@enact/ui 4.5.2 → 4.6.1
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 +8 -28
- package/BodyText/tests/BodyText-specs.js +0 -19
- package/Button/Button.js +33 -63
- package/Button/tests/Button-specs.js +0 -26
- package/CHANGELOG.md +45 -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/package.json +3 -0
- 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 +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.js +19 -53
- package/Icon/tests/Icon-specs.js +0 -22
- package/IconButton/IconButton.js +24 -57
- 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.js +22 -53
- package/LabeledIcon/tests/LabeledIcon-specs.js +0 -14
- package/Layout/Cell.js +18 -44
- 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 +7 -29
- package/RadioDecorator/RadioDecorator.js +9 -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.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 +37 -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.js +29 -67
- package/Slider/tests/Slider-specs.js +94 -7
- package/Slider/utils.js +0 -2
- package/SlotItem/SlotItem.js +23 -45
- 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 +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.js +24 -57
- 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/Pinch.js +185 -0
- package/Touchable/Touch.js +71 -76
- package/Touchable/Touchable.js +95 -75
- package/Touchable/config.js +27 -24
- package/Touchable/tests/Touchable-specs.js +360 -119
- package/Touchable/tests/useTouch-specs.js +6 -80
- package/Touchable/useTouch.js +57 -65
- 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.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 +265 -409
- 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/AnnounceDecorator/AnnounceDecorator.d.ts +0 -64
- package/BodyText/BodyText.d.ts +0 -66
- package/Button/Button.d.ts +0 -125
- package/Cancelable/Cancelable.d.ts +0 -64
- package/Changeable/Changeable.d.ts +0 -54
- package/ComponentOverride/ComponentOverride.d.ts +0 -52
- package/ForwardRef/ForwardRef.d.ts +0 -22
- package/GridListImageItem/GridListImageItem.d.ts +0 -85
- package/Group/Group.d.ts +0 -107
- package/Heading/Heading.d.ts +0 -90
- package/Icon/Icon.d.ts +0 -88
- package/IconButton/IconButton.d.ts +0 -115
- package/Image/Image.d.ts +0 -113
- package/ImageItem/ImageItem.d.ts +0 -83
- package/Item/Item.d.ts +0 -64
- package/LabeledIcon/LabeledIcon.d.ts +0 -130
- package/Layout/Layout.d.ts +0 -247
- package/Marquee/index.d.ts +0 -258
- package/Measurable/Measurable.d.ts +0 -26
- package/Media/Media.d.ts +0 -99
- package/Placeholder/index.d.ts +0 -53
- package/ProgressBar/ProgressBar.d.ts +0 -92
- package/RadioDecorator/RadioDecorator.d.ts +0 -35
- package/Repeater/Repeater.d.ts +0 -83
- package/Resizable/Resizable.d.ts +0 -31
- package/Routable/Routable.d.ts +0 -148
- package/Scrollable/Scrollable.d.ts +0 -0
- package/Scroller/Scroller.d.ts +0 -276
- package/Skinnable/Skinnable.d.ts +0 -94
- package/Slider/Slider.d.ts +0 -202
- package/SlotItem/SlotItem.d.ts +0 -118
- package/Slottable/Slottable.d.ts +0 -22
- package/Spinner/Spinner.d.ts +0 -95
- package/ToggleIcon/ToggleIcon.d.ts +0 -90
- package/ToggleItem/ToggleItem.d.ts +0 -134
- package/Toggleable/Toggleable.d.ts +0 -103
- package/Touchable/Touchable.d.ts +0 -175
- package/Transition/Transition.d.ts +0 -196
- package/ViewManager/ViewManager.d.ts +0 -191
- package/VirtualList/VirtualList.d.ts +0 -530
- package/index.d.ts +0 -0
- package/internal/IdProvider/IdProvider.d.ts +0 -0
- package/internal/Pure/Pure.d.ts +0 -0
- package/internal/localized-fonts/localized-fonts.d.ts +0 -53
- package/internal/selection/selection.d.ts +0 -0
- package/internal/validators/validators.d.ts +0 -0
- package/resolution/index.d.ts +0 -187
- package/useControlledState/useControlledState.d.ts +0 -0
- package/useScroll/useScroll.d.ts +0 -0
package/Transition/Transition.js
CHANGED
|
@@ -4,60 +4,33 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = exports.TransitionBase = exports.Transition = void 0;
|
|
7
|
-
|
|
8
7
|
var _handle = require("@enact/core/handle");
|
|
9
|
-
|
|
10
8
|
var _propTypes = _interopRequireDefault(require("@enact/core/internal/prop-types"));
|
|
11
|
-
|
|
12
9
|
var _kind = _interopRequireDefault(require("@enact/core/kind"));
|
|
13
|
-
|
|
14
10
|
var _util = require("@enact/core/util");
|
|
15
|
-
|
|
16
11
|
var _react = require("react");
|
|
17
|
-
|
|
18
12
|
var _propTypes2 = _interopRequireDefault(require("prop-types"));
|
|
19
|
-
|
|
20
13
|
var _Resizable = require("../Resizable");
|
|
21
|
-
|
|
22
14
|
var _TransitionModule = _interopRequireDefault(require("./Transition.module.css"));
|
|
23
|
-
|
|
24
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
|
-
|
|
26
16
|
var _excluded = ["css", "childRef", "children", "innerStyle"],
|
|
27
|
-
|
|
28
|
-
|
|
17
|
+
_excluded2 = ["visible"];
|
|
29
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
30
|
-
|
|
31
19
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
32
|
-
|
|
33
20
|
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); } }
|
|
34
|
-
|
|
35
21
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
36
|
-
|
|
37
22
|
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); }
|
|
38
|
-
|
|
39
23
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
40
|
-
|
|
41
24
|
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); }; }
|
|
42
|
-
|
|
43
25
|
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); }
|
|
44
|
-
|
|
45
26
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
46
|
-
|
|
47
27
|
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; } }
|
|
48
|
-
|
|
49
28
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
50
|
-
|
|
51
29
|
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; }
|
|
52
|
-
|
|
53
30
|
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; }
|
|
54
|
-
|
|
55
31
|
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; }
|
|
56
|
-
|
|
57
32
|
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; }
|
|
58
|
-
|
|
59
33
|
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; }
|
|
60
|
-
|
|
61
34
|
var formatter = function formatter(duration) {
|
|
62
35
|
return typeof duration === 'number' ? duration + 'ms' : duration;
|
|
63
36
|
};
|
|
@@ -72,13 +45,9 @@ var formatter = function formatter(duration) {
|
|
|
72
45
|
* @memberof ui/Transition
|
|
73
46
|
* @public
|
|
74
47
|
*/
|
|
75
|
-
|
|
76
|
-
|
|
77
48
|
var TransitionBase = (0, _kind["default"])({
|
|
78
49
|
name: 'TransitionBase',
|
|
79
|
-
propTypes:
|
|
80
|
-
/** @lends ui/Transition.TransitionBase.prototype */
|
|
81
|
-
{
|
|
50
|
+
propTypes: /** @lends ui/Transition.TransitionBase.prototype */{
|
|
82
51
|
/**
|
|
83
52
|
* Provide a function to get the reference to the child node (the one with the content) at
|
|
84
53
|
* render time.
|
|
@@ -90,7 +59,6 @@ var TransitionBase = (0, _kind["default"])({
|
|
|
90
59
|
* @public
|
|
91
60
|
*/
|
|
92
61
|
childRef: _propTypes["default"].ref,
|
|
93
|
-
|
|
94
62
|
/**
|
|
95
63
|
* The node to be transitioned.
|
|
96
64
|
*
|
|
@@ -98,7 +66,6 @@ var TransitionBase = (0, _kind["default"])({
|
|
|
98
66
|
* @public
|
|
99
67
|
*/
|
|
100
68
|
children: _propTypes2["default"].node,
|
|
101
|
-
|
|
102
69
|
/**
|
|
103
70
|
* The height of the transition when `type` is set to `'clip'`, used when direction is
|
|
104
71
|
* 'left' or 'right'.
|
|
@@ -108,7 +75,6 @@ var TransitionBase = (0, _kind["default"])({
|
|
|
108
75
|
* @public
|
|
109
76
|
*/
|
|
110
77
|
clipHeight: _propTypes2["default"].number,
|
|
111
|
-
|
|
112
78
|
/**
|
|
113
79
|
* The width of the transition when `type` is set to `'clip'`, used when direction is 'left'
|
|
114
80
|
* or 'right'.
|
|
@@ -118,7 +84,6 @@ var TransitionBase = (0, _kind["default"])({
|
|
|
118
84
|
* @public
|
|
119
85
|
*/
|
|
120
86
|
clipWidth: _propTypes2["default"].number,
|
|
121
|
-
|
|
122
87
|
/**
|
|
123
88
|
* Customizes the component by mapping the supplied collection of CSS class names to the
|
|
124
89
|
* corresponding internal elements and states of this component.
|
|
@@ -151,7 +116,6 @@ var TransitionBase = (0, _kind["default"])({
|
|
|
151
116
|
* @public
|
|
152
117
|
*/
|
|
153
118
|
css: _propTypes2["default"].object,
|
|
154
|
-
|
|
155
119
|
/**
|
|
156
120
|
* Sets the direction of transition. Where the component will move *to*; the destination.
|
|
157
121
|
* Supported directions are: `'up'`, `'right'`, `'down'`, `'left'`.
|
|
@@ -161,7 +125,6 @@ var TransitionBase = (0, _kind["default"])({
|
|
|
161
125
|
* @public
|
|
162
126
|
*/
|
|
163
127
|
direction: _propTypes2["default"].oneOf(['up', 'right', 'down', 'left']),
|
|
164
|
-
|
|
165
128
|
/**
|
|
166
129
|
* Controls how long the transition should take.
|
|
167
130
|
* Supported preset durations are: `'short'` (250ms), `'medium'` (500ms), and `'long'` (1s).
|
|
@@ -174,7 +137,6 @@ var TransitionBase = (0, _kind["default"])({
|
|
|
174
137
|
* @public
|
|
175
138
|
*/
|
|
176
139
|
duration: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].number]),
|
|
177
|
-
|
|
178
140
|
/**
|
|
179
141
|
* Disables transition animation.
|
|
180
142
|
*
|
|
@@ -185,7 +147,6 @@ var TransitionBase = (0, _kind["default"])({
|
|
|
185
147
|
* @public
|
|
186
148
|
*/
|
|
187
149
|
noAnimation: _propTypes2["default"].bool,
|
|
188
|
-
|
|
189
150
|
/**
|
|
190
151
|
* The transition timing function.
|
|
191
152
|
*
|
|
@@ -197,7 +158,6 @@ var TransitionBase = (0, _kind["default"])({
|
|
|
197
158
|
* @public
|
|
198
159
|
*/
|
|
199
160
|
timingFunction: _propTypes2["default"].oneOf(['ease', 'ease-in', 'ease-out', 'ease-in-out', 'ease-in-quart', 'ease-out-quart', 'linear']),
|
|
200
|
-
|
|
201
161
|
/**
|
|
202
162
|
* The type of transition to affect the content.
|
|
203
163
|
*
|
|
@@ -224,7 +184,6 @@ var TransitionBase = (0, _kind["default"])({
|
|
|
224
184
|
* @public
|
|
225
185
|
*/
|
|
226
186
|
type: _propTypes2["default"].oneOf(['slide', 'clip', 'fade']),
|
|
227
|
-
|
|
228
187
|
/**
|
|
229
188
|
* Sets the visibility of the component, which determines whether it's on screen or off.
|
|
230
189
|
*
|
|
@@ -250,67 +209,60 @@ var TransitionBase = (0, _kind["default"])({
|
|
|
250
209
|
computed: {
|
|
251
210
|
className: function className(_ref) {
|
|
252
211
|
var css = _ref.css,
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
212
|
+
direction = _ref.direction,
|
|
213
|
+
duration = _ref.duration,
|
|
214
|
+
noAnimation = _ref.noAnimation,
|
|
215
|
+
timingFunction = _ref.timingFunction,
|
|
216
|
+
type = _ref.type,
|
|
217
|
+
visible = _ref.visible,
|
|
218
|
+
styler = _ref.styler;
|
|
260
219
|
return styler.append(visible ? 'shown' : 'hidden', direction && css[direction], !noAnimation && duration && css[duration], !noAnimation && timingFunction && css[timingFunction], css[type]);
|
|
261
220
|
},
|
|
262
221
|
innerStyle: function innerStyle(_ref2) {
|
|
263
222
|
var clipWidth = _ref2.clipWidth,
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
223
|
+
css = _ref2.css,
|
|
224
|
+
direction = _ref2.direction,
|
|
225
|
+
duration = _ref2.duration,
|
|
226
|
+
type = _ref2.type;
|
|
268
227
|
var style = {};
|
|
269
|
-
|
|
270
228
|
if (type === 'clip' && (direction === 'left' || direction === 'right')) {
|
|
271
229
|
style.width = clipWidth;
|
|
272
230
|
} else if ((type === 'fade' || type === 'slide') && duration && !css[duration]) {
|
|
273
231
|
// If it's a number, assume it's miliseconds, if not, assume it's already a CSS duration string (like "200ms" or "2s")
|
|
274
232
|
style.transitionDuration = formatter(duration);
|
|
275
233
|
}
|
|
276
|
-
|
|
277
234
|
return style;
|
|
278
235
|
},
|
|
279
236
|
style: function style(_ref3) {
|
|
280
237
|
var clipHeight = _ref3.clipHeight,
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
238
|
+
css = _ref3.css,
|
|
239
|
+
direction = _ref3.direction,
|
|
240
|
+
duration = _ref3.duration,
|
|
241
|
+
type = _ref3.type,
|
|
242
|
+
visible = _ref3.visible,
|
|
243
|
+
_style = _ref3.style;
|
|
288
244
|
if (type === 'clip') {
|
|
289
245
|
_style = _objectSpread(_objectSpread({}, _style), {}, {
|
|
290
246
|
overflow: 'hidden'
|
|
291
247
|
});
|
|
292
|
-
|
|
293
248
|
if (visible && (direction === 'up' || direction === 'down')) {
|
|
294
249
|
_style.height = clipHeight;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
|
|
250
|
+
}
|
|
251
|
+
// If duration isn't a known named string, assume it is a CSS duration value
|
|
298
252
|
if (duration && !css[duration]) {
|
|
299
253
|
// If it's a number, assume it's miliseconds, if not, assume it's already a CSS duration string (like "200ms" or "2s")
|
|
300
254
|
_style.transitionDuration = formatter(duration);
|
|
301
255
|
}
|
|
302
256
|
}
|
|
303
|
-
|
|
304
257
|
return _style;
|
|
305
258
|
}
|
|
306
259
|
},
|
|
307
260
|
render: function render(_ref4) {
|
|
308
261
|
var css = _ref4.css,
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
262
|
+
childRef = _ref4.childRef,
|
|
263
|
+
children = _ref4.children,
|
|
264
|
+
innerStyle = _ref4.innerStyle,
|
|
265
|
+
rest = _objectWithoutProperties(_ref4, _excluded);
|
|
314
266
|
delete rest.clipHeight;
|
|
315
267
|
delete rest.clipWidth;
|
|
316
268
|
delete rest.direction;
|
|
@@ -336,8 +288,8 @@ var TRANSITION_STATE = {
|
|
|
336
288
|
MEASURE: 1,
|
|
337
289
|
// open but need to measure
|
|
338
290
|
READY: 2 // measured and ready
|
|
339
|
-
|
|
340
291
|
};
|
|
292
|
+
|
|
341
293
|
/**
|
|
342
294
|
* A stateful component that allows for applying transitions to its child items via configurable
|
|
343
295
|
* properties and events.
|
|
@@ -347,24 +299,18 @@ var TRANSITION_STATE = {
|
|
|
347
299
|
* @memberof ui/Transition
|
|
348
300
|
* @public
|
|
349
301
|
*/
|
|
350
|
-
|
|
351
302
|
var Transition = /*#__PURE__*/function (_Component) {
|
|
352
303
|
_inherits(Transition, _Component);
|
|
353
|
-
|
|
354
304
|
var _super = _createSuper(Transition);
|
|
355
|
-
|
|
356
305
|
function Transition(props) {
|
|
357
306
|
var _this;
|
|
358
|
-
|
|
359
307
|
_classCallCheck(this, Transition);
|
|
360
|
-
|
|
361
308
|
_this = _super.call(this, props);
|
|
362
309
|
_this.measuringJob = new _util.Job(function () {
|
|
363
310
|
_this.setState({
|
|
364
311
|
renderState: TRANSITION_STATE.MEASURE
|
|
365
312
|
});
|
|
366
313
|
});
|
|
367
|
-
|
|
368
314
|
_this.handleResize = function () {
|
|
369
315
|
// @TODO oddly, using the setState callback is required here to ensure that the bounds
|
|
370
316
|
// are remeasured in a separate tick
|
|
@@ -372,10 +318,8 @@ var Transition = /*#__PURE__*/function (_Component) {
|
|
|
372
318
|
initialHeight: null
|
|
373
319
|
}, _this.measureInner);
|
|
374
320
|
};
|
|
375
|
-
|
|
376
321
|
_this.handleTransitionEnd = function (ev) {
|
|
377
322
|
(0, _handle.forward)('onTransitionEnd', ev, _this.props);
|
|
378
|
-
|
|
379
323
|
if (ev.target === _this.childNode) {
|
|
380
324
|
if (!_this.props.visible) {
|
|
381
325
|
(0, _handle.forward)('onHide', {
|
|
@@ -390,12 +334,10 @@ var Transition = /*#__PURE__*/function (_Component) {
|
|
|
390
334
|
}
|
|
391
335
|
}
|
|
392
336
|
};
|
|
393
|
-
|
|
394
337
|
_this.measureInner = function () {
|
|
395
338
|
if (_this.childNode) {
|
|
396
339
|
var initialHeight = _this.childNode.scrollHeight;
|
|
397
340
|
var initialWidth = _this.childNode.scrollWidth;
|
|
398
|
-
|
|
399
341
|
if (initialHeight !== _this.state.initialHeight || initialWidth !== _this.state.initialWidth) {
|
|
400
342
|
_this.setState({
|
|
401
343
|
initialHeight: initialHeight,
|
|
@@ -405,11 +347,9 @@ var Transition = /*#__PURE__*/function (_Component) {
|
|
|
405
347
|
}
|
|
406
348
|
}
|
|
407
349
|
};
|
|
408
|
-
|
|
409
350
|
_this.childRef = function (node) {
|
|
410
351
|
_this.childNode = node;
|
|
411
352
|
};
|
|
412
|
-
|
|
413
353
|
_this.state = {
|
|
414
354
|
initialHeight: null,
|
|
415
355
|
initialWidth: null,
|
|
@@ -419,7 +359,6 @@ var Transition = /*#__PURE__*/function (_Component) {
|
|
|
419
359
|
_this.resizeRegistry = null;
|
|
420
360
|
return _this;
|
|
421
361
|
}
|
|
422
|
-
|
|
423
362
|
_createClass(Transition, [{
|
|
424
363
|
key: "componentDidMount",
|
|
425
364
|
value: function componentDidMount() {
|
|
@@ -428,7 +367,6 @@ var Transition = /*#__PURE__*/function (_Component) {
|
|
|
428
367
|
} else {
|
|
429
368
|
this.measureInner();
|
|
430
369
|
}
|
|
431
|
-
|
|
432
370
|
if (this.context && typeof this.context === 'function') {
|
|
433
371
|
this.resizeRegistry = this.context(this.handleResize);
|
|
434
372
|
}
|
|
@@ -443,22 +381,20 @@ var Transition = /*#__PURE__*/function (_Component) {
|
|
|
443
381
|
key: "componentDidUpdate",
|
|
444
382
|
value: function componentDidUpdate(prevProps, prevState) {
|
|
445
383
|
var _this$props = this.props,
|
|
446
|
-
|
|
447
|
-
|
|
384
|
+
noAnimation = _this$props.noAnimation,
|
|
385
|
+
visible = _this$props.visible;
|
|
448
386
|
var _this$state = this.state,
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
387
|
+
initialHeight = _this$state.initialHeight,
|
|
388
|
+
renderState = _this$state.renderState;
|
|
452
389
|
if (this.state.renderState === TRANSITION_STATE.MEASURE) {
|
|
453
390
|
this.measuringJob.stop();
|
|
454
|
-
}
|
|
455
|
-
// or the initialHeight state or checking if component should be visible but doesn't have a height
|
|
456
|
-
|
|
391
|
+
}
|
|
457
392
|
|
|
393
|
+
// Checking that something changed that wasn't the visibility
|
|
394
|
+
// or the initialHeight state or checking if component should be visible but doesn't have a height
|
|
458
395
|
if (visible === prevProps.visible && initialHeight === prevState.initialHeight && renderState !== TRANSITION_STATE.INIT || initialHeight == null && visible) {
|
|
459
396
|
this.measureInner();
|
|
460
397
|
}
|
|
461
|
-
|
|
462
398
|
if (noAnimation) {
|
|
463
399
|
if (!prevProps.visible && visible) {
|
|
464
400
|
(0, _handle.forwardCustom)('onShow')({}, this.props);
|
|
@@ -471,7 +407,6 @@ var Transition = /*#__PURE__*/function (_Component) {
|
|
|
471
407
|
key: "componentWillUnmount",
|
|
472
408
|
value: function componentWillUnmount() {
|
|
473
409
|
this.measuringJob.stop();
|
|
474
|
-
|
|
475
410
|
if (this.resizeRegistry) {
|
|
476
411
|
this.resizeRegistry.unregister();
|
|
477
412
|
}
|
|
@@ -480,27 +415,24 @@ var Transition = /*#__PURE__*/function (_Component) {
|
|
|
480
415
|
key: "render",
|
|
481
416
|
value: function render() {
|
|
482
417
|
var _this$props2 = this.props,
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
418
|
+
visible = _this$props2.visible,
|
|
419
|
+
props = _objectWithoutProperties(_this$props2, _excluded2);
|
|
486
420
|
delete props.onHide;
|
|
487
421
|
delete props.onShow;
|
|
488
422
|
delete props.textSize;
|
|
489
|
-
|
|
490
423
|
switch (this.state.renderState) {
|
|
491
424
|
// If we are deferring children, don't render any
|
|
492
425
|
case TRANSITION_STATE.INIT:
|
|
493
426
|
return null;
|
|
427
|
+
|
|
494
428
|
// If we're transitioning to visible but don't have a measurement yet, create the
|
|
495
429
|
// transition container with its children so we can measure. Measuring will cause a
|
|
496
430
|
// state change to trigger the animation.
|
|
497
|
-
|
|
498
431
|
case TRANSITION_STATE.MEASURE:
|
|
499
432
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(TransitionBase, _objectSpread(_objectSpread({}, props), {}, {
|
|
500
433
|
childRef: this.childRef,
|
|
501
434
|
visible: false
|
|
502
435
|
}));
|
|
503
|
-
|
|
504
436
|
case TRANSITION_STATE.READY:
|
|
505
437
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(TransitionBase, _objectSpread(_objectSpread({}, props), {}, {
|
|
506
438
|
childRef: this.childRef,
|
|
@@ -522,19 +454,14 @@ var Transition = /*#__PURE__*/function (_Component) {
|
|
|
522
454
|
renderState: TRANSITION_STATE.MEASURE
|
|
523
455
|
};
|
|
524
456
|
}
|
|
525
|
-
|
|
526
457
|
return null;
|
|
527
458
|
}
|
|
528
459
|
}]);
|
|
529
|
-
|
|
530
460
|
return Transition;
|
|
531
461
|
}(_react.Component);
|
|
532
|
-
|
|
533
462
|
exports.Transition = Transition;
|
|
534
463
|
Transition.contextType = _Resizable.ResizeContext;
|
|
535
|
-
Transition.propTypes =
|
|
536
|
-
/** @lends ui/Transition.Transition.prototype */
|
|
537
|
-
{
|
|
464
|
+
Transition.propTypes = /** @lends ui/Transition.Transition.prototype */{
|
|
538
465
|
/**
|
|
539
466
|
* The node to be transitioned.
|
|
540
467
|
*
|
|
@@ -542,7 +469,6 @@ Transition.propTypes =
|
|
|
542
469
|
* @public
|
|
543
470
|
*/
|
|
544
471
|
children: _propTypes2["default"].node,
|
|
545
|
-
|
|
546
472
|
/**
|
|
547
473
|
* The direction of transition (i.e. where the component will move *to*; the destination).
|
|
548
474
|
*
|
|
@@ -553,7 +479,6 @@ Transition.propTypes =
|
|
|
553
479
|
* @public
|
|
554
480
|
*/
|
|
555
481
|
direction: _propTypes2["default"].oneOf(['up', 'right', 'down', 'left']),
|
|
556
|
-
|
|
557
482
|
/**
|
|
558
483
|
* Controls how long the transition should take.
|
|
559
484
|
*
|
|
@@ -568,7 +493,6 @@ Transition.propTypes =
|
|
|
568
493
|
* @public
|
|
569
494
|
*/
|
|
570
495
|
duration: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].number]),
|
|
571
|
-
|
|
572
496
|
/**
|
|
573
497
|
* Disables transition animation.
|
|
574
498
|
*
|
|
@@ -579,7 +503,6 @@ Transition.propTypes =
|
|
|
579
503
|
* @public
|
|
580
504
|
*/
|
|
581
505
|
noAnimation: _propTypes2["default"].bool,
|
|
582
|
-
|
|
583
506
|
/**
|
|
584
507
|
* Called after transition for hiding is finished.
|
|
585
508
|
*
|
|
@@ -587,7 +510,6 @@ Transition.propTypes =
|
|
|
587
510
|
* @public
|
|
588
511
|
*/
|
|
589
512
|
onHide: _propTypes2["default"].func,
|
|
590
|
-
|
|
591
513
|
/**
|
|
592
514
|
* Called after transition for showing is finished.
|
|
593
515
|
*
|
|
@@ -595,7 +517,6 @@ Transition.propTypes =
|
|
|
595
517
|
* @public
|
|
596
518
|
*/
|
|
597
519
|
onShow: _propTypes2["default"].func,
|
|
598
|
-
|
|
599
520
|
/**
|
|
600
521
|
* The transition timing function.
|
|
601
522
|
* Supported function names are: `ease`, `ease-in`, `ease-out`, `ease-in-out`, `ease-in-quart`,
|
|
@@ -606,7 +527,6 @@ Transition.propTypes =
|
|
|
606
527
|
* @public
|
|
607
528
|
*/
|
|
608
529
|
timingFunction: _propTypes2["default"].oneOf(['ease', 'ease-in', 'ease-out', 'ease-in-out', 'ease-in-quart', 'ease-out-quart', 'linear']),
|
|
609
|
-
|
|
610
530
|
/**
|
|
611
531
|
* The type of transition to affect the content.
|
|
612
532
|
*
|
|
@@ -633,7 +553,6 @@ Transition.propTypes =
|
|
|
633
553
|
* @public
|
|
634
554
|
*/
|
|
635
555
|
type: _propTypes2["default"].oneOf(['slide', 'clip', 'fade']),
|
|
636
|
-
|
|
637
556
|
/**
|
|
638
557
|
* The visibility of the component, which determines whether it's on the screen or off.
|
|
639
558
|
*
|