UNPKG

2.43 kBJavaScriptView Raw
1"use strict";
2/*
3 * Copyright 2016 Palantir Technologies, Inc. All rights reserved.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17Object.defineProperty(exports, "__esModule", { value: true });
18exports.Slider = void 0;
19var tslib_1 = require("tslib");
20var React = tslib_1.__importStar(require("react"));
21var common_1 = require("../../common");
22var props_1 = require("../../common/props");
23var multiSlider_1 = require("./multiSlider");
24/**
25 * Slider component.
26 *
27 * @see https://blueprintjs.com/docs/#core/components/sliders.slider
28 */
29var Slider = /** @class */ (function (_super) {
30 tslib_1.__extends(Slider, _super);
31 function Slider() {
32 return _super !== null && _super.apply(this, arguments) || this;
33 }
34 Slider.prototype.render = function () {
35 var _a = this.props, initialValue = _a.initialValue, intent = _a.intent, value = _a.value, onChange = _a.onChange, onRelease = _a.onRelease, handleHtmlProps = _a.handleHtmlProps, props = tslib_1.__rest(_a, ["initialValue", "intent", "value", "onChange", "onRelease", "handleHtmlProps"]);
36 return (React.createElement(multiSlider_1.MultiSlider, tslib_1.__assign({}, props),
37 React.createElement(multiSlider_1.MultiSlider.Handle, { value: value, intentAfter: value < initialValue ? intent : undefined, intentBefore: value >= initialValue ? intent : undefined, onChange: onChange, onRelease: onRelease, htmlProps: handleHtmlProps }),
38 React.createElement(multiSlider_1.MultiSlider.Handle, { value: initialValue, interactionKind: "none" })));
39 };
40 Slider.defaultProps = tslib_1.__assign(tslib_1.__assign({}, multiSlider_1.MultiSlider.defaultSliderProps), { initialValue: 0, intent: common_1.Intent.PRIMARY, value: 0 });
41 Slider.displayName = "".concat(props_1.DISPLAYNAME_PREFIX, ".Slider");
42 return Slider;
43}(common_1.AbstractPureComponent2));
44exports.Slider = Slider;
45//# sourceMappingURL=slider.js.map
\No newline at end of file