@chem-po/react-native 0.0.27 → 0.0.29

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 (73) hide show
  1. package/lib/commonjs/components/form/input/Editable.js +17 -27
  2. package/lib/commonjs/components/form/input/Editable.js.map +1 -1
  3. package/lib/commonjs/components/form/input/StandaloneInput.js +5 -1
  4. package/lib/commonjs/components/form/input/StandaloneInput.js.map +1 -1
  5. package/lib/commonjs/components/form/input/hooks/useInputStyles.js +2 -1
  6. package/lib/commonjs/components/form/input/hooks/useInputStyles.js.map +1 -1
  7. package/lib/commonjs/components/form/input/multipleSelect/index.js +19 -10
  8. package/lib/commonjs/components/form/input/multipleSelect/index.js.map +1 -1
  9. package/lib/commonjs/components/form/input/number/index.js +8 -4
  10. package/lib/commonjs/components/form/input/number/index.js.map +1 -1
  11. package/lib/commonjs/components/form/input/select/index.js +14 -4
  12. package/lib/commonjs/components/form/input/select/index.js.map +1 -1
  13. package/lib/commonjs/components/form/input/text/AutoResizeTextarea.js +54 -0
  14. package/lib/commonjs/components/form/input/text/AutoResizeTextarea.js.map +1 -0
  15. package/lib/commonjs/components/form/input/text/index.js +22 -11
  16. package/lib/commonjs/components/form/input/text/index.js.map +1 -1
  17. package/lib/commonjs/components/form/input/text/textarea.js +12 -21
  18. package/lib/commonjs/components/form/input/text/textarea.js.map +1 -1
  19. package/lib/commonjs/components/form/input/text/useWebAutoResize.js +65 -0
  20. package/lib/commonjs/components/form/input/text/useWebAutoResize.js.map +1 -0
  21. package/lib/commonjs/contexts/root.js +94 -1
  22. package/lib/commonjs/contexts/root.js.map +1 -1
  23. package/lib/module/components/form/input/Editable.js +17 -27
  24. package/lib/module/components/form/input/Editable.js.map +1 -1
  25. package/lib/module/components/form/input/StandaloneInput.js +5 -1
  26. package/lib/module/components/form/input/StandaloneInput.js.map +1 -1
  27. package/lib/module/components/form/input/hooks/useInputStyles.js +2 -1
  28. package/lib/module/components/form/input/hooks/useInputStyles.js.map +1 -1
  29. package/lib/module/components/form/input/multipleSelect/index.js +19 -10
  30. package/lib/module/components/form/input/multipleSelect/index.js.map +1 -1
  31. package/lib/module/components/form/input/number/index.js +8 -4
  32. package/lib/module/components/form/input/number/index.js.map +1 -1
  33. package/lib/module/components/form/input/select/index.js +15 -5
  34. package/lib/module/components/form/input/select/index.js.map +1 -1
  35. package/lib/module/components/form/input/text/AutoResizeTextarea.js +48 -0
  36. package/lib/module/components/form/input/text/AutoResizeTextarea.js.map +1 -0
  37. package/lib/module/components/form/input/text/index.js +22 -11
  38. package/lib/module/components/form/input/text/index.js.map +1 -1
  39. package/lib/module/components/form/input/text/textarea.js +13 -22
  40. package/lib/module/components/form/input/text/textarea.js.map +1 -1
  41. package/lib/module/components/form/input/text/useWebAutoResize.js +59 -0
  42. package/lib/module/components/form/input/text/useWebAutoResize.js.map +1 -0
  43. package/lib/module/contexts/root.js +95 -2
  44. package/lib/module/contexts/root.js.map +1 -1
  45. package/lib/typescript/components/form/input/Editable.d.ts.map +1 -1
  46. package/lib/typescript/components/form/input/StandaloneInput.d.ts +8 -6
  47. package/lib/typescript/components/form/input/StandaloneInput.d.ts.map +1 -1
  48. package/lib/typescript/components/form/input/multipleSelect/index.d.ts.map +1 -1
  49. package/lib/typescript/components/form/input/number/index.d.ts.map +1 -1
  50. package/lib/typescript/components/form/input/select/index.d.ts.map +1 -1
  51. package/lib/typescript/components/form/input/text/AutoResizeTextarea.d.ts +4 -0
  52. package/lib/typescript/components/form/input/text/AutoResizeTextarea.d.ts.map +1 -0
  53. package/lib/typescript/components/form/input/text/index.d.ts.map +1 -1
  54. package/lib/typescript/components/form/input/text/textarea.d.ts.map +1 -1
  55. package/lib/typescript/components/form/input/text/useWebAutoResize.d.ts +8 -0
  56. package/lib/typescript/components/form/input/text/useWebAutoResize.d.ts.map +1 -0
  57. package/lib/typescript/components/form/types.d.ts +2 -2
  58. package/lib/typescript/components/form/types.d.ts.map +1 -1
  59. package/lib/typescript/contexts/root.d.ts +4 -1
  60. package/lib/typescript/contexts/root.d.ts.map +1 -1
  61. package/package.json +3 -3
  62. package/src/components/form/input/Editable.tsx +16 -33
  63. package/src/components/form/input/StandaloneInput.tsx +29 -7
  64. package/src/components/form/input/hooks/useInputStyles.ts +1 -1
  65. package/src/components/form/input/multipleSelect/index.tsx +22 -19
  66. package/src/components/form/input/number/index.tsx +20 -4
  67. package/src/components/form/input/select/index.tsx +16 -4
  68. package/src/components/form/input/text/AutoResizeTextarea.tsx +45 -0
  69. package/src/components/form/input/text/index.tsx +34 -17
  70. package/src/components/form/input/text/textarea.tsx +7 -21
  71. package/src/components/form/input/text/useWebAutoResize.tsx +72 -0
  72. package/src/components/form/types.ts +6 -2
  73. package/src/contexts/root.tsx +101 -3
@@ -1,15 +1,106 @@
1
1
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
- import { ChempoProvider } from '@chem-po/react';
2
+ import { ChempoProvider, useTheme } from '@chem-po/react';
3
3
  import React, { useMemo } from 'react';
4
4
  import { NotifierWrapper } from 'react-native-notifier';
5
+ import { configureFonts, PaperProvider } from 'react-native-paper';
5
6
  import { en, registerTranslation } from 'react-native-paper-dates';
6
7
  import { nativeToast } from '../constants/toast';
7
8
  import { useThemeState } from '../hooks/useThemeState';
8
9
  import { initializeScreen } from '../store/useScreen';
9
10
  registerTranslation('en', en);
11
+ const createPaperTheme = (theme, fonts, colorMode) => {
12
+ const {
13
+ colors
14
+ } = theme;
15
+ return {
16
+ dark: colorMode === 'dark',
17
+ colors: {
18
+ primary: colors.accent[200],
19
+ onPrimary: colors.text[900],
20
+ primaryContainer: colors.accent[500],
21
+ onPrimaryContainer: colors.text[300],
22
+ secondary: colors.background[150],
23
+ onSecondary: colors.text[100],
24
+ secondaryContainer: colors.background[50],
25
+ onSecondaryContainer: colors.text[150],
26
+ tertiary: colors.accent[600],
27
+ onTertiary: colors.text[50],
28
+ tertiaryContainer: colors.accent[300],
29
+ onTertiaryContainer: colors.text[700],
30
+ error: colors.error[500],
31
+ onError: colors.text[50],
32
+ errorContainer: colors.error[100],
33
+ onErrorContainer: colors.error[900],
34
+ background: colors.background[50],
35
+ onBackground: colors.text[100],
36
+ surface: colors.background[100],
37
+ onSurface: colors.text[100],
38
+ surfaceVariant: colors.background[200],
39
+ onSurfaceVariant: colors.text[250],
40
+ outline: colors.text[500],
41
+ outlineVariant: colors.accent[300],
42
+ surfaceDisabled: colors.background[200],
43
+ onSurfaceDisabled: colors.text[400],
44
+ backdrop: '#000000aa',
45
+ // 60% opacity
46
+
47
+ inverseSurface: colors.background[900],
48
+ inverseOnSurface: colors.text[50],
49
+ inversePrimary: colors.accent[200],
50
+ shadow: '#00000099',
51
+ scrim: '#00000099',
52
+ // Semi-transparent dark overlay
53
+
54
+ elevation: {
55
+ level0: 'transparent',
56
+ level1: colors.background[100],
57
+ level2: colors.background[200],
58
+ level3: colors.background[300],
59
+ level4: colors.background[400],
60
+ level5: colors.background[500]
61
+ }
62
+ },
63
+ roundness: 4,
64
+ animation: {
65
+ scale: 1.0
66
+ },
67
+ fonts: configureFonts({
68
+ config: {
69
+ ...fonts,
70
+ bodyLarge: {
71
+ fontSize: 18,
72
+ ...(fonts === null || fonts === void 0 ? void 0 : fonts.bodyLarge)
73
+ },
74
+ bodyMedium: {
75
+ fontSize: 17,
76
+ ...(fonts === null || fonts === void 0 ? void 0 : fonts.bodyMedium)
77
+ },
78
+ bodySmall: {
79
+ fontSize: 15,
80
+ ...(fonts === null || fonts === void 0 ? void 0 : fonts.bodySmall)
81
+ }
82
+ }
83
+ })
84
+ };
85
+ };
86
+ const ChempoPaperProvider = ({
87
+ children,
88
+ fonts
89
+ }) => {
90
+ const {
91
+ theme,
92
+ colorMode
93
+ } = useTheme();
94
+ const paperTheme = useMemo(() => createPaperTheme(theme, fonts, colorMode), [theme, fonts, colorMode]);
95
+ return /*#__PURE__*/React.createElement(PaperProvider, {
96
+ theme: paperTheme
97
+ }, children);
98
+ };
10
99
  export const ChempoNativeProvider = ({
11
100
  theme: themeProp,
12
101
  initialColorMode,
102
+ children,
103
+ fonts,
13
104
  ...props
14
105
  }) => {
15
106
  const useThemeProps = useMemo(() => ({
@@ -21,6 +112,8 @@ export const ChempoNativeProvider = ({
21
112
  toast: nativeToast,
22
113
  theme: theme,
23
114
  initializeScreen: initializeScreen
24
- }, props)));
115
+ }, props), /*#__PURE__*/React.createElement(ChempoPaperProvider, {
116
+ fonts: fonts
117
+ }, children)));
25
118
  };
26
119
  //# sourceMappingURL=root.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["ChempoProvider","React","useMemo","NotifierWrapper","en","registerTranslation","nativeToast","useThemeState","initializeScreen","ChempoNativeProvider","theme","themeProp","initialColorMode","props","useThemeProps","createElement","_extends","toast"],"sourceRoot":"..\\..\\..\\src","sources":["contexts/root.tsx"],"mappings":";AACA,SAAsBA,cAAc,QAAQ,gBAAgB;AAC5D,OAAOC,KAAK,IAAuBC,OAAO,QAAQ,OAAO;AACzD,SAASC,eAAe,QAAQ,uBAAuB;AACvD,SAASC,EAAE,EAAEC,mBAAmB,QAAQ,0BAA0B;AAClE,SAASC,WAAW,QAAQ,oBAAoB;AAChD,SAASC,aAAa,QAAQ,wBAAwB;AACtD,SAASC,gBAAgB,QAAQ,oBAAoB;AAErDH,mBAAmB,CAAC,IAAI,EAAED,EAAE,CAAC;AAO7B,OAAO,MAAMK,oBAAoB,GAAGA,CAElC;EACAC,KAAK,EAAEC,SAAS;EAChBC,gBAAgB;EAChB,GAAGC;AACsC,CAAC,KAAK;EAC/C,MAAMC,aAAa,GAAGZ,OAAO,CAC3B,OAAO;IAAEQ,KAAK,EAAEC,SAAS;IAAEC;EAAiB,CAAC,CAAC,EAC9C,CAACD,SAAS,EAAEC,gBAAgB,CAC9B,CAAC;EACD,MAAMF,KAAK,GAAGH,aAAa,CAACO,aAAa,CAAC;EAC1C,oBACEb,KAAA,CAAAc,aAAA,CAACZ,eAAe,qBACdF,KAAA,CAAAc,aAAA,CAACf,cAAc,EAAAgB,QAAA;IACbC,KAAK,EAAEX,WAAY;IACnBI,KAAK,EAAEA,KAAM;IACbF,gBAAgB,EAAEA;EAAiB,GAC/BK,KAAK,CACV,CACc,CAAC;AAEtB,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["ChempoProvider","useTheme","React","useMemo","NotifierWrapper","configureFonts","PaperProvider","en","registerTranslation","nativeToast","useThemeState","initializeScreen","createPaperTheme","theme","fonts","colorMode","colors","dark","primary","accent","onPrimary","text","primaryContainer","onPrimaryContainer","secondary","background","onSecondary","secondaryContainer","onSecondaryContainer","tertiary","onTertiary","tertiaryContainer","onTertiaryContainer","error","onError","errorContainer","onErrorContainer","onBackground","surface","onSurface","surfaceVariant","onSurfaceVariant","outline","outlineVariant","surfaceDisabled","onSurfaceDisabled","backdrop","inverseSurface","inverseOnSurface","inversePrimary","shadow","scrim","elevation","level0","level1","level2","level3","level4","level5","roundness","animation","scale","config","bodyLarge","fontSize","bodyMedium","bodySmall","ChempoPaperProvider","children","paperTheme","createElement","ChempoNativeProvider","themeProp","initialColorMode","props","useThemeProps","_extends","toast"],"sourceRoot":"..\\..\\..\\src","sources":["contexts/root.tsx"],"mappings":";AACA,SAAsBA,cAAc,EAAEC,QAAQ,QAAQ,gBAAgB;AACtE,OAAOC,KAAK,IAAuBC,OAAO,QAAQ,OAAO;AACzD,SAASC,eAAe,QAAQ,uBAAuB;AACvD,SAASC,cAAc,EAAEC,aAAa,QAAqC,oBAAoB;AAC/F,SAASC,EAAE,EAAEC,mBAAmB,QAAQ,0BAA0B;AAElE,SAASC,WAAW,QAAQ,oBAAoB;AAChD,SAASC,aAAa,QAAQ,wBAAwB;AACtD,SAASC,gBAAgB,QAAQ,oBAAoB;AAErDH,mBAAmB,CAAC,IAAI,EAAED,EAAE,CAAC;AAS7B,MAAMK,gBAAgB,GAAGA,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,QAAA;IACbC,KAAK,EAAEpE,WAAY;IACnBI,KAAK,EAAEA,KAAM;IACbF,gBAAgB,EAAEA;EAAiB,GAC/B+D,KAAK,gBACTxE,KAAA,CAAAoE,aAAA,CAACH,mBAAmB;IAACrD,KAAK,EAAEA;EAAM,GAAEsD,QAA8B,CACpD,CACD,CAAC;AAEtB,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"Editable.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/input/Editable.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,KAAK,EAKN,MAAM,gBAAgB,CAAA;AAEvB,OAAO,KAA0C,MAAM,OAAO,CAAA;AAC9D,OAAO,EAAsC,SAAS,EAAE,MAAM,cAAc,CAAA;AAQ5E,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,KAAK,EAAE,2GAUvC,aAAa,CAAC,SAAS,EAAE,CAAC,CAAC,sBAsL7B,CAAA"}
1
+ {"version":3,"file":"Editable.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/input/Editable.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,KAAK,EAKN,MAAM,gBAAgB,CAAA;AAEvB,OAAO,KAA0C,MAAM,OAAO,CAAA;AAC9D,OAAO,EAAsC,SAAS,EAAE,MAAM,cAAc,CAAA;AAM5E,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,KAAK,EAAE,2GAUvC,aAAa,CAAC,SAAS,EAAE,CAAC,CAAC,sBAuK7B,CAAA"}
@@ -1,17 +1,19 @@
1
- import { InputRef } from '@chem-po/core';
1
+ import { InputRef, InputSize } from '@chem-po/core';
2
2
  import { Field } from '@chem-po/react';
3
3
  import React from 'react';
4
- import { StyleProp, ViewStyle } from 'react-native';
5
- interface StandaloneInputProps {
4
+ import { StyleProp, TextStyle, ViewStyle } from 'react-native';
5
+ interface StandaloneInputProps<T extends Field, ContainerStyle extends ViewStyle = ViewStyle, InputStyle extends TextStyle = TextStyle> {
6
6
  onChange: (v?: any) => void;
7
7
  value?: any;
8
- field: Field;
8
+ field: T;
9
9
  onBlur?: () => void;
10
10
  onFocus?: () => void;
11
11
  theme?: 'basic' | 'detailed';
12
12
  inEditable?: boolean;
13
- style?: StyleProp<ViewStyle>;
13
+ style?: StyleProp<ContainerStyle>;
14
+ inputStyle?: StyleProp<InputStyle>;
15
+ size?: InputSize;
14
16
  }
15
- export declare const StandaloneInput: React.ForwardRefExoticComponent<StandaloneInputProps & React.RefAttributes<InputRef>>;
17
+ export declare const StandaloneInput: React.ForwardRefExoticComponent<StandaloneInputProps<Field, ViewStyle, TextStyle> & React.RefAttributes<InputRef>>;
16
18
  export {};
17
19
  //# sourceMappingURL=StandaloneInput.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"StandaloneInput.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/input/StandaloneInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,KAAK,EAAsB,MAAM,gBAAgB,CAAA;AAC1D,OAAO,KAAmC,MAAM,OAAO,CAAA;AACvD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAGnD,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAA;IAC3B,KAAK,CAAC,EAAE,GAAG,CAAA;IACX,KAAK,EAAE,KAAK,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,KAAK,CAAC,EAAE,OAAO,GAAG,UAAU,CAAA;IAC5B,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;CAC7B;AAoBD,eAAO,MAAM,eAAe,uFAAkC,CAAA"}
1
+ {"version":3,"file":"StandaloneInput.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/input/StandaloneInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,EAAE,KAAK,EAAsB,MAAM,gBAAgB,CAAA;AAC1D,OAAO,KAAmC,MAAM,OAAO,CAAA;AACvD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAG9D,UAAU,oBAAoB,CAC5B,CAAC,SAAS,KAAK,EACf,cAAc,SAAS,SAAS,GAAG,SAAS,EAC5C,UAAU,SAAS,SAAS,GAAG,SAAS;IAExC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,IAAI,CAAA;IAC3B,KAAK,CAAC,EAAE,GAAG,CAAA;IACX,KAAK,EAAE,CAAC,CAAA;IACR,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,KAAK,CAAC,EAAE,OAAO,GAAG,UAAU,CAAA;IAC5B,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,KAAK,CAAC,EAAE,SAAS,CAAC,cAAc,CAAC,CAAA;IACjC,UAAU,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,CAAA;IAClC,IAAI,CAAC,EAAE,SAAS,CAAA;CACjB;AAoCD,eAAO,MAAM,eAAe,oHAAkC,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,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
+ {"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,sBAQnE,CAAA;AAwID,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;kCAiD9F,CAAA;AAmBD,eAAO,MAAM,uBAAuB,kGAEnC,CAAA"}
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;kCAiE9F,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,KAAgE,MAAM,OAAO,CAAA;AAIpF,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAiHxC,eAAO,MAAM,eAAe,0FAAkC,CAAA"}
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,EAMZ,MAAM,gBAAgB,CAAA;AAEvB,OAAO,KAAgE,MAAM,OAAO,CAAA;AAIpF,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AA4HxC,eAAO,MAAM,eAAe,0FAAkC,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { TextInput, TextInputProps } from 'react-native';
2
+ import React from 'react';
3
+ export declare const AutoResizeTextarea: React.ForwardRefExoticComponent<TextInputProps & React.RefAttributes<TextInput>>;
4
+ //# sourceMappingURL=AutoResizeTextarea.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AutoResizeTextarea.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/input/text/AutoResizeTextarea.tsx"],"names":[],"mappings":"AACA,OAAO,EAAc,SAAS,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAIpE,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,eAAO,MAAM,kBAAkB,kFAuB9B,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,wFA8CzB,CAAA"}
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,wFA+DzB,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;AAGxC,eAAO,MAAM,iBAAiB,wFAmC7B,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;AAIxC,eAAO,MAAM,iBAAiB,wFAiC7B,CAAA"}
@@ -0,0 +1,8 @@
1
+ import { StyleProp, TextStyle } from 'react-native';
2
+ export declare const useWebAutoResize: (onChangeText: ((e: string) => void) | undefined, style: StyleProp<TextStyle> | undefined) => {
3
+ getWebTextHeight: (text: string, spanRef: React.RefObject<HTMLSpanElement | null>) => number | null;
4
+ handleChange: ((e: string) => void) | undefined;
5
+ height: number;
6
+ setHeight: import("react").Dispatch<import("react").SetStateAction<number>>;
7
+ };
8
+ //# sourceMappingURL=useWebAutoResize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useWebAutoResize.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/input/text/useWebAutoResize.tsx"],"names":[],"mappings":"AACA,OAAO,EAAY,SAAS,EAAc,SAAS,EAAE,MAAM,cAAc,CAAA;AAmCzE,eAAO,MAAM,gBAAgB,GAC3B,cAAc,CAAC,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,EAC/C,OAAO,SAAS,CAAC,SAAS,CAAC,GAAG,SAAS;6BAlCT,MAAM,WAAW,KAAK,CAAC,SAAS,CAAC,eAAe,GAAG,IAAI,CAAC;uBAiCnE,MAAM,KAAK,IAAI;;;CAkCnC,CAAA"}
@@ -1,4 +1,4 @@
1
1
  import { BaseFieldProps, Field } from '@chem-po/react';
2
- import { StyleProp } from 'react-native';
3
- export type FieldProps<T extends Field> = BaseFieldProps<StyleProp<any>, T>;
2
+ import { StyleProp, TextStyle, ViewStyle } from 'react-native';
3
+ export type FieldProps<T extends Field, ContainerStyle extends ViewStyle = ViewStyle, InputStyle extends TextStyle = TextStyle> = BaseFieldProps<StyleProp<ContainerStyle>, StyleProp<InputStyle>, T>;
4
4
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/form/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,KAAK,IAAI,cAAc,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/form/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AACtD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE9D,MAAM,MAAM,UAAU,CACpB,CAAC,SAAS,KAAK,EACf,cAAc,SAAS,SAAS,GAAG,SAAS,EAC5C,UAAU,SAAS,SAAS,GAAG,SAAS,IACtC,cAAc,CAAC,SAAS,CAAC,cAAc,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,CAAA"}
@@ -1,9 +1,12 @@
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
+ import { MD3Type, MD3TypescaleKey } from 'react-native-paper/lib/typescript/types';
5
+ export type FontConfig = Partial<Record<MD3TypescaleKey, Partial<MD3Type>>>;
4
6
  export interface ChempoNativeProviderProps<BackendAdapter extends BackendAdapterInterface> extends PropsWithChildren<Pick<ChempoProps<BackendAdapter>, 'backendAdapter' | 'assets'>> {
5
7
  theme?: Theme;
8
+ fonts?: FontConfig;
6
9
  initialColorMode?: ColorMode;
7
10
  }
8
- export declare const ChempoNativeProvider: <BackendAdapter extends BackendAdapterInterface<any, any, any, any, any, any>>({ theme: themeProp, initialColorMode, ...props }: ChempoNativeProviderProps<BackendAdapter>) => React.JSX.Element;
11
+ export declare const ChempoNativeProvider: <BackendAdapter extends BackendAdapterInterface<any, any, any, any, any, any>>({ theme: themeProp, initialColorMode, children, fonts, ...props }: ChempoNativeProviderProps<BackendAdapter>) => React.JSX.Element;
9
12
  //# 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;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"}
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,EAA4B,MAAM,gBAAgB,CAAA;AACtE,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAW,MAAM,OAAO,CAAA;AAIzD,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAA;AAOlF,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;AAC3E,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,KAAK,CAAC,EAAE,UAAU,CAAA;IAClB,gBAAgB,CAAC,EAAE,SAAS,CAAA;CAC7B;AA4FD,eAAO,MAAM,oBAAoB,GAC/B,cAAc,SAAS,uBAAuB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAC5E,mEAMC,yBAAyB,CAAC,cAAc,CAAC,sBAiB3C,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.27",
5
+ "version": "0.0.29",
6
6
  "main": "lib/commonjs/index.js",
7
7
  "types": "lib/typescript/index.d.ts",
8
8
  "source": "src/index.ts",
@@ -51,8 +51,8 @@
51
51
  "react-native-paper-dates": "^0.22.42",
52
52
  "react-native-svg": "15.11.2",
53
53
  "zustand": "^4.3.3",
54
- "@chem-po/core": "0.0.27",
55
- "@chem-po/react": "0.0.27"
54
+ "@chem-po/core": "0.0.29",
55
+ "@chem-po/react": "0.0.29"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@babel/core": "^7.26.0",
@@ -13,8 +13,6 @@ import { LoadingOverlay } from '../../loading/LoadingOverlay'
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'
18
16
 
19
17
  export const Editable = <T extends Field>({
20
18
  value: initValue,
@@ -89,17 +87,8 @@ export const Editable = <T extends Field>({
89
87
  }, [isEditing, inputRef])
90
88
 
91
89
  const iconColor = useIconColor()
92
- const { clearButtonSize } = useInputStyles(true, field.size, size)
93
90
  const editingBorderColor = useColorModeValue('#00000055', '#ffffff55')
94
- const submitColor = useThemeValue('colors.accent.200')
95
-
96
- const needsClearButton = useMemo(() => {
97
- if (!field.optional) return false
98
- switch (field._type) {
99
- case 'select':
100
- return true
101
- }
102
- }, [field])
91
+ const submitColor = useThemeValue('colors.accent.600')
103
92
 
104
93
  const handleBlur = useCallback(() => {
105
94
  switch (field._type) {
@@ -117,7 +106,7 @@ export const Editable = <T extends Field>({
117
106
  const editableField = useMemo(
118
107
  () => ({
119
108
  ...field,
120
- optional: false,
109
+ // optional: false,
121
110
  }),
122
111
  [field],
123
112
  )
@@ -147,42 +136,36 @@ export const Editable = <T extends Field>({
147
136
  inEditable
148
137
  field={editableField}
149
138
  style={style}
139
+ size={size}
150
140
  onChange={shouldSubmitOnChange ? v => submitValue(v) : setValue}
151
141
  onBlur={handleBlur}
152
142
  />
153
143
  ) : (
154
- <FieldView noLabel style={style} field={field} value={value} />
144
+ <FieldView noLabel style={style} size={size} field={field} value={value} />
155
145
  )}
156
146
  </View>
157
147
  {!alwaysEditing && (
158
148
  <View style={styles.buttonsContainer}>
159
- {needsClearButton ? (
160
- <InputClearButton
161
- size={clearButtonSize}
149
+ {isEditing ? null : (
150
+ <TouchableOpacity
151
+ style={styles.editButton}
162
152
  onPress={() => {
163
- submitValue(null)
153
+ handleEditOpen()
164
154
  }}
165
- isActive={!!value}
166
- />
167
- ) : null}
168
- {noCloseButton && isEditing ? null : (
155
+ onPressIn={() => setEditHovered(true)}
156
+ onPressOut={() => setEditHovered(false)}>
157
+ <Ionicons name="create-outline" size={20} color={iconColor} />
158
+ </TouchableOpacity>
159
+ )}
160
+ {noCloseButton || !isEditing ? null : (
169
161
  <TouchableOpacity
170
162
  style={styles.editButton}
171
163
  onPress={() => {
172
- if (isEditing) {
173
- setValue(value)
174
- handleEditClose()
175
- } else {
176
- handleEditOpen()
177
- }
164
+ handleEditClose()
178
165
  }}
179
166
  onPressIn={() => setEditHovered(true)}
180
167
  onPressOut={() => setEditHovered(false)}>
181
- <Ionicons
182
- name={isEditing ? 'close' : 'create-outline'}
183
- size={20}
184
- color={iconColor}
185
- />
168
+ <Ionicons name="close" size={20} color={iconColor} />
186
169
  </TouchableOpacity>
187
170
  )}
188
171
  <View
@@ -1,22 +1,42 @@
1
- import { InputRef } from '@chem-po/core'
1
+ import { InputRef, InputSize } from '@chem-po/core'
2
2
  import { Field, useStandaloneInput } from '@chem-po/react'
3
3
  import React, { ForwardedRef, forwardRef } from 'react'
4
- import { StyleProp, ViewStyle } from 'react-native'
4
+ import { StyleProp, TextStyle, ViewStyle } from 'react-native'
5
5
  import { Input } from './input'
6
6
 
7
- interface StandaloneInputProps {
7
+ interface StandaloneInputProps<
8
+ T extends Field,
9
+ ContainerStyle extends ViewStyle = ViewStyle,
10
+ InputStyle extends TextStyle = TextStyle,
11
+ > {
8
12
  onChange: (v?: any) => void
9
13
  value?: any
10
- field: Field
14
+ field: T
11
15
  onBlur?: () => void
12
16
  onFocus?: () => void
13
17
  theme?: 'basic' | 'detailed'
14
18
  inEditable?: boolean
15
- style?: StyleProp<ViewStyle>
19
+ style?: StyleProp<ContainerStyle>
20
+ inputStyle?: StyleProp<InputStyle>
21
+ size?: InputSize
16
22
  }
17
23
 
18
- const StandaloneInputBase = (
19
- { onChange, value, field, onBlur, inEditable, onFocus, style }: StandaloneInputProps,
24
+ const StandaloneInputBase = <
25
+ T extends Field,
26
+ ContainerStyle extends ViewStyle = ViewStyle,
27
+ InputStyle extends TextStyle = TextStyle,
28
+ >(
29
+ {
30
+ onChange,
31
+ value,
32
+ field,
33
+ onBlur,
34
+ inEditable,
35
+ onFocus,
36
+ style,
37
+ size,
38
+ inputStyle,
39
+ }: StandaloneInputProps<T, ContainerStyle, InputStyle>,
20
40
  ref: ForwardedRef<InputRef>,
21
41
  ) => {
22
42
  const { inputProps, meta } = useStandaloneInput(field, value, onChange, onFocus, onBlur)
@@ -28,6 +48,8 @@ const StandaloneInputBase = (
28
48
  inEditable={inEditable}
29
49
  style={style}
30
50
  input={inputProps}
51
+ inputStyle={inputStyle}
52
+ formSize={size}
31
53
  meta={meta}
32
54
  />
33
55
  )
@@ -110,7 +110,7 @@ export const useInputStyles = (
110
110
  const textColor = useTextColor()
111
111
  const usedSize = size ?? formSize
112
112
  return {
113
- text: { ...inputTextSizeMap[usedSize], color: textColor },
113
+ text: { ...inputTextSizeMap[usedSize], color: textColor, outlineWidth: 0 },
114
114
  container: {
115
115
  ...inputStyles.input,
116
116
  ...(inEditable ? editableInputSizeMap[usedSize] : inputSizeMap[usedSize]),
@@ -30,7 +30,12 @@ export const SelectedOptionContainer = ({
30
30
  style,
31
31
  }: PropsWithChildren<{ key?: string; style?: StyleProp<ViewStyle> }>) => {
32
32
  const borderColor = useBorderColor()
33
- return <View style={[styles.selectedOption, { borderColor }, style]}>{children}</View>
33
+ const bg = useBackgroundColor(100)
34
+ return (
35
+ <View style={[styles.selectedOption, { borderColor, backgroundColor: bg }, style]}>
36
+ {children}
37
+ </View>
38
+ )
34
39
  }
35
40
 
36
41
  const BaseMultipleSelectComponent = <T extends MultipleSelectField>(
@@ -55,7 +60,8 @@ const BaseMultipleSelectComponent = <T extends MultipleSelectField>(
55
60
  const textColor = useTextColor()
56
61
  const placeholderColor = usePlaceholderColor()
57
62
  const menuBg = useBackgroundColor(100)
58
- const selectedOptionBg = useColorModeValue('#ffffff77', '#ffffff15')
63
+ const inputBg = useBackgroundColor(50)
64
+ const selectedOptionBg = useColorModeValue('#ffffff55', '#ffffff22')
59
65
  const borderColor = useBorderColor()
60
66
 
61
67
  useImperativeHandle(ref, () => ({
@@ -102,8 +108,8 @@ const BaseMultipleSelectComponent = <T extends MultipleSelectField>(
102
108
  ref={inputRef}
103
109
  style={[inputStyles, { borderColor }]}
104
110
  placeholderStyle={[text, { color: value?.length ? textColor : placeholderColor }]}
105
- containerStyle={{ backgroundColor: menuBg }}
106
- inputSearchStyle={[styles.inputSearch, text]}
111
+ containerStyle={{ backgroundColor: menuBg, boxShadow: `0 0 10px ${borderColor}` }}
112
+ inputSearchStyle={[styles.inputSearch, text, { backgroundColor: inputBg, borderWidth: 0 }]}
107
113
  iconStyle={styles.iconStyle}
108
114
  data={options}
109
115
  search={searchable}
@@ -117,18 +123,19 @@ const BaseMultipleSelectComponent = <T extends MultipleSelectField>(
117
123
  onChange={updated => {
118
124
  onChange(updated)
119
125
  }}
120
- activeColor={selectedOptionBg}
121
126
  onFocus={onFocus}
122
127
  onBlur={onBlur}
123
128
  renderItem={(item, selected) => (
124
- <View style={{ backgroundColor: selected ? selectedOptionBg : menuBg }}>
125
- <RenderOptionText
126
- value={item.value}
127
- option={item}
128
- colorMode={colorMode}
129
- isSelected={!!selected}
130
- size={size}
131
- />
129
+ <View style={{ backgroundColor: menuBg }}>
130
+ <View style={{ backgroundColor: selected ? selectedOptionBg : 'transparent' }}>
131
+ <RenderOptionText
132
+ value={item.value}
133
+ option={item}
134
+ colorMode={colorMode}
135
+ isSelected={!!selected}
136
+ size={size}
137
+ />
138
+ </View>
132
139
  </View>
133
140
  )}
134
141
  renderSelectedItem={item => (
@@ -140,11 +147,7 @@ const BaseMultipleSelectComponent = <T extends MultipleSelectField>(
140
147
  isSelected
141
148
  size={size}
142
149
  />
143
- <View
144
- style={[
145
- styles.optionClearContainer,
146
- { borderColor, backgroundColor: selectedOptionBg },
147
- ]}>
150
+ <View style={[styles.optionClearContainer, { borderColor }]}>
148
151
  <InputClearButton
149
152
  size={clearButtonSize}
150
153
  onPress={() => {
@@ -183,10 +186,10 @@ const styles = StyleSheet.create({
183
186
  height: 20,
184
187
  },
185
188
  inputSearch: {
186
- outlineWidth: 0,
187
189
  paddingVertical: 4,
188
190
  minHeight: 0,
189
191
  height: 'auto',
192
+ outlineWidth: 0,
190
193
  fontSize: 16,
191
194
  },
192
195
  selectedOption: {
@@ -8,10 +8,25 @@ import { useInputImperativeHandle } from '../hooks/useInputImperativeHandle'
8
8
  import { useInputStyles } from '../hooks/useInputStyles'
9
9
 
10
10
  export const NumberComponent = forwardRef<InputRef, FieldProps<NumberField> & { prefix?: string }>(
11
- ({ input: { onChange, value, ...input }, field, prefix, inEditable, style, formSize }, ref) => {
11
+ (
12
+ {
13
+ input: { onChange, value, ...input },
14
+ inputStyle,
15
+ field,
16
+ prefix,
17
+ inEditable,
18
+ style,
19
+ formSize,
20
+ },
21
+ ref,
22
+ ) => {
12
23
  const { type, defaultValue, placeholder, size } = field
13
24
  const color = useTextColor()
14
- const { container: inputStyles } = useInputStyles(inEditable, size, formSize)
25
+ const { container: conatinerStyles, text: inputStyles } = useInputStyles(
26
+ inEditable,
27
+ size,
28
+ formSize,
29
+ )
15
30
  const inputRef = useInputImperativeHandle(ref)
16
31
  const [endsWith, setEndsWith] = useState('')
17
32
  const displayed = typeof value === 'number' && !Number.isNaN(value) ? `${value}${endsWith}` : ''
@@ -22,6 +37,7 @@ export const NumberComponent = forwardRef<InputRef, FieldProps<NumberField> & {
22
37
  return (
23
38
  <InputSlider
24
39
  label={placeholder}
40
+ style={style}
25
41
  onValueChange={onChange}
26
42
  value={value}
27
43
  minimumValue={defaultValue}
@@ -30,11 +46,11 @@ export const NumberComponent = forwardRef<InputRef, FieldProps<NumberField> & {
30
46
  }
31
47
 
32
48
  return (
33
- <View style={styles.container}>
49
+ <View style={[styles.container, conatinerStyles, style]}>
34
50
  {prefix && <Text style={styles.prefix}>{prefix}</Text>}
35
51
  <TextInput
36
52
  ref={inputRef}
37
- style={[inputStyles, { color }, style]}
53
+ style={[inputStyles, { color, outlineWidth: 0 }, inputStyle]}
38
54
  placeholder={field.placeholder}
39
55
  placeholderTextColor={placeholderColor}
40
56
  keyboardType="numeric"