import { Slider as ChakraSlider, For, HStack } from "@chakra-ui/react" import * as React from "react" export interface SliderProps extends ChakraSlider.RootProps { marks?: Array label?: React.ReactNode showValue?: boolean } export const Slider = React.forwardRef( function Slider(props, ref) { const { marks: marksProp, label, showValue, ...rest } = props const value = props.defaultValue ?? props.value const marks = marksProp?.map((mark) => { if (typeof mark === "number") return { value: mark, label: undefined } return mark }) const hasMarkLabel = !!marks?.some((mark) => mark.label) return ( {label && !showValue && ( {label} )} {label && showValue && ( {label} )} ) }, ) function SliderThumbs(props: { value?: number[] }) { const { value } = props return ( {(_, index) => ( )} ) } interface SliderMarksProps { marks?: Array } const SliderMarks = React.forwardRef( function SliderMarks(props, ref) { const { marks } = props if (!marks?.length) return null return ( {marks.map((mark, index) => { const value = typeof mark === "number" ? mark : mark.value const label = typeof mark === "number" ? undefined : mark.label return ( {label} ) })} ) }, )