@cdek-it/react-native-ui-kit 0.6.1 → 0.6.3
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/dist/components/Dialog/Dialog.js +0 -1
- package/dist/components/Input/InputOtp/InputOtp.js +2 -4
- package/dist/components/Input/InputTextBase/useInputStyles.d.ts +1 -0
- package/dist/components/Input/InputTextBase/useInputStyles.js +1 -0
- package/dist/components/ProgressSpinner/ProgressSpinner.js +0 -2
- package/dist/components/Rating/Rating.js +3 -5
- package/dist/components/Timer/Timer.js +3 -2
- package/package.json +1 -2
|
@@ -7,7 +7,6 @@ const ANIMATION_BACKDROP_DURATION = 200;
|
|
|
7
7
|
const ANIMATION_CONTENT_DURATION = 500;
|
|
8
8
|
const BACKDROP_OPACITY = 0.5;
|
|
9
9
|
const SCALE_INIT_VALUE = 0.9;
|
|
10
|
-
// eslint-disable-next-line import-x/no-deprecated
|
|
11
10
|
const AnimatedPressable = Animated.createAnimatedComponent(Pressable);
|
|
12
11
|
export const Dialog = ({ isVisible, onClose, onHideComplete, header, footer, body, testID, }) => {
|
|
13
12
|
const [showModal, setShowModal] = useState(false);
|
|
@@ -23,13 +23,11 @@ export const InputOtp = memo(({ length, onChange, disabled = false, error = fals
|
|
|
23
23
|
onBlur?.(e);
|
|
24
24
|
}, [onBlur]);
|
|
25
25
|
const activeIndex = useMemo(() => Math.min(value.length, length - 1), [value.length, length]);
|
|
26
|
-
const renderArray = useMemo(() => Array.from({ length }
|
|
26
|
+
const renderArray = useMemo(() => Array.from({ length }, (_, i) => `Otp-Item-${i}`), [length]);
|
|
27
27
|
return (<Pressable disabled={disabled} style={styles.container} testID={testID} testOnly_pressed={testOnly_pressed} onPress={handlePress}>
|
|
28
28
|
{({ pressed }) => (<>
|
|
29
29
|
<View style={styles.content}>
|
|
30
|
-
{renderArray.map((
|
|
31
|
-
// eslint-disable-next-line react/no-array-index-key
|
|
32
|
-
key={index} pressed={pressed} testID={`${testID}Item`} value={value[index]}/>))}
|
|
30
|
+
{renderArray.map((key, index) => (<InputOtpItem disabled={disabled} error={error} focused={isFocused ? index === activeIndex : false} key={key} pressed={pressed} testID={`${testID}Item`} value={value[index]}/>))}
|
|
33
31
|
</View>
|
|
34
32
|
<TextInput keyboardType='number-pad' maxLength={length} ref={inputRef} style={styles.input} testID={`${testID}HiddenInput`} value={value} onBlur={handleBlur} onChangeText={handleChange} onFocus={handleFocus} {...rest}/>
|
|
35
33
|
</>)}
|
|
@@ -27,6 +27,7 @@ const useStyles = makeStyles(({ theme, border, typography, spacing, fonts }) =>
|
|
|
27
27
|
containerFocused: {
|
|
28
28
|
outlineColor: theme.General.focusOutlineColor,
|
|
29
29
|
outlineWidth: Math.round(theme.General.focusShadowWidth),
|
|
30
|
+
borderColor: theme.General.focusBorderColor,
|
|
30
31
|
},
|
|
31
32
|
containerFloatLabel: {
|
|
32
33
|
minHeight: theme.Button.Common.buttonHeightXL,
|
|
@@ -2,9 +2,7 @@ import { memo, useEffect, useMemo } from 'react';
|
|
|
2
2
|
import Animated, { Easing, interpolate, useAnimatedProps, useAnimatedStyle, useSharedValue, withRepeat, withTiming, } from 'react-native-reanimated';
|
|
3
3
|
import Svg, { Circle } from 'react-native-svg';
|
|
4
4
|
import { makeStyles } from '../../utils/makeStyles';
|
|
5
|
-
// eslint-disable-next-line import-x/no-deprecated
|
|
6
5
|
const AnimatedSvg = Animated.createAnimatedComponent(Svg);
|
|
7
|
-
// eslint-disable-next-line import-x/no-deprecated
|
|
8
6
|
const AnimatedCircle = Animated.createAnimatedComponent(Circle);
|
|
9
7
|
const STROKE_WIDTH = 2;
|
|
10
8
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { memo, useCallback } from 'react';
|
|
1
|
+
import { memo, useCallback, useMemo } from 'react';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
3
|
import { makeStyles } from '../../utils/makeStyles';
|
|
4
4
|
import { RatingClear } from './RatingClear';
|
|
@@ -20,12 +20,10 @@ export const Rating = memo(({ disabled = false, paddings = false, maxRating = 5,
|
|
|
20
20
|
const handleItemPress = useCallback((index) => () => {
|
|
21
21
|
onChange(index + 1);
|
|
22
22
|
}, [onChange]);
|
|
23
|
+
const renderArray = useMemo(() => Array.from({ length: maxRating }, (_, i) => `Rating-Item-${i}`), [maxRating]);
|
|
23
24
|
return (<View style={styles.container}>
|
|
24
25
|
<RatingClear disabled={disabled} paddings={paddings} testID={testID || 'RatingClear'} onPress={onClear} {...rest}/>
|
|
25
|
-
{
|
|
26
|
-
// Использовать индекс массива в качестве ключа - единственно возможное и правильное решение
|
|
27
|
-
// eslint-disable-next-line react/no-array-index-key
|
|
28
|
-
key={`RatingItem-${index}`} paddings={paddings} testID={`RatingItem-${index + 1}`} onPress={handleItemPress(index)}/>))}
|
|
26
|
+
{renderArray.map((key, index) => (<RatingItem checked={index < rating} key={key} paddings={paddings} testID={`RatingItem-${index + 1}`} onPress={handleItemPress(index)}/>))}
|
|
29
27
|
</View>);
|
|
30
28
|
});
|
|
31
29
|
const useStyles = makeStyles(({ theme }) => ({
|
|
@@ -5,7 +5,6 @@ import Svg, { Circle } from 'react-native-svg';
|
|
|
5
5
|
import { makeStyles } from '../../utils/makeStyles';
|
|
6
6
|
import { TimerFlip } from './TimerFlip';
|
|
7
7
|
import { COUNTER_SIZE } from './constants';
|
|
8
|
-
// eslint-disable-next-line import-x/no-deprecated
|
|
9
8
|
const AnimatedCircle = Animated.createAnimatedComponent(Circle);
|
|
10
9
|
const BORDER_WIDTH = 2;
|
|
11
10
|
/**
|
|
@@ -21,6 +20,8 @@ export const Timer = memo(({ countFrom, onFinish }) => {
|
|
|
21
20
|
const center = COUNTER_SIZE / 2;
|
|
22
21
|
const circleAnimatedProps = useAnimatedProps(() => ({
|
|
23
22
|
strokeDashoffset: -circleAnimation.value * circumferenceLength,
|
|
23
|
+
origin: [center, center],
|
|
24
|
+
rotation: -90,
|
|
24
25
|
}));
|
|
25
26
|
useEffect(() => {
|
|
26
27
|
setCurrentTimerValue(countFrom);
|
|
@@ -45,7 +46,7 @@ export const Timer = memo(({ countFrom, onFinish }) => {
|
|
|
45
46
|
}, [currentTimerValue, onFinish]);
|
|
46
47
|
return (<View style={styles.container} testID={TestId.Container}>
|
|
47
48
|
<Svg style={styles.svgContainer}>
|
|
48
|
-
<AnimatedCircle animatedProps={circleAnimatedProps} cx={center} cy={center} fill='none'
|
|
49
|
+
<AnimatedCircle animatedProps={circleAnimatedProps} cx={center} cy={center} fill='none' r={circumferenceRadius} stroke={styles.circle.color} strokeDasharray={circumferenceLength} strokeLinecap='round' strokeWidth={BORDER_WIDTH}/>
|
|
49
50
|
</Svg>
|
|
50
51
|
|
|
51
52
|
<TimerFlip value={currentTimerValue}/>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cdek-it/react-native-ui-kit",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.3",
|
|
4
4
|
"description": "UI kit на основе Prime Faces, Prime Flex для React Native",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://developer.cdek.ru/design-system",
|
|
@@ -42,7 +42,6 @@
|
|
|
42
42
|
"pod-install": "bundle exec pod install --project-directory=ios"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@gorhom/portal": "^1.0.14",
|
|
46
45
|
"@tabler/icons-react-native": "^3.36.0"
|
|
47
46
|
},
|
|
48
47
|
"devDependencies": {
|