@codeleap/mobile 1.9.33 → 2.0.2
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 -13
- package/dist/components/Button/index.js.map +1 -0
- package/dist/components/Button/styles.d.ts +65 -0
- package/dist/components/Button/styles.js +61 -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 +5 -3
- package/dist/components/Checkbox/index.js.map +1 -1
- package/dist/components/Checkbox/styles.d.ts +53 -53
- package/dist/components/Checkbox/styles.js +6 -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/{NewPager → Icon}/styles.d.ts +59 -86
- 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} +38 -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 +22 -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/Navigation/utils.js +0 -1
- package/dist/components/Navigation/utils.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 -25
- package/dist/components/Pager/styles.js.map +1 -1
- package/dist/components/RadioInput/index.d.ts +4 -4
- package/dist/components/RadioInput/index.js +3 -1
- package/dist/components/RadioInput/index.js.map +1 -1
- package/dist/components/RadioInput/styles.d.ts +54 -54
- package/dist/components/RadioInput/styles.js +12 -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.d.ts +10 -1
- package/dist/components/SegmentedControl/index.js +27 -27
- package/dist/components/SegmentedControl/index.js.map +1 -1
- package/dist/components/SegmentedControl/styles.d.ts +56 -51
- package/dist/components/SegmentedControl/styles.js +10 -3
- package/dist/components/SegmentedControl/styles.js.map +1 -1
- package/dist/components/Select/index.d.ts +8 -0
- package/dist/components/Select/index.js +37 -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 +17 -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} +9 -5
- 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} +7 -3
- package/dist/components/{Text.js → Text/index.js} +53 -5
- package/dist/components/Text/index.js.map +1 -0
- package/dist/components/Text/styles.d.ts +70 -0
- package/dist/components/Text/styles.js +31 -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} +42 -45
- package/dist/components/TextInput/index.js +204 -0
- package/dist/components/TextInput/index.js.map +1 -0
- package/dist/components/TextInput/styles.d.ts +62 -0
- package/dist/components/TextInput/styles.js +68 -0
- package/dist/components/TextInput/styles.js.map +1 -0
- package/dist/components/Touchable/index.d.ts +20 -0
- package/dist/components/Touchable/index.js +165 -0
- package/dist/components/Touchable/index.js.map +1 -0
- package/dist/components/Touchable/styles.d.ts +58 -0
- package/dist/components/Touchable/styles.js +24 -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 +67 -0
- package/dist/utils/KeyboardAware/lib/KeyboardAwareHOC.js +451 -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/OSAlert.d.ts +6 -5
- package/dist/utils/OSAlert.js +7 -6
- package/dist/utils/OSAlert.js.map +1 -1
- package/dist/utils/PermissionManager/context.js +0 -7
- package/dist/utils/PermissionManager/context.js.map +1 -1
- package/dist/utils/hooks.d.ts +34 -1
- package/dist/utils/hooks.js +54 -1
- package/dist/utils/hooks.js.map +1 -1
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.js +38 -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} +62 -13
- package/src/components/Button/styles.ts +129 -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 +10 -5
- package/src/components/Checkbox/styles.ts +8 -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 +91 -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 +18 -0
- package/src/components/MultiSelect/types.ts +39 -0
- package/src/components/Navigation/Navigation.tsx +1 -5
- package/src/components/Navigation/utils.tsx +0 -2
- package/src/components/Pager/index.tsx +81 -202
- package/src/components/Pager/styles.ts +57 -27
- package/src/components/RadioInput/index.tsx +8 -7
- package/src/components/RadioInput/styles.ts +10 -11
- 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 +30 -17
- package/src/components/SegmentedControl/styles.ts +29 -7
- package/src/components/Select/index.tsx +78 -142
- package/src/components/Select/styles.ts +52 -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} +10 -5
- package/src/components/Switch/styles.ts +37 -0
- package/src/components/Text/index.tsx +102 -0
- package/src/components/Text/styles.ts +50 -0
- package/src/components/TextInput/Label.tsx +26 -0
- package/src/components/{TextInput.tsx → TextInput/index.tsx} +124 -75
- package/src/components/TextInput/styles.ts +130 -0
- package/src/components/Touchable/index.tsx +182 -0
- package/src/components/Touchable/styles.ts +28 -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 +618 -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/OSAlert.ts +10 -10
- package/src/utils/PermissionManager/context.tsx +1 -7
- package/src/utils/hooks.ts +82 -2
- 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 +0 -181
- package/dist/components/TextInput.js.map +0 -1
- package/dist/components/Touchable.d.ts +0 -16
- package/dist/components/Touchable.js +0 -83
- 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/Text.tsx +0 -43
- package/src/components/Touchable.tsx +0 -89
- package/src/components/View.tsx +0 -48
- package/src/utils/styles.ts +0 -14
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { assignTextStyle, createDefaultVariantFactory, includePresets } from '@codeleap/common'
|
|
2
|
+
|
|
3
|
+
export type SliderComposition =
|
|
4
|
+
| 'wrapper'
|
|
5
|
+
| 'handle'
|
|
6
|
+
| 'track'
|
|
7
|
+
| 'label'
|
|
8
|
+
| 'selectedTrack'
|
|
9
|
+
| 'inputContainer'
|
|
10
|
+
| 'tooltip'
|
|
11
|
+
| 'tooltip:visible'
|
|
12
|
+
| 'tooltip:hidden'
|
|
13
|
+
| 'trackLabels'
|
|
14
|
+
| 'mark'
|
|
15
|
+
| 'tooltipArrow'
|
|
16
|
+
| 'tooltipText'
|
|
17
|
+
|
|
18
|
+
const createSliderStyle = createDefaultVariantFactory<SliderComposition>()
|
|
19
|
+
|
|
20
|
+
const presets = includePresets((styles) => createSliderStyle(() => ({ wrapper: styles })),
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
export const SliderStyles = {
|
|
24
|
+
...presets,
|
|
25
|
+
default: createSliderStyle((theme) => ({
|
|
26
|
+
wrapper: {},
|
|
27
|
+
handle: {
|
|
28
|
+
backgroundColor: theme.colors.primary,
|
|
29
|
+
},
|
|
30
|
+
selectedTrack: {
|
|
31
|
+
backgroundColor: theme.colors.primary,
|
|
32
|
+
},
|
|
33
|
+
track: {
|
|
34
|
+
backgroundColor: theme.colors.gray,
|
|
35
|
+
},
|
|
36
|
+
tooltip: {
|
|
37
|
+
padding: theme.spacing.value(0.5),
|
|
38
|
+
backgroundColor: theme.colors.primary,
|
|
39
|
+
position: 'relative',
|
|
40
|
+
borderRadius: theme.borderRadius.small,
|
|
41
|
+
},
|
|
42
|
+
'tooltip:visible': {
|
|
43
|
+
opacity: 1,
|
|
44
|
+
},
|
|
45
|
+
'tooltip:hidden': {
|
|
46
|
+
opacity: 0,
|
|
47
|
+
},
|
|
48
|
+
mark: {
|
|
49
|
+
position: 'absolute',
|
|
50
|
+
backgroundColor: theme.colors.primary,
|
|
51
|
+
borderRadius: 29,
|
|
52
|
+
height: 10,
|
|
53
|
+
width: 10,
|
|
54
|
+
top: -5,
|
|
55
|
+
},
|
|
56
|
+
trackLabels: {
|
|
57
|
+
position: 'absolute',
|
|
58
|
+
top: 8,
|
|
59
|
+
...assignTextStyle('p3')(theme).text,
|
|
60
|
+
},
|
|
61
|
+
tooltipArrow: {
|
|
62
|
+
height: 6,
|
|
63
|
+
width: 6,
|
|
64
|
+
position: 'absolute',
|
|
65
|
+
backgroundColor: theme.colors.primary,
|
|
66
|
+
transform: [{ rotate: '45deg' }],
|
|
67
|
+
bottom: -3,
|
|
68
|
+
left: '50%',
|
|
69
|
+
},
|
|
70
|
+
tooltipText: {
|
|
71
|
+
color: theme.colors.white,
|
|
72
|
+
...assignTextStyle('p3')(theme).text,
|
|
73
|
+
},
|
|
74
|
+
})),
|
|
75
|
+
}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import { ComponentVariants, Form
|
|
1
|
+
import { ComponentVariants, Form } from '@codeleap/common'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
SliderComposition, SliderStyles,
|
|
5
|
+
} from './styles'
|
|
6
|
+
|
|
2
7
|
import { SliderProps as RNSliderProps } from '@miblanchard/react-native-slider/lib/types'
|
|
3
|
-
import { StylesOf } from '../../types
|
|
8
|
+
import { StylesOf } from '../../types'
|
|
4
9
|
import { ViewProps } from '../View'
|
|
5
10
|
export type SliderProps = Partial<Omit<RNSliderProps, 'value' | 'onValueChange'>> & {
|
|
6
11
|
debounce?: number
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
SwitchComposition,
|
|
3
|
+
|
|
5
4
|
ComponentVariants,
|
|
6
5
|
useDefaultComponentStyle,
|
|
7
6
|
StylesOf,
|
|
@@ -11,9 +10,14 @@ import {
|
|
|
11
10
|
} from '@codeleap/common'
|
|
12
11
|
import { ComponentPropsWithRef, forwardRef, ReactNode } from 'react'
|
|
13
12
|
import { StyleSheet, Switch as NativeSwitch } from 'react-native'
|
|
14
|
-
import { InputLabel, FormError } from '
|
|
15
|
-
import { View } from '
|
|
13
|
+
import { InputLabel, FormError } from '../TextInput'
|
|
14
|
+
import { View } from '../View'
|
|
16
15
|
|
|
16
|
+
import {
|
|
17
|
+
SwitchStyles,
|
|
18
|
+
SwitchComposition,
|
|
19
|
+
} from './styles'
|
|
20
|
+
export * from './styles'
|
|
17
21
|
type NativeSwitchProps = Omit<
|
|
18
22
|
ComponentPropsWithRef<typeof NativeSwitch>,
|
|
19
23
|
'thumbColor' | 'trackColor'
|
|
@@ -70,11 +74,12 @@ export const Switch = forwardRef<NativeSwitch, SwitchProps>(
|
|
|
70
74
|
trackColor={{ false: trackColor, true: trackColor }}
|
|
71
75
|
ios_backgroundColor={trackColor}
|
|
72
76
|
value={value}
|
|
77
|
+
ref={ref}
|
|
73
78
|
{...props}
|
|
74
79
|
/>
|
|
75
80
|
<InputLabel label={label} style={getStyles('label')} />
|
|
76
81
|
</View>
|
|
77
|
-
<FormError
|
|
82
|
+
<FormError text={error.message} style={getStyles('error')} />
|
|
78
83
|
</View>
|
|
79
84
|
)
|
|
80
85
|
},
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { createDefaultVariantFactory, includePresets } from '@codeleap/common'
|
|
2
|
+
|
|
3
|
+
export type SwitchParts = 'wrapper' | 'label' | 'input' | 'error' | 'inputWrapper'
|
|
4
|
+
export type SwitchComposition =
|
|
5
|
+
| SwitchParts
|
|
6
|
+
| `${SwitchParts}:disabled`
|
|
7
|
+
| `${SwitchParts}:on`
|
|
8
|
+
|
|
9
|
+
const createSwitchStyle = createDefaultVariantFactory<SwitchComposition>()
|
|
10
|
+
|
|
11
|
+
const presets = includePresets((styles) => createSwitchStyle(() => ({ wrapper: styles })),
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
export const SwitchStyles = {
|
|
15
|
+
...presets,
|
|
16
|
+
default: createSwitchStyle((theme) => ({
|
|
17
|
+
wrapper: {},
|
|
18
|
+
inputWrapper: {
|
|
19
|
+
...theme.presets.row,
|
|
20
|
+
...theme.presets.alignCenter,
|
|
21
|
+
},
|
|
22
|
+
label: {
|
|
23
|
+
...theme.spacing.marginLeft(0.5),
|
|
24
|
+
},
|
|
25
|
+
input: {
|
|
26
|
+
color: theme.colors.white,
|
|
27
|
+
backgroundColor: theme.colors.gray,
|
|
28
|
+
},
|
|
29
|
+
'input:on': {
|
|
30
|
+
color: theme.colors.primary,
|
|
31
|
+
backgroundColor: theme.colors.gray,
|
|
32
|
+
},
|
|
33
|
+
error: {
|
|
34
|
+
color: theme.colors.negative,
|
|
35
|
+
},
|
|
36
|
+
})),
|
|
37
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import { ComponentPropsWithoutRef, forwardRef } from 'react'
|
|
3
|
+
import {
|
|
4
|
+
ComponentVariants,
|
|
5
|
+
useDefaultComponentStyle,
|
|
6
|
+
BaseViewProps,
|
|
7
|
+
TypeGuards,
|
|
8
|
+
useState,
|
|
9
|
+
} from '@codeleap/common'
|
|
10
|
+
import { Animated, GestureResponderEvent, Platform, StyleSheet, Text as NativeText } from 'react-native'
|
|
11
|
+
import { MotiText as _MotiText, MotiProps } from 'moti'
|
|
12
|
+
import { useAnimateColor, usePressableFeedback } from '../../utils'
|
|
13
|
+
import { TextStyles } from './styles'
|
|
14
|
+
import { View } from '../View'
|
|
15
|
+
|
|
16
|
+
export * from './styles'
|
|
17
|
+
|
|
18
|
+
export type TextProps = ComponentPropsWithoutRef<typeof NativeText> & {
|
|
19
|
+
text?: React.ReactNode
|
|
20
|
+
variants?: ComponentVariants<typeof TextStyles>['variants']
|
|
21
|
+
animated?: boolean
|
|
22
|
+
colorChangeConfig?: Partial<Animated.TimingAnimationConfig>
|
|
23
|
+
debugName?: string
|
|
24
|
+
} & BaseViewProps & MotiProps
|
|
25
|
+
|
|
26
|
+
const MotiText = Animated.createAnimatedComponent(_MotiText)
|
|
27
|
+
|
|
28
|
+
export const Text = forwardRef<NativeText, TextProps>((textProps, ref) => {
|
|
29
|
+
const { variants = [], text, children, style, colorChangeConfig, ...props } = textProps
|
|
30
|
+
|
|
31
|
+
const pressPolyfillEnabled = Platform.OS === 'android' && !!props.onPress
|
|
32
|
+
|
|
33
|
+
const [pressed, setPressed] = useState(false)
|
|
34
|
+
const handlePress = (pressed) => {
|
|
35
|
+
if (!pressPolyfillEnabled) return
|
|
36
|
+
return () => {
|
|
37
|
+
if (props.onPress) {
|
|
38
|
+
setPressed(pressed)
|
|
39
|
+
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const variantStyles = useDefaultComponentStyle<'u:Text', typeof TextStyles>('u:Text', {
|
|
44
|
+
variants,
|
|
45
|
+
transform: StyleSheet.flatten,
|
|
46
|
+
rootElement: 'text',
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
const styles = StyleSheet.flatten([variantStyles.text, style])
|
|
50
|
+
|
|
51
|
+
const animatedColor = useAnimateColor(styles.color, colorChangeConfig)
|
|
52
|
+
|
|
53
|
+
if (!!text && !TypeGuards.isString(text)) return <>{text}</>
|
|
54
|
+
|
|
55
|
+
const Component = textProps.animated ? MotiText : NativeText
|
|
56
|
+
|
|
57
|
+
const colorStyle = { color: props.animated ? animatedColor : styles.color }
|
|
58
|
+
|
|
59
|
+
const { getFeedbackStyle } = usePressableFeedback(styles, {
|
|
60
|
+
disabled: !pressPolyfillEnabled,
|
|
61
|
+
feedbackConfig: variantStyles.pressFeedback,
|
|
62
|
+
hightlightPropertyIn: 'color',
|
|
63
|
+
hightlightPropertyOut: 'backgroundColor',
|
|
64
|
+
})
|
|
65
|
+
const feedbackStyle = pressPolyfillEnabled ? getFeedbackStyle(pressed) : undefined
|
|
66
|
+
|
|
67
|
+
return <Component {...props}
|
|
68
|
+
onPressIn={handlePress(true)} onPressOut={handlePress(false)}
|
|
69
|
+
style={[styles, colorStyle, feedbackStyle]}
|
|
70
|
+
// @ts-ignore
|
|
71
|
+
ref={ref}
|
|
72
|
+
>
|
|
73
|
+
{text}
|
|
74
|
+
</Component>
|
|
75
|
+
|
|
76
|
+
// @ts-ignore
|
|
77
|
+
return <Component {...props} style={[styles, colorStyle]} ref={ref}>
|
|
78
|
+
{text}
|
|
79
|
+
{children}
|
|
80
|
+
</Component>
|
|
81
|
+
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
// const childArr = React.Children.toArray([
|
|
85
|
+
// text,
|
|
86
|
+
// children,
|
|
87
|
+
// ])
|
|
88
|
+
|
|
89
|
+
// return <View style={[styles, colorStyle]}>
|
|
90
|
+
// {
|
|
91
|
+
// childArr.map((child) => {
|
|
92
|
+
// if (TypeGuards.isString(child)) {
|
|
93
|
+
// // @ts-ignore
|
|
94
|
+
// return <Component {...props} ref={ref}>
|
|
95
|
+
// {child}
|
|
96
|
+
// </Component>
|
|
97
|
+
|
|
98
|
+
// }
|
|
99
|
+
// return child
|
|
100
|
+
// })
|
|
101
|
+
// }
|
|
102
|
+
// </View>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { assignTextStyle, createDefaultVariantFactory, includePresets, shadeColor, StylesOf } from '@codeleap/common'
|
|
2
|
+
import { FeedbackConfig } from '../../utils'
|
|
3
|
+
|
|
4
|
+
export type TextComposition = 'text' | 'touchFeedback'
|
|
5
|
+
|
|
6
|
+
export type TextStylesGen<TCSS = any> = StylesOf<'text', TCSS> & {
|
|
7
|
+
'pressFeedback'?: FeedbackConfig
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const createTextStyle = createDefaultVariantFactory<
|
|
11
|
+
TextComposition, TextStylesGen
|
|
12
|
+
>()
|
|
13
|
+
|
|
14
|
+
const presets = includePresets((styles) => createTextStyle(() => ({ text: styles })),
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
export const TextStyles = {
|
|
18
|
+
...presets,
|
|
19
|
+
default: createTextStyle((theme) => {
|
|
20
|
+
const defaultStyle = assignTextStyle('p1')(theme).text
|
|
21
|
+
return {
|
|
22
|
+
text: {
|
|
23
|
+
fontFamily: theme.typography.fontFamily,
|
|
24
|
+
...defaultStyle,
|
|
25
|
+
},
|
|
26
|
+
pressFeedback: {
|
|
27
|
+
type: 'highlight',
|
|
28
|
+
brightness: 0,
|
|
29
|
+
shiftOpacity: 0.3,
|
|
30
|
+
},
|
|
31
|
+
}
|
|
32
|
+
}),
|
|
33
|
+
h1: assignTextStyle('h1'),
|
|
34
|
+
h2: assignTextStyle('h2'),
|
|
35
|
+
h3: assignTextStyle('h3'),
|
|
36
|
+
h4: assignTextStyle('h4'),
|
|
37
|
+
h5: assignTextStyle('h5'),
|
|
38
|
+
h6: assignTextStyle('h6'),
|
|
39
|
+
p1: assignTextStyle('p1'),
|
|
40
|
+
p2: assignTextStyle('p2'),
|
|
41
|
+
p3: assignTextStyle('p3'),
|
|
42
|
+
p4: assignTextStyle('p4'),
|
|
43
|
+
link: assignTextStyle('p1'),
|
|
44
|
+
OSAlertBody: createTextStyle((theme) => ({
|
|
45
|
+
text: {
|
|
46
|
+
...assignTextStyle('p1')(theme).text,
|
|
47
|
+
...theme.presets.textCenter,
|
|
48
|
+
},
|
|
49
|
+
})),
|
|
50
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { useDefaultComponentStyle } from '@codeleap/common'
|
|
3
|
+
import { StyleSheet } from 'react-native'
|
|
4
|
+
import { Text } from '../Text'
|
|
5
|
+
import { View } from '../View'
|
|
6
|
+
|
|
7
|
+
export const InputLabel = ({ label, variants = [], styles = {}, style, asteriskStyle = null, required = false, wrapperStyle = null }) => {
|
|
8
|
+
const labelStyles = useDefaultComponentStyle('TextInput', {
|
|
9
|
+
variants, styles, transform: StyleSheet.flatten,
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
if (!label) return null
|
|
13
|
+
|
|
14
|
+
switch (typeof label) {
|
|
15
|
+
case 'string':
|
|
16
|
+
return <View style={ wrapperStyle || labelStyles.labelWrapper}>
|
|
17
|
+
<Text style={style || labelStyles.label} text={label} />
|
|
18
|
+
{required && <Text style={asteriskStyle || labelStyles.requiredAsterisk} text={' *'} />}
|
|
19
|
+
</View>
|
|
20
|
+
case 'object':
|
|
21
|
+
return label
|
|
22
|
+
default:
|
|
23
|
+
return null
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
@@ -2,27 +2,45 @@ import * as React from 'react'
|
|
|
2
2
|
import {
|
|
3
3
|
ComponentVariants,
|
|
4
4
|
FormTypes,
|
|
5
|
+
getNestedStylesByKey,
|
|
5
6
|
IconPlaceholder,
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
TypeGuards,
|
|
9
|
+
|
|
8
10
|
useBooleanToggle,
|
|
9
11
|
useDefaultComponentStyle,
|
|
10
12
|
useValidate,
|
|
11
13
|
} from '@codeleap/common'
|
|
12
14
|
import { ComponentPropsWithoutRef, forwardRef, useImperativeHandle, useRef, useState } from 'react'
|
|
13
|
-
import { Text } from '
|
|
14
|
-
import { View, ViewProps } from '
|
|
15
|
-
import { StylesOf } from '
|
|
16
|
-
import { Icon } from '
|
|
15
|
+
import { Text, TextProps } from '../Text'
|
|
16
|
+
import { View, ViewProps } from '../View'
|
|
17
|
+
import { StylesOf } from '../../types'
|
|
18
|
+
import { Icon } from '../Icon'
|
|
17
19
|
import { NativeSyntheticEvent, StyleSheet, TextInput as NativeTextInput, TextInputChangeEventData } from 'react-native'
|
|
18
|
-
import { Touchable, TouchableProps } from '
|
|
19
|
-
import { MaskedTextInput } from '
|
|
20
|
-
import {
|
|
20
|
+
import { Touchable, TouchableProps } from '../Touchable'
|
|
21
|
+
import { MaskedTextInput, TextInputMaskProps } from '../../modules/textInputMask'
|
|
22
|
+
import { InputLabel } from './Label'
|
|
23
|
+
|
|
24
|
+
export { InputLabel } from './Label'
|
|
25
|
+
|
|
26
|
+
export * from './styles'
|
|
27
|
+
|
|
28
|
+
import {
|
|
29
|
+
InputIconComposition,
|
|
30
|
+
TextInputComposition,
|
|
31
|
+
TextInputStyles,
|
|
32
|
+
} from './styles'
|
|
33
|
+
import { ActionIcon, ActionIconParts, ActionIconProps } from '../ActionIcon'
|
|
21
34
|
|
|
22
35
|
type IconProp = { name: IconPlaceholder; action?: () => void }
|
|
23
36
|
|
|
24
37
|
type NativeProps = ComponentPropsWithoutRef<typeof NativeTextInput>
|
|
25
38
|
|
|
39
|
+
type SubtitleProps = {
|
|
40
|
+
errorProps: TextProps
|
|
41
|
+
styles: Record<'wrapper'|'error'|'subtitle', any>
|
|
42
|
+
}
|
|
43
|
+
|
|
26
44
|
export type TextInputProps =
|
|
27
45
|
Partial<TextInputMaskProps> &
|
|
28
46
|
ComponentVariants<typeof TextInputStyles> &
|
|
@@ -35,18 +53,19 @@ export type TextInputProps =
|
|
|
35
53
|
type?: string
|
|
36
54
|
label?: React.ReactNode
|
|
37
55
|
debugName: string
|
|
38
|
-
leftIcon?:
|
|
39
|
-
rightIcon?:
|
|
56
|
+
leftIcon?: Partial<ActionIconProps>
|
|
57
|
+
rightIcon?: Partial<ActionIconProps>
|
|
40
58
|
styles?: StylesOf<TextInputComposition>
|
|
41
59
|
validate?: FormTypes.ValidatorFunctionWithoutForm | string
|
|
42
60
|
value?: string
|
|
43
61
|
password?: boolean
|
|
44
62
|
visibilityToggle?: boolean
|
|
45
63
|
touchableWrapper?: boolean
|
|
64
|
+
subtitle?: string | ((props: SubtitleProps) => React.ReactElement)
|
|
46
65
|
onPress?: () => void
|
|
47
66
|
masking?: FormTypes.TextField['masking']
|
|
48
67
|
innerWrapperProps?: ViewProps
|
|
49
|
-
wrapperProps?: TouchableProps
|
|
68
|
+
wrapperProps?: TouchableProps
|
|
50
69
|
onChangeMask?: TextInputMaskProps['onChangeText']
|
|
51
70
|
required?:boolean
|
|
52
71
|
}
|
|
@@ -54,7 +73,6 @@ export type TextInputProps =
|
|
|
54
73
|
export const TextInput = forwardRef<NativeTextInput, TextInputProps>((rawprops, inputRef) => {
|
|
55
74
|
const {
|
|
56
75
|
onChange,
|
|
57
|
-
type,
|
|
58
76
|
value,
|
|
59
77
|
onChangeText,
|
|
60
78
|
disabled,
|
|
@@ -70,9 +88,9 @@ export const TextInput = forwardRef<NativeTextInput, TextInputProps>((rawprops,
|
|
|
70
88
|
validate,
|
|
71
89
|
password,
|
|
72
90
|
visibilityToggle,
|
|
73
|
-
touchableWrapper,
|
|
74
91
|
innerWrapperProps,
|
|
75
92
|
masking = null,
|
|
93
|
+
subtitle = '',
|
|
76
94
|
onChangeMask,
|
|
77
95
|
debugName,
|
|
78
96
|
required = false,
|
|
@@ -84,9 +102,10 @@ export const TextInput = forwardRef<NativeTextInput, TextInputProps>((rawprops,
|
|
|
84
102
|
|
|
85
103
|
const input = useRef<any>(null)
|
|
86
104
|
const [textIsVisible, setTextVisible] = useBooleanToggle(false)
|
|
87
|
-
const variantStyles = useDefaultComponentStyle('TextInput', {
|
|
105
|
+
const variantStyles = useDefaultComponentStyle<'u:TextInput', typeof TextInputStyles>('u:TextInput', {
|
|
88
106
|
variants,
|
|
89
107
|
styles,
|
|
108
|
+
transform: StyleSheet.flatten,
|
|
90
109
|
})
|
|
91
110
|
const InputElement = masking ? MaskedTextInput : NativeTextInput
|
|
92
111
|
|
|
@@ -122,36 +141,19 @@ export const TextInput = forwardRef<NativeTextInput, TextInputProps>((rawprops,
|
|
|
122
141
|
|
|
123
142
|
const { showError, error } = useValidate(value, validate)
|
|
124
143
|
|
|
125
|
-
const
|
|
126
|
-
...variantStyles.icon,
|
|
127
|
-
...(isFocused ? variantStyles['icon:focus'] : {}),
|
|
128
|
-
...(showError ? variantStyles['icon:error'] : {}),
|
|
129
|
-
...variantStyles.leftIcon,
|
|
130
|
-
...(isFocused ? variantStyles['leftIcon:focus'] : {}),
|
|
131
|
-
...(showError ? variantStyles['leftIcon:error'] : {}),
|
|
132
|
-
}
|
|
144
|
+
const commonIconStyles = getNestedStylesByKey('icon', variantStyles)
|
|
133
145
|
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
...(showError ? variantStyles['icon:error'] : {}),
|
|
138
|
-
...variantStyles.rightIcon,
|
|
139
|
-
...(isFocused ? variantStyles['rightIcon:focus'] : {}),
|
|
140
|
-
...(showError ? variantStyles['rightIcon:error'] : {}),
|
|
141
|
-
}
|
|
146
|
+
const leftIconStyles = getNestedStylesByKey('leftIcon', variantStyles)
|
|
147
|
+
|
|
148
|
+
const rightIconStyles = getNestedStylesByKey('rightIcon', variantStyles)
|
|
142
149
|
|
|
143
|
-
const buttonIconWrapperStyle = {
|
|
144
|
-
...variantStyles.buttonIconWrapper,
|
|
145
|
-
...(isFocused ? variantStyles['buttonIconWrapper:focus'] : {}),
|
|
146
|
-
...(showError ? variantStyles['buttonIconWrapper:error'] : {}),
|
|
147
|
-
}
|
|
148
150
|
function getStyles(key: TextInputComposition) {
|
|
149
151
|
const requestedStyles = [
|
|
150
152
|
variantStyles[key],
|
|
151
153
|
isFocused ? variantStyles[key + ':focus'] : {},
|
|
152
154
|
showError ? variantStyles[key + ':error'] : {},
|
|
153
155
|
]
|
|
154
|
-
return requestedStyles
|
|
156
|
+
return StyleSheet.flatten(requestedStyles)
|
|
155
157
|
}
|
|
156
158
|
|
|
157
159
|
function handlePress() {
|
|
@@ -162,12 +164,33 @@ export const TextInput = forwardRef<NativeTextInput, TextInputProps>((rawprops,
|
|
|
162
164
|
}
|
|
163
165
|
}
|
|
164
166
|
|
|
167
|
+
const visibilityToggleProps = visibilityToggle ? {
|
|
168
|
+
onPress: () => setTextVisible(),
|
|
169
|
+
icon: (textIsVisible ? 'input-visiblity:visible' : 'input-visiblity:hidden') as IconPlaceholder,
|
|
170
|
+
debugName: `${debugName} toggle visibility`,
|
|
171
|
+
} : {}
|
|
172
|
+
|
|
173
|
+
const subtitleStyles = {
|
|
174
|
+
error: getStyles('error'),
|
|
175
|
+
wrapper: getStyles('subtitleWrapper'),
|
|
176
|
+
subtitle: getStyles('subtitle'),
|
|
177
|
+
|
|
178
|
+
}
|
|
179
|
+
const errorProps = { text: error.message, style: subtitleStyles.error }
|
|
180
|
+
|
|
181
|
+
const subtitleContent = TypeGuards.isFunction(subtitle) ? subtitle({ styles: subtitleStyles, errorProps }) : <View style={subtitleStyles.wrapper}>
|
|
182
|
+
<FormError {...errorProps}/>
|
|
183
|
+
{TypeGuards.isString(subtitle) ? <Text text={subtitle} style={subtitleStyles.subtitle}/> : (subtitle || null)}
|
|
184
|
+
</View>
|
|
185
|
+
|
|
165
186
|
return (
|
|
166
187
|
<Touchable
|
|
167
188
|
style={getStyles('wrapper')}
|
|
168
189
|
debugName={debugName}
|
|
169
190
|
onPress={handlePress}
|
|
170
191
|
{...wrapperProps}
|
|
192
|
+
android_ripple={null}
|
|
193
|
+
noFeedback
|
|
171
194
|
>
|
|
172
195
|
<InputLabel
|
|
173
196
|
label={label}
|
|
@@ -177,7 +200,14 @@ export const TextInput = forwardRef<NativeTextInput, TextInputProps>((rawprops,
|
|
|
177
200
|
required={required}
|
|
178
201
|
/>
|
|
179
202
|
<View style={getStyles('innerWrapper')} {...innerWrapperProps}>
|
|
180
|
-
<InputIcon
|
|
203
|
+
<InputIcon
|
|
204
|
+
isFocused={isFocused}
|
|
205
|
+
showError={showError}
|
|
206
|
+
styles={leftIconStyles}
|
|
207
|
+
commonStyles={commonIconStyles}
|
|
208
|
+
debugName={`${debugName} left icon`}
|
|
209
|
+
{...leftIcon}
|
|
210
|
+
/>
|
|
181
211
|
{/* @ts-ignore */}
|
|
182
212
|
<InputElement
|
|
183
213
|
ref={input}
|
|
@@ -196,54 +226,73 @@ export const TextInput = forwardRef<NativeTextInput, TextInputProps>((rawprops,
|
|
|
196
226
|
} } : {})}
|
|
197
227
|
style={getStyles('textField')}
|
|
198
228
|
/>
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
229
|
+
<InputIcon
|
|
230
|
+
isFocused={isFocused}
|
|
231
|
+
showError={showError}
|
|
232
|
+
styles={rightIconStyles}
|
|
233
|
+
commonStyles={commonIconStyles}
|
|
234
|
+
debugName={`${debugName} right icon`}
|
|
235
|
+
{...rightIcon}
|
|
236
|
+
{...visibilityToggleProps}
|
|
237
|
+
/>
|
|
238
|
+
|
|
207
239
|
</View>
|
|
208
|
-
|
|
240
|
+
{subtitleContent}
|
|
209
241
|
</Touchable>
|
|
210
242
|
)
|
|
211
243
|
})
|
|
212
244
|
|
|
213
|
-
export const FormError = ({
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
245
|
+
export const FormError:React.FC<TextProps> = ({ text, ...props }) => {
|
|
246
|
+
let message = text
|
|
247
|
+
if (TypeGuards.isNumber(message)) {
|
|
248
|
+
message = message.toString()
|
|
249
|
+
}
|
|
250
|
+
if (typeof message === 'undefined') {
|
|
251
|
+
message = ''
|
|
217
252
|
}
|
|
218
|
-
return message
|
|
219
|
-
}
|
|
220
253
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
return <Touchable debugName={`${name} icon button`} onPress={() => action()} style={wrapperStyle} >
|
|
225
|
-
<Icon name={name} style={style}/>
|
|
226
|
-
</Touchable>
|
|
254
|
+
if (TypeGuards.isString(message)) {
|
|
255
|
+
const text = message ? `${message.charAt(0).toUpperCase() + message.slice(1)}` : ' '
|
|
256
|
+
return <Text text={text} {...props} />
|
|
227
257
|
}
|
|
228
|
-
return
|
|
258
|
+
return <>
|
|
259
|
+
{text}
|
|
260
|
+
</>
|
|
229
261
|
}
|
|
230
262
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
263
|
+
type InputIconProps = {
|
|
264
|
+
styles: StylesOf<InputIconComposition>
|
|
265
|
+
commonStyles: StylesOf<InputIconComposition>
|
|
266
|
+
isFocused: boolean
|
|
267
|
+
showError: boolean
|
|
268
|
+
} & Omit<ActionIconProps, 'styles'>
|
|
235
269
|
|
|
236
|
-
|
|
270
|
+
export const InputIcon:React.FC<InputIconProps> = ({ styles, commonStyles, isFocused, showError, ...props }) => {
|
|
271
|
+
if (!props.icon) return null
|
|
237
272
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
273
|
+
function getStyles(k: ActionIconParts | '') {
|
|
274
|
+
let key = k
|
|
275
|
+
if (key === 'icon') key = ''
|
|
276
|
+
const requestedStyles = [
|
|
277
|
+
commonStyles[key],
|
|
278
|
+
isFocused ? commonStyles[key + ':focus'] : {},
|
|
279
|
+
showError ? commonStyles[key + ':error'] : {},
|
|
280
|
+
styles[key],
|
|
281
|
+
isFocused ? styles[key + ':focus'] : {},
|
|
282
|
+
showError ? styles[key + ':error'] : {},
|
|
283
|
+
]
|
|
284
|
+
|
|
285
|
+
return StyleSheet.flatten(requestedStyles)
|
|
248
286
|
}
|
|
287
|
+
const iconStyles = {
|
|
288
|
+
icon: getStyles('icon'),
|
|
289
|
+
touchablePressable: getStyles('touchablePressable'),
|
|
290
|
+
touchableWrapper: getStyles('touchableWrapper'),
|
|
291
|
+
touchableFeedback: getStyles('touchableFeedback'),
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
return <ActionIcon
|
|
295
|
+
styles={iconStyles}
|
|
296
|
+
{...props}
|
|
297
|
+
/>
|
|
249
298
|
}
|