@enact/ui 4.5.1 → 4.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) 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.d.ts +1 -1
  8. package/BodyText/BodyText.js +8 -28
  9. package/BodyText/tests/BodyText-specs.js +0 -19
  10. package/Button/Button.d.ts +6 -6
  11. package/Button/Button.js +33 -63
  12. package/Button/tests/Button-specs.js +0 -26
  13. package/CHANGELOG.md +36 -0
  14. package/Cancelable/Cancelable.js +8 -47
  15. package/Cancelable/cancelHandler.js +5 -12
  16. package/Cancelable/modalHandler.js +3 -11
  17. package/Cancelable/tests/Cancelable-specs.js +3 -57
  18. package/Changeable/Changeable.js +2 -34
  19. package/Changeable/tests/Changeable-specs.js +20 -66
  20. package/ComponentOverride/ComponentOverride.js +1 -13
  21. package/FloatingLayer/FloatingLayer.js +17 -73
  22. package/FloatingLayer/FloatingLayerContainer.js +0 -15
  23. package/FloatingLayer/FloatingLayerDecorator.js +4 -17
  24. package/FloatingLayer/Scrim.js +9 -53
  25. package/FloatingLayer/index.js +0 -4
  26. package/FloatingLayer/tests/FloatingLayer-specs.js +8 -22
  27. package/FloatingLayer/tests/Scrim-specs.js +0 -9
  28. package/FloatingLayer/tests/useFloatingLayerDecorator-specs.js +0 -13
  29. package/FloatingLayer/useFloatingLayer.js +3 -14
  30. package/FloatingLayer/useFloatingLayerDecorator.js +3 -11
  31. package/ForwardRef/ForwardRef.js +1 -10
  32. package/GridListImageItem/GridListImageItem.d.ts +1 -1
  33. package/GridListImageItem/GridListImageItem.js +18 -51
  34. package/Group/Group.js +5 -36
  35. package/Group/GroupItem.js +16 -33
  36. package/Group/tests/Group-specs.js +0 -32
  37. package/Heading/Heading.js +8 -36
  38. package/Heading/tests/Heading-specs.js +81 -14
  39. package/Icon/Icon.d.ts +4 -4
  40. package/Icon/Icon.js +19 -53
  41. package/Icon/tests/Icon-specs.js +0 -22
  42. package/IconButton/IconButton.d.ts +4 -4
  43. package/IconButton/IconButton.js +17 -55
  44. package/IconButton/tests/IconButton-specs.js +0 -7
  45. package/Image/Image.js +17 -46
  46. package/Image/tests/Image-specs.js +0 -14
  47. package/ImageItem/ImageItem.js +18 -47
  48. package/ImageItem/tests/ImageItem-specs.js +0 -25
  49. package/Item/Item.js +9 -33
  50. package/Item/tests/Item-specs.js +0 -24
  51. package/LabeledIcon/LabeledIcon.d.ts +2 -2
  52. package/LabeledIcon/LabeledIcon.js +22 -53
  53. package/LabeledIcon/tests/LabeledIcon-specs.js +0 -14
  54. package/Layout/Cell.js +18 -44
  55. package/Layout/Layout.d.ts +16 -16
  56. package/Layout/Layout.js +23 -46
  57. package/Layout/tests/Layout-specs.js +10 -39
  58. package/Marquee/MarqueeBase.js +31 -64
  59. package/Marquee/MarqueeController.js +11 -72
  60. package/Marquee/MarqueeDecorator.js +70 -196
  61. package/Marquee/index.js +1 -5
  62. package/Marquee/tests/Marquee-specs.js +295 -87
  63. package/Measurable/Measurable.js +12 -34
  64. package/Measurable/tests/Measurable-specs.js +115 -0
  65. package/Media/Media.js +15 -65
  66. package/Media/tests/Media-specs.js +168 -0
  67. package/Placeholder/PlaceholderControllerDecorator.js +7 -43
  68. package/Placeholder/PlaceholderDecorator.js +7 -38
  69. package/Placeholder/index.js +1 -5
  70. package/Placeholder/tests/PlaceholderControllerDecorator-specs.js +25 -0
  71. package/Placeholder/tests/PlaceholderDecorator-specs.js +28 -0
  72. package/ProgressBar/ProgressBar.js +14 -45
  73. package/ProgressBar/tests/ProgressBar-specs.js +0 -17
  74. package/RadioDecorator/RadioControllerDecorator.js +1 -29
  75. package/RadioDecorator/RadioDecorator.js +4 -42
  76. package/RadioDecorator/tests/RadioDecorator-specs.js +12 -49
  77. package/Repeater/Repeater.js +9 -33
  78. package/Repeater/tests/Repeater-specs.js +0 -38
  79. package/Resizable/Resizable.js +9 -37
  80. package/Resizable/tests/Resizable-specs.js +34 -0
  81. package/Routable/Link.js +11 -47
  82. package/Routable/Routable.d.ts +2 -2
  83. package/Routable/Routable.js +12 -35
  84. package/Routable/Route.js +0 -6
  85. package/Routable/Router.js +15 -58
  86. package/Routable/tests/Routable-specs.js +7 -33
  87. package/Routable/tests/Router-specs.js +18 -44
  88. package/Routable/useLink.js +4 -8
  89. package/Routable/util.js +18 -24
  90. package/Scrollable/ScrollAnimator.js +49 -65
  91. package/Scrollable/ScrollThumb.js +2 -13
  92. package/Scrollable/Scrollable.js +180 -387
  93. package/Scrollable/ScrollableNative.js +189 -392
  94. package/Scrollable/Scrollbar.js +30 -102
  95. package/Scroller/Scroller.js +15 -39
  96. package/Scroller/ScrollerBasic.js +34 -89
  97. package/Scroller/UiScrollerBase.js +31 -84
  98. package/Scroller/tests/Scroller-specs.js +56 -0
  99. package/Skinnable/Skinnable.js +11 -38
  100. package/Skinnable/tests/Skinnable-specs.js +3 -74
  101. package/Skinnable/tests/useSkins-specs.js +1 -13
  102. package/Skinnable/tests/util-specs.js +0 -14
  103. package/Skinnable/useSkins.js +8 -15
  104. package/Skinnable/util.js +9 -20
  105. package/Slider/Knob.js +5 -24
  106. package/Slider/PositionDecorator.js +16 -54
  107. package/Slider/Slider.d.ts +2 -2
  108. package/Slider/Slider.js +29 -67
  109. package/Slider/tests/Slider-specs.js +94 -7
  110. package/Slider/utils.js +0 -2
  111. package/SlotItem/SlotItem.d.ts +1 -1
  112. package/SlotItem/SlotItem.js +17 -43
  113. package/SlotItem/tests/SlotItem-specs.js +0 -5
  114. package/Slottable/Slottable.js +4 -12
  115. package/Slottable/tests/Slottable-specs.js +19 -46
  116. package/Slottable/tests/useSlots-specs.js +27 -65
  117. package/Slottable/useSlots.js +8 -33
  118. package/Spinner/Spinner.d.ts +1 -1
  119. package/Spinner/Spinner.js +16 -43
  120. package/Spinner/tests/Spinner-specs.js +0 -15
  121. package/ToggleIcon/ToggleIcon.js +10 -36
  122. package/ToggleIcon/tests/ToggleIcon-specs.js +0 -16
  123. package/ToggleItem/ToggleItem.d.ts +3 -3
  124. package/ToggleItem/ToggleItem.js +18 -55
  125. package/ToggleItem/tests/ToggleItem-specs.js +0 -30
  126. package/Toggleable/Toggle.js +1 -15
  127. package/Toggleable/Toggleable.js +12 -45
  128. package/Toggleable/tests/Toggleable-specs.js +28 -96
  129. package/Toggleable/useToggle.js +3 -19
  130. package/Touchable/ClickAllow.js +5 -14
  131. package/Touchable/Drag.js +16 -54
  132. package/Touchable/Flick.js +11 -42
  133. package/Touchable/Hold.js +21 -68
  134. package/Touchable/Touch.js +37 -65
  135. package/Touchable/Touchable.js +32 -71
  136. package/Touchable/config.js +8 -22
  137. package/Touchable/tests/Touchable-specs.js +270 -119
  138. package/Touchable/tests/useTouch-specs.js +6 -80
  139. package/Touchable/useTouch.js +17 -34
  140. package/Transition/Transition.js +37 -118
  141. package/Transition/tests/Transition-specs.js +20 -60
  142. package/ViewManager/Arranger.js +10 -22
  143. package/ViewManager/TransitionGroup.js +32 -107
  144. package/ViewManager/View.js +35 -91
  145. package/ViewManager/ViewManager.d.ts +1 -1
  146. package/ViewManager/ViewManager.js +20 -84
  147. package/ViewManager/tests/View-specs.js +0 -17
  148. package/ViewManager/tests/ViewManager-specs.js +236 -305
  149. package/ViewManager/tests/test-utils.js +0 -8
  150. package/VirtualList/UiVirtualListBase.js +259 -409
  151. package/VirtualList/VirtualList.d.ts +4 -4
  152. package/VirtualList/VirtualList.js +29 -69
  153. package/VirtualList/VirtualListBase.js +0 -3
  154. package/VirtualList/VirtualListBasic.js +273 -431
  155. package/VirtualList/tests/VirtualGridList-native-specs.js +161 -0
  156. package/VirtualList/tests/VirtualGridList-specs.js +614 -0
  157. package/VirtualList/tests/VirtualList-native-specs.js +152 -0
  158. package/VirtualList/tests/VirtualList-specs.js +423 -95
  159. package/internal/IdProvider/IdProvider.js +7 -21
  160. package/internal/IdProvider/Provider.js +4 -17
  161. package/internal/IdProvider/tests/IdProvider-specs.js +44 -0
  162. package/internal/IdProvider/tests/useId-specs.js +6 -20
  163. package/internal/IdProvider/useId.js +0 -6
  164. package/internal/Pure/Pure.js +3 -30
  165. package/internal/Pure/tests/Pure-specs.js +88 -0
  166. package/internal/localized-fonts/localized-fonts.js +33 -62
  167. package/internal/localized-fonts/tests/localized-fonts-specs.js +33 -0
  168. package/internal/selection/selection.js +1 -6
  169. package/internal/selection/tests/selection-specs.js +6 -4
  170. package/internal/validators/tests/validators-specs.js +80 -0
  171. package/internal/validators/validators.js +14 -34
  172. package/package.json +9 -3
  173. package/resolution/ResolutionDecorator.js +4 -40
  174. package/resolution/index.js +0 -7
  175. package/resolution/resolution.js +42 -80
  176. package/resolution/tests/ResolutionDecorator-specs.js +4 -11
  177. package/resolution/tests/resolution-specs.js +2 -2
  178. package/useControlledState/tests/useControlledState-specs.js +15 -46
  179. package/useControlledState/useControlledState.js +11 -22
  180. package/useScroll/ScrollAnimator.js +49 -65
  181. package/useScroll/Scrollbar.js +22 -58
  182. package/useScroll/ScrollbarTrack.js +3 -19
  183. package/useScroll/useScroll.js +267 -454
  184. package/useScroll/utilDOM.js +8 -14
  185. package/useScroll/utilEvent.js +0 -4
package/Icon/Icon.js CHANGED
@@ -4,39 +4,22 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = exports.IconDecorator = exports.IconBase = exports.Icon = void 0;
7
-
8
7
  var _kind = _interopRequireDefault(require("@enact/core/kind"));
9
-
10
8
  var _propTypes = _interopRequireDefault(require("@enact/core/internal/prop-types"));
11
-
12
9
  var _util = require("@enact/core/util");
13
-
14
10
  var _propTypes2 = _interopRequireDefault(require("prop-types"));
15
-
16
11
  var _compose = _interopRequireDefault(require("ramda/src/compose"));
17
-
18
12
  var _resolution = _interopRequireDefault(require("../resolution"));
19
-
20
13
  var _ForwardRef = _interopRequireDefault(require("../ForwardRef"));
21
-
22
14
  var _IconModule = _interopRequireDefault(require("./Icon.module.css"));
23
-
24
15
  var _jsxRuntime = require("react/jsx-runtime");
25
-
26
16
  var _excluded = ["componentRef", "iconProps"];
27
-
28
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
29
-
30
18
  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; }
31
-
32
19
  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; }
33
-
34
20
  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; }
35
-
36
21
  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; }
37
-
38
22
  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; }
39
-
40
23
  /**
41
24
  * Merges consumer styles with the image `src` resolved through the resolution independence module.
42
25
  *
@@ -49,16 +32,14 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
49
32
  */
50
33
  var mergeStyle = function mergeStyle(style, src) {
51
34
  var updated = Object.assign({}, style);
52
-
53
35
  var source = _resolution["default"].selectSrc(src);
54
-
55
36
  if (src && src !== 'none' && src !== 'inherit' && src !== 'initial') {
56
37
  source = "url(".concat(source, ")");
57
38
  }
58
-
59
39
  updated.backgroundImage = source;
60
40
  return updated;
61
41
  };
42
+
62
43
  /**
63
44
  * Tests if a string appears to be a URI/URL.
64
45
  *
@@ -68,11 +49,10 @@ var mergeStyle = function mergeStyle(style, src) {
68
49
  * @returns {Boolean} `true` if c looks like a URL
69
50
  * @private
70
51
  */
71
-
72
-
73
52
  var isUri = function isUri(c) {
74
53
  return c.indexOf('/') > -1 || c.indexOf('.') > -1;
75
54
  };
55
+
76
56
  /**
77
57
  * A basic icon component structure without any behaviors applied to it.
78
58
  *
@@ -81,19 +61,15 @@ var isUri = function isUri(c) {
81
61
  * @ui
82
62
  * @public
83
63
  */
84
-
85
-
86
64
  var IconBase = (0, _kind["default"])({
87
65
  name: 'ui:Icon',
88
- propTypes:
89
- /** @lends ui/Icon.IconBase.prototype */
90
- {
66
+ propTypes: /** @lends ui/Icon.IconBase.prototype */{
91
67
  /**
92
68
  * The icon content.
93
69
  *
94
70
  * May be specified as either:
95
71
  *
96
- * * A string that represents an icon from the [iconList]{@link ui/Icon.IconBase.iconList},
72
+ * * A string that represents an icon from the {@link ui/Icon.IconBase.iconList|iconList},
97
73
  * * An HTML entity string, Unicode reference or hex value (in the form '0x...'),
98
74
  * * A URL specifying path to an icon image, or
99
75
  * * An object representing a resolution independent resource (See {@link ui/resolution}).
@@ -102,7 +78,6 @@ var IconBase = (0, _kind["default"])({
102
78
  * @public
103
79
  */
104
80
  children: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].object]),
105
-
106
81
  /**
107
82
  * Called with a reference to the root component.
108
83
  *
@@ -113,7 +88,6 @@ var IconBase = (0, _kind["default"])({
113
88
  * @public
114
89
  */
115
90
  componentRef: _propTypes["default"].ref,
116
-
117
91
  /**
118
92
  * Customizes the component by mapping the supplied collection of CSS class names to the
119
93
  * corresponding internal elements and states of this component.
@@ -121,8 +95,8 @@ var IconBase = (0, _kind["default"])({
121
95
  * The following classes are supported:
122
96
  *
123
97
  * * `icon` - The root component class
124
- * * `dingbat` - Applied when the value of [`icon`]{@link ui/Icon.IconBase.icon} is not
125
- * found in [iconList]{@link ui/Icon.IconBase.iconList}
98
+ * * `dingbat` - Applied when the value of {@link ui/Icon.IconBase.icon|icon} is not
99
+ * found in {@link ui/Icon.IconBase.iconList|iconList}
126
100
  * * `large` - Applied when `size` prop is `'large'`
127
101
  * * `pressed` - Applied when `pressed` prop is `true`
128
102
  * * `small` - Applied when `size` prop is `'small'`
@@ -131,7 +105,6 @@ var IconBase = (0, _kind["default"])({
131
105
  * @public
132
106
  */
133
107
  css: _propTypes2["default"].object,
134
-
135
108
  /**
136
109
  * Flip the icon horizontally, vertically or both.
137
110
  *
@@ -139,7 +112,6 @@ var IconBase = (0, _kind["default"])({
139
112
  * @public
140
113
  */
141
114
  flip: _propTypes2["default"].string,
142
-
143
115
  /**
144
116
  * The full list (hash) of supported icons.
145
117
  *
@@ -153,7 +125,6 @@ var IconBase = (0, _kind["default"])({
153
125
  * @public
154
126
  */
155
127
  iconList: _propTypes2["default"].object,
156
-
157
128
  /**
158
129
  * Applies the `pressed` CSS class.
159
130
  *
@@ -162,12 +133,11 @@ var IconBase = (0, _kind["default"])({
162
133
  * @public
163
134
  */
164
135
  pressed: _propTypes2["default"].bool,
165
-
166
136
  /**
167
137
  * The size of the button.
168
138
  *
169
139
  * Applies the CSS class which can be customized by
170
- * [theming]{@link /docs/developer-guide/theming/}.
140
+ * {@link /docs/developer-guide/theming/|theming}.
171
141
  *
172
142
  * @type {String}
173
143
  * @public
@@ -186,11 +156,11 @@ var IconBase = (0, _kind["default"])({
186
156
  computed: {
187
157
  className: function className(_ref) {
188
158
  var icon = _ref.children,
189
- flip = _ref.flip,
190
- iconList = _ref.iconList,
191
- pressed = _ref.pressed,
192
- size = _ref.size,
193
- styler = _ref.styler;
159
+ flip = _ref.flip,
160
+ iconList = _ref.iconList,
161
+ pressed = _ref.pressed,
162
+ size = _ref.size,
163
+ styler = _ref.styler;
194
164
  return styler.append({
195
165
  // If the icon isn't in our known set, apply our custom font class
196
166
  dingbat: !(icon in iconList),
@@ -199,10 +169,9 @@ var IconBase = (0, _kind["default"])({
199
169
  },
200
170
  iconProps: function iconProps(_ref2) {
201
171
  var iconProp = _ref2.children,
202
- iconList = _ref2.iconList,
203
- style = _ref2.style;
172
+ iconList = _ref2.iconList,
173
+ style = _ref2.style;
204
174
  var icon = iconList[iconProp];
205
-
206
175
  if (!icon) {
207
176
  if (typeof iconProp == 'string') {
208
177
  if (iconProp.indexOf('&#x') === 0) {
@@ -228,12 +197,10 @@ var IconBase = (0, _kind["default"])({
228
197
  style = mergeStyle(style, iconProp);
229
198
  }
230
199
  }
231
-
232
200
  if (typeof icon == 'number') {
233
201
  // Converts a hex reference in number form
234
202
  icon = String.fromCodePoint(icon);
235
203
  }
236
-
237
204
  return {
238
205
  children: icon,
239
206
  style: style
@@ -242,9 +209,8 @@ var IconBase = (0, _kind["default"])({
242
209
  },
243
210
  render: function render(_ref3) {
244
211
  var componentRef = _ref3.componentRef,
245
- iconProps = _ref3.iconProps,
246
- rest = _objectWithoutProperties(_ref3, _excluded);
247
-
212
+ iconProps = _ref3.iconProps,
213
+ rest = _objectWithoutProperties(_ref3, _excluded);
248
214
  delete rest.iconList;
249
215
  delete rest.pressed;
250
216
  delete rest.size;
@@ -255,19 +221,20 @@ var IconBase = (0, _kind["default"])({
255
221
  }));
256
222
  }
257
223
  });
224
+
258
225
  /**
259
- * A higher-order component that adds behavior to [Icon]{@link ui/Icon.IconBase}.
226
+ * A higher-order component that adds behavior to {@link ui/Icon.IconBase|Icon}.
260
227
  *
261
228
  * @hoc
262
229
  * @memberof ui/Icon
263
230
  * @mixes ui/ForwardRef.ForwardRef
264
231
  * @public
265
232
  */
266
-
267
233
  exports.IconBase = IconBase;
268
234
  var IconDecorator = (0, _compose["default"])((0, _ForwardRef["default"])({
269
235
  prop: 'componentRef'
270
236
  }));
237
+
271
238
  /**
272
239
  * An Icon component.
273
240
  *
@@ -279,7 +246,6 @@ var IconDecorator = (0, _compose["default"])((0, _ForwardRef["default"])({
279
246
  * @ui
280
247
  * @public
281
248
  */
282
-
283
249
  exports.IconDecorator = IconDecorator;
284
250
  var Icon = IconDecorator(IconBase);
285
251
  exports.Icon = Icon;
@@ -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 _Icon = _interopRequireWildcard(require("../Icon"));
8
-
9
6
  var _jsxRuntime = require("react/jsx-runtime");
10
-
11
7
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
12
-
13
8
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
14
-
15
9
  describe('Icon', function () {
16
10
  test('should allow icon-name words to pass through', function () {
17
11
  var iconName = 'hollow_star';
@@ -19,9 +13,7 @@ describe('Icon', function () {
19
13
  "data-testid": "icon",
20
14
  children: iconName
21
15
  }));
22
-
23
16
  var icon = _react.screen.getByTestId('icon');
24
-
25
17
  expect(icon).toHaveTextContent(iconName);
26
18
  });
27
19
  test('should allow single-byte characters to pass through', function () {
@@ -30,9 +22,7 @@ describe('Icon', function () {
30
22
  "data-testid": "icon",
31
23
  children: iconName
32
24
  }));
33
-
34
25
  var icon = _react.screen.getByTestId('icon');
35
-
36
26
  expect(icon).toHaveTextContent(iconName);
37
27
  });
38
28
  test('should allow multi-byte characters to pass through', function () {
@@ -41,9 +31,7 @@ describe('Icon', function () {
41
31
  "data-testid": "icon",
42
32
  children: iconName
43
33
  }));
44
-
45
34
  var icon = _react.screen.getByTestId('icon');
46
-
47
35
  expect(icon).toHaveTextContent(iconName);
48
36
  });
49
37
  test('should allow pre-defined icon names as an icon', function () {
@@ -58,9 +46,7 @@ describe('Icon', function () {
58
46
  iconList: iconList,
59
47
  children: iconName
60
48
  }));
61
-
62
49
  var icon = _react.screen.getByTestId('icon');
63
-
64
50
  expect(icon).toHaveTextContent(iconGlyph);
65
51
  });
66
52
  test('should allow un-matched icon names to fall through, even when pre-defined icons exist', function () {
@@ -74,9 +60,7 @@ describe('Icon', function () {
74
60
  iconList: iconList,
75
61
  children: iconName
76
62
  }));
77
-
78
63
  var icon = _react.screen.getByTestId('icon');
79
-
80
64
  expect(icon).toHaveTextContent(iconName);
81
65
  });
82
66
  test('should allow URIs to be used as an icon', function () {
@@ -85,9 +69,7 @@ describe('Icon', function () {
85
69
  "data-testid": "icon",
86
70
  children: src
87
71
  }));
88
-
89
72
  var icon = _react.screen.getByTestId('icon');
90
-
91
73
  var expected = {
92
74
  backgroundImage: "url(".concat(src, ")")
93
75
  };
@@ -99,9 +81,7 @@ describe('Icon', function () {
99
81
  "data-testid": "icon",
100
82
  children: src
101
83
  }));
102
-
103
84
  var icon = _react.screen.getByTestId('icon');
104
-
105
85
  var expected = {
106
86
  backgroundImage: "url(".concat(src, ")")
107
87
  };
@@ -116,9 +96,7 @@ describe('Icon', function () {
116
96
  },
117
97
  children: src
118
98
  }));
119
-
120
99
  var icon = _react.screen.getByTestId('icon');
121
-
122
100
  var expected = {
123
101
  color: 'green',
124
102
  backgroundImage: "url(".concat(src, ")")
@@ -14,7 +14,7 @@ export interface IconButtonBaseProps {
14
14
  */
15
15
  buttonComponent: React.ComponentType | JSX.Element;
16
16
  /**
17
- * The component used to render the [icon] .
17
+ * The component used to render the .
18
18
  *
19
19
  * This component will receive the `flip` and `size` property set on the `IconButton` as well as the
20
20
  `icon` class to customize its styling.
@@ -39,7 +39,7 @@ corresponding internal elements and states of this component.
39
39
  *
40
40
  * The following classes are supported:
41
41
  * * `iconButton` - The root component class
42
- * * `icon` - The [icon component] class
42
+ * * `icon` - The class
43
43
  * * `large` - Applied when `size` prop is `'large'`
44
44
  * * `small` - Applied when `size` prop is `'small'`
45
45
  * * `pressed` - Applied when `pressed` prop is `true`
@@ -49,7 +49,7 @@ corresponding internal elements and states of this component.
49
49
  * Disables IconButton.
50
50
  *
51
51
  * When `true` , the button is shown as disabled and does not generate
52
- `onClick` [events] .
52
+ `onClick` .
53
53
  */
54
54
  disabled?: boolean;
55
55
  /**
@@ -74,7 +74,7 @@ corresponding internal elements and states of this component.
74
74
  * The size of the button.
75
75
  *
76
76
  * Applies the CSS class which can be customized by
77
- [theming] .
77
+ .
78
78
  */
79
79
  size?: string;
80
80
  }
@@ -4,53 +4,29 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = exports.IconButtonDecorator = exports.IconButtonBase = exports.IconButton = 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 _react = require("react");
17
-
18
12
  var _ComponentOverride = _interopRequireDefault(require("../ComponentOverride"));
19
-
20
13
  var _ForwardRef = _interopRequireDefault(require("../ForwardRef"));
21
-
22
14
  var _Touchable = _interopRequireDefault(require("../Touchable"));
23
-
24
15
  var _IconButtonModule = _interopRequireDefault(require("./IconButton.module.css"));
25
-
26
16
  var _jsxRuntime = require("react/jsx-runtime");
27
-
28
17
  var _excluded = ["buttonComponent", "children", "componentRef", "css", "flip", "icon", "iconComponent", "size"];
29
-
30
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
31
-
32
19
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
33
-
34
20
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
35
-
36
21
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
37
-
38
22
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
39
-
40
23
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
41
-
42
24
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
43
-
44
25
  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; }
45
-
46
26
  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; }
47
-
48
27
  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; }
49
-
50
28
  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; }
51
-
52
29
  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; }
53
-
54
30
  /**
55
31
  * A ui-styled button without any behavior.
56
32
  *
@@ -61,9 +37,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
61
37
  */
62
38
  var IconButtonBase = (0, _kind["default"])({
63
39
  name: 'ui:IconButton',
64
- propTypes:
65
- /** @lends ui/IconButton.IconButtonBase.prototype */
66
- {
40
+ propTypes: /** @lends ui/IconButton.IconButtonBase.prototype */{
67
41
  /**
68
42
  * This is the root component used to render the button and will receive all props except
69
43
  * `icon`.
@@ -73,9 +47,8 @@ var IconButtonBase = (0, _kind["default"])({
73
47
  * @public
74
48
  */
75
49
  buttonComponent: _propTypes["default"].componentOverride.isRequired,
76
-
77
50
  /**
78
- * The component used to render the [icon]{@link ui/IconButton.IconButtonBase.icon}.
51
+ * The component used to render the {@link ui/IconButton.IconButtonBase.icon|icon}.
79
52
  *
80
53
  * This component will receive the `flip` and `size` property set on the `IconButton` as well as the
81
54
  * `icon` class to customize its styling.
@@ -85,7 +58,6 @@ var IconButtonBase = (0, _kind["default"])({
85
58
  * @public
86
59
  */
87
60
  iconComponent: _propTypes["default"].component.isRequired,
88
-
89
61
  /**
90
62
  * Additional children that follow the icon.
91
63
  *
@@ -96,7 +68,6 @@ var IconButtonBase = (0, _kind["default"])({
96
68
  * @public
97
69
  */
98
70
  children: _propTypes2["default"].node,
99
-
100
71
  /**
101
72
  * Called with a reference to the root component.
102
73
  *
@@ -107,7 +78,6 @@ var IconButtonBase = (0, _kind["default"])({
107
78
  * @public
108
79
  */
109
80
  componentRef: _propTypes["default"].ref,
110
-
111
81
  /**
112
82
  * Customizes the component by mapping the supplied collection of CSS class names to the
113
83
  * corresponding internal elements and states of this component.
@@ -115,7 +85,7 @@ var IconButtonBase = (0, _kind["default"])({
115
85
  * The following classes are supported:
116
86
  *
117
87
  * * `iconButton` - The root component class
118
- * * `icon` - The [icon component]{@link ui/IconButton.IconButtonBase.iconComponent} class
88
+ * * `icon` - The {@link ui/IconButton.IconButtonBase.iconComponent|icon component} class
119
89
  * * `large` - Applied when `size` prop is `'large'`
120
90
  * * `small` - Applied when `size` prop is `'small'`
121
91
  * * `pressed` - Applied when `pressed` prop is `true`
@@ -124,19 +94,17 @@ var IconButtonBase = (0, _kind["default"])({
124
94
  * @public
125
95
  */
126
96
  css: _propTypes2["default"].object,
127
-
128
97
  /**
129
98
  * Disables IconButton.
130
99
  *
131
100
  * When `true`, the button is shown as disabled and does not generate
132
- * `onClick` [events]{@link /docs/developer-guide/glossary/#event}.
101
+ * `onClick` {@link /docs/developer-guide/glossary/#event|events}.
133
102
  *
134
103
  * @type {Boolean}
135
104
  * @default false
136
105
  * @public
137
106
  */
138
107
  disabled: _propTypes2["default"].bool,
139
-
140
108
  /**
141
109
  * Flip the icon horizontally, vertically or both.
142
110
  *
@@ -144,7 +112,6 @@ var IconButtonBase = (0, _kind["default"])({
144
112
  * @public
145
113
  */
146
114
  flip: _propTypes2["default"].string,
147
-
148
115
  /**
149
116
  * The icon displayed within the IconButton.
150
117
  *
@@ -154,7 +121,6 @@ var IconButtonBase = (0, _kind["default"])({
154
121
  * @public
155
122
  */
156
123
  icon: _propTypes2["default"].string,
157
-
158
124
  /**
159
125
  * Applies the `pressed` CSS class.
160
126
  *
@@ -163,7 +129,6 @@ var IconButtonBase = (0, _kind["default"])({
163
129
  * @public
164
130
  */
165
131
  pressed: _propTypes2["default"].bool,
166
-
167
132
  /**
168
133
  * Applies the `selected` CSS class.
169
134
  *
@@ -172,12 +137,11 @@ var IconButtonBase = (0, _kind["default"])({
172
137
  * @public
173
138
  */
174
139
  selected: _propTypes2["default"].bool,
175
-
176
140
  /**
177
141
  * The size of the button.
178
142
  *
179
143
  * Applies the CSS class which can be customized by
180
- * [theming]{@link /docs/developer-guide/theming/}.
144
+ * {@link /docs/developer-guide/theming/|theming}.
181
145
  *
182
146
  * @type {String}
183
147
  * @public
@@ -197,28 +161,26 @@ var IconButtonBase = (0, _kind["default"])({
197
161
  computed: {
198
162
  className: function className(_ref) {
199
163
  var size = _ref.size,
200
- styler = _ref.styler;
164
+ styler = _ref.styler;
201
165
  return styler.append(size);
202
166
  }
203
167
  },
204
168
  render: function render(_ref2) {
205
169
  var buttonComponent = _ref2.buttonComponent,
206
- children = _ref2.children,
207
- componentRef = _ref2.componentRef,
208
- css = _ref2.css,
209
- flip = _ref2.flip,
210
- icon = _ref2.icon,
211
- Icon = _ref2.iconComponent,
212
- size = _ref2.size,
213
- rest = _objectWithoutProperties(_ref2, _excluded);
214
-
170
+ children = _ref2.children,
171
+ componentRef = _ref2.componentRef,
172
+ css = _ref2.css,
173
+ flip = _ref2.flip,
174
+ icon = _ref2.icon,
175
+ Icon = _ref2.iconComponent,
176
+ size = _ref2.size,
177
+ rest = _objectWithoutProperties(_ref2, _excluded);
215
178
  // To support the simpler use case of only specifying the icon as the children within
216
179
  // <IconButton>, this falls back on using children if icon isn't specified.
217
180
  if (!icon && children) {
218
181
  icon = children;
219
182
  children = null;
220
183
  }
221
-
222
184
  return (0, _ComponentOverride["default"])(_objectSpread(_objectSpread({}, rest), {}, {
223
185
  component: buttonComponent,
224
186
  size: size,
@@ -233,8 +195,9 @@ var IconButtonBase = (0, _kind["default"])({
233
195
  }));
234
196
  }
235
197
  });
198
+
236
199
  /**
237
- * A higher-order component that adds universal button behaviors to an [IconButtonBase]{@link ui/IconButton.IconButtonBase}.
200
+ * A higher-order component that adds universal button behaviors to an {@link ui/IconButton.IconButtonBase|IconButtonBase}.
238
201
  *
239
202
  * @hoc
240
203
  * @memberof ui/IconButton
@@ -242,13 +205,13 @@ var IconButtonBase = (0, _kind["default"])({
242
205
  * @mixes ui/Touchable.Touchable
243
206
  * @public
244
207
  */
245
-
246
208
  exports.IconButtonBase = IconButtonBase;
247
209
  var IconButtonDecorator = (0, _compose["default"])((0, _ForwardRef["default"])({
248
210
  prop: 'componentRef'
249
211
  }), (0, _Touchable["default"])({
250
212
  activeProp: 'pressed'
251
213
  }));
214
+
252
215
  /**
253
216
  * A minimally styled, but interactive, Button ready for customization by a theme.
254
217
  *
@@ -267,7 +230,6 @@ var IconButtonDecorator = (0, _compose["default"])((0, _ForwardRef["default"])({
267
230
  * @ui
268
231
  * @public
269
232
  */
270
-
271
233
  exports.IconButtonDecorator = IconButtonDecorator;
272
234
  var IconButton = IconButtonDecorator(IconButtonBase);
273
235
  exports.IconButton = IconButton;
@@ -1,26 +1,19 @@
1
1
  "use strict";
2
2
 
3
3
  var _react = require("react");
4
-
5
4
  var _react2 = require("@testing-library/react");
6
-
7
5
  var _IconButton = _interopRequireDefault(require("../IconButton"));
8
-
9
6
  var _jsxRuntime = require("react/jsx-runtime");
10
-
11
7
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
12
-
13
8
  describe('IconButton', function () {
14
9
  var Button = /*#__PURE__*/(0, _react.forwardRef)(function (props, fn) {
15
10
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
16
11
  ref: fn
17
12
  });
18
13
  });
19
-
20
14
  function Icon() {
21
15
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {});
22
16
  }
23
-
24
17
  test('should return a DOM node reference for `componentRef`', function () {
25
18
  var ref = jest.fn();
26
19
  (0, _react2.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton["default"], {