@codeleap/mobile 1.9.33 → 2.0.0
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/dist/components/ActionIcon/index.d.ts +13 -0
- package/dist/components/ActionIcon/index.js +54 -0
- package/dist/components/ActionIcon/index.js.map +1 -0
- package/dist/components/ActionIcon/styles.d.ts +64 -0
- package/dist/components/ActionIcon/styles.js +57 -0
- package/dist/components/ActionIcon/styles.js.map +1 -0
- package/dist/components/{ActivityIndicator.d.ts → ActivityIndicator/index.d.ts} +4 -2
- package/dist/components/{ActivityIndicator.js → ActivityIndicator/index.js} +5 -1
- package/dist/components/ActivityIndicator/index.js.map +1 -0
- package/dist/components/ActivityIndicator/styles.d.ts +59 -0
- package/dist/components/ActivityIndicator/styles.js +52 -0
- package/dist/components/ActivityIndicator/styles.js.map +1 -0
- package/dist/components/AutoComplete/index.d.ts +33 -0
- package/dist/components/AutoComplete/index.js +129 -0
- package/dist/components/AutoComplete/index.js.map +1 -0
- package/dist/components/AutoComplete/styles.d.ts +57 -0
- package/dist/components/AutoComplete/styles.js +28 -0
- package/dist/components/AutoComplete/styles.js.map +1 -0
- package/dist/components/Backdrop/index.d.ts +14 -0
- package/dist/components/{Backdrop.js → Backdrop/index.js} +21 -30
- package/dist/components/Backdrop/index.js.map +1 -0
- package/dist/components/{Backdrop.d.ts → Backdrop/styles.d.ts} +7 -20
- package/dist/components/Backdrop/styles.js +28 -0
- package/dist/components/Backdrop/styles.js.map +1 -0
- package/dist/components/Button/index.d.ts +247 -0
- package/dist/components/{Button.js → Button/index.js} +45 -11
- package/dist/components/Button/index.js.map +1 -0
- package/dist/components/{NewPager → Button}/styles.d.ts +59 -86
- package/dist/components/Button/styles.js +59 -0
- package/dist/components/Button/styles.js.map +1 -0
- package/dist/components/Calendar/index.d.ts +15 -0
- package/dist/components/Calendar/index.js +80 -0
- package/dist/components/Calendar/index.js.map +1 -0
- package/dist/components/Calendar/style.d.ts +4 -0
- package/dist/components/Calendar/style.js +36 -0
- package/dist/components/Calendar/style.js.map +1 -0
- package/dist/components/Calendar/types.d.ts +95 -0
- package/dist/components/Calendar/types.js +3 -0
- package/dist/components/Calendar/types.js.map +1 -0
- package/dist/components/Checkbox/index.d.ts +2 -2
- package/dist/components/Checkbox/index.js +1 -1
- package/dist/components/Checkbox/index.js.map +1 -1
- package/dist/components/Checkbox/styles.d.ts +52 -52
- package/dist/components/Checkbox/styles.js +2 -2
- package/dist/components/Checkbox/styles.js.map +1 -1
- package/dist/components/{ContentView.d.ts → ContentView/index.d.ts} +5 -3
- package/dist/components/{ContentView.js → ContentView/index.js} +19 -4
- package/dist/components/ContentView/index.js.map +1 -0
- package/dist/components/ContentView/styles.d.ts +53 -0
- package/dist/components/ContentView/styles.js +26 -0
- package/dist/components/ContentView/styles.js.map +1 -0
- package/dist/components/Drawer/index.d.ts +7 -0
- package/dist/components/{View.js → Drawer/index.js} +18 -15
- package/dist/components/Drawer/index.js.map +1 -0
- package/dist/components/{NewModal → Drawer}/styles.d.ts +55 -56
- package/dist/components/Drawer/styles.js +37 -0
- package/dist/components/Drawer/styles.js.map +1 -0
- package/dist/components/{EmptyPlaceholder.d.ts → EmptyPlaceholder/index.d.ts} +4 -2
- package/dist/components/{EmptyPlaceholder.js → EmptyPlaceholder/index.js} +9 -5
- package/dist/components/EmptyPlaceholder/index.js.map +1 -0
- package/dist/components/EmptyPlaceholder/styles.d.ts +55 -0
- package/dist/components/EmptyPlaceholder/styles.js +32 -0
- package/dist/components/EmptyPlaceholder/styles.js.map +1 -0
- package/dist/components/{FileInput.d.ts → FileInput/index.d.ts} +8 -6
- package/dist/components/{FileInput.js → FileInput/index.js} +13 -30
- package/dist/components/FileInput/index.js.map +1 -0
- package/dist/components/FileInput/styles.d.ts +53 -0
- package/dist/components/FileInput/styles.js +19 -0
- package/dist/components/FileInput/styles.js.map +1 -0
- package/dist/components/Grid/index.d.ts +30 -0
- package/dist/components/Grid/index.js +69 -0
- package/dist/components/Grid/index.js.map +1 -0
- package/dist/components/Grid/styles.d.ts +5 -0
- package/dist/components/Grid/styles.js +19 -0
- package/dist/components/Grid/styles.js.map +1 -0
- package/dist/components/{Icon.d.ts → Icon/index.d.ts} +3 -1
- package/dist/components/{Icon.js → Icon/index.js} +6 -2
- package/dist/components/Icon/index.js.map +1 -0
- package/dist/components/Icon/styles.d.ts +60 -0
- package/dist/components/Icon/styles.js +45 -0
- package/dist/components/Icon/styles.js.map +1 -0
- package/dist/components/{Image.d.ts → Image/index.d.ts} +6 -4
- package/dist/components/{Image.js → Image/index.js} +35 -7
- package/dist/components/Image/index.js.map +1 -0
- package/dist/components/Image/styles.d.ts +54 -0
- package/dist/components/Image/styles.js +25 -0
- package/dist/components/Image/styles.js.map +1 -0
- package/dist/components/ImageView/Spotlight.d.ts +25 -0
- package/dist/components/ImageView/Spotlight.js +155 -0
- package/dist/components/ImageView/Spotlight.js.map +1 -0
- package/dist/components/ImageView/component.d.ts +5 -0
- package/dist/components/ImageView/component.js +54 -0
- package/dist/components/ImageView/component.js.map +1 -0
- package/dist/components/ImageView/index.d.ts +2 -0
- package/dist/components/ImageView/index.js +19 -0
- package/dist/components/ImageView/index.js.map +1 -0
- package/dist/components/List/PaginationIndicator.d.ts +67 -0
- package/dist/components/List/PaginationIndicator.js +51 -0
- package/dist/components/List/PaginationIndicator.js.map +1 -0
- package/dist/components/{List.d.ts → List/index.d.ts} +12 -15
- package/dist/components/List/index.js +68 -0
- package/dist/components/List/index.js.map +1 -0
- package/dist/components/List/styles.d.ts +5 -0
- package/dist/components/List/styles.js +24 -0
- package/dist/components/List/styles.js.map +1 -0
- package/dist/components/Modal/index.d.ts +13 -3
- package/dist/components/Modal/index.js +23 -8
- package/dist/components/Modal/index.js.map +1 -1
- package/dist/components/Modal/styles.d.ts +55 -55
- package/dist/components/Modal/styles.js +4 -3
- package/dist/components/Modal/styles.js.map +1 -1
- package/dist/components/MultiSelect/index.d.ts +6 -0
- package/dist/components/MultiSelect/index.js +106 -0
- package/dist/components/MultiSelect/index.js.map +1 -0
- package/dist/components/MultiSelect/styles.d.ts +58 -0
- package/dist/components/MultiSelect/styles.js +25 -0
- package/dist/components/MultiSelect/styles.js.map +1 -0
- package/dist/components/MultiSelect/types.d.ts +32 -0
- package/dist/components/MultiSelect/types.js +3 -0
- package/dist/components/MultiSelect/types.js.map +1 -0
- package/dist/components/Navigation/Navigation.js +1 -5
- package/dist/components/Navigation/Navigation.js.map +1 -1
- package/dist/components/Pager/index.d.ts +18 -12
- package/dist/components/Pager/index.js +54 -134
- package/dist/components/Pager/index.js.map +1 -1
- package/dist/components/Pager/styles.d.ts +42 -9
- package/dist/components/Pager/styles.js +53 -27
- package/dist/components/Pager/styles.js.map +1 -1
- package/dist/components/RadioInput/index.d.ts +4 -4
- package/dist/components/RadioInput/index.js.map +1 -1
- package/dist/components/RadioInput/styles.d.ts +53 -53
- package/dist/components/RadioInput/styles.js +11 -7
- package/dist/components/RadioInput/styles.js.map +1 -1
- package/dist/components/Scroll/index.d.ts +18 -0
- package/dist/components/{Scroll.js → Scroll/index.js} +14 -11
- package/dist/components/Scroll/index.js.map +1 -0
- package/dist/components/Scroll/styles.d.ts +4 -0
- package/dist/components/Scroll/styles.js +27 -0
- package/dist/components/Scroll/styles.js.map +1 -0
- package/dist/components/Sections/index.d.ts +11 -0
- package/dist/components/{Sections.js → Sections/index.js} +4 -5
- package/dist/components/Sections/index.js.map +1 -0
- package/dist/components/SegmentedControl/index.js.map +1 -1
- package/dist/components/SegmentedControl/styles.d.ts +6 -6
- package/dist/components/Select/index.d.ts +8 -0
- package/dist/components/Select/index.js +38 -80
- package/dist/components/Select/index.js.map +1 -1
- package/dist/components/Select/styles.d.ts +57 -7
- package/dist/components/Select/styles.js +14 -41
- package/dist/components/Select/styles.js.map +1 -1
- package/dist/components/Select/types.d.ts +16 -25
- package/dist/components/Slider/index.d.ts +1 -0
- package/dist/components/Slider/index.js +4 -0
- package/dist/components/Slider/index.js.map +1 -1
- package/dist/components/Slider/styles.d.ts +53 -0
- package/dist/components/Slider/styles.js +61 -0
- package/dist/components/Slider/styles.js.map +1 -0
- package/dist/components/Slider/types.d.ts +3 -2
- package/dist/components/{Switch.d.ts → Switch/index.d.ts} +3 -2
- package/dist/components/{Switch.js → Switch/index.js} +8 -4
- package/dist/components/Switch/index.js.map +1 -0
- package/dist/components/Switch/styles.d.ts +54 -0
- package/dist/components/Switch/styles.js +34 -0
- package/dist/components/Switch/styles.js.map +1 -0
- package/dist/components/{Text.d.ts → Text/index.d.ts} +5 -3
- package/dist/components/{Text.js → Text/index.js} +7 -3
- package/dist/components/Text/index.js.map +1 -0
- package/dist/components/Text/styles.d.ts +65 -0
- package/dist/components/Text/styles.js +23 -0
- package/dist/components/Text/styles.js.map +1 -0
- package/dist/components/TextInput/Label.d.ts +9 -0
- package/dist/components/TextInput/Label.js +34 -0
- package/dist/components/TextInput/Label.js.map +1 -0
- package/dist/components/{TextInput.d.ts → TextInput/index.d.ts} +34 -41
- package/dist/components/{TextInput.js → TextInput/index.js} +51 -48
- package/dist/components/TextInput/index.js.map +1 -0
- package/dist/components/TextInput/styles.d.ts +62 -0
- package/dist/components/TextInput/styles.js +60 -0
- package/dist/components/TextInput/styles.js.map +1 -0
- package/dist/components/{Touchable.d.ts → Touchable/index.d.ts} +8 -4
- package/dist/components/{Touchable.js → Touchable/index.js} +59 -12
- package/dist/components/Touchable/index.js.map +1 -0
- package/dist/components/Touchable/styles.d.ts +53 -0
- package/dist/components/Touchable/styles.js +19 -0
- package/dist/components/Touchable/styles.js.map +1 -0
- package/dist/components/{View.d.ts → View/index.d.ts} +6 -0
- package/dist/components/View/index.js +99 -0
- package/dist/components/View/index.js.map +1 -0
- package/dist/components/View/styles.d.ts +54 -0
- package/dist/components/View/styles.js +29 -0
- package/dist/components/View/styles.js.map +1 -0
- package/dist/components/components.d.ts +10 -3
- package/dist/components/components.js +23 -3
- package/dist/components/components.js.map +1 -1
- package/dist/components/defaultStyles.d.ts +1364 -0
- package/dist/components/defaultStyles.js +63 -0
- package/dist/components/defaultStyles.js.map +1 -0
- package/dist/components/{_Modal → legacy/Modal}/index.d.ts +3 -3
- package/dist/components/{_Modal → legacy/Modal}/index.js +6 -6
- package/dist/components/legacy/Modal/index.js.map +1 -0
- package/dist/components/{_Modal → legacy/Modal}/styles.d.ts +6 -6
- package/dist/components/{_Modal → legacy/Modal}/styles.js +0 -0
- package/dist/components/legacy/Modal/styles.js.map +1 -0
- package/dist/components/legacy/Pager/index.d.ts +20 -0
- package/dist/components/legacy/Pager/index.js +168 -0
- package/dist/components/legacy/Pager/index.js.map +1 -0
- package/dist/components/legacy/Pager/styles.d.ts +54 -0
- package/dist/components/legacy/Pager/styles.js +44 -0
- package/dist/components/legacy/Pager/styles.js.map +1 -0
- package/dist/components/legacy/index.d.ts +2 -0
- package/dist/components/legacy/index.js +19 -0
- package/dist/components/legacy/index.js.map +1 -0
- package/dist/index.d.ts +4 -6
- package/dist/index.js +6 -9
- package/dist/index.js.map +1 -1
- package/dist/modules/reactNavigation.d.ts +2 -0
- package/dist/modules/reactNavigation.js +16 -1
- package/dist/modules/reactNavigation.js.map +1 -1
- package/dist/modules/textInputMask.d.ts +1 -0
- package/dist/modules/textInputMask.js +15 -0
- package/dist/modules/textInputMask.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +18 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/KeyboardAware/index.d.ts +6 -0
- package/dist/utils/KeyboardAware/index.js +31 -0
- package/dist/utils/KeyboardAware/index.js.map +1 -0
- package/dist/utils/KeyboardAware/lib/KeyboardAwareFlatList.d.ts +3 -0
- package/dist/utils/KeyboardAware/lib/KeyboardAwareFlatList.js +9 -0
- package/dist/utils/KeyboardAware/lib/KeyboardAwareFlatList.js.map +1 -0
- package/dist/utils/KeyboardAware/lib/KeyboardAwareHOC.d.ts +65 -0
- package/dist/utils/KeyboardAware/lib/KeyboardAwareHOC.js +450 -0
- package/dist/utils/KeyboardAware/lib/KeyboardAwareHOC.js.map +1 -0
- package/dist/utils/KeyboardAware/lib/KeyboardAwareInterface.d.ts +7 -0
- package/dist/utils/KeyboardAware/lib/KeyboardAwareInterface.js +4 -0
- package/dist/utils/KeyboardAware/lib/KeyboardAwareInterface.js.map +1 -0
- package/dist/utils/KeyboardAware/lib/KeyboardAwareScrollView.d.ts +3 -0
- package/dist/utils/KeyboardAware/lib/KeyboardAwareScrollView.js +10 -0
- package/dist/utils/KeyboardAware/lib/KeyboardAwareScrollView.js.map +1 -0
- package/dist/utils/KeyboardAware/lib/KeyboardAwareSectionList.d.ts +3 -0
- package/dist/utils/KeyboardAware/lib/KeyboardAwareSectionList.js +10 -0
- package/dist/utils/KeyboardAware/lib/KeyboardAwareSectionList.js.map +1 -0
- package/dist/utils/KeyboardAware/types.d.ts +1 -0
- package/dist/utils/KeyboardAware/types.js +7 -0
- package/dist/utils/KeyboardAware/types.js.map +1 -0
- package/dist/utils/ModalManager/components.d.ts +10 -2
- package/dist/utils/ModalManager/components.js +39 -7
- package/dist/utils/ModalManager/components.js.map +1 -1
- package/dist/utils/ModalManager/context.d.ts +1 -0
- package/dist/utils/ModalManager/context.js +6 -0
- package/dist/utils/ModalManager/context.js.map +1 -1
- package/dist/utils/ModalManager/index.d.ts +3 -2
- package/dist/utils/ModalManager/index.js +1 -0
- package/dist/utils/ModalManager/index.js.map +1 -1
- package/dist/utils/PermissionManager/context.js +0 -7
- package/dist/utils/PermissionManager/context.js.map +1 -1
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.js +42 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/misc.d.ts +5 -1
- package/dist/utils/misc.js +62 -1
- package/dist/utils/misc.js.map +1 -1
- package/dist/utils/notifications.d.ts +34 -0
- package/dist/utils/notifications.js +268 -0
- package/dist/utils/notifications.js.map +1 -0
- package/package.json +13 -4
- package/src/components/ActionIcon/index.tsx +31 -0
- package/src/components/ActionIcon/styles.ts +92 -0
- package/src/components/{ActivityIndicator.tsx → ActivityIndicator/index.tsx} +7 -3
- package/src/components/ActivityIndicator/styles.ts +68 -0
- package/src/components/AutoComplete/index.tsx +158 -0
- package/src/components/AutoComplete/styles.ts +49 -0
- package/src/components/{Backdrop.tsx → Backdrop/index.tsx} +9 -42
- package/src/components/Backdrop/styles.ts +33 -0
- package/src/components/{Button.tsx → Button/index.tsx} +64 -11
- package/src/components/Button/styles.ts +105 -0
- package/src/components/Calendar/index.tsx +65 -0
- package/src/components/Calendar/style.ts +35 -0
- package/src/components/Calendar/types.ts +102 -0
- package/src/components/Checkbox/index.tsx +6 -4
- package/src/components/Checkbox/styles.ts +3 -3
- package/src/components/{ContentView.tsx → ContentView/index.tsx} +11 -6
- package/src/components/ContentView/styles.ts +25 -0
- package/src/components/Drawer/index.tsx +24 -0
- package/src/components/Drawer/styles.ts +38 -0
- package/src/components/{EmptyPlaceholder.tsx → EmptyPlaceholder/index.tsx} +14 -7
- package/src/components/EmptyPlaceholder/styles.ts +58 -0
- package/src/components/{FileInput.tsx → FileInput/index.tsx} +19 -28
- package/src/components/FileInput/styles.ts +15 -0
- package/src/components/Grid/index.tsx +107 -0
- package/src/components/Grid/styles.ts +11 -0
- package/src/components/{Icon.tsx → Icon/index.tsx} +8 -3
- package/src/components/Icon/styles.ts +52 -0
- package/src/components/Image/index.tsx +88 -0
- package/src/components/Image/styles.ts +20 -0
- package/src/components/ImageView/Spotlight.tsx +158 -0
- package/src/components/ImageView/component.tsx +38 -0
- package/src/components/ImageView/index.ts +2 -0
- package/src/components/List/PaginationIndicator.tsx +71 -0
- package/src/components/List/index.tsx +108 -0
- package/src/components/List/styles.ts +15 -0
- package/src/components/Modal/index.tsx +75 -39
- package/src/components/Modal/styles.ts +7 -5
- package/src/components/MultiSelect/index.tsx +120 -0
- package/src/components/MultiSelect/styles.ts +25 -0
- package/src/components/MultiSelect/types.ts +39 -0
- package/src/components/Navigation/Navigation.tsx +1 -5
- package/src/components/Pager/index.tsx +81 -202
- package/src/components/Pager/styles.ts +58 -33
- package/src/components/RadioInput/index.tsx +5 -6
- package/src/components/RadioInput/styles.ts +8 -10
- package/src/components/{Scroll.tsx → Scroll/index.tsx} +22 -24
- package/src/components/Scroll/styles.ts +18 -0
- package/src/components/{Sections.tsx → Sections/index.tsx} +5 -15
- package/src/components/SegmentedControl/index.tsx +1 -1
- package/src/components/Select/index.tsx +74 -139
- package/src/components/Select/styles.ts +42 -74
- package/src/components/Select/types.ts +16 -23
- package/src/components/Slider/index.tsx +2 -0
- package/src/components/Slider/styles.ts +75 -0
- package/src/components/Slider/types.ts +7 -2
- package/src/components/{Switch.tsx → Switch/index.tsx} +9 -4
- package/src/components/Switch/styles.ts +37 -0
- package/src/components/{Text.tsx → Text/index.tsx} +7 -3
- package/src/components/Text/styles.ts +34 -0
- package/src/components/TextInput/Label.tsx +26 -0
- package/src/components/{TextInput.tsx → TextInput/index.tsx} +84 -70
- package/src/components/TextInput/styles.ts +120 -0
- package/src/components/Touchable/index.tsx +133 -0
- package/src/components/Touchable/styles.ts +16 -0
- package/src/components/View/index.tsx +89 -0
- package/src/components/View/styles.ts +24 -0
- package/src/components/components.ts +14 -4
- package/src/components/defaultStyles.ts +60 -0
- package/src/components/{_Modal → legacy/Modal}/index.tsx +7 -7
- package/src/components/{_Modal → legacy/Modal}/styles.ts +0 -0
- package/src/components/legacy/Pager/index.tsx +242 -0
- package/src/components/legacy/Pager/styles.ts +51 -0
- package/src/components/legacy/index.ts +2 -0
- package/src/index.ts +4 -9
- package/src/modules/reactNavigation.ts +11 -0
- package/src/modules/textInputMask.ts +2 -0
- package/src/types/index.ts +1 -0
- package/src/utils/KeyboardAware/index.ts +15 -0
- package/src/utils/KeyboardAware/lib/KeyboardAwareFlatList.ts +4 -0
- package/src/utils/KeyboardAware/lib/KeyboardAwareHOC.tsx +608 -0
- package/src/utils/KeyboardAware/lib/KeyboardAwareInterface.ts +13 -0
- package/src/utils/KeyboardAware/lib/KeyboardAwareScrollView.ts +6 -0
- package/src/utils/KeyboardAware/lib/KeyboardAwareSectionList.ts +6 -0
- package/src/utils/KeyboardAware/types.ts +159 -0
- package/src/utils/ModalManager/components.tsx +57 -14
- package/src/utils/ModalManager/context.tsx +10 -0
- package/src/utils/ModalManager/index.ts +4 -1
- package/src/utils/PermissionManager/context.tsx +1 -7
- package/src/utils/index.ts +9 -0
- package/src/utils/misc.ts +61 -2
- package/src/utils/notifications.ts +206 -0
- package/dist/components/ActivityIndicator.js.map +0 -1
- package/dist/components/Backdrop.js.map +0 -1
- package/dist/components/Button.d.ts +0 -132
- package/dist/components/Button.js.map +0 -1
- package/dist/components/ContentView.js.map +0 -1
- package/dist/components/EmptyPlaceholder.js.map +0 -1
- package/dist/components/FileInput.js.map +0 -1
- package/dist/components/Gap.d.ts +0 -8
- package/dist/components/Gap.js +0 -60
- package/dist/components/Gap.js.map +0 -1
- package/dist/components/Icon.js.map +0 -1
- package/dist/components/Image.js.map +0 -1
- package/dist/components/List.js +0 -101
- package/dist/components/List.js.map +0 -1
- package/dist/components/NewModal/index.d.ts +0 -27
- package/dist/components/NewModal/index.js +0 -99
- package/dist/components/NewModal/index.js.map +0 -1
- package/dist/components/NewModal/styles.js +0 -58
- package/dist/components/NewModal/styles.js.map +0 -1
- package/dist/components/NewPager/index.d.ts +0 -26
- package/dist/components/NewPager/index.js +0 -88
- package/dist/components/NewPager/index.js.map +0 -1
- package/dist/components/NewPager/styles.js +0 -70
- package/dist/components/NewPager/styles.js.map +0 -1
- package/dist/components/Overlay.d.ts +0 -16
- package/dist/components/Overlay.js +0 -74
- package/dist/components/Overlay.js.map +0 -1
- package/dist/components/Scroll.d.ts +0 -15
- package/dist/components/Scroll.js.map +0 -1
- package/dist/components/Sections.d.ts +0 -11
- package/dist/components/Sections.js.map +0 -1
- package/dist/components/SegmentedControl.d.ts +0 -5
- package/dist/components/SegmentedControl.js +0 -32
- package/dist/components/SegmentedControl.js.map +0 -1
- package/dist/components/Switch.js.map +0 -1
- package/dist/components/Text.js.map +0 -1
- package/dist/components/TextInput.js.map +0 -1
- package/dist/components/Touchable.js.map +0 -1
- package/dist/components/View.js.map +0 -1
- package/dist/components/_Modal/index.js.map +0 -1
- package/dist/components/_Modal/styles.js.map +0 -1
- package/dist/utils/PermissionManager/components.d.ts +0 -18
- package/dist/utils/PermissionManager/components.js +0 -52
- package/dist/utils/PermissionManager/components.js.map +0 -1
- package/dist/utils/styles.d.ts +0 -1
- package/dist/utils/styles.js +0 -13
- package/dist/utils/styles.js.map +0 -1
- package/src/components/Gap.tsx +0 -40
- package/src/components/Image.tsx +0 -62
- package/src/components/List.tsx +0 -155
- package/src/components/NewPager/index.tsx +0 -121
- package/src/components/NewPager/styles.ts +0 -76
- package/src/components/Overlay.tsx +0 -86
- package/src/components/Touchable.tsx +0 -89
- package/src/components/View.tsx +0 -48
- package/src/utils/styles.ts +0 -14
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import {
|
|
3
|
+
ComponentVariants,
|
|
4
|
+
|
|
5
|
+
useDefaultComponentStyle,
|
|
6
|
+
arePropsEqual,
|
|
7
|
+
FormTypes,
|
|
8
|
+
} from '@codeleap/common'
|
|
9
|
+
import { ComponentPropsWithoutRef } from 'react'
|
|
10
|
+
import {
|
|
11
|
+
Image as NativeImage,
|
|
12
|
+
ImageStyle,
|
|
13
|
+
StyleProp,
|
|
14
|
+
StyleSheet,
|
|
15
|
+
TextStyle,
|
|
16
|
+
ViewStyle,
|
|
17
|
+
} from 'react-native'
|
|
18
|
+
import { FastImage } from '../../modules/fastImage'
|
|
19
|
+
import {
|
|
20
|
+
ImageStyles,
|
|
21
|
+
} from './styles'
|
|
22
|
+
import { useImageSpotlight } from '../ImageView/Spotlight'
|
|
23
|
+
import { Touchable } from '../Touchable'
|
|
24
|
+
import { isFile, toMultipartFile } from '../../utils'
|
|
25
|
+
export * from './styles'
|
|
26
|
+
type NativeImageProps = ComponentPropsWithoutRef<typeof NativeImage>
|
|
27
|
+
export type ImageProps = Omit<NativeImageProps, 'source' | 'style'> & {
|
|
28
|
+
variants?: ComponentVariants<typeof ImageStyles>['variants']
|
|
29
|
+
fast?: boolean
|
|
30
|
+
style?: StyleProp<ImageStyle | TextStyle | ViewStyle>
|
|
31
|
+
source:
|
|
32
|
+
| (NativeImageProps['source'] & {
|
|
33
|
+
priority?: keyof typeof FastImage.priority
|
|
34
|
+
})
|
|
35
|
+
| FormTypes.AnyFile
|
|
36
|
+
| string
|
|
37
|
+
| number
|
|
38
|
+
resizeMode?: keyof typeof FastImage.resizeMode
|
|
39
|
+
spotlight?: string
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const ImageComponent: React.FC<ImageProps> = (props) => {
|
|
43
|
+
const { variants, style, fast = true, spotlight = null, resizeMode = 'contain', source, ...imageProps } = props
|
|
44
|
+
|
|
45
|
+
const variantStyles = useDefaultComponentStyle<'u:Image', typeof ImageStyles>('u:Image', { variants })
|
|
46
|
+
|
|
47
|
+
const styles = StyleSheet.flatten([variantStyles.wrapper, style])
|
|
48
|
+
let imSource = source
|
|
49
|
+
if (isFile(imSource)) {
|
|
50
|
+
imSource = toMultipartFile(imSource)
|
|
51
|
+
}
|
|
52
|
+
const spotlightActions = useImageSpotlight(spotlight, props.source)
|
|
53
|
+
const Wrapper = !!spotlight ? Touchable : ({ children }) => <>{children}</>
|
|
54
|
+
const wrapperProps = {
|
|
55
|
+
onPress: spotlightActions.onImagePressed,
|
|
56
|
+
debugName: `Press spotlight image ${props.source}`,
|
|
57
|
+
style: [variantStyles.touchable],
|
|
58
|
+
android_ripple: null,
|
|
59
|
+
}
|
|
60
|
+
if (fast) {
|
|
61
|
+
return (
|
|
62
|
+
<Wrapper {...wrapperProps}>
|
|
63
|
+
|
|
64
|
+
<FastImage
|
|
65
|
+
style={styles}
|
|
66
|
+
// @ts-ignore
|
|
67
|
+
tintColor={styles?.tintColor}
|
|
68
|
+
source={imSource}
|
|
69
|
+
resizeMode={FastImage.resizeMode[resizeMode || 'contain']}
|
|
70
|
+
{...imageProps}
|
|
71
|
+
/>
|
|
72
|
+
</Wrapper>
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
return <Wrapper {...wrapperProps}>
|
|
76
|
+
<NativeImage style={styles} resizeMode={resizeMode} source={imSource} {...(imageProps as any)} />
|
|
77
|
+
|
|
78
|
+
</Wrapper>
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function areEqual(prevProps, nextProps) {
|
|
82
|
+
const check = ['source', 'style', 'variants', 'resizeMode', 'fast']
|
|
83
|
+
const res = arePropsEqual(prevProps, nextProps, { check })
|
|
84
|
+
return res
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export const Image = React.memo(ImageComponent, areEqual)
|
|
88
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createDefaultVariantFactory, includePresets } from '@codeleap/common'
|
|
2
|
+
|
|
3
|
+
export type ImageComposition = 'wrapper' | 'touchable'
|
|
4
|
+
const createImageStyle = createDefaultVariantFactory<ImageComposition>()
|
|
5
|
+
|
|
6
|
+
const presets = includePresets((styles) => createImageStyle(() => ({ wrapper: styles, touchable: styles })),
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
export const ImageStyles = {
|
|
10
|
+
...presets,
|
|
11
|
+
default: createImageStyle(() => ({
|
|
12
|
+
wrapper: {},
|
|
13
|
+
})),
|
|
14
|
+
|
|
15
|
+
round: createImageStyle(() => ({
|
|
16
|
+
wrapper: {
|
|
17
|
+
borderRadius: 100,
|
|
18
|
+
},
|
|
19
|
+
})),
|
|
20
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import React, { useContext, useState } from 'react'
|
|
2
|
+
import { deepEqual, onUpdate, ReactState, TypeGuards, usePrevious, useUnmount } from '@codeleap/common'
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import { ImageSource } from 'react-native-image-viewing/dist/@types'
|
|
5
|
+
import uuid from 'react-native-uuid'
|
|
6
|
+
import { ImageView } from './component'
|
|
7
|
+
import { ImageProps } from '../Image'
|
|
8
|
+
type TImage = {
|
|
9
|
+
source: ImageSource
|
|
10
|
+
created: number
|
|
11
|
+
id: string
|
|
12
|
+
|
|
13
|
+
}
|
|
14
|
+
type ImageList = Record<string, TImage>
|
|
15
|
+
|
|
16
|
+
type SpotlightState = ReactState<Record<string, ImageList>>
|
|
17
|
+
type IndexState = ReactState<Record<string, number>>
|
|
18
|
+
type TSpotlightCtx = {
|
|
19
|
+
spotlights: SpotlightState[0]
|
|
20
|
+
setSpotlights: SpotlightState[1]
|
|
21
|
+
indexes: IndexState[0]
|
|
22
|
+
setIndexes: IndexState[1]
|
|
23
|
+
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const SpotlightCtx = React.createContext({} as TSpotlightCtx)
|
|
27
|
+
|
|
28
|
+
export const SpotlightProvider:React.FC = ({ children }) => {
|
|
29
|
+
const [spotlights, setSpotlights] = useState<TSpotlightCtx['spotlights']>({})
|
|
30
|
+
const [indexes, setIndexes] = useState<TSpotlightCtx['indexes']>({})
|
|
31
|
+
const ctxValue:TSpotlightCtx = {
|
|
32
|
+
spotlights,
|
|
33
|
+
setSpotlights,
|
|
34
|
+
indexes,
|
|
35
|
+
setIndexes,
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return <SpotlightCtx.Provider value={ctxValue}>
|
|
39
|
+
{children}
|
|
40
|
+
</SpotlightCtx.Provider>
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function useSpotlight(name: string) {
|
|
44
|
+
const ctx = useContext(SpotlightCtx)
|
|
45
|
+
|
|
46
|
+
const imList =
|
|
47
|
+
Object.values(ctx.spotlights[name] || {})
|
|
48
|
+
.sort((a, b) => a.created - b.created)
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
images: imList,
|
|
52
|
+
currentIndex: ctx.indexes[name],
|
|
53
|
+
set(img: ImageSource, id?: string) {
|
|
54
|
+
const newId = id || uuid.v4() as string
|
|
55
|
+
ctx.setSpotlights((prev) => {
|
|
56
|
+
const images = { ...prev[name] }
|
|
57
|
+
|
|
58
|
+
if (id !== null) {
|
|
59
|
+
images[id] = {
|
|
60
|
+
...images[id],
|
|
61
|
+
source: img,
|
|
62
|
+
}
|
|
63
|
+
} else {
|
|
64
|
+
const now = Date.now()
|
|
65
|
+
|
|
66
|
+
images[newId] = {
|
|
67
|
+
created: now,
|
|
68
|
+
id: newId,
|
|
69
|
+
source: img,
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
...prev,
|
|
75
|
+
[name]: images,
|
|
76
|
+
}
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
return newId
|
|
80
|
+
},
|
|
81
|
+
remove(id: string) {
|
|
82
|
+
ctx.setSpotlights((prev) => {
|
|
83
|
+
const images = { ...prev[name] }
|
|
84
|
+
delete images[id]
|
|
85
|
+
return {
|
|
86
|
+
...prev,
|
|
87
|
+
[name]: images,
|
|
88
|
+
}
|
|
89
|
+
})
|
|
90
|
+
},
|
|
91
|
+
open(id: string) {
|
|
92
|
+
const newIdx = imList.findIndex(x => x.id === id)
|
|
93
|
+
ctx.setIndexes((prev) => ({
|
|
94
|
+
...prev,
|
|
95
|
+
[name]: newIdx,
|
|
96
|
+
}))
|
|
97
|
+
},
|
|
98
|
+
close() {
|
|
99
|
+
|
|
100
|
+
ctx.setIndexes((prev) => ({
|
|
101
|
+
...prev,
|
|
102
|
+
[name]: undefined,
|
|
103
|
+
}))
|
|
104
|
+
},
|
|
105
|
+
clear() {
|
|
106
|
+
ctx.setIndexes((prev) => ({
|
|
107
|
+
...prev,
|
|
108
|
+
[name]: undefined,
|
|
109
|
+
}))
|
|
110
|
+
ctx.setSpotlights((prev) => {
|
|
111
|
+
|
|
112
|
+
return {
|
|
113
|
+
...prev,
|
|
114
|
+
[name]: {},
|
|
115
|
+
}
|
|
116
|
+
})
|
|
117
|
+
},
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export const useImageSpotlight = (name: string | null, src: ImageProps['source']) => {
|
|
122
|
+
const [id, setId] = useState(null)
|
|
123
|
+
const spotlight = useSpotlight(name)
|
|
124
|
+
const imSource = TypeGuards.isString(src) ? { uri: src } : src as TImage['source']
|
|
125
|
+
const prevSource = usePrevious(imSource)
|
|
126
|
+
|
|
127
|
+
onUpdate(() => {
|
|
128
|
+
if (!name) return
|
|
129
|
+
if (deepEqual(prevSource, imSource)) return
|
|
130
|
+
setId(spotlight.set(imSource, id))
|
|
131
|
+
}, [src, id])
|
|
132
|
+
|
|
133
|
+
useUnmount(() => {
|
|
134
|
+
if (!name) return
|
|
135
|
+
spotlight.remove(id)
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
return {
|
|
139
|
+
onImagePressed: () => {
|
|
140
|
+
spotlight.open(id)
|
|
141
|
+
},
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export const Spotlight = ({ name }) => {
|
|
146
|
+
const spotlight = useSpotlight(name)
|
|
147
|
+
useUnmount(() => {
|
|
148
|
+
spotlight.clear()
|
|
149
|
+
})
|
|
150
|
+
return <ImageView
|
|
151
|
+
imageIndex={spotlight.currentIndex}
|
|
152
|
+
images={spotlight.images.map(x => x.source)}
|
|
153
|
+
keyExtractor={(_, index) => index.toString()}
|
|
154
|
+
onRequestClose={spotlight.close}
|
|
155
|
+
visible={typeof spotlight.currentIndex !== 'undefined'}
|
|
156
|
+
|
|
157
|
+
/>
|
|
158
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
|
|
3
|
+
import { onUpdate, PropsOf } from '@codeleap/common'
|
|
4
|
+
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
import _ImageView from 'react-native-image-viewing'
|
|
7
|
+
import { StatusBar } from 'react-native'
|
|
8
|
+
import { View } from '../View'
|
|
9
|
+
import { Text } from '../Text'
|
|
10
|
+
|
|
11
|
+
type FooterComponentType = React.ComponentType<{
|
|
12
|
+
imageIndex: number
|
|
13
|
+
imagesLength: number
|
|
14
|
+
}>
|
|
15
|
+
|
|
16
|
+
const FooterComponent: FooterComponentType = ({ imageIndex, imagesLength }) => (
|
|
17
|
+
<View variants={['marginBottom:5', 'alignCenter']}>
|
|
18
|
+
<Text text={imageIndex + 1 + '/' + imagesLength}/>
|
|
19
|
+
</View>
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
export type ImageViewProps = PropsOf<typeof _ImageView>
|
|
23
|
+
|
|
24
|
+
export const ImageView: React.FC<ImageViewProps> = (props) => {
|
|
25
|
+
onUpdate(() => {
|
|
26
|
+
StatusBar.setHidden(props.visible)
|
|
27
|
+
// StatusBar.setBarStyle(`${props.visible ? 'light' : 'dark'}-content`)
|
|
28
|
+
}, [props.visible])
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<_ImageView
|
|
32
|
+
doubleTapToZoomEnabled={false}
|
|
33
|
+
FooterComponent={({ imageIndex }) => <FooterComponent imageIndex={imageIndex} imagesLength={props.images.length}/>}
|
|
34
|
+
presentationStyle={'overFullScreen'}
|
|
35
|
+
{...props}
|
|
36
|
+
/>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {
|
|
3
|
+
assignTextStyle,
|
|
4
|
+
ComponentVariants,
|
|
5
|
+
createDefaultVariantFactory,
|
|
6
|
+
getNestedStylesByKey,
|
|
7
|
+
includePresets,
|
|
8
|
+
TypeGuards,
|
|
9
|
+
useDefaultComponentStyle,
|
|
10
|
+
} from '@codeleap/common'
|
|
11
|
+
import { StyleSheet, ViewStyle } from 'react-native'
|
|
12
|
+
import { StylesOf } from '../../types'
|
|
13
|
+
import { ActivityIndicator, ActivityIndicatorComposition } from '../ActivityIndicator'
|
|
14
|
+
import { Text } from '../Text'
|
|
15
|
+
|
|
16
|
+
export type PaginationIndicatorComposition = 'text' | `loader${Capitalize<ActivityIndicatorComposition>}`
|
|
17
|
+
|
|
18
|
+
const createPaginationIndicatorStyle = createDefaultVariantFactory<PaginationIndicatorComposition>()
|
|
19
|
+
const presets = includePresets((style) => createPaginationIndicatorStyle(() => ({ loaderWrapper: style, text: style })))
|
|
20
|
+
export const PaginationIndicatorStyles = {
|
|
21
|
+
...presets,
|
|
22
|
+
default: createPaginationIndicatorStyle((theme) => {
|
|
23
|
+
return {
|
|
24
|
+
loaderWrapper: {
|
|
25
|
+
...theme.presets.center,
|
|
26
|
+
...theme.spacing.marginVertical(3),
|
|
27
|
+
},
|
|
28
|
+
text: {
|
|
29
|
+
...assignTextStyle('h4')(theme).text,
|
|
30
|
+
...theme.presets.textCenter,
|
|
31
|
+
...theme.spacing.marginVertical(3),
|
|
32
|
+
...theme.presets.fullWidth,
|
|
33
|
+
},
|
|
34
|
+
}
|
|
35
|
+
}),
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export type PaginationIndicatorProps = {
|
|
39
|
+
isFetching?: boolean
|
|
40
|
+
noMoreItemsText: React.ReactChild
|
|
41
|
+
hasMore?: boolean
|
|
42
|
+
activityIndicator?: JSX.Element
|
|
43
|
+
styles?: StylesOf<PaginationIndicatorComposition>
|
|
44
|
+
style?: ViewStyle
|
|
45
|
+
} & ComponentVariants<typeof PaginationIndicatorStyles>
|
|
46
|
+
|
|
47
|
+
export const PaginationIndicator = (props: PaginationIndicatorProps) => {
|
|
48
|
+
const { hasMore, isFetching, noMoreItemsText, style, activityIndicator, styles = {}, variants = [] } = props
|
|
49
|
+
|
|
50
|
+
const variantStyles = useDefaultComponentStyle<
|
|
51
|
+
'u:PaginationIndicator',
|
|
52
|
+
typeof PaginationIndicatorStyles
|
|
53
|
+
>('u:PaginationIndicator', {
|
|
54
|
+
variants,
|
|
55
|
+
styles,
|
|
56
|
+
transform: StyleSheet.flatten,
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
const loaderStyles = getNestedStylesByKey('loader', variantStyles)
|
|
60
|
+
|
|
61
|
+
if (isFetching) {
|
|
62
|
+
return activityIndicator || <ActivityIndicator style={style} styles={loaderStyles}/>
|
|
63
|
+
}
|
|
64
|
+
if (!hasMore) {
|
|
65
|
+
if (TypeGuards.isString(noMoreItemsText) || TypeGuards.isNumber(noMoreItemsText)) {
|
|
66
|
+
return <Text style={[variantStyles.text, style]} text={noMoreItemsText.toString()}/>
|
|
67
|
+
}
|
|
68
|
+
return noMoreItemsText
|
|
69
|
+
}
|
|
70
|
+
return null
|
|
71
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import { forwardRef, useState } from 'react'
|
|
3
|
+
import {
|
|
4
|
+
|
|
5
|
+
useDefaultComponentStyle,
|
|
6
|
+
|
|
7
|
+
ComponentVariants,
|
|
8
|
+
} from '@codeleap/common'
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
import { RefreshControl, FlatList, FlatListProps as RNFlatListProps, ListRenderItemInfo, StyleSheet, RefreshControlProps } from 'react-native'
|
|
12
|
+
import { View, ViewProps } from '../View'
|
|
13
|
+
import { EmptyPlaceholder, EmptyPlaceholderProps } from '../EmptyPlaceholder'
|
|
14
|
+
import { ListComposition, ListStyles } from './styles'
|
|
15
|
+
import { StylesOf } from '../../types'
|
|
16
|
+
import { KeyboardAwareFlatList } from '../../utils'
|
|
17
|
+
|
|
18
|
+
export type DataboundFlatListPropsTypes = 'data' | 'renderItem' | 'keyExtractor' | 'getItemLayout'
|
|
19
|
+
|
|
20
|
+
export type ReplaceFlatlistProps<P, T> = Omit<P, DataboundFlatListPropsTypes> & {
|
|
21
|
+
data: T[]
|
|
22
|
+
keyExtractor?: (item: T, index: number) => string
|
|
23
|
+
renderItem: (data: ListRenderItemInfo<T>) => React.ReactElement
|
|
24
|
+
onRefresh?: () => void
|
|
25
|
+
getItemLayout?: ((
|
|
26
|
+
data:T,
|
|
27
|
+
index: number,
|
|
28
|
+
) => { length: number; offset: number; index: number })
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export * from './styles'
|
|
32
|
+
export * from './PaginationIndicator'
|
|
33
|
+
|
|
34
|
+
export type FlatListProps<
|
|
35
|
+
T = any[],
|
|
36
|
+
Data = T extends Array<infer D> ? D : never
|
|
37
|
+
> =RNFlatListProps<Data> &
|
|
38
|
+
Omit<ViewProps, 'variants'> & {
|
|
39
|
+
separators?: boolean
|
|
40
|
+
placeholder?: EmptyPlaceholderProps
|
|
41
|
+
keyboardAware?: boolean
|
|
42
|
+
styles?: StylesOf<ListComposition>
|
|
43
|
+
refreshControlProps?: Partial<RefreshControlProps>
|
|
44
|
+
} & ComponentVariants<typeof ListStyles>
|
|
45
|
+
|
|
46
|
+
const ListCP = forwardRef<FlatList, FlatListProps>(
|
|
47
|
+
(flatListProps, ref) => {
|
|
48
|
+
const {
|
|
49
|
+
variants = [],
|
|
50
|
+
style,
|
|
51
|
+
styles = {},
|
|
52
|
+
onRefresh,
|
|
53
|
+
refreshing,
|
|
54
|
+
placeholder,
|
|
55
|
+
keyboardAware = true,
|
|
56
|
+
refreshControlProps = {},
|
|
57
|
+
...props
|
|
58
|
+
} = flatListProps
|
|
59
|
+
|
|
60
|
+
const variantStyles = useDefaultComponentStyle<'u:List', typeof ListStyles>('u:List', {
|
|
61
|
+
variants,
|
|
62
|
+
styles,
|
|
63
|
+
transform: StyleSheet.flatten,
|
|
64
|
+
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
const renderSeparator = () => {
|
|
68
|
+
return (
|
|
69
|
+
<View variants={['separator']}></View>
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const separatorProp = props.separators
|
|
74
|
+
const isEmpty = !props.data || !props.data.length
|
|
75
|
+
const separator = !isEmpty && separatorProp == true && renderSeparator
|
|
76
|
+
|
|
77
|
+
const Component:any = keyboardAware ? KeyboardAwareFlatList : FlatList
|
|
78
|
+
const refreshStyles = StyleSheet.flatten([variantStyles.refreshControl, styles.refreshControl])
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<Component
|
|
82
|
+
style={[variantStyles.wrapper, style]}
|
|
83
|
+
contentContainerStyle={variantStyles.content}
|
|
84
|
+
ref={ref as unknown as FlatList}
|
|
85
|
+
ItemSeparatorComponent={separator}
|
|
86
|
+
refreshControl={
|
|
87
|
+
!!onRefresh && (
|
|
88
|
+
<RefreshControl
|
|
89
|
+
refreshing={refreshing}
|
|
90
|
+
onRefresh={onRefresh}
|
|
91
|
+
tintColor={refreshStyles?.color}
|
|
92
|
+
colors={[refreshStyles?.color]}
|
|
93
|
+
{...refreshControlProps}
|
|
94
|
+
/>
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
ListEmptyComponent={<EmptyPlaceholder {...placeholder}/>}
|
|
99
|
+
{...props}
|
|
100
|
+
/>
|
|
101
|
+
)
|
|
102
|
+
},
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
export type ListComponentType = <T extends any[] = any[]>(props: FlatListProps<T>) => React.ReactElement
|
|
106
|
+
|
|
107
|
+
export const List = ListCP as ListComponentType
|
|
108
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createDefaultVariantFactory } from '@codeleap/common'
|
|
2
|
+
import { ScrollComposition, ScrollStyles } from '../Scroll/styles'
|
|
3
|
+
|
|
4
|
+
export type ListComposition = ScrollComposition
|
|
5
|
+
|
|
6
|
+
const createListStyle = createDefaultVariantFactory<ListComposition>()
|
|
7
|
+
|
|
8
|
+
export const ListStyles = {
|
|
9
|
+
default: createListStyle((theme) => {
|
|
10
|
+
const defaultStyles = ScrollStyles.default(theme)
|
|
11
|
+
return {
|
|
12
|
+
...defaultStyles,
|
|
13
|
+
}
|
|
14
|
+
}),
|
|
15
|
+
}
|
|
@@ -11,9 +11,9 @@ import {
|
|
|
11
11
|
useDefaultComponentStyle,
|
|
12
12
|
} from '@codeleap/common'
|
|
13
13
|
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
ModalComposition,
|
|
15
|
+
ModalStyles,
|
|
16
|
+
ModalParts,
|
|
17
17
|
} from './styles'
|
|
18
18
|
import { StyleSheet } from 'react-native'
|
|
19
19
|
import { StylesOf } from '../../types/utility'
|
|
@@ -21,14 +21,14 @@ import { StylesOf } from '../../types/utility'
|
|
|
21
21
|
import { useDynamicAnimation } from 'moti'
|
|
22
22
|
import { Backdrop } from '../Backdrop'
|
|
23
23
|
import { useStaticAnimationStyles } from '../../utils/hooks'
|
|
24
|
-
import { Text } from '../Text'
|
|
24
|
+
import { Text, TextProps } from '../Text'
|
|
25
25
|
import { Touchable } from '../Touchable'
|
|
26
26
|
|
|
27
27
|
export * from './styles'
|
|
28
28
|
|
|
29
29
|
export type ModalProps = Omit<ViewProps, 'variants' | 'styles'> & {
|
|
30
|
-
variants?: ComponentVariants<typeof
|
|
31
|
-
styles?: StylesOf<
|
|
30
|
+
variants?: ComponentVariants<typeof ModalStyles>['variants']
|
|
31
|
+
styles?: StylesOf<ModalComposition>
|
|
32
32
|
dismissOnBackdrop?: boolean
|
|
33
33
|
buttonProps?: ButtonProps
|
|
34
34
|
accessible?: boolean
|
|
@@ -42,7 +42,41 @@ export type ModalProps = Omit<ViewProps, 'variants' | 'styles'> & {
|
|
|
42
42
|
toggle?: () => void
|
|
43
43
|
zIndex?: number
|
|
44
44
|
scroll?: boolean
|
|
45
|
+
header?: React.ReactElement
|
|
45
46
|
keyboardAware?: boolean
|
|
47
|
+
renderHeader?: (props: ModalHeaderProps) => React.ReactElement
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export type ModalHeaderProps = Omit<ModalProps, 'styles' | 'renderHeader'> & {
|
|
51
|
+
styles: {
|
|
52
|
+
wrapper: ViewProps['style']
|
|
53
|
+
title: TextProps['style']
|
|
54
|
+
closeButton: ButtonProps['styles']
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const DefaultHeader:React.FC<ModalHeaderProps> = (props) => {
|
|
59
|
+
const { styles, title, showClose, closable, debugName, closeIconName, toggle } = props
|
|
60
|
+
return <>
|
|
61
|
+
{(title || showClose) && (
|
|
62
|
+
<View style={styles.wrapper}>
|
|
63
|
+
{typeof title === 'string' ? (
|
|
64
|
+
<Text text={title} style={styles.title} />
|
|
65
|
+
) : (
|
|
66
|
+
title
|
|
67
|
+
)}
|
|
68
|
+
|
|
69
|
+
{(showClose && closable) && (
|
|
70
|
+
<Button
|
|
71
|
+
debugName={`${debugName} modal close button`}
|
|
72
|
+
icon={closeIconName as IconPlaceholder}
|
|
73
|
+
variants={['icon']}
|
|
74
|
+
onPress={toggle}
|
|
75
|
+
styles={styles.closeButton}
|
|
76
|
+
/>
|
|
77
|
+
)}
|
|
78
|
+
</View>
|
|
79
|
+
)}</>
|
|
46
80
|
}
|
|
47
81
|
|
|
48
82
|
export const Modal: React.FC<ModalProps> = (modalProps) => {
|
|
@@ -50,16 +84,17 @@ export const Modal: React.FC<ModalProps> = (modalProps) => {
|
|
|
50
84
|
variants = [],
|
|
51
85
|
styles = {},
|
|
52
86
|
visible,
|
|
53
|
-
|
|
87
|
+
|
|
54
88
|
closable = true,
|
|
55
|
-
|
|
89
|
+
|
|
56
90
|
footer,
|
|
57
91
|
children,
|
|
58
92
|
toggle = () => null,
|
|
59
93
|
dismissOnBackdrop = true,
|
|
60
|
-
|
|
94
|
+
header = null,
|
|
61
95
|
debugName,
|
|
62
96
|
scroll = true,
|
|
97
|
+
renderHeader,
|
|
63
98
|
keyboardAware = true,
|
|
64
99
|
zIndex = null,
|
|
65
100
|
...props
|
|
@@ -71,7 +106,7 @@ export const Modal: React.FC<ModalProps> = (modalProps) => {
|
|
|
71
106
|
styles,
|
|
72
107
|
}) as ModalProps['styles']
|
|
73
108
|
|
|
74
|
-
function getStyles(key:
|
|
109
|
+
function getStyles(key: ModalParts) {
|
|
75
110
|
const s = [
|
|
76
111
|
variantStyles[key],
|
|
77
112
|
styles[key],
|
|
@@ -91,8 +126,24 @@ export const Modal: React.FC<ModalProps> = (modalProps) => {
|
|
|
91
126
|
boxAnimation.animateTo(visible ? boxAnimationStates['box:visible'] : boxAnimationStates['box:hidden'])
|
|
92
127
|
}, [visible])
|
|
93
128
|
const wrapperStyle = getStyles('wrapper')
|
|
129
|
+
const ScrollComponent = scroll ? Scroll : View
|
|
130
|
+
const scrollStyle = scroll ? getStyles('innerWrapper') : [getStyles('innerWrapper'), getStyles('innerWrapperScroll')]
|
|
131
|
+
|
|
132
|
+
const headerProps:ModalHeaderProps = {
|
|
133
|
+
...modalProps,
|
|
134
|
+
styles: {
|
|
135
|
+
wrapper: getStyles('header'),
|
|
136
|
+
title: getStyles('title'),
|
|
137
|
+
closeButton: buttonStyles,
|
|
138
|
+
},
|
|
139
|
+
}
|
|
140
|
+
const Header = renderHeader || DefaultHeader
|
|
141
|
+
|
|
94
142
|
return (
|
|
95
|
-
<View
|
|
143
|
+
<View
|
|
144
|
+
style={[wrapperStyle, { zIndex: TypeGuards.isNumber(zIndex) ? zIndex : wrapperStyle?.zIndex }]}
|
|
145
|
+
pointerEvents={visible ? 'auto' : 'none'}
|
|
146
|
+
>
|
|
96
147
|
|
|
97
148
|
<Backdrop visible={visible} debugName={`Modal ${debugName} backdrop`} styles={{
|
|
98
149
|
'wrapper:hidden': variantStyles['backdrop:hidden'],
|
|
@@ -103,18 +154,20 @@ export const Modal: React.FC<ModalProps> = (modalProps) => {
|
|
|
103
154
|
transition: { ...variantStyles['backdrop:transition'] },
|
|
104
155
|
}}
|
|
105
156
|
/>
|
|
106
|
-
<
|
|
107
|
-
style={
|
|
157
|
+
<ScrollComponent
|
|
158
|
+
style={scrollStyle}
|
|
108
159
|
contentContainerStyle={getStyles('innerWrapperScroll')}
|
|
109
160
|
scrollEnabled={scroll}
|
|
110
161
|
keyboardAware={keyboardAware}
|
|
111
162
|
>
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
163
|
+
{dismissOnBackdrop &&
|
|
164
|
+
<Touchable
|
|
165
|
+
feedbackVariant='none'
|
|
166
|
+
onPress={ closable ? toggle : (() => {})}
|
|
167
|
+
debugName={'Modal backdrop touchable'}
|
|
168
|
+
style={variantStyles.backdropTouchable}
|
|
169
|
+
android_ripple={null}
|
|
170
|
+
/>}
|
|
118
171
|
<View
|
|
119
172
|
animated
|
|
120
173
|
state={boxAnimation}
|
|
@@ -122,25 +175,8 @@ export const Modal: React.FC<ModalProps> = (modalProps) => {
|
|
|
122
175
|
transition={{ ...variantStyles['box:transition'] }}
|
|
123
176
|
{...props}
|
|
124
177
|
>
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
{typeof title === 'string' ? (
|
|
128
|
-
<Text text={title} style={getStyles('title')} />
|
|
129
|
-
) : (
|
|
130
|
-
title
|
|
131
|
-
)}
|
|
132
|
-
|
|
133
|
-
{(showClose && closable) && (
|
|
134
|
-
<Button
|
|
135
|
-
debugName={`${debugName} modal close button`}
|
|
136
|
-
icon={closeIconName as IconPlaceholder}
|
|
137
|
-
variants={['icon']}
|
|
138
|
-
onPress={toggle}
|
|
139
|
-
styles={buttonStyles}
|
|
140
|
-
/>
|
|
141
|
-
)}
|
|
142
|
-
</View>
|
|
143
|
-
)}
|
|
178
|
+
|
|
179
|
+
{header ? header : <Header {...headerProps}/>}
|
|
144
180
|
|
|
145
181
|
<View style={getStyles('body')}>{children}</View>
|
|
146
182
|
{footer && (
|
|
@@ -149,7 +185,7 @@ export const Modal: React.FC<ModalProps> = (modalProps) => {
|
|
|
149
185
|
</View>
|
|
150
186
|
)}
|
|
151
187
|
</View>
|
|
152
|
-
</
|
|
188
|
+
</ScrollComponent>
|
|
153
189
|
</View>
|
|
154
190
|
|
|
155
191
|
)
|