@enact/ui 4.5.2 → 4.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (222) 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 +8 -28
  8. package/BodyText/tests/BodyText-specs.js +0 -19
  9. package/Button/Button.js +33 -63
  10. package/Button/tests/Button-specs.js +0 -26
  11. package/CHANGELOG.md +45 -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/package.json +3 -0
  25. package/FloatingLayer/tests/FloatingLayer-specs.js +8 -22
  26. package/FloatingLayer/tests/Scrim-specs.js +0 -9
  27. package/FloatingLayer/tests/useFloatingLayerDecorator-specs.js +0 -13
  28. package/FloatingLayer/useFloatingLayer.js +3 -14
  29. package/FloatingLayer/useFloatingLayerDecorator.js +3 -11
  30. package/ForwardRef/ForwardRef.js +1 -10
  31. package/GridListImageItem/GridListImageItem.js +18 -51
  32. package/Group/Group.js +5 -36
  33. package/Group/GroupItem.js +16 -33
  34. package/Group/tests/Group-specs.js +0 -32
  35. package/Heading/Heading.js +8 -36
  36. package/Heading/tests/Heading-specs.js +81 -14
  37. package/Icon/Icon.js +19 -53
  38. package/Icon/tests/Icon-specs.js +0 -22
  39. package/IconButton/IconButton.js +24 -57
  40. package/IconButton/tests/IconButton-specs.js +0 -7
  41. package/Image/Image.js +17 -46
  42. package/Image/tests/Image-specs.js +0 -14
  43. package/ImageItem/ImageItem.js +18 -47
  44. package/ImageItem/tests/ImageItem-specs.js +0 -25
  45. package/Item/Item.js +9 -33
  46. package/Item/tests/Item-specs.js +0 -24
  47. package/LabeledIcon/LabeledIcon.js +22 -53
  48. package/LabeledIcon/tests/LabeledIcon-specs.js +0 -14
  49. package/Layout/Cell.js +18 -44
  50. package/Layout/Layout.js +23 -46
  51. package/Layout/tests/Layout-specs.js +10 -39
  52. package/Marquee/MarqueeBase.js +29 -63
  53. package/Marquee/MarqueeController.js +11 -72
  54. package/Marquee/MarqueeDecorator.js +70 -196
  55. package/Marquee/index.js +1 -5
  56. package/Marquee/tests/Marquee-specs.js +295 -87
  57. package/Measurable/Measurable.js +12 -34
  58. package/Measurable/tests/Measurable-specs.js +115 -0
  59. package/Media/Media.js +15 -65
  60. package/Media/tests/Media-specs.js +168 -0
  61. package/Placeholder/PlaceholderControllerDecorator.js +7 -43
  62. package/Placeholder/PlaceholderDecorator.js +7 -38
  63. package/Placeholder/index.js +1 -5
  64. package/Placeholder/tests/PlaceholderControllerDecorator-specs.js +25 -0
  65. package/Placeholder/tests/PlaceholderDecorator-specs.js +28 -0
  66. package/ProgressBar/ProgressBar.js +14 -45
  67. package/ProgressBar/tests/ProgressBar-specs.js +0 -17
  68. package/RadioDecorator/RadioControllerDecorator.js +7 -29
  69. package/RadioDecorator/RadioDecorator.js +9 -42
  70. package/RadioDecorator/tests/RadioDecorator-specs.js +12 -49
  71. package/Repeater/Repeater.js +9 -33
  72. package/Repeater/tests/Repeater-specs.js +0 -38
  73. package/Resizable/Resizable.js +9 -37
  74. package/Resizable/tests/Resizable-specs.js +34 -0
  75. package/Routable/Link.js +11 -47
  76. package/Routable/Routable.js +12 -35
  77. package/Routable/Route.js +0 -6
  78. package/Routable/Router.js +15 -58
  79. package/Routable/tests/Routable-specs.js +7 -33
  80. package/Routable/tests/Router-specs.js +18 -44
  81. package/Routable/useLink.js +4 -8
  82. package/Routable/util.js +18 -24
  83. package/Scrollable/ScrollAnimator.js +49 -65
  84. package/Scrollable/ScrollThumb.js +2 -13
  85. package/Scrollable/Scrollable.js +180 -387
  86. package/Scrollable/ScrollableNative.js +189 -392
  87. package/Scrollable/Scrollbar.js +30 -102
  88. package/Scroller/Scroller.js +15 -39
  89. package/Scroller/ScrollerBasic.js +34 -89
  90. package/Scroller/UiScrollerBase.js +37 -84
  91. package/Scroller/tests/Scroller-specs.js +56 -0
  92. package/Skinnable/Skinnable.js +11 -38
  93. package/Skinnable/tests/Skinnable-specs.js +3 -74
  94. package/Skinnable/tests/useSkins-specs.js +1 -13
  95. package/Skinnable/tests/util-specs.js +0 -14
  96. package/Skinnable/useSkins.js +8 -15
  97. package/Skinnable/util.js +9 -20
  98. package/Slider/Knob.js +5 -24
  99. package/Slider/PositionDecorator.js +16 -54
  100. package/Slider/Slider.js +29 -67
  101. package/Slider/tests/Slider-specs.js +94 -7
  102. package/Slider/utils.js +0 -2
  103. package/SlotItem/SlotItem.js +23 -45
  104. package/SlotItem/tests/SlotItem-specs.js +0 -5
  105. package/Slottable/Slottable.js +4 -12
  106. package/Slottable/tests/Slottable-specs.js +19 -46
  107. package/Slottable/tests/useSlots-specs.js +27 -65
  108. package/Slottable/useSlots.js +8 -33
  109. package/Spinner/Spinner.js +16 -43
  110. package/Spinner/tests/Spinner-specs.js +0 -15
  111. package/ToggleIcon/ToggleIcon.js +10 -36
  112. package/ToggleIcon/tests/ToggleIcon-specs.js +0 -16
  113. package/ToggleItem/ToggleItem.js +24 -57
  114. package/ToggleItem/tests/ToggleItem-specs.js +0 -30
  115. package/Toggleable/Toggle.js +1 -15
  116. package/Toggleable/Toggleable.js +12 -45
  117. package/Toggleable/tests/Toggleable-specs.js +28 -96
  118. package/Toggleable/useToggle.js +3 -19
  119. package/Touchable/ClickAllow.js +5 -14
  120. package/Touchable/Drag.js +16 -54
  121. package/Touchable/Flick.js +11 -42
  122. package/Touchable/Hold.js +21 -68
  123. package/Touchable/Pinch.js +185 -0
  124. package/Touchable/Touch.js +71 -76
  125. package/Touchable/Touchable.js +95 -75
  126. package/Touchable/config.js +27 -24
  127. package/Touchable/tests/Touchable-specs.js +360 -119
  128. package/Touchable/tests/useTouch-specs.js +6 -80
  129. package/Touchable/useTouch.js +57 -65
  130. package/Transition/Transition.js +37 -118
  131. package/Transition/tests/Transition-specs.js +20 -60
  132. package/ViewManager/Arranger.js +10 -22
  133. package/ViewManager/TransitionGroup.js +32 -107
  134. package/ViewManager/View.js +35 -91
  135. package/ViewManager/ViewManager.js +20 -84
  136. package/ViewManager/tests/View-specs.js +0 -17
  137. package/ViewManager/tests/ViewManager-specs.js +236 -305
  138. package/ViewManager/tests/test-utils.js +0 -8
  139. package/VirtualList/UiVirtualListBase.js +265 -409
  140. package/VirtualList/VirtualList.js +29 -69
  141. package/VirtualList/VirtualListBase.js +0 -3
  142. package/VirtualList/VirtualListBasic.js +273 -431
  143. package/VirtualList/tests/VirtualGridList-native-specs.js +161 -0
  144. package/VirtualList/tests/VirtualGridList-specs.js +614 -0
  145. package/VirtualList/tests/VirtualList-native-specs.js +152 -0
  146. package/VirtualList/tests/VirtualList-specs.js +423 -95
  147. package/internal/IdProvider/IdProvider.js +7 -21
  148. package/internal/IdProvider/Provider.js +4 -17
  149. package/internal/IdProvider/tests/IdProvider-specs.js +44 -0
  150. package/internal/IdProvider/tests/useId-specs.js +6 -20
  151. package/internal/IdProvider/useId.js +0 -6
  152. package/internal/Pure/Pure.js +3 -30
  153. package/internal/Pure/tests/Pure-specs.js +88 -0
  154. package/internal/localized-fonts/localized-fonts.js +33 -62
  155. package/internal/localized-fonts/tests/localized-fonts-specs.js +33 -0
  156. package/internal/selection/selection.js +1 -6
  157. package/internal/selection/tests/selection-specs.js +6 -4
  158. package/internal/validators/tests/validators-specs.js +80 -0
  159. package/internal/validators/validators.js +14 -34
  160. package/package.json +9 -3
  161. package/resolution/ResolutionDecorator.js +4 -40
  162. package/resolution/index.js +0 -7
  163. package/resolution/resolution.js +42 -80
  164. package/resolution/tests/ResolutionDecorator-specs.js +4 -11
  165. package/resolution/tests/resolution-specs.js +2 -2
  166. package/useControlledState/tests/useControlledState-specs.js +15 -46
  167. package/useControlledState/useControlledState.js +11 -22
  168. package/useScroll/ScrollAnimator.js +49 -65
  169. package/useScroll/Scrollbar.js +22 -58
  170. package/useScroll/ScrollbarTrack.js +3 -19
  171. package/useScroll/useScroll.js +267 -454
  172. package/useScroll/utilDOM.js +8 -14
  173. package/useScroll/utilEvent.js +0 -4
  174. package/AnnounceDecorator/AnnounceDecorator.d.ts +0 -64
  175. package/BodyText/BodyText.d.ts +0 -66
  176. package/Button/Button.d.ts +0 -125
  177. package/Cancelable/Cancelable.d.ts +0 -64
  178. package/Changeable/Changeable.d.ts +0 -54
  179. package/ComponentOverride/ComponentOverride.d.ts +0 -52
  180. package/ForwardRef/ForwardRef.d.ts +0 -22
  181. package/GridListImageItem/GridListImageItem.d.ts +0 -85
  182. package/Group/Group.d.ts +0 -107
  183. package/Heading/Heading.d.ts +0 -90
  184. package/Icon/Icon.d.ts +0 -88
  185. package/IconButton/IconButton.d.ts +0 -115
  186. package/Image/Image.d.ts +0 -113
  187. package/ImageItem/ImageItem.d.ts +0 -83
  188. package/Item/Item.d.ts +0 -64
  189. package/LabeledIcon/LabeledIcon.d.ts +0 -130
  190. package/Layout/Layout.d.ts +0 -247
  191. package/Marquee/index.d.ts +0 -258
  192. package/Measurable/Measurable.d.ts +0 -26
  193. package/Media/Media.d.ts +0 -99
  194. package/Placeholder/index.d.ts +0 -53
  195. package/ProgressBar/ProgressBar.d.ts +0 -92
  196. package/RadioDecorator/RadioDecorator.d.ts +0 -35
  197. package/Repeater/Repeater.d.ts +0 -83
  198. package/Resizable/Resizable.d.ts +0 -31
  199. package/Routable/Routable.d.ts +0 -148
  200. package/Scrollable/Scrollable.d.ts +0 -0
  201. package/Scroller/Scroller.d.ts +0 -276
  202. package/Skinnable/Skinnable.d.ts +0 -94
  203. package/Slider/Slider.d.ts +0 -202
  204. package/SlotItem/SlotItem.d.ts +0 -118
  205. package/Slottable/Slottable.d.ts +0 -22
  206. package/Spinner/Spinner.d.ts +0 -95
  207. package/ToggleIcon/ToggleIcon.d.ts +0 -90
  208. package/ToggleItem/ToggleItem.d.ts +0 -134
  209. package/Toggleable/Toggleable.d.ts +0 -103
  210. package/Touchable/Touchable.d.ts +0 -175
  211. package/Transition/Transition.d.ts +0 -196
  212. package/ViewManager/ViewManager.d.ts +0 -191
  213. package/VirtualList/VirtualList.d.ts +0 -530
  214. package/index.d.ts +0 -0
  215. package/internal/IdProvider/IdProvider.d.ts +0 -0
  216. package/internal/Pure/Pure.d.ts +0 -0
  217. package/internal/localized-fonts/localized-fonts.d.ts +0 -53
  218. package/internal/selection/selection.d.ts +0 -0
  219. package/internal/validators/validators.d.ts +0 -0
  220. package/resolution/index.d.ts +0 -187
  221. package/useControlledState/useControlledState.d.ts +0 -0
  222. package/useScroll/useScroll.d.ts +0 -0
package/Button/Button.js CHANGED
@@ -4,39 +4,22 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = exports.ButtonDecorator = exports.ButtonBase = exports.Button = void 0;
7
-
8
7
  var _propTypes = _interopRequireDefault(require("@enact/core/internal/prop-types"));
9
-
10
8
  var _kind = _interopRequireDefault(require("@enact/core/kind"));
11
-
12
9
  var _propTypes2 = _interopRequireDefault(require("prop-types"));
13
-
14
10
  var _compose = _interopRequireDefault(require("ramda/src/compose"));
15
-
16
11
  var _ComponentOverride = _interopRequireDefault(require("../ComponentOverride"));
17
-
18
12
  var _ForwardRef = _interopRequireDefault(require("../ForwardRef"));
19
-
20
13
  var _Touchable = _interopRequireDefault(require("../Touchable"));
21
-
22
14
  var _ButtonModule = _interopRequireDefault(require("./Button.module.css"));
23
-
24
15
  var _jsxRuntime = require("react/jsx-runtime");
25
-
26
16
  var _excluded = ["children", "componentRef", "css", "decoration", "disabled", "icon"];
27
-
28
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": 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 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; }
35
-
36
21
  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; }
37
-
38
22
  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; }
39
-
40
23
  /**
41
24
  * A basic button component structure without any behaviors applied to it.
42
25
  *
@@ -47,9 +30,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
47
30
  */
48
31
  var ButtonBase = (0, _kind["default"])({
49
32
  name: 'ui:Button',
50
- propTypes:
51
- /** @lends ui/Button.ButtonBase.prototype */
52
- {
33
+ propTypes: /** @lends ui/Button.ButtonBase.prototype */{
53
34
  /**
54
35
  * Called with a reference to the root component.
55
36
  *
@@ -60,7 +41,6 @@ var ButtonBase = (0, _kind["default"])({
60
41
  * @public
61
42
  */
62
43
  componentRef: _propTypes["default"].ref,
63
-
64
44
  /**
65
45
  * Customizes the component by mapping the supplied collection of CSS class names to the
66
46
  * corresponding internal elements and states of this component.
@@ -82,7 +62,6 @@ var ButtonBase = (0, _kind["default"])({
82
62
  * @public
83
63
  */
84
64
  css: _propTypes2["default"].object,
85
-
86
65
  /**
87
66
  * Additional DOM nodes which may be necessary for decorating the Button.
88
67
  *
@@ -90,7 +69,6 @@ var ButtonBase = (0, _kind["default"])({
90
69
  * @private
91
70
  */
92
71
  decoration: _propTypes2["default"].node,
93
-
94
72
  /**
95
73
  * Applies the `disabled` class.
96
74
  *
@@ -101,7 +79,6 @@ var ButtonBase = (0, _kind["default"])({
101
79
  * @public
102
80
  */
103
81
  disabled: _propTypes2["default"].bool,
104
-
105
82
  /**
106
83
  * The icon displayed within the Button.
107
84
  *
@@ -122,12 +99,11 @@ var ButtonBase = (0, _kind["default"])({
122
99
  * @public
123
100
  */
124
101
  icon: _propTypes2["default"].oneOfType([_propTypes2["default"].node, _propTypes2["default"].bool]),
125
-
126
102
  /**
127
- * The component used to render the [icon]{@link ui/Button.ButtonBase.icon}.
103
+ * The component used to render the {@link ui/Button.ButtonBase.icon|icon}.
128
104
  *
129
105
  * This component will receive the `icon` class to customize its styling.
130
- * If [icon]{@link ui/Button.ButtonBase.icon} is not assigned or is false, this component
106
+ * If {@link ui/Button.ButtonBase.icon|icon} is not assigned or is false, this component
131
107
  * will not be rendered.
132
108
  *
133
109
  * If this is a component rather than an HTML element string, this component will also
@@ -138,7 +114,6 @@ var ButtonBase = (0, _kind["default"])({
138
114
  * @public
139
115
  */
140
116
  iconComponent: _propTypes["default"].componentOverride,
141
-
142
117
  /**
143
118
  * Flips the icon.
144
119
  *
@@ -147,48 +122,44 @@ var ButtonBase = (0, _kind["default"])({
147
122
  * @public
148
123
  */
149
124
  iconFlip: _propTypes2["default"].string,
150
-
151
125
  /**
152
126
  * Enforces a minimum width for the component.
153
127
  *
154
128
  * Applies the `minWidth` CSS class which can be customized by
155
- * [theming]{@link /docs/developer-guide/theming/}.
129
+ * {@link /docs/developer-guide/theming/|theming}.
156
130
  *
157
131
  * @type {Boolean}
158
132
  * @default true
159
133
  * @public
160
134
  */
161
135
  minWidth: _propTypes2["default"].bool,
162
-
163
136
  /**
164
137
  * Indicates the component is depressed.
165
138
  *
166
139
  * Applies the `pressed` CSS class which can be customized by
167
- * [theming]{@link /docs/developer-guide/theming/}.
140
+ * {@link /docs/developer-guide/theming/|theming}.
168
141
  *
169
142
  * @type {Boolean}
170
143
  * @default false
171
144
  * @public
172
145
  */
173
146
  pressed: _propTypes2["default"].bool,
174
-
175
147
  /**
176
148
  * Indicates the component is selected.
177
149
  *
178
150
  * Applies the `selected` CSS class which can be customized by
179
- * [theming]{@link /docs/developer-guide/theming/}.
151
+ * {@link /docs/developer-guide/theming/|theming}.
180
152
  *
181
153
  * @type {Boolean}
182
154
  * @default false
183
155
  * @public
184
156
  */
185
157
  selected: _propTypes2["default"].bool,
186
-
187
158
  /**
188
159
  * The size of the button.
189
160
  *
190
161
  * Applies the CSS class which can be customized by
191
- * [theming]{@link /docs/developer-guide/theming/}.
162
+ * {@link /docs/developer-guide/theming/|theming}.
192
163
  *
193
164
  * @type {String}
194
165
  * @public
@@ -209,11 +180,11 @@ var ButtonBase = (0, _kind["default"])({
209
180
  computed: {
210
181
  className: function className(_ref) {
211
182
  var icon = _ref.icon,
212
- minWidth = _ref.minWidth,
213
- pressed = _ref.pressed,
214
- selected = _ref.selected,
215
- size = _ref.size,
216
- styler = _ref.styler;
183
+ minWidth = _ref.minWidth,
184
+ pressed = _ref.pressed,
185
+ selected = _ref.selected,
186
+ size = _ref.size,
187
+ styler = _ref.styler;
217
188
  return styler.append({
218
189
  hasIcon: !!icon,
219
190
  minWidth: minWidth,
@@ -223,42 +194,41 @@ var ButtonBase = (0, _kind["default"])({
223
194
  },
224
195
  icon: function icon(_ref2) {
225
196
  var css = _ref2.css,
226
- _icon = _ref2.icon,
227
- iconComponent = _ref2.iconComponent,
228
- iconFlip = _ref2.iconFlip,
229
- size = _ref2.size;
230
- if (_icon == null || _icon === false) return; // Establish the base collection of props for the most basic `iconComponent` type, an
231
- // HTML element string.
197
+ _icon = _ref2.icon,
198
+ iconComponent = _ref2.iconComponent,
199
+ iconFlip = _ref2.iconFlip,
200
+ size = _ref2.size;
201
+ if (_icon == null || _icon === false) return;
232
202
 
203
+ // Establish the base collection of props for the most basic `iconComponent` type, an
204
+ // HTML element string.
233
205
  var props = {
234
206
  className: css.icon,
235
207
  component: iconComponent
236
- }; // Add in additional props that any Component supplied to `iconComponent` should be
237
- // configured to handle.
208
+ };
238
209
 
210
+ // Add in additional props that any Component supplied to `iconComponent` should be
211
+ // configured to handle.
239
212
  if (typeof iconComponent !== 'string') {
240
- props.size = size; // the following inadvertently triggers a linting rule
213
+ props.size = size;
214
+ // the following inadvertently triggers a linting rule
241
215
  // eslint-disable-next-line enact/prop-types
242
-
243
216
  props.flip = iconFlip;
244
217
  }
245
-
246
218
  if (_icon !== true) {
247
219
  props.children = _icon;
248
220
  }
249
-
250
221
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ComponentOverride["default"], _objectSpread({}, props));
251
222
  }
252
223
  },
253
224
  render: function render(_ref3) {
254
225
  var children = _ref3.children,
255
- componentRef = _ref3.componentRef,
256
- css = _ref3.css,
257
- decoration = _ref3.decoration,
258
- disabled = _ref3.disabled,
259
- icon = _ref3.icon,
260
- rest = _objectWithoutProperties(_ref3, _excluded);
261
-
226
+ componentRef = _ref3.componentRef,
227
+ css = _ref3.css,
228
+ decoration = _ref3.decoration,
229
+ disabled = _ref3.disabled,
230
+ icon = _ref3.icon,
231
+ rest = _objectWithoutProperties(_ref3, _excluded);
262
232
  delete rest.iconComponent;
263
233
  delete rest.iconFlip;
264
234
  delete rest.minWidth;
@@ -283,21 +253,22 @@ var ButtonBase = (0, _kind["default"])({
283
253
  }));
284
254
  }
285
255
  });
256
+
286
257
  /**
287
- * A higher-order component that adds touch support to a [ButtonBase]{@link ui/Button.ButtonBase}.
258
+ * A higher-order component that adds touch support to a {@link ui/Button.ButtonBase|ButtonBase}.
288
259
  *
289
260
  * @hoc
290
261
  * @memberof ui/Button
291
262
  * @mixes ui/Touchable.Touchable
292
263
  * @public
293
264
  */
294
-
295
265
  exports.ButtonBase = ButtonBase;
296
266
  var ButtonDecorator = (0, _compose["default"])((0, _ForwardRef["default"])({
297
267
  prop: 'componentRef'
298
268
  }), (0, _Touchable["default"])({
299
269
  activeProp: 'pressed'
300
270
  }));
271
+
301
272
  /**
302
273
  * A minimally-styled button component with touch support.
303
274
  *
@@ -309,7 +280,6 @@ var ButtonDecorator = (0, _compose["default"])((0, _ForwardRef["default"])({
309
280
  * @ui
310
281
  * @public
311
282
  */
312
-
313
283
  exports.ButtonDecorator = ButtonDecorator;
314
284
  var Button = ButtonDecorator(ButtonBase);
315
285
  exports.Button = Button;
@@ -1,17 +1,11 @@
1
1
  "use strict";
2
2
 
3
3
  require("@testing-library/jest-dom");
4
-
5
4
  var _react = require("@testing-library/react");
6
-
7
5
  var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
8
-
9
6
  var _Button = require("../Button");
10
-
11
7
  var _jsxRuntime = require("react/jsx-runtime");
12
-
13
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
14
-
15
9
  describe('Button', function () {
16
10
  test('should return a DOM node reference for `componentRef`', function () {
17
11
  var ref = jest.fn();
@@ -27,16 +21,12 @@ describe('Button', function () {
27
21
  disabled: true,
28
22
  children: "I am a disabled Button"
29
23
  }));
30
-
31
24
  var button = _react.screen.getByRole('button');
32
-
33
25
  expect(button).toHaveAttribute('disabled');
34
26
  });
35
27
  test('should have default minWidth class', function () {
36
28
  (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.ButtonBase, {}));
37
-
38
29
  var button = _react.screen.getByRole('button');
39
-
40
30
  var expected = 'minWidth';
41
31
  expect(button).toHaveClass(expected);
42
32
  });
@@ -44,9 +34,7 @@ describe('Button', function () {
44
34
  (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.ButtonBase, {
45
35
  selected: true
46
36
  }));
47
-
48
37
  var button = _react.screen.getByRole('button');
49
-
50
38
  var expected = 'selected';
51
39
  expect(button).toHaveClass(expected);
52
40
  });
@@ -54,9 +42,7 @@ describe('Button', function () {
54
42
  (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.ButtonBase, {
55
43
  pressed: true
56
44
  }));
57
-
58
45
  var button = _react.screen.getByRole('button');
59
-
60
46
  var expected = 'pressed';
61
47
  expect(button).toHaveClass(expected);
62
48
  });
@@ -64,9 +50,7 @@ describe('Button', function () {
64
50
  (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.ButtonBase, {
65
51
  size: "large"
66
52
  }));
67
-
68
53
  var button = _react.screen.getByRole('button');
69
-
70
54
  var expected = 'large';
71
55
  expect(button).toHaveClass(expected);
72
56
  });
@@ -74,9 +58,7 @@ describe('Button', function () {
74
58
  (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.ButtonBase, {
75
59
  size: "small"
76
60
  }));
77
-
78
61
  var button = _react.screen.getByRole('button');
79
-
80
62
  var expected = 'small';
81
63
  expect(button).toHaveClass(expected);
82
64
  });
@@ -85,9 +67,7 @@ describe('Button', function () {
85
67
  icon: true,
86
68
  children: "Hello Button!"
87
69
  }));
88
-
89
70
  var button = _react.screen.getByRole('button');
90
-
91
71
  var expected = 'hasIcon';
92
72
  expect(button).toHaveClass(expected);
93
73
  });
@@ -97,11 +77,8 @@ describe('Button', function () {
97
77
  onClick: handleCLick,
98
78
  children: "Hello Button!"
99
79
  }));
100
-
101
80
  var button = _react.screen.getByRole('button');
102
-
103
81
  _userEvent["default"].click(button);
104
-
105
82
  var expected = 1;
106
83
  expect(handleCLick).toHaveBeenCalledTimes(expected);
107
84
  });
@@ -112,11 +89,8 @@ describe('Button', function () {
112
89
  onClick: handleClick,
113
90
  children: "Hello Button!"
114
91
  }));
115
-
116
92
  var button = _react.screen.getByRole('button');
117
-
118
93
  _userEvent["default"].click(button);
119
-
120
94
  expect(handleClick).not.toHaveBeenCalled();
121
95
  });
122
96
  });
package/CHANGELOG.md CHANGED
@@ -2,6 +2,33 @@
2
2
 
3
3
  The following is a curated list of changes in the Enact ui module, newest changes on the top.
4
4
 
5
+ ## [4.6.1] - 2023-02-03
6
+
7
+ ### Added
8
+
9
+ - `ui/Touchable` events `onPinch`, `onPinchStart`, `onPinchEnd`, and config `pinchConfig` to support pinch gesture
10
+
11
+ ### Deprecated
12
+
13
+ - `ui/IconButton` to be removed in 5.0.0, use `ui/Button` instead
14
+ - `ui/RadioDecorator` to be removed in 5.0.0
15
+ - `ui/Scroller.ScrollerBase` to be removed in 5.0.0
16
+ - `ui/SlotItem` to be removed in 5.0.0
17
+ - `ui/ToggleItem` to be removed in 5.0.0
18
+ - `ui/VirtualList.VirtualListBase` to be removed 5.0.0
19
+
20
+ ## [4.6.0] - 2022-12-05
21
+
22
+ ### Fixed
23
+
24
+ - `ui/Marquee.MarqueeDecorator` to restart animation properly when `marqueeDelay` is 0
25
+
26
+ ## [4.0.12] - 2022-09-16
27
+
28
+ ### Fixed
29
+
30
+ - `ui/Marquee.MarqueeDecorator` to have proper spacing for bidirectional text
31
+
5
32
  ## [4.5.2] - 2022-08-17
6
33
 
7
34
  ### Fixed
@@ -49,12 +76,20 @@ No significant changes.
49
76
 
50
77
  - `ui/Marquee.MarqueeDecorator` config `css` to support customizing the marquee styles
51
78
 
79
+ ## [4.0.11] - 2022-04-25
80
+
81
+ No significant changes.
82
+
52
83
  ## [4.5.0-alpha.1] - 2022-04-15
53
84
 
54
85
  ### Fixed
55
86
 
56
87
  - `ui/FloatingLayer` to stack popups always in the order in which they were opened
57
88
 
89
+ ## [4.0.10] - 2022-04-05
90
+
91
+ No significant changes.
92
+
58
93
  ## [4.1.4] - 2022-03-24
59
94
 
60
95
  ### Removed
@@ -74,6 +109,10 @@ No significant changes.
74
109
 
75
110
  - Updated to use `forwardCustom` and add `type` when forwarding custom events
76
111
 
112
+ ## [3.2.7] - 2022-01-17
113
+
114
+ No significant changes.
115
+
77
116
  ## [4.1.2] - 2021-12-22
78
117
 
79
118
  ### Fixed
@@ -81,6 +120,10 @@ No significant changes.
81
120
  - `ui/Scroller` and `ui/VirtualList` to avoid stuttering of content on drag in mobile devices
82
121
  - `ui/Scroller` and `ui/VirtualList` to scroll correctly on Android platform for RTL locales
83
122
 
123
+ ## [4.0.9] - 2021-12-15
124
+
125
+ No significant changes.
126
+
84
127
  ## [4.1.1] - 2021-11-30
85
128
 
86
129
  No significant changes.
@@ -376,6 +419,8 @@ No significant changes.
376
419
 
377
420
  ### Fixed
378
421
 
422
+ - `ui/VirtualList.VirtualGridList` and `ui/VirtualList.VirtualList` to show items properly when reducing data size by updating `firstIndex` correctly
423
+ - `ui/VirtualList.VirtualList` and `ui/VirtualList.VirtualGridList` not to suddenly jump when pressing directional keys after wheeling
379
424
  - `ui/VirtualList.VirtualList` and `ui/VirtualList.VirtualGridList` to show items properly when reducing data size
380
425
 
381
426
  ## [3.2.5] - 2019-11-14
@@ -17,53 +17,29 @@ Object.defineProperty(exports, "removeCancelHandler", {
17
17
  return _cancelHandler.removeCancelHandler;
18
18
  }
19
19
  });
20
-
21
20
  var _handle = require("@enact/core/handle");
22
-
23
21
  var _hoc = _interopRequireDefault(require("@enact/core/hoc"));
24
-
25
22
  var _keymap = require("@enact/core/keymap");
26
-
27
23
  var _invariant = _interopRequireDefault(require("invariant"));
28
-
29
24
  var _propTypes = _interopRequireDefault(require("prop-types"));
30
-
31
25
  var _react = require("react");
32
-
33
26
  var _cancelHandler = require("./cancelHandler");
34
-
35
27
  var _modalHandler = require("./modalHandler");
36
-
37
28
  var _jsxRuntime = require("react/jsx-runtime");
38
-
39
29
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
40
-
41
30
  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; }
42
-
43
31
  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; }
44
-
45
32
  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; }
46
-
47
33
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
48
-
49
34
  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); } }
50
-
51
35
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
52
-
53
36
  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); }
54
-
55
37
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
56
-
57
38
  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); }; }
58
-
59
39
  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); }
60
-
61
40
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
62
-
63
41
  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; } }
64
-
65
42
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
66
-
67
43
  /**
68
44
  * Default config for {@link ui/Cancelable.Cancelable}
69
45
  *
@@ -86,7 +62,6 @@ var defaultConfig = {
86
62
  * @memberof ui/Cancelable.Cancelable.defaultConfig
87
63
  */
88
64
  onCancel: null,
89
-
90
65
  /**
91
66
  * Subscribes to cancel events globally for this instance.
92
67
  *
@@ -102,7 +77,6 @@ var defaultConfig = {
102
77
  * @memberof ui/Cancelable.Cancelable.defaultConfig
103
78
  */
104
79
  modal: false,
105
-
106
80
  /**
107
81
  * The component that will contain the wrapped component.
108
82
  *
@@ -114,9 +88,11 @@ var defaultConfig = {
114
88
  * @memberof ui/Cancelable.Cancelable.defaultConfig
115
89
  */
116
90
  component: null
117
- }; // Add keymap for escape key
91
+ };
118
92
 
93
+ // Add keymap for escape key
119
94
  (0, _keymap.add)('cancel', 27);
95
+
120
96
  /**
121
97
  * A higher-order component that adds support to a component to handle cancel actions.
122
98
  *
@@ -164,17 +140,14 @@ var defaultConfig = {
164
140
  * @hoc
165
141
  * @public
166
142
  */
167
-
168
143
  var Cancelable = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
169
144
  var _class;
170
-
171
145
  var onCancel = config.onCancel,
172
- modal = config.modal,
173
- Component = config.component;
146
+ modal = config.modal,
147
+ Component = config.component;
174
148
  !onCancel ? process.env.NODE_ENV !== "production" ? (0, _invariant["default"])(false, 'onCancel must be specified with Cancelable') : (0, _invariant["default"])(false) : void 0;
175
149
  var onCancelIsString = typeof onCancel === 'string';
176
150
  var onCancelIsFunction = typeof onCancel === 'function';
177
-
178
151
  var dispatchCancelToConfig = function dispatchCancelToConfig(ev, props) {
179
152
  // by default, we return false which allows event propagation because it will "break" the
180
153
  // handler chain and not call `stop` and `stopImmediate` below
@@ -185,7 +158,6 @@ var Cancelable = (0, _hoc["default"])(defaultConfig, function (config, Wrapped)
185
158
  stopped = true;
186
159
  }
187
160
  };
188
-
189
161
  if (onCancelIsString && typeof props[onCancel] === 'function') {
190
162
  // use the custom event name from the config
191
163
  cancelEvent.type = onCancel;
@@ -193,30 +165,24 @@ var Cancelable = (0, _hoc["default"])(defaultConfig, function (config, Wrapped)
193
165
  } else if (onCancelIsFunction) {
194
166
  onCancel(cancelEvent, props);
195
167
  }
196
-
197
168
  return stopped;
198
169
  };
199
-
200
170
  return _class = /*#__PURE__*/function (_ReactComponent) {
201
171
  _inherits(_class, _ReactComponent);
202
-
203
172
  var _super = _createSuper(_class);
204
-
205
173
  function _class(props) {
206
174
  var _this;
207
-
208
175
  _classCallCheck(this, _class);
209
-
210
176
  _this = _super.call(this, props);
211
177
  _this.handle = _handle.handle.bind(_assertThisInitialized(_this));
212
178
  _this.handleCancel = _this.handle(_cancelHandler.forCancel, (0, _handle.forwardCustom)('onCancel'), dispatchCancelToConfig, _handle.stop, _handle.stopImmediate);
213
- _this.handleKeyUp = _this.handle((0, _handle.forward)('onKeyUp'), // nesting handlers for DRYness. note that if any conditions return false in
179
+ _this.handleKeyUp = _this.handle((0, _handle.forward)('onKeyUp'),
180
+ // nesting handlers for DRYness. note that if any conditions return false in
214
181
  // this.handleCancel(), this handler chain will stop too
215
182
  _this.handleCancel);
216
183
  _this.isFirstRender = true;
217
184
  return _this;
218
185
  }
219
-
220
186
  _createClass(_class, [{
221
187
  key: "componentWillUnmount",
222
188
  value: function componentWillUnmount() {
@@ -250,20 +216,15 @@ var Cancelable = (0, _hoc["default"])(defaultConfig, function (config, Wrapped)
250
216
  var props = Object.assign({}, this.props);
251
217
  delete props.onCancel;
252
218
  delete props[onCancel];
253
-
254
219
  if (this.isFirstRender && modal) {
255
220
  (0, _modalHandler.addModal)(this);
256
221
  this.isFirstRender = false;
257
222
  }
258
-
259
223
  return modal && this.renderModal(props) || Component && this.renderWrapped(props) || this.renderUnwrapped(props);
260
224
  }
261
225
  }]);
262
-
263
226
  return _class;
264
- }(_react.Component), _class.displayName = 'Cancelable', _class.propTypes =
265
- /** @lends ui/Cancelable.Cancelable.prototype */
266
- {
227
+ }(_react.Component), _class.displayName = 'Cancelable', _class.propTypes = /** @lends ui/Cancelable.Cancelable.prototype */{
267
228
  /**
268
229
  * Called when a cancel action is received.
269
230
  *
@@ -4,17 +4,17 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.removeCancelHandler = exports.forCancel = exports.addCancelHandler = void 0;
7
-
8
7
  var _handle = require("@enact/core/handle");
9
-
10
8
  /**
11
9
  * Array of cancel handlers. If any of these returns `false`, `forCancel` will return `false`;
12
10
  *
13
11
  * @type {Function[]}
14
12
  * @private
15
13
  */
16
- var cancelHandlers = [// always support the Escape key
14
+ var cancelHandlers = [
15
+ // always support the Escape key
17
16
  (0, _handle.forKey)('cancel')];
17
+
18
18
  /**
19
19
  * Event handler compatible with {@link core/handle} that allows the handler chain to
20
20
  * continue for any cancel event. A cancel event is an Escape key press by default but can be
@@ -27,7 +27,6 @@ var cancelHandlers = [// always support the Escape key
27
27
  * @returns {Boolean} `true` to stop the handler chain
28
28
  * @private
29
29
  */
30
-
31
30
  var forCancel = function forCancel(ev) {
32
31
  var ok = false;
33
32
  cancelHandlers.forEach(function (fn) {
@@ -36,6 +35,7 @@ var forCancel = function forCancel(ev) {
36
35
  });
37
36
  return ok;
38
37
  };
38
+
39
39
  /**
40
40
  * Adds an event handler to filter cancel events.
41
41
  *
@@ -46,15 +46,13 @@ var forCancel = function forCancel(ev) {
46
46
  * @returns {undefined}
47
47
  * @public
48
48
  */
49
-
50
-
51
49
  exports.forCancel = forCancel;
52
-
53
50
  var addCancelHandler = function addCancelHandler(handler) {
54
51
  if (cancelHandlers.indexOf(handler) < 0) {
55
52
  cancelHandlers.push(handler);
56
53
  }
57
54
  };
55
+
58
56
  /**
59
57
  * Removes an event handler to filter cancel events
60
58
  *
@@ -64,16 +62,11 @@ var addCancelHandler = function addCancelHandler(handler) {
64
62
  * @returns {undefined}
65
63
  * @public
66
64
  */
67
-
68
-
69
65
  exports.addCancelHandler = addCancelHandler;
70
-
71
66
  var removeCancelHandler = function removeCancelHandler(handler) {
72
67
  var index = cancelHandlers.indexOf(handler);
73
-
74
68
  if (index >= 0) {
75
69
  cancelHandlers.splice(index, 1);
76
70
  }
77
71
  };
78
-
79
72
  exports.removeCancelHandler = removeCancelHandler;