@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/Scroll/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React, { forwardRef, useCallback, useState } from 'react';
|
|
3
|
+
import { TextInput } from '../TextInput';
|
|
4
|
+
import { TypeGuards } from '@codeleap/types';
|
|
5
|
+
export const SearchInput = forwardRef((props, ref) => {
|
|
6
|
+
const { debugName, onClear, onSearchChange, onTypingChange, clearIcon, searchIcon, debounce, placeholder, value, onValueChange, showClear, ...others } = {
|
|
7
|
+
...SearchInput.defaultProps,
|
|
8
|
+
...props,
|
|
9
|
+
};
|
|
10
|
+
/** When `value` + `onValueChange` are both provided the component is fully controlled — the internal `useState` is skipped entirely, so the caller owns the displayed text and must update it on every keystroke. */
|
|
11
|
+
const [search, setSearch] = !TypeGuards.isNil(value) && !!onValueChange ? [value, onValueChange] : useState('');
|
|
12
|
+
const setSearchTimeout = React.useRef(null);
|
|
13
|
+
const handleChangeSearch = useCallback((value) => {
|
|
14
|
+
onTypingChange?.(true);
|
|
15
|
+
setSearch(value);
|
|
16
|
+
if (TypeGuards.isNil(debounce)) {
|
|
17
|
+
onSearchChange?.(value);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
if (setSearchTimeout.current) {
|
|
21
|
+
clearTimeout(setSearchTimeout.current);
|
|
22
|
+
setSearchTimeout.current = null;
|
|
23
|
+
}
|
|
24
|
+
setSearchTimeout.current = setTimeout(() => {
|
|
25
|
+
onSearchChange(value);
|
|
26
|
+
onTypingChange?.(false);
|
|
27
|
+
}, debounce ?? 0);
|
|
28
|
+
}
|
|
29
|
+
}, [onSearchChange, onTypingChange]);
|
|
30
|
+
const handleClear = useCallback(() => {
|
|
31
|
+
setSearch('');
|
|
32
|
+
onSearchChange?.('');
|
|
33
|
+
onClear?.();
|
|
34
|
+
}, []);
|
|
35
|
+
return (_jsx(TextInput, { value: search, onValueChange: handleChangeSearch, placeholder: placeholder, debugName: `Search ${debugName}`, rightIcon: (showClear?.(search) ?? true) && {
|
|
36
|
+
name: clearIcon,
|
|
37
|
+
onPress: handleClear,
|
|
38
|
+
}, leftIcon: {
|
|
39
|
+
name: searchIcon,
|
|
40
|
+
}, ref: ref, ...others }));
|
|
41
|
+
});
|
|
42
|
+
SearchInput.defaultProps = {
|
|
43
|
+
debounce: 500,
|
|
44
|
+
clearIcon: 'x',
|
|
45
|
+
searchIcon: 'search',
|
|
46
|
+
showClear: (s) => !!s?.trim?.()
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/SearchInput/index.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAGhE,OAAO,EAAkB,SAAS,EAAE,MAAM,cAAc,CAAA;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAyB5C,MAAM,CAAC,MAAM,WAAW,GAAc,UAAU,CAAC,CAAC,KAAuB,EAAE,GAAG,EAAE,EAAE;IAChF,MAAM,EACJ,SAAS,EACT,OAAO,EACP,cAAc,EACd,cAAc,EACd,SAAS,EACT,UAAU,EACV,QAAQ,EACR,WAAW,EACX,KAAK,EACL,aAAa,EACb,SAAS,EACT,GAAG,MAAM,EACV,GAAG;QACF,GAAG,WAAW,CAAC,YAAY;QAC3B,GAAG,KAAK;KACT,CAAA;IAED,qNAAqN;IACrN,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,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S,EAAE,EAChC,SAAS,EAAE,CAAC,SAAS,EAAE,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI;YAC1C,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,WAAW;SACrB,EACD,QAAQ,EAAE;YACR,IAAI,EAAE,UAAU;SACjB,EACD,GAAG,EAAE,GAAU,KACX,MAAM,GACV,CACH,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,WAAW,CAAC,YAAY,GAAG;IACzB,QAAQ,EAAE,GAAG;IACb,SAAS,EAAE,GAAc;IACzB,UAAU,EAAE,QAAmB;IAC/B,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE;CACH,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/components/SectionFilters/context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAUjD,MAAM,CAAC,MAAM,qBAAqB,GAAG,aAAa,CAAC,EAA4B,CAAC,CAAA;AAEhF,MAAM,UAAU,wBAAwB;IACtC,OAAO,UAAU,CAAC,qBAAqB,CAA8B,CAAA;AACvE,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { TypeGuards } from '@codeleap/types';
|
|
3
|
+
import { memoBy } from '@codeleap/utils';
|
|
4
|
+
import { Button } from '../Button';
|
|
5
|
+
import { Sections } from '../Sections';
|
|
6
|
+
import { Text } from '../Text';
|
|
7
|
+
import { SectionsFilterContext, useSectionFiltersContext } from './context';
|
|
8
|
+
import { useSectionFilters } from './useSectionFilters';
|
|
9
|
+
export * from './types';
|
|
10
|
+
export * from './context';
|
|
11
|
+
export * from './useSectionFilters';
|
|
12
|
+
const SectionComponent = memoBy((props) => {
|
|
13
|
+
const { renderWith: Component, index } = props;
|
|
14
|
+
const handle = useSectionFiltersContext();
|
|
15
|
+
if (!Component)
|
|
16
|
+
return null;
|
|
17
|
+
return (_jsx(Component, { ...props, selectedItems: handle.selectedItems[index] ?? [], clearSelectedItems: () => handle.clearSelectedItemsWithSection(index) }));
|
|
18
|
+
}, ['renderWith']);
|
|
19
|
+
/**
|
|
20
|
+
* `handle` can be provided externally to make the filter state controlled from outside;
|
|
21
|
+
* if omitted, an internal `useSectionFilters` instance is created from the same props.
|
|
22
|
+
* Either way, the handle is published to `SectionsFilterContext` so `renderSectionHeader`
|
|
23
|
+
* and `renderSectionFooter` can read per-section selection state via `useSectionFiltersContext`.
|
|
24
|
+
*/
|
|
25
|
+
export function SectionFilters(props) {
|
|
26
|
+
const { sections, renderItem: RenderItem, renderSectionHeader, renderSectionFooter, children, ...rest } = {
|
|
27
|
+
...SectionFilters.defaultProps,
|
|
28
|
+
...props,
|
|
29
|
+
};
|
|
30
|
+
const handle = props.handle ?? useSectionFilters(props);
|
|
31
|
+
const renderItem = (section) => {
|
|
32
|
+
const hasSection = !TypeGuards.isNil(section?.index) && !TypeGuards.isNil(section);
|
|
33
|
+
const sectionLimitReached = hasSection && handle.sectionLimitReached(section?.index);
|
|
34
|
+
const limitReached = handle.limitReached();
|
|
35
|
+
const disableOnReachLimit = handle.disableItemsOnLimitReached;
|
|
36
|
+
const disableNonSelectedItems = (limitReached || sectionLimitReached) && disableOnReachLimit;
|
|
37
|
+
const isSelected = handle.isSelected(section?.item);
|
|
38
|
+
const isDisabled = disableNonSelectedItems && !isSelected;
|
|
39
|
+
return (_jsx(RenderItem, { ...section, onPress: () => handle.toggleItem(section?.item), selected: isSelected, disabled: isDisabled, text: section?.item?.label }));
|
|
40
|
+
};
|
|
41
|
+
return (_jsxs(SectionsFilterContext.Provider, { value: handle, children: [_jsx(Sections, { ...rest, sections: sections, renderItem: renderItem, renderSectionHeader: (props) => _jsx(SectionComponent, { ...props, renderWith: renderSectionHeader }), renderSectionFooter: (props) => _jsx(SectionComponent, { ...props, renderWith: renderSectionFooter }) }), children] }));
|
|
42
|
+
}
|
|
43
|
+
SectionFilters.defaultProps = {
|
|
44
|
+
renderItem: Button,
|
|
45
|
+
renderSectionHeader: ({ title }) => _jsx(Text, { text: title })
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/SectionFilters/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAyD,QAAQ,EAAE,MAAM,aAAa,CAAA;AAC7F,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAA;AAE3E,OAAO,EAAsB,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAE3E,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,qBAAqB,CAAA;AAEnC,MAAM,gBAAgB,GAAG,MAAM,CAAC,CAAC,KAAiJ,EAAE,EAAE;IACpL,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,KAAK,CAAA;IAE9C,MAAM,MAAM,GAAG,wBAAwB,EAAE,CAAA;IAEzC,IAAI,CAAC,SAAS;QAAE,OAAO,IAAI,CAAA;IAE3B,OAAO,CACL,KAAC,SAAS,OACJ,KAAK,EACT,aAAa,EAAE,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,EAAE,EAChD,kBAAkB,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,6BAA6B,CAAC,KAAK,CAAC,GACrE,CACH,CAAA;AACH,CAAC,EAAE,CAAC,YAAY,C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,IAAC,KAAK,EAAE,MAAM,aAC3C,KAAC,QAAQ,OACH,IAAI,EACR,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,UAAU,EACtB,mBAAmB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAC,gBAAgB,OAAK,KAAK,EAAE,UAAU,EAAE,mBAAmB,GAAI,EAChG,mBAAmB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAC,gBAAgB,OAAK,KAAK,EAAE,UAAU,EAAE,mBAAmB,GAAI,GAChG,EACD,QAAQ,IACsB,CAClC,CAAA;AACH,CAAC;AAED,cAAc,CAAC,YAAY,GAAG;IAC5B,UAAU,EAAE,MAAiB;IAC7B,mBAAmB,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAC,IAAI,IAAC,IAAI,EAAE,KAAK,GAAI;CAC1B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/SectionFilters/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { TypeGuards } from '@codeleap/types';
|
|
2
|
+
import { deepEqual } from '@codeleap/utils';
|
|
3
|
+
import React, { useCallback } from 'react';
|
|
4
|
+
/**
|
|
5
|
+
* All selection state is owned internally — this hook is uncontrolled.
|
|
6
|
+
* Pass `initialSelectedItems` to seed state; after mount, changes are only possible
|
|
7
|
+
* through `toggleItem` / `clearSelectedItemsWithSection`.
|
|
8
|
+
* `onToggleItem` can intercept a toggle and return `true` to prevent the internal
|
|
9
|
+
* state update (useful for controlled scenarios without rewriting the whole hook).
|
|
10
|
+
* When `selectionLimit === 1` the entire per-section array is replaced on toggle
|
|
11
|
+
* rather than appended, so de-selecting by re-tapping the same item is not supported
|
|
12
|
+
* at limit=1 — tapping a new item simply replaces the previous selection.
|
|
13
|
+
*/
|
|
14
|
+
export function useSectionFilters(props) {
|
|
15
|
+
const { sections, areItemsEqual = deepEqual, selectionLimit = 1, sectionSelectionLimit = null, disableItemsOnLimitReached = selectionLimit > 1 && !sectionSelectionLimit, initialSelectedItems = [], onToggleItem, } = props;
|
|
16
|
+
/** When `initialSelectedItems` is a plain array (no section keys), it is assigned to
|
|
17
|
+
* section index 0 so single-section callers don't have to wrap in an object. */
|
|
18
|
+
const [selectedItems, setSelectedItems] = React.useState(() => {
|
|
19
|
+
if (TypeGuards.isArray(initialSelectedItems)) {
|
|
20
|
+
return {
|
|
21
|
+
0: initialSelectedItems,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
return initialSelectedItems ?? {};
|
|
25
|
+
});
|
|
26
|
+
const changed = useCallback(() => {
|
|
27
|
+
return Object.entries(selectedItems).some(([sectionIndex, items]) => {
|
|
28
|
+
const initialItems = initialSelectedItems[sectionIndex] ?? [];
|
|
29
|
+
if (!initialItems) {
|
|
30
|
+
return items.length > 0;
|
|
31
|
+
}
|
|
32
|
+
if (items.length !== initialItems.length) {
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
return items.some((item) => !initialItems.some((i) => areItemsEqual(i, item)));
|
|
36
|
+
});
|
|
37
|
+
}, [selectedItems, initialSelectedItems]);
|
|
38
|
+
const getAllItems = () => {
|
|
39
|
+
return sections?.flatMap((section) => section.data) ?? [];
|
|
40
|
+
};
|
|
41
|
+
const findItemSection = (item) => {
|
|
42
|
+
if (!sections) {
|
|
43
|
+
return {
|
|
44
|
+
sectionIndex: 0,
|
|
45
|
+
section: null,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
const sectionIndex = sections?.findIndex((section) => {
|
|
49
|
+
return section.data.some((i) => areItemsEqual(item, i));
|
|
50
|
+
});
|
|
51
|
+
if (sectionIndex === -1) {
|
|
52
|
+
return {
|
|
53
|
+
sectionIndex: null,
|
|
54
|
+
section: null,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const section = sections[sectionIndex];
|
|
58
|
+
return {
|
|
59
|
+
sectionIndex,
|
|
60
|
+
section,
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
const isSelected = (item) => {
|
|
64
|
+
if (sections) {
|
|
65
|
+
const { sectionIndex } = findItemSection(item);
|
|
66
|
+
return selectedItems[sectionIndex]?.some((i) => areItemsEqual(i, item));
|
|
67
|
+
}
|
|
68
|
+
return selectedItems[0]?.some((i) => areItemsEqual(i, item));
|
|
69
|
+
};
|
|
70
|
+
const toggleItem = (item) => {
|
|
71
|
+
let sectionIndex = -1;
|
|
72
|
+
let limit = selectionLimit;
|
|
73
|
+
if (sections) {
|
|
74
|
+
const { sectionIndex: si, section } = findItemSection(item);
|
|
75
|
+
if (si === null) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
sectionIndex = si;
|
|
79
|
+
limit = section.selectionLimit ?? selectionLimit;
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
sectionIndex = 0;
|
|
83
|
+
}
|
|
84
|
+
const handled = onToggleItem?.(item, sections[sectionIndex]) ?? false;
|
|
85
|
+
if (handled) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (selectionLimit === 1) {
|
|
89
|
+
setSelectedItems({
|
|
90
|
+
[sectionIndex]: [item],
|
|
91
|
+
});
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const currentItems = selectedItems[sectionIndex] ?? [];
|
|
95
|
+
const isItemSelected = currentItems.some((i) => areItemsEqual(i, item));
|
|
96
|
+
const newItems = [...currentItems];
|
|
97
|
+
if (isItemSelected) {
|
|
98
|
+
const index = newItems.findIndex((i) => areItemsEqual(i, item));
|
|
99
|
+
newItems.splice(index, 1);
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
if (newItems.length >= limit) {
|
|
103
|
+
newItems.shift();
|
|
104
|
+
}
|
|
105
|
+
newItems.push(item);
|
|
106
|
+
}
|
|
107
|
+
setSelectedItems({
|
|
108
|
+
...selectedItems,
|
|
109
|
+
[sectionIndex]: newItems,
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
function sectionLimitReached(sectionIndex) {
|
|
113
|
+
const section = sections[sectionIndex];
|
|
114
|
+
if (!section) {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
const limit = section.selectionLimit ?? sectionSelectionLimit ?? selectionLimit;
|
|
118
|
+
if (!limit) {
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
const nItems = selectedItems[sectionIndex]?.length;
|
|
122
|
+
return nItems >= limit;
|
|
123
|
+
}
|
|
124
|
+
function limitReached() {
|
|
125
|
+
const nItems = Object.values(selectedItems).flatMap((i) => i).length;
|
|
126
|
+
return nItems >= selectionLimit;
|
|
127
|
+
}
|
|
128
|
+
function clearSelectedItemsWithSection(sectionIndex) {
|
|
129
|
+
setSelectedItems({
|
|
130
|
+
...selectedItems,
|
|
131
|
+
[sectionIndex]: [],
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
return {
|
|
135
|
+
isSelected,
|
|
136
|
+
toggleItem,
|
|
137
|
+
findItemSection,
|
|
138
|
+
selectedItems,
|
|
139
|
+
sectionLimitReached,
|
|
140
|
+
limitReached,
|
|
141
|
+
disableItemsOnLimitReached,
|
|
142
|
+
clearSelectedItemsWithSection,
|
|
143
|
+
changed,
|
|
144
|
+
areItemsEqual,
|
|
145
|
+
getAllItems,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=useSectionFilters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSectionFilters.js","sourceRoot":"","sources":["../../../src/components/SectionFilters/useSectionFilters.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,EAAE,EAAE,WAAW,EAAW,MAAM,OAAO,CAAA;AA0BnD;;;;;;;;;GASG;AACH,MAAM,UA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ACH,CAAC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { TypeGuards } from '@codeleap/types';
|
|
4
|
+
import { useCallback } from '@codeleap/hooks';
|
|
5
|
+
import { SectionList } from 'react-native';
|
|
6
|
+
import { View } from '../View';
|
|
7
|
+
import { RefreshControl } from '../RefreshControl';
|
|
8
|
+
import { useKeyboardPaddingStyle } from '../../utils';
|
|
9
|
+
import { MobileStyleRegistry } from '../../Registry';
|
|
10
|
+
import { useStylesFor } from '../../hooks';
|
|
11
|
+
import { EmptyPlaceholder } from '../EmptyPlaceholder';
|
|
12
|
+
export * from './styles';
|
|
13
|
+
export * from './types';
|
|
14
|
+
const RenderSeparator = (props) => {
|
|
15
|
+
return _jsx(View, { style: props.separatorStyles });
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Wraps React Native's SectionList. The `sections` data is augmented with a sequential `index`
|
|
19
|
+
* field internally — callers must not add their own `index` to section objects or it will be
|
|
20
|
+
* overwritten and position helpers (`isFirst`, `isLast`, `isOnly`) will break.
|
|
21
|
+
*
|
|
22
|
+
* There is no `keyExtractor` default — SectionList falls back to array index, which causes
|
|
23
|
+
* re-mount flicker on reorder. Always pass a `keyExtractor` when items can change order or identity.
|
|
24
|
+
*/
|
|
25
|
+
export function Sections(sectionsProps) {
|
|
26
|
+
const { style, onRefresh, refreshing, placeholder, refreshControlProps, loading, keyboardAware, fakeEmpty = loading, contentContainerStyle, refreshControl, renderItem: providedRenderItem, sections: data, renderSectionHeader: providedRenderSectionHeader, renderSectionFooter: providedRenderSectionFooter, ...props } = {
|
|
27
|
+
...Sections.defaultProps,
|
|
28
|
+
...sectionsProps,
|
|
29
|
+
};
|
|
30
|
+
/** Deep-equality via JSON.stringify to avoid re-renders on reference changes; will miss non-serialisable values (functions, Dates) in section data. */
|
|
31
|
+
const sections = useMemo(() => {
|
|
32
|
+
return data?.map((section, index) => ({
|
|
33
|
+
...section,
|
|
34
|
+
index,
|
|
35
|
+
}));
|
|
36
|
+
}, [JSON.stringify(data)]);
|
|
37
|
+
const styles = useStylesFor(Sections.styleRegistryName, style);
|
|
38
|
+
const separator = useCallback(() => {
|
|
39
|
+
if (!props?.separators)
|
|
40
|
+
return null;
|
|
41
|
+
return _jsx(RenderSeparator, { separatorStyles: styles.separator });
|
|
42
|
+
}, []);
|
|
43
|
+
const getSectionProps = (data) => {
|
|
44
|
+
const listLength = sections?.length || 0;
|
|
45
|
+
const isFirst = data?.section?.index === sections?.[0]?.index;
|
|
46
|
+
const isLast = data?.section?.index === sections?.[listLength - 1]?.index;
|
|
47
|
+
const isOnly = isFirst && isLast;
|
|
48
|
+
const title = data?.section?.title;
|
|
49
|
+
const index = data?.section?.index;
|
|
50
|
+
return { isFirst, isLast, isOnly, title, index };
|
|
51
|
+
};
|
|
52
|
+
const renderSectionHeader = useCallback((data) => {
|
|
53
|
+
if (!providedRenderSectionHeader)
|
|
54
|
+
return null;
|
|
55
|
+
const positionProps = getSectionProps(data);
|
|
56
|
+
return providedRenderSectionHeader({ ...data.section, ...positionProps });
|
|
57
|
+
}, [providedRenderSectionHeader, sections?.length]);
|
|
58
|
+
const renderSectionFooter = useCallback((data) => {
|
|
59
|
+
if (!providedRenderSectionFooter)
|
|
60
|
+
return null;
|
|
61
|
+
const positionProps = getSectionProps(data);
|
|
62
|
+
return providedRenderSectionFooter({ ...data.section, ...positionProps });
|
|
63
|
+
}, [providedRenderSectionFooter, sections?.length]);
|
|
64
|
+
const renderItem = useCallback((data) => {
|
|
65
|
+
if (!providedRenderItem)
|
|
66
|
+
return null;
|
|
67
|
+
const listLength = data?.section?.data?.length || 0;
|
|
68
|
+
const isFirst = data?.index === 0;
|
|
69
|
+
const isLast = data?.index === listLength - 1;
|
|
70
|
+
const isOnly = isFirst && isLast;
|
|
71
|
+
return providedRenderItem({
|
|
72
|
+
...data,
|
|
73
|
+
isFirst,
|
|
74
|
+
isLast,
|
|
75
|
+
isOnly,
|
|
76
|
+
});
|
|
77
|
+
}, [providedRenderItem]);
|
|
78
|
+
const isEmpty = !sections || !sections?.length;
|
|
79
|
+
const _placeholder = {
|
|
80
|
+
...placeholder,
|
|
81
|
+
loading: TypeGuards.isBoolean(placeholder?.loading) ? placeholder.loading : loading,
|
|
82
|
+
};
|
|
83
|
+
const keyboardStyle = useKeyboardPaddingStyle([
|
|
84
|
+
styles.content,
|
|
85
|
+
contentContainerStyle,
|
|
86
|
+
isEmpty && styles['content:empty'],
|
|
87
|
+
loading && styles['content:loading'],
|
|
88
|
+
], keyboardAware && !props.horizontal);
|
|
89
|
+
const wrapperStyle = [styles.wrapper, isEmpty && styles['wrapper:empty'], loading && styles['wrapper:loading']];
|
|
90
|
+
return (_jsx(SectionList, { ItemSeparatorComponent: separator, refreshControl: TypeGuards.isFunction(onRefresh) ? (_jsx(RefreshControl, { refreshing: refreshing, onRefresh: onRefresh, ...refreshControlProps })) : null, ListEmptyComponent: _jsx(EmptyPlaceholder, { ..._placeholder }), showsVerticalScrollIndicator: false, showsHorizontalScrollIndicator: false, ...props, ListHeaderComponentStyle: styles.header, ListFooterComponentStyle: styles.footer, style: wrapperStyle, contentContainerStyle: keyboardStyle, sections: sections, renderItem: renderItem, renderSectionHeader: renderSectionHeader, renderSectionFooter: renderSectionFooter }));
|
|
91
|
+
}
|
|
92
|
+
Sections.styleRegistryName = 'Sections';
|
|
93
|
+
Sections.elements = ['wrapper', 'content', 'separator', 'header', 'footer', 'refreshControl'];
|
|
94
|
+
Sections.rootElement = 'wrapper';
|
|
95
|
+
Sections.withVariantTypes = (styles) => {
|
|
96
|
+
return Sections;
|
|
97
|
+
};
|
|
98
|
+
Sections.defaultProps = {
|
|
99
|
+
keyboardShouldPersistTaps: 'handled',
|
|
100
|
+
fakeEmpty: false,
|
|
101
|
+
loading: false,
|
|
102
|
+
keyboardAware: true,
|
|
103
|
+
};
|
|
104
|
+
MobileStyleRegistry.registerComponent(Sections);
|
|
105
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Sections/index.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAsC,MAAM,cAAc,CAAA;AAC9E,OAAO,EAAE,IAAI,EAAa,MAAM,SAAS,CAAA;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAGrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAEtD,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AAEvB,MAAM,eAAe,GAAG,CAAC,KAA8C,EAAE,EAAE;IACzE,OAAO,KAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,eAAe,GAAI,CAAA;AAC/C,CAAC,CAAA;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,QAAQ,CAAI,aAA8B;IACxD,MAAM,EACJ,KAAK,EACL,SAAS,EACT,UAAU,EACV,WAAW,EACX,mBAAmB,EACnB,OAAO,EACP,aAAa,EACb,SAAS,GAAG,OAAO,EACnB,qBAAqB,EACrB,cAAc,EACd,UAAU,EAAE,kBAAkB,EAC9B,QAAQ,EAAE,IAAI,EACd,mBAAmB,EAAE,2BAA2B,EAChD,mBAAmB,EAAE,2BAA2B,EAChD,GAAG,KAAK,EACT,GAAG;QACF,GAAG,QAAQ,CAAC,YAAY;QACxB,GAAG,aAAa;KACjB,CAAA;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AAA;AACvC,QAAQ,CAAC,QAAQ,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,gBAAgB,CAAC,CAAA;AAC7F,QAAQ,CAAC,WAAW,GAAG,SAAS,CAAA;AAEhC,QAAQ,CAAC,gBAAgB,GAAG,CAAsB,MAAS,EAAE,EAAE;IAC7D,OAAO,QAAoF,CAAA;AAC7F,CAAC,CAAA;AAED,QAAQ,CAAC,YAAY,GAAG;IACtB,yBAAyB,EAAE,SAAS;IACpC,SAAS,EAAE,KAAK;IAChB,OAAO,EAAE,KAAK;IACd,aAAa,EAAE,IAAI;CACK,CAAA;AAE1B,mBAAmB,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/components/Sections/styles.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/Sections/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Text } from '../Text';
|
|
3
|
+
import { Touchable } from '../Touchable';
|
|
4
|
+
import { Icon } from '../Icon';
|
|
5
|
+
export const SegmentedControlOption = (props) => {
|
|
6
|
+
const { selected, onPress, debugName, style, variantStyles, label, value, icon, textProps, badge = null, ...touchableProps } = props;
|
|
7
|
+
return (_jsxs(Touchable, { debugName: `Segmented Control ${debugName}, option ${label}`, noFeedback: selected, style: [
|
|
8
|
+
variantStyles?.button,
|
|
9
|
+
selected && variantStyles['button:selected'],
|
|
10
|
+
style,
|
|
11
|
+
{
|
|
12
|
+
feedback: variantStyles.buttonFeedback,
|
|
13
|
+
}
|
|
14
|
+
], onPress: onPress, ...touchableProps, children: [!!icon ? _jsx(Icon, { name: icon, style: variantStyles?.icon }) : null, _jsx(Text, { text: label, style: [
|
|
15
|
+
variantStyles?.text,
|
|
16
|
+
selected && variantStyles['text:selected'],
|
|
17
|
+
touchableProps?.disabled && variantStyles['text:disabled'],
|
|
18
|
+
], ...textProps }), badge] }));
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=Option.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Option.js","sourceRoot":"","sources":["../../../src/components/SegmentedControl/Option.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,SAAS,EAAkB,MAAM,cAAc,CAAA;AAExD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAc9B,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,KAAkC,EAAE,EAAE;IAC3E,MAAM,EACJ,QAAQ,EACR,OAAO,EACP,SAAS,EACT,KAAK,EACL,aAAa,EACb,KAAK,EACL,KAAK,EACL,IAAI,EACJ,SAAS,EACT,KAAK,GAAG,IAAI,EACZ,GAAG,cAAc,EAClB,GAAG,KAAK,CAAA;IAET,OAAO,CACL,MAAC,SAAS,IACR,SAAS,EAAE,qBAAqB,SAAS,YAAY,KAAK,EAAE,EAC5D,UAAU,EAAE,QAAQ,EACpB,KAAK,EAAE;YACL,aAAa,EAAE,MAAM;YACrB,QAAQ,IAAI,aAAa,CAAC,iBAAiB,CAAC;YAC5C,KAAK;YACL;gBACE,QAAQ,EAAE,aAAa,CAAC,cAAc;aACvC;SACF,EACD,OAAO,EAAE,OAAO,KACZ,cAAc,aAEjB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAC,IAAI,IAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,aAAa,EAAE,IAAI,GAAI,CAAC,CAAC,CAAC,IAAI,EAEjE,KAAC,IAAI,IACH,IAAI,EAAE,KAAK,EACX,KAAK,EAAE;oBACL,aAAa,EAAE,IAAI;oBACnB,QAAQ,IAAI,aAAa,CAAC,eAAe,CAAC;oBAC1C,cAAc,EAAE,QAAQ,IAAI,aAAa,CAAC,eAAe,CAAC;iBAC3D,KACG,SAAS,GACb,EAED,KAAK,IACI,CACb,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, { useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
3
|
+
import { Easing, ScrollView } from 'react-native';
|
|
4
|
+
import { Text } from '../Text';
|
|
5
|
+
import { View } from '../View';
|
|
6
|
+
import { useAnimatedVariantStyles } from '../../utils';
|
|
7
|
+
import { SegmentedControlOption } from './Option';
|
|
8
|
+
import { useTheme } from '@codeleap/styles';
|
|
9
|
+
import { MobileStyleRegistry } from '../../Registry';
|
|
10
|
+
import { useStylesFor } from '../../hooks';
|
|
11
|
+
export * from './styles';
|
|
12
|
+
export * from './types';
|
|
13
|
+
const DefaultBubble = (props) => {
|
|
14
|
+
return _jsx(View, { animated: true, ...props });
|
|
15
|
+
};
|
|
16
|
+
const defaultAnimation = {
|
|
17
|
+
type: 'timing',
|
|
18
|
+
duration: 200,
|
|
19
|
+
easing: Easing.linear,
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Always fully controlled — there is no internal selected state; `value` and `onValueChange`
|
|
23
|
+
* are required. The animated bubble position is driven by Reanimated worklets, so the bubble
|
|
24
|
+
* can only animate when `currentOptionIdx` changes (i.e. `value` changes from the parent).
|
|
25
|
+
*/
|
|
26
|
+
export const SegmentedControl = React.forwardRef((props, ref) => {
|
|
27
|
+
const [themeValues, themeSpacing] = useTheme(store => [store.theme?.values, store.theme?.spacing]);
|
|
28
|
+
const { options = [], onValueChange, debugName, label, value, animation = {}, scrollProps = {},
|
|
29
|
+
/** Default divides total screen width equally; override `getItemWidth` when options have variable label lengths or the control doesn't fill the screen. */
|
|
30
|
+
getItemWidth = () => (themeValues?.width - themeSpacing?.value?.(4)) / options.length, renderBubble: BubbleView, scrollToCurrentOptionOnMount, renderOption: Option, touchableProps, style, ...viewProps } = {
|
|
31
|
+
...SegmentedControl.defaultProps,
|
|
32
|
+
...props,
|
|
33
|
+
};
|
|
34
|
+
const [bubbleWidth, setBubbleWidth] = useState(0);
|
|
35
|
+
const _animation = {
|
|
36
|
+
...defaultAnimation,
|
|
37
|
+
...animation,
|
|
38
|
+
};
|
|
39
|
+
const styles = useStylesFor(SegmentedControl.styleRegistryName, style);
|
|
40
|
+
const scrollRef = useRef(null);
|
|
41
|
+
function scrollTo(idx) {
|
|
42
|
+
if (!scrollRef.current)
|
|
43
|
+
return;
|
|
44
|
+
setTimeout(() => {
|
|
45
|
+
scrollRef.current?.scrollTo({
|
|
46
|
+
x: widthStyle.width * idx,
|
|
47
|
+
y: 0,
|
|
48
|
+
animated: true
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
const widthStyle = useMemo(() => {
|
|
53
|
+
if (getItemWidth) {
|
|
54
|
+
const sizes = options.map(getItemWidth);
|
|
55
|
+
const maxWidth = sizes.sort((a, b) => b - a)[0];
|
|
56
|
+
return { width: maxWidth };
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
width: bubbleWidth,
|
|
60
|
+
};
|
|
61
|
+
}, [options, bubbleWidth]);
|
|
62
|
+
const currentOptionIdx = options.findIndex(o => o.value === value) || 0;
|
|
63
|
+
const onPress = (txt, idx) => {
|
|
64
|
+
return () => {
|
|
65
|
+
onValueChange(txt);
|
|
66
|
+
scrollTo(idx);
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
const hasScrolledInitially = useRef(false);
|
|
70
|
+
useImperativeHandle(ref, () => {
|
|
71
|
+
if (!scrollRef.current)
|
|
72
|
+
return null;
|
|
73
|
+
return {
|
|
74
|
+
...(scrollRef.current),
|
|
75
|
+
scrollTo,
|
|
76
|
+
scrollToCurrent() {
|
|
77
|
+
if (!scrollRef.current)
|
|
78
|
+
return;
|
|
79
|
+
scrollTo(currentOptionIdx);
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
}, [
|
|
83
|
+
currentOptionIdx,
|
|
84
|
+
]);
|
|
85
|
+
if (!hasScrolledInitially.current && scrollRef.current && scrollToCurrentOptionOnMount) {
|
|
86
|
+
scrollTo(currentOptionIdx);
|
|
87
|
+
hasScrolledInitially.current = true;
|
|
88
|
+
}
|
|
89
|
+
const bubbleAnimation = useAnimatedVariantStyles({
|
|
90
|
+
variantStyles: styles,
|
|
91
|
+
animatedProperties: [],
|
|
92
|
+
updater: () => {
|
|
93
|
+
'worklet';
|
|
94
|
+
return {
|
|
95
|
+
translateX: currentOptionIdx * widthStyle.width,
|
|
96
|
+
};
|
|
97
|
+
},
|
|
98
|
+
transition: _animation,
|
|
99
|
+
dependencies: [currentOptionIdx, widthStyle.width],
|
|
100
|
+
});
|
|
101
|
+
/** Tracks the widest option measured during onLayout to set a uniform bubble width when `getItemWidth` is not provided; reset to 0 after each full pass so re-renders don't accumulate stale values. */
|
|
102
|
+
const largestWidth = useRef(0);
|
|
103
|
+
return (_jsxs(View, { style: styles?.wrapper, children: [label ? (_jsx(View, { ...viewProps, style: styles?.labelWrapper, children: _jsx(Text, { style: styles?.labelText, text: label }) })) : null, _jsx(ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, style: styles?.scroll, contentContainerStyle: styles?.scrollContent, ...scrollProps, ref: scrollRef, children: _jsxs(View, { style: styles?.innerWrapper, children: [_jsx(BubbleView, { options: options, animated: true, animatedStyle: bubbleAnimation, style: [
|
|
104
|
+
styles?.selectedBubble,
|
|
105
|
+
props?.touchableProps?.disabled && styles?.['selectedBubble:disabled'],
|
|
106
|
+
widthStyle,
|
|
107
|
+
] }), options.map((o, idx) => (_jsx(Option, { debugName: debugName, label: o.label, value: o.value, icon: o.icon, onPress: onPress(o.value, idx), style: widthStyle, selected: value === o.value, variantStyles: styles, onLayout: e => {
|
|
108
|
+
const { width } = e.nativeEvent.layout;
|
|
109
|
+
if (width > largestWidth.current) {
|
|
110
|
+
largestWidth.current = width;
|
|
111
|
+
}
|
|
112
|
+
if (idx === options.length - 1) {
|
|
113
|
+
setBubbleWidth(largestWidth.current);
|
|
114
|
+
largestWidth.current = 0;
|
|
115
|
+
}
|
|
116
|
+
}, ...touchableProps }, idx)))] }) })] }));
|
|
117
|
+
});
|
|
118
|
+
SegmentedControl.styleRegistryName = 'SegmentedControl';
|
|
119
|
+
SegmentedControl.elements = ['wrapper', 'selectedBubble', 'innerWrapper', 'scroll', 'text', 'icon', 'button', 'label', 'badge'];
|
|
120
|
+
SegmentedControl.rootElement = 'scroll';
|
|
121
|
+
SegmentedControl.withVariantTypes = (styles) => {
|
|
122
|
+
return SegmentedControl;
|
|
123
|
+
};
|
|
124
|
+
SegmentedControl.defaultProps = {
|
|
125
|
+
renderBubble: DefaultBubble,
|
|
126
|
+
renderOption: SegmentedControlOption,
|
|
127
|
+
scrollToCurrentOptionOnMount: true,
|
|
128
|
+
};
|
|
129
|
+
MobileStyleRegistry.registerComponent(SegmentedControl);
|
|
130
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/SegmentedControl/index.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAO,MAAM,OAAO,CAAA;AAClF,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAEjD,OAAO,EAAmE,QAAQ,EAAE,MAAM,kBAAk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,cAAc,CAAC,YAAY,CAAC,OAAO,CAAC,CAAA;oCACpC,YAAY,CAAC,OAAO,GAAG,CAAC,CAAA;gCAC1B,CAAC;4BACH,CAAC,KACG,cAAc,IAfb,GAAG,CAgBR,CACH,CAAC,IACG,GACI,IACR,CACR,CAAA;AACH,CAAC,CAAoD,CAAA;AAErD,gBAAgB,CAAC,iBAAiB,GAAG,kBAAkB,CAAA;AACvD,gBAAgB,CAAC,QAAQ,GAAG,CAAC,SAAS,EAAE,gBAAgB,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;AAC/H,gBAAgB,CAAC,WAAW,GAAG,QAAQ,CAAA;AAEvC,gBAAgB,CAAC,gBAAgB,GAAG,CAAsB,MAAS,EAAE,EAAE;IACrE,OAAO,gBAA2J,CAAA;AACpK,CAAC,CAAA;AAED,gBAAgB,CAAC,YAAY,GAAG;IAC9B,YAAY,EAAE,aAAa;IAC3B,YAAY,EAAE,sBAAsB;IACpC,4BAA4B,EAAE,IAAI;CACD,CAAA;AAEnC,mBAAmB,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/components/SegmentedControl/styles.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/SegmentedControl/types.ts"],"names":[],"mappings":""}
|