@momo-kits/slider 0.0.33-beta → 0.0.39-beta
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/DefaultLabel.web.js +86 -0
- package/DefaultMarker.web.js +72 -0
- package/Slider.web.js +1 -1
- package/package.json +3 -10
- package/publish.sh +1 -1
- package/babel.config.js +0 -3
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { View, StyleSheet } from 'react-native';
|
|
4
|
+
import Text from '../../core/components/typography';
|
|
5
|
+
|
|
6
|
+
const sliderRadius = 3;
|
|
7
|
+
const width = 50;
|
|
8
|
+
export default class DefaultLabel extends React.Component {
|
|
9
|
+
render() {
|
|
10
|
+
const {
|
|
11
|
+
oneMarkerValue,
|
|
12
|
+
twoMarkerValue,
|
|
13
|
+
oneMarkerLeftPosition,
|
|
14
|
+
twoMarkerLeftPosition,
|
|
15
|
+
oneMarkerPressed,
|
|
16
|
+
twoMarkerPressed,
|
|
17
|
+
} = this.props;
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<View style={{ position: 'relative' }}>
|
|
21
|
+
{
|
|
22
|
+
Number.isFinite(oneMarkerLeftPosition)
|
|
23
|
+
&& Number.isFinite(oneMarkerValue)
|
|
24
|
+
&& (
|
|
25
|
+
<View
|
|
26
|
+
style={[
|
|
27
|
+
styles.sliderLabel,
|
|
28
|
+
{ left: oneMarkerLeftPosition - width / 2 + sliderRadius },
|
|
29
|
+
oneMarkerPressed && styles.markerPressed,
|
|
30
|
+
]}
|
|
31
|
+
>
|
|
32
|
+
<Text.SubTitle style={styles.sliderLabelText}>{oneMarkerValue}</Text.SubTitle>
|
|
33
|
+
</View>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
{
|
|
38
|
+
Number.isFinite(twoMarkerLeftPosition)
|
|
39
|
+
&& Number.isFinite(twoMarkerValue)
|
|
40
|
+
&& (
|
|
41
|
+
<View
|
|
42
|
+
style={[
|
|
43
|
+
styles.sliderLabel,
|
|
44
|
+
{ left: twoMarkerLeftPosition - width / 2 + sliderRadius },
|
|
45
|
+
twoMarkerPressed && styles.markerPressed,
|
|
46
|
+
]}
|
|
47
|
+
>
|
|
48
|
+
<Text.SubTitle style={styles.sliderLabelText}>{twoMarkerValue}</Text.SubTitle>
|
|
49
|
+
</View>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
</View>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const styles = StyleSheet.create({
|
|
58
|
+
sliderLabel: {
|
|
59
|
+
position: 'absolute',
|
|
60
|
+
bottom: 0,
|
|
61
|
+
minWidth: width,
|
|
62
|
+
padding: 8,
|
|
63
|
+
backgroundColor: '#f1f1f1',
|
|
64
|
+
},
|
|
65
|
+
sliderLabelText: {
|
|
66
|
+
alignItems: 'center',
|
|
67
|
+
textAlign: 'center',
|
|
68
|
+
fontStyle: 'normal',
|
|
69
|
+
// fontSize: 11,
|
|
70
|
+
},
|
|
71
|
+
markerPressed: {
|
|
72
|
+
borderWidth: 2,
|
|
73
|
+
borderColor: '#999',
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
DefaultLabel.propTypes = {
|
|
78
|
+
oneMarkerValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
79
|
+
twoMarkerValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
80
|
+
|
|
81
|
+
oneMarkerLeftPosition: PropTypes.number,
|
|
82
|
+
twoMarkerLeftPosition: PropTypes.number,
|
|
83
|
+
|
|
84
|
+
oneMarkerPressed: PropTypes.bool,
|
|
85
|
+
twoMarkerPressed: PropTypes.bool,
|
|
86
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
View, StyleSheet, Platform, TouchableHighlight
|
|
4
|
+
} from 'react-native';
|
|
5
|
+
import Colors from '../../core/colors';
|
|
6
|
+
|
|
7
|
+
class DefaultMarker extends React.Component {
|
|
8
|
+
render() {
|
|
9
|
+
const {
|
|
10
|
+
enabled,
|
|
11
|
+
markerStyle,
|
|
12
|
+
pressed,
|
|
13
|
+
pressedMarkerStyle,
|
|
14
|
+
disabledMarkerStyle
|
|
15
|
+
} = this.props;
|
|
16
|
+
return (
|
|
17
|
+
<TouchableHighlight>
|
|
18
|
+
<View
|
|
19
|
+
style={
|
|
20
|
+
enabled
|
|
21
|
+
? [
|
|
22
|
+
styles.markerStyle,
|
|
23
|
+
markerStyle,
|
|
24
|
+
pressed && styles.pressedMarkerStyle,
|
|
25
|
+
pressed && pressedMarkerStyle,
|
|
26
|
+
]
|
|
27
|
+
: [
|
|
28
|
+
styles.markerStyle,
|
|
29
|
+
styles.disabled,
|
|
30
|
+
disabledMarkerStyle,
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
/>
|
|
34
|
+
</TouchableHighlight>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const styles = StyleSheet.create({
|
|
40
|
+
markerStyle: {
|
|
41
|
+
height: 24,
|
|
42
|
+
width: 24,
|
|
43
|
+
borderRadius: 12,
|
|
44
|
+
borderWidth: 2,
|
|
45
|
+
borderColor: Colors.pink_03,
|
|
46
|
+
backgroundColor: '#FFFFFF',
|
|
47
|
+
shadowColor: '#000000',
|
|
48
|
+
shadowOffset: {
|
|
49
|
+
width: 0,
|
|
50
|
+
height: 3,
|
|
51
|
+
},
|
|
52
|
+
shadowRadius: 1,
|
|
53
|
+
shadowOpacity: 0.2,
|
|
54
|
+
elevation: 3
|
|
55
|
+
},
|
|
56
|
+
pressedMarkerStyle: {
|
|
57
|
+
...Platform.select({
|
|
58
|
+
web: {},
|
|
59
|
+
ios: {},
|
|
60
|
+
android: {
|
|
61
|
+
height: 20,
|
|
62
|
+
width: 20,
|
|
63
|
+
borderRadius: 20,
|
|
64
|
+
},
|
|
65
|
+
}),
|
|
66
|
+
},
|
|
67
|
+
disabled: {
|
|
68
|
+
backgroundColor: '#d3d3d3',
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
export default DefaultMarker;
|
package/Slider.web.js
CHANGED
|
@@ -11,7 +11,7 @@ import { get } from 'lodash';
|
|
|
11
11
|
import DefaultMarker from './DefaultMarker';
|
|
12
12
|
import DefaultLabel from './DefaultLabel';
|
|
13
13
|
import { createArray, valueToPosition, positionToValue } from './converters';
|
|
14
|
-
import Colors from '../../colors';
|
|
14
|
+
import Colors from '../../core/colors';
|
|
15
15
|
|
|
16
16
|
export default class Slider extends Component {
|
|
17
17
|
constructor(props) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@momo-kits/slider",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.39-beta",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"dependencies": {},
|
|
@@ -11,13 +11,6 @@
|
|
|
11
11
|
"lodash": "^4.17.15",
|
|
12
12
|
"@momo-kits/core": ">=0.0.5-beta"
|
|
13
13
|
},
|
|
14
|
-
"devDependencies": {
|
|
15
|
-
|
|
16
|
-
"@babel/core": "^7.12.9",
|
|
17
|
-
"@babel/runtime": "^7.12.5"
|
|
18
|
-
},
|
|
19
|
-
"license": "MoMo",
|
|
20
|
-
"jest": {
|
|
21
|
-
"preset": "react-native"
|
|
22
|
-
}
|
|
14
|
+
"devDependencies": {},
|
|
15
|
+
"license": "MoMo"
|
|
23
16
|
}
|
package/publish.sh
CHANGED
|
@@ -26,4 +26,4 @@ cd ..
|
|
|
26
26
|
rm -rf dist
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
curl -X POST -H 'Content-Type: application/json' 'https://chat.googleapis.com/v1/spaces/AAAAbP8987c/messages?key=AIzaSyDdI0hCZtE6vySjMm-WEfRq3CPzqKqqsHI&token=UGSFRvk_oYb9uGsAgs31bVvMm6jDkmD8zihGm3eyaQA%3D&threadKey=JoaXTEYaNNkl' -d '{"text": "@momo-kits/stepper new version release: '*"$VERSION"*' https://www.npmjs.com/package/@momo-kits/stepper"}'
|
package/babel.config.js
DELETED