@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,28 @@
|
|
|
1
|
+
import { ComponentVariants, StylesOf, useDefaultComponentStyle } from '@codeleap/common'
|
|
2
|
+
import { RefreshControl as RNRefreshControl, RefreshControlProps as RNRefreshControlProps } from 'react-native'
|
|
3
|
+
import { RefreshControlComposition, RefreshControlPresets } from './styles'
|
|
4
|
+
|
|
5
|
+
export type RefreshControlProps = {
|
|
6
|
+
styles?: StylesOf<RefreshControlComposition>
|
|
7
|
+
} & RNRefreshControlProps & ComponentVariants<typeof RefreshControlPresets>
|
|
8
|
+
|
|
9
|
+
export const RefreshControl: React.FC<RefreshControlProps> = (props) => {
|
|
10
|
+
const { variants = [], styles } = props
|
|
11
|
+
|
|
12
|
+
const variantStyles = useDefaultComponentStyle<'u:RefreshControl', typeof RefreshControlPresets>('u:RefreshControl', {
|
|
13
|
+
variants,
|
|
14
|
+
styles,
|
|
15
|
+
})
|
|
16
|
+
return (
|
|
17
|
+
<RNRefreshControl
|
|
18
|
+
colors={[variantStyles.loadingAnimation?.color]}
|
|
19
|
+
tintColor={variantStyles.loadingAnimation?.color}
|
|
20
|
+
progressBackgroundColor={variantStyles.progressBackgroundColor?.color}
|
|
21
|
+
titleColor={variantStyles.titleColor?.color}
|
|
22
|
+
{...props}
|
|
23
|
+
/>
|
|
24
|
+
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export * from './styles'
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createDefaultVariantFactory, includePresets } from '@codeleap/common'
|
|
2
|
+
|
|
3
|
+
export type RefreshControlComposition = 'loadingAnimation' |'progressBackgroundColor' | 'titleColor'
|
|
4
|
+
|
|
5
|
+
const createRefreshControlStyle = createDefaultVariantFactory<RefreshControlComposition>()
|
|
6
|
+
|
|
7
|
+
export const RefreshControlPresets = includePresets(style => createRefreshControlStyle(() => ({ loadingAnimation: style })))
|
|
@@ -6,15 +6,14 @@ import {
|
|
|
6
6
|
useDefaultComponentStyle,
|
|
7
7
|
usePrevious,
|
|
8
8
|
} from '@codeleap/common'
|
|
9
|
-
|
|
10
|
-
import {
|
|
9
|
+
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view'
|
|
10
|
+
import { ScrollView, StyleSheet } from 'react-native'
|
|
11
11
|
import { ViewProps } from '../View'
|
|
12
|
+
import { RefreshControl, RefreshControlProps } from '../RefreshControl'
|
|
12
13
|
import { KeyboardAwareScrollViewTypes } from '../../modules'
|
|
13
14
|
import { StylesOf } from '../../types'
|
|
14
|
-
import { ScrollComposition,
|
|
15
|
-
import { GetKeyboardAwarePropsOptions
|
|
16
|
-
import { ScrollView as MotiScrollView } from 'moti'
|
|
17
|
-
// import { KeyboardAwareScrollView } from '../../utils'
|
|
15
|
+
import { ScrollComposition, ScrollPresets } from './styles'
|
|
16
|
+
import { GetKeyboardAwarePropsOptions } from '../../utils'
|
|
18
17
|
|
|
19
18
|
type KeyboardAwareScrollViewProps = KeyboardAwareScrollViewTypes.KeyboardAwareScrollViewProps
|
|
20
19
|
|
|
@@ -75,46 +74,32 @@ export const Scroll = forwardRef<ScrollView, ScrollProps>(
|
|
|
75
74
|
}
|
|
76
75
|
}, [refreshingDisplay, changeData])
|
|
77
76
|
|
|
78
|
-
const variantStyles = useDefaultComponentStyle<'u:Scroll', typeof
|
|
77
|
+
const variantStyles = useDefaultComponentStyle<'u:Scroll', typeof ScrollPresets>('u:Scroll', {
|
|
79
78
|
variants,
|
|
80
79
|
styles,
|
|
81
80
|
transform: StyleSheet.flatten,
|
|
82
81
|
rootElement: 'content',
|
|
83
82
|
})
|
|
84
83
|
|
|
85
|
-
const
|
|
86
|
-
const _scrollProps = {
|
|
87
|
-
style: [variantStyles.wrapper, style],
|
|
88
|
-
contentContainerStyle: [variantStyles.content, contentContainerStyle],
|
|
89
|
-
ref: ref as unknown as ScrollView,
|
|
90
|
-
refreshControl: hasRefresh && (
|
|
91
|
-
<RefreshControl
|
|
92
|
-
refreshing={refreshingDisplay}
|
|
93
|
-
onRefresh={onRefresh}
|
|
94
|
-
tintColor={refreshStyles?.color}
|
|
95
|
-
colors={[refreshStyles?.color]}
|
|
96
|
-
{...refreshControlProps}
|
|
97
|
-
/>
|
|
98
|
-
),
|
|
99
|
-
...props,
|
|
100
|
-
}
|
|
101
|
-
const keyboard = useKeyboardAwareView({
|
|
102
|
-
debugName,
|
|
103
|
-
})
|
|
104
|
-
|
|
105
|
-
const rootProps = keyboard.getKeyboardAwareProps(_scrollProps, {
|
|
106
|
-
adapt: 'marginBottom',
|
|
107
|
-
baseStyleProp: 'style',
|
|
108
|
-
animated,
|
|
109
|
-
...keyboardAware,
|
|
110
|
-
|
|
111
|
-
})
|
|
112
|
-
const Component = (animated ? MotiScrollView : ScrollView ) as unknown as typeof ScrollView
|
|
84
|
+
const Component = (animated ? KeyboardAwareScrollView : KeyboardAwareScrollView) as unknown as typeof ScrollView
|
|
113
85
|
|
|
114
86
|
return (
|
|
115
87
|
<Component
|
|
116
|
-
{
|
|
117
|
-
|
|
88
|
+
style={[variantStyles.wrapper, style]}
|
|
89
|
+
contentContainerStyle={[variantStyles.content, contentContainerStyle]}
|
|
90
|
+
showsVerticalScrollIndicator={false}
|
|
91
|
+
// @ts-expect-error - Refs suck
|
|
92
|
+
ref={ref}
|
|
93
|
+
refreshControl= {
|
|
94
|
+
hasRefresh && (
|
|
95
|
+
<RefreshControl
|
|
96
|
+
refreshing={refreshingDisplay}
|
|
97
|
+
onRefresh={onRefresh}
|
|
98
|
+
{...refreshControlProps}
|
|
99
|
+
/>
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
{...props}
|
|
118
103
|
>
|
|
119
104
|
{children}
|
|
120
105
|
</Component>
|
|
@@ -1,21 +1,7 @@
|
|
|
1
1
|
import { createDefaultVariantFactory, includePresets } from '@codeleap/common'
|
|
2
2
|
|
|
3
|
-
export type ScrollComposition = 'wrapper' |'content'
|
|
3
|
+
export type ScrollComposition = 'wrapper' |'content'
|
|
4
4
|
|
|
5
5
|
const createScrollStyle = createDefaultVariantFactory<ScrollComposition>()
|
|
6
6
|
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
export const ScrollStyles = {
|
|
10
|
-
...presets,
|
|
11
|
-
default: createScrollStyle((theme) => {
|
|
12
|
-
return {
|
|
13
|
-
wrapper: {
|
|
14
|
-
...theme.presets.fullHeight,
|
|
15
|
-
},
|
|
16
|
-
refreshControl: {
|
|
17
|
-
color: theme.colors.primary,
|
|
18
|
-
},
|
|
19
|
-
}
|
|
20
|
-
}),
|
|
21
|
-
}
|
|
7
|
+
export const ScrollPresets = includePresets(style => createScrollStyle(() => ({ content: style })))
|
|
@@ -1,90 +1,152 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
|
-
import { forwardRef
|
|
2
|
+
import { forwardRef } from 'react'
|
|
3
3
|
import {
|
|
4
|
-
deepEqual,
|
|
5
|
-
onUpdate,
|
|
6
4
|
useDefaultComponentStyle,
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
ComponentVariants,
|
|
6
|
+
useCallback,
|
|
9
7
|
} from '@codeleap/common'
|
|
10
8
|
|
|
11
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
RefreshControl,
|
|
11
|
+
StyleSheet,
|
|
12
|
+
RefreshControlProps,
|
|
13
|
+
SectionListRenderItemInfo,
|
|
14
|
+
SectionListProps as RNSectionListProps,
|
|
15
|
+
} from 'react-native'
|
|
12
16
|
import { View, ViewProps } from '../View'
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
import { EmptyPlaceholderProps } from '../EmptyPlaceholder'
|
|
18
|
+
import { StylesOf } from '../../types'
|
|
19
|
+
import { KeyboardAwareSectionList } from 'react-native-keyboard-aware-scroll-view'
|
|
20
|
+
import { SectionsComposition, SectionsPresets } from './styles'
|
|
21
|
+
export * from './styles'
|
|
22
|
+
|
|
23
|
+
export type DataboundSectionListPropsTypes = 'data' | 'renderItem' | 'keyExtractor' | 'getItemLayout'
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
export type AugmentedSectionRenderItemInfo<T> = SectionListRenderItemInfo<T> & {
|
|
27
|
+
isFirst: boolean
|
|
28
|
+
isLast: boolean
|
|
29
|
+
isOnly: boolean
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export type ReplaceSectionListProps<P, T> = Omit<P, DataboundSectionListPropsTypes> & {
|
|
33
|
+
sections: T[]
|
|
34
|
+
keyExtractor?: (item: T, index: number) => string
|
|
35
|
+
renderItem: (data: AugmentedSectionRenderItemInfo<T>) => React.ReactElement
|
|
36
|
+
onRefresh?: () => void
|
|
37
|
+
getItemLayout?: ((
|
|
38
|
+
data:T,
|
|
39
|
+
index: number,
|
|
40
|
+
) => { length: number; offset: number; index: number })
|
|
41
|
+
fakeEmpty?: boolean
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export * from './styles'
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
export type SectionListProps<
|
|
48
|
+
T = any[],
|
|
49
|
+
Data = T extends Array<infer D> ? D : never
|
|
50
|
+
> = ReplaceSectionListProps<RNSectionListProps<Data>, Data> &
|
|
51
|
+
Omit<ViewProps, 'variants'> & {
|
|
21
52
|
separators?: boolean
|
|
22
|
-
|
|
53
|
+
placeholder?: EmptyPlaceholderProps
|
|
54
|
+
styles?: StylesOf<SectionsComposition>
|
|
55
|
+
refreshControlProps?: Partial<RefreshControlProps>
|
|
56
|
+
fakeEmpty?: boolean
|
|
57
|
+
} & ComponentVariants<typeof SectionsPresets>
|
|
23
58
|
|
|
24
|
-
|
|
25
|
-
|
|
59
|
+
|
|
60
|
+
export const Sections = forwardRef<KeyboardAwareSectionList, SectionListProps>(
|
|
61
|
+
(sectionsProps, ref) => {
|
|
26
62
|
const {
|
|
27
63
|
variants = [],
|
|
28
64
|
style,
|
|
29
|
-
|
|
30
|
-
|
|
65
|
+
styles = {},
|
|
66
|
+
onRefresh,
|
|
67
|
+
component,
|
|
68
|
+
refreshing,
|
|
69
|
+
placeholder,
|
|
70
|
+
keyboardAware,
|
|
71
|
+
refreshControlProps = {},
|
|
72
|
+
fakeEmpty,
|
|
73
|
+
refreshControl,
|
|
31
74
|
...props
|
|
32
|
-
} =
|
|
33
|
-
const hasRefresh = !!props.onRefresh
|
|
34
|
-
const [refreshing, setRefreshing] = useState(false)
|
|
75
|
+
} = sectionsProps
|
|
35
76
|
|
|
36
|
-
const
|
|
37
|
-
|
|
77
|
+
const variantStyles = useDefaultComponentStyle<'u:Sections', typeof SectionsPresets>('u:Sections', {
|
|
78
|
+
variants,
|
|
79
|
+
styles,
|
|
80
|
+
transform: StyleSheet.flatten,
|
|
38
81
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
const renderSeparator = () => {
|
|
85
|
+
return (
|
|
86
|
+
<View style={variantStyles.separator}></View>
|
|
87
|
+
)
|
|
88
|
+
}
|
|
43
89
|
|
|
44
|
-
|
|
90
|
+
const getItemPosition = (section, itemIdx) => {
|
|
91
|
+
const listLength = section?.length || 0
|
|
45
92
|
|
|
46
|
-
|
|
93
|
+
const isFirst = itemIdx === 0
|
|
94
|
+
const isLast = itemIdx === listLength - 1
|
|
95
|
+
const isOnly = isFirst && isLast
|
|
47
96
|
|
|
48
|
-
|
|
49
|
-
setRefreshing(false)
|
|
50
|
-
}, refreshTimeout)
|
|
97
|
+
return { isFirst, isLast, isOnly }
|
|
51
98
|
}
|
|
52
|
-
onUpdate(() => {
|
|
53
|
-
if (refreshing && !deepEqual(previousData, changeData)) {
|
|
54
|
-
setRefreshing(false)
|
|
55
|
-
if (timer.current) {
|
|
56
|
-
clearTimeout(timer.current)
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}, [refreshing, changeData])
|
|
60
|
-
const { Theme } = useCodeleapContext()
|
|
61
99
|
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
})
|
|
100
|
+
const getSectionPosition = (data) => {
|
|
101
|
+
const listLength = props.sections?.length || 0
|
|
65
102
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
103
|
+
const isFirst = data.section.key === props.sections[0].key
|
|
104
|
+
const isLast = data.section.key === props.sections[listLength - 1].key
|
|
105
|
+
const isOnly = isFirst && isLast
|
|
106
|
+
|
|
107
|
+
return { isFirst, isLast, isOnly }
|
|
70
108
|
}
|
|
71
109
|
|
|
110
|
+
const renderSectionHeader = useCallback((data) => {
|
|
111
|
+
if (!props?.renderSectionHeader) return null
|
|
112
|
+
|
|
113
|
+
return props?.renderSectionHeader({ ...data, ...getSectionPosition(data) })
|
|
114
|
+
}, [props?.renderSectionHeader, props?.sections?.length])
|
|
115
|
+
|
|
116
|
+
const renderSectionFooter = useCallback((data) => {
|
|
117
|
+
if (!props?.renderSectionFooter) return null
|
|
118
|
+
|
|
119
|
+
return props?.renderSectionFooter({ ...data, ...getSectionPosition(data) })
|
|
120
|
+
}, [props?.renderSectionFooter, props?.sections?.length])
|
|
121
|
+
|
|
122
|
+
const renderItem = useCallback((data) => {
|
|
123
|
+
if (!props?.renderItem) return null
|
|
124
|
+
|
|
125
|
+
return props?.renderItem({ ...data, ...getItemPosition(data.section?.data, data?.index) })
|
|
126
|
+
|
|
127
|
+
}, [props?.renderItem, props?.sections?.length])
|
|
128
|
+
|
|
72
129
|
const separatorProp = props.separators
|
|
73
|
-
const isEmpty = !props.
|
|
130
|
+
const isEmpty = !props.sections || !props.sections.length
|
|
74
131
|
const separator = !isEmpty && separatorProp == true && renderSeparator
|
|
75
132
|
|
|
76
133
|
return (
|
|
77
134
|
<KeyboardAwareSectionList
|
|
78
|
-
style={[
|
|
79
|
-
contentContainerStyle={[variantStyles.
|
|
80
|
-
|
|
135
|
+
style={[variantStyles.wrapper,style]}
|
|
136
|
+
contentContainerStyle={[variantStyles.content]}
|
|
137
|
+
showsVerticalScrollIndicator={false}
|
|
138
|
+
// @ts-ignore
|
|
139
|
+
ref={ref}
|
|
81
140
|
ItemSeparatorComponent={separator}
|
|
82
141
|
{...props}
|
|
83
142
|
refreshControl={
|
|
84
|
-
|
|
143
|
+
!!onRefresh && (
|
|
85
144
|
<RefreshControl refreshing={refreshing} onRefresh={onRefresh} />
|
|
86
145
|
)
|
|
87
146
|
}
|
|
147
|
+
renderItem={renderItem}
|
|
148
|
+
renderSectionHeader={renderSectionHeader}
|
|
149
|
+
renderSectionFooter={renderSectionFooter}
|
|
88
150
|
/>
|
|
89
151
|
)
|
|
90
152
|
},
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createDefaultVariantFactory, includePresets } from '@codeleap/common'
|
|
2
|
+
|
|
3
|
+
export type SectionsComposition = 'wrapper' |'content' | 'separator'
|
|
4
|
+
|
|
5
|
+
const createSectionsStyle = createDefaultVariantFactory<SectionsComposition>()
|
|
6
|
+
|
|
7
|
+
export const SectionsPresets = includePresets(style => createSectionsStyle(() => ({ content: style })))
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { IconPlaceholder, PropsOf } from '@codeleap/common'
|
|
3
|
+
import { StylesOf } from '../../types'
|
|
4
|
+
import { Text } from '../Text'
|
|
5
|
+
import { Touchable } from '../Touchable'
|
|
6
|
+
import { Gap, View } from '../View'
|
|
7
|
+
import { SegmentedControlComposition } from './styles'
|
|
8
|
+
import { Icon } from '../Icon'
|
|
9
|
+
|
|
10
|
+
export type SegmentedControlOptionProps = PropsOf<typeof Touchable> & {
|
|
11
|
+
selected?: boolean
|
|
12
|
+
label: string
|
|
13
|
+
value: string
|
|
14
|
+
variantStyles?: StylesOf<SegmentedControlComposition>
|
|
15
|
+
textProps?: Omit<PropsOf<typeof Text>, 'key'>
|
|
16
|
+
icon?: IconPlaceholder
|
|
17
|
+
badge?: React.ReactNode
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const SegmentedControlOption = (props: SegmentedControlOptionProps) => {
|
|
21
|
+
const { selected, onPress, debugName, style, variantStyles, label, value, icon, textProps, badge = null, ...touchableProps } = props
|
|
22
|
+
|
|
23
|
+
return <Touchable
|
|
24
|
+
debugName={`Segmented Control ${debugName}, option ${label}`}
|
|
25
|
+
noFeedback={selected}
|
|
26
|
+
key={touchableProps.key}
|
|
27
|
+
styles={{
|
|
28
|
+
feedback: variantStyles.buttonFeedback,
|
|
29
|
+
}}
|
|
30
|
+
style={[variantStyles.button, selected && variantStyles['button:selected'], style]}
|
|
31
|
+
onPress={onPress}
|
|
32
|
+
>
|
|
33
|
+
{
|
|
34
|
+
!!icon && (
|
|
35
|
+
<Icon name={icon} style={[variantStyles.icon]} />
|
|
36
|
+
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
<Text
|
|
40
|
+
text={label}
|
|
41
|
+
style={[
|
|
42
|
+
variantStyles.text,
|
|
43
|
+
selected && variantStyles['text:selected'],
|
|
44
|
+
touchableProps?.disabled && variantStyles['text:disabled'],
|
|
45
|
+
]}
|
|
46
|
+
{...textProps}
|
|
47
|
+
/>
|
|
48
|
+
{ badge }
|
|
49
|
+
|
|
50
|
+
</Touchable>
|
|
51
|
+
}
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import React, { ReactElement, useImperativeHandle, useMemo, useRef } from 'react'
|
|
2
2
|
import { Scroll, ScrollProps } from '../Scroll'
|
|
3
3
|
|
|
4
|
-
import { Easing,
|
|
5
|
-
import { FormTypes, getNestedStylesByKey, PropsOf, useCodeleapContext, useDefaultComponentStyle } from '@codeleap/common'
|
|
6
|
-
import { SegmentedControlComposition,
|
|
4
|
+
import { Easing, StyleSheet } from 'react-native'
|
|
5
|
+
import { FormTypes, getNestedStylesByKey, PropsOf, TypeGuards, useCodeleapContext, useDefaultComponentStyle } from '@codeleap/common'
|
|
6
|
+
import { SegmentedControlComposition, SegmentedControlPresets } from './styles'
|
|
7
7
|
import { Touchable } from '../Touchable'
|
|
8
8
|
import { StylesOf } from '../../types/utility'
|
|
9
|
-
import { Text
|
|
9
|
+
import { Text } from '../Text'
|
|
10
10
|
import { KeyboardAwareScrollViewTypes } from '../../modules'
|
|
11
11
|
import { View } from '../View'
|
|
12
12
|
import { InputLabel } from '../InputLabel'
|
|
13
|
+
import { useAnimatedVariantStyles, TransitionConfig } from '../../utils'
|
|
14
|
+
import { SegmentedControlOption } from './Option'
|
|
15
|
+
import { IconPlaceholder } from '@codeleap/common'
|
|
16
|
+
import { Badge, BadgeProps } from '../Badge'
|
|
13
17
|
|
|
14
18
|
export * from './styles'
|
|
15
19
|
export type SegmentedControlRef =KeyboardAwareScrollViewTypes.KeyboardAwareScrollView & {
|
|
@@ -17,15 +21,14 @@ export type SegmentedControlRef =KeyboardAwareScrollViewTypes.KeyboardAwareScrol
|
|
|
17
21
|
scrollToCurrent: () => void
|
|
18
22
|
}
|
|
19
23
|
|
|
24
|
+
type SegmentedContropOptions<T = string> = {label: string; value: T; icon?: IconPlaceholder; badge?: BadgeProps['badge']}
|
|
25
|
+
|
|
20
26
|
export type SegmentedControlProps<T = string> = ScrollProps & {
|
|
21
|
-
options :
|
|
27
|
+
options : SegmentedContropOptions[]
|
|
22
28
|
onValueChange: (value: T) => any
|
|
23
29
|
value: T
|
|
24
30
|
debugName: string
|
|
25
|
-
animation?:
|
|
26
|
-
duration?: number
|
|
27
|
-
easing?: EasingFunction
|
|
28
|
-
}
|
|
31
|
+
animation?: TransitionConfig
|
|
29
32
|
textProps?: Partial<PropsOf<typeof Text>>
|
|
30
33
|
touchableProps?: Partial<PropsOf<typeof Touchable>>
|
|
31
34
|
styles?: StylesOf<SegmentedControlComposition>
|
|
@@ -34,10 +37,11 @@ export type SegmentedControlProps<T = string> = ScrollProps & {
|
|
|
34
37
|
RenderButton?: (props: SegmentedControlProps & {
|
|
35
38
|
touchableProps: PropsOf<typeof Touchable>
|
|
36
39
|
textProps: PropsOf<typeof Text>
|
|
37
|
-
option:
|
|
40
|
+
option: SegmentedContropOptions
|
|
38
41
|
}) => ReactElement
|
|
39
42
|
RenderAnimatedView?: (props: Partial<SegmentedControlProps>) => ReactElement
|
|
40
|
-
getItemWidth?: (item:
|
|
43
|
+
getItemWidth?: (item: SegmentedContropOptions, idx: number, arr: SegmentedContropOptions[]) => number
|
|
44
|
+
badgeProps?: Partial<BadgeProps>
|
|
41
45
|
}
|
|
42
46
|
|
|
43
47
|
const defaultAnimation = {
|
|
@@ -63,13 +67,14 @@ const _SegmentedControl = React.forwardRef<SegmentedControlRef, SegmentedControl
|
|
|
63
67
|
getItemWidth = (i) => (Theme.values.width - Theme.spacing.value(4)) / options.length,
|
|
64
68
|
RenderAnimatedView,
|
|
65
69
|
RenderButton,
|
|
70
|
+
badgeProps = {},
|
|
66
71
|
} = props
|
|
67
72
|
|
|
68
|
-
|
|
73
|
+
const _animation = {
|
|
69
74
|
...defaultAnimation, ...animation,
|
|
70
75
|
}
|
|
71
76
|
|
|
72
|
-
let variantStyles = useDefaultComponentStyle<'u:SegmentedControl', typeof
|
|
77
|
+
let variantStyles = useDefaultComponentStyle<'u:SegmentedControl', typeof SegmentedControlPresets>('u:SegmentedControl', {
|
|
73
78
|
styles,
|
|
74
79
|
transform: StyleSheet.flatten,
|
|
75
80
|
variants,
|
|
@@ -94,8 +99,6 @@ const _SegmentedControl = React.forwardRef<SegmentedControlRef, SegmentedControl
|
|
|
94
99
|
|
|
95
100
|
const currentOptionIdx = options.findIndex(o => o.value === value) || 0
|
|
96
101
|
|
|
97
|
-
const translateX = widthStyle.width * currentOptionIdx
|
|
98
|
-
|
|
99
102
|
const onPress = (txt:string, idx: number) => {
|
|
100
103
|
return () => {
|
|
101
104
|
onValueChange(txt)
|
|
@@ -123,11 +126,26 @@ const _SegmentedControl = React.forwardRef<SegmentedControlRef, SegmentedControl
|
|
|
123
126
|
hasScrolledInitially.current = true
|
|
124
127
|
}
|
|
125
128
|
|
|
126
|
-
const
|
|
129
|
+
const BubbleView = RenderAnimatedView || View
|
|
127
130
|
variantStyles = JSON.parse(JSON.stringify(variantStyles))
|
|
128
|
-
_animation = JSON.parse(JSON.stringify(_animation))
|
|
129
131
|
|
|
130
132
|
const labelStyles = getNestedStylesByKey('label', variantStyles)
|
|
133
|
+
|
|
134
|
+
const bubbleAnimation = useAnimatedVariantStyles({
|
|
135
|
+
variantStyles,
|
|
136
|
+
animatedProperties: [],
|
|
137
|
+
updater: () => {
|
|
138
|
+
'worklet'
|
|
139
|
+
return {
|
|
140
|
+
translateX: currentOptionIdx * widthStyle.width,
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
transition: _animation,
|
|
144
|
+
dependencies: [currentOptionIdx, widthStyle.width],
|
|
145
|
+
})
|
|
146
|
+
|
|
147
|
+
const badgeStyles = getNestedStylesByKey('badge', variantStyles)
|
|
148
|
+
|
|
131
149
|
return (<View style={variantStyles.wrapper}>
|
|
132
150
|
<InputLabel label={label} styles={labelStyles} required={false}/>
|
|
133
151
|
<Scroll
|
|
@@ -142,61 +160,27 @@ const _SegmentedControl = React.forwardRef<SegmentedControlRef, SegmentedControl
|
|
|
142
160
|
ref={scrollRef}
|
|
143
161
|
>
|
|
144
162
|
<View style={variantStyles.innerWrapper}>
|
|
145
|
-
<
|
|
163
|
+
<BubbleView
|
|
146
164
|
options={options}
|
|
147
165
|
styles={variantStyles}
|
|
148
|
-
|
|
149
166
|
animated
|
|
150
|
-
style={[variantStyles.selectedBubble, widthStyle]}
|
|
151
|
-
animate={{
|
|
152
|
-
translateX,
|
|
153
|
-
}}
|
|
154
|
-
transition={{
|
|
155
|
-
translateX: _animation,
|
|
156
|
-
}}
|
|
167
|
+
style={[variantStyles.selectedBubble, props?.touchableProps?.disabled && variantStyles['selectedBubble:disabled'], widthStyle, bubbleAnimation]}
|
|
157
168
|
|
|
158
169
|
/>
|
|
159
|
-
{options.map((o, idx) =>
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
onPress
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
colorChangeConfig: _animation,
|
|
174
|
-
style: StyleSheet.flatten([variantStyles.text, selected && variantStyles['text:selected']]),
|
|
175
|
-
animated: true,
|
|
176
|
-
...props.textProps,
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
if (RenderButton) {
|
|
180
|
-
return (
|
|
181
|
-
<RenderButton {...props} touchableProps={touchableProps} key={touchableProps.key} textProps={textProps} option={o}/>
|
|
182
|
-
)
|
|
183
|
-
}
|
|
184
|
-
return <Touchable
|
|
185
|
-
{...touchableProps}
|
|
186
|
-
noFeedback={selected}
|
|
187
|
-
key={touchableProps.key}
|
|
188
|
-
styles={{
|
|
189
|
-
feedback: variantStyles.buttonFeedback,
|
|
190
|
-
}}
|
|
191
|
-
>
|
|
192
|
-
<Text
|
|
193
|
-
|
|
194
|
-
{...textProps}
|
|
195
|
-
/>
|
|
196
|
-
|
|
197
|
-
</Touchable>
|
|
198
|
-
|
|
199
|
-
})}
|
|
170
|
+
{options.map((o, idx) => (
|
|
171
|
+
<SegmentedControlOption
|
|
172
|
+
debugName={debugName}
|
|
173
|
+
label={o.label}
|
|
174
|
+
value={o.value}
|
|
175
|
+
icon={o.icon}
|
|
176
|
+
onPress={onPress(o.value, idx)}
|
|
177
|
+
key={idx}
|
|
178
|
+
style={widthStyle}
|
|
179
|
+
selected={value === o.value}
|
|
180
|
+
variantStyles={variantStyles}
|
|
181
|
+
badge={!TypeGuards.isNil(o.badge) ? <Badge badge={o.badge} styles={badgeStyles} {...badgeProps} /> : null}
|
|
182
|
+
/>
|
|
183
|
+
))}
|
|
200
184
|
</View>
|
|
201
185
|
</Scroll>
|
|
202
186
|
</View>
|