@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.
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 +4 -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 +29 -63
  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,55 +4,30 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = exports.ScrollerBasic = void 0;
7
-
8
7
  var _propTypes = _interopRequireDefault(require("@enact/core/internal/prop-types"));
9
-
10
8
  var _platform = require("@enact/core/platform");
11
-
12
9
  var _classnames = _interopRequireDefault(require("classnames"));
13
-
14
10
  var _propTypes2 = _interopRequireDefault(require("prop-types"));
15
-
16
11
  var _react = require("react");
17
-
18
12
  var _ScrollerModule = _interopRequireDefault(require("./Scroller.module.css"));
19
-
20
13
  var _jsxRuntime = require("react/jsx-runtime");
21
-
22
14
  var _excluded = ["className", "style"];
23
-
24
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
25
-
26
16
  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; }
27
-
28
17
  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; }
29
-
30
18
  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; }
31
-
32
19
  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; }
33
-
34
20
  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; }
35
-
36
21
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
37
-
38
22
  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); } }
39
-
40
23
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
41
-
42
24
  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); }
43
-
44
25
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
45
-
46
26
  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); }; }
47
-
48
27
  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); }
49
-
50
28
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
51
-
52
29
  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; } }
53
-
54
30
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
55
-
56
31
  /**
57
32
  * An unstyled base scroller component.
58
33
  *
@@ -63,18 +38,13 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
63
38
  */
64
39
  var ScrollerBasic = /*#__PURE__*/function (_Component) {
65
40
  _inherits(ScrollerBasic, _Component);
66
-
67
41
  var _super = _createSuper(ScrollerBasic);
68
-
69
42
  function ScrollerBasic() {
70
43
  var _this;
71
-
72
44
  _classCallCheck(this, ScrollerBasic);
73
-
74
45
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
75
46
  args[_key] = arguments[_key];
76
47
  }
77
-
78
48
  _this = _super.call.apply(_super, [this].concat(args));
79
49
  _this.scrollBounds = {
80
50
  clientWidth: 0,
@@ -88,34 +58,29 @@ var ScrollerBasic = /*#__PURE__*/function (_Component) {
88
58
  top: 0,
89
59
  left: 0
90
60
  };
91
-
92
61
  _this.getScrollBounds = function () {
93
62
  return _this.scrollBounds;
94
63
  };
95
-
96
64
  _this.getRtlPositionX = function (x) {
97
65
  if (_this.props.rtl) {
98
66
  return _platform.platform.ios || _platform.platform.safari || _platform.platform.chrome >= 85 || _platform.platform.androidChrome >= 85 ? -x : _this.scrollBounds.maxLeft - x;
99
67
  }
100
-
101
68
  return x;
102
69
  };
103
-
104
70
  _this.getNodePosition = function (node) {
105
71
  var _node$getBoundingClie = node.getBoundingClientRect(),
106
- nodeLeft = _node$getBoundingClie.left,
107
- nodeTop = _node$getBoundingClie.top,
108
- nodeHeight = _node$getBoundingClie.height,
109
- nodeWidth = _node$getBoundingClie.width,
110
- _this$props$scrollCon = _this.props.scrollContentRef.current.getBoundingClientRect(),
111
- containerLeft = _this$props$scrollCon.left,
112
- containerTop = _this$props$scrollCon.top,
113
- _this$props$scrollCon2 = _this.props.scrollContentRef.current,
114
- scrollLeft = _this$props$scrollCon2.scrollLeft,
115
- scrollTop = _this$props$scrollCon2.scrollTop,
116
- left = _this.isHorizontal() ? scrollLeft + nodeLeft - containerLeft : null,
117
- top = _this.isVertical() ? scrollTop + nodeTop - containerTop : null;
118
-
72
+ nodeLeft = _node$getBoundingClie.left,
73
+ nodeTop = _node$getBoundingClie.top,
74
+ nodeHeight = _node$getBoundingClie.height,
75
+ nodeWidth = _node$getBoundingClie.width,
76
+ _this$props$scrollCon = _this.props.scrollContentRef.current.getBoundingClientRect(),
77
+ containerLeft = _this$props$scrollCon.left,
78
+ containerTop = _this$props$scrollCon.top,
79
+ _this$props$scrollCon2 = _this.props.scrollContentRef.current,
80
+ scrollLeft = _this$props$scrollCon2.scrollLeft,
81
+ scrollTop = _this$props$scrollCon2.scrollTop,
82
+ left = _this.isHorizontal() ? scrollLeft + nodeLeft - containerLeft : null,
83
+ top = _this.isVertical() ? scrollTop + nodeTop - containerTop : null;
119
84
  return {
120
85
  left: left,
121
86
  top: top,
@@ -123,39 +88,29 @@ var ScrollerBasic = /*#__PURE__*/function (_Component) {
123
88
  height: nodeHeight
124
89
  };
125
90
  };
126
-
127
91
  _this.isVertical = function () {
128
92
  return _this.props.direction !== 'horizontal';
129
93
  };
130
-
131
94
  _this.isHorizontal = function () {
132
95
  return _this.props.direction !== 'vertical';
133
96
  };
134
-
135
97
  _this.syncClientSize = function () {
136
98
  var node = _this.props.scrollContentRef.current;
137
-
138
99
  if (!node) {
139
100
  return false;
140
101
  }
141
-
142
102
  var clientWidth = node.clientWidth,
143
- clientHeight = node.clientHeight,
144
- _assertThisInitialize = _assertThisInitialized(_this),
145
- scrollBounds = _assertThisInitialize.scrollBounds;
146
-
103
+ clientHeight = node.clientHeight,
104
+ _assertThisInitialize = _assertThisInitialized(_this),
105
+ scrollBounds = _assertThisInitialize.scrollBounds;
147
106
  if (clientWidth !== scrollBounds.clientWidth || clientHeight !== scrollBounds.clientHeight) {
148
107
  _this.calculateMetrics();
149
-
150
108
  return true;
151
109
  }
152
-
153
110
  return false;
154
111
  };
155
-
156
112
  return _this;
157
113
  }
158
-
159
114
  _createClass(ScrollerBasic, [{
160
115
  key: "componentDidMount",
161
116
  value: function componentDidMount() {
@@ -165,28 +120,27 @@ var ScrollerBasic = /*#__PURE__*/function (_Component) {
165
120
  key: "componentDidUpdate",
166
121
  value: function componentDidUpdate(prevProps) {
167
122
  this.calculateMetrics();
168
-
169
123
  if (this.props.isVerticalScrollbarVisible && !prevProps.isVerticalScrollbarVisible) {
170
124
  this.forceUpdate();
171
125
  }
172
126
  }
173
127
  }, {
174
128
  key: "setScrollPosition",
175
- value: // scrollMode 'translate'
129
+ value:
130
+ // scrollMode 'translate'
176
131
  function setScrollPosition(x, y) {
177
132
  var node = this.props.scrollContentRef.current;
178
-
179
133
  if (this.isVertical()) {
180
134
  node.scrollTop = y;
181
135
  this.scrollPos.top = y;
182
136
  }
183
-
184
137
  if (this.isHorizontal()) {
185
138
  node.scrollLeft = this.getRtlPositionX(x);
186
139
  this.scrollPos.left = x;
187
140
  }
188
- } // scrollMode 'native'
141
+ }
189
142
 
143
+ // scrollMode 'native'
190
144
  }, {
191
145
  key: "scrollToPosition",
192
146
  value: function scrollToPosition(left, top, behavior) {
@@ -195,8 +149,9 @@ var ScrollerBasic = /*#__PURE__*/function (_Component) {
195
149
  top: top,
196
150
  behavior: behavior
197
151
  });
198
- } // scrollMode 'native'
152
+ }
199
153
 
154
+ // scrollMode 'native'
200
155
  }, {
201
156
  key: "didScroll",
202
157
  value: function didScroll(x, y) {
@@ -207,11 +162,11 @@ var ScrollerBasic = /*#__PURE__*/function (_Component) {
207
162
  key: "calculateMetrics",
208
163
  value: function calculateMetrics() {
209
164
  var scrollBounds = this.scrollBounds,
210
- _this$props$scrollCon3 = this.props.scrollContentRef.current,
211
- scrollWidth = _this$props$scrollCon3.scrollWidth,
212
- scrollHeight = _this$props$scrollCon3.scrollHeight,
213
- clientWidth = _this$props$scrollCon3.clientWidth,
214
- clientHeight = _this$props$scrollCon3.clientHeight;
165
+ _this$props$scrollCon3 = this.props.scrollContentRef.current,
166
+ scrollWidth = _this$props$scrollCon3.scrollWidth,
167
+ scrollHeight = _this$props$scrollCon3.scrollHeight,
168
+ clientWidth = _this$props$scrollCon3.clientWidth,
169
+ clientHeight = _this$props$scrollCon3.clientHeight;
215
170
  scrollBounds.scrollWidth = scrollWidth;
216
171
  scrollBounds.scrollHeight = scrollHeight;
217
172
  scrollBounds.clientWidth = clientWidth;
@@ -223,14 +178,13 @@ var ScrollerBasic = /*#__PURE__*/function (_Component) {
223
178
  key: "render",
224
179
  value: function render() {
225
180
  var _this$props = this.props,
226
- className = _this$props.className,
227
- style = _this$props.style,
228
- rest = _objectWithoutProperties(_this$props, _excluded),
229
- mergedStyle = Object.assign({}, style, {
230
- overflowX: this.isHorizontal() ? 'auto' : 'hidden',
231
- overflowY: this.isVertical() ? 'auto' : 'hidden'
232
- });
233
-
181
+ className = _this$props.className,
182
+ style = _this$props.style,
183
+ rest = _objectWithoutProperties(_this$props, _excluded),
184
+ mergedStyle = Object.assign({}, style, {
185
+ overflowX: this.isHorizontal() ? 'auto' : 'hidden',
186
+ overflowY: this.isVertical() ? 'auto' : 'hidden'
187
+ });
234
188
  delete rest.cbScrollTo;
235
189
  delete rest.direction;
236
190
  delete rest.isHorizontalScrollbarVisible;
@@ -247,17 +201,12 @@ var ScrollerBasic = /*#__PURE__*/function (_Component) {
247
201
  }));
248
202
  }
249
203
  }]);
250
-
251
204
  return ScrollerBasic;
252
205
  }(_react.Component);
253
-
254
206
  exports.ScrollerBasic = ScrollerBasic;
255
207
  ScrollerBasic.displayName = 'ui:ScrollerBasic';
256
- ScrollerBasic.propTypes =
257
- /** @lends ui/Scroller.ScrollerBasic.prototype */
258
- {
208
+ ScrollerBasic.propTypes = /** @lends ui/Scroller.ScrollerBasic.prototype */{
259
209
  children: _propTypes2["default"].node.isRequired,
260
-
261
210
  /**
262
211
  * Callback method of scrollTo.
263
212
  * Normally, `useScroll` should set this value.
@@ -266,7 +215,6 @@ ScrollerBasic.propTypes =
266
215
  * @private
267
216
  */
268
217
  cbScrollTo: _propTypes2["default"].func,
269
-
270
218
  /**
271
219
  * Direction of the scroller.
272
220
  *
@@ -280,7 +228,6 @@ ScrollerBasic.propTypes =
280
228
  * @public
281
229
  */
282
230
  direction: _propTypes2["default"].oneOf(['both', 'horizontal', 'vertical']),
283
-
284
231
  /**
285
232
  * Prop to check context value if Scrollbar exists or not.
286
233
  *
@@ -288,7 +235,6 @@ ScrollerBasic.propTypes =
288
235
  * @private
289
236
  */
290
237
  isVerticalScrollbarVisible: _propTypes2["default"].bool,
291
-
292
238
  /**
293
239
  * `true` if RTL, `false` if LTR.
294
240
  *
@@ -296,7 +242,6 @@ ScrollerBasic.propTypes =
296
242
  * @private
297
243
  */
298
244
  rtl: _propTypes2["default"].bool,
299
-
300
245
  /**
301
246
  * Ref for scroll content
302
247
  *
@@ -4,53 +4,29 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = exports.ScrollerBase = void 0;
7
-
8
7
  var _classnames = _interopRequireDefault(require("classnames"));
9
-
10
8
  var _platform = require("@enact/core/platform");
11
-
12
9
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
-
14
10
  var _react = require("react");
15
-
16
11
  var _UiScrollerModule = _interopRequireDefault(require("./UiScroller.module.css"));
17
-
18
12
  var _jsxRuntime = require("react/jsx-runtime");
19
-
20
13
  var _excluded = ["className", "style"];
21
-
22
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
23
-
24
15
  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; }
25
-
26
16
  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; }
27
-
28
17
  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; }
29
-
30
18
  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; }
31
-
32
19
  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; }
33
-
34
20
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
35
-
36
21
  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); } }
37
-
38
22
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
39
-
40
23
  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); }
41
-
42
24
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
43
-
44
25
  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); }; }
45
-
46
26
  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); }
47
-
48
27
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
49
-
50
28
  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; } }
51
-
52
29
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
53
-
54
30
  /**
55
31
  * An unstyled base scroller component.
56
32
  *
@@ -63,14 +39,10 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
63
39
  */
64
40
  var ScrollerBase = /*#__PURE__*/function (_Component) {
65
41
  _inherits(ScrollerBase, _Component);
66
-
67
42
  var _super = _createSuper(ScrollerBase);
68
-
69
43
  function ScrollerBase(props) {
70
44
  var _this;
71
-
72
45
  _classCallCheck(this, ScrollerBase);
73
-
74
46
  _this = _super.call(this, props);
75
47
  _this.scrollBounds = {
76
48
  clientWidth: 0,
@@ -84,34 +56,29 @@ var ScrollerBase = /*#__PURE__*/function (_Component) {
84
56
  top: 0,
85
57
  left: 0
86
58
  };
87
-
88
59
  _this.getScrollBounds = function () {
89
60
  return _this.scrollBounds;
90
61
  };
91
-
92
62
  _this.getRtlPositionX = function (x) {
93
63
  if (_this.props.rtl) {
94
64
  return _platform.platform.ios || _platform.platform.safari || _platform.platform.chrome >= 85 || _platform.platform.androidChrome >= 85 ? -x : _this.scrollBounds.maxLeft - x;
95
65
  }
96
-
97
66
  return x;
98
67
  };
99
-
100
68
  _this.getNodePosition = function (node) {
101
69
  var _node$getBoundingClie = node.getBoundingClientRect(),
102
- nodeLeft = _node$getBoundingClie.left,
103
- nodeTop = _node$getBoundingClie.top,
104
- nodeHeight = _node$getBoundingClie.height,
105
- nodeWidth = _node$getBoundingClie.width,
106
- _this$containerRef$cu = _this.containerRef.current.getBoundingClientRect(),
107
- containerLeft = _this$containerRef$cu.left,
108
- containerTop = _this$containerRef$cu.top,
109
- _this$containerRef$cu2 = _this.containerRef.current,
110
- scrollLeft = _this$containerRef$cu2.scrollLeft,
111
- scrollTop = _this$containerRef$cu2.scrollTop,
112
- left = _this.isHorizontal() ? scrollLeft + nodeLeft - containerLeft : null,
113
- top = _this.isVertical() ? scrollTop + nodeTop - containerTop : null;
114
-
70
+ nodeLeft = _node$getBoundingClie.left,
71
+ nodeTop = _node$getBoundingClie.top,
72
+ nodeHeight = _node$getBoundingClie.height,
73
+ nodeWidth = _node$getBoundingClie.width,
74
+ _this$containerRef$cu = _this.containerRef.current.getBoundingClientRect(),
75
+ containerLeft = _this$containerRef$cu.left,
76
+ containerTop = _this$containerRef$cu.top,
77
+ _this$containerRef$cu2 = _this.containerRef.current,
78
+ scrollLeft = _this$containerRef$cu2.scrollLeft,
79
+ scrollTop = _this$containerRef$cu2.scrollTop,
80
+ left = _this.isHorizontal() ? scrollLeft + nodeLeft - containerLeft : null,
81
+ top = _this.isVertical() ? scrollTop + nodeTop - containerTop : null;
115
82
  return {
116
83
  left: left,
117
84
  top: top,
@@ -119,19 +86,15 @@ var ScrollerBase = /*#__PURE__*/function (_Component) {
119
86
  height: nodeHeight
120
87
  };
121
88
  };
122
-
123
89
  _this.isVertical = function () {
124
90
  return _this.props.direction !== 'horizontal';
125
91
  };
126
-
127
92
  _this.isHorizontal = function () {
128
93
  return _this.props.direction !== 'vertical';
129
94
  };
130
-
131
95
  _this.containerRef = /*#__PURE__*/(0, _react.createRef)();
132
96
  return _this;
133
97
  }
134
-
135
98
  _createClass(ScrollerBase, [{
136
99
  key: "componentDidMount",
137
100
  value: function componentDidMount() {
@@ -141,34 +104,34 @@ var ScrollerBase = /*#__PURE__*/function (_Component) {
141
104
  key: "componentDidUpdate",
142
105
  value: function componentDidUpdate(prevProps) {
143
106
  this.calculateMetrics();
144
-
145
107
  if (this.props.isVerticalScrollbarVisible && !prevProps.isVerticalScrollbarVisible) {
146
108
  this.forceUpdate();
147
109
  }
148
110
  }
149
111
  }, {
150
112
  key: "setScrollPosition",
151
- value: // for Scrollable
113
+ value:
114
+ // for Scrollable
152
115
  function setScrollPosition(x, y) {
153
116
  var node = this.containerRef.current;
154
-
155
117
  if (this.isVertical()) {
156
118
  node.scrollTop = y;
157
119
  this.scrollPos.top = y;
158
120
  }
159
-
160
121
  if (this.isHorizontal()) {
161
122
  node.scrollLeft = this.getRtlPositionX(x);
162
123
  this.scrollPos.left = x;
163
124
  }
164
- } // for ScrollableNative
125
+ }
165
126
 
127
+ // for ScrollableNative
166
128
  }, {
167
129
  key: "scrollToPosition",
168
130
  value: function scrollToPosition(x, y) {
169
131
  this.containerRef.current.scrollTo(this.getRtlPositionX(x), y);
170
- } // for ScrollableNative
132
+ }
171
133
 
134
+ // for ScrollableNative
172
135
  }, {
173
136
  key: "didScroll",
174
137
  value: function didScroll(x, y) {
@@ -179,11 +142,11 @@ var ScrollerBase = /*#__PURE__*/function (_Component) {
179
142
  key: "calculateMetrics",
180
143
  value: function calculateMetrics() {
181
144
  var scrollBounds = this.scrollBounds,
182
- _this$containerRef$cu3 = this.containerRef.current,
183
- scrollWidth = _this$containerRef$cu3.scrollWidth,
184
- scrollHeight = _this$containerRef$cu3.scrollHeight,
185
- clientWidth = _this$containerRef$cu3.clientWidth,
186
- clientHeight = _this$containerRef$cu3.clientHeight;
145
+ _this$containerRef$cu3 = this.containerRef.current,
146
+ scrollWidth = _this$containerRef$cu3.scrollWidth,
147
+ scrollHeight = _this$containerRef$cu3.scrollHeight,
148
+ clientWidth = _this$containerRef$cu3.clientWidth,
149
+ clientHeight = _this$containerRef$cu3.clientHeight;
187
150
  scrollBounds.scrollWidth = scrollWidth;
188
151
  scrollBounds.scrollHeight = scrollHeight;
189
152
  scrollBounds.clientWidth = clientWidth;
@@ -195,14 +158,13 @@ var ScrollerBase = /*#__PURE__*/function (_Component) {
195
158
  key: "render",
196
159
  value: function render() {
197
160
  var _this$props = this.props,
198
- className = _this$props.className,
199
- style = _this$props.style,
200
- rest = _objectWithoutProperties(_this$props, _excluded),
201
- mergedStyle = Object.assign({}, style, {
202
- overflowX: this.isHorizontal() ? 'auto' : 'hidden',
203
- overflowY: this.isVertical() ? 'auto' : 'hidden'
204
- });
205
-
161
+ className = _this$props.className,
162
+ style = _this$props.style,
163
+ rest = _objectWithoutProperties(_this$props, _excluded),
164
+ mergedStyle = Object.assign({}, style, {
165
+ overflowX: this.isHorizontal() ? 'auto' : 'hidden',
166
+ overflowY: this.isVertical() ? 'auto' : 'hidden'
167
+ });
206
168
  delete rest.cbScrollTo;
207
169
  delete rest.direction;
208
170
  delete rest.isHorizontalScrollbarVisible;
@@ -215,7 +177,6 @@ var ScrollerBase = /*#__PURE__*/function (_Component) {
215
177
  }));
216
178
  }
217
179
  }]);
218
-
219
180
  return ScrollerBase;
220
181
  }(_react.Component);
221
182
  /**
@@ -248,7 +209,6 @@ var ScrollerBase = /*#__PURE__*/function (_Component) {
248
209
  * @type {Function}
249
210
  * @public
250
211
  */
251
-
252
212
  /**
253
213
  * Specifies how to show horizontal scrollbar.
254
214
  *
@@ -263,7 +223,6 @@ var ScrollerBase = /*#__PURE__*/function (_Component) {
263
223
  * @default 'auto'
264
224
  * @public
265
225
  */
266
-
267
226
  /**
268
227
  * Prevents scroll by wheeling on the scroller.
269
228
  *
@@ -273,7 +232,6 @@ var ScrollerBase = /*#__PURE__*/function (_Component) {
273
232
  * @default false
274
233
  * @public
275
234
  */
276
-
277
235
  /**
278
236
  * Called when scrolling.
279
237
  *
@@ -290,7 +248,6 @@ var ScrollerBase = /*#__PURE__*/function (_Component) {
290
248
  * @param {Object} event.moreInfo The object including `firstVisibleIndex` and `lastVisibleIndex` properties.
291
249
  * @public
292
250
  */
293
-
294
251
  /**
295
252
  * Called when scroll starts.
296
253
  *
@@ -320,7 +277,6 @@ var ScrollerBase = /*#__PURE__*/function (_Component) {
320
277
  * @param {Object} event.moreInfo The object including `firstVisibleIndex` and `lastVisibleIndex` properties.
321
278
  * @public
322
279
  */
323
-
324
280
  /**
325
281
  * Called when scroll stops.
326
282
  *
@@ -350,7 +306,6 @@ var ScrollerBase = /*#__PURE__*/function (_Component) {
350
306
  * @param {Object} event.moreInfo The object including `firstVisibleIndex` and `lastVisibleIndex` properties.
351
307
  * @public
352
308
  */
353
-
354
309
  /**
355
310
  * Specifies how to show vertical scrollbar.
356
311
  *
@@ -365,15 +320,10 @@ var ScrollerBase = /*#__PURE__*/function (_Component) {
365
320
  * @default 'auto'
366
321
  * @public
367
322
  */
368
-
369
-
370
323
  exports.ScrollerBase = ScrollerBase;
371
324
  ScrollerBase.displayName = 'ui:ScrollerBase';
372
- ScrollerBase.propTypes =
373
- /** @lends ui/Scroller.ScrollerBase.prototype */
374
- {
325
+ ScrollerBase.propTypes = /** @lends ui/Scroller.ScrollerBase.prototype */{
375
326
  children: _propTypes["default"].node.isRequired,
376
-
377
327
  /**
378
328
  * Callback method of scrollTo.
379
329
  * Normally, `Scrollable` should set this value.
@@ -382,7 +332,6 @@ ScrollerBase.propTypes =
382
332
  * @private
383
333
  */
384
334
  cbScrollTo: _propTypes["default"].func,
385
-
386
335
  /**
387
336
  * Direction of the scroller.
388
337
  *
@@ -396,7 +345,6 @@ ScrollerBase.propTypes =
396
345
  * @public
397
346
  */
398
347
  direction: _propTypes["default"].oneOf(['both', 'horizontal', 'vertical']),
399
-
400
348
  /**
401
349
  * Prop to check context value if Scrollbar exists or not.
402
350
  *
@@ -404,7 +352,6 @@ ScrollerBase.propTypes =
404
352
  * @private
405
353
  */
406
354
  isVerticalScrollbarVisible: _propTypes["default"].bool,
407
-
408
355
  /**
409
356
  * `true` if RTL, `false` if LTR.
410
357
  *