@ray-js/lamp-style-slider 0.0.3-beta-7 → 0.0.4

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/README.md CHANGED
@@ -4,7 +4,7 @@ English | [简体中文](./README-zh_CN.md)
4
4
 
5
5
  [![latest](https://img.shields.io/npm/v/@ray-js/lamp-style-slider/latest.svg)](https://www.npmjs.com/package/@ray-js/lamp-style-slider) [![download](https://img.shields.io/npm/dt/@ray-js/lamp-style-slider.svg)](https://www.npmjs.com/package/@ray-js/lamp-style-slider)
6
6
 
7
- > 照明样式的基础滑动条
7
+ > Basic sliding bars of lighting styles
8
8
 
9
9
  ## Installation
10
10
 
@@ -16,81 +16,120 @@ $ yarn add @ray-js/lamp-style-slider
16
16
 
17
17
  ## Usage
18
18
 
19
- ```ts
20
- // 属性
21
- export interface IProps {
22
- /**
23
- * @description.zh 禁止滑动
24
- * @description.en Ban sliding
25
- * @default false
26
- */
27
- disable?: boolean;
28
- /**
29
- * @description.zh 滑动槽样式
30
- * @description.en
31
- * @default {}
32
- */
33
- trackStyle?: React.CSSProperties;
34
- /**
35
- * @description.zh slider值
36
- * @description.en slider value
37
- * @default 0
38
- */
39
- value: number;
40
- /**
41
- * @description.zh slider 展示的颜色值 对应hsv的hue
42
- * @description.en slider value
43
- * @default 0
44
- */
45
- hue: number; // 0 - 359
46
- /**
47
- * @description.zh slider 手指点击时触发
48
- * @description.en slider Value changes
49
- * @default () => {}
50
- */
51
- onTouchStart?: (value: number) => void;
52
- /**
53
- * @description.zh slider 手指拖动时触发
54
- * @description.en slider Value changes
55
- * @default () => {}
56
- */
57
- onTouchMove?: (value: number) => void;
58
- /**
59
- * @description.zh slider 手指离开时触发
60
- * @description.en Values change after the trigger
61
- * @default () => {}
62
- */
63
- onTouchEnd?: (value: number) => void;
64
- }
65
-
66
- export const defaultProps: IProps = {
67
- value: 0,
68
- onTouchStart: () => null,
69
- onTouchMove: () => null,
70
- onTouchEnd: () => null,
19
+ ### 1. Color temperature slider
20
+
21
+ ```tsx
22
+ import OpacitySlider from '@ray-js/lamp-style-slider';
23
+
24
+ const [value, setValue] = useState(1000);
25
+ const handleMove = v => {
26
+ // console.log('move====', v);
71
27
  };
28
+
29
+ <OpacitySlider
30
+ style={{
31
+ paddingLeft: 16,
32
+ }}
33
+ label="色温"
34
+ valueStyle={{ color: 'blue' }}
35
+ disable={false}
36
+ value={value}
37
+ onTouchMove={handleMove}
38
+ trackBackgroundColor="linear-gradient(270deg, #CDECFE 1.22%, #FFFFFF 45.36%, #FFFFFF 53.27%, #FFCA5C 98.32%)"
39
+ />
72
40
  ```
73
41
 
42
+ ### 2. Brightness slider
43
+
74
44
  ```tsx
75
- import LampSlider from '@ray-js/lamp-style-slider';
76
-
77
- export default () => {
78
- const [value, setValue] = useState(100);
79
-
80
- useEffect(() => {
81
- // 模拟dp上报
82
- setTimeout(() => {
83
- setValue(321);
84
- }, 3000);
85
- }, []);
86
-
87
- return (
88
- <LampSlider
89
- value={saturation}
90
- onTouchMove={val => {
91
- setValue(val);
92
- }}
93
- />
94
- );
45
+ import OpacitySlider from '@ray-js/lamp-style-slider';
46
+
47
+ const [value, setValue] = useState(1000);
48
+ const handleMove = v => {
49
+ // console.log('move====', v);
95
50
  };
51
+
52
+ <OpacitySlider
53
+ style={{
54
+ paddingLeft: 16,
55
+ }}
56
+ label="亮度"
57
+ valueStyle={{ color: 'blue' }}
58
+ min={1}
59
+ disable={false}
60
+ value={value}
61
+ onTouchMove={handleMove}
62
+ trackBackgroundColor="linear-gradient(270deg, #FFFFFF 2.57%, rgba(255, 255, 255, 0) 100.64%)"
63
+ thumbColorFormatterConfig={{
64
+ formatter: 'hsl(0deg 0% value%)',
65
+ scale: 0.1,
66
+ }}
67
+ />
96
68
  ```
69
+
70
+ ### 3. Hue slider
71
+
72
+ ```tsx
73
+ import OpacitySlider from '@ray-js/lamp-style-slider';
74
+
75
+ const [value, setValue] = useState(1000);
76
+ const handleMove = v => {
77
+ // console.log('move====', v);
78
+ };
79
+
80
+ <OpacitySlider
81
+ style={{
82
+ paddingLeft: 16,
83
+ }}
84
+ label="hue"
85
+ valueStyle={{ color: 'blue' }}
86
+ trackStyle={{ height: '100rpx' }}
87
+ thumbStyle={{
88
+ height: '100rpx',
89
+ borderRadius: '20rpx',
90
+ width: '40rpx',
91
+ boxShadow: 'rgb(0 0 0 / 53%) 0px 1px 7px',
92
+ }}
93
+ min={0}
94
+ max={360}
95
+ disable={false}
96
+ value={value}
97
+ onTouchMove={handleMove}
98
+ trackBackgroundColor="linear-gradient(0deg, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05)), linear-gradient(90.01deg, #FF0000 0.01%, #F8CB0E 12.14%, #80FE06 21.83%, #08FB2B 32.75%, #04FAFC 46.38%, #0243FC 58.38%, #8700F9 70.04%, #FC00EF 80.06%, #F00A5B 89.92%, #FF0000 99.99%)"
99
+ thumbColorFormatterConfig={{
100
+ formatter: 'hsl(valuedeg 100% 50%)',
101
+ }}
102
+ />
103
+ ```
104
+ ### 4. Saturation slider
105
+
106
+ ```tsx
107
+ import OpacitySlider from '@ray-js/lamp-style-slider';
108
+
109
+ const [value, setValue] = useState(1000);
110
+ const handleMove = v => {
111
+ // console.log('move====', v);
112
+ };
113
+
114
+ <OpacitySlider
115
+ style={{
116
+ paddingLeft: 16,
117
+ }}
118
+ label="saturation"
119
+ valueStyle={{ color: 'blue' }}
120
+ min={0}
121
+ max={100}
122
+ disable={false}
123
+ value={value}
124
+ onTouchMove={handleMove}
125
+ trackBackgroundColor={`linear-gradient(90deg, rgba(255, 255, 255, 0), ${hsv2rgbString(
126
+ 0,
127
+ 100,
128
+ 100
129
+ )})`}
130
+ thumbColorFormatterConfig={{
131
+ formatter: 'hsl(0deg 100% value%)',
132
+ scale: 0.5,
133
+ }}
134
+ />
135
+ ```
package/lib/index.js CHANGED
@@ -19,7 +19,6 @@ function OpacitySlider(props) {
19
19
  label,
20
20
  min = 0,
21
21
  max = 1000,
22
- rangeOffset = 38,
23
22
  value,
24
23
  style,
25
24
  trackStyle = {},
@@ -109,6 +108,7 @@ function OpacitySlider(props) {
109
108
  disable: disable,
110
109
  end: controllerValue - min,
111
110
  step: 1,
111
+ enableTouch: props.enableTouch,
112
112
  bindstart: _ref => {
113
113
  let {
114
114
  detail
@@ -158,7 +158,7 @@ function OpacitySlider(props) {
158
158
  border: '8rpx solid #fff',
159
159
  borderRadius: '50%',
160
160
  boxShadow: 'rgb(255 255 255 / 10%) 0px 0px 1px',
161
- background: `${disable ? '#000' : 'transparent'}`
161
+ background: `${'transparent'}`
162
162
  }, thumbStyle)),
163
163
  thumbStyleRenderFormatter: {
164
164
  background: props === null || props === void 0 ? void 0 : (_props$thumbColorForm = props.thumbColorFormatterConfig) === null || _props$thumbColorForm === void 0 ? void 0 : _props$thumbColorForm.formatter
package/lib/props.d.ts CHANGED
@@ -12,34 +12,34 @@ export interface IProps {
12
12
  */
13
13
  valueStyle?: React.CSSProperties;
14
14
  /**
15
- * @description.zh slider的背景颜色
16
- * @description.en Slider track background color
17
- * @default '''
18
- */
15
+ * @description.zh slider的背景颜色
16
+ * @description.en Slider track background color
17
+ * @default '''
18
+ */
19
19
  trackBackgroundColor?: string;
20
20
  /**
21
- * @description.zh 整体外层样式
22
- * @description.en Style
23
- * @default {}
24
- */
21
+ * @description.zh 整体外层样式
22
+ * @description.en Style
23
+ * @default {}
24
+ */
25
25
  style?: React.CSSProperties;
26
26
  /**
27
- * @description.zh 禁止滑动
28
- * @description.en Ban sliding
29
- * @default false
30
- */
27
+ * @description.zh 禁止滑动
28
+ * @description.en Ban sliding
29
+ * @default false
30
+ */
31
31
  disable?: boolean;
32
32
  /**
33
- * @description.zh 值的标签,不传不显示标签和值
34
- * @description.en label
35
- * @default ''
36
- */
33
+ * @description.zh 值的标签,不传不显示标签和值
34
+ * @description.en label
35
+ * @default ''
36
+ */
37
37
  label?: string;
38
38
  /**
39
- * @description.zh 自定义值显示,不传默认按百分比显示
40
- * @description.en custom textValue
41
- * @default '''
42
- */
39
+ * @description.zh 自定义值显示,不传默认按百分比显示
40
+ * @description.en custom textValue
41
+ * @default '''
42
+ */
43
43
  textValue?: string;
44
44
  /**
45
45
  * @description.zh 滑动条Track样式
@@ -58,12 +58,6 @@ export interface IProps {
58
58
  * @default 0
59
59
  */
60
60
  value: number;
61
- /**
62
- * @description.zh 滑块偏移量
63
- * @description.en thumb offset
64
- * @default 38
65
- */
66
- rangeOffset?: number;
67
61
  /**
68
62
  * @description.zh slider最小值
69
63
  * @description.en slider min value
@@ -71,10 +65,10 @@ export interface IProps {
71
65
  */
72
66
  min?: number;
73
67
  /**
74
- * @description.zh slider值 最大值
75
- * @description.en slider max value
76
- * @default 1000
77
- */
68
+ * @description.zh slider值 最大值
69
+ * @description.en slider max value
70
+ * @default 1000
71
+ */
78
72
  max?: number;
79
73
  /**
80
74
  * @description.zh 是否支持点击
package/lib/props.js CHANGED
@@ -6,7 +6,6 @@ export const defaultProps = {
6
6
  trackStyle: {},
7
7
  enableTouch: true,
8
8
  trackBackgroundColor: 'transparent',
9
- rangeOffset: 38,
10
9
  style: {},
11
10
  min: 0,
12
11
  max: 1000,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/lamp-style-slider",
3
- "version": "0.0.3-beta-7",
3
+ "version": "0.0.4",
4
4
  "description": "照明样式的基础滑动条",
5
5
  "main": "lib/index",
6
6
  "files": [
@@ -59,7 +59,7 @@
59
59
  ]
60
60
  },
61
61
  "dependencies": {
62
- "@ray-js/components-ty-slider": "0.2.36-beta-6"
62
+ "@ray-js/components-ty-slider": "^0.2.37"
63
63
  },
64
64
  "maintainers": [
65
65
  {