@enact/ui 4.1.2 → 4.5.0-alpha.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.
- package/AnnounceDecorator/Announce.js +9 -9
- package/AnnounceDecorator/AnnounceDecorator.js +6 -4
- package/AnnounceDecorator/tests/Announce-specs.js +13 -5
- package/AnnounceDecorator/tests/AnnounceDecorator-specs.js +9 -7
- package/AnnounceDecorator/tests/useAnnounce-specs.js +25 -17
- package/AnnounceDecorator/useAnnounce.js +1 -1
- package/BodyText/BodyText.d.ts +1 -1
- package/BodyText/BodyText.js +6 -4
- package/BodyText/tests/BodyText-specs.js +51 -37
- package/Button/Button.d.ts +6 -6
- package/Button/Button.js +11 -7
- package/Button/tests/Button-specs.js +104 -3
- package/CHANGELOG.md +25 -0
- package/Cancelable/Cancelable.js +12 -11
- package/Cancelable/tests/Cancelable-specs.js +133 -70
- package/Changeable/Changeable.js +9 -9
- package/Changeable/tests/Changeable-specs.js +172 -110
- package/ComponentOverride/ComponentOverride.js +6 -4
- package/FloatingLayer/FloatingLayer.js +40 -49
- package/FloatingLayer/FloatingLayer.module.css +3 -0
- package/FloatingLayer/FloatingLayerContainer.js +2 -2
- package/FloatingLayer/FloatingLayerDecorator.js +6 -4
- package/FloatingLayer/Scrim.js +9 -7
- package/FloatingLayer/index.js +1 -1
- package/FloatingLayer/tests/FloatingLayer-specs.js +83 -8
- package/FloatingLayer/tests/Scrim-specs.js +20 -11
- package/FloatingLayer/tests/useFloatingLayerDecorator-specs.js +17 -11
- package/FloatingLayer/useFloatingLayer.js +2 -2
- package/FloatingLayer/useFloatingLayerDecorator.js +1 -1
- package/ForwardRef/ForwardRef.js +3 -3
- package/GridListImageItem/GridListImageItem.d.ts +1 -1
- package/GridListImageItem/GridListImageItem.js +6 -4
- package/Group/Group.d.ts +2 -2
- package/Group/Group.js +7 -4
- package/Group/GroupItem.js +6 -4
- package/Group/tests/Group-specs.js +73 -43
- package/Heading/Heading.d.ts +2 -1
- package/Heading/Heading.js +6 -4
- package/Heading/tests/Heading-specs.js +27 -20
- package/Icon/Icon.d.ts +4 -4
- package/Icon/Icon.js +6 -4
- package/Icon/tests/Icon-specs.js +54 -33
- package/IconButton/IconButton.d.ts +4 -4
- package/IconButton/IconButton.js +6 -4
- package/IconButton/tests/IconButton-specs.js +2 -2
- package/Image/Image.js +6 -4
- package/Image/tests/Image-specs.js +41 -31
- package/ImageItem/ImageItem.js +8 -5
- package/ImageItem/tests/ImageItem-specs.js +75 -72
- package/Item/Item.js +6 -4
- package/Item/tests/Item-specs.js +59 -35
- package/LabeledIcon/LabeledIcon.d.ts +4 -4
- package/LabeledIcon/LabeledIcon.js +6 -4
- package/LabeledIcon/tests/LabeledIcon-specs.js +30 -19
- package/Layout/Cell.js +6 -4
- package/Layout/Layout.d.ts +16 -16
- package/Layout/Layout.js +6 -4
- package/Layout/tests/Layout-specs.js +42 -30
- package/Marquee/MarqueeBase.js +7 -9
- package/Marquee/MarqueeController.js +9 -9
- package/Marquee/MarqueeDecorator.js +18 -13
- package/Marquee/index.d.ts +4 -1
- package/Marquee/index.js +2 -1
- package/Marquee/tests/Marquee-specs.js +254 -122
- package/Measurable/Measurable.js +4 -4
- package/Media/Media.js +10 -10
- package/Placeholder/PlaceholderControllerDecorator.js +9 -9
- package/Placeholder/PlaceholderDecorator.js +9 -9
- package/ProgressBar/ProgressBar.js +6 -4
- package/ProgressBar/tests/ProgressBar-specs.js +60 -42
- package/README.md +1 -1
- package/RadioDecorator/RadioControllerDecorator.js +9 -9
- package/RadioDecorator/RadioDecorator.js +12 -14
- package/RadioDecorator/tests/RadioDecorator-specs.js +179 -65
- package/Repeater/Repeater.d.ts +2 -1
- package/Repeater/Repeater.js +6 -4
- package/Repeater/tests/Repeater-specs.js +90 -49
- package/Resizable/Resizable.js +10 -10
- package/Routable/Link.js +9 -7
- package/Routable/Routable.d.ts +2 -2
- package/Routable/Routable.js +10 -6
- package/Routable/Route.js +1 -1
- package/Routable/Router.js +14 -11
- package/Routable/tests/Routable-specs.js +29 -20
- package/Routable/tests/Router-specs.js +65 -41
- package/Routable/useLink.js +1 -1
- package/Routable/util.js +1 -1
- package/Scrollable/ScrollAnimator.js +2 -2
- package/Scrollable/ScrollThumb.js +3 -3
- package/Scrollable/Scrollable.js +14 -10
- package/Scrollable/ScrollableNative.js +14 -10
- package/Scrollable/Scrollbar.js +14 -8
- package/Scroller/Scroller.d.ts +2 -14
- package/Scroller/Scroller.js +8 -7
- package/Scroller/ScrollerBasic.js +18 -35
- package/Scroller/UiScrollerBase.js +9 -7
- package/Skinnable/Skinnable.js +6 -4
- package/Skinnable/tests/Skinnable-specs.js +104 -56
- package/Skinnable/tests/useSkins-specs.js +39 -44
- package/Skinnable/useSkins.js +1 -1
- package/Slider/Knob.js +6 -4
- package/Slider/PositionDecorator.js +9 -9
- package/Slider/Slider.d.ts +3 -3
- package/Slider/Slider.js +6 -4
- package/Slider/tests/Slider-specs.js +4 -4
- package/SlotItem/SlotItem.d.ts +2 -2
- package/SlotItem/SlotItem.js +6 -4
- package/SlotItem/tests/SlotItem-specs.js +4 -4
- package/Slottable/Slottable.js +3 -3
- package/Slottable/tests/Slottable-specs.js +67 -36
- package/Slottable/tests/useSlots-specs.js +68 -35
- package/Slottable/useSlots.js +6 -4
- package/Spinner/Spinner.d.ts +1 -1
- package/Spinner/Spinner.js +6 -4
- package/Spinner/tests/Spinner-specs.js +46 -31
- package/ToggleIcon/ToggleIcon.js +6 -4
- package/ToggleIcon/tests/ToggleIcon-specs.js +32 -20
- package/ToggleItem/ToggleItem.d.ts +13 -11
- package/ToggleItem/ToggleItem.js +6 -4
- package/ToggleItem/tests/ToggleItem-specs.js +54 -37
- package/Toggleable/Toggle.js +10 -10
- package/Toggleable/Toggleable.js +11 -17
- package/Toggleable/tests/Toggleable-specs.js +464 -324
- package/Toggleable/useToggle.js +4 -2
- package/Touchable/ClickAllow.js +2 -2
- package/Touchable/Drag.js +22 -22
- package/Touchable/Flick.js +22 -18
- package/Touchable/Hold.js +18 -23
- package/Touchable/Touch.js +2 -2
- package/Touchable/Touchable.d.ts +3 -3
- package/Touchable/Touchable.js +7 -4
- package/Touchable/config.js +3 -3
- package/Touchable/tests/Touchable-specs.js +225 -109
- package/Touchable/tests/useTouch-specs.js +163 -86
- package/Touchable/useTouch.js +4 -4
- package/Transition/Transition.d.ts +29 -27
- package/Transition/Transition.js +22 -17
- package/Transition/tests/Transition-specs.js +116 -36
- package/ViewManager/Arranger.js +3 -3
- package/ViewManager/TransitionGroup.js +10 -9
- package/ViewManager/View.js +7 -7
- package/ViewManager/ViewManager.d.ts +4 -4
- package/ViewManager/ViewManager.js +24 -22
- package/ViewManager/tests/View-specs.js +141 -81
- package/ViewManager/tests/ViewManager-specs.js +486 -193
- package/VirtualList/UiVirtualListBase.js +26 -35
- package/VirtualList/VirtualList.d.ts +11 -29
- package/VirtualList/VirtualList.js +10 -9
- package/VirtualList/VirtualListBase.js +1 -1
- package/VirtualList/VirtualListBasic.js +44 -61
- package/VirtualList/tests/VirtualList-specs.js +81 -95
- package/internal/IdProvider/IdProvider.js +3 -3
- package/internal/IdProvider/Provider.js +2 -2
- package/internal/IdProvider/tests/useId-specs.js +37 -20
- package/internal/Pure/Pure.js +9 -9
- package/internal/localized-fonts/localized-fonts.js +1 -1
- package/internal/validators/validators.js +1 -1
- package/package.json +11 -11
- package/resolution/ResolutionDecorator.js +9 -9
- package/resolution/index.js +2 -2
- package/resolution/resolution.js +4 -2
- package/resolution/tests/ResolutionDecorator-specs.js +17 -8
- package/styles/mixins.less +14 -2
- package/useControlledState/tests/useControlledState-specs.js +68 -43
- package/useControlledState/useControlledState.js +2 -2
- package/useScroll/ScrollAnimator.js +2 -2
- package/useScroll/Scrollbar.js +7 -4
- package/useScroll/ScrollbarTrack.js +6 -4
- package/useScroll/useScroll.js +18 -29
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
6
|
+
exports["default"] = exports.PositionDecorator = void 0;
|
|
7
7
|
|
|
8
8
|
var _hoc = _interopRequireDefault(require("@enact/core/hoc"));
|
|
9
9
|
|
|
@@ -23,9 +23,9 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
23
23
|
|
|
24
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
25
25
|
|
|
26
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
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; }
|
|
27
27
|
|
|
28
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
28
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
29
29
|
|
|
30
30
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
31
31
|
|
|
@@ -33,15 +33,15 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
33
33
|
|
|
34
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); } }
|
|
35
35
|
|
|
36
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
36
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
37
37
|
|
|
38
|
-
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 } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
38
|
+
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); }
|
|
39
39
|
|
|
40
40
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
41
41
|
|
|
42
42
|
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); }; }
|
|
43
43
|
|
|
44
|
-
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
44
|
+
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); }
|
|
45
45
|
|
|
46
46
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
47
47
|
|
|
@@ -66,9 +66,9 @@ var validateStepMax = (0, _validators.validateSteppedOnce)(function (props) {
|
|
|
66
66
|
valueName: 'max'
|
|
67
67
|
});
|
|
68
68
|
var PositionDecorator = (0, _hoc["default"])(function (config, Wrapped) {
|
|
69
|
-
var _class
|
|
69
|
+
var _class;
|
|
70
70
|
|
|
71
|
-
return
|
|
71
|
+
return _class = /*#__PURE__*/function (_Component) {
|
|
72
72
|
_inherits(_class, _Component);
|
|
73
73
|
|
|
74
74
|
var _super = _createSuper(_class);
|
|
@@ -234,7 +234,7 @@ var PositionDecorator = (0, _hoc["default"])(function (config, Wrapped) {
|
|
|
234
234
|
min: 0,
|
|
235
235
|
orientation: 'horizontal',
|
|
236
236
|
step: 1
|
|
237
|
-
},
|
|
237
|
+
}, _class;
|
|
238
238
|
});
|
|
239
239
|
exports.PositionDecorator = PositionDecorator;
|
|
240
240
|
var _default = PositionDecorator;
|
package/Slider/Slider.d.ts
CHANGED
|
@@ -76,7 +76,7 @@ corresponding internal elements and states of this component.
|
|
|
76
76
|
* The following classes are supported:
|
|
77
77
|
* * `slider` - The root component class
|
|
78
78
|
* * `knob` - The knob node
|
|
79
|
-
* * `horizontal` - Applied when `orientation` prop is `"horizontal"
|
|
79
|
+
* * `horizontal` - Applied when `orientation` prop is `"horizontal"``
|
|
80
80
|
* * `pressed` - Applied when `pressed` prop is `true`
|
|
81
81
|
* * `noFill` - Applied when `noFill` prop is `true`
|
|
82
82
|
* * `vertical` - Applied when `orientation` prop is `"vertical"`
|
|
@@ -108,14 +108,14 @@ will have its props merged with the above props.
|
|
|
108
108
|
* The maximum value of the slider.
|
|
109
109
|
*
|
|
110
110
|
* The range between `min` and `max` should be evenly divisible by
|
|
111
|
-
|
|
111
|
+
[step] .
|
|
112
112
|
*/
|
|
113
113
|
max?: number;
|
|
114
114
|
/**
|
|
115
115
|
* The minimum value of the slider.
|
|
116
116
|
*
|
|
117
117
|
* The range between `min` and `max` should be evenly divisible by
|
|
118
|
-
|
|
118
|
+
[step] .
|
|
119
119
|
*/
|
|
120
120
|
min?: number;
|
|
121
121
|
/**
|
package/Slider/Slider.js
CHANGED
|
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "Knob", {
|
|
|
9
9
|
return _Knob["default"];
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
exports.SliderDecorator = exports.SliderBase = exports.Slider =
|
|
12
|
+
exports["default"] = exports.SliderDecorator = exports.SliderBase = exports.Slider = void 0;
|
|
13
13
|
|
|
14
14
|
var _propTypes = _interopRequireDefault(require("@enact/core/internal/prop-types"));
|
|
15
15
|
|
|
@@ -37,15 +37,17 @@ var _utils = require("./utils");
|
|
|
37
37
|
|
|
38
38
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
39
39
|
|
|
40
|
+
var _excluded = ["backgroundProgress", "componentRef", "css", "disabled", "knobComponent", "min", "orientation", "percent", "progressBarComponent", "progressAnchor", "tooltipComponent", "value"];
|
|
41
|
+
|
|
40
42
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
41
43
|
|
|
42
44
|
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; }
|
|
43
45
|
|
|
44
46
|
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; }
|
|
45
47
|
|
|
46
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
48
|
+
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; }
|
|
47
49
|
|
|
48
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
50
|
+
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; }
|
|
49
51
|
|
|
50
52
|
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; }
|
|
51
53
|
|
|
@@ -324,7 +326,7 @@ var SliderBase = (0, _kind["default"])({
|
|
|
324
326
|
tooltipComponent = _ref4.tooltipComponent,
|
|
325
327
|
_ref4$value = _ref4.value,
|
|
326
328
|
value = _ref4$value === void 0 ? min : _ref4$value,
|
|
327
|
-
rest = _objectWithoutProperties(_ref4,
|
|
329
|
+
rest = _objectWithoutProperties(_ref4, _excluded);
|
|
328
330
|
|
|
329
331
|
delete rest.max;
|
|
330
332
|
delete rest.noFill;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _react = require("@testing-library/react");
|
|
4
4
|
|
|
5
5
|
var _Slider = _interopRequireDefault(require("../Slider"));
|
|
6
6
|
|
|
@@ -15,9 +15,9 @@ describe('Slider', function () {
|
|
|
15
15
|
|
|
16
16
|
test('should return a DOM node reference for `componentRef`', function () {
|
|
17
17
|
var ref = jest.fn();
|
|
18
|
-
(0,
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Slider["default"], {
|
|
19
|
+
progressBarComponent: ProgressBar,
|
|
20
|
+
ref: ref
|
|
21
21
|
}));
|
|
22
22
|
var expected = 'DIV';
|
|
23
23
|
var actual = ref.mock.calls[0][0].nodeName;
|
package/SlotItem/SlotItem.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export interface SlotItemBaseProps {
|
|
|
12
12
|
* The type of component to use to render the item.
|
|
13
13
|
*
|
|
14
14
|
* This component will receive the `inline` prop and any additional unhandled props provided
|
|
15
|
-
to `SlotItem` . A derivative of
|
|
15
|
+
to `SlotItem` . A derivative of [Item] is recommended.
|
|
16
16
|
*/
|
|
17
17
|
component: React.ComponentType;
|
|
18
18
|
/**
|
|
@@ -49,7 +49,7 @@ corresponding internal elements and states of this component.
|
|
|
49
49
|
* * `after` - Applied to the slot that falls after the content
|
|
50
50
|
* * `before` - Applied to the slot that falls before the content
|
|
51
51
|
* * `hidden` - Applied to a slot when that slot is supposed to be hidden, according to
|
|
52
|
-
|
|
52
|
+
`autoHide` prop
|
|
53
53
|
*/
|
|
54
54
|
css?: object;
|
|
55
55
|
/**
|
package/SlotItem/SlotItem.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.SlotItemDecorator = exports.SlotItemBase = exports.SlotItem =
|
|
6
|
+
exports["default"] = exports.SlotItemDecorator = exports.SlotItemBase = exports.SlotItem = void 0;
|
|
7
7
|
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("@enact/core/internal/prop-types"));
|
|
9
9
|
|
|
@@ -21,11 +21,13 @@ var _ForwardRef = _interopRequireDefault(require("../ForwardRef"));
|
|
|
21
21
|
|
|
22
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
23
|
|
|
24
|
+
var _excluded = ["children", "component", "componentRef", "inline", "slotAfter", "slotBefore"];
|
|
25
|
+
|
|
24
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
25
27
|
|
|
26
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
28
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
27
29
|
|
|
28
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
30
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
29
31
|
|
|
30
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; }
|
|
31
33
|
|
|
@@ -198,7 +200,7 @@ var SlotItemBase = (0, _kind["default"])({
|
|
|
198
200
|
inline = _ref4.inline,
|
|
199
201
|
slotAfter = _ref4.slotAfter,
|
|
200
202
|
slotBefore = _ref4.slotBefore,
|
|
201
|
-
rest = _objectWithoutProperties(_ref4,
|
|
203
|
+
rest = _objectWithoutProperties(_ref4, _excluded);
|
|
202
204
|
|
|
203
205
|
delete rest.autoHide;
|
|
204
206
|
delete rest.layout;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _react = require("react");
|
|
3
|
+
var _react = require("@testing-library/react");
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _react2 = require("react");
|
|
6
6
|
|
|
7
7
|
var _SlotItem = _interopRequireDefault(require("../SlotItem"));
|
|
8
8
|
|
|
@@ -12,13 +12,13 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
12
12
|
|
|
13
13
|
describe('SlotItem', function () {
|
|
14
14
|
test('should return a DOM node reference for `componentRef`', function () {
|
|
15
|
-
var component = /*#__PURE__*/(0,
|
|
15
|
+
var component = /*#__PURE__*/(0, _react2.forwardRef)(function (props, fn) {
|
|
16
16
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
17
17
|
ref: fn
|
|
18
18
|
});
|
|
19
19
|
});
|
|
20
20
|
var ref = jest.fn();
|
|
21
|
-
(0,
|
|
21
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_SlotItem["default"], {
|
|
22
22
|
ref: ref,
|
|
23
23
|
component: component
|
|
24
24
|
}));
|
package/Slottable/Slottable.js
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports["default"] = exports.Slottable = void 0;
|
|
6
7
|
Object.defineProperty(exports, "useSlots", {
|
|
7
8
|
enumerable: true,
|
|
8
9
|
get: function get() {
|
|
9
10
|
return _useSlots["default"];
|
|
10
11
|
}
|
|
11
12
|
});
|
|
12
|
-
exports.Slottable = exports["default"] = void 0;
|
|
13
13
|
|
|
14
14
|
var _hoc = _interopRequireDefault(require("@enact/core/hoc"));
|
|
15
15
|
|
|
@@ -19,9 +19,9 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
19
19
|
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
21
|
|
|
22
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
22
|
+
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; }
|
|
23
23
|
|
|
24
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
24
|
+
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; }
|
|
25
25
|
|
|
26
26
|
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; }
|
|
27
27
|
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _enzyme = require("enzyme");
|
|
4
|
-
|
|
5
3
|
var _kind = _interopRequireDefault(require("@enact/core/kind"));
|
|
6
4
|
|
|
5
|
+
require("@testing-library/jest-dom");
|
|
6
|
+
|
|
7
|
+
var _react = require("@testing-library/react");
|
|
8
|
+
|
|
7
9
|
var _Slottable = _interopRequireDefault(require("../Slottable"));
|
|
8
10
|
|
|
9
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -20,10 +22,11 @@ describe('Slottable Specs', function () {
|
|
|
20
22
|
b = _ref.b,
|
|
21
23
|
c = _ref.c;
|
|
22
24
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
25
|
+
"data-testid": "slottable",
|
|
23
26
|
children: [c, b, a]
|
|
24
27
|
});
|
|
25
28
|
});
|
|
26
|
-
|
|
29
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(Component, {
|
|
27
30
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
28
31
|
slot: "a",
|
|
29
32
|
children: "A"
|
|
@@ -35,9 +38,11 @@ describe('Slottable Specs', function () {
|
|
|
35
38
|
children: "C"
|
|
36
39
|
})]
|
|
37
40
|
}));
|
|
41
|
+
|
|
42
|
+
var actual = _react.screen.getByTestId('slottable');
|
|
43
|
+
|
|
38
44
|
var expected = 'CBA';
|
|
39
|
-
|
|
40
|
-
expect(actual).toBe(expected);
|
|
45
|
+
expect(actual.textContent).toBe(expected);
|
|
41
46
|
});
|
|
42
47
|
test('should distribute children with a \'type\' that matches a slot', function () {
|
|
43
48
|
var Component = (0, _Slottable["default"])({
|
|
@@ -48,10 +53,11 @@ describe('Slottable Specs', function () {
|
|
|
48
53
|
c = _ref2.c,
|
|
49
54
|
custom = _ref2.custom;
|
|
50
55
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
56
|
+
"data-testid": "slottable",
|
|
51
57
|
children: [c, b, a, custom]
|
|
52
58
|
});
|
|
53
59
|
});
|
|
54
|
-
|
|
60
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(Component, {
|
|
55
61
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
56
62
|
slot: "a",
|
|
57
63
|
children: "A"
|
|
@@ -65,9 +71,11 @@ describe('Slottable Specs', function () {
|
|
|
65
71
|
children: "C"
|
|
66
72
|
})]
|
|
67
73
|
}));
|
|
74
|
+
|
|
75
|
+
var actual = _react.screen.getByTestId('slottable');
|
|
76
|
+
|
|
68
77
|
var expected = 'CBAD';
|
|
69
|
-
|
|
70
|
-
expect(actual).toBe(expected);
|
|
78
|
+
expect(actual.textContent).toBe(expected);
|
|
71
79
|
});
|
|
72
80
|
test('should distribute children whose \'type\' has a \'defaultSlot\' property that matches a slot', function () {
|
|
73
81
|
var Custom = (0, _kind["default"])({
|
|
@@ -87,10 +95,11 @@ describe('Slottable Specs', function () {
|
|
|
87
95
|
b = _ref4.b,
|
|
88
96
|
c = _ref4.c;
|
|
89
97
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
98
|
+
"data-testid": "slottable",
|
|
90
99
|
children: [c, b, a]
|
|
91
100
|
});
|
|
92
101
|
});
|
|
93
|
-
|
|
102
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(Component, {
|
|
94
103
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
95
104
|
slot: "a",
|
|
96
105
|
children: "A"
|
|
@@ -102,8 +111,10 @@ describe('Slottable Specs', function () {
|
|
|
102
111
|
})]
|
|
103
112
|
}));
|
|
104
113
|
var expected = 'CBA';
|
|
105
|
-
|
|
106
|
-
|
|
114
|
+
|
|
115
|
+
var actual = _react.screen.getByTestId('slottable');
|
|
116
|
+
|
|
117
|
+
expect(actual.textContent).toBe(expected);
|
|
107
118
|
});
|
|
108
119
|
test('should distribute children with no \'slot\' property to Slottable\'s \'children\'', function () {
|
|
109
120
|
var Component = (0, _Slottable["default"])({
|
|
@@ -113,10 +124,11 @@ describe('Slottable Specs', function () {
|
|
|
113
124
|
b = _ref5.b,
|
|
114
125
|
children = _ref5.children;
|
|
115
126
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
127
|
+
"data-testid": "slottable",
|
|
116
128
|
children: [children, b, a]
|
|
117
129
|
});
|
|
118
130
|
});
|
|
119
|
-
|
|
131
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(Component, {
|
|
120
132
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
121
133
|
slot: "a",
|
|
122
134
|
children: "A"
|
|
@@ -128,8 +140,10 @@ describe('Slottable Specs', function () {
|
|
|
128
140
|
})]
|
|
129
141
|
}));
|
|
130
142
|
var expected = 'CBA';
|
|
131
|
-
|
|
132
|
-
|
|
143
|
+
|
|
144
|
+
var actual = _react.screen.getByTestId('slottable');
|
|
145
|
+
|
|
146
|
+
expect(actual.textContent).toBe(expected);
|
|
133
147
|
});
|
|
134
148
|
test('should not distribute children with an invalid \'slot\' property', function () {
|
|
135
149
|
// Modify the console spy to silence error output with
|
|
@@ -142,10 +156,11 @@ describe('Slottable Specs', function () {
|
|
|
142
156
|
b = _ref6.b,
|
|
143
157
|
c = _ref6.c;
|
|
144
158
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
159
|
+
"data-testid": "slottable",
|
|
145
160
|
children: [c, b, a]
|
|
146
161
|
});
|
|
147
162
|
});
|
|
148
|
-
|
|
163
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(Component, {
|
|
149
164
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
150
165
|
slot: "a",
|
|
151
166
|
children: "A"
|
|
@@ -158,8 +173,10 @@ describe('Slottable Specs', function () {
|
|
|
158
173
|
})]
|
|
159
174
|
}));
|
|
160
175
|
var expected = 'BA';
|
|
161
|
-
|
|
162
|
-
|
|
176
|
+
|
|
177
|
+
var actual = _react.screen.getByTestId('slottable');
|
|
178
|
+
|
|
179
|
+
expect(actual.textContent).toBe(expected); // Check to make sure that we only get the one expected error
|
|
163
180
|
|
|
164
181
|
var actualErrorsLength = console.error.mock.calls.length;
|
|
165
182
|
var expectedErrorLength = 1;
|
|
@@ -178,10 +195,11 @@ describe('Slottable Specs', function () {
|
|
|
178
195
|
custom = _ref7.custom;
|
|
179
196
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
180
197
|
className: "root-div",
|
|
198
|
+
"data-testid": "slottable",
|
|
181
199
|
children: [c, b, a, custom]
|
|
182
200
|
});
|
|
183
201
|
});
|
|
184
|
-
|
|
202
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(Component, {
|
|
185
203
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
186
204
|
slot: "a",
|
|
187
205
|
title: "Div A"
|
|
@@ -196,11 +214,15 @@ describe('Slottable Specs', function () {
|
|
|
196
214
|
})]
|
|
197
215
|
}));
|
|
198
216
|
var expected = 'CBD';
|
|
199
|
-
|
|
200
|
-
|
|
217
|
+
|
|
218
|
+
var actual = _react.screen.getByTestId('slottable');
|
|
219
|
+
|
|
220
|
+
expect(actual.textContent).toBe(expected);
|
|
201
221
|
var expectedTitle = 'Div A';
|
|
202
|
-
|
|
203
|
-
|
|
222
|
+
|
|
223
|
+
var actualChild = _react.screen.getByTestId('slottable').children[2];
|
|
224
|
+
|
|
225
|
+
expect(actualChild).toHaveAttribute('title', expectedTitle);
|
|
204
226
|
});
|
|
205
227
|
test('should preserve values in \'slot\' property', function () {
|
|
206
228
|
// This suppresses the unique key warning that this implementation creates. Also, we can't
|
|
@@ -211,10 +233,11 @@ describe('Slottable Specs', function () {
|
|
|
211
233
|
}, function (_ref8) {
|
|
212
234
|
var a = _ref8.a;
|
|
213
235
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
236
|
+
"data-testid": "slottable",
|
|
214
237
|
children: a
|
|
215
238
|
});
|
|
216
239
|
});
|
|
217
|
-
|
|
240
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
218
241
|
a: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
219
242
|
children: "X"
|
|
220
243
|
}, "X"),
|
|
@@ -224,8 +247,10 @@ describe('Slottable Specs', function () {
|
|
|
224
247
|
}, "A")
|
|
225
248
|
}));
|
|
226
249
|
var expected = 'XA';
|
|
227
|
-
|
|
228
|
-
|
|
250
|
+
|
|
251
|
+
var actual = _react.screen.getByTestId('slottable');
|
|
252
|
+
|
|
253
|
+
expect(actual.textContent).toBe(expected);
|
|
229
254
|
});
|
|
230
255
|
test('should add values to existing array in \'slot\' property', function () {
|
|
231
256
|
var Component = (0, _Slottable["default"])({
|
|
@@ -233,12 +258,13 @@ describe('Slottable Specs', function () {
|
|
|
233
258
|
}, function (_ref9) {
|
|
234
259
|
var a = _ref9.a;
|
|
235
260
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
261
|
+
"data-testid": "slottable",
|
|
236
262
|
children: a
|
|
237
263
|
});
|
|
238
264
|
});
|
|
239
265
|
/* eslint-disable jsx-a11y/anchor-is-valid */
|
|
240
266
|
|
|
241
|
-
|
|
267
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
|
|
242
268
|
a: ['a', 'b'],
|
|
243
269
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
|
|
244
270
|
children: "c"
|
|
@@ -246,15 +272,16 @@ describe('Slottable Specs', function () {
|
|
|
246
272
|
}));
|
|
247
273
|
/* eslint-enable jsx-a11y/anchor-is-valid */
|
|
248
274
|
|
|
249
|
-
var
|
|
250
|
-
|
|
251
|
-
expect(actual).
|
|
275
|
+
var actual = _react.screen.getByTestId('slottable');
|
|
276
|
+
|
|
277
|
+
expect(actual).toHaveTextContent('abc');
|
|
252
278
|
});
|
|
253
279
|
test('should distribute multiple children with the same slot into the same slot', function () {
|
|
254
280
|
function ComponentBase(_ref10) {
|
|
255
281
|
var a = _ref10.a;
|
|
256
282
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
257
283
|
className: "root-div",
|
|
284
|
+
"data-testid": "slottable",
|
|
258
285
|
children: a
|
|
259
286
|
});
|
|
260
287
|
}
|
|
@@ -262,7 +289,7 @@ describe('Slottable Specs', function () {
|
|
|
262
289
|
var Component = (0, _Slottable["default"])({
|
|
263
290
|
slots: ['a']
|
|
264
291
|
}, ComponentBase);
|
|
265
|
-
|
|
292
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsxs)(Component, {
|
|
266
293
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
267
294
|
slot: "a",
|
|
268
295
|
children: "A"
|
|
@@ -275,13 +302,16 @@ describe('Slottable Specs', function () {
|
|
|
275
302
|
})]
|
|
276
303
|
}));
|
|
277
304
|
var expected = 'AAA';
|
|
278
|
-
|
|
279
|
-
|
|
305
|
+
|
|
306
|
+
var actual = _react.screen.getByTestId('slottable');
|
|
307
|
+
|
|
308
|
+
expect(actual.textContent).toBe(expected);
|
|
280
309
|
});
|
|
281
310
|
test('should allow downstream component to have default value for unset slot', function () {
|
|
282
311
|
function ComponentBase(_ref11) {
|
|
283
312
|
var a = _ref11.a;
|
|
284
313
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
314
|
+
"data-testid": "slottable",
|
|
285
315
|
children: a
|
|
286
316
|
});
|
|
287
317
|
}
|
|
@@ -292,9 +322,10 @@ describe('Slottable Specs', function () {
|
|
|
292
322
|
var Component = (0, _Slottable["default"])({
|
|
293
323
|
slots: ['a']
|
|
294
324
|
}, ComponentBase);
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
var actual =
|
|
298
|
-
|
|
325
|
+
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {}));
|
|
326
|
+
|
|
327
|
+
var actual = _react.screen.getByTestId('slottable');
|
|
328
|
+
|
|
329
|
+
expect(actual).toHaveTextContent('Default A');
|
|
299
330
|
});
|
|
300
331
|
});
|