@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/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, ")")
@@ -4,53 +4,30 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = exports.IconButtonDecorator = exports.IconButtonBase = exports.IconButton = void 0;
7
-
7
+ var _deprecate = _interopRequireDefault(require("@enact/core/internal/deprecate"));
8
8
  var _propTypes = _interopRequireDefault(require("@enact/core/internal/prop-types"));
9
-
10
9
  var _kind = _interopRequireDefault(require("@enact/core/kind"));
11
-
12
10
  var _propTypes2 = _interopRequireDefault(require("prop-types"));
13
-
14
11
  var _compose = _interopRequireDefault(require("ramda/src/compose"));
15
-
16
12
  var _react = require("react");
17
-
18
13
  var _ComponentOverride = _interopRequireDefault(require("../ComponentOverride"));
19
-
20
14
  var _ForwardRef = _interopRequireDefault(require("../ForwardRef"));
21
-
22
15
  var _Touchable = _interopRequireDefault(require("../Touchable"));
23
-
24
16
  var _IconButtonModule = _interopRequireDefault(require("./IconButton.module.css"));
25
-
26
17
  var _jsxRuntime = require("react/jsx-runtime");
27
-
28
18
  var _excluded = ["buttonComponent", "children", "componentRef", "css", "flip", "icon", "iconComponent", "size"];
29
-
30
19
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
31
-
32
20
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
33
-
34
21
  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
22
  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
23
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
39
-
40
24
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
41
-
42
25
  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
26
  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
27
  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
28
  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
29
  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
30
  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
31
  /**
55
32
  * A ui-styled button without any behavior.
56
33
  *
@@ -61,9 +38,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
61
38
  */
62
39
  var IconButtonBase = (0, _kind["default"])({
63
40
  name: 'ui:IconButton',
64
- propTypes:
65
- /** @lends ui/IconButton.IconButtonBase.prototype */
66
- {
41
+ propTypes: /** @lends ui/IconButton.IconButtonBase.prototype */{
67
42
  /**
68
43
  * This is the root component used to render the button and will receive all props except
69
44
  * `icon`.
@@ -73,9 +48,8 @@ var IconButtonBase = (0, _kind["default"])({
73
48
  * @public
74
49
  */
75
50
  buttonComponent: _propTypes["default"].componentOverride.isRequired,
76
-
77
51
  /**
78
- * The component used to render the [icon]{@link ui/IconButton.IconButtonBase.icon}.
52
+ * The component used to render the {@link ui/IconButton.IconButtonBase.icon|icon}.
79
53
  *
80
54
  * This component will receive the `flip` and `size` property set on the `IconButton` as well as the
81
55
  * `icon` class to customize its styling.
@@ -85,7 +59,6 @@ var IconButtonBase = (0, _kind["default"])({
85
59
  * @public
86
60
  */
87
61
  iconComponent: _propTypes["default"].component.isRequired,
88
-
89
62
  /**
90
63
  * Additional children that follow the icon.
91
64
  *
@@ -96,7 +69,6 @@ var IconButtonBase = (0, _kind["default"])({
96
69
  * @public
97
70
  */
98
71
  children: _propTypes2["default"].node,
99
-
100
72
  /**
101
73
  * Called with a reference to the root component.
102
74
  *
@@ -107,7 +79,6 @@ var IconButtonBase = (0, _kind["default"])({
107
79
  * @public
108
80
  */
109
81
  componentRef: _propTypes["default"].ref,
110
-
111
82
  /**
112
83
  * Customizes the component by mapping the supplied collection of CSS class names to the
113
84
  * corresponding internal elements and states of this component.
@@ -115,7 +86,7 @@ var IconButtonBase = (0, _kind["default"])({
115
86
  * The following classes are supported:
116
87
  *
117
88
  * * `iconButton` - The root component class
118
- * * `icon` - The [icon component]{@link ui/IconButton.IconButtonBase.iconComponent} class
89
+ * * `icon` - The {@link ui/IconButton.IconButtonBase.iconComponent|icon component} class
119
90
  * * `large` - Applied when `size` prop is `'large'`
120
91
  * * `small` - Applied when `size` prop is `'small'`
121
92
  * * `pressed` - Applied when `pressed` prop is `true`
@@ -124,19 +95,17 @@ var IconButtonBase = (0, _kind["default"])({
124
95
  * @public
125
96
  */
126
97
  css: _propTypes2["default"].object,
127
-
128
98
  /**
129
99
  * Disables IconButton.
130
100
  *
131
101
  * When `true`, the button is shown as disabled and does not generate
132
- * `onClick` [events]{@link /docs/developer-guide/glossary/#event}.
102
+ * `onClick` {@link /docs/developer-guide/glossary/#event|events}.
133
103
  *
134
104
  * @type {Boolean}
135
105
  * @default false
136
106
  * @public
137
107
  */
138
108
  disabled: _propTypes2["default"].bool,
139
-
140
109
  /**
141
110
  * Flip the icon horizontally, vertically or both.
142
111
  *
@@ -144,7 +113,6 @@ var IconButtonBase = (0, _kind["default"])({
144
113
  * @public
145
114
  */
146
115
  flip: _propTypes2["default"].string,
147
-
148
116
  /**
149
117
  * The icon displayed within the IconButton.
150
118
  *
@@ -154,7 +122,6 @@ var IconButtonBase = (0, _kind["default"])({
154
122
  * @public
155
123
  */
156
124
  icon: _propTypes2["default"].string,
157
-
158
125
  /**
159
126
  * Applies the `pressed` CSS class.
160
127
  *
@@ -163,7 +130,6 @@ var IconButtonBase = (0, _kind["default"])({
163
130
  * @public
164
131
  */
165
132
  pressed: _propTypes2["default"].bool,
166
-
167
133
  /**
168
134
  * Applies the `selected` CSS class.
169
135
  *
@@ -172,12 +138,11 @@ var IconButtonBase = (0, _kind["default"])({
172
138
  * @public
173
139
  */
174
140
  selected: _propTypes2["default"].bool,
175
-
176
141
  /**
177
142
  * The size of the button.
178
143
  *
179
144
  * Applies the CSS class which can be customized by
180
- * [theming]{@link /docs/developer-guide/theming/}.
145
+ * {@link /docs/developer-guide/theming/|theming}.
181
146
  *
182
147
  * @type {String}
183
148
  * @public
@@ -197,28 +162,26 @@ var IconButtonBase = (0, _kind["default"])({
197
162
  computed: {
198
163
  className: function className(_ref) {
199
164
  var size = _ref.size,
200
- styler = _ref.styler;
165
+ styler = _ref.styler;
201
166
  return styler.append(size);
202
167
  }
203
168
  },
204
- render: function render(_ref2) {
169
+ render: (0, _deprecate["default"])(function (_ref2) {
205
170
  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
-
171
+ children = _ref2.children,
172
+ componentRef = _ref2.componentRef,
173
+ css = _ref2.css,
174
+ flip = _ref2.flip,
175
+ icon = _ref2.icon,
176
+ Icon = _ref2.iconComponent,
177
+ size = _ref2.size,
178
+ rest = _objectWithoutProperties(_ref2, _excluded);
215
179
  // To support the simpler use case of only specifying the icon as the children within
216
180
  // <IconButton>, this falls back on using children if icon isn't specified.
217
181
  if (!icon && children) {
218
182
  icon = children;
219
183
  children = null;
220
184
  }
221
-
222
185
  return (0, _ComponentOverride["default"])(_objectSpread(_objectSpread({}, rest), {}, {
223
186
  component: buttonComponent,
224
187
  size: size,
@@ -231,10 +194,15 @@ var IconButtonBase = (0, _kind["default"])({
231
194
  }, "icon")].concat(_toConsumableArray(_react.Children.toArray(children))),
232
195
  ref: componentRef
233
196
  }));
234
- }
197
+ }, {
198
+ name: 'ui/IconButton',
199
+ replacedBy: 'ui/Button',
200
+ until: '5.0.0'
201
+ })
235
202
  });
203
+
236
204
  /**
237
- * A higher-order component that adds universal button behaviors to an [IconButtonBase]{@link ui/IconButton.IconButtonBase}.
205
+ * A higher-order component that adds universal button behaviors to an {@link ui/IconButton.IconButtonBase|IconButtonBase}.
238
206
  *
239
207
  * @hoc
240
208
  * @memberof ui/IconButton
@@ -242,13 +210,13 @@ var IconButtonBase = (0, _kind["default"])({
242
210
  * @mixes ui/Touchable.Touchable
243
211
  * @public
244
212
  */
245
-
246
213
  exports.IconButtonBase = IconButtonBase;
247
214
  var IconButtonDecorator = (0, _compose["default"])((0, _ForwardRef["default"])({
248
215
  prop: 'componentRef'
249
216
  }), (0, _Touchable["default"])({
250
217
  activeProp: 'pressed'
251
218
  }));
219
+
252
220
  /**
253
221
  * A minimally styled, but interactive, Button ready for customization by a theme.
254
222
  *
@@ -267,7 +235,6 @@ var IconButtonDecorator = (0, _compose["default"])((0, _ForwardRef["default"])({
267
235
  * @ui
268
236
  * @public
269
237
  */
270
-
271
238
  exports.IconButtonDecorator = IconButtonDecorator;
272
239
  var IconButton = IconButtonDecorator(IconButtonBase);
273
240
  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"], {