"use strict";
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
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;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var react_1 = __importStar(require("react"));
var styles_1 = require("@mui/styles");
var Slider_1 = __importDefault(require("@mui/material/Slider"));
var colors_1 = require("../../base/colors");
var useStyles = styles_1.makeStyles({
    root: {
        color: colors_1.grey.light,
        height: 8,
    },
    thumb: {
        height: 20,
        width: 20,
        backgroundColor: "#fff",
        boxShadow: "0px 2px 5px 1px rgb(135 153 150 / 60%)",
        "&::after": {
            width: 12,
            height: 12,
            left: 10,
            top: 10,
            backgroundColor: colors_1.green.standard,
        },
        "&:focus, &:hover, &$active": {
            boxShadow: "0px 2px 5px 1px rgb(135 153 150 / 60%)",
        },
    },
    active: {},
    track: {
        height: 4,
        borderRadius: 4,
        color: colors_1.green.standard,
    },
    rail: {
        height: 4,
        borderRadius: 4,
        color: colors_1.grey.light,
        opacity: 1,
    },
    mark: {
        height: 12,
        width: 12,
        borderRadius: 6,
        backgroundColor: colors_1.grey.light,
        display: "none",
    },
    markActive: {
        display: "none",
    },
    markLabel: {
        display: "none",
        top: "inherit",
        bottom: 35,
    },
    markLabelActive: {
        display: "block",
        marginTop: 0,
        "&:last-child": {
            backgroundColor: "yellow",
            color: "blue",
        },
    },
});
function LabelSlider(_a) {
    var tbxMarks = _a.tbxMarks, props = __rest(_a, ["tbxMarks"]);
    var styles = useStyles();
    // Convert our marks into something meaningful for the Material slider
    // to use. tbxMarks assumes that all marks are to be equally spaced apart,
    // with the first mark "away" from the left edge, and the right mark
    // at the finish line.
    var newMarks = react_1.useMemo(function () {
        return tbxMarks.map(function (label, idx) {
            var value = ((idx + 1) / tbxMarks.length) * 100;
            if (value === props.value) {
                return { label: label, value: value };
            }
            return { label: null, value: value };
        });
    }, [tbxMarks, props.value]);
    return (react_1.default.createElement(Slider_1.default, __assign({ classes: styles, marks: newMarks, size: "small", components: __assign(__assign({}, props.components), { ValueLabel: function (_a) {
                var children = _a.children;
                return children;
            } }) }, props)));
}
exports.default = LabelSlider;
//# sourceMappingURL=LabelSlider.js.map