@ledvance/base 1.3.104 → 1.3.106

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.
Files changed (33) hide show
  1. package/package.json +1 -1
  2. package/src/components/AdvanceCard.tsx +1 -1
  3. package/src/components/ApplyForDeviceItem.tsx +2 -2
  4. package/src/components/ApplyForText.tsx +1 -1
  5. package/src/components/Battery.tsx +88 -0
  6. package/src/components/BatteryPercentageView.tsx +47 -42
  7. package/src/components/BatteryStateView.tsx +2 -2
  8. package/src/components/Cell.tsx +2 -2
  9. package/src/components/ColorAdjustView.tsx +5 -4
  10. package/src/components/ColorTempAdjustView.tsx +4 -3
  11. package/src/components/ColorsLine.tsx +2 -0
  12. package/src/components/DeleteButton.tsx +1 -1
  13. package/src/components/DiySceneItem.tsx +2 -3
  14. package/src/components/DrawToolView.tsx +8 -5
  15. package/src/components/HybridSwitchView.tsx +1 -1
  16. package/src/components/InfoText.tsx +1 -1
  17. package/src/components/MoodColorsLine.tsx +4 -2
  18. package/src/components/OptionGroup.tsx +3 -3
  19. package/src/components/Page.tsx +16 -15
  20. package/src/components/SocketItem.tsx +2 -2
  21. package/src/components/Summary.tsx +1 -1
  22. package/src/components/Tag.tsx +1 -1
  23. package/src/components/TextButton.tsx +1 -1
  24. package/src/components/TextField.tsx +2 -2
  25. package/src/components/TextFieldStyleButton.tsx +2 -2
  26. package/src/components/UATabTitle.tsx +1 -1
  27. package/src/components/UATabs.tsx +1 -1
  28. package/src/components/ldvColorSlider.tsx +50 -46
  29. package/src/components/ldvSlider.tsx +2 -2
  30. package/src/components/ldvTemperatureSlider.tsx +2 -2
  31. package/src/components/ldvTopBar.tsx +1 -1
  32. package/src/components/segmentControl.tsx +2 -2
  33. package/src/i18n/strings.ts +88 -88
@@ -19,7 +19,7 @@ const UATabTitle = (props: UATabTitleProps) => {
19
19
  tabsTitle: {
20
20
  color: props.theme?.global.fontColor,
21
21
  fontSize: cx(14),
22
- fontFamily: 'helvetica_neue_lt_std_roman',
22
+ // fontFamily: 'helvetica_neue_lt_std_roman',
23
23
  },
24
24
  })
25
25
 
@@ -42,7 +42,7 @@ const UATabs = (props: UATabsProps) => {
42
42
  },
43
43
  tabText: {
44
44
  fontSize: cx(14),
45
- fontFamily: 'helvetica_neue_lt_std_roman',
45
+ // fontFamily: 'helvetica_neue_lt_std_roman',
46
46
  },
47
47
  })
48
48
 
@@ -1,10 +1,11 @@
1
- import React from 'react'
1
+ import React, { useMemo } from 'react'
2
2
  import {StyleProp, StyleSheet, Text, View, ViewStyle} from 'react-native'
3
3
  import {LinearGradient, Slider, Utils} from 'tuya-panel-kit'
4
4
  import {Rect} from 'react-native-svg'
5
5
  import ThemeType from '../config/themeType'
6
+ import { useIsPad } from '../models/modules/NativePropsSlice'
6
7
 
7
- const cx = Utils.RatioUtils.convertX
8
+ const { convertX: cx, width: screenWidth } = Utils.RatioUtils
8
9
  const { withTheme } = Utils.ThemeUtils
9
10
 
10
11
  const temperatures = {
@@ -42,12 +43,56 @@ interface LdvColorSliderProps {
42
43
 
43
44
  const LdvColorSlider = (props: LdvColorSliderProps) => {
44
45
  const {title, type, onSlidingComplete, thumbColor, value} = props
46
+ const isPad = useIsPad()
45
47
  let dataSource = type === TEMP_KEY ? temperatures : colors
46
48
  let max = type === TEMP_KEY ? 100 : 359
47
49
  let min = type === TEMP_KEY ? 0 : 0
48
- const width = props.width || (Utils.RatioUtils.width - cx(80))
50
+ const width = props.width || (isPad ? cx(screenWidth - 10) : (screenWidth - 80))
49
51
 
50
- const styles = StyleSheet.create({
52
+ const styles = useMemo(() => getStyles(props.theme), [props.theme])
53
+
54
+ return (
55
+ <View style={[styles.container, props.style]}>
56
+ <Text accessibilityLabel={"Color"} accessibilityHint={`${value}`} style={styles.title}>
57
+ {title}
58
+ </Text>
59
+ <Slider.Horizontal
60
+ accessibilityLabel={"ColorSliderHorizontal"}
61
+ style={{...styles.shadeSlider, width}}
62
+ styles={{track: styles.sliderTrack, thumb: {...styles.shadeThumb, backgroundColor: thumbColor}}}
63
+ maximumValue={max}
64
+ minimumValue={min}
65
+ value={value}
66
+ stepValue={1}
67
+ canTouchTrack={true}
68
+ theme={{
69
+ trackRadius: cx(15),
70
+ }}
71
+ onlyMaximumTrack={true}
72
+ renderMaximumTrack={() => {
73
+ return (
74
+ <View style={{flex: 1, borderRadius: cx(15)}}>
75
+ <LinearGradient
76
+ style={{...styles.sliderLinearGradient, width}}
77
+ x1="0%"
78
+ y1="0%"
79
+ x2="100%"
80
+ y2="0%"
81
+ stops={dataSource}>
82
+ <Rect {...styles.sliderLinearGradient} width={width}/>
83
+ </LinearGradient>
84
+ </View>
85
+ )
86
+ }}
87
+ onValueChange={props.onValueChange}
88
+ onSlidingComplete={onSlidingComplete}
89
+ />
90
+ </View>
91
+ )
92
+ }
93
+
94
+ const getStyles = (theme?: ThemeType) =>
95
+ StyleSheet.create({
51
96
  container: {
52
97
  height: cx(57),
53
98
  flexDirection: 'column',
@@ -56,8 +101,7 @@ const LdvColorSlider = (props: LdvColorSliderProps) => {
56
101
  title: {
57
102
  marginTop: cx(4),
58
103
  fontSize: cx(14),
59
- color: props.theme?.global.fontColor,
60
- fontFamily: 'helvetica_neue_lt_std_roman',
104
+ color: theme?.global.fontColor,
61
105
  },
62
106
  shadeSlider: {
63
107
  marginTop: cx(8),
@@ -94,44 +138,4 @@ const LdvColorSlider = (props: LdvColorSliderProps) => {
94
138
  },
95
139
  })
96
140
 
97
- return (
98
- <View style={[styles.container, props.style]}>
99
- <Text accessibilityLabel={"Color"} accessibilityHint={`${value}`} style={styles.title}>
100
- {title}
101
- </Text>
102
- <Slider.Horizontal
103
- accessibilityLabel={"ColorSliderHorizontal"}
104
- style={{...styles.shadeSlider, width}}
105
- styles={{track: styles.sliderTrack, thumb: {...styles.shadeThumb, backgroundColor: thumbColor}}}
106
- maximumValue={max}
107
- minimumValue={min}
108
- value={value}
109
- stepValue={1}
110
- canTouchTrack={true}
111
- theme={{
112
- trackRadius: cx(15),
113
- }}
114
- onlyMaximumTrack={true}
115
- renderMaximumTrack={() => {
116
- return (
117
- <View style={{flex: 1, borderRadius: cx(15)}}>
118
- <LinearGradient
119
- style={{...styles.sliderLinearGradient, width}}
120
- x1="0%"
121
- y1="0%"
122
- x2="100%"
123
- y2="0%"
124
- stops={dataSource}>
125
- <Rect {...styles.sliderLinearGradient} width={width}/>
126
- </LinearGradient>
127
- </View>
128
- )
129
- }}
130
- onValueChange={props.onValueChange}
131
- onSlidingComplete={onSlidingComplete}
132
- />
133
- </View>
134
- )
135
- }
136
-
137
141
  export default withTheme(LdvColorSlider)
@@ -46,13 +46,13 @@ const LdvSlider = (props: LdvSliderProps) => {
46
46
  marginTop: cx(10),
47
47
  fontSize: cx(14),
48
48
  color: props.theme?.global.fontColor,
49
- fontFamily: 'helvetica_neue_lt_std_roman',
49
+ // fontFamily: 'helvetica_neue_lt_std_roman',
50
50
  },
51
51
  title: {
52
52
  marginTop: cx(10),
53
53
  fontSize: cx(14),
54
54
  color: props.theme?.global.fontColor,
55
- fontFamily: 'helvetica_neue_lt_std_roman',
55
+ // fontFamily: 'helvetica_neue_lt_std_roman',
56
56
  },
57
57
  slider: {
58
58
  marginTop: cx(8),
@@ -99,13 +99,13 @@ const styles = StyleSheet.create({
99
99
  marginTop: cx(10),
100
100
  fontSize: cx(14),
101
101
  color: '#000',
102
- fontFamily: 'helvetica_neue_lt_std_roman',
102
+ // fontFamily: 'helvetica_neue_lt_std_roman',
103
103
  },
104
104
  title: {
105
105
  marginTop: cx(4),
106
106
  fontSize: cx(14),
107
107
  color: '#000',
108
- fontFamily: 'helvetica_neue_lt_std_roman',
108
+ // fontFamily: 'helvetica_neue_lt_std_roman',
109
109
  },
110
110
  shadeSlider: {
111
111
  marginTop: cx(8),
@@ -46,7 +46,7 @@ const LDVTopBar = (props: TopBarProps) => {
46
46
  maxWidth: cx(290),
47
47
  color: props.theme?.global.brand,
48
48
  fontSize: cx(16),
49
- fontFamily: 'helvetica_neue_lt_std_roman',
49
+ // fontFamily: 'helvetica_neue_lt_std_roman',
50
50
  }}>{props.title}</Text>
51
51
  </View>
52
52
  </TouchableOpacity>
@@ -36,7 +36,7 @@ const SegmentControl = (props) => {
36
36
  style={{
37
37
  color: props.theme?.segment.fontColor,
38
38
  fontSize: convertX(12),
39
- fontFamily: isFirst ? 'helvetica_neue_lt_std_bd' : 'helvetica_neue_lt_std_roman',
39
+ // fontFamily: isFirst ? 'helvetica_neue_lt_std_bd' : 'helvetica_neue_lt_std_roman',
40
40
  marginVertical: convertX(10),
41
41
  }}>
42
42
  {title1}
@@ -63,7 +63,7 @@ const SegmentControl = (props) => {
63
63
  style={{
64
64
  color: props.theme?.segment.fontColor,
65
65
  fontSize: convertX(12),
66
- fontFamily: isFirst ? 'helvetica_neue_lt_std_roman' : 'helvetica_neue_lt_std_bd',
66
+ // fontFamily: isFirst ? 'helvetica_neue_lt_std_roman' : 'helvetica_neue_lt_std_bd',
67
67
  marginVertical: convertX(10),
68
68
  }}>
69
69
  {title2}