@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,320 +2,298 @@ import * as React from 'react'
|
|
|
2
2
|
import {
|
|
3
3
|
ComponentVariants,
|
|
4
4
|
FormTypes,
|
|
5
|
-
|
|
6
|
-
IconPlaceholder,
|
|
7
|
-
|
|
5
|
+
PropsOf,
|
|
8
6
|
TypeGuards,
|
|
9
|
-
|
|
10
|
-
useBooleanToggle,
|
|
11
7
|
useDefaultComponentStyle,
|
|
12
8
|
useValidate,
|
|
9
|
+
yup,
|
|
10
|
+
useState,
|
|
11
|
+
useBooleanToggle,
|
|
12
|
+
IconPlaceholder,
|
|
13
13
|
} from '@codeleap/common'
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import { Touchable
|
|
14
|
+
import { forwardRef, useImperativeHandle } from 'react'
|
|
15
|
+
import { ComponentWithDefaultProps, StylesOf } from '../../types'
|
|
16
|
+
import { StyleSheet, TextInput as NativeTextInput, TextInputProps as NativeTextInputProps, NativeSyntheticEvent, TextInputFocusEventData } from 'react-native'
|
|
17
|
+
import { InputBase, InputBaseProps, selectInputBaseProps } from '../InputBase'
|
|
18
|
+
import { TextInputComposition, TextInputPresets } from './styles'
|
|
19
|
+
import { Touchable } from '../Touchable'
|
|
20
20
|
import { MaskedTextInput, TextInputMaskProps } from '../../modules/textInputMask'
|
|
21
|
-
import { InputLabel } from '../InputLabel'
|
|
22
21
|
|
|
23
22
|
export * from './styles'
|
|
24
23
|
|
|
25
|
-
import {
|
|
26
|
-
InputIconComposition,
|
|
27
|
-
TextInputComposition,
|
|
28
|
-
TextInputStyles,
|
|
29
|
-
} from './styles'
|
|
30
|
-
import { ActionIcon, ActionIconParts, ActionIconProps } from '../ActionIcon'
|
|
31
|
-
|
|
32
|
-
type NativeProps = ComponentPropsWithoutRef<typeof NativeTextInput>
|
|
33
|
-
|
|
34
|
-
type SubtitleProps = {
|
|
35
|
-
errorProps: TextProps
|
|
36
|
-
styles: Record<'wrapper'|'error'|'subtitle', any>
|
|
37
|
-
}
|
|
38
|
-
|
|
39
24
|
export type TextInputProps =
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
Omit<NativeProps, 'value'> &
|
|
25
|
+
Omit<InputBaseProps, 'styles' | 'variants'> &
|
|
26
|
+
NativeTextInputProps &
|
|
43
27
|
{
|
|
44
|
-
multiline?: boolean
|
|
45
|
-
onChangeText?: (text: string) => void
|
|
46
|
-
disabled?: boolean
|
|
47
|
-
edited?: boolean
|
|
48
|
-
type?: string
|
|
49
|
-
label?: React.ReactNode
|
|
50
|
-
debugName: string
|
|
51
|
-
leftIcon?: Partial<ActionIconProps>
|
|
52
|
-
rightIcon?: Partial<ActionIconProps>
|
|
53
28
|
styles?: StylesOf<TextInputComposition>
|
|
54
|
-
validate?: FormTypes.ValidatorFunctionWithoutForm | string
|
|
55
|
-
value?: string
|
|
56
29
|
password?: boolean
|
|
30
|
+
validate?: FormTypes.ValidatorFunctionWithoutForm | yup.SchemaOf<string>
|
|
31
|
+
debugName: string
|
|
57
32
|
visibilityToggle?: boolean
|
|
58
|
-
touchableWrapper?: boolean
|
|
59
|
-
subtitle?: string | ((props: SubtitleProps) => React.ReactElement)
|
|
60
|
-
onPress?: () => void
|
|
61
33
|
masking?: FormTypes.TextField['masking']
|
|
62
|
-
|
|
63
|
-
wrapperProps?: TouchableProps
|
|
34
|
+
variants?: ComponentVariants<typeof TextInputPresets>['variants']
|
|
64
35
|
onChangeMask?: TextInputMaskProps['onChangeText']
|
|
65
|
-
|
|
66
|
-
|
|
36
|
+
visibleIcon?: IconPlaceholder
|
|
37
|
+
hiddenIcon?: IconPlaceholder
|
|
38
|
+
_error?: string
|
|
39
|
+
} & Pick<PropsOf<typeof Touchable>, 'onPress'>
|
|
40
|
+
|
|
41
|
+
const defaultProps:Partial<TextInputProps> = {
|
|
42
|
+
hiddenIcon: 'input-visiblity:hidden' as IconPlaceholder,
|
|
43
|
+
visibleIcon: 'input-visiblity:visible' as IconPlaceholder,
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const TextInput = forwardRef<NativeTextInput, TextInputProps>((props, inputRef) => {
|
|
47
|
+
|
|
48
|
+
const innerInputRef = React.useRef<NativeTextInput>(null)
|
|
49
|
+
|
|
50
|
+
const [isFocused, setIsFocused] = useState(false)
|
|
51
|
+
|
|
52
|
+
const {
|
|
53
|
+
inputBaseProps,
|
|
54
|
+
others,
|
|
55
|
+
} = selectInputBaseProps({
|
|
56
|
+
...TextInput.defaultProps,
|
|
57
|
+
...props,
|
|
58
|
+
})
|
|
67
59
|
|
|
68
|
-
export const TextInput = forwardRef<NativeTextInput, TextInputProps>((rawprops, inputRef) => {
|
|
69
60
|
const {
|
|
70
|
-
onChange,
|
|
71
|
-
value,
|
|
72
|
-
onChangeText,
|
|
73
|
-
disabled,
|
|
74
|
-
edited,
|
|
75
|
-
onFocus,
|
|
76
|
-
onBlur,
|
|
77
61
|
variants,
|
|
78
|
-
label,
|
|
79
|
-
wrapperProps,
|
|
80
|
-
leftIcon,
|
|
81
|
-
rightIcon,
|
|
82
62
|
styles,
|
|
63
|
+
value,
|
|
83
64
|
validate,
|
|
84
|
-
|
|
85
|
-
visibilityToggle,
|
|
86
|
-
innerWrapperProps,
|
|
65
|
+
debugName,
|
|
66
|
+
visibilityToggle = false,
|
|
87
67
|
masking,
|
|
88
|
-
|
|
68
|
+
password,
|
|
89
69
|
onChangeMask,
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
70
|
+
onPress,
|
|
71
|
+
visibleIcon,
|
|
72
|
+
hiddenIcon,
|
|
73
|
+
_error = null,
|
|
74
|
+
...textInputProps
|
|
75
|
+
} = others
|
|
76
|
+
|
|
77
|
+
const [secureTextEntry, toggleSecureTextEntry] = useBooleanToggle(true)
|
|
78
|
+
|
|
79
|
+
const isMasked = !!masking
|
|
94
80
|
|
|
95
|
-
const
|
|
96
|
-
const [editedState, setEdited] = useState(edited)
|
|
81
|
+
const InputElement = isMasked ? MaskedTextInput : NativeTextInput
|
|
97
82
|
|
|
98
|
-
const
|
|
99
|
-
const maskInputRef = useRef<any>(null)
|
|
100
|
-
const [textIsVisible, setTextVisible] = useBooleanToggle(false)
|
|
101
|
-
const variantStyles = useDefaultComponentStyle<'u:TextInput', typeof TextInputStyles>('u:TextInput', {
|
|
83
|
+
const variantStyles = useDefaultComponentStyle<'u:TextInput', typeof TextInputPresets>('u:TextInput', {
|
|
102
84
|
variants,
|
|
103
85
|
styles,
|
|
104
86
|
transform: StyleSheet.flatten,
|
|
105
87
|
})
|
|
106
|
-
const InputElement = masking ? MaskedTextInput : NativeTextInput
|
|
107
|
-
|
|
108
|
-
const handleBlur: TextInputProps['onBlur'] = (e) => {
|
|
109
|
-
if (!editedState && value) setEdited(true)
|
|
110
|
-
setFocus(false)
|
|
111
|
-
|
|
112
|
-
if (onBlur) {
|
|
113
|
-
onBlur(e)
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
const handleFocus: TextInputProps['onFocus'] = (e) => {
|
|
118
|
-
setFocus(true)
|
|
119
|
-
if (onFocus) {
|
|
120
|
-
onFocus(e)
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
const handleMaskChange = (masked, unmasked) => {
|
|
124
|
-
|
|
125
|
-
if (onChangeText) onChangeText(masking?.saveFormatted ? masked : masked)
|
|
126
|
-
if (onChangeMask) onChangeMask(masked, unmasked)
|
|
127
|
-
}
|
|
128
|
-
const handleChange = (event: NativeSyntheticEvent<TextInputChangeEventData>) => {
|
|
129
|
-
const text = event.nativeEvent.text
|
|
130
|
-
|
|
131
|
-
if (onChange) onChange(event)
|
|
132
|
-
if (onChangeText) onChangeText(text)
|
|
133
|
-
}
|
|
134
88
|
|
|
89
|
+
// @ts-expect-error - React's ref type system is weird
|
|
135
90
|
useImperativeHandle(inputRef, () => {
|
|
136
91
|
return {
|
|
137
|
-
...
|
|
92
|
+
...innerInputRef.current,
|
|
138
93
|
focus: () => {
|
|
139
|
-
|
|
94
|
+
innerInputRef.current?.focus?.()
|
|
140
95
|
},
|
|
141
96
|
isTextInput: true,
|
|
142
97
|
}
|
|
98
|
+
}, [!!innerInputRef?.current?.focus])
|
|
143
99
|
|
|
144
|
-
|
|
100
|
+
const isPressable = TypeGuards.isFunction(onPress)
|
|
145
101
|
|
|
146
|
-
const
|
|
102
|
+
const validation = useValidate(value, validate)
|
|
147
103
|
|
|
148
|
-
const
|
|
104
|
+
const handleBlur = React.useCallback((e: NativeSyntheticEvent<TextInputFocusEventData>) => {
|
|
105
|
+
validation.onInputBlurred()
|
|
106
|
+
setIsFocused(false)
|
|
107
|
+
props.onBlur?.(e)
|
|
108
|
+
}, [validation.onInputBlurred, props.onBlur])
|
|
149
109
|
|
|
150
|
-
const
|
|
110
|
+
const handleFocus = React.useCallback((e: NativeSyntheticEvent<TextInputFocusEventData>) => {
|
|
111
|
+
validation.onInputFocused()
|
|
112
|
+
setIsFocused(true)
|
|
113
|
+
props.onFocus?.(e)
|
|
114
|
+
}, [validation.onInputFocused, props.onFocus])
|
|
151
115
|
|
|
152
|
-
const
|
|
116
|
+
const handleMaskChange = (masked, unmasked) => {
|
|
153
117
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
variantStyles[key],
|
|
157
|
-
isFocused ? variantStyles[key + ':focus'] : {},
|
|
158
|
-
showError ? variantStyles[key + ':error'] : {},
|
|
159
|
-
]
|
|
160
|
-
return StyleSheet.flatten(requestedStyles)
|
|
118
|
+
if (textInputProps.onChangeText) textInputProps.onChangeText(masking?.saveFormatted ? masked : masked)
|
|
119
|
+
if (onChangeMask) onChangeMask(masked, unmasked)
|
|
161
120
|
}
|
|
162
121
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
122
|
+
const isMultiline = textInputProps.multiline
|
|
123
|
+
const isDisabled = !!inputBaseProps.disabled
|
|
124
|
+
|
|
125
|
+
const placeholderTextColor = [
|
|
126
|
+
[isDisabled, variantStyles['placeholder:disabled']],
|
|
127
|
+
[!validation.isValid, variantStyles['placeholder:error']],
|
|
128
|
+
[isFocused, variantStyles['placeholder:focus']],
|
|
129
|
+
[true, variantStyles.placeholder],
|
|
130
|
+
].find(([x]) => x)?.[1]?.color
|
|
131
|
+
|
|
132
|
+
const selectionColor = [
|
|
133
|
+
[isDisabled, variantStyles['selection:disabled']],
|
|
134
|
+
[!validation.isValid, variantStyles['selection:error']],
|
|
135
|
+
[isFocused, variantStyles['selection:focus']],
|
|
136
|
+
[true, variantStyles.selection],
|
|
137
|
+
].find(([x]) => x)?.[1]?.color
|
|
170
138
|
|
|
171
139
|
const visibilityToggleProps = visibilityToggle ? {
|
|
172
|
-
onPress:
|
|
173
|
-
icon: (
|
|
140
|
+
onPress: toggleSecureTextEntry,
|
|
141
|
+
icon: (secureTextEntry ? hiddenIcon : visibleIcon) as IconPlaceholder,
|
|
174
142
|
debugName: `${debugName} toggle visibility`,
|
|
175
|
-
} :
|
|
143
|
+
} : null
|
|
176
144
|
|
|
177
|
-
const
|
|
178
|
-
error: getStyles('error'),
|
|
179
|
-
wrapper: getStyles('subtitleWrapper'),
|
|
180
|
-
subtitle: getStyles('subtitle'),
|
|
145
|
+
const rightIcon = inputBaseProps?.rightIcon ?? visibilityToggleProps
|
|
181
146
|
|
|
182
|
-
|
|
183
|
-
|
|
147
|
+
const maskingExtraProps = isMasked ? {
|
|
148
|
+
onChangeText: handleMaskChange,
|
|
149
|
+
ref: null,
|
|
184
150
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
/>
|
|
250
|
-
<InputIcon
|
|
251
|
-
isFocused={isFocused}
|
|
252
|
-
showError={showError}
|
|
253
|
-
styles={rightIconStyles}
|
|
254
|
-
commonStyles={commonIconStyles}
|
|
255
|
-
debugName={`${debugName} right icon`}
|
|
256
|
-
onPress={() => {}}
|
|
257
|
-
noFeedback={!rightIcon?.onPress}
|
|
258
|
-
{...rightIcon}
|
|
259
|
-
{...visibilityToggleProps}
|
|
260
|
-
/>
|
|
261
|
-
|
|
262
|
-
</View>
|
|
263
|
-
{subtitleContent}
|
|
264
|
-
</Touchable>
|
|
265
|
-
)
|
|
151
|
+
refInput: (inputRef) => {
|
|
152
|
+
// console.log(inputRef)
|
|
153
|
+
if (!!inputRef) {
|
|
154
|
+
innerInputRef.current = inputRef
|
|
155
|
+
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
...masking,
|
|
159
|
+
} : {}
|
|
160
|
+
|
|
161
|
+
const buttonModeProps = isPressable ? {
|
|
162
|
+
// pointerEvents: 'none',
|
|
163
|
+
editable: false,
|
|
164
|
+
caretHidden: true,
|
|
165
|
+
} : {}
|
|
166
|
+
|
|
167
|
+
const hasMultipleLines = isMultiline && value?.includes('\n')
|
|
168
|
+
return <InputBase
|
|
169
|
+
{...inputBaseProps}
|
|
170
|
+
innerWrapper={isPressable ? Touchable : undefined}
|
|
171
|
+
debugName={debugName}
|
|
172
|
+
error={(validation.isValid && !_error) ? null : _error || validation.message}
|
|
173
|
+
styles={{
|
|
174
|
+
...variantStyles,
|
|
175
|
+
innerWrapper: [
|
|
176
|
+
variantStyles.innerWrapper,
|
|
177
|
+
isMultiline && variantStyles['innerWrapper:multiline'],
|
|
178
|
+
hasMultipleLines && variantStyles['innerWrapper:hasMultipleLines'],
|
|
179
|
+
],
|
|
180
|
+
}}
|
|
181
|
+
innerWrapperProps={{
|
|
182
|
+
...(inputBaseProps.innerWrapperProps || {}),
|
|
183
|
+
onPress,
|
|
184
|
+
debugName,
|
|
185
|
+
}}
|
|
186
|
+
rightIcon={rightIcon}
|
|
187
|
+
focused={isFocused}
|
|
188
|
+
>
|
|
189
|
+
<InputElement
|
|
190
|
+
|
|
191
|
+
allowFontScaling={false}
|
|
192
|
+
editable={!isPressable && !isDisabled}
|
|
193
|
+
{...buttonModeProps}
|
|
194
|
+
placeholderTextColor={placeholderTextColor}
|
|
195
|
+
value={value}
|
|
196
|
+
selectionColor={selectionColor}
|
|
197
|
+
secureTextEntry={password && secureTextEntry}
|
|
198
|
+
{...textInputProps}
|
|
199
|
+
onBlur={handleBlur}
|
|
200
|
+
onFocus={handleFocus}
|
|
201
|
+
style={[
|
|
202
|
+
variantStyles.input,
|
|
203
|
+
isMultiline && variantStyles['input:multiline'],
|
|
204
|
+
isFocused && variantStyles['input:focused'],
|
|
205
|
+
!validation.isValid && variantStyles['input:error'],
|
|
206
|
+
isDisabled && variantStyles['input:disabled'],
|
|
207
|
+
hasMultipleLines && variantStyles['input:hasMultipleLines'],
|
|
208
|
+
]}
|
|
209
|
+
ref={innerInputRef}
|
|
210
|
+
pointerEvents={isPressable ? 'none' : undefined}
|
|
211
|
+
textAlignVertical={isMultiline ? 'top' : undefined}
|
|
212
|
+
{...maskingExtraProps}
|
|
213
|
+
/>
|
|
214
|
+
</InputBase>
|
|
266
215
|
})
|
|
267
216
|
|
|
268
|
-
export
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
217
|
+
export type SearchInputProps = {
|
|
218
|
+
onTypingChange: (isTyping: boolean) => void
|
|
219
|
+
onSearchChange: (search: string) => void
|
|
220
|
+
onClear?: () => void
|
|
221
|
+
debugName: string
|
|
222
|
+
debounce?: number
|
|
223
|
+
clearIcon?: IconPlaceholder
|
|
224
|
+
searchIcon?: IconPlaceholder
|
|
225
|
+
placeholder: string
|
|
226
|
+
} & Partial<TextInputProps>
|
|
227
|
+
|
|
228
|
+
export const SearchInput: ComponentWithDefaultProps<SearchInputProps> = (props) => {
|
|
229
|
+
const {
|
|
230
|
+
debugName,
|
|
231
|
+
onClear,
|
|
232
|
+
onSearchChange,
|
|
233
|
+
onTypingChange,
|
|
234
|
+
clearIcon,
|
|
235
|
+
searchIcon,
|
|
236
|
+
debounce,
|
|
237
|
+
placeholder,
|
|
238
|
+
...others
|
|
239
|
+
} = {
|
|
240
|
+
...SearchInput.defaultProps,
|
|
241
|
+
...props,
|
|
275
242
|
}
|
|
276
243
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
244
|
+
const [search, setSearch] = useState('')
|
|
245
|
+
|
|
246
|
+
const setSearchTimeout = React.useRef<NodeJS.Timeout|null>(null)
|
|
247
|
+
|
|
248
|
+
const handleChangeSearch = (value: string) => {
|
|
249
|
+
setSearch(value)
|
|
250
|
+
|
|
251
|
+
if (TypeGuards.isNil(debounce)) {
|
|
252
|
+
onSearchChange?.(value)
|
|
253
|
+
} else {
|
|
254
|
+
if (setSearchTimeout.current) {
|
|
255
|
+
clearTimeout(setSearchTimeout.current)
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
setSearchTimeout.current = setTimeout(() => {
|
|
259
|
+
|
|
260
|
+
onSearchChange(value)
|
|
261
|
+
onTypingChange?.(false)
|
|
262
|
+
}, debounce ?? 0)
|
|
263
|
+
}
|
|
285
264
|
|
|
286
|
-
type InputIconProps = {
|
|
287
|
-
styles: StylesOf<InputIconComposition>
|
|
288
|
-
commonStyles: StylesOf<InputIconComposition>
|
|
289
|
-
isFocused: boolean
|
|
290
|
-
showError: boolean
|
|
291
|
-
} & Omit<ActionIconProps, 'styles'>
|
|
292
|
-
|
|
293
|
-
export const InputIcon:React.FC<InputIconProps> = ({ styles, commonStyles, isFocused, showError, ...props }) => {
|
|
294
|
-
if (!props.icon) return null
|
|
295
|
-
|
|
296
|
-
function getStyles(k: ActionIconParts | '') {
|
|
297
|
-
let key = k
|
|
298
|
-
if (key === 'icon') key = ''
|
|
299
|
-
const requestedStyles = [
|
|
300
|
-
commonStyles[key],
|
|
301
|
-
isFocused ? commonStyles[key + ':focus'] : {},
|
|
302
|
-
showError ? commonStyles[key + ':error'] : {},
|
|
303
|
-
styles[key],
|
|
304
|
-
isFocused ? styles[key + ':focus'] : {},
|
|
305
|
-
showError ? styles[key + ':error'] : {},
|
|
306
|
-
]
|
|
307
|
-
|
|
308
|
-
return StyleSheet.flatten(requestedStyles)
|
|
309
265
|
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
266
|
+
|
|
267
|
+
const handleClear = () => {
|
|
268
|
+
setSearch('')
|
|
269
|
+
onSearchChange?.('')
|
|
270
|
+
onClear?.()
|
|
315
271
|
}
|
|
316
272
|
|
|
317
|
-
return
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
273
|
+
return (
|
|
274
|
+
<TextInput
|
|
275
|
+
value={search}
|
|
276
|
+
onChangeText={(value) => {
|
|
277
|
+
onTypingChange?.(true)
|
|
278
|
+
handleChangeSearch(value)
|
|
279
|
+
}}
|
|
280
|
+
placeholder={placeholder}
|
|
281
|
+
debugName={`Search ${debugName}`}
|
|
282
|
+
rightIcon={!!search.trim() && {
|
|
283
|
+
name: clearIcon,
|
|
284
|
+
onPress: handleClear,
|
|
285
|
+
}}
|
|
286
|
+
leftIcon={{
|
|
287
|
+
name: searchIcon,
|
|
288
|
+
}}
|
|
289
|
+
{...others}
|
|
290
|
+
/>
|
|
291
|
+
)
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
TextInput.defaultProps = defaultProps
|
|
295
|
+
SearchInput.defaultProps = {
|
|
296
|
+
debounce: null,
|
|
297
|
+
clearIcon: 'x' as IconPlaceholder,
|
|
298
|
+
searchIcon: 'search' as IconPlaceholder,
|
|
321
299
|
}
|