@miot-rn/car-component 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.
Files changed (242) hide show
  1. package/README.md +325 -0
  2. package/dist/assets/i18n/ar.d.ts +55 -0
  3. package/dist/assets/i18n/ar.js +55 -0
  4. package/dist/assets/i18n/bo.d.ts +55 -0
  5. package/dist/assets/i18n/bo.js +55 -0
  6. package/dist/assets/i18n/cs.d.ts +55 -0
  7. package/dist/assets/i18n/cs.js +55 -0
  8. package/dist/assets/i18n/de.d.ts +55 -0
  9. package/dist/assets/i18n/de.js +55 -0
  10. package/dist/assets/i18n/el.d.ts +55 -0
  11. package/dist/assets/i18n/el.js +55 -0
  12. package/dist/assets/i18n/en.d.ts +55 -0
  13. package/dist/assets/i18n/en.js +55 -0
  14. package/dist/assets/i18n/es.d.ts +55 -0
  15. package/dist/assets/i18n/es.js +55 -0
  16. package/dist/assets/i18n/es_us.d.ts +55 -0
  17. package/dist/assets/i18n/es_us.js +55 -0
  18. package/dist/assets/i18n/fi.d.ts +55 -0
  19. package/dist/assets/i18n/fi.js +55 -0
  20. package/dist/assets/i18n/fr.d.ts +55 -0
  21. package/dist/assets/i18n/fr.js +55 -0
  22. package/dist/assets/i18n/he.d.ts +55 -0
  23. package/dist/assets/i18n/he.js +55 -0
  24. package/dist/assets/i18n/hu.d.ts +55 -0
  25. package/dist/assets/i18n/hu.js +55 -0
  26. package/dist/assets/i18n/id.d.ts +55 -0
  27. package/dist/assets/i18n/id.js +55 -0
  28. package/dist/assets/i18n/it.d.ts +55 -0
  29. package/dist/assets/i18n/it.js +55 -0
  30. package/dist/assets/i18n/ja.d.ts +55 -0
  31. package/dist/assets/i18n/ja.js +55 -0
  32. package/dist/assets/i18n/ko.d.ts +55 -0
  33. package/dist/assets/i18n/ko.js +55 -0
  34. package/dist/assets/i18n/nb.d.ts +55 -0
  35. package/dist/assets/i18n/nb.js +55 -0
  36. package/dist/assets/i18n/nl.d.ts +55 -0
  37. package/dist/assets/i18n/nl.js +55 -0
  38. package/dist/assets/i18n/pl.d.ts +55 -0
  39. package/dist/assets/i18n/pl.js +55 -0
  40. package/dist/assets/i18n/pt.d.ts +55 -0
  41. package/dist/assets/i18n/pt.js +55 -0
  42. package/dist/assets/i18n/pt_pt.d.ts +55 -0
  43. package/dist/assets/i18n/pt_pt.js +55 -0
  44. package/dist/assets/i18n/ro.d.ts +55 -0
  45. package/dist/assets/i18n/ro.js +55 -0
  46. package/dist/assets/i18n/ru.d.ts +55 -0
  47. package/dist/assets/i18n/ru.js +55 -0
  48. package/dist/assets/i18n/sk.d.ts +55 -0
  49. package/dist/assets/i18n/sk.js +55 -0
  50. package/dist/assets/i18n/sv.d.ts +55 -0
  51. package/dist/assets/i18n/sv.js +55 -0
  52. package/dist/assets/i18n/th.d.ts +55 -0
  53. package/dist/assets/i18n/th.js +55 -0
  54. package/dist/assets/i18n/tr.d.ts +55 -0
  55. package/dist/assets/i18n/tr.js +55 -0
  56. package/dist/assets/i18n/uk.d.ts +55 -0
  57. package/dist/assets/i18n/uk.js +55 -0
  58. package/dist/assets/i18n/vi.d.ts +55 -0
  59. package/dist/assets/i18n/vi.js +55 -0
  60. package/dist/assets/i18n/zh.d.ts +55 -0
  61. package/dist/assets/i18n/zh.js +55 -0
  62. package/dist/assets/i18n/zh_hk.d.ts +55 -0
  63. package/dist/assets/i18n/zh_hk.js +55 -0
  64. package/dist/assets/i18n/zh_tw.d.ts +55 -0
  65. package/dist/assets/i18n/zh_tw.js +55 -0
  66. package/dist/assets/image/dark/car_background_dark.png +0 -0
  67. package/dist/assets/image/default/car_background.png +0 -0
  68. package/dist/components/airConditioningCard/index.d.ts +24 -0
  69. package/dist/components/airConditioningCard/index.js +103 -0
  70. package/dist/components/carInfoHeader/carImage.d.ts +8 -0
  71. package/dist/components/carInfoHeader/carImage.js +42 -0
  72. package/dist/components/carInfoHeader/dualRangeIndicator.d.ts +15 -0
  73. package/dist/components/carInfoHeader/dualRangeIndicator.js +124 -0
  74. package/dist/components/carInfoHeader/index.d.ts +37 -0
  75. package/dist/components/carInfoHeader/index.js +118 -0
  76. package/dist/components/carInfoHeader/parkingStatus.d.ts +12 -0
  77. package/dist/components/carInfoHeader/parkingStatus.js +100 -0
  78. package/dist/components/carInfoHeader/rangeProgressBar.d.ts +14 -0
  79. package/dist/components/carInfoHeader/rangeProgressBar.js +77 -0
  80. package/dist/components/carInfoHeader/singleRangeIndicator.d.ts +11 -0
  81. package/dist/components/carInfoHeader/singleRangeIndicator.js +58 -0
  82. package/dist/components/cardContainer/index.d.ts +8 -0
  83. package/dist/components/cardContainer/index.js +22 -0
  84. package/dist/components/containerWithGap/gapWrap.d.ts +8 -0
  85. package/dist/components/containerWithGap/gapWrap.js +31 -0
  86. package/dist/components/containerWithGap/index.d.ts +12 -0
  87. package/dist/components/containerWithGap/index.js +43 -0
  88. package/dist/components/flatSelect/FlatOption.d.ts +18 -0
  89. package/dist/components/flatSelect/FlatOption.js +117 -0
  90. package/dist/components/flatSelect/FlatSelect.d.ts +14 -0
  91. package/dist/components/flatSelect/FlatSelect.js +112 -0
  92. package/dist/components/flatSelect/index.d.ts +2 -0
  93. package/dist/components/flatSelect/index.js +2 -0
  94. package/dist/components/flatSelect/index.zh-CN.md +89 -0
  95. package/dist/components/groupContainer/index.d.ts +9 -0
  96. package/dist/components/groupContainer/index.js +48 -0
  97. package/dist/components/otherSettingCard/index.d.ts +8 -0
  98. package/dist/components/otherSettingCard/index.js +40 -0
  99. package/dist/components/pageBackground/index.d.ts +7 -0
  100. package/dist/components/pageBackground/index.js +22 -0
  101. package/dist/components/seatControl/index.d.ts +34 -0
  102. package/dist/components/seatControl/index.js +98 -0
  103. package/dist/components/seatControl/seatCard.d.ts +11 -0
  104. package/dist/components/seatControl/seatCard.js +24 -0
  105. package/dist/components/seatControl/seatCardRow.d.ts +29 -0
  106. package/dist/components/seatControl/seatCardRow.js +48 -0
  107. package/dist/components/seatControlGroup/index.d.ts +40 -0
  108. package/dist/components/seatControlGroup/index.js +51 -0
  109. package/dist/components/steeringWheelHotCard/index.d.ts +17 -0
  110. package/dist/components/steeringWheelHotCard/index.js +66 -0
  111. package/dist/components/titleContainer/TitleContainer.d.ts +4 -0
  112. package/dist/components/titleContainer/TitleContainer.js +148 -0
  113. package/dist/components/titleContainer/TitleContainer.zh-CN.md +62 -0
  114. package/dist/components/titleContainer/index.d.ts +1 -0
  115. package/dist/components/titleContainer/index.js +1 -0
  116. package/dist/components/titleContainer/interface.d.ts +48 -0
  117. package/dist/components/titleContainer/interface.js +21 -0
  118. package/dist/components/warningForRunningCard/index.d.ts +6 -0
  119. package/dist/components/warningForRunningCard/index.js +20 -0
  120. package/dist/config/ConnectStatus.d.ts +7 -0
  121. package/dist/config/ConnectStatus.js +8 -0
  122. package/dist/config/index.d.ts +16 -0
  123. package/dist/config/index.js +16 -0
  124. package/dist/config/seatFunctionType.d.ts +7 -0
  125. package/dist/config/seatFunctionType.js +24 -0
  126. package/dist/config/seatGearLevel.d.ts +21 -0
  127. package/dist/config/seatGearLevel.js +19 -0
  128. package/dist/config/seatI18nKeys.d.ts +9 -0
  129. package/dist/config/seatI18nKeys.js +9 -0
  130. package/dist/config/seatPosition.d.ts +8 -0
  131. package/dist/config/seatPosition.js +8 -0
  132. package/dist/config/seatRowConfig.d.ts +6 -0
  133. package/dist/config/seatRowConfig.js +6 -0
  134. package/dist/global.d.js +0 -0
  135. package/dist/hooks/CONNECT_STATUS.d.ts +6 -0
  136. package/dist/hooks/CONNECT_STATUS.js +5 -0
  137. package/dist/hooks/index.d.ts +6 -0
  138. package/dist/hooks/index.js +7 -0
  139. package/dist/hooks/useAirConditionData.d.ts +29 -0
  140. package/dist/hooks/useAirConditionData.js +89 -0
  141. package/dist/hooks/useDualRangeData.d.ts +18 -0
  142. package/dist/hooks/useDualRangeData.js +82 -0
  143. package/dist/hooks/useParkingStatusData.d.ts +19 -0
  144. package/dist/hooks/useParkingStatusData.js +100 -0
  145. package/dist/hooks/useSeatControlData.d.ts +94 -0
  146. package/dist/hooks/useSeatControlData.js +251 -0
  147. package/dist/hooks/useSingleRangeData.d.ts +15 -0
  148. package/dist/hooks/useSingleRangeData.js +97 -0
  149. package/dist/hooks/useSteeringWheelData.d.ts +11 -0
  150. package/dist/hooks/useSteeringWheelData.js +56 -0
  151. package/dist/icons/CarInUsed.d.ts +4 -0
  152. package/dist/icons/CarInUsed.js +13 -0
  153. package/dist/icons/DeviceManage.d.ts +4 -0
  154. package/dist/icons/DeviceManage.js +13 -0
  155. package/dist/icons/ElectricPower.d.ts +4 -0
  156. package/dist/icons/ElectricPower.js +13 -0
  157. package/dist/icons/ErrorStatus.d.ts +4 -0
  158. package/dist/icons/ErrorStatus.js +13 -0
  159. package/dist/icons/FuelPower.d.ts +4 -0
  160. package/dist/icons/FuelPower.js +18 -0
  161. package/dist/icons/Loading.d.ts +4 -0
  162. package/dist/icons/Loading.js +16 -0
  163. package/dist/icons/MijiaLogo.d.ts +4 -0
  164. package/dist/icons/MijiaLogo.js +16 -0
  165. package/dist/icons/Minus.d.ts +4 -0
  166. package/dist/icons/Minus.js +15 -0
  167. package/dist/icons/ParkingStatus.d.ts +4 -0
  168. package/dist/icons/ParkingStatus.js +15 -0
  169. package/dist/icons/SeatGearHeatingLevelOne.d.ts +4 -0
  170. package/dist/icons/SeatGearHeatingLevelOne.js +22 -0
  171. package/dist/icons/SeatGearHeatingLevelThree.d.ts +4 -0
  172. package/dist/icons/SeatGearHeatingLevelThree.js +18 -0
  173. package/dist/icons/SeatGearHeatingLevelTwo.d.ts +4 -0
  174. package/dist/icons/SeatGearHeatingLevelTwo.js +22 -0
  175. package/dist/icons/SeatGearHeatingOff.d.ts +4 -0
  176. package/dist/icons/SeatGearHeatingOff.js +18 -0
  177. package/dist/icons/SeatGearVentilationLevelOne.d.ts +4 -0
  178. package/dist/icons/SeatGearVentilationLevelOne.js +17 -0
  179. package/dist/icons/SeatGearVentilationLevelThree.d.ts +4 -0
  180. package/dist/icons/SeatGearVentilationLevelThree.js +13 -0
  181. package/dist/icons/SeatGearVentilationLevelTwo.d.ts +4 -0
  182. package/dist/icons/SeatGearVentilationLevelTwo.js +17 -0
  183. package/dist/icons/SeatGearVentilationOff.d.ts +4 -0
  184. package/dist/icons/SeatGearVentilationOff.js +16 -0
  185. package/dist/icons/SentryMode.d.ts +4 -0
  186. package/dist/icons/SentryMode.js +13 -0
  187. package/dist/icons/SmartScene.d.ts +4 -0
  188. package/dist/icons/SmartScene.js +13 -0
  189. package/dist/icons/SteeringWheelFirstGear.d.ts +4 -0
  190. package/dist/icons/SteeringWheelFirstGear.js +13 -0
  191. package/dist/icons/SteeringWheelHot.d.ts +4 -0
  192. package/dist/icons/SteeringWheelHot.js +13 -0
  193. package/dist/icons/SteeringWheelSecondGear.d.ts +4 -0
  194. package/dist/icons/SteeringWheelSecondGear.js +13 -0
  195. package/dist/icons/SteeringWheelThirdGear.d.ts +4 -0
  196. package/dist/icons/SteeringWheelThirdGear.js +13 -0
  197. package/dist/icons/Warning.d.ts +4 -0
  198. package/dist/icons/Warning.js +13 -0
  199. package/dist/icons/index.d.ts +24 -0
  200. package/dist/icons/index.js +27 -0
  201. package/dist/index.d.ts +21 -0
  202. package/dist/index.js +20 -0
  203. package/dist/modules/MODULES.md +245 -0
  204. package/dist/modules/airconditionModule/README.md +262 -0
  205. package/dist/modules/airconditionModule/index.d.ts +17 -0
  206. package/dist/modules/airconditionModule/index.js +63 -0
  207. package/dist/modules/carInfoModule/README.md +418 -0
  208. package/dist/modules/carInfoModule/index.d.ts +26 -0
  209. package/dist/modules/carInfoModule/index.js +67 -0
  210. package/dist/modules/index.d.ts +2 -0
  211. package/dist/modules/index.js +2 -0
  212. package/dist/modules/seatModule/README.md +345 -0
  213. package/dist/modules/seatModule/index.d.ts +15 -0
  214. package/dist/modules/seatModule/index.js +40 -0
  215. package/dist/modules/steeringWheelModule/README.md +216 -0
  216. package/dist/modules/steeringWheelModule/index.d.ts +13 -0
  217. package/dist/modules/steeringWheelModule/index.js +31 -0
  218. package/dist/resources/i18n.d.ts +1730 -0
  219. package/dist/resources/i18n.js +84 -0
  220. package/dist/resources/images.d.ts +1 -0
  221. package/dist/resources/images.js +45 -0
  222. package/dist/spec/index.d.ts +494 -0
  223. package/dist/spec/index.js +911 -0
  224. package/dist/types.d.ts +63 -0
  225. package/dist/types.js +1 -0
  226. package/dist/utils/checkSameValue.d.ts +1 -0
  227. package/dist/utils/checkSameValue.js +11 -0
  228. package/dist/utils/fns.d.ts +5 -0
  229. package/dist/utils/fns.js +167 -0
  230. package/dist/utils/get-value-or-default.d.ts +1 -0
  231. package/dist/utils/get-value-or-default.js +4 -0
  232. package/dist/utils/getLocalI18n.d.ts +1 -0
  233. package/dist/utils/getLocalI18n.js +9 -0
  234. package/dist/utils/i18n.d.ts +1 -0
  235. package/dist/utils/i18n.js +141 -0
  236. package/dist/utils/objects.d.ts +2 -0
  237. package/dist/utils/objects.js +222 -0
  238. package/dist/utils/spec.d.ts +8 -0
  239. package/dist/utils/spec.js +171 -0
  240. package/dist/utils/types.d.ts +3 -0
  241. package/dist/utils/types.js +25 -0
  242. package/package.json +27 -0
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import { View } from 'react-native';
3
+ import { dynamicStyleSheet } from 'miot/ui/Style/DynamicStyleSheet';
4
+ import { defaultColorToken } from 'miot/ui/hyperOSUI';
5
+ export const PageBackground = ({
6
+ children,
7
+ style
8
+ }) => {
9
+ return /*#__PURE__*/React.createElement(View, {
10
+ style: [styles.container, style]
11
+ }, children);
12
+ };
13
+ const styles = dynamicStyleSheet({
14
+ container: {
15
+ position: 'absolute',
16
+ left: 0,
17
+ top: 0,
18
+ right: 0,
19
+ bottom: 0,
20
+ backgroundColor: defaultColorToken.mj_color_gray_bg_2
21
+ }
22
+ });
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+ import { StyleProp, ViewStyle } from 'react-native';
3
+ export interface ButtonStateConfig {
4
+ value: string;
5
+ backgroundColor: string;
6
+ disabledBackgroundColor: string;
7
+ icon: React.ReactElement;
8
+ iconColor: string;
9
+ }
10
+ export interface ControlButtonConfig {
11
+ propType: string;
12
+ spec?: string;
13
+ title?: string;
14
+ states: ButtonStateConfig[];
15
+ currentStateIndex: number;
16
+ disabled?: boolean;
17
+ }
18
+ export interface OnButtonPressParams {
19
+ propType: string;
20
+ spec?: string;
21
+ previousStateIndex: number;
22
+ currentStateIndex: number;
23
+ previousValue: string;
24
+ currentValue: string;
25
+ action: 'switch';
26
+ }
27
+ export interface SeatControlProps {
28
+ title: string;
29
+ buttons: ControlButtonConfig[];
30
+ disabled?: boolean;
31
+ onButtonPress?: (params: OnButtonPressParams) => void;
32
+ style?: StyleProp<ViewStyle>;
33
+ }
34
+ export declare const SeatControl: ({ title, buttons, disabled, onButtonPress, style }: SeatControlProps) => React.JSX.Element;
@@ -0,0 +1,98 @@
1
+ import React, { useCallback } from 'react';
2
+ import { View, Text, TouchableOpacity } from 'react-native';
3
+ import { dynamicStyleSheet } from 'miot/ui/Style/DynamicStyleSheet';
4
+ import { Fonts, defaultColorToken } from 'miot/ui/hyperOSUI';
5
+ export const SeatControl = ({
6
+ title,
7
+ buttons = [],
8
+ disabled = false,
9
+ onButtonPress,
10
+ style
11
+ }) => {
12
+ const handleButtonPress = useCallback((propType, buttonConfig) => {
13
+ if (buttonConfig.disabled) {
14
+ return;
15
+ }
16
+ const newStateIndex = (buttonConfig.currentStateIndex + 1) % buttonConfig.states.length;
17
+ if (onButtonPress) {
18
+ onButtonPress({
19
+ propType,
20
+ spec: buttonConfig.spec,
21
+ previousStateIndex: buttonConfig.currentStateIndex,
22
+ currentStateIndex: newStateIndex,
23
+ previousValue: buttonConfig.states[buttonConfig.currentStateIndex].value,
24
+ currentValue: buttonConfig.states[newStateIndex].value,
25
+ action: 'switch'
26
+ });
27
+ }
28
+ }, [onButtonPress]);
29
+ const renderControlButton = useCallback(buttonConfig => {
30
+ const currentState = buttonConfig.states[buttonConfig.currentStateIndex] || {};
31
+ const isDisabled = buttonConfig.disabled || disabled;
32
+ const backgroundColor = currentState.backgroundColor;
33
+ const IconComponent = currentState.icon;
34
+ return /*#__PURE__*/React.createElement(TouchableOpacity, {
35
+ key: buttonConfig.propType,
36
+ style: styles.buttonWrapper,
37
+ onPress: () => handleButtonPress(buttonConfig.propType, buttonConfig),
38
+ disabled: isDisabled
39
+ }, /*#__PURE__*/React.createElement(View, {
40
+ style: [styles.controlButton, {
41
+ backgroundColor
42
+ }]
43
+ }, IconComponent));
44
+ }, [handleButtonPress, disabled]);
45
+ return /*#__PURE__*/React.createElement(View, {
46
+ style: [styles.container, style]
47
+ }, /*#__PURE__*/React.createElement(Text, {
48
+ style: [styles.title, disabled && styles.titleDisabled],
49
+ numberOfLines: 3,
50
+ ellipsizeMode: "tail"
51
+ }, title), /*#__PURE__*/React.createElement(View, {
52
+ style: styles.buttonsContainer
53
+ }, buttons.map(renderControlButton)));
54
+ };
55
+ const styles = dynamicStyleSheet({
56
+ container: {
57
+ alignItems: 'center',
58
+ justifyContent: 'center',
59
+ paddingTop: 12,
60
+ paddingBottom: 0,
61
+ paddingHorizontal: 8,
62
+ minHeight: 104
63
+ },
64
+ title: {
65
+ ...Fonts.mj_text_subtitle_3_M,
66
+ color: defaultColorToken.mj_color_gray_text_2,
67
+ textAlign: 'center',
68
+ lineHeight: 20
69
+ },
70
+ titleDisabled: {
71
+ color: defaultColorToken.mj_color_gray_text_6
72
+ },
73
+ buttonsContainer: {
74
+ flexDirection: 'row',
75
+ justifyContent: 'center',
76
+ alignItems: 'center',
77
+ flexWrap: 'wrap',
78
+ paddingVertical: 12
79
+ },
80
+ buttonWrapper: {
81
+ alignItems: 'center',
82
+ marginHorizontal: 4,
83
+ marginVertical: 4,
84
+ justifyContent: 'center'
85
+ },
86
+ controlButton: {
87
+ width: 40,
88
+ height: 40,
89
+ borderRadius: 60,
90
+ alignItems: 'center',
91
+ justifyContent: 'center',
92
+ backgroundColor: defaultColorToken.mj_color_control_fill_5
93
+ },
94
+ controlIcon: {
95
+ width: 20,
96
+ height: 20
97
+ }
98
+ });
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { StyleProp, ViewStyle } from 'react-native';
3
+ import { ControlButtonConfig, OnButtonPressParams } from './index';
4
+ export interface SeatCardProps {
5
+ title: string;
6
+ buttons: ControlButtonConfig[];
7
+ disabled?: boolean;
8
+ onButtonPress?: (params: OnButtonPressParams) => void;
9
+ style?: StyleProp<ViewStyle>;
10
+ }
11
+ export declare const SeatCard: ({ title, buttons, disabled, onButtonPress, style }: SeatCardProps) => React.JSX.Element;
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import { CardContainer } from "../cardContainer";
3
+ import { SeatControl } from "./index";
4
+ export const SeatCard = ({
5
+ title,
6
+ buttons = [],
7
+ disabled = false,
8
+ onButtonPress,
9
+ style
10
+ }) => {
11
+ const handleSeatControlButtonPress = params => {
12
+ if (onButtonPress) {
13
+ onButtonPress(params);
14
+ }
15
+ };
16
+ return /*#__PURE__*/React.createElement(CardContainer, {
17
+ style: style
18
+ }, /*#__PURE__*/React.createElement(SeatControl, {
19
+ title: title,
20
+ buttons: buttons,
21
+ disabled: disabled,
22
+ onButtonPress: handleSeatControlButtonPress
23
+ }));
24
+ };
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ import { StyleProp, ViewStyle } from 'react-native';
3
+ import { OnButtonPressParams } from './index';
4
+ export interface SeatConfig {
5
+ serviceType: string;
6
+ title: string;
7
+ buttons: ControlButtonConfig[];
8
+ disabled?: boolean;
9
+ }
10
+ export interface ControlButtonConfig {
11
+ propType: string;
12
+ spec?: string;
13
+ title?: string;
14
+ states: {
15
+ value: string;
16
+ backgroundColor: string;
17
+ disabledBackgroundColor: string;
18
+ icon: React.ReactElement;
19
+ iconColor: string;
20
+ }[];
21
+ currentStateIndex: number;
22
+ disabled?: boolean;
23
+ }
24
+ export interface SeatCardRowProps {
25
+ seats: SeatConfig[];
26
+ onSeatChange?: (params: OnButtonPressParams) => void;
27
+ style?: StyleProp<ViewStyle>;
28
+ }
29
+ export declare const SeatCardRow: ({ seats, onSeatChange, style }: SeatCardRowProps) => React.JSX.Element;
@@ -0,0 +1,48 @@
1
+ import React from 'react';
2
+ import { View } from 'react-native';
3
+ import { dynamicStyleSheet } from 'miot/ui/Style/DynamicStyleSheet';
4
+ import { SeatCard } from "./seatCard";
5
+ export const SeatCardRow = ({
6
+ seats = [],
7
+ onSeatChange,
8
+ style
9
+ }) => {
10
+ const handleSeatButtonPress = config => {
11
+ if (onSeatChange) {
12
+ onSeatChange(config);
13
+ }
14
+ };
15
+ return /*#__PURE__*/React.createElement(View, {
16
+ style: [styles.container, style]
17
+ }, seats.map((seat, index) => {
18
+ const {
19
+ serviceType,
20
+ title,
21
+ buttons = [],
22
+ disabled
23
+ } = seat;
24
+ const isLastItem = index === seats.length - 1;
25
+ return /*#__PURE__*/React.createElement(SeatCard, {
26
+ key: serviceType || `seat-${index}`,
27
+ title: title,
28
+ buttons: buttons,
29
+ disabled: disabled,
30
+ onButtonPress: handleSeatButtonPress,
31
+ style: [styles.seatCard, isLastItem && styles.seatCardLast]
32
+ });
33
+ }));
34
+ };
35
+ const styles = dynamicStyleSheet({
36
+ container: {
37
+ flexDirection: 'row',
38
+ justifyContent: 'flex-start',
39
+ alignItems: 'stretch'
40
+ },
41
+ seatCard: {
42
+ marginRight: 8,
43
+ flex: 1
44
+ },
45
+ seatCardLast: {
46
+ marginRight: 0
47
+ }
48
+ });
@@ -0,0 +1,40 @@
1
+ import React from 'react';
2
+ import { StyleProp, ViewStyle } from 'react-native';
3
+ export type ButtonStateConfig = {
4
+ value: string;
5
+ backgroundColor: string;
6
+ disabledBackgroundColor: string;
7
+ icon: React.ReactElement;
8
+ iconColor: string;
9
+ };
10
+ export type ControlButtonConfig = {
11
+ propType: string;
12
+ spec?: string;
13
+ title?: string;
14
+ states: ButtonStateConfig[];
15
+ currentStateIndex: number;
16
+ disabled?: boolean;
17
+ };
18
+ export type SeatConfig = {
19
+ serviceType: string;
20
+ title: string;
21
+ buttons: ControlButtonConfig[];
22
+ disabled?: boolean;
23
+ };
24
+ export type OnButtonPressParams = {
25
+ propType: string;
26
+ spec?: string;
27
+ previousStateIndex: number;
28
+ currentStateIndex: number;
29
+ previousValue: string;
30
+ currentValue: string;
31
+ action: 'switch';
32
+ };
33
+ export interface SeatControlGroupProps {
34
+ seatRows: SeatConfig[][];
35
+ title?: string;
36
+ onSeatChange?: (params: OnButtonPressParams) => void;
37
+ disabled?: boolean;
38
+ style?: StyleProp<ViewStyle>;
39
+ }
40
+ export declare const SeatControlGroup: ({ seatRows, title, onSeatChange, disabled, style, }: SeatControlGroupProps) => React.JSX.Element;
@@ -0,0 +1,51 @@
1
+ import React from 'react';
2
+ import { StyleSheet } from 'react-native';
3
+ import { GroupContainer } from "../groupContainer";
4
+ import ContainerWithGap from "../containerWithGap";
5
+ import { SeatCard } from "../seatControl/seatCard";
6
+ export const SeatControlGroup = ({
7
+ seatRows = [],
8
+ title = '',
9
+ onSeatChange,
10
+ disabled = false,
11
+ style
12
+ }) => {
13
+ const handleSeatButtonPress = config => {
14
+ if (onSeatChange) {
15
+ onSeatChange(config);
16
+ }
17
+ };
18
+ const handleSeatControlButtonPress = params => {
19
+ handleSeatButtonPress(params);
20
+ };
21
+ return /*#__PURE__*/React.createElement(GroupContainer, {
22
+ title: title,
23
+ style: style
24
+ }, seatRows.map((rowSeats, rowIndex) => {
25
+ return /*#__PURE__*/React.createElement(ContainerWithGap, {
26
+ key: `row-${rowIndex}`,
27
+ horizontal: true,
28
+ gap: 8
29
+ }, rowSeats.map(seat => {
30
+ const {
31
+ serviceType,
32
+ title,
33
+ buttons = [],
34
+ disabled: seatDisabled
35
+ } = seat;
36
+ return /*#__PURE__*/React.createElement(SeatCard, {
37
+ key: serviceType || `seat-${rowIndex}-${serviceType}`,
38
+ title: title,
39
+ buttons: buttons,
40
+ disabled: disabled || seatDisabled,
41
+ onButtonPress: handleSeatControlButtonPress,
42
+ style: styles.seatCard
43
+ });
44
+ }));
45
+ }));
46
+ };
47
+ const styles = StyleSheet.create({
48
+ seatCard: {
49
+ flex: 1
50
+ }
51
+ });
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { ColorType } from 'miot/ui/hyperOSUI';
3
+ interface OptionItem {
4
+ value: string | number;
5
+ colorType?: ColorType;
6
+ label?: string;
7
+ description: string;
8
+ }
9
+ interface SteeringWheelHotCardProps {
10
+ value: string | number;
11
+ onChange: (value: string | number) => void;
12
+ options?: OptionItem[];
13
+ disabled?: boolean;
14
+ steeringWheelTitle: string;
15
+ }
16
+ export declare const SteeringWheelHotCard: React.MemoExoticComponent<({ value, onChange, options, disabled, steeringWheelTitle }: SteeringWheelHotCardProps) => React.JSX.Element | null>;
17
+ export {};
@@ -0,0 +1,66 @@
1
+ import React, { useContext, memo, useMemo } from 'react';
2
+ import { ConfigContext } from 'miot/ui/hyperOSUI';
3
+ import { SteeringWheelFirstGear, SteeringWheelSecondGear, SteeringWheelThirdGear, SteeringWheelHot } from "../../icons";
4
+ import { SteeringWheelHotGear } from "../../config";
5
+ import { CardContainer } from "../cardContainer";
6
+ import { GroupContainer } from "../groupContainer";
7
+ import { FlatSelect } from "../flatSelect";
8
+ const {
9
+ FlatOption
10
+ } = FlatSelect;
11
+ export const SteeringWheelHotCard = /*#__PURE__*/memo(({
12
+ value,
13
+ onChange,
14
+ options = [],
15
+ disabled = false,
16
+ steeringWheelTitle
17
+ }) => {
18
+ const {
19
+ colorToken
20
+ } = useContext(ConfigContext);
21
+ const heatingLevelIcon = useMemo(() => {
22
+ const color = disabled ? colorToken.mj_color_gray_icon_7 : colorToken.mj_color_gray_icon_2;
23
+ const icons = {
24
+ [SteeringWheelHotGear.OFF]: /*#__PURE__*/React.createElement(SteeringWheelHot, {
25
+ fill: color
26
+ }),
27
+ [SteeringWheelHotGear.Level1]: /*#__PURE__*/React.createElement(SteeringWheelFirstGear, {
28
+ fill: color
29
+ }),
30
+ [SteeringWheelHotGear.Level2]: /*#__PURE__*/React.createElement(SteeringWheelSecondGear, {
31
+ fill: color
32
+ }),
33
+ [SteeringWheelHotGear.Level3]: /*#__PURE__*/React.createElement(SteeringWheelThirdGear, {
34
+ fill: color
35
+ }),
36
+ [SteeringWheelHotGear.Off]: /*#__PURE__*/React.createElement(SteeringWheelHot, {
37
+ fill: color
38
+ }),
39
+ [SteeringWheelHotGear['Level 1']]: /*#__PURE__*/React.createElement(SteeringWheelFirstGear, {
40
+ fill: color
41
+ }),
42
+ [SteeringWheelHotGear['Level 2']]: /*#__PURE__*/React.createElement(SteeringWheelSecondGear, {
43
+ fill: color
44
+ }),
45
+ [SteeringWheelHotGear['Level 3']]: /*#__PURE__*/React.createElement(SteeringWheelThirdGear, {
46
+ fill: color
47
+ })
48
+ };
49
+ return icons;
50
+ }, [colorToken, disabled]);
51
+ return options.length > 0 ? /*#__PURE__*/React.createElement(GroupContainer, {
52
+ title: steeringWheelTitle
53
+ }, /*#__PURE__*/React.createElement(CardContainer, null, /*#__PURE__*/React.createElement(FlatSelect, {
54
+ disabled: disabled,
55
+ value: value,
56
+ onChange: onChange
57
+ }, options.map(item => {
58
+ return /*#__PURE__*/React.createElement(FlatOption, {
59
+ key: item.value,
60
+ value: item.value,
61
+ colorType: item.colorType,
62
+ label: item.label,
63
+ icon: heatingLevelIcon[item.description]
64
+ });
65
+ })))) : null;
66
+ });
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { TitleContainerProps } from './interface';
3
+ declare const TitleContainer: React.FC<TitleContainerProps>;
4
+ export default TitleContainer;
@@ -0,0 +1,148 @@
1
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
+ import { ConfigContext, Switch, Fonts } from 'miot/ui/hyperOSUI';
3
+ import React, { useCallback, useContext, useMemo } from 'react';
4
+ import { StyleSheet, Text, View } from 'react-native';
5
+ import { getAccessibilityConfig } from 'miot/utils/accessibility-helper';
6
+ import { WidgetType } from "./interface";
7
+ const THIN_HEIGHT = 32;
8
+ const PADDING = 16;
9
+ const MAX_LINE = 3;
10
+ /**
11
+ * @export public
12
+ * @doc_name 标题控件
13
+ * @doc_index 2
14
+ * @doc_directory ui
15
+ * @author gongxiang
16
+ * @since 10114
17
+ * @module Title
18
+ * @description 右侧带四种控件的列表项
19
+ * @property {string} type - 右侧的图标类型,默认为开关
20
+ * @property {string} title - 左侧主标题
21
+ * @property {string} subtitle - 左侧副标题,主标题下方
22
+ * @property {bool} value - 开关状态,默认值 false
23
+ * @property {bool} disabled - 是否禁用右侧控件,默认值 false
24
+ * @property {function} onPress - note: IMPORTANT 列表项点击事件,不传则不具有点击态(disabled)
25
+ * @property {function} onValueChange - 开关切换事件
26
+ * @property {string} colorType - 开关按钮打开时的背景颜色类型
27
+ * @property {ImageSourcePropType} leftIcon - 左侧自定义图标
28
+ * @property {ImageSourcePropType} showTitleArrow - 是否展示主标题箭头
29
+ * @property {object} switchOption - 开关的属性
30
+ * @property {AccessibilityPropTypes} accessibilityTitle - 主标题的无障碍配置
31
+ * @property {AccessibilityPropTypes} accessibilitySubtitle - 副标题的无障碍配置
32
+ * @property {React.ReactElement} customRenderer - 右侧自定义渲染区域
33
+ */
34
+
35
+ // 类型定义已移至 interface.ts
36
+ const TitleContainer = ({
37
+ type = WidgetType.SWITCH,
38
+ title = '',
39
+ subtitle = '',
40
+ value = false,
41
+ disabled = false,
42
+ leftIcon = null,
43
+ onValueChange,
44
+ colorType,
45
+ switchOption,
46
+ customRenderer,
47
+ accessibilityTitle,
48
+ accessibilitySubtitle
49
+ }) => {
50
+ const {
51
+ colorToken
52
+ } = useContext(ConfigContext);
53
+ const _onValueChange = useCallback(val => {
54
+ if (typeof onValueChange === 'function') {
55
+ onValueChange(val);
56
+ }
57
+ }, [onValueChange]);
58
+ const renderRightContent = useMemo(() => {
59
+ switch (type) {
60
+ case WidgetType.SWITCH:
61
+ return /*#__PURE__*/React.createElement(Switch, _extends({}, switchOption || {}, {
62
+ value: value,
63
+ onValueChange: _onValueChange,
64
+ disabled: disabled,
65
+ colorType: colorType
66
+ }));
67
+ default:
68
+ return null;
69
+ }
70
+ }, [type, value, disabled, colorType, switchOption, _onValueChange]);
71
+ const subTitleIsString = typeof subtitle === 'string';
72
+ const leftIconStyle = useMemo(() => [styles.leftIcon, {
73
+ opacity: disabled ? 0.3 : 1
74
+ }], [disabled]);
75
+ return /*#__PURE__*/React.createElement(View, {
76
+ accessibilityLabel: `${title} ${subTitleIsString ? subtitle : ''}`,
77
+ style: styles.container
78
+ }, leftIcon && /*#__PURE__*/React.createElement(View, {
79
+ style: leftIconStyle
80
+ }, leftIcon), /*#__PURE__*/React.createElement(View, {
81
+ style: [styles.left]
82
+ }, /*#__PURE__*/React.createElement(View, {
83
+ style: [styles.up]
84
+ }, /*#__PURE__*/React.createElement(Text, _extends({
85
+ numberOfLines: MAX_LINE,
86
+ allowFontScaling: false,
87
+ style: [Fonts.mj_text_headline_2_M, styles.title, {
88
+ color: disabled ? colorToken.mj_color_gray_text_6 : colorToken.mj_color_gray_text_1
89
+ }]
90
+ }, getAccessibilityConfig({
91
+ ...accessibilityTitle
92
+ })), title)), subtitle ? subTitleIsString ? /*#__PURE__*/React.createElement(Text, _extends({
93
+ numberOfLines: MAX_LINE,
94
+ allowFontScaling: false,
95
+ style: [Fonts.mj_text_custom_13_R, {
96
+ color: disabled ? colorToken.mj_color_gray_text_6 : colorToken.mj_color_gray_text_4
97
+ }]
98
+ }, getAccessibilityConfig({
99
+ ...accessibilitySubtitle
100
+ })), subtitle) : subtitle : null), /*#__PURE__*/React.createElement(View, {
101
+ style: styles.gap
102
+ }), /*#__PURE__*/React.createElement(View, {
103
+ style: [styles.right]
104
+ }, customRenderer || renderRightContent));
105
+ };
106
+ const styles = StyleSheet.create({
107
+ container: {
108
+ paddingTop: 12,
109
+ paddingHorizontal: PADDING,
110
+ flexDirection: 'row',
111
+ alignItems: 'center',
112
+ justifyContent: 'flex-start'
113
+ },
114
+ left: {
115
+ flex: 1,
116
+ minHeight: THIN_HEIGHT,
117
+ justifyContent: 'center'
118
+ },
119
+ right: {
120
+ flexDirection: 'row',
121
+ alignItems: 'center',
122
+ justifyContent: 'flex-end',
123
+ maxWidth: 116,
124
+ minWidth: 56,
125
+ minHeight: 32
126
+ },
127
+ up: {
128
+ position: 'relative',
129
+ flexDirection: 'row',
130
+ alignItems: 'center',
131
+ justifyContent: 'flex-start'
132
+ },
133
+ leftIcon: {
134
+ width: 24,
135
+ height: 24,
136
+ marginRight: 8,
137
+ alignItems: 'center',
138
+ overflow: 'hidden',
139
+ justifyContent: 'center'
140
+ },
141
+ title: {
142
+ flex: 1
143
+ },
144
+ gap: {
145
+ width: 10
146
+ }
147
+ });
148
+ export default TitleContainer;
@@ -0,0 +1,62 @@
1
+ # TitleContainer - 标题控件
2
+
3
+ ## 说明
4
+
5
+ 右侧带控件的标题列表项组件,支持开关、自定义渲染等。常用于设置页面的功能开关或选项。
6
+
7
+ ## 属性
8
+
9
+ | 属性名 | 类型 | 必填 | 默认值 | 说明 |
10
+ |--------|------|------|--------|------|
11
+ | **type** | `WidgetType` | 否 | `WidgetType.SWITCH` | 右侧控件类型,目前主要支持开关 |
12
+ | **title** | `string` | 是 | - | 左侧主标题 |
13
+ | **subtitle** | `string \| React.ReactElement` | 否 | `''` | 左侧副标题,主标题下方 |
14
+ | **value** | `boolean` | 否 | `false` | 开关状态 |
15
+ | **disabled** | `boolean` | 否 | `false` | 是否禁用右侧控件 |
16
+ | **onPress** | `() => void` | 否 | - | 列表项点击事件 |
17
+ | **onValueChange** | `(val: boolean) => void` | 是 | - | 开关切换事件 |
18
+ | **colorType** | `ColorType` | 否 | - | 开关按钮打开时的背景颜色类型 |
19
+ | **leftIcon** | `React.ReactNode` | 否 | `null` | 左侧自定义图标 |
20
+ | **showTitleArrow** | `boolean` | 否 | `false` | 是否展示主标题箭头 |
21
+ | **switchOption** | `SwitchProps` | 否 | - | 开关的额外属性 |
22
+ | **customRenderer** | `React.ReactElement` | 否 | - | 右侧自定义渲染区域(优先级高于 type) |
23
+ | **allowFontScaling** | `boolean` | 否 | `false` | 字体是否随系统字体大小变化 |
24
+ | **accessibilityTitle** | `AccessibilityPropsType` | 否 | - | 主标题的无障碍配置 |
25
+ | **accessibilitySubtitle** | `AccessibilityPropsType` | 否 | - | 副标题的无障碍配置 |
26
+
27
+ ## WidgetType 枚举
28
+
29
+ ```typescript
30
+ export enum WidgetType {
31
+ SWITCH = 'switch',
32
+ }
33
+ ```
34
+
35
+ ## 使用示例
36
+
37
+ ```tsx
38
+ import { TitleContainer } from '@src/hyperOS/IotComponents/titleContainer';
39
+
40
+ // 基本开关用法
41
+ <TitleContainer
42
+ title="自动模式"
43
+ subtitle="开启后将自动调节"
44
+ value={isAuto}
45
+ onValueChange={setIsAuto}
46
+ />
47
+
48
+ // 带左侧图标
49
+ <TitleContainer
50
+ title="定时开关"
51
+ leftIcon={<TimerIcon />}
52
+ value={isTimerOn}
53
+ onValueChange={setIsTimerOn}
54
+ />
55
+
56
+ // 自定义右侧内容
57
+ <TitleContainer
58
+ title="自定义选项"
59
+ customRenderer={<MyCustomButton />}
60
+ onValueChange={() => {}}
61
+ />
62
+ ```
@@ -0,0 +1 @@
1
+ export { default as TitleContainer } from './TitleContainer';
@@ -0,0 +1 @@
1
+ export { default as TitleContainer } from "./TitleContainer";