@codeleap/mobile 2.4.7 → 3.1.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.
- package/mobile-packages.code-workspace +27 -0
- package/package.json +25 -33
- package/src/components/ActionIcon/index.tsx +16 -6
- package/src/components/ActionIcon/styles.ts +3 -90
- package/src/components/ActivityIndicator/index.tsx +28 -9
- package/src/components/ActivityIndicator/styles.ts +2 -59
- package/src/components/Autocomplete/index.tsx +235 -0
- package/src/components/Autocomplete/styles.ts +18 -0
- package/src/components/Autocomplete/types.ts +75 -0
- package/src/components/Avatar/index.tsx +126 -0
- package/src/components/Avatar/styles.ts +22 -0
- package/src/components/AvatarGroup/index.tsx +76 -0
- package/src/components/AvatarGroup/styles.ts +11 -0
- package/src/components/Backdrop/index.tsx +14 -13
- package/src/components/Backdrop/styles.ts +3 -24
- package/src/components/Badge/index.tsx +134 -0
- package/src/components/Badge/styles.ts +14 -0
- package/src/components/Button/index.tsx +39 -49
- package/src/components/Button/styles.ts +6 -107
- package/src/components/Calendar/index.tsx +3 -3
- package/src/components/Calendar/style.ts +2 -31
- package/src/components/Checkbox/index.tsx +137 -74
- package/src/components/Checkbox/styles.ts +13 -73
- package/src/components/ContentView/index.tsx +2 -2
- package/src/components/ContentView/styles.ts +1 -17
- package/src/components/DatePickerModal/index.tsx +240 -0
- package/src/components/DatePickerModal/styles.ts +15 -0
- package/src/components/DatePickerModal/types.ts +55 -0
- package/src/components/Drawer/index.tsx +2 -2
- package/src/components/Drawer/styles.ts +4 -39
- package/src/components/EmptyPlaceholder/index.tsx +3 -3
- package/src/components/EmptyPlaceholder/styles.ts +2 -47
- package/src/components/FileInput/styles.ts +1 -8
- package/src/components/Grid/index.tsx +76 -72
- package/src/components/Grid/styles.ts +4 -7
- package/src/components/Icon/index.tsx +46 -8
- package/src/components/Icon/styles.ts +3 -51
- package/src/components/Image/index.tsx +18 -22
- package/src/components/Image/styles.ts +1 -14
- package/src/components/ImageView/Spotlight.tsx +4 -2
- package/src/components/ImageView/component.tsx +0 -3
- package/src/components/InputBase/index.tsx +101 -0
- package/src/components/InputBase/styles.ts +135 -0
- package/src/components/InputBase/types.ts +28 -0
- package/src/components/InputBase/utils.ts +42 -0
- package/src/components/InputLabel/index.tsx +3 -3
- package/src/components/InputLabel/styles.ts +2 -14
- package/src/components/List/PaginationIndicator.tsx +4 -21
- package/src/components/List/index.tsx +84 -46
- package/src/components/List/styles.ts +8 -20
- package/src/components/LoadingOverlay/index.tsx +45 -45
- package/src/components/LoadingOverlay/styles.ts +5 -27
- package/src/components/Modal/index.tsx +56 -32
- package/src/components/Modal/styles.ts +3 -114
- package/src/components/NumberIncrement/index.tsx +318 -0
- package/src/components/NumberIncrement/styles.ts +14 -0
- package/src/components/NumberIncrement/types.ts +44 -0
- package/src/components/NumberIncrement/utils.ts +27 -0
- package/src/components/Pager/index.tsx +120 -67
- package/src/components/Pager/styles.ts +2 -69
- package/src/components/RadioInput/index.tsx +145 -68
- package/src/components/RadioInput/styles.ts +8 -61
- package/src/components/RefreshControl/index.tsx +28 -0
- package/src/components/RefreshControl/styles.ts +7 -0
- package/src/components/Scroll/index.tsx +22 -37
- package/src/components/Scroll/styles.ts +2 -16
- package/src/components/Sections/index.tsx +116 -54
- package/src/components/Sections/styles.ts +7 -0
- package/src/components/SegmentedControl/Option.tsx +51 -0
- package/src/components/SegmentedControl/index.tsx +51 -67
- package/src/components/SegmentedControl/styles.ts +7 -63
- package/src/components/Select/index.tsx +268 -95
- package/src/components/Select/styles.ts +11 -131
- package/src/components/Select/types.ts +47 -11
- package/src/components/Slider/index.tsx +151 -94
- package/src/components/Slider/styles.ts +7 -72
- package/src/components/Slider/types.ts +18 -20
- package/src/components/Switch/index.tsx +115 -63
- package/src/components/Switch/styles.ts +13 -30
- package/src/components/Text/index.tsx +14 -31
- package/src/components/Text/styles.ts +2 -41
- package/src/components/TextInput/index.tsx +237 -259
- package/src/components/TextInput/styles.ts +6 -120
- package/src/components/Touchable/index.tsx +74 -27
- package/src/components/Touchable/styles.ts +1 -12
- package/src/components/View/index.tsx +11 -26
- package/src/components/View/styles.ts +1 -17
- package/src/components/components.ts +9 -5
- package/src/components/defaultStyles.ts +74 -61
- package/src/index.ts +0 -1
- package/src/modules/PressableRipple/index.ts +5 -0
- package/src/modules/PressableRipple/ripple.js +258 -0
- package/src/modules/PressableRipple/styles.js +22 -0
- package/src/modules/PressableRipple/type.ts +17 -0
- package/src/modules/textInputMask.tsx +13 -0
- package/src/types/index.ts +5 -0
- package/src/types/utility.ts +2 -2
- package/src/utils/KeyboardAware/index.ts +0 -13
- package/src/utils/KeyboardAware/keyboardHooks.ts +69 -79
- package/src/utils/hooks.ts +63 -36
- package/src/utils/index.ts +1 -0
- package/src/utils/locale.ts +7 -0
- package/src/utils/theme.ts +1 -21
- package/dist/components/ActionIcon/index.d.ts +0 -13
- package/dist/components/ActionIcon/index.js +0 -51
- package/dist/components/ActionIcon/index.js.map +0 -1
- package/dist/components/ActionIcon/styles.d.ts +0 -65
- package/dist/components/ActionIcon/styles.js +0 -61
- package/dist/components/ActionIcon/styles.js.map +0 -1
- package/dist/components/ActivityIndicator/index.d.ts +0 -15
- package/dist/components/ActivityIndicator/index.js +0 -55
- package/dist/components/ActivityIndicator/index.js.map +0 -1
- package/dist/components/ActivityIndicator/styles.d.ts +0 -59
- package/dist/components/ActivityIndicator/styles.js +0 -52
- package/dist/components/ActivityIndicator/styles.js.map +0 -1
- package/dist/components/Animated.d.ts +0 -15
- package/dist/components/Animated.js +0 -55
- package/dist/components/Animated.js.map +0 -1
- package/dist/components/AutoComplete/index.d.ts +0 -34
- package/dist/components/AutoComplete/index.js +0 -126
- package/dist/components/AutoComplete/index.js.map +0 -1
- package/dist/components/AutoComplete/styles.d.ts +0 -57
- package/dist/components/AutoComplete/styles.js +0 -89
- package/dist/components/AutoComplete/styles.js.map +0 -1
- package/dist/components/Backdrop/index.d.ts +0 -14
- package/dist/components/Backdrop/index.js +0 -59
- package/dist/components/Backdrop/index.js.map +0 -1
- package/dist/components/Backdrop/styles.d.ts +0 -53
- package/dist/components/Backdrop/styles.js +0 -28
- package/dist/components/Backdrop/styles.js.map +0 -1
- package/dist/components/Button/index.d.ts +0 -246
- package/dist/components/Button/index.js +0 -115
- package/dist/components/Button/index.js.map +0 -1
- package/dist/components/Button/styles.d.ts +0 -65
- package/dist/components/Button/styles.js +0 -61
- package/dist/components/Button/styles.js.map +0 -1
- package/dist/components/Calendar/index.d.ts +0 -15
- package/dist/components/Calendar/index.js +0 -76
- package/dist/components/Calendar/index.js.map +0 -1
- package/dist/components/Calendar/style.d.ts +0 -4
- package/dist/components/Calendar/style.js +0 -36
- package/dist/components/Calendar/style.js.map +0 -1
- package/dist/components/Calendar/types.d.ts +0 -95
- package/dist/components/Calendar/types.js +0 -3
- package/dist/components/Calendar/types.js.map +0 -1
- package/dist/components/Checkbox/index.d.ts +0 -15
- package/dist/components/Checkbox/index.js +0 -81
- package/dist/components/Checkbox/index.js.map +0 -1
- package/dist/components/Checkbox/styles.d.ts +0 -56
- package/dist/components/Checkbox/styles.js +0 -53
- package/dist/components/Checkbox/styles.js.map +0 -1
- package/dist/components/ContentView/index.d.ts +0 -12
- package/dist/components/ContentView/index.js +0 -62
- package/dist/components/ContentView/index.js.map +0 -1
- package/dist/components/ContentView/styles.d.ts +0 -53
- package/dist/components/ContentView/styles.js +0 -26
- package/dist/components/ContentView/styles.js.map +0 -1
- package/dist/components/Drawer/index.d.ts +0 -7
- package/dist/components/Drawer/index.js +0 -66
- package/dist/components/Drawer/index.js.map +0 -1
- package/dist/components/Drawer/styles.d.ts +0 -56
- package/dist/components/Drawer/styles.js +0 -39
- package/dist/components/Drawer/styles.js.map +0 -1
- package/dist/components/EmptyPlaceholder/index.d.ts +0 -25
- package/dist/components/EmptyPlaceholder/index.js +0 -88
- package/dist/components/EmptyPlaceholder/index.js.map +0 -1
- package/dist/components/EmptyPlaceholder/styles.d.ts +0 -55
- package/dist/components/EmptyPlaceholder/styles.js +0 -30
- package/dist/components/EmptyPlaceholder/styles.js.map +0 -1
- package/dist/components/FileInput/index.d.ts +0 -24
- package/dist/components/FileInput/index.js +0 -179
- package/dist/components/FileInput/index.js.map +0 -1
- package/dist/components/FileInput/styles.d.ts +0 -53
- package/dist/components/FileInput/styles.js +0 -19
- package/dist/components/FileInput/styles.js.map +0 -1
- package/dist/components/Grid/index.d.ts +0 -32
- package/dist/components/Grid/index.js +0 -80
- package/dist/components/Grid/index.js.map +0 -1
- package/dist/components/Grid/styles.d.ts +0 -54
- package/dist/components/Grid/styles.js +0 -19
- package/dist/components/Grid/styles.js.map +0 -1
- package/dist/components/Icon/index.d.ts +0 -14
- package/dist/components/Icon/index.js +0 -75
- package/dist/components/Icon/index.js.map +0 -1
- package/dist/components/Icon/styles.d.ts +0 -61
- package/dist/components/Icon/styles.js +0 -49
- package/dist/components/Icon/styles.js.map +0 -1
- package/dist/components/Image/index.d.ts +0 -25
- package/dist/components/Image/index.js +0 -130
- package/dist/components/Image/index.js.map +0 -1
- package/dist/components/Image/styles.d.ts +0 -55
- package/dist/components/Image/styles.js +0 -25
- package/dist/components/Image/styles.js.map +0 -1
- package/dist/components/ImageView/Spotlight.d.ts +0 -25
- package/dist/components/ImageView/Spotlight.js +0 -150
- package/dist/components/ImageView/Spotlight.js.map +0 -1
- package/dist/components/ImageView/component.d.ts +0 -5
- package/dist/components/ImageView/component.js +0 -50
- package/dist/components/ImageView/component.js.map +0 -1
- package/dist/components/ImageView/index.d.ts +0 -2
- package/dist/components/ImageView/index.js +0 -15
- package/dist/components/ImageView/index.js.map +0 -1
- package/dist/components/InputLabel/index.d.ts +0 -12
- package/dist/components/InputLabel/index.js +0 -58
- package/dist/components/InputLabel/index.js.map +0 -1
- package/dist/components/InputLabel/styles.d.ts +0 -4
- package/dist/components/InputLabel/styles.js +0 -26
- package/dist/components/InputLabel/styles.js.map +0 -1
- package/dist/components/List/PaginationIndicator.d.ts +0 -67
- package/dist/components/List/PaginationIndicator.js +0 -51
- package/dist/components/List/PaginationIndicator.js.map +0 -1
- package/dist/components/List/index.d.ts +0 -31
- package/dist/components/List/index.js +0 -77
- package/dist/components/List/index.js.map +0 -1
- package/dist/components/List/styles.d.ts +0 -54
- package/dist/components/List/styles.js +0 -28
- package/dist/components/List/styles.js.map +0 -1
- package/dist/components/LoadingOverlay/index.d.ts +0 -11
- package/dist/components/LoadingOverlay/index.js +0 -60
- package/dist/components/LoadingOverlay/index.js.map +0 -1
- package/dist/components/LoadingOverlay/styles.d.ts +0 -7
- package/dist/components/LoadingOverlay/styles.js +0 -34
- package/dist/components/LoadingOverlay/styles.js.map +0 -1
- package/dist/components/Modal/index.d.ts +0 -43
- package/dist/components/Modal/index.js +0 -147
- package/dist/components/Modal/index.js.map +0 -1
- package/dist/components/Modal/styles.d.ts +0 -58
- package/dist/components/Modal/styles.js +0 -74
- package/dist/components/Modal/styles.js.map +0 -1
- package/dist/components/MultiSelect/index.d.ts +0 -6
- package/dist/components/MultiSelect/index.js +0 -119
- package/dist/components/MultiSelect/index.js.map +0 -1
- package/dist/components/MultiSelect/styles.d.ts +0 -7
- package/dist/components/MultiSelect/styles.js +0 -84
- package/dist/components/MultiSelect/styles.js.map +0 -1
- package/dist/components/MultiSelect/types.d.ts +0 -43
- package/dist/components/MultiSelect/types.js +0 -3
- package/dist/components/MultiSelect/types.js.map +0 -1
- package/dist/components/Navigation/Navigation.d.ts +0 -3
- package/dist/components/Navigation/Navigation.js +0 -80
- package/dist/components/Navigation/Navigation.js.map +0 -1
- package/dist/components/Navigation/constants.d.ts +0 -5
- package/dist/components/Navigation/constants.js +0 -11
- 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 -16
- 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 -8
- 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 -69
- package/dist/components/Navigation/utils.js.map +0 -1
- package/dist/components/Pager/index.d.ts +0 -26
- package/dist/components/Pager/index.js +0 -84
- package/dist/components/Pager/index.js.map +0 -1
- package/dist/components/Pager/styles.d.ts +0 -87
- package/dist/components/Pager/styles.js +0 -72
- package/dist/components/Pager/styles.js.map +0 -1
- package/dist/components/RadioInput/index.d.ts +0 -27
- package/dist/components/RadioInput/index.js +0 -72
- package/dist/components/RadioInput/index.js.map +0 -1
- package/dist/components/RadioInput/styles.d.ts +0 -58
- package/dist/components/RadioInput/styles.js +0 -50
- package/dist/components/RadioInput/styles.js.map +0 -1
- package/dist/components/Scroll/index.d.ts +0 -124
- package/dist/components/Scroll/index.js +0 -97
- package/dist/components/Scroll/index.js.map +0 -1
- package/dist/components/Scroll/styles.d.ts +0 -53
- package/dist/components/Scroll/styles.js +0 -26
- package/dist/components/Scroll/styles.js.map +0 -1
- package/dist/components/Sections/index.d.ts +0 -115
- package/dist/components/Sections/index.js +0 -76
- package/dist/components/Sections/index.js.map +0 -1
- package/dist/components/SegmentedControl/index.d.ts +0 -52
- package/dist/components/SegmentedControl/index.js +0 -131
- package/dist/components/SegmentedControl/index.js.map +0 -1
- package/dist/components/SegmentedControl/styles.d.ts +0 -60
- package/dist/components/SegmentedControl/styles.js +0 -43
- package/dist/components/SegmentedControl/styles.js.map +0 -1
- package/dist/components/Select/index.d.ts +0 -16
- package/dist/components/Select/index.js +0 -122
- package/dist/components/Select/index.js.map +0 -1
- package/dist/components/Select/styles.d.ts +0 -60
- package/dist/components/Select/styles.js +0 -83
- package/dist/components/Select/styles.js.map +0 -1
- package/dist/components/Select/types.d.ts +0 -43
- package/dist/components/Select/types.js +0 -3
- package/dist/components/Select/types.js.map +0 -1
- package/dist/components/Slider/Mark.d.ts +0 -3
- package/dist/components/Slider/Mark.js +0 -32
- package/dist/components/Slider/Mark.js.map +0 -1
- package/dist/components/Slider/Thumb.d.ts +0 -7
- package/dist/components/Slider/Thumb.js +0 -30
- package/dist/components/Slider/Thumb.js.map +0 -1
- package/dist/components/Slider/index.d.ts +0 -4
- package/dist/components/Slider/index.js +0 -99
- package/dist/components/Slider/index.js.map +0 -1
- package/dist/components/Slider/styles.d.ts +0 -54
- package/dist/components/Slider/styles.js +0 -61
- package/dist/components/Slider/styles.js.map +0 -1
- package/dist/components/Slider/types.d.ts +0 -26
- package/dist/components/Slider/types.js +0 -3
- package/dist/components/Slider/types.js.map +0 -1
- package/dist/components/Switch/index.d.ts +0 -14
- package/dist/components/Switch/index.js +0 -81
- package/dist/components/Switch/index.js.map +0 -1
- package/dist/components/Switch/styles.d.ts +0 -55
- package/dist/components/Switch/styles.js +0 -34
- package/dist/components/Switch/styles.js.map +0 -1
- package/dist/components/Text/index.d.ts +0 -25
- package/dist/components/Text/index.js +0 -121
- package/dist/components/Text/index.js.map +0 -1
- package/dist/components/Text/styles.d.ts +0 -70
- package/dist/components/Text/styles.js +0 -34
- package/dist/components/Text/styles.js.map +0 -1
- package/dist/components/TextInput/index.d.ts +0 -181
- package/dist/components/TextInput/index.js +0 -213
- package/dist/components/TextInput/index.js.map +0 -1
- package/dist/components/TextInput/styles.d.ts +0 -63
- package/dist/components/TextInput/styles.js +0 -65
- package/dist/components/TextInput/styles.js.map +0 -1
- package/dist/components/Touchable/index.d.ts +0 -22
- package/dist/components/Touchable/index.js +0 -165
- package/dist/components/Touchable/index.js.map +0 -1
- package/dist/components/Touchable/styles.d.ts +0 -58
- package/dist/components/Touchable/styles.js +0 -24
- package/dist/components/Touchable/styles.js.map +0 -1
- package/dist/components/View/index.d.ts +0 -25
- package/dist/components/View/index.js +0 -107
- package/dist/components/View/index.js.map +0 -1
- package/dist/components/View/styles.d.ts +0 -54
- package/dist/components/View/styles.js +0 -29
- package/dist/components/View/styles.js.map +0 -1
- package/dist/components/components.d.ts +0 -37
- package/dist/components/components.js +0 -50
- package/dist/components/components.js.map +0 -1
- package/dist/components/defaultStyles.d.ts +0 -1468
- package/dist/components/defaultStyles.js +0 -67
- package/dist/components/defaultStyles.js.map +0 -1
- package/dist/index.d.ts +0 -7
- package/dist/index.js +0 -39
- package/dist/index.js.map +0 -1
- package/dist/modules/documentPicker.d.ts +0 -3
- package/dist/modules/documentPicker.js +0 -12
- package/dist/modules/documentPicker.js.map +0 -1
- package/dist/modules/fastImage.d.ts +0 -1
- package/dist/modules/fastImage.js +0 -10
- package/dist/modules/fastImage.js.map +0 -1
- package/dist/modules/reactNavigation.d.ts +0 -5
- package/dist/modules/reactNavigation.js +0 -26
- package/dist/modules/reactNavigation.js.map +0 -1
- package/dist/modules/rnDeviceInfo.d.ts +0 -2
- package/dist/modules/rnDeviceInfo.js +0 -10
- package/dist/modules/rnDeviceInfo.js.map +0 -1
- package/dist/modules/textInputMask.d.ts +0 -10
- package/dist/modules/textInputMask.js +0 -19
- package/dist/modules/textInputMask.js.map +0 -1
- package/dist/modules/types/fileTypes.d.ts +0 -138
- package/dist/modules/types/fileTypes.js +0 -3
- package/dist/modules/types/fileTypes.js.map +0 -1
- package/dist/modules/types/textInputMask.d.ts +0 -7
- package/dist/modules/types/textInputMask.js +0 -3
- package/dist/modules/types/textInputMask.js.map +0 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.js +0 -14
- package/dist/types/index.js.map +0 -1
- package/dist/types/utility.d.ts +0 -14
- package/dist/types/utility.js +0 -3
- package/dist/types/utility.js.map +0 -1
- package/dist/utils/KeyboardAware/context.d.ts +0 -13
- package/dist/utils/KeyboardAware/context.js +0 -63
- package/dist/utils/KeyboardAware/context.js.map +0 -1
- package/dist/utils/KeyboardAware/index.d.ts +0 -8
- package/dist/utils/KeyboardAware/index.js +0 -29
- package/dist/utils/KeyboardAware/index.js.map +0 -1
- package/dist/utils/KeyboardAware/keyboardHooks.d.ts +0 -26
- package/dist/utils/KeyboardAware/keyboardHooks.js +0 -87
- package/dist/utils/KeyboardAware/keyboardHooks.js.map +0 -1
- package/dist/utils/KeyboardAware/lib/KeyboardAwareFlatList.d.ts +0 -3
- package/dist/utils/KeyboardAware/lib/KeyboardAwareFlatList.js +0 -9
- package/dist/utils/KeyboardAware/lib/KeyboardAwareFlatList.js.map +0 -1
- package/dist/utils/KeyboardAware/lib/KeyboardAwareHOC.d.ts +0 -67
- package/dist/utils/KeyboardAware/lib/KeyboardAwareHOC.js +0 -439
- package/dist/utils/KeyboardAware/lib/KeyboardAwareHOC.js.map +0 -1
- package/dist/utils/KeyboardAware/lib/KeyboardAwareInterface.d.ts +0 -7
- package/dist/utils/KeyboardAware/lib/KeyboardAwareInterface.js +0 -4
- package/dist/utils/KeyboardAware/lib/KeyboardAwareInterface.js.map +0 -1
- package/dist/utils/KeyboardAware/lib/KeyboardAwareScrollView.d.ts +0 -3
- package/dist/utils/KeyboardAware/lib/KeyboardAwareScrollView.js +0 -10
- package/dist/utils/KeyboardAware/lib/KeyboardAwareScrollView.js.map +0 -1
- package/dist/utils/KeyboardAware/lib/KeyboardAwareSectionList.d.ts +0 -3
- package/dist/utils/KeyboardAware/lib/KeyboardAwareSectionList.js +0 -10
- package/dist/utils/KeyboardAware/lib/KeyboardAwareSectionList.js.map +0 -1
- package/dist/utils/KeyboardAware/types.d.ts +0 -1
- package/dist/utils/KeyboardAware/types.js +0 -7
- package/dist/utils/KeyboardAware/types.js.map +0 -1
- package/dist/utils/ModalManager/components.d.ts +0 -20
- package/dist/utils/ModalManager/components.js +0 -114
- package/dist/utils/ModalManager/components.js.map +0 -1
- package/dist/utils/ModalManager/context.d.ts +0 -48
- package/dist/utils/ModalManager/context.js +0 -201
- package/dist/utils/ModalManager/context.js.map +0 -1
- package/dist/utils/ModalManager/index.d.ts +0 -11
- package/dist/utils/ModalManager/index.js +0 -13
- package/dist/utils/ModalManager/index.js.map +0 -1
- package/dist/utils/OSAlert.d.ts +0 -32
- package/dist/utils/OSAlert.js +0 -143
- package/dist/utils/OSAlert.js.map +0 -1
- package/dist/utils/PermissionManager/context.d.ts +0 -53
- package/dist/utils/PermissionManager/context.js +0 -320
- package/dist/utils/PermissionManager/context.js.map +0 -1
- package/dist/utils/PermissionManager/index.d.ts +0 -4
- package/dist/utils/PermissionManager/index.js +0 -9
- package/dist/utils/PermissionManager/index.js.map +0 -1
- package/dist/utils/PermissionManager/types.d.ts +0 -13
- package/dist/utils/PermissionManager/types.js +0 -3
- package/dist/utils/PermissionManager/types.js.map +0 -1
- package/dist/utils/hooks.d.ts +0 -61
- package/dist/utils/hooks.js +0 -233
- package/dist/utils/hooks.js.map +0 -1
- package/dist/utils/index.d.ts +0 -10
- package/dist/utils/index.js +0 -36
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/input.d.ts +0 -35
- package/dist/utils/input.js +0 -49
- package/dist/utils/input.js.map +0 -1
- package/dist/utils/misc.d.ts +0 -6
- package/dist/utils/misc.js +0 -87
- package/dist/utils/misc.js.map +0 -1
- package/dist/utils/notifications.d.ts +0 -34
- package/dist/utils/notifications.js +0 -268
- package/dist/utils/notifications.js.map +0 -1
- package/dist/utils/theme.d.ts +0 -42
- package/dist/utils/theme.js +0 -50
- package/dist/utils/theme.js.map +0 -1
- package/src/components/Animated.tsx +0 -34
- package/src/components/AutoComplete/index.tsx +0 -167
- package/src/components/AutoComplete/styles.ts +0 -150
- package/src/components/MultiSelect/index.tsx +0 -148
- package/src/components/MultiSelect/styles.ts +0 -131
- package/src/components/MultiSelect/types.ts +0 -51
- package/src/components/Slider/Mark.tsx +0 -46
- package/src/components/Slider/Thumb.tsx +0 -29
- package/src/modules/textInputMask.ts +0 -11
- package/src/utils/KeyboardAware/lib/KeyboardAwareFlatList.ts +0 -4
- package/src/utils/KeyboardAware/lib/KeyboardAwareHOC.tsx +0 -592
- package/src/utils/KeyboardAware/lib/KeyboardAwareInterface.ts +0 -13
- package/src/utils/KeyboardAware/lib/KeyboardAwareScrollView.ts +0 -6
- package/src/utils/KeyboardAware/lib/KeyboardAwareSectionList.ts +0 -6
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { TypeGuards, createDefaultVariantFactory, getRenderedComponent, includePresets, useDefaultComponentStyle, useMemo, useNestedStylesByKey } from "@codeleap/common"
|
|
2
|
+
import { ActionIconComposition, ActionIconParts } from "../ActionIcon"
|
|
3
|
+
import { InputBaseProps } from "./types"
|
|
4
|
+
import { StyleSheet } from "react-native"
|
|
5
|
+
|
|
6
|
+
type InputIcons = 'icon' | 'leftIcon' | 'rightIcon'
|
|
7
|
+
|
|
8
|
+
type IconParts = ActionIconParts
|
|
9
|
+
|
|
10
|
+
export type InputIconComposition = `${InputIcons}${Capitalize<IconParts>}`
|
|
11
|
+
|
|
12
|
+
export type InputBaseStates = 'error' | 'focus' | 'disabled'
|
|
13
|
+
|
|
14
|
+
export type InputBaseParts =
|
|
15
|
+
'wrapper' |
|
|
16
|
+
'innerWrapper' |
|
|
17
|
+
'label' |
|
|
18
|
+
'errorMessage' |
|
|
19
|
+
'description' |
|
|
20
|
+
'labelRow'|
|
|
21
|
+
InputIconComposition
|
|
22
|
+
|
|
23
|
+
export type IconLessInputBaseParts = Exclude<InputBaseParts, InputIconComposition>
|
|
24
|
+
|
|
25
|
+
export type InputBaseComposition = `${InputBaseParts}:${InputBaseStates}` | InputBaseParts
|
|
26
|
+
|
|
27
|
+
const createTextInputBaseComposition = createDefaultVariantFactory<InputBaseComposition>()
|
|
28
|
+
|
|
29
|
+
export const InputBasePresets = includePresets((styles) => createTextInputBaseComposition(() => ({ wrapper: styles })))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
const getIconStyles = (obj, state) => {
|
|
33
|
+
return {
|
|
34
|
+
icon: [
|
|
35
|
+
obj.icon,
|
|
36
|
+
state.focused && obj['icon:focus'],
|
|
37
|
+
state.hasError && obj['icon:error'],
|
|
38
|
+
state.disabled && obj['icon:disabled']
|
|
39
|
+
],
|
|
40
|
+
touchableWrapper: [
|
|
41
|
+
obj.touchableWrapper,
|
|
42
|
+
state.focused && obj['touchableWrapper:focus'],
|
|
43
|
+
state.hasError && obj['touchableWrapper:error'],
|
|
44
|
+
state.disabled && obj['touchableWrapper:disabled']
|
|
45
|
+
],
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export const useInputBaseStyles = (props: InputBaseProps) => {
|
|
51
|
+
const {
|
|
52
|
+
focused,
|
|
53
|
+
disabled,
|
|
54
|
+
error,
|
|
55
|
+
styles
|
|
56
|
+
} = props
|
|
57
|
+
|
|
58
|
+
const hasError = !TypeGuards.isNil(error)
|
|
59
|
+
|
|
60
|
+
const variantStyles = useDefaultComponentStyle<'u:InputBase', typeof InputBasePresets>('u:InputBase', {
|
|
61
|
+
styles,
|
|
62
|
+
transform: StyleSheet.flatten,
|
|
63
|
+
rootElement: 'wrapper'
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
const _leftIconStyles = useNestedStylesByKey<ActionIconComposition>('leftIcon', variantStyles)
|
|
67
|
+
const _rightIconStyles = useNestedStylesByKey<ActionIconComposition>('rightIcon', variantStyles)
|
|
68
|
+
const _generalIconStyles = useNestedStylesByKey<ActionIconComposition>('icon', variantStyles)
|
|
69
|
+
|
|
70
|
+
const generalIconStyles = getIconStyles(_generalIconStyles, { hasError, disabled })
|
|
71
|
+
|
|
72
|
+
const leftIconStyles = [
|
|
73
|
+
generalIconStyles,
|
|
74
|
+
getIconStyles(_leftIconStyles, { hasError, disabled, focused })
|
|
75
|
+
]
|
|
76
|
+
|
|
77
|
+
const rightIconStyles = [
|
|
78
|
+
generalIconStyles,
|
|
79
|
+
getIconStyles(_rightIconStyles, { hasError, disabled, focused })
|
|
80
|
+
]
|
|
81
|
+
|
|
82
|
+
const labelStyle = [
|
|
83
|
+
variantStyles.label,
|
|
84
|
+
focused && variantStyles['label:focus'],
|
|
85
|
+
hasError && variantStyles['label:error'],
|
|
86
|
+
disabled && variantStyles['label:disabled'],
|
|
87
|
+
|
|
88
|
+
]
|
|
89
|
+
|
|
90
|
+
const errorStyle = [
|
|
91
|
+
variantStyles.errorMessage,
|
|
92
|
+
focused && variantStyles['errorMessage:focus'],
|
|
93
|
+
hasError && variantStyles['errorMessage:error'],
|
|
94
|
+
disabled && variantStyles['errorMessage:disabled'],
|
|
95
|
+
]
|
|
96
|
+
|
|
97
|
+
const descriptionStyle = [
|
|
98
|
+
variantStyles.description,
|
|
99
|
+
focused && variantStyles['description:focus'],
|
|
100
|
+
hasError && variantStyles['description:error'],
|
|
101
|
+
disabled && variantStyles['description:disabled'],
|
|
102
|
+
]
|
|
103
|
+
|
|
104
|
+
const wrapperStyle = [
|
|
105
|
+
variantStyles.wrapper,
|
|
106
|
+
focused && variantStyles['wrapper:focus'],
|
|
107
|
+
error && variantStyles['wrapper:error'],
|
|
108
|
+
disabled && variantStyles['wrapper:disabled'],
|
|
109
|
+
]
|
|
110
|
+
|
|
111
|
+
const innerWrapperStyle = [
|
|
112
|
+
variantStyles.innerWrapper,
|
|
113
|
+
focused && variantStyles['innerWrapper:focus'],
|
|
114
|
+
hasError && variantStyles['innerWrapper:error'],
|
|
115
|
+
disabled && variantStyles['innerWrapper:disabled'],
|
|
116
|
+
]
|
|
117
|
+
|
|
118
|
+
const labelRowStyle = [
|
|
119
|
+
variantStyles.labelRow,
|
|
120
|
+
focused && variantStyles['labelRow:focus'],
|
|
121
|
+
hasError && variantStyles['labelRow:error'],
|
|
122
|
+
disabled && variantStyles['labelRow:disabled'],
|
|
123
|
+
]
|
|
124
|
+
|
|
125
|
+
return {
|
|
126
|
+
wrapperStyle,
|
|
127
|
+
innerWrapperStyle,
|
|
128
|
+
leftIconStyles,
|
|
129
|
+
rightIconStyles,
|
|
130
|
+
labelStyle,
|
|
131
|
+
errorStyle,
|
|
132
|
+
descriptionStyle,
|
|
133
|
+
labelRowStyle
|
|
134
|
+
}
|
|
135
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { PropsOf } from '@codeleap/common'
|
|
2
|
+
import { StylesOf } from '../../types'
|
|
3
|
+
import { InputBaseComposition } from './styles'
|
|
4
|
+
import { ActionIcon } from '../ActionIcon'
|
|
5
|
+
|
|
6
|
+
type ActionIconProps = PropsOf<typeof ActionIcon>
|
|
7
|
+
|
|
8
|
+
type OrderedParts = 'label' | 'description' | 'innerWrapper' | 'error'
|
|
9
|
+
type IconProp = Partial<ActionIconProps> | JSX.Element
|
|
10
|
+
export type InputBaseProps = React.PropsWithChildren<{
|
|
11
|
+
label?: React.ReactNode
|
|
12
|
+
error?: React.ReactNode
|
|
13
|
+
leftIcon?: IconProp
|
|
14
|
+
rightIcon?: IconProp
|
|
15
|
+
wrapper?: React.FC<any>
|
|
16
|
+
wrapperProps?: any
|
|
17
|
+
innerWrapper?: React.FC<any>
|
|
18
|
+
innerWrapperProps?: any
|
|
19
|
+
styles?: StylesOf<InputBaseComposition>
|
|
20
|
+
description?: React.ReactNode
|
|
21
|
+
debugName: string
|
|
22
|
+
focused?: boolean
|
|
23
|
+
disabled?: boolean
|
|
24
|
+
order?: OrderedParts[]
|
|
25
|
+
style?: any
|
|
26
|
+
labelAsRow?: boolean
|
|
27
|
+
hideErrorMessage?: boolean
|
|
28
|
+
}>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { InputBaseProps } from './types'
|
|
2
|
+
|
|
3
|
+
type OmitDiff<T1, T2> = {
|
|
4
|
+
[K in Exclude<keyof T1, keyof T2>]: T1[K]
|
|
5
|
+
} & {
|
|
6
|
+
[K in keyof T2]: T2[K]
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
type InputBaseKey = keyof InputBaseProps
|
|
10
|
+
|
|
11
|
+
export function selectInputBaseProps<T extends InputBaseProps>(props: T): {
|
|
12
|
+
inputBaseProps: InputBaseProps
|
|
13
|
+
others: OmitDiff<T, T>
|
|
14
|
+
} {
|
|
15
|
+
const varList:InputBaseKey[] = [
|
|
16
|
+
'label',
|
|
17
|
+
'style',
|
|
18
|
+
'error',
|
|
19
|
+
'innerWrapper',
|
|
20
|
+
'leftIcon',
|
|
21
|
+
'rightIcon',
|
|
22
|
+
// 'styles',
|
|
23
|
+
'description',
|
|
24
|
+
'wrapper',
|
|
25
|
+
'children',
|
|
26
|
+
'innerWrapperProps',
|
|
27
|
+
'wrapperProps',
|
|
28
|
+
'disabled',
|
|
29
|
+
'hideErrorMessage',
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
const copy = { ...props }
|
|
33
|
+
|
|
34
|
+
const result = varList.reduce((acc, key) => {
|
|
35
|
+
// @ts-ignore
|
|
36
|
+
acc[key] = copy[key]
|
|
37
|
+
|
|
38
|
+
return acc
|
|
39
|
+
}, {} as InputBaseProps)
|
|
40
|
+
|
|
41
|
+
return { inputBaseProps: result, others: copy as OmitDiff<T, T> }
|
|
42
|
+
}
|
|
@@ -2,7 +2,7 @@ import React from 'react'
|
|
|
2
2
|
import { ComponentVariants, FormTypes, useDefaultComponentStyle } from '@codeleap/common'
|
|
3
3
|
import { StylesOf } from '../../types'
|
|
4
4
|
import { View, ViewProps } from '../View'
|
|
5
|
-
import { InputLabelComposition,
|
|
5
|
+
import { InputLabelComposition, InputLabelPresets } from './styles'
|
|
6
6
|
import { Text } from '../Text'
|
|
7
7
|
import { StyleSheet } from 'react-native'
|
|
8
8
|
|
|
@@ -10,13 +10,13 @@ export type InputLabelProps = ViewProps & {
|
|
|
10
10
|
styles?: StylesOf<InputLabelComposition>
|
|
11
11
|
label?: FormTypes.Label
|
|
12
12
|
required?: boolean
|
|
13
|
-
} & ComponentVariants<typeof
|
|
13
|
+
} & ComponentVariants<typeof InputLabelPresets>
|
|
14
14
|
|
|
15
15
|
export * from './styles'
|
|
16
16
|
|
|
17
17
|
export const InputLabel:React.FC<InputLabelProps> = (props) => {
|
|
18
18
|
const { label, required = false, variants = [], styles = {}, style, ...viewProps } = props
|
|
19
|
-
const variantStyles = useDefaultComponentStyle<'u:InputLabel', typeof
|
|
19
|
+
const variantStyles = useDefaultComponentStyle<'u:InputLabel', typeof InputLabelPresets>('u:InputLabel', {
|
|
20
20
|
variants, styles, transform: StyleSheet.flatten,
|
|
21
21
|
})
|
|
22
22
|
|
|
@@ -1,19 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createDefaultVariantFactory, includePresets } from '@codeleap/common'
|
|
2
2
|
|
|
3
3
|
export type InputLabelComposition = 'text' | 'wrapper' | 'asterisk'
|
|
4
4
|
|
|
5
5
|
const createInputLabelStyle = createDefaultVariantFactory<InputLabelComposition>()
|
|
6
6
|
|
|
7
|
-
export const
|
|
8
|
-
default: createInputLabelStyle((theme) => ({
|
|
9
|
-
asterisk: {
|
|
10
|
-
color: theme.colors.negative,
|
|
11
|
-
},
|
|
12
|
-
wrapper: {
|
|
13
|
-
...theme.presets.row,
|
|
14
|
-
},
|
|
15
|
-
text: {
|
|
16
|
-
...assignTextStyle('h5')(theme).text,
|
|
17
|
-
},
|
|
18
|
-
})),
|
|
19
|
-
}
|
|
7
|
+
export const InputLabelPresets = includePresets(style => createInputLabelStyle(() => ({ wrapper: style, text: style })))
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import {
|
|
3
|
-
assignTextStyle,
|
|
4
3
|
ComponentVariants,
|
|
5
4
|
createDefaultVariantFactory,
|
|
6
5
|
getNestedStylesByKey,
|
|
@@ -16,24 +15,8 @@ import { Text } from '../Text'
|
|
|
16
15
|
export type PaginationIndicatorComposition = 'text' | `loader${Capitalize<ActivityIndicatorComposition>}`
|
|
17
16
|
|
|
18
17
|
const createPaginationIndicatorStyle = createDefaultVariantFactory<PaginationIndicatorComposition>()
|
|
19
|
-
|
|
20
|
-
export const
|
|
21
|
-
...presets,
|
|
22
|
-
default: createPaginationIndicatorStyle((theme) => {
|
|
23
|
-
return {
|
|
24
|
-
loaderWrapper: {
|
|
25
|
-
...theme.presets.center,
|
|
26
|
-
...theme.spacing.marginVertical(3),
|
|
27
|
-
},
|
|
28
|
-
text: {
|
|
29
|
-
...assignTextStyle('h4')(theme).text,
|
|
30
|
-
...theme.presets.textCenter,
|
|
31
|
-
...theme.spacing.marginVertical(3),
|
|
32
|
-
...theme.presets.fullWidth,
|
|
33
|
-
},
|
|
34
|
-
}
|
|
35
|
-
}),
|
|
36
|
-
}
|
|
18
|
+
|
|
19
|
+
export const PaginationIndicatorPresets = includePresets((style) => createPaginationIndicatorStyle(() => ({ loaderWrapper: style, text: style })))
|
|
37
20
|
|
|
38
21
|
export type PaginationIndicatorProps = {
|
|
39
22
|
isFetching?: boolean
|
|
@@ -42,14 +25,14 @@ export type PaginationIndicatorProps = {
|
|
|
42
25
|
activityIndicator?: JSX.Element
|
|
43
26
|
styles?: StylesOf<PaginationIndicatorComposition>
|
|
44
27
|
style?: ViewStyle
|
|
45
|
-
} & ComponentVariants<typeof
|
|
28
|
+
} & ComponentVariants<typeof PaginationIndicatorPresets>
|
|
46
29
|
|
|
47
30
|
export const PaginationIndicator = (props: PaginationIndicatorProps) => {
|
|
48
31
|
const { hasMore, isFetching, noMoreItemsText, style, activityIndicator, styles = {}, variants = [] } = props
|
|
49
32
|
|
|
50
33
|
const variantStyles = useDefaultComponentStyle<
|
|
51
34
|
'u:PaginationIndicator',
|
|
52
|
-
typeof
|
|
35
|
+
typeof PaginationIndicatorPresets
|
|
53
36
|
>('u:PaginationIndicator', {
|
|
54
37
|
variants,
|
|
55
38
|
styles,
|
|
@@ -1,31 +1,40 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
2
|
import { forwardRef } from 'react'
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
4
|
useDefaultComponentStyle,
|
|
6
|
-
|
|
7
5
|
ComponentVariants,
|
|
8
6
|
useCallback,
|
|
7
|
+
TypeGuards,
|
|
9
8
|
} from '@codeleap/common'
|
|
10
9
|
|
|
11
|
-
import {
|
|
10
|
+
import { FlatListProps as RNFlatListProps, ListRenderItemInfo, StyleSheet } from 'react-native'
|
|
12
11
|
import { View, ViewProps } from '../View'
|
|
13
12
|
import { EmptyPlaceholder, EmptyPlaceholderProps } from '../EmptyPlaceholder'
|
|
14
|
-
import {
|
|
13
|
+
import { RefreshControl, RefreshControlProps } from '../RefreshControl'
|
|
14
|
+
import { ListComposition, ListPresets } from './styles'
|
|
15
15
|
import { StylesOf } from '../../types'
|
|
16
|
-
|
|
16
|
+
|
|
17
|
+
import { KeyboardAwareFlatList } from 'react-native-keyboard-aware-scroll-view'
|
|
17
18
|
|
|
18
19
|
export type DataboundFlatListPropsTypes = 'data' | 'renderItem' | 'keyExtractor' | 'getItemLayout'
|
|
19
20
|
|
|
21
|
+
export type AugmentedRenderItemInfo<T> = ListRenderItemInfo<T> & {
|
|
22
|
+
isFirst: boolean
|
|
23
|
+
isLast: boolean
|
|
24
|
+
isOnly: boolean
|
|
25
|
+
}
|
|
26
|
+
|
|
20
27
|
export type ReplaceFlatlistProps<P, T> = Omit<P, DataboundFlatListPropsTypes> & {
|
|
21
28
|
data: T[]
|
|
22
29
|
keyExtractor?: (item: T, index: number) => string
|
|
23
|
-
renderItem: (data:
|
|
30
|
+
renderItem: (data: AugmentedRenderItemInfo<T>) => React.ReactElement
|
|
24
31
|
onRefresh?: () => void
|
|
25
32
|
getItemLayout?: ((
|
|
26
33
|
data:T,
|
|
27
34
|
index: number,
|
|
28
|
-
) => { length: number; offset: number; index: number })
|
|
35
|
+
) => { length: number; offset: number; index: number })
|
|
36
|
+
fakeEmpty?: boolean
|
|
37
|
+
loading?: boolean
|
|
29
38
|
}
|
|
30
39
|
|
|
31
40
|
export * from './styles'
|
|
@@ -34,16 +43,23 @@ export * from './PaginationIndicator'
|
|
|
34
43
|
export type FlatListProps<
|
|
35
44
|
T = any[],
|
|
36
45
|
Data = T extends Array<infer D> ? D : never
|
|
37
|
-
> =RNFlatListProps<Data> &
|
|
46
|
+
> = ReplaceFlatlistProps<RNFlatListProps<Data>, Data> &
|
|
38
47
|
Omit<ViewProps, 'variants'> & {
|
|
39
48
|
separators?: boolean
|
|
40
49
|
placeholder?: EmptyPlaceholderProps
|
|
41
|
-
keyboardAware?: GetKeyboardAwarePropsOptions
|
|
42
50
|
styles?: StylesOf<ListComposition>
|
|
43
51
|
refreshControlProps?: Partial<RefreshControlProps>
|
|
44
|
-
|
|
52
|
+
fakeEmpty?: boolean
|
|
53
|
+
loading?: boolean
|
|
54
|
+
} & ComponentVariants<typeof ListPresets>
|
|
55
|
+
|
|
56
|
+
const RenderSeparator = (props: { separatorStyles: ViewProps['style'] }) => {
|
|
57
|
+
return (
|
|
58
|
+
<View style={props.separatorStyles}></View>
|
|
59
|
+
)
|
|
60
|
+
}
|
|
45
61
|
|
|
46
|
-
const ListCP = forwardRef<
|
|
62
|
+
const ListCP = forwardRef<KeyboardAwareFlatList, FlatListProps>(
|
|
47
63
|
(flatListProps, ref) => {
|
|
48
64
|
const {
|
|
49
65
|
variants = [],
|
|
@@ -55,54 +71,76 @@ const ListCP = forwardRef<FlatList, FlatListProps>(
|
|
|
55
71
|
placeholder,
|
|
56
72
|
keyboardAware,
|
|
57
73
|
refreshControlProps = {},
|
|
74
|
+
loading = false,
|
|
75
|
+
fakeEmpty = loading,
|
|
58
76
|
...props
|
|
59
77
|
} = flatListProps
|
|
60
78
|
|
|
61
|
-
const variantStyles = useDefaultComponentStyle<'u:List', typeof
|
|
79
|
+
const variantStyles = useDefaultComponentStyle<'u:List', typeof ListPresets>('u:List', {
|
|
62
80
|
variants,
|
|
63
81
|
styles,
|
|
64
82
|
transform: StyleSheet.flatten,
|
|
65
83
|
|
|
66
84
|
})
|
|
67
85
|
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
<View style={variantStyles.separator}></View>
|
|
71
|
-
)
|
|
72
|
-
}, [])
|
|
73
|
-
|
|
74
|
-
const isEmpty = !props.data || !props.data.length
|
|
75
|
-
const separator = !isEmpty && props?.separators && renderSeparator
|
|
86
|
+
// const isEmpty = !props.data || !props.data.length
|
|
87
|
+
const separator = props?.separators && <RenderSeparator separatorStyles={variantStyles.separator}/>
|
|
76
88
|
|
|
77
|
-
const Component:any = component || FlatList
|
|
78
89
|
const refreshStyles = StyleSheet.flatten([variantStyles.refreshControl, styles.refreshControl])
|
|
79
90
|
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
91
|
+
const renderItem = useCallback((data: ListRenderItemInfo<any>) => {
|
|
92
|
+
if (!props?.renderItem) return null
|
|
93
|
+
const listLength = props?.data?.length || 0
|
|
94
|
+
|
|
95
|
+
const isFirst = data.index === 0
|
|
96
|
+
const isLast = data.index === listLength - 1
|
|
97
|
+
|
|
98
|
+
const isOnly = isFirst && isLast
|
|
99
|
+
|
|
100
|
+
return props?.renderItem({
|
|
101
|
+
...data,
|
|
102
|
+
isFirst,
|
|
103
|
+
isLast,
|
|
104
|
+
isOnly,
|
|
105
|
+
})
|
|
106
|
+
}, [props?.renderItem, props?.data?.length])
|
|
107
|
+
|
|
108
|
+
const isEmpty = !props.data || !props.data.length
|
|
109
|
+
|
|
110
|
+
const _placeholder = {
|
|
111
|
+
...placeholder,
|
|
112
|
+
loading: TypeGuards.isBoolean(placeholder?.loading) ? placeholder.loading : loading,
|
|
96
113
|
}
|
|
97
|
-
|
|
98
|
-
const listProps = keyboard.getKeyboardAwareProps(_listProps, {
|
|
99
|
-
adapt: 'paddingBottom',
|
|
100
|
-
baseStyleProp: 'contentContainerStyle',
|
|
101
|
-
...keyboardAware,
|
|
102
|
-
})
|
|
114
|
+
|
|
103
115
|
return (
|
|
104
|
-
<
|
|
105
|
-
{
|
|
116
|
+
<KeyboardAwareFlatList
|
|
117
|
+
style={[
|
|
118
|
+
variantStyles.wrapper,
|
|
119
|
+
style,
|
|
120
|
+
isEmpty && variantStyles['wrapper:empty'],
|
|
121
|
+
]}
|
|
122
|
+
contentContainerStyle={[
|
|
123
|
+
variantStyles.content,
|
|
124
|
+
isEmpty && variantStyles['content:empty'],
|
|
125
|
+
]}
|
|
126
|
+
// @ts-expect-error React's refs suck
|
|
127
|
+
ItemSeparatorComponent={separator}
|
|
128
|
+
ListHeaderComponentStyle={variantStyles.header}
|
|
129
|
+
|
|
130
|
+
refreshControl={!!onRefresh && (
|
|
131
|
+
<RefreshControl
|
|
132
|
+
refreshing={refreshing}
|
|
133
|
+
onRefresh={onRefresh}
|
|
134
|
+
{...refreshControlProps}
|
|
135
|
+
/>
|
|
136
|
+
)}
|
|
137
|
+
|
|
138
|
+
ListEmptyComponent={<EmptyPlaceholder {..._placeholder}/>}
|
|
139
|
+
{...props}
|
|
140
|
+
data={fakeEmpty ? [] : props.data}
|
|
141
|
+
ref={ ref as React.LegacyRef<KeyboardAwareFlatList> }
|
|
142
|
+
renderItem={renderItem}
|
|
143
|
+
|
|
106
144
|
/>
|
|
107
145
|
)
|
|
108
146
|
},
|
|
@@ -110,5 +148,5 @@ const ListCP = forwardRef<FlatList, FlatListProps>(
|
|
|
110
148
|
|
|
111
149
|
export type ListComponentType = <T extends any[] = any[]>(props: FlatListProps<T>) => React.ReactElement
|
|
112
150
|
|
|
113
|
-
export const List = ListCP as ListComponentType
|
|
151
|
+
export const List = ListCP as unknown as ListComponentType
|
|
114
152
|
|
|
@@ -1,25 +1,13 @@
|
|
|
1
1
|
import { createDefaultVariantFactory, includePresets } from '@codeleap/common'
|
|
2
|
-
import { ScrollComposition
|
|
2
|
+
import { ScrollComposition } from '../Scroll/styles'
|
|
3
3
|
|
|
4
|
-
export type ListComposition = ScrollComposition | 'separator'
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
type ListStates = 'empty' | 'loading'
|
|
6
|
+
|
|
7
|
+
type ListParts = ScrollComposition | 'separator' | 'header' | 'refreshControl'
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
export type ListComposition = `${ListParts}:${ListStates}` | ListParts
|
|
10
|
+
|
|
11
|
+
const createListStyle = createDefaultVariantFactory<ListComposition>()
|
|
9
12
|
|
|
10
|
-
export const
|
|
11
|
-
...presets,
|
|
12
|
-
default: createListStyle((theme) => {
|
|
13
|
-
const defaultStyles = ScrollStyles.default(theme)
|
|
14
|
-
return {
|
|
15
|
-
...defaultStyles,
|
|
16
|
-
separator: {
|
|
17
|
-
width: '100%',
|
|
18
|
-
height: theme.spacing.value(1),
|
|
19
|
-
},
|
|
20
|
-
content: {
|
|
21
|
-
flexGrow: 1,
|
|
22
|
-
},
|
|
23
|
-
}
|
|
24
|
-
}),
|
|
25
|
-
}
|
|
13
|
+
export const ListPresets = includePresets(style => createListStyle(() => ({ content: style })))
|
|
@@ -1,55 +1,55 @@
|
|
|
1
1
|
import React, { useRef } from 'react'
|
|
2
|
-
import { ComponentVariants, getNestedStylesByKey, onUpdate, useDefaultComponentStyle, useMemo } from
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {useStaticAnimationStyles} from '../../utils'
|
|
2
|
+
import { ComponentVariants, getNestedStylesByKey, onUpdate, useDefaultComponentStyle, useMemo } from '@codeleap/common'
|
|
3
|
+
import { StyleSheet } from 'react-native'
|
|
4
|
+
import { StylesOf } from '../../types'
|
|
5
|
+
import { ActivityIndicator } from '../ActivityIndicator'
|
|
6
|
+
import { View } from '../View'
|
|
7
|
+
import { LoadingOverlayComposition, LoadingOverlayPresets } from './styles'
|
|
8
|
+
import { useAnimatedVariantStyles } from '../../utils'
|
|
10
9
|
|
|
11
10
|
export * from './styles'
|
|
12
11
|
|
|
13
12
|
export type LoadingOverlayProps = React.PropsWithChildren<{
|
|
14
|
-
variants?: ComponentVariants<typeof
|
|
13
|
+
variants?: ComponentVariants<typeof LoadingOverlayPresets>['variants']
|
|
15
14
|
styles?: StylesOf<LoadingOverlayComposition>
|
|
16
15
|
visible?: boolean
|
|
17
16
|
} >
|
|
18
17
|
|
|
19
|
-
|
|
20
18
|
export const LoadingOverlay = (props: LoadingOverlayProps) => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
19
|
+
const {
|
|
20
|
+
children,
|
|
21
|
+
styles,
|
|
22
|
+
variants,
|
|
23
|
+
visible,
|
|
24
|
+
} = props
|
|
25
|
+
|
|
26
|
+
const variantStyles = useDefaultComponentStyle<'u:LoadingOverlay', typeof LoadingOverlayPresets>('u:LoadingOverlay', {
|
|
27
|
+
variants,
|
|
28
|
+
rootElement: 'wrapper',
|
|
29
|
+
styles,
|
|
30
|
+
transform: StyleSheet.flatten,
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
const loaderStyles = useMemo(() => getNestedStylesByKey('loader', variantStyles), [variantStyles])
|
|
34
|
+
|
|
35
|
+
const wrapperAnimation = useAnimatedVariantStyles({
|
|
36
|
+
variantStyles,
|
|
37
|
+
animatedProperties: ['wrapper:visible', 'wrapper:hidden'],
|
|
38
|
+
updater: (s) => {
|
|
39
|
+
'worklet'
|
|
40
|
+
return visible ? s['wrapper:visible'] : s['wrapper:hidden']
|
|
41
|
+
},
|
|
42
|
+
transition: variantStyles.transition,
|
|
43
|
+
dependencies: [visible],
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
const transition = useRef(null)
|
|
48
|
+
if (!transition.current) {
|
|
49
|
+
transition.current = JSON.parse(JSON.stringify(variantStyles['wrapper:transition']))
|
|
50
|
+
}
|
|
51
|
+
return <View style={[variantStyles.wrapper, wrapperAnimation]} animated transition={transition.current}>
|
|
52
|
+
<ActivityIndicator styles={loaderStyles}/>
|
|
53
|
+
{children}
|
|
54
|
+
</View>
|
|
55
|
+
}
|
|
@@ -1,32 +1,10 @@
|
|
|
1
|
-
import { createDefaultVariantFactory,
|
|
2
|
-
import { ActivityIndicatorComposition } from
|
|
1
|
+
import { createDefaultVariantFactory, includePresets } from '@codeleap/common'
|
|
2
|
+
import { ActivityIndicatorComposition } from '../ActivityIndicator'
|
|
3
3
|
|
|
4
|
-
type WrapperStates = 'hidden'| 'visible'
|
|
4
|
+
type WrapperStates = 'hidden'| 'visible'
|
|
5
5
|
|
|
6
|
-
export type LoadingOverlayComposition = 'wrapper' | `wrapper:${WrapperStates}` | 'wrapper:transition' | `loader${Capitalize<ActivityIndicatorComposition>}`
|
|
6
|
+
export type LoadingOverlayComposition = 'wrapper' | `wrapper:${WrapperStates}` | 'wrapper:transition' | `loader${Capitalize<ActivityIndicatorComposition>}` | 'transition'
|
|
7
7
|
|
|
8
8
|
const createLoadingOverlayStyle = createDefaultVariantFactory<LoadingOverlayComposition>()
|
|
9
9
|
|
|
10
|
-
export const
|
|
11
|
-
default: createLoadingOverlayStyle(theme => ({
|
|
12
|
-
wrapper: {
|
|
13
|
-
...theme.presets.center,
|
|
14
|
-
...theme.presets.whole,
|
|
15
|
-
...theme.presets.absolute,
|
|
16
|
-
backgroundColor: theme.colors.background
|
|
17
|
-
},
|
|
18
|
-
'wrapper:visible': {
|
|
19
|
-
opacity: 1
|
|
20
|
-
},
|
|
21
|
-
'wrapper:hidden': {
|
|
22
|
-
opacity: 0
|
|
23
|
-
},
|
|
24
|
-
'wrapper:transition': {
|
|
25
|
-
opacity: {
|
|
26
|
-
duration: 900,
|
|
27
|
-
type: 'timing',
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
}))
|
|
32
|
-
}
|
|
10
|
+
export const LoadingOverlayPresets = includePresets((styles) => createLoadingOverlayStyle(() => ({ wrapper: styles })))
|