Fix review comments

Signed-off-by: AmbrishRamachandiran <ambrish.r@infosys.com>
This commit is contained in:
AmbrishRamachandiran
2026-03-04 18:14:28 +05:30
parent 445fc101ac
commit d32f8282a5
2 changed files with 11 additions and 6 deletions
@@ -57,10 +57,12 @@ export const RangeSlider = forwardRef<HTMLDivElement, RangeSliderProps>(
const minValue = props.minValue ?? 0;
const maxValue = props.maxValue ?? 100;
const {
defaultValue = [minValue, maxValue] as [number, number],
...propsWithoutDefault
} = props;
const uncontrolledDefaultValue =
props.value === undefined
? ((props.defaultValue ??
([minValue, maxValue] as [number, number])) as [number, number])
: undefined;
const { defaultValue: _ignoredDefault, ...propsWithoutDefault } = props;
const { classNames, dataAttributes, style, cleanedProps } = useStyles(
RangeSliderDefinition,
@@ -68,7 +70,9 @@ export const RangeSlider = forwardRef<HTMLDivElement, RangeSliderProps>(
minValue,
maxValue,
step: 1,
defaultValue,
...(uncontrolledDefaultValue !== undefined
? { defaultValue: uncontrolledDefaultValue }
: {}),
...propsWithoutDefault,
},
);
@@ -97,7 +101,7 @@ export const RangeSlider = forwardRef<HTMLDivElement, RangeSliderProps>(
{...rest}
ref={ref}
>
<div className={styles['bui-RangeSliderHeader']}>
<div className={clsx(classNames.header, styles[classNames.header])}>
<FieldLabel
label={label}
secondaryLabel={secondaryLabelText}
@@ -23,6 +23,7 @@ import type { ComponentDefinition } from '../../types';
export const RangeSliderDefinition = {
classNames: {
root: 'bui-RangeSlider',
header: 'bui-RangeSliderHeader',
track: 'bui-RangeSliderTrack',
trackFill: 'bui-RangeSliderTrackFill',
thumb: 'bui-RangeSliderThumb',