@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,27 @@
|
|
|
1
|
+
import { useState, useCallback } from 'react'
|
|
2
|
+
|
|
3
|
+
const initialState = {
|
|
4
|
+
message: '',
|
|
5
|
+
isValid: true,
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const useActionValidate = (validator: any) => {
|
|
9
|
+
const [error, setError] = useState(initialState)
|
|
10
|
+
|
|
11
|
+
const validate = useCallback((value: number) => {
|
|
12
|
+
if (!validator) return
|
|
13
|
+
|
|
14
|
+
const { valid, message } = validator(value, {})
|
|
15
|
+
|
|
16
|
+
setError({
|
|
17
|
+
isValid: valid,
|
|
18
|
+
message: message,
|
|
19
|
+
})
|
|
20
|
+
}, [validator])
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
onAction: validate,
|
|
24
|
+
message: error?.message,
|
|
25
|
+
isValid: error?.isValid
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ComponentVariants,
|
|
3
|
+
onUpdate,
|
|
4
|
+
TypeGuards,
|
|
3
5
|
useDefaultComponentStyle,
|
|
6
|
+
useWarning
|
|
4
7
|
} from '@codeleap/common'
|
|
5
|
-
import React, {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
import React, { ReactNode, useCallback, useRef } from 'react'
|
|
9
|
+
import {
|
|
10
|
+
Dimensions,
|
|
11
|
+
NativeScrollEvent,
|
|
12
|
+
NativeSyntheticEvent,
|
|
13
|
+
ScrollView,
|
|
14
|
+
StyleSheet,
|
|
15
|
+
} from 'react-native'
|
|
9
16
|
import { StylesOf } from '../../types/utility'
|
|
17
|
+
import { ScrollProps } from '../Scroll'
|
|
10
18
|
import { View } from '../View'
|
|
11
|
-
import {
|
|
19
|
+
import { PagerPresets, PagerComposition } from './styles'
|
|
12
20
|
export * from './styles'
|
|
13
21
|
|
|
14
22
|
export type PageProps = {
|
|
@@ -19,34 +27,46 @@ export type PageProps = {
|
|
|
19
27
|
page: number
|
|
20
28
|
index: number
|
|
21
29
|
isPrevious: boolean
|
|
30
|
+
|
|
22
31
|
}
|
|
23
32
|
|
|
24
|
-
export type PagerProps = {
|
|
25
|
-
variants?: ComponentVariants<typeof
|
|
33
|
+
export type PagerProps = React.PropsWithChildren<{
|
|
34
|
+
variants?: ComponentVariants<typeof PagerPresets>['variants']
|
|
26
35
|
styles?: StylesOf<PagerComposition>
|
|
27
36
|
children?: (((pageData: PageProps) => ReactNode) | ReactNode)[]
|
|
28
37
|
page?: number
|
|
29
38
|
style?: any
|
|
30
39
|
setPage?: (page: number) => void
|
|
31
40
|
returnEarly?: boolean
|
|
32
|
-
renderPageWrapper?:React.FC<PageProps>
|
|
41
|
+
renderPageWrapper?: React.FC<PageProps>
|
|
33
42
|
pageWrapperProps?: any
|
|
34
|
-
|
|
43
|
+
width?: number
|
|
44
|
+
onScroll: ScrollProps['onScroll']
|
|
45
|
+
/** If TRUE render page, nextPage and prevPage only */
|
|
46
|
+
windowing?:boolean
|
|
47
|
+
}>
|
|
35
48
|
|
|
36
|
-
export const Pager:React.FC<PagerProps> = (pagerProps) => {
|
|
49
|
+
export const Pager: React.FC<PagerProps> = (pagerProps) => {
|
|
37
50
|
const {
|
|
38
|
-
|
|
39
51
|
styles,
|
|
40
52
|
variants,
|
|
53
|
+
width: widthProp,
|
|
41
54
|
page,
|
|
42
55
|
style = {},
|
|
43
56
|
returnEarly = true,
|
|
44
57
|
renderPageWrapper,
|
|
45
58
|
pageWrapperProps = {},
|
|
46
59
|
children,
|
|
60
|
+
windowing = false,
|
|
61
|
+
setPage,
|
|
47
62
|
} = pagerProps
|
|
48
63
|
|
|
49
|
-
|
|
64
|
+
|
|
65
|
+
const childArr = React.Children.toArray(children)
|
|
66
|
+
const scrollRef = useRef<ScrollView>(null)
|
|
67
|
+
const [positionX, setPositionX] = React.useState(0)
|
|
68
|
+
|
|
69
|
+
let variantStyles = useDefaultComponentStyle<'u:Pager', typeof PagerPresets>(
|
|
50
70
|
'u:Pager',
|
|
51
71
|
{
|
|
52
72
|
styles,
|
|
@@ -54,69 +74,102 @@ export const Pager:React.FC<PagerProps> = (pagerProps) => {
|
|
|
54
74
|
variants,
|
|
55
75
|
},
|
|
56
76
|
)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
const windowWidth = Dimensions.get('window').width
|
|
80
|
+
let width = widthProp ?? variantStyles.wrapper.width
|
|
81
|
+
|
|
82
|
+
const validWidth = TypeGuards.isNumber(width)
|
|
83
|
+
|
|
84
|
+
if (!validWidth) {
|
|
85
|
+
width = windowWidth
|
|
86
|
+
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
useWarning(
|
|
90
|
+
!validWidth,
|
|
91
|
+
'Pager',
|
|
92
|
+
'provided width is not a number, using default width',
|
|
93
|
+
)
|
|
94
|
+
|
|
57
95
|
const nChildren = React.Children.count(children)
|
|
58
96
|
|
|
59
97
|
const lastPage = nChildren - 1
|
|
60
98
|
|
|
99
|
+
const WrapperComponent = renderPageWrapper || View
|
|
61
100
|
|
|
62
|
-
const childArr = React.Children.toArray(children)
|
|
63
101
|
|
|
64
|
-
const
|
|
102
|
+
const handleScrollEnd = useCallback(
|
|
103
|
+
({ nativeEvent }: NativeSyntheticEvent<NativeScrollEvent>) => {
|
|
104
|
+
const x = nativeEvent.contentOffset.x
|
|
105
|
+
const toPage = Math.ceil(x / width)
|
|
106
|
+
|
|
107
|
+
if (toPage !== page && toPage <= childArr.length - 1) {
|
|
108
|
+
setPage(toPage)
|
|
109
|
+
setPositionX(toPage * width)
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
[childArr, page, setPage],
|
|
113
|
+
)
|
|
65
114
|
|
|
66
|
-
|
|
67
|
-
|
|
115
|
+
onUpdate(() => {
|
|
116
|
+
const x = width * page
|
|
117
|
+
if (scrollRef.current && x !== positionX) {
|
|
118
|
+
scrollRef.current.scrollTo({
|
|
119
|
+
x,
|
|
120
|
+
animated: true,
|
|
121
|
+
})
|
|
122
|
+
setPositionX(x)
|
|
123
|
+
}
|
|
124
|
+
}, [page])
|
|
68
125
|
|
|
69
126
|
return (
|
|
70
|
-
<
|
|
71
|
-
{
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
})
|
|
119
|
-
}
|
|
120
|
-
</View>
|
|
127
|
+
<ScrollView
|
|
128
|
+
{...pagerProps}
|
|
129
|
+
ref={scrollRef}
|
|
130
|
+
horizontal
|
|
131
|
+
pagingEnabled
|
|
132
|
+
onMomentumScrollEnd={handleScrollEnd}
|
|
133
|
+
scrollEventThrottle={300}
|
|
134
|
+
showsHorizontalScrollIndicator={false}
|
|
135
|
+
scrollEnabled={childArr.length > 1}
|
|
136
|
+
style={[variantStyles.wrapper, style]}
|
|
137
|
+
>
|
|
138
|
+
{childArr.map((child: PagerProps['children'][number], index) => {
|
|
139
|
+
|
|
140
|
+
const isActive = index === page
|
|
141
|
+
const isLast = index === lastPage
|
|
142
|
+
const isFirst = index === 0
|
|
143
|
+
const isNext = index === page + 1
|
|
144
|
+
const isPrevious = index === page - 1
|
|
145
|
+
|
|
146
|
+
const shouldRender = windowing ? (isActive || isNext || isPrevious) : true
|
|
147
|
+
|
|
148
|
+
if (!shouldRender && returnEarly) {
|
|
149
|
+
return <View style={{ height: '100%', width }} />
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
const pageProps:PageProps = {
|
|
154
|
+
isLast,
|
|
155
|
+
isActive,
|
|
156
|
+
isFirst,
|
|
157
|
+
isNext,
|
|
158
|
+
isPrevious,
|
|
159
|
+
index,
|
|
160
|
+
page,
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
const content = typeof child === 'function' ? child(pageProps) : child
|
|
164
|
+
|
|
165
|
+
const wrapperProps = {
|
|
166
|
+
key: index,
|
|
167
|
+
style: [{ height: '100%', width }, variantStyles.page],
|
|
168
|
+
...pageWrapperProps,
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return <WrapperComponent {...wrapperProps}>{content}</WrapperComponent>
|
|
172
|
+
})}
|
|
173
|
+
</ScrollView>
|
|
121
174
|
)
|
|
122
175
|
}
|
|
@@ -2,80 +2,13 @@ import {
|
|
|
2
2
|
createDefaultVariantFactory,
|
|
3
3
|
includePresets,
|
|
4
4
|
} from '@codeleap/common'
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
|
|
7
7
|
export type PagerComposition =
|
|
8
8
|
| 'page'
|
|
9
|
-
| 'page:transition'
|
|
10
|
-
| 'page:previous'
|
|
11
|
-
| 'page:next'
|
|
12
|
-
| 'page:current'
|
|
13
9
|
| 'wrapper'
|
|
14
10
|
|
|
15
11
|
const createPagerStyle = createDefaultVariantFactory<PagerComposition>()
|
|
16
12
|
|
|
17
|
-
const
|
|
18
|
-
)
|
|
19
|
-
export const defaultPagerTransition = {
|
|
20
|
-
type: 'timing',
|
|
21
|
-
duration: 300,
|
|
22
|
-
easing: Easing.linear,
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export function pagerAnimation(height, width, translate = 'X', transition = defaultPagerTransition) {
|
|
26
|
-
const translateProp = `translate${translate}`
|
|
27
|
-
|
|
28
|
-
const translateVal = translate === 'X' ? width : height
|
|
29
|
-
|
|
30
|
-
return {
|
|
31
|
-
wrapper: {
|
|
32
|
-
height,
|
|
33
|
-
width,
|
|
34
|
-
overflow: 'hidden',
|
|
35
|
-
},
|
|
36
|
-
'page:transition': {
|
|
37
|
-
[translateProp]: transition,
|
|
38
|
-
},
|
|
39
|
-
'page:next': {
|
|
40
|
-
[translateProp]: translateVal,
|
|
41
|
-
|
|
42
|
-
},
|
|
43
|
-
'page:current': {
|
|
44
|
-
[translateProp]: 0,
|
|
45
|
-
},
|
|
46
|
-
'page:previous': {
|
|
47
|
-
[translateProp]: -translateVal,
|
|
48
|
-
},
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export const PagerStyles = {
|
|
53
|
-
...presets,
|
|
54
|
-
default: createPagerStyle((theme) => {
|
|
55
|
-
const width = theme.values.width
|
|
56
|
-
const height = theme.values.window.height * 0.8
|
|
57
|
-
return {
|
|
58
|
-
...pagerAnimation(height, width, 'X'),
|
|
59
|
-
page: {
|
|
60
|
-
width: '100%',
|
|
61
|
-
height: '100%',
|
|
62
|
-
position: 'absolute',
|
|
63
|
-
left: 0,
|
|
64
|
-
right: 0,
|
|
65
|
-
bottom: 0,
|
|
66
|
-
top: 0,
|
|
67
|
-
},
|
|
68
|
-
}
|
|
69
|
-
}),
|
|
70
|
-
horizontal: createPagerStyle((theme) => {
|
|
13
|
+
export const PagerPresets = includePresets((style) => createPagerStyle(() => ({ wrapper: style })))
|
|
71
14
|
|
|
72
|
-
const width = theme.values.width
|
|
73
|
-
const height = theme.values.window.height * 0.8
|
|
74
|
-
return pagerAnimation(height, width, 'X')
|
|
75
|
-
}),
|
|
76
|
-
vertical: createPagerStyle((theme) => {
|
|
77
|
-
const height = theme.values.window.height * 0.8
|
|
78
|
-
const width = theme.values.width
|
|
79
|
-
return pagerAnimation(height, width, 'Y')
|
|
80
|
-
}),
|
|
81
|
-
}
|
|
@@ -5,102 +5,179 @@ import { Text } from '../Text'
|
|
|
5
5
|
import { Touchable } from '../Touchable'
|
|
6
6
|
import {
|
|
7
7
|
ComponentVariants,
|
|
8
|
+
FormTypes,
|
|
8
9
|
getNestedStylesByKey,
|
|
9
10
|
StylesOf,
|
|
11
|
+
TypeGuards,
|
|
10
12
|
useDefaultComponentStyle,
|
|
11
13
|
} from '@codeleap/common'
|
|
12
14
|
import { View } from '../View'
|
|
13
|
-
import { RadioInputComposition,
|
|
15
|
+
import { RadioInputComposition, RadioInputPresets } from './styles'
|
|
14
16
|
import { InputLabel } from '../InputLabel'
|
|
15
|
-
|
|
17
|
+
import { StyleSheet } from 'react-native'
|
|
18
|
+
import { InputBase, InputBaseDefaultOrder, InputBaseProps, selectInputBaseProps } from '../InputBase'
|
|
16
19
|
export * from './styles'
|
|
17
20
|
|
|
18
|
-
type
|
|
19
|
-
value: T
|
|
20
|
-
label: ReactNode
|
|
21
|
-
}
|
|
21
|
+
type WrapperProps = InputBaseProps
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
export type RadioButtonProps = Omit<
|
|
26
|
-
ComponentPropsWithoutRef<typeof Touchable>,
|
|
27
|
-
'style'
|
|
28
|
-
> & {
|
|
29
|
-
item: RadioItem
|
|
30
|
-
select: () => void
|
|
31
|
-
style: StylesOf<RadioInputComposition>
|
|
32
|
-
checked: boolean
|
|
33
|
-
defaultValue?: number
|
|
23
|
+
type RadioOption<T> = FormTypes.Options<T>[number] & {
|
|
24
|
+
disabled?: boolean
|
|
34
25
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
options: RadioItem<T>[]
|
|
26
|
+
export type RadioGroupProps<T extends string|number> = WrapperProps & {
|
|
27
|
+
options: RadioOption<T>[]
|
|
38
28
|
value: T
|
|
39
29
|
onValueChange(value: T): void
|
|
40
|
-
required?: boolean
|
|
41
30
|
label: ReactNode
|
|
42
31
|
styles?: StylesOf<RadioInputComposition>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
32
|
+
variants?: ComponentVariants<typeof RadioInputPresets>['variants']
|
|
33
|
+
radioOnRight?: boolean
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
type OptionProps<T extends string|number> = {
|
|
37
|
+
item: RadioOption<T>
|
|
38
|
+
selected: boolean
|
|
39
|
+
onSelect(): void
|
|
40
|
+
styles?: StylesOf<RadioInputComposition>
|
|
41
|
+
debugName?: string
|
|
42
|
+
disabled?: boolean
|
|
43
|
+
separator?: boolean
|
|
44
|
+
reverseOrder?: boolean
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const Option = <T extends string|number>(props: OptionProps<T>) => {
|
|
48
|
+
const {
|
|
49
|
+
debugName,
|
|
50
|
+
item,
|
|
51
|
+
disabled,
|
|
52
|
+
styles,
|
|
53
|
+
selected,
|
|
54
|
+
onSelect,
|
|
55
|
+
separator = false,
|
|
56
|
+
reverseOrder,
|
|
57
|
+
} = props
|
|
58
|
+
|
|
59
|
+
const isDisabled = disabled || item.disabled
|
|
60
|
+
|
|
61
|
+
const getStyle = (key) => {
|
|
62
|
+
if (isDisabled && selected) {
|
|
63
|
+
return styles[`${key}:selectedDisabled`]
|
|
64
|
+
}
|
|
65
|
+
if (isDisabled) {
|
|
66
|
+
return styles[`${key}:disabled`]
|
|
67
|
+
}
|
|
68
|
+
if (selected) {
|
|
69
|
+
return styles[`${key}:selected`]
|
|
70
|
+
}
|
|
71
|
+
return styles[key]
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const label = TypeGuards.isString(item.label) ? <Text
|
|
75
|
+
style={[
|
|
76
|
+
styles.optionLabel,
|
|
77
|
+
getStyle('optionLabel'),
|
|
78
|
+
]}
|
|
79
|
+
text={item.label}
|
|
80
|
+
/> : item.label
|
|
81
|
+
|
|
82
|
+
return <>
|
|
83
|
+
<Touchable
|
|
84
|
+
debugName={`${debugName} option ${item.value}`}
|
|
85
|
+
style={[
|
|
86
|
+
styles.optionWrapper,
|
|
87
|
+
getStyle('optionWrapper'),
|
|
88
|
+
]}
|
|
89
|
+
rippleDisabled
|
|
90
|
+
onPress={onSelect}
|
|
91
|
+
disabled={isDisabled}
|
|
92
|
+
>
|
|
93
|
+
|
|
94
|
+
{reverseOrder ? (
|
|
95
|
+
<>
|
|
96
|
+
{label}
|
|
97
|
+
<View
|
|
98
|
+
style={[
|
|
99
|
+
styles.optionIndicator,
|
|
100
|
+
getStyle('optionIndicator'),
|
|
101
|
+
]}
|
|
102
|
+
>
|
|
103
|
+
<View
|
|
104
|
+
style={[
|
|
105
|
+
styles.optionIndicatorInner,
|
|
106
|
+
getStyle('optionIndicatorInner'),
|
|
107
|
+
]}
|
|
108
|
+
/>
|
|
109
|
+
</View>
|
|
110
|
+
</>
|
|
63
111
|
) : (
|
|
64
|
-
|
|
112
|
+
<>
|
|
113
|
+
<View
|
|
114
|
+
style={[
|
|
115
|
+
styles.optionIndicator,
|
|
116
|
+
getStyle('optionIndicator'),
|
|
117
|
+
]}
|
|
118
|
+
>
|
|
119
|
+
<View
|
|
120
|
+
style={[
|
|
121
|
+
styles.optionIndicatorInner,
|
|
122
|
+
getStyle('optionIndicatorInner'),
|
|
123
|
+
]}
|
|
124
|
+
/>
|
|
125
|
+
</View>
|
|
126
|
+
{label}
|
|
127
|
+
</>
|
|
65
128
|
)}
|
|
129
|
+
|
|
66
130
|
</Touchable>
|
|
67
|
-
|
|
131
|
+
{separator && <View style={styles.optionSeparator} />}
|
|
132
|
+
</>
|
|
68
133
|
}
|
|
69
134
|
|
|
70
|
-
export const RadioGroup = <T extends
|
|
71
|
-
|
|
135
|
+
export const RadioGroup = <T extends string|number>(
|
|
136
|
+
props: RadioGroupProps<T>,
|
|
72
137
|
) => {
|
|
138
|
+
const {
|
|
139
|
+
inputBaseProps,
|
|
140
|
+
others,
|
|
141
|
+
} = selectInputBaseProps(props)
|
|
142
|
+
|
|
73
143
|
const {
|
|
74
144
|
options,
|
|
75
145
|
value,
|
|
76
146
|
onValueChange,
|
|
77
|
-
label,
|
|
78
|
-
responsiveVariants,
|
|
79
|
-
required = false,
|
|
80
147
|
variants,
|
|
81
148
|
styles,
|
|
82
|
-
|
|
149
|
+
disabled,
|
|
150
|
+
debugName,
|
|
151
|
+
radioOnRight,
|
|
152
|
+
} = others
|
|
83
153
|
|
|
84
|
-
const
|
|
85
|
-
responsiveVariants,
|
|
154
|
+
const variantStyles = useDefaultComponentStyle<'u:RadioInput', typeof RadioInputPresets>('u:RadioInput', {
|
|
86
155
|
variants,
|
|
87
156
|
styles,
|
|
157
|
+
transform: StyleSheet.flatten,
|
|
88
158
|
})
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
159
|
+
|
|
160
|
+
const _radioOnRight = radioOnRight ?? variantStyles.__props?.radioOnRight
|
|
161
|
+
|
|
162
|
+
return <InputBase
|
|
163
|
+
{...inputBaseProps}
|
|
164
|
+
disabled={disabled}
|
|
165
|
+
styles={variantStyles}
|
|
166
|
+
debugName={debugName}
|
|
167
|
+
>
|
|
168
|
+
{options?.map((item, idx) => (
|
|
169
|
+
<Option
|
|
170
|
+
debugName={debugName}
|
|
171
|
+
item={item}
|
|
172
|
+
key={idx}
|
|
173
|
+
disabled={disabled}
|
|
174
|
+
styles={variantStyles}
|
|
175
|
+
selected={value === item.value}
|
|
176
|
+
onSelect={() => onValueChange(item.value)}
|
|
177
|
+
separator={idx < options.length - 1}
|
|
178
|
+
reverseOrder={_radioOnRight}
|
|
179
|
+
/>
|
|
180
|
+
))}
|
|
181
|
+
</InputBase>
|
|
182
|
+
|
|
106
183
|
}
|
|
@@ -1,67 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
} from '@codeleap/common'
|
|
4
|
-
import { InputLabelComposition } from '../InputLabel'
|
|
5
|
-
type RadioParts = 'button' | 'itemWrapper' | 'text' | 'buttonMark' | 'buttonFeedback'
|
|
1
|
+
import { createDefaultVariantFactory, includePresets } from '@codeleap/common'
|
|
2
|
+
import { IconLessInputBaseParts } from '../InputBase'
|
|
6
3
|
|
|
7
|
-
type
|
|
4
|
+
type OptionParts = 'wrapper' | 'label' | 'indicator' | 'indicatorInner' | 'separator'
|
|
5
|
+
type OptionStates = 'selected' | 'disabled' | 'selectedDisabled'
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
| RadioGroupParts
|
|
7
|
+
type OptionComposition = `${OptionParts}:${OptionStates}` | OptionParts
|
|
8
|
+
|
|
9
|
+
export type RadioInputComposition = IconLessInputBaseParts | `${IconLessInputBaseParts}:disabled` | `option${Capitalize<OptionComposition>}` | '__props'
|
|
13
10
|
|
|
14
11
|
const createRadioStyle =
|
|
15
12
|
createDefaultVariantFactory<RadioInputComposition>()
|
|
16
13
|
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
export const RadioInputStyles = {
|
|
20
|
-
...presets,
|
|
21
|
-
default: createRadioStyle((theme) => {
|
|
22
|
-
|
|
23
|
-
const itemHeight = theme.typography.baseFontSize * 1.2
|
|
24
|
-
const markHeight = itemHeight / 2
|
|
25
|
-
const translateX = -(markHeight / 2)
|
|
26
|
-
const translateY = -(markHeight / 2)
|
|
27
|
-
return {
|
|
28
|
-
itemWrapper: {
|
|
29
|
-
...theme.presets.row,
|
|
30
|
-
...theme.spacing.marginVertical(1.3),
|
|
31
|
-
},
|
|
32
|
-
button: {
|
|
33
|
-
height: itemHeight,
|
|
34
|
-
width: itemHeight,
|
|
35
|
-
...theme.border.primary(1),
|
|
36
|
-
borderRadius: theme.borderRadius.large,
|
|
37
|
-
|
|
38
|
-
position: 'relative',
|
|
39
|
-
...theme.spacing.marginRight(1),
|
|
40
|
-
},
|
|
41
|
-
buttonFeedback: { type: 'opacity', value: 0.5 },
|
|
42
|
-
buttonMark: {
|
|
43
|
-
backgroundColor: theme.colors.primary,
|
|
44
|
-
position: 'absolute',
|
|
45
|
-
left: '50%',
|
|
46
|
-
top: '50%',
|
|
47
|
-
height: markHeight,
|
|
48
|
-
width: markHeight,
|
|
49
|
-
|
|
50
|
-
transform: [{ translateX }, { translateY }],
|
|
51
|
-
borderRadius: theme.borderRadius.large,
|
|
52
|
-
opacity: 0,
|
|
53
|
-
},
|
|
54
|
-
'buttonMark:checked': {
|
|
55
|
-
opacity: 1,
|
|
56
|
-
},
|
|
57
|
-
}
|
|
58
|
-
}),
|
|
59
|
-
square: createRadioStyle(() => ({
|
|
60
|
-
buttonMark: {
|
|
61
|
-
borderRadius: 0,
|
|
62
|
-
},
|
|
63
|
-
button: {
|
|
64
|
-
borderRadius: 0,
|
|
65
|
-
},
|
|
66
|
-
})),
|
|
67
|
-
}
|
|
14
|
+
export const RadioInputPresets = includePresets(style => createRadioStyle(() => ({ wrapper: style })))
|