@chem-po/react-native 0.0.15 → 0.0.17
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/button/DeleteButton.js +1 -1
- package/lib/commonjs/components/button/DeleteButton.js.map +1 -1
- package/lib/commonjs/components/button/LoadingButton.js +2 -1
- package/lib/commonjs/components/button/LoadingButton.js.map +1 -1
- package/lib/commonjs/components/feed/MediaFeed.js +1 -1
- package/lib/commonjs/components/feed/MediaFeed.js.map +1 -1
- package/lib/commonjs/components/form/Field.js +4 -2
- package/lib/commonjs/components/form/Field.js.map +1 -1
- package/lib/commonjs/components/form/Form.js +20 -7
- package/lib/commonjs/components/form/Form.js.map +1 -1
- package/lib/commonjs/components/form/input/Editable.js +24 -7
- package/lib/commonjs/components/form/input/Editable.js.map +1 -1
- package/lib/commonjs/components/form/input/common/InputClearButton.js +10 -5
- package/lib/commonjs/components/form/input/common/InputClearButton.js.map +1 -1
- package/lib/commonjs/components/form/input/date/index.js +23 -15
- package/lib/commonjs/components/form/input/date/index.js.map +1 -1
- package/lib/commonjs/components/form/input/datetime/index.js +22 -18
- package/lib/commonjs/components/form/input/datetime/index.js.map +1 -1
- package/lib/commonjs/components/form/input/hooks/index.js +4 -4
- package/lib/commonjs/components/form/input/hooks/index.js.map +1 -1
- package/lib/commonjs/components/form/input/hooks/useInputStyles.js +111 -0
- package/lib/commonjs/components/form/input/hooks/useInputStyles.js.map +1 -0
- package/lib/commonjs/components/form/input/input.js +46 -11
- package/lib/commonjs/components/form/input/input.js.map +1 -1
- package/lib/commonjs/components/form/input/multipleSelect/index.js +162 -44
- package/lib/commonjs/components/form/input/multipleSelect/index.js.map +1 -1
- package/lib/commonjs/components/form/input/number/index.js +10 -5
- package/lib/commonjs/components/form/input/number/index.js.map +1 -1
- package/lib/commonjs/components/form/input/select/index.js +86 -173
- package/lib/commonjs/components/form/input/select/index.js.map +1 -1
- package/lib/commonjs/components/form/input/text/index.js +7 -5
- package/lib/commonjs/components/form/input/text/index.js.map +1 -1
- package/lib/commonjs/components/form/input/text/textarea.js +10 -5
- package/lib/commonjs/components/form/input/text/textarea.js.map +1 -1
- package/lib/commonjs/components/form/input/time/index.js +22 -13
- package/lib/commonjs/components/form/input/time/index.js.map +1 -1
- package/lib/commonjs/components/form/view/file.js +18 -4
- package/lib/commonjs/components/form/view/file.js.map +1 -1
- package/lib/commonjs/components/form/view/index.js +24 -23
- package/lib/commonjs/components/form/view/index.js.map +1 -1
- package/lib/commonjs/components/form/view/multipleSelect.js +38 -10
- package/lib/commonjs/components/form/view/multipleSelect.js.map +1 -1
- package/lib/commonjs/components/form/view/select.js +24 -9
- package/lib/commonjs/components/form/view/select.js.map +1 -1
- package/lib/commonjs/components/form/view/styles.js +21 -0
- package/lib/commonjs/components/form/view/styles.js.map +1 -0
- package/lib/commonjs/contexts/root.js +0 -6
- package/lib/commonjs/contexts/root.js.map +1 -1
- package/lib/module/components/button/DeleteButton.js +1 -1
- package/lib/module/components/button/DeleteButton.js.map +1 -1
- package/lib/module/components/button/LoadingButton.js +2 -1
- package/lib/module/components/button/LoadingButton.js.map +1 -1
- package/lib/module/components/feed/MediaFeed.js +1 -1
- package/lib/module/components/feed/MediaFeed.js.map +1 -1
- package/lib/module/components/form/Field.js +4 -2
- package/lib/module/components/form/Field.js.map +1 -1
- package/lib/module/components/form/Form.js +20 -7
- package/lib/module/components/form/Form.js.map +1 -1
- package/lib/module/components/form/input/Editable.js +24 -7
- package/lib/module/components/form/input/Editable.js.map +1 -1
- package/lib/module/components/form/input/common/InputClearButton.js +11 -6
- package/lib/module/components/form/input/common/InputClearButton.js.map +1 -1
- package/lib/module/components/form/input/date/index.js +23 -15
- package/lib/module/components/form/input/date/index.js.map +1 -1
- package/lib/module/components/form/input/datetime/index.js +22 -18
- package/lib/module/components/form/input/datetime/index.js.map +1 -1
- package/lib/module/components/form/input/hooks/index.js +1 -1
- package/lib/module/components/form/input/hooks/index.js.map +1 -1
- package/lib/module/components/form/input/hooks/useInputStyles.js +104 -0
- package/lib/module/components/form/input/hooks/useInputStyles.js.map +1 -0
- package/lib/module/components/form/input/input.js +48 -13
- package/lib/module/components/form/input/input.js.map +1 -1
- package/lib/module/components/form/input/multipleSelect/index.js +163 -46
- package/lib/module/components/form/input/multipleSelect/index.js.map +1 -1
- package/lib/module/components/form/input/number/index.js +10 -5
- package/lib/module/components/form/input/number/index.js.map +1 -1
- package/lib/module/components/form/input/select/index.js +88 -175
- package/lib/module/components/form/input/select/index.js.map +1 -1
- package/lib/module/components/form/input/text/index.js +7 -5
- package/lib/module/components/form/input/text/index.js.map +1 -1
- package/lib/module/components/form/input/text/textarea.js +11 -6
- package/lib/module/components/form/input/text/textarea.js.map +1 -1
- package/lib/module/components/form/input/time/index.js +22 -13
- package/lib/module/components/form/input/time/index.js.map +1 -1
- package/lib/module/components/form/view/file.js +18 -4
- package/lib/module/components/form/view/file.js.map +1 -1
- package/lib/module/components/form/view/index.js +25 -24
- package/lib/module/components/form/view/index.js.map +1 -1
- package/lib/module/components/form/view/multipleSelect.js +38 -10
- package/lib/module/components/form/view/multipleSelect.js.map +1 -1
- package/lib/module/components/form/view/select.js +23 -9
- package/lib/module/components/form/view/select.js.map +1 -1
- package/lib/module/components/form/view/styles.js +15 -0
- package/lib/module/components/form/view/styles.js.map +1 -0
- package/lib/module/contexts/root.js +0 -6
- package/lib/module/contexts/root.js.map +1 -1
- package/lib/typescript/components/button/LoadingButton.d.ts +1 -0
- package/lib/typescript/components/button/LoadingButton.d.ts.map +1 -1
- package/lib/typescript/components/form/Field.d.ts +2 -1
- package/lib/typescript/components/form/Field.d.ts.map +1 -1
- package/lib/typescript/components/form/Form.d.ts +7 -4
- package/lib/typescript/components/form/Form.d.ts.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/common/InputClearButton.d.ts +4 -2
- package/lib/typescript/components/form/input/common/InputClearButton.d.ts.map +1 -1
- package/lib/typescript/components/form/input/date/index.d.ts.map +1 -1
- package/lib/typescript/components/form/input/datetime/index.d.ts.map +1 -1
- package/lib/typescript/components/form/input/hooks/index.d.ts +1 -1
- package/lib/typescript/components/form/input/hooks/index.d.ts.map +1 -1
- package/lib/typescript/components/form/input/hooks/useInputStyles.d.ts +61 -0
- package/lib/typescript/components/form/input/hooks/useInputStyles.d.ts.map +1 -0
- package/lib/typescript/components/form/input/input.d.ts.map +1 -1
- package/lib/typescript/components/form/input/multipleSelect/index.d.ts +6 -1
- package/lib/typescript/components/form/input/multipleSelect/index.d.ts.map +1 -1
- package/lib/typescript/components/form/input/number/index.d.ts.map +1 -1
- package/lib/typescript/components/form/input/select/index.d.ts.map +1 -1
- package/lib/typescript/components/form/input/text/index.d.ts.map +1 -1
- package/lib/typescript/components/form/input/text/textarea.d.ts.map +1 -1
- package/lib/typescript/components/form/input/time/index.d.ts.map +1 -1
- package/lib/typescript/components/form/view/file.d.ts +3 -1
- package/lib/typescript/components/form/view/file.d.ts.map +1 -1
- package/lib/typescript/components/form/view/index.d.ts +3 -1
- package/lib/typescript/components/form/view/index.d.ts.map +1 -1
- package/lib/typescript/components/form/view/multipleSelect.d.ts +5 -3
- package/lib/typescript/components/form/view/multipleSelect.d.ts.map +1 -1
- package/lib/typescript/components/form/view/select.d.ts +4 -1
- package/lib/typescript/components/form/view/select.d.ts.map +1 -1
- package/lib/typescript/components/form/view/styles.d.ts +14 -0
- package/lib/typescript/components/form/view/styles.d.ts.map +1 -0
- package/lib/typescript/contexts/root.d.ts +2 -2
- package/lib/typescript/contexts/root.d.ts.map +1 -1
- package/package.json +16 -27
- package/src/components/button/DeleteButton.tsx +1 -1
- package/src/components/button/LoadingButton.tsx +4 -1
- package/src/components/feed/MediaFeed.tsx +1 -1
- package/src/components/form/Field.tsx +3 -2
- package/src/components/form/Form.tsx +41 -11
- package/src/components/form/input/Editable.tsx +23 -6
- package/src/components/form/input/common/InputClearButton.tsx +12 -4
- package/src/components/form/input/date/index.tsx +23 -12
- package/src/components/form/input/datetime/index.tsx +27 -14
- package/src/components/form/input/hooks/index.ts +1 -1
- package/src/components/form/input/hooks/useInputStyles.ts +124 -0
- package/src/components/form/input/input.tsx +54 -25
- package/src/components/form/input/multipleSelect/index.tsx +189 -60
- package/src/components/form/input/number/index.tsx +5 -4
- package/src/components/form/input/select/index.tsx +90 -166
- package/src/components/form/input/text/index.tsx +4 -9
- package/src/components/form/input/text/textarea.tsx +18 -16
- package/src/components/form/input/time/index.tsx +31 -11
- package/src/components/form/view/file.tsx +19 -4
- package/src/components/form/view/index.tsx +36 -22
- package/src/components/form/view/multipleSelect.tsx +42 -15
- package/src/components/form/view/select.tsx +28 -11
- package/src/components/form/view/styles.ts +15 -0
- package/src/contexts/root.tsx +6 -13
- package/lib/commonjs/components/form/input/hooks/useInputStyle.js +0 -50
- package/lib/commonjs/components/form/input/hooks/useInputStyle.js.map +0 -1
- package/lib/commonjs/components/form/input/styles.js +0 -17
- package/lib/commonjs/components/form/input/styles.js.map +0 -1
- package/lib/module/components/form/input/hooks/useInputStyle.js +0 -43
- package/lib/module/components/form/input/hooks/useInputStyle.js.map +0 -1
- package/lib/module/components/form/input/styles.js +0 -11
- package/lib/module/components/form/input/styles.js.map +0 -1
- package/lib/typescript/components/form/input/hooks/useInputStyle.d.ts +0 -9
- package/lib/typescript/components/form/input/hooks/useInputStyle.d.ts.map +0 -1
- package/lib/typescript/components/form/input/styles.d.ts +0 -10
- package/lib/typescript/components/form/input/styles.d.ts.map +0 -1
- package/src/components/form/input/hooks/useInputStyle.ts +0 -40
- package/src/components/form/input/styles.ts +0 -11
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { InputRef } from '@chem-po/core';
|
|
2
2
|
import { MultipleSelectField } from '@chem-po/react';
|
|
3
|
-
import React from 'react';
|
|
3
|
+
import React, { PropsWithChildren } from 'react';
|
|
4
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
4
5
|
import { FieldProps } from '../../types';
|
|
6
|
+
export declare const SelectedOptionContainer: ({ children, style, }: PropsWithChildren<{
|
|
7
|
+
key?: string;
|
|
8
|
+
style?: StyleProp<ViewStyle>;
|
|
9
|
+
}>) => React.JSX.Element;
|
|
5
10
|
export declare const MultipleSelectComponent: React.ForwardRefExoticComponent<FieldProps<MultipleSelectField> & React.RefAttributes<InputRef>>;
|
|
6
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/input/multipleSelect/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,
|
|
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,EAQpB,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,sBAGnE,CAAA;AA0ID,eAAO,MAAM,uBAAuB,kGAA0C,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/input/number/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAqC,MAAM,gBAAgB,CAAA;AACpG,OAAO,KAA0E,MAAM,OAAO,CAAA;AAE9F,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAKxC,eAAO,MAAM,eAAe;aAA6D,MAAM;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/input/number/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAqC,MAAM,gBAAgB,CAAA;AACpG,OAAO,KAA0E,MAAM,OAAO,CAAA;AAE9F,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAKxC,eAAO,MAAM,eAAe;aAA6D,MAAM;kCAiD9F,CAAA;AAmBD,eAAO,MAAM,uBAAuB,kGAEnC,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,EAKZ,MAAM,gBAAgB,CAAA;AAEvB,OAAO,
|
|
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;AAiHxC,eAAO,MAAM,eAAe,0FAAkC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/input/text/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,SAAS,EAAqC,MAAM,gBAAgB,CAAA;AAE7E,OAAO,KAA4D,MAAM,OAAO,CAAA;AAEhF,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAIxC,eAAO,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/input/text/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,SAAS,EAAqC,MAAM,gBAAgB,CAAA;AAE7E,OAAO,KAA4D,MAAM,OAAO,CAAA;AAEhF,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAIxC,eAAO,MAAM,aAAa,wFA8CzB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textarea.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/input/text/textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,SAAS,EAAqC,MAAM,gBAAgB,CAAA;AAC7E,OAAO,KAAkD,MAAM,OAAO,CAAA;AAEtE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"textarea.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/input/text/textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,SAAS,EAAqC,MAAM,gBAAgB,CAAA;AAC7E,OAAO,KAAkD,MAAM,OAAO,CAAA;AAEtE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAGxC,eAAO,MAAM,iBAAiB,wFAmC7B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/input/time/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAY,MAAM,eAAe,CAAA;AAClD,OAAO,EAAE,SAAS,EAAgB,MAAM,gBAAgB,CAAA;AAExD,OAAO,KAA6D,MAAM,OAAO,CAAA;AAIjF,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAKxC,eAAO,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/input/time/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAY,MAAM,eAAe,CAAA;AAClD,OAAO,EAAE,SAAS,EAAgB,MAAM,gBAAgB,CAAA;AAExD,OAAO,KAA6D,MAAM,OAAO,CAAA;AAIjF,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAKxC,eAAO,MAAM,SAAS,wFA6FrB,CAAA"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { InputSize } from '@chem-po/core';
|
|
1
2
|
import { FileField } from '@chem-po/react';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import { ViewStyle } from 'react-native';
|
|
4
|
-
export declare const FileFieldView: ({ field, value, noLabel, style, }: {
|
|
5
|
+
export declare const FileFieldView: ({ field, value, noLabel, style, size: sizeProp, }: {
|
|
5
6
|
field: FileField;
|
|
6
7
|
value: any;
|
|
7
8
|
noLabel?: boolean;
|
|
8
9
|
style?: ViewStyle;
|
|
10
|
+
size?: InputSize;
|
|
9
11
|
}) => React.JSX.Element;
|
|
10
12
|
//# sourceMappingURL=file.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/view/file.tsx"],"names":[],"mappings":"
|
|
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,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,KAAkB,MAAM,OAAO,CAAA;AACtC,OAAO,EAA0B,SAAS,EAAE,MAAM,cAAc,CAAA;AAoChE,eAAO,MAAM,aAAa,GAAI,mDAM3B;IACD,KAAK,EAAE,SAAS,CAAA;IAChB,KAAK,EAAE,GAAG,CAAA;IACV,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,IAAI,CAAC,EAAE,SAAS,CAAA;CACjB,sBAsBA,CAAA"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { InputSize } from '@chem-po/core';
|
|
1
2
|
import { Field } from '@chem-po/react';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import { ViewStyle } from 'react-native';
|
|
4
|
-
export declare const FieldView: ({ field, value, noLabel, style, }: {
|
|
5
|
+
export declare const FieldView: ({ field, value, noLabel, style, size, }: {
|
|
5
6
|
field: Field;
|
|
6
7
|
value: any;
|
|
7
8
|
noLabel?: boolean;
|
|
8
9
|
style?: ViewStyle;
|
|
10
|
+
size?: InputSize;
|
|
9
11
|
}) => React.JSX.Element;
|
|
10
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/view/index.tsx"],"names":[],"mappings":"
|
|
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,EAAe,MAAM,gBAAgB,CAAA;AACnD,OAAO,KAAkB,MAAM,OAAO,CAAA;AACtC,OAAO,EAAoB,SAAS,EAAE,MAAM,cAAc,CAAA;AAmD1D,eAAO,MAAM,SAAS,GAAI,yCAMvB;IACD,KAAK,EAAE,KAAK,CAAA;IACZ,KAAK,EAAE,GAAG,CAAA;IACV,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,IAAI,CAAC,EAAE,SAAS,CAAA;CACjB,sBAyBA,CAAA"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { InputSize } from '@chem-po/core';
|
|
1
2
|
import { MultipleSelectField } from '@chem-po/react';
|
|
2
3
|
import { ViewStyle } from 'react-native';
|
|
3
|
-
export declare const MultipleSelectFieldView: ({ field, value, noLabel, style, }: {
|
|
4
|
-
field:
|
|
5
|
-
value
|
|
4
|
+
export declare const MultipleSelectFieldView: <F extends MultipleSelectField>({ field, value, noLabel, size: sizeProp, style, }: {
|
|
5
|
+
field: F;
|
|
6
|
+
value?: F["defaultValue"];
|
|
6
7
|
noLabel?: boolean;
|
|
8
|
+
size?: InputSize;
|
|
7
9
|
style?: ViewStyle;
|
|
8
10
|
}) => any;
|
|
9
11
|
//# 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,mBAAmB,EAAgB,MAAM,gBAAgB,CAAA;
|
|
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;AACzC,OAAO,EAAE,mBAAmB,EAAgB,MAAM,gBAAgB,CAAA;AAElE,OAAc,EAA0B,SAAS,EAAE,MAAM,cAAc,CAAA;AA+BvE,eAAO,MAAM,uBAAuB,GAAI,CAAC,SAAS,mBAAmB,EAAE,mDAMpE;IACD,KAAK,EAAE,CAAC,CAAA;IACR,KAAK,CAAC,EAAE,CAAC,CAAC,cAAc,CAAC,CAAA;IACzB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,KAAK,CAAC,EAAE,SAAS,CAAA;CAClB,QAkCA,CAAA"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import { BaseSelectOption, InputSize, RenderSelectOptionProps } from '@chem-po/core';
|
|
1
2
|
import { SelectField } from '@chem-po/react';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import { ViewStyle } from 'react-native';
|
|
4
|
-
export declare const
|
|
5
|
+
export declare const DefaultRenderOption: <Value = string, Option extends BaseSelectOption<Value> = BaseSelectOption<Value>>({ option, }: RenderSelectOptionProps<Value, Option>) => React.JSX.Element;
|
|
6
|
+
export declare const SelectFieldView: ({ field, value, noLabel, style, size: sizeProp, }: {
|
|
5
7
|
field: SelectField;
|
|
6
8
|
value: any;
|
|
7
9
|
noLabel?: boolean;
|
|
8
10
|
style?: ViewStyle;
|
|
11
|
+
size?: InputSize;
|
|
9
12
|
}) => React.JSX.Element;
|
|
10
13
|
//# sourceMappingURL=select.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/view/select.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/view/select.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAA;AACpF,OAAO,EAAE,WAAW,EAAqC,MAAM,gBAAgB,CAAA;AAC/E,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAA0B,SAAS,EAAE,MAAM,cAAc,CAAA;AAgBhE,eAAO,MAAM,mBAAmB,GAC9B,KAAK,GAAG,MAAM,EACd,MAAM,SAAS,gBAAgB,CAAC,KAAK,CAAC,GAAG,gBAAgB,CAAC,KAAK,CAAC,EAChE,aAEC,uBAAuB,CAAC,KAAK,EAAE,MAAM,CAAC,sBAExC,CAAA;AAED,eAAO,MAAM,eAAe,GAAI,mDAM7B;IACD,KAAK,EAAE,WAAW,CAAA;IAClB,KAAK,EAAE,GAAG,CAAA;IACV,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,IAAI,CAAC,EAAE,SAAS,CAAA;CACjB,sBAyBA,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/view/styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe;;;;;;;;;;;;CAY1B,CAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { BackendAdapterInterface, ColorMode, Theme } from '@chem-po/core';
|
|
2
2
|
import { ChempoProps } from '@chem-po/react';
|
|
3
3
|
import React, { PropsWithChildren } from 'react';
|
|
4
|
-
export interface ChempoNativeProviderProps extends PropsWithChildren<Pick<ChempoProps<
|
|
4
|
+
export interface ChempoNativeProviderProps<BackendAdapter extends BackendAdapterInterface> extends PropsWithChildren<Pick<ChempoProps<BackendAdapter>, 'backendAdapter' | 'assets'>> {
|
|
5
5
|
theme?: Theme;
|
|
6
6
|
initialColorMode?: ColorMode;
|
|
7
7
|
}
|
|
8
|
-
export declare const ChempoNativeProvider: ({ theme: themeProp, initialColorMode, ...props }: ChempoNativeProviderProps) => React.JSX.Element;
|
|
8
|
+
export declare const ChempoNativeProvider: <BackendAdapter extends BackendAdapterInterface<any, any, any, any, any, any>>({ theme: themeProp, initialColorMode, ...props }: ChempoNativeProviderProps<BackendAdapter>) => React.JSX.Element;
|
|
9
9
|
//# sourceMappingURL=root.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"root.d.ts","sourceRoot":"","sources":["../../../src/contexts/root.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACzE,OAAO,EAAE,WAAW,EAAkB,MAAM,gBAAgB,CAAA;AAC5D,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAW,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"root.d.ts","sourceRoot":"","sources":["../../../src/contexts/root.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACzE,OAAO,EAAE,WAAW,EAAkB,MAAM,gBAAgB,CAAA;AAC5D,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAW,MAAM,OAAO,CAAA;AASzD,MAAM,WAAW,yBAAyB,CAAC,cAAc,SAAS,uBAAuB,CACvF,SAAQ,iBAAiB,CAAC,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,EAAE,gBAAgB,GAAG,QAAQ,CAAC,CAAC;IACzF,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,gBAAgB,CAAC,EAAE,SAAS,CAAA;CAC7B;AACD,eAAO,MAAM,oBAAoB,GAC/B,cAAc,SAAS,uBAAuB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAC5E,kDAIC,yBAAyB,CAAC,cAAc,CAAC,sBAgB3C,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chem-po/react-native",
|
|
3
|
-
"
|
|
3
|
+
"author": "Elan Canfield",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"version": "0.0.17",
|
|
4
6
|
"main": "lib/commonjs/index.js",
|
|
5
7
|
"types": "lib/typescript/index.d.ts",
|
|
6
8
|
"source": "src/index.ts",
|
|
@@ -9,7 +11,6 @@
|
|
|
9
11
|
"react-native": "src/index.ts"
|
|
10
12
|
},
|
|
11
13
|
"sideEffects": false,
|
|
12
|
-
"license": "MIT",
|
|
13
14
|
"files": [
|
|
14
15
|
"src",
|
|
15
16
|
"lib",
|
|
@@ -38,46 +39,37 @@
|
|
|
38
39
|
"expo-image-picker": "~16.1.4",
|
|
39
40
|
"lottie-react-native": "7.2.2",
|
|
40
41
|
"nested-property": "^4.0.0",
|
|
41
|
-
"react": "19.0.0",
|
|
42
|
+
"react": "^19.0.0",
|
|
42
43
|
"react-hook-form": "^7.55.0",
|
|
43
|
-
"react-native": "0.79.
|
|
44
|
+
"react-native": "0.79.3",
|
|
45
|
+
"react-native-element-dropdown": "^2.12.4",
|
|
44
46
|
"react-native-gesture-handler": "~2.24.0",
|
|
45
47
|
"react-native-notifier": "^2.0.0",
|
|
46
48
|
"react-native-paper": "^5.14.3",
|
|
47
49
|
"react-native-paper-dates": "^0.22.42",
|
|
48
50
|
"react-native-svg": "15.11.2",
|
|
49
51
|
"zustand": "^4.3.3",
|
|
50
|
-
"@chem-po/core": "0.0.
|
|
51
|
-
"@chem-po/react": "0.0.
|
|
52
|
+
"@chem-po/core": "0.0.17",
|
|
53
|
+
"@chem-po/react": "0.0.17"
|
|
52
54
|
},
|
|
53
55
|
"devDependencies": {
|
|
54
56
|
"@babel/core": "^7.26.0",
|
|
55
57
|
"@babel/preset-env": "^7.25.4",
|
|
56
58
|
"@expo/metro-runtime": "~5.0.4",
|
|
57
|
-
"@types/react": "~19.0.
|
|
59
|
+
"@types/react": "~19.0.12",
|
|
58
60
|
"babel-plugin-react-docgen-typescript": "^1.5.1",
|
|
59
61
|
"babel-plugin-react-native-web": "^0.19.10",
|
|
60
62
|
"expo-build-properties": "~0.14.6",
|
|
61
|
-
"expo-dev-client": "~5.
|
|
63
|
+
"expo-dev-client": "~5.2.0",
|
|
64
|
+
"eslint-config-expo": "~9.2.0",
|
|
62
65
|
"react-native-builder-bob": "^0.20.0",
|
|
63
|
-
"vite": "^6.
|
|
66
|
+
"vite": "^6.2.2"
|
|
64
67
|
},
|
|
65
68
|
"peerDependencies": {
|
|
66
|
-
"expo": "~53.0.
|
|
69
|
+
"expo": "~53.0.11",
|
|
67
70
|
"react": "^19.0.0",
|
|
68
71
|
"react-dom": "^19.0.0",
|
|
69
|
-
"react-native": "
|
|
70
|
-
},
|
|
71
|
-
"expo": {
|
|
72
|
-
"install": {
|
|
73
|
-
"exclude": [
|
|
74
|
-
"react-native@~0.76.6",
|
|
75
|
-
"react-native-reanimated@~3.16.1",
|
|
76
|
-
"react-native-gesture-handler@~2.20.0",
|
|
77
|
-
"react-native-screens@~4.4.0",
|
|
78
|
-
"react-native-webview@~13.12.5"
|
|
79
|
-
]
|
|
80
|
-
}
|
|
72
|
+
"react-native": "0.79.3"
|
|
81
73
|
},
|
|
82
74
|
"react-native-builder-bob": {
|
|
83
75
|
"source": "src",
|
|
@@ -95,12 +87,9 @@
|
|
|
95
87
|
},
|
|
96
88
|
"scripts": {
|
|
97
89
|
"type-check": "tsc --noEmit",
|
|
98
|
-
"lint": "pnpm type-check && eslint
|
|
90
|
+
"lint": "pnpm type-check && eslint --fix",
|
|
99
91
|
"build": "bob build",
|
|
100
|
-
"
|
|
101
|
-
"example": "yarn --cwd example",
|
|
102
|
-
"bootstrap": "yarn example && yarn install",
|
|
103
|
-
"watch": "bob build --watch",
|
|
92
|
+
"prebuild": "pnpm lint",
|
|
104
93
|
"clean": "rm -rf lib"
|
|
105
94
|
},
|
|
106
95
|
"module": "lib/module/index.js"
|
|
@@ -16,6 +16,7 @@ export interface LoadingButtonProps {
|
|
|
16
16
|
onPress: (() => Promise<any>) | (() => void)
|
|
17
17
|
children: ReactNode
|
|
18
18
|
style?: ViewStyle
|
|
19
|
+
contentStyle?: ViewStyle
|
|
19
20
|
textStyle?: TextStyle
|
|
20
21
|
color?: string
|
|
21
22
|
icon?: {
|
|
@@ -29,6 +30,7 @@ export const LoadingButton: React.FC<LoadingButtonProps> = ({
|
|
|
29
30
|
onPress,
|
|
30
31
|
children,
|
|
31
32
|
style,
|
|
33
|
+
contentStyle,
|
|
32
34
|
textStyle,
|
|
33
35
|
color: colorProp,
|
|
34
36
|
icon,
|
|
@@ -98,7 +100,8 @@ export const LoadingButton: React.FC<LoadingButtonProps> = ({
|
|
|
98
100
|
handlePress()
|
|
99
101
|
}}
|
|
100
102
|
disabled={loading || disabled}>
|
|
101
|
-
<View
|
|
103
|
+
<View
|
|
104
|
+
style={[styles.buttonContent, { borderColor: disabled ? '#ccc' : color }, contentStyle]}>
|
|
102
105
|
<Animated.View style={[styles.contentContainer, { opacity: contentOpacity }]}>
|
|
103
106
|
{icon && (
|
|
104
107
|
<Ionicons name={icon.name} size={icon.size ?? 20} color={disabled ? '#ccc' : color} />
|
|
@@ -146,7 +146,7 @@ export const MediaFeed = <T extends AnyObject = AnyObject>({
|
|
|
146
146
|
|
|
147
147
|
const handleItemLoad = useCallback(
|
|
148
148
|
(data: WithId<T> | null) => {
|
|
149
|
-
const isCurr = panels.find(p => p.status === 'current')?.id === data?.
|
|
149
|
+
const isCurr = panels.find(p => p.status === 'current')?.id === data?.id
|
|
150
150
|
if (isCurr) setCurr(data)
|
|
151
151
|
},
|
|
152
152
|
[panels],
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { InputRef, getFieldValidate } from '@chem-po/core'
|
|
1
|
+
import { InputRef, InputSize, getFieldValidate } from '@chem-po/core'
|
|
2
2
|
import { Field, useField } from '@chem-po/react'
|
|
3
3
|
import React, { ForwardedRef, forwardRef, useMemo } from 'react'
|
|
4
4
|
import { ChangeHandler, Controller } from 'react-hook-form'
|
|
5
5
|
import { Input } from './input/input'
|
|
6
6
|
|
|
7
7
|
const FieldComponentBase = (
|
|
8
|
-
{ field, name }: { field: Field; name: string },
|
|
8
|
+
{ field, name, size: formSize }: { field: Field; name: string; size?: InputSize },
|
|
9
9
|
ref: ForwardedRef<InputRef>,
|
|
10
10
|
) => {
|
|
11
11
|
const { control, getOnChange, meta, onFocus, onBlur: fieldBlur } = useField(name, field)
|
|
@@ -31,6 +31,7 @@ const FieldComponentBase = (
|
|
|
31
31
|
onChange: getOnChange(inputProps.onChange as ChangeHandler),
|
|
32
32
|
}}
|
|
33
33
|
meta={meta}
|
|
34
|
+
formSize={formSize}
|
|
34
35
|
/>
|
|
35
36
|
)
|
|
36
37
|
}}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isField, isListField } from '@chem-po/core'
|
|
1
|
+
import { InputSize, isField, isListField } from '@chem-po/core'
|
|
2
2
|
import {
|
|
3
3
|
ChempoFormProvider,
|
|
4
4
|
DataViewProps,
|
|
@@ -110,7 +110,11 @@ const styles = StyleSheet.create({
|
|
|
110
110
|
},
|
|
111
111
|
})
|
|
112
112
|
|
|
113
|
-
export const ListFieldInput: FC<{
|
|
113
|
+
export const ListFieldInput: FC<{
|
|
114
|
+
field: ListField
|
|
115
|
+
name: string
|
|
116
|
+
size: InputSize
|
|
117
|
+
}> = ({ field, name, size }) => {
|
|
114
118
|
const emptyData = useMemo(() => {
|
|
115
119
|
if (isField(field.itemField)) return ''
|
|
116
120
|
if (isListField(field.itemField)) return []
|
|
@@ -133,7 +137,7 @@ export const ListFieldInput: FC<{ field: ListField; name: string }> = ({ field,
|
|
|
133
137
|
<View key={formField.id} style={styles.listItem}>
|
|
134
138
|
<View style={styles.listItemContent}>
|
|
135
139
|
<View style={styles.listItemInput}>
|
|
136
|
-
<FormElement name={formField.id} field={field.itemField} />
|
|
140
|
+
<FormElement size={size} name={formField.id} field={field.itemField} />
|
|
137
141
|
</View>
|
|
138
142
|
<DeleteButton
|
|
139
143
|
onDelete={() => remove(idx)}
|
|
@@ -155,7 +159,15 @@ export const ListFieldInput: FC<{ field: ListField; name: string }> = ({ field,
|
|
|
155
159
|
)
|
|
156
160
|
}
|
|
157
161
|
|
|
158
|
-
export const FormElement = ({
|
|
162
|
+
export const FormElement = ({
|
|
163
|
+
field,
|
|
164
|
+
name,
|
|
165
|
+
size,
|
|
166
|
+
}: {
|
|
167
|
+
field: IFormElement
|
|
168
|
+
name: string
|
|
169
|
+
size: InputSize
|
|
170
|
+
}) => {
|
|
159
171
|
const fields = useMemo<Array<{ name: string; field: IFormElement }>>(() => {
|
|
160
172
|
if (isField(field) || isListField(field)) return [{ name: 'value', field }]
|
|
161
173
|
|
|
@@ -169,7 +181,7 @@ export const FormElement = ({ field, name }: { field: IFormElement; name: string
|
|
|
169
181
|
<View style={styles.formElementContainer}>
|
|
170
182
|
{fields.map(f => {
|
|
171
183
|
if (isListField(f.field)) {
|
|
172
|
-
const b = <ListFieldInput key={f.name} name={f.name} field={f.field} />
|
|
184
|
+
const b = <ListFieldInput key={f.name} name={f.name} field={f.field} size={size} />
|
|
173
185
|
return f.field.condition ? (
|
|
174
186
|
<Condition path={name} condition={f.field.condition} key={f.name}>
|
|
175
187
|
{b}
|
|
@@ -179,7 +191,7 @@ export const FormElement = ({ field, name }: { field: IFormElement; name: string
|
|
|
179
191
|
)
|
|
180
192
|
}
|
|
181
193
|
if (isField(f.field)) {
|
|
182
|
-
const b = <FieldComponent key={f.name} name={f.name} field={f.field} />
|
|
194
|
+
const b = <FieldComponent key={f.name} name={f.name} field={f.field} size={size} />
|
|
183
195
|
return f.field.condition ? (
|
|
184
196
|
<Condition path={name} condition={f.field.condition} key={f.name}>
|
|
185
197
|
{b}
|
|
@@ -189,7 +201,7 @@ export const FormElement = ({ field, name }: { field: IFormElement; name: string
|
|
|
189
201
|
)
|
|
190
202
|
}
|
|
191
203
|
|
|
192
|
-
const b = <FormElement key={f.name} name={f.name} field={f.field} />
|
|
204
|
+
const b = <FormElement key={f.name} name={f.name} field={f.field} size={size} />
|
|
193
205
|
return f.field.condition ? (
|
|
194
206
|
<Condition path={name} condition={f.field.condition} key={f.name}>
|
|
195
207
|
{b}
|
|
@@ -341,6 +353,7 @@ export const FieldMapForm = <F extends FieldMap>({
|
|
|
341
353
|
buttonText = 'SUBMIT',
|
|
342
354
|
renderFooter,
|
|
343
355
|
storagePath,
|
|
356
|
+
size = 'md',
|
|
344
357
|
}: FieldMapFormProps<F>) => {
|
|
345
358
|
const useSubmitDataProps = useMemo<UseFormSubmitProps<F>>(
|
|
346
359
|
() => ({
|
|
@@ -355,7 +368,7 @@ export const FieldMapForm = <F extends FieldMap>({
|
|
|
355
368
|
|
|
356
369
|
return (
|
|
357
370
|
<View style={styles.container}>
|
|
358
|
-
<FormElement name="" field={field} />
|
|
371
|
+
<FormElement name="" field={field} size={size} />
|
|
359
372
|
<FormFooter
|
|
360
373
|
uploads={uploads}
|
|
361
374
|
onSubmit={onSubmit}
|
|
@@ -371,12 +384,14 @@ export const FieldForm = <F extends Field | ListField>({
|
|
|
371
384
|
onSubmit,
|
|
372
385
|
field,
|
|
373
386
|
value,
|
|
387
|
+
size,
|
|
374
388
|
...props
|
|
375
389
|
}: FieldFormProps<F>) => {
|
|
376
390
|
const fieldMap = useMemo<FieldMap>(() => ({ children: { value: field } }), [field])
|
|
377
391
|
const fieldMapValue = useMemo<FieldMapValue<FieldMap>>(() => ({ value }), [value])
|
|
378
392
|
return (
|
|
379
393
|
<FieldMapForm
|
|
394
|
+
size={size}
|
|
380
395
|
field={fieldMap}
|
|
381
396
|
value={fieldMapValue}
|
|
382
397
|
onSubmit={data => onSubmit(data?.value)}
|
|
@@ -385,12 +400,27 @@ export const FieldForm = <F extends Field | ListField>({
|
|
|
385
400
|
)
|
|
386
401
|
}
|
|
387
402
|
|
|
388
|
-
export const Form = <F extends IFormElement>({
|
|
403
|
+
export const Form = <F extends IFormElement>({
|
|
404
|
+
field,
|
|
405
|
+
onSubmit,
|
|
406
|
+
size = 'md',
|
|
407
|
+
...props
|
|
408
|
+
}: FormProps<F>) => {
|
|
389
409
|
const body =
|
|
390
410
|
isField(field) || isListField(field) ? (
|
|
391
|
-
<FieldForm
|
|
411
|
+
<FieldForm
|
|
412
|
+
size={size}
|
|
413
|
+
field={field}
|
|
414
|
+
onSubmit={onSubmit as FormOnSubmit<Field | ListField>}
|
|
415
|
+
{...props}
|
|
416
|
+
/>
|
|
392
417
|
) : (
|
|
393
|
-
<FieldMapForm
|
|
418
|
+
<FieldMapForm
|
|
419
|
+
size={size}
|
|
420
|
+
field={field}
|
|
421
|
+
onSubmit={onSubmit as FormOnSubmit<FieldMap>}
|
|
422
|
+
{...props}
|
|
423
|
+
/>
|
|
394
424
|
)
|
|
395
425
|
|
|
396
426
|
return <ChempoFormProvider>{body}</ChempoFormProvider>
|
|
@@ -13,6 +13,8 @@ import { LoadingOverlay } from '../../loading/Loading'
|
|
|
13
13
|
import { UploadProgress } from '../UploadProgress'
|
|
14
14
|
import { FieldView } from '../view'
|
|
15
15
|
import { StandaloneInput } from './StandaloneInput'
|
|
16
|
+
import { InputClearButton } from './common/InputClearButton'
|
|
17
|
+
import { useInputStyles } from './hooks/useInputStyles'
|
|
16
18
|
|
|
17
19
|
export const Editable = <T extends Field>({
|
|
18
20
|
value: initValue,
|
|
@@ -23,9 +25,9 @@ export const Editable = <T extends Field>({
|
|
|
23
25
|
onEditClose,
|
|
24
26
|
onEditOpen,
|
|
25
27
|
containerStyle,
|
|
28
|
+
size,
|
|
26
29
|
}: EditableProps<ViewStyle, T>) => {
|
|
27
30
|
const {
|
|
28
|
-
formattedValue,
|
|
29
31
|
inputRef,
|
|
30
32
|
setValue,
|
|
31
33
|
isLoading,
|
|
@@ -38,7 +40,6 @@ export const Editable = <T extends Field>({
|
|
|
38
40
|
setEditHovered,
|
|
39
41
|
submitValue,
|
|
40
42
|
submit,
|
|
41
|
-
parse,
|
|
42
43
|
} = useEditable({
|
|
43
44
|
value: initValue,
|
|
44
45
|
field,
|
|
@@ -88,10 +89,18 @@ export const Editable = <T extends Field>({
|
|
|
88
89
|
}, [isEditing, inputRef])
|
|
89
90
|
|
|
90
91
|
const iconColor = useIconColor()
|
|
91
|
-
|
|
92
|
+
const { clearButtonSize } = useInputStyles(true, field.size, size)
|
|
92
93
|
const editingBorderColor = useColorModeValue('#00000055', '#ffffff55')
|
|
93
94
|
const submitColor = useThemeValue('colors.accent.200')
|
|
94
95
|
|
|
96
|
+
const needsClearButton = useMemo(() => {
|
|
97
|
+
if (!field.optional) return false
|
|
98
|
+
switch (field._type) {
|
|
99
|
+
case 'select':
|
|
100
|
+
return true
|
|
101
|
+
}
|
|
102
|
+
}, [field])
|
|
103
|
+
|
|
95
104
|
const handleBlur = useCallback(() => {
|
|
96
105
|
switch (field._type) {
|
|
97
106
|
case 'select':
|
|
@@ -134,20 +143,28 @@ export const Editable = <T extends Field>({
|
|
|
134
143
|
{isEditing || alwaysEditing ? (
|
|
135
144
|
<StandaloneInput
|
|
136
145
|
ref={inputRef}
|
|
137
|
-
value={
|
|
146
|
+
value={value}
|
|
138
147
|
inEditable
|
|
139
148
|
field={editableField}
|
|
140
149
|
style={style}
|
|
141
|
-
onChange={shouldSubmitOnChange ? v => submitValue(
|
|
150
|
+
onChange={shouldSubmitOnChange ? v => submitValue(v) : setValue}
|
|
142
151
|
onBlur={handleBlur}
|
|
143
152
|
/>
|
|
144
153
|
) : (
|
|
145
154
|
<FieldView noLabel style={style} field={field} value={value} />
|
|
146
155
|
)}
|
|
147
156
|
</View>
|
|
148
|
-
|
|
149
157
|
{!alwaysEditing && (
|
|
150
158
|
<View style={styles.buttonsContainer}>
|
|
159
|
+
{needsClearButton ? (
|
|
160
|
+
<InputClearButton
|
|
161
|
+
size={clearButtonSize}
|
|
162
|
+
onPress={() => {
|
|
163
|
+
submitValue(null)
|
|
164
|
+
}}
|
|
165
|
+
isActive={!!value}
|
|
166
|
+
/>
|
|
167
|
+
) : null}
|
|
151
168
|
{noCloseButton && isEditing ? null : (
|
|
152
169
|
<TouchableOpacity
|
|
153
170
|
style={styles.editButton}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useBorderColor, useIconColor } from '@chem-po/react'
|
|
1
|
+
import { useBackgroundColor, useBorderColor, useIconColor } from '@chem-po/react'
|
|
2
2
|
import { Ionicons } from '@expo/vector-icons'
|
|
3
3
|
import React from 'react'
|
|
4
4
|
import { StyleSheet, TouchableOpacity } from 'react-native'
|
|
@@ -7,20 +7,26 @@ export const InputClearButton = ({
|
|
|
7
7
|
onPress,
|
|
8
8
|
isActive,
|
|
9
9
|
marginRight,
|
|
10
|
+
size,
|
|
10
11
|
}: {
|
|
11
12
|
onPress: () => void
|
|
12
13
|
isActive: boolean
|
|
13
14
|
marginRight?: number
|
|
15
|
+
size: number
|
|
14
16
|
}) => {
|
|
15
17
|
const iconColor = useIconColor()
|
|
16
18
|
const borderColor = useBorderColor()
|
|
19
|
+
const backgroundColor = useBackgroundColor(100)
|
|
17
20
|
return (
|
|
18
21
|
<TouchableOpacity
|
|
19
22
|
onPress={onPress}
|
|
20
|
-
style={[
|
|
23
|
+
style={[
|
|
24
|
+
styles.closeButton,
|
|
25
|
+
{ opacity: isActive ? 1 : 0, marginRight, borderColor, backgroundColor },
|
|
26
|
+
]}
|
|
21
27
|
hitSlop={{ top: 10, bottom: 10, left: 10, right: 10 }}
|
|
22
28
|
disabled={!isActive}>
|
|
23
|
-
<Ionicons name="close" size={
|
|
29
|
+
<Ionicons name="close" size={size} color={iconColor} style={{ alignSelf: 'center' }} />
|
|
24
30
|
</TouchableOpacity>
|
|
25
31
|
)
|
|
26
32
|
}
|
|
@@ -28,11 +34,13 @@ export const InputClearButton = ({
|
|
|
28
34
|
export const DateInputClearButton = ({
|
|
29
35
|
onPress,
|
|
30
36
|
isActive,
|
|
37
|
+
size,
|
|
31
38
|
}: {
|
|
32
39
|
onPress: () => void
|
|
33
40
|
isActive: boolean
|
|
41
|
+
size: number
|
|
34
42
|
}) => {
|
|
35
|
-
return <InputClearButton marginRight={0} onPress={onPress} isActive={isActive} />
|
|
43
|
+
return <InputClearButton marginRight={0} onPress={onPress} isActive={isActive} size={size} />
|
|
36
44
|
}
|
|
37
45
|
|
|
38
46
|
const styles = StyleSheet.create({
|