@enact/ui 4.5.2 → 4.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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.js +8 -28
- package/BodyText/tests/BodyText-specs.js +0 -19
- package/Button/Button.js +33 -63
- package/Button/tests/Button-specs.js +0 -26
- package/CHANGELOG.md +45 -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/package.json +3 -0
- 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.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.js +19 -53
- package/Icon/tests/Icon-specs.js +0 -22
- package/IconButton/IconButton.js +24 -57
- 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.js +22 -53
- package/LabeledIcon/tests/LabeledIcon-specs.js +0 -14
- package/Layout/Cell.js +18 -44
- package/Layout/Layout.js +23 -46
- package/Layout/tests/Layout-specs.js +10 -39
- package/Marquee/MarqueeBase.js +29 -63
- 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 +7 -29
- package/RadioDecorator/RadioDecorator.js +9 -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.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 +37 -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.js +29 -67
- package/Slider/tests/Slider-specs.js +94 -7
- package/Slider/utils.js +0 -2
- package/SlotItem/SlotItem.js +23 -45
- 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.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.js +24 -57
- 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/Pinch.js +185 -0
- package/Touchable/Touch.js +71 -76
- package/Touchable/Touchable.js +95 -75
- package/Touchable/config.js +27 -24
- package/Touchable/tests/Touchable-specs.js +360 -119
- package/Touchable/tests/useTouch-specs.js +6 -80
- package/Touchable/useTouch.js +57 -65
- 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.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 +265 -409
- 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/AnnounceDecorator/AnnounceDecorator.d.ts +0 -64
- package/BodyText/BodyText.d.ts +0 -66
- package/Button/Button.d.ts +0 -125
- package/Cancelable/Cancelable.d.ts +0 -64
- package/Changeable/Changeable.d.ts +0 -54
- package/ComponentOverride/ComponentOverride.d.ts +0 -52
- package/ForwardRef/ForwardRef.d.ts +0 -22
- package/GridListImageItem/GridListImageItem.d.ts +0 -85
- package/Group/Group.d.ts +0 -107
- package/Heading/Heading.d.ts +0 -90
- package/Icon/Icon.d.ts +0 -88
- package/IconButton/IconButton.d.ts +0 -115
- package/Image/Image.d.ts +0 -113
- package/ImageItem/ImageItem.d.ts +0 -83
- package/Item/Item.d.ts +0 -64
- package/LabeledIcon/LabeledIcon.d.ts +0 -130
- package/Layout/Layout.d.ts +0 -247
- package/Marquee/index.d.ts +0 -258
- package/Measurable/Measurable.d.ts +0 -26
- package/Media/Media.d.ts +0 -99
- package/Placeholder/index.d.ts +0 -53
- package/ProgressBar/ProgressBar.d.ts +0 -92
- package/RadioDecorator/RadioDecorator.d.ts +0 -35
- package/Repeater/Repeater.d.ts +0 -83
- package/Resizable/Resizable.d.ts +0 -31
- package/Routable/Routable.d.ts +0 -148
- package/Scrollable/Scrollable.d.ts +0 -0
- package/Scroller/Scroller.d.ts +0 -276
- package/Skinnable/Skinnable.d.ts +0 -94
- package/Slider/Slider.d.ts +0 -202
- package/SlotItem/SlotItem.d.ts +0 -118
- package/Slottable/Slottable.d.ts +0 -22
- package/Spinner/Spinner.d.ts +0 -95
- package/ToggleIcon/ToggleIcon.d.ts +0 -90
- package/ToggleItem/ToggleItem.d.ts +0 -134
- package/Toggleable/Toggleable.d.ts +0 -103
- package/Touchable/Touchable.d.ts +0 -175
- package/Transition/Transition.d.ts +0 -196
- package/ViewManager/ViewManager.d.ts +0 -191
- package/VirtualList/VirtualList.d.ts +0 -530
- package/index.d.ts +0 -0
- package/internal/IdProvider/IdProvider.d.ts +0 -0
- package/internal/Pure/Pure.d.ts +0 -0
- package/internal/localized-fonts/localized-fonts.d.ts +0 -53
- package/internal/selection/selection.d.ts +0 -0
- package/internal/validators/validators.d.ts +0 -0
- package/resolution/index.d.ts +0 -187
- package/useControlledState/useControlledState.d.ts +0 -0
- package/useScroll/useScroll.d.ts +0 -0
package/Skinnable/util.js
CHANGED
|
@@ -7,21 +7,16 @@ exports.determineSkin = determineSkin;
|
|
|
7
7
|
exports.determineVariants = determineVariants;
|
|
8
8
|
exports.getClassName = getClassName;
|
|
9
9
|
exports.preferDefined = exports.objectify = void 0;
|
|
10
|
-
|
|
11
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
|
-
|
|
13
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
14
|
-
|
|
15
12
|
var objectify = function objectify(arg) {
|
|
16
13
|
// undefined, null, empty string case
|
|
17
14
|
// bail early
|
|
18
15
|
if (!arg) return {};
|
|
19
|
-
|
|
20
16
|
if (typeof arg === 'string') {
|
|
21
17
|
// String case, convert to array for processing
|
|
22
18
|
arg = arg.split(' ');
|
|
23
19
|
}
|
|
24
|
-
|
|
25
20
|
if (arg instanceof Array) {
|
|
26
21
|
// Convert array values into object properties
|
|
27
22
|
return arg.reduce(function (obj, a) {
|
|
@@ -36,12 +31,11 @@ var objectify = function objectify(arg) {
|
|
|
36
31
|
return {};
|
|
37
32
|
}
|
|
38
33
|
};
|
|
39
|
-
|
|
40
34
|
exports.objectify = objectify;
|
|
41
|
-
|
|
42
35
|
var preferDefined = function preferDefined(a, b) {
|
|
43
36
|
return a != null ? a : b;
|
|
44
37
|
};
|
|
38
|
+
|
|
45
39
|
/**
|
|
46
40
|
* Determines the effective skin
|
|
47
41
|
*
|
|
@@ -50,13 +44,11 @@ var preferDefined = function preferDefined(a, b) {
|
|
|
50
44
|
* @param {String} parentSkin The inherited skin value from an upstream useSkins
|
|
51
45
|
* @private
|
|
52
46
|
*/
|
|
53
|
-
|
|
54
|
-
|
|
55
47
|
exports.preferDefined = preferDefined;
|
|
56
|
-
|
|
57
48
|
function determineSkin(defaultSkin, authorSkin, parentSkin) {
|
|
58
49
|
return authorSkin || defaultSkin || parentSkin;
|
|
59
50
|
}
|
|
51
|
+
|
|
60
52
|
/**
|
|
61
53
|
* Determines the effective skin variant
|
|
62
54
|
*
|
|
@@ -66,41 +58,38 @@ function determineSkin(defaultSkin, authorSkin, parentSkin) {
|
|
|
66
58
|
* @param {String|String[]} parentVariants The inherited variants from an upstream useSkins
|
|
67
59
|
* @private
|
|
68
60
|
*/
|
|
69
|
-
|
|
70
|
-
|
|
71
61
|
function determineVariants(defaultVariants, allowedVariants, authorVariants, parentVariants) {
|
|
72
62
|
if (!allowedVariants || !(allowedVariants instanceof Array)) {
|
|
73
63
|
// There are no allowed variants, so just return an empty object, indicating that there are no viable determined variants.
|
|
74
64
|
return {};
|
|
75
65
|
}
|
|
76
|
-
|
|
77
66
|
defaultVariants = objectify(defaultVariants);
|
|
78
67
|
authorVariants = objectify(authorVariants);
|
|
79
|
-
parentVariants = objectify(parentVariants);
|
|
68
|
+
parentVariants = objectify(parentVariants);
|
|
80
69
|
|
|
70
|
+
// Merge all of the variants objects, preferring values in objects from left to right.
|
|
81
71
|
var mergedObj = [defaultVariants, parentVariants, authorVariants].reduce(function (obj, a) {
|
|
82
72
|
if (a) {
|
|
83
73
|
Object.keys(a).forEach(function (key) {
|
|
84
74
|
obj[key] = preferDefined(a[key], obj[key]);
|
|
85
75
|
});
|
|
86
76
|
}
|
|
87
|
-
|
|
88
77
|
return obj;
|
|
89
|
-
}, {});
|
|
78
|
+
}, {});
|
|
90
79
|
|
|
80
|
+
// Clean up the merged object
|
|
91
81
|
for (var key in mergedObj) {
|
|
92
82
|
// Delete keys that are null or undefined and delete keys that aren't allowed
|
|
93
83
|
if (mergedObj[key] == null || !allowedVariants.includes(key)) {
|
|
94
84
|
delete mergedObj[key];
|
|
95
85
|
}
|
|
96
86
|
}
|
|
97
|
-
|
|
98
87
|
return mergedObj;
|
|
99
88
|
}
|
|
100
|
-
|
|
101
89
|
function getClassName(skins, effectiveSkin, variants) {
|
|
102
|
-
var skin = skins && skins[effectiveSkin];
|
|
103
|
-
// defined by the value in context
|
|
90
|
+
var skin = skins && skins[effectiveSkin];
|
|
104
91
|
|
|
92
|
+
// only apply the skin class if it's set and different from the "current" skin as
|
|
93
|
+
// defined by the value in context
|
|
105
94
|
return (0, _classnames["default"])(skin, variants);
|
|
106
95
|
}
|
package/Slider/Knob.js
CHANGED
|
@@ -4,31 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = exports.Knob = void 0;
|
|
7
|
-
|
|
8
7
|
var _propTypes = _interopRequireDefault(require("@enact/core/internal/prop-types"));
|
|
9
|
-
|
|
10
8
|
var _kind = _interopRequireDefault(require("@enact/core/kind"));
|
|
11
|
-
|
|
12
9
|
var _propTypes2 = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
|
|
14
10
|
var _ComponentOverride = _interopRequireDefault(require("../ComponentOverride"));
|
|
15
|
-
|
|
16
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
-
|
|
18
12
|
var _excluded = ["orientation", "proportion", "tooltipComponent", "value"];
|
|
19
|
-
|
|
20
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
|
-
|
|
22
14
|
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
|
-
|
|
24
15
|
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
|
-
|
|
26
16
|
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
|
-
|
|
28
17
|
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; }
|
|
29
|
-
|
|
30
18
|
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; }
|
|
31
|
-
|
|
32
19
|
/**
|
|
33
20
|
* An unstyled, knob component to be used with a `Slider`.
|
|
34
21
|
*
|
|
@@ -39,9 +26,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
39
26
|
*/
|
|
40
27
|
var Knob = (0, _kind["default"])({
|
|
41
28
|
name: 'Knob',
|
|
42
|
-
propTypes:
|
|
43
|
-
/** @lends ui/Slider.Knob.prototype */
|
|
44
|
-
{
|
|
29
|
+
propTypes: /** @lends ui/Slider.Knob.prototype */{
|
|
45
30
|
/**
|
|
46
31
|
* The orientation of the slider, either `"horizontal"` or `"vertical"`.
|
|
47
32
|
*
|
|
@@ -50,7 +35,6 @@ var Knob = (0, _kind["default"])({
|
|
|
50
35
|
* @public
|
|
51
36
|
*/
|
|
52
37
|
orientation: _propTypes2["default"].oneOf(['horizontal', 'vertical']),
|
|
53
|
-
|
|
54
38
|
/**
|
|
55
39
|
* A number between 0 and 1 representing the proportion of the `value` in terms of `min`
|
|
56
40
|
* and `max` props of the slider.
|
|
@@ -59,7 +43,6 @@ var Knob = (0, _kind["default"])({
|
|
|
59
43
|
* @public
|
|
60
44
|
*/
|
|
61
45
|
proportion: _propTypes2["default"].number,
|
|
62
|
-
|
|
63
46
|
/**
|
|
64
47
|
* Adds a tooltip to the knob using the provided component.
|
|
65
48
|
*
|
|
@@ -79,7 +62,6 @@ var Knob = (0, _kind["default"])({
|
|
|
79
62
|
* @public
|
|
80
63
|
*/
|
|
81
64
|
tooltipComponent: _propTypes["default"].componentOverride,
|
|
82
|
-
|
|
83
65
|
/**
|
|
84
66
|
* The value of the slider.
|
|
85
67
|
*
|
|
@@ -91,11 +73,10 @@ var Knob = (0, _kind["default"])({
|
|
|
91
73
|
},
|
|
92
74
|
render: function render(_ref) {
|
|
93
75
|
var orientation = _ref.orientation,
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
76
|
+
proportion = _ref.proportion,
|
|
77
|
+
tooltipComponent = _ref.tooltipComponent,
|
|
78
|
+
value = _ref.value,
|
|
79
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
99
80
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", _objectSpread(_objectSpread({}, rest), {}, {
|
|
100
81
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ComponentOverride["default"], {
|
|
101
82
|
component: tooltipComponent,
|
|
@@ -4,51 +4,28 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = exports.PositionDecorator = void 0;
|
|
7
|
-
|
|
8
7
|
var _hoc = _interopRequireDefault(require("@enact/core/hoc"));
|
|
9
|
-
|
|
10
8
|
var _handle = require("@enact/core/handle");
|
|
11
|
-
|
|
12
9
|
var _react = require("react");
|
|
13
|
-
|
|
14
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
-
|
|
16
11
|
var _validators = require("../internal/validators");
|
|
17
|
-
|
|
18
12
|
var _utils = require("./utils");
|
|
19
|
-
|
|
20
13
|
var _SliderModule = _interopRequireDefault(require("./Slider.module.css"));
|
|
21
|
-
|
|
22
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
|
-
|
|
24
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
25
|
-
|
|
26
16
|
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
|
-
|
|
28
17
|
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
|
-
|
|
30
18
|
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
|
-
|
|
32
19
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
33
|
-
|
|
34
20
|
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
|
-
|
|
36
21
|
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
|
-
|
|
38
22
|
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
|
-
|
|
40
23
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
41
|
-
|
|
42
24
|
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
|
-
|
|
44
25
|
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
|
-
|
|
46
26
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
47
|
-
|
|
48
27
|
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; } }
|
|
49
|
-
|
|
50
28
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
51
|
-
|
|
52
29
|
var validateRange = (0, _validators.validateRangeOnce)(function (props) {
|
|
53
30
|
return props;
|
|
54
31
|
}, {
|
|
@@ -67,17 +44,12 @@ var validateStepMax = (0, _validators.validateSteppedOnce)(function (props) {
|
|
|
67
44
|
});
|
|
68
45
|
var PositionDecorator = (0, _hoc["default"])(function (config, Wrapped) {
|
|
69
46
|
var _class;
|
|
70
|
-
|
|
71
47
|
return _class = /*#__PURE__*/function (_Component) {
|
|
72
48
|
_inherits(_class, _Component);
|
|
73
|
-
|
|
74
49
|
var _super = _createSuper(_class);
|
|
75
|
-
|
|
76
50
|
function _class(props) {
|
|
77
51
|
var _this;
|
|
78
|
-
|
|
79
52
|
_classCallCheck(this, _class);
|
|
80
|
-
|
|
81
53
|
_this = _super.call(this, props);
|
|
82
54
|
_this.handleDown = _this.handleDown.bind(_assertThisInitialized(_this));
|
|
83
55
|
_this.handleDrag = _this.handleDrag.bind(_assertThisInitialized(_this));
|
|
@@ -88,44 +60,38 @@ var PositionDecorator = (0, _hoc["default"])(function (config, Wrapped) {
|
|
|
88
60
|
};
|
|
89
61
|
return _this;
|
|
90
62
|
}
|
|
91
|
-
|
|
92
63
|
_createClass(_class, [{
|
|
93
64
|
key: "emitChangeForPosition",
|
|
94
65
|
value: function emitChangeForPosition(x, y) {
|
|
95
66
|
var _this$props = this.props,
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
67
|
+
max = _this$props.max,
|
|
68
|
+
min = _this$props.min,
|
|
69
|
+
orientation = _this$props.orientation,
|
|
70
|
+
step = _this$props.step;
|
|
100
71
|
var position = x;
|
|
101
72
|
var offset = this.bounds.offsetX;
|
|
102
|
-
|
|
103
73
|
if (orientation === 'vertical') {
|
|
104
74
|
position = y;
|
|
105
75
|
offset = this.bounds.offsetY;
|
|
106
76
|
}
|
|
107
|
-
|
|
108
77
|
var proportion = (0, _utils.calcProportion)(this.bounds.min, this.bounds.max, position - offset);
|
|
109
|
-
|
|
110
78
|
if (orientation === 'vertical') {
|
|
111
79
|
proportion = 1 - proportion;
|
|
112
80
|
}
|
|
81
|
+
var value = (max - min) * proportion + min;
|
|
113
82
|
|
|
114
|
-
|
|
115
|
-
|
|
83
|
+
// adjust value for stepping
|
|
116
84
|
if (step) {
|
|
117
85
|
var delta = (value - min) % step;
|
|
118
|
-
|
|
119
86
|
if (delta < step / 2) {
|
|
120
87
|
value -= delta;
|
|
121
88
|
} else {
|
|
122
89
|
value += step - delta;
|
|
123
|
-
}
|
|
124
|
-
|
|
90
|
+
}
|
|
125
91
|
|
|
92
|
+
// recalculate the proportion based on the stepped value
|
|
126
93
|
proportion = (0, _utils.calcProportion)(min, max, value);
|
|
127
94
|
}
|
|
128
|
-
|
|
129
95
|
if (value !== this.props.value) {
|
|
130
96
|
(0, _handle.forward)('onChange', {
|
|
131
97
|
type: 'onChange',
|
|
@@ -140,7 +106,6 @@ var PositionDecorator = (0, _hoc["default"])(function (config, Wrapped) {
|
|
|
140
106
|
var orientation = this.props.orientation;
|
|
141
107
|
var bounds = node.getBoundingClientRect();
|
|
142
108
|
var computedStyle = window.getComputedStyle(node);
|
|
143
|
-
|
|
144
109
|
if (orientation === 'horizontal') {
|
|
145
110
|
this.bounds.min = bounds.left + parseInt(computedStyle.paddingLeft);
|
|
146
111
|
this.bounds.max = bounds.right - parseInt(computedStyle.paddingRight);
|
|
@@ -155,7 +120,6 @@ var PositionDecorator = (0, _hoc["default"])(function (config, Wrapped) {
|
|
|
155
120
|
this.bounds.offsetX = 0;
|
|
156
121
|
this.bounds.offsetY = 0;
|
|
157
122
|
var knob = target.closest(".".concat(_SliderModule["default"].knob));
|
|
158
|
-
|
|
159
123
|
if (knob) {
|
|
160
124
|
var rect = knob.getBoundingClientRect();
|
|
161
125
|
var centerX = rect.left + rect.width / 2;
|
|
@@ -168,9 +132,9 @@ var PositionDecorator = (0, _hoc["default"])(function (config, Wrapped) {
|
|
|
168
132
|
key: "handleDown",
|
|
169
133
|
value: function handleDown(_ref) {
|
|
170
134
|
var clientX = _ref.clientX,
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
135
|
+
clientY = _ref.clientY,
|
|
136
|
+
currentTarget = _ref.currentTarget,
|
|
137
|
+
target = _ref.target;
|
|
174
138
|
// bail early for emulated mousedown events from key presses
|
|
175
139
|
if (typeof clientX === 'undefined' || typeof clientY === 'undefined') return;
|
|
176
140
|
this.updateBounds(currentTarget);
|
|
@@ -194,11 +158,11 @@ var PositionDecorator = (0, _hoc["default"])(function (config, Wrapped) {
|
|
|
194
158
|
value: function render() {
|
|
195
159
|
if (process.env.NODE_ENV !== "production") {
|
|
196
160
|
var _this$props2 = this.props,
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
161
|
+
min = _this$props2.min,
|
|
162
|
+
_this$props2$value = _this$props2.value,
|
|
163
|
+
value = _this$props2$value === void 0 ? min : _this$props2$value,
|
|
164
|
+
max = _this$props2.max,
|
|
165
|
+
step = _this$props2.step;
|
|
202
166
|
var props = {
|
|
203
167
|
min: min,
|
|
204
168
|
value: value || min,
|
|
@@ -209,7 +173,6 @@ var PositionDecorator = (0, _hoc["default"])(function (config, Wrapped) {
|
|
|
209
173
|
validateStepValue(props);
|
|
210
174
|
validateStepMax(props);
|
|
211
175
|
}
|
|
212
|
-
|
|
213
176
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Wrapped, _objectSpread(_objectSpread({}, this.props), {}, {
|
|
214
177
|
dragConfig: this.dragConfig,
|
|
215
178
|
onDown: this.handleDown,
|
|
@@ -218,7 +181,6 @@ var PositionDecorator = (0, _hoc["default"])(function (config, Wrapped) {
|
|
|
218
181
|
}));
|
|
219
182
|
}
|
|
220
183
|
}]);
|
|
221
|
-
|
|
222
184
|
return _class;
|
|
223
185
|
}(_react.Component), _class.displayName = 'PositionDecorator', _class.propTypes = {
|
|
224
186
|
disabled: _propTypes["default"].bool,
|
package/Slider/Slider.js
CHANGED
|
@@ -10,47 +10,26 @@ Object.defineProperty(exports, "Knob", {
|
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
exports["default"] = exports.SliderDecorator = exports.SliderBase = exports.Slider = void 0;
|
|
13
|
-
|
|
14
13
|
var _propTypes = _interopRequireDefault(require("@enact/core/internal/prop-types"));
|
|
15
|
-
|
|
16
14
|
var _kind = _interopRequireDefault(require("@enact/core/kind"));
|
|
17
|
-
|
|
18
15
|
var _propTypes2 = _interopRequireDefault(require("prop-types"));
|
|
19
|
-
|
|
20
16
|
var _compose = _interopRequireDefault(require("ramda/src/compose"));
|
|
21
|
-
|
|
22
17
|
var _Changeable = _interopRequireDefault(require("../Changeable"));
|
|
23
|
-
|
|
24
18
|
var _ComponentOverride = _interopRequireDefault(require("../ComponentOverride"));
|
|
25
|
-
|
|
26
19
|
var _ForwardRef = _interopRequireDefault(require("../ForwardRef"));
|
|
27
|
-
|
|
28
20
|
var _Touchable = _interopRequireDefault(require("../Touchable"));
|
|
29
|
-
|
|
30
21
|
var _Knob = _interopRequireDefault(require("./Knob"));
|
|
31
|
-
|
|
32
22
|
var _PositionDecorator = _interopRequireDefault(require("./PositionDecorator"));
|
|
33
|
-
|
|
34
23
|
var _SliderModule = _interopRequireDefault(require("./Slider.module.css"));
|
|
35
|
-
|
|
36
24
|
var _utils = require("./utils");
|
|
37
|
-
|
|
38
25
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
39
|
-
|
|
40
26
|
var _excluded = ["backgroundProgress", "componentRef", "css", "disabled", "knobComponent", "min", "orientation", "percent", "progressBarComponent", "progressAnchor", "tooltipComponent", "value"];
|
|
41
|
-
|
|
42
27
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
43
|
-
|
|
44
28
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
45
|
-
|
|
46
29
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
47
|
-
|
|
48
30
|
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; }
|
|
49
|
-
|
|
50
31
|
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; }
|
|
51
|
-
|
|
52
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; }
|
|
53
|
-
|
|
54
33
|
/**
|
|
55
34
|
* An unstyled, sliding range-selection component.
|
|
56
35
|
*
|
|
@@ -61,9 +40,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
61
40
|
*/
|
|
62
41
|
var SliderBase = (0, _kind["default"])({
|
|
63
42
|
name: 'ui:Slider',
|
|
64
|
-
propTypes:
|
|
65
|
-
/** @lends ui/Slider.SliderBase.prototype */
|
|
66
|
-
{
|
|
43
|
+
propTypes: /** @lends ui/Slider.SliderBase.prototype */{
|
|
67
44
|
/**
|
|
68
45
|
* The component used to render the progress bar within the slider.
|
|
69
46
|
*
|
|
@@ -83,7 +60,6 @@ var SliderBase = (0, _kind["default"])({
|
|
|
83
60
|
* @public
|
|
84
61
|
*/
|
|
85
62
|
progressBarComponent: _propTypes["default"].componentOverride.isRequired,
|
|
86
|
-
|
|
87
63
|
/**
|
|
88
64
|
* Background progress, as a proportion between `0` and `1`.
|
|
89
65
|
*
|
|
@@ -92,7 +68,6 @@ var SliderBase = (0, _kind["default"])({
|
|
|
92
68
|
* @public
|
|
93
69
|
*/
|
|
94
70
|
backgroundProgress: _propTypes2["default"].number,
|
|
95
|
-
|
|
96
71
|
/**
|
|
97
72
|
* Called with a reference to the root component.
|
|
98
73
|
*
|
|
@@ -103,7 +78,6 @@ var SliderBase = (0, _kind["default"])({
|
|
|
103
78
|
* @public
|
|
104
79
|
*/
|
|
105
80
|
componentRef: _propTypes["default"].ref,
|
|
106
|
-
|
|
107
81
|
/**
|
|
108
82
|
* Customizes the component by mapping the supplied collection of CSS class names to the
|
|
109
83
|
* corresponding internal elements and states of this component.
|
|
@@ -121,7 +95,6 @@ var SliderBase = (0, _kind["default"])({
|
|
|
121
95
|
* @public
|
|
122
96
|
*/
|
|
123
97
|
css: _propTypes2["default"].object,
|
|
124
|
-
|
|
125
98
|
/**
|
|
126
99
|
* Disables component and does not generate events.
|
|
127
100
|
*
|
|
@@ -130,7 +103,6 @@ var SliderBase = (0, _kind["default"])({
|
|
|
130
103
|
* @public
|
|
131
104
|
*/
|
|
132
105
|
disabled: _propTypes2["default"].bool,
|
|
133
|
-
|
|
134
106
|
/**
|
|
135
107
|
* Defines a custom knob component for the slider.
|
|
136
108
|
*
|
|
@@ -156,31 +128,28 @@ var SliderBase = (0, _kind["default"])({
|
|
|
156
128
|
* @public
|
|
157
129
|
*/
|
|
158
130
|
knobComponent: _propTypes["default"].componentOverride,
|
|
159
|
-
|
|
160
131
|
/**
|
|
161
132
|
* The maximum value of the slider.
|
|
162
133
|
*
|
|
163
134
|
* The range between `min` and `max` should be evenly divisible by
|
|
164
|
-
*
|
|
135
|
+
* {@link ui/Slider.SliderBase.step|step}.
|
|
165
136
|
*
|
|
166
137
|
* @type {Number}
|
|
167
138
|
* @default 100
|
|
168
139
|
* @public
|
|
169
140
|
*/
|
|
170
141
|
max: _propTypes2["default"].number,
|
|
171
|
-
|
|
172
142
|
/**
|
|
173
143
|
* The minimum value of the slider.
|
|
174
144
|
*
|
|
175
145
|
* The range between `min` and `max` should be evenly divisible by
|
|
176
|
-
*
|
|
146
|
+
* {@link ui/Slider.SliderBase.step|step}.
|
|
177
147
|
*
|
|
178
148
|
* @type {Number}
|
|
179
149
|
* @default 0
|
|
180
150
|
* @public
|
|
181
151
|
*/
|
|
182
152
|
min: _propTypes2["default"].number,
|
|
183
|
-
|
|
184
153
|
/**
|
|
185
154
|
* Applies the style where the slider bar does not display filled.
|
|
186
155
|
*
|
|
@@ -189,7 +158,6 @@ var SliderBase = (0, _kind["default"])({
|
|
|
189
158
|
* @public
|
|
190
159
|
*/
|
|
191
160
|
noFill: _propTypes2["default"].bool,
|
|
192
|
-
|
|
193
161
|
/**
|
|
194
162
|
* The orientation of the slider.
|
|
195
163
|
*
|
|
@@ -202,7 +170,6 @@ var SliderBase = (0, _kind["default"])({
|
|
|
202
170
|
* @public
|
|
203
171
|
*/
|
|
204
172
|
orientation: _propTypes2["default"].string,
|
|
205
|
-
|
|
206
173
|
/**
|
|
207
174
|
* Applies a pressed visual effect.
|
|
208
175
|
*
|
|
@@ -210,7 +177,6 @@ var SliderBase = (0, _kind["default"])({
|
|
|
210
177
|
* @public
|
|
211
178
|
*/
|
|
212
179
|
pressed: _propTypes2["default"].bool,
|
|
213
|
-
|
|
214
180
|
/**
|
|
215
181
|
* Sets the point, as a proportion between 0 and 1, from which the slider is filled.
|
|
216
182
|
*
|
|
@@ -225,7 +191,6 @@ var SliderBase = (0, _kind["default"])({
|
|
|
225
191
|
* @public
|
|
226
192
|
*/
|
|
227
193
|
progressAnchor: _propTypes2["default"].number,
|
|
228
|
-
|
|
229
194
|
/**
|
|
230
195
|
* The amount to increment or decrement the value.
|
|
231
196
|
*
|
|
@@ -236,7 +201,6 @@ var SliderBase = (0, _kind["default"])({
|
|
|
236
201
|
* @public
|
|
237
202
|
*/
|
|
238
203
|
step: _propTypes2["default"].number,
|
|
239
|
-
|
|
240
204
|
/**
|
|
241
205
|
* Adds a tooltip to the slider using the provided component.
|
|
242
206
|
*
|
|
@@ -256,7 +220,6 @@ var SliderBase = (0, _kind["default"])({
|
|
|
256
220
|
* @public
|
|
257
221
|
*/
|
|
258
222
|
tooltipComponent: _propTypes["default"].componentOverride,
|
|
259
|
-
|
|
260
223
|
/**
|
|
261
224
|
* The value of the slider.
|
|
262
225
|
*
|
|
@@ -285,9 +248,9 @@ var SliderBase = (0, _kind["default"])({
|
|
|
285
248
|
computed: {
|
|
286
249
|
className: function className(_ref) {
|
|
287
250
|
var noFill = _ref.noFill,
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
251
|
+
orientation = _ref.orientation,
|
|
252
|
+
pressed = _ref.pressed,
|
|
253
|
+
styler = _ref.styler;
|
|
291
254
|
return styler.append(orientation, {
|
|
292
255
|
noFill: noFill,
|
|
293
256
|
pressed: pressed
|
|
@@ -295,17 +258,17 @@ var SliderBase = (0, _kind["default"])({
|
|
|
295
258
|
},
|
|
296
259
|
percent: function percent(_ref2) {
|
|
297
260
|
var max = _ref2.max,
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
261
|
+
min = _ref2.min,
|
|
262
|
+
_ref2$value = _ref2.value,
|
|
263
|
+
value = _ref2$value === void 0 ? min : _ref2$value;
|
|
301
264
|
return (0, _utils.calcProportion)(min, max, value);
|
|
302
265
|
},
|
|
303
266
|
style: function style(_ref3) {
|
|
304
267
|
var max = _ref3.max,
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
268
|
+
min = _ref3.min,
|
|
269
|
+
_style = _ref3.style,
|
|
270
|
+
_ref3$value = _ref3.value,
|
|
271
|
+
value = _ref3$value === void 0 ? min : _ref3$value;
|
|
309
272
|
var proportion = (0, _utils.calcProportion)(min, max, value);
|
|
310
273
|
return _objectSpread(_objectSpread({}, _style), {}, {
|
|
311
274
|
'--ui-slider-proportion-end-knob': proportion
|
|
@@ -314,20 +277,19 @@ var SliderBase = (0, _kind["default"])({
|
|
|
314
277
|
},
|
|
315
278
|
render: function render(_ref4) {
|
|
316
279
|
var backgroundProgress = _ref4.backgroundProgress,
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
280
|
+
componentRef = _ref4.componentRef,
|
|
281
|
+
css = _ref4.css,
|
|
282
|
+
disabled = _ref4.disabled,
|
|
283
|
+
knobComponent = _ref4.knobComponent,
|
|
284
|
+
min = _ref4.min,
|
|
285
|
+
orientation = _ref4.orientation,
|
|
286
|
+
percent = _ref4.percent,
|
|
287
|
+
progressBarComponent = _ref4.progressBarComponent,
|
|
288
|
+
progressAnchor = _ref4.progressAnchor,
|
|
289
|
+
tooltipComponent = _ref4.tooltipComponent,
|
|
290
|
+
_ref4$value = _ref4.value,
|
|
291
|
+
value = _ref4$value === void 0 ? min : _ref4$value,
|
|
292
|
+
rest = _objectWithoutProperties(_ref4, _excluded);
|
|
331
293
|
delete rest.max;
|
|
332
294
|
delete rest.noFill;
|
|
333
295
|
delete rest.pressed;
|
|
@@ -354,8 +316,9 @@ var SliderBase = (0, _kind["default"])({
|
|
|
354
316
|
}));
|
|
355
317
|
}
|
|
356
318
|
});
|
|
319
|
+
|
|
357
320
|
/**
|
|
358
|
-
* Adds touch and drag support to a
|
|
321
|
+
* Adds touch and drag support to a {@link ui/Slider.SliderBase|SliderBase}.
|
|
359
322
|
*
|
|
360
323
|
* @hoc
|
|
361
324
|
* @memberof ui/Slider
|
|
@@ -363,13 +326,13 @@ var SliderBase = (0, _kind["default"])({
|
|
|
363
326
|
* @mixes ui/Touchable.Touchable
|
|
364
327
|
* @public
|
|
365
328
|
*/
|
|
366
|
-
|
|
367
329
|
exports.SliderBase = SliderBase;
|
|
368
330
|
var SliderDecorator = (0, _compose["default"])((0, _ForwardRef["default"])({
|
|
369
331
|
prop: 'componentRef'
|
|
370
332
|
}), _Changeable["default"], _PositionDecorator["default"], (0, _Touchable["default"])({
|
|
371
333
|
activeProp: 'pressed'
|
|
372
334
|
}));
|
|
335
|
+
|
|
373
336
|
/**
|
|
374
337
|
* A minimally-styled slider component with touch and drag support.
|
|
375
338
|
*
|
|
@@ -394,7 +357,6 @@ var SliderDecorator = (0, _compose["default"])((0, _ForwardRef["default"])({
|
|
|
394
357
|
* values
|
|
395
358
|
* @public
|
|
396
359
|
*/
|
|
397
|
-
|
|
398
360
|
exports.SliderDecorator = SliderDecorator;
|
|
399
361
|
var Slider = SliderDecorator(SliderBase);
|
|
400
362
|
exports.Slider = Slider;
|