@chem-po/react-native 0.0.42 → 0.0.43
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/lib/commonjs/components/form/input/Editable.js +7 -4
- package/lib/commonjs/components/form/input/Editable.js.map +1 -1
- package/lib/commonjs/components/form/input/file/index.js +3 -2
- package/lib/commonjs/components/form/input/file/index.js.map +1 -1
- package/lib/commonjs/components/form/input/multipleSelect/index.js +8 -8
- package/lib/commonjs/components/form/input/multipleSelect/index.js.map +1 -1
- package/lib/commonjs/components/form/input/select/index.js +3 -6
- package/lib/commonjs/components/form/input/select/index.js.map +1 -1
- package/lib/commonjs/components/form/view/file.js +4 -2
- package/lib/commonjs/components/form/view/file.js.map +1 -1
- package/lib/commonjs/components/form/view/index.js +9 -3
- package/lib/commonjs/components/form/view/index.js.map +1 -1
- package/lib/commonjs/components/form/view/multipleSelect.js +7 -9
- package/lib/commonjs/components/form/view/multipleSelect.js.map +1 -1
- package/lib/commonjs/components/form/view/select.js +14 -11
- package/lib/commonjs/components/form/view/select.js.map +1 -1
- package/lib/module/components/form/input/Editable.js +7 -4
- package/lib/module/components/form/input/Editable.js.map +1 -1
- package/lib/module/components/form/input/file/index.js +3 -2
- package/lib/module/components/form/input/file/index.js.map +1 -1
- package/lib/module/components/form/input/multipleSelect/index.js +9 -9
- package/lib/module/components/form/input/multipleSelect/index.js.map +1 -1
- package/lib/module/components/form/input/select/index.js +4 -7
- package/lib/module/components/form/input/select/index.js.map +1 -1
- package/lib/module/components/form/view/file.js +4 -2
- package/lib/module/components/form/view/file.js.map +1 -1
- package/lib/module/components/form/view/index.js +9 -3
- package/lib/module/components/form/view/index.js.map +1 -1
- package/lib/module/components/form/view/multipleSelect.js +7 -9
- package/lib/module/components/form/view/multipleSelect.js.map +1 -1
- package/lib/module/components/form/view/select.js +13 -10
- package/lib/module/components/form/view/select.js.map +1 -1
- package/lib/typescript/components/form/input/Editable.d.ts +1 -1
- package/lib/typescript/components/form/input/Editable.d.ts.map +1 -1
- package/lib/typescript/components/form/input/file/index.d.ts +3 -2
- package/lib/typescript/components/form/input/file/index.d.ts.map +1 -1
- package/lib/typescript/components/form/input/multipleSelect/index.d.ts.map +1 -1
- package/lib/typescript/components/form/input/select/index.d.ts.map +1 -1
- package/lib/typescript/components/form/view/file.d.ts +3 -2
- package/lib/typescript/components/form/view/file.d.ts.map +1 -1
- package/lib/typescript/components/form/view/index.d.ts +3 -2
- package/lib/typescript/components/form/view/index.d.ts.map +1 -1
- package/lib/typescript/components/form/view/multipleSelect.d.ts +6 -3
- package/lib/typescript/components/form/view/multipleSelect.d.ts.map +1 -1
- package/lib/typescript/components/form/view/select.d.ts +10 -6
- package/lib/typescript/components/form/view/select.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/components/form/input/Editable.tsx +5 -4
- package/src/components/form/input/file/index.tsx +4 -2
- package/src/components/form/input/multipleSelect/index.tsx +5 -6
- package/src/components/form/input/select/index.tsx +7 -12
- package/src/components/form/view/file.tsx +5 -3
- package/src/components/form/view/index.tsx +17 -3
- package/src/components/form/view/multipleSelect.tsx +13 -11
- package/src/components/form/view/select.tsx +24 -16
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useColorMode","usePlaceholderColor","useMemo","React","StyleSheet","Text","View","Txt","useInputStyles","SelectedOptionContainer","DefaultRenderOption","styles","create","container","flexDirection","flexWrap","alignItems","maxWidth","backgroundColor","label","paddingRight","opacity","fontWeight","optionsContainer","padding","optionContainer","marginTop","marginHorizontal","MultipleSelectFieldView","field","value","noLabel","size","sizeProp","style","placeholder","renderOption","customRender","options","selectedOptions","filter","o","includes","colorMode","text","placeholderColor","
|
|
1
|
+
{"version":3,"names":["useColorMode","usePlaceholderColor","useMemo","React","StyleSheet","Text","View","Txt","useInputStyles","SelectedOptionContainer","DefaultRenderOption","styles","create","container","flexDirection","flexWrap","alignItems","maxWidth","backgroundColor","label","paddingRight","opacity","fontWeight","optionsContainer","padding","optionContainer","marginTop","marginHorizontal","MultipleSelectFieldView","field","value","noLabel","size","sizeProp","style","textStyle","placeholder","renderOption","customRender","options","selectedOptions","filter","o","includes","colorMode","text","placeholderColor","RenderOption","createElement","length","map","key","width","option","isSelected","color"],"sourceRoot":"..\\..\\..\\..\\..\\src","sources":["components/form/view/multipleSelect.tsx"],"mappings":"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","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useColorMode, usePlaceholderColor } from '@chem-po/react';
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { useMemo } from 'react';
|
|
3
3
|
import { StyleSheet, Text, View } from 'react-native';
|
|
4
4
|
import { Txt } from '../../text';
|
|
5
5
|
import { useInputStyles } from '../input/hooks/useInputStyles';
|
|
@@ -16,14 +16,14 @@ const styles = StyleSheet.create({
|
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
export const DefaultRenderOption = ({
|
|
19
|
-
option
|
|
19
|
+
option,
|
|
20
|
+
containerStyle,
|
|
21
|
+
textStyle
|
|
20
22
|
}) => {
|
|
21
23
|
return /*#__PURE__*/React.createElement(View, {
|
|
22
|
-
style:
|
|
23
|
-
padding: 6
|
|
24
|
-
}
|
|
24
|
+
style: containerStyle
|
|
25
25
|
}, /*#__PURE__*/React.createElement(Txt, {
|
|
26
|
-
style: inputViewStyles.value
|
|
26
|
+
style: [inputViewStyles.value, textStyle]
|
|
27
27
|
}, option.label));
|
|
28
28
|
};
|
|
29
29
|
export const SelectFieldView = ({
|
|
@@ -32,7 +32,8 @@ export const SelectFieldView = ({
|
|
|
32
32
|
noLabel,
|
|
33
33
|
style,
|
|
34
34
|
size: sizeProp,
|
|
35
|
-
inEditable
|
|
35
|
+
inEditable,
|
|
36
|
+
textStyle
|
|
36
37
|
}) => {
|
|
37
38
|
const {
|
|
38
39
|
placeholder,
|
|
@@ -46,16 +47,18 @@ export const SelectFieldView = ({
|
|
|
46
47
|
container
|
|
47
48
|
} = useInputStyles(inEditable, field.size, sizeProp);
|
|
48
49
|
const selectedOption = field.options.find(o => o.value === value);
|
|
49
|
-
const RenderOption = customRender ?? DefaultRenderOption;
|
|
50
|
+
const RenderOption = useMemo(() => customRender ?? DefaultRenderOption, [customRender]);
|
|
50
51
|
return /*#__PURE__*/React.createElement(View, {
|
|
51
52
|
style: [styles.container, style]
|
|
52
53
|
}, !noLabel && /*#__PURE__*/React.createElement(Text, {
|
|
53
54
|
style: [styles.label, text, {
|
|
54
55
|
color: placeholderColor
|
|
55
|
-
}]
|
|
56
|
+
}, textStyle]
|
|
56
57
|
}, placeholder), selectedOption ? /*#__PURE__*/React.createElement(RenderOption, {
|
|
57
58
|
value: selectedOption.value,
|
|
58
59
|
option: selectedOption,
|
|
60
|
+
containerStyle: container,
|
|
61
|
+
textStyle: [text, textStyle],
|
|
59
62
|
colorMode: colorMode,
|
|
60
63
|
isSelected: true,
|
|
61
64
|
size: size
|
|
@@ -64,7 +67,7 @@ export const SelectFieldView = ({
|
|
|
64
67
|
}, /*#__PURE__*/React.createElement(Txt, {
|
|
65
68
|
style: [text, {
|
|
66
69
|
color: placeholderColor
|
|
67
|
-
}]
|
|
70
|
+
}, textStyle]
|
|
68
71
|
}, "None")));
|
|
69
72
|
};
|
|
70
73
|
//# sourceMappingURL=select.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useColorMode","usePlaceholderColor","React","StyleSheet","Text","View","Txt","useInputStyles","inputViewStyles","styles","create","container","flexDirection","alignItems","backgroundColor","label","paddingRight","fontWeight","DefaultRenderOption","option","
|
|
1
|
+
{"version":3,"names":["useColorMode","usePlaceholderColor","React","useMemo","StyleSheet","Text","View","Txt","useInputStyles","inputViewStyles","styles","create","container","flexDirection","alignItems","backgroundColor","label","paddingRight","fontWeight","DefaultRenderOption","option","containerStyle","textStyle","createElement","style","value","SelectFieldView","field","noLabel","size","sizeProp","inEditable","placeholder","renderOption","customRender","colorMode","placeholderColor","text","selectedOption","options","find","o","RenderOption","color","isSelected"],"sourceRoot":"..\\..\\..\\..\\..\\src","sources":["components/form/view/select.tsx"],"mappings":"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","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EditableProps, Field } from '@chem-po/react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { TextStyle, ViewStyle } from 'react-native';
|
|
4
|
-
export declare const Editable: <T extends Field>({ value: initValue, field, onSubmit, storagePath, style, onEditClose, onEditOpen, containerStyle, size, CustomInput, CustomView, }: EditableProps<ViewStyle, TextStyle, T>) => React.JSX.Element;
|
|
4
|
+
export declare const Editable: <T extends Field>({ value: initValue, field, onSubmit, storagePath, style, onEditClose, onEditOpen, containerStyle, size, CustomInput, CustomView, inputStyle, }: EditableProps<ViewStyle, TextStyle, T>) => React.JSX.Element;
|
|
5
5
|
//# sourceMappingURL=Editable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Editable.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/input/Editable.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,aAAa,EACb,KAAK,EAKN,MAAM,gBAAgB,CAAA;AAEvB,OAAO,KAAwD,MAAM,OAAO,CAAA;AAC5E,OAAO,EAAc,SAAS,EAAQ,SAAS,EAAE,MAAM,cAAc,CAAA;AASrE,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"Editable.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/input/Editable.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,aAAa,EACb,KAAK,EAKN,MAAM,gBAAgB,CAAA;AAEvB,OAAO,KAAwD,MAAM,OAAO,CAAA;AAC5E,OAAO,EAAc,SAAS,EAAQ,SAAS,EAAE,MAAM,cAAc,CAAA;AASrE,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,KAAK,EAAE,gJAavC,aAAa,CAAC,SAAS,EAAE,SAAS,EAAE,CAAC,CAAC,sBA+HxC,CAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { FileValue, ImageViewOptions, InputRef } from '@chem-po/core';
|
|
2
2
|
import { FileField } from '@chem-po/react';
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import { StyleProp, ViewStyle } from 'react-native';
|
|
4
|
+
import { StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
5
5
|
import { FieldProps } from '../../types';
|
|
6
|
-
export declare const FileView: ({ value, hasUpload, imageOptions, withFullView, nonImageContainerStyle, withDownload, onUploadPress, }: {
|
|
6
|
+
export declare const FileView: ({ value, hasUpload, imageOptions, withFullView, nonImageContainerStyle, withDownload, onUploadPress, textStyle, }: {
|
|
7
7
|
value?: FileValue | null;
|
|
8
8
|
hasUpload?: boolean;
|
|
9
9
|
imageOptions?: ImageViewOptions;
|
|
@@ -11,6 +11,7 @@ export declare const FileView: ({ value, hasUpload, imageOptions, withFullView,
|
|
|
11
11
|
nonImageContainerStyle?: StyleProp<ViewStyle>;
|
|
12
12
|
withDownload?: boolean;
|
|
13
13
|
onUploadPress?: () => void;
|
|
14
|
+
textStyle?: StyleProp<TextStyle>;
|
|
14
15
|
}) => React.JSX.Element;
|
|
15
16
|
export declare const FileComponent: React.ForwardRefExoticComponent<FieldProps<FileField> & React.RefAttributes<InputRef>>;
|
|
16
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/input/file/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,QAAQ,EAAkB,MAAM,eAAe,CAAA;AACrF,OAAO,EACL,SAAS,EAQV,MAAM,gBAAgB,CAAA;AAIvB,OAAO,KAAgE,MAAM,OAAO,CAAA;AACpF,OAAO,EAAY,SAAS,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/input/file/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,QAAQ,EAAkB,MAAM,eAAe,CAAA;AACrF,OAAO,EACL,SAAS,EAQV,MAAM,gBAAgB,CAAA;AAIvB,OAAO,KAAgE,MAAM,OAAO,CAAA;AACpF,OAAO,EAAY,SAAS,EAAoB,SAAS,EAAQ,SAAS,EAAE,MAAM,cAAc,CAAA;AAIhG,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AA+BxC,eAAO,MAAM,QAAQ,GAAI,mHAStB;IACD,KAAK,CAAC,EAAE,SAAS,GAAG,IAAI,CAAA;IACxB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,YAAY,CAAC,EAAE,gBAAgB,CAAA;IAC/B,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,sBAAsB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;IAC7C,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,aAAa,CAAC,EAAE,MAAM,IAAI,CAAA;IAC1B,SAAS,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;CACjC,sBAmFA,CAAA;AAED,eAAO,MAAM,aAAa,wFAyFzB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/input/multipleSelect/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAA2B,MAAM,eAAe,CAAA;AACjE,OAAO,EACL,mBAAmB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/input/multipleSelect/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAA2B,MAAM,eAAe,CAAA;AACjE,OAAO,EACL,mBAAmB,EAOpB,MAAM,gBAAgB,CAAA;AAEvB,OAAO,KAAK,EAAE,EAGZ,iBAAiB,EAIlB,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,SAAS,EAAoB,SAAS,EAAE,MAAM,cAAc,CAAA;AAGrE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAIxC,eAAO,MAAM,uBAAuB,GAAI,sBAGrC,iBAAiB,CAAC;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;CAAE,CAAC,sBAQnE,CAAA;AAoJD,eAAO,MAAM,uBAAuB,kGAA0C,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/input/select/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAA2B,MAAM,eAAe,CAAA;AACjE,OAAO,EACL,WAAW,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/input/select/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAA2B,MAAM,eAAe,CAAA;AACjE,OAAO,EACL,WAAW,EAKZ,MAAM,gBAAgB,CAAA;AAEvB,OAAO,KAAgE,MAAM,OAAO,CAAA;AAIpF,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAwHxC,eAAO,MAAM,eAAe,0FAAkC,CAAA"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { InputSize } from '@chem-po/core';
|
|
2
2
|
import { FileField } from '@chem-po/react';
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import { ViewStyle } from 'react-native';
|
|
5
|
-
export declare const FileFieldView: ({ field, value, noLabel, style, size: sizeProp, }: {
|
|
4
|
+
import { StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
5
|
+
export declare const FileFieldView: ({ field, value, noLabel, style, size: sizeProp, textStyle, }: {
|
|
6
6
|
field: FileField;
|
|
7
7
|
value: any;
|
|
8
8
|
noLabel?: boolean;
|
|
9
9
|
style?: ViewStyle;
|
|
10
|
+
textStyle?: StyleProp<TextStyle>;
|
|
10
11
|
size?: InputSize;
|
|
11
12
|
}) => React.JSX.Element;
|
|
12
13
|
//# sourceMappingURL=file.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/view/file.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoB,SAAS,EAAE,MAAM,eAAe,CAAA;AAC3D,OAAO,EAAE,SAAS,EAAuB,MAAM,gBAAgB,CAAA;AAC/D,OAAO,KAAkB,MAAM,OAAO,CAAA;AACtC,OAAO,
|
|
1
|
+
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/view/file.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoB,SAAS,EAAE,MAAM,eAAe,CAAA;AAC3D,OAAO,EAAE,SAAS,EAAuB,MAAM,gBAAgB,CAAA;AAC/D,OAAO,KAAkB,MAAM,OAAO,CAAA;AACtC,OAAO,EAAE,SAAS,EAAoB,SAAS,EAAQ,SAAS,EAAE,MAAM,cAAc,CAAA;AAmCtF,eAAO,MAAM,aAAa,GAAI,8DAO3B;IACD,KAAK,EAAE,SAAS,CAAA;IAChB,KAAK,EAAE,GAAG,CAAA;IACV,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,SAAS,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;IAChC,IAAI,CAAC,EAAE,SAAS,CAAA;CACjB,sBA2BA,CAAA"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { InputSize } from '@chem-po/core';
|
|
2
2
|
import { Field } from '@chem-po/react';
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import { ViewStyle } from 'react-native';
|
|
5
|
-
export declare const FieldView: ({ field, value, noLabel, style, size, inEditable, }: {
|
|
4
|
+
import { StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
5
|
+
export declare const FieldView: ({ field, value, noLabel, style, textStyle, size, inEditable, }: {
|
|
6
6
|
field: Field;
|
|
7
7
|
value?: any;
|
|
8
8
|
noLabel?: boolean;
|
|
9
9
|
style?: ViewStyle;
|
|
10
|
+
textStyle?: StyleProp<TextStyle>;
|
|
10
11
|
size?: InputSize;
|
|
11
12
|
inEditable?: boolean;
|
|
12
13
|
}) => React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/view/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgB,SAAS,EAAE,MAAM,eAAe,CAAA;AACvD,OAAO,EAAE,KAAK,EAAoC,MAAM,gBAAgB,CAAA;AACxE,OAAO,KAAkB,MAAM,OAAO,CAAA;AACtC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/view/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgB,SAAS,EAAE,MAAM,eAAe,CAAA;AACvD,OAAO,EAAE,KAAK,EAAoC,MAAM,gBAAgB,CAAA;AACxE,OAAO,KAAkB,MAAM,OAAO,CAAA;AACtC,OAAO,EAAE,SAAS,EAAc,SAAS,EAAQ,SAAS,EAAE,MAAM,cAAc,CAAA;AAwDhF,eAAO,MAAM,SAAS,GAAI,gEAQvB;IACD,KAAK,EAAE,KAAK,CAAA;IACZ,KAAK,CAAC,EAAE,GAAG,CAAA;IACX,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,SAAS,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;IAChC,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,sBAiDA,CAAA"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { InputSize } from '@chem-po/core';
|
|
1
|
+
import { BaseSelectOption, InputSize } from '@chem-po/core';
|
|
2
2
|
import { MultipleSelectField } from '@chem-po/react';
|
|
3
|
-
import { ViewStyle } from 'react-native';
|
|
4
|
-
|
|
3
|
+
import { StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
4
|
+
type NativeMultipleSelectField<Value extends any[] = string[], Option extends BaseSelectOption<Value[number]> = BaseSelectOption<Value[number]>> = MultipleSelectField<Value, Option>;
|
|
5
|
+
export declare const MultipleSelectFieldView: <F extends NativeMultipleSelectField>({ field, value, noLabel, size: sizeProp, style, textStyle, }: {
|
|
5
6
|
field: F;
|
|
6
7
|
value?: F["defaultValue"];
|
|
7
8
|
noLabel?: boolean;
|
|
9
|
+
textStyle?: StyleProp<TextStyle>;
|
|
8
10
|
size?: InputSize;
|
|
9
11
|
style?: ViewStyle;
|
|
10
12
|
}) => any;
|
|
13
|
+
export {};
|
|
11
14
|
//# sourceMappingURL=multipleSelect.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multipleSelect.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/view/multipleSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"multipleSelect.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/view/multipleSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC3D,OAAO,EAAE,mBAAmB,EAAqC,MAAM,gBAAgB,CAAA;AAEvF,OAAc,EAAE,SAAS,EAAoB,SAAS,EAAQ,SAAS,EAAE,MAAM,cAAc,CAAA;AA8B7F,KAAK,yBAAyB,CAC5B,KAAK,SAAS,GAAG,EAAE,GAAG,MAAM,EAAE,EAC9B,MAAM,SAAS,gBAAgB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,gBAAgB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAC9E,mBAAmB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;AAEtC,eAAO,MAAM,uBAAuB,GAAI,CAAC,SAAS,yBAAyB,EAAE,8DAO1E;IACD,KAAK,EAAE,CAAC,CAAA;IACR,KAAK,CAAC,EAAE,CAAC,CAAC,cAAc,CAAC,CAAA;IACzB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,SAAS,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;IAChC,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,KAAK,CAAC,EAAE,SAAS,CAAA;CAClB,QAgCA,CAAA"}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { InputSize, RenderSelectOptionProps } from '@chem-po/core';
|
|
2
2
|
import { SelectField } from '@chem-po/react';
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import { ViewStyle } from 'react-native';
|
|
5
|
-
export declare const DefaultRenderOption:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
import { StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
5
|
+
export declare const DefaultRenderOption: ({ option, containerStyle, textStyle, }: RenderSelectOptionProps & {
|
|
6
|
+
containerStyle?: StyleProp<ViewStyle>;
|
|
7
|
+
textStyle?: StyleProp<TextStyle>;
|
|
8
|
+
}) => React.JSX.Element;
|
|
9
|
+
export declare const SelectFieldView: <F extends SelectField>({ field, value, noLabel, style, size: sizeProp, inEditable, textStyle, }: {
|
|
10
|
+
field: F;
|
|
11
|
+
value: F["defaultValue"];
|
|
9
12
|
noLabel?: boolean;
|
|
10
13
|
style?: ViewStyle;
|
|
14
|
+
textStyle?: StyleProp<TextStyle>;
|
|
11
15
|
size?: InputSize;
|
|
12
16
|
inEditable?: boolean;
|
|
13
17
|
}) => React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/view/select.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/view/select.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAA;AAClE,OAAO,EAAE,WAAW,EAAqC,MAAM,gBAAgB,CAAA;AAC/E,OAAO,KAAkB,MAAM,OAAO,CAAA;AACtC,OAAO,EAAE,SAAS,EAAoB,SAAS,EAAQ,SAAS,EAAE,MAAM,cAAc,CAAA;AAiBtF,eAAO,MAAM,mBAAmB,GAAI,wCAIjC,uBAAuB,GAAG;IAC3B,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;IACrC,SAAS,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;CACjC,sBAMA,CAAA;AAED,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,WAAW,EAAE,0EAQpD;IACD,KAAK,EAAE,CAAC,CAAA;IACR,KAAK,EAAE,CAAC,CAAC,cAAc,CAAC,CAAA;IACxB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,SAAS,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;IAChC,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,sBA+BA,CAAA"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@chem-po/react-native",
|
|
3
3
|
"author": "Elan Canfield",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.43",
|
|
6
6
|
"main": "lib/commonjs/index.js",
|
|
7
7
|
"types": "lib/typescript/index.d.ts",
|
|
8
8
|
"source": "src/index.ts",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"react-native-svg": "15.12.1",
|
|
54
54
|
"react-native-worklets": "0.5.1",
|
|
55
55
|
"zustand": "^4.3.3",
|
|
56
|
-
"@chem-po/
|
|
57
|
-
"@chem-po/
|
|
56
|
+
"@chem-po/react": "0.0.43",
|
|
57
|
+
"@chem-po/core": "0.0.43"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@babel/core": "^7.26.0",
|
|
@@ -31,6 +31,7 @@ export const Editable = <T extends Field>({
|
|
|
31
31
|
size,
|
|
32
32
|
CustomInput,
|
|
33
33
|
CustomView,
|
|
34
|
+
inputStyle,
|
|
34
35
|
}: EditableProps<ViewStyle, TextStyle, T>) => {
|
|
35
36
|
const {
|
|
36
37
|
inputRef,
|
|
@@ -80,9 +81,9 @@ export const Editable = <T extends Field>({
|
|
|
80
81
|
return <CustomInput {...props} ref={ref} />
|
|
81
82
|
}
|
|
82
83
|
if (!field) throw new Error('Editable component must have a field OR a CustomInput')
|
|
83
|
-
return <StandaloneInput ref={ref} field={field} {...props} />
|
|
84
|
+
return <StandaloneInput ref={ref} field={field} inputStyle={inputStyle} {...props} />
|
|
84
85
|
},
|
|
85
|
-
[CustomInput, field],
|
|
86
|
+
[CustomInput, field, inputStyle],
|
|
86
87
|
)
|
|
87
88
|
|
|
88
89
|
const RenderView = useCallback(
|
|
@@ -91,9 +92,9 @@ export const Editable = <T extends Field>({
|
|
|
91
92
|
return <CustomView {...props} />
|
|
92
93
|
}
|
|
93
94
|
if (!field) throw new Error('Editable component must have a field OR a CustomView')
|
|
94
|
-
return <FieldView field={field} {...props} />
|
|
95
|
+
return <FieldView textStyle={inputStyle} field={field} {...props} />
|
|
95
96
|
},
|
|
96
|
-
[CustomView, field],
|
|
97
|
+
[CustomView, field, inputStyle],
|
|
97
98
|
)
|
|
98
99
|
|
|
99
100
|
return (
|
|
@@ -13,7 +13,7 @@ import { Ionicons } from '@expo/vector-icons'
|
|
|
13
13
|
import * as DocumentPicker from 'expo-document-picker'
|
|
14
14
|
import * as ImagePicker from 'expo-image-picker'
|
|
15
15
|
import React, { forwardRef, useCallback, useImperativeHandle, useMemo } from 'react'
|
|
16
|
-
import { Platform, StyleProp, StyleSheet, Text, View, ViewStyle } from 'react-native'
|
|
16
|
+
import { Platform, StyleProp, StyleSheet, Text, TextStyle, View, ViewStyle } from 'react-native'
|
|
17
17
|
import { Pressable } from 'react-native-gesture-handler'
|
|
18
18
|
import { downloadFile } from '../../../../utils/downloadFile'
|
|
19
19
|
import { LoadingImage } from '../../../loading/LoadingImage'
|
|
@@ -56,6 +56,7 @@ export const FileView = ({
|
|
|
56
56
|
nonImageContainerStyle,
|
|
57
57
|
withDownload,
|
|
58
58
|
onUploadPress,
|
|
59
|
+
textStyle,
|
|
59
60
|
}: {
|
|
60
61
|
value?: FileValue | null
|
|
61
62
|
hasUpload?: boolean
|
|
@@ -64,6 +65,7 @@ export const FileView = ({
|
|
|
64
65
|
nonImageContainerStyle?: StyleProp<ViewStyle>
|
|
65
66
|
withDownload?: boolean
|
|
66
67
|
onUploadPress?: () => void
|
|
68
|
+
textStyle?: StyleProp<TextStyle>
|
|
67
69
|
}) => {
|
|
68
70
|
const { storagePath, dataUrl } = value ?? {}
|
|
69
71
|
const missingFile = !dataUrl && !storagePath
|
|
@@ -131,7 +133,7 @@ export const FileView = ({
|
|
|
131
133
|
<Ionicons name="document" size={24} color={iconColor} />
|
|
132
134
|
</View>
|
|
133
135
|
<View style={styles.filenameContainer}>
|
|
134
|
-
<Text numberOfLines={1} style={[styles.filename, { color: fileNameColor }]}>
|
|
136
|
+
<Text numberOfLines={1} style={[styles.filename, { color: fileNameColor }, textStyle]}>
|
|
135
137
|
{value.filename}
|
|
136
138
|
</Text>
|
|
137
139
|
</View>
|
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
useBackgroundColor,
|
|
5
5
|
useBorderColor,
|
|
6
6
|
useColorMode,
|
|
7
|
-
useColorModeValue,
|
|
8
7
|
useIconColor,
|
|
9
8
|
usePlaceholderColor,
|
|
10
9
|
useTextColor,
|
|
@@ -58,7 +57,7 @@ const BaseMultipleSelectComponent = <T extends MultipleSelectField>(
|
|
|
58
57
|
const placeholderColor = usePlaceholderColor()
|
|
59
58
|
const menuBg = useBackgroundColor(100)
|
|
60
59
|
const inputBg = useBackgroundColor(50)
|
|
61
|
-
const selectedOptionBg =
|
|
60
|
+
const selectedOptionBg = useBackgroundColor(50)
|
|
62
61
|
const borderColor = useBorderColor()
|
|
63
62
|
|
|
64
63
|
useImperativeHandle(ref, () => ({
|
|
@@ -86,7 +85,7 @@ const BaseMultipleSelectComponent = <T extends MultipleSelectField>(
|
|
|
86
85
|
return RenderOption(props)
|
|
87
86
|
}
|
|
88
87
|
return (
|
|
89
|
-
<View style={{
|
|
88
|
+
<View style={[container, { width: 'auto' }]}>
|
|
90
89
|
<Txt style={[text]}>{props.option.label}</Txt>
|
|
91
90
|
</View>
|
|
92
91
|
)
|
|
@@ -100,11 +99,11 @@ const BaseMultipleSelectComponent = <T extends MultipleSelectField>(
|
|
|
100
99
|
<View style={[styles.wrapper]}>
|
|
101
100
|
<MultiSelect
|
|
102
101
|
ref={inputRef}
|
|
103
|
-
style={[container, { borderColor,
|
|
102
|
+
style={[container, { borderColor, borderBottomWidth: 1, borderRadius: 0 }]}
|
|
104
103
|
placeholderStyle={[text, { color: value?.length ? textColor : placeholderColor }]}
|
|
105
104
|
containerStyle={{
|
|
106
105
|
backgroundColor: menuBg,
|
|
107
|
-
boxShadow: `0 0
|
|
106
|
+
boxShadow: `0 0 10px #00000066`,
|
|
108
107
|
borderWidth: 0,
|
|
109
108
|
}}
|
|
110
109
|
inputSearchStyle={[styles.inputSearch, text, { backgroundColor: inputBg, borderWidth: 0 }]}
|
|
@@ -133,7 +132,7 @@ const BaseMultipleSelectComponent = <T extends MultipleSelectField>(
|
|
|
133
132
|
renderItem={(item, selected) => (
|
|
134
133
|
<View
|
|
135
134
|
style={{
|
|
136
|
-
backgroundColor: selected ? selectedOptionBg :
|
|
135
|
+
backgroundColor: selected ? selectedOptionBg : menuBg,
|
|
137
136
|
paddingVertical: 8,
|
|
138
137
|
paddingHorizontal: 12,
|
|
139
138
|
flexDirection: 'row',
|
|
@@ -2,7 +2,6 @@ import { InputRef, RenderSelectOptionProps } from '@chem-po/core'
|
|
|
2
2
|
import {
|
|
3
3
|
SelectField,
|
|
4
4
|
useBackgroundColor,
|
|
5
|
-
useBorderColor,
|
|
6
5
|
useColorMode,
|
|
7
6
|
useIconColor,
|
|
8
7
|
usePlaceholderColor,
|
|
@@ -33,14 +32,11 @@ const BaseSelectComponent = <T extends SelectField>(
|
|
|
33
32
|
const colorMode = useColorMode()
|
|
34
33
|
|
|
35
34
|
const inputRef = useRef<IDropdownRef>(null)
|
|
36
|
-
const {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
clearButtonSize,
|
|
42
|
-
buttonContainer,
|
|
43
|
-
} = useInputStyles(inEditable, field.size, formSize)
|
|
35
|
+
const { container, iconSize, text, size, clearButtonSize, buttonContainer } = useInputStyles(
|
|
36
|
+
inEditable,
|
|
37
|
+
field.size,
|
|
38
|
+
formSize,
|
|
39
|
+
)
|
|
44
40
|
|
|
45
41
|
useImperativeHandle(ref, () => ({
|
|
46
42
|
focus: () => {
|
|
@@ -64,19 +60,18 @@ const BaseSelectComponent = <T extends SelectField>(
|
|
|
64
60
|
const placeholderColor = usePlaceholderColor()
|
|
65
61
|
const menuBg = useBackgroundColor(100)
|
|
66
62
|
const selectedOptionBg = useBackgroundColor(50)
|
|
67
|
-
const borderColor = useBorderColor()
|
|
68
63
|
|
|
69
64
|
return (
|
|
70
65
|
<View style={styles.wrapper}>
|
|
71
66
|
<Dropdown
|
|
72
67
|
ref={inputRef}
|
|
73
|
-
style={
|
|
68
|
+
style={container}
|
|
74
69
|
placeholderStyle={[text, { color: placeholderColor }]}
|
|
75
70
|
containerStyle={{
|
|
76
71
|
backgroundColor: menuBg,
|
|
77
72
|
borderWidth: 0,
|
|
78
73
|
borderColor: 'transparent',
|
|
79
|
-
boxShadow: `0 0 10px
|
|
74
|
+
boxShadow: `0 0 10px #00000066`,
|
|
80
75
|
}}
|
|
81
76
|
selectedTextStyle={text}
|
|
82
77
|
inputSearchStyle={[
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ImageViewOptions, InputSize } from '@chem-po/core'
|
|
2
2
|
import { FileField, usePlaceholderColor } from '@chem-po/react'
|
|
3
3
|
import React, { useMemo } from 'react'
|
|
4
|
-
import { StyleSheet, Text, View, ViewStyle } from 'react-native'
|
|
4
|
+
import { StyleProp, StyleSheet, Text, TextStyle, View, ViewStyle } from 'react-native'
|
|
5
5
|
import { Txt } from '../../text/Txt'
|
|
6
6
|
import { FileView } from '../input/file'
|
|
7
7
|
import { useInputStyles } from '../input/hooks/useInputStyles'
|
|
@@ -42,11 +42,13 @@ export const FileFieldView = ({
|
|
|
42
42
|
noLabel,
|
|
43
43
|
style,
|
|
44
44
|
size: sizeProp,
|
|
45
|
+
textStyle,
|
|
45
46
|
}: {
|
|
46
47
|
field: FileField
|
|
47
48
|
value: any
|
|
48
49
|
noLabel?: boolean
|
|
49
50
|
style?: ViewStyle
|
|
51
|
+
textStyle?: StyleProp<TextStyle>
|
|
50
52
|
size?: InputSize
|
|
51
53
|
}) => {
|
|
52
54
|
const { imageOptions, placeholder, size } = field
|
|
@@ -66,11 +68,11 @@ export const FileFieldView = ({
|
|
|
66
68
|
{!noLabel && <Text style={styles.label}>{placeholder}</Text>}
|
|
67
69
|
{value ? (
|
|
68
70
|
<View style={styles.fileContainer}>
|
|
69
|
-
<FileView imageOptions={options} value={value} />
|
|
71
|
+
<FileView textStyle={textStyle} imageOptions={options} value={value} />
|
|
70
72
|
</View>
|
|
71
73
|
) : (
|
|
72
74
|
<View style={container}>
|
|
73
|
-
<Txt style={[text, { color: placeholderColor }]}>None</Txt>
|
|
75
|
+
<Txt style={[text, { color: placeholderColor }, textStyle]}>None</Txt>
|
|
74
76
|
</View>
|
|
75
77
|
)}
|
|
76
78
|
</View>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { displayField, InputSize } from '@chem-po/core'
|
|
2
2
|
import { Field, FormatField, usePlaceholderColor } from '@chem-po/react'
|
|
3
3
|
import React, { useMemo } from 'react'
|
|
4
|
-
import { StyleSheet, View, ViewStyle } from 'react-native'
|
|
4
|
+
import { StyleProp, StyleSheet, TextStyle, View, ViewStyle } from 'react-native'
|
|
5
5
|
import { Txt } from '../../text'
|
|
6
6
|
import { useInputStyles } from '../input/hooks/useInputStyles'
|
|
7
7
|
import { FileFieldView } from './file'
|
|
@@ -23,11 +23,13 @@ const DefaultFieldView = ({
|
|
|
23
23
|
style,
|
|
24
24
|
size: sizeProp,
|
|
25
25
|
inEditable,
|
|
26
|
+
textStyle,
|
|
26
27
|
}: {
|
|
27
28
|
field: Field
|
|
28
29
|
value: any
|
|
29
30
|
noLabel?: boolean
|
|
30
31
|
style?: ViewStyle
|
|
32
|
+
textStyle?: StyleProp<TextStyle>
|
|
31
33
|
size?: InputSize
|
|
32
34
|
inEditable?: boolean
|
|
33
35
|
}) => {
|
|
@@ -48,7 +50,7 @@ const DefaultFieldView = ({
|
|
|
48
50
|
return (
|
|
49
51
|
<View style={[styles.container, containerStyles, { backgroundColor: 'transparent' }, style]}>
|
|
50
52
|
{!noLabel && <Txt style={[inputViewStyles.label, text]}>{placeholder}</Txt>}
|
|
51
|
-
<Txt style={[text, { color: hasValue ?
|
|
53
|
+
<Txt style={[text, { color: hasValue ? text.color : placeholderColor }, textStyle]}>
|
|
52
54
|
{hasValue ? formatted : 'None'}
|
|
53
55
|
</Txt>
|
|
54
56
|
</View>
|
|
@@ -60,6 +62,7 @@ export const FieldView = ({
|
|
|
60
62
|
value,
|
|
61
63
|
noLabel,
|
|
62
64
|
style,
|
|
65
|
+
textStyle,
|
|
63
66
|
size,
|
|
64
67
|
inEditable,
|
|
65
68
|
}: {
|
|
@@ -67,6 +70,7 @@ export const FieldView = ({
|
|
|
67
70
|
value?: any
|
|
68
71
|
noLabel?: boolean
|
|
69
72
|
style?: ViewStyle
|
|
73
|
+
textStyle?: StyleProp<TextStyle>
|
|
70
74
|
size?: InputSize
|
|
71
75
|
inEditable?: boolean
|
|
72
76
|
}) => {
|
|
@@ -75,6 +79,7 @@ export const FieldView = ({
|
|
|
75
79
|
return (
|
|
76
80
|
<SelectFieldView
|
|
77
81
|
style={style}
|
|
82
|
+
textStyle={textStyle}
|
|
78
83
|
field={field}
|
|
79
84
|
value={value}
|
|
80
85
|
noLabel={noLabel}
|
|
@@ -88,13 +93,21 @@ export const FieldView = ({
|
|
|
88
93
|
style={style}
|
|
89
94
|
field={field}
|
|
90
95
|
value={value}
|
|
96
|
+
textStyle={textStyle}
|
|
91
97
|
noLabel={noLabel}
|
|
92
98
|
size={size}
|
|
93
99
|
/>
|
|
94
100
|
)
|
|
95
101
|
case 'file':
|
|
96
102
|
return (
|
|
97
|
-
<FileFieldView
|
|
103
|
+
<FileFieldView
|
|
104
|
+
textStyle={textStyle}
|
|
105
|
+
style={style}
|
|
106
|
+
field={field}
|
|
107
|
+
value={value}
|
|
108
|
+
noLabel={noLabel}
|
|
109
|
+
size={size}
|
|
110
|
+
/>
|
|
98
111
|
)
|
|
99
112
|
default:
|
|
100
113
|
return (
|
|
@@ -102,6 +115,7 @@ export const FieldView = ({
|
|
|
102
115
|
style={style}
|
|
103
116
|
field={field}
|
|
104
117
|
value={value}
|
|
118
|
+
textStyle={textStyle}
|
|
105
119
|
noLabel={noLabel}
|
|
106
120
|
size={size}
|
|
107
121
|
inEditable={inEditable}
|