@enact/ui 4.5.2 → 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 +30 -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 +29 -63
- 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
|
@@ -9,19 +9,12 @@ var _exportNames = {
|
|
|
9
9
|
ViewManagerDecorator: true
|
|
10
10
|
};
|
|
11
11
|
exports["default"] = exports.ViewManagerDecorator = exports.ViewManagerBase = exports.ViewManager = void 0;
|
|
12
|
-
|
|
13
12
|
var _propTypes = _interopRequireDefault(require("@enact/core/internal/prop-types"));
|
|
14
|
-
|
|
15
13
|
var _handle = _interopRequireWildcard(require("@enact/core/handle"));
|
|
16
|
-
|
|
17
14
|
var _propTypes2 = _interopRequireDefault(require("prop-types"));
|
|
18
|
-
|
|
19
15
|
var _react = require("react");
|
|
20
|
-
|
|
21
16
|
var _ForwardRef = _interopRequireDefault(require("../ForwardRef"));
|
|
22
|
-
|
|
23
17
|
var _Arranger = require("./Arranger");
|
|
24
|
-
|
|
25
18
|
Object.keys(_Arranger).forEach(function (key) {
|
|
26
19
|
if (key === "default" || key === "__esModule") return;
|
|
27
20
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -33,56 +26,32 @@ Object.keys(_Arranger).forEach(function (key) {
|
|
|
33
26
|
}
|
|
34
27
|
});
|
|
35
28
|
});
|
|
36
|
-
|
|
37
29
|
var _TransitionGroup = _interopRequireDefault(require("./TransitionGroup"));
|
|
38
|
-
|
|
39
30
|
var _View = require("./View");
|
|
40
|
-
|
|
41
31
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
42
|
-
|
|
43
32
|
var _excluded = ["arranger", "childProps", "children", "duration", "index", "noAnimation", "enteringDelay", "enteringProp", "rtl"];
|
|
44
|
-
|
|
45
33
|
var _class;
|
|
46
|
-
|
|
47
34
|
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); }
|
|
48
|
-
|
|
49
35
|
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; }
|
|
50
|
-
|
|
51
36
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
52
|
-
|
|
53
37
|
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; }
|
|
54
|
-
|
|
55
38
|
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; }
|
|
56
|
-
|
|
57
39
|
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; }
|
|
58
|
-
|
|
59
40
|
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; }
|
|
60
|
-
|
|
61
41
|
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; }
|
|
62
|
-
|
|
63
42
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
64
|
-
|
|
65
43
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
66
|
-
|
|
67
44
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
68
|
-
|
|
69
45
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
70
|
-
|
|
71
46
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
72
|
-
|
|
73
47
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
74
|
-
|
|
75
48
|
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
76
|
-
|
|
77
49
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
78
|
-
|
|
79
50
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
80
|
-
|
|
81
51
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
82
|
-
|
|
83
52
|
/**
|
|
84
53
|
* The base `ViewManager` component, without
|
|
85
|
-
*
|
|
54
|
+
* {@link ui/ViewManager.ViewManagerDecorator|ViewManagerDecorator} applied.
|
|
86
55
|
*
|
|
87
56
|
* @class ViewManagerBase
|
|
88
57
|
* @memberof ui/ViewManager
|
|
@@ -91,23 +60,17 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
|
91
60
|
*/
|
|
92
61
|
var ViewManagerBase = (_class = /*#__PURE__*/function (_Component) {
|
|
93
62
|
_inherits(ViewManagerBase, _Component);
|
|
94
|
-
|
|
95
63
|
var _super = _createSuper(ViewManagerBase);
|
|
96
|
-
|
|
97
64
|
function ViewManagerBase(props) {
|
|
98
65
|
var _this;
|
|
99
|
-
|
|
100
66
|
_classCallCheck(this, ViewManagerBase);
|
|
101
|
-
|
|
102
67
|
_this = _super.call(this, props);
|
|
103
|
-
|
|
104
68
|
_this.makeTransitionEvent = function () {
|
|
105
69
|
return {
|
|
106
70
|
index: _this.props.index,
|
|
107
71
|
previousIndex: _this.state.prevIndex
|
|
108
72
|
};
|
|
109
73
|
};
|
|
110
|
-
|
|
111
74
|
_this.handleTransition = (0, _handle["default"])((0, _handle.forwardCustom)('onTransition', _this.makeTransitionEvent)).bindAs(_assertThisInitialized(_this), 'handleTransition');
|
|
112
75
|
_this.handleWillTransition = (0, _handle["default"])((0, _handle.forwardCustom)('onWillTransition', _this.makeTransitionEvent)).bindAs(_assertThisInitialized(_this), 'handleWillTransition');
|
|
113
76
|
_this.state = {
|
|
@@ -116,33 +79,29 @@ var ViewManagerBase = (_class = /*#__PURE__*/function (_Component) {
|
|
|
116
79
|
};
|
|
117
80
|
return _this;
|
|
118
81
|
}
|
|
119
|
-
|
|
120
82
|
_createClass(ViewManagerBase, [{
|
|
121
83
|
key: "render",
|
|
122
84
|
value: function render() {
|
|
123
85
|
var _this$props = this.props,
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
86
|
+
arranger = _this$props.arranger,
|
|
87
|
+
childProps = _this$props.childProps,
|
|
88
|
+
children = _this$props.children,
|
|
89
|
+
duration = _this$props.duration,
|
|
90
|
+
index = _this$props.index,
|
|
91
|
+
noAnimation = _this$props.noAnimation,
|
|
92
|
+
enteringDelay = _this$props.enteringDelay,
|
|
93
|
+
enteringProp = _this$props.enteringProp,
|
|
94
|
+
rtl = _this$props.rtl,
|
|
95
|
+
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
135
96
|
var _this$props2 = this.props,
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
97
|
+
_this$props2$end = _this$props2.end,
|
|
98
|
+
end = _this$props2$end === void 0 ? index : _this$props2$end,
|
|
99
|
+
_this$props2$start = _this$props2.start,
|
|
100
|
+
start = _this$props2$start === void 0 ? index : _this$props2$start;
|
|
140
101
|
var _this$state = this.state,
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
102
|
+
previousIndex = _this$state.prevIndex,
|
|
103
|
+
reverseTransition = _this$state.reverseTransition;
|
|
144
104
|
var childrenList = _react.Children.toArray(children);
|
|
145
|
-
|
|
146
105
|
if (index > end) end = index;
|
|
147
106
|
if (index < start) start = index;
|
|
148
107
|
var childCount = end - start + 1;
|
|
@@ -186,22 +145,17 @@ var ViewManagerBase = (_class = /*#__PURE__*/function (_Component) {
|
|
|
186
145
|
reverseTransition: state.index > props.index
|
|
187
146
|
};
|
|
188
147
|
}
|
|
189
|
-
|
|
190
148
|
return null;
|
|
191
149
|
}
|
|
192
150
|
}]);
|
|
193
|
-
|
|
194
151
|
return ViewManagerBase;
|
|
195
|
-
}(_react.Component), _class.displayName = 'ViewManager', _class.propTypes =
|
|
196
|
-
/** @lends ui/ViewManager.ViewManagerBase.prototype */
|
|
197
|
-
{
|
|
152
|
+
}(_react.Component), _class.displayName = 'ViewManager', _class.propTypes = /** @lends ui/ViewManager.ViewManagerBase.prototype */{
|
|
198
153
|
/**
|
|
199
154
|
* Arranger to control the animation
|
|
200
155
|
*
|
|
201
156
|
* @type {Arranger}
|
|
202
157
|
*/
|
|
203
158
|
arranger: _Arranger.shape,
|
|
204
|
-
|
|
205
159
|
/**
|
|
206
160
|
* An object containing properties to be passed to each child.
|
|
207
161
|
*
|
|
@@ -209,7 +163,6 @@ var ViewManagerBase = (_class = /*#__PURE__*/function (_Component) {
|
|
|
209
163
|
* @public
|
|
210
164
|
*/
|
|
211
165
|
childProps: _propTypes2["default"].object,
|
|
212
|
-
|
|
213
166
|
/**
|
|
214
167
|
* Views to be managed.
|
|
215
168
|
*
|
|
@@ -218,7 +171,6 @@ var ViewManagerBase = (_class = /*#__PURE__*/function (_Component) {
|
|
|
218
171
|
* @type {Node}
|
|
219
172
|
*/
|
|
220
173
|
children: _propTypes2["default"].node,
|
|
221
|
-
|
|
222
174
|
/**
|
|
223
175
|
* Type of component wrapping the children. May be a DOM node or a custom React component.
|
|
224
176
|
*
|
|
@@ -226,7 +178,6 @@ var ViewManagerBase = (_class = /*#__PURE__*/function (_Component) {
|
|
|
226
178
|
* @default 'div'
|
|
227
179
|
*/
|
|
228
180
|
component: _propTypes["default"].renderable,
|
|
229
|
-
|
|
230
181
|
/**
|
|
231
182
|
* Called with a reference to the root component.
|
|
232
183
|
*
|
|
@@ -237,7 +188,6 @@ var ViewManagerBase = (_class = /*#__PURE__*/function (_Component) {
|
|
|
237
188
|
* @public
|
|
238
189
|
*/
|
|
239
190
|
componentRef: _propTypes["default"].ref,
|
|
240
|
-
|
|
241
191
|
/**
|
|
242
192
|
* Time in milliseconds to complete a transition
|
|
243
193
|
*
|
|
@@ -245,7 +195,6 @@ var ViewManagerBase = (_class = /*#__PURE__*/function (_Component) {
|
|
|
245
195
|
* @default 300
|
|
246
196
|
*/
|
|
247
197
|
duration: _propTypes2["default"].number,
|
|
248
|
-
|
|
249
198
|
/**
|
|
250
199
|
* Index of last visible view.
|
|
251
200
|
*
|
|
@@ -255,7 +204,6 @@ var ViewManagerBase = (_class = /*#__PURE__*/function (_Component) {
|
|
|
255
204
|
* @default value of index
|
|
256
205
|
*/
|
|
257
206
|
end: _propTypes2["default"].number,
|
|
258
|
-
|
|
259
207
|
/**
|
|
260
208
|
* Time, in milliseconds, to wait after a view has entered to inform it by pass the
|
|
261
209
|
* `enteringProp` as false.
|
|
@@ -264,7 +212,6 @@ var ViewManagerBase = (_class = /*#__PURE__*/function (_Component) {
|
|
|
264
212
|
* @default 0
|
|
265
213
|
*/
|
|
266
214
|
enteringDelay: _propTypes2["default"].number,
|
|
267
|
-
|
|
268
215
|
/**
|
|
269
216
|
* Name of the property to pass to the wrapped view to indicate when it is entering the
|
|
270
217
|
* viewport.
|
|
@@ -278,7 +225,6 @@ var ViewManagerBase = (_class = /*#__PURE__*/function (_Component) {
|
|
|
278
225
|
* @type {String}
|
|
279
226
|
*/
|
|
280
227
|
enteringProp: _propTypes2["default"].string,
|
|
281
|
-
|
|
282
228
|
/**
|
|
283
229
|
* Index of active view
|
|
284
230
|
*
|
|
@@ -286,7 +232,6 @@ var ViewManagerBase = (_class = /*#__PURE__*/function (_Component) {
|
|
|
286
232
|
* @default 0
|
|
287
233
|
*/
|
|
288
234
|
index: _propTypes2["default"].number,
|
|
289
|
-
|
|
290
235
|
/**
|
|
291
236
|
* Indicates if the transition should be animated
|
|
292
237
|
*
|
|
@@ -294,49 +239,42 @@ var ViewManagerBase = (_class = /*#__PURE__*/function (_Component) {
|
|
|
294
239
|
* @default false
|
|
295
240
|
*/
|
|
296
241
|
noAnimation: _propTypes2["default"].bool,
|
|
297
|
-
|
|
298
242
|
/**
|
|
299
243
|
* Called when each view is rendered during initial construction.
|
|
300
244
|
*
|
|
301
245
|
* @type {Function}
|
|
302
246
|
*/
|
|
303
247
|
onAppear: _propTypes2["default"].func,
|
|
304
|
-
|
|
305
248
|
/**
|
|
306
249
|
* Called when each view completes its transition into the viewport.
|
|
307
250
|
*
|
|
308
251
|
* @type {Function}
|
|
309
252
|
*/
|
|
310
253
|
onEnter: _propTypes2["default"].func,
|
|
311
|
-
|
|
312
254
|
/**
|
|
313
255
|
* Called when each view completes its transition out of the viewport.
|
|
314
256
|
*
|
|
315
257
|
* @type {Function}
|
|
316
258
|
*/
|
|
317
259
|
onLeave: _propTypes2["default"].func,
|
|
318
|
-
|
|
319
260
|
/**
|
|
320
261
|
* Called when each view completes its transition within the viewport.
|
|
321
262
|
*
|
|
322
263
|
* @type {Function}
|
|
323
264
|
*/
|
|
324
265
|
onStay: _propTypes2["default"].func,
|
|
325
|
-
|
|
326
266
|
/**
|
|
327
267
|
* Called once when all views have completed their transition.
|
|
328
268
|
*
|
|
329
269
|
* @type {Function}
|
|
330
270
|
*/
|
|
331
271
|
onTransition: _propTypes2["default"].func,
|
|
332
|
-
|
|
333
272
|
/**
|
|
334
273
|
* Called once before views begin their transition.
|
|
335
274
|
*
|
|
336
275
|
* @type {Function}
|
|
337
276
|
*/
|
|
338
277
|
onWillTransition: _propTypes2["default"].func,
|
|
339
|
-
|
|
340
278
|
/**
|
|
341
279
|
* Explicitly sets the transition direction.
|
|
342
280
|
*
|
|
@@ -346,7 +284,6 @@ var ViewManagerBase = (_class = /*#__PURE__*/function (_Component) {
|
|
|
346
284
|
* @type {Boolean}
|
|
347
285
|
*/
|
|
348
286
|
reverseTransition: _propTypes2["default"].bool,
|
|
349
|
-
|
|
350
287
|
/**
|
|
351
288
|
* Indicates the current locale uses right-to-left reading order.
|
|
352
289
|
*
|
|
@@ -356,7 +293,6 @@ var ViewManagerBase = (_class = /*#__PURE__*/function (_Component) {
|
|
|
356
293
|
* @type {Boolean}
|
|
357
294
|
*/
|
|
358
295
|
rtl: _propTypes2["default"].bool,
|
|
359
|
-
|
|
360
296
|
/**
|
|
361
297
|
* Index of first visible view. Defaults to the current value of `index`.
|
|
362
298
|
*
|
|
@@ -369,6 +305,7 @@ var ViewManagerBase = (_class = /*#__PURE__*/function (_Component) {
|
|
|
369
305
|
duration: 300,
|
|
370
306
|
index: 0
|
|
371
307
|
}, _class);
|
|
308
|
+
|
|
372
309
|
/**
|
|
373
310
|
* Applies ViewManager behaviors.
|
|
374
311
|
*
|
|
@@ -377,11 +314,11 @@ var ViewManagerBase = (_class = /*#__PURE__*/function (_Component) {
|
|
|
377
314
|
* @mixes ui/ForwardRef.ForwardRef
|
|
378
315
|
* @public
|
|
379
316
|
*/
|
|
380
|
-
|
|
381
317
|
exports.ViewManagerBase = ViewManagerBase;
|
|
382
318
|
var ViewManagerDecorator = (0, _ForwardRef["default"])({
|
|
383
319
|
prop: 'componentRef'
|
|
384
320
|
});
|
|
321
|
+
|
|
385
322
|
/**
|
|
386
323
|
* A `ViewManager` controls the visibility of a configurable number of views, allowing for them to be
|
|
387
324
|
* transitioned on and off the viewport.
|
|
@@ -394,7 +331,6 @@ var ViewManagerDecorator = (0, _ForwardRef["default"])({
|
|
|
394
331
|
* @ui
|
|
395
332
|
* @public
|
|
396
333
|
*/
|
|
397
|
-
|
|
398
334
|
exports.ViewManagerDecorator = ViewManagerDecorator;
|
|
399
335
|
var ViewManager = ViewManagerDecorator(ViewManagerBase);
|
|
400
336
|
exports.ViewManager = ViewManager;
|
|
@@ -1,19 +1,12 @@
|
|
|
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 _react2 = require("react");
|
|
8
|
-
|
|
9
6
|
var _testUtils = require("./test-utils");
|
|
10
|
-
|
|
11
7
|
var _View = _interopRequireDefault(require("../View"));
|
|
12
|
-
|
|
13
8
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
-
|
|
15
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
16
|
-
|
|
17
10
|
describe('View', function () {
|
|
18
11
|
test('should render its child when neither enteringProp or childProps is specified', function () {
|
|
19
12
|
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_View["default"], {
|
|
@@ -22,9 +15,7 @@ describe('View', function () {
|
|
|
22
15
|
"data-testid": "span"
|
|
23
16
|
})
|
|
24
17
|
}));
|
|
25
|
-
|
|
26
18
|
var actual = _react.screen.getByTestId('span');
|
|
27
|
-
|
|
28
19
|
expect(actual).toBeInTheDocument();
|
|
29
20
|
});
|
|
30
21
|
test('should pass the value of entering to its child in enteringProp', function () {
|
|
@@ -36,9 +27,7 @@ describe('View', function () {
|
|
|
36
27
|
})
|
|
37
28
|
}));
|
|
38
29
|
var expected = 'true';
|
|
39
|
-
|
|
40
30
|
var actual = _react.screen.getByTestId('span');
|
|
41
|
-
|
|
42
31
|
expect(actual).toHaveAttribute('data-entering', expected);
|
|
43
32
|
});
|
|
44
33
|
test('should pass enteringProp as false for an appearing view', function () {
|
|
@@ -52,9 +41,7 @@ describe('View', function () {
|
|
|
52
41
|
"data-testid": "span"
|
|
53
42
|
})
|
|
54
43
|
}));
|
|
55
|
-
|
|
56
44
|
var actual = _react.screen.getByTestId('span');
|
|
57
|
-
|
|
58
45
|
expect(actual).toHaveAttribute('data-entering', 'false');
|
|
59
46
|
});
|
|
60
47
|
describe('imperative API without arranger', function () {
|
|
@@ -116,17 +103,13 @@ describe('View', function () {
|
|
|
116
103
|
return ref.current.componentDidAppear(spy);
|
|
117
104
|
});
|
|
118
105
|
var firstExpected = 'false';
|
|
119
|
-
|
|
120
106
|
var firstSpan = _react.screen.getByTestId('span');
|
|
121
|
-
|
|
122
107
|
expect(firstSpan).toHaveAttribute('data-entering', firstExpected);
|
|
123
108
|
(0, _react.act)(function () {
|
|
124
109
|
return ref.current.componentWillEnter(spy);
|
|
125
110
|
});
|
|
126
111
|
var secondExpected = 'true';
|
|
127
|
-
|
|
128
112
|
var secondSpan = _react.screen.getByTestId('span');
|
|
129
|
-
|
|
130
113
|
expect(secondSpan).toHaveAttribute('data-entering', secondExpected);
|
|
131
114
|
});
|
|
132
115
|
});
|