UNPKG

@neo4j-ndl/react

Version:

React implementation of Neo4j Design System

62 lines (61 loc) 2.98 kB
/** * * Copyright (c) "Neo4j" * Neo4j Sweden AB [http://neo4j.com] * * This file is part of Neo4j. * * Neo4j is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ import React from 'react'; import { type HtmlAttributes, type PolymorphicCommonProps } from '../_common/types'; type SliderPropsBase = { /** Input props of the underlying input element */ inputProps?: HtmlAttributes<'input'>; /** Determines the step size that will be added or removed from the current value when moving the slider button */ step?: number; /** Whether the slider is disabled */ isDisabled?: boolean; /** The minimum value possible to choose */ minValue?: number; /** The maximum value possible to choose */ maxValue?: number; /** Whether to display a tooltip with the current value when the slider is being dragged */ showValues?: boolean; /** Whether to display visual indicators for each step in the slider */ showSteps?: boolean; }; type SingleSlider = SliderPropsBase & { /** Type of the slider */ type?: 'single'; /** Current value of the single slider. **Only required when the type is 'single'**. */ value: number; /** Callback function triggered when the slider value(s) changes. The function parameter varies depending on the slider type, for single slider, it is a number and for range slider, it is an array of two numbers. */ onChange: (value: number) => void; }; type RangeSlider = SliderPropsBase & { /** Type of the slider */ type: 'range'; /** Current values of the range slider as an array of two numbers `[min, max]`. **Only required when the type is 'range'**.*/ values: [number, number]; /** Callback function triggered when the slider value(s) changes. The function parameter varies depending on the slider type, for single slider, it is a number and for range slider, it is an array of two numbers. */ onChange: (value: [number, number]) => void; }; type SliderProps = SingleSlider | RangeSlider; export declare const Slider: { <T extends React.ElementType = "div">({ as, inputProps, className, style, minValue, maxValue, isDisabled, showSteps, showValues, step, type, onChange, htmlAttributes, ref, ...restProps }: PolymorphicCommonProps<T, SliderProps>): import("react/jsx-runtime").JSX.Element; displayName: string; }; export {}; //# sourceMappingURL=Slider.d.ts.map