diff --git a/packages/react/src/slider/control/SliderControl.test.tsx b/packages/react/src/slider/control/SliderControl.test.tsx index 9eef837772..4e55a7a590 100644 --- a/packages/react/src/slider/control/SliderControl.test.tsx +++ b/packages/react/src/slider/control/SliderControl.test.tsx @@ -7,7 +7,6 @@ import { NOOP } from '../../utils/noop'; const testRootContext: SliderRootContext = { active: -1, handleInputChange: NOOP, - direction: 'ltr', dragging: false, disabled: false, getFingerState: () => ({ diff --git a/packages/react/src/slider/indicator/SliderIndicator.test.tsx b/packages/react/src/slider/indicator/SliderIndicator.test.tsx index 63114597bb..04eb7806f9 100644 --- a/packages/react/src/slider/indicator/SliderIndicator.test.tsx +++ b/packages/react/src/slider/indicator/SliderIndicator.test.tsx @@ -7,7 +7,6 @@ import { NOOP } from '../../utils/noop'; const testRootContext: SliderRootContext = { active: -1, handleInputChange: NOOP, - direction: 'ltr', dragging: false, disabled: false, getFingerState: () => ({ diff --git a/packages/react/src/slider/indicator/SliderIndicator.tsx b/packages/react/src/slider/indicator/SliderIndicator.tsx index 7c09a0ae60..653d6d67b8 100644 --- a/packages/react/src/slider/indicator/SliderIndicator.tsx +++ b/packages/react/src/slider/indicator/SliderIndicator.tsx @@ -20,10 +20,9 @@ const SliderIndicator = React.forwardRef(function SliderIndicator( ) { const { render, className, ...otherProps } = props; - const { direction, disabled, orientation, state, percentageValues } = useSliderRootContext(); + const { disabled, orientation, state, percentageValues } = useSliderRootContext(); const { getRootProps } = useSliderIndicator({ - direction, disabled, orientation, percentageValues, diff --git a/packages/react/src/slider/indicator/useSliderIndicator.ts b/packages/react/src/slider/indicator/useSliderIndicator.ts index e8271ccb91..b8cef2d682 100644 --- a/packages/react/src/slider/indicator/useSliderIndicator.ts +++ b/packages/react/src/slider/indicator/useSliderIndicator.ts @@ -71,10 +71,7 @@ export function useSliderIndicator( export namespace useSliderIndicator { export interface Parameters - extends Pick< - useSliderRoot.ReturnValue, - 'direction' | 'disabled' | 'orientation' | 'percentageValues' - > {} + extends Pick {} export interface ReturnValue { getRootProps: (externalProps?: GenericHTMLProps) => GenericHTMLProps; diff --git a/packages/react/src/slider/root/SliderRoot.tsx b/packages/react/src/slider/root/SliderRoot.tsx index ad3e1cad8e..b0d56ac5b0 100644 --- a/packages/react/src/slider/root/SliderRoot.tsx +++ b/packages/react/src/slider/root/SliderRoot.tsx @@ -7,7 +7,6 @@ import { useBaseUiId } from '../../utils/useBaseUiId'; import { useComponentRenderer } from '../../utils/useComponentRenderer'; import type { FieldRoot } from '../../field/root/FieldRoot'; import { CompositeList } from '../../composite/list/CompositeList'; -import { useDirection } from '../../direction-provider/DirectionContext'; import { sliderStyleHookMapping } from './styleHooks'; import { useSliderRoot } from './useSliderRoot'; import { SliderRootContext } from './SliderRootContext'; @@ -46,7 +45,6 @@ const SliderRoot = React.forwardRef(function SliderRoot( } = props; const id = useBaseUiId(idProp); - const direction = useDirection(); const { labelId, state: fieldState, disabled: fieldDisabled } = useFieldRootContext(); const disabled = fieldDisabled || disabledProp; @@ -54,7 +52,6 @@ const SliderRoot = React.forwardRef(function SliderRoot( const { getRootProps, ...slider } = useSliderRoot({ 'aria-labelledby': ariaLabelledby ?? labelId ?? '', defaultValue, - direction, disabled, id: id ?? '', largeStep, diff --git a/packages/react/src/slider/root/useSliderRoot.ts b/packages/react/src/slider/root/useSliderRoot.ts index 7da886c635..1c3d0e6ae7 100644 --- a/packages/react/src/slider/root/useSliderRoot.ts +++ b/packages/react/src/slider/root/useSliderRoot.ts @@ -11,7 +11,7 @@ import { useEventCallback } from '../../utils/useEventCallback'; import { useForkRef } from '../../utils/useForkRef'; import { valueToPercent } from '../../utils/valueToPercent'; import type { CompositeMetadata } from '../../composite/list/CompositeList'; -import type { TextDirection } from '../../direction-provider/DirectionContext'; +import { useDirection } from '../../direction-provider/DirectionContext'; import { useField } from '../../field/useField'; import { useFieldRootContext } from '../../field/root/FieldRootContext'; import { useFieldControlValidation } from '../../field/control/useFieldControlValidation'; @@ -109,7 +109,6 @@ export function useSliderRoot(parameters: useSliderRoot.Parameters): useSliderRo const { 'aria-labelledby': ariaLabelledby, defaultValue, - direction = 'ltr', disabled = false, id, largeStep = 10, @@ -125,6 +124,7 @@ export function useSliderRoot(parameters: useSliderRoot.Parameters): useSliderRo value: valueProp, } = parameters; + const direction = useDirection(); const { setControlId, setTouched, setDirty, validityData } = useFieldRootContext(); const { @@ -375,7 +375,6 @@ export function useSliderRoot(parameters: useSliderRoot.Parameters): useSliderRo getRootProps, 'aria-labelledby': ariaLabelledby, active, - direction, disabled, dragging, getFingerState, @@ -404,7 +403,6 @@ export function useSliderRoot(parameters: useSliderRoot.Parameters): useSliderRo getRootProps, active, ariaLabelledby, - direction, disabled, dragging, getFingerState, @@ -460,11 +458,6 @@ export namespace useSliderRoot { * The default value. Use when the component is not controlled. */ defaultValue?: number | readonly number[]; - /** - * Sets the direction. For right-to-left languages, the lowest value is on the right-hand side. - * @default 'ltr' - */ - direction: TextDirection; /** * Whether the component should ignore user interaction. * @default false @@ -555,7 +548,6 @@ export namespace useSliderRoot { event: React.KeyboardEvent | React.ChangeEvent, ) => void; dragging: boolean; - direction: TextDirection; disabled: boolean; getFingerState: ( fingerPosition: FingerPosition | null, diff --git a/packages/react/src/slider/thumb/SliderThumb.test.tsx b/packages/react/src/slider/thumb/SliderThumb.test.tsx index fa7b44a92f..55b4d7c727 100644 --- a/packages/react/src/slider/thumb/SliderThumb.test.tsx +++ b/packages/react/src/slider/thumb/SliderThumb.test.tsx @@ -7,7 +7,6 @@ import { NOOP } from '../../utils/noop'; const testRootContext: SliderRootContext = { active: -1, handleInputChange: NOOP, - direction: 'ltr', dragging: false, disabled: false, getFingerState: () => ({ diff --git a/packages/react/src/slider/thumb/SliderThumb.tsx b/packages/react/src/slider/thumb/SliderThumb.tsx index a7b53f4433..0f3b166457 100644 --- a/packages/react/src/slider/thumb/SliderThumb.tsx +++ b/packages/react/src/slider/thumb/SliderThumb.tsx @@ -62,7 +62,6 @@ const SliderThumb = React.forwardRef(function SliderThumb( active: activeIndex, 'aria-labelledby': ariaLabelledby, handleInputChange, - direction, disabled: contextDisabled, format = null, largeStep, @@ -91,7 +90,6 @@ const SliderThumb = React.forwardRef(function SliderThumb( 'aria-labelledby': ariaLabelledby ?? '', 'aria-valuetext': ariaValuetext ?? '', handleInputChange, - direction, disabled: disabledProp || contextDisabled, format, getAriaLabel: getAriaLabelProp ?? null, diff --git a/packages/react/src/slider/thumb/useSliderThumb.ts b/packages/react/src/slider/thumb/useSliderThumb.ts index 86db210a24..b0e8c1042a 100644 --- a/packages/react/src/slider/thumb/useSliderThumb.ts +++ b/packages/react/src/slider/thumb/useSliderThumb.ts @@ -14,6 +14,7 @@ import { END, } from '../../composite/composite'; import { useCompositeListItem } from '../../composite/list/useCompositeListItem'; +import { useDirection } from '../../direction-provider/DirectionContext'; import { useFieldControlValidation } from '../../field/control/useFieldControlValidation'; import { useFieldRootContext } from '../../field/root/FieldRootContext'; import { getSliderValue } from '../utils/getSliderValue'; @@ -60,7 +61,6 @@ export function useSliderThumb(parameters: useSliderThumb.Parameters): useSlider 'aria-labelledby': ariaLabelledby, 'aria-valuetext': ariaValuetext, handleInputChange, - direction, disabled, format, getAriaLabel = null, @@ -80,6 +80,7 @@ export function useSliderThumb(parameters: useSliderThumb.Parameters): useSlider values: sliderValues, } = parameters; + const direction = useDirection(); const { setTouched } = useFieldRootContext(); const { getInputValidationProps, @@ -316,7 +317,6 @@ export namespace useSliderThumb { | 'active' | 'aria-labelledby' | 'handleInputChange' - | 'direction' | 'largeStep' | 'max' | 'min' diff --git a/packages/react/src/slider/track/SliderTrack.test.tsx b/packages/react/src/slider/track/SliderTrack.test.tsx index aca1fb5d5b..4219709da6 100644 --- a/packages/react/src/slider/track/SliderTrack.test.tsx +++ b/packages/react/src/slider/track/SliderTrack.test.tsx @@ -7,7 +7,6 @@ import { NOOP } from '../../utils/noop'; const testRootContext: SliderRootContext = { active: -1, handleInputChange: NOOP, - direction: 'ltr', dragging: false, disabled: false, getFingerState: () => ({ diff --git a/packages/react/src/slider/value/SliderValue.test.tsx b/packages/react/src/slider/value/SliderValue.test.tsx index ed960c2601..3d6e62f2e0 100644 --- a/packages/react/src/slider/value/SliderValue.test.tsx +++ b/packages/react/src/slider/value/SliderValue.test.tsx @@ -9,7 +9,6 @@ import { NOOP } from '../../utils/noop'; const testRootContext: SliderRootContext = { active: -1, handleInputChange: NOOP, - direction: 'ltr', dragging: false, disabled: false, getFingerState: () => ({