@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
|
@@ -2,17 +2,14 @@ import * as React from 'react'
|
|
|
2
2
|
import {
|
|
3
3
|
useDefaultComponentStyle,
|
|
4
4
|
ComponentVariants,
|
|
5
|
-
|
|
6
5
|
IconPlaceholder,
|
|
7
6
|
GetRefType,
|
|
8
|
-
SmartOmit,
|
|
9
7
|
TypeGuards,
|
|
10
|
-
|
|
11
|
-
PropsOf,
|
|
8
|
+
getNestedStylesByKey,
|
|
12
9
|
} from '@codeleap/common'
|
|
13
10
|
|
|
14
11
|
import {
|
|
15
|
-
|
|
12
|
+
ButtonPresets,
|
|
16
13
|
ButtonComposition,
|
|
17
14
|
ButtonParts,
|
|
18
15
|
} from './styles'
|
|
@@ -21,9 +18,10 @@ import { StylesOf } from '../../types/utility'
|
|
|
21
18
|
import { Text } from '../Text'
|
|
22
19
|
import { Touchable, TouchableProps } from '../Touchable'
|
|
23
20
|
import { Icon } from '../Icon'
|
|
24
|
-
import { View, ViewProps } from '../View'
|
|
25
21
|
import { ActivityIndicator } from '../ActivityIndicator'
|
|
26
22
|
import { StyleSheet } from 'react-native'
|
|
23
|
+
import { usePressableFeedback } from '../../utils'
|
|
24
|
+
import { Badge, BadgeComponentProps } from '../Badge'
|
|
27
25
|
export * from './styles'
|
|
28
26
|
|
|
29
27
|
type ChildProps = {
|
|
@@ -31,16 +29,8 @@ type ChildProps = {
|
|
|
31
29
|
props: Omit<ButtonProps, 'children'>
|
|
32
30
|
}
|
|
33
31
|
|
|
34
|
-
type BadgeProps = Partial<ViewProps> & {
|
|
35
|
-
text?: string
|
|
36
|
-
children?: React.ReactElement | ((props: Partial<SmartOmit<BadgeProps, 'children'>>) => React.ReactElement)
|
|
37
|
-
styles?: StylesOf<'text'|'wrapper'>
|
|
38
|
-
position?: [number, number]
|
|
39
|
-
textProps?: Partial<PropsOf<typeof Text>>
|
|
40
|
-
}
|
|
41
|
-
|
|
42
32
|
export type ButtonProps = Omit<TouchableProps, 'variants'> &
|
|
43
|
-
ComponentVariants<typeof
|
|
33
|
+
ComponentVariants<typeof ButtonPresets> & {
|
|
44
34
|
text?: string
|
|
45
35
|
rightIcon?: IconPlaceholder
|
|
46
36
|
icon?: IconPlaceholder
|
|
@@ -48,24 +38,9 @@ export type ButtonProps = Omit<TouchableProps, 'variants'> &
|
|
|
48
38
|
loading?: boolean
|
|
49
39
|
debounce?: number
|
|
50
40
|
debugName: string
|
|
51
|
-
|
|
41
|
+
selected?: boolean
|
|
52
42
|
children?: React.ReactNode | ((props: ChildProps) => React.ReactNode)
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export const Badge = forwardRef<GetRefType<ViewProps['ref']>, BadgeProps>((props, ref) => {
|
|
56
|
-
const {
|
|
57
|
-
children = null,
|
|
58
|
-
styles,
|
|
59
|
-
text,
|
|
60
|
-
textProps = {},
|
|
61
|
-
...viewProps
|
|
62
|
-
} = props
|
|
63
|
-
|
|
64
|
-
return <View style={[styles.wrapper]} {...viewProps} ref={ref}>
|
|
65
|
-
{text && <Text text={text} style={styles.text} {...textProps}/>}
|
|
66
|
-
{(TypeGuards.isFunction(children) ? children({ ...viewProps, styles, text }) : children)}
|
|
67
|
-
</View>
|
|
68
|
-
})
|
|
43
|
+
} & BadgeComponentProps
|
|
69
44
|
|
|
70
45
|
export const Button = forwardRef<GetRefType<TouchableProps['ref']>, ButtonProps>((buttonProps, ref) => {
|
|
71
46
|
const {
|
|
@@ -77,12 +52,14 @@ export const Button = forwardRef<GetRefType<TouchableProps['ref']>, ButtonProps>
|
|
|
77
52
|
styles = {},
|
|
78
53
|
onPress,
|
|
79
54
|
disabled,
|
|
80
|
-
|
|
55
|
+
selected,
|
|
81
56
|
rightIcon,
|
|
82
57
|
style,
|
|
58
|
+
badge = false,
|
|
59
|
+
badgeProps = {},
|
|
83
60
|
...props
|
|
84
61
|
} = buttonProps
|
|
85
|
-
|
|
62
|
+
const [pressed, setPressed] = React.useState(false)
|
|
86
63
|
const variantStyles = useDefaultComponentStyle('u:Button', {
|
|
87
64
|
variants,
|
|
88
65
|
transform: StyleSheet.flatten,
|
|
@@ -95,6 +72,7 @@ export const Button = forwardRef<GetRefType<TouchableProps['ref']>, ButtonProps>
|
|
|
95
72
|
key === 'wrapper' && style,
|
|
96
73
|
disabled && variantStyles[key + ':disabled'],
|
|
97
74
|
styles[key],
|
|
75
|
+
selected && variantStyles[key + ':selected'],
|
|
98
76
|
disabled && styles[key + ':disabled'],
|
|
99
77
|
]
|
|
100
78
|
}
|
|
@@ -104,8 +82,6 @@ export const Button = forwardRef<GetRefType<TouchableProps['ref']>, ButtonProps>
|
|
|
104
82
|
const leftIconStyle = StyleSheet.flatten([iconStyle, getStyles('leftIcon')])
|
|
105
83
|
const rightIconStyle = StyleSheet.flatten([iconStyle, getStyles('rightIcon')])
|
|
106
84
|
|
|
107
|
-
const hasText = !!(text || children)
|
|
108
|
-
|
|
109
85
|
const _styles = {
|
|
110
86
|
wrapper: getStyles('wrapper'),
|
|
111
87
|
loader: getStyles('loader'),
|
|
@@ -116,24 +92,37 @@ export const Button = forwardRef<GetRefType<TouchableProps['ref']>, ButtonProps>
|
|
|
116
92
|
|
|
117
93
|
}
|
|
118
94
|
|
|
95
|
+
const disableFeedback = !onPress || props?.noFeedback
|
|
96
|
+
|
|
97
|
+
const { getFeedbackStyle } = usePressableFeedback(variantStyles.text, {
|
|
98
|
+
hightlightPropertyIn: 'color',
|
|
99
|
+
hightlightPropertyOut: 'color',
|
|
100
|
+
feedbackConfig: variantStyles?.textFeedback,
|
|
101
|
+
disabled: disableFeedback,
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
const { getFeedbackStyle: getFeedbackWrapperStyle } = usePressableFeedback(variantStyles.wrapper, {
|
|
105
|
+
hightlightPropertyIn: 'borderColor',
|
|
106
|
+
hightlightPropertyOut: 'borderColor',
|
|
107
|
+
disabled: disableFeedback,
|
|
108
|
+
feedbackConfig: variantStyles?.wrapperFeedback,
|
|
109
|
+
})
|
|
110
|
+
|
|
119
111
|
const childrenContent = TypeGuards.isFunction(children) ?
|
|
120
112
|
// @ts-ignore
|
|
121
113
|
children({ styles: _styles, props: buttonProps })
|
|
122
114
|
: children
|
|
123
115
|
|
|
124
|
-
|
|
116
|
+
const rightFeedback = getFeedbackStyle(pressed)
|
|
125
117
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
text: variantStyles.badgeText,
|
|
129
|
-
wrapper: variantStyles.badgeWrapper,
|
|
130
|
-
}, badge?.styles || {})}/>
|
|
118
|
+
// TODO - This is a hack to hide the icon when there is no text
|
|
119
|
+
const isLeftIconHidden = _styles?.leftIcon?.display != 'none'
|
|
131
120
|
|
|
132
|
-
|
|
121
|
+
const badgeStyles = getNestedStylesByKey('badge', variantStyles)
|
|
133
122
|
|
|
134
123
|
return (
|
|
135
124
|
<Touchable
|
|
136
|
-
style={_styles.wrapper}
|
|
125
|
+
style={[_styles.wrapper, getFeedbackWrapperStyle(pressed)]}
|
|
137
126
|
ref={ref}
|
|
138
127
|
disabled={disabled}
|
|
139
128
|
styles={{
|
|
@@ -142,14 +131,15 @@ export const Button = forwardRef<GetRefType<TouchableProps['ref']>, ButtonProps>
|
|
|
142
131
|
onPress={onPress}
|
|
143
132
|
debugComponent={'Button'}
|
|
144
133
|
noFeedback={!onPress}
|
|
134
|
+
setPressed={setPressed}
|
|
145
135
|
{...props}
|
|
146
136
|
>
|
|
147
|
-
{
|
|
148
|
-
{loading && <
|
|
149
|
-
{
|
|
150
|
-
{text ? <Text text={text} style={_styles.text} /> : null}
|
|
137
|
+
{loading && <ActivityIndicator style={[_styles.loader, getFeedbackStyle(pressed)]} />}
|
|
138
|
+
{(!loading && isLeftIconHidden) && <Icon name={icon} style={[_styles.leftIcon, getFeedbackStyle(pressed)]} />}
|
|
139
|
+
{text ? <Text text={text} style={[_styles.text, getFeedbackStyle(pressed)]} /> : null}
|
|
151
140
|
{childrenContent}
|
|
152
|
-
<Icon name={rightIcon} style={_styles.rightIcon
|
|
141
|
+
<Icon name={rightIcon} style={[_styles.rightIcon, rightFeedback]} />
|
|
142
|
+
<Badge badge={badge} style={badgeStyles} {...badgeProps} />
|
|
153
143
|
</Touchable>
|
|
154
144
|
)
|
|
155
145
|
})
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { createDefaultVariantFactory, includePresets, StylesOf } from '@codeleap/common'
|
|
2
2
|
import { ActivityIndicatorComposition } from '../ActivityIndicator'
|
|
3
|
+
import { BadgeComposition } from '../Badge'
|
|
3
4
|
import { TouchableStylesGen } from '../Touchable'
|
|
4
5
|
|
|
5
|
-
export type ButtonStates = 'disabled'
|
|
6
|
+
export type ButtonStates = 'disabled' | 'selected'
|
|
6
7
|
export type ButtonParts =
|
|
7
8
|
| 'text'
|
|
8
9
|
| 'inner'
|
|
@@ -12,118 +13,16 @@ export type ButtonParts =
|
|
|
12
13
|
| 'rightIcon'
|
|
13
14
|
| 'loader'
|
|
14
15
|
| `loader${Capitalize<ActivityIndicatorComposition>}`
|
|
15
|
-
|
|
|
16
|
-
| 'badgeWrapper'
|
|
16
|
+
| `badge${Capitalize<BadgeComposition>}`
|
|
17
17
|
|
|
18
18
|
export type ButtonComposition = `${ButtonParts}:${ButtonStates}` | ButtonParts
|
|
19
19
|
|
|
20
20
|
export type ButtonStylesGen<TCSS = any> = StylesOf<ButtonComposition, TCSS> & {
|
|
21
21
|
feedback?: TouchableStylesGen['feedback']
|
|
22
|
+
textFeedback?: TouchableStylesGen['feedback']
|
|
23
|
+
wrapperFeedback?: TouchableStylesGen['feedback']
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
const createButtonStyle = createDefaultVariantFactory<ButtonComposition, ButtonStylesGen >()
|
|
25
27
|
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
export const ButtonStyles = {
|
|
29
|
-
...presets,
|
|
30
|
-
default: createButtonStyle((theme) => ({
|
|
31
|
-
wrapper: {
|
|
32
|
-
|
|
33
|
-
flexDirection: 'row',
|
|
34
|
-
backgroundColor: theme.colors.primary,
|
|
35
|
-
...theme.presets.justifyCenter,
|
|
36
|
-
...theme.presets.alignCenter,
|
|
37
|
-
...theme.spacing.paddingHorizontal(2.5),
|
|
38
|
-
},
|
|
39
|
-
text: {
|
|
40
|
-
textAlign: 'center',
|
|
41
|
-
// ...theme.spacing.marginHorizontal(2.5),
|
|
42
|
-
},
|
|
43
|
-
loader: {
|
|
44
|
-
height: 20,
|
|
45
|
-
width: 20,
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
loaderFrontCircle: {
|
|
49
|
-
borderTopColor: theme.colors.white,
|
|
50
|
-
},
|
|
51
|
-
'wrapper:disabled': {
|
|
52
|
-
backgroundColor: theme.colors.disabled,
|
|
53
|
-
opacity: 0.9,
|
|
54
|
-
cursor: 'auto',
|
|
55
|
-
|
|
56
|
-
},
|
|
57
|
-
badgeWrapper: {
|
|
58
|
-
backgroundColor: theme.colors.negative,
|
|
59
|
-
position: 'absolute',
|
|
60
|
-
...theme.spacing.padding(2.5),
|
|
61
|
-
},
|
|
62
|
-
badgeText: {
|
|
63
|
-
color: theme.colors.white,
|
|
64
|
-
},
|
|
65
|
-
|
|
66
|
-
leftIcon: {
|
|
67
|
-
...theme.sized(4),
|
|
68
|
-
...theme.spacing.marginRight('auto'),
|
|
69
|
-
// ...theme.spacing.marginLeft(2.5),
|
|
70
|
-
},
|
|
71
|
-
rightIcon: {
|
|
72
|
-
...theme.spacing.marginLeft('auto'),
|
|
73
|
-
// ...theme.spacing.marginRight(2.5),
|
|
74
|
-
...theme.sized(4),
|
|
75
|
-
},
|
|
76
|
-
|
|
77
|
-
})),
|
|
78
|
-
negative: createButtonStyle((theme) => ({
|
|
79
|
-
wrapper: {
|
|
80
|
-
backgroundColor: theme.colors.negative,
|
|
81
|
-
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
})),
|
|
85
|
-
|
|
86
|
-
circle: createButtonStyle((theme) => ({
|
|
87
|
-
wrapper: {
|
|
88
|
-
borderRadius: 100,
|
|
89
|
-
...theme.spacing.padding(1),
|
|
90
|
-
},
|
|
91
|
-
})),
|
|
92
|
-
pill: createButtonStyle((theme) => ({
|
|
93
|
-
wrapper: {
|
|
94
|
-
borderRadius: theme.borderRadius.medium,
|
|
95
|
-
...theme.spacing.paddingHorizontal(1),
|
|
96
|
-
...theme.spacing.paddingVertical(0.5),
|
|
97
|
-
},
|
|
98
|
-
})),
|
|
99
|
-
icon: createButtonStyle((theme) => ({
|
|
100
|
-
wrapper: {
|
|
101
|
-
backgroundColor: 'transparent',
|
|
102
|
-
aspectRatio: 1,
|
|
103
|
-
display: 'flex',
|
|
104
|
-
...theme.presets.center,
|
|
105
|
-
...theme.spacing.padding(0),
|
|
106
|
-
|
|
107
|
-
},
|
|
108
|
-
text: {
|
|
109
|
-
flex: 1,
|
|
110
|
-
textAlign: 'center',
|
|
111
|
-
},
|
|
112
|
-
loader: {
|
|
113
|
-
...theme.spacing.margin(0),
|
|
114
|
-
},
|
|
115
|
-
icon: {
|
|
116
|
-
...theme.spacing.margin(0),
|
|
117
|
-
...theme.presets.center,
|
|
118
|
-
height: null,
|
|
119
|
-
width: null,
|
|
120
|
-
color: theme.colors.icon,
|
|
121
|
-
},
|
|
122
|
-
leftIcon: {
|
|
123
|
-
...theme.spacing.marginRight(0),
|
|
124
|
-
},
|
|
125
|
-
rightIcon: {
|
|
126
|
-
...theme.spacing.marginRight(0),
|
|
127
|
-
},
|
|
128
|
-
})),
|
|
129
|
-
}
|
|
28
|
+
export const ButtonPresets = includePresets((styles) => createButtonStyle(() => ({ wrapper: styles })))
|
|
@@ -6,14 +6,14 @@ import { format, formatISO } from 'date-fns'
|
|
|
6
6
|
import { Calendar as RNCalendar, CalendarProps as RNCalendarProps, DateData } from 'react-native-calendars'
|
|
7
7
|
|
|
8
8
|
import { View } from '../View'
|
|
9
|
-
import { CalendarStyles } from './style'
|
|
10
9
|
import { TCalendarStyles } from './types'
|
|
10
|
+
import { CalendarPresets } from './style'
|
|
11
11
|
export type CalendarProps = PropsOf<typeof View> & {
|
|
12
12
|
styles?: TCalendarStyles
|
|
13
13
|
onValueChange?: (date: Date|string) => any
|
|
14
14
|
value?: Date|string
|
|
15
15
|
calendarProps?: RNCalendarProps
|
|
16
|
-
} & ComponentVariants<typeof
|
|
16
|
+
} & ComponentVariants<typeof CalendarPresets>
|
|
17
17
|
export * from './style'
|
|
18
18
|
export * from './types'
|
|
19
19
|
|
|
@@ -27,7 +27,7 @@ export const Calendar = (props:CalendarProps) => {
|
|
|
27
27
|
onValueChange,
|
|
28
28
|
...viewProps
|
|
29
29
|
} = props
|
|
30
|
-
const variantStyles = useDefaultComponentStyle<'u:Calendar', typeof
|
|
30
|
+
const variantStyles = useDefaultComponentStyle<'u:Calendar', typeof CalendarPresets>('u:Calendar', {
|
|
31
31
|
variants,
|
|
32
32
|
styles,
|
|
33
33
|
transform: StyleSheet.flatten,
|
|
@@ -1,35 +1,6 @@
|
|
|
1
|
-
import { createDefaultVariantFactory } from '@codeleap/common'
|
|
1
|
+
import { createDefaultVariantFactory, includePresets } from '@codeleap/common'
|
|
2
2
|
import { TCalendarStyles, CalendarComposition } from './types'
|
|
3
3
|
|
|
4
4
|
const createCalendarStyle = createDefaultVariantFactory<CalendarComposition, TCalendarStyles>()
|
|
5
5
|
|
|
6
|
-
export const
|
|
7
|
-
default: createCalendarStyle((theme) => ({
|
|
8
|
-
theme: {
|
|
9
|
-
backgroundColor: '#0000',
|
|
10
|
-
calendarBackground: '#0000',
|
|
11
|
-
textSectionTitleColor: theme.colors.textH,
|
|
12
|
-
textSectionTitleDisabledColor: theme.colors.disabled,
|
|
13
|
-
selectedDayBackgroundColor: theme.colors.primary,
|
|
14
|
-
selectedDayTextColor: theme.colors.white,
|
|
15
|
-
todayTextColor: theme.colors.textH,
|
|
16
|
-
dayTextColor: theme.colors.textP,
|
|
17
|
-
textDisabledColor: theme.colors.disabled,
|
|
18
|
-
dotColor: theme.colors.primary,
|
|
19
|
-
selectedDotColor: theme.colors.primary,
|
|
20
|
-
arrowColor: theme.colors.primary,
|
|
21
|
-
disabledArrowColor: theme.colors.disabled,
|
|
22
|
-
monthTextColor: theme.colors.textH,
|
|
23
|
-
indicatorColor: theme.colors.backgroundSecondary,
|
|
24
|
-
textDayFontFamily: theme.typography.fontFamily,
|
|
25
|
-
textMonthFontFamily: theme.typography.fontFamily,
|
|
26
|
-
textDayHeaderFontFamily: theme.typography.fontFamily,
|
|
27
|
-
textDayFontWeight: '400',
|
|
28
|
-
textMonthFontWeight: 'bold',
|
|
29
|
-
textDayHeaderFontWeight: '400',
|
|
30
|
-
textDayFontSize: 16,
|
|
31
|
-
textMonthFontSize: 22,
|
|
32
|
-
textDayHeaderFontSize: 15,
|
|
33
|
-
},
|
|
34
|
-
})),
|
|
35
|
-
}
|
|
6
|
+
export const CalendarPresets = includePresets((style) => createCalendarStyle(() => ({ theme: style })))
|
|
@@ -1,91 +1,154 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
2
|
import {
|
|
3
|
+
|
|
3
4
|
ComponentVariants,
|
|
4
5
|
useDefaultComponentStyle,
|
|
5
6
|
StylesOf,
|
|
6
|
-
Form,
|
|
7
|
-
useValidate,
|
|
8
|
-
GetRefType,
|
|
9
7
|
PropsOf,
|
|
8
|
+
IconPlaceholder,
|
|
10
9
|
} from '@codeleap/common'
|
|
11
|
-
import {
|
|
12
|
-
import { StyleSheet
|
|
13
|
-
import { FormError } from '../TextInput'
|
|
10
|
+
import { ReactNode } from 'react'
|
|
11
|
+
import { StyleSheet } from 'react-native'
|
|
14
12
|
import { View } from '../View'
|
|
15
|
-
|
|
13
|
+
|
|
16
14
|
import {
|
|
17
|
-
|
|
15
|
+
CheckboxPresets,
|
|
18
16
|
CheckboxComposition,
|
|
19
17
|
} from './styles'
|
|
20
|
-
import {
|
|
18
|
+
import { InputBase, InputBaseDefaultOrder, InputBaseProps, selectInputBaseProps } from '../InputBase'
|
|
19
|
+
import { useAnimatedVariantStyles } from '../..'
|
|
20
|
+
import { Touchable } from '../Touchable'
|
|
21
|
+
import { Icon } from '../Icon'
|
|
22
|
+
|
|
21
23
|
export * from './styles'
|
|
22
24
|
|
|
23
|
-
type
|
|
24
|
-
|
|
25
|
-
'
|
|
26
|
-
>
|
|
27
|
-
|
|
28
|
-
variants?: ComponentVariants<typeof CheckboxStyles>['variants']
|
|
29
|
-
label?: ReactNode
|
|
25
|
+
export type CheckboxProps = Pick<
|
|
26
|
+
InputBaseProps,
|
|
27
|
+
'debugName' | 'disabled' | 'label'
|
|
28
|
+
> & {
|
|
29
|
+
variants?: ComponentVariants<typeof CheckboxPresets>['variants']
|
|
30
30
|
styles?: StylesOf<CheckboxComposition>
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
value: boolean
|
|
32
|
+
onValueChange: (value: boolean) => void
|
|
33
|
+
style?: PropsOf<typeof View>['style']
|
|
34
|
+
checkboxOnLeft?: boolean
|
|
35
|
+
checkIcon?: IconPlaceholder
|
|
33
36
|
}
|
|
34
37
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
38
|
+
const reversedOrder = [...InputBaseDefaultOrder].reverse()
|
|
39
|
+
const defaultProps: Partial<CheckboxProps> = {
|
|
40
|
+
checkIcon: 'check' as IconPlaceholder,
|
|
41
|
+
}
|
|
42
|
+
export const Checkbox = (props: CheckboxProps) => {
|
|
43
|
+
const {
|
|
44
|
+
inputBaseProps,
|
|
45
|
+
others,
|
|
46
|
+
} = selectInputBaseProps({
|
|
47
|
+
...defaultProps,
|
|
48
|
+
...props,
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
const {
|
|
52
|
+
variants = [],
|
|
53
|
+
style = {},
|
|
54
|
+
styles = {},
|
|
55
|
+
value,
|
|
56
|
+
disabled,
|
|
57
|
+
debugName,
|
|
58
|
+
onValueChange,
|
|
59
|
+
checkboxOnLeft,
|
|
60
|
+
checkIcon,
|
|
61
|
+
} = others
|
|
62
|
+
|
|
63
|
+
const variantStyles = useDefaultComponentStyle<'u:Checkbox', typeof CheckboxPresets>('u:Checkbox', {
|
|
64
|
+
variants,
|
|
65
|
+
styles,
|
|
66
|
+
rootElement: 'wrapper',
|
|
67
|
+
transform: StyleSheet.flatten,
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
const boxAnimation = useAnimatedVariantStyles({
|
|
71
|
+
variantStyles,
|
|
72
|
+
animatedProperties: ['box:unchecked', 'box:disabled', 'box:checked', 'box:disabled-checked', 'box:disabled-unchecked'],
|
|
73
|
+
transition: variantStyles['box:transition'],
|
|
74
|
+
updater: () => {
|
|
75
|
+
'worklet'
|
|
76
|
+
let disabledStyle = {}
|
|
77
|
+
if (disabled) {
|
|
78
|
+
disabledStyle = value ? variantStyles['box:disabled-checked'] : variantStyles['box:disabled-unchecked']
|
|
79
|
+
}
|
|
80
|
+
const style = value ? variantStyles['box:checked'] : variantStyles['box:unchecked']
|
|
81
|
+
|
|
82
|
+
return {
|
|
83
|
+
...style,
|
|
84
|
+
...disabledStyle,
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
},
|
|
88
|
+
dependencies: [value, disabled],
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
const checkmarkWrapperAnimation = useAnimatedVariantStyles({
|
|
92
|
+
variantStyles,
|
|
93
|
+
animatedProperties: ['checkmarkWrapper:unchecked', 'checkmarkWrapper:disabled', 'checkmarkWrapper:checked', 'checkmarkWrapper:disabled-unchecked', 'checkmarkWrapper:disabled-checked'],
|
|
94
|
+
transition: variantStyles['checkmarkWrapper:transition'],
|
|
95
|
+
updater: () => {
|
|
96
|
+
'worklet'
|
|
97
|
+
let disabledStyle = {}
|
|
98
|
+
if (disabled) {
|
|
99
|
+
disabledStyle = value ? variantStyles['checkmarkWrapper:disabled-checked'] : variantStyles['checkmarkWrapper:disabled-unchecked']
|
|
100
|
+
}
|
|
101
|
+
const style = value ? variantStyles['checkmarkWrapper:checked'] : variantStyles['checkmarkWrapper:unchecked']
|
|
102
|
+
return {
|
|
103
|
+
...style,
|
|
104
|
+
...disabledStyle,
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
},
|
|
108
|
+
dependencies: [value, disabled],
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
const _checkboxOnLeft = checkboxOnLeft ?? variantStyles.__props?.checkboxOnLeft
|
|
112
|
+
|
|
113
|
+
return <InputBase
|
|
114
|
+
{...inputBaseProps}
|
|
115
|
+
debugName={debugName}
|
|
116
|
+
wrapper={Touchable}
|
|
117
|
+
styles={variantStyles}
|
|
118
|
+
wrapperProps={{
|
|
119
|
+
onPress: () => {
|
|
120
|
+
onValueChange(!value)
|
|
121
|
+
},
|
|
122
|
+
disabled,
|
|
123
|
+
rippleDisabled: true,
|
|
124
|
+
}}
|
|
125
|
+
order={_checkboxOnLeft ? reversedOrder : InputBaseDefaultOrder}
|
|
126
|
+
style={style}
|
|
127
|
+
>
|
|
128
|
+
<View
|
|
129
|
+
animated
|
|
130
|
+
style={[
|
|
131
|
+
variantStyles.box,
|
|
132
|
+
disabled && variantStyles['box:disabled'],
|
|
133
|
+
boxAnimation,
|
|
134
|
+
]}
|
|
135
|
+
>
|
|
136
|
+
<View
|
|
137
|
+
animated
|
|
138
|
+
style={[
|
|
139
|
+
variantStyles.checkmarkWrapper,
|
|
140
|
+
disabled && variantStyles['checkmarkWrapper:disabled'],
|
|
141
|
+
checkmarkWrapperAnimation,
|
|
142
|
+
]}
|
|
143
|
+
>
|
|
144
|
+
<Icon
|
|
145
|
+
name={checkIcon as any}
|
|
146
|
+
style={[variantStyles.checkmark, disabled && variantStyles['checkmark:disabled']]}
|
|
147
|
+
|
|
148
|
+
/>
|
|
88
149
|
</View>
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
150
|
+
</View>
|
|
151
|
+
</InputBase>
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
Checkbox.defaultProps = defaultProps
|