@@ -58,11 +58,19 @@ export const renderSliderMarks = (
5858 renderedMarks : SliderMarks ,
5959 vertical : boolean ,
6060 minMaxValues : { min_mark : number ; max_mark : number } ,
61- dots : boolean
61+ dots : boolean ,
62+ reverse = false
6263) => {
6364 return Object . entries ( renderedMarks ) . map ( ( [ position , mark ] ) => {
6465 const pos = parseFloat ( position ) ;
65- const thumbPosition = getRadixThumbPosition ( pos , minMaxValues ) ;
66+
67+ // When reversed, use the inverted value for positioning
68+ const displayPos = reverse
69+ ? minMaxValues . max_mark - pos + minMaxValues . min_mark
70+ : pos ;
71+
72+ const thumbPosition = getRadixThumbPosition ( displayPos , minMaxValues ) ;
73+
6674 const style = vertical
6775 ? {
6876 bottom : `calc(${ thumbPosition . percentage } % + ${ thumbPosition . offset } px - 13px)` ,
@@ -95,7 +103,8 @@ export const renderSliderMarks = (
95103export const renderSliderDots = (
96104 stepValue : number ,
97105 minMaxValues : { min_mark : number ; max_mark : number } ,
98- vertical : boolean
106+ vertical : boolean ,
107+ reverse = false
99108) => {
100109 if ( stepValue <= 1 ) {
101110 return null ;
@@ -117,7 +126,17 @@ export const renderSliderDots = (
117126 } ,
118127 ( _ , i ) => {
119128 const dotValue = minMaxValues . min_mark + i * stepValue ;
120- const thumbPosition = getRadixThumbPosition ( dotValue , minMaxValues ) ;
129+
130+ // When reversed, use the inverted value for positioning
131+ const displayValue = reverse
132+ ? minMaxValues . max_mark - dotValue + minMaxValues . min_mark
133+ : dotValue ;
134+
135+ const thumbPosition = getRadixThumbPosition (
136+ displayValue ,
137+ minMaxValues
138+ ) ;
139+
121140 const dotStyle = vertical
122141 ? {
123142 bottom : `calc(${ thumbPosition . percentage } % + ${ thumbPosition . offset } px)` ,
0 commit comments