@enact/ui 4.5.2 → 4.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AnnounceDecorator/Announce.js +1 -40
- package/AnnounceDecorator/AnnounceDecorator.js +3 -21
- package/AnnounceDecorator/tests/Announce-specs.js +2 -7
- package/AnnounceDecorator/tests/AnnounceDecorator-specs.js +2 -6
- package/AnnounceDecorator/tests/useAnnounce-specs.js +8 -19
- package/AnnounceDecorator/useAnnounce.js +0 -6
- package/BodyText/BodyText.js +6 -26
- package/BodyText/tests/BodyText-specs.js +0 -19
- package/Button/Button.js +26 -56
- package/Button/tests/Button-specs.js +0 -26
- package/CHANGELOG.md +4 -0
- package/Cancelable/Cancelable.js +8 -47
- package/Cancelable/cancelHandler.js +5 -12
- package/Cancelable/modalHandler.js +3 -11
- package/Cancelable/tests/Cancelable-specs.js +3 -57
- package/Changeable/Changeable.js +2 -34
- package/Changeable/tests/Changeable-specs.js +20 -66
- package/ComponentOverride/ComponentOverride.js +1 -13
- package/FloatingLayer/FloatingLayer.js +17 -73
- package/FloatingLayer/FloatingLayerContainer.js +0 -15
- package/FloatingLayer/FloatingLayerDecorator.js +4 -17
- package/FloatingLayer/Scrim.js +9 -53
- package/FloatingLayer/index.js +0 -4
- package/FloatingLayer/tests/FloatingLayer-specs.js +8 -22
- package/FloatingLayer/tests/Scrim-specs.js +0 -9
- package/FloatingLayer/tests/useFloatingLayerDecorator-specs.js +0 -13
- package/FloatingLayer/useFloatingLayer.js +3 -14
- package/FloatingLayer/useFloatingLayerDecorator.js +3 -11
- package/ForwardRef/ForwardRef.js +1 -10
- package/GridListImageItem/GridListImageItem.js +17 -50
- package/Group/Group.js +4 -35
- package/Group/GroupItem.js +15 -32
- package/Group/tests/Group-specs.js +0 -32
- package/Heading/Heading.js +7 -35
- package/Heading/tests/Heading-specs.js +81 -14
- package/Icon/Icon.js +14 -48
- package/Icon/tests/Icon-specs.js +0 -22
- package/IconButton/IconButton.js +12 -50
- package/IconButton/tests/IconButton-specs.js +0 -7
- package/Image/Image.js +16 -45
- package/Image/tests/Image-specs.js +0 -14
- package/ImageItem/ImageItem.js +17 -46
- package/ImageItem/tests/ImageItem-specs.js +0 -25
- package/Item/Item.js +8 -32
- package/Item/tests/Item-specs.js +0 -24
- package/LabeledIcon/LabeledIcon.js +19 -50
- package/LabeledIcon/tests/LabeledIcon-specs.js +0 -14
- package/Layout/Cell.js +11 -37
- package/Layout/Layout.js +14 -37
- package/Layout/tests/Layout-specs.js +10 -39
- package/Marquee/MarqueeBase.js +29 -63
- package/Marquee/MarqueeController.js +11 -72
- package/Marquee/MarqueeDecorator.js +62 -196
- package/Marquee/index.js +1 -5
- package/Marquee/tests/Marquee-specs.js +258 -87
- package/Measurable/Measurable.js +12 -34
- package/Measurable/tests/Measurable-specs.js +115 -0
- package/Media/Media.js +15 -65
- package/Media/tests/Media-specs.js +168 -0
- package/Placeholder/PlaceholderControllerDecorator.js +7 -43
- package/Placeholder/PlaceholderDecorator.js +7 -38
- package/Placeholder/index.js +0 -4
- package/Placeholder/tests/PlaceholderControllerDecorator-specs.js +25 -0
- package/Placeholder/tests/PlaceholderDecorator-specs.js +28 -0
- package/ProgressBar/ProgressBar.js +13 -44
- package/ProgressBar/tests/ProgressBar-specs.js +0 -17
- package/RadioDecorator/RadioControllerDecorator.js +1 -29
- package/RadioDecorator/RadioDecorator.js +4 -42
- package/RadioDecorator/tests/RadioDecorator-specs.js +12 -49
- package/Repeater/Repeater.js +9 -33
- package/Repeater/tests/Repeater-specs.js +0 -38
- package/Resizable/Resizable.js +7 -35
- package/Resizable/tests/Resizable-specs.js +34 -0
- package/Routable/Link.js +8 -44
- package/Routable/Routable.js +10 -33
- package/Routable/Route.js +0 -6
- package/Routable/Router.js +13 -56
- package/Routable/tests/Routable-specs.js +7 -33
- package/Routable/tests/Router-specs.js +18 -44
- package/Routable/useLink.js +4 -8
- package/Routable/util.js +18 -24
- package/Scrollable/ScrollAnimator.js +49 -65
- package/Scrollable/ScrollThumb.js +2 -13
- package/Scrollable/Scrollable.js +179 -386
- package/Scrollable/ScrollableNative.js +188 -391
- package/Scrollable/Scrollbar.js +28 -100
- package/Scroller/Scroller.js +15 -39
- package/Scroller/ScrollerBasic.js +34 -89
- package/Scroller/UiScrollerBase.js +31 -84
- package/Skinnable/Skinnable.js +11 -38
- package/Skinnable/tests/Skinnable-specs.js +3 -74
- package/Skinnable/tests/useSkins-specs.js +1 -13
- package/Skinnable/tests/util-specs.js +0 -14
- package/Skinnable/useSkins.js +8 -15
- package/Skinnable/util.js +9 -20
- package/Slider/Knob.js +5 -24
- package/Slider/PositionDecorator.js +16 -54
- package/Slider/Slider.js +26 -64
- package/Slider/tests/Slider-specs.js +94 -7
- package/Slider/utils.js +0 -2
- package/SlotItem/SlotItem.js +15 -41
- package/SlotItem/tests/SlotItem-specs.js +0 -5
- package/Slottable/Slottable.js +4 -12
- package/Slottable/tests/Slottable-specs.js +19 -46
- package/Slottable/tests/useSlots-specs.js +27 -65
- package/Slottable/useSlots.js +8 -33
- package/Spinner/Spinner.js +15 -42
- package/Spinner/tests/Spinner-specs.js +0 -15
- package/ToggleIcon/ToggleIcon.js +10 -36
- package/ToggleIcon/tests/ToggleIcon-specs.js +0 -16
- package/ToggleItem/ToggleItem.js +15 -52
- package/ToggleItem/tests/ToggleItem-specs.js +0 -30
- package/Toggleable/Toggle.js +1 -15
- package/Toggleable/Toggleable.js +12 -45
- package/Toggleable/tests/Toggleable-specs.js +28 -96
- package/Toggleable/useToggle.js +3 -19
- package/Touchable/ClickAllow.js +5 -14
- package/Touchable/Drag.js +16 -54
- package/Touchable/Flick.js +11 -42
- package/Touchable/Hold.js +21 -68
- package/Touchable/Touch.js +37 -65
- package/Touchable/Touchable.js +32 -71
- package/Touchable/config.js +8 -22
- package/Touchable/tests/Touchable-specs.js +270 -119
- package/Touchable/tests/useTouch-specs.js +6 -80
- package/Touchable/useTouch.js +17 -34
- package/Transition/Transition.js +37 -118
- package/Transition/tests/Transition-specs.js +20 -60
- package/ViewManager/Arranger.js +10 -22
- package/ViewManager/TransitionGroup.js +31 -106
- package/ViewManager/View.js +35 -91
- package/ViewManager/ViewManager.js +19 -83
- package/ViewManager/tests/View-specs.js +0 -17
- package/ViewManager/tests/ViewManager-specs.js +236 -305
- package/ViewManager/tests/test-utils.js +0 -8
- package/VirtualList/UiVirtualListBase.js +256 -406
- package/VirtualList/VirtualList.js +29 -69
- package/VirtualList/VirtualListBase.js +0 -3
- package/VirtualList/VirtualListBasic.js +270 -428
- package/VirtualList/tests/VirtualList-specs.js +9 -37
- package/internal/IdProvider/IdProvider.js +7 -21
- package/internal/IdProvider/Provider.js +4 -17
- package/internal/IdProvider/tests/IdProvider-specs.js +44 -0
- package/internal/IdProvider/tests/useId-specs.js +7 -22
- package/internal/IdProvider/useId.js +0 -6
- package/internal/Pure/Pure.js +3 -30
- package/internal/Pure/tests/Pure-specs.js +88 -0
- package/internal/localized-fonts/localized-fonts.js +33 -62
- package/internal/localized-fonts/tests/localized-fonts-specs.js +33 -0
- package/internal/selection/selection.js +1 -6
- package/internal/selection/tests/selection-specs.js +6 -4
- package/internal/validators/tests/validators-specs.js +80 -0
- package/internal/validators/validators.js +14 -34
- package/package.json +8 -2
- package/resolution/ResolutionDecorator.js +4 -40
- package/resolution/index.js +0 -7
- package/resolution/resolution.js +42 -80
- package/resolution/tests/ResolutionDecorator-specs.js +4 -11
- package/resolution/tests/resolution-specs.js +2 -2
- package/useControlledState/tests/useControlledState-specs.js +15 -46
- package/useControlledState/useControlledState.js +11 -22
- package/useScroll/ScrollAnimator.js +49 -65
- package/useScroll/Scrollbar.js +22 -58
- package/useScroll/ScrollbarTrack.js +3 -19
- package/useScroll/useScroll.js +267 -454
- package/useScroll/utilDOM.js +8 -14
- package/useScroll/utilEvent.js +0 -4
|
@@ -4,75 +4,40 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = exports.MarqueeDecorator = void 0;
|
|
7
|
-
|
|
8
7
|
var _direction = _interopRequireDefault(require("direction"));
|
|
9
|
-
|
|
10
8
|
var _dispatcher = require("@enact/core/dispatcher");
|
|
11
|
-
|
|
12
9
|
var _handle = require("@enact/core/handle");
|
|
13
|
-
|
|
14
10
|
var _hoc = _interopRequireDefault(require("@enact/core/hoc"));
|
|
15
|
-
|
|
16
11
|
var _deprecate = _interopRequireDefault(require("@enact/core/internal/deprecate"));
|
|
17
|
-
|
|
18
12
|
var _keymap = require("@enact/core/keymap");
|
|
19
|
-
|
|
20
13
|
var _util = require("@enact/core/util");
|
|
21
|
-
|
|
22
14
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
23
|
-
|
|
24
15
|
var _react = require("react");
|
|
25
|
-
|
|
26
16
|
var _reactDom = require("react-dom");
|
|
27
|
-
|
|
28
17
|
var _warning = _interopRequireDefault(require("warning"));
|
|
29
|
-
|
|
30
18
|
var _resolution = require("../resolution");
|
|
31
|
-
|
|
32
19
|
var _Resizable = require("../Resizable");
|
|
33
|
-
|
|
34
20
|
var _MarqueeBase = _interopRequireDefault(require("./MarqueeBase"));
|
|
35
|
-
|
|
36
21
|
var _MarqueeController = require("./MarqueeController");
|
|
37
|
-
|
|
38
22
|
var _MarqueeModule = _interopRequireDefault(require("./Marquee.module.css"));
|
|
39
|
-
|
|
40
23
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
41
|
-
|
|
42
24
|
var _excluded = ["alignment", "children", "disabled", "marqueeOn", "marqueeSpeed"];
|
|
43
|
-
|
|
44
25
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
45
|
-
|
|
46
26
|
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; }
|
|
47
|
-
|
|
48
27
|
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; }
|
|
49
|
-
|
|
50
28
|
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; }
|
|
51
|
-
|
|
52
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; }
|
|
53
|
-
|
|
54
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; }
|
|
55
|
-
|
|
56
31
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
57
|
-
|
|
58
32
|
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); } }
|
|
59
|
-
|
|
60
33
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
61
|
-
|
|
62
34
|
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); }
|
|
63
|
-
|
|
64
35
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
65
|
-
|
|
66
36
|
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); }; }
|
|
67
|
-
|
|
68
37
|
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); }
|
|
69
|
-
|
|
70
38
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
71
|
-
|
|
72
39
|
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; } }
|
|
73
|
-
|
|
74
40
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
75
|
-
|
|
76
41
|
/**
|
|
77
42
|
* Default configuration parameters for {@link ui/Marquee.MarqueeDecorator}
|
|
78
43
|
*
|
|
@@ -89,7 +54,6 @@ var defaultConfig = {
|
|
|
89
54
|
* @memberof ui/Marquee.MarqueeDecorator.defaultConfig
|
|
90
55
|
*/
|
|
91
56
|
blur: 'onBlur',
|
|
92
|
-
|
|
93
57
|
/**
|
|
94
58
|
* Optional CSS class name to customize the marquee `component`
|
|
95
59
|
*
|
|
@@ -99,7 +63,6 @@ var defaultConfig = {
|
|
|
99
63
|
* @deprecated Will be removed in 5.0.0. Use {@link ui/Marquee.MarqueeDecorator.defaultConfig.css} instead.
|
|
100
64
|
*/
|
|
101
65
|
className: null,
|
|
102
|
-
|
|
103
66
|
/**
|
|
104
67
|
* The base marquee component wrapping the content.
|
|
105
68
|
*
|
|
@@ -108,7 +71,6 @@ var defaultConfig = {
|
|
|
108
71
|
* @memberof ui/Marquee.MarqueeDecorator.defaultConfig
|
|
109
72
|
*/
|
|
110
73
|
component: _MarqueeBase["default"],
|
|
111
|
-
|
|
112
74
|
/**
|
|
113
75
|
* Customizes the component by mapping the supplied collection of CSS class names to the
|
|
114
76
|
* corresponding internal elements and states of this component.
|
|
@@ -126,7 +88,6 @@ var defaultConfig = {
|
|
|
126
88
|
* @memberof ui/Marquee.MarqueeDecorator.defaultConfig
|
|
127
89
|
*/
|
|
128
90
|
css: null,
|
|
129
|
-
|
|
130
91
|
/**
|
|
131
92
|
* Property containing the callback to start the animation when `marqueeOn` is `'hover'`
|
|
132
93
|
*
|
|
@@ -135,7 +96,6 @@ var defaultConfig = {
|
|
|
135
96
|
* @memberof ui/Marquee.MarqueeDecorator.defaultConfig
|
|
136
97
|
*/
|
|
137
98
|
enter: 'onMouseEnter',
|
|
138
|
-
|
|
139
99
|
/**
|
|
140
100
|
* Property containing the callback to start the animation when `marqueeOn` is `'focus'`
|
|
141
101
|
*
|
|
@@ -144,7 +104,6 @@ var defaultConfig = {
|
|
|
144
104
|
* @memberof ui/Marquee.MarqueeDecorator.defaultConfig
|
|
145
105
|
*/
|
|
146
106
|
focus: 'onFocus',
|
|
147
|
-
|
|
148
107
|
/**
|
|
149
108
|
* Invalidate the distance if any property (like 'inline') changes.
|
|
150
109
|
* Expects an array of props which on change trigger invalidateMetrics.
|
|
@@ -154,7 +113,6 @@ var defaultConfig = {
|
|
|
154
113
|
* @memberof ui/Marquee.MarqueeDecorator.defaultConfig
|
|
155
114
|
*/
|
|
156
115
|
invalidateProps: ['remeasure'],
|
|
157
|
-
|
|
158
116
|
/**
|
|
159
117
|
* Property containing the callback to stop the animation when `marqueeOn` is `'hover'`
|
|
160
118
|
*
|
|
@@ -163,7 +121,6 @@ var defaultConfig = {
|
|
|
163
121
|
* @memberof ui/Marquee.MarqueeDecorator.defaultConfig
|
|
164
122
|
*/
|
|
165
123
|
leave: 'onMouseLeave',
|
|
166
|
-
|
|
167
124
|
/**
|
|
168
125
|
* A function that determines the text directionality of a string.
|
|
169
126
|
*
|
|
@@ -179,6 +136,7 @@ var defaultConfig = {
|
|
|
179
136
|
return (0, _direction["default"])(str) === 'rtl' ? 'rtl' : 'ltr';
|
|
180
137
|
}
|
|
181
138
|
};
|
|
139
|
+
|
|
182
140
|
/*
|
|
183
141
|
* Checks whether any of the invalidateProps has changed or not
|
|
184
142
|
*
|
|
@@ -188,19 +146,17 @@ var defaultConfig = {
|
|
|
188
146
|
* @returns {Boolean} `true` if any of the props changed
|
|
189
147
|
* @private
|
|
190
148
|
*/
|
|
191
|
-
|
|
192
149
|
var didPropChange = function didPropChange(propList, prev, next) {
|
|
193
150
|
var hasPropsChanged = propList.map(function (i) {
|
|
194
151
|
return prev[i] !== next[i];
|
|
195
152
|
});
|
|
196
153
|
return hasPropsChanged.indexOf(true) !== -1;
|
|
197
154
|
};
|
|
155
|
+
|
|
198
156
|
/*
|
|
199
157
|
* There's only one timer shared for Marquee so we need to keep track of what we may be using it
|
|
200
158
|
* for. We may need to clean up certain things as we move among states.
|
|
201
159
|
*/
|
|
202
|
-
|
|
203
|
-
|
|
204
160
|
var TimerState = {
|
|
205
161
|
CLEAR: 0,
|
|
206
162
|
// No timers pending
|
|
@@ -209,8 +165,8 @@ var TimerState = {
|
|
|
209
165
|
RESET_PENDING: 2,
|
|
210
166
|
// Marquee finished, waiting for reset delay
|
|
211
167
|
SYNCSTART_PENDING: 3 // Waiting to alert Controller that we want to start marqueeing
|
|
212
|
-
|
|
213
168
|
};
|
|
169
|
+
|
|
214
170
|
/**
|
|
215
171
|
* A higher-order component that provides marquee functionalities.
|
|
216
172
|
*
|
|
@@ -222,18 +178,15 @@ var TimerState = {
|
|
|
222
178
|
* @hoc
|
|
223
179
|
* @public
|
|
224
180
|
*/
|
|
225
|
-
|
|
226
181
|
var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
227
182
|
var _class;
|
|
228
|
-
|
|
229
183
|
var blur = config.blur,
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
184
|
+
MarqueeComponent = config.component,
|
|
185
|
+
enter = config.enter,
|
|
186
|
+
focus = config.focus,
|
|
187
|
+
invalidateProps = config.invalidateProps,
|
|
188
|
+
leave = config.leave,
|
|
189
|
+
marqueeDirection = config.marqueeDirection;
|
|
237
190
|
if (config.className) {
|
|
238
191
|
(0, _deprecate["default"])({
|
|
239
192
|
name: 'ui/MarqueeDecorator.config.className',
|
|
@@ -241,16 +194,15 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
241
194
|
until: '5.0.0'
|
|
242
195
|
});
|
|
243
196
|
}
|
|
244
|
-
|
|
245
197
|
var css = typeof config.css === 'object' && config.css || {
|
|
246
198
|
marquee: config.className
|
|
247
|
-
};
|
|
199
|
+
};
|
|
248
200
|
|
|
201
|
+
// Generate functions to forward events to containers
|
|
249
202
|
var forwardBlur = (0, _handle.forward)(blur);
|
|
250
203
|
var forwardFocus = (0, _handle.forward)(focus);
|
|
251
204
|
var forwardEnter = (0, _handle.forward)(enter);
|
|
252
205
|
var forwardLeave = (0, _handle.forward)(leave);
|
|
253
|
-
|
|
254
206
|
var determineTextDirection = function determineTextDirection(node, rtl, forceDirection) {
|
|
255
207
|
// Text directionality is a function of locale direction (rtl), content (node.textContent),
|
|
256
208
|
// and props (forceDirection) in increasing order of significance.
|
|
@@ -259,20 +211,14 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
259
211
|
} else if (node) {
|
|
260
212
|
rtl = marqueeDirection(node.textContent) === 'rtl';
|
|
261
213
|
}
|
|
262
|
-
|
|
263
214
|
return rtl;
|
|
264
215
|
};
|
|
265
|
-
|
|
266
216
|
return _class = /*#__PURE__*/function (_PureComponent) {
|
|
267
217
|
_inherits(_class, _PureComponent);
|
|
268
|
-
|
|
269
218
|
var _super = _createSuper(_class);
|
|
270
|
-
|
|
271
219
|
function _class(props) {
|
|
272
220
|
var _this;
|
|
273
|
-
|
|
274
221
|
_classCallCheck(this, _class);
|
|
275
|
-
|
|
276
222
|
_this = _super.call(this, props);
|
|
277
223
|
_this.promoteJob = new _util.Job(function () {
|
|
278
224
|
if (_this.contentFits === false) {
|
|
@@ -290,10 +236,8 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
290
236
|
} : null;
|
|
291
237
|
});
|
|
292
238
|
});
|
|
293
|
-
|
|
294
239
|
_this.start = function () {
|
|
295
240
|
var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.props.marqueeDelay;
|
|
296
|
-
|
|
297
241
|
if (_this.props.marqueeDisabled) {
|
|
298
242
|
// if marquee isn't necessary, do not set `animating` but return `true` to mark it
|
|
299
243
|
// complete if it's synchronized so it doesn't block other instances.
|
|
@@ -305,7 +249,6 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
305
249
|
// our group already did it.
|
|
306
250
|
_this.setTimeout(function () {
|
|
307
251
|
_this.calculateMetrics();
|
|
308
|
-
|
|
309
252
|
if (_this.contentFits === false) {
|
|
310
253
|
_this.setState({
|
|
311
254
|
promoted: true,
|
|
@@ -317,28 +260,21 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
317
260
|
}, delay, TimerState.START_PENDING);
|
|
318
261
|
}
|
|
319
262
|
};
|
|
320
|
-
|
|
321
263
|
_this.stop = function () {
|
|
322
264
|
_this.clearTimeout();
|
|
323
|
-
|
|
324
265
|
if (_this.state.animating) {
|
|
325
266
|
_this.setState({
|
|
326
267
|
animating: false
|
|
327
268
|
});
|
|
328
269
|
}
|
|
329
|
-
|
|
330
270
|
_this.demote();
|
|
331
271
|
};
|
|
332
|
-
|
|
333
272
|
_this.tryStartingAnimation = function (delay) {
|
|
334
273
|
if (_this.state.animating || _this.timerState !== TimerState.CLEAR) return;
|
|
335
|
-
|
|
336
274
|
_this.startAnimation(delay);
|
|
337
275
|
};
|
|
338
|
-
|
|
339
276
|
_this.startAnimation = function (delay) {
|
|
340
277
|
_this.promote(delay);
|
|
341
|
-
|
|
342
278
|
if (_this.sync) {
|
|
343
279
|
// If we're running a timer for anything, we should let that finish, unless it's
|
|
344
280
|
// another syncstart request. We should probably check to see if the start request
|
|
@@ -348,7 +284,6 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
348
284
|
if (_this.timerState !== TimerState.CLEAR && _this.timerState !== TimerState.SYNCSTART_PENDING) {
|
|
349
285
|
return;
|
|
350
286
|
}
|
|
351
|
-
|
|
352
287
|
_this.setTimeout(function () {
|
|
353
288
|
_this.context.start();
|
|
354
289
|
}, delay, TimerState.SYNCSTART_PENDING);
|
|
@@ -356,25 +291,23 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
356
291
|
_this.start(delay);
|
|
357
292
|
}
|
|
358
293
|
};
|
|
359
|
-
|
|
360
294
|
_this.restartAnimation = function (delay) {
|
|
361
295
|
(0, _reactDom.flushSync)(function () {
|
|
362
296
|
_this.setState({
|
|
363
297
|
animating: false
|
|
364
298
|
});
|
|
365
|
-
});
|
|
366
|
-
|
|
299
|
+
});
|
|
300
|
+
// synchronized Marquees defer to the controller to restart them
|
|
367
301
|
if (_this.sync) {
|
|
368
302
|
_this.context.complete(_assertThisInitialized(_this));
|
|
369
303
|
} else if (!_this.state.animating) {
|
|
370
304
|
_this.startAnimation(delay);
|
|
371
305
|
}
|
|
372
306
|
};
|
|
373
|
-
|
|
374
307
|
_this.resetAnimation = function () {
|
|
375
|
-
var delay = Math.max(40, _this.props.marqueeResetDelay + _this.props.marqueeDelay);
|
|
308
|
+
var delay = Math.max(40, _this.props.marqueeResetDelay + _this.props.marqueeDelay);
|
|
309
|
+
// If we're already timing a start action, don't reset. Start actions will clear us if
|
|
376
310
|
// sync.
|
|
377
|
-
|
|
378
311
|
if (_this.timerState === TimerState.CLEAR) {
|
|
379
312
|
// If invoked immediately, the setState call in restartAnimation is batched and will
|
|
380
313
|
// break any non-marquee-on-render instances because the subsequent startAnimation
|
|
@@ -389,62 +322,46 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
389
322
|
}, 0, TimerState.RESET_PENDING);
|
|
390
323
|
}
|
|
391
324
|
};
|
|
392
|
-
|
|
393
325
|
_this.cancelAnimation = function () {
|
|
394
326
|
if (_this.sync) {
|
|
395
327
|
_this.context.cancel(_assertThisInitialized(_this));
|
|
396
|
-
|
|
397
328
|
return;
|
|
398
329
|
}
|
|
399
|
-
|
|
400
330
|
_this.stop();
|
|
401
331
|
};
|
|
402
|
-
|
|
403
332
|
_this.handleResize = function () {
|
|
404
333
|
if (_this.node && !_this.props.marqueeDisabled) {
|
|
405
334
|
_this.invalidateMetrics();
|
|
406
|
-
|
|
407
335
|
if (_this.state.animating) {
|
|
408
336
|
_this.cancelAnimation();
|
|
409
|
-
|
|
410
337
|
_this.resetAnimation();
|
|
411
338
|
}
|
|
412
339
|
}
|
|
413
340
|
};
|
|
414
|
-
|
|
415
341
|
_this.handleMarqueeComplete = function () {
|
|
416
342
|
_this.resetAnimation();
|
|
417
343
|
};
|
|
418
|
-
|
|
419
344
|
_this.handleFocus = function (ev) {
|
|
420
345
|
_this.isFocused = true;
|
|
421
|
-
|
|
422
346
|
if (!_this.sync) {
|
|
423
347
|
if (!_this.state.animating) {
|
|
424
348
|
_this.startAnimation();
|
|
425
349
|
}
|
|
426
350
|
}
|
|
427
|
-
|
|
428
351
|
forwardFocus(ev, _this.props);
|
|
429
352
|
};
|
|
430
|
-
|
|
431
353
|
_this.handleBlur = function (ev) {
|
|
432
354
|
_this.promoteJob.stop();
|
|
433
|
-
|
|
434
355
|
forwardBlur(ev, _this.props);
|
|
435
|
-
|
|
436
356
|
if (_this.isFocused) {
|
|
437
357
|
_this.isFocused = false;
|
|
438
|
-
|
|
439
358
|
if (!_this.sync && !(_this.isHovered && _this.props.marqueeOn === 'hover')) {
|
|
440
359
|
_this.cancelAnimation();
|
|
441
360
|
}
|
|
442
361
|
}
|
|
443
362
|
};
|
|
444
|
-
|
|
445
363
|
_this.handleEnter = function (ev) {
|
|
446
364
|
_this.isHovered = true;
|
|
447
|
-
|
|
448
365
|
if (_this.props.marqueeOn === 'hover') {
|
|
449
366
|
if (_this.sync) {
|
|
450
367
|
_this.context.enter(_assertThisInitialized(_this));
|
|
@@ -452,30 +369,22 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
452
369
|
_this.startAnimation();
|
|
453
370
|
}
|
|
454
371
|
}
|
|
455
|
-
|
|
456
372
|
forwardEnter(ev, _this.props);
|
|
457
373
|
};
|
|
458
|
-
|
|
459
374
|
_this.handleLeave = function (ev) {
|
|
460
375
|
_this.promoteJob.stop();
|
|
461
|
-
|
|
462
376
|
_this.handleUnhover();
|
|
463
|
-
|
|
464
377
|
forwardLeave(ev, _this.props);
|
|
465
378
|
};
|
|
466
|
-
|
|
467
379
|
_this.handlePointerHide = function (_ref) {
|
|
468
380
|
var keyCode = _ref.keyCode;
|
|
469
|
-
|
|
470
381
|
if ((0, _keymap.is)('pointerHide', keyCode)) {
|
|
471
382
|
_this.handleUnhover();
|
|
472
383
|
}
|
|
473
384
|
};
|
|
474
|
-
|
|
475
385
|
_this.cacheNode = function (node) {
|
|
476
386
|
_this.node = node;
|
|
477
387
|
};
|
|
478
|
-
|
|
479
388
|
_this.state = {
|
|
480
389
|
animating: false,
|
|
481
390
|
overflow: 'ellipsis',
|
|
@@ -489,7 +398,6 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
489
398
|
_this.resizeRegistry = null;
|
|
490
399
|
return _this;
|
|
491
400
|
}
|
|
492
|
-
|
|
493
401
|
_createClass(_class, [{
|
|
494
402
|
key: "componentDidMount",
|
|
495
403
|
value: function componentDidMount() {
|
|
@@ -500,36 +408,31 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
500
408
|
stop: this.stop
|
|
501
409
|
});
|
|
502
410
|
}
|
|
503
|
-
|
|
504
411
|
this.validateTextDirection();
|
|
505
|
-
|
|
506
412
|
if (this.props.marqueeOn === 'render') {
|
|
507
413
|
this.startAnimation(this.props.marqueeOnRenderDelay);
|
|
508
414
|
}
|
|
509
|
-
|
|
510
415
|
(0, _dispatcher.on)('keydown', this.handlePointerHide, document);
|
|
511
416
|
}
|
|
512
417
|
}, {
|
|
513
418
|
key: "componentDidUpdate",
|
|
514
419
|
value: function componentDidUpdate(prevProps) {
|
|
515
420
|
var _this$props = this.props,
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
421
|
+
children = _this$props.children,
|
|
422
|
+
disabled = _this$props.disabled,
|
|
423
|
+
forceDirection = _this$props.forceDirection,
|
|
424
|
+
locale = _this$props.locale,
|
|
425
|
+
marqueeOn = _this$props.marqueeOn,
|
|
426
|
+
marqueeDisabled = _this$props.marqueeDisabled,
|
|
427
|
+
marqueeSpacing = _this$props.marqueeSpacing,
|
|
428
|
+
marqueeSpeed = _this$props.marqueeSpeed,
|
|
429
|
+
rtl = _this$props.rtl;
|
|
525
430
|
var forceRestartMarquee = false;
|
|
526
|
-
|
|
527
431
|
if (prevProps.locale !== locale || prevProps.rtl !== rtl || prevProps.marqueeSpacing !== marqueeSpacing || !(0, _util.shallowEqual)(prevProps.children, children) || invalidateProps && didPropChange(invalidateProps, prevProps, this.props)) {
|
|
528
432
|
// restart marqueeOn="render" marquees or synced marquees that were animating
|
|
529
433
|
forceRestartMarquee = marqueeOn === 'render' || this.sync && (this.state.animating || this.timerState > TimerState.CLEAR);
|
|
530
434
|
this.invalidateMetrics();
|
|
531
435
|
this.cancelAnimation();
|
|
532
|
-
|
|
533
436
|
if (forceRestartMarquee && marqueeOn === 'focus') {
|
|
534
437
|
this.resetAnimation();
|
|
535
438
|
}
|
|
@@ -538,9 +441,7 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
538
441
|
} else if (disabled && this.isHovered && marqueeOn === 'focus' && this.sync) {
|
|
539
442
|
this.context.enter(this);
|
|
540
443
|
}
|
|
541
|
-
|
|
542
444
|
this.validateTextDirection();
|
|
543
|
-
|
|
544
445
|
if (forceRestartMarquee || this.shouldStartMarquee()) {
|
|
545
446
|
this.tryStartingAnimation(this.props.marqueeOn === 'render' ? this.props.marqueeOnRenderDelay : this.props.marqueeDelay);
|
|
546
447
|
}
|
|
@@ -551,22 +452,18 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
551
452
|
this.clearTimeout();
|
|
552
453
|
this.promoteJob.stop();
|
|
553
454
|
this.demoteJob.stop();
|
|
554
|
-
|
|
555
455
|
if (this.sync) {
|
|
556
456
|
this.context.unregister(this);
|
|
557
457
|
}
|
|
558
|
-
|
|
559
458
|
if (this.resizeRegistry) {
|
|
560
459
|
this.resizeRegistry.unregister(this.handleResize);
|
|
561
460
|
}
|
|
562
|
-
|
|
563
461
|
(0, _dispatcher.off)('keydown', this.handlePointerHide, document);
|
|
564
462
|
}
|
|
565
463
|
}, {
|
|
566
464
|
key: "demote",
|
|
567
465
|
value: function demote() {
|
|
568
466
|
this.promoteJob.stop();
|
|
569
|
-
|
|
570
467
|
if (this.state.promoted) {
|
|
571
468
|
this.demoteJob.idle();
|
|
572
469
|
}
|
|
@@ -578,12 +475,12 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
578
475
|
this.demoteJob.stop();
|
|
579
476
|
this.promoteJob.startAfter(Math.max(0, delay - 200));
|
|
580
477
|
}
|
|
478
|
+
|
|
581
479
|
/*
|
|
582
480
|
* Clears the timer
|
|
583
481
|
*
|
|
584
482
|
* @returns {undefined}
|
|
585
483
|
*/
|
|
586
|
-
|
|
587
484
|
}, {
|
|
588
485
|
key: "clearTimeout",
|
|
589
486
|
value: function clearTimeout() {
|
|
@@ -591,9 +488,9 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
591
488
|
window.clearTimeout(this.timer);
|
|
592
489
|
this.timer = null;
|
|
593
490
|
}
|
|
594
|
-
|
|
595
491
|
this.timerState = TimerState.CLEAR;
|
|
596
492
|
}
|
|
493
|
+
|
|
597
494
|
/*
|
|
598
495
|
* Starts a new timer
|
|
599
496
|
*
|
|
@@ -601,16 +498,13 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
601
498
|
* @param {Number} time Delay in milliseconds
|
|
602
499
|
* @returns {undefined}
|
|
603
500
|
*/
|
|
604
|
-
|
|
605
501
|
}, {
|
|
606
502
|
key: "setTimeout",
|
|
607
503
|
value: function setTimeout(fn) {
|
|
608
504
|
var _this2 = this;
|
|
609
|
-
|
|
610
505
|
var time = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
611
506
|
var state = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : TimerState.CLEAR;
|
|
612
507
|
this.clearTimeout();
|
|
613
|
-
|
|
614
508
|
if (window) {
|
|
615
509
|
this.timerState = state;
|
|
616
510
|
this.timer = window.setTimeout(function () {
|
|
@@ -619,35 +513,35 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
619
513
|
}, time);
|
|
620
514
|
}
|
|
621
515
|
}
|
|
516
|
+
|
|
622
517
|
/*
|
|
623
518
|
* Checks to see if the children changed during a condition that should cause us to re-check
|
|
624
519
|
* the animation state
|
|
625
520
|
*
|
|
626
521
|
* @returns {Boolean} - `true` if a possible marquee condition exists
|
|
627
522
|
*/
|
|
628
|
-
|
|
629
523
|
}, {
|
|
630
524
|
key: "shouldStartMarquee",
|
|
631
525
|
value: function shouldStartMarquee() {
|
|
632
526
|
var _this$props2 = this.props,
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
527
|
+
disabled = _this$props2.disabled,
|
|
528
|
+
marqueeDisabled = _this$props2.marqueeDisabled,
|
|
529
|
+
marqueeOn = _this$props2.marqueeOn;
|
|
636
530
|
return !marqueeDisabled && (marqueeOn === 'render' || !this.sync && (this.isFocused && marqueeOn === 'focus' && !disabled || this.isHovered && (marqueeOn === 'hover' || marqueeOn === 'focus' && disabled)));
|
|
637
531
|
}
|
|
532
|
+
|
|
638
533
|
/*
|
|
639
534
|
* Invalidates marquee metrics requiring them to be recalculated
|
|
640
535
|
*
|
|
641
536
|
* @returns {undefined}
|
|
642
537
|
*/
|
|
643
|
-
|
|
644
538
|
}, {
|
|
645
539
|
key: "invalidateMetrics",
|
|
646
540
|
value: function invalidateMetrics() {
|
|
647
|
-
this.spacing = 0;
|
|
648
|
-
|
|
649
|
-
this.distance = null;
|
|
650
|
-
|
|
541
|
+
this.spacing = 0;
|
|
542
|
+
// Null distance is the special value to allow recalculation
|
|
543
|
+
this.distance = null;
|
|
544
|
+
// Assume the marquee does not fit until calculations show otherwise
|
|
651
545
|
this.contentFits = null;
|
|
652
546
|
this.setState(function (state) {
|
|
653
547
|
if (state.overflow === 'ellipsis' && state.promoted === false) return null;
|
|
@@ -673,20 +567,20 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
673
567
|
scrollWidth: this.node.scrollWidth,
|
|
674
568
|
width: this.node.getBoundingClientRect().width
|
|
675
569
|
};
|
|
676
|
-
}
|
|
677
|
-
|
|
570
|
+
}
|
|
678
571
|
|
|
572
|
+
// move all the children into the wrapper node ...
|
|
679
573
|
var wrapper = document.createElement('span');
|
|
680
574
|
this.moveChildren(this.node, wrapper);
|
|
681
|
-
this.node.appendChild(wrapper);
|
|
575
|
+
this.node.appendChild(wrapper);
|
|
682
576
|
|
|
577
|
+
// measure it to find the precise floating point width of the content ...
|
|
683
578
|
var _wrapper$getBoundingC = wrapper.getBoundingClientRect(),
|
|
684
|
-
|
|
685
|
-
|
|
579
|
+
scrollWidth = _wrapper$getBoundingC.width;
|
|
686
580
|
var _this$node$getBoundin = this.node.getBoundingClientRect(),
|
|
687
|
-
|
|
688
|
-
|
|
581
|
+
width = _this$node$getBoundin.width;
|
|
689
582
|
|
|
583
|
+
// and move all the children back and remove the wrapper
|
|
690
584
|
this.node.removeChild(wrapper);
|
|
691
585
|
this.moveChildren(wrapper, this.node);
|
|
692
586
|
return {
|
|
@@ -694,22 +588,22 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
694
588
|
width: width
|
|
695
589
|
};
|
|
696
590
|
}
|
|
591
|
+
|
|
697
592
|
/*
|
|
698
593
|
* Determines if the component should marquee and the distance to animate
|
|
699
594
|
*
|
|
700
595
|
* @returns {undefined}
|
|
701
596
|
*/
|
|
702
|
-
|
|
703
597
|
}, {
|
|
704
598
|
key: "calculateMetrics",
|
|
705
599
|
value: function calculateMetrics() {
|
|
706
|
-
var node = this.node;
|
|
600
|
+
var node = this.node;
|
|
707
601
|
|
|
602
|
+
// TODO: absolute showing check (or assume that it won't be rendered if it isn't showing?)
|
|
708
603
|
if (node && this.distance == null && !this.props.marqueeDisabled) {
|
|
709
604
|
var _this$measureWidths = this.measureWidths(),
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
605
|
+
width = _this$measureWidths.width,
|
|
606
|
+
scrollWidth = _this$measureWidths.scrollWidth;
|
|
713
607
|
this.spacing = this.getSpacing(width);
|
|
714
608
|
this.distance = this.calculateDistance(width, scrollWidth, this.spacing);
|
|
715
609
|
this.contentFits = !this.shouldAnimate(this.distance);
|
|
@@ -721,6 +615,7 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
721
615
|
});
|
|
722
616
|
}
|
|
723
617
|
}
|
|
618
|
+
|
|
724
619
|
/*
|
|
725
620
|
* Calculates the distance the marquee must travel to reveal all of the content
|
|
726
621
|
*
|
|
@@ -729,18 +624,16 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
729
624
|
* @param {Number} spacing Horizontal spacing
|
|
730
625
|
* @returns {Number} Distance to travel in pixels
|
|
731
626
|
*/
|
|
732
|
-
|
|
733
627
|
}, {
|
|
734
628
|
key: "calculateDistance",
|
|
735
629
|
value: function calculateDistance(width, scrollWidth, spacing) {
|
|
736
630
|
var overflow = scrollWidth - width;
|
|
737
|
-
|
|
738
631
|
if (this.shouldAnimate(overflow)) {
|
|
739
632
|
return scrollWidth + spacing;
|
|
740
633
|
}
|
|
741
|
-
|
|
742
634
|
return 0;
|
|
743
635
|
}
|
|
636
|
+
|
|
744
637
|
/*
|
|
745
638
|
* A custom overflow-determining method to reflect real-world truncation/ellipsis
|
|
746
639
|
* calculation. This catches an edge case that the browser typically does not, where the
|
|
@@ -753,7 +646,6 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
753
646
|
* @param {Number} distance Amount of overflow in pixels
|
|
754
647
|
* @returns {String} text-overflow value
|
|
755
648
|
*/
|
|
756
|
-
|
|
757
649
|
}, {
|
|
758
650
|
key: "calculateTextOverflow",
|
|
759
651
|
value: function calculateTextOverflow(distance) {
|
|
@@ -763,42 +655,39 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
763
655
|
key: "getSpacing",
|
|
764
656
|
value: function getSpacing(width) {
|
|
765
657
|
var marqueeSpacing = this.props.marqueeSpacing;
|
|
766
|
-
|
|
767
658
|
if (typeof marqueeSpacing === 'string') {
|
|
768
659
|
if (/^\d+(\.\d+)?%$/.test(marqueeSpacing)) {
|
|
769
660
|
return width * Number.parseFloat(marqueeSpacing) / 100;
|
|
770
|
-
}
|
|
771
|
-
|
|
661
|
+
}
|
|
772
662
|
|
|
663
|
+
// warning for invalid string value;
|
|
773
664
|
return 0;
|
|
774
665
|
}
|
|
775
|
-
|
|
776
666
|
return (0, _resolution.scale)(marqueeSpacing);
|
|
777
667
|
}
|
|
668
|
+
|
|
778
669
|
/*
|
|
779
670
|
* Calculates if the marquee should animate
|
|
780
671
|
*
|
|
781
672
|
* @param {Number} distance Amount of overflow in pixels
|
|
782
673
|
* @returns {Boolean} `true` if it should animated
|
|
783
674
|
*/
|
|
784
|
-
|
|
785
675
|
}, {
|
|
786
676
|
key: "shouldAnimate",
|
|
787
677
|
value: function shouldAnimate(distance) {
|
|
788
678
|
return distance > 0;
|
|
789
679
|
}
|
|
680
|
+
|
|
790
681
|
/*
|
|
791
682
|
* Starts the animation without synchronizing
|
|
792
683
|
*
|
|
793
684
|
* @param {Number} [delay] Milliseconds to wait before animating
|
|
794
685
|
* @returns {undefined}
|
|
795
686
|
*/
|
|
796
|
-
|
|
797
687
|
}, {
|
|
798
688
|
key: "handleUnhover",
|
|
799
689
|
value: function handleUnhover() {
|
|
800
690
|
this.isHovered = false;
|
|
801
|
-
|
|
802
691
|
if (this.props.marqueeOn === 'hover') {
|
|
803
692
|
if (this.sync) {
|
|
804
693
|
this.context.leave(this);
|
|
@@ -811,7 +700,6 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
811
700
|
key: "validateTextDirection",
|
|
812
701
|
value: function validateTextDirection() {
|
|
813
702
|
var _this3 = this;
|
|
814
|
-
|
|
815
703
|
this.setState(function (state, props) {
|
|
816
704
|
var rtl = determineTextDirection(_this3.node, props.rtl, props.forceDirection);
|
|
817
705
|
return state.rtl === rtl ? null : {
|
|
@@ -823,31 +711,27 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
823
711
|
key: "renderMarquee",
|
|
824
712
|
value: function renderMarquee() {
|
|
825
713
|
var _this$props3 = this.props,
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
714
|
+
alignment = _this$props3.alignment,
|
|
715
|
+
children = _this$props3.children,
|
|
716
|
+
disabled = _this$props3.disabled,
|
|
717
|
+
marqueeOn = _this$props3.marqueeOn,
|
|
718
|
+
marqueeSpeed = _this$props3.marqueeSpeed,
|
|
719
|
+
rest = _objectWithoutProperties(_this$props3, _excluded);
|
|
833
720
|
var marqueeOnFocus = marqueeOn === 'focus';
|
|
834
721
|
var marqueeOnHover = marqueeOn === 'hover';
|
|
835
722
|
var marqueeOnRender = marqueeOn === 'render';
|
|
836
|
-
|
|
837
723
|
if (marqueeOnFocus) {
|
|
838
724
|
rest[focus] = this.handleFocus;
|
|
839
|
-
}
|
|
840
|
-
|
|
725
|
+
}
|
|
841
726
|
|
|
727
|
+
// TODO: cancel others on hover
|
|
842
728
|
if (marqueeOnHover || marqueeOnFocus) {
|
|
843
729
|
rest[enter] = this.handleEnter;
|
|
844
730
|
rest[leave] = this.handleLeave;
|
|
845
731
|
}
|
|
846
|
-
|
|
847
732
|
if (marqueeOnRender) {
|
|
848
733
|
rest[enter] = this.handleEnter;
|
|
849
734
|
}
|
|
850
|
-
|
|
851
735
|
delete rest.forceDirection;
|
|
852
736
|
delete rest.locale;
|
|
853
737
|
delete rest.marqueeCentered;
|
|
@@ -901,13 +785,11 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
901
785
|
key: "render",
|
|
902
786
|
value: function render() {
|
|
903
787
|
var _this4 = this;
|
|
904
|
-
|
|
905
788
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Resizable.ResizeContext.Consumer, {
|
|
906
789
|
children: function children(register) {
|
|
907
790
|
if (!_this4.resizeRegistry && register) {
|
|
908
791
|
_this4.resizeRegistry = register(_this4.handleResize);
|
|
909
792
|
}
|
|
910
|
-
|
|
911
793
|
if (_this4.props.marqueeDisabled) {
|
|
912
794
|
return _this4.renderWrapped();
|
|
913
795
|
} else {
|
|
@@ -917,11 +799,8 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
917
799
|
});
|
|
918
800
|
}
|
|
919
801
|
}]);
|
|
920
|
-
|
|
921
802
|
return _class;
|
|
922
|
-
}(_react.PureComponent), _class.displayName = 'ui:MarqueeDecorator', _class.propTypes =
|
|
923
|
-
/** @lends ui/Marquee.MarqueeDecorator.prototype */
|
|
924
|
-
{
|
|
803
|
+
}(_react.PureComponent), _class.displayName = 'ui:MarqueeDecorator', _class.propTypes = /** @lends ui/Marquee.MarqueeDecorator.prototype */{
|
|
925
804
|
/**
|
|
926
805
|
* Text alignment value of the marquee. Valid values are `'left'`, `'right'` and `'center'`.
|
|
927
806
|
*
|
|
@@ -929,7 +808,6 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
929
808
|
* @public
|
|
930
809
|
*/
|
|
931
810
|
alignment: _propTypes["default"].oneOf(['left', 'right', 'center']),
|
|
932
|
-
|
|
933
811
|
/**
|
|
934
812
|
* Children to be marqueed
|
|
935
813
|
*
|
|
@@ -937,7 +815,6 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
937
815
|
* @public
|
|
938
816
|
*/
|
|
939
817
|
children: _propTypes["default"].node,
|
|
940
|
-
|
|
941
818
|
/**
|
|
942
819
|
* Passed through to the wrapped component.
|
|
943
820
|
*
|
|
@@ -949,7 +826,6 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
949
826
|
* @public
|
|
950
827
|
*/
|
|
951
828
|
disabled: _propTypes["default"].bool,
|
|
952
|
-
|
|
953
829
|
/**
|
|
954
830
|
* Forces the `direction` of the marquee.
|
|
955
831
|
*
|
|
@@ -964,7 +840,6 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
964
840
|
* @public
|
|
965
841
|
*/
|
|
966
842
|
forceDirection: _propTypes["default"].oneOf(['rtl', 'ltr', 'locale']),
|
|
967
|
-
|
|
968
843
|
/**
|
|
969
844
|
* The current locale as a
|
|
970
845
|
* {@link https://tools.ietf.org/html/rfc5646|BCP 47 language tag}.
|
|
@@ -973,7 +848,6 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
973
848
|
* @public
|
|
974
849
|
*/
|
|
975
850
|
locale: _propTypes["default"].string,
|
|
976
|
-
|
|
977
851
|
/**
|
|
978
852
|
* Number of milliseconds to wait before starting marquee when `marqueeOn` is `'hover'` or
|
|
979
853
|
* `'focus'` or before restarting any marquee.
|
|
@@ -983,14 +857,12 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
983
857
|
* @public
|
|
984
858
|
*/
|
|
985
859
|
marqueeDelay: _propTypes["default"].number,
|
|
986
|
-
|
|
987
860
|
/**
|
|
988
861
|
* Disables all marquee behavior and removes supporting markup.
|
|
989
862
|
*
|
|
990
863
|
* @type {Boolean}
|
|
991
864
|
*/
|
|
992
865
|
marqueeDisabled: _propTypes["default"].bool,
|
|
993
|
-
|
|
994
866
|
/**
|
|
995
867
|
* Determines what triggers the marquee to start its animation.
|
|
996
868
|
*
|
|
@@ -999,7 +871,6 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
999
871
|
* @public
|
|
1000
872
|
*/
|
|
1001
873
|
marqueeOn: _propTypes["default"].oneOf(['focus', 'hover', 'render']),
|
|
1002
|
-
|
|
1003
874
|
/**
|
|
1004
875
|
* Number of milliseconds to wait before starting marquee the first time.
|
|
1005
876
|
*
|
|
@@ -1010,7 +881,6 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
1010
881
|
* @public
|
|
1011
882
|
*/
|
|
1012
883
|
marqueeOnRenderDelay: _propTypes["default"].number,
|
|
1013
|
-
|
|
1014
884
|
/**
|
|
1015
885
|
* Number of milliseconds to wait before resetting the marquee position after it
|
|
1016
886
|
* finishes.
|
|
@@ -1022,7 +892,6 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
1022
892
|
* @public
|
|
1023
893
|
*/
|
|
1024
894
|
marqueeResetDelay: _propTypes["default"].number,
|
|
1025
|
-
|
|
1026
895
|
/**
|
|
1027
896
|
* Amount of spacing between the instances of the content when animating.
|
|
1028
897
|
*
|
|
@@ -1037,7 +906,6 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
1037
906
|
* @public
|
|
1038
907
|
*/
|
|
1039
908
|
marqueeSpacing: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
|
|
1040
|
-
|
|
1041
909
|
/**
|
|
1042
910
|
* Rate of marquee measured in pixels/second.
|
|
1043
911
|
*
|
|
@@ -1046,7 +914,6 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
1046
914
|
* @public
|
|
1047
915
|
*/
|
|
1048
916
|
marqueeSpeed: _propTypes["default"].number,
|
|
1049
|
-
|
|
1050
917
|
/**
|
|
1051
918
|
* Used to signal for a remeasurement inside of marquee.
|
|
1052
919
|
*
|
|
@@ -1056,7 +923,6 @@ var MarqueeDecorator = (0, _hoc["default"])(defaultConfig, function (config, Wra
|
|
|
1056
923
|
* @private
|
|
1057
924
|
*/
|
|
1058
925
|
remeasure: _propTypes["default"].any,
|
|
1059
|
-
|
|
1060
926
|
/**
|
|
1061
927
|
* Indicates the text directionality of the current locale is right-to-left
|
|
1062
928
|
*
|