@enact/ui 4.5.1 → 4.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AnnounceDecorator/Announce.js +1 -40
- package/AnnounceDecorator/AnnounceDecorator.js +3 -21
- package/AnnounceDecorator/tests/Announce-specs.js +2 -7
- package/AnnounceDecorator/tests/AnnounceDecorator-specs.js +2 -6
- package/AnnounceDecorator/tests/useAnnounce-specs.js +8 -19
- package/AnnounceDecorator/useAnnounce.js +0 -6
- package/BodyText/BodyText.d.ts +1 -1
- package/BodyText/BodyText.js +8 -28
- package/BodyText/tests/BodyText-specs.js +0 -19
- package/Button/Button.d.ts +6 -6
- package/Button/Button.js +33 -63
- package/Button/tests/Button-specs.js +0 -26
- package/CHANGELOG.md +36 -0
- package/Cancelable/Cancelable.js +8 -47
- package/Cancelable/cancelHandler.js +5 -12
- package/Cancelable/modalHandler.js +3 -11
- package/Cancelable/tests/Cancelable-specs.js +3 -57
- package/Changeable/Changeable.js +2 -34
- package/Changeable/tests/Changeable-specs.js +20 -66
- package/ComponentOverride/ComponentOverride.js +1 -13
- package/FloatingLayer/FloatingLayer.js +17 -73
- package/FloatingLayer/FloatingLayerContainer.js +0 -15
- package/FloatingLayer/FloatingLayerDecorator.js +4 -17
- package/FloatingLayer/Scrim.js +9 -53
- package/FloatingLayer/index.js +0 -4
- package/FloatingLayer/tests/FloatingLayer-specs.js +8 -22
- package/FloatingLayer/tests/Scrim-specs.js +0 -9
- package/FloatingLayer/tests/useFloatingLayerDecorator-specs.js +0 -13
- package/FloatingLayer/useFloatingLayer.js +3 -14
- package/FloatingLayer/useFloatingLayerDecorator.js +3 -11
- package/ForwardRef/ForwardRef.js +1 -10
- package/GridListImageItem/GridListImageItem.d.ts +1 -1
- package/GridListImageItem/GridListImageItem.js +18 -51
- package/Group/Group.js +5 -36
- package/Group/GroupItem.js +16 -33
- package/Group/tests/Group-specs.js +0 -32
- package/Heading/Heading.js +8 -36
- package/Heading/tests/Heading-specs.js +81 -14
- package/Icon/Icon.d.ts +4 -4
- package/Icon/Icon.js +19 -53
- package/Icon/tests/Icon-specs.js +0 -22
- package/IconButton/IconButton.d.ts +4 -4
- package/IconButton/IconButton.js +17 -55
- package/IconButton/tests/IconButton-specs.js +0 -7
- package/Image/Image.js +17 -46
- package/Image/tests/Image-specs.js +0 -14
- package/ImageItem/ImageItem.js +18 -47
- package/ImageItem/tests/ImageItem-specs.js +0 -25
- package/Item/Item.js +9 -33
- package/Item/tests/Item-specs.js +0 -24
- package/LabeledIcon/LabeledIcon.d.ts +2 -2
- package/LabeledIcon/LabeledIcon.js +22 -53
- package/LabeledIcon/tests/LabeledIcon-specs.js +0 -14
- package/Layout/Cell.js +18 -44
- package/Layout/Layout.d.ts +16 -16
- package/Layout/Layout.js +23 -46
- package/Layout/tests/Layout-specs.js +10 -39
- package/Marquee/MarqueeBase.js +31 -64
- package/Marquee/MarqueeController.js +11 -72
- package/Marquee/MarqueeDecorator.js +70 -196
- package/Marquee/index.js +1 -5
- package/Marquee/tests/Marquee-specs.js +295 -87
- package/Measurable/Measurable.js +12 -34
- package/Measurable/tests/Measurable-specs.js +115 -0
- package/Media/Media.js +15 -65
- package/Media/tests/Media-specs.js +168 -0
- package/Placeholder/PlaceholderControllerDecorator.js +7 -43
- package/Placeholder/PlaceholderDecorator.js +7 -38
- package/Placeholder/index.js +1 -5
- package/Placeholder/tests/PlaceholderControllerDecorator-specs.js +25 -0
- package/Placeholder/tests/PlaceholderDecorator-specs.js +28 -0
- package/ProgressBar/ProgressBar.js +14 -45
- package/ProgressBar/tests/ProgressBar-specs.js +0 -17
- package/RadioDecorator/RadioControllerDecorator.js +1 -29
- package/RadioDecorator/RadioDecorator.js +4 -42
- package/RadioDecorator/tests/RadioDecorator-specs.js +12 -49
- package/Repeater/Repeater.js +9 -33
- package/Repeater/tests/Repeater-specs.js +0 -38
- package/Resizable/Resizable.js +9 -37
- package/Resizable/tests/Resizable-specs.js +34 -0
- package/Routable/Link.js +11 -47
- package/Routable/Routable.d.ts +2 -2
- package/Routable/Routable.js +12 -35
- package/Routable/Route.js +0 -6
- package/Routable/Router.js +15 -58
- package/Routable/tests/Routable-specs.js +7 -33
- package/Routable/tests/Router-specs.js +18 -44
- package/Routable/useLink.js +4 -8
- package/Routable/util.js +18 -24
- package/Scrollable/ScrollAnimator.js +49 -65
- package/Scrollable/ScrollThumb.js +2 -13
- package/Scrollable/Scrollable.js +180 -387
- package/Scrollable/ScrollableNative.js +189 -392
- package/Scrollable/Scrollbar.js +30 -102
- package/Scroller/Scroller.js +15 -39
- package/Scroller/ScrollerBasic.js +34 -89
- package/Scroller/UiScrollerBase.js +31 -84
- package/Scroller/tests/Scroller-specs.js +56 -0
- package/Skinnable/Skinnable.js +11 -38
- package/Skinnable/tests/Skinnable-specs.js +3 -74
- package/Skinnable/tests/useSkins-specs.js +1 -13
- package/Skinnable/tests/util-specs.js +0 -14
- package/Skinnable/useSkins.js +8 -15
- package/Skinnable/util.js +9 -20
- package/Slider/Knob.js +5 -24
- package/Slider/PositionDecorator.js +16 -54
- package/Slider/Slider.d.ts +2 -2
- package/Slider/Slider.js +29 -67
- package/Slider/tests/Slider-specs.js +94 -7
- package/Slider/utils.js +0 -2
- package/SlotItem/SlotItem.d.ts +1 -1
- package/SlotItem/SlotItem.js +17 -43
- package/SlotItem/tests/SlotItem-specs.js +0 -5
- package/Slottable/Slottable.js +4 -12
- package/Slottable/tests/Slottable-specs.js +19 -46
- package/Slottable/tests/useSlots-specs.js +27 -65
- package/Slottable/useSlots.js +8 -33
- package/Spinner/Spinner.d.ts +1 -1
- package/Spinner/Spinner.js +16 -43
- package/Spinner/tests/Spinner-specs.js +0 -15
- package/ToggleIcon/ToggleIcon.js +10 -36
- package/ToggleIcon/tests/ToggleIcon-specs.js +0 -16
- package/ToggleItem/ToggleItem.d.ts +3 -3
- package/ToggleItem/ToggleItem.js +18 -55
- package/ToggleItem/tests/ToggleItem-specs.js +0 -30
- package/Toggleable/Toggle.js +1 -15
- package/Toggleable/Toggleable.js +12 -45
- package/Toggleable/tests/Toggleable-specs.js +28 -96
- package/Toggleable/useToggle.js +3 -19
- package/Touchable/ClickAllow.js +5 -14
- package/Touchable/Drag.js +16 -54
- package/Touchable/Flick.js +11 -42
- package/Touchable/Hold.js +21 -68
- package/Touchable/Touch.js +37 -65
- package/Touchable/Touchable.js +32 -71
- package/Touchable/config.js +8 -22
- package/Touchable/tests/Touchable-specs.js +270 -119
- package/Touchable/tests/useTouch-specs.js +6 -80
- package/Touchable/useTouch.js +17 -34
- package/Transition/Transition.js +37 -118
- package/Transition/tests/Transition-specs.js +20 -60
- package/ViewManager/Arranger.js +10 -22
- package/ViewManager/TransitionGroup.js +32 -107
- package/ViewManager/View.js +35 -91
- package/ViewManager/ViewManager.d.ts +1 -1
- package/ViewManager/ViewManager.js +20 -84
- package/ViewManager/tests/View-specs.js +0 -17
- package/ViewManager/tests/ViewManager-specs.js +236 -305
- package/ViewManager/tests/test-utils.js +0 -8
- package/VirtualList/UiVirtualListBase.js +259 -409
- package/VirtualList/VirtualList.d.ts +4 -4
- package/VirtualList/VirtualList.js +29 -69
- package/VirtualList/VirtualListBase.js +0 -3
- package/VirtualList/VirtualListBasic.js +273 -431
- package/VirtualList/tests/VirtualGridList-native-specs.js +161 -0
- package/VirtualList/tests/VirtualGridList-specs.js +614 -0
- package/VirtualList/tests/VirtualList-native-specs.js +152 -0
- package/VirtualList/tests/VirtualList-specs.js +423 -95
- package/internal/IdProvider/IdProvider.js +7 -21
- package/internal/IdProvider/Provider.js +4 -17
- package/internal/IdProvider/tests/IdProvider-specs.js +44 -0
- package/internal/IdProvider/tests/useId-specs.js +6 -20
- package/internal/IdProvider/useId.js +0 -6
- package/internal/Pure/Pure.js +3 -30
- package/internal/Pure/tests/Pure-specs.js +88 -0
- package/internal/localized-fonts/localized-fonts.js +33 -62
- package/internal/localized-fonts/tests/localized-fonts-specs.js +33 -0
- package/internal/selection/selection.js +1 -6
- package/internal/selection/tests/selection-specs.js +6 -4
- package/internal/validators/tests/validators-specs.js +80 -0
- package/internal/validators/validators.js +14 -34
- package/package.json +9 -3
- package/resolution/ResolutionDecorator.js +4 -40
- package/resolution/index.js +0 -7
- package/resolution/resolution.js +42 -80
- package/resolution/tests/ResolutionDecorator-specs.js +4 -11
- package/resolution/tests/resolution-specs.js +2 -2
- package/useControlledState/tests/useControlledState-specs.js +15 -46
- package/useControlledState/useControlledState.js +11 -22
- package/useScroll/ScrollAnimator.js +49 -65
- package/useScroll/Scrollbar.js +22 -58
- package/useScroll/ScrollbarTrack.js +3 -19
- package/useScroll/useScroll.js +267 -454
- package/useScroll/utilDOM.js +8 -14
- package/useScroll/utilEvent.js +0 -4
package/Scrollable/Scrollbar.js
CHANGED
|
@@ -10,63 +10,36 @@ Object.defineProperty(exports, "ScrollThumb", {
|
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
exports["default"] = exports.ScrollbarBase = exports.Scrollbar = void 0;
|
|
13
|
-
|
|
14
13
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
|
-
|
|
16
14
|
var _util = require("@enact/core/util");
|
|
17
|
-
|
|
18
15
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
19
|
-
|
|
20
16
|
var _react = require("react");
|
|
21
|
-
|
|
22
17
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
23
|
-
|
|
24
18
|
var _resolution = _interopRequireDefault(require("../resolution"));
|
|
25
|
-
|
|
26
19
|
var _ScrollThumb = _interopRequireDefault(require("./ScrollThumb"));
|
|
27
|
-
|
|
28
20
|
var _ScrollbarModule = _interopRequireDefault(require("./Scrollbar.module.css"));
|
|
29
|
-
|
|
30
21
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
31
|
-
|
|
32
22
|
var _excluded = ["childRenderer", "className", "corner", "css", "vertical"];
|
|
33
|
-
|
|
34
23
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
35
|
-
|
|
36
24
|
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; }
|
|
37
|
-
|
|
38
25
|
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; }
|
|
39
|
-
|
|
40
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; }
|
|
41
|
-
|
|
42
27
|
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
|
-
|
|
44
28
|
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
|
-
|
|
46
29
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
47
|
-
|
|
48
30
|
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); } }
|
|
49
|
-
|
|
50
31
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
51
|
-
|
|
52
32
|
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); }
|
|
53
|
-
|
|
54
33
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
55
|
-
|
|
56
34
|
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); }; }
|
|
57
|
-
|
|
58
35
|
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); }
|
|
59
|
-
|
|
60
36
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
61
|
-
|
|
62
37
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
63
|
-
|
|
64
38
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
65
|
-
|
|
66
39
|
var minThumbSize = 18,
|
|
67
|
-
|
|
68
|
-
nop = function nop() {},
|
|
69
|
-
|
|
40
|
+
// Size in pixels
|
|
41
|
+
nop = function nop() {},
|
|
42
|
+
thumbHidingDelay = 400; // in milliseconds
|
|
70
43
|
|
|
71
44
|
/*
|
|
72
45
|
* Set CSS Varaible value.
|
|
@@ -76,94 +49,72 @@ nop = function nop() {},
|
|
|
76
49
|
* @param {String} variable - CSS Variable property.
|
|
77
50
|
* @param {String} value - CSS Variable value.
|
|
78
51
|
*/
|
|
79
|
-
|
|
80
|
-
|
|
81
52
|
var setCSSVariable = function setCSSVariable(element, variable, value) {
|
|
82
53
|
_reactDom["default"].findDOMNode(element).style.setProperty(variable, value); // eslint-disable-line react/no-find-dom-node
|
|
83
|
-
|
|
84
54
|
};
|
|
55
|
+
|
|
85
56
|
/**
|
|
86
|
-
* An unstyled base component for a scroll bar. It is used in
|
|
57
|
+
* An unstyled base component for a scroll bar. It is used in {@link ui/Scrollable.Scrollable|Scrollable}.
|
|
87
58
|
*
|
|
88
59
|
* @class ScrollbarBase
|
|
89
60
|
* @memberof ui/Scrollable
|
|
90
61
|
* @ui
|
|
91
62
|
* @private
|
|
92
63
|
*/
|
|
93
|
-
|
|
94
|
-
|
|
95
64
|
var ScrollbarBase = /*#__PURE__*/function (_PureComponent) {
|
|
96
65
|
_inherits(ScrollbarBase, _PureComponent);
|
|
97
|
-
|
|
98
66
|
var _super = _createSuper(ScrollbarBase);
|
|
99
|
-
|
|
100
67
|
function ScrollbarBase(props) {
|
|
101
68
|
var _this;
|
|
102
|
-
|
|
103
69
|
_classCallCheck(this, ScrollbarBase);
|
|
104
|
-
|
|
105
70
|
_this = _super.call(this, props);
|
|
106
71
|
_this.minThumbSizeRatio = 0;
|
|
107
72
|
_this.ignoreMode = false;
|
|
108
|
-
|
|
109
73
|
_this.update = function (bounds) {
|
|
110
74
|
var vertical = _this.props.vertical,
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
75
|
+
clientWidth = bounds.clientWidth,
|
|
76
|
+
clientHeight = bounds.clientHeight,
|
|
77
|
+
scrollWidth = bounds.scrollWidth,
|
|
78
|
+
scrollHeight = bounds.scrollHeight,
|
|
79
|
+
scrollLeft = bounds.scrollLeft,
|
|
80
|
+
scrollTop = bounds.scrollTop,
|
|
81
|
+
clientSize = vertical ? clientHeight : clientWidth,
|
|
82
|
+
scrollSize = vertical ? scrollHeight : scrollWidth,
|
|
83
|
+
scrollOrigin = vertical ? scrollTop : scrollLeft,
|
|
84
|
+
thumbSizeRatioBase = clientSize / scrollSize,
|
|
85
|
+
scrollThumbPositionRatio = scrollOrigin / (scrollSize - clientSize),
|
|
86
|
+
scrollThumbSizeRatio = Math.max(_this.minThumbSizeRatio, Math.min(1, thumbSizeRatioBase));
|
|
123
87
|
setCSSVariable(_this.thumbRef.current, '--scrollbar-size-ratio', scrollThumbSizeRatio);
|
|
124
88
|
setCSSVariable(_this.thumbRef.current, '--scrollbar-progress-ratio', scrollThumbPositionRatio);
|
|
125
89
|
};
|
|
126
|
-
|
|
127
90
|
_this.showThumb = function () {
|
|
128
91
|
_this.hideThumbJob.stop();
|
|
129
|
-
|
|
130
92
|
_reactDom["default"].findDOMNode(_this.thumbRef.current).classList.add(_this.props.css.thumbShown); // eslint-disable-line react/no-find-dom-node
|
|
131
|
-
|
|
132
93
|
};
|
|
133
|
-
|
|
134
94
|
_this.startHidingThumb = function () {
|
|
135
95
|
_this.hideThumbJob.start();
|
|
136
96
|
};
|
|
137
|
-
|
|
138
97
|
_this.hideThumb = function () {
|
|
139
98
|
_reactDom["default"].findDOMNode(_this.thumbRef.current).classList.remove(_this.props.css.thumbShown); // eslint-disable-line react/no-find-dom-node
|
|
140
|
-
|
|
141
99
|
};
|
|
142
|
-
|
|
143
100
|
_this.hideThumbJob = new _util.Job(_this.hideThumb.bind(_assertThisInitialized(_this)), thumbHidingDelay);
|
|
144
|
-
|
|
145
101
|
_this.calculateMetrics = function () {
|
|
146
102
|
var primaryDimenstion = _this.props.vertical ? 'clientHeight' : 'clientWidth';
|
|
147
103
|
var trackSize;
|
|
148
|
-
|
|
149
104
|
if (_this.props.clientSize) {
|
|
150
105
|
trackSize = _this.props.clientSize[primaryDimenstion];
|
|
151
106
|
} else {
|
|
152
107
|
trackSize = _this.containerRef.current[primaryDimenstion];
|
|
153
108
|
}
|
|
154
|
-
|
|
155
109
|
_this.minThumbSizeRatio = _resolution["default"].scale(minThumbSize) / trackSize;
|
|
156
110
|
};
|
|
157
|
-
|
|
158
111
|
_this.getContainerRef = function () {
|
|
159
112
|
return _this.containerRef;
|
|
160
113
|
};
|
|
161
|
-
|
|
162
114
|
_this.containerRef = /*#__PURE__*/(0, _react.createRef)();
|
|
163
115
|
_this.thumbRef = /*#__PURE__*/(0, _react.createRef)();
|
|
164
116
|
return _this;
|
|
165
117
|
}
|
|
166
|
-
|
|
167
118
|
_createClass(ScrollbarBase, [{
|
|
168
119
|
key: "componentDidMount",
|
|
169
120
|
value: function componentDidMount() {
|
|
@@ -183,14 +134,13 @@ var ScrollbarBase = /*#__PURE__*/function (_PureComponent) {
|
|
|
183
134
|
key: "render",
|
|
184
135
|
value: function render() {
|
|
185
136
|
var _this$props = this.props,
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
137
|
+
childRenderer = _this$props.childRenderer,
|
|
138
|
+
className = _this$props.className,
|
|
139
|
+
corner = _this$props.corner,
|
|
140
|
+
css = _this$props.css,
|
|
141
|
+
vertical = _this$props.vertical,
|
|
142
|
+
rest = _objectWithoutProperties(_this$props, _excluded),
|
|
143
|
+
containerClassName = (0, _classnames["default"])(className, css.scrollbar, corner ? css.corner : null, vertical ? css.vertical : css.horizontal);
|
|
194
144
|
delete rest.clientSize;
|
|
195
145
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", _objectSpread(_objectSpread({}, rest), {}, {
|
|
196
146
|
className: containerClassName,
|
|
@@ -202,24 +152,19 @@ var ScrollbarBase = /*#__PURE__*/function (_PureComponent) {
|
|
|
202
152
|
}));
|
|
203
153
|
}
|
|
204
154
|
}]);
|
|
205
|
-
|
|
206
155
|
return ScrollbarBase;
|
|
207
156
|
}(_react.PureComponent);
|
|
208
157
|
/**
|
|
209
|
-
* An unstyled scroll bar. It is used in
|
|
158
|
+
* An unstyled scroll bar. It is used in {@link ui/Scrollable.Scrollable|Scrollable}.
|
|
210
159
|
*
|
|
211
160
|
* @class Scrollbar
|
|
212
161
|
* @memberof ui/Scrollable
|
|
213
162
|
* @ui
|
|
214
163
|
* @private
|
|
215
164
|
*/
|
|
216
|
-
|
|
217
|
-
|
|
218
165
|
exports.ScrollbarBase = ScrollbarBase;
|
|
219
166
|
ScrollbarBase.displayName = 'ui:Scrollbar';
|
|
220
|
-
ScrollbarBase.propTypes =
|
|
221
|
-
/** @lends ui/Scrollable.Scrollbar.prototype */
|
|
222
|
-
{
|
|
167
|
+
ScrollbarBase.propTypes = /** @lends ui/Scrollable.Scrollbar.prototype */{
|
|
223
168
|
/**
|
|
224
169
|
* The render function for child.
|
|
225
170
|
*
|
|
@@ -228,7 +173,6 @@ ScrollbarBase.propTypes =
|
|
|
228
173
|
* @private
|
|
229
174
|
*/
|
|
230
175
|
childRenderer: _propTypes["default"].func.isRequired,
|
|
231
|
-
|
|
232
176
|
/**
|
|
233
177
|
* Client size of the container; valid values are an object that has `clientWidth` and `clientHeight`.
|
|
234
178
|
*
|
|
@@ -241,7 +185,6 @@ ScrollbarBase.propTypes =
|
|
|
241
185
|
clientHeight: _propTypes["default"].number.isRequired,
|
|
242
186
|
clientWidth: _propTypes["default"].number.isRequired
|
|
243
187
|
}),
|
|
244
|
-
|
|
245
188
|
/**
|
|
246
189
|
* If `true`, add the corner between vertical and horizontal scrollbars.
|
|
247
190
|
*
|
|
@@ -250,7 +193,6 @@ ScrollbarBase.propTypes =
|
|
|
250
193
|
* @public
|
|
251
194
|
*/
|
|
252
195
|
corner: _propTypes["default"].bool,
|
|
253
|
-
|
|
254
196
|
/**
|
|
255
197
|
* Customizes the component by mapping the supplied collection of CSS class names to the
|
|
256
198
|
* corresponding internal Elements and states of this component.
|
|
@@ -263,7 +205,6 @@ ScrollbarBase.propTypes =
|
|
|
263
205
|
* @public
|
|
264
206
|
*/
|
|
265
207
|
css: _propTypes["default"].object,
|
|
266
|
-
|
|
267
208
|
/**
|
|
268
209
|
* If `true`, the scrollbar will be oriented vertically.
|
|
269
210
|
*
|
|
@@ -280,39 +221,30 @@ ScrollbarBase.defaultProps = {
|
|
|
280
221
|
css: _ScrollbarModule["default"],
|
|
281
222
|
vertical: true
|
|
282
223
|
};
|
|
283
|
-
|
|
284
224
|
var Scrollbar = /*#__PURE__*/function (_Component) {
|
|
285
225
|
_inherits(Scrollbar, _Component);
|
|
286
|
-
|
|
287
226
|
var _super2 = _createSuper(Scrollbar);
|
|
288
|
-
|
|
289
227
|
function Scrollbar() {
|
|
290
228
|
var _this2;
|
|
291
|
-
|
|
292
229
|
_classCallCheck(this, Scrollbar);
|
|
293
|
-
|
|
294
230
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
295
231
|
args[_key] = arguments[_key];
|
|
296
232
|
}
|
|
297
|
-
|
|
298
233
|
_this2 = _super2.call.apply(_super2, [this].concat(args));
|
|
299
|
-
|
|
300
234
|
_this2.setApi = function (ref) {
|
|
301
235
|
if (ref) {
|
|
302
236
|
var getContainerRef = ref.getContainerRef,
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
237
|
+
showThumb = ref.showThumb,
|
|
238
|
+
startHidingThumb = ref.startHidingThumb,
|
|
239
|
+
uiUpdate = ref.update;
|
|
306
240
|
_this2.getContainerRef = getContainerRef;
|
|
307
241
|
_this2.showThumb = showThumb;
|
|
308
242
|
_this2.startHidingThumb = startHidingThumb;
|
|
309
243
|
_this2.update = uiUpdate;
|
|
310
244
|
}
|
|
311
245
|
};
|
|
312
|
-
|
|
313
246
|
return _this2;
|
|
314
247
|
}
|
|
315
|
-
|
|
316
248
|
_createClass(Scrollbar, [{
|
|
317
249
|
key: "render",
|
|
318
250
|
value: function render() {
|
|
@@ -330,14 +262,10 @@ var Scrollbar = /*#__PURE__*/function (_Component) {
|
|
|
330
262
|
}));
|
|
331
263
|
}
|
|
332
264
|
}]);
|
|
333
|
-
|
|
334
265
|
return Scrollbar;
|
|
335
266
|
}(_react.Component);
|
|
336
|
-
|
|
337
267
|
exports.Scrollbar = Scrollbar;
|
|
338
|
-
Scrollbar.propTypes =
|
|
339
|
-
/** @lends ui/Scrollable.Scrollbar.prototype */
|
|
340
|
-
{
|
|
268
|
+
Scrollbar.propTypes = /** @lends ui/Scrollable.Scrollbar.prototype */{
|
|
341
269
|
/**
|
|
342
270
|
* If `true`, the scrollbar will be oriented vertically.
|
|
343
271
|
*
|
package/Scroller/Scroller.js
CHANGED
|
@@ -17,30 +17,19 @@ Object.defineProperty(exports, "ScrollerBasic", {
|
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
exports["default"] = void 0;
|
|
20
|
-
|
|
21
20
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
22
|
-
|
|
23
21
|
var _Resizable = require("../Resizable");
|
|
24
|
-
|
|
25
22
|
var _useScroll2 = _interopRequireDefault(require("../useScroll"));
|
|
26
|
-
|
|
27
23
|
var _Scrollbar = _interopRequireDefault(require("../useScroll/Scrollbar"));
|
|
28
|
-
|
|
29
24
|
var _ScrollerBasic = _interopRequireDefault(require("./ScrollerBasic"));
|
|
30
|
-
|
|
31
25
|
var _UiScrollerBase = _interopRequireDefault(require("./UiScrollerBase"));
|
|
32
|
-
|
|
33
26
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
34
|
-
|
|
35
27
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
36
|
-
|
|
37
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; }
|
|
38
|
-
|
|
39
29
|
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; }
|
|
40
|
-
|
|
41
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; }
|
|
42
|
-
|
|
43
31
|
var nop = function nop() {};
|
|
32
|
+
|
|
44
33
|
/**
|
|
45
34
|
* An unstyled scroller.
|
|
46
35
|
*
|
|
@@ -55,23 +44,23 @@ var nop = function nop() {};
|
|
|
55
44
|
* @ui
|
|
56
45
|
* @public
|
|
57
46
|
*/
|
|
58
|
-
|
|
59
|
-
|
|
60
47
|
var Scroller = function Scroller(props) {
|
|
61
48
|
// Hooks
|
|
49
|
+
|
|
62
50
|
var _useScroll = (0, _useScroll2["default"])(props),
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
51
|
+
scrollContentHandle = _useScroll.scrollContentHandle,
|
|
52
|
+
ScrollContentWrapper = _useScroll.scrollContentWrapper,
|
|
53
|
+
isHorizontalScrollbarVisible = _useScroll.isHorizontalScrollbarVisible,
|
|
54
|
+
isVerticalScrollbarVisible = _useScroll.isVerticalScrollbarVisible,
|
|
55
|
+
resizeContextProps = _useScroll.resizeContextProps,
|
|
56
|
+
scrollContainerProps = _useScroll.scrollContainerProps,
|
|
57
|
+
scrollInnerContainerProps = _useScroll.scrollInnerContainerProps,
|
|
58
|
+
scrollContentWrapperProps = _useScroll.scrollContentWrapperProps,
|
|
59
|
+
scrollContentProps = _useScroll.scrollContentProps,
|
|
60
|
+
verticalScrollbarProps = _useScroll.verticalScrollbarProps,
|
|
61
|
+
horizontalScrollbarProps = _useScroll.horizontalScrollbarProps;
|
|
74
62
|
|
|
63
|
+
// Return
|
|
75
64
|
|
|
76
65
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Resizable.ResizeContext.Provider, _objectSpread(_objectSpread({}, resizeContextProps), {}, {
|
|
77
66
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", _objectSpread(_objectSpread({}, scrollContainerProps), {}, {
|
|
@@ -85,12 +74,9 @@ var Scroller = function Scroller(props) {
|
|
|
85
74
|
}))
|
|
86
75
|
}));
|
|
87
76
|
};
|
|
88
|
-
|
|
89
77
|
exports.Scroller = Scroller;
|
|
90
78
|
Scroller.displayName = 'ui:Scroller';
|
|
91
|
-
Scroller.propTypes =
|
|
92
|
-
/** @lends ui/Scroller.Scroller.prototype */
|
|
93
|
-
{
|
|
79
|
+
Scroller.propTypes = /** @lends ui/Scroller.Scroller.prototype */{
|
|
94
80
|
/**
|
|
95
81
|
* A callback function that receives a reference to the `scrollTo` feature.
|
|
96
82
|
*
|
|
@@ -119,7 +105,6 @@ Scroller.propTypes =
|
|
|
119
105
|
* @public
|
|
120
106
|
*/
|
|
121
107
|
cbScrollTo: _propTypes["default"].func,
|
|
122
|
-
|
|
123
108
|
/**
|
|
124
109
|
* Direction of the scroller.
|
|
125
110
|
*
|
|
@@ -133,7 +118,6 @@ Scroller.propTypes =
|
|
|
133
118
|
* @public
|
|
134
119
|
*/
|
|
135
120
|
direction: _propTypes["default"].string,
|
|
136
|
-
|
|
137
121
|
/**
|
|
138
122
|
* Specifies how to show horizontal scrollbar.
|
|
139
123
|
*
|
|
@@ -147,7 +131,6 @@ Scroller.propTypes =
|
|
|
147
131
|
* @public
|
|
148
132
|
*/
|
|
149
133
|
horizontalScrollbar: _propTypes["default"].oneOf(['auto', 'visible', 'hidden']),
|
|
150
|
-
|
|
151
134
|
/**
|
|
152
135
|
* Prevents scroll by dragging or flicking on the scroller.
|
|
153
136
|
*
|
|
@@ -156,7 +139,6 @@ Scroller.propTypes =
|
|
|
156
139
|
* @private
|
|
157
140
|
*/
|
|
158
141
|
noScrollByDrag: _propTypes["default"].bool,
|
|
159
|
-
|
|
160
142
|
/**
|
|
161
143
|
* Prevents scroll by wheeling on the scroller.
|
|
162
144
|
*
|
|
@@ -165,7 +147,6 @@ Scroller.propTypes =
|
|
|
165
147
|
* @public
|
|
166
148
|
*/
|
|
167
149
|
noScrollByWheel: _propTypes["default"].bool,
|
|
168
|
-
|
|
169
150
|
/**
|
|
170
151
|
* Called when scrolling.
|
|
171
152
|
*
|
|
@@ -180,7 +161,6 @@ Scroller.propTypes =
|
|
|
180
161
|
* @public
|
|
181
162
|
*/
|
|
182
163
|
onScroll: _propTypes["default"].func,
|
|
183
|
-
|
|
184
164
|
/**
|
|
185
165
|
* Called when scroll starts.
|
|
186
166
|
*
|
|
@@ -208,7 +188,6 @@ Scroller.propTypes =
|
|
|
208
188
|
* @public
|
|
209
189
|
*/
|
|
210
190
|
onScrollStart: _propTypes["default"].func,
|
|
211
|
-
|
|
212
191
|
/**
|
|
213
192
|
* Called when scroll stops.
|
|
214
193
|
*
|
|
@@ -236,7 +215,6 @@ Scroller.propTypes =
|
|
|
236
215
|
* @public
|
|
237
216
|
*/
|
|
238
217
|
onScrollStop: _propTypes["default"].func,
|
|
239
|
-
|
|
240
218
|
/**
|
|
241
219
|
* Specifies overscroll effects shows on which type of inputs.
|
|
242
220
|
*
|
|
@@ -249,7 +227,6 @@ Scroller.propTypes =
|
|
|
249
227
|
pageKey: _propTypes["default"].bool,
|
|
250
228
|
wheel: _propTypes["default"].bool
|
|
251
229
|
}),
|
|
252
|
-
|
|
253
230
|
/**
|
|
254
231
|
* Specifies how to scroll.
|
|
255
232
|
*
|
|
@@ -262,7 +239,6 @@ Scroller.propTypes =
|
|
|
262
239
|
* @public
|
|
263
240
|
*/
|
|
264
241
|
scrollMode: _propTypes["default"].string,
|
|
265
|
-
|
|
266
242
|
/**
|
|
267
243
|
* Specifies how to show vertical scrollbar.
|
|
268
244
|
*
|