@enact/ui 4.5.1 → 4.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AnnounceDecorator/Announce.js +1 -40
- package/AnnounceDecorator/AnnounceDecorator.js +3 -21
- package/AnnounceDecorator/tests/Announce-specs.js +2 -7
- package/AnnounceDecorator/tests/AnnounceDecorator-specs.js +2 -6
- package/AnnounceDecorator/tests/useAnnounce-specs.js +8 -19
- package/AnnounceDecorator/useAnnounce.js +0 -6
- package/BodyText/BodyText.d.ts +1 -1
- package/BodyText/BodyText.js +8 -28
- package/BodyText/tests/BodyText-specs.js +0 -19
- package/Button/Button.d.ts +6 -6
- package/Button/Button.js +33 -63
- package/Button/tests/Button-specs.js +0 -26
- package/CHANGELOG.md +36 -0
- package/Cancelable/Cancelable.js +8 -47
- package/Cancelable/cancelHandler.js +5 -12
- package/Cancelable/modalHandler.js +3 -11
- package/Cancelable/tests/Cancelable-specs.js +3 -57
- package/Changeable/Changeable.js +2 -34
- package/Changeable/tests/Changeable-specs.js +20 -66
- package/ComponentOverride/ComponentOverride.js +1 -13
- package/FloatingLayer/FloatingLayer.js +17 -73
- package/FloatingLayer/FloatingLayerContainer.js +0 -15
- package/FloatingLayer/FloatingLayerDecorator.js +4 -17
- package/FloatingLayer/Scrim.js +9 -53
- package/FloatingLayer/index.js +0 -4
- package/FloatingLayer/tests/FloatingLayer-specs.js +8 -22
- package/FloatingLayer/tests/Scrim-specs.js +0 -9
- package/FloatingLayer/tests/useFloatingLayerDecorator-specs.js +0 -13
- package/FloatingLayer/useFloatingLayer.js +3 -14
- package/FloatingLayer/useFloatingLayerDecorator.js +3 -11
- package/ForwardRef/ForwardRef.js +1 -10
- package/GridListImageItem/GridListImageItem.d.ts +1 -1
- package/GridListImageItem/GridListImageItem.js +18 -51
- package/Group/Group.js +5 -36
- package/Group/GroupItem.js +16 -33
- package/Group/tests/Group-specs.js +0 -32
- package/Heading/Heading.js +8 -36
- package/Heading/tests/Heading-specs.js +81 -14
- package/Icon/Icon.d.ts +4 -4
- package/Icon/Icon.js +19 -53
- package/Icon/tests/Icon-specs.js +0 -22
- package/IconButton/IconButton.d.ts +4 -4
- package/IconButton/IconButton.js +17 -55
- package/IconButton/tests/IconButton-specs.js +0 -7
- package/Image/Image.js +17 -46
- package/Image/tests/Image-specs.js +0 -14
- package/ImageItem/ImageItem.js +18 -47
- package/ImageItem/tests/ImageItem-specs.js +0 -25
- package/Item/Item.js +9 -33
- package/Item/tests/Item-specs.js +0 -24
- package/LabeledIcon/LabeledIcon.d.ts +2 -2
- package/LabeledIcon/LabeledIcon.js +22 -53
- package/LabeledIcon/tests/LabeledIcon-specs.js +0 -14
- package/Layout/Cell.js +18 -44
- package/Layout/Layout.d.ts +16 -16
- package/Layout/Layout.js +23 -46
- package/Layout/tests/Layout-specs.js +10 -39
- package/Marquee/MarqueeBase.js +31 -64
- package/Marquee/MarqueeController.js +11 -72
- package/Marquee/MarqueeDecorator.js +70 -196
- package/Marquee/index.js +1 -5
- package/Marquee/tests/Marquee-specs.js +295 -87
- package/Measurable/Measurable.js +12 -34
- package/Measurable/tests/Measurable-specs.js +115 -0
- package/Media/Media.js +15 -65
- package/Media/tests/Media-specs.js +168 -0
- package/Placeholder/PlaceholderControllerDecorator.js +7 -43
- package/Placeholder/PlaceholderDecorator.js +7 -38
- package/Placeholder/index.js +1 -5
- package/Placeholder/tests/PlaceholderControllerDecorator-specs.js +25 -0
- package/Placeholder/tests/PlaceholderDecorator-specs.js +28 -0
- package/ProgressBar/ProgressBar.js +14 -45
- package/ProgressBar/tests/ProgressBar-specs.js +0 -17
- package/RadioDecorator/RadioControllerDecorator.js +1 -29
- package/RadioDecorator/RadioDecorator.js +4 -42
- package/RadioDecorator/tests/RadioDecorator-specs.js +12 -49
- package/Repeater/Repeater.js +9 -33
- package/Repeater/tests/Repeater-specs.js +0 -38
- package/Resizable/Resizable.js +9 -37
- package/Resizable/tests/Resizable-specs.js +34 -0
- package/Routable/Link.js +11 -47
- package/Routable/Routable.d.ts +2 -2
- package/Routable/Routable.js +12 -35
- package/Routable/Route.js +0 -6
- package/Routable/Router.js +15 -58
- package/Routable/tests/Routable-specs.js +7 -33
- package/Routable/tests/Router-specs.js +18 -44
- package/Routable/useLink.js +4 -8
- package/Routable/util.js +18 -24
- package/Scrollable/ScrollAnimator.js +49 -65
- package/Scrollable/ScrollThumb.js +2 -13
- package/Scrollable/Scrollable.js +180 -387
- package/Scrollable/ScrollableNative.js +189 -392
- package/Scrollable/Scrollbar.js +30 -102
- package/Scroller/Scroller.js +15 -39
- package/Scroller/ScrollerBasic.js +34 -89
- package/Scroller/UiScrollerBase.js +31 -84
- package/Scroller/tests/Scroller-specs.js +56 -0
- package/Skinnable/Skinnable.js +11 -38
- package/Skinnable/tests/Skinnable-specs.js +3 -74
- package/Skinnable/tests/useSkins-specs.js +1 -13
- package/Skinnable/tests/util-specs.js +0 -14
- package/Skinnable/useSkins.js +8 -15
- package/Skinnable/util.js +9 -20
- package/Slider/Knob.js +5 -24
- package/Slider/PositionDecorator.js +16 -54
- package/Slider/Slider.d.ts +2 -2
- package/Slider/Slider.js +29 -67
- package/Slider/tests/Slider-specs.js +94 -7
- package/Slider/utils.js +0 -2
- package/SlotItem/SlotItem.d.ts +1 -1
- package/SlotItem/SlotItem.js +17 -43
- package/SlotItem/tests/SlotItem-specs.js +0 -5
- package/Slottable/Slottable.js +4 -12
- package/Slottable/tests/Slottable-specs.js +19 -46
- package/Slottable/tests/useSlots-specs.js +27 -65
- package/Slottable/useSlots.js +8 -33
- package/Spinner/Spinner.d.ts +1 -1
- package/Spinner/Spinner.js +16 -43
- package/Spinner/tests/Spinner-specs.js +0 -15
- package/ToggleIcon/ToggleIcon.js +10 -36
- package/ToggleIcon/tests/ToggleIcon-specs.js +0 -16
- package/ToggleItem/ToggleItem.d.ts +3 -3
- package/ToggleItem/ToggleItem.js +18 -55
- package/ToggleItem/tests/ToggleItem-specs.js +0 -30
- package/Toggleable/Toggle.js +1 -15
- package/Toggleable/Toggleable.js +12 -45
- package/Toggleable/tests/Toggleable-specs.js +28 -96
- package/Toggleable/useToggle.js +3 -19
- package/Touchable/ClickAllow.js +5 -14
- package/Touchable/Drag.js +16 -54
- package/Touchable/Flick.js +11 -42
- package/Touchable/Hold.js +21 -68
- package/Touchable/Touch.js +37 -65
- package/Touchable/Touchable.js +32 -71
- package/Touchable/config.js +8 -22
- package/Touchable/tests/Touchable-specs.js +270 -119
- package/Touchable/tests/useTouch-specs.js +6 -80
- package/Touchable/useTouch.js +17 -34
- package/Transition/Transition.js +37 -118
- package/Transition/tests/Transition-specs.js +20 -60
- package/ViewManager/Arranger.js +10 -22
- package/ViewManager/TransitionGroup.js +32 -107
- package/ViewManager/View.js +35 -91
- package/ViewManager/ViewManager.d.ts +1 -1
- package/ViewManager/ViewManager.js +20 -84
- package/ViewManager/tests/View-specs.js +0 -17
- package/ViewManager/tests/ViewManager-specs.js +236 -305
- package/ViewManager/tests/test-utils.js +0 -8
- package/VirtualList/UiVirtualListBase.js +259 -409
- package/VirtualList/VirtualList.d.ts +4 -4
- package/VirtualList/VirtualList.js +29 -69
- package/VirtualList/VirtualListBase.js +0 -3
- package/VirtualList/VirtualListBasic.js +273 -431
- package/VirtualList/tests/VirtualGridList-native-specs.js +161 -0
- package/VirtualList/tests/VirtualGridList-specs.js +614 -0
- package/VirtualList/tests/VirtualList-native-specs.js +152 -0
- package/VirtualList/tests/VirtualList-specs.js +423 -95
- package/internal/IdProvider/IdProvider.js +7 -21
- package/internal/IdProvider/Provider.js +4 -17
- package/internal/IdProvider/tests/IdProvider-specs.js +44 -0
- package/internal/IdProvider/tests/useId-specs.js +6 -20
- package/internal/IdProvider/useId.js +0 -6
- package/internal/Pure/Pure.js +3 -30
- package/internal/Pure/tests/Pure-specs.js +88 -0
- package/internal/localized-fonts/localized-fonts.js +33 -62
- package/internal/localized-fonts/tests/localized-fonts-specs.js +33 -0
- package/internal/selection/selection.js +1 -6
- package/internal/selection/tests/selection-specs.js +6 -4
- package/internal/validators/tests/validators-specs.js +80 -0
- package/internal/validators/validators.js +14 -34
- package/package.json +9 -3
- package/resolution/ResolutionDecorator.js +4 -40
- package/resolution/index.js +0 -7
- package/resolution/resolution.js +42 -80
- package/resolution/tests/ResolutionDecorator-specs.js +4 -11
- package/resolution/tests/resolution-specs.js +2 -2
- package/useControlledState/tests/useControlledState-specs.js +15 -46
- package/useControlledState/useControlledState.js +11 -22
- package/useScroll/ScrollAnimator.js +49 -65
- package/useScroll/Scrollbar.js +22 -58
- package/useScroll/ScrollbarTrack.js +3 -19
- package/useScroll/useScroll.js +267 -454
- package/useScroll/utilDOM.js +8 -14
- package/useScroll/utilEvent.js +0 -4
|
@@ -4,56 +4,49 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = exports.ScrollAnimator = void 0;
|
|
7
|
-
|
|
8
7
|
var _util = require("@enact/core/util");
|
|
9
|
-
|
|
10
8
|
var _clamp = _interopRequireDefault(require("ramda/src/clamp"));
|
|
11
|
-
|
|
12
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
-
|
|
14
10
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
15
|
-
|
|
16
11
|
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); } }
|
|
17
|
-
|
|
18
12
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
timingFunctions = {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
13
|
+
var
|
|
14
|
+
// Use eases library
|
|
15
|
+
timingFunctions = {
|
|
16
|
+
'linear': function linear(source, target, duration, curTime) {
|
|
17
|
+
curTime /= duration;
|
|
18
|
+
return (target - source) * curTime + source;
|
|
19
|
+
},
|
|
20
|
+
'ease-in': function easeIn(source, target, duration, curTime) {
|
|
21
|
+
curTime /= duration;
|
|
22
|
+
return (target - source) * curTime * curTime * curTime * curTime + source;
|
|
23
|
+
},
|
|
24
|
+
'ease-out': function easeOut(source, target, duration, curTime) {
|
|
25
|
+
curTime /= duration;
|
|
26
|
+
curTime--;
|
|
27
|
+
return (target - source) * (curTime * curTime * curTime * curTime * curTime + 1) + source;
|
|
28
|
+
},
|
|
29
|
+
'ease-in-out': function easeInOut(source, target, duration, curTime) {
|
|
30
|
+
curTime /= duration / 2;
|
|
31
|
+
if (curTime < 1) {
|
|
32
|
+
return (target - source) / 2 * curTime * curTime * curTime * curTime + source;
|
|
33
|
+
} else {
|
|
34
|
+
curTime -= 2;
|
|
35
|
+
}
|
|
36
|
+
return (source - target) / 2 * (curTime * curTime * curTime * curTime - 2) + source;
|
|
42
37
|
}
|
|
38
|
+
},
|
|
39
|
+
// for simulate()
|
|
40
|
+
frameTime = 16.0,
|
|
41
|
+
// time for one frame
|
|
42
|
+
maxVelocity = 100,
|
|
43
|
+
// speed cap
|
|
44
|
+
stopVelocity = 0.04,
|
|
45
|
+
// velocity to stop
|
|
46
|
+
velocityFriction = 0.95,
|
|
47
|
+
// velocity decreasing factor
|
|
48
|
+
clampVelocity = (0, _clamp["default"])(-maxVelocity, maxVelocity);
|
|
43
49
|
|
|
44
|
-
return (source - target) / 2 * (curTime * curTime * curTime * curTime - 2) + source;
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
// for simulate()
|
|
48
|
-
frameTime = 16.0,
|
|
49
|
-
// time for one frame
|
|
50
|
-
maxVelocity = 100,
|
|
51
|
-
// speed cap
|
|
52
|
-
stopVelocity = 0.04,
|
|
53
|
-
// velocity to stop
|
|
54
|
-
velocityFriction = 0.95,
|
|
55
|
-
// velocity decreasing factor
|
|
56
|
-
clampVelocity = (0, _clamp["default"])(-maxVelocity, maxVelocity);
|
|
57
50
|
/**
|
|
58
51
|
* The class to scroll a list or a scroller with animation.
|
|
59
52
|
*
|
|
@@ -61,7 +54,6 @@ clampVelocity = (0, _clamp["default"])(-maxVelocity, maxVelocity);
|
|
|
61
54
|
* @memberof ui/Scrollable
|
|
62
55
|
* @private
|
|
63
56
|
*/
|
|
64
|
-
|
|
65
57
|
var ScrollAnimator = /*#__PURE__*/function () {
|
|
66
58
|
/**
|
|
67
59
|
* @param {String|null} type - Timing function type for list scroll animation. Must be one of
|
|
@@ -72,21 +64,18 @@ var ScrollAnimator = /*#__PURE__*/function () {
|
|
|
72
64
|
*/
|
|
73
65
|
function ScrollAnimator(type) {
|
|
74
66
|
_classCallCheck(this, ScrollAnimator);
|
|
75
|
-
|
|
76
67
|
this.rAFId = null;
|
|
77
68
|
this.type = 'ease-out';
|
|
78
69
|
this.timingFunction = timingFunctions[type || this.type];
|
|
79
70
|
}
|
|
80
|
-
|
|
81
71
|
_createClass(ScrollAnimator, [{
|
|
82
72
|
key: "simulate",
|
|
83
73
|
value: function simulate(sourceX, sourceY, velocityX, velocityY) {
|
|
84
74
|
var stepX = clampVelocity(velocityX * frameTime),
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
75
|
+
stepY = clampVelocity(velocityY * frameTime),
|
|
76
|
+
deltaX = 0,
|
|
77
|
+
deltaY = 0,
|
|
78
|
+
duration = 0;
|
|
90
79
|
do {
|
|
91
80
|
stepX *= velocityFriction;
|
|
92
81
|
stepY *= velocityFriction;
|
|
@@ -94,7 +83,6 @@ var ScrollAnimator = /*#__PURE__*/function () {
|
|
|
94
83
|
deltaY += stepY;
|
|
95
84
|
duration += frameTime;
|
|
96
85
|
} while (stepX * stepX + stepY * stepY > stopVelocity);
|
|
97
|
-
|
|
98
86
|
return {
|
|
99
87
|
targetX: sourceX + deltaX,
|
|
100
88
|
targetY: sourceY + deltaY,
|
|
@@ -105,20 +93,19 @@ var ScrollAnimator = /*#__PURE__*/function () {
|
|
|
105
93
|
key: "animate",
|
|
106
94
|
value: function animate(rAFCallbackFuntion) {
|
|
107
95
|
var _this = this;
|
|
108
|
-
|
|
109
96
|
var rAF = window.requestAnimationFrame,
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
97
|
+
startTimeStamp = (0, _util.perfNow)(),
|
|
98
|
+
fn = function fn() {
|
|
99
|
+
var
|
|
100
|
+
// schedule next frame
|
|
101
|
+
rAFId = rAF(fn),
|
|
114
102
|
// current timestamp
|
|
115
|
-
|
|
103
|
+
curTimeStamp = (0, _util.perfNow)(),
|
|
116
104
|
// current time if 0 at starting position
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
105
|
+
curTime = curTimeStamp - startTimeStamp;
|
|
106
|
+
_this.rAFId = rAFId;
|
|
107
|
+
rAFCallbackFuntion(curTime);
|
|
108
|
+
};
|
|
122
109
|
this.rAFId = rAF(fn);
|
|
123
110
|
}
|
|
124
111
|
}, {
|
|
@@ -130,17 +117,14 @@ var ScrollAnimator = /*#__PURE__*/function () {
|
|
|
130
117
|
key: "stop",
|
|
131
118
|
value: function stop() {
|
|
132
119
|
var cAF = window.cancelAnimationFrame;
|
|
133
|
-
|
|
134
120
|
if (this.rAFId !== null) {
|
|
135
121
|
cAF(this.rAFId);
|
|
136
122
|
this.rAFId = null;
|
|
137
123
|
}
|
|
138
124
|
}
|
|
139
125
|
}]);
|
|
140
|
-
|
|
141
126
|
return ScrollAnimator;
|
|
142
127
|
}();
|
|
143
|
-
|
|
144
128
|
exports.ScrollAnimator = ScrollAnimator;
|
|
145
129
|
var _default = ScrollAnimator;
|
|
146
130
|
exports["default"] = _default;
|
|
@@ -4,23 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = exports.ScrollThumbBase = exports.ScrollThumb = void 0;
|
|
7
|
-
|
|
8
7
|
var _kind = _interopRequireDefault(require("@enact/core/kind"));
|
|
9
|
-
|
|
10
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
9
|
var _ScrollThumbModule = _interopRequireDefault(require("./ScrollThumb.module.css"));
|
|
13
|
-
|
|
14
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
-
|
|
16
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
17
|
-
|
|
18
12
|
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; }
|
|
19
|
-
|
|
20
13
|
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; }
|
|
21
|
-
|
|
22
14
|
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; }
|
|
23
|
-
|
|
24
15
|
/**
|
|
25
16
|
* An unstyled scroll thumb without any behavior.
|
|
26
17
|
*
|
|
@@ -31,9 +22,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
31
22
|
*/
|
|
32
23
|
var ScrollThumb = (0, _kind["default"])({
|
|
33
24
|
name: 'ui:ScrollThumb',
|
|
34
|
-
propTypes:
|
|
35
|
-
/** @lends ui/Scrollable.ScrollThumb.prototype */
|
|
36
|
-
{
|
|
25
|
+
propTypes: /** @lends ui/Scrollable.ScrollThumb.prototype */{
|
|
37
26
|
/**
|
|
38
27
|
* If `true`, the scrollbar will be oriented vertically.
|
|
39
28
|
*
|
|
@@ -53,7 +42,7 @@ var ScrollThumb = (0, _kind["default"])({
|
|
|
53
42
|
computed: {
|
|
54
43
|
className: function className(_ref) {
|
|
55
44
|
var vertical = _ref.vertical,
|
|
56
|
-
|
|
45
|
+
styler = _ref.styler;
|
|
57
46
|
return styler.append({
|
|
58
47
|
vertical: vertical
|
|
59
48
|
});
|