@codeleap/mobile 4.3.9 → 5.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/dist/components/Autocomplete/index.js.map +1 -1
  2. package/dist/components/Autocomplete/types.d.ts +9 -10
  3. package/dist/components/Backdrop/index.js.map +1 -1
  4. package/dist/components/Checkbox/index.js +13 -9
  5. package/dist/components/Checkbox/index.js.map +1 -1
  6. package/dist/components/Checkbox/types.d.ts +5 -2
  7. package/dist/components/DatePickerModal/index.js +18 -11
  8. package/dist/components/DatePickerModal/index.js.map +1 -1
  9. package/dist/components/DatePickerModal/types.d.ts +12 -9
  10. package/dist/components/FileInput/types.d.ts +3 -4
  11. package/dist/components/Grid/index.js.map +1 -1
  12. package/dist/components/Image/types.d.ts +2 -5
  13. package/dist/components/InputBase/index.d.ts +2 -6
  14. package/dist/components/InputBase/index.js +9 -5
  15. package/dist/components/InputBase/index.js.map +1 -1
  16. package/dist/components/InputBase/types.d.ts +2 -0
  17. package/dist/components/InputBase/useInputBase.d.ts +24 -0
  18. package/dist/components/InputBase/useInputBase.js +46 -0
  19. package/dist/components/InputBase/useInputBase.js.map +1 -0
  20. package/dist/components/InputBase/useInputBasePartialStyles.d.ts +2 -0
  21. package/dist/components/InputBase/useInputBasePartialStyles.js +30 -0
  22. package/dist/components/InputBase/useInputBasePartialStyles.js.map +1 -0
  23. package/dist/components/InputBase/utils.js +16 -16
  24. package/dist/components/InputBase/utils.js.map +1 -1
  25. package/dist/components/List/index.js +1 -1
  26. package/dist/components/List/index.js.map +1 -1
  27. package/dist/components/Modal/index.js +4 -14
  28. package/dist/components/Modal/index.js.map +1 -1
  29. package/dist/components/NumberIncrement/index.js +21 -132
  30. package/dist/components/NumberIncrement/index.js.map +1 -1
  31. package/dist/components/NumberIncrement/types.d.ts +7 -5
  32. package/dist/components/NumberIncrement/useNumberIncrement.d.ts +55 -0
  33. package/dist/components/NumberIncrement/useNumberIncrement.js +107 -0
  34. package/dist/components/NumberIncrement/useNumberIncrement.js.map +1 -0
  35. package/dist/components/RadioInput/index.d.ts +1 -1
  36. package/dist/components/RadioInput/index.js +20 -41
  37. package/dist/components/RadioInput/index.js.map +1 -1
  38. package/dist/components/RadioInput/types.d.ts +11 -9
  39. package/dist/components/Scroll/index.js +25 -28
  40. package/dist/components/Scroll/index.js.map +1 -1
  41. package/dist/components/Scroll/types.d.ts +4 -4
  42. package/dist/components/Sections/index.js +1 -1
  43. package/dist/components/Sections/index.js.map +1 -1
  44. package/dist/components/SegmentedControl/index.js +6 -4
  45. package/dist/components/SegmentedControl/index.js.map +1 -1
  46. package/dist/components/SegmentedControl/types.d.ts +4 -3
  47. package/dist/components/Select/index.js +10 -6
  48. package/dist/components/Select/index.js.map +1 -1
  49. package/dist/components/Select/types.d.ts +19 -18
  50. package/dist/components/Slider/index.js +18 -57
  51. package/dist/components/Slider/index.js.map +1 -1
  52. package/dist/components/Slider/types.d.ts +7 -5
  53. package/dist/components/SortablePhotos/index.js +17 -18
  54. package/dist/components/SortablePhotos/index.js.map +1 -1
  55. package/dist/components/SortablePhotos/types.d.ts +5 -15
  56. package/dist/components/SortablePhotos/useSortablePhotos.d.ts +11 -8
  57. package/dist/components/SortablePhotos/useSortablePhotos.js +18 -11
  58. package/dist/components/SortablePhotos/useSortablePhotos.js.map +1 -1
  59. package/dist/components/Switch/index.js +13 -9
  60. package/dist/components/Switch/index.js.map +1 -1
  61. package/dist/components/Switch/types.d.ts +5 -2
  62. package/dist/components/TextInput/index.js +26 -70
  63. package/dist/components/TextInput/index.js.map +1 -1
  64. package/dist/components/TextInput/types.d.ts +8 -6
  65. package/dist/components/TextInput/useTextInput.d.ts +54 -0
  66. package/dist/components/TextInput/useTextInput.js +59 -0
  67. package/dist/components/TextInput/useTextInput.js.map +1 -0
  68. package/dist/components/Touchable/index.js +4 -3
  69. package/dist/components/Touchable/index.js.map +1 -1
  70. package/dist/components/View/index.d.ts +7 -12
  71. package/dist/components/View/index.js +9 -7
  72. package/dist/components/View/index.js.map +1 -1
  73. package/dist/components/View/types.d.ts +6 -6
  74. package/dist/components/components.d.ts +0 -2
  75. package/dist/components/components.js +0 -2
  76. package/dist/components/components.js.map +1 -1
  77. package/dist/hooks/index.d.ts +3 -2
  78. package/dist/hooks/index.js +3 -10
  79. package/dist/hooks/index.js.map +1 -1
  80. package/dist/hooks/useKeyboardController.d.ts +6 -0
  81. package/dist/hooks/useKeyboardController.js +19 -0
  82. package/dist/hooks/useKeyboardController.js.map +1 -0
  83. package/dist/hooks/useStatusBar.d.ts +6 -0
  84. package/dist/hooks/useStatusBar.js +15 -0
  85. package/dist/hooks/useStatusBar.js.map +1 -0
  86. package/dist/hooks/useStylesFor.d.ts +2 -0
  87. package/dist/hooks/useStylesFor.js +11 -0
  88. package/dist/hooks/useStylesFor.js.map +1 -0
  89. package/dist/index.d.ts +2 -1
  90. package/dist/index.js +2 -1
  91. package/dist/index.js.map +1 -1
  92. package/dist/modules/backgroundTimer.d.ts +3 -0
  93. package/dist/modules/backgroundTimer.js +31 -0
  94. package/dist/modules/backgroundTimer.js.map +1 -0
  95. package/dist/modules/index.d.ts +3 -0
  96. package/dist/modules/index.js +3 -0
  97. package/dist/modules/index.js.map +1 -0
  98. package/dist/modules/reactNavigation.d.ts +8 -21
  99. package/dist/modules/reactNavigation.js +38 -12
  100. package/dist/modules/reactNavigation.js.map +1 -1
  101. package/dist/modules/scroll.d.ts +18 -0
  102. package/dist/modules/scroll.js +57 -0
  103. package/dist/modules/scroll.js.map +1 -0
  104. package/dist/modules/types/textInputMask.d.ts +6 -2
  105. package/dist/utils/KeyboardAware/context.js +2 -6
  106. package/dist/utils/KeyboardAware/context.js.map +1 -1
  107. package/dist/utils/KeyboardAware/index.d.ts +0 -1
  108. package/dist/utils/KeyboardAware/index.js +0 -1
  109. package/dist/utils/KeyboardAware/index.js.map +1 -1
  110. package/dist/utils/ModalManager/context.js +2 -2
  111. package/dist/utils/ModalManager/context.js.map +1 -1
  112. package/dist/utils/hooks.js +4 -4
  113. package/dist/utils/hooks.js.map +1 -1
  114. package/dist/utils/locale.d.ts +1 -1
  115. package/dist/utils/locale.js +10 -5
  116. package/dist/utils/locale.js.map +1 -1
  117. package/dist/utils/theme.d.ts +1 -0
  118. package/dist/utils/theme.js +4 -2
  119. package/dist/utils/theme.js.map +1 -1
  120. package/package.json +32 -36
  121. package/package.json.bak +16 -20
  122. package/src/components/Autocomplete/index.tsx +2 -3
  123. package/src/components/Autocomplete/types.ts +9 -10
  124. package/src/components/Backdrop/index.tsx +0 -1
  125. package/src/components/Checkbox/index.tsx +23 -9
  126. package/src/components/Checkbox/types.ts +5 -2
  127. package/src/components/DatePickerModal/index.tsx +27 -18
  128. package/src/components/DatePickerModal/types.ts +12 -9
  129. package/src/components/FileInput/types.ts +3 -4
  130. package/src/components/Grid/index.tsx +3 -3
  131. package/src/components/Image/types.ts +3 -6
  132. package/src/components/InputBase/index.tsx +13 -7
  133. package/src/components/InputBase/types.ts +2 -0
  134. package/src/components/InputBase/useInputBase.ts +60 -0
  135. package/src/components/InputBase/useInputBasePartialStyles.ts +38 -0
  136. package/src/components/InputBase/utils.ts +17 -17
  137. package/src/components/List/index.tsx +0 -1
  138. package/src/components/Modal/index.tsx +4 -15
  139. package/src/components/NumberIncrement/index.tsx +52 -160
  140. package/src/components/NumberIncrement/types.ts +7 -5
  141. package/src/components/NumberIncrement/useNumberIncrement.ts +152 -0
  142. package/src/components/RadioInput/index.tsx +37 -53
  143. package/src/components/RadioInput/types.ts +11 -9
  144. package/src/components/Scroll/index.tsx +44 -45
  145. package/src/components/Scroll/types.ts +4 -4
  146. package/src/components/Sections/index.tsx +0 -1
  147. package/src/components/SegmentedControl/index.tsx +8 -6
  148. package/src/components/SegmentedControl/types.ts +4 -3
  149. package/src/components/Select/index.tsx +32 -24
  150. package/src/components/Select/types.ts +19 -18
  151. package/src/components/Slider/index.tsx +34 -66
  152. package/src/components/Slider/types.ts +7 -5
  153. package/src/components/SortablePhotos/index.tsx +31 -47
  154. package/src/components/SortablePhotos/types.ts +6 -15
  155. package/src/components/SortablePhotos/useSortablePhotos.ts +28 -22
  156. package/src/components/Switch/index.tsx +23 -9
  157. package/src/components/Switch/types.ts +5 -2
  158. package/src/components/TextInput/index.tsx +55 -89
  159. package/src/components/TextInput/types.ts +9 -7
  160. package/src/components/TextInput/useTextInput.ts +88 -0
  161. package/src/components/Touchable/index.tsx +5 -1
  162. package/src/components/View/index.tsx +19 -12
  163. package/src/components/View/types.ts +7 -6
  164. package/src/components/components.ts +0 -2
  165. package/src/hooks/index.ts +3 -13
  166. package/src/hooks/useKeyboardController.ts +28 -0
  167. package/src/hooks/useStatusBar.ts +21 -0
  168. package/src/hooks/useStylesFor.ts +13 -0
  169. package/src/index.ts +3 -1
  170. package/src/modules/backgroundTimer.ts +39 -0
  171. package/src/modules/index.ts +3 -0
  172. package/src/modules/reactNavigation.ts +64 -14
  173. package/src/modules/scroll.tsx +89 -0
  174. package/src/modules/types/textInputMask.ts +8 -4
  175. package/src/types/index.ts +1 -0
  176. package/src/utils/KeyboardAware/context.tsx +2 -6
  177. package/src/utils/KeyboardAware/index.ts +1 -1
  178. package/src/utils/ModalManager/context.tsx +2 -2
  179. package/src/utils/hooks.ts +4 -4
  180. package/src/utils/locale.ts +13 -5
  181. package/src/utils/theme.ts +6 -2
  182. package/dist/components/Navigation/Navigation.d.ts +0 -55
  183. package/dist/components/Navigation/Navigation.js +0 -41
  184. package/dist/components/Navigation/Navigation.js.map +0 -1
  185. package/dist/components/Navigation/constants.d.ts +0 -9
  186. package/dist/components/Navigation/constants.js +0 -9
  187. package/dist/components/Navigation/constants.js.map +0 -1
  188. package/dist/components/Navigation/index.d.ts +0 -3
  189. package/dist/components/Navigation/index.js +0 -4
  190. package/dist/components/Navigation/index.js.map +0 -1
  191. package/dist/components/Navigation/types.d.ts +0 -26
  192. package/dist/components/Navigation/types.js +0 -2
  193. package/dist/components/Navigation/types.js.map +0 -1
  194. package/dist/components/Navigation/utils.d.ts +0 -3
  195. package/dist/components/Navigation/utils.js +0 -34
  196. package/dist/components/Navigation/utils.js.map +0 -1
  197. package/dist/components/NumberIncrement/utils.d.ts +0 -5
  198. package/dist/components/NumberIncrement/utils.js +0 -23
  199. package/dist/components/NumberIncrement/utils.js.map +0 -1
  200. package/dist/utils/KeyboardAware/types.d.ts +0 -1
  201. package/dist/utils/KeyboardAware/types.js +0 -6
  202. package/dist/utils/KeyboardAware/types.js.map +0 -1
  203. package/src/components/Navigation/Navigation.tsx +0 -55
  204. package/src/components/Navigation/constants.ts +0 -24
  205. package/src/components/Navigation/index.tsx +0 -3
  206. package/src/components/Navigation/types.ts +0 -28
  207. package/src/components/Navigation/utils.tsx +0 -57
  208. package/src/components/NumberIncrement/utils.ts +0 -27
  209. package/src/utils/KeyboardAware/types.ts +0 -159
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codeleap/mobile",
3
- "version": "4.3.9",
3
+ "version": "5.0.1",
4
4
  "main": "src/index.ts",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -9,57 +9,53 @@
9
9
  "directory": "packages/mobile"
10
10
  },
11
11
  "devDependencies": {
12
- "@codeleap/types": "4.3.9",
13
- "@codeleap/utils": "4.3.9",
14
- "@codeleap/hooks": "4.3.9",
15
- "@codeleap/form": "4.3.9",
16
- "@codeleap/i18n": "4.3.9",
17
- "@codeleap/query": "4.3.9",
18
- "@codeleap/logger": "4.3.9",
19
- "@codeleap/config": "4.3.9"
12
+ "@codeleap/types": "5.0.1",
13
+ "@codeleap/utils": "5.0.1",
14
+ "@codeleap/hooks": "5.0.1",
15
+ "@codeleap/form": "5.0.1",
16
+ "@codeleap/i18n": "5.0.1",
17
+ "@codeleap/query": "5.0.1",
18
+ "@codeleap/logger": "5.0.1",
19
+ "@codeleap/config": "5.0.1"
20
20
  },
21
21
  "scripts": {
22
22
  "build": "tsc --build",
23
23
  "lint": "eslint -c .eslintrc.js --fix \"./src/**/*.{ts,tsx,js,jsx}\""
24
24
  },
25
25
  "peerDependencies": {
26
- "@codeleap/types": "4.3.9",
27
- "@codeleap/utils": "4.3.9",
28
- "@codeleap/hooks": "4.3.9",
29
- "@codeleap/form": "4.3.9",
30
- "@codeleap/i18n": "4.3.9",
31
- "@codeleap/query": "4.3.9",
32
- "@codeleap/logger": "4.3.9",
33
- "@codeleap/styles": "4.3.9",
26
+ "@codeleap/types": "5.0.1",
27
+ "@codeleap/utils": "5.0.1",
28
+ "@codeleap/hooks": "5.0.1",
29
+ "@codeleap/form": "5.0.1",
30
+ "@codeleap/i18n": "5.0.1",
31
+ "@codeleap/query": "5.0.1",
32
+ "@codeleap/logger": "5.0.1",
33
+ "@codeleap/styles": "5.0.1",
34
34
  "@d11/react-native-fast-image": "8.8.0",
35
- "@react-native-firebase/messaging": "21.4.0",
36
- "@react-navigation/bottom-tabs": "6.5.3",
37
- "@react-navigation/drawer": "6.5.7",
38
- "@react-navigation/native": "6.1.2",
39
- "@react-navigation/native-stack": "6.9.8",
40
- "@react-navigation/stack": "6.3.11",
41
- "react": "18.1.0",
42
- "react-native": "0.76.3",
43
- "react-native-avoid-softinput": "6.0.2",
44
- "react-native-calendars": "1.1293.0",
45
- "react-native-date-picker": "4.2.13",
46
- "react-native-device-info": "10.3.0",
47
- "react-native-gesture-handler": "2.9.0",
48
- "react-native-image-crop-picker": "github:Pauligrinder/react-native-image-crop-picker",
35
+ "@react-native-firebase/messaging": "21.7.2",
36
+ "@react-navigation/bottom-tabs": "7.2.0",
37
+ "@react-navigation/native": "7.0.14",
38
+ "@react-navigation/native-stack": "7.2.0",
39
+ "react": "18.2.0",
40
+ "react-native": "0.77.0",
41
+ "react-native-calendars": "1.1307.0",
42
+ "react-native-date-picker": "5.0.9",
43
+ "react-native-device-info": "14.0.4",
44
+ "react-native-gesture-handler": "2.22.1",
45
+ "react-native-image-crop-picker": "0.42.0",
49
46
  "react-native-image-viewing": "0.2.2",
50
- "react-native-keyboard-aware-scroll-view": "0.9.5",
51
- "react-native-mmkv": "2.12.2",
47
+ "react-native-localize": "3.4.1",
48
+ "react-native-mmkv": "3.2.0",
52
49
  "react-native-super-grid": "4.6.1",
53
- "typescript": "5.0.4"
50
+ "typescript": "5.5.2"
54
51
  },
55
52
  "dependencies": {
56
53
  "@gorhom/portal": "1.0.14",
57
54
  "@miblanchard/react-native-slider": "2.3.1",
58
- "date-fns": "2.29.3",
59
55
  "react-native-currency-input": "^1.1.1",
60
- "react-native-drag-sort": "^2.4.4",
61
56
  "react-native-masked-text": "1.13.0",
62
57
  "react-native-reanimated-carousel": "^3.5.1",
58
+ "react-native-sortables": "^1.1.1",
63
59
  "react-native-uuid": "2.0.1"
64
60
  }
65
61
  }
package/package.json.bak CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codeleap/mobile",
3
- "version": "4.3.9",
3
+ "version": "5.0.1",
4
4
  "main": "src/index.ts",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -32,34 +32,30 @@
32
32
  "@codeleap/logger": "workspace:*",
33
33
  "@codeleap/styles": "workspace:*",
34
34
  "@d11/react-native-fast-image": "8.8.0",
35
- "@react-native-firebase/messaging": "21.4.0",
36
- "@react-navigation/bottom-tabs": "6.5.3",
37
- "@react-navigation/drawer": "6.5.7",
38
- "@react-navigation/native": "6.1.2",
39
- "@react-navigation/native-stack": "6.9.8",
40
- "@react-navigation/stack": "6.3.11",
41
- "react": "18.1.0",
42
- "react-native": "0.76.3",
43
- "react-native-avoid-softinput": "6.0.2",
44
- "react-native-calendars": "1.1293.0",
45
- "react-native-date-picker": "4.2.13",
46
- "react-native-device-info": "10.3.0",
47
- "react-native-gesture-handler": "2.9.0",
48
- "react-native-image-crop-picker": "github:Pauligrinder/react-native-image-crop-picker",
35
+ "@react-native-firebase/messaging": "21.7.2",
36
+ "@react-navigation/bottom-tabs": "7.2.0",
37
+ "@react-navigation/native": "7.0.14",
38
+ "@react-navigation/native-stack": "7.2.0",
39
+ "react": "18.2.0",
40
+ "react-native": "0.77.0",
41
+ "react-native-calendars": "1.1307.0",
42
+ "react-native-date-picker": "5.0.9",
43
+ "react-native-device-info": "14.0.4",
44
+ "react-native-gesture-handler": "2.22.1",
45
+ "react-native-image-crop-picker": "0.42.0",
49
46
  "react-native-image-viewing": "0.2.2",
50
- "react-native-keyboard-aware-scroll-view": "0.9.5",
51
- "react-native-mmkv": "2.12.2",
47
+ "react-native-localize": "3.4.1",
48
+ "react-native-mmkv": "3.2.0",
52
49
  "react-native-super-grid": "4.6.1",
53
- "typescript": "5.0.4"
50
+ "typescript": "5.5.2"
54
51
  },
55
52
  "dependencies": {
56
53
  "@gorhom/portal": "1.0.14",
57
54
  "@miblanchard/react-native-slider": "2.3.1",
58
- "date-fns": "2.29.3",
59
55
  "react-native-currency-input": "^1.1.1",
60
- "react-native-drag-sort": "^2.4.4",
61
56
  "react-native-masked-text": "1.13.0",
62
57
  "react-native-reanimated-carousel": "^3.5.1",
58
+ "react-native-sortables": "^1.1.1",
63
59
  "react-native-uuid": "2.0.1"
64
60
  }
65
61
  }
@@ -1,6 +1,5 @@
1
1
  import React, { useCallback } from 'react'
2
- import { TypeGuards } from '@codeleap/types'
3
- import { FormTypes } from '@codeleap/form'
2
+ import { Options, TypeGuards } from '@codeleap/types'
4
3
  import { onMount, useSearch } from '@codeleap/hooks'
5
4
  import { List } from '../List'
6
5
  import { SearchInput } from '../SearchInput'
@@ -14,7 +13,7 @@ import { useStylesFor } from '../../hooks'
14
13
  export * from './styles'
15
14
  export * from './types'
16
15
 
17
- const defaultFilterFunction = (search: string, options: FormTypes.Options<any>) => {
16
+ const defaultFilterFunction = (search: string, options: Options<any>) => {
18
17
  return options.filter((option) => {
19
18
  if (TypeGuards.isString(option.label)) {
20
19
  return option.label.toLowerCase().includes(search.toLowerCase())
@@ -1,5 +1,4 @@
1
- import { PropsOf } from '@codeleap/types'
2
- import { FormTypes } from '@codeleap/form'
1
+ import { Option, Options, PropsOf } from '@codeleap/types'
3
2
  import { StylesOf } from '../../types/utility'
4
3
  import { GetKeyboardAwarePropsOptions } from '../../utils'
5
4
  import { Icon } from '../Icon'
@@ -15,7 +14,7 @@ export type AutocompleteRenderFNProps<T> = {
15
14
  style?: StylesOf<AutocompleteComposition>
16
15
  onPress: () => void
17
16
  isSelected?: boolean
18
- item: FormTypes.Options<T>[number]
17
+ item: Option<T>
19
18
  touchableProps?: Partial<PropsOf<typeof Touchable>>
20
19
  textProps?: Partial<PropsOf<typeof Text>>
21
20
  iconProps?: Partial<PropsOf<typeof Icon>>
@@ -26,17 +25,17 @@ export type AutocompleteRenderFN<T> = (props: AutocompleteRenderFNProps<T>) => J
26
25
  export type AutocompleteValue<T, Multi extends boolean = false> = Multi extends true ? T[] : T
27
26
 
28
27
  export type ValueBoundAutocompleteProps<T, Multi extends boolean = false> = {
29
- options?: FormTypes.Options<T>
30
- defaultOptions?: FormTypes.Options<T>
31
- loadOptions?: (search: string) => Promise<FormTypes.Options<T>>
28
+ options?: Options<T>
29
+ defaultOptions?: Options<T>
30
+ loadOptions?: (search: string) => Promise<Options<T>>
32
31
  value: AutocompleteValue<T, Multi>
33
32
  renderItem?: AutocompleteRenderFN<AutocompleteValue<T, Multi>>
34
33
  onValueChange: (value: AutocompleteValue<T, Multi>) => void
35
- filterItems?: (search: string, items: FormTypes.Options<T>) => FormTypes.Options<T>
34
+ filterItems?: (search: string, items: Options<T>) => Options<T>
36
35
  onLoadOptionsError?: (error: any) => void
37
36
  multiple?: Multi
38
- getLabel?: (forOption: Multi extends true ? FormTypes.Options<T> : FormTypes.Options<T>[number]) => FormTypes.Label
39
- onItemPressed?: (item: FormTypes.Options<T>[number]) => any
37
+ getLabel?: (forOption: Multi extends true ? Options<T> : Options<T>[number]) => string
38
+ onItemPressed?: (item: Options<T>[number]) => any
40
39
  }
41
40
 
42
41
  export type ReplaceAutocompleteProps<Props, T, Multi extends boolean = false> = Omit<
@@ -49,7 +48,7 @@ export type AutocompleteProps<T = any, Multi extends boolean = false> =
49
48
  ValueBoundAutocompleteProps<T, Multi> &
50
49
  {
51
50
  placeholder?: string
52
- label?: FormTypes.Label
51
+ label?: string
53
52
  closeOnSelect?: boolean
54
53
  style?: StyledProp<AutocompleteComposition>
55
54
  keyboardAware?: GetKeyboardAwarePropsOptions
@@ -34,7 +34,6 @@ export const Backdrop = (props: BackdropProps) => {
34
34
  return (
35
35
  <View.Animated
36
36
  pointerEvents={visible ? 'auto' : 'none'}
37
-
38
37
  entering={entering}
39
38
  exiting={exiting}
40
39
  {...wrapperProps}
@@ -8,6 +8,8 @@ import { CheckboxProps } from './types'
8
8
  import { AnyRecord, AppIcon, IJSX, StyledComponentProps } from '@codeleap/styles'
9
9
  import { MobileStyleRegistry } from '../../Registry'
10
10
  import { useStylesFor } from '../../hooks'
11
+ import { useInputBase } from '../InputBase/useInputBase'
12
+ import { fields } from '@codeleap/form'
11
13
 
12
14
  export * from './styles'
13
15
  export * from './types'
@@ -25,16 +27,24 @@ export const Checkbox = (props: CheckboxProps) => {
25
27
 
26
28
  const {
27
29
  style,
28
- value,
29
30
  disabled,
30
31
  debugName,
31
- onValueChange,
32
32
  checkboxOnLeft,
33
33
  checkIcon,
34
+ field,
35
+ forceError,
36
+ value,
37
+ onValueChange,
34
38
  } = others
35
39
 
36
40
  const styles = useStylesFor(Checkbox.styleRegistryName, style)
37
41
 
42
+ const {
43
+ fieldHandle,
44
+ validation,
45
+ wrapperRef,
46
+ } = useInputBase<boolean>(field, fields.boolean, [value, onValueChange])
47
+
38
48
  const boxAnimation = useAnimatedVariantStyles({
39
49
  variantStyles: styles,
40
50
  animatedProperties: ['box:unchecked', 'box:disabled', 'box:checked', 'box:disabled-checked', 'box:disabled-unchecked'],
@@ -43,9 +53,9 @@ export const Checkbox = (props: CheckboxProps) => {
43
53
  'worklet'
44
54
  let disabledStyle = {}
45
55
  if (disabled) {
46
- disabledStyle = value ? styles['box:disabled-checked'] : styles['box:disabled-unchecked']
56
+ disabledStyle = fieldHandle?.value ? styles['box:disabled-checked'] : styles['box:disabled-unchecked']
47
57
  }
48
- const style = value ? styles['box:checked'] : styles['box:unchecked']
58
+ const style = fieldHandle?.value ? styles['box:checked'] : styles['box:unchecked']
49
59
 
50
60
  return {
51
61
  ...style,
@@ -53,7 +63,7 @@ export const Checkbox = (props: CheckboxProps) => {
53
63
  }
54
64
 
55
65
  },
56
- dependencies: [value, disabled],
66
+ dependencies: [fieldHandle?.value, disabled],
57
67
  })
58
68
 
59
69
  const checkmarkWrapperAnimation = useAnimatedVariantStyles({
@@ -64,29 +74,33 @@ export const Checkbox = (props: CheckboxProps) => {
64
74
  'worklet'
65
75
  let disabledStyle = {}
66
76
  if (disabled) {
67
- disabledStyle = value ? styles['checkmarkWrapper:disabled-checked'] : styles['checkmarkWrapper:disabled-unchecked']
77
+ disabledStyle = fieldHandle?.value ? styles['checkmarkWrapper:disabled-checked'] : styles['checkmarkWrapper:disabled-unchecked']
68
78
  }
69
- const style = value ? styles['checkmarkWrapper:checked'] : styles['checkmarkWrapper:unchecked']
79
+ const style = fieldHandle?.value ? styles['checkmarkWrapper:checked'] : styles['checkmarkWrapper:unchecked']
70
80
  return {
71
81
  ...style,
72
82
  ...disabledStyle,
73
83
  }
74
84
 
75
85
  },
76
- dependencies: [value, disabled],
86
+ dependencies: [fieldHandle?.value, disabled],
77
87
  })
78
88
 
79
89
  // @ts-expect-error
80
90
  const _checkboxOnLeft = checkboxOnLeft ?? styles.__props?.checkboxOnLeft
81
91
 
92
+ const hasError = validation.showError || forceError
93
+
82
94
  return <InputBase
83
95
  {...inputBaseProps}
96
+ ref={wrapperRef}
97
+ error={hasError ? validation.message || forceError : null}
84
98
  debugName={debugName}
85
99
  wrapper={Touchable}
86
100
  style={styles}
87
101
  wrapperProps={{
88
102
  onPress: () => {
89
- onValueChange(!value)
103
+ fieldHandle.setValue(!fieldHandle?.value)
90
104
  },
91
105
  disabled,
92
106
  rippleDisabled: true,
@@ -1,13 +1,16 @@
1
1
  import { AppIcon, StyledProp } from '@codeleap/styles'
2
2
  import { InputBaseProps } from '../InputBase'
3
3
  import { CheckboxComposition } from './styles'
4
+ import { BooleanField } from '@codeleap/form'
4
5
 
5
6
  export type CheckboxProps =
6
7
  Pick<InputBaseProps, 'debugName' | 'disabled' | 'label'> &
7
8
  {
8
- value: boolean
9
- onValueChange: (value: boolean) => void
9
+ field?: BooleanField<any>
10
10
  style?: StyledProp<CheckboxComposition>
11
11
  checkboxOnLeft?: boolean
12
12
  checkIcon?: AppIcon
13
+ forceError?: boolean
14
+ value?: boolean
15
+ onValueChange?: (value: boolean) => void
13
16
  }
@@ -1,4 +1,4 @@
1
- import React, { useRef } from 'react'
1
+ import React, { useMemo, useRef } from 'react'
2
2
  import { TypeGuards } from '@codeleap/types'
3
3
  import { useConditionalState } from '@codeleap/hooks'
4
4
  import { useI18N } from '@codeleap/i18n'
@@ -11,6 +11,8 @@ import { DatePickerModalProps } from './types'
11
11
  import { AnyRecord, IJSX, StyledComponentProps, useCompositionStyles } from '@codeleap/styles'
12
12
  import { MobileStyleRegistry } from '../../Registry'
13
13
  import { useStylesFor } from '../../hooks'
14
+ import { DateField, fields } from '@codeleap/form'
15
+ import { useInputBase } from '../InputBase/useInputBase'
14
16
 
15
17
  export * from './styles'
16
18
  export * from './types'
@@ -33,8 +35,9 @@ const OuterInputComponent: DatePickerModalProps['outerInputComponent'] = (props)
33
35
  />
34
36
  }
35
37
 
36
- const defaultFormatDate: DatePickerModalProps['formatDate'] = (date) => {
37
- if (!date) return null
38
+ const defaultFormatDate: DatePickerModalProps['formatDate'] = (_date) => {
39
+ if (!_date) return null
40
+ const date = new Date(_date)
38
41
  return `${date.getDate()}/${date.getMonth() + 1}/${date.getFullYear()}`
39
42
  }
40
43
 
@@ -88,18 +91,16 @@ export const DatePickerModal = (props: DatePickerModalProps) => {
88
91
  }
89
92
 
90
93
  const {
94
+ field,
91
95
  isCustomModal,
92
96
  hideInput,
93
97
  visible: _visible,
94
98
  toggle: _toggle,
95
- value: _value,
96
- onValueChange,
97
99
  formatDate,
98
100
  debugName,
99
101
  cancelButtonProps = {},
100
102
  confirmButtonProps = {},
101
103
  outerInputComponent: OuterInput,
102
- footer,
103
104
  datePickerProps,
104
105
  mode,
105
106
  label,
@@ -109,10 +110,12 @@ export const DatePickerModal = (props: DatePickerModalProps) => {
109
110
  style,
110
111
  minimumDate,
111
112
  maximumDate,
112
- initialDate,
113
+ initialDate = minimumDate,
113
114
  footerComponent: Footer,
114
115
  toggleOnConfirm,
115
116
  onConfirm: _onConfirm,
117
+ value: _value,
118
+ onValueChange: _onValueChange,
116
119
  ...modalProps
117
120
  } = allProps
118
121
 
@@ -120,7 +123,11 @@ export const DatePickerModal = (props: DatePickerModalProps) => {
120
123
 
121
124
  const [visible, toggle] = useConditionalState(_visible, _toggle, { initialValue: false, isBooleanToggle: true })
122
125
 
123
- const [value, setValue] = [_value, onValueChange]
126
+ const {
127
+ fieldHandle,
128
+ } = useInputBase(field, fields.date as () => DateField<any>, [_value, _onValueChange])
129
+
130
+ const [value, setValue] = [fieldHandle?.value, fieldHandle.setValue]
124
131
 
125
132
  const Wrapper = isCustomModal ? ModalManager.Modal : React.Fragment
126
133
 
@@ -129,7 +136,7 @@ export const DatePickerModal = (props: DatePickerModalProps) => {
129
136
  const formattedDate = value ? formatDate(value) : ''
130
137
  const { locale } = useI18N()
131
138
 
132
- const tempDate = useRef<Date | null>(null)
139
+ const tempDate = useRef<Date | null>(initialDate instanceof Date ? initialDate : new Date(initialDate))
133
140
 
134
141
  const onConfirm = () => {
135
142
  if (commitDate == 'onConfirm' && !!tempDate.current) {
@@ -145,7 +152,7 @@ export const DatePickerModal = (props: DatePickerModalProps) => {
145
152
  }
146
153
  }
147
154
 
148
- const modalFooter = footer || <Footer
155
+ const modalFooter = <Footer
149
156
  {...allProps}
150
157
  confirm={onConfirm}
151
158
  doneStyles={compositionStyles?.doneButton}
@@ -154,11 +161,9 @@ export const DatePickerModal = (props: DatePickerModalProps) => {
154
161
  confirmButtonProps={confirmButtonProps}
155
162
  cancelButtonProps={cancelButtonProps}
156
163
  showDoneButton={showDoneButton}
157
- value={value}
158
164
  debugName={debugName}
159
165
  visible={visible}
160
166
  toggle={toggle}
161
- onValueChange={setValue}
162
167
  valueLabel={formattedDate}
163
168
  />
164
169
 
@@ -174,6 +179,11 @@ export const DatePickerModal = (props: DatePickerModalProps) => {
174
179
  id: null,
175
180
  } : {}
176
181
 
182
+ const date = useMemo(() => {
183
+ const newValue = value ?? initialDate
184
+ return newValue instanceof Date ? newValue : new Date(newValue)
185
+ }, [value, initialDate])
186
+
177
187
  return (
178
188
  <>
179
189
  {!hideInput ? <OuterInput
@@ -192,14 +202,13 @@ export const DatePickerModal = (props: DatePickerModalProps) => {
192
202
  modal={!isCustomModal}
193
203
  open={visible}
194
204
  onCancel={toggle}
195
- date={value ?? initialDate ?? new Date()}
196
- onDateChange={(date) => {
205
+ date={date}
206
+ onDateChange={(currentDate) => {
207
+ tempDate.current = currentDate
208
+
197
209
  if (commitDate === 'onChange') {
198
- setValue(date)
199
- return
210
+ setValue(currentDate)
200
211
  }
201
-
202
- tempDate.current = date
203
212
  }}
204
213
  locale={locale}
205
214
  // @ts-expect-error
@@ -1,18 +1,20 @@
1
1
  import React from 'react'
2
2
  import { StylesOf } from '@codeleap/types'
3
- import { FormTypes } from '@codeleap/form'
4
3
  import { DatePickerModalButtonCompositions, DatePickerModalComposition } from './styles'
5
4
  import { DatePickerProps } from 'react-native-date-picker'
6
5
  import { ButtonProps } from '../Button'
7
6
  import { ModalProps } from '../Modal'
8
7
  import { StyledProp } from '@codeleap/styles'
8
+ import { DateField } from '@codeleap/form'
9
9
 
10
- export type DatePickerModalOuterInputProps = Omit<DatePickerModalProps, 'outerInputComponent'> & {
11
- valueLabel: FormTypes.Label
10
+ export type DatePickerModalOuterInputProps = Omit<DatePickerModalProps, 'outerInputComponent' | 'field'> & {
11
+ valueLabel: string
12
+ value: any
13
+ onValueChange: (date: any) => void
12
14
  }
13
15
 
14
16
  type DatePickerModalFooterProps = Omit<DatePickerModalProps, 'outerInputComponent' | 'style'> & {
15
- valueLabel: FormTypes.Label
17
+ valueLabel: string
16
18
  confirm: () => void
17
19
  cancelStyles: StylesOf<DatePickerModalButtonCompositions>
18
20
  confirmStyles: StylesOf<DatePickerModalButtonCompositions>
@@ -22,19 +24,18 @@ type DatePickerModalFooterProps = Omit<DatePickerModalProps, 'outerInputComponen
22
24
  export type DatePickerModalProps =
23
25
  Omit<ModalProps, 'style' | 'ref'> &
24
26
  {
27
+ field?: DateField<any>
25
28
  hideInput?: boolean
26
29
  debugName: string
27
- value: Date
28
- label?: FormTypes.Label
29
- placeholder?: FormTypes.Label
30
- onValueChange: (date: Date) => void
30
+ label?: string
31
+ placeholder?: string
31
32
  isCustomModal?: boolean
32
33
  mode?: DatePickerProps['mode']
33
34
  cancelButtonProps?: Partial<ButtonProps>
34
35
  confirmButtonProps?: Partial<ButtonProps>
35
36
  datePickerProps?: Partial<DatePickerProps>
36
37
  outerInputComponent?: React.ComponentType<DatePickerModalOuterInputProps>
37
- formatDate?: (date: Date) => FormTypes.Label
38
+ formatDate?: (date: Date) => string
38
39
  commitDate?: 'onConfirm' | 'onChange'
39
40
  showDoneButton?: boolean
40
41
  footerComponent?: React.ComponentType<DatePickerModalFooterProps>
@@ -44,4 +45,6 @@ export type DatePickerModalProps =
44
45
  toggleOnConfirm?: boolean
45
46
  onConfirm?: (value: Date) => void
46
47
  style?: StyledProp<DatePickerModalComposition>
48
+ value?: Date
49
+ onValueChange?: (value: Date) => void
47
50
  }
@@ -1,12 +1,11 @@
1
- import { AnyRef } from '@codeleap/types'
2
- import { FormTypes } from '@codeleap/form'
1
+ import { AnyRef, MobileInputFile } from '@codeleap/types'
3
2
  import { DocumentPickerOptions } from 'react-native-document-picker'
4
3
  import { Options } from 'react-native-image-crop-picker'
5
4
  import { OSAlert } from '../../utils'
6
5
 
7
6
  export type FileInputImageSource = 'camera' | 'library' | 'fs'
8
7
 
9
- export type FileResult = FormTypes.AnyFile
8
+ export type FileResult = MobileInputFile | string | number
10
9
 
11
10
  export type FileInputRef = {
12
11
  openFilePicker: (source?: FileInputImageSource, options?: Partial<Options>) => Promise<FileResult[]>
@@ -15,7 +14,7 @@ export type FileInputRef = {
15
14
  export type FileInputProps = {
16
15
  mode: 'hidden' | 'button'
17
16
  onFileSelect?: (files: FileResult[]) => void
18
- options?: DocumentPickerOptions<any>
17
+ options?: DocumentPickerOptions
19
18
  ref?: AnyRef<FileInputRef>
20
19
  type?: 'image' | 'anyFile'
21
20
  alertProps?: Parameters<typeof OSAlert.ask>[0]
@@ -1,10 +1,10 @@
1
1
  import React, { useCallback, forwardRef, ComponentType } from 'react'
2
- import { ListRenderItemInfo } from 'react-native'
2
+ import { FlatList, ListRenderItemInfo } from 'react-native'
3
3
  import { View, ViewProps } from '../View'
4
4
  import { EmptyPlaceholder } from '../EmptyPlaceholder'
5
5
  import { RefreshControl } from '../RefreshControl'
6
6
  import { List, ListItem } from '../List'
7
- import { KeyboardAwareFlatList } from 'react-native-keyboard-aware-scroll-view'
7
+
8
8
  import { GridProps } from './types'
9
9
  import { AnyRecord, AppTheme, IJSX, StyledComponentProps, StyledComponentWithProps, Theme, useTheme } from '@codeleap/styles'
10
10
  import { MobileStyleRegistry } from '../../Registry'
@@ -17,7 +17,7 @@ const RenderSeparator = (props: { separatorStyles: ViewProps['style'] }) => {
17
17
  return <View style={props.separatorStyles} />
18
18
  }
19
19
 
20
- export const Grid = forwardRef<KeyboardAwareFlatList, GridProps>((flatGridProps, ref) => {
20
+ export const Grid = forwardRef<FlatList, GridProps>((flatGridProps, ref) => {
21
21
  const {
22
22
  style,
23
23
  onRefresh,
@@ -1,18 +1,15 @@
1
1
  import { LoadingOverlayProps } from '../LoadingOverlay'
2
- import FastImage, { Source } from '@d11/react-native-fast-image'
3
- import { ImageProps as RNImageProps } from 'react-native'
2
+ import FastImage, { FastImageProps } from '@d11/react-native-fast-image'
4
3
  import { ImageComposition } from './styles'
5
4
  import { StyledProp } from '@codeleap/styles'
6
- import { FormTypes } from '@codeleap/form'
7
5
 
8
6
  export type ImageProps =
9
- Omit<RNImageProps, 'source' | 'style'> &
7
+ Omit<FastImageProps, 'style' | 'resizeMode'> &
10
8
  {
11
9
  fast?: boolean
12
10
  style?: StyledProp<ImageComposition>
13
- source: Source | FormTypes.AnyFile
14
11
  resizeMode?: keyof typeof FastImage.resizeMode
15
12
  spotlight?: string
16
13
  maintainAspectRatio?: boolean
17
14
  withLoadingOverlay?: boolean | ((props: LoadingOverlayProps) => JSX.Element)
18
- }
15
+ }
@@ -1,4 +1,4 @@
1
- import React from 'react'
1
+ import React, { forwardRef } from 'react'
2
2
  import { TypeGuards } from '@codeleap/types'
3
3
  import { getRenderedComponent } from '@codeleap/utils'
4
4
  import { ActionIcon, ActionIconProps } from '../ActionIcon'
@@ -6,6 +6,9 @@ import { View } from '../View'
6
6
  import { useInputBaseStyles } from './styles'
7
7
  import { InputBaseProps } from './types'
8
8
  import { Text } from '../Text'
9
+ import RNAnimated, { FadeIn, FadeOut } from 'react-native-reanimated'
10
+ import { View as RNView } from 'react-native'
11
+ import { StyledComponentProps, StyledComponentWithProps } from '@codeleap/styles'
9
12
 
10
13
  export * from './styles'
11
14
  export * from './utils'
@@ -22,7 +25,7 @@ const KeyPassthrough = (props: React.PropsWithChildren<any>) => {
22
25
  return <>{props.children}</>
23
26
  }
24
27
 
25
- export const InputBase = (props: InputBaseProps) => {
28
+ export const InputBase = forwardRef<RNView, InputBaseProps>((props: InputBaseProps, ref) => {
26
29
  const {
27
30
  children,
28
31
  error = null,
@@ -82,24 +85,27 @@ export const InputBase = (props: InputBaseProps) => {
82
85
  {children}
83
86
  {_rightIcon}
84
87
  </InnerWrapperComponent>,
85
- error: hideErrorMessage ? null : (
86
- _error || <Text text={''} style={styles.errorStyle} />
87
- ),
88
88
  }
89
89
 
90
90
  return <WrapperComponent
91
91
  {...otherProps}
92
92
  {...wrapperProps}
93
93
  style={styles.wrapperStyle}
94
+ ref={ref}
94
95
  >
95
96
  {
96
97
  order.map((key) => <KeyPassthrough key={key}>
97
98
  {parts[key]}
98
99
  </KeyPassthrough>)
99
-
100
100
  }
101
+
102
+ {hideErrorMessage || !error ? null : (
103
+ <RNAnimated.View exiting={FadeOut.duration(100)} entering={FadeIn.duration(200)}>
104
+ {_error}
105
+ </RNAnimated.View>
106
+ )}
101
107
  </WrapperComponent>
102
- }
108
+ }) as StyledComponentWithProps<InputBaseProps>
103
109
 
104
110
  InputBase.elements = ['wrapper', 'innerWrapper', 'label', 'errorMessage', 'description', 'icon', 'leftIcon', 'rightIcon']
105
111