@codeleap/mobile 4.3.9 → 5.0.0
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/dist/components/Autocomplete/index.js.map +1 -1
- package/dist/components/Autocomplete/types.d.ts +9 -10
- package/dist/components/Backdrop/index.js.map +1 -1
- package/dist/components/Checkbox/index.js +13 -9
- package/dist/components/Checkbox/index.js.map +1 -1
- package/dist/components/Checkbox/types.d.ts +5 -2
- package/dist/components/DatePickerModal/index.js +18 -11
- package/dist/components/DatePickerModal/index.js.map +1 -1
- package/dist/components/DatePickerModal/types.d.ts +12 -9
- package/dist/components/FileInput/types.d.ts +3 -4
- package/dist/components/Grid/index.js.map +1 -1
- package/dist/components/Image/types.d.ts +2 -5
- package/dist/components/InputBase/index.d.ts +2 -6
- package/dist/components/InputBase/index.js +9 -5
- package/dist/components/InputBase/index.js.map +1 -1
- package/dist/components/InputBase/types.d.ts +2 -0
- package/dist/components/InputBase/useInputBase.d.ts +24 -0
- package/dist/components/InputBase/useInputBase.js +46 -0
- package/dist/components/InputBase/useInputBase.js.map +1 -0
- package/dist/components/InputBase/useInputBasePartialStyles.d.ts +2 -0
- package/dist/components/InputBase/useInputBasePartialStyles.js +30 -0
- package/dist/components/InputBase/useInputBasePartialStyles.js.map +1 -0
- package/dist/components/InputBase/utils.js +16 -16
- package/dist/components/InputBase/utils.js.map +1 -1
- package/dist/components/List/index.js +1 -1
- package/dist/components/List/index.js.map +1 -1
- package/dist/components/Modal/index.js +4 -14
- package/dist/components/Modal/index.js.map +1 -1
- package/dist/components/NumberIncrement/index.js +21 -132
- package/dist/components/NumberIncrement/index.js.map +1 -1
- package/dist/components/NumberIncrement/types.d.ts +7 -5
- package/dist/components/NumberIncrement/useNumberIncrement.d.ts +55 -0
- package/dist/components/NumberIncrement/useNumberIncrement.js +107 -0
- package/dist/components/NumberIncrement/useNumberIncrement.js.map +1 -0
- package/dist/components/RadioInput/index.d.ts +1 -1
- package/dist/components/RadioInput/index.js +20 -41
- package/dist/components/RadioInput/index.js.map +1 -1
- package/dist/components/RadioInput/types.d.ts +11 -9
- package/dist/components/Scroll/index.js +25 -28
- package/dist/components/Scroll/index.js.map +1 -1
- package/dist/components/Scroll/types.d.ts +4 -4
- package/dist/components/Sections/index.js +1 -1
- package/dist/components/Sections/index.js.map +1 -1
- package/dist/components/SegmentedControl/index.js +6 -4
- package/dist/components/SegmentedControl/index.js.map +1 -1
- package/dist/components/SegmentedControl/types.d.ts +4 -3
- package/dist/components/Select/index.js +10 -6
- package/dist/components/Select/index.js.map +1 -1
- package/dist/components/Select/types.d.ts +19 -18
- package/dist/components/Slider/index.js +18 -57
- package/dist/components/Slider/index.js.map +1 -1
- package/dist/components/Slider/types.d.ts +7 -5
- package/dist/components/SortablePhotos/index.js +17 -18
- package/dist/components/SortablePhotos/index.js.map +1 -1
- package/dist/components/SortablePhotos/types.d.ts +5 -15
- package/dist/components/SortablePhotos/useSortablePhotos.d.ts +11 -8
- package/dist/components/SortablePhotos/useSortablePhotos.js +18 -11
- package/dist/components/SortablePhotos/useSortablePhotos.js.map +1 -1
- package/dist/components/Switch/index.js +13 -9
- package/dist/components/Switch/index.js.map +1 -1
- package/dist/components/Switch/types.d.ts +5 -2
- package/dist/components/TextInput/index.js +26 -70
- package/dist/components/TextInput/index.js.map +1 -1
- package/dist/components/TextInput/types.d.ts +8 -6
- package/dist/components/TextInput/useTextInput.d.ts +54 -0
- package/dist/components/TextInput/useTextInput.js +59 -0
- package/dist/components/TextInput/useTextInput.js.map +1 -0
- package/dist/components/Touchable/index.js +4 -3
- package/dist/components/Touchable/index.js.map +1 -1
- package/dist/components/View/index.d.ts +7 -12
- package/dist/components/View/index.js +9 -7
- package/dist/components/View/index.js.map +1 -1
- package/dist/components/View/types.d.ts +6 -6
- package/dist/components/components.d.ts +0 -2
- package/dist/components/components.js +0 -2
- package/dist/components/components.js.map +1 -1
- package/dist/hooks/index.d.ts +3 -2
- package/dist/hooks/index.js +3 -10
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/useKeyboardController.d.ts +6 -0
- package/dist/hooks/useKeyboardController.js +19 -0
- package/dist/hooks/useKeyboardController.js.map +1 -0
- package/dist/hooks/useStatusBar.d.ts +6 -0
- package/dist/hooks/useStatusBar.js +15 -0
- package/dist/hooks/useStatusBar.js.map +1 -0
- package/dist/hooks/useStylesFor.d.ts +2 -0
- package/dist/hooks/useStylesFor.js +11 -0
- package/dist/hooks/useStylesFor.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/modules/backgroundTimer.d.ts +3 -0
- package/dist/modules/backgroundTimer.js +31 -0
- package/dist/modules/backgroundTimer.js.map +1 -0
- package/dist/modules/index.d.ts +3 -0
- package/dist/modules/index.js +3 -0
- package/dist/modules/index.js.map +1 -0
- package/dist/modules/reactNavigation.d.ts +8 -21
- package/dist/modules/reactNavigation.js +38 -12
- package/dist/modules/reactNavigation.js.map +1 -1
- package/dist/modules/scroll.d.ts +18 -0
- package/dist/modules/scroll.js +57 -0
- package/dist/modules/scroll.js.map +1 -0
- package/dist/modules/types/textInputMask.d.ts +6 -2
- package/dist/utils/KeyboardAware/context.js +2 -6
- package/dist/utils/KeyboardAware/context.js.map +1 -1
- package/dist/utils/KeyboardAware/index.d.ts +0 -1
- package/dist/utils/KeyboardAware/index.js +0 -1
- package/dist/utils/KeyboardAware/index.js.map +1 -1
- package/dist/utils/ModalManager/context.js +2 -2
- package/dist/utils/ModalManager/context.js.map +1 -1
- package/dist/utils/hooks.js +4 -4
- package/dist/utils/hooks.js.map +1 -1
- package/dist/utils/locale.d.ts +1 -1
- package/dist/utils/locale.js +10 -5
- package/dist/utils/locale.js.map +1 -1
- package/dist/utils/theme.d.ts +1 -0
- package/dist/utils/theme.js +4 -2
- package/dist/utils/theme.js.map +1 -1
- package/package.json +31 -35
- package/package.json.bak +17 -20
- package/src/components/Autocomplete/index.tsx +2 -3
- package/src/components/Autocomplete/types.ts +9 -10
- package/src/components/Backdrop/index.tsx +0 -1
- package/src/components/Checkbox/index.tsx +23 -9
- package/src/components/Checkbox/types.ts +5 -2
- package/src/components/DatePickerModal/index.tsx +27 -18
- package/src/components/DatePickerModal/types.ts +12 -9
- package/src/components/FileInput/types.ts +3 -4
- package/src/components/Grid/index.tsx +3 -3
- package/src/components/Image/types.ts +3 -6
- package/src/components/InputBase/index.tsx +13 -7
- package/src/components/InputBase/types.ts +2 -0
- package/src/components/InputBase/useInputBase.ts +60 -0
- package/src/components/InputBase/useInputBasePartialStyles.ts +38 -0
- package/src/components/InputBase/utils.ts +17 -17
- package/src/components/List/index.tsx +0 -1
- package/src/components/Modal/index.tsx +4 -15
- package/src/components/NumberIncrement/index.tsx +52 -160
- package/src/components/NumberIncrement/types.ts +7 -5
- package/src/components/NumberIncrement/useNumberIncrement.ts +152 -0
- package/src/components/RadioInput/index.tsx +37 -53
- package/src/components/RadioInput/types.ts +11 -9
- package/src/components/Scroll/index.tsx +44 -45
- package/src/components/Scroll/types.ts +4 -4
- package/src/components/Sections/index.tsx +0 -1
- package/src/components/SegmentedControl/index.tsx +8 -6
- package/src/components/SegmentedControl/types.ts +4 -3
- package/src/components/Select/index.tsx +32 -24
- package/src/components/Select/types.ts +19 -18
- package/src/components/Slider/index.tsx +34 -66
- package/src/components/Slider/types.ts +7 -5
- package/src/components/SortablePhotos/index.tsx +31 -47
- package/src/components/SortablePhotos/types.ts +6 -15
- package/src/components/SortablePhotos/useSortablePhotos.ts +28 -22
- package/src/components/Switch/index.tsx +23 -9
- package/src/components/Switch/types.ts +5 -2
- package/src/components/TextInput/index.tsx +55 -89
- package/src/components/TextInput/types.ts +9 -7
- package/src/components/TextInput/useTextInput.ts +88 -0
- package/src/components/Touchable/index.tsx +5 -1
- package/src/components/View/index.tsx +19 -12
- package/src/components/View/types.ts +7 -6
- package/src/components/components.ts +0 -2
- package/src/hooks/index.ts +3 -13
- package/src/hooks/useKeyboardController.ts +28 -0
- package/src/hooks/useStatusBar.ts +21 -0
- package/src/hooks/useStylesFor.ts +13 -0
- package/src/index.ts +3 -1
- package/src/modules/backgroundTimer.ts +39 -0
- package/src/modules/index.ts +3 -0
- package/src/modules/reactNavigation.ts +64 -14
- package/src/modules/scroll.tsx +89 -0
- package/src/modules/types/textInputMask.ts +8 -4
- package/src/types/index.ts +1 -0
- package/src/utils/KeyboardAware/context.tsx +2 -6
- package/src/utils/KeyboardAware/index.ts +1 -1
- package/src/utils/ModalManager/context.tsx +2 -2
- package/src/utils/hooks.ts +4 -4
- package/src/utils/locale.ts +13 -5
- package/src/utils/theme.ts +6 -2
- package/dist/components/Navigation/Navigation.d.ts +0 -55
- package/dist/components/Navigation/Navigation.js +0 -41
- package/dist/components/Navigation/Navigation.js.map +0 -1
- package/dist/components/Navigation/constants.d.ts +0 -9
- package/dist/components/Navigation/constants.js +0 -9
- package/dist/components/Navigation/constants.js.map +0 -1
- package/dist/components/Navigation/index.d.ts +0 -3
- package/dist/components/Navigation/index.js +0 -4
- package/dist/components/Navigation/index.js.map +0 -1
- package/dist/components/Navigation/types.d.ts +0 -26
- package/dist/components/Navigation/types.js +0 -2
- package/dist/components/Navigation/types.js.map +0 -1
- package/dist/components/Navigation/utils.d.ts +0 -3
- package/dist/components/Navigation/utils.js +0 -34
- package/dist/components/Navigation/utils.js.map +0 -1
- package/dist/components/NumberIncrement/utils.d.ts +0 -5
- package/dist/components/NumberIncrement/utils.js +0 -23
- package/dist/components/NumberIncrement/utils.js.map +0 -1
- package/dist/utils/KeyboardAware/types.d.ts +0 -1
- package/dist/utils/KeyboardAware/types.js +0 -6
- package/dist/utils/KeyboardAware/types.js.map +0 -1
- package/src/components/Navigation/Navigation.tsx +0 -55
- package/src/components/Navigation/constants.ts +0 -24
- package/src/components/Navigation/index.tsx +0 -3
- package/src/components/Navigation/types.ts +0 -28
- package/src/components/Navigation/utils.tsx +0 -57
- package/src/components/NumberIncrement/utils.ts +0 -27
- 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": "
|
|
3
|
+
"version": "5.0.0",
|
|
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": "
|
|
13
|
-
"@codeleap/utils": "
|
|
14
|
-
"@codeleap/hooks": "
|
|
15
|
-
"@codeleap/form": "
|
|
16
|
-
"@codeleap/i18n": "
|
|
17
|
-
"@codeleap/query": "
|
|
18
|
-
"@codeleap/logger": "
|
|
19
|
-
"@codeleap/config": "
|
|
12
|
+
"@codeleap/types": "5.0.0",
|
|
13
|
+
"@codeleap/utils": "5.0.0",
|
|
14
|
+
"@codeleap/hooks": "5.0.0",
|
|
15
|
+
"@codeleap/form": "5.0.0",
|
|
16
|
+
"@codeleap/i18n": "5.0.0",
|
|
17
|
+
"@codeleap/query": "5.0.0",
|
|
18
|
+
"@codeleap/logger": "5.0.0",
|
|
19
|
+
"@codeleap/config": "5.0.0"
|
|
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": "
|
|
27
|
-
"@codeleap/utils": "
|
|
28
|
-
"@codeleap/hooks": "
|
|
29
|
-
"@codeleap/form": "
|
|
30
|
-
"@codeleap/i18n": "
|
|
31
|
-
"@codeleap/query": "
|
|
32
|
-
"@codeleap/logger": "
|
|
26
|
+
"@codeleap/types": "5.0.0",
|
|
27
|
+
"@codeleap/utils": "5.0.0",
|
|
28
|
+
"@codeleap/hooks": "5.0.0",
|
|
29
|
+
"@codeleap/form": "5.0.0",
|
|
30
|
+
"@codeleap/i18n": "5.0.0",
|
|
31
|
+
"@codeleap/query": "5.0.0",
|
|
32
|
+
"@codeleap/logger": "5.0.0",
|
|
33
33
|
"@codeleap/styles": "4.3.9",
|
|
34
34
|
"@d11/react-native-fast-image": "8.8.0",
|
|
35
|
-
"@react-native-firebase/messaging": "21.
|
|
36
|
-
"@react-navigation/bottom-tabs": "
|
|
37
|
-
"@react-navigation/
|
|
38
|
-
"@react-navigation/native": "
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"react": "
|
|
42
|
-
"react-native": "0.
|
|
43
|
-
"react-native-
|
|
44
|
-
"react-native-
|
|
45
|
-
"react-native-
|
|
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-
|
|
51
|
-
"react-native-mmkv": "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.
|
|
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,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codeleap/mobile",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"main": "src/index.ts",
|
|
5
|
+
|
|
5
6
|
"license": "UNLICENSED",
|
|
6
7
|
"repository": {
|
|
7
8
|
"url": "https://github.com/codeleap-uk/internal-libs-monorepo.git",
|
|
@@ -32,34 +33,30 @@
|
|
|
32
33
|
"@codeleap/logger": "workspace:*",
|
|
33
34
|
"@codeleap/styles": "workspace:*",
|
|
34
35
|
"@d11/react-native-fast-image": "8.8.0",
|
|
35
|
-
"@react-native-firebase/messaging": "21.
|
|
36
|
-
"@react-navigation/bottom-tabs": "
|
|
37
|
-
"@react-navigation/
|
|
38
|
-
"@react-navigation/native": "
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"react": "
|
|
42
|
-
"react-native": "0.
|
|
43
|
-
"react-native-
|
|
44
|
-
"react-native-
|
|
45
|
-
"react-native-
|
|
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",
|
|
36
|
+
"@react-native-firebase/messaging": "21.7.2",
|
|
37
|
+
"@react-navigation/bottom-tabs": "7.2.0",
|
|
38
|
+
"@react-navigation/native": "7.0.14",
|
|
39
|
+
"@react-navigation/native-stack": "7.2.0",
|
|
40
|
+
"react": "18.2.0",
|
|
41
|
+
"react-native": "0.77.0",
|
|
42
|
+
"react-native-calendars": "1.1307.0",
|
|
43
|
+
"react-native-date-picker": "5.0.9",
|
|
44
|
+
"react-native-device-info": "14.0.4",
|
|
45
|
+
"react-native-gesture-handler": "2.22.1",
|
|
46
|
+
"react-native-image-crop-picker": "0.42.0",
|
|
49
47
|
"react-native-image-viewing": "0.2.2",
|
|
50
|
-
"react-native-
|
|
51
|
-
"react-native-mmkv": "2.
|
|
48
|
+
"react-native-localize": "3.4.1",
|
|
49
|
+
"react-native-mmkv": "3.2.0",
|
|
52
50
|
"react-native-super-grid": "4.6.1",
|
|
53
|
-
"typescript": "5.
|
|
51
|
+
"typescript": "5.5.2"
|
|
54
52
|
},
|
|
55
53
|
"dependencies": {
|
|
56
54
|
"@gorhom/portal": "1.0.14",
|
|
57
55
|
"@miblanchard/react-native-slider": "2.3.1",
|
|
58
|
-
"date-fns": "2.29.3",
|
|
59
56
|
"react-native-currency-input": "^1.1.1",
|
|
60
|
-
"react-native-drag-sort": "^2.4.4",
|
|
61
57
|
"react-native-masked-text": "1.13.0",
|
|
62
58
|
"react-native-reanimated-carousel": "^3.5.1",
|
|
59
|
+
"react-native-sortables": "^1.1.1",
|
|
63
60
|
"react-native-uuid": "2.0.1"
|
|
64
61
|
}
|
|
65
62
|
}
|
|
@@ -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:
|
|
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:
|
|
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?:
|
|
30
|
-
defaultOptions?:
|
|
31
|
-
loadOptions?: (search: string) => Promise<
|
|
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:
|
|
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 ?
|
|
39
|
-
onItemPressed?: (item:
|
|
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?:
|
|
51
|
+
label?: string
|
|
53
52
|
closeOnSelect?: boolean
|
|
54
53
|
style?: StyledProp<AutocompleteComposition>
|
|
55
54
|
keyboardAware?: GetKeyboardAwarePropsOptions
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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'] = (
|
|
37
|
-
if (!
|
|
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
|
|
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>(
|
|
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 =
|
|
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={
|
|
196
|
-
onDateChange={(
|
|
205
|
+
date={date}
|
|
206
|
+
onDateChange={(currentDate) => {
|
|
207
|
+
tempDate.current = currentDate
|
|
208
|
+
|
|
197
209
|
if (commitDate === 'onChange') {
|
|
198
|
-
setValue(
|
|
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:
|
|
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:
|
|
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
|
-
|
|
28
|
-
|
|
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) =>
|
|
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 =
|
|
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
|
|
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
|
-
|
|
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<
|
|
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, {
|
|
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<
|
|
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
|
+
}
|