@enact/ui 4.5.1 → 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.
Files changed (167) hide show
  1. package/AnnounceDecorator/Announce.js +1 -40
  2. package/AnnounceDecorator/AnnounceDecorator.js +3 -21
  3. package/AnnounceDecorator/tests/Announce-specs.js +2 -7
  4. package/AnnounceDecorator/tests/AnnounceDecorator-specs.js +2 -6
  5. package/AnnounceDecorator/tests/useAnnounce-specs.js +8 -19
  6. package/AnnounceDecorator/useAnnounce.js +0 -6
  7. package/BodyText/BodyText.js +6 -26
  8. package/BodyText/tests/BodyText-specs.js +0 -19
  9. package/Button/Button.js +26 -56
  10. package/Button/tests/Button-specs.js +0 -26
  11. package/CHANGELOG.md +10 -0
  12. package/Cancelable/Cancelable.js +8 -47
  13. package/Cancelable/cancelHandler.js +5 -12
  14. package/Cancelable/modalHandler.js +3 -11
  15. package/Cancelable/tests/Cancelable-specs.js +3 -57
  16. package/Changeable/Changeable.js +2 -34
  17. package/Changeable/tests/Changeable-specs.js +20 -66
  18. package/ComponentOverride/ComponentOverride.js +1 -13
  19. package/FloatingLayer/FloatingLayer.js +17 -73
  20. package/FloatingLayer/FloatingLayerContainer.js +0 -15
  21. package/FloatingLayer/FloatingLayerDecorator.js +4 -17
  22. package/FloatingLayer/Scrim.js +9 -53
  23. package/FloatingLayer/index.js +0 -4
  24. package/FloatingLayer/tests/FloatingLayer-specs.js +8 -22
  25. package/FloatingLayer/tests/Scrim-specs.js +0 -9
  26. package/FloatingLayer/tests/useFloatingLayerDecorator-specs.js +0 -13
  27. package/FloatingLayer/useFloatingLayer.js +3 -14
  28. package/FloatingLayer/useFloatingLayerDecorator.js +3 -11
  29. package/ForwardRef/ForwardRef.js +1 -10
  30. package/GridListImageItem/GridListImageItem.js +17 -50
  31. package/Group/Group.js +4 -35
  32. package/Group/GroupItem.js +15 -32
  33. package/Group/tests/Group-specs.js +0 -32
  34. package/Heading/Heading.js +7 -35
  35. package/Heading/tests/Heading-specs.js +81 -14
  36. package/Icon/Icon.js +14 -48
  37. package/Icon/tests/Icon-specs.js +0 -22
  38. package/IconButton/IconButton.js +12 -50
  39. package/IconButton/tests/IconButton-specs.js +0 -7
  40. package/Image/Image.js +16 -45
  41. package/Image/tests/Image-specs.js +0 -14
  42. package/ImageItem/ImageItem.js +17 -46
  43. package/ImageItem/tests/ImageItem-specs.js +0 -25
  44. package/Item/Item.js +8 -32
  45. package/Item/tests/Item-specs.js +0 -24
  46. package/LabeledIcon/LabeledIcon.js +19 -50
  47. package/LabeledIcon/tests/LabeledIcon-specs.js +0 -14
  48. package/Layout/Cell.js +11 -37
  49. package/Layout/Layout.js +14 -37
  50. package/Layout/tests/Layout-specs.js +10 -39
  51. package/Marquee/MarqueeBase.js +31 -64
  52. package/Marquee/MarqueeController.js +11 -72
  53. package/Marquee/MarqueeDecorator.js +62 -196
  54. package/Marquee/index.js +1 -5
  55. package/Marquee/tests/Marquee-specs.js +258 -87
  56. package/Measurable/Measurable.js +12 -34
  57. package/Measurable/tests/Measurable-specs.js +115 -0
  58. package/Media/Media.js +15 -65
  59. package/Media/tests/Media-specs.js +168 -0
  60. package/Placeholder/PlaceholderControllerDecorator.js +7 -43
  61. package/Placeholder/PlaceholderDecorator.js +7 -38
  62. package/Placeholder/index.js +0 -4
  63. package/Placeholder/tests/PlaceholderControllerDecorator-specs.js +25 -0
  64. package/Placeholder/tests/PlaceholderDecorator-specs.js +28 -0
  65. package/ProgressBar/ProgressBar.js +13 -44
  66. package/ProgressBar/tests/ProgressBar-specs.js +0 -17
  67. package/RadioDecorator/RadioControllerDecorator.js +1 -29
  68. package/RadioDecorator/RadioDecorator.js +4 -42
  69. package/RadioDecorator/tests/RadioDecorator-specs.js +12 -49
  70. package/Repeater/Repeater.js +9 -33
  71. package/Repeater/tests/Repeater-specs.js +0 -38
  72. package/Resizable/Resizable.js +7 -35
  73. package/Resizable/tests/Resizable-specs.js +34 -0
  74. package/Routable/Link.js +8 -44
  75. package/Routable/Routable.js +10 -33
  76. package/Routable/Route.js +0 -6
  77. package/Routable/Router.js +13 -56
  78. package/Routable/tests/Routable-specs.js +7 -33
  79. package/Routable/tests/Router-specs.js +18 -44
  80. package/Routable/useLink.js +4 -8
  81. package/Routable/util.js +18 -24
  82. package/Scrollable/ScrollAnimator.js +49 -65
  83. package/Scrollable/ScrollThumb.js +2 -13
  84. package/Scrollable/Scrollable.js +179 -386
  85. package/Scrollable/ScrollableNative.js +188 -391
  86. package/Scrollable/Scrollbar.js +28 -100
  87. package/Scroller/Scroller.js +15 -39
  88. package/Scroller/ScrollerBasic.js +34 -89
  89. package/Scroller/UiScrollerBase.js +31 -84
  90. package/Skinnable/Skinnable.js +11 -38
  91. package/Skinnable/tests/Skinnable-specs.js +3 -74
  92. package/Skinnable/tests/useSkins-specs.js +1 -13
  93. package/Skinnable/tests/util-specs.js +0 -14
  94. package/Skinnable/useSkins.js +8 -15
  95. package/Skinnable/util.js +9 -20
  96. package/Slider/Knob.js +5 -24
  97. package/Slider/PositionDecorator.js +16 -54
  98. package/Slider/Slider.js +26 -64
  99. package/Slider/tests/Slider-specs.js +94 -7
  100. package/Slider/utils.js +0 -2
  101. package/SlotItem/SlotItem.js +15 -41
  102. package/SlotItem/tests/SlotItem-specs.js +0 -5
  103. package/Slottable/Slottable.js +4 -12
  104. package/Slottable/tests/Slottable-specs.js +19 -46
  105. package/Slottable/tests/useSlots-specs.js +27 -65
  106. package/Slottable/useSlots.js +8 -33
  107. package/Spinner/Spinner.js +15 -42
  108. package/Spinner/tests/Spinner-specs.js +0 -15
  109. package/ToggleIcon/ToggleIcon.js +10 -36
  110. package/ToggleIcon/tests/ToggleIcon-specs.js +0 -16
  111. package/ToggleItem/ToggleItem.js +15 -52
  112. package/ToggleItem/tests/ToggleItem-specs.js +0 -30
  113. package/Toggleable/Toggle.js +1 -15
  114. package/Toggleable/Toggleable.js +12 -45
  115. package/Toggleable/tests/Toggleable-specs.js +28 -96
  116. package/Toggleable/useToggle.js +3 -19
  117. package/Touchable/ClickAllow.js +5 -14
  118. package/Touchable/Drag.js +16 -54
  119. package/Touchable/Flick.js +11 -42
  120. package/Touchable/Hold.js +21 -68
  121. package/Touchable/Touch.js +37 -65
  122. package/Touchable/Touchable.js +32 -71
  123. package/Touchable/config.js +8 -22
  124. package/Touchable/tests/Touchable-specs.js +270 -119
  125. package/Touchable/tests/useTouch-specs.js +6 -80
  126. package/Touchable/useTouch.js +17 -34
  127. package/Transition/Transition.js +37 -118
  128. package/Transition/tests/Transition-specs.js +20 -60
  129. package/ViewManager/Arranger.js +10 -22
  130. package/ViewManager/TransitionGroup.js +31 -106
  131. package/ViewManager/View.js +35 -91
  132. package/ViewManager/ViewManager.js +19 -83
  133. package/ViewManager/tests/View-specs.js +0 -17
  134. package/ViewManager/tests/ViewManager-specs.js +236 -305
  135. package/ViewManager/tests/test-utils.js +0 -8
  136. package/VirtualList/UiVirtualListBase.js +256 -406
  137. package/VirtualList/VirtualList.js +29 -69
  138. package/VirtualList/VirtualListBase.js +0 -3
  139. package/VirtualList/VirtualListBasic.js +270 -428
  140. package/VirtualList/tests/VirtualList-specs.js +9 -37
  141. package/internal/IdProvider/IdProvider.js +7 -21
  142. package/internal/IdProvider/Provider.js +4 -17
  143. package/internal/IdProvider/tests/IdProvider-specs.js +44 -0
  144. package/internal/IdProvider/tests/useId-specs.js +7 -22
  145. package/internal/IdProvider/useId.js +0 -6
  146. package/internal/Pure/Pure.js +3 -30
  147. package/internal/Pure/tests/Pure-specs.js +88 -0
  148. package/internal/localized-fonts/localized-fonts.js +33 -62
  149. package/internal/localized-fonts/tests/localized-fonts-specs.js +33 -0
  150. package/internal/selection/selection.js +1 -6
  151. package/internal/selection/tests/selection-specs.js +6 -4
  152. package/internal/validators/tests/validators-specs.js +80 -0
  153. package/internal/validators/validators.js +14 -34
  154. package/package.json +8 -2
  155. package/resolution/ResolutionDecorator.js +4 -40
  156. package/resolution/index.js +0 -7
  157. package/resolution/resolution.js +42 -80
  158. package/resolution/tests/ResolutionDecorator-specs.js +4 -11
  159. package/resolution/tests/resolution-specs.js +2 -2
  160. package/useControlledState/tests/useControlledState-specs.js +15 -46
  161. package/useControlledState/useControlledState.js +11 -22
  162. package/useScroll/ScrollAnimator.js +49 -65
  163. package/useScroll/Scrollbar.js +22 -58
  164. package/useScroll/ScrollbarTrack.js +3 -19
  165. package/useScroll/useScroll.js +267 -454
  166. package/useScroll/utilDOM.js +8 -14
  167. 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
- var // Use eases library
21
- timingFunctions = {
22
- 'linear': function linear(source, target, duration, curTime) {
23
- curTime /= duration;
24
- return (target - source) * curTime + source;
25
- },
26
- 'ease-in': function easeIn(source, target, duration, curTime) {
27
- curTime /= duration;
28
- return (target - source) * curTime * curTime * curTime * curTime + source;
29
- },
30
- 'ease-out': function easeOut(source, target, duration, curTime) {
31
- curTime /= duration;
32
- curTime--;
33
- return (target - source) * (curTime * curTime * curTime * curTime * curTime + 1) + source;
34
- },
35
- 'ease-in-out': function easeInOut(source, target, duration, curTime) {
36
- curTime /= duration / 2;
37
-
38
- if (curTime < 1) {
39
- return (target - source) / 2 * curTime * curTime * curTime * curTime + source;
40
- } else {
41
- curTime -= 2;
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
- stepY = clampVelocity(velocityY * frameTime),
86
- deltaX = 0,
87
- deltaY = 0,
88
- duration = 0;
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
- startTimeStamp = (0, _util.perfNow)(),
111
- fn = function fn() {
112
- var // schedule next frame
113
- rAFId = rAF(fn),
97
+ startTimeStamp = (0, _util.perfNow)(),
98
+ fn = function fn() {
99
+ var
100
+ // schedule next frame
101
+ rAFId = rAF(fn),
114
102
  // current timestamp
115
- curTimeStamp = (0, _util.perfNow)(),
103
+ curTimeStamp = (0, _util.perfNow)(),
116
104
  // current time if 0 at starting position
117
- curTime = curTimeStamp - startTimeStamp;
118
- _this.rAFId = rAFId;
119
- rAFCallbackFuntion(curTime);
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
- styler = _ref.styler;
45
+ styler = _ref.styler;
57
46
  return styler.append({
58
47
  vertical: vertical
59
48
  });