/**
 * @license MIT
 * author: Cube Dev Team
 * @cube-dev/ui-kit v0.0.0-canary-d4047d7
 * Released under the MIT license.
 */

import { jsx as _jsx } from "react/jsx-runtime";
import { SliderGradationElement, SliderGradeElement } from './elements.js';
export function Gradation(props) {
    const { state, ranges, values = [] } = props;
    if (!values.length) {
        return null;
    }
    const getIsActive = (value, idx) => {
        const [minIdx, maxIdx] = ranges.map((range) => state.getThumbValue(range));
        return idx >= minIdx && idx <= maxIdx;
    };
    return (_jsx(SliderGradationElement, { children: values.map((value, idx) => (_jsx(SliderGradeElement, { mods: {
                active: getIsActive(value, idx),
            }, children: value }, value))) }));
}

        