import type { FocusEvent } from 'react'; import type { SliderOnChangeData } from '@fluentui/react-components'; import { Label, Slider } from '@fluentui/react-components'; import type { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils'; import { ariaDescribedByIds, labelValue, rangeSpec } from '@rjsf/utils'; /** The `RangeWidget` component uses the `BaseInputTemplate` changing the type to `range` and wrapping the result * in a div, with the value along side it. * * @param props - The `WidgetProps` for this component */ export default function RangeWidget( props: WidgetProps, ) { const { value, readonly, disabled, onBlur, onFocus, options, schema, onChange, required, label, hideLabel, id } = props; const sliderProps = { value, label, id, name: id, ...rangeSpec(schema) }; const handleChange = (_: any, data: SliderOnChangeData) => { onChange(data.value ?? options.emptyValue); }; const handleBlur = ({ target }: FocusEvent) => onBlur(id, target?.value); const handleFocus = ({ target }: FocusEvent) => onFocus(id, target?.value); return ( <> {labelValue( , hideLabel, )} ); }