@utilitywarehouse/hearth-react-native 0.27.2-testid-fix-3 → 0.27.2
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/.turbo/turbo-build.log +4 -5
- package/.turbo/turbo-lint.log +69 -0
- package/build/components/Button/ButtonRoot.js +0 -8
- package/build/components/List/List.js +2 -2
- package/build/components/Modal/Modal.js +11 -16
- package/build/components/Select/Select.d.ts +1 -1
- package/build/components/Select/Select.js +4 -5
- package/build/components/Select/Select.props.d.ts +0 -4
- package/build/components/Select/SelectOption.d.ts +1 -1
- package/build/components/Select/SelectOption.js +2 -2
- package/build/components/VerificationInput/VerificationInput.js +3 -3
- package/package.json +3 -3
- package/src/components/Button/Button.stories.tsx +7 -43
- package/src/components/Button/ButtonRoot.tsx +0 -8
- package/src/components/List/List.tsx +4 -5
- package/src/components/Modal/Modal.tsx +16 -31
- package/src/components/Select/Select.props.ts +0 -4
- package/src/components/Select/Select.tsx +1 -6
- package/src/components/Select/SelectOption.tsx +0 -2
- package/src/components/VerificationInput/VerificationInput.tsx +0 -3
- package/build/components/DatePicker/TimePicker.d.ts +0 -3
- package/build/components/DatePicker/TimePicker.js +0 -84
- package/build/components/DatePicker/time-picker/animated-math.d.ts +0 -4
- package/build/components/DatePicker/time-picker/animated-math.js +0 -19
- package/build/components/DatePicker/time-picker/period-native.d.ts +0 -6
- package/build/components/DatePicker/time-picker/period-native.js +0 -17
- package/build/components/DatePicker/time-picker/period-picker.d.ts +0 -6
- package/build/components/DatePicker/time-picker/period-picker.js +0 -10
- package/build/components/DatePicker/time-picker/period-web.d.ts +0 -6
- package/build/components/DatePicker/time-picker/period-web.js +0 -21
- package/build/components/DatePicker/time-picker/wheel-native.d.ts +0 -8
- package/build/components/DatePicker/time-picker/wheel-native.js +0 -19
- package/build/components/DatePicker/time-picker/wheel-picker/index.d.ts +0 -2
- package/build/components/DatePicker/time-picker/wheel-picker/index.js +0 -2
- package/build/components/DatePicker/time-picker/wheel-picker/wheel-picker-item.d.ts +0 -16
- package/build/components/DatePicker/time-picker/wheel-picker/wheel-picker-item.js +0 -97
- package/build/components/DatePicker/time-picker/wheel-picker/wheel-picker.d.ts +0 -21
- package/build/components/DatePicker/time-picker/wheel-picker/wheel-picker.js +0 -88
- package/build/components/DatePicker/time-picker/wheel-picker/wheel-picker.style.d.ts +0 -23
- package/build/components/DatePicker/time-picker/wheel-picker/wheel-picker.style.js +0 -21
- package/build/components/DatePicker/time-picker/wheel-web.d.ts +0 -8
- package/build/components/DatePicker/time-picker/wheel-web.js +0 -146
- package/build/components/DatePicker/time-picker/wheel.d.ts +0 -8
- package/build/components/DatePicker/time-picker/wheel.js +0 -10
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { memo, useMemo, useRef } from 'react';
|
|
3
|
-
import { Animated, PanResponder, Platform, View } from 'react-native';
|
|
4
|
-
import { StyleSheet } from 'react-native-unistyles';
|
|
5
|
-
import { isEqual } from '../../../utils';
|
|
6
|
-
import { BodyText } from '../../BodyText';
|
|
7
|
-
import { CONTAINER_HEIGHT } from '../enums';
|
|
8
|
-
import { sin } from './animated-math';
|
|
9
|
-
const ITEM_HEIGHT = 44;
|
|
10
|
-
const WheelWeb = ({ value, setValue = () => { }, items }) => {
|
|
11
|
-
const displayCount = 5;
|
|
12
|
-
const translateY = useRef(new Animated.Value(0)).current;
|
|
13
|
-
const renderCount = displayCount * 2 < items.length ? displayCount * 8 : displayCount * 2 - 1;
|
|
14
|
-
const circular = items.length >= displayCount;
|
|
15
|
-
const height = 140;
|
|
16
|
-
const radius = height / 2;
|
|
17
|
-
const valueIndex = useMemo(() => {
|
|
18
|
-
return Math.max(0, items.findIndex(item => item.value === value));
|
|
19
|
-
}, [items, value]);
|
|
20
|
-
const panResponder = useMemo(() => {
|
|
21
|
-
return PanResponder.create({
|
|
22
|
-
onMoveShouldSetPanResponder: () => true,
|
|
23
|
-
onStartShouldSetPanResponderCapture: () => true,
|
|
24
|
-
onPanResponderGrant: () => {
|
|
25
|
-
translateY.setValue(0);
|
|
26
|
-
},
|
|
27
|
-
onPanResponderMove: (evt, gestureState) => {
|
|
28
|
-
translateY.setValue(gestureState.dy);
|
|
29
|
-
evt.stopPropagation();
|
|
30
|
-
},
|
|
31
|
-
onPanResponderRelease: (_, gestureState) => {
|
|
32
|
-
translateY.extractOffset();
|
|
33
|
-
let newValueIndex = valueIndex - Math.round(gestureState.dy / ((radius * 2) / displayCount));
|
|
34
|
-
if (circular) {
|
|
35
|
-
newValueIndex = (newValueIndex + items.length) % items.length;
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
if (newValueIndex < 0) {
|
|
39
|
-
newValueIndex = 0;
|
|
40
|
-
}
|
|
41
|
-
else if (newValueIndex >= items.length) {
|
|
42
|
-
newValueIndex = items.length - 1;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
const newValue = items[newValueIndex];
|
|
46
|
-
if (newValue?.value === value) {
|
|
47
|
-
translateY.setOffset(0);
|
|
48
|
-
translateY.setValue(0);
|
|
49
|
-
}
|
|
50
|
-
else if (newValue?.value) {
|
|
51
|
-
setValue(newValue.value);
|
|
52
|
-
}
|
|
53
|
-
else if (items[0]?.value) {
|
|
54
|
-
setValue(items[0].value);
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
});
|
|
58
|
-
}, [circular, displayCount, radius, setValue, value, valueIndex, items, translateY]);
|
|
59
|
-
const displayValues = useMemo(() => {
|
|
60
|
-
const centerIndex = Math.floor(renderCount / 2);
|
|
61
|
-
return Array.from({ length: renderCount }, (_, index) => {
|
|
62
|
-
let targetIndex = valueIndex + index - centerIndex;
|
|
63
|
-
if (circular) {
|
|
64
|
-
targetIndex = ((targetIndex % items.length) + items.length) % items.length;
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
targetIndex = Math.max(0, Math.min(targetIndex, items.length - 1));
|
|
68
|
-
}
|
|
69
|
-
return items[targetIndex] || items[0];
|
|
70
|
-
});
|
|
71
|
-
}, [renderCount, valueIndex, items, circular]);
|
|
72
|
-
const animatedAngles = useMemo(() => {
|
|
73
|
-
//translateY.setValue(0);
|
|
74
|
-
translateY.setOffset(0);
|
|
75
|
-
const currentIndex = displayValues.findIndex(item => item?.value === value);
|
|
76
|
-
return displayValues && displayValues.length > 0
|
|
77
|
-
? displayValues.map((_, index) => translateY
|
|
78
|
-
.interpolate({
|
|
79
|
-
inputRange: [-radius, radius],
|
|
80
|
-
outputRange: [
|
|
81
|
-
-radius + ((radius * 2) / displayCount) * (index - currentIndex),
|
|
82
|
-
radius + ((radius * 2) / displayCount) * (index - currentIndex),
|
|
83
|
-
],
|
|
84
|
-
extrapolate: 'extend',
|
|
85
|
-
})
|
|
86
|
-
.interpolate({
|
|
87
|
-
inputRange: [-radius, radius],
|
|
88
|
-
outputRange: [-Math.PI / 2, Math.PI / 2],
|
|
89
|
-
extrapolate: 'clamp',
|
|
90
|
-
}))
|
|
91
|
-
: [];
|
|
92
|
-
}, [displayValues, radius, value, displayCount, translateY]);
|
|
93
|
-
return (_jsxs(View, { style: [styles.container], ...panResponder.panHandlers, children: [_jsx(View, { style: [
|
|
94
|
-
styles.selectedIndicator,
|
|
95
|
-
{
|
|
96
|
-
transform: [{ translateY: -ITEM_HEIGHT / 2 }],
|
|
97
|
-
height: ITEM_HEIGHT,
|
|
98
|
-
},
|
|
99
|
-
] }), displayValues?.map((displayValue, index) => {
|
|
100
|
-
const animatedAngle = animatedAngles[index];
|
|
101
|
-
return (_jsx(Animated.View, { style: {
|
|
102
|
-
position: 'absolute',
|
|
103
|
-
height: ITEM_HEIGHT - 10,
|
|
104
|
-
transform: animatedAngle
|
|
105
|
-
? [
|
|
106
|
-
{
|
|
107
|
-
translateY: Animated.multiply(radius, sin(animatedAngle)),
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
rotateX: animatedAngle.interpolate({
|
|
111
|
-
inputRange: [-Math.PI / 2, Math.PI / 2],
|
|
112
|
-
outputRange: ['-89deg', '89deg'],
|
|
113
|
-
extrapolate: 'clamp',
|
|
114
|
-
}),
|
|
115
|
-
},
|
|
116
|
-
]
|
|
117
|
-
: [],
|
|
118
|
-
opacity: displayValue?.value !== value ? 0.3 : 1,
|
|
119
|
-
}, children: _jsx(BodyText, { children: displayValue?.text }) }, `${displayValue?.text}-${index}`));
|
|
120
|
-
})] }));
|
|
121
|
-
};
|
|
122
|
-
const styles = StyleSheet.create({
|
|
123
|
-
container: {
|
|
124
|
-
minWidth: 30,
|
|
125
|
-
overflow: 'hidden',
|
|
126
|
-
alignItems: 'center',
|
|
127
|
-
justifyContent: 'center',
|
|
128
|
-
height: CONTAINER_HEIGHT / 2,
|
|
129
|
-
...Platform.select({
|
|
130
|
-
web: {
|
|
131
|
-
cursor: 'pointer',
|
|
132
|
-
userSelect: 'none',
|
|
133
|
-
},
|
|
134
|
-
}),
|
|
135
|
-
},
|
|
136
|
-
selectedIndicator: {
|
|
137
|
-
position: 'absolute',
|
|
138
|
-
width: '100%',
|
|
139
|
-
top: '50%',
|
|
140
|
-
},
|
|
141
|
-
});
|
|
142
|
-
const customComparator = (prev, next) => {
|
|
143
|
-
const areEqual = prev.value === next.value && prev.setValue === next.setValue && isEqual(prev.items, next.items);
|
|
144
|
-
return areEqual;
|
|
145
|
-
};
|
|
146
|
-
export default memo(WheelWeb, customComparator);
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { PickerOption } from '../DatePicker.props';
|
|
2
|
-
type WheelProps = {
|
|
3
|
-
value: number | string;
|
|
4
|
-
setValue?: (value: any) => void;
|
|
5
|
-
items: PickerOption[];
|
|
6
|
-
};
|
|
7
|
-
declare const _default: import("react").MemoExoticComponent<(props: WheelProps) => import("react/jsx-runtime").JSX.Element>;
|
|
8
|
-
export default _default;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { memo } from 'react';
|
|
3
|
-
import { Platform } from 'react-native';
|
|
4
|
-
import WheelNative from './wheel-native';
|
|
5
|
-
import WheelWeb from './wheel-web';
|
|
6
|
-
const Wheel = (props) => {
|
|
7
|
-
const Component = Platform.OS === 'web' ? WheelWeb : WheelNative;
|
|
8
|
-
return _jsx(Component, { ...props });
|
|
9
|
-
};
|
|
10
|
-
export default memo(Wheel);
|