related-ui-components 3.2.9 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/module/components/Card/templates/SelaDealCard.js +0 -10
- package/lib/module/components/Card/templates/SelaDealCard.js.map +1 -1
- package/lib/module/components/RangeSlider/RangeSlider.js +103 -14
- package/lib/module/components/RangeSlider/RangeSlider.js.map +1 -1
- package/lib/typescript/src/components/Card/templates/SelaDealCard.d.ts.map +1 -1
- package/lib/typescript/src/components/RangeSlider/RangeSlider.d.ts +7 -0
- package/lib/typescript/src/components/RangeSlider/RangeSlider.d.ts.map +1 -1
- package/package.json +81 -81
- package/src/components/Card/templates/SelaDealCard.tsx +0 -11
- package/src/components/RangeSlider/RangeSlider.tsx +141 -36
|
@@ -5,7 +5,6 @@ import { View, StyleSheet, Image } from "react-native";
|
|
|
5
5
|
import Card from "../Card.js";
|
|
6
6
|
import { useTheme } from "../../../theme/ThemeContext.js";
|
|
7
7
|
import { LockOverlay } from "../../LockOverlay/index.js";
|
|
8
|
-
import { BlurView } from "expo-blur";
|
|
9
8
|
import { ThemedText as Text } from "../../ui/index.js";
|
|
10
9
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
10
|
const SelaDealCard = ({
|
|
@@ -141,15 +140,6 @@ const SelaDealCard = ({
|
|
|
141
140
|
style: descriptionTextStyle,
|
|
142
141
|
children: description
|
|
143
142
|
})]
|
|
144
|
-
}), price && priceContainerBlur && /*#__PURE__*/_jsx(BlurView, {
|
|
145
|
-
experimentalBlurMethod: "dimezisBlurView",
|
|
146
|
-
intensity: priceContainerBlur,
|
|
147
|
-
tint: "dark",
|
|
148
|
-
style: finalPriceContainerStyle,
|
|
149
|
-
children: /*#__PURE__*/_jsx(Text, {
|
|
150
|
-
style: finalPriceStyle,
|
|
151
|
-
children: price
|
|
152
|
-
})
|
|
153
143
|
}), price && !priceContainerBlur && /*#__PURE__*/_jsx(View, {
|
|
154
144
|
style: [{
|
|
155
145
|
backgroundColor: theme.primary
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useEffect","useState","View","StyleSheet","Image","Card","useTheme","LockOverlay","
|
|
1
|
+
{"version":3,"names":["React","useEffect","useState","View","StyleSheet","Image","Card","useTheme","LockOverlay","ThemedText","Text","jsx","_jsx","jsxs","_jsxs","SelaDealCard","variant","backgroundImage","label","labelStyle","labelContainerStyle","providerName","providerNameStyle","description","descriptionStyle","price","priceStyle","priceContainerStyle","itemId","onPress","style","width","height","isRTL","propIsRTL","borderRadius","darkOverlayEnabled","darkOverlayColor","lockOverlay","lockIcon","priceContainerBlur","showGrayscale","gestureHandler","theme","themeIsRTL","undefined","styles","getStyles","dynamicHeight","setDynamicHeight","uri","getSize","imgWidth","imgHeight","aspectRatio","finalLabelContainerStyle","labelContainerBase","finalLabelStyle","labelTextBase","finalPriceContainerStyle","priceContainerBase","priceContainerHorizontal","priceContainerVertical","finalPriceStyle","priceTextBase","providerTextStyle","providerNameBase","color","onSurface","descriptionTextStyle","descriptionBase","cardBase","greyscale","source","resizeMode","id","children","absoluteFill","backgroundColor","visible","contentPosition","icon","text","overlayOpacity","overlayContainer","topSection","bottomContentHorizontal","textBlockHorizontal","bottomContentVertical","textBlockVertical","primary","create","overflow","position","flex","padding","justifyContent","flexDirection","paddingVertical","paddingHorizontal","background","fontWeight","fontSize","onBackground","marginBottom","secondary","helper","onPrimary","alignItems","marginRight","alignSelf"],"sourceRoot":"..\\..\\..\\..\\..\\src","sources":["components/Card/templates/SelaDealCard.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAClD,SAIEC,IAAI,EAGJC,UAAU,EACVC,KAAK,QAGA,cAAc;AACrB,OAAOC,IAAI,MAAM,YAAS;AAC1B,SAASC,QAAQ,QAAQ,gCAA6B;AAEtD,SAASC,WAAW,QAAQ,4BAAmB;AAC/C,SAASC,UAAU,IAAIC,IAA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pBF,UAAU,EAAE;EACd;AACF,CAAC,CAAC;AAEJ,eAAe7F,YAAY","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import React, { useCallback, useState } from "react";
|
|
3
|
+
import React, { useCallback, useMemo, useState } from "react";
|
|
4
4
|
import { I18nManager, StyleSheet, View } from "react-native";
|
|
5
5
|
import { Gesture, GestureDetector } from "react-native-gesture-handler";
|
|
6
6
|
import Animated, { runOnJS, useAnimatedStyle, useSharedValue } from "react-native-reanimated";
|
|
@@ -10,6 +10,49 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
10
10
|
const THUMB_SIZE = 28;
|
|
11
11
|
const RAIL_HEIGHT = 6;
|
|
12
12
|
const LABEL_HEIGHT = 26;
|
|
13
|
+
/**
|
|
14
|
+
* Creates percentile breakpoints from data
|
|
15
|
+
* Returns sorted unique values that represent the distribution
|
|
16
|
+
*/
|
|
17
|
+
function createPercentileBreakpoints(data) {
|
|
18
|
+
const sorted = [...new Set(data)].sort((a, b) => a - b);
|
|
19
|
+
|
|
20
|
+
// If small dataset, use all unique values
|
|
21
|
+
if (sorted.length <= 100) {
|
|
22
|
+
return sorted;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// For larger datasets, sample at percentile intervals
|
|
26
|
+
const breakpoints = [];
|
|
27
|
+
const numBreakpoints = 100;
|
|
28
|
+
for (let i = 0; i <= numBreakpoints; i++) {
|
|
29
|
+
const index = Math.floor(i / numBreakpoints * (sorted.length - 1));
|
|
30
|
+
const value = sorted[index];
|
|
31
|
+
if (breakpoints[breakpoints.length - 1] !== value) {
|
|
32
|
+
breakpoints.push(value);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return breakpoints;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Binary search to find position in breakpoints
|
|
40
|
+
*/
|
|
41
|
+
function findBreakpointIndex(breakpoints, value) {
|
|
42
|
+
"worklet";
|
|
43
|
+
|
|
44
|
+
let left = 0;
|
|
45
|
+
let right = breakpoints.length - 1;
|
|
46
|
+
while (left < right) {
|
|
47
|
+
const mid = Math.floor((left + right) / 2);
|
|
48
|
+
if (breakpoints[mid] < value) {
|
|
49
|
+
left = mid + 1;
|
|
50
|
+
} else {
|
|
51
|
+
right = mid;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return left;
|
|
55
|
+
}
|
|
13
56
|
const RangeSlider = ({
|
|
14
57
|
min,
|
|
15
58
|
max,
|
|
@@ -18,7 +61,9 @@ const RangeSlider = ({
|
|
|
18
61
|
initialMinValue,
|
|
19
62
|
initialMaxValue,
|
|
20
63
|
onValueChange,
|
|
21
|
-
theme
|
|
64
|
+
theme,
|
|
65
|
+
scale = "linear",
|
|
66
|
+
dataPoints
|
|
22
67
|
}) => {
|
|
23
68
|
const {
|
|
24
69
|
theme: defaultTheme
|
|
@@ -26,25 +71,72 @@ const RangeSlider = ({
|
|
|
26
71
|
const currTheme = theme || defaultTheme;
|
|
27
72
|
const styles = getStyles(currTheme);
|
|
28
73
|
const isRTL = I18nManager.isRTL;
|
|
29
|
-
|
|
30
|
-
// State for label text values, passed down to the SliderLabels component
|
|
31
74
|
const [leftLabel, setLeftLabel] = useState(initialMinValue.toLocaleString());
|
|
32
75
|
const [rightLabel, setRightLabel] = useState(initialMaxValue.toLocaleString());
|
|
76
|
+
|
|
77
|
+
// Pre-compute breakpoints for percentile scale
|
|
78
|
+
const breakpoints = useMemo(() => {
|
|
79
|
+
if (scale === "percentile" && dataPoints?.length) {
|
|
80
|
+
return createPercentileBreakpoints(dataPoints);
|
|
81
|
+
}
|
|
82
|
+
return [];
|
|
83
|
+
}, [scale, dataPoints]);
|
|
84
|
+
const safeMin = scale === "logarithmic" ? Math.max(min, 0.001) : min;
|
|
33
85
|
const valueToPosition = useCallback(value => {
|
|
34
86
|
"worklet";
|
|
35
87
|
|
|
36
|
-
|
|
37
|
-
|
|
88
|
+
let percentage;
|
|
89
|
+
if (scale === "percentile" && breakpoints.length > 1) {
|
|
90
|
+
// Find where this value falls in the breakpoints
|
|
91
|
+
const index = findBreakpointIndex(breakpoints, value);
|
|
92
|
+
if (index === 0) {
|
|
93
|
+
percentage = 0;
|
|
94
|
+
} else if (index >= breakpoints.length - 1) {
|
|
95
|
+
percentage = 1;
|
|
96
|
+
} else {
|
|
97
|
+
// Interpolate between breakpoints
|
|
98
|
+
const lowerVal = breakpoints[index - 1];
|
|
99
|
+
const upperVal = breakpoints[index];
|
|
100
|
+
const lowerPct = (index - 1) / (breakpoints.length - 1);
|
|
101
|
+
const upperPct = index / (breakpoints.length - 1);
|
|
102
|
+
if (upperVal === lowerVal) {
|
|
103
|
+
percentage = lowerPct;
|
|
104
|
+
} else {
|
|
105
|
+
const ratio = (value - lowerVal) / (upperVal - lowerVal);
|
|
106
|
+
percentage = lowerPct + ratio * (upperPct - lowerPct);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
} else if (scale === "logarithmic") {
|
|
110
|
+
const logMin = Math.log(safeMin);
|
|
111
|
+
const logMax = Math.log(max);
|
|
112
|
+
const logValue = Math.log(Math.max(value, safeMin));
|
|
113
|
+
percentage = (logValue - logMin) / (logMax - logMin);
|
|
114
|
+
} else {
|
|
115
|
+
percentage = (value - min) / (max - min);
|
|
116
|
+
}
|
|
38
117
|
return isRTL ? (1 - percentage) * sliderWidth : percentage * sliderWidth;
|
|
39
|
-
}, [min, max, sliderWidth, isRTL]);
|
|
118
|
+
}, [min, max, safeMin, sliderWidth, isRTL, scale, breakpoints]);
|
|
40
119
|
const positionToValue = useCallback(position => {
|
|
41
120
|
"worklet";
|
|
42
121
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
122
|
+
const percentage = isRTL ? 1 - position / sliderWidth : position / sliderWidth;
|
|
123
|
+
let rawValue;
|
|
124
|
+
if (scale === "percentile" && breakpoints.length > 1) {
|
|
125
|
+
// Map percentage to breakpoint index
|
|
126
|
+
const exactIndex = percentage * (breakpoints.length - 1);
|
|
127
|
+
const lowerIndex = Math.floor(exactIndex);
|
|
128
|
+
const upperIndex = Math.min(lowerIndex + 1, breakpoints.length - 1);
|
|
129
|
+
const ratio = exactIndex - lowerIndex;
|
|
130
|
+
rawValue = breakpoints[lowerIndex] + ratio * (breakpoints[upperIndex] - breakpoints[lowerIndex]);
|
|
131
|
+
} else if (scale === "logarithmic") {
|
|
132
|
+
const logMin = Math.log(safeMin);
|
|
133
|
+
const logMax = Math.log(max);
|
|
134
|
+
rawValue = Math.exp(logMin + percentage * (logMax - logMin));
|
|
135
|
+
} else {
|
|
136
|
+
rawValue = percentage * (max - min) + min;
|
|
137
|
+
}
|
|
46
138
|
return Math.round(rawValue / step) * step;
|
|
47
|
-
}, [min, max, step, sliderWidth, isRTL]);
|
|
139
|
+
}, [min, max, safeMin, step, sliderWidth, isRTL, scale, breakpoints]);
|
|
48
140
|
const leftPosition = useSharedValue(valueToPosition(initialMinValue));
|
|
49
141
|
const rightPosition = useSharedValue(valueToPosition(initialMaxValue));
|
|
50
142
|
const context = useSharedValue({
|
|
@@ -68,8 +160,6 @@ const RangeSlider = ({
|
|
|
68
160
|
}).onUpdate(e => {
|
|
69
161
|
if (activeThumb.value === null) return;
|
|
70
162
|
const newPos = context.value.x + e.translationX;
|
|
71
|
-
|
|
72
|
-
// 5. Adjust clamping logic for RTL
|
|
73
163
|
if (activeThumb.value === "left") {
|
|
74
164
|
const lowerBound = isRTL ? rightPosition.value + THUMB_SIZE : 0;
|
|
75
165
|
const upperBound = isRTL ? sliderWidth : rightPosition.value - THUMB_SIZE;
|
|
@@ -104,7 +194,6 @@ const RangeSlider = ({
|
|
|
104
194
|
}]
|
|
105
195
|
}));
|
|
106
196
|
const animatedActiveRailStyle = useAnimatedStyle(() => {
|
|
107
|
-
// 6. Use Math.min and Math.max to correctly draw the active rail in both LTR and RTL
|
|
108
197
|
const start = Math.min(leftPosition.value, rightPosition.value);
|
|
109
198
|
const end = Math.max(leftPosition.value, rightPosition.value);
|
|
110
199
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useCallback","useState","I18nManager","StyleSheet","View","Gesture","GestureDetector","Animated","runOnJS","useAnimatedStyle","useSharedValue","SliderLabels","useTheme","jsx","_jsx","jsxs","_jsxs","THUMB_SIZE","RAIL_HEIGHT","LABEL_HEIGHT","RangeSlider","min","max","step","sliderWidth","initialMinValue","initialMaxValue","onValueChange","theme","defaultTheme","currTheme","styles","getStyles","isRTL","leftLabel","setLeftLabel","toLocaleString","rightLabel","setRightLabel","valueToPosition","value","percentage","positionToValue","position","rawValue","Math","round","leftPosition","rightPosition","context","x","activeThumb","panGesture","Pan","onBegin","e","distToLeft","abs","distToRight","onUpdate","newPos","translationX","lowerBound","upperBound","clampedPos","onEnd","finalLeftValue","finalRightValue","animatedLeftThumbStyle","transform","translateX","animatedRightThumbStyle","animatedActiveRailStyle","start","end","left","right","style","container","width","children","leftValue","rightValue","thumbSize","gesture","railContainer","rail","activeRail","thumbContainer","thumb","create","height","justifyContent","marginTop","direction","borderRadius","backgroundColor","surface","primary","alignItems","background","borderColor","borderWidth"],"sourceRoot":"..\\..\\..\\..\\src","sources":["components/RangeSlider/RangeSlider.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,QAAQ,QAAQ,OAAO;AACpD,SAASC,WAAW,EAAEC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAC5D,SAASC,OAAO,EAAEC,eAAe,QAAQ,8BAA8B;AACvE,OAAOC,QAAQ,IACbC,OAAO,EACPC,gBAAgB,EAChBC,cAAc,QACT,yBAAyB;AAChC,SAASC,YAAY,QAAQ,kBAAe;AAC5C,SAAoBC,QAAQ,QAAQ,sBAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAElD,MAAMC,UAAU,GAAG,EAAE;AACrB,MAAMC,WAAW,GAAG,CAAC;A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7B8E,eAAe,EAAEpE,KAAK,CAACqE;EACzB,CAAC;EACDV,UAAU,EAAE;IACVI,MAAM,EAAEzE,WAAW;IACnB8E,eAAe,EAAEpE,KAAK,CAACsE,OAAO;IAC9BvD,QAAQ,EAAE;EACZ,CAAC;EACD6C,cAAc,EAAE;IACd7C,QAAQ,EAAE,UAAU;IACpBoC,KAAK,EAAE9D,UAAU;IACjB0E,MAAM,EAAE1E,UAAU;IAClB2E,cAAc,EAAE,QAAQ;IACxBO,UAAU,EAAE;EACd,CAAC;EACDV,KAAK,EAAE;IACLV,KAAK,EAAE9D,UAAU;IACjB0E,MAAM,EAAE1E,UAAU;IAClB8E,YAAY,EAAE9E,UAAU,GAAG,CAAC;IAC5B+E,eAAe,EAAEpE,KAAK,CAACwE,UAAU;IACjCC,WAAW,EAAEzE,KAAK,CAACsE,OAAO;IAC1BI,WAAW,EAAE;EACf;AACF,CAAC,CAAC;AAEJ,eAAelF,WAAW","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","useCallback","useMemo","useState","I18nManager","StyleSheet","View","Gesture","GestureDetector","Animated","runOnJS","useAnimatedStyle","useSharedValue","SliderLabels","useTheme","jsx","_jsx","jsxs","_jsxs","THUMB_SIZE","RAIL_HEIGHT","LABEL_HEIGHT","createPercentileBreakpoints","data","sorted","Set","sort","a","b","length","breakpoints","numBreakpoints","i","index","Math","floor","value","push","findBreakpointIndex","left","right","mid","RangeSlider","min","max","step","sliderWidth","initialMinValue","initialMaxValue","onValueChange","theme","scale","dataPoints","defaultTheme","currTheme","styles","getStyles","isRTL","leftLabel","setLeftLabel","toLocaleString","rightLabel","setRightLabel","safeMin","valueToPosition","percentage","lowerVal","upperVal","lowerPct","upperPct","ratio","logMin","log","logMax","logValue","positionToValue","position","rawValue","exactIndex","lowerIndex","upperIndex","exp","round","leftPosition","rightPosition","context","x","activeThumb","panGesture","Pan","onBegin","e","distToLeft","abs","distToRight","onUpdate","newPos","translationX","lowerBound","upperBound","clampedPos","onEnd","finalLeftValue","finalRightValue","animatedLeftThumbStyle","transform","translateX","animatedRightThumbStyle","animatedActiveRailStyle","start","end","style","container","width","children","leftValue","rightValue","thumbSize","gesture","railContainer","rail","activeRail","thumbContainer","thumb","create","height","justifyContent","marginTop","direction","borderRadius","backgroundColor","surface","primary","alignItems","background","borderColor","borderWidth"],"sourceRoot":"..\\..\\..\\..\\src","sources":["components/RangeSlider/RangeSlider.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAC7D,SAASC,WAAW,EAAEC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAC5D,SAASC,OAAO,EAAEC,eAAe,QAAQ,8BAA8B;AACvE,OAAOC,QAAQ,IACbC,OAAO,EACPC,gBAAgB,EAChBC,cAAc,QACT,yBAAyB;AAChC,SAASC,YAAY,QAAQ,kBAAe;AAC5C,SAAoBC,QAAQ,QAAQ,sBAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAElD,MAAMC,UAAU,GAAG,EAAE;AACrB,MAAMC,WAAW,GAAG,CAAC;AACrB,MAAMC,YAAY,GAAG,EAAE;AAqBvB;AACA;AACA;AACA;AACA,SAASC,2BAA2BA,CAACC,IAAc,EAAY;EAC7D,MAAMC,MAAM,GAAG,CAAC,GAAG,IAAIC,GAAG,CAACF,IAAI,CAAC,CAAC,CAACG,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,GAAGC,CAAC,CAAC;;EAEvD;EACA,IAAIJ,MAAM,CAACK,MAAM,IAAI,GAAG,EAAE;IACxB,OAAOL,MAAM;EACf;;EAEA;EACA,MAAMM,WAAqB,GAAG,EAAE;EAChC,MAAMC,cAAc,GAAG,GAAG;EAE1B,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,IAAID,cAAc,EAAEC,CAAC,EAAE,EAAE;IACxC,MAAMC,KAAK,GAAGC,IAAI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ACDV,KAAK,EAAE;IACLV,KAAK,EAAE9F,UAAU;IACjB0G,MAAM,EAAE1G,UAAU;IAClB8G,YAAY,EAAE9G,UAAU,GAAG,CAAC;IAC5B+G,eAAe,EAAEhF,KAAK,CAACoF,UAAU;IACjCC,WAAW,EAAErF,KAAK,CAACkF,OAAO;IAC1BI,WAAW,EAAE;EACf;AACF,CAAC,CAAC;AAEJ,eAAe9F,WAAW","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelaDealCard.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Card/templates/SelaDealCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AACnD,OAAO,EAEL,SAAS,EACT,SAAS,EAET,SAAS,EACT,cAAc,EAGd,cAAc,EAEf,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"SelaDealCard.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Card/templates/SelaDealCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AACnD,OAAO,EAEL,SAAS,EACT,SAAS,EAET,SAAS,EACT,cAAc,EAGd,cAAc,EAEf,MAAM,cAAc,CAAC;AAOtB,UAAU,iBAAiB;IACzB,OAAO,EAAE,YAAY,GAAG,UAAU,CAAC;IACnC,eAAe,EAAE,cAAc,CAAC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAClC,mBAAmB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC3C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAClC,mBAAmB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC3C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB;AAED,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAsL7C,CAAC;AAsEF,eAAe,YAAY,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ThemeType } from "../../theme";
|
|
3
|
+
type ScaleType = "linear" | "logarithmic" | "percentile";
|
|
3
4
|
interface RangeSliderProps {
|
|
4
5
|
min: number;
|
|
5
6
|
max: number;
|
|
@@ -12,6 +13,12 @@ interface RangeSliderProps {
|
|
|
12
13
|
max: number;
|
|
13
14
|
}) => void;
|
|
14
15
|
theme?: ThemeType;
|
|
16
|
+
scale?: ScaleType;
|
|
17
|
+
/**
|
|
18
|
+
* For percentile scale: array of all values in your dataset
|
|
19
|
+
* The slider will distribute positions based on data density
|
|
20
|
+
*/
|
|
21
|
+
dataPoints?: number[];
|
|
15
22
|
}
|
|
16
23
|
declare const RangeSlider: React.FC<RangeSliderProps>;
|
|
17
24
|
export default RangeSlider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RangeSlider.d.ts","sourceRoot":"","sources":["../../../../../src/components/RangeSlider/RangeSlider.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"RangeSlider.d.ts","sourceRoot":"","sources":["../../../../../src/components/RangeSlider/RangeSlider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAS9D,OAAO,EAAE,SAAS,EAAY,MAAM,aAAa,CAAC;AAMlD,KAAK,SAAS,GAAG,QAAQ,GAAG,aAAa,GAAG,YAAY,CAAC;AAEzD,UAAU,gBAAgB;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,CAAC,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC9D,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAiDD,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAwM3C,CAAC;AAyCF,eAAe,WAAW,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "related-ui-components",
|
|
3
|
-
"version": "3.
|
|
4
|
-
"main": "
|
|
5
|
-
"scripts": {
|
|
6
|
-
"start": "expo start",
|
|
7
|
-
"android": "expo start --android",
|
|
8
|
-
"ios": "expo start --ios",
|
|
9
|
-
"web": "expo start --web",
|
|
10
|
-
"prepare": "bob build"
|
|
11
|
-
},
|
|
12
|
-
"peerDependencies": {
|
|
13
|
-
"@expo/vector-icons": ">=14.1.0",
|
|
14
|
-
"@gorhom/bottom-sheet": ">=5.1.6",
|
|
15
|
-
"@ptomasroos/react-native-multi-slider": ">=2.2.2",
|
|
16
|
-
"@react-native-community/slider": ">=4.5.6",
|
|
17
|
-
"@react-native-picker/picker": ">=2.11.1",
|
|
18
|
-
"@shopify/react-native-skia": ">=v2.0.0-next.4",
|
|
19
|
-
"country-telephone-data": ">=0.6.3",
|
|
20
|
-
"date-fns": ">=4.1.0",
|
|
21
|
-
"expo": "53.0.20",
|
|
22
|
-
"expo-blur": ">=14.1.5",
|
|
23
|
-
"expo-checkbox": ">=4.1.4",
|
|
24
|
-
"expo-clipboard": ">=7.1.4",
|
|
25
|
-
"expo-image": ">=2.4.0",
|
|
26
|
-
"expo-linear-gradient": ">=14.1.5",
|
|
27
|
-
"expo-status-bar": ">=2.2.3",
|
|
28
|
-
"react": "19.0.0",
|
|
29
|
-
"react-native": "0.79.5",
|
|
30
|
-
"react-native-calendars": ">=1.1312.0",
|
|
31
|
-
"react-native-gesture-handler": ">=2.24.0",
|
|
32
|
-
"react-native-picker-select": ">=9.3.1",
|
|
33
|
-
"react-native-qrcode-svg": ">=6.3.15",
|
|
34
|
-
"react-native-safe-area-context": ">=5.4.0",
|
|
35
|
-
"react-native-svg": ">=15.11.2",
|
|
36
|
-
"react-native-color-matrix-image-filters": ">=7.0.2",
|
|
37
|
-
"react-native-toast-message": ">=2.3.3",
|
|
38
|
-
"react-native-reanimated": ">=3.0.0"
|
|
39
|
-
},
|
|
40
|
-
"devDependencies": {
|
|
41
|
-
"@babel/core": "^7.25.2",
|
|
42
|
-
"@types/country-telephone-data": "^0.6.3",
|
|
43
|
-
"@types/react": "~19.0.10",
|
|
44
|
-
"react-native-builder-bob": "^0.40.11",
|
|
45
|
-
"typescript": "~5.8.3"
|
|
46
|
-
},
|
|
47
|
-
"private": false,
|
|
48
|
-
"exports": {
|
|
49
|
-
".": {
|
|
50
|
-
"source": "./src\\index.ts",
|
|
51
|
-
"types": "./lib\\typescript\\src\\index.d.ts",
|
|
52
|
-
"default": "./lib\\module\\index.js"
|
|
53
|
-
},
|
|
54
|
-
"./package.json": "./package.json"
|
|
55
|
-
},
|
|
56
|
-
"types": "./lib\\typescript\\src\\index.d.ts",
|
|
57
|
-
"files": [
|
|
58
|
-
"src",
|
|
59
|
-
"lib",
|
|
60
|
-
"!**/__tests__",
|
|
61
|
-
"!**/__fixtures__",
|
|
62
|
-
"!**/__mocks__"
|
|
63
|
-
],
|
|
64
|
-
"react-native-builder-bob": {
|
|
65
|
-
"source": "src",
|
|
66
|
-
"output": "lib",
|
|
67
|
-
"targets": [
|
|
68
|
-
[
|
|
69
|
-
"module",
|
|
70
|
-
{
|
|
71
|
-
"esm": true
|
|
72
|
-
}
|
|
73
|
-
],
|
|
74
|
-
"typescript"
|
|
75
|
-
]
|
|
76
|
-
},
|
|
77
|
-
"eslintIgnore": [
|
|
78
|
-
"node_modules/",
|
|
79
|
-
"lib/"
|
|
80
|
-
]
|
|
81
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "related-ui-components",
|
|
3
|
+
"version": "3.3.0",
|
|
4
|
+
"main": "lib/module/index.js",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"start": "expo start",
|
|
7
|
+
"android": "expo start --android",
|
|
8
|
+
"ios": "expo start --ios",
|
|
9
|
+
"web": "expo start --web",
|
|
10
|
+
"prepare": "bob build"
|
|
11
|
+
},
|
|
12
|
+
"peerDependencies": {
|
|
13
|
+
"@expo/vector-icons": ">=14.1.0",
|
|
14
|
+
"@gorhom/bottom-sheet": ">=5.1.6",
|
|
15
|
+
"@ptomasroos/react-native-multi-slider": ">=2.2.2",
|
|
16
|
+
"@react-native-community/slider": ">=4.5.6",
|
|
17
|
+
"@react-native-picker/picker": ">=2.11.1",
|
|
18
|
+
"@shopify/react-native-skia": ">=v2.0.0-next.4",
|
|
19
|
+
"country-telephone-data": ">=0.6.3",
|
|
20
|
+
"date-fns": ">=4.1.0",
|
|
21
|
+
"expo": "53.0.20",
|
|
22
|
+
"expo-blur": ">=14.1.5",
|
|
23
|
+
"expo-checkbox": ">=4.1.4",
|
|
24
|
+
"expo-clipboard": ">=7.1.4",
|
|
25
|
+
"expo-image": ">=2.4.0",
|
|
26
|
+
"expo-linear-gradient": ">=14.1.5",
|
|
27
|
+
"expo-status-bar": ">=2.2.3",
|
|
28
|
+
"react": "19.0.0",
|
|
29
|
+
"react-native": "0.79.5",
|
|
30
|
+
"react-native-calendars": ">=1.1312.0",
|
|
31
|
+
"react-native-gesture-handler": ">=2.24.0",
|
|
32
|
+
"react-native-picker-select": ">=9.3.1",
|
|
33
|
+
"react-native-qrcode-svg": ">=6.3.15",
|
|
34
|
+
"react-native-safe-area-context": ">=5.4.0",
|
|
35
|
+
"react-native-svg": ">=15.11.2",
|
|
36
|
+
"react-native-color-matrix-image-filters": ">=7.0.2",
|
|
37
|
+
"react-native-toast-message": ">=2.3.3",
|
|
38
|
+
"react-native-reanimated": ">=3.0.0"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@babel/core": "^7.25.2",
|
|
42
|
+
"@types/country-telephone-data": "^0.6.3",
|
|
43
|
+
"@types/react": "~19.0.10",
|
|
44
|
+
"react-native-builder-bob": "^0.40.11",
|
|
45
|
+
"typescript": "~5.8.3"
|
|
46
|
+
},
|
|
47
|
+
"private": false,
|
|
48
|
+
"exports": {
|
|
49
|
+
".": {
|
|
50
|
+
"source": "./src\\index.ts",
|
|
51
|
+
"types": "./lib\\typescript\\src\\index.d.ts",
|
|
52
|
+
"default": "./lib\\module\\index.js"
|
|
53
|
+
},
|
|
54
|
+
"./package.json": "./package.json"
|
|
55
|
+
},
|
|
56
|
+
"types": "./lib\\typescript\\src\\index.d.ts",
|
|
57
|
+
"files": [
|
|
58
|
+
"src",
|
|
59
|
+
"lib",
|
|
60
|
+
"!**/__tests__",
|
|
61
|
+
"!**/__fixtures__",
|
|
62
|
+
"!**/__mocks__"
|
|
63
|
+
],
|
|
64
|
+
"react-native-builder-bob": {
|
|
65
|
+
"source": "src",
|
|
66
|
+
"output": "lib",
|
|
67
|
+
"targets": [
|
|
68
|
+
[
|
|
69
|
+
"module",
|
|
70
|
+
{
|
|
71
|
+
"esm": true
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
"typescript"
|
|
75
|
+
]
|
|
76
|
+
},
|
|
77
|
+
"eslintIgnore": [
|
|
78
|
+
"node_modules/",
|
|
79
|
+
"lib/"
|
|
80
|
+
]
|
|
81
|
+
}
|
|
@@ -15,7 +15,6 @@ import Card from "../Card";
|
|
|
15
15
|
import { useTheme } from "../../../theme/ThemeContext";
|
|
16
16
|
import { ThemeType } from "../../../theme";
|
|
17
17
|
import { LockOverlay } from "../../LockOverlay";
|
|
18
|
-
import { BlurView } from "expo-blur";
|
|
19
18
|
import { ThemedText as Text } from "../../ui";
|
|
20
19
|
|
|
21
20
|
interface SelaDealCardProps {
|
|
@@ -219,16 +218,6 @@ const SelaDealCard: React.FC<SelaDealCardProps> = ({
|
|
|
219
218
|
<Text style={descriptionTextStyle}>{description}</Text>
|
|
220
219
|
)}
|
|
221
220
|
</View>
|
|
222
|
-
{price && priceContainerBlur && (
|
|
223
|
-
<BlurView
|
|
224
|
-
experimentalBlurMethod="dimezisBlurView"
|
|
225
|
-
intensity={priceContainerBlur}
|
|
226
|
-
tint="dark"
|
|
227
|
-
style={finalPriceContainerStyle}
|
|
228
|
-
>
|
|
229
|
-
<Text style={finalPriceStyle}>{price}</Text>
|
|
230
|
-
</BlurView>
|
|
231
|
-
)}
|
|
232
221
|
{price && !priceContainerBlur && (
|
|
233
222
|
<View
|
|
234
223
|
style={[
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useCallback, useState } from "react";
|
|
1
|
+
import React, { useCallback, useMemo, useState } from "react";
|
|
2
2
|
import { I18nManager, StyleSheet, View } from "react-native";
|
|
3
3
|
import { Gesture, GestureDetector } from "react-native-gesture-handler";
|
|
4
4
|
import Animated, {
|
|
@@ -13,6 +13,8 @@ const THUMB_SIZE = 28;
|
|
|
13
13
|
const RAIL_HEIGHT = 6;
|
|
14
14
|
const LABEL_HEIGHT = 26;
|
|
15
15
|
|
|
16
|
+
type ScaleType = "linear" | "logarithmic" | "percentile";
|
|
17
|
+
|
|
16
18
|
interface RangeSliderProps {
|
|
17
19
|
min: number;
|
|
18
20
|
max: number;
|
|
@@ -21,8 +23,60 @@ interface RangeSliderProps {
|
|
|
21
23
|
initialMinValue: number;
|
|
22
24
|
initialMaxValue: number;
|
|
23
25
|
onValueChange: (values: { min: number; max: number }) => void;
|
|
26
|
+
theme?: ThemeType;
|
|
27
|
+
scale?: ScaleType;
|
|
28
|
+
/**
|
|
29
|
+
* For percentile scale: array of all values in your dataset
|
|
30
|
+
* The slider will distribute positions based on data density
|
|
31
|
+
*/
|
|
32
|
+
dataPoints?: number[];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Creates percentile breakpoints from data
|
|
37
|
+
* Returns sorted unique values that represent the distribution
|
|
38
|
+
*/
|
|
39
|
+
function createPercentileBreakpoints(data: number[]): number[] {
|
|
40
|
+
const sorted = [...new Set(data)].sort((a, b) => a - b);
|
|
41
|
+
|
|
42
|
+
// If small dataset, use all unique values
|
|
43
|
+
if (sorted.length <= 100) {
|
|
44
|
+
return sorted;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// For larger datasets, sample at percentile intervals
|
|
48
|
+
const breakpoints: number[] = [];
|
|
49
|
+
const numBreakpoints = 100;
|
|
50
|
+
|
|
51
|
+
for (let i = 0; i <= numBreakpoints; i++) {
|
|
52
|
+
const index = Math.floor((i / numBreakpoints) * (sorted.length - 1));
|
|
53
|
+
const value = sorted[index];
|
|
54
|
+
if (breakpoints[breakpoints.length - 1] !== value) {
|
|
55
|
+
breakpoints.push(value);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return breakpoints;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Binary search to find position in breakpoints
|
|
64
|
+
*/
|
|
65
|
+
function findBreakpointIndex(breakpoints: number[], value: number): number {
|
|
66
|
+
"worklet";
|
|
67
|
+
let left = 0;
|
|
68
|
+
let right = breakpoints.length - 1;
|
|
24
69
|
|
|
25
|
-
|
|
70
|
+
while (left < right) {
|
|
71
|
+
const mid = Math.floor((left + right) / 2);
|
|
72
|
+
if (breakpoints[mid] < value) {
|
|
73
|
+
left = mid + 1;
|
|
74
|
+
} else {
|
|
75
|
+
right = mid;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return left;
|
|
26
80
|
}
|
|
27
81
|
|
|
28
82
|
const RangeSlider: React.FC<RangeSliderProps> = ({
|
|
@@ -33,45 +87,101 @@ const RangeSlider: React.FC<RangeSliderProps> = ({
|
|
|
33
87
|
initialMinValue,
|
|
34
88
|
initialMaxValue,
|
|
35
89
|
onValueChange,
|
|
36
|
-
theme
|
|
90
|
+
theme,
|
|
91
|
+
scale = "linear",
|
|
92
|
+
dataPoints,
|
|
37
93
|
}) => {
|
|
38
|
-
const { theme: defaultTheme} = useTheme();
|
|
39
|
-
|
|
94
|
+
const { theme: defaultTheme } = useTheme();
|
|
40
95
|
const currTheme = theme || defaultTheme;
|
|
41
|
-
|
|
42
96
|
const styles = getStyles(currTheme);
|
|
43
|
-
|
|
44
97
|
const isRTL = I18nManager.isRTL;
|
|
45
98
|
|
|
46
|
-
// State for label text values, passed down to the SliderLabels component
|
|
47
99
|
const [leftLabel, setLeftLabel] = useState(initialMinValue.toLocaleString());
|
|
48
100
|
const [rightLabel, setRightLabel] = useState(
|
|
49
101
|
initialMaxValue.toLocaleString()
|
|
50
102
|
);
|
|
51
103
|
|
|
104
|
+
// Pre-compute breakpoints for percentile scale
|
|
105
|
+
const breakpoints = useMemo(() => {
|
|
106
|
+
if (scale === "percentile" && dataPoints?.length) {
|
|
107
|
+
return createPercentileBreakpoints(dataPoints);
|
|
108
|
+
}
|
|
109
|
+
return [];
|
|
110
|
+
}, [scale, dataPoints]);
|
|
111
|
+
|
|
112
|
+
const safeMin = scale === "logarithmic" ? Math.max(min, 0.001) : min;
|
|
113
|
+
|
|
52
114
|
const valueToPosition = useCallback(
|
|
53
115
|
(value: number) => {
|
|
54
116
|
"worklet";
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
117
|
+
let percentage: number;
|
|
118
|
+
|
|
119
|
+
if (scale === "percentile" && breakpoints.length > 1) {
|
|
120
|
+
// Find where this value falls in the breakpoints
|
|
121
|
+
const index = findBreakpointIndex(breakpoints, value);
|
|
122
|
+
|
|
123
|
+
if (index === 0) {
|
|
124
|
+
percentage = 0;
|
|
125
|
+
} else if (index >= breakpoints.length - 1) {
|
|
126
|
+
percentage = 1;
|
|
127
|
+
} else {
|
|
128
|
+
// Interpolate between breakpoints
|
|
129
|
+
const lowerVal = breakpoints[index - 1];
|
|
130
|
+
const upperVal = breakpoints[index];
|
|
131
|
+
const lowerPct = (index - 1) / (breakpoints.length - 1);
|
|
132
|
+
const upperPct = index / (breakpoints.length - 1);
|
|
133
|
+
|
|
134
|
+
if (upperVal === lowerVal) {
|
|
135
|
+
percentage = lowerPct;
|
|
136
|
+
} else {
|
|
137
|
+
const ratio = (value - lowerVal) / (upperVal - lowerVal);
|
|
138
|
+
percentage = lowerPct + ratio * (upperPct - lowerPct);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
} else if (scale === "logarithmic") {
|
|
142
|
+
const logMin = Math.log(safeMin);
|
|
143
|
+
const logMax = Math.log(max);
|
|
144
|
+
const logValue = Math.log(Math.max(value, safeMin));
|
|
145
|
+
percentage = (logValue - logMin) / (logMax - logMin);
|
|
146
|
+
} else {
|
|
147
|
+
percentage = (value - min) / (max - min);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return isRTL ? (1 - percentage) * sliderWidth : percentage * sliderWidth;
|
|
60
151
|
},
|
|
61
|
-
[min, max, sliderWidth, isRTL]
|
|
152
|
+
[min, max, safeMin, sliderWidth, isRTL, scale, breakpoints]
|
|
62
153
|
);
|
|
63
154
|
|
|
64
155
|
const positionToValue = useCallback(
|
|
65
156
|
(position: number) => {
|
|
66
157
|
"worklet";
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
158
|
+
const percentage = isRTL
|
|
159
|
+
? 1 - position / sliderWidth
|
|
160
|
+
: position / sliderWidth;
|
|
161
|
+
|
|
162
|
+
let rawValue: number;
|
|
163
|
+
|
|
164
|
+
if (scale === "percentile" && breakpoints.length > 1) {
|
|
165
|
+
// Map percentage to breakpoint index
|
|
166
|
+
const exactIndex = percentage * (breakpoints.length - 1);
|
|
167
|
+
const lowerIndex = Math.floor(exactIndex);
|
|
168
|
+
const upperIndex = Math.min(lowerIndex + 1, breakpoints.length - 1);
|
|
169
|
+
const ratio = exactIndex - lowerIndex;
|
|
170
|
+
|
|
171
|
+
rawValue =
|
|
172
|
+
breakpoints[lowerIndex] +
|
|
173
|
+
ratio * (breakpoints[upperIndex] - breakpoints[lowerIndex]);
|
|
174
|
+
} else if (scale === "logarithmic") {
|
|
175
|
+
const logMin = Math.log(safeMin);
|
|
176
|
+
const logMax = Math.log(max);
|
|
177
|
+
rawValue = Math.exp(logMin + percentage * (logMax - logMin));
|
|
178
|
+
} else {
|
|
179
|
+
rawValue = percentage * (max - min) + min;
|
|
180
|
+
}
|
|
181
|
+
|
|
72
182
|
return Math.round(rawValue / step) * step;
|
|
73
183
|
},
|
|
74
|
-
[min, max, step, sliderWidth, isRTL]
|
|
184
|
+
[min, max, safeMin, step, sliderWidth, isRTL, scale, breakpoints]
|
|
75
185
|
);
|
|
76
186
|
|
|
77
187
|
const leftPosition = useSharedValue(valueToPosition(initialMinValue));
|
|
@@ -95,23 +205,20 @@ const RangeSlider: React.FC<RangeSliderProps> = ({
|
|
|
95
205
|
if (activeThumb.value === null) return;
|
|
96
206
|
const newPos = context.value.x + e.translationX;
|
|
97
207
|
|
|
98
|
-
// 5. Adjust clamping logic for RTL
|
|
99
208
|
if (activeThumb.value === "left") {
|
|
100
209
|
const lowerBound = isRTL ? rightPosition.value + THUMB_SIZE : 0;
|
|
101
|
-
const upperBound = isRTL
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
);
|
|
210
|
+
const upperBound = isRTL
|
|
211
|
+
? sliderWidth
|
|
212
|
+
: rightPosition.value - THUMB_SIZE;
|
|
213
|
+
const clampedPos = Math.max(Math.min(newPos, upperBound), lowerBound);
|
|
106
214
|
leftPosition.value = clampedPos;
|
|
107
215
|
runOnJS(setLeftLabel)(positionToValue(clampedPos).toLocaleString());
|
|
108
216
|
} else {
|
|
109
217
|
const lowerBound = isRTL ? 0 : leftPosition.value + THUMB_SIZE;
|
|
110
|
-
const upperBound = isRTL
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
);
|
|
218
|
+
const upperBound = isRTL
|
|
219
|
+
? leftPosition.value - THUMB_SIZE
|
|
220
|
+
: sliderWidth;
|
|
221
|
+
const clampedPos = Math.max(Math.min(newPos, upperBound), lowerBound);
|
|
115
222
|
rightPosition.value = clampedPos;
|
|
116
223
|
runOnJS(setRightLabel)(positionToValue(clampedPos).toLocaleString());
|
|
117
224
|
}
|
|
@@ -124,9 +231,8 @@ const RangeSlider: React.FC<RangeSliderProps> = ({
|
|
|
124
231
|
activeThumb.value = null;
|
|
125
232
|
});
|
|
126
233
|
|
|
127
|
-
|
|
128
234
|
const animatedLeftThumbStyle = useAnimatedStyle(() => ({
|
|
129
|
-
transform: [{ translateX: leftPosition.value - (isRTL ? THUMB_SIZE : 0)}],
|
|
235
|
+
transform: [{ translateX: leftPosition.value - (isRTL ? THUMB_SIZE : 0) }],
|
|
130
236
|
}));
|
|
131
237
|
|
|
132
238
|
const animatedRightThumbStyle = useAnimatedStyle(() => ({
|
|
@@ -134,7 +240,6 @@ const RangeSlider: React.FC<RangeSliderProps> = ({
|
|
|
134
240
|
}));
|
|
135
241
|
|
|
136
242
|
const animatedActiveRailStyle = useAnimatedStyle(() => {
|
|
137
|
-
// 6. Use Math.min and Math.max to correctly draw the active rail in both LTR and RTL
|
|
138
243
|
const start = Math.min(leftPosition.value, rightPosition.value);
|
|
139
244
|
const end = Math.max(leftPosition.value, rightPosition.value);
|
|
140
245
|
return {
|
|
@@ -182,7 +287,7 @@ const getStyles = (theme: ThemeType) =>
|
|
|
182
287
|
height: LABEL_HEIGHT + THUMB_SIZE,
|
|
183
288
|
justifyContent: "center",
|
|
184
289
|
marginTop: LABEL_HEIGHT,
|
|
185
|
-
direction: "ltr"
|
|
290
|
+
direction: "ltr",
|
|
186
291
|
},
|
|
187
292
|
railContainer: {
|
|
188
293
|
justifyContent: "center",
|
|
@@ -215,4 +320,4 @@ const getStyles = (theme: ThemeType) =>
|
|
|
215
320
|
},
|
|
216
321
|
});
|
|
217
322
|
|
|
218
|
-
export default RangeSlider;
|
|
323
|
+
export default RangeSlider;
|