@codeleap/mobile 7.0.0 → 7.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/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
package/dist/Registry.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { CodeleapStyleRegistry, StylePersistor } from '@codeleap/styles';
|
|
2
|
+
import { StyleSheet } from 'react-native';
|
|
3
|
+
import { MMKV } from 'react-native-mmkv';
|
|
4
|
+
const mmkvStorage = new MMKV();
|
|
5
|
+
const persistor = new StylePersistor({
|
|
6
|
+
set(key, value) {
|
|
7
|
+
return mmkvStorage?.set(key, value);
|
|
8
|
+
},
|
|
9
|
+
get(key) {
|
|
10
|
+
return mmkvStorage?.getString(key);
|
|
11
|
+
},
|
|
12
|
+
del(key) {
|
|
13
|
+
return mmkvStorage?.delete(key);
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
let instance;
|
|
17
|
+
const components = [];
|
|
18
|
+
/**
|
|
19
|
+
* Singleton — the constructor enforces a single instance and returns it on every `new` call, so any module that imports this class and instantiates it will always get the same registry. Components registered via the static `registerComponent` before the first instantiation are buffered in `components[]` and replayed on construction; registrations after instantiation go straight to the live instance.
|
|
20
|
+
*
|
|
21
|
+
* `createStyle` passes every style object through `StyleSheet.create` so React Native can intern it on the native side; skipping this would cause equality checks in layout diffing to always fail.
|
|
22
|
+
*/
|
|
23
|
+
export class MobileStyleRegistry extends CodeleapStyleRegistry {
|
|
24
|
+
constructor() {
|
|
25
|
+
super(persistor);
|
|
26
|
+
components.forEach((component) => {
|
|
27
|
+
this.registerComponent(component);
|
|
28
|
+
});
|
|
29
|
+
if (!instance) {
|
|
30
|
+
instance = this;
|
|
31
|
+
}
|
|
32
|
+
return instance;
|
|
33
|
+
}
|
|
34
|
+
createStyle(css) {
|
|
35
|
+
return StyleSheet.create({ s: css }).s;
|
|
36
|
+
}
|
|
37
|
+
static get current() {
|
|
38
|
+
return instance;
|
|
39
|
+
}
|
|
40
|
+
static registerComponent(component) {
|
|
41
|
+
components.push(component);
|
|
42
|
+
if (instance) {
|
|
43
|
+
instance.registerComponent(component);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=Registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Registry.js","sourceRoot":"","sources":["../src/Registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,qBAAqB,EAAQ,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAClG,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAExC,MAAM,WAAW,GAAG,IAAI,IAAI,EAAE,CAAA;AAE9B,MAAM,SAAS,GAAG,IAAI,cAAc,CAAC;IACnC,GAAG,CAAC,GAAG,EAAE,KAAK;QACZ,OAAO,WAAW,EAAE,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;IACrC,CAAC;IACD,GAAG,CAAC,GAAG;QACL,OAAO,WAAW,EAAE,SAAS,CAAC,GAAG,CAAC,CAAA;IACpC,CAAC;IACD,GAAG,CAAC,GAAG;QACL,OAAO,WAAW,EAAE,MAAM,CAAC,GAAG,CAAC,CAAA;IACjC,CAAC;CACF,CAAC,CAAA;AAEF,IAAI,QAA6B,CAAA;AAEjC,MAAM,UAAU,GAAkD,EAAE,CAAA;AAEpE;;;;GAIG;AACH,MAAM,OAAO,mBAAoB,SAAQ,qBAAqB;IAC5D;QACE,KAAK,CAAC,SAAS,CAAC,CAAA;QAEhB,UAAU,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;YAC/B,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAA;QACnC,CAAC,CAAC,CAAA;QAEF,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,QAAQ,GAAG,IAAI,CAAA;QACjB,CAAC;QAED,OAAO,QAAQ,CAAA;IACjB,CAAC;IAED,WAAW,CAAC,GAAS;QACnB,OAAO,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAA;IACxC,CAAC;IAED,MAAM,KAAK,OAAO;QAChB,OAAO,QAAQ,CAAA;IACjB,CAAC;IAED,MAAM,CAAC,iBAAiB,CAAC,SAA6B;QACpD,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QAC1B,IAAI,QAAQ,EAAE,CAAC;YACb,QAAQ,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAA;QACvC,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ActivityIndicator as RNActivityIndicator } from 'react-native';
|
|
3
|
+
import { MobileStyleRegistry } from '../../Registry';
|
|
4
|
+
import { useStylesFor } from '../../hooks';
|
|
5
|
+
export * from './styles';
|
|
6
|
+
export * from './types';
|
|
7
|
+
export const ActivityIndicator = (props) => {
|
|
8
|
+
const { style, component: Component = RNActivityIndicator, ...rest } = {
|
|
9
|
+
...ActivityIndicator.defaultProps,
|
|
10
|
+
...props,
|
|
11
|
+
};
|
|
12
|
+
const styles = useStylesFor(ActivityIndicator.styleRegistryName, style);
|
|
13
|
+
const wrapperStyle = styles?.wrapper;
|
|
14
|
+
/** `color` and `size` are extracted from the style token rather than passed as props so that
|
|
15
|
+
* theme variants can control them via the design-token system instead of inline overrides. */
|
|
16
|
+
const color = wrapperStyle?.color || '#000';
|
|
17
|
+
const size = (wrapperStyle?.height || wrapperStyle?.width || 'large');
|
|
18
|
+
return (_jsx(Component, { size: size, color: color, ...rest, style: styles?.wrapper }));
|
|
19
|
+
};
|
|
20
|
+
ActivityIndicator.styleRegistryName = 'ActivityIndicator';
|
|
21
|
+
ActivityIndicator.elements = ['wrapper'];
|
|
22
|
+
ActivityIndicator.rootElement = 'wrapper';
|
|
23
|
+
ActivityIndicator.defaultProps = {};
|
|
24
|
+
ActivityIndicator.withVariantTypes = (styles) => {
|
|
25
|
+
return ActivityIndicator;
|
|
26
|
+
};
|
|
27
|
+
MobileStyleRegistry.registerComponent(ActivityIndicator);
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ActivityIndicator/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,iBAAiB,IAAI,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAEvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAEpD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AAEvB,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAA6D,KAAgC,EAAE,EAAE;IAChI,MAAM,EACJ,KAAK,EACL,SAAS,EAAE,SAAS,GAAG,mBAAmB,EAC1C,GAAG,IAAI,EACR,GAAG;QACF,GAAG,iBAAiB,CAAC,YAAY;QACjC,GAAG,KAAK;KACT,CAAA;IAED,MAAM,MAAM,GAAG,YAAY,CAAC,iBAAiB,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAA;IAEvE,MAAM,YAAY,GAAG,MAAM,EAAE,OAAwB,CAAA;IAErD;mGAC+F;IAC/F,MAAM,KAAK,GAAG,YAAY,EAAE,KAAK,IAAI,MAAM,CAAA;IAC3C,MAAM,IAAI,GAAG,CAAC,YAAY,EAAE,MAAM,IAAI,YAAY,EAAE,KAAK,IAAI,OAAO,CAAW,CAAA;IAE/E,OAAO,CACL,KAAC,SAAS,IACR,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,KACR,IAAI,EACR,KAAK,EAAE,MAAM,EAAE,OAAO,GACtB,CACH,CAAA;AACH,CAAC,CAAA;AAED,iBAAiB,CAAC,iBAAiB,GAAG,mBAAmB,CAAA;AACzD,iBAAiB,CAAC,QAAQ,GAAG,CAAC,SAAS,CAAC,CAAA;AACxC,iBAAiB,CAAC,WAAW,GAAG,SAAS,CAAA;AACzC,iBAAiB,CAAC,YAAY,GAAG,EAAqC,CAAA;AAEtE,iBAAiB,CAAC,gBAAgB,GAAG,CAAsB,MAAS,EAAE,EAAE;IACtE,OAAO,iBAAkK,CAAA;AAC3K,CAAC,CAAA;AAED,mBAAmB,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/components/ActivityIndicator/styles.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/ActivityIndicator/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback } from 'react';
|
|
3
|
+
import { TypeGuards } from '@codeleap/types';
|
|
4
|
+
import { onMount, useSearch } from '@codeleap/hooks';
|
|
5
|
+
import { List } from '../List';
|
|
6
|
+
import { SearchInput } from '../SearchInput';
|
|
7
|
+
import { Button } from '../Button';
|
|
8
|
+
import { View } from '../View';
|
|
9
|
+
import { useCompositionStyles } from '@codeleap/styles';
|
|
10
|
+
import { MobileStyleRegistry } from '../../Registry';
|
|
11
|
+
import { useStylesFor } from '../../hooks';
|
|
12
|
+
export * from './styles';
|
|
13
|
+
export * from './types';
|
|
14
|
+
const defaultFilterFunction = (search, options) => {
|
|
15
|
+
return options.filter((option) => {
|
|
16
|
+
if (TypeGuards.isString(option.label)) {
|
|
17
|
+
return option.label.toLowerCase().includes(search.toLowerCase());
|
|
18
|
+
}
|
|
19
|
+
return option.label === search;
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
const defaultGetLabel = (option) => {
|
|
23
|
+
if (TypeGuards.isArray(option)) {
|
|
24
|
+
if (option.length === 0)
|
|
25
|
+
return null;
|
|
26
|
+
return option.map(o => o.label).join(', ');
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
if (!option)
|
|
30
|
+
return null;
|
|
31
|
+
return option?.label;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Unlike Select, Autocomplete renders inline (no modal) — the result list is positioned below
|
|
36
|
+
* the search input in the same scroll context, so `scrollEnabled` is false on the inner List to
|
|
37
|
+
* avoid nested scroll conflicts.
|
|
38
|
+
*
|
|
39
|
+
* `selectable` must be true for item presses to update `value`; without it, `onItemPressed`
|
|
40
|
+
* fires but selection state is never written.
|
|
41
|
+
*/
|
|
42
|
+
export const Autocomplete = (autocomplete) => {
|
|
43
|
+
const allProps = {
|
|
44
|
+
...Autocomplete.defaultProps,
|
|
45
|
+
...autocomplete,
|
|
46
|
+
};
|
|
47
|
+
const { value, onValueChange, options = [], renderItem, debugName, placeholder, itemProps = {}, searchable, loadOptions, multiple, limit = null, defaultOptions = options, onLoadOptionsError, selectedIcon, loadOptionsOnMount = defaultOptions.length === 0, selectable, searchComponent, filterItems = defaultFilterFunction, searchInputProps: searchProps = {}, onItemPressed = () => { }, listPlaceholder, style, loading: loadingProp = false, listProps = {}, } = allProps;
|
|
48
|
+
const isValueArray = TypeGuards.isArray(value) && multiple;
|
|
49
|
+
const { loading, setLoading, labelOptions, setLabelOptions, filteredOptions, load, onChangeSearch, } = useSearch({
|
|
50
|
+
value,
|
|
51
|
+
multiple,
|
|
52
|
+
options,
|
|
53
|
+
filterItems,
|
|
54
|
+
debugName,
|
|
55
|
+
defaultOptions,
|
|
56
|
+
loadOptions,
|
|
57
|
+
onLoadOptionsError,
|
|
58
|
+
});
|
|
59
|
+
onMount(() => {
|
|
60
|
+
if (loadOptionsOnMount && !!loadOptions) {
|
|
61
|
+
load();
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
const styles = useStylesFor(Autocomplete.styleRegistryName, style);
|
|
65
|
+
const compositionStyles = useCompositionStyles(['item', 'list', 'searchInput'], styles);
|
|
66
|
+
const currentOptions = searchable ? filteredOptions : defaultOptions;
|
|
67
|
+
const select = (selectedValue) => {
|
|
68
|
+
let newValue = null;
|
|
69
|
+
let newOption = null;
|
|
70
|
+
let removedIndex = null;
|
|
71
|
+
if (multiple && isValueArray) {
|
|
72
|
+
if (value.includes(selectedValue)) {
|
|
73
|
+
removedIndex = value.findIndex(v => v === selectedValue);
|
|
74
|
+
newValue = value.filter((v, i) => i !== removedIndex);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
if (TypeGuards.isNumber(limit) && value.length >= limit) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
newOption = currentOptions.find(o => o.value === selectedValue);
|
|
81
|
+
newValue = [...value, selectedValue];
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
newValue = selectedValue;
|
|
86
|
+
newOption = currentOptions.find(o => o.value === selectedValue);
|
|
87
|
+
}
|
|
88
|
+
onValueChange(newValue);
|
|
89
|
+
if (isValueArray) {
|
|
90
|
+
if (removedIndex !== null) {
|
|
91
|
+
const newOptions = [...labelOptions];
|
|
92
|
+
newOptions.splice(removedIndex, 1);
|
|
93
|
+
setLabelOptions(newOptions);
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
setLabelOptions([...labelOptions, newOption]);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
setLabelOptions([newOption]);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
const Item = renderItem || Button;
|
|
104
|
+
const renderListItem = useCallback(({ item }) => {
|
|
105
|
+
let selected = false;
|
|
106
|
+
if (multiple && isValueArray) {
|
|
107
|
+
selected = value?.includes(item.value);
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
selected = value === item.value;
|
|
111
|
+
}
|
|
112
|
+
return _jsx(Item, { debugName: `${debugName} item ${item.value}`, selected: selectable ? selected : false, text: item.label, item: item, onPress: () => {
|
|
113
|
+
onItemPressed(item);
|
|
114
|
+
if (selectable) {
|
|
115
|
+
select(item.value);
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
// @ts-ignore
|
|
119
|
+
rightIcon: selectedIcon,
|
|
120
|
+
// @ts-ignore
|
|
121
|
+
icon: selectedIcon, style: compositionStyles?.item, ...itemProps });
|
|
122
|
+
}, [value, select, multiple, selectable, isValueArray]);
|
|
123
|
+
const Search = searchComponent;
|
|
124
|
+
const showLoading = TypeGuards.isFunction(loadingProp) ? loadingProp(loading) : (loadingProp || loading);
|
|
125
|
+
return _jsxs(View, { style: styles?.wrapper, children: [_jsx(Search, { placeholder: placeholder, debugName: debugName, onTypingChange: (isTyping) => {
|
|
126
|
+
if (searchable && !!loadOptions && isTyping) {
|
|
127
|
+
setLoading(isTyping);
|
|
128
|
+
}
|
|
129
|
+
}, debounce: !!loadOptions ? 800 : null, onSearchChange: onChangeSearch, hideErrorMessage: true, ...searchProps, style: compositionStyles?.searchInput }), _jsx(List, { data: searchable ? filteredOptions : options, scrollEnabled: false, showsHorizontalScrollIndicator: false, style: compositionStyles?.list,
|
|
130
|
+
// @ts-ignore
|
|
131
|
+
keyExtractor: (i) => i.value, renderItem: renderListItem, loading: showLoading, placeholder: listPlaceholder, keyboardAware: false, ...listProps })] });
|
|
132
|
+
};
|
|
133
|
+
Autocomplete.styleRegistryName = 'Autocomplete';
|
|
134
|
+
Autocomplete.elements = ['wrapper', 'list', 'item', 'searchInput'];
|
|
135
|
+
Autocomplete.rootElement = 'wrapper';
|
|
136
|
+
Autocomplete.withVariantTypes = (styles) => {
|
|
137
|
+
return Autocomplete;
|
|
138
|
+
};
|
|
139
|
+
Autocomplete.defaultProps = {
|
|
140
|
+
getLabel: defaultGetLabel,
|
|
141
|
+
searchInputProps: {},
|
|
142
|
+
selectedIcon: 'check',
|
|
143
|
+
searchComponent: SearchInput,
|
|
144
|
+
placeholder: 'Select',
|
|
145
|
+
searchable: true,
|
|
146
|
+
multiple: false,
|
|
147
|
+
selectable: false,
|
|
148
|
+
};
|
|
149
|
+
MobileStyleRegistry.registerComponent(Autocomplete);
|
|
150
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Autocomplete/index.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,EAAW,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACrD,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE5C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAkD,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AACvG,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,qBAAqB,GAAG,CAAC,MAAc,EAAE,OAAqB,EAAE,EAAE;IACtE,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE;QAC/B,IAAI,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;YACtC,OAAO,MAAM,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAA;QAClE,CAAC;QAED,OAAO,MAAM,CAAC,KAAK,KAAK,MAAM,CAAA;IAChC,C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gB,WACZ,WAAW,EACf,KAAK,EAAE,iBAAiB,EAAE,WAAW,GACrC,EAEF,KAAC,IAAI,IACH,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,OAAO,EAC5C,aAAa,EAAE,KAAK,EACpB,8BAA8B,EAAE,KAAK,EACrC,KAAK,EAAE,iBAAiB,EAAE,IAAI;gBAC9B,aAAa;gBACb,YAAY,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,EAC5B,UAAU,EAAE,cAAc,EAC1B,OAAO,EAAE,WAAW,EACpB,WAAW,EAAE,eAAe,EAC5B,aAAa,EAAE,KAAK,KAChB,SAAS,GACb,IACG,CAAA;AACT,CAAC,CAAA;AAED,YAAY,CAAC,iBAAiB,GAAG,cAAc,CAAA;AAC/C,YAAY,CAAC,QAAQ,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,CAAA;AAClE,YAAY,CAAC,WAAW,GAAG,SAAS,CAAA;AAEpC,YAAY,CAAC,gBAAgB,GAAG,CAAsB,MAAS,EAAE,EAAE;IACjE,OAAO,YAAsK,CAAA;AAC/K,CAAC,CAAA;AAED,YAAY,CAAC,YAAY,GAAG;IAC1B,QAAQ,EAAE,eAAe;IACzB,gBAAgB,EAAE,EAAE;IACpB,YAAY,EAAE,OAAkB;IAChC,eAAe,EAAE,WAAW;IAC5B,WAAW,EAAE,QAAQ;IACrB,UAAU,EAAE,IAAI;IAChB,QAAQ,EAAE,KAAK;IACf,UAAU,EAAE,KAAK;CAC0B,CAAA;AAE7C,mBAAmB,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/components/Autocomplete/styles.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/Autocomplete/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useAvatarContext } from '../context';
|
|
3
|
+
import { Badge } from '../../Badge';
|
|
4
|
+
import { useCompositionStyles } from '@codeleap/styles';
|
|
5
|
+
import { TypeGuards } from '@codeleap/types';
|
|
6
|
+
export const AvatarBadge = (props) => {
|
|
7
|
+
const { badge, styles, ...badgeProps } = useAvatarContext(props);
|
|
8
|
+
const compositionsStyles = useCompositionStyles('badge', styles);
|
|
9
|
+
if (TypeGuards.isNil(badge))
|
|
10
|
+
return null;
|
|
11
|
+
return _jsx(Badge, { badge: badge, ...badgeProps, style: compositionsStyles.badge });
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=Badge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Badge.js","sourceRoot":"","sources":["../../../../src/components/Avatar/components/Badge.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAEvD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAuB,EAAE,EAAE;IACrD,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,UAAU,EAAE,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAA;IAEhE,MAAM,kBAAkB,GAAG,oBAAoB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;IAEhE,IAAI,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAA;IAExC,OAAO,KAAC,KAAK,IAAC,KAAK,EAAE,KAAK,KAAM,UAAU,EAAE,KAAK,EAAE,kBAAkB,CAAC,KAAK,GAAI,CAAA;AACjF,CAAC,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useAvatarContext } from '../context';
|
|
3
|
+
import { AvatarBadge } from './Badge';
|
|
4
|
+
import { AvatarIllustration } from './Illustration';
|
|
5
|
+
import { AvatarText } from './Text';
|
|
6
|
+
import { AvatarOverlayIcon } from './OverlayIcon';
|
|
7
|
+
import { AvatarWrapper } from './Wrapper';
|
|
8
|
+
/**
|
|
9
|
+
* When `children` are provided the sub-components (Badge, OverlayIcon, Illustration/Text) are
|
|
10
|
+
* NOT rendered automatically — the caller is fully responsible for composing them inside children.
|
|
11
|
+
*/
|
|
12
|
+
export const AvatarContent = ({ children }) => {
|
|
13
|
+
const { icon, image } = useAvatarContext();
|
|
14
|
+
if (children) {
|
|
15
|
+
return (_jsx(AvatarWrapper, { children: children }));
|
|
16
|
+
}
|
|
17
|
+
return (_jsxs(AvatarWrapper, { children: [(!!icon || !!image) ? _jsx(AvatarIllustration, {}) : _jsx(AvatarText, {}), _jsx(AvatarBadge, {}), _jsx(AvatarOverlayIcon, {})] }));
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=Content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Content.js","sourceRoot":"","sources":["../../../../src/components/Avatar/components/Content.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AACrC,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AACnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAEzC;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAAE,QAAQ,EAA2B,EAAE,EAAE;IACrE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,gBAAgB,EAAE,CAAA;IAE1C,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,CACL,KAAC,aAAa,cAAE,QAAQ,GAAiB,CAC1C,CAAA;IACH,CAAC;IAED,OAAO,CACL,MAAC,aAAa,eACX,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAC,kBAAkB,KAAG,CAAC,CAAC,CAAC,KAAC,UAAU,KAAG,EAC9D,KAAC,WAAW,KAAG,EACf,KAAC,iBAAiB,KAAG,IACP,CACjB,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Icon } from '../../Icon';
|
|
3
|
+
import { Image } from '../../Image';
|
|
4
|
+
import { useAvatarContext } from '../context';
|
|
5
|
+
import { TypeGuards } from '@codeleap/types';
|
|
6
|
+
export const AvatarIllustration = (props) => {
|
|
7
|
+
const { icon, image, styles } = useAvatarContext(props);
|
|
8
|
+
const source = TypeGuards.isString(image) ? { uri: image } : image;
|
|
9
|
+
return _jsxs(_Fragment, { children: [icon ? _jsx(Icon, { name: icon, style: styles.icon }) : null, image ? _jsx(Image, { source: source, style: styles.image }) : null] });
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=Illustration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Illustration.js","sourceRoot":"","sources":["../../../../src/components/Avatar/components/Illustration.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAEjC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAA8B,EAAE,EAAE;IACnE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAA;IAEvD,MAAM,MAAM,GAAG,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAA;IAElE,OAAO,8BACJ,IAAI,CAAC,CAAC,CAAC,KAAC,IAAI,IAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,GAAI,CAAC,CAAC,CAAC,IAAI,EACtD,KAAK,CAAC,CAAC,CAAC,KAAC,KAAK,IAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,GAAI,CAAC,CAAC,CAAC,IAAI,IAC7D,CAAA;AACL,CAAC,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useAvatarContext } from '../context';
|
|
3
|
+
import { Touchable } from '../../Touchable';
|
|
4
|
+
import { Icon } from '../../Icon';
|
|
5
|
+
export const AvatarOverlayIcon = (props) => {
|
|
6
|
+
const { overlayIcon, styles, onPressOverlayIcon, ...touchableProps } = useAvatarContext(props);
|
|
7
|
+
if (!overlayIcon)
|
|
8
|
+
return null;
|
|
9
|
+
return (_jsx(Touchable, { debugName: 'avatar:overlayIcon', onPress: onPressOverlayIcon, noFeedback: true, ...touchableProps, style: styles.overlayIconWrapper, children: _jsx(Icon, { name: overlayIcon, style: styles.overlayIcon }) }));
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=OverlayIcon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OverlayIcon.js","sourceRoot":"","sources":["../../../../src/components/Avatar/components/OverlayIcon.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAE7C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAEjC,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAA6B,EAAE,EAAE;IACjE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,kBAAkB,EAAE,GAAG,cAAc,EAAE,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAA;IAE9F,IAAI,CAAC,WAAW;QAAE,OAAO,IAAI,CAAA;IAE7B,OAAO,CACL,KAAC,SAAS,IACR,SAAS,EAAC,oBAAoB,EAC9B,OAAO,EAAE,kBAAkB,EAC3B,UAAU,WACN,cAAc,EAClB,KAAK,EAAE,MAAM,CAAC,kBAAkB,YAEhC,KAAC,IAAI,IAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,CAAC,WAAW,GAAI,GAC5C,CACb,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useAvatarContext } from '../context';
|
|
3
|
+
import { Text } from '../../Text';
|
|
4
|
+
import { useMemo } from 'react';
|
|
5
|
+
import { TypeGuards } from '@codeleap/types';
|
|
6
|
+
export const AvatarText = (props) => {
|
|
7
|
+
const { text, name, firstNameOnly, styles } = useAvatarContext(props);
|
|
8
|
+
const initials = useMemo(() => {
|
|
9
|
+
const [first = '', last = ''] = TypeGuards.isString(name) ? name.split(' ') : name ?? [];
|
|
10
|
+
const initials = [first[0]];
|
|
11
|
+
if (!firstNameOnly)
|
|
12
|
+
initials.push(last[0]);
|
|
13
|
+
return initials?.join('');
|
|
14
|
+
}, [name, firstNameOnly]);
|
|
15
|
+
if (!text && !initials)
|
|
16
|
+
return null;
|
|
17
|
+
return (_jsx(Text, { text: text || initials, style: styles.text }));
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=Text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.js","sourceRoot":"","sources":["../../../../src/components/Avatar/components/Text.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAE7C,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAsB,EAAE,EAAE;IACnD,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAA;IAErE,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,EAAE;QAC5B,MAAM,CAAC,KAAK,GAAG,EAAE,EAAE,IAAI,GAAG,EAAE,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAA;QACxF,MAAM,QAAQ,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;QAE3B,IAAI,CAAC,aAAa;YAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA;QAE1C,OAAO,QAAQ,EAAE,IAAI,CAAC,EAAE,CAAC,CAAA;IAC3B,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC,CAAA;IAEzB,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAA;IAEnC,OAAO,CACL,KAAC,IAAI,IAAC,IAAI,EAAE,IAAI,IAAI,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,GAAI,CACrD,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { TypeGuards } from '@codeleap/types';
|
|
3
|
+
import { useAvatarContext } from '../context';
|
|
4
|
+
import { useMemo } from 'react';
|
|
5
|
+
import { matchInitialToColor, memoBy } from '@codeleap/utils';
|
|
6
|
+
import { Touchable } from '../../Touchable';
|
|
7
|
+
import { View } from '../../View';
|
|
8
|
+
const UnMemoizedAvatarWrapper = ({ children }) => {
|
|
9
|
+
const { styles, onPress, name, icon, image, ...wrapperProps } = useAvatarContext();
|
|
10
|
+
// @ts-expect-error ICSS
|
|
11
|
+
const bgColor = styles?.touchable?.backgroundColor;
|
|
12
|
+
/**
|
|
13
|
+
* Falls back to a deterministic colour derived from the first letter of `name` when no
|
|
14
|
+
* explicit `backgroundColor` is set in the style token, so initials avatars are always
|
|
15
|
+
* distinguishable without requiring per-avatar colour configuration.
|
|
16
|
+
*/
|
|
17
|
+
const randomBgColor = useMemo(() => {
|
|
18
|
+
if (!!bgColor)
|
|
19
|
+
return bgColor;
|
|
20
|
+
const firstLetter = TypeGuards.isString(name) ? name[0] : name?.[0]?.[0];
|
|
21
|
+
return matchInitialToColor(firstLetter);
|
|
22
|
+
}, [bgColor, name]);
|
|
23
|
+
const isPressable = TypeGuards.isFunction(onPress);
|
|
24
|
+
if (isPressable) {
|
|
25
|
+
return (_jsx(Touchable, { debugName: 'avatar', ...wrapperProps, onPress: onPress, style: [styles.wrapper, { backgroundColor: randomBgColor }], children: children }));
|
|
26
|
+
}
|
|
27
|
+
return (_jsx(View, { ...wrapperProps, style: [styles.wrapper, { backgroundColor: randomBgColor }], children: children }));
|
|
28
|
+
};
|
|
29
|
+
export const AvatarWrapper = memoBy(UnMemoizedAvatarWrapper, 'children');
|
|
30
|
+
//# sourceMappingURL=Wrapper.js.map
|
|
@@ -0,0 +1 @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Q,KACd,YAAY,EAChB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,eAAe,EAAE,aAAa,EAAE,CAAC,YAE1D,QAAQ,GACC,CACb,CAAA;IACH,CAAC;IAED,OAAO,CACL,KAAC,IAAI,OAAK,YAAY,EAAE,KAAK,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,eAAe,EAAE,aAAa,EAAE,CAAC,YAChF,QAAQ,GACJ,CACR,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,uBAAuB,EAAE,UAAU,CAAC,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
export const AvatarContext = createContext({});
|
|
3
|
+
export const useAvatarContext = (providedProps = {}) => {
|
|
4
|
+
const ctx = useContext(AvatarContext);
|
|
5
|
+
if (!ctx) {
|
|
6
|
+
throw new Error('[Avatar] useAvatarContext must be used within an Avatar component.');
|
|
7
|
+
}
|
|
8
|
+
return {
|
|
9
|
+
...ctx,
|
|
10
|
+
...providedProps,
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/components/Avatar/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAGjD,MAAM,CAAC,MAAM,aAAa,GAAG,aAAa,CAAC,EAAoB,CAAC,CAAA;AAEhE,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAqB,gBAA4B,EAAE,EAAE,EAAE;IACrF,MAAM,GAAG,GAAG,UAAU,CAAC,aAAa,CAAC,CAAA;IAErC,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CACb,oEAAoE,CACrE,CAAA;IACH,CAAC;IAED,OAAO;QACL,GAAG,GAAG;QACN,GAAG,aAAa;KACjB,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { MobileStyleRegistry } from '../../Registry';
|
|
3
|
+
import { AvatarContext } from './context';
|
|
4
|
+
import { AvatarContent } from './components/Content';
|
|
5
|
+
import { useStylesFor } from '../../hooks';
|
|
6
|
+
import { AvatarIllustration } from './components/Illustration';
|
|
7
|
+
import { AvatarText } from './components/Text';
|
|
8
|
+
import { AvatarBadge } from './components/Badge';
|
|
9
|
+
import { AvatarOverlayIcon } from './components/OverlayIcon';
|
|
10
|
+
export * from './styles';
|
|
11
|
+
export * from './types';
|
|
12
|
+
export const Avatar = (props) => {
|
|
13
|
+
const { children, style, ...contextValue } = {
|
|
14
|
+
...Avatar.defaultProps,
|
|
15
|
+
...props,
|
|
16
|
+
};
|
|
17
|
+
const styles = useStylesFor(Avatar.styleRegistryName, style);
|
|
18
|
+
return (_jsx(AvatarContext.Provider, { value: { ...contextValue, styles }, children: _jsx(AvatarContent, { children: children }) }));
|
|
19
|
+
};
|
|
20
|
+
Avatar.styleRegistryName = 'Avatar';
|
|
21
|
+
Avatar.elements = ['wrapper', 'text', 'image', 'icon', 'overlayIcon', 'badge'];
|
|
22
|
+
Avatar.rootElement = 'wrapper';
|
|
23
|
+
Avatar.Illustration = AvatarIllustration;
|
|
24
|
+
Avatar.Text = AvatarText;
|
|
25
|
+
Avatar.Badge = AvatarBadge;
|
|
26
|
+
Avatar.OverlayIcon = AvatarOverlayIcon;
|
|
27
|
+
Avatar.withVariantTypes = (styles) => {
|
|
28
|
+
return Avatar;
|
|
29
|
+
};
|
|
30
|
+
Avatar.defaultProps = {
|
|
31
|
+
badge: false,
|
|
32
|
+
firstNameOnly: false,
|
|
33
|
+
};
|
|
34
|
+
MobileStyleRegistry.registerComponent(Avatar);
|
|
35
|
+
//# sourceMappingURL=index.js.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AG,kBAAkB,CAAA;AACxC,MAAM,CAAC,IAAI,GAAG,UAAU,CAAA;AACxB,MAAM,CAAC,KAAK,GAAG,WAAW,CAAA;AAC1B,MAAM,CAAC,WAAW,GAAG,iBAAiB,CAAA;AAEtC,MAAM,CAAC,gBAAgB,GAAG,CAAsB,MAAS,EAAE,EAAE;IAC3D,OAAO,MAAsJ,CAAA;AAC/J,CAAC,CAAA;AAED,MAAM,CAAC,YAAY,GAAG;IACpB,KAAK,EAAE,KAAK;IACZ,aAAa,EAAE,KAAK;CACG,CAAA;AAEzB,mBAAmB,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/components/Avatar/styles.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/Avatar/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { View } from '../View';
|
|
3
|
+
import { Avatar } from '../Avatar';
|
|
4
|
+
import { useNestedStylesByKey } from '@codeleap/styles';
|
|
5
|
+
import { MobileStyleRegistry } from '../../Registry';
|
|
6
|
+
import { useStylesFor } from '../../hooks';
|
|
7
|
+
export * from './styles';
|
|
8
|
+
export * from './types';
|
|
9
|
+
/**
|
|
10
|
+
* Uses percentage-based `right` offset so overlap scales with the container width; a fixed
|
|
11
|
+
* pixel offset would break on different screen densities and container sizes.
|
|
12
|
+
*/
|
|
13
|
+
const getAvatarStyle = (index, displacement = 20.5) => {
|
|
14
|
+
const right = index * displacement;
|
|
15
|
+
return { right: `${right}%` };
|
|
16
|
+
};
|
|
17
|
+
export const AvatarGroup = (props) => {
|
|
18
|
+
const { avatars = [], style, displacement, debugName, ...viewProps } = {
|
|
19
|
+
...AvatarGroup.defaultProps,
|
|
20
|
+
...props,
|
|
21
|
+
};
|
|
22
|
+
const styles = useStylesFor(AvatarGroup.styleRegistryName, style);
|
|
23
|
+
const avatarStyles = useNestedStylesByKey('avatar', styles);
|
|
24
|
+
return (_jsx(View, { ...viewProps, style: styles.wrapper, children: avatars?.map?.((avatar, index) => (_jsx(Avatar, { firstNameOnly: true, debugName: `${debugName}: ${avatar?.debugName ?? index}`, ...avatar, style: [avatarStyles, (avatar?.style ?? {}), getAvatarStyle(index, displacement)] }, debugName + index))) }));
|
|
25
|
+
};
|
|
26
|
+
AvatarGroup.styleRegistryName = 'AvatarGroup';
|
|
27
|
+
AvatarGroup.elements = ['wrapper', 'avatar'];
|
|
28
|
+
AvatarGroup.rootElement = 'wrapper';
|
|
29
|
+
AvatarGroup.withVariantTypes = (styles) => {
|
|
30
|
+
return AvatarGroup;
|
|
31
|
+
};
|
|
32
|
+
AvatarGroup.defaultProps = {
|
|
33
|
+
displacement: 20.5,
|
|
34
|
+
};
|
|
35
|
+
MobileStyleRegistry.registerComponent(AvatarGroup);
|
|
36
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/AvatarGroup/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAElC,OAAO,EAAa,oBAAoB,EAA8B,MAAM,kBAAkB,CAAA;AAC9F,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AAEvB;;;GAGG;AACH,MAAM,cAAc,GAAG,CAAC,KAAa,EAAE,eAAuB,IAAI,EAAE,EAAE;IACpE,MAAM,KAAK,GAAG,KAAK,GAAG,YAAY,CAAA;IAClC,OAAO,EAAE,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AAmB,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/components/AvatarGroup/styles.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/AvatarGroup/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Touchable } from '../Touchable';
|
|
3
|
+
import { View } from '../View';
|
|
4
|
+
import { MobileStyleRegistry } from '../../Registry';
|
|
5
|
+
import { useStylesFor } from '../../hooks';
|
|
6
|
+
import { FadeIn, FadeOut } from 'react-native-reanimated';
|
|
7
|
+
export * from './styles';
|
|
8
|
+
export * from './types';
|
|
9
|
+
export const Backdrop = (props) => {
|
|
10
|
+
const { visible, children, wrapperProps = {}, style, entering, exiting, ...rest } = {
|
|
11
|
+
...Backdrop.defaultProps,
|
|
12
|
+
...props,
|
|
13
|
+
};
|
|
14
|
+
const styles = useStylesFor(Backdrop.styleRegistryName, style);
|
|
15
|
+
const isPressable = !!props?.onPress;
|
|
16
|
+
/** Early return unmounts the node entirely when hidden, which means the `exiting` animation will NOT play — callers that need a fade-out must keep `visible` true until after the exit animation completes, or drive visibility through `opacity`/`pointerEvents` instead. */
|
|
17
|
+
if (!visible)
|
|
18
|
+
return null;
|
|
19
|
+
return (_jsxs(View.Animated, { pointerEvents: visible ? 'auto' : 'none', entering: entering, exiting: exiting, ...wrapperProps, style: styles.wrapper, children: [isPressable
|
|
20
|
+
? _jsx(Touchable, { ...rest, style: styles.touchable, noFeedback: true, android_ripple: null })
|
|
21
|
+
: null, children] }));
|
|
22
|
+
};
|
|
23
|
+
Backdrop.styleRegistryName = 'Backdrop';
|
|
24
|
+
Backdrop.elements = ['wrapper', 'touchable', 'transition'];
|
|
25
|
+
Backdrop.rootElement = 'wrapper';
|
|
26
|
+
Backdrop.withVariantTypes = (styles) => {
|
|
27
|
+
return Backdrop;
|
|
28
|
+
};
|
|
29
|
+
Backdrop.defaultProps = {
|
|
30
|
+
entering: FadeIn.duration(100).build(),
|
|
31
|
+
exiting: FadeOut.duration(100).delay(100).build(),
|
|
32
|
+
};
|
|
33
|
+
MobileStyleRegistry.registerComponent(Backdrop);
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Backdrop/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAI9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAEzD,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AAEvB,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAAoB,EAAE,EAAE;IAC/C,MAAM,EACJ,OAAO,EACP,QAAQ,EACR,YAAY,GAAG,EAAE,EACjB,KAAK,EACL,QAAQ,EACR,OAAO,EACP,GAAG,IAAI,EACR,GAAG;QACF,GAAG,QAAQ,CAAC,YAAY;QACxB,GAAG,KAAK;KACT,CAAA;IAED,MAAM,MAAM,GAAG,YAAY,CAAC,QAAQ,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAA;IAE9D,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,EAAE,OAAO,CAAA;IAEpC,8QAA8Q;IAC9Q,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAA;IAEzB,OAAO,CACL,MAAC,IAAI,CAAC,QAAQ,IACZ,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EACxC,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,KACZ,YAAY,EAChB,KAAK,EAAE,MAAM,CAAC,OAAO,aAGpB,WAAW;gBACV,CAAC,CAAC,KAAC,SAAS,OAAK,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,SAAS,EAAE,UAAU,QAAC,cAAc,EAAE,IAAI,GAAI;gBACnF,CAAC,CAAC,IAAI,EAEP,QAAQ,IACK,CACjB,CAAA;AACH,CAAC,CAAA;AAED,QAAQ,CAAC,iBAAiB,GAAG,UAAU,CAAA;AACvC,QAAQ,CAAC,QAAQ,GAAG,CAAC,SAAS,EAAE,WAAW,EAAE,YAAY,CAAC,CAAA;AAC1D,QAAQ,CAAC,WAAW,GAAG,SAAS,CAAA;AAEhC,QAAQ,CAAC,gBAAgB,GAAG,CAAsB,MAAS,EAAE,EAAE;IAC7D,OAAO,QAA+E,CAAA;AACxF,CAAC,CAAA;AAED,QAAQ,CAAC,YAAY,GAAG;IACtB,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE;IACtC,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE;CACxB,CAAA;AAE3B,mBAAmB,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/components/Backdrop/styles.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/Backdrop/types.ts"],"names":[],"mappings":""}
|