UNPKG

@react-md/form

Version:

This package is for creating all the different form input types.

52 lines 2.58 kB
var __assign = (this && this.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; }; import { jsx as _jsx } from "react/jsx-runtime"; import { forwardRef } from "react"; import cn from "classnames"; import { bem } from "@react-md/utils"; import { THUMB_1_VAR, THUMB_2_VAR } from "./constants"; var styles = bem("rmd-slider-track"); /** * The `SliderTrack` component is used to show the distance that the slider can * be dragged as well as a visual indication of the value. The main usage is to * update the custom css properties for the thumb's values. * * @remarks \@since 2.5.0 */ export var SliderTrack = forwardRef(function SliderTrack(_a, ref) { var _b; var propStyle = _a.style, className = _a.className, children = _a.children, _c = _a.animate, animate = _c === void 0 ? false : _c, _d = _a.vertical, vertical = _d === void 0 ? false : _d, _e = _a.disabled, disabled = _e === void 0 ? false : _e, thumb1Percentage = _a.thumb1Percentage, thumb2Percentage = _a.thumb2Percentage, props = __rest(_a, ["style", "className", "children", "animate", "vertical", "disabled", "thumb1Percentage", "thumb2Percentage"]); var style = __assign(__assign({}, propStyle), (_b = {}, _b[THUMB_1_VAR] = thumb1Percentage, _b[THUMB_2_VAR] = thumb2Percentage, _b)); return (_jsx("span", __assign({}, props, { ref: ref, style: style, className: cn(styles({ animate: animate, hoverable: !disabled, disabled: disabled, h: !vertical, h1: !vertical && !thumb2Percentage, h2: !vertical && thumb2Percentage, v: vertical, v1: vertical && !thumb2Percentage, v2: vertical && thumb2Percentage, }), className) }, { children: children }))); }); //# sourceMappingURL=SliderTrack.js.map