@codeleap/mobile 7.0.0 → 7.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Registry.js +47 -0
- package/dist/Registry.js.map +1 -0
- package/dist/components/ActivityIndicator/index.js +28 -0
- package/dist/components/ActivityIndicator/index.js.map +1 -0
- package/dist/components/ActivityIndicator/styles.js +2 -0
- package/dist/components/ActivityIndicator/styles.js.map +1 -0
- package/dist/components/ActivityIndicator/types.js +2 -0
- package/dist/components/ActivityIndicator/types.js.map +1 -0
- package/dist/components/Autocomplete/index.js +150 -0
- package/dist/components/Autocomplete/index.js.map +1 -0
- package/dist/components/Autocomplete/styles.js +2 -0
- package/dist/components/Autocomplete/styles.js.map +1 -0
- package/dist/components/Autocomplete/types.js +2 -0
- package/dist/components/Autocomplete/types.js.map +1 -0
- package/dist/components/Avatar/components/Badge.js +13 -0
- package/dist/components/Avatar/components/Badge.js.map +1 -0
- package/dist/components/Avatar/components/Content.js +19 -0
- package/dist/components/Avatar/components/Content.js.map +1 -0
- package/dist/components/Avatar/components/Illustration.js +11 -0
- package/dist/components/Avatar/components/Illustration.js.map +1 -0
- package/dist/components/Avatar/components/OverlayIcon.js +11 -0
- package/dist/components/Avatar/components/OverlayIcon.js.map +1 -0
- package/dist/components/Avatar/components/Text.js +19 -0
- package/dist/components/Avatar/components/Text.js.map +1 -0
- package/dist/components/Avatar/components/Wrapper.js +30 -0
- package/dist/components/Avatar/components/Wrapper.js.map +1 -0
- package/dist/components/Avatar/context.js +13 -0
- package/dist/components/Avatar/context.js.map +1 -0
- package/dist/components/Avatar/index.js +35 -0
- package/dist/components/Avatar/index.js.map +1 -0
- package/dist/components/Avatar/styles.js +2 -0
- package/dist/components/Avatar/styles.js.map +1 -0
- package/dist/components/Avatar/types.js +2 -0
- package/dist/components/Avatar/types.js.map +1 -0
- package/dist/components/AvatarGroup/index.js +36 -0
- package/dist/components/AvatarGroup/index.js.map +1 -0
- package/dist/components/AvatarGroup/styles.js +2 -0
- package/dist/components/AvatarGroup/styles.js.map +1 -0
- package/dist/components/AvatarGroup/types.js +2 -0
- package/dist/components/AvatarGroup/types.js.map +1 -0
- package/dist/components/Backdrop/index.js +34 -0
- package/dist/components/Backdrop/index.js.map +1 -0
- package/dist/components/Backdrop/styles.js +2 -0
- package/dist/components/Backdrop/styles.js.map +1 -0
- package/dist/components/Backdrop/types.js +2 -0
- package/dist/components/Backdrop/types.js.map +1 -0
- package/dist/components/Badge/index.js +66 -0
- package/dist/components/Badge/index.js.map +1 -0
- package/dist/components/Badge/styles.js +2 -0
- package/dist/components/Badge/styles.js.map +1 -0
- package/dist/components/Badge/types.js +2 -0
- package/dist/components/Badge/types.js.map +1 -0
- package/dist/components/Button/index.js +73 -0
- package/dist/components/Button/index.js.map +1 -0
- package/dist/components/Button/styles.js +2 -0
- package/dist/components/Button/styles.js.map +1 -0
- package/dist/components/Button/types.js +2 -0
- package/dist/components/Button/types.js.map +1 -0
- package/dist/components/Calendar/index.js +100 -0
- package/dist/components/Calendar/index.js.map +1 -0
- package/dist/components/Calendar/styles.js +2 -0
- package/dist/components/Calendar/styles.js.map +1 -0
- package/dist/components/Calendar/types.js +2 -0
- package/dist/components/Calendar/types.js.map +1 -0
- package/dist/components/CalendarInput/index.js +67 -0
- package/dist/components/CalendarInput/index.js.map +1 -0
- package/dist/components/CalendarInput/styles.js +2 -0
- package/dist/components/CalendarInput/styles.js.map +1 -0
- package/dist/components/CalendarInput/types.js +2 -0
- package/dist/components/CalendarInput/types.js.map +1 -0
- package/dist/components/Checkbox/index.js +85 -0
- package/dist/components/Checkbox/index.js.map +1 -0
- package/dist/components/Checkbox/styles.js +2 -0
- package/dist/components/Checkbox/styles.js.map +1 -0
- package/dist/components/Checkbox/types.js +2 -0
- package/dist/components/Checkbox/types.js.map +1 -0
- package/dist/components/Collapse/index.js +45 -0
- package/dist/components/Collapse/index.js.map +1 -0
- package/dist/components/Collapse/types.js +2 -0
- package/dist/components/Collapse/types.js.map +1 -0
- package/dist/components/DatePickerModal/index.js +107 -0
- package/dist/components/DatePickerModal/index.js.map +1 -0
- package/dist/components/DatePickerModal/styles.js +2 -0
- package/dist/components/DatePickerModal/styles.js.map +1 -0
- package/dist/components/DatePickerModal/types.js +2 -0
- package/dist/components/DatePickerModal/types.js.map +1 -0
- package/dist/components/EmptyPlaceholder/components/Button.js +15 -0
- package/dist/components/EmptyPlaceholder/components/Button.js.map +1 -0
- package/dist/components/EmptyPlaceholder/components/Content.js +36 -0
- package/dist/components/EmptyPlaceholder/components/Content.js.map +1 -0
- package/dist/components/EmptyPlaceholder/components/Illustration.js +9 -0
- package/dist/components/EmptyPlaceholder/components/Illustration.js.map +1 -0
- package/dist/components/EmptyPlaceholder/components/Info.js +9 -0
- package/dist/components/EmptyPlaceholder/components/Info.js.map +1 -0
- package/dist/components/EmptyPlaceholder/components/Loading.js +20 -0
- package/dist/components/EmptyPlaceholder/components/Loading.js.map +1 -0
- package/dist/components/EmptyPlaceholder/context.js +13 -0
- package/dist/components/EmptyPlaceholder/context.js.map +1 -0
- package/dist/components/EmptyPlaceholder/index.js +38 -0
- package/dist/components/EmptyPlaceholder/index.js.map +1 -0
- package/dist/components/EmptyPlaceholder/styles.js +2 -0
- package/dist/components/EmptyPlaceholder/styles.js.map +1 -0
- package/dist/components/EmptyPlaceholder/types.js +2 -0
- package/dist/components/EmptyPlaceholder/types.js.map +1 -0
- package/dist/components/FileInput/index.js +126 -0
- package/dist/components/FileInput/index.js.map +1 -0
- package/dist/components/FileInput/types.js +2 -0
- package/dist/components/FileInput/types.js.map +1 -0
- package/dist/components/Grid/index.js +65 -0
- package/dist/components/Grid/index.js.map +1 -0
- package/dist/components/Grid/styles.js +2 -0
- package/dist/components/Grid/styles.js.map +1 -0
- package/dist/components/Grid/types.js +2 -0
- package/dist/components/Grid/types.js.map +1 -0
- package/dist/components/Icon/index.js +59 -0
- package/dist/components/Icon/index.js.map +1 -0
- package/dist/components/Icon/styles.js +2 -0
- package/dist/components/Icon/styles.js.map +1 -0
- package/dist/components/Icon/types.js +2 -0
- package/dist/components/Icon/types.js.map +1 -0
- package/dist/components/Image/index.js +108 -0
- package/dist/components/Image/index.js.map +1 -0
- package/dist/components/Image/styles.js +2 -0
- package/dist/components/Image/styles.js.map +1 -0
- package/dist/components/Image/types.js +2 -0
- package/dist/components/Image/types.js.map +1 -0
- package/dist/components/ImageView/Spotlight.js +139 -0
- package/dist/components/ImageView/Spotlight.js.map +1 -0
- package/dist/components/ImageView/component.js +17 -0
- package/dist/components/ImageView/component.js.map +1 -0
- package/dist/components/ImageView/index.js +3 -0
- package/dist/components/ImageView/index.js.map +1 -0
- package/dist/components/InputBase/index.js +37 -0
- package/dist/components/InputBase/index.js.map +1 -0
- package/dist/components/InputBase/styles.js +98 -0
- package/dist/components/InputBase/styles.js.map +1 -0
- package/dist/components/InputBase/types.js +2 -0
- package/dist/components/InputBase/types.js.map +1 -0
- package/dist/components/InputBase/useInputBase.js +48 -0
- package/dist/components/InputBase/useInputBase.js.map +1 -0
- package/dist/components/InputBase/useInputBasePartialStyles.js +35 -0
- package/dist/components/InputBase/useInputBasePartialStyles.js.map +1 -0
- package/dist/components/InputBase/utils.js +31 -0
- package/dist/components/InputBase/utils.js.map +1 -0
- package/dist/components/InputOverlay/index.js +68 -0
- package/dist/components/InputOverlay/index.js.map +1 -0
- package/dist/components/InputOverlay/store.js +49 -0
- package/dist/components/InputOverlay/store.js.map +1 -0
- package/dist/components/InputOverlay/types.js +2 -0
- package/dist/components/InputOverlay/types.js.map +1 -0
- package/dist/components/List/index.js +66 -0
- package/dist/components/List/index.js.map +1 -0
- package/dist/components/List/styles.js +2 -0
- package/dist/components/List/styles.js.map +1 -0
- package/dist/components/List/types.js +2 -0
- package/dist/components/List/types.js.map +1 -0
- package/dist/components/LoadingOverlay/index.js +51 -0
- package/dist/components/LoadingOverlay/index.js.map +1 -0
- package/dist/components/LoadingOverlay/styles.js +2 -0
- package/dist/components/LoadingOverlay/styles.js.map +1 -0
- package/dist/components/LoadingOverlay/types.js +2 -0
- package/dist/components/LoadingOverlay/types.js.map +1 -0
- package/dist/components/Modal/index.js +76 -0
- package/dist/components/Modal/index.js.map +1 -0
- package/dist/components/Modal/styles.js +2 -0
- package/dist/components/Modal/styles.js.map +1 -0
- package/dist/components/Modal/types.js +2 -0
- package/dist/components/Modal/types.js.map +1 -0
- package/dist/components/NumberIncrement/index.js +120 -0
- package/dist/components/NumberIncrement/index.js.map +1 -0
- package/dist/components/NumberIncrement/styles.js +2 -0
- package/dist/components/NumberIncrement/styles.js.map +1 -0
- package/dist/components/NumberIncrement/types.js +2 -0
- package/dist/components/NumberIncrement/types.js.map +1 -0
- package/dist/components/NumberIncrement/useNumberIncrement.js +116 -0
- package/dist/components/NumberIncrement/useNumberIncrement.js.map +1 -0
- package/dist/components/Pager/PagerDots.js +19 -0
- package/dist/components/Pager/PagerDots.js.map +1 -0
- package/dist/components/Pager/PagerItem.js +14 -0
- package/dist/components/Pager/PagerItem.js.map +1 -0
- package/dist/components/Pager/index.js +78 -0
- package/dist/components/Pager/index.js.map +1 -0
- package/dist/components/Pager/styles.js +2 -0
- package/dist/components/Pager/styles.js.map +1 -0
- package/dist/components/Pager/types.js +2 -0
- package/dist/components/Pager/types.js.map +1 -0
- package/dist/components/PaginationIndicator/index.js +36 -0
- package/dist/components/PaginationIndicator/index.js.map +1 -0
- package/dist/components/PaginationIndicator/styles.js +2 -0
- package/dist/components/PaginationIndicator/styles.js.map +1 -0
- package/dist/components/PaginationIndicator/types.js +2 -0
- package/dist/components/PaginationIndicator/types.js.map +1 -0
- package/dist/components/PlacesAutocomplete/index.js +71 -0
- package/dist/components/PlacesAutocomplete/index.js.map +1 -0
- package/dist/components/PlacesAutocomplete/styles.js +2 -0
- package/dist/components/PlacesAutocomplete/styles.js.map +1 -0
- package/dist/components/PlacesAutocomplete/types.js +2 -0
- package/dist/components/PlacesAutocomplete/types.js.map +1 -0
- package/dist/components/RadioInput/index.js +47 -0
- package/dist/components/RadioInput/index.js.map +1 -0
- package/dist/components/RadioInput/styles.js +2 -0
- package/dist/components/RadioInput/styles.js.map +1 -0
- package/dist/components/RadioInput/types.js +2 -0
- package/dist/components/RadioInput/types.js.map +1 -0
- package/dist/components/RefreshControl/index.js +27 -0
- package/dist/components/RefreshControl/index.js.map +1 -0
- package/dist/components/RefreshControl/styles.js +2 -0
- package/dist/components/RefreshControl/styles.js.map +1 -0
- package/dist/components/RefreshControl/types.js +2 -0
- package/dist/components/RefreshControl/types.js.map +1 -0
- package/dist/components/Scroll/index.js +40 -0
- package/dist/components/Scroll/index.js.map +1 -0
- package/dist/components/Scroll/styles.js +2 -0
- package/dist/components/Scroll/styles.js.map +1 -0
- package/dist/components/Scroll/types.js +2 -0
- package/dist/components/Scroll/types.js.map +1 -0
- package/dist/components/SearchInput/index.js +48 -0
- package/dist/components/SearchInput/index.js.map +1 -0
- package/dist/components/SectionFilters/context.js +6 -0
- package/dist/components/SectionFilters/context.js.map +1 -0
- package/dist/components/SectionFilters/index.js +47 -0
- package/dist/components/SectionFilters/index.js.map +1 -0
- package/dist/components/SectionFilters/types.js +2 -0
- package/dist/components/SectionFilters/types.js.map +1 -0
- package/dist/components/SectionFilters/useSectionFilters.js +148 -0
- package/dist/components/SectionFilters/useSectionFilters.js.map +1 -0
- package/dist/components/Sections/index.js +105 -0
- package/dist/components/Sections/index.js.map +1 -0
- package/dist/components/Sections/styles.js +2 -0
- package/dist/components/Sections/styles.js.map +1 -0
- package/dist/components/Sections/types.js +2 -0
- package/dist/components/Sections/types.js.map +1 -0
- package/dist/components/SegmentedControl/Option.js +20 -0
- package/dist/components/SegmentedControl/Option.js.map +1 -0
- package/dist/components/SegmentedControl/index.js +130 -0
- package/dist/components/SegmentedControl/index.js.map +1 -0
- package/dist/components/SegmentedControl/styles.js +2 -0
- package/dist/components/SegmentedControl/styles.js.map +1 -0
- package/dist/components/SegmentedControl/types.js +2 -0
- package/dist/components/SegmentedControl/types.js.map +1 -0
- package/dist/components/Select/index.js +204 -0
- package/dist/components/Select/index.js.map +1 -0
- package/dist/components/Select/styles.js +2 -0
- package/dist/components/Select/styles.js.map +1 -0
- package/dist/components/Select/types.js +2 -0
- package/dist/components/Select/types.js.map +1 -0
- package/dist/components/Slider/index.js +99 -0
- package/dist/components/Slider/index.js.map +1 -0
- package/dist/components/Slider/styles.js +2 -0
- package/dist/components/Slider/styles.js.map +1 -0
- package/dist/components/Slider/types.js +2 -0
- package/dist/components/Slider/types.js.map +1 -0
- package/dist/components/SortablePhotos/index.js +85 -0
- package/dist/components/SortablePhotos/index.js.map +1 -0
- package/dist/components/SortablePhotos/styles.js +2 -0
- package/dist/components/SortablePhotos/styles.js.map +1 -0
- package/dist/components/SortablePhotos/types.js +2 -0
- package/dist/components/SortablePhotos/types.js.map +1 -0
- package/dist/components/SortablePhotos/useSortablePhotos.js +143 -0
- package/dist/components/SortablePhotos/useSortablePhotos.js.map +1 -0
- package/dist/components/Switch/index.js +81 -0
- package/dist/components/Switch/index.js.map +1 -0
- package/dist/components/Switch/styles.js +2 -0
- package/dist/components/Switch/styles.js.map +1 -0
- package/dist/components/Switch/types.js +2 -0
- package/dist/components/Switch/types.js.map +1 -0
- package/dist/components/Tabs/Context.js +44 -0
- package/dist/components/Tabs/Context.js.map +1 -0
- package/dist/components/Tabs/Panel.js +21 -0
- package/dist/components/Tabs/Panel.js.map +1 -0
- package/dist/components/Tabs/Tab.js +28 -0
- package/dist/components/Tabs/Tab.js.map +1 -0
- package/dist/components/Tabs/TabList.js +16 -0
- package/dist/components/Tabs/TabList.js.map +1 -0
- package/dist/components/Tabs/index.js +34 -0
- package/dist/components/Tabs/index.js.map +1 -0
- package/dist/components/Tabs/styles.js +2 -0
- package/dist/components/Tabs/styles.js.map +1 -0
- package/dist/components/Tabs/types.js +2 -0
- package/dist/components/Tabs/types.js.map +1 -0
- package/dist/components/Text/index.js +82 -0
- package/dist/components/Text/index.js.map +1 -0
- package/dist/components/Text/styles.js +2 -0
- package/dist/components/Text/styles.js.map +1 -0
- package/dist/components/Text/types.js +2 -0
- package/dist/components/Text/types.js.map +1 -0
- package/dist/components/TextInput/index.js +99 -0
- package/dist/components/TextInput/index.js.map +1 -0
- package/dist/components/TextInput/styles.js +2 -0
- package/dist/components/TextInput/styles.js.map +1 -0
- package/dist/components/TextInput/types.js +2 -0
- package/dist/components/TextInput/types.js.map +1 -0
- package/dist/components/TextInput/useTextInput.js +66 -0
- package/dist/components/TextInput/useTextInput.js.map +1 -0
- package/dist/components/TimeInput/index.js +50 -0
- package/dist/components/TimeInput/index.js.map +1 -0
- package/dist/components/TimeInput/styles.js +2 -0
- package/dist/components/TimeInput/styles.js.map +1 -0
- package/dist/components/TimeInput/types.js +2 -0
- package/dist/components/TimeInput/types.js.map +1 -0
- package/dist/components/Touchable/index.js +170 -0
- package/dist/components/Touchable/index.js.map +1 -0
- package/dist/components/Touchable/styles.js +2 -0
- package/dist/components/Touchable/styles.js.map +1 -0
- package/dist/components/Touchable/types.js +2 -0
- package/dist/components/Touchable/types.js.map +1 -0
- package/dist/components/View/index.js +28 -0
- package/dist/components/View/index.js.map +1 -0
- package/dist/components/View/styles.js +2 -0
- package/dist/components/View/styles.js.map +1 -0
- package/dist/components/View/types.js +2 -0
- package/dist/components/View/types.js.map +1 -0
- package/dist/components/components.js +46 -0
- package/dist/components/components.js.map +1 -0
- package/dist/hooks/index.js +6 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/useAnimatedState.js +28 -0
- package/dist/hooks/useAnimatedState.js.map +1 -0
- package/dist/hooks/useAppState.js +16 -0
- package/dist/hooks/useAppState.js.map +1 -0
- package/dist/hooks/useKeyboardController.js +22 -0
- package/dist/hooks/useKeyboardController.js.map +1 -0
- package/dist/hooks/useStatusBar.js +18 -0
- package/dist/hooks/useStatusBar.js.map +1 -0
- package/dist/hooks/useStylesFor.js +13 -0
- package/dist/hooks/useStylesFor.js.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/modules/PressableRipple/index.js +3 -0
- package/dist/modules/PressableRipple/index.js.map +1 -0
- package/dist/modules/PressableRipple/ripple.js +168 -0
- package/dist/modules/PressableRipple/ripple.js.map +1 -0
- package/dist/modules/PressableRipple/styles.js +18 -0
- package/dist/modules/PressableRipple/styles.js.map +1 -0
- package/dist/modules/PressableRipple/type.js +2 -0
- package/dist/modules/PressableRipple/type.js.map +1 -0
- package/dist/modules/backgroundTimer.js +33 -0
- package/dist/modules/backgroundTimer.js.map +1 -0
- package/dist/modules/formConfig.js +26 -0
- package/dist/modules/formConfig.js.map +1 -0
- package/dist/modules/index.js +3 -0
- package/dist/modules/index.js.map +1 -0
- package/dist/modules/reactNavigation.js +39 -0
- package/dist/modules/reactNavigation.js.map +1 -0
- package/dist/modules/scroll.js +59 -0
- package/dist/modules/scroll.js.map +1 -0
- package/dist/modules/textInputMask.js +7 -0
- package/dist/modules/textInputMask.js.map +1 -0
- package/dist/modules/types/textInputMask.js +2 -0
- package/dist/modules/types/textInputMask.js.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/utility.js +2 -0
- package/dist/types/utility.js.map +1 -0
- package/dist/utils/NotificationManager/index.js +170 -0
- package/dist/utils/NotificationManager/index.js.map +1 -0
- package/dist/utils/NotificationManager/types.js +2 -0
- package/dist/utils/NotificationManager/types.js.map +1 -0
- package/dist/utils/OSAlert.js +128 -0
- package/dist/utils/OSAlert.js.map +1 -0
- package/dist/utils/StorageManager.js +84 -0
- package/dist/utils/StorageManager.js.map +1 -0
- package/dist/utils/Subscription.js +48 -0
- package/dist/utils/Subscription.js.map +1 -0
- package/dist/utils/hooks.js +199 -0
- package/dist/utils/hooks.js.map +1 -0
- package/dist/utils/index.js +11 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/input.js +45 -0
- package/dist/utils/input.js.map +1 -0
- package/dist/utils/locale.js +11 -0
- package/dist/utils/locale.js.map +1 -0
- package/dist/utils/misc.js +111 -0
- package/dist/utils/misc.js.map +1 -0
- package/dist/utils/theme.js +37 -0
- package/dist/utils/theme.js.map +1 -0
- package/dist/utils/useQueryListRefresh.js +33 -0
- package/dist/utils/useQueryListRefresh.js.map +1 -0
- package/package.json +19 -19
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Icon/index.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAE9B,OAAO,EAAE,oBAAoB,EAAyC,QAAQ,EAA4B,MAAM,kBAAkB,CAAA;AAClI,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AAEvB,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAgB,EAAE,EAAE;IAChD,MAAM,EACJ,IAAI,EACJ,KAAK,EACL,KAAK,EACL,UAAU,GAAG,EAAE,EACf,YAAY,GAAG,EAAE,EACjB,MAAM,EACN,GAAG,UAAU,EACd,GAAG;QACF,GAAG,IAAI,CAAC,YAAY;QACpB,GAAG,KAAK;KACT,CAAA;IAED,0FAA0F;IAC1F,yFAAyF;IACzF,gGAAgG;IAChG,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;IAEnD,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAA;IAE1D,MAAM,SAAS,GAAG,KAAK,EAAE,CAAC,IAAI,CAA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,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,CAAC,CAAA;IAC1D,OAAO,GAAG,CAAA;AACZ,CAAC;AAED,MAAM,CAAC,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAwC,CAAA;AAE9F,IAAI,CAAC,iBAAiB,GAAG,MAAM,CAAA;AAC/B,IAAI,CAAC,QAAQ,GAAG,CAAC,MAAM,EAAE,kBAAkB,EAAE,OAAO,CAAC,CAAA;AACrD,IAAI,CAAC,WAAW,GAAG,MAAM,CAAA;AAEzB,IAAI,CAAC,YAAY,GAAG;IAClB,KAAK,EAAE,KAAK;CACS,CAAA;AAEvB,IAAI,CAAC,gBAAgB,GAAG,CAAsB,MAAS,EAAE,EAAE;IACzD,OAAO,IAAuE,CAAA;AAChF,CAAC,CAAA;AAED,mBAAmB,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/components/Icon/styles.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/Icon/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { TypeGuards } from '@codeleap/types';
|
|
4
|
+
import { arePropsEqual } from '@codeleap/utils';
|
|
5
|
+
import { Image as NativeImage } from 'react-native';
|
|
6
|
+
import { useImageSpotlight } from '../ImageView/Spotlight';
|
|
7
|
+
import { Touchable } from '../Touchable';
|
|
8
|
+
import { isFile, toMultipartFile } from '../../utils';
|
|
9
|
+
import { LoadingOverlay } from '../LoadingOverlay';
|
|
10
|
+
import FastImage from '@d11/react-native-fast-image';
|
|
11
|
+
import { useNestedStylesByKey } from '@codeleap/styles';
|
|
12
|
+
import { MobileStyleRegistry } from '../../Registry';
|
|
13
|
+
import { useStylesFor } from '../../hooks';
|
|
14
|
+
export * from './styles';
|
|
15
|
+
export * from './types';
|
|
16
|
+
export const Image = React.memo((props) => {
|
|
17
|
+
const { style, fast, spotlight = null, resizeMode, source, withLoadingOverlay, maintainAspectRatio, touchProps, ...imageProps } = {
|
|
18
|
+
...Image.defaultProps,
|
|
19
|
+
...props,
|
|
20
|
+
};
|
|
21
|
+
const [loading, setLoading] = React.useState(false);
|
|
22
|
+
const styles = useStylesFor(Image.styleRegistryName, style);
|
|
23
|
+
let imSource = source;
|
|
24
|
+
if (isFile(imSource)) {
|
|
25
|
+
imSource = toMultipartFile(imSource);
|
|
26
|
+
}
|
|
27
|
+
else if (TypeGuards.isString(source)) {
|
|
28
|
+
imSource = { uri: source };
|
|
29
|
+
}
|
|
30
|
+
const spotlightActions = useImageSpotlight(spotlight, props.source);
|
|
31
|
+
const Wrapper = !!spotlight ? Touchable : ({ children }) => _jsx(_Fragment, { children: children });
|
|
32
|
+
const wrapperProps = {
|
|
33
|
+
onPress: spotlightActions.onImagePressed,
|
|
34
|
+
debugName: `Press spotlight image ${props.source}`,
|
|
35
|
+
style: styles.touchable,
|
|
36
|
+
android_ripple: null,
|
|
37
|
+
...touchProps,
|
|
38
|
+
};
|
|
39
|
+
const aspectRatioStyle = React.useMemo(() => {
|
|
40
|
+
if (!maintainAspectRatio || !imSource)
|
|
41
|
+
return null;
|
|
42
|
+
try {
|
|
43
|
+
// @ts-ignore
|
|
44
|
+
const assetSource = NativeImage.resolveAssetSource(imSource);
|
|
45
|
+
const aspectRatio = assetSource.width / assetSource.height;
|
|
46
|
+
if (Number.isNaN(aspectRatio)) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
aspectRatio,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
catch (e) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
}, [maintainAspectRatio, imSource]);
|
|
57
|
+
const loadEndedEarly = React.useRef(false);
|
|
58
|
+
// The 60 ms delay before showing the overlay suppresses a flash when the image is already
|
|
59
|
+
// cached and resolves synchronously — `loadEndedEarly` acts as the cancellation flag.
|
|
60
|
+
const loadProps = React.useRef({
|
|
61
|
+
onLoadStart: () => {
|
|
62
|
+
if (withLoadingOverlay) {
|
|
63
|
+
setTimeout(() => {
|
|
64
|
+
if (!loadEndedEarly.current) {
|
|
65
|
+
setLoading(true);
|
|
66
|
+
}
|
|
67
|
+
}, 60);
|
|
68
|
+
}
|
|
69
|
+
}, onLoadEnd: () => {
|
|
70
|
+
loadEndedEarly.current = true;
|
|
71
|
+
if (withLoadingOverlay)
|
|
72
|
+
setLoading(false);
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
const Loading = TypeGuards.isFunction(withLoadingOverlay) ? withLoadingOverlay : LoadingOverlay;
|
|
76
|
+
const showLoading = !!withLoadingOverlay;
|
|
77
|
+
const overlayStyle = useNestedStylesByKey('overlay', styles);
|
|
78
|
+
const loadingElement = React.useMemo(() => {
|
|
79
|
+
return showLoading ? (_jsx(Loading, { visible: loading, style: overlayStyle })) : null;
|
|
80
|
+
}, [showLoading, loading]);
|
|
81
|
+
if (fast) {
|
|
82
|
+
return (_jsxs(Wrapper, { ...wrapperProps, children: [_jsx(FastImage, { style: [aspectRatioStyle, styles.wrapper],
|
|
83
|
+
// @ts-ignore
|
|
84
|
+
tintColor: styles?.wrapper?.tintColor,
|
|
85
|
+
// @ts-ignore
|
|
86
|
+
source: imSource, resizeMode: FastImage.resizeMode[resizeMode || 'contain'], ...loadProps.current, ...imageProps }), loadingElement] }));
|
|
87
|
+
}
|
|
88
|
+
return (_jsxs(Wrapper, { ...wrapperProps, children: [_jsx(NativeImage, { resizeMode: resizeMode, source: imSource, ...imageProps, ...loadProps.current, style: [aspectRatioStyle, styles.wrapper] }), loadingElement] }));
|
|
89
|
+
}, (prevProps, nextProps) => {
|
|
90
|
+
const equal = arePropsEqual(prevProps, nextProps, { check: ['source', 'style', 'resizeMode', 'fast'] });
|
|
91
|
+
return equal;
|
|
92
|
+
});
|
|
93
|
+
Image.styleRegistryName = 'Image';
|
|
94
|
+
Image.elements = ['wrapper', 'touchable', 'overlay'];
|
|
95
|
+
Image.rootElement = 'wrapper';
|
|
96
|
+
Image.withVariantTypes = (styles) => {
|
|
97
|
+
return Image;
|
|
98
|
+
};
|
|
99
|
+
/** `fast` defaults to true, meaning FastImage is used by default for disk/memory caching.
|
|
100
|
+
* Set to false only when you need native `Image` semantics (e.g. animated GIFs, data URIs). */
|
|
101
|
+
Image.defaultProps = {
|
|
102
|
+
fast: true,
|
|
103
|
+
resizeMode: 'contain',
|
|
104
|
+
withLoadingOverlay: false,
|
|
105
|
+
maintainAspectRatio: true,
|
|
106
|
+
};
|
|
107
|
+
MobileStyleRegistry.registerComponent(Image);
|
|
108
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Image/index.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,KAAK,IAAI,WAAW,EAAE,MAAM,cAAc,CAAA;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,SAAS,MAAM,8BAA8B,CAAA;AAEpD,OAAO,EAAa,oBAAoB,EAAwD,MAAM,kBAAkB,CAAA;AACxH,OAAO,EAAE,mBAAmB,EAA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,KAAK,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,CAAC,CAAA;IACvG,OAAO,KAAK,CAAA;AACd,CAAC,CAAyC,CAAA;AAE1C,KAAK,CAAC,iBAAiB,GAAG,OAAO,CAAA;AACjC,KAAK,CAAC,QAAQ,GAAG,CAAC,SAAS,EAAE,WAAW,EAAE,SAAS,CAAC,CAAA;AACpD,KAAK,CAAC,WAAW,GAAG,SAAS,CAAA;AAE7B,KAAK,CAAC,gBAAgB,GAAG,CAAsB,MAAS,EAAE,EAAE;IAC1D,OAAO,KAAyE,CAAA;AAClF,CAAC,CAAA;AAED;gGACgG;AAChG,KAAK,CAAC,YAAY,GAAG;IACnB,IAAI,EAAE,IAAI;IACV,UAAU,EAAE,SAAS;IACrB,kBAAkB,EAAE,KAAK;IACzB,mBAAmB,EAAE,IAAI;CAC1B,CAAA;AAED,mBAAmB,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/components/Image/styles.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/Image/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React, { useContext, useState } from 'react';
|
|
3
|
+
import { TypeGuards } from '@codeleap/types';
|
|
4
|
+
import { onUpdate, usePrevious, useUnmount } from '@codeleap/hooks';
|
|
5
|
+
import { deepEqual } from '@codeleap/utils';
|
|
6
|
+
import uuid from 'react-native-uuid';
|
|
7
|
+
import { ImageView } from './component';
|
|
8
|
+
import { View } from '../View';
|
|
9
|
+
import { Text } from '../Text';
|
|
10
|
+
const SpotlightCtx = React.createContext({});
|
|
11
|
+
/**
|
|
12
|
+
* Must wrap any tree that uses `useSpotlight`, `useImageSpotlight`, or `Spotlight`.
|
|
13
|
+
* A single provider can host multiple named spotlights simultaneously — each `name` string
|
|
14
|
+
* is an isolated namespace, so different image galleries don't interfere.
|
|
15
|
+
*/
|
|
16
|
+
export const SpotlightProvider = ({ children }) => {
|
|
17
|
+
const [spotlights, setSpotlights] = useState({});
|
|
18
|
+
const [indexes, setIndexes] = useState({});
|
|
19
|
+
const ctxValue = {
|
|
20
|
+
spotlights,
|
|
21
|
+
setSpotlights,
|
|
22
|
+
indexes,
|
|
23
|
+
setIndexes,
|
|
24
|
+
};
|
|
25
|
+
return _jsx(SpotlightCtx.Provider, { value: ctxValue, children: children });
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Returns an imperative API — call `open(id)` to display the viewer at the image matching `id`.
|
|
29
|
+
* The viewer's `imageIndex` is derived by finding the id in the ordered image list, so insertion
|
|
30
|
+
* order (creation timestamp) determines display order, not registration order.
|
|
31
|
+
*/
|
|
32
|
+
export function useSpotlight(name) {
|
|
33
|
+
const ctx = useContext(SpotlightCtx);
|
|
34
|
+
const imList = Object.values(ctx.spotlights[name] || {});
|
|
35
|
+
return {
|
|
36
|
+
images: imList,
|
|
37
|
+
currentIndex: ctx.indexes[name],
|
|
38
|
+
set(img, id) {
|
|
39
|
+
const newId = id || uuid.v4();
|
|
40
|
+
ctx.setSpotlights((prev) => {
|
|
41
|
+
const images = { ...prev[name] };
|
|
42
|
+
if (id !== null) {
|
|
43
|
+
images[id] = {
|
|
44
|
+
...images[id],
|
|
45
|
+
source: img,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
const now = Date.now();
|
|
50
|
+
images[newId] = {
|
|
51
|
+
created: now,
|
|
52
|
+
id: newId,
|
|
53
|
+
source: img,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
...prev,
|
|
58
|
+
[name]: images,
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
return newId;
|
|
62
|
+
},
|
|
63
|
+
remove(id) {
|
|
64
|
+
ctx.setSpotlights((prev) => {
|
|
65
|
+
const images = { ...prev[name] };
|
|
66
|
+
delete images[id];
|
|
67
|
+
return {
|
|
68
|
+
...prev,
|
|
69
|
+
[name]: images,
|
|
70
|
+
};
|
|
71
|
+
});
|
|
72
|
+
},
|
|
73
|
+
open(id) {
|
|
74
|
+
const newIdx = imList.findIndex(x => x.id === id);
|
|
75
|
+
ctx.setIndexes((prev) => ({
|
|
76
|
+
...prev,
|
|
77
|
+
[name]: newIdx,
|
|
78
|
+
}));
|
|
79
|
+
},
|
|
80
|
+
close() {
|
|
81
|
+
ctx.setIndexes((prev) => ({
|
|
82
|
+
...prev,
|
|
83
|
+
[name]: undefined,
|
|
84
|
+
}));
|
|
85
|
+
},
|
|
86
|
+
clear() {
|
|
87
|
+
ctx.setIndexes((prev) => ({
|
|
88
|
+
...prev,
|
|
89
|
+
[name]: undefined,
|
|
90
|
+
}));
|
|
91
|
+
ctx.setSpotlights((prev) => {
|
|
92
|
+
return {
|
|
93
|
+
...prev,
|
|
94
|
+
[name]: {},
|
|
95
|
+
};
|
|
96
|
+
});
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Registers a single image into the named spotlight and returns `onImagePressed`.
|
|
102
|
+
* Pass `name=null` to opt out without conditionally calling the hook (hook rules safe).
|
|
103
|
+
* The image is automatically removed from the spotlight when the component unmounts,
|
|
104
|
+
* so stale images never appear in the gallery after the source component is gone.
|
|
105
|
+
*/
|
|
106
|
+
export const useImageSpotlight = (name, src) => {
|
|
107
|
+
const [id, setId] = useState(null);
|
|
108
|
+
const spotlight = useSpotlight(name);
|
|
109
|
+
const imSource = TypeGuards.isString(src) ? { uri: src } : src;
|
|
110
|
+
const prevSource = usePrevious(imSource);
|
|
111
|
+
onUpdate(() => {
|
|
112
|
+
if (!name)
|
|
113
|
+
return;
|
|
114
|
+
if (deepEqual(prevSource, imSource))
|
|
115
|
+
return;
|
|
116
|
+
setId(spotlight.set(imSource, id));
|
|
117
|
+
}, [src, id]);
|
|
118
|
+
useUnmount(() => {
|
|
119
|
+
if (!name)
|
|
120
|
+
return;
|
|
121
|
+
spotlight.remove(id);
|
|
122
|
+
});
|
|
123
|
+
return {
|
|
124
|
+
onImagePressed: () => {
|
|
125
|
+
spotlight.open(id);
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
const DefaultFooterComponent = ({ imageIndex, imagesLength }) => (_jsx(View, { children: _jsx(Text, { text: imageIndex + 1 + '/' + imagesLength }) }));
|
|
130
|
+
export const Spotlight = (props) => {
|
|
131
|
+
const { name, HeaderComponent, showFooter, FooterComponent, ...rest } = props;
|
|
132
|
+
const spotlight = useSpotlight(name);
|
|
133
|
+
useUnmount(() => {
|
|
134
|
+
spotlight.clear();
|
|
135
|
+
});
|
|
136
|
+
const Footer = showFooter ? FooterComponent || DefaultFooterComponent : (() => null);
|
|
137
|
+
return _jsx(ImageView, { imageIndex: spotlight.currentIndex, images: spotlight.images.map(x => x.source), keyExtractor: (_, index) => index.toString(), onRequestClose: spotlight.close, visible: typeof spotlight.currentIndex !== 'undefined', ...rest, FooterComponent: ({ imageIndex }) => _jsx(Footer, { imageIndex: imageIndex, spotlight: spotlight, imagesLength: spotlight.images.length }), HeaderComponent: !!HeaderComponent ? ({ imageIndex }) => _jsx(HeaderComponent, { spotlight: spotlight, imageIndex: imageIndex }) : undefined });
|
|
138
|
+
};
|
|
139
|
+
//# sourceMappingURL=Spotlight.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Spotlight.js","sourceRoot":"","sources":["../../../src/components/ImageView/Spotlight.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACnD,OAAO,EAAc,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACxD,OAAO,EAAE,Q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,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,KAAC,MAAM,IAAC,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,CAAC,MAAM,CAAC,MAAM,GAAI,EACpI,eAAe,EAAE,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,KAAC,eAAe,IAAC,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,GAAI,CAAC,CAAC,CAAC,SAAS,GACtI,CAAA;AACJ,CAAC,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { onUpdate } from '@codeleap/hooks';
|
|
3
|
+
import _ImageView from 'react-native-image-viewing';
|
|
4
|
+
import { StatusBar } from 'react-native';
|
|
5
|
+
/**
|
|
6
|
+
* Hides the status bar while the viewer is open via an imperative StatusBar call.
|
|
7
|
+
* `presentationStyle='overFullScreen'` is forced so the viewer covers navigation bars;
|
|
8
|
+
* overriding it will break the full-screen illusion on iOS.
|
|
9
|
+
* `doubleTapToZoomEnabled` is off by default to avoid conflicting gesture handlers in lists.
|
|
10
|
+
*/
|
|
11
|
+
export const ImageView = (props) => {
|
|
12
|
+
onUpdate(() => {
|
|
13
|
+
StatusBar.setHidden(props.visible);
|
|
14
|
+
}, [props.visible]);
|
|
15
|
+
return (_jsx(_ImageView, { doubleTapToZoomEnabled: false, presentationStyle: 'overFullScreen', ...props }));
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../src/components/ImageView/component.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAE1C,OAAO,UAAU,MAAM,4BAA4B,CAAA;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAIxC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAqB,EAAE,EAAE;IACjD,QAAQ,CAAC,GAAG,EAAE;QACZ,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;IACpC,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAA;IAEnB,OAAO,CAEL,KAAC,UAAU,IACT,sBAAsB,EAAE,KAAK,EAC7B,iBAAiB,EAAE,gBAAgB,KAC/B,KAAK,GACT,CACH,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ImageView/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { TypeGuards } from '@codeleap/types';
|
|
4
|
+
import { View } from '../View';
|
|
5
|
+
import { useInputBaseStyles } from './styles';
|
|
6
|
+
import { Text } from '../Text';
|
|
7
|
+
import RNAnimated, { FadeIn, FadeOut } from 'react-native-reanimated';
|
|
8
|
+
export { useInputBase } from './useInputBase';
|
|
9
|
+
export * from './styles';
|
|
10
|
+
export * from './utils';
|
|
11
|
+
export * from './types';
|
|
12
|
+
export const InputBaseDefaultOrder = [
|
|
13
|
+
'label',
|
|
14
|
+
'description',
|
|
15
|
+
'innerWrapper',
|
|
16
|
+
'error',
|
|
17
|
+
];
|
|
18
|
+
export const InputBase = forwardRef((props, ref) => {
|
|
19
|
+
const { children, error = null, label, description = null, leftIcon = null, rightIcon = null, wrapper, debugName, innerWrapper, focused, innerWrapperProps = {}, wrapperProps = {}, disabled, order = InputBaseDefaultOrder, style, labelAsRow, hideErrorMessage, ...otherProps } = {
|
|
20
|
+
...InputBase.defaultProps,
|
|
21
|
+
...props,
|
|
22
|
+
};
|
|
23
|
+
const styles = useInputBaseStyles(props);
|
|
24
|
+
const WrapperComponent = wrapper ?? View;
|
|
25
|
+
const InnerWrapperComponent = innerWrapper ?? View;
|
|
26
|
+
return _jsxs(WrapperComponent, { ...otherProps, ...wrapperProps, style: styles.wrapperStyle, ref: ref, children: [TypeGuards.isString(label) ? _jsx(Text, { text: label, style: styles.labelStyle }) : label, TypeGuards.isString(description) ? _jsx(Text, { text: description, style: styles.descriptionStyle }) : description, _jsxs(InnerWrapperComponent, { style: styles.innerWrapperStyle, ...innerWrapperProps, children: [_leftIcon, children, _rightIcon] }), hideErrorMessage || !error ? null : (_jsx(RNAnimated.View, { exiting: FadeOut.duration(100), entering: FadeIn.duration(200), children: TypeGuards.isString(error) ? _jsx(Text, { text: error, style: styles.errorStyle }) : error }))] });
|
|
27
|
+
});
|
|
28
|
+
InputBase.elements = ['wrapper', 'innerWrapper', 'label', 'errorMessage', 'description', 'icon', 'leftIcon', 'rightIcon'];
|
|
29
|
+
InputBase.defaultProps = {
|
|
30
|
+
disabled: false,
|
|
31
|
+
labelAsRow: false,
|
|
32
|
+
hideErrorMessage: false,
|
|
33
|
+
order: InputBaseDefaultOrder,
|
|
34
|
+
wrapper: View,
|
|
35
|
+
innerWrapper: View,
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/InputBase/index.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAG5C,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAE7C,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AA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,WAAW,CAAC,CAAC,CAAC,CAAC,KAAC,IAAI,IAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,CAAC,gBAAgB,GAAI,CAAC,CAAC,CAAC,WAAW,EAE7G,MAAC,qBAAqB,IAAC,KAAK,EAAE,MAAM,CAAC,iBAAiB,KAAM,iBAAiB,aAC1E,SAAS,EACT,QAAQ,EACR,UAAU,IACW,EAEvB,gBAAgB,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CACnC,KAAC,UAAU,CAAC,IAAI,IAAC,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,YAC5E,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAC,IAAI,IAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,UAAU,GAAI,CAAC,CAAC,CAAC,KAAK,GACrE,CACnB,IACgB,CAAA;AACrB,CAAC,CAA6C,CAAA;AAE9C,SAAS,CAAC,QAAQ,GAAG,CAAC,SAAS,EAAE,cAAc,EAAE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,CAAC,CAAA;AAEzH,SAAS,CAAC,YAAY,GAAG;IACvB,QAAQ,EAAE,KAAK;IACf,UAAU,EAAE,KAAK;IACjB,gBAAgB,EAAE,KAAK;IACvB,KAAK,EAAE,qBAAqB;IAC5B,OAAO,EAAE,IAAI;IACb,YAAY,EAAE,IAAI;CACQ,CAAA"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { TypeGuards } from '@codeleap/types';
|
|
2
|
+
import { mergeStyles, useCompositionStyles } from '@codeleap/styles';
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
const getIconStyles = (obj, state) => ({
|
|
5
|
+
icon: mergeStyles([
|
|
6
|
+
obj.icon,
|
|
7
|
+
state.focused && obj['icon:focus'],
|
|
8
|
+
state.hasError && obj['icon:error'],
|
|
9
|
+
state.disabled && obj['icon:disabled'],
|
|
10
|
+
state.hasValue && obj['icon:typed'],
|
|
11
|
+
]),
|
|
12
|
+
'icon:disabled': mergeStyles([
|
|
13
|
+
state.disabled && obj['icon:disabled'],
|
|
14
|
+
]),
|
|
15
|
+
touchableWrapper: mergeStyles([
|
|
16
|
+
obj.touchableWrapper,
|
|
17
|
+
state.focused && obj['touchableWrapper:focus'],
|
|
18
|
+
state.hasError && obj['touchableWrapper:error'],
|
|
19
|
+
state.disabled && obj['touchableWrapper:disabled'],
|
|
20
|
+
state.hasValue && obj['touchableWrapper:typed'],
|
|
21
|
+
]),
|
|
22
|
+
'touchableWrapper:disabled': mergeStyles([
|
|
23
|
+
state.disabled && obj['touchableWrapper:disabled'],
|
|
24
|
+
]),
|
|
25
|
+
});
|
|
26
|
+
const useIconStyles = (styles, iconStyles, states) => {
|
|
27
|
+
return useMemo(() => {
|
|
28
|
+
const _iconStyles = getIconStyles(iconStyles, states);
|
|
29
|
+
return mergeStyles([styles, _iconStyles]);
|
|
30
|
+
}, [states, styles, iconStyles]);
|
|
31
|
+
};
|
|
32
|
+
export const useInputBaseStyles = (props) => {
|
|
33
|
+
const { focused, disabled, error, style: styles, hasValue, } = props;
|
|
34
|
+
const hasError = !TypeGuards.isNil(error);
|
|
35
|
+
const compositionStyles = useCompositionStyles(['leftIcon', 'rightIcon', 'icon'], styles);
|
|
36
|
+
const generalIconStyles = getIconStyles(compositionStyles?.icon, { hasError, disabled });
|
|
37
|
+
const leftIconStyles = useIconStyles(generalIconStyles, compositionStyles?.leftIcon, {
|
|
38
|
+
// @ts-expect-error
|
|
39
|
+
hasError, disabled: (disabled || props?.leftIcon?.disabled), focused,
|
|
40
|
+
});
|
|
41
|
+
const rightIconStyles = useIconStyles(generalIconStyles, compositionStyles?.rightIcon, {
|
|
42
|
+
// @ts-expect-error
|
|
43
|
+
hasError, disabled: (disabled || props?.rightIcon?.disabled), focused, hasValue,
|
|
44
|
+
});
|
|
45
|
+
const labelStyle = [
|
|
46
|
+
styles.label,
|
|
47
|
+
focused && styles['label:focus'],
|
|
48
|
+
hasError && styles['label:error'],
|
|
49
|
+
disabled && styles['label:disabled'],
|
|
50
|
+
hasValue && styles['label:typed'],
|
|
51
|
+
];
|
|
52
|
+
const errorStyle = [
|
|
53
|
+
styles.errorMessage,
|
|
54
|
+
focused && styles['errorMessage:focus'],
|
|
55
|
+
hasError && styles['errorMessage:error'],
|
|
56
|
+
disabled && styles['errorMessage:disabled'],
|
|
57
|
+
hasValue && styles['errorMessage:typed'],
|
|
58
|
+
];
|
|
59
|
+
const descriptionStyle = [
|
|
60
|
+
styles.description,
|
|
61
|
+
focused && styles['description:focus'],
|
|
62
|
+
hasError && styles['description:error'],
|
|
63
|
+
disabled && styles['description:disabled'],
|
|
64
|
+
hasValue && styles['description:typed'],
|
|
65
|
+
];
|
|
66
|
+
const wrapperStyle = [
|
|
67
|
+
styles.wrapper,
|
|
68
|
+
focused && styles['wrapper:focus'],
|
|
69
|
+
error && styles['wrapper:error'],
|
|
70
|
+
disabled && styles['wrapper:disabled'],
|
|
71
|
+
hasValue && styles['wrapper:typed'],
|
|
72
|
+
];
|
|
73
|
+
const innerWrapperStyle = [
|
|
74
|
+
styles.innerWrapper,
|
|
75
|
+
focused && styles['innerWrapper:focus'],
|
|
76
|
+
hasError && styles['innerWrapper:error'],
|
|
77
|
+
disabled && styles['innerWrapper:disabled'],
|
|
78
|
+
hasValue && styles['innerWrapper:typed'],
|
|
79
|
+
];
|
|
80
|
+
const labelRowStyle = [
|
|
81
|
+
styles.labelRow,
|
|
82
|
+
focused && styles['labelRow:focus'],
|
|
83
|
+
hasError && styles['labelRow:error'],
|
|
84
|
+
disabled && styles['labelRow:disabled'],
|
|
85
|
+
hasValue && styles['labelRow:typed'],
|
|
86
|
+
];
|
|
87
|
+
return {
|
|
88
|
+
wrapperStyle,
|
|
89
|
+
innerWrapperStyle,
|
|
90
|
+
leftIconStyles,
|
|
91
|
+
rightIconStyles,
|
|
92
|
+
labelStyle,
|
|
93
|
+
errorStyle,
|
|
94
|
+
descriptionStyle,
|
|
95
|
+
labelRowStyle,
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/components/InputBase/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAG5C,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAgB/B,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;IACrC,IAAI,EAAE,WAAW,CAAC;QAChB,GAAG,CAAC,IAAI;QACR,KAAK,CAAC,OAAO,IAAI,GAAG,CAAC,YAAY,CAAC;QAClC,KAAK,CAAC,QAAQ,IAAI,GAAG,CAAC,YAAY,CAAC;QACnC,KAAK,CAAC,QAAQ,IAAI,GAAG,CAAC,eAAe,CAAC;QACtC,KAAK,CAAC,QAAQ,IAAI,GAAG,CAAC,YAAY,CAAC;KACpC,CAAC;IACF,eAAe,EAAE,WAAW,CAAC;QAC3B,KAAK,CAAC,QAAQ,IAAI,GAAG,CAAC,eAAe,CAAC;KACvC,CAAC;IACF,gBAAgB,EAAE,WAAW,CAAC;QAC5B,GAAG,CAAC,gBAAgB;QACpB,KAAK,CAAC,OAAO,IAAI,GAAG,CAAC,wBAAwB,CAAC;QAC9C,KAAK,CAAC,QAAQ,IAAI,GAAG,CAAC,wBAAwB,CAAC;QAC/C,KAAK,CAAC,QAAQ,IAAI,GAAG,CAAC,2BAA2B,CAAC;QAClD,KAAK,CAAC,QAAQ,IAAI,GAAG,CAAC,wBAAwB,CAAC;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,IAAI,MAAM,CAAC,uBAAuB,CAAC;QAC3C,QAAQ,IAAI,MAAM,CAAC,oBAAoB,CAAC;KACzC,CAAA;IAED,MAAM,aAAa,GAAG;QACpB,MAAM,CAAC,QAAQ;QACf,OAAO,IAAI,MAAM,CAAC,gBAAgB,CAAC;QACnC,QAAQ,IAAI,MAAM,CAAC,gBAAgB,CAAC;QACpC,QAAQ,IAAI,MAAM,CAAC,mBAAmB,CAAC;QACvC,QAAQ,IAAI,MAAM,CAAC,gBAAgB,CAAC;KACrC,CAAA;IAED,OAAO;QACL,YAAY;QACZ,iBAAiB;QACjB,cAAc;QACd,eAAe;QACf,UAAU;QACV,UAAU;QACV,gBAAgB;QAChB,aAAa;KACd,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/InputBase/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { useMemo, useRef } from 'react';
|
|
2
|
+
import { useWrappingScrollable } from '../../modules/scroll';
|
|
3
|
+
import { fields, useField } from '@codeleap/form';
|
|
4
|
+
import { TypeGuards } from '@codeleap/types';
|
|
5
|
+
/**
|
|
6
|
+
* When both `value` and `onValueChange` are provided, the component runs in uncontrolled-by-form
|
|
7
|
+
* mode: `useField` is never called and the field ref (blur/focus/scrollIntoView) is a no-op stub.
|
|
8
|
+
* This check is frozen on mount — toggling between controlled and uncontrolled after mount is unsupported.
|
|
9
|
+
*/
|
|
10
|
+
export function useInputBase(field, defaultField = fields.text, internalState, params = {}, deps = []) {
|
|
11
|
+
const { value, onValueChange } = internalState;
|
|
12
|
+
const hasInternalState = useMemo(() => TypeGuards.isFunction(onValueChange) && !TypeGuards.isNil(value), []);
|
|
13
|
+
const wrapperRef = useRef(null);
|
|
14
|
+
const innerInputRef = useRef(null);
|
|
15
|
+
const scrollable = useWrappingScrollable();
|
|
16
|
+
const fieldHandle = hasInternalState ? {} : useField(field, [
|
|
17
|
+
{
|
|
18
|
+
blur() {
|
|
19
|
+
innerInputRef.current.blur();
|
|
20
|
+
},
|
|
21
|
+
focus() {
|
|
22
|
+
innerInputRef.current.focus();
|
|
23
|
+
},
|
|
24
|
+
getValue() {
|
|
25
|
+
return innerInputRef.current.state;
|
|
26
|
+
},
|
|
27
|
+
scrollIntoView() {
|
|
28
|
+
/** Requires a wrapping ScrollView registered via `useWrappingScrollable`; silently does nothing if none is found. */
|
|
29
|
+
return field.measurePosition(wrapperRef).then((measureResult) => {
|
|
30
|
+
field.scrollTo(scrollable, measureResult);
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
...params,
|
|
34
|
+
},
|
|
35
|
+
deps
|
|
36
|
+
], defaultField);
|
|
37
|
+
const validation = fieldHandle?.validation;
|
|
38
|
+
return {
|
|
39
|
+
fieldHandle,
|
|
40
|
+
validation,
|
|
41
|
+
wrapperRef,
|
|
42
|
+
innerInputRef,
|
|
43
|
+
scrollable,
|
|
44
|
+
inputValue: (hasInternalState ? value : fieldHandle?.value),
|
|
45
|
+
onInputValueChange: hasInternalState ? onValueChange : fieldHandle?.setValue,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=useInputBase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useInputBase.js","sourceRoot":"","sources":["../../../src/components/InputBase/useInputBase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAEvC,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAC5D,OAAO,EAAoB,MAAM,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACnE,OAAO,EAAa,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEvD;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAC1B,KAAQ,EACR,eAA2C,MAAM,CAAC,IAAe,EACjE,aAA8D,EAC9D,SAA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M;QAChE,kBAAkB,EAAE,gBAAgB,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,WAAW,EAAE,QAAQ;KAC7E,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Merges state-variant styles (e.g. `placeholder:error`) into a flat object keyed by part name.
|
|
4
|
+
* Pass a key as `[key, false]` to get only the active state overrides without the base style merged in
|
|
5
|
+
* — useful when RN props accept raw color values that must not be wrapped in a style array.
|
|
6
|
+
*/
|
|
7
|
+
export function useInputBasePartialStyles(styles, styleKeys, states) {
|
|
8
|
+
return useMemo(() => {
|
|
9
|
+
return styleKeys.reduce((acc, value) => {
|
|
10
|
+
const [key, overrideWithDefault] = Array.isArray(value) ? value : [value, true];
|
|
11
|
+
const result = Object.entries(states).reduce((acc, [state, is]) => {
|
|
12
|
+
if (!is)
|
|
13
|
+
return acc;
|
|
14
|
+
const style = styles?.[`${key}:${state}`];
|
|
15
|
+
if (!style)
|
|
16
|
+
return acc;
|
|
17
|
+
return {
|
|
18
|
+
...acc,
|
|
19
|
+
...styles[`${key}:${state}`]
|
|
20
|
+
};
|
|
21
|
+
}, {});
|
|
22
|
+
if (overrideWithDefault && !!styles?.[key]) {
|
|
23
|
+
acc[key] = {
|
|
24
|
+
...styles[key],
|
|
25
|
+
...result,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
acc[key] = result;
|
|
30
|
+
}
|
|
31
|
+
return acc;
|
|
32
|
+
}, {});
|
|
33
|
+
}, [states]);
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=useInputBasePartialStyles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useInputBasePartialStyles.js","sourceRoot":"","sources":["../../../src/components/InputBase/useInputBasePartialStyles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA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1,31 @@
|
|
|
1
|
+
const varList = [
|
|
2
|
+
'label',
|
|
3
|
+
'style',
|
|
4
|
+
'error',
|
|
5
|
+
'innerWrapper',
|
|
6
|
+
'leftIcon',
|
|
7
|
+
'rightIcon',
|
|
8
|
+
'description',
|
|
9
|
+
'wrapper',
|
|
10
|
+
'children',
|
|
11
|
+
'innerWrapperProps',
|
|
12
|
+
'wrapperProps',
|
|
13
|
+
'disabled',
|
|
14
|
+
'hideErrorMessage',
|
|
15
|
+
'style',
|
|
16
|
+
];
|
|
17
|
+
/**
|
|
18
|
+
* Splits a merged props object so InputBase receives only its own props and the
|
|
19
|
+
* native input/control component receives the rest — prevents unknown prop warnings
|
|
20
|
+
* on native elements and avoids spread collisions between the two prop surfaces.
|
|
21
|
+
*/
|
|
22
|
+
export function selectInputBaseProps(props) {
|
|
23
|
+
const copy = { ...props };
|
|
24
|
+
const result = varList.reduce((acc, key) => {
|
|
25
|
+
// @ts-ignore
|
|
26
|
+
acc[key] = copy[key];
|
|
27
|
+
return acc;
|
|
28
|
+
}, {});
|
|
29
|
+
return { inputBaseProps: result, others: copy };
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/components/InputBase/utils.ts"],"names":[],"mappings":"AAYA,MAAM,OAAO,GAAkB;IAC7B,OAAO;IACP,OAAO;IACP,OAAO;IACP,cAAc;IACd,UAAU;IACV,WAAW;IACX,aAAa;IACb,SAAS;IACT,UAAU;IACV,mBAAmB;IACnB,cAAc;IACd,UAAU;IACV,kBAAkB;IAClB,OAAO;CACR,CAAA;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAsB,KAAQ;IAIhE,MAAM,IAAI,GAAG,EAAE,GAAG,KAAK,EAAE,CAAA;IAEzB,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QACzC,aAAa;QACb,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAA;QAEpB,OAAO,GAAG,CAAA;IACZ,CAAC,EAAE,EAAe,CAAC,CAAA;IAEnB,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,IAAsB,EAAE,CAAA;AACnE,CAAC"}
|