@ledvance/base 1.0.1
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/.babelrc +31 -0
- package/.eslintignore +6 -0
- package/.eslintrc.js +27 -0
- package/.prettierignore +0 -0
- package/.prettierrc.js +1 -0
- package/.versionrc +5 -0
- package/package.json +71 -0
- package/rn-cli.config.js +8 -0
- package/src/api/native.d.ts +16 -0
- package/src/api/native.ts +161 -0
- package/src/api/nativeEventEmitter.d.ts +2 -0
- package/src/api/nativeEventEmitter.ts +24 -0
- package/src/components/Card.d.ts +9 -0
- package/src/components/Card.tsx +35 -0
- package/src/components/Cell.d.ts +9 -0
- package/src/components/Cell.tsx +41 -0
- package/src/components/ColorAdjustView.d.ts +9 -0
- package/src/components/ColorAdjustView.tsx +66 -0
- package/src/components/ColorTempAdjustView.d.ts +12 -0
- package/src/components/ColorTempAdjustView.tsx +55 -0
- package/src/components/Dialog.d.ts +10 -0
- package/src/components/Dialog.tsx +39 -0
- package/src/components/InfoText.d.ts +10 -0
- package/src/components/InfoText.tsx +44 -0
- package/src/components/LampAdjustView.d.ts +13 -0
- package/src/components/LampAdjustView.tsx +76 -0
- package/src/components/LinearGradientLine.d.ts +9 -0
- package/src/components/LinearGradientLine.tsx +65 -0
- package/src/components/Page.d.ts +11 -0
- package/src/components/Page.tsx +35 -0
- package/src/components/Spacer.d.ts +7 -0
- package/src/components/Spacer.tsx +14 -0
- package/src/components/Tag.d.ts +8 -0
- package/src/components/Tag.tsx +57 -0
- package/src/components/TextButton.d.ts +9 -0
- package/src/components/TextButton.tsx +32 -0
- package/src/components/TextField.d.ts +5 -0
- package/src/components/TextField.tsx +74 -0
- package/src/components/connect.d.ts +10 -0
- package/src/components/connect.tsx +20 -0
- package/src/components/ldvColorBrightness.d.ts +1 -0
- package/src/components/ldvColorBrightness.tsx +18 -0
- package/src/components/ldvColorSlider.d.ts +14 -0
- package/src/components/ldvColorSlider.tsx +132 -0
- package/src/components/ldvPickerView.d.ts +10 -0
- package/src/components/ldvPickerView.tsx +68 -0
- package/src/components/ldvPresetView.d.ts +2 -0
- package/src/components/ldvPresetView.tsx +89 -0
- package/src/components/ldvSaturation.d.ts +2 -0
- package/src/components/ldvSaturation.tsx +23 -0
- package/src/components/ldvSlider.d.ts +15 -0
- package/src/components/ldvSlider.tsx +104 -0
- package/src/components/ldvSwitch.d.ts +9 -0
- package/src/components/ldvSwitch.tsx +48 -0
- package/src/components/ldvTemperatureSlider.d.ts +13 -0
- package/src/components/ldvTemperatureSlider.tsx +140 -0
- package/src/components/ldvTopBar.d.ts +9 -0
- package/src/components/ldvTopBar.tsx +64 -0
- package/src/components/ldvTopName.d.ts +7 -0
- package/src/components/ldvTopName.tsx +47 -0
- package/src/components/segmentControl.d.ts +1 -0
- package/src/components/segmentControl.tsx +66 -0
- package/src/components/weekSelect.d.ts +7 -0
- package/src/components/weekSelect.tsx +95 -0
- package/src/composeLayout.tsx +148 -0
- package/src/i18n/index.d.ts +16 -0
- package/src/i18n/index.ts +36 -0
- package/src/i18n/strings.d.ts +3139 -0
- package/src/i18n/strings.ts +3234 -0
- package/src/main.tsx +9 -0
- package/src/models/GlobalParams.d.ts +14 -0
- package/src/models/GlobalParams.ts +15 -0
- package/src/models/TuyaApi.d.ts +17 -0
- package/src/models/TuyaApi.ts +37 -0
- package/src/models/combine.d.ts +26 -0
- package/src/models/combine.ts +17 -0
- package/src/models/configureStore.d.ts +9 -0
- package/src/models/configureStore.ts +33 -0
- package/src/models/index.d.ts +31 -0
- package/src/models/index.ts +22 -0
- package/src/models/modules/NativePropsSlice.d.ts +25 -0
- package/src/models/modules/NativePropsSlice.tsx +145 -0
- package/src/models/modules/Result.d.ts +14 -0
- package/src/models/modules/Result.ts +16 -0
- package/src/models/modules/common.d.ts +44 -0
- package/src/models/modules/common.ts +161 -0
- package/src/res/index.d.ts +38 -0
- package/src/res/index.ts +37 -0
- package/src/utils/ColorParser.d.ts +66 -0
- package/src/utils/ColorParser.ts +190 -0
- package/src/utils/ColorUtils.d.ts +71 -0
- package/src/utils/ColorUtils.tsx +449 -0
- package/src/utils/common.d.ts +11 -0
- package/src/utils/common.ts +54 -0
- package/src/utils/index.d.ts +24 -0
- package/src/utils/index.ts +164 -0
- package/tsconfig.json +51 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ImageStyle, StyleProp, TextStyle, ViewProps } from 'react-native';
|
|
2
|
+
interface InfoTextProps extends ViewProps {
|
|
3
|
+
icon: string;
|
|
4
|
+
text: string;
|
|
5
|
+
contentColor?: string;
|
|
6
|
+
iconStyle?: StyleProp<ImageStyle>;
|
|
7
|
+
textStyle?: StyleProp<TextStyle>;
|
|
8
|
+
}
|
|
9
|
+
declare const InfoText: (props: InfoTextProps) => JSX.Element;
|
|
10
|
+
export default InfoText;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Image, ImageStyle, StyleProp, StyleSheet, Text, TextStyle, View, ViewProps } from 'react-native'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { Utils } from 'tuya-panel-kit'
|
|
4
|
+
import Spacer from './Spacer'
|
|
5
|
+
|
|
6
|
+
const cx = Utils.RatioUtils.convertX
|
|
7
|
+
|
|
8
|
+
interface InfoTextProps extends ViewProps {
|
|
9
|
+
icon: string
|
|
10
|
+
text: string
|
|
11
|
+
contentColor?: string
|
|
12
|
+
iconStyle?: StyleProp<ImageStyle>
|
|
13
|
+
textStyle?: StyleProp<TextStyle>
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const InfoText = (props: InfoTextProps) => {
|
|
17
|
+
const contentColor = props.contentColor || '#666666'
|
|
18
|
+
return (
|
|
19
|
+
<View style={styles.root}>
|
|
20
|
+
<Image style={[styles.icon, props.iconStyle, { tintColor: contentColor }]}
|
|
21
|
+
source={{ uri: props.icon }} />
|
|
22
|
+
<Spacer width={cx(4)} height={0} />
|
|
23
|
+
<Text style={[styles.text, props.textStyle, { color: contentColor }]}>{props.text}</Text>
|
|
24
|
+
</View>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const styles = StyleSheet.create({
|
|
29
|
+
root: {
|
|
30
|
+
flexDirection: 'row',
|
|
31
|
+
},
|
|
32
|
+
icon: {
|
|
33
|
+
width: cx(16),
|
|
34
|
+
height: cx(16),
|
|
35
|
+
},
|
|
36
|
+
text: {
|
|
37
|
+
flex: 1,
|
|
38
|
+
marginTop: cx(2.5),
|
|
39
|
+
fontSize: cx(12),
|
|
40
|
+
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
41
|
+
},
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
export default InfoText
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ColorAdjustViewProps } from './ColorAdjustView';
|
|
2
|
+
import { ColorTempAdjustViewProps } from './ColorTempAdjustView';
|
|
3
|
+
interface LampConfigViewProps extends ColorAdjustViewProps, ColorTempAdjustViewProps {
|
|
4
|
+
isRGBWLamp: boolean;
|
|
5
|
+
isRGBLamp: boolean;
|
|
6
|
+
isOnlyRGBLamp: boolean;
|
|
7
|
+
isTWLamp: boolean;
|
|
8
|
+
isDIMLamp: boolean;
|
|
9
|
+
isColorMode: boolean;
|
|
10
|
+
setIsColorMode: (isColorMode: boolean) => void;
|
|
11
|
+
}
|
|
12
|
+
declare const LampAdjustView: (props: LampConfigViewProps) => JSX.Element;
|
|
13
|
+
export default LampAdjustView;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import {StyleSheet, View} from 'react-native'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import {Utils} from 'tuya-panel-kit'
|
|
4
|
+
import {useReactive} from 'ahooks'
|
|
5
|
+
import Spacer from './Spacer'
|
|
6
|
+
import ColorAdjustView, {ColorAdjustViewProps} from './ColorAdjustView'
|
|
7
|
+
import ColorTempAdjustView, {ColorTempAdjustViewProps} from './ColorTempAdjustView'
|
|
8
|
+
import SegmentControl from './segmentControl'
|
|
9
|
+
import I18n from '../i18n/index'
|
|
10
|
+
|
|
11
|
+
const {convertX: cx} = Utils.RatioUtils
|
|
12
|
+
|
|
13
|
+
interface LampConfigViewProps extends ColorAdjustViewProps, ColorTempAdjustViewProps {
|
|
14
|
+
isRGBWLamp: boolean
|
|
15
|
+
isRGBLamp: boolean
|
|
16
|
+
isOnlyRGBLamp: boolean
|
|
17
|
+
isTWLamp: boolean
|
|
18
|
+
isDIMLamp: boolean
|
|
19
|
+
isColorMode: boolean
|
|
20
|
+
setIsColorMode: (isColorMode: boolean) => void
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const LampAdjustView = (props: LampConfigViewProps) => {
|
|
24
|
+
|
|
25
|
+
const state = useReactive({
|
|
26
|
+
hasSegmentControl: props.isRGBWLamp || props.isRGBLamp,
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<View>
|
|
31
|
+
{state.hasSegmentControl &&
|
|
32
|
+
<SegmentControl
|
|
33
|
+
style={styles.segmentControl}
|
|
34
|
+
title1={I18n.getLang('light_sources_tile_rgb_lighting_tab_color')}
|
|
35
|
+
title2={I18n.getLang('light_sources_tile_rgb_lighting_tab_white')}
|
|
36
|
+
isFirst={props.isColorMode}
|
|
37
|
+
setIsFirst={props.setIsColorMode}/>
|
|
38
|
+
}
|
|
39
|
+
{(props.isOnlyRGBLamp || (state.hasSegmentControl && props.isColorMode)) &&
|
|
40
|
+
<>
|
|
41
|
+
{state.hasSegmentControl && <Spacer height={cx(10)}/>}
|
|
42
|
+
<ColorAdjustView
|
|
43
|
+
h={props.h}
|
|
44
|
+
s={props.s}
|
|
45
|
+
v={props.v}
|
|
46
|
+
onHSVChange={props.onHSVChange}
|
|
47
|
+
onHSVChangeComplete={props.onHSVChangeComplete}/>
|
|
48
|
+
<Spacer/>
|
|
49
|
+
</>
|
|
50
|
+
}
|
|
51
|
+
{(props.isTWLamp || props.isDIMLamp || (!props.isColorMode)) &&
|
|
52
|
+
<>
|
|
53
|
+
{state.hasSegmentControl && <Spacer height={cx(10)}/>}
|
|
54
|
+
<ColorTempAdjustView
|
|
55
|
+
isSupportTemperature={props.isSupportTemperature}
|
|
56
|
+
isSupportBrightness={props.isSupportBrightness}
|
|
57
|
+
colorTemp={props.colorTemp}
|
|
58
|
+
brightness={props.brightness}
|
|
59
|
+
onCCTChange={props.onCCTChange}
|
|
60
|
+
onCCTChangeComplete={props.onCCTChangeComplete}
|
|
61
|
+
onBrightnessChange={props.onBrightnessChange}
|
|
62
|
+
onBrightnessChangeComplete={props.onBrightnessChangeComplete}/>
|
|
63
|
+
<Spacer/>
|
|
64
|
+
</>
|
|
65
|
+
}
|
|
66
|
+
</View>
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const styles = StyleSheet.create({
|
|
71
|
+
segmentControl: {
|
|
72
|
+
marginHorizontal: cx(16),
|
|
73
|
+
},
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
export default LampAdjustView
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { StyleProp } from 'react-native';
|
|
2
|
+
interface LinearGradientLineProps extends StyleProp<any> {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
colors: string[];
|
|
6
|
+
orientation?: 'vertical' | 'horizontal';
|
|
7
|
+
}
|
|
8
|
+
declare const LinearGradientLine: (props: LinearGradientLineProps) => JSX.Element;
|
|
9
|
+
export default LinearGradientLine;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { LinearGradient } from 'tuya-panel-kit'
|
|
2
|
+
import React, { useEffect } from 'react'
|
|
3
|
+
import { Rect } from 'react-native-svg'
|
|
4
|
+
import { StyleProp, View } from 'react-native'
|
|
5
|
+
import { useReactive } from 'ahooks'
|
|
6
|
+
|
|
7
|
+
interface LinearGradientLineProps extends StyleProp<any> {
|
|
8
|
+
width: number
|
|
9
|
+
height: number
|
|
10
|
+
colors: string[]
|
|
11
|
+
orientation?: 'vertical' | 'horizontal'
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const LinearGradientLine = (props: LinearGradientLineProps) => {
|
|
15
|
+
const { width, height } = props
|
|
16
|
+
|
|
17
|
+
const state = useReactive({
|
|
18
|
+
x1: '0%',
|
|
19
|
+
y1: '50%',
|
|
20
|
+
x2: '100%',
|
|
21
|
+
y2: '50%',
|
|
22
|
+
stops: {},
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (props.orientation === 'vertical') {
|
|
27
|
+
state.x1 = '50%'
|
|
28
|
+
state.y1 = '0%'
|
|
29
|
+
state.x2 = '50%'
|
|
30
|
+
state.y2 = '100%'
|
|
31
|
+
} else {
|
|
32
|
+
state.x1 = '0%'
|
|
33
|
+
state.y1 = '50%'
|
|
34
|
+
state.x2 = '100%'
|
|
35
|
+
state.y2 = '50%'
|
|
36
|
+
}
|
|
37
|
+
}, [props.orientation])
|
|
38
|
+
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
const p = (1 / (props.colors.length - 1)) * 100
|
|
41
|
+
let pc = 0
|
|
42
|
+
props.colors.forEach(color => {
|
|
43
|
+
state.stops[`${pc}%`] = color
|
|
44
|
+
pc += p
|
|
45
|
+
})
|
|
46
|
+
console.log('LinearGradientLine colors', JSON.stringify(state.stops))
|
|
47
|
+
}, [props.colors])
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<View style={[{ width, height, overflow: 'hidden' }, props.style]}>
|
|
51
|
+
<LinearGradient
|
|
52
|
+
gradientId="Gradient"
|
|
53
|
+
style={{ width, height }}
|
|
54
|
+
x1={state.x1}
|
|
55
|
+
y1={state.y1}
|
|
56
|
+
x2={state.x2}
|
|
57
|
+
y2={state.y2}
|
|
58
|
+
stops={state.stops}>
|
|
59
|
+
<Rect width={width} height={height} />
|
|
60
|
+
</LinearGradient>
|
|
61
|
+
</View>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export default LinearGradientLine
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { ViewProps } from 'react-native';
|
|
3
|
+
interface PageProps extends PropsWithChildren<ViewProps> {
|
|
4
|
+
backText: string;
|
|
5
|
+
onBackClick?: () => void;
|
|
6
|
+
headlineText?: string;
|
|
7
|
+
headlineIcon?: string;
|
|
8
|
+
onHeadlineIconClick?: () => void;
|
|
9
|
+
}
|
|
10
|
+
declare const Page: (props: PageProps) => JSX.Element;
|
|
11
|
+
export default Page;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from 'react'
|
|
2
|
+
import { View, ViewProps } from 'react-native'
|
|
3
|
+
import LDVTopBar from './ldvTopBar'
|
|
4
|
+
import { useNavigation } from '@react-navigation/native'
|
|
5
|
+
import LdvTopName from './ldvTopName'
|
|
6
|
+
|
|
7
|
+
interface PageProps extends PropsWithChildren<ViewProps> {
|
|
8
|
+
backText: string
|
|
9
|
+
onBackClick?: () => void
|
|
10
|
+
headlineText?: string
|
|
11
|
+
headlineIcon?: string
|
|
12
|
+
onHeadlineIconClick?: () => void
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const Page = (props: PageProps) => {
|
|
16
|
+
const navigation = useNavigation()
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<View style={[{ flex: 1 }, props.style]}>
|
|
20
|
+
<LDVTopBar
|
|
21
|
+
title={props.backText}
|
|
22
|
+
onBackPress={props.onBackClick || (() => {
|
|
23
|
+
navigation.goBack()
|
|
24
|
+
})} />
|
|
25
|
+
{props.headlineText &&
|
|
26
|
+
<LdvTopName
|
|
27
|
+
title={props.headlineText}
|
|
28
|
+
rightIcon={props.headlineIcon}
|
|
29
|
+
rightIconClick={props.onHeadlineIconClick} />}
|
|
30
|
+
{props.children}
|
|
31
|
+
</View>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default Page
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { View, ViewProps } from 'react-native'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { Utils } from 'tuya-panel-kit'
|
|
4
|
+
|
|
5
|
+
const cx = Utils.RatioUtils.convertX
|
|
6
|
+
|
|
7
|
+
interface SpacerProps extends ViewProps {
|
|
8
|
+
width?: number
|
|
9
|
+
height?: number
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default function Spacer(props: SpacerProps) {
|
|
13
|
+
return <View style={[{ width: props.width, height: props.height || cx(20) }, props.style]} />
|
|
14
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Image, StyleSheet, Text, TouchableOpacity, View, ViewProps } from 'react-native'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { Utils } from 'tuya-panel-kit'
|
|
4
|
+
import res from '../res'
|
|
5
|
+
|
|
6
|
+
const cx = Utils.RatioUtils.convertX
|
|
7
|
+
|
|
8
|
+
interface TagProps extends ViewProps {
|
|
9
|
+
checked: boolean
|
|
10
|
+
text: string
|
|
11
|
+
onCheckedChange: (boolean) => void
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const Tag = (props: TagProps) => {
|
|
15
|
+
return (
|
|
16
|
+
<TouchableOpacity
|
|
17
|
+
onPress={() => {
|
|
18
|
+
props.onCheckedChange(!props.checked)
|
|
19
|
+
}}>
|
|
20
|
+
<View style={[styles.root, props.checked ? { backgroundColor: '#ffe0d4' } : {}, props.style]}>
|
|
21
|
+
<Text style={[styles.text, { marginEnd: cx(props.checked ? 4 : 12) }]}>{props.text}</Text>
|
|
22
|
+
{
|
|
23
|
+
props.checked &&
|
|
24
|
+
<Image
|
|
25
|
+
source={{ uri: res.ic_arrows_nav_clear }}
|
|
26
|
+
style={styles.icon} />
|
|
27
|
+
}
|
|
28
|
+
</View>
|
|
29
|
+
</TouchableOpacity>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const styles = StyleSheet.create({
|
|
34
|
+
root: {
|
|
35
|
+
height: cx(24),
|
|
36
|
+
flexDirection: 'row',
|
|
37
|
+
justifyContent: 'center',
|
|
38
|
+
alignItems: 'center',
|
|
39
|
+
borderWidth: cx(1),
|
|
40
|
+
borderColor: '#ff6600',
|
|
41
|
+
borderRadius: cx(12),
|
|
42
|
+
},
|
|
43
|
+
text: {
|
|
44
|
+
marginStart: cx(12),
|
|
45
|
+
color: '#ff6600',
|
|
46
|
+
fontSize: cx(14),
|
|
47
|
+
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
48
|
+
},
|
|
49
|
+
icon: {
|
|
50
|
+
width: cx(12),
|
|
51
|
+
height: cx(12),
|
|
52
|
+
marginEnd: cx(6),
|
|
53
|
+
tintColor: '#F60',
|
|
54
|
+
},
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
export default Tag
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { StyleProp, ViewStyle, TextStyle } from 'react-native';
|
|
2
|
+
interface TextButtonProps {
|
|
3
|
+
text: string;
|
|
4
|
+
onPress: () => void;
|
|
5
|
+
style?: StyleProp<ViewStyle>;
|
|
6
|
+
textStyle?: StyleProp<TextStyle>;
|
|
7
|
+
}
|
|
8
|
+
export default function TextButton(props: TextButtonProps): JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { TouchableOpacity, Text, StyleProp, ViewStyle, TextStyle } from 'react-native'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { Utils } from 'tuya-panel-kit'
|
|
4
|
+
|
|
5
|
+
const cx = Utils.RatioUtils.convertX
|
|
6
|
+
|
|
7
|
+
interface TextButtonProps {
|
|
8
|
+
text: string,
|
|
9
|
+
onPress: () => void,
|
|
10
|
+
style?: StyleProp<ViewStyle>
|
|
11
|
+
textStyle?: StyleProp<TextStyle>
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default function TextButton(props: TextButtonProps) {
|
|
15
|
+
return (
|
|
16
|
+
<TouchableOpacity
|
|
17
|
+
style={[{
|
|
18
|
+
justifyContent: 'center',
|
|
19
|
+
alignItems: 'center',
|
|
20
|
+
alignSelf: 'center',
|
|
21
|
+
paddingVertical: cx(8),
|
|
22
|
+
paddingHorizontal: cx(12),
|
|
23
|
+
}, props.style]}
|
|
24
|
+
onPress={props.onPress}>
|
|
25
|
+
<Text style={[{
|
|
26
|
+
color: '#f60',
|
|
27
|
+
fontSize: cx(14),
|
|
28
|
+
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
29
|
+
}, props.textStyle]}>{props.text}</Text>
|
|
30
|
+
</TouchableOpacity>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Image, StyleSheet, Text, TextInput, TextInputProps, TouchableOpacity, View } from 'react-native'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { Utils } from 'tuya-panel-kit'
|
|
4
|
+
import res from '../res'
|
|
5
|
+
|
|
6
|
+
const cx = Utils.RatioUtils.convertX
|
|
7
|
+
|
|
8
|
+
interface TextFieldProps extends TextInputProps {
|
|
9
|
+
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const TextField = (props: TextFieldProps) => {
|
|
13
|
+
return (
|
|
14
|
+
<View style={props.style}>
|
|
15
|
+
<Text style={[styles.topTip, { opacity: (!!props.value) ? 1 : 0 }]}>{props.placeholder}</Text>
|
|
16
|
+
<View style={styles.textInputGroup}>
|
|
17
|
+
<TextInput{...props} style={styles.textInput} />
|
|
18
|
+
{!!props.value &&
|
|
19
|
+
<TouchableOpacity
|
|
20
|
+
style={styles.iconTouchable}
|
|
21
|
+
onPress={() => {
|
|
22
|
+
props.onChangeText && props.onChangeText('')
|
|
23
|
+
}}>
|
|
24
|
+
<Image source={{ uri: res.ic_cancel }} style={styles.icon} />
|
|
25
|
+
</TouchableOpacity>
|
|
26
|
+
}
|
|
27
|
+
<View style={styles.line} />
|
|
28
|
+
</View>
|
|
29
|
+
</View>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const styles = StyleSheet.create({
|
|
34
|
+
topTip: {
|
|
35
|
+
marginTop: cx(5),
|
|
36
|
+
fontSize: cx(12),
|
|
37
|
+
marginStart: cx(13),
|
|
38
|
+
color: '#666',
|
|
39
|
+
fontFamily: 'helvetica_neue_lt_std_bd',
|
|
40
|
+
},
|
|
41
|
+
textInputGroup: {
|
|
42
|
+
flexDirection: 'row',
|
|
43
|
+
borderRadius: cx(4),
|
|
44
|
+
backgroundColor: '#f6f6f6',
|
|
45
|
+
alignItems: 'center',
|
|
46
|
+
},
|
|
47
|
+
textInput: {
|
|
48
|
+
flex: 1,
|
|
49
|
+
height: cx(44),
|
|
50
|
+
marginStart: cx(16),
|
|
51
|
+
marginEnd: cx(6),
|
|
52
|
+
fontSize: cx(16),
|
|
53
|
+
color: '#000',
|
|
54
|
+
fontFamily: 'helvetica_neue_lt_std_roman',
|
|
55
|
+
},
|
|
56
|
+
iconTouchable: {
|
|
57
|
+
marginEnd: cx(18),
|
|
58
|
+
padding: cx(4),
|
|
59
|
+
},
|
|
60
|
+
icon: {
|
|
61
|
+
width: cx(16),
|
|
62
|
+
height: cx(16),
|
|
63
|
+
},
|
|
64
|
+
line: {
|
|
65
|
+
height: 1,
|
|
66
|
+
position: 'absolute',
|
|
67
|
+
start: cx(4),
|
|
68
|
+
end: cx(4),
|
|
69
|
+
bottom: 0,
|
|
70
|
+
backgroundColor: '#cbcbcb',
|
|
71
|
+
},
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
export default TextField
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare type ChildrenType = (props: any) => React.ReactElement | null;
|
|
3
|
+
declare const _default: import("react-redux").ConnectedComponent<({ children, ...props }: {
|
|
4
|
+
children: ChildrenType;
|
|
5
|
+
}) => React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | null, Pick<{
|
|
6
|
+
children: ChildrenType;
|
|
7
|
+
}, "children"> & {
|
|
8
|
+
mapStateToProps: any;
|
|
9
|
+
}>;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {bindActionCreators} from 'redux'
|
|
2
|
+
import {connect} from 'react-redux'
|
|
3
|
+
import React from 'react'
|
|
4
|
+
|
|
5
|
+
type ChildrenType = (props: any) => React.ReactElement | null;
|
|
6
|
+
|
|
7
|
+
const Connect = ({children, ...props}: { children: ChildrenType }) => children(props)
|
|
8
|
+
|
|
9
|
+
export default connect(
|
|
10
|
+
(state: any, {mapStateToProps}: { mapStateToProps: any }) => mapStateToProps(state),
|
|
11
|
+
(dispatch: any, {mapDispatchToProps}: { mapDispatchToProps: any }) => {
|
|
12
|
+
if (typeof mapDispatchToProps === 'object') {
|
|
13
|
+
return bindActionCreators(mapDispatchToProps, dispatch)
|
|
14
|
+
}
|
|
15
|
+
if (typeof mapDispatchToProps === 'function') {
|
|
16
|
+
return mapDispatchToProps(dispatch)
|
|
17
|
+
}
|
|
18
|
+
return {}
|
|
19
|
+
},
|
|
20
|
+
)(Connect)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function LdvColorBrightness(props: any): JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import LdvSlider from 'components/ldvSlider'
|
|
3
|
+
import I18n from '../i18n/index'
|
|
4
|
+
|
|
5
|
+
export default function LdvColorBrightness(props) {
|
|
6
|
+
const {value, onSlidingComplete} = props
|
|
7
|
+
const renderBrightness = () => {
|
|
8
|
+
return (
|
|
9
|
+
<LdvSlider
|
|
10
|
+
style={props.style}
|
|
11
|
+
title={I18n.getLang('light_sources_tile_dim_lighting_brightness')}
|
|
12
|
+
value={value}
|
|
13
|
+
onSlidingComplete={onSlidingComplete}
|
|
14
|
+
onValueChange={props.onValueChange}/>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
return renderBrightness()
|
|
18
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
export declare const TEMP_KEY = "temperature";
|
|
3
|
+
interface LdvColorSliderProps {
|
|
4
|
+
title: string;
|
|
5
|
+
type: string;
|
|
6
|
+
onValueChange?: (number: any) => void | undefined;
|
|
7
|
+
onSlidingComplete: (number: any) => void;
|
|
8
|
+
thumbColor: string;
|
|
9
|
+
value: number;
|
|
10
|
+
width?: number | undefined;
|
|
11
|
+
style?: StyleProp<ViewStyle> | undefined;
|
|
12
|
+
}
|
|
13
|
+
declare const LdvColorSlider: (props: LdvColorSliderProps) => JSX.Element;
|
|
14
|
+
export default LdvColorSlider;
|