react-native-umui 1.3.59 → 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.
Files changed (144) hide show
  1. package/lib/commonjs/Accordion.js +46 -0
  2. package/lib/commonjs/Accordion.js.map +1 -0
  3. package/lib/commonjs/Badge.js +1 -1
  4. package/lib/commonjs/Badge.js.map +1 -1
  5. package/lib/commonjs/Button.js +10 -7
  6. package/lib/commonjs/Button.js.map +1 -1
  7. package/lib/commonjs/Checkbox.js +0 -1
  8. package/lib/commonjs/Checkbox.js.map +1 -1
  9. package/lib/commonjs/Divider.js +8 -8
  10. package/lib/commonjs/Divider.js.map +1 -1
  11. package/lib/commonjs/EasyIn.js +43 -0
  12. package/lib/commonjs/EasyIn.js.map +1 -1
  13. package/lib/commonjs/FlatList.js +2 -1
  14. package/lib/commonjs/FlatList.js.map +1 -1
  15. package/lib/commonjs/FlatPanel.js.map +1 -1
  16. package/lib/commonjs/Grid.js.map +1 -1
  17. package/lib/commonjs/InputField.js +2 -0
  18. package/lib/commonjs/InputField.js.map +1 -1
  19. package/lib/commonjs/Line.js +0 -1
  20. package/lib/commonjs/Line.js.map +1 -1
  21. package/lib/commonjs/Load.js +1 -2
  22. package/lib/commonjs/Load.js.map +1 -1
  23. package/lib/commonjs/Numeral.js +6 -1
  24. package/lib/commonjs/Numeral.js.map +1 -1
  25. package/lib/commonjs/PanelRK.js +1 -1
  26. package/lib/commonjs/PanelRK.js.map +1 -1
  27. package/lib/commonjs/Phone.js +12 -5
  28. package/lib/commonjs/Phone.js.map +1 -1
  29. package/lib/commonjs/Press.js.map +1 -1
  30. package/lib/commonjs/Radio.js +0 -1
  31. package/lib/commonjs/Radio.js.map +1 -1
  32. package/lib/commonjs/Scroll.js +2 -2
  33. package/lib/commonjs/Scroll.js.map +1 -1
  34. package/lib/commonjs/Tab.js +5 -14
  35. package/lib/commonjs/Tab.js.map +1 -1
  36. package/lib/commonjs/Text.js +22 -2
  37. package/lib/commonjs/Text.js.map +1 -1
  38. package/lib/commonjs/TextInput.js +69 -1
  39. package/lib/commonjs/TextInput.js.map +1 -1
  40. package/lib/commonjs/regions.js +14 -1
  41. package/lib/commonjs/regions.js.map +1 -1
  42. package/lib/commonjs/shadows.js +3 -2
  43. package/lib/commonjs/shadows.js.map +1 -1
  44. package/lib/module/Accordion.js +37 -0
  45. package/lib/module/Accordion.js.map +1 -0
  46. package/lib/module/Badge.js +1 -1
  47. package/lib/module/Badge.js.map +1 -1
  48. package/lib/module/Button.js +10 -7
  49. package/lib/module/Button.js.map +1 -1
  50. package/lib/module/Checkbox.js +0 -1
  51. package/lib/module/Checkbox.js.map +1 -1
  52. package/lib/module/Divider.js +8 -8
  53. package/lib/module/Divider.js.map +1 -1
  54. package/lib/module/EasyIn.js +40 -0
  55. package/lib/module/EasyIn.js.map +1 -1
  56. package/lib/module/FlatList.js +2 -1
  57. package/lib/module/FlatList.js.map +1 -1
  58. package/lib/module/FlatPanel.js.map +1 -1
  59. package/lib/module/Grid.js.map +1 -1
  60. package/lib/module/InputField.js +2 -0
  61. package/lib/module/InputField.js.map +1 -1
  62. package/lib/module/Line.js +0 -1
  63. package/lib/module/Line.js.map +1 -1
  64. package/lib/module/Load.js +1 -2
  65. package/lib/module/Load.js.map +1 -1
  66. package/lib/module/Numeral.js +6 -1
  67. package/lib/module/Numeral.js.map +1 -1
  68. package/lib/module/PanelRK.js +2 -2
  69. package/lib/module/PanelRK.js.map +1 -1
  70. package/lib/module/Phone.js +12 -5
  71. package/lib/module/Phone.js.map +1 -1
  72. package/lib/module/Press.js.map +1 -1
  73. package/lib/module/Radio.js +0 -1
  74. package/lib/module/Radio.js.map +1 -1
  75. package/lib/module/Scroll.js +2 -2
  76. package/lib/module/Scroll.js.map +1 -1
  77. package/lib/module/Tab.js +5 -14
  78. package/lib/module/Tab.js.map +1 -1
  79. package/lib/module/Text.js +21 -2
  80. package/lib/module/Text.js.map +1 -1
  81. package/lib/module/TextInput.js +69 -2
  82. package/lib/module/TextInput.js.map +1 -1
  83. package/lib/module/regions.js +14 -1
  84. package/lib/module/regions.js.map +1 -1
  85. package/lib/module/shadows.js +3 -2
  86. package/lib/module/shadows.js.map +1 -1
  87. package/lib/typescript/src/Accordion.d.ts +12 -0
  88. package/lib/typescript/src/Accordion.d.ts.map +1 -0
  89. package/lib/typescript/src/Badge.d.ts.map +1 -1
  90. package/lib/typescript/src/Button.d.ts +1 -1
  91. package/lib/typescript/src/Button.d.ts.map +1 -1
  92. package/lib/typescript/src/Checkbox.d.ts.map +1 -1
  93. package/lib/typescript/src/Divider.d.ts +3 -0
  94. package/lib/typescript/src/Divider.d.ts.map +1 -1
  95. package/lib/typescript/src/EasyIn.d.ts +3 -0
  96. package/lib/typescript/src/EasyIn.d.ts.map +1 -1
  97. package/lib/typescript/src/FlatList.d.ts.map +1 -1
  98. package/lib/typescript/src/FlatPanel.d.ts.map +1 -1
  99. package/lib/typescript/src/Grid.d.ts.map +1 -1
  100. package/lib/typescript/src/InputField.d.ts +1 -2
  101. package/lib/typescript/src/InputField.d.ts.map +1 -1
  102. package/lib/typescript/src/Line.d.ts.map +1 -1
  103. package/lib/typescript/src/Load.d.ts.map +1 -1
  104. package/lib/typescript/src/Numeral.d.ts.map +1 -1
  105. package/lib/typescript/src/PanelRK.d.ts +2 -2
  106. package/lib/typescript/src/PanelRK.d.ts.map +1 -1
  107. package/lib/typescript/src/Phone.d.ts +2 -1
  108. package/lib/typescript/src/Phone.d.ts.map +1 -1
  109. package/lib/typescript/src/Press.d.ts.map +1 -1
  110. package/lib/typescript/src/Radio.d.ts.map +1 -1
  111. package/lib/typescript/src/Scroll.d.ts.map +1 -1
  112. package/lib/typescript/src/Tab.d.ts +2 -1
  113. package/lib/typescript/src/Tab.d.ts.map +1 -1
  114. package/lib/typescript/src/Text.d.ts.map +1 -1
  115. package/lib/typescript/src/TextInput.d.ts +8 -1
  116. package/lib/typescript/src/TextInput.d.ts.map +1 -1
  117. package/lib/typescript/src/regions.d.ts +14 -1
  118. package/lib/typescript/src/regions.d.ts.map +1 -1
  119. package/lib/typescript/src/shadows.d.ts +2 -2
  120. package/lib/typescript/src/shadows.d.ts.map +1 -1
  121. package/package.json +1 -1
  122. package/src/Accordion.tsx +1 -0
  123. package/src/Badge.tsx +1 -1
  124. package/src/Button.tsx +81 -7
  125. package/src/Checkbox.tsx +1 -13
  126. package/src/Divider.tsx +1 -10
  127. package/src/EasyIn.tsx +1 -22
  128. package/src/FlatList.tsx +1 -6
  129. package/src/FlatPanel.tsx +1 -9
  130. package/src/Grid.tsx +1 -18
  131. package/src/InputField.tsx +1 -14
  132. package/src/Line.tsx +13 -5
  133. package/src/Load.tsx +59 -2
  134. package/src/Numeral.tsx +115 -31
  135. package/src/PanelRK.tsx +1 -6
  136. package/src/Phone.tsx +100 -73
  137. package/src/Press.tsx +1 -6
  138. package/src/Radio.tsx +1 -15
  139. package/src/Scroll.tsx +1 -13
  140. package/src/Tab.tsx +216 -15
  141. package/src/Text.tsx +21 -8
  142. package/src/TextInput.tsx +1 -24
  143. package/src/regions.ts +19 -4
  144. package/src/shadows.ts +1 -24
package/src/Tab.tsx CHANGED
@@ -1,7 +1,8 @@
1
1
  import React, { Fragment, ReactElement, ReactNode } from "react";
2
- import { StyleProp, View, ViewStyle, PanResponder, Animated, Dimensions } from "react-native";
2
+ import { StyleProp, View, ViewStyle, PanResponder, Animated, Dimensions, TextStyle } from "react-native";
3
3
  import { MButton } from "./Button";
4
4
  import { MText } from "./Text";
5
+
5
6
  interface IMTabButtonProps {
6
7
  testID?: string;
7
8
  size?: "xs" | "sm" | "md" | "nm";
@@ -16,24 +17,46 @@ interface IMTabButtonProps {
16
17
  btnType?: "primary" | "success" | "warning" | "secondary" | "danger" | "light" | "navy" | "smokelight";
17
18
  onPress?: () => void;
18
19
  children?: ReactNode;
19
- }; export function MTabButton({ children, btnType = "smokelight", style, size = "md", outline = true, ...props }: IMTabButtonProps) { return (<MButton btnType={btnType} size={size} outline={outline}{...props} style={[{ borderWidth: 1, borderColor: "#dadada" }, style]}>{children}</MButton>); };
20
+ };
21
+
22
+ export function MTabButton({ children, btnType = "smokelight", style, size = "md", outline = true, ...props }: IMTabButtonProps) {
23
+ return (
24
+ <MButton
25
+ btnType={btnType}
26
+ size={size}
27
+ outline={outline}
28
+ {...props}
29
+ style={[{ borderWidth: 1, borderColor: "#dadada" }, style]}
30
+ >
31
+ {children}
32
+ </MButton>
33
+ );
34
+ }
35
+
20
36
  export interface MCustomTabProps {
21
37
  value: string | number;
22
38
  active: boolean;
23
39
  disabled: boolean;
24
40
  onPress: (value: any) => void;
25
41
  };
42
+
26
43
  interface MTabProps {
27
44
  value: string | number;
28
45
  fontSize?: number;
29
46
  textAlign?: "center" | "left" | "right";
30
47
  fontWeight?: | 'normal' | 'bold' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900' | undefined;
48
+ tabTextStyle?: StyleProp<TextStyle>;
31
49
  tab: string | ((props: MCustomTabProps) => ReactNode);
32
50
  disabled?: boolean;
33
51
  isHidden?: boolean;
34
52
  render?: () => ReactNode;
35
53
  children?: ReactNode;
36
- }; export function MTab(props: MTabProps) { return (<>{props.children || props.render()}</>); };
54
+ };
55
+
56
+ export function MTab(props: MTabProps) {
57
+ return (<React.Fragment>{props.children || props.render()}</React.Fragment>);
58
+ }
59
+
37
60
  interface TabContainerProps {
38
61
  testID?: string;
39
62
  tabStyle?: StyleProp<ViewStyle>;
@@ -41,14 +64,118 @@ interface TabContainerProps {
41
64
  activeValue: string | number;
42
65
  onChange: (value: any) => void;
43
66
  items: Array<ReactElement<MTabProps>>;
44
- }; function TabContainer(props: TabContainerProps) { return (<View style={[{ width: "100%", display: "flex", flexDirection: "row", justifyContent: "space-around", alignItems: "center" }, props.tabStyle]}>{props.items.filter(k => k && !k.props.isHidden).map((item, index) => { const isActive = item.props.value === props.activeValue; return (<Fragment key={`${index}${props.activeValue}`}>{typeof item.props.tab === "string" ? (<MButton testID={props.testID} size="md" btnType={isActive ? "navy" : "light"} outline={isActive} disabled={item.props.disabled} style={{ backgroundColor: "transparent", flex: 1, borderRadius: 0, borderColor: null, borderWidth: 0, borderTopWidth: !props.isTop ? 2 : 0, borderBottomWidth: props.isTop ? 2 : 0, borderTopColor: !props.isTop && isActive ? undefined : "transparent", borderBottomColor: props.isTop && isActive ? undefined : "transparent", minHeight: 43, maxHeight: 43 }} onPress={() => props.onChange(item.props.value)}><MText style={{ flex: 1, color: "black", fontSize: item.props.fontSize || 15, fontWeight: item.props.fontWeight, textAlign: item.props.textAlign || "center" }}>{item.props.tab}</MText></MButton>) : (item.props.tab({ active: isActive, value: item.props.value, disabled: item.props.disabled, onPress: props.onChange }))}</Fragment>); })}</View>); }
67
+ };
68
+
69
+ function TabContainer(props: TabContainerProps) {
70
+ return (
71
+ <View style={[{ width: "100%", display: "flex", flexDirection: "row", justifyContent: "space-around", alignItems: "center" }, props.tabStyle]}>
72
+ {props.items.filter(k => k && !k.props.isHidden).map((item, index) => {
73
+ const isActive = item.props.value === props.activeValue;
74
+
75
+ return (
76
+ <Fragment key={`${index}${props.activeValue}`}>
77
+ {typeof item.props.tab === "string" ? (
78
+ <MButton
79
+ testID={props.testID}
80
+ size="md"
81
+ btnType={isActive ? "navy" : "light"}
82
+ outline={isActive}
83
+ disabled={item.props.disabled}
84
+ style={{
85
+ backgroundColor: "transparent",
86
+ flex: 1,
87
+ borderRadius: 0,
88
+ borderColor: null,
89
+ borderWidth: 0,
90
+ borderTopWidth: !props.isTop ? 2 : 0,
91
+ borderBottomWidth: props.isTop ? 2 : 0,
92
+ borderTopColor: !props.isTop && isActive ? undefined : "transparent",
93
+ borderBottomColor: props.isTop && isActive ? undefined : "transparent",
94
+ minHeight: 43,
95
+ maxHeight: 43
96
+ }}
97
+ onPress={() => props.onChange(item.props.value)}
98
+ >
99
+ <MText style={[{ flex: 1, color: "black", fontSize: item.props.fontSize || 15, fontWeight: item.props.fontWeight, textAlign: item.props.textAlign || "center" }, item.props.tabTextStyle]}>
100
+ {item.props.tab}
101
+ </MText>
102
+ </MButton>) : (
103
+ item.props.tab({
104
+ active: isActive,
105
+ value: item.props.value,
106
+ disabled: item.props.disabled,
107
+ onPress: props.onChange
108
+ })
109
+ )}
110
+ </Fragment>
111
+ );
112
+ })}
113
+ </View>
114
+ );
115
+ }
116
+
45
117
  interface MTabsProps {
46
- position?: "top" | "bottom";
47
- tabStyle?: StyleProp<ViewStyle>;
48
- active: string | number;
49
- children: ReactElement<MTabProps> | Array<ReactElement<MTabProps>>;
50
- onChange: (value: any) => void;
51
- }; export function MTabs({ position = "top", ...props }: MTabsProps) { const fadeAnim = React.useRef(new Animated.Value(0, { useNativeDriver: true })).current; const children = (Array.isArray(props.children) ? props.children : [props.children]).filter(k => (!k.props.isHidden && !k.props.disabled)); const activeIndex = React.useMemo(() => { return children.findIndex(k => k.props.value === props.active); }, [props.active]); const panResponder = React.useMemo(() => { fadeAnim.setValue(0); return PanResponder.create({ onMoveShouldSetPanResponder: (_e1, gestureState) => { if ((Math.abs(gestureState.dx) > (Dimensions.get("window").width / 2.5)) && (Math.abs(gestureState.dx) > Math.abs(gestureState.dy * 3.5)) && (Math.abs(gestureState.vx) > Math.abs(gestureState.vy * 2.5))) { if (gestureState.dx > 0 && activeIndex > 0) { props.onChange(children[activeIndex - 1].props.value); return true; }; if (gestureState.dx < 0 && activeIndex < children.length - 1) { props.onChange(children[activeIndex + 1].props.value); return true; } }; if ((gestureState.dx > 0 && activeIndex > 0) || (gestureState.dx < 0 && activeIndex < children.length - 1)) { fadeAnim.setValue(gestureState.dx); }; return true; }, onPanResponderRelease(_e1, _g1) { fadeAnim.setValue(0); }, onPanResponderTerminate() { } }); }, [activeIndex]); return (<View style={{ flex: 1, display: "flex", flexDirection: "column" }} {...panResponder.panHandlers} onTouchEnd={() => { fadeAnim.setValue(0) }} onTouchCancel={() => fadeAnim.setValue(0)}>{position === "top" ? <TabContainer isTop={true} activeValue={props.active} tabStyle={props.tabStyle} items={children} onChange={props.onChange} /> : <></>}{children.length ? <Animated.View key={activeIndex} style={{ flex: 1, transform: [{ translateX: fadeAnim }] }}>{children[activeIndex]?.props?.children || children[activeIndex]?.props?.render()}</Animated.View> : <></>}{position === "bottom" ? <TabContainer isTop={false} activeValue={props.active} tabStyle={props.tabStyle} items={children} onChange={props.onChange} /> : <></>}</View>); }
118
+ position?: "top" | "bottom"
119
+ tabStyle?: StyleProp<ViewStyle>
120
+ active: string | number
121
+ children: ReactElement<MTabProps> | Array<ReactElement<MTabProps>>
122
+ onChange: (value: any) => void
123
+ }
124
+
125
+ export function MTabs({ position = "top", ...props }: MTabsProps) {
126
+ const fadeAnim = React.useRef(new Animated.Value(0, { useNativeDriver: true })).current;
127
+ const children = (Array.isArray(props.children) ? props.children : [props.children]).filter(k => (!k.props.isHidden && !k.props.disabled))
128
+
129
+
130
+ const activeIndex = React.useMemo(() => {
131
+ return children.findIndex(k => k.props.value === props.active);
132
+ }, [props.active])
133
+
134
+ const panResponder = React.useMemo(() => {
135
+ fadeAnim.setValue(0)
136
+ return PanResponder.create({
137
+ onMoveShouldSetPanResponder: (_e1, gestureState) => {
138
+ if ((Math.abs(gestureState.dx) > (Dimensions.get("window").width / 2.5)) && (Math.abs(gestureState.dx) > Math.abs(gestureState.dy * 3.5)) && (Math.abs(gestureState.vx) > Math.abs(gestureState.vy * 2.5))) {
139
+ if (gestureState.dx > 0 && activeIndex > 0) {
140
+ props.onChange(children[activeIndex - 1].props.value)
141
+ return true
142
+ }
143
+ if (gestureState.dx < 0 && activeIndex < children.length - 1) {
144
+ props.onChange(children[activeIndex + 1].props.value)
145
+ return true
146
+ }
147
+ }
148
+ if ((gestureState.dx > 0 && activeIndex > 0) || (gestureState.dx < 0 && activeIndex < children.length - 1)) {
149
+ fadeAnim.setValue(gestureState.dx)
150
+ }
151
+ return true
152
+ },
153
+ onPanResponderRelease(_e1, _g1) {
154
+ fadeAnim.setValue(0)
155
+ },
156
+ onPanResponderTerminate() {
157
+
158
+ }
159
+ });
160
+ }, [activeIndex])
161
+
162
+ return (
163
+ <View style={{ flex: 1, display: "flex", flexDirection: "column" }} {...panResponder.panHandlers} onTouchEnd={() => {
164
+ fadeAnim.setValue(0)
165
+ }} onTouchCancel={()=>fadeAnim.setValue(0)}>
166
+ {position === "top" ? <TabContainer isTop={true} activeValue={props.active} tabStyle={props.tabStyle} items={children} onChange={props.onChange} /> : <React.Fragment></React.Fragment>}
167
+
168
+ {children.length ? <Animated.View key={activeIndex} style={{ flex: 1, transform: [{ translateX: fadeAnim }] }}>
169
+ {children[activeIndex]?.props?.children || children[activeIndex]?.props?.render()}
170
+ </Animated.View> : <React.Fragment></React.Fragment>}
171
+
172
+ {position === "bottom" ? <TabContainer isTop={false} activeValue={props.active} tabStyle={props.tabStyle} items={children} onChange={props.onChange} /> : <React.Fragment></React.Fragment>}
173
+ </View>
174
+ );
175
+ }
176
+
177
+ //
178
+
52
179
  class MTabButtonBaseProps {
53
180
  testID?: string
54
181
  value: string | number
@@ -56,29 +183,103 @@ class MTabButtonBaseProps {
56
183
  label: string
57
184
  style?: StyleProp<ViewStyle>
58
185
  }
186
+
59
187
  class MTabButtonProps extends MTabButtonBaseProps {
60
188
  activeValue?: string | number
61
189
  onChange?: (value: any) => void
62
- }; export function MTabControlButton(props: MTabButtonProps) { const isActive = props.value === props.activeValue; return (<MButton testID={props.testID} btnType={isActive ? "navy" : "light"} disabled={props.disabled} style={[{ borderRadius: 0, borderWidth: 1, borderColor: "#fafafa" }, props.style]} onPress={() => props.onChange(props.value)}><MText style={{ color: isActive ? "white" : "black", fontSize: 15 }}>{props.label}</MText></MButton>); }
190
+ }
191
+
192
+ export function MTabControlButton(props: MTabButtonProps) {
193
+ const isActive = props.value === props.activeValue
194
+
195
+ return (
196
+ <MButton
197
+ testID={props.testID}
198
+ btnType={isActive ? "navy" : "light"}
199
+ disabled={props.disabled}
200
+ style={[{ borderRadius: 0, borderWidth: 1, borderColor: "#fafafa" }, props.style]}
201
+ onPress={() => props.onChange(props.value)}
202
+ >
203
+ <MText style={{ color: isActive ? "white" : "black", fontSize: 15 }}>
204
+ {props.label}
205
+ </MText>
206
+ </MButton>
207
+ );
208
+ }
209
+
63
210
  interface MTabContollerProps {
64
211
  active: string | number
65
212
  style?: StyleProp<ViewStyle>
66
213
  children: Array<ReactElement<MTabButtonBaseProps | ReactNode>>
67
214
  onChange: (value: any) => void
68
- }; export function MTabContoller(props: MTabContollerProps) { return (<View style={[{ width: "100%", display: "flex", flexDirection: "row", justifyContent: "space-evenly", alignItems: "center" }, props.style]}>{props.children.map((k, index) => { if (k.type["name"] === "MTabControlButton") { return (<MTabControlButton key={index} {...k.props as any} activeValue={props.active} onChange={(value) => { props.onChange(value); if (k.props["onChange"]) { k.props["onChange"](value) } }} />); } else { return k; } })}</View>); };
215
+ }
216
+
217
+ export function MTabContoller(props: MTabContollerProps) {
218
+ return (
219
+ <View
220
+ style={[
221
+ { width: "100%", display: "flex", flexDirection: "row", justifyContent: "space-evenly", alignItems: "center" },
222
+ props.style
223
+ ]}
224
+ >
225
+ {props.children.map((k, index) => {
226
+ if (k.type["name"] === "MTabControlButton") {
227
+ return (
228
+ <MTabControlButton
229
+ key={index}
230
+ {...k.props as any}
231
+ activeValue={props.active}
232
+ onChange={(value) => {
233
+ props.onChange(value)
234
+ if (k.props["onChange"]) {
235
+ k.props["onChange"](value)
236
+ }
237
+ }}
238
+ />
239
+ );
240
+ } else {
241
+ return k;
242
+ }
243
+ })}
244
+ </View>
245
+ )
246
+ }
247
+
69
248
  interface MTabContentProps {
70
249
  value: string | number
71
250
  style?: StyleProp<ViewStyle>
72
251
  children: ReactNode
73
- }; export function MTabContent(props: MTabContentProps) { return (<View style={[{ flex: 1 }, props.style]}>{props.children}</View>); }
252
+ }
253
+
254
+ export function MTabContent(props: MTabContentProps) {
255
+ return (
256
+ <View style={[{ flex: 1 }, props.style]}>
257
+ {props.children}
258
+ </View>
259
+ );
260
+ }
261
+
74
262
  interface MTabContentsProps {
75
263
  active: string | number
76
264
  children: Array<ReactElement<MTabContentProps>>
77
- }; export function MTabContents(props: MTabContentsProps) { return (<>{props.children?.find(k => k.props.value === props.active)}</>); }
265
+ }
266
+
267
+ export function MTabContents(props: MTabContentsProps) {
268
+ return (<React.Fragment>{props.children?.find(k => k.props.value === props.active)}</React.Fragment>);
269
+ }
270
+
78
271
  interface MTabContainerProps {
79
272
  style?: StyleProp<ViewStyle>
80
273
  children: [ReactElement<MTabContollerProps>, ReactElement<MTabContentsProps>]
81
- }; export function MTabContainer(props: MTabContainerProps) { return (<View style={[{ flex: 1, display: "flex", flexDirection: "column" }, props.style]}>{props.children}</View>); }
274
+ }
275
+
276
+ export function MTabContainer(props: MTabContainerProps) {
277
+ return (
278
+ <View style={[{ flex: 1, display: "flex", flexDirection: "column" }, props.style]}>
279
+ {props.children}
280
+ </View>
281
+ );
282
+ }
82
283
 
83
284
  /*
84
285
  <MTabContainer>
package/src/Text.tsx CHANGED
@@ -1,8 +1,21 @@
1
- import React from "react";
2
- //import { StyleProp, Text, TextProps, TextStyle } from "react-native";
3
- import { Text, TextProps } from "react-native";
4
- interface MTextProps extends TextProps {
5
- // style?: StyleProp<Omit<TextStyle, "fontSize">>
6
- }
7
- // function lineHeight(fontSize) { const multiplier = (fontSize > 20) ? 1.5 : 1; return parseInt(fontSize + (fontSize * multiplier), 10); };
8
- export const MText = React.forwardRef<Text, MTextProps>((props, ref) => { return (<Text ref={ref} {...props} style={[{ fontSize: 15, letterSpacing: 0.59 }, props.style]}>{props.children}</Text>); })
1
+ import React from "react"; import {Text, TextProps } from "react-native"; interface MTextProps extends TextProps { }; export const MText = React.forwardRef<Text, MTextProps>((props, ref) => { return (<Text ref={ref} {...props} style={[{ fontSize: 15, letterSpacing: 0.59 }, props.style]}>{props.children}</Text>) })
2
+
3
+ // import React from "react";
4
+ // import { StyleProp, Text, TextProps, TextStyle } from "react-native"
5
+
6
+ // interface MTextProps extends TextProps {
7
+ // // style?: StyleProp<Omit<TextStyle, "fontSize">>
8
+ // }
9
+
10
+ // function lineHeight(fontSize) {
11
+ // const multiplier = (fontSize > 20) ? 1.5 : 1;
12
+ // return parseInt(fontSize + (fontSize * multiplier), 10);
13
+ // }
14
+
15
+ // export const MText = React.forwardRef<Text, MTextProps>((props, ref) => {
16
+ // return (
17
+ // <Text ref={ref} {...props} style={[{ fontSize: 15, letterSpacing: 0.59 }, props.style]}>
18
+ // {props.children}
19
+ // </Text>
20
+ // )
21
+ // })
package/src/TextInput.tsx CHANGED
@@ -1,24 +1 @@
1
- import React, { StyleSheet, TextInput, TextInputProps } from "react-native";
2
- const styleOTI = StyleSheet.create({
3
- txtInput: {
4
- flex: 1,
5
- height: 45,
6
- minHeight: 45,
7
- maxHeight: 45,
8
- borderStyle: "solid",
9
- zIndex: 101,
10
- backgroundColor: "white",
11
- color: "black",
12
- borderRadius: 3,
13
- fontSize: 16.25,
14
- paddingHorizontal: 11,
15
- paddingVertical: 5,
16
- borderWidth: 1,
17
- borderColor: "#dadce0",
18
- letterSpacing: 1
19
- }
20
- });
21
- interface ITextInputProps extends TextInputProps {
22
- disabled?: boolean;
23
- };
24
- export function MTextInput({ disabled, editable, style, ...props }: ITextInputProps) { const _editable = !(disabled || editable == false); return (<TextInput autoCapitalize="none" autoFocus={false}{...props} editable={_editable} style={[styleOTI.txtInput, { backgroundColor: _editable ? "white" : "#f7f7f7" }, style]} placeholderTextColor="#919191" />); }; export function MTextareaInput({ disabled, editable, style, ...props }: ITextInputProps) { const _editable = !(disabled || editable == false); return (<TextInput autoCapitalize="none" numberOfLines={4} multiline={true} autoFocus={false}{...props} editable={_editable} style={[styleOTI.txtInput, { height: null, maxHeight: null, backgroundColor: _editable ? "white" : "#f7f7f7" }, style]} placeholderTextColor="#919191" />); };
1
+ import React, { StyleProp, StyleSheet, TextInput, TextInputProps, View, ViewStyle } from "react-native"; import { MText } from "./Text"; import { useEffect } from "react"; const styleOTI = StyleSheet.create({ txtInput: { flex: 1, height: 45, minHeight: 45, maxHeight: 45, borderStyle: "solid", zIndex: 101, backgroundColor: "white", color: "black", borderRadius: 3, fontSize: 16.25, paddingHorizontal: 11, paddingVertical: 5, borderWidth: 1, borderColor: "#dadce0", letterSpacing: 1 } }); interface ITextInputProps extends TextInputProps { disabled?: boolean; }; export function MTextInput({ disabled, editable, style, ...props }: ITextInputProps) { const _editable = !(disabled || editable == false); return (<TextInput autoCapitalize="none" autoFocus={false} {...props} editable={_editable} style={[styleOTI.txtInput, { backgroundColor: _editable ? "white" : "#f7f7f7" }, style]} placeholderTextColor="#919191" />); } export function MTextareaInput({ disabled, editable, style, ...props }: ITextInputProps) { const _editable = !(disabled || editable == false); return (<TextInput autoCapitalize="none" numberOfLines={4} multiline={true} autoFocus={false} {...props} editable={_editable} style={[styleOTI.txtInput, { height: null, maxHeight: null, backgroundColor: _editable ? "white" : "#f7f7f7" }, style]} placeholderTextColor="#919191" />); } interface IMPinInputMatProps extends TextInputProps { size: number; styleContainer?: StyleProp<ViewStyle>; styleBadge?: StyleProp<ViewStyle>; onFilledFully?: (value?: string)=> void; }; export default function MPinInput({ size, styleContainer, onFilledFully, ...props }: IMPinInputMatProps) { useEffect(()=>{ if(props.value?.length>=size && onFilledFully){ onFilledFully(props.value); } },[size, props.value]); return (<View style={[ { flex: 1, zIndex: 9, height: 45, minHeight: 45, maxHeight: 45, paddingHorizontal: 11, display: 'flex', flexDirection: 'row', justifyContent: 'space-around', alignItems: 'center', position: 'relative' }, styleContainer ]}><TextInput {...props} style={{ flex: 1, position: 'absolute', left: 0, top: 0, right: 0, bottom: 0, color: 'transparent', textAlign: 'center', zIndex: 3 }} secureTextEntry={true} caretHidden={true} maxLength={size} placeholder="" />{Array(Math.abs(size)).fill(null).map((_, i) => (<View key={i} style={[{ width: 45, height: 45, borderWidth: 1, borderColor: '#8080802e', backgroundColor: 'white', display: "flex", justifyContent: 'center', alignItems: "center" }, props.styleBadge]}><MText style={{ color: "black", fontSize: 17, fontWeight: "700" }}>{props.value?.at(i)}</MText></View>))}</View>) }
package/src/regions.ts CHANGED
@@ -222,22 +222,37 @@ export const codesMap = Object.freeze({
222
222
  "ZA": "ZA",
223
223
  "ZM": "ZM",
224
224
  "ZW": "ZW"
225
- });
226
- export const codes = Object.values(codesMap);
225
+ })
226
+
227
+ export const codes = Object.values(codesMap)
228
+
227
229
  export const MCOLORS = Object.freeze({
228
230
  primary: "#3b82f6",
229
231
  success: "#22c55e",
230
232
  warning: "#f97316",
231
233
  secondary: "#14b8a6",
232
234
  danger: "#ca251a",
235
+ dangerlight: "#ff1818",
233
236
  light: "white",
234
237
  smokelight: "#f7f7f7",
238
+ light9: "#f9f9f9",
239
+ lightc: "#fcfcfc",
240
+ lighte: "#fefefe",
235
241
  navy: "#3e4b67",
236
242
  orange: "#ff4e02",
237
243
  darksky: "#004d6c",
238
244
  cyan: "#4bb790",
239
245
  gray: "gray",
240
246
  lightgray: "#dadce0",
247
+ metalicgray: "#43484b",
248
+ metalicgraylight: "#4d555a",
241
249
  green: "#85d89a",
242
- lightgreen: "#85d89a"
243
- });
250
+ greenb1: "#21c161",
251
+ lightgreen: "#51ff0d",
252
+ black: "black",
253
+ metalicblack1: "#292929",
254
+ metalicblack2: "#343434",
255
+ metalicblack3: "#343434",
256
+ blueafc: "#0088cc",
257
+ metalicblue: "#121b22"
258
+ })
package/src/shadows.ts CHANGED
@@ -1,24 +1 @@
1
- export const MSHADOWS = Object.freeze({
2
- _1: { shadowColor: "#000", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.18, shadowRadius: 1.00, elevation: 1 },
3
- _2: { shadowColor: "#000", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.20, shadowRadius: 1.41, elevation: 2 },
4
- _3: { shadowColor: "#000", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.22, shadowRadius: 2.22, elevation: 3 },
5
- _4: { shadowColor: "#000", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.23, shadowRadius: 2.62, elevation: 4 },
6
- _5: { shadowColor: "#000", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.25, shadowRadius: 3.84, elevation: 5 },
7
- _6: { shadowColor: "#000", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.27, shadowRadius: 4.65, elevation: 6 },
8
- _7: { shadowColor: "#000", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.29, shadowRadius: 4.65, elevation: 7 },
9
- _8: { shadowColor: "#000", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.30, shadowRadius: 4.65, elevation: 8 },
10
- _9: { shadowColor: "#000", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.32, shadowRadius: 5.46, elevation: 9 },
11
- _10: { shadowColor: "#000", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.34, shadowRadius: 6.27, elevation: 10 },
12
- _11: { shadowColor: "#000", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.36, shadowRadius: 6.68, elevation: 11 },
13
- _12: { shadowColor: "#000", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.37, shadowRadius: 7.49, elevation: 12 },
14
- _13: { shadowColor: "#000", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.39, shadowRadius: 8.30, elevation: 13 },
15
- _14: { shadowColor: "#000", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.41, shadowRadius: 9.11, elevation: 14 },
16
- _15: { shadowColor: "#000", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.43, shadowRadius: 9.51, elevation: 15 },
17
- _16: { shadowColor: "#000", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.44, shadowRadius: 10.32, elevation: 16 },
18
- _17: { shadowColor: "#000", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.46, shadowRadius: 11.14, elevation: 17 },
19
- _18: { shadowColor: "#000", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.48, shadowRadius: 11.95, elevation: 18 },
20
- _19: { shadowColor: "#000", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.50, shadowRadius: 12.35, elevation: 19 },
21
- _20: { shadowColor: "#000", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.51, shadowRadius: 13.16, elevation: 20 },
22
- _21: { shadowColor: "#000", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.53, shadowRadius: 13.97, elevation: 21 }
23
- });
24
- export const mshadow = (index: number, color: string, shadowOpacity?: number, shadowRadius?: number) => { const item = MSHADOWS[`_${index}`] || MSHADOWS[5]; return ({ ...item, shadowColor: color, shadowOpacity: shadowOpacity || item.shadowOpacity, shadowRadius: shadowRadius || item.shadowRadius }); };
1
+ export const MSHADOWS = { _1: { shadowColor: "#000", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.18, shadowRadius: 1.00, elevation: 1 }, _2: { shadowColor: "#000", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.20, shadowRadius: 1.41, elevation: 2 }, _3: { shadowColor: "#000", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.22, shadowRadius: 2.22, elevation: 3 }, _4: { shadowColor: "#000", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.23, shadowRadius: 2.62, elevation: 4 }, _5: { shadowColor: "#000", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.25, shadowRadius: 3.84, elevation: 5 }, _6: { shadowColor: "#000", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.27, shadowRadius: 4.65, elevation: 6 }, _7: { shadowColor: "#000", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.29, shadowRadius: 4.65, elevation: 7 }, _8: { shadowColor: "#000", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.30, shadowRadius: 4.65, elevation: 8 }, _9: { shadowColor: "#000", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.32, shadowRadius: 5.46, elevation: 9 }, _10: { shadowColor: "#000", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.34, shadowRadius: 6.27, elevation: 10 }, _11: { shadowColor: "#000", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.36, shadowRadius: 6.68, elevation: 11 }, _12: { shadowColor: "#000", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.37, shadowRadius: 7.49, elevation: 12 }, _13: { shadowColor: "#000", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.39, shadowRadius: 8.30, elevation: 13 }, _14: { shadowColor: "#000", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.41, shadowRadius: 9.11, elevation: 14 }, _15: { shadowColor: "#000", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.43, shadowRadius: 9.51, elevation: 15 }, _16: { shadowColor: "#000", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.44, shadowRadius: 10.32, elevation: 16 }, _17: { shadowColor: "#000", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.46, shadowRadius: 11.14, elevation: 17 }, _18: { shadowColor: "#000", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.48, shadowRadius: 11.95, elevation: 18 }, _19: { shadowColor: "#000", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.50, shadowRadius: 12.35, elevation: 19 }, _20: { shadowColor: "#000", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.51, shadowRadius: 13.16, elevation: 20 }, _21: { shadowColor: "#000", shadowOffset: { width: 0, height: 0 }, shadowOpacity: 0.53, shadowRadius: 13.97, elevation: 21 } }; Object.freeze(MSHADOWS); export const mshadow = (index: number, color: string, shadowOpacity?: number, shadowRadius?: number) => { const item = MSHADOWS[`_${index}`] || MSHADOWS[5]; return ({ ...item, shadowColor: color, shadowOpacity: shadowOpacity || item.shadowOpacity, shadowRadius: shadowRadius || item.shadowRadius }); }