@ledvance/base 1.3.2 → 1.3.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/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "@ledvance/base",
5
5
  "pid": [],
6
6
  "uiid": "",
7
- "version": "1.3.2",
7
+ "version": "1.3.3",
8
8
  "scripts": {
9
9
  "prepublishOnly": "python update-localazy.py"
10
10
  },
@@ -6,12 +6,63 @@ import Spacer from './Spacer'
6
6
  import res from '../res'
7
7
 
8
8
  const cx = Utils.RatioUtils.convertX
9
+ const { withTheme } = Utils.ThemeUtils
9
10
 
10
11
  export interface ApplyForDeviceItemProps {
12
+ theme?: any
11
13
  deviceInfo: DeviceInfo
12
14
  }
13
15
 
14
16
  const ApplyForDeviceItem = (props: ApplyForDeviceItemProps) => {
17
+
18
+ const styles = StyleSheet.create({
19
+ root: {
20
+ marginHorizontal: cx(8),
21
+ backgroundColor: props.theme.global.background,
22
+ flexDirection: 'row',
23
+ alignItems: 'center'
24
+ },
25
+ deviceInfo: {
26
+ flex: 1,
27
+ flexDirection: 'row',
28
+ alignItems: 'center',
29
+ marginTop: cx(4),
30
+ },
31
+ deviceIcon: {
32
+ width: cx(24),
33
+ height: cx(24),
34
+ marginStart: cx(6),
35
+ },
36
+ deviceName: {
37
+ flex: 1,
38
+ marginStart: cx(8),
39
+ color: props.theme.global.fontColor,
40
+ fontSize: cx(16),
41
+ fontFamily: 'helvetica_neue_lt_std_roman',
42
+ },
43
+ deviceRoomInfo: {
44
+ marginStart: cx(38),
45
+ flexDirection: 'row',
46
+ },
47
+ roomNameTag: {
48
+ height: cx(16),
49
+ display: 'flex',
50
+ justifyContent: 'center',
51
+ backgroundColor: props.theme.tag.background,
52
+ borderRadius: cx(8),
53
+ },
54
+ roomName: {
55
+ marginHorizontal: cx(12),
56
+ color: props.theme.tag.fontColor,
57
+ fontSize: cx(10),
58
+ fontFamily: 'helvetica_neue_lt_std_roman',
59
+ },
60
+ offlineIcon: {
61
+ width: cx(24),
62
+ height: cx(24)
63
+ }
64
+ })
65
+
15
66
  return (
16
67
  <View style={styles.root}>
17
68
  <View style={{ flex: 1 }}>
@@ -33,52 +84,4 @@ const ApplyForDeviceItem = (props: ApplyForDeviceItemProps) => {
33
84
  )
34
85
  }
35
86
 
36
- const styles = StyleSheet.create({
37
- root: {
38
- marginHorizontal: cx(8),
39
- backgroundColor: '#fff',
40
- flexDirection: 'row',
41
- alignItems: 'center'
42
- },
43
- deviceInfo: {
44
- flex: 1,
45
- flexDirection: 'row',
46
- alignItems: 'center',
47
- marginTop: cx(4),
48
- },
49
- deviceIcon: {
50
- width: cx(24),
51
- height: cx(24),
52
- marginStart: cx(6),
53
- },
54
- deviceName: {
55
- flex: 1,
56
- marginStart: cx(8),
57
- color: '#666',
58
- fontSize: cx(16),
59
- fontFamily: 'helvetica_neue_lt_std_roman',
60
- },
61
- deviceRoomInfo: {
62
- marginStart: cx(38),
63
- flexDirection: 'row',
64
- },
65
- roomNameTag: {
66
- height: cx(16),
67
- display: 'flex',
68
- justifyContent: 'center',
69
- backgroundColor: '#cbcbcb',
70
- borderRadius: cx(8),
71
- },
72
- roomName: {
73
- marginHorizontal: cx(12),
74
- color: '#000',
75
- fontSize: cx(10),
76
- fontFamily: 'helvetica_neue_lt_std_roman',
77
- },
78
- offlineIcon: {
79
- width: cx(24),
80
- height: cx(24)
81
- }
82
- })
83
-
84
- export default ApplyForDeviceItem
87
+ export default withTheme(ApplyForDeviceItem)
@@ -8,14 +8,16 @@ import { Utils } from 'tuya-panel-kit'
8
8
  import { useReactive, useUpdateEffect } from 'ahooks'
9
9
 
10
10
  const cx = Utils.RatioUtils.convertX
11
+ const { withTheme } = Utils.ThemeUtils
11
12
 
12
13
  export interface ApplyForDeviceListProps {
14
+ theme?: any
13
15
  devices: DeviceInfo[]
14
16
  expand?: boolean
15
17
  onExpandChange?: (expand: boolean) => void
16
18
  }
17
19
 
18
- export default function ApplyForDeviceList(props: ApplyForDeviceListProps) {
20
+ const ApplyForDeviceList = (props: ApplyForDeviceListProps) => {
19
21
  const state = useReactive({
20
22
  expand: props.expand || false
21
23
  })
@@ -24,6 +26,17 @@ export default function ApplyForDeviceList(props: ApplyForDeviceListProps) {
24
26
  state.expand = props.expand || false
25
27
  }, [props.expand])
26
28
 
29
+ const styles = StyleSheet.create({
30
+ deviceList: {
31
+ marginHorizontal: cx(16),
32
+ paddingVertical: cx(8),
33
+ backgroundColor: props.theme.container.background,
34
+ },
35
+ spacer: {
36
+ backgroundColor: props.theme.container.background,
37
+ }
38
+ })
39
+
27
40
  return <View>
28
41
  <ApplyForText
29
42
  expand={state.expand}
@@ -36,27 +49,19 @@ export default function ApplyForDeviceList(props: ApplyForDeviceListProps) {
36
49
  }}/>
37
50
  <Spacer height={cx(2)}/>
38
51
  {state.expand &&
39
- <FlatList
40
- style={styles.deviceList}
41
- data={props.devices}
42
- renderItem={({ item }) => <ApplyForDeviceItem deviceInfo={item}/>}
43
- keyExtractor={item => item.deviceId}
44
- ItemSeparatorComponent={() => {
45
- return (
46
- <Spacer
47
- style={{
48
- backgroundColor: 'rgb(241,241,241)',
49
- }}
50
- height={cx(8)}/>
51
- )
52
- }}/>}
52
+ <FlatList
53
+ style={styles.deviceList}
54
+ data={props.devices}
55
+ renderItem={({ item }) => <ApplyForDeviceItem deviceInfo={item}/>}
56
+ keyExtractor={item => item.deviceId}
57
+ ItemSeparatorComponent={() => {
58
+ return (
59
+ <Spacer
60
+ style={styles.spacer}
61
+ height={cx(8)}/>
62
+ )
63
+ }}/>}
53
64
  </View>
54
65
  }
55
66
 
56
- const styles = StyleSheet.create({
57
- deviceList: {
58
- marginHorizontal: cx(16),
59
- paddingVertical: cx(8),
60
- backgroundColor: 'rgb(241,241,241)',
61
- },
62
- })
67
+ export default withTheme(ApplyForDeviceList)
@@ -5,13 +5,33 @@ import res from '../res/index'
5
5
  import I18n from '../i18n/index'
6
6
 
7
7
  const cx = Utils.RatioUtils.convertX
8
+ const { withTheme } = Utils.ThemeUtils
8
9
 
9
10
  export interface ApplyForTextProps {
11
+ theme?: any
10
12
  expand: boolean
11
13
  onExpandChange: (expand: boolean) => void
12
14
  }
13
15
 
14
16
  const ApplyForText = (props: ApplyForTextProps) => {
17
+ const styles = StyleSheet.create({
18
+ root: {
19
+ flexDirection: 'row',
20
+ alignItems: 'center',
21
+ marginStart: cx(16),
22
+ },
23
+ text: {
24
+ color: props.theme.global.secondFontColor,
25
+ fontSize: cx(16),
26
+ letterSpacing: cx(0.12),
27
+ fontFamily: 'helvetica_neue_lt_std_bd',
28
+ },
29
+ icon: {
30
+ tintColor: props.theme.global.secondFontColor,
31
+ width: cx(24),
32
+ height: cx(24),
33
+ },
34
+ })
15
35
  return (
16
36
  <TouchableOpacity
17
37
  onPress={() => {
@@ -32,22 +52,5 @@ const ApplyForText = (props: ApplyForTextProps) => {
32
52
  )
33
53
  }
34
54
 
35
- const styles = StyleSheet.create({
36
- root: {
37
- flexDirection: 'row',
38
- alignItems: 'center',
39
- marginStart: cx(16),
40
- },
41
- text: {
42
- color: '#666',
43
- fontSize: cx(16),
44
- letterSpacing: cx(0.12),
45
- fontFamily: 'helvetica_neue_lt_std_bd',
46
- },
47
- icon: {
48
- width: cx(24),
49
- height: cx(24),
50
- },
51
- })
52
55
 
53
- export default ApplyForText
56
+ export default withTheme(ApplyForText)
@@ -9,8 +9,10 @@ import I18n from '../i18n/index'
9
9
  import {cctToColor} from '../utils/cctUtils'
10
10
 
11
11
  const {convertX: cx} = Utils.RatioUtils
12
+ const { withTheme } = Utils.ThemeUtils
12
13
 
13
14
  export interface ColorTempAdjustViewProps {
15
+ theme?: any
14
16
  colorTemp: number
15
17
  brightness: number
16
18
  minBrightness?: number
@@ -55,4 +57,4 @@ const ColorTempAdjustView = (props: ColorTempAdjustViewProps) => {
55
57
  )
56
58
  }
57
59
 
58
- export default ColorTempAdjustView
60
+ export default withTheme(ColorTempAdjustView)
@@ -23,7 +23,7 @@ const DeleteButton = (props: DeleteButtonProps) => {
23
23
  style={[{
24
24
  width: '100%',
25
25
  height: cx(50),
26
- backgroundColor: props.theme.button.disabled,
26
+ backgroundColor: props.theme.button.delete,
27
27
  alignItems: 'center',
28
28
  justifyContent: 'center',
29
29
  borderRadius: cx(8),
@@ -4,8 +4,10 @@ import {Utils} from 'tuya-panel-kit'
4
4
  import Spacer from './Spacer'
5
5
 
6
6
  const cx = Utils.RatioUtils.convertX
7
+ const { withTheme } = Utils.ThemeUtils
7
8
 
8
9
  interface InfoTextProps extends ViewProps {
10
+ theme?: any
9
11
  icon: string | number
10
12
  text: string
11
13
  contentColor?: string
@@ -15,7 +17,7 @@ interface InfoTextProps extends ViewProps {
15
17
  }
16
18
 
17
19
  const InfoText = (props: InfoTextProps) => {
18
- const contentColor = props.contentColor || '#666666'
20
+ const contentColor = props.contentColor || props.theme.global.secondFontColor
19
21
  const source = typeof props.icon === 'string' ? {uri: props.icon} : props.icon
20
22
  return (
21
23
  <View style={[styles.root, props.style]}>
@@ -43,4 +45,4 @@ const styles = StyleSheet.create({
43
45
  },
44
46
  })
45
47
 
46
- export default InfoText
48
+ export default withTheme(InfoText)
@@ -1,13 +1,15 @@
1
1
  import React, { PropsWithChildren } from "react";
2
2
  import { View, Image, StyleSheet, Text, TouchableOpacity, ViewProps } from "react-native";
3
- import Card from "@ledvance/base/src/components/Card";
4
- import Spacer from "@ledvance/base/src/components/Spacer";
3
+ import Card from "components/Card";
4
+ import Spacer from "components/Spacer";
5
5
  import { Dialog, SwitchButton, Utils } from "tuya-panel-kit";
6
- import I18n from "@ledvance/base/src/i18n";
6
+ import I18n from "../i18n";
7
7
 
8
8
  const cx = Utils.RatioUtils.convertX
9
+ const { withTheme } = Utils.ThemeUtils
9
10
 
10
11
  interface SocketItemProps extends PropsWithChildren<ViewProps>{
12
+ theme?: any
11
13
  title: string
12
14
  name: string
13
15
  icon: any
@@ -18,6 +20,34 @@ interface SocketItemProps extends PropsWithChildren<ViewProps>{
18
20
  }
19
21
 
20
22
  function SocketItem(props: SocketItemProps) {
23
+
24
+ const styles = StyleSheet.create({
25
+ switchLine: {
26
+ flexDirection: 'row',
27
+ alignItems: 'center',
28
+ marginHorizontal: cx(16),
29
+ },
30
+ title: {
31
+ fontSize: cx(16),
32
+ color: props.theme.global.fontColor,
33
+ fontFamily: 'helvetica_neue_lt_std_bd',
34
+ fontWeight: 'bold',
35
+ },
36
+ icon: {
37
+ width: cx(60),
38
+ height: cx(20),
39
+ },
40
+ nameLine: {
41
+ flex: 1,
42
+ marginHorizontal: cx(16),
43
+ },
44
+ name: {
45
+ fontSize: cx(14),
46
+ color: props.theme.global.fontColor,
47
+ fontFamily: 'helvetica_neue_lt_std_roman',
48
+ },
49
+ })
50
+
21
51
  return (
22
52
  <Card style={{ marginHorizontal: cx(24) }}>
23
53
  <View>
@@ -58,31 +88,4 @@ function SocketItem(props: SocketItemProps) {
58
88
  )
59
89
  }
60
90
 
61
- const styles = StyleSheet.create({
62
- switchLine: {
63
- flexDirection: 'row',
64
- alignItems: 'center',
65
- marginHorizontal: cx(16),
66
- },
67
- title: {
68
- fontSize: cx(16),
69
- color: '#000',
70
- fontFamily: 'helvetica_neue_lt_std_bd',
71
- fontWeight: 'bold',
72
- },
73
- icon: {
74
- width: cx(60),
75
- height: cx(20),
76
- },
77
- nameLine: {
78
- flex: 1,
79
- marginHorizontal: cx(16),
80
- },
81
- name: {
82
- fontSize: cx(14),
83
- color: '#000',
84
- fontFamily: 'helvetica_neue_lt_std_roman',
85
- },
86
- })
87
-
88
- export default SocketItem
91
+ export default withTheme(SocketItem)
@@ -4,6 +4,7 @@ import {LinearGradient, Slider, Utils} from 'tuya-panel-kit'
4
4
  import {Rect} from 'react-native-svg'
5
5
 
6
6
  const cx = Utils.RatioUtils.convertX
7
+ const { withTheme } = Utils.ThemeUtils
7
8
 
8
9
  const temperatures = {
9
10
  '0%': 'rgb(254, 172, 90)',
@@ -27,6 +28,7 @@ const colors = {
27
28
  export const TEMP_KEY = 'temperature'
28
29
 
29
30
  interface LdvColorSliderProps {
31
+ theme?: any
30
32
  title: string,
31
33
  type: string,
32
34
  onValueChange?: (number) => void | undefined,
@@ -43,6 +45,54 @@ const LdvColorSlider = (props: LdvColorSliderProps) => {
43
45
  let max = type === TEMP_KEY ? 100 : 359
44
46
  let min = type === TEMP_KEY ? 0 : 0
45
47
  const width = props.width || (Utils.RatioUtils.width - cx(80))
48
+
49
+ const styles = StyleSheet.create({
50
+ container: {
51
+ height: cx(57),
52
+ flexDirection: 'column',
53
+ paddingStart: cx(16),
54
+ },
55
+ title: {
56
+ marginTop: cx(4),
57
+ fontSize: cx(14),
58
+ color: props.theme.global.fontColor,
59
+ fontFamily: 'helvetica_neue_lt_std_roman',
60
+ },
61
+ shadeSlider: {
62
+ marginTop: cx(8),
63
+ height: cx(28),
64
+ justifyContent: 'center',
65
+ },
66
+ sliderTrack: {
67
+ marginTop: cx(9),
68
+ marginBottom: cx(9),
69
+ flex: 1,
70
+ borderRadius: cx(15),
71
+ },
72
+ shadeThumb: {
73
+ backgroundColor: 'rgb(0, 249, 255)',
74
+ width: cx(28),
75
+ height: cx(28),
76
+ borderRadius: cx(14),
77
+ borderColor: 'white',
78
+ borderWidth: 1,
79
+ shadowColor: '#000000',
80
+ shadowOpacity: 0.2,
81
+ shadowRadius: cx(8),
82
+ elevation: cx(8),
83
+ shadowOffset: {
84
+ width: 0,
85
+ height: cx(4),
86
+ },
87
+ },
88
+ sliderLinearGradient: {
89
+ height: cx(12),
90
+ },
91
+ presetView: {
92
+ height: cx(60),
93
+ },
94
+ })
95
+
46
96
  return (
47
97
  <View style={[styles.container, props.style]}>
48
98
  <Text style={styles.title}>
@@ -82,51 +132,4 @@ const LdvColorSlider = (props: LdvColorSliderProps) => {
82
132
  )
83
133
  }
84
134
 
85
- const styles = StyleSheet.create({
86
- container: {
87
- height: cx(57),
88
- flexDirection: 'column',
89
- paddingStart: cx(16),
90
- },
91
- title: {
92
- marginTop: cx(4),
93
- fontSize: cx(14),
94
- color: '#000',
95
- fontFamily: 'helvetica_neue_lt_std_roman',
96
- },
97
- shadeSlider: {
98
- marginTop: cx(8),
99
- height: cx(28),
100
- justifyContent: 'center',
101
- },
102
- sliderTrack: {
103
- marginTop: cx(9),
104
- marginBottom: cx(9),
105
- flex: 1,
106
- borderRadius: cx(15),
107
- },
108
- shadeThumb: {
109
- backgroundColor: 'rgb(0, 249, 255)',
110
- width: cx(28),
111
- height: cx(28),
112
- borderRadius: cx(14),
113
- borderColor: 'white',
114
- borderWidth: 1,
115
- shadowColor: '#000000',
116
- shadowOpacity: 0.2,
117
- shadowRadius: cx(8),
118
- elevation: cx(8),
119
- shadowOffset: {
120
- width: 0,
121
- height: cx(4),
122
- },
123
- },
124
- sliderLinearGradient: {
125
- height: cx(12),
126
- },
127
- presetView: {
128
- height: cx(60),
129
- },
130
- })
131
-
132
- export default LdvColorSlider
135
+ export default withTheme(LdvColorSlider)
@@ -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)
@@ -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',
@@ -21,11 +21,17 @@ export default {
21
21
  background: '#2a2a2a',
22
22
  board: '#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: {
@@ -52,7 +58,7 @@ export default {
52
58
  confirmFontSize: 16, // 底部栏确认字体大小
53
59
  confirmFontColor: "#f60", // 底部栏确认字体颜色
54
60
  prompt: {
55
- bg: "#737373", // 输入框背景色
61
+ bg: '#737373', // 输入框背景色
56
62
  radius: cx(4), // 输入框圆角
57
63
  padding: "12px 16px", // 输入框边距
58
64
  placeholder: "#fff", // 占位符字体颜色
@@ -23,9 +23,15 @@ export default {
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: {
@@ -52,7 +58,7 @@ export default {
52
58
  confirmFontSize: 16, // 底部栏确认字体大小
53
59
  confirmFontColor: "#f60", // 底部栏确认字体颜色
54
60
  prompt: {
55
- bg: "#f8f8f8", // 输入框背景色
61
+ bg: "#F6F6F6", // 输入框背景色
56
62
  radius: cx(4), // 输入框圆角
57
63
  padding: "12px 16px", // 输入框边距
58
64
  placeholder: "#d6d6de", // 占位符字体颜色