@ledvance/base 1.3.85 → 1.3.87

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/localazy.json CHANGED
@@ -1202,8 +1202,35 @@
1202
1202
  "MATCH:camera_motiondetection",
1203
1203
  "MATCH:camera_motiondetectiondescription",
1204
1204
  "MATCH:wifi_repeater_title",
1205
- "MATCH:wifi_repeater_description",
1206
- "MATCH:wifi_repeater_group_tips"
1205
+ "MATCH:wifirepeater_info",
1206
+ "MATCH:repeater_ssid",
1207
+ "MATCH:repeater_ssid_required",
1208
+ "MATCH:login_textfield_headline_pw",
1209
+ "MATCH:repeater_ssid_desc",
1210
+ "MATCH:password_required",
1211
+ "MATCH:repeater_change_wifi_tips",
1212
+ "MATCH:repeater_schedule_error_limit",
1213
+ "MATCH:repeater_schedule_error_common",
1214
+ "MATCH:repeater_other_device",
1215
+ "MATCH:internet_access",
1216
+ "MATCH:repeater_no_device",
1217
+ "MATCH:repeater_router_setting",
1218
+ "MATCH:repeater_repeater_setting",
1219
+ "MATCH:show_password",
1220
+ "MATCH:manage_room_headline_devices",
1221
+ "MATCH:repeater_quickly_config",
1222
+ "MATCH:repeater_copy_router_info",
1223
+ "MATCH:repeater_network_2_4g",
1224
+ "MATCH:repeater_applying_title",
1225
+ "MATCH:repeater_applying_content_1",
1226
+ "MATCH:repeater_applying_content_2",
1227
+ "MATCH:repeater_select_router",
1228
+ "MATCH:repeater_current_router",
1229
+ "MATCH:repeater_change_router_tips",
1230
+ "MATCH:repeater_select_other_router",
1231
+ "MATCH:repeater_password_error_length",
1232
+ "MATCH:repeater_password_error_space",
1233
+ "MATCH:cancel_dialog_leave_unsaved_repeater_note"
1207
1234
  ],
1208
1235
  "replacements": {
1209
1236
  "REGEX:% %1\\$s.*?\\)%": "{0}",
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "@ledvance/base",
5
5
  "pid": [],
6
6
  "uiid": "",
7
- "version": "1.3.85",
7
+ "version": "1.3.87",
8
8
  "scripts": {
9
9
  "prepublishOnly": "python update-localazy.py"
10
10
  },
@@ -0,0 +1,151 @@
1
+ import ThemeType from '../config/themeType'
2
+ import React, { useState, ReactNode } from 'react'
3
+ import {
4
+ View,
5
+ Text,
6
+ TouchableOpacity,
7
+ StyleSheet,
8
+ Image,
9
+ ImageSourcePropType,
10
+ } from 'react-native'
11
+ import { Utils } from 'tuya-panel-kit'
12
+
13
+ const cx = Utils.RatioUtils.convertX
14
+ const { withTheme } = Utils.ThemeUtils
15
+
16
+ export interface TabItem {
17
+ key: string
18
+ title: string
19
+ icon?: ImageSourcePropType
20
+ activeIcon?: ImageSourcePropType
21
+ }
22
+
23
+ interface BottomTabNavigatorProps {
24
+ theme?: ThemeType
25
+ tabs: TabItem[]
26
+ children: ReactNode
27
+ activeTabKey?: string
28
+ onTabChange: (tabKey: string) => void
29
+ backgroundColor?: string
30
+ activeColor?: string
31
+ inactiveColor?: string
32
+ tabBarStyle?: object
33
+ tabItemStyle?: object
34
+ iconSize?: number
35
+ }
36
+
37
+ const BottomTabNavigator: React.FC<BottomTabNavigatorProps> = (props: BottomTabNavigatorProps) => {
38
+ const { tabs,
39
+ children,
40
+ activeTabKey,
41
+ onTabChange,
42
+ backgroundColor = props.theme?.tabBar.background,
43
+ activeColor = props.theme?.tabBar.active,
44
+ inactiveColor = props.theme?.tabBar.inactive,
45
+ tabBarStyle,
46
+ tabItemStyle,
47
+ iconSize = cx(45),
48
+ } = props
49
+ const [internalActiveTab, setInternalActiveTab] = useState<string>(
50
+ activeTabKey || tabs[0]?.key || ''
51
+ )
52
+
53
+ const currentActiveTab = activeTabKey || internalActiveTab
54
+
55
+ const handleTabPress = (tabKey: string) => {
56
+ if (!activeTabKey) {
57
+ setInternalActiveTab(tabKey)
58
+ }
59
+ onTabChange(tabKey)
60
+ }
61
+
62
+ const renderTabIcon = (tab: TabItem, isActive: boolean) => {
63
+ if (!tab.icon) return null
64
+
65
+ const iconSource = isActive && tab.activeIcon ? tab.activeIcon : tab.icon
66
+
67
+ return (
68
+ <Image
69
+ source={iconSource}
70
+ style={[
71
+ styles.tabIcon,
72
+ {
73
+ width: iconSize,
74
+ height: iconSize,
75
+ tintColor: isActive ? activeColor : inactiveColor
76
+ }
77
+ ]}
78
+ resizeMode="contain"
79
+ />
80
+ )
81
+ }
82
+
83
+ const styles = StyleSheet.create({
84
+ container: {
85
+ flex: 1,
86
+ },
87
+ content: {
88
+ flex: 1,
89
+ },
90
+ tabBar: {
91
+ flexDirection: 'row',
92
+ borderTopWidth: 1,
93
+ borderTopColor: props.theme?.tabBar.divider,
94
+ paddingBottom: cx(10),
95
+ paddingTop: cx(5),
96
+ },
97
+ tabItem: {
98
+ flex: 1,
99
+ justifyContent: 'flex-end',
100
+ alignItems: 'center',
101
+ },
102
+ tabIcon: {
103
+ marginBottom: cx(2),
104
+ },
105
+ tabText: {
106
+ fontSize: cx(12),
107
+ textAlign: 'center',
108
+ },
109
+ })
110
+
111
+ return (
112
+ <View style={styles.container}>
113
+ {/* Main Content */}
114
+ <View style={styles.content}>
115
+ {children}
116
+ </View>
117
+
118
+ {/* Bottom Tab Bar */}
119
+ <View style={[
120
+ styles.tabBar,
121
+ { backgroundColor },
122
+ tabBarStyle
123
+ ]}>
124
+ {tabs.map((tab) => {
125
+ const isActive = currentActiveTab === tab.key
126
+
127
+ return (
128
+ <TouchableOpacity
129
+ key={tab.key}
130
+ style={[styles.tabItem, tabItemStyle]}
131
+ onPress={() => handleTabPress(tab.key)}
132
+ activeOpacity={0.8}
133
+ >
134
+ {renderTabIcon(tab, isActive)}
135
+ <Text
136
+ style={[
137
+ styles.tabText,
138
+ { color: isActive ? activeColor : inactiveColor }
139
+ ]}
140
+ >
141
+ {tab.title}
142
+ </Text>
143
+ </TouchableOpacity>
144
+ )
145
+ })}
146
+ </View>
147
+ </View>
148
+ )
149
+ }
150
+
151
+ export default withTheme(BottomTabNavigator)
@@ -56,14 +56,20 @@ const NewColorTempPicker = React.memo((props: ColorTempAdjustViewProps) => {
56
56
  }
57
57
  }, [colorTemp, brightness])
58
58
 
59
- const handleMove = useCallback((v) => {
60
- onCCTChange?.(scaleDown(v.temperature))
61
- onBrightnessChange?.(scaleDown(v.brightness))
59
+ const handleMove = useCallback((v, options) => {
60
+ if (options?.isChangeBright) {
61
+ onBrightnessChange?.(scaleDown(v.brightness))
62
+ } else {
63
+ onCCTChange?.(scaleDown(v.temperature))
64
+ }
62
65
  }, [onCCTChange, onBrightnessChange])
63
66
 
64
- const handleComplete = useCallback((v) => {
65
- onCCTChangeComplete?.(scaleDown(v.temperature))
66
- onBrightnessChangeComplete?.(scaleDown(v.brightness))
67
+ const handleComplete = useCallback((v, options) => {
68
+ if (options?.isChangeBright) {
69
+ onBrightnessChangeComplete?.(scaleDown(v.brightness))
70
+ } else {
71
+ onCCTChangeComplete?.(scaleDown(v.temperature))
72
+ }
67
73
  state.moving = false
68
74
  }, [onCCTChangeComplete, onBrightnessChangeComplete])
69
75
 
@@ -494,7 +494,8 @@ export default class Slider extends React.Component<IProps, IState> {
494
494
  }
495
495
 
496
496
  const clampedX = Math.max(0, Math.min(this.sliderWidth, x));
497
- return Math.round((clampedX / this.sliderWidth) * (max - min) + min);
497
+ const value = Math.round((clampedX / this.sliderWidth) * (max - min) + min);
498
+ return Math.round(value / 10) * 10
498
499
  }
499
500
 
500
501
  render() {
@@ -269,7 +269,8 @@ export default class WhitePicker extends Component<WhiteProps, IWhite> {
269
269
  const total = Math.sqrt(normalVector.x ** 2 + normalVector.y ** 2);
270
270
  const diff = (vector1.x * normalVector.x + vector1.y * normalVector.y) / total;
271
271
  const temperature = Math.round((diff / total) * 1000);
272
- return { temperature, brightness };
272
+ const newTemperature = Math.round(temperature / 10) * 10
273
+ return { temperature: newTemperature, brightness };
273
274
  };
274
275
 
275
276
  handleTemperaturePosition(temperature: number, bound: ValidBound) {