@enact/ui 4.9.2 → 5.0.0-alpha.2
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 +20 -22
- package/AnnounceDecorator/AnnounceDecorator.js +5 -5
- package/AnnounceDecorator/tests/Announce-specs.js +1 -1
- package/AnnounceDecorator/tests/AnnounceDecorator-specs.js +1 -1
- package/AnnounceDecorator/tests/useAnnounce-specs.js +1 -1
- package/AnnounceDecorator/useAnnounce.js +1 -1
- package/BodyText/BodyText.js +5 -5
- package/BodyText/tests/BodyText-specs.js +1 -1
- package/Button/Button.js +5 -5
- package/Button/tests/Button-specs.js +3 -3
- package/CHANGELOG.md +33 -0
- package/Cancelable/Cancelable.js +22 -24
- package/Cancelable/tests/Cancelable-specs.js +4 -4
- package/Changeable/Changeable.js +22 -24
- package/Changeable/tests/Changeable-specs.js +1 -1
- package/ComponentOverride/ComponentOverride.js +4 -4
- package/FloatingLayer/FloatingLayer.js +20 -22
- package/FloatingLayer/FloatingLayerContainer.js +6 -7
- package/FloatingLayer/FloatingLayerDecorator.js +5 -5
- package/FloatingLayer/Scrim.js +18 -20
- package/FloatingLayer/tests/FloatingLayer-specs.js +1 -1
- package/FloatingLayer/tests/Scrim-specs.js +1 -1
- package/FloatingLayer/tests/useFloatingLayerDecorator-specs.js +2 -2
- package/FloatingLayer/useFloatingLayer.js +4 -4
- package/FloatingLayer/useFloatingLayerDecorator.js +1 -1
- package/ForwardRef/ForwardRef.js +3 -3
- package/Group/Group.js +5 -5
- package/Group/GroupItem.js +5 -5
- package/Group/tests/Group-specs.js +4 -4
- package/Heading/Heading.js +5 -5
- package/Heading/tests/Heading-specs.js +1 -1
- package/Icon/Icon.js +5 -5
- package/Icon/tests/Icon-specs.js +1 -1
- package/Image/Image.js +5 -5
- package/Image/tests/Image-specs.js +1 -1
- package/ImageItem/ImageItem.js +5 -5
- package/ImageItem/tests/ImageItem-specs.js +3 -3
- package/Item/Item.js +5 -5
- package/Item/tests/Item-specs.js +3 -3
- package/LabeledIcon/LabeledIcon.js +5 -5
- package/LabeledIcon/tests/LabeledIcon-specs.js +1 -1
- package/Layout/Cell.js +5 -5
- package/Layout/Layout.js +5 -5
- package/Layout/tests/Layout-specs.js +7 -7
- package/Marquee/MarqueeBase.js +5 -5
- package/Marquee/MarqueeController.js +3 -3
- package/Marquee/MarqueeDecorator.js +30 -51
- package/Marquee/index.d.ts +10 -14
- package/Marquee/index.js +1 -1
- package/Marquee/tests/Marquee-specs.js +5 -6
- package/Marquee/useMarqueeController.js +2 -2
- package/Measurable/Measurable.js +8 -8
- package/Measurable/tests/Measurable-specs.js +8 -10
- package/Media/Media.js +17 -19
- package/Placeholder/PlaceholderControllerDecorator.js +22 -24
- package/Placeholder/PlaceholderDecorator.js +20 -22
- package/Placeholder/index.js +1 -1
- package/Placeholder/tests/PlaceholderControllerDecorator-specs.js +2 -2
- package/Placeholder/tests/PlaceholderDecorator-specs.js +1 -1
- package/ProgressBar/ProgressBar.js +5 -5
- package/ProgressBar/tests/ProgressBar-specs.js +1 -1
- package/Repeater/Repeater.js +5 -5
- package/Repeater/tests/Repeater-specs.js +3 -3
- package/Resizable/Resizable.js +3 -3
- package/Resizable/tests/Resizable-specs.js +2 -2
- package/Resizable/tests/useResize-specs.js +3 -3
- package/Resizable/useResize.js +3 -3
- package/Routable/Link.js +17 -19
- package/Routable/Routable.js +5 -5
- package/Routable/Route.js +1 -1
- package/Routable/Router.js +22 -24
- package/Routable/tests/Routable-specs.js +9 -9
- package/Routable/tests/Router-specs.js +1 -1
- package/Routable/util.js +1 -1
- package/Scroller/Scroller.d.ts +0 -120
- package/Scroller/Scroller.js +3 -11
- package/Scroller/ScrollerBasic.js +19 -21
- package/Scroller/tests/Scroller-specs.js +1 -1
- package/Skinnable/Skinnable.js +5 -5
- package/Skinnable/tests/Skinnable-specs.js +3 -3
- package/Skinnable/tests/useSkins-specs.js +3 -3
- package/Skinnable/util.js +1 -1
- package/Slider/Knob.js +5 -5
- package/Slider/PositionDecorator.js +25 -27
- package/Slider/Slider.js +5 -5
- package/Slider/tests/Slider-specs.js +1 -1
- package/Slottable/Slottable.js +3 -5
- package/Slottable/tests/Slottable-specs.js +1 -1
- package/Slottable/tests/useSlots-specs.js +1 -1
- package/Slottable/useSlots.js +5 -5
- package/Spinner/Spinner.js +5 -5
- package/ToggleIcon/ToggleIcon.js +5 -5
- package/ToggleIcon/tests/ToggleIcon-specs.js +3 -3
- package/Toggleable/Toggle.js +6 -7
- package/Toggleable/Toggleable.js +6 -6
- package/Toggleable/tests/Toggleable-specs.js +1 -1
- package/Toggleable/useToggle.js +8 -8
- package/Touchable/ClickAllow.js +5 -6
- package/Touchable/Drag.js +6 -6
- package/Touchable/Flick.js +7 -8
- package/Touchable/Hold.js +7 -8
- package/Touchable/Pinch.js +6 -6
- package/Touchable/Touch.js +6 -7
- package/Touchable/Touchable.js +5 -5
- package/Touchable/config.js +2 -2
- package/Touchable/tests/Touchable-specs.js +3 -3
- package/Touchable/tests/useTouch-specs.js +5 -5
- package/Touchable/useTouch.js +7 -7
- package/Transition/Transition.js +17 -19
- package/Transition/tests/Transition-specs.js +7 -7
- package/ViewManager/Arranger.js +3 -3
- package/ViewManager/TransitionGroup.js +18 -20
- package/ViewManager/View.js +15 -17
- package/ViewManager/ViewManager.js +25 -27
- package/ViewManager/tests/View-specs.js +1 -1
- package/ViewManager/tests/ViewManager-specs.js +16 -18
- package/VirtualList/VirtualList.d.ts +0 -158
- package/VirtualList/VirtualList.js +3 -17
- package/VirtualList/VirtualListBasic.js +42 -43
- package/VirtualList/tests/VirtualGridList-native-specs.js +4 -4
- package/VirtualList/tests/VirtualGridList-specs.js +6 -6
- package/VirtualList/tests/VirtualList-native-specs.js +5 -5
- package/VirtualList/tests/VirtualList-specs.js +7 -7
- package/internal/IdProvider/IdProvider.js +3 -3
- package/internal/IdProvider/Provider.js +5 -6
- package/internal/IdProvider/tests/IdProvider-specs.js +3 -3
- package/internal/IdProvider/tests/useId-specs.js +3 -3
- package/internal/IdProvider/useId.js +1 -1
- package/internal/Pure/Pure.js +20 -22
- package/internal/Pure/tests/Pure-specs.js +15 -17
- package/internal/localized-fonts/localized-fonts.js +4 -4
- package/internal/selection/selection.js +1 -1
- package/package.json +5 -4
- package/resolution/ResolutionDecorator.js +21 -23
- package/resolution/index.js +2 -2
- package/resolution/tests/ResolutionDecorator-specs.js +1 -1
- package/useControlledState/tests/useControlledState-specs.js +5 -5
- package/useControlledState/useControlledState.js +4 -4
- package/useScroll/ScrollAnimator.js +6 -7
- package/useScroll/Scrollbar.js +5 -5
- package/useScroll/ScrollbarTrack.js +5 -5
- package/useScroll/useScroll.js +9 -9
- package/useScroll/utilDOM.js +1 -1
- package/GridListImageItem/GridListImageItem.d.ts +0 -85
- package/GridListImageItem/GridListImageItem.js +0 -250
- package/GridListImageItem/GridListImageItem.module.css +0 -28
- package/GridListImageItem/package.json +0 -3
- package/IconButton/IconButton.d.ts +0 -115
- package/IconButton/IconButton.js +0 -253
- package/IconButton/IconButton.module.css +0 -11
- package/IconButton/package.json +0 -3
- package/IconButton/tests/IconButton-specs.js +0 -29
- package/RadioDecorator/RadioControllerDecorator.js +0 -101
- package/RadioDecorator/RadioDecorator.d.ts +0 -35
- package/RadioDecorator/RadioDecorator.js +0 -177
- package/RadioDecorator/package.json +0 -3
- package/RadioDecorator/tests/RadioDecorator-specs.js +0 -247
- package/Scrollable/ScrollAnimator.js +0 -130
- package/Scrollable/ScrollThumb.js +0 -57
- package/Scrollable/ScrollThumb.module.css +0 -34
- package/Scrollable/Scrollable.js +0 -1430
- package/Scrollable/Scrollable.module.css +0 -36
- package/Scrollable/ScrollableNative.js +0 -1429
- package/Scrollable/Scrollbar.js +0 -281
- package/Scrollable/Scrollbar.module.css +0 -24
- package/Scrollable/package.json +0 -3
- package/Scroller/UiScroller.module.css +0 -10
- package/Scroller/UiScrollerBase.js +0 -372
- package/SlotItem/SlotItem.d.ts +0 -118
- package/SlotItem/SlotItem.js +0 -248
- package/SlotItem/SlotItem.module.css +0 -12
- package/SlotItem/package.json +0 -3
- package/SlotItem/tests/SlotItem-specs.js +0 -24
- package/ToggleItem/ToggleItem.d.ts +0 -132
- package/ToggleItem/ToggleItem.js +0 -301
- package/ToggleItem/ToggleItem.module.css +0 -9
- package/ToggleItem/package.json +0 -3
- package/ToggleItem/tests/ToggleItem-specs.js +0 -120
- package/VirtualList/UiVirtualList.module.css +0 -26
- package/VirtualList/UiVirtualListBase.js +0 -1410
- package/VirtualList/VirtualListBase.js +0 -33
|
@@ -1,372 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = exports.ScrollerBase = void 0;
|
|
7
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
8
|
-
var _deprecate = _interopRequireDefault(require("@enact/core/internal/deprecate"));
|
|
9
|
-
var _platform = require("@enact/core/platform");
|
|
10
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
var _react = require("react");
|
|
12
|
-
var _UiScrollerModule = _interopRequireDefault(require("./UiScroller.module.css"));
|
|
13
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
-
var _excluded = ["className", "style"];
|
|
15
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
16
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
17
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
18
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
19
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
20
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
21
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
22
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
23
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
24
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
25
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
26
|
-
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); }
|
|
27
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
28
|
-
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); }; }
|
|
29
|
-
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); }
|
|
30
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
31
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
32
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /**
|
|
33
|
-
* An unstyled base scroller component.
|
|
34
|
-
*
|
|
35
|
-
* In most circumstances, you will want to use the Scrollable version.
|
|
36
|
-
*
|
|
37
|
-
* @class ScrollerBase
|
|
38
|
-
* @memberof ui/Scroller
|
|
39
|
-
* @ui
|
|
40
|
-
* @public
|
|
41
|
-
* @deprecated Will be removed in 5.0.0.
|
|
42
|
-
*/
|
|
43
|
-
var ScrollerBase = exports.ScrollerBase = /*#__PURE__*/function (_Component) {
|
|
44
|
-
_inherits(ScrollerBase, _Component);
|
|
45
|
-
var _super = _createSuper(ScrollerBase);
|
|
46
|
-
function ScrollerBase(props) {
|
|
47
|
-
var _this;
|
|
48
|
-
_classCallCheck(this, ScrollerBase);
|
|
49
|
-
_this = _super.call(this, props);
|
|
50
|
-
_this.scrollBounds = {
|
|
51
|
-
clientWidth: 0,
|
|
52
|
-
clientHeight: 0,
|
|
53
|
-
scrollWidth: 0,
|
|
54
|
-
scrollHeight: 0,
|
|
55
|
-
maxLeft: 0,
|
|
56
|
-
maxTop: 0
|
|
57
|
-
};
|
|
58
|
-
_this.scrollPos = {
|
|
59
|
-
top: 0,
|
|
60
|
-
left: 0
|
|
61
|
-
};
|
|
62
|
-
_this.getScrollBounds = function () {
|
|
63
|
-
return _this.scrollBounds;
|
|
64
|
-
};
|
|
65
|
-
_this.getRtlPositionX = function (x) {
|
|
66
|
-
if (_this.props.rtl) {
|
|
67
|
-
return _platform.platform.chrome < 85 ? _this.scrollBounds.maxLeft - x : -x;
|
|
68
|
-
}
|
|
69
|
-
return x;
|
|
70
|
-
};
|
|
71
|
-
_this.getNodePosition = function (node) {
|
|
72
|
-
var _node$getBoundingClie = node.getBoundingClientRect(),
|
|
73
|
-
nodeLeft = _node$getBoundingClie.left,
|
|
74
|
-
nodeTop = _node$getBoundingClie.top,
|
|
75
|
-
nodeHeight = _node$getBoundingClie.height,
|
|
76
|
-
nodeWidth = _node$getBoundingClie.width,
|
|
77
|
-
_this$containerRef$cu = _this.containerRef.current.getBoundingClientRect(),
|
|
78
|
-
containerLeft = _this$containerRef$cu.left,
|
|
79
|
-
containerTop = _this$containerRef$cu.top,
|
|
80
|
-
_this$containerRef$cu2 = _this.containerRef.current,
|
|
81
|
-
scrollLeft = _this$containerRef$cu2.scrollLeft,
|
|
82
|
-
scrollTop = _this$containerRef$cu2.scrollTop,
|
|
83
|
-
left = _this.isHorizontal() ? scrollLeft + nodeLeft - containerLeft : null,
|
|
84
|
-
top = _this.isVertical() ? scrollTop + nodeTop - containerTop : null;
|
|
85
|
-
return {
|
|
86
|
-
left: left,
|
|
87
|
-
top: top,
|
|
88
|
-
width: nodeWidth,
|
|
89
|
-
height: nodeHeight
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
|
-
_this.isVertical = function () {
|
|
93
|
-
return _this.props.direction !== 'horizontal';
|
|
94
|
-
};
|
|
95
|
-
_this.isHorizontal = function () {
|
|
96
|
-
return _this.props.direction !== 'vertical';
|
|
97
|
-
};
|
|
98
|
-
_this.containerRef = /*#__PURE__*/(0, _react.createRef)();
|
|
99
|
-
return _this;
|
|
100
|
-
}
|
|
101
|
-
_createClass(ScrollerBase, [{
|
|
102
|
-
key: "componentDidMount",
|
|
103
|
-
value: function componentDidMount() {
|
|
104
|
-
this.calculateMetrics();
|
|
105
|
-
}
|
|
106
|
-
}, {
|
|
107
|
-
key: "componentDidUpdate",
|
|
108
|
-
value: function componentDidUpdate(prevProps) {
|
|
109
|
-
this.calculateMetrics();
|
|
110
|
-
if (this.props.isVerticalScrollbarVisible && !prevProps.isVerticalScrollbarVisible) {
|
|
111
|
-
this.forceUpdate();
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}, {
|
|
115
|
-
key: "setScrollPosition",
|
|
116
|
-
value:
|
|
117
|
-
// for Scrollable
|
|
118
|
-
function setScrollPosition(x, y) {
|
|
119
|
-
var node = this.containerRef.current;
|
|
120
|
-
if (this.isVertical()) {
|
|
121
|
-
node.scrollTop = y;
|
|
122
|
-
this.scrollPos.top = y;
|
|
123
|
-
}
|
|
124
|
-
if (this.isHorizontal()) {
|
|
125
|
-
node.scrollLeft = this.getRtlPositionX(x);
|
|
126
|
-
this.scrollPos.left = x;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// for ScrollableNative
|
|
131
|
-
}, {
|
|
132
|
-
key: "scrollToPosition",
|
|
133
|
-
value: function scrollToPosition(x, y) {
|
|
134
|
-
this.containerRef.current.scrollTo(this.getRtlPositionX(x), y);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
// for ScrollableNative
|
|
138
|
-
}, {
|
|
139
|
-
key: "didScroll",
|
|
140
|
-
value: function didScroll(x, y) {
|
|
141
|
-
this.scrollPos.left = x;
|
|
142
|
-
this.scrollPos.top = y;
|
|
143
|
-
}
|
|
144
|
-
}, {
|
|
145
|
-
key: "calculateMetrics",
|
|
146
|
-
value: function calculateMetrics() {
|
|
147
|
-
var scrollBounds = this.scrollBounds,
|
|
148
|
-
_this$containerRef$cu3 = this.containerRef.current,
|
|
149
|
-
scrollWidth = _this$containerRef$cu3.scrollWidth,
|
|
150
|
-
scrollHeight = _this$containerRef$cu3.scrollHeight,
|
|
151
|
-
clientWidth = _this$containerRef$cu3.clientWidth,
|
|
152
|
-
clientHeight = _this$containerRef$cu3.clientHeight;
|
|
153
|
-
scrollBounds.scrollWidth = scrollWidth;
|
|
154
|
-
scrollBounds.scrollHeight = scrollHeight;
|
|
155
|
-
scrollBounds.clientWidth = clientWidth;
|
|
156
|
-
scrollBounds.clientHeight = clientHeight;
|
|
157
|
-
scrollBounds.maxLeft = Math.max(0, scrollWidth - clientWidth);
|
|
158
|
-
scrollBounds.maxTop = Math.max(0, scrollHeight - clientHeight);
|
|
159
|
-
}
|
|
160
|
-
}, {
|
|
161
|
-
key: "render",
|
|
162
|
-
value: function render() {
|
|
163
|
-
(0, _deprecate["default"])({
|
|
164
|
-
name: 'ui/Scroller.ScrollerBase',
|
|
165
|
-
until: '5.0.0'
|
|
166
|
-
});
|
|
167
|
-
var _this$props = this.props,
|
|
168
|
-
className = _this$props.className,
|
|
169
|
-
style = _this$props.style,
|
|
170
|
-
rest = _objectWithoutProperties(_this$props, _excluded),
|
|
171
|
-
mergedStyle = Object.assign({}, style, {
|
|
172
|
-
overflowX: this.isHorizontal() ? 'auto' : 'hidden',
|
|
173
|
-
overflowY: this.isVertical() ? 'auto' : 'hidden'
|
|
174
|
-
});
|
|
175
|
-
delete rest.cbScrollTo;
|
|
176
|
-
delete rest.direction;
|
|
177
|
-
delete rest.isHorizontalScrollbarVisible;
|
|
178
|
-
delete rest.isVerticalScrollbarVisible;
|
|
179
|
-
delete rest.rtl;
|
|
180
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", _objectSpread(_objectSpread({}, rest), {}, {
|
|
181
|
-
className: (0, _classnames["default"])(className, _UiScrollerModule["default"].scroller),
|
|
182
|
-
ref: this.containerRef,
|
|
183
|
-
style: mergedStyle
|
|
184
|
-
}));
|
|
185
|
-
}
|
|
186
|
-
}]);
|
|
187
|
-
return ScrollerBase;
|
|
188
|
-
}(_react.Component);
|
|
189
|
-
/**
|
|
190
|
-
* A callback function that receives a reference to the `scrollTo` feature.
|
|
191
|
-
*
|
|
192
|
-
* Once received, the `scrollTo` method can be called as an imperative interface.
|
|
193
|
-
*
|
|
194
|
-
* The `scrollTo` function accepts the following parameters:
|
|
195
|
-
* - {position: {x, y}} - Pixel value for x and/or y position
|
|
196
|
-
* - {align} - Where the scroll area should be aligned. Values are:
|
|
197
|
-
* `'left'`, `'right'`, `'top'`, `'bottom'`,
|
|
198
|
-
* `'topleft'`, `'topright'`, `'bottomleft'`, and `'bottomright'`.
|
|
199
|
-
* - {node} - Node to scroll into view
|
|
200
|
-
* - {animate} - When `true`, scroll occurs with animation. When `false`, no
|
|
201
|
-
* animation occurs.
|
|
202
|
-
* - {focus} - When `true`, attempts to focus item after scroll. Only valid when scrolling
|
|
203
|
-
* by `index` or `node`.
|
|
204
|
-
* > Note: Only specify one of: `position`, `align`, `index` or `node`
|
|
205
|
-
*
|
|
206
|
-
* Example:
|
|
207
|
-
* ```
|
|
208
|
-
* // If you set cbScrollTo prop like below;
|
|
209
|
-
* cbScrollTo: (fn) => {this.scrollTo = fn;}
|
|
210
|
-
* // You can simply call like below;
|
|
211
|
-
* this.scrollTo({align: 'top'}); // scroll to the top
|
|
212
|
-
* ```
|
|
213
|
-
*
|
|
214
|
-
* @name cbScrollTo
|
|
215
|
-
* @memberof ui/Scroller.ScrollerBase.prototype
|
|
216
|
-
* @type {Function}
|
|
217
|
-
* @public
|
|
218
|
-
*/
|
|
219
|
-
/**
|
|
220
|
-
* Specifies how to show horizontal scrollbar.
|
|
221
|
-
*
|
|
222
|
-
* Valid values are:
|
|
223
|
-
* * `'auto'`,
|
|
224
|
-
* * `'visible'`, and
|
|
225
|
-
* * `'hidden'`.
|
|
226
|
-
*
|
|
227
|
-
* @name horizontalScrollbar
|
|
228
|
-
* @memberof ui/Scroller.ScrollerBase.prototype
|
|
229
|
-
* @type {String}
|
|
230
|
-
* @default 'auto'
|
|
231
|
-
* @public
|
|
232
|
-
*/
|
|
233
|
-
/**
|
|
234
|
-
* Prevents scroll by wheeling on the scroller.
|
|
235
|
-
*
|
|
236
|
-
* @name noScrollByWheel
|
|
237
|
-
* @memberof ui/Scroller.ScrollerBase.prototype
|
|
238
|
-
* @type {Boolean}
|
|
239
|
-
* @default false
|
|
240
|
-
* @public
|
|
241
|
-
*/
|
|
242
|
-
/**
|
|
243
|
-
* Called when scrolling.
|
|
244
|
-
*
|
|
245
|
-
* Passes `scrollLeft` and `scrollTop`.
|
|
246
|
-
* It is not recommended to set this prop since it can cause performance degradation.
|
|
247
|
-
* Use `onScrollStart` or `onScrollStop` instead.
|
|
248
|
-
*
|
|
249
|
-
* @name onScroll
|
|
250
|
-
* @memberof ui/Scroller.ScrollerBase.prototype
|
|
251
|
-
* @type {Function}
|
|
252
|
-
* @param {Object} event
|
|
253
|
-
* @param {Number} event.scrollLeft Scroll left value.
|
|
254
|
-
* @param {Number} event.scrollTop Scroll top value.
|
|
255
|
-
* @param {Object} event.moreInfo The object including `firstVisibleIndex` and `lastVisibleIndex` properties.
|
|
256
|
-
* @public
|
|
257
|
-
*/
|
|
258
|
-
/**
|
|
259
|
-
* Called when scroll starts.
|
|
260
|
-
*
|
|
261
|
-
* Passes `scrollLeft` and `scrollTop`.
|
|
262
|
-
*
|
|
263
|
-
* Example:
|
|
264
|
-
* ```
|
|
265
|
-
* onScrollStart = ({scrollLeft, scrollTop}) => {
|
|
266
|
-
* // do something with scrollLeft and scrollTop
|
|
267
|
-
* }
|
|
268
|
-
*
|
|
269
|
-
* render = () => (
|
|
270
|
-
* <Scroller
|
|
271
|
-
* ...
|
|
272
|
-
* onScrollStart={this.onScrollStart}
|
|
273
|
-
* ...
|
|
274
|
-
* />
|
|
275
|
-
* )
|
|
276
|
-
* ```
|
|
277
|
-
*
|
|
278
|
-
* @name onScrollStart
|
|
279
|
-
* @memberof ui/Scroller.ScrollerBase.prototype
|
|
280
|
-
* @type {Function}
|
|
281
|
-
* @param {Object} event
|
|
282
|
-
* @param {Number} event.scrollLeft Scroll left value.
|
|
283
|
-
* @param {Number} event.scrollTop Scroll top value.
|
|
284
|
-
* @param {Object} event.moreInfo The object including `firstVisibleIndex` and `lastVisibleIndex` properties.
|
|
285
|
-
* @public
|
|
286
|
-
*/
|
|
287
|
-
/**
|
|
288
|
-
* Called when scroll stops.
|
|
289
|
-
*
|
|
290
|
-
* Passes `scrollLeft` and `scrollTop`.
|
|
291
|
-
*
|
|
292
|
-
* Example:
|
|
293
|
-
* ```
|
|
294
|
-
* onScrollStop = ({scrollLeft, scrollTop}) => {
|
|
295
|
-
* // do something with scrollLeft and scrollTop
|
|
296
|
-
* }
|
|
297
|
-
*
|
|
298
|
-
* render = () => (
|
|
299
|
-
* <Scroller
|
|
300
|
-
* ...
|
|
301
|
-
* onScrollStop={this.onScrollStop}
|
|
302
|
-
* ...
|
|
303
|
-
* />
|
|
304
|
-
* )
|
|
305
|
-
* ```
|
|
306
|
-
*
|
|
307
|
-
* @name onScrollStop
|
|
308
|
-
* @memberof ui/Scroller.ScrollerBase.prototype
|
|
309
|
-
* @type {Function}
|
|
310
|
-
* @param {Object} event
|
|
311
|
-
* @param {Number} event.scrollLeft Scroll left value.
|
|
312
|
-
* @param {Number} event.scrollTop Scroll top value.
|
|
313
|
-
* @param {Object} event.moreInfo The object including `firstVisibleIndex` and `lastVisibleIndex` properties.
|
|
314
|
-
* @public
|
|
315
|
-
*/
|
|
316
|
-
/**
|
|
317
|
-
* Specifies how to show vertical scrollbar.
|
|
318
|
-
*
|
|
319
|
-
* Valid values are:
|
|
320
|
-
* * `'auto'`,
|
|
321
|
-
* * `'visible'`, and
|
|
322
|
-
* * `'hidden'`.
|
|
323
|
-
*
|
|
324
|
-
* @name verticalScrollbar
|
|
325
|
-
* @memberof ui/Scroller.ScrollerBase.prototype
|
|
326
|
-
* @type {String}
|
|
327
|
-
* @default 'auto'
|
|
328
|
-
* @public
|
|
329
|
-
*/
|
|
330
|
-
ScrollerBase.displayName = 'ui:ScrollerBase';
|
|
331
|
-
ScrollerBase.propTypes = /** @lends ui/Scroller.ScrollerBase.prototype */{
|
|
332
|
-
children: _propTypes["default"].node.isRequired,
|
|
333
|
-
/**
|
|
334
|
-
* Callback method of scrollTo.
|
|
335
|
-
* Normally, `Scrollable` should set this value.
|
|
336
|
-
*
|
|
337
|
-
* @type {Function}
|
|
338
|
-
* @private
|
|
339
|
-
*/
|
|
340
|
-
cbScrollTo: _propTypes["default"].func,
|
|
341
|
-
/**
|
|
342
|
-
* Direction of the scroller.
|
|
343
|
-
*
|
|
344
|
-
* Valid values are:
|
|
345
|
-
* * `'both'`,
|
|
346
|
-
* * `'horizontal'`, and
|
|
347
|
-
* * `'vertical'`.
|
|
348
|
-
*
|
|
349
|
-
* @type {String}
|
|
350
|
-
* @default 'both'
|
|
351
|
-
* @public
|
|
352
|
-
*/
|
|
353
|
-
direction: _propTypes["default"].oneOf(['both', 'horizontal', 'vertical']),
|
|
354
|
-
/**
|
|
355
|
-
* Prop to check context value if Scrollbar exists or not.
|
|
356
|
-
*
|
|
357
|
-
* @type {Boolean}
|
|
358
|
-
* @private
|
|
359
|
-
*/
|
|
360
|
-
isVerticalScrollbarVisible: _propTypes["default"].bool,
|
|
361
|
-
/**
|
|
362
|
-
* `true` if RTL, `false` if LTR.
|
|
363
|
-
*
|
|
364
|
-
* @type {Boolean}
|
|
365
|
-
* @private
|
|
366
|
-
*/
|
|
367
|
-
rtl: _propTypes["default"].bool
|
|
368
|
-
};
|
|
369
|
-
ScrollerBase.defaultProps = {
|
|
370
|
-
direction: 'both'
|
|
371
|
-
};
|
|
372
|
-
var _default = exports["default"] = ScrollerBase;
|
package/SlotItem/SlotItem.d.ts
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
// Type definitions for ui/SlotItem
|
|
2
|
-
|
|
3
|
-
import { SlottableProps as ui_Slottable_SlottableProps } from "@enact/ui/Slottable";
|
|
4
|
-
import { ForwardRefProps as ui_ForwardRef_ForwardRefProps } from "@enact/ui/ForwardRef";
|
|
5
|
-
import * as React from "react";
|
|
6
|
-
|
|
7
|
-
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
8
|
-
type Merge<M, N> = Omit<M, Extract<keyof M, keyof N>> & N;
|
|
9
|
-
|
|
10
|
-
export interface SlotItemBaseProps {
|
|
11
|
-
/**
|
|
12
|
-
* The type of component to use to render the item.
|
|
13
|
-
*
|
|
14
|
-
* This component will receive the `inline` prop and any additional unhandled props provided
|
|
15
|
-
to `SlotItem` . A derivative of is recommended.
|
|
16
|
-
*/
|
|
17
|
-
component: React.ComponentType;
|
|
18
|
-
/**
|
|
19
|
-
* Controls the visibility state of the slots.
|
|
20
|
-
*
|
|
21
|
-
* One, both, or neither slot can be shown. Choosing `'after'` will leave `slotBefore`
|
|
22
|
-
visible at all times; only `slotAfter` will have its visibility toggled. Valid values
|
|
23
|
-
are `'before'` , `'after'` and `'both'` . Omitting the property will result in
|
|
24
|
-
no-auto-hiding for either slot so they will both be present.
|
|
25
|
-
*
|
|
26
|
-
* In order for `autoHide` to have a visual affect, the `hidden` class must be tied to
|
|
27
|
-
another condition such as focus.
|
|
28
|
-
* ```
|
|
29
|
-
.slot.hidden:not(:focus) {
|
|
30
|
-
display: none;
|
|
31
|
-
}
|
|
32
|
-
```
|
|
33
|
-
*/
|
|
34
|
-
autoHide?: boolean;
|
|
35
|
-
/**
|
|
36
|
-
* Called with a reference to the root component.
|
|
37
|
-
*
|
|
38
|
-
* When using , the `ref` prop is forwarded to this component
|
|
39
|
-
as `componentRef` .
|
|
40
|
-
*/
|
|
41
|
-
componentRef?: object | Function;
|
|
42
|
-
/**
|
|
43
|
-
* Customizes the component by mapping the supplied collection of CSS class names to the
|
|
44
|
-
corresponding internal elements and states of this component.
|
|
45
|
-
*
|
|
46
|
-
* The following classes are supported:
|
|
47
|
-
* * `slotItem` - The root class name
|
|
48
|
-
* * `slot` - Applied to both slots
|
|
49
|
-
* * `after` - Applied to the slot that falls after the content
|
|
50
|
-
* * `before` - Applied to the slot that falls before the content
|
|
51
|
-
* * `hidden` - Applied to a slot when that slot is supposed to be hidden, according to
|
|
52
|
-
`autoHide` prop
|
|
53
|
-
*/
|
|
54
|
-
css?: object;
|
|
55
|
-
/**
|
|
56
|
-
* Applies inline styling to the component.
|
|
57
|
-
*/
|
|
58
|
-
inline?: boolean;
|
|
59
|
-
/**
|
|
60
|
-
* The layout technique for `SlotItem` .
|
|
61
|
-
*
|
|
62
|
-
* `"flex"` is applied as a default and gives basic flex support to the wrapping elements.
|
|
63
|
-
This may be set to `null` to define your own layout method.
|
|
64
|
-
*/
|
|
65
|
-
layout?: string;
|
|
66
|
-
/**
|
|
67
|
-
* Nodes to be inserted after `children` and hidden using `autoHide` .
|
|
68
|
-
*
|
|
69
|
-
* If nothing is specified, nothing, not even an empty container, is rendered in this place.
|
|
70
|
-
*/
|
|
71
|
-
slotAfter?: React.ReactNode;
|
|
72
|
-
/**
|
|
73
|
-
* Nodes to be inserted before `children` and hidden using `autoHide` .
|
|
74
|
-
*
|
|
75
|
-
* If nothing is specified, nothing, not even an empty container, is rendered in this place.
|
|
76
|
-
*/
|
|
77
|
-
slotBefore?: React.ReactNode;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* A ui-styled `SlotItem` without any behavior.
|
|
81
|
-
*/
|
|
82
|
-
|
|
83
|
-
export class SlotItemBase extends React.Component<
|
|
84
|
-
Merge<React.HTMLProps<HTMLElement>, SlotItemBaseProps>
|
|
85
|
-
> {}
|
|
86
|
-
|
|
87
|
-
export interface SlotItemDecoratorProps
|
|
88
|
-
extends Merge<ui_Slottable_SlottableProps, ui_ForwardRef_ForwardRefProps> {}
|
|
89
|
-
export function SlotItemDecorator<P>(
|
|
90
|
-
Component: React.ComponentType<P> | string,
|
|
91
|
-
): React.ComponentType<P & SlotItemDecoratorProps>;
|
|
92
|
-
|
|
93
|
-
export interface SlotItemProps
|
|
94
|
-
extends Omit<
|
|
95
|
-
Merge<SlotItemBaseProps, SlotItemDecoratorProps>,
|
|
96
|
-
"componentRef"
|
|
97
|
-
> {}
|
|
98
|
-
/**
|
|
99
|
-
* A ui-styled item with built-in support for slots.
|
|
100
|
-
*
|
|
101
|
-
* Example:
|
|
102
|
-
* ```
|
|
103
|
-
<SlotItem component={Item} autoHide="both">
|
|
104
|
-
<slotBefore>
|
|
105
|
-
<Icon>flag</Icon>
|
|
106
|
-
<Icon>star</Icon>
|
|
107
|
-
</slotBefore>
|
|
108
|
-
An Item that will show some icons slotBefore and slotAfter this text when spotted
|
|
109
|
-
<Icon slot="slotAfter">trash</Icon>
|
|
110
|
-
</SlotItem>
|
|
111
|
-
```
|
|
112
|
-
*/
|
|
113
|
-
|
|
114
|
-
export class SlotItem extends React.Component<
|
|
115
|
-
Merge<React.HTMLProps<HTMLElement>, SlotItemProps>
|
|
116
|
-
> {}
|
|
117
|
-
|
|
118
|
-
export default SlotItem;
|