UNPKG

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