@ledvance/base 1.3.2 → 1.3.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.
@@ -4,8 +4,10 @@ import {StyleProp, StyleSheet, Text, TextStyle, View, ViewStyle} from 'react-nat
4
4
  import {Slider, Utils} from 'tuya-panel-kit'
5
5
 
6
6
  const cx = Utils.RatioUtils.convertX
7
+ const { withTheme } = Utils.ThemeUtils
7
8
 
8
9
  interface LdvSliderProps {
10
+ theme?: any
9
11
  title: string,
10
12
  value: number,
11
13
  min?: number | undefined,
@@ -29,6 +31,49 @@ const LdvSlider = (props: LdvSliderProps) => {
29
31
  useEffect(() => {
30
32
  state.value = value
31
33
  }, [value])
34
+
35
+ const styles = StyleSheet.create({
36
+ container: {
37
+ flexDirection: 'column',
38
+ paddingHorizontal: cx(16),
39
+ },
40
+ titleBg: {
41
+ flexDirection: 'row',
42
+ justifyContent: 'space-between',
43
+ },
44
+ valueText: {
45
+ marginTop: cx(10),
46
+ fontSize: cx(14),
47
+ color: props.theme.global.fontColor,
48
+ fontFamily: 'helvetica_neue_lt_std_roman',
49
+ },
50
+ title: {
51
+ marginTop: cx(10),
52
+ fontSize: cx(14),
53
+ color: props.theme.global.fontColor,
54
+ fontFamily: 'helvetica_neue_lt_std_roman',
55
+ },
56
+ slider: {
57
+ marginTop: cx(8),
58
+ height: cx(28),
59
+ justifyContent: 'center',
60
+ },
61
+ thumb: {
62
+ backgroundColor: '#fff',
63
+ width: cx(28),
64
+ height: cx(28),
65
+ borderRadius: cx(14),
66
+ shadowColor: '#000000',
67
+ shadowOpacity: 0.2,
68
+ elevation: cx(8),
69
+ shadowRadius: cx(8),
70
+ shadowOffset: {
71
+ width: 0,
72
+ height: cx(4),
73
+ },
74
+ },
75
+ })
76
+
32
77
  return (
33
78
  <View style={[styles.container, props.style]}>
34
79
  <View style={styles.titleBg}>
@@ -59,46 +104,4 @@ const LdvSlider = (props: LdvSliderProps) => {
59
104
  )
60
105
  }
61
106
 
62
- const styles = StyleSheet.create({
63
- container: {
64
- flexDirection: 'column',
65
- paddingHorizontal: cx(16),
66
- },
67
- titleBg: {
68
- flexDirection: 'row',
69
- justifyContent: 'space-between',
70
- },
71
- valueText: {
72
- marginTop: cx(10),
73
- fontSize: cx(14),
74
- color: '#000',
75
- fontFamily: 'helvetica_neue_lt_std_roman',
76
- },
77
- title: {
78
- marginTop: cx(10),
79
- fontSize: cx(14),
80
- color: '#000',
81
- fontFamily: 'helvetica_neue_lt_std_roman',
82
- },
83
- slider: {
84
- marginTop: cx(8),
85
- height: cx(28),
86
- justifyContent: 'center',
87
- },
88
- thumb: {
89
- backgroundColor: '#fff',
90
- width: cx(28),
91
- height: cx(28),
92
- borderRadius: cx(14),
93
- shadowColor: '#000000',
94
- shadowOpacity: 0.2,
95
- elevation: cx(8),
96
- shadowRadius: cx(8),
97
- shadowOffset: {
98
- width: 0,
99
- height: cx(4),
100
- },
101
- },
102
- })
103
-
104
- export default LdvSlider
107
+ export default withTheme(LdvSlider)
@@ -1,25 +1,26 @@
1
1
  import Spacer from '@ledvance/base/src/components/Spacer'
2
2
  import React from 'react'
3
- import {Image, StyleSheet, Text, TouchableOpacity, View} from 'react-native'
4
- import {Utils} from 'tuya-panel-kit'
3
+ import { Image, StyleSheet, Text, TouchableOpacity, View } from 'react-native'
4
+ import { Utils } from 'tuya-panel-kit'
5
5
 
6
6
  const cx = Utils.RatioUtils.convertX
7
7
  const { withTheme } = Utils.ThemeUtils
8
8
 
9
9
  interface LdvTopNameProps {
10
10
  theme?: any
11
- title: string,
11
+ title?: string,
12
12
  rightIcon?: string | undefined | number,
13
13
  rightIconClick?: () => void
14
14
  showGreenery?: boolean
15
15
  greeneryIcon?: string | undefined | number
16
- headlineContent?: React.ReactNode
16
+ headlineIconContent?: React.ReactNode
17
17
  headlineTopContent?: React.ReactNode
18
+ headlineContent?: React.ReactNode
18
19
  }
19
20
 
20
21
  const LdvTopName = (props: LdvTopNameProps) => {
21
- const rightIcon = typeof props.rightIcon === 'number' ? props.rightIcon : {uri: props.rightIcon}
22
- const greeneryIcon = typeof props.greeneryIcon === 'number' ? props.greeneryIcon : {uri: props.greeneryIcon}
22
+ const rightIcon = typeof props.rightIcon === 'number' ? props.rightIcon : { uri: props.rightIcon }
23
+ const greeneryIcon = typeof props.greeneryIcon === 'number' ? props.greeneryIcon : { uri: props.greeneryIcon }
23
24
 
24
25
  const styles = StyleSheet.create({
25
26
  container: {
@@ -34,30 +35,30 @@ const LdvTopName = (props: LdvTopNameProps) => {
34
35
  return (
35
36
  <View style={styles.container}>
36
37
  {props.headlineTopContent && props.headlineTopContent}
37
- {!props.headlineTopContent && <Spacer height={cx(38)}/>}
38
+ {!props.headlineTopContent && <Spacer height={cx(38)} />}
38
39
  <View
39
40
  style={{
40
41
  flexDirection: 'row',
41
42
  justifyContent: 'space-between',
42
43
  alignItems: 'center',
43
44
  }}>
44
- <View style={{flexDirection: 'row', flex: 1}}>
45
+ {props.headlineContent ? props.headlineContent : <View style={{ flexDirection: 'row', flex: 1 }}>
45
46
  <Text style={styles.title}>
46
47
  {props.title}
47
48
  </Text>
48
49
  {props.showGreenery && <Image
49
- source={greeneryIcon}
50
- resizeMode="contain"
51
- style={{height: cx(16), width: cx(16), left: 0}}
50
+ source={greeneryIcon}
51
+ resizeMode="contain"
52
+ style={{ height: cx(16), width: cx(16), left: 0 }}
52
53
  /> || null}
53
- </View>
54
+ </View>}
54
55
  {props.rightIcon && <TouchableOpacity
55
- onPress={props.rightIconClick}>
56
- <Image
57
- style={{width: cx(24), height: cx(24), tintColor: props.theme.global.brand}}
58
- source={rightIcon}/>
56
+ onPress={props.rightIconClick}>
57
+ <Image
58
+ style={{ width: cx(24), height: cx(24), tintColor: props.theme.global.brand }}
59
+ source={rightIcon} />
59
60
  </TouchableOpacity>}
60
- {props.headlineContent && props.headlineContent}
61
+ {props.headlineIconContent && props.headlineIconContent}
61
62
  </View>
62
63
  </View>
63
64
  )
@@ -3,14 +3,15 @@ import React from 'react'
3
3
  import {Utils} from 'tuya-panel-kit'
4
4
 
5
5
  const {convertX} = Utils.RatioUtils
6
+ const { withTheme } = Utils.ThemeUtils
6
7
 
7
- export default function SegmentControl(props) {
8
+ const SegmentControl = (props) => {
8
9
 
9
10
  const {title1, title2, isFirst, setIsFirst, style, tabStyle} = props
10
11
 
11
12
  return (<View style={{}}>
12
13
  <View style={[{
13
- backgroundColor: '#eeeeef',
14
+ backgroundColor: props.theme.segment.background,
14
15
  marginHorizontal: convertX(24),
15
16
  marginVertical: convertX(0),
16
17
  borderRadius: convertX(8.9),
@@ -24,12 +25,12 @@ export default function SegmentControl(props) {
24
25
  margin: convertX(2),
25
26
  borderRadius: convertX(6.9),
26
27
  }, isFirst ?
27
- {backgroundColor: '#fff', margin: convertX(2), borderRadius: 6.9} :
28
- {backgroundColor: '#eeeeef'}, tabStyle]
28
+ {backgroundColor: props.theme.segment.active, margin: convertX(2), borderRadius: 6.9} :
29
+ {backgroundColor: props.theme.segment.background}, tabStyle]
29
30
  } onPress={() => setIsFirst(true)}>
30
31
  <Text
31
32
  style={{
32
- color: '#000',
33
+ color: props.theme.segment.fontColor,
33
34
  fontSize: convertX(12),
34
35
  fontFamily: isFirst ? 'helvetica_neue_lt_std_bd' : 'helvetica_neue_lt_std_roman',
35
36
  marginVertical: convertX(10),
@@ -47,13 +48,13 @@ export default function SegmentControl(props) {
47
48
  borderRadius: convertX(6.9),
48
49
  },
49
50
  !isFirst ?
50
- {backgroundColor: '#fff'} :
51
- {backgroundColor: '#eeeeef'}, tabStyle]
51
+ {backgroundColor: props.theme.segment.active} :
52
+ {backgroundColor: props.theme.segment.background}, tabStyle]
52
53
  }
53
54
  onPress={() => setIsFirst(false)}>
54
55
  <Text
55
56
  style={{
56
- color: '#000',
57
+ color: props.theme.segment.fontColor,
57
58
  fontSize: convertX(12),
58
59
  fontFamily: isFirst ? 'helvetica_neue_lt_std_roman' : 'helvetica_neue_lt_std_bd',
59
60
  marginVertical: convertX(10),
@@ -63,4 +64,6 @@ export default function SegmentControl(props) {
63
64
  </TouchableOpacity>
64
65
  </View>
65
66
  </View>)
66
- }
67
+ }
68
+
69
+ export default withTheme(SegmentControl)
@@ -8,7 +8,7 @@ export default {
8
8
  brand: '#fff',
9
9
  secondBrand: '#fff',
10
10
  thirdBrand: '#FFE0D4',
11
- background: '#000',
11
+ background: '#121212',
12
12
  fontColor: '#fff',
13
13
  secondFontColor: '#cccccc',
14
14
  disabledFontColor: '#555555',
@@ -19,13 +19,19 @@ export default {
19
19
  card: {
20
20
  head: '#666',
21
21
  background: '#2a2a2a',
22
- board: '#f6f6f6',
22
+ border: '#f6f6f6',
23
23
  fontColor: '#ffffff',
24
- shadowColor: '#444444'
24
+ shadowColor: '#ffffff'
25
+ },
26
+ container: {
27
+ background: '#444444',
28
+ divider: '#fff'
25
29
  },
26
30
  button: {
27
- active: '#f60',
28
- disabled: '#f60',
31
+ primary: '#f60',
32
+ delete: '#f60',
33
+ cancel: '#f60',
34
+ disabled: '#FFE0D4',
29
35
  fontColor: '#fff'
30
36
  },
31
37
  textInput: {
@@ -33,10 +39,25 @@ export default {
33
39
  fontColor: '#fff',
34
40
  line: '#fff'
35
41
  },
42
+ icon: {
43
+ primary: '#f60', /* 明亮的橙色,保持足够的突出 */
44
+ normal: '#a6a6a6', /* 中性灰,适合在深色背景上 */
45
+ disable: '#555555', /* 更深的灰色,表示禁用状态 */
46
+ },
36
47
  tag: {
37
48
  background: '#737373',
38
49
  fontColor: '#fff'
39
50
  },
51
+ segment: {
52
+ background: '#3a3a3c',
53
+ active: '#4a4a4c',
54
+ fontColor: '#ffffff',
55
+ },
56
+ addNode: {
57
+ background: '#4a4a4a',
58
+ border: '#888888',
59
+ fontColor: '#fff',
60
+ },
40
61
  dialog: {
41
62
  width: cx(315), // 弹窗容器宽度
42
63
  bg: "#2a2a2a", // 弹窗背景色
@@ -52,7 +73,7 @@ export default {
52
73
  confirmFontSize: 16, // 底部栏确认字体大小
53
74
  confirmFontColor: "#f60", // 底部栏确认字体颜色
54
75
  prompt: {
55
- bg: "#737373", // 输入框背景色
76
+ bg: '#737373', // 输入框背景色
56
77
  radius: cx(4), // 输入框圆角
57
78
  padding: "12px 16px", // 输入框边距
58
79
  placeholder: "#fff", // 占位符字体颜色
@@ -1,6 +1,6 @@
1
1
  import {Utils} from "tuya-panel-kit";
2
2
 
3
- const { convertX: cx } = Utils.RatioUtils
3
+ const {convertX: cx} = Utils.RatioUtils
4
4
 
5
5
  export default {
6
6
  type: 'light',
@@ -19,13 +19,19 @@ export default {
19
19
  card: {
20
20
  head: '#DFDEDE',
21
21
  background: '#fff',
22
- board: '#f6f6f6',
22
+ border: '#f6f6f6',
23
23
  fontColor: '#000',
24
24
  shadowColor: '#000'
25
25
  },
26
+ container: {
27
+ background: '#f6f6f6',
28
+ divider: '#cbcbcb'
29
+ },
26
30
  button: {
27
- active: '#f60',
28
- disabled: '#666666',
31
+ primary: '#f60',
32
+ delete: '#666',
33
+ cancel: '#666',
34
+ disabled: '#FFE0D4',
29
35
  fontColor: '#fff'
30
36
  },
31
37
  textInput: {
@@ -33,10 +39,25 @@ export default {
33
39
  fontColor: '#000',
34
40
  line: '#cbcbcb'
35
41
  },
42
+ icon: {
43
+ primary: '#f60',
44
+ normal: '#666',
45
+ disable: '#ccc',
46
+ },
36
47
  tag: {
37
48
  background: '#E6E7E8',
38
49
  fontColor: '#000'
39
50
  },
51
+ segment: {
52
+ background: '#eeeeef',
53
+ active: '#fff',
54
+ fontColor: '#000',
55
+ },
56
+ addNode: {
57
+ background: '#f6f6f6',
58
+ border: '#666',
59
+ fontColor: '#000',
60
+ },
40
61
  dialog: {
41
62
  width: cx(315), // 弹窗容器宽度
42
63
  bg: "#fff", // 弹窗背景色
@@ -52,7 +73,7 @@ export default {
52
73
  confirmFontSize: 16, // 底部栏确认字体大小
53
74
  confirmFontColor: "#f60", // 底部栏确认字体颜色
54
75
  prompt: {
55
- bg: "#f8f8f8", // 输入框背景色
76
+ bg: "#F6F6F6", // 输入框背景色
56
77
  radius: cx(4), // 输入框圆角
57
78
  padding: "12px 16px", // 输入框边距
58
79
  placeholder: "#d6d6de", // 占位符字体颜色