@codeleap/web 5.8.20 → 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ActionIcon/index.d.ts +1 -1
- package/dist/components/ActionIcon/index.js +1 -1
- package/dist/components/ActionIcon/index.js.map +1 -1
- package/dist/components/ActivityIndicator/index.d.ts +9 -2
- package/dist/components/ActivityIndicator/index.js +8 -16
- package/dist/components/ActivityIndicator/index.js.map +1 -1
- package/dist/components/Badge/index.d.ts +1 -1
- package/dist/components/Badge/index.js +1 -1
- package/dist/components/Badge/index.js.map +1 -1
- package/dist/components/Badge/types.d.ts +1 -2
- package/dist/components/Button/index.d.ts +1 -1
- package/dist/components/Button/index.js +1 -1
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Carousel/index.d.ts +5 -0
- package/dist/components/Carousel/index.js +168 -0
- package/dist/components/Carousel/index.js.map +1 -0
- package/dist/components/Carousel/styles.d.ts +3 -0
- package/dist/components/Carousel/styles.js.map +1 -0
- package/dist/components/Carousel/types.d.ts +34 -0
- package/dist/components/{Grid → Carousel}/types.js.map +1 -1
- package/dist/components/Checkbox/index.d.ts +1 -1
- package/dist/components/Checkbox/index.js +2 -2
- package/dist/components/Checkbox/index.js.map +1 -1
- package/dist/components/Collapse/index.d.ts +1 -1
- package/dist/components/Collapse/index.js +3 -3
- package/dist/components/Collapse/index.js.map +1 -1
- package/dist/components/Collapse/types.d.ts +1 -2
- package/dist/components/ColorPicker/index.d.ts +1 -1
- package/dist/components/ColorPicker/index.js +4 -4
- package/dist/components/ColorPicker/index.js.map +1 -1
- package/dist/components/ColorPicker/types.d.ts +3 -3
- package/dist/components/CropPicker/index.d.ts +9 -2
- package/dist/components/CropPicker/index.js +6 -6
- package/dist/components/CropPicker/index.js.map +1 -1
- package/dist/components/CropPicker/types.d.ts +3 -1
- package/dist/components/DatePicker/components/DayContent.js +1 -1
- package/dist/components/DatePicker/components/DayContent.js.map +1 -1
- package/dist/components/DatePicker/components/Header.js +1 -1
- package/dist/components/DatePicker/components/Header.js.map +1 -1
- package/dist/components/DatePicker/components/OuterInput.js +2 -12
- package/dist/components/DatePicker/components/OuterInput.js.map +1 -1
- package/dist/components/DatePicker/components/YearContent.js +1 -1
- package/dist/components/DatePicker/components/YearContent.js.map +1 -1
- package/dist/components/DatePicker/index.d.ts +1 -1
- package/dist/components/DatePicker/index.js +12 -13
- package/dist/components/DatePicker/index.js.map +1 -1
- package/dist/components/DatePicker/types.d.ts +8 -6
- package/dist/components/Drawer/index.d.ts +1 -1
- package/dist/components/Drawer/index.js +2 -2
- package/dist/components/Drawer/index.js.map +1 -1
- package/dist/components/Dropzone/index.d.ts +9 -2
- package/dist/components/Dropzone/index.js +7 -6
- package/dist/components/Dropzone/index.js.map +1 -1
- package/dist/components/Dropzone/types.d.ts +3 -2
- package/dist/components/EmptyPlaceholder/index.d.ts +1 -1
- package/dist/components/EmptyPlaceholder/index.js +3 -3
- package/dist/components/EmptyPlaceholder/index.js.map +1 -1
- package/dist/components/EmptyPlaceholder/types.d.ts +2 -2
- package/dist/components/FileInput/index.d.ts +5 -9
- package/dist/components/FileInput/index.js +6 -5
- package/dist/components/FileInput/index.js.map +1 -1
- package/dist/components/FileInput/types.d.ts +2 -0
- package/dist/components/Icon/index.d.ts +1 -1
- package/dist/components/Icon/index.js.map +1 -1
- package/dist/components/InputBase/index.js +2 -2
- package/dist/components/InputBase/index.js.map +1 -1
- package/dist/components/InputBase/types.d.ts +0 -1
- package/dist/components/InputBase/useInputBase.d.ts +2 -3
- package/dist/components/InputBase/useInputBase.js +2 -3
- package/dist/components/InputBase/useInputBase.js.map +1 -1
- package/dist/components/InputBase/useInputBasePartialStyles.js +1 -2
- package/dist/components/InputBase/useInputBasePartialStyles.js.map +1 -1
- package/dist/components/InputBase/utils.d.ts +1 -1
- package/dist/components/InputBase/utils.js +3 -3
- package/dist/components/InputBase/utils.js.map +1 -1
- package/dist/components/List/index.d.ts +2 -3
- package/dist/components/List/index.js +87 -40
- package/dist/components/List/index.js.map +1 -1
- package/dist/components/List/styles.d.ts +2 -4
- package/dist/components/List/types.d.ts +10 -52
- package/dist/components/LoadingOverlay/index.d.ts +1 -1
- package/dist/components/LoadingOverlay/index.js +1 -1
- package/dist/components/LoadingOverlay/index.js.map +1 -1
- package/dist/components/MaskedTextInput/index.d.ts +7 -0
- package/dist/components/MaskedTextInput/index.js +69 -0
- package/dist/components/MaskedTextInput/index.js.map +1 -0
- package/dist/components/MaskedTextInput/mask.d.ts +8 -0
- package/dist/components/MaskedTextInput/mask.js +37 -0
- package/dist/components/MaskedTextInput/mask.js.map +1 -0
- package/dist/components/MaskedTextInput/types.d.ts +10 -0
- package/dist/components/MaskedTextInput/types.js.map +1 -0
- package/dist/components/Modal/index.d.ts +1 -1
- package/dist/components/Modal/index.js +6 -6
- package/dist/components/Modal/index.js.map +1 -1
- package/dist/components/NumberIncrement/index.d.ts +1 -1
- package/dist/components/NumberIncrement/index.js +1 -3
- package/dist/components/NumberIncrement/index.js.map +1 -1
- package/dist/components/NumberIncrement/useNumberIncrement.d.ts +4 -4
- package/dist/components/NumberIncrement/useNumberIncrement.js +1 -2
- package/dist/components/NumberIncrement/useNumberIncrement.js.map +1 -1
- package/dist/components/Overlay/index.d.ts +1 -1
- package/dist/components/PaginationButtons/index.d.ts +1 -1
- package/dist/components/PaginationButtons/index.js +2 -2
- package/dist/components/PaginationButtons/index.js.map +1 -1
- package/dist/components/PaginationButtons/types.d.ts +1 -2
- package/dist/components/PaginationIndicator/index.d.ts +2 -3
- package/dist/components/PaginationIndicator/index.js +2 -2
- package/dist/components/PaginationIndicator/index.js.map +1 -1
- package/dist/components/PaginationIndicator/types.d.ts +3 -3
- package/dist/components/Progress/Bar/index.d.ts +1 -1
- package/dist/components/Progress/Bar/index.js +1 -1
- package/dist/components/Progress/Bar/index.js.map +1 -1
- package/dist/components/Progress/Bar/types.d.ts +2 -3
- package/dist/components/Progress/Circle/index.d.ts +1 -1
- package/dist/components/Progress/Circle/index.js +2 -2
- package/dist/components/Progress/Circle/index.js.map +1 -1
- package/dist/components/Progress/Circle/types.d.ts +1 -2
- package/dist/components/Progress/index.d.ts +0 -1
- package/dist/components/Progress/utils.js +1 -2
- package/dist/components/Progress/utils.js.map +1 -1
- package/dist/components/RadioInput/index.d.ts +1 -1
- package/dist/components/RadioInput/index.js +2 -2
- package/dist/components/RadioInput/index.js.map +1 -1
- package/dist/components/SearchInput/index.js.map +1 -1
- package/dist/components/SectionFilters/index.d.ts +1 -1
- package/dist/components/SectionFilters/index.js +4 -4
- package/dist/components/SectionFilters/index.js.map +1 -1
- package/dist/components/SectionFilters/types.d.ts +1 -2
- package/dist/components/SegmentedControl/index.d.ts +1 -1
- package/dist/components/SegmentedControl/index.js +12 -21
- package/dist/components/SegmentedControl/index.js.map +1 -1
- package/dist/components/SegmentedControl/types.d.ts +2 -2
- package/dist/components/Select/index.js +5 -5
- package/dist/components/Select/index.js.map +1 -1
- package/dist/components/Select/styles.js +1 -2
- package/dist/components/Select/styles.js.map +1 -1
- package/dist/components/Select/types.d.ts +6 -6
- package/dist/components/Slider/index.d.ts +1 -1
- package/dist/components/Slider/index.js +3 -3
- package/dist/components/Slider/index.js.map +1 -1
- package/dist/components/Switch/index.d.ts +1 -1
- package/dist/components/Switch/index.js +2 -2
- package/dist/components/Switch/index.js.map +1 -1
- package/dist/components/Tag/index.d.ts +1 -1
- package/dist/components/Tag/index.js +1 -1
- package/dist/components/Tag/index.js.map +1 -1
- package/dist/components/Text/index.d.ts +10 -2
- package/dist/components/Text/index.js +12 -20
- package/dist/components/Text/index.js.map +1 -1
- package/dist/components/Text/types.d.ts +3 -2
- package/dist/components/TextEditor/index.d.ts +1 -1
- package/dist/components/TextEditor/index.js +21 -9
- package/dist/components/TextEditor/index.js.map +1 -1
- package/dist/components/TextEditor/types.d.ts +4 -5
- package/dist/components/TextInput/index.d.ts +9 -3
- package/dist/components/TextInput/index.js +14 -30
- package/dist/components/TextInput/index.js.map +1 -1
- package/dist/components/TextInput/types.d.ts +4 -40
- package/dist/components/TextInput/useTextInput.d.ts +2 -6
- package/dist/components/TextInput/useTextInput.js +7 -16
- package/dist/components/TextInput/useTextInput.js.map +1 -1
- package/dist/components/Tooltip/index.d.ts +1 -1
- package/dist/components/Tooltip/index.js +1 -1
- package/dist/components/Tooltip/index.js.map +1 -1
- package/dist/components/Tooltip/types.d.ts +1 -1
- package/dist/components/Touchable/index.d.ts +10 -2
- package/dist/components/Touchable/index.js +9 -19
- package/dist/components/Touchable/index.js.map +1 -1
- package/dist/components/Touchable/types.d.ts +2 -1
- package/dist/components/View/index.d.ts +10 -2
- package/dist/components/View/index.js +7 -7
- package/dist/components/View/index.js.map +1 -1
- package/dist/components/View/types.d.ts +2 -2
- package/dist/components/VirtualList/context.d.ts +3 -0
- package/dist/components/VirtualList/context.js +93 -0
- package/dist/components/VirtualList/context.js.map +1 -0
- package/dist/components/VirtualList/index.d.ts +5 -0
- package/dist/components/VirtualList/index.js +14 -0
- package/dist/components/VirtualList/index.js.map +1 -0
- package/dist/components/VirtualList/list.d.ts +3 -0
- package/dist/components/VirtualList/list.js +102 -0
- package/dist/components/VirtualList/list.js.map +1 -0
- package/dist/components/VirtualList/types.d.ts +33 -0
- package/dist/components/{Pager/styles.js → VirtualList/types.js} +1 -1
- package/dist/components/VirtualList/types.js.map +1 -0
- package/dist/components/components.d.ts +4 -2
- package/dist/components/components.js +4 -2
- package/dist/components/components.js.map +1 -1
- package/dist/lib/ListMasonry.js +3 -3
- package/dist/lib/ListMasonry.js.map +1 -1
- package/dist/lib/WebStyleRegistry.js.map +1 -1
- package/dist/lib/hooks/index.d.ts +0 -1
- package/dist/lib/hooks/index.js +0 -1
- package/dist/lib/hooks/index.js.map +1 -1
- package/dist/lib/hooks/useAnimatedStyle.d.ts +8 -4
- package/dist/lib/hooks/useAnimatedStyle.js.map +1 -1
- package/dist/lib/hooks/useAnimatedVariantStyles.d.ts +3 -3
- package/dist/lib/hooks/useAnimatedVariantStyles.js +1 -2
- package/dist/lib/hooks/useAnimatedVariantStyles.js.map +1 -1
- package/dist/lib/hooks/useBreakpointMatch.js +1 -2
- package/dist/lib/hooks/useBreakpointMatch.js.map +1 -1
- package/dist/lib/hooks/useClick.js +1 -2
- package/dist/lib/hooks/useClick.js.map +1 -1
- package/dist/lib/hooks/useClickOutside.d.ts +1 -2
- package/dist/lib/hooks/useClickOutside.js +2 -3
- package/dist/lib/hooks/useClickOutside.js.map +1 -1
- package/dist/lib/hooks/useCropPicker.d.ts +1 -2
- package/dist/lib/hooks/useCropPicker.js +19 -7
- package/dist/lib/hooks/useCropPicker.js.map +1 -1
- package/dist/lib/hooks/useFileInput.d.ts +1 -2
- package/dist/lib/hooks/useKeydown.js +2 -2
- package/dist/lib/hooks/useKeydown.js.map +1 -1
- package/dist/lib/hooks/useMediaQuery.js +2 -3
- package/dist/lib/hooks/useMediaQuery.js.map +1 -1
- package/dist/lib/hooks/usePageExitBlocker.js.map +1 -1
- package/dist/lib/hooks/usePagination.js +1 -2
- package/dist/lib/hooks/usePagination.js.map +1 -1
- package/dist/lib/hooks/usePopState.js.map +1 -1
- package/dist/lib/hooks/useRefresh.d.ts +1 -1
- package/dist/lib/hooks/useRefresh.js.map +1 -1
- package/dist/lib/hooks/useScrollEffect.js +1 -2
- package/dist/lib/hooks/useScrollEffect.js.map +1 -1
- package/dist/lib/hooks/useSearchParams.d.ts +0 -1
- package/dist/lib/hooks/useSearchParams.js +1 -2
- package/dist/lib/hooks/useSearchParams.js.map +1 -1
- package/dist/lib/hooks/useStaticAnimationStyles.js +1 -2
- package/dist/lib/hooks/useStaticAnimationStyles.js.map +1 -1
- package/dist/lib/hooks/useWindowSize.js +1 -2
- package/dist/lib/hooks/useWindowSize.js.map +1 -1
- package/dist/lib/tools/localStorage.js.map +1 -1
- package/dist/lib/tools/mediaQuery.js +3 -4
- package/dist/lib/tools/mediaQuery.js.map +1 -1
- package/dist/lib/tools/modal.js +3 -3
- package/dist/lib/tools/modal.js.map +1 -1
- package/dist/lib/utils/pollyfils/scroll.js.map +1 -1
- package/dist/lib/utils/stopPropagation.js +1 -2
- package/dist/lib/utils/stopPropagation.js.map +1 -1
- package/dist/lib/utils/test.js.map +1 -1
- package/dist/types/utility.d.ts +2 -2
- package/package.json +39 -39
- package/package.json.bak +24 -24
- package/src/components/ActionIcon/index.tsx +1 -1
- package/src/components/ActivityIndicator/index.tsx +3 -4
- package/src/components/Badge/types.ts +1 -1
- package/src/components/Carousel/index.tsx +230 -0
- package/src/components/{Pager → Carousel}/styles.ts +2 -2
- package/src/components/Carousel/types.ts +41 -0
- package/src/components/Checkbox/index.tsx +1 -1
- package/src/components/Collapse/index.tsx +1 -1
- package/src/components/Collapse/types.ts +1 -1
- package/src/components/ColorPicker/types.ts +3 -3
- package/src/components/CropPicker/index.tsx +4 -3
- package/src/components/CropPicker/types.ts +3 -1
- package/src/components/DatePicker/components/OuterInput.tsx +3 -12
- package/src/components/DatePicker/index.tsx +18 -10
- package/src/components/DatePicker/types.ts +8 -5
- package/src/components/Dropzone/index.tsx +3 -2
- package/src/components/Dropzone/types.ts +3 -1
- package/src/components/EmptyPlaceholder/types.ts +2 -2
- package/src/components/FileInput/index.tsx +4 -3
- package/src/components/FileInput/types.ts +2 -0
- package/src/components/InputBase/useInputBase.ts +1 -1
- package/src/components/InputBase/utils.ts +1 -1
- package/src/components/List/index.tsx +56 -78
- package/src/components/List/styles.ts +2 -10
- package/src/components/List/types.ts +10 -52
- package/src/components/MaskedTextInput/index.tsx +58 -0
- package/src/components/MaskedTextInput/mask.ts +41 -0
- package/src/components/MaskedTextInput/types.ts +18 -0
- package/src/components/NumberIncrement/index.tsx +1 -3
- package/src/components/PaginationButtons/types.ts +1 -1
- package/src/components/PaginationIndicator/types.ts +2 -2
- package/src/components/Progress/Bar/types.ts +2 -2
- package/src/components/Progress/Circle/types.ts +1 -1
- package/src/components/SectionFilters/types.ts +1 -1
- package/src/components/SegmentedControl/index.tsx +6 -5
- package/src/components/SegmentedControl/types.ts +2 -2
- package/src/components/Select/index.tsx +3 -3
- package/src/components/Select/types.ts +6 -6
- package/src/components/Switch/index.tsx +1 -1
- package/src/components/Text/index.tsx +4 -3
- package/src/components/Text/types.ts +3 -2
- package/src/components/TextEditor/index.tsx +20 -18
- package/src/components/TextEditor/types.ts +5 -5
- package/src/components/TextInput/index.tsx +14 -34
- package/src/components/TextInput/types.ts +5 -57
- package/src/components/TextInput/useTextInput.ts +10 -19
- package/src/components/Tooltip/types.ts +1 -1
- package/src/components/Touchable/index.tsx +4 -4
- package/src/components/Touchable/types.ts +2 -1
- package/src/components/View/index.tsx +6 -5
- package/src/components/View/types.ts +3 -3
- package/src/components/VirtualList/context.tsx +93 -0
- package/src/components/VirtualList/index.tsx +11 -0
- package/src/components/VirtualList/list.tsx +85 -0
- package/src/components/VirtualList/types.ts +38 -0
- package/src/components/components.ts +4 -2
- package/src/lib/hooks/index.ts +0 -1
- package/src/lib/hooks/useAnimatedStyle.ts +11 -7
- package/src/lib/hooks/useAnimatedVariantStyles.ts +2 -2
- package/src/lib/hooks/useClickOutside.ts +1 -1
- package/src/lib/hooks/useMediaQuery.ts +1 -1
- package/src/types/utility.ts +2 -2
- package/dist/components/Grid/index.d.ts +0 -13
- package/dist/components/Grid/index.js +0 -94
- package/dist/components/Grid/index.js.map +0 -1
- package/dist/components/Grid/styles.d.ts +0 -2
- package/dist/components/Grid/styles.js.map +0 -1
- package/dist/components/Grid/types.d.ts +0 -9
- package/dist/components/List/ListLayout.d.ts +0 -2
- package/dist/components/List/ListLayout.js +0 -39
- package/dist/components/List/ListLayout.js.map +0 -1
- package/dist/components/Pager/index.d.ts +0 -7
- package/dist/components/Pager/index.js +0 -118
- package/dist/components/Pager/index.js.map +0 -1
- package/dist/components/Pager/styles.d.ts +0 -3
- package/dist/components/Pager/styles.js.map +0 -1
- package/dist/components/Pager/types.d.ts +0 -27
- package/dist/components/Pager/types.js.map +0 -1
- package/dist/components/TextInput/mask.d.ts +0 -5
- package/dist/components/TextInput/mask.js +0 -110
- package/dist/components/TextInput/mask.js.map +0 -1
- package/dist/lib/deprecated/OSAlert.d.ts +0 -38
- package/dist/lib/deprecated/OSAlert.js +0 -139
- package/dist/lib/deprecated/OSAlert.js.map +0 -1
- package/dist/lib/deprecated/index.d.ts +0 -1
- package/dist/lib/deprecated/index.js +0 -22
- package/dist/lib/deprecated/index.js.map +0 -1
- package/dist/lib/hooks/useInfiniteScroll.d.ts +0 -22
- package/dist/lib/hooks/useInfiniteScroll.js +0 -98
- package/dist/lib/hooks/useInfiniteScroll.js.map +0 -1
- package/src/components/Grid/index.tsx +0 -126
- package/src/components/Grid/styles.ts +0 -3
- package/src/components/Grid/types.ts +0 -13
- package/src/components/List/ListLayout.tsx +0 -87
- package/src/components/Pager/index.tsx +0 -156
- package/src/components/Pager/types.ts +0 -35
- package/src/components/TextInput/mask.tsx +0 -117
- package/src/lib/deprecated/OSAlert.tsx +0 -200
- package/src/lib/deprecated/index.ts +0 -6
- package/src/lib/hooks/useInfiniteScroll.ts +0 -77
- /package/dist/components/{Grid → Carousel}/styles.js +0 -0
- /package/dist/components/{Grid → Carousel}/types.js +0 -0
- /package/dist/components/{Pager → MaskedTextInput}/types.js +0 -0
|
@@ -1,103 +1,91 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { View
|
|
1
|
+
import React, { useCallback, useMemo } from 'react'
|
|
2
|
+
import { View } from '../View'
|
|
3
3
|
import { EmptyPlaceholder } from '../EmptyPlaceholder'
|
|
4
4
|
import { ListItem, ListProps } from './types'
|
|
5
|
-
import { ItemMasonryProps, ListMasonry, useInfiniteScroll, useMasonryReload } from '../../lib'
|
|
6
5
|
import { useStylesFor } from '../../lib/hooks/useStylesFor'
|
|
7
6
|
import { WebStyleRegistry } from '../../lib/WebStyleRegistry'
|
|
8
7
|
import { AnyRecord, IJSX, StyledComponentProps } from '@codeleap/styles'
|
|
9
|
-
import {
|
|
8
|
+
import { RenderComponentProps, useInfiniteLoader } from 'masonic'
|
|
9
|
+
import { TypeGuards } from '@codeleap/types'
|
|
10
|
+
import dynamic from 'next/dynamic'
|
|
10
11
|
|
|
11
12
|
export * from './styles'
|
|
12
13
|
export * from './types'
|
|
13
|
-
export * from './ListLayout'
|
|
14
14
|
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export function List(props: ListProps) {
|
|
20
|
-
const allProps = {
|
|
21
|
-
...List.defaultProps,
|
|
22
|
-
...props,
|
|
23
|
-
} as ListProps
|
|
15
|
+
const Masonry = dynamic(
|
|
16
|
+
() => import('masonic').then(mod => mod.Masonry),
|
|
17
|
+
{ ssr: false }
|
|
18
|
+
)
|
|
24
19
|
|
|
20
|
+
export function List<T extends ListItem>(props: ListProps<T>) {
|
|
25
21
|
const {
|
|
26
|
-
renderItem:
|
|
27
|
-
|
|
28
|
-
ListSeparatorComponent,
|
|
22
|
+
renderItem: providedRenderItem,
|
|
23
|
+
ItemSeparatorComponent,
|
|
29
24
|
data,
|
|
30
|
-
|
|
31
|
-
separators,
|
|
32
|
-
masonryProps,
|
|
33
|
-
reloadTimeout,
|
|
34
|
-
showFooter,
|
|
25
|
+
fetchNextPage,
|
|
35
26
|
style,
|
|
36
|
-
|
|
37
|
-
|
|
27
|
+
hasNextPage,
|
|
28
|
+
infiniteLoaderProps,
|
|
29
|
+
separators,
|
|
30
|
+
ListFooterComponent,
|
|
31
|
+
placeholder,
|
|
32
|
+
...masonryProps
|
|
33
|
+
} = {
|
|
34
|
+
...List.defaultProps,
|
|
35
|
+
...props,
|
|
36
|
+
}
|
|
38
37
|
|
|
39
38
|
const styles = useStylesFor(List.styleRegistryName, style)
|
|
40
39
|
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
40
|
+
const maybeLoadMore = useInfiniteLoader(
|
|
41
|
+
async (args) => {
|
|
42
|
+
if (hasNextPage) fetchNextPage?.()
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
isItemLoaded: (index, items) => !!items?.[index],
|
|
46
|
+
...infiniteLoaderProps,
|
|
47
|
+
},
|
|
48
|
+
)
|
|
47
49
|
|
|
48
|
-
const separator =
|
|
49
|
-
|
|
50
|
+
const separator = useMemo(() => {
|
|
51
|
+
if (!separators) return null
|
|
52
|
+
return ItemSeparatorComponent
|
|
50
53
|
}, [])
|
|
51
54
|
|
|
52
|
-
const renderItem =
|
|
53
|
-
if (!
|
|
54
|
-
|
|
55
|
-
const listLength = data?.length || 0
|
|
56
|
-
|
|
57
|
-
const isFirst = _item?.index === 0
|
|
58
|
-
const isLast = _item?.index === listLength - 1
|
|
59
|
-
const isOnly = isFirst && isLast
|
|
55
|
+
const renderItem = useCallback((itemMasonry: RenderComponentProps<T>) => {
|
|
56
|
+
if (!providedRenderItem) return null
|
|
60
57
|
|
|
61
|
-
const
|
|
62
|
-
..._item,
|
|
63
|
-
isOnly,
|
|
64
|
-
isLast,
|
|
65
|
-
isFirst,
|
|
66
|
-
item: _item?.data,
|
|
67
|
-
}
|
|
58
|
+
const isFirst = itemMasonry?.index === 0
|
|
68
59
|
|
|
69
60
|
return <>
|
|
70
61
|
{isFirst ? null : separator}
|
|
71
|
-
|
|
62
|
+
{providedRenderItem({ ...itemMasonry, item: itemMasonry?.data })}
|
|
72
63
|
</>
|
|
73
|
-
}, [
|
|
64
|
+
}, [providedRenderItem])
|
|
65
|
+
|
|
66
|
+
const isEmpty = useMemo(() => data?.length <= 0 || !data?.length, [data?.length])
|
|
74
67
|
|
|
75
68
|
return (
|
|
76
|
-
<
|
|
77
|
-
{...
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
styles={styles}
|
|
81
|
-
showFooter={reloadingLayout ? false : showFooter}
|
|
82
|
-
>
|
|
83
|
-
<ListMasonry
|
|
84
|
-
items={data}
|
|
85
|
-
render={renderItem}
|
|
86
|
-
itemKey={(item, _index) => (item?.id ?? _index)}
|
|
87
|
-
rowGutter={rowItemsSpacing}
|
|
88
|
-
onRender={onLoadMore}
|
|
89
|
-
overscanBy={overscan}
|
|
69
|
+
<View style={styles.wrapper}>
|
|
70
|
+
{isEmpty ? <EmptyPlaceholder {...placeholder} /> : null}
|
|
71
|
+
|
|
72
|
+
<Masonry
|
|
90
73
|
columnCount={1}
|
|
91
|
-
|
|
92
|
-
reloadingLayout={reloadingLayout}
|
|
74
|
+
overscanBy={7}
|
|
93
75
|
{...masonryProps}
|
|
76
|
+
items={data}
|
|
77
|
+
css={styles.list as any}
|
|
78
|
+
render={renderItem}
|
|
79
|
+
onRender={maybeLoadMore}
|
|
94
80
|
/>
|
|
95
|
-
|
|
81
|
+
|
|
82
|
+
{TypeGuards.isFunction(ListFooterComponent) ? <ListFooterComponent /> : ListFooterComponent}
|
|
83
|
+
</View>
|
|
96
84
|
)
|
|
97
85
|
}
|
|
98
86
|
|
|
99
87
|
List.styleRegistryName = 'List'
|
|
100
|
-
List.elements = ['wrapper', '
|
|
88
|
+
List.elements = ['wrapper', 'separator']
|
|
101
89
|
List.rootElement = 'wrapper'
|
|
102
90
|
|
|
103
91
|
List.withVariantTypes = <S extends AnyRecord>(styles: S) => {
|
|
@@ -105,17 +93,7 @@ List.withVariantTypes = <S extends AnyRecord>(styles: S) => {
|
|
|
105
93
|
}
|
|
106
94
|
|
|
107
95
|
List.defaultProps = {
|
|
108
|
-
|
|
109
|
-
ListSeparatorComponent: RenderSeparator,
|
|
110
|
-
refreshDebounce: 1500,
|
|
111
|
-
refreshSize: 40,
|
|
112
|
-
refreshThreshold: 0.1,
|
|
113
|
-
refreshPosition: 16,
|
|
114
|
-
refresh: true,
|
|
115
|
-
rowItemsSpacing: 8,
|
|
116
|
-
overscan: 2,
|
|
117
|
-
reloadTimeout: 350,
|
|
118
|
-
showFooter: true,
|
|
96
|
+
separators: true,
|
|
119
97
|
} as Partial<ListProps>
|
|
120
98
|
|
|
121
99
|
WebStyleRegistry.registerComponent(List)
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
+
export type ListParts = 'wrapper' | 'list'
|
|
1
2
|
|
|
2
|
-
type
|
|
3
|
-
|
|
4
|
-
export type ListParts =
|
|
5
|
-
'wrapper' |
|
|
6
|
-
'innerWrapper' |
|
|
7
|
-
'separator' |
|
|
8
|
-
'refreshControl' |
|
|
9
|
-
'refreshControlIndicator'
|
|
10
|
-
|
|
11
|
-
export type ListComposition = `${ListParts}:${ListStates}` | ListParts
|
|
3
|
+
export type ListComposition = ListParts
|
|
@@ -1,29 +1,10 @@
|
|
|
1
|
-
import { StylesOf } from '@codeleap/types'
|
|
2
1
|
import { EmptyPlaceholderProps } from '../EmptyPlaceholder'
|
|
3
|
-
import { ViewProps } from '../View'
|
|
4
|
-
import { MotionProps } from 'framer-motion'
|
|
5
|
-
import { ActivityIndicatorProps } from '../ActivityIndicator'
|
|
6
|
-
import { ComponentCommonProps } from '../../types'
|
|
7
|
-
import { ItemMasonryProps, ListMasonryProps, UseInfiniteScrollArgs, UseInfiniteScrollReturn } from '../../lib'
|
|
8
2
|
import { ListComposition } from './styles'
|
|
9
3
|
import { StyledProp } from '@codeleap/styles'
|
|
4
|
+
import { MasonryProps, RenderComponentProps, UseInfiniteLoaderOptions } from 'masonic'
|
|
10
5
|
|
|
11
|
-
export type
|
|
12
|
-
styles: StylesOf<ListComposition>
|
|
13
|
-
children?: React.ReactNode
|
|
14
|
-
showFooter?: boolean
|
|
15
|
-
wrapperProps?: Partial<ViewProps>
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export type ListRefreshControlComponent = Partial<ListLayoutProps> & {
|
|
19
|
-
styles: StylesOf<ListComposition>
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export type AugmentedRenderItemInfo<T> = ItemMasonryProps<T> & {
|
|
6
|
+
export type AugmentedRenderItemInfo<T> = RenderComponentProps<T> & {
|
|
23
7
|
item: T
|
|
24
|
-
isFirst: boolean
|
|
25
|
-
isLast: boolean
|
|
26
|
-
isOnly: boolean
|
|
27
8
|
}
|
|
28
9
|
|
|
29
10
|
export type ListItem = {
|
|
@@ -31,39 +12,16 @@ export type ListItem = {
|
|
|
31
12
|
}
|
|
32
13
|
|
|
33
14
|
export type ListProps<T extends ListItem = ListItem> =
|
|
34
|
-
|
|
35
|
-
UseInfiniteScrollArgs &
|
|
15
|
+
Omit<MasonryProps<T>, 'items' | 'render' | 'onRender'> &
|
|
36
16
|
{
|
|
37
17
|
data: T[]
|
|
38
|
-
|
|
39
|
-
hasNextPage?: boolean
|
|
40
|
-
separators?: boolean
|
|
41
|
-
onRefresh?: () => void
|
|
18
|
+
style?: StyledProp<ListComposition>
|
|
42
19
|
placeholder?: Omit<EmptyPlaceholderProps, 'debugName'>
|
|
43
|
-
|
|
44
|
-
renderItem: (data: AugmentedRenderItemInfo<T>) => React.ReactElement
|
|
45
|
-
ListFooterComponent?: (props: ListLayoutProps) => React.ReactElement
|
|
46
|
-
ListLoadingIndicatorComponent?: () => React.ReactElement
|
|
47
|
-
ListRefreshControlComponent?: () => React.ReactElement
|
|
48
|
-
ListEmptyComponent?: React.FC | ((props: EmptyPlaceholderProps) => React.ReactElement)
|
|
49
|
-
ListSeparatorComponent?: React.FC | ((props: { separatorStyles: ViewProps['style'] }) => React.ReactElement)
|
|
50
|
-
isLoading?: boolean
|
|
51
|
-
isFetchingNextPage?: boolean
|
|
20
|
+
ItemSeparatorComponent?: React.ReactElement
|
|
52
21
|
fetchNextPage?: () => void
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
refresh?: boolean
|
|
59
|
-
refreshControlProps?: Partial<MotionProps>
|
|
60
|
-
refreshControlIndicatorProps?: Partial<ActivityIndicatorProps>
|
|
61
|
-
style?: StyledProp<ListComposition>
|
|
62
|
-
ref?: React.MutableRefObject<undefined>
|
|
63
|
-
rowItemsSpacing?: number
|
|
64
|
-
overscan?: number
|
|
65
|
-
masonryProps?: Partial<ListMasonryProps<T>>
|
|
66
|
-
reloadTimeout?: number
|
|
67
|
-
showFooter?: boolean
|
|
68
|
-
layoutWrapperProps?: Partial<ViewProps>
|
|
22
|
+
renderItem: (data: AugmentedRenderItemInfo<T>) => React.ReactElement
|
|
23
|
+
ListFooterComponent?: React.ReactElement | (() => React.ReactElement)
|
|
24
|
+
infiniteLoaderProps?: UseInfiniteLoaderOptions<unknown>
|
|
25
|
+
hasNextPage?: boolean
|
|
26
|
+
separators?: boolean
|
|
69
27
|
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { useIMask } from 'react-imask'
|
|
2
|
+
import { MaskedTextInputProps } from './types'
|
|
3
|
+
import { AnyRecord, IJSX, StyledComponentProps } from '@codeleap/styles'
|
|
4
|
+
import { TextInput } from '../TextInput'
|
|
5
|
+
import { maskPresets } from './mask'
|
|
6
|
+
import { useMemo, useCallback } from 'react'
|
|
7
|
+
import { TypeGuards } from '@codeleap/types'
|
|
8
|
+
|
|
9
|
+
export * from './types'
|
|
10
|
+
|
|
11
|
+
export const MaskedTextInput = (props: MaskedTextInputProps) => {
|
|
12
|
+
const {
|
|
13
|
+
maskType,
|
|
14
|
+
maskOptions: customMaskOptions,
|
|
15
|
+
onAccept,
|
|
16
|
+
onComplete,
|
|
17
|
+
unmask = false,
|
|
18
|
+
onValueChange,
|
|
19
|
+
value,
|
|
20
|
+
...textInputProps
|
|
21
|
+
} = props
|
|
22
|
+
|
|
23
|
+
const maskOptions = useMemo(() => {
|
|
24
|
+
const preset = maskType ? maskPresets[maskType] : {}
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
...preset,
|
|
28
|
+
...customMaskOptions,
|
|
29
|
+
unmask,
|
|
30
|
+
}
|
|
31
|
+
}, [maskType, customMaskOptions, unmask])
|
|
32
|
+
|
|
33
|
+
const handleAccept = useCallback((value: string, maskRef: any, e?: InputEvent) => {
|
|
34
|
+
onAccept?.(value, maskRef, e)
|
|
35
|
+
onValueChange?.(value)
|
|
36
|
+
}, [onAccept, onValueChange])
|
|
37
|
+
|
|
38
|
+
const { ref: maskRef } = useIMask(maskOptions as any, {
|
|
39
|
+
onAccept: handleAccept,
|
|
40
|
+
onComplete,
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
const placeholder = textInputProps?.placeholder ?? (TypeGuards.isString(maskOptions?.mask) ? maskOptions?.mask : undefined)
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<TextInput
|
|
47
|
+
{...textInputProps}
|
|
48
|
+
placeholder={placeholder}
|
|
49
|
+
ref={maskRef as any}
|
|
50
|
+
value={value}
|
|
51
|
+
onValueChange={onValueChange}
|
|
52
|
+
/>
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
MaskedTextInput.withVariantTypes = <S extends AnyRecord>(styles: S) => {
|
|
57
|
+
return MaskedTextInput as (props: StyledComponentProps<MaskedTextInputProps, typeof styles>) => IJSX
|
|
58
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { MaskedTextInputMaskType } from './types'
|
|
2
|
+
|
|
3
|
+
type MaskPreset = {
|
|
4
|
+
mask?: string
|
|
5
|
+
lazy?: boolean
|
|
6
|
+
placeholderChar?: string
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const maskPresets: Record<MaskedTextInputMaskType | 'cel-phone-brl', MaskPreset> = {
|
|
10
|
+
'credit-card': {
|
|
11
|
+
mask: '0000 0000 0000 0000',
|
|
12
|
+
lazy: false,
|
|
13
|
+
placeholderChar: '0',
|
|
14
|
+
},
|
|
15
|
+
'cpf': {
|
|
16
|
+
mask: '000.000.000-00',
|
|
17
|
+
lazy: false,
|
|
18
|
+
placeholderChar: '0',
|
|
19
|
+
},
|
|
20
|
+
'cnpj': {
|
|
21
|
+
mask: '00.000.000/0000-00',
|
|
22
|
+
lazy: false,
|
|
23
|
+
placeholderChar: '0',
|
|
24
|
+
},
|
|
25
|
+
'zip-code': {
|
|
26
|
+
mask: '00000-000',
|
|
27
|
+
lazy: false,
|
|
28
|
+
placeholderChar: '0',
|
|
29
|
+
},
|
|
30
|
+
'cel-phone': {
|
|
31
|
+
mask: '+000 000 000 000',
|
|
32
|
+
lazy: false,
|
|
33
|
+
placeholderChar: '0',
|
|
34
|
+
},
|
|
35
|
+
'cel-phone-brl': {
|
|
36
|
+
mask: '(00) 00000-0000',
|
|
37
|
+
lazy: false,
|
|
38
|
+
placeholderChar: '0',
|
|
39
|
+
},
|
|
40
|
+
'custom': {},
|
|
41
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { TextInputProps } from '../TextInput'
|
|
2
|
+
import { ReactMaskOpts } from 'react-imask'
|
|
3
|
+
|
|
4
|
+
export type MaskedTextInputMaskType =
|
|
5
|
+
| 'credit-card'
|
|
6
|
+
| 'cpf'
|
|
7
|
+
| 'cnpj'
|
|
8
|
+
| 'zip-code'
|
|
9
|
+
| 'cel-phone'
|
|
10
|
+
| 'custom'
|
|
11
|
+
|
|
12
|
+
export type MaskedTextInputProps = Omit<TextInputProps, 'multiline'> & {
|
|
13
|
+
maskType?: MaskedTextInputMaskType
|
|
14
|
+
maskOptions?: ReactMaskOpts
|
|
15
|
+
onAccept?: (value: string, maskRef?: any, e?: InputEvent) => void
|
|
16
|
+
onComplete?: (value: string, maskRef?: any, e?: InputEvent) => void
|
|
17
|
+
unmask?: boolean | 'typed'
|
|
18
|
+
}
|
|
@@ -69,7 +69,7 @@ export const NumberIncrement = (props: NumberIncrementProps) => {
|
|
|
69
69
|
? PatternFormat
|
|
70
70
|
: NumericFormat
|
|
71
71
|
|
|
72
|
-
const Input = TypeGuards.isFunction(formatter)
|
|
72
|
+
const Input: any = TypeGuards.isFunction(formatter)
|
|
73
73
|
? NumberFormatBase
|
|
74
74
|
: InputFormat
|
|
75
75
|
|
|
@@ -111,9 +111,7 @@ export const NumberIncrement = (props: NumberIncrementProps) => {
|
|
|
111
111
|
<Input
|
|
112
112
|
displayType='input'
|
|
113
113
|
css={[
|
|
114
|
-
// @ts-ignore
|
|
115
114
|
partialStyles?.input,
|
|
116
|
-
// @ts-ignore
|
|
117
115
|
{
|
|
118
116
|
'&::placeholder': partialStyles?.placeholder,
|
|
119
117
|
},
|
|
@@ -9,7 +9,7 @@ export type PaginationButtonsProps =
|
|
|
9
9
|
{
|
|
10
10
|
onFetchNextPage?: AnyFunction
|
|
11
11
|
onFetchPreviousPage?: AnyFunction
|
|
12
|
-
renderItem?: (item: string | number, index: number) =>
|
|
12
|
+
renderItem?: (item: string | number, index: number) => React.ReactElement
|
|
13
13
|
onPressItem?: (item: string | number) => void
|
|
14
14
|
shouldAbbreviate?: boolean
|
|
15
15
|
abbreviationSymbol?: string
|
|
@@ -9,9 +9,9 @@ export type PaginationIndicatorProps =
|
|
|
9
9
|
ComponentCommonProps &
|
|
10
10
|
{
|
|
11
11
|
isFetching?: boolean
|
|
12
|
-
noMoreItemsText:
|
|
12
|
+
noMoreItemsText: React.ReactElement | string | number
|
|
13
13
|
hasMore?: boolean
|
|
14
|
-
activityIndicator?:
|
|
14
|
+
activityIndicator?: React.ReactElement
|
|
15
15
|
style?: StyledProp<PaginationIndicatorComposition>
|
|
16
16
|
indicatorProps?: Partial<ActivityIndicatorProps>
|
|
17
17
|
textProps?: Partial<TextProps<'p'>>
|
|
@@ -19,8 +19,8 @@ export type ProgressBarProps =
|
|
|
19
19
|
rightIconProps?: Partial<IconProps>
|
|
20
20
|
text?: string
|
|
21
21
|
textProps?: Partial<TextProps>
|
|
22
|
-
leftText?: TextProps['text'] |
|
|
22
|
+
leftText?: TextProps['text'] | React.ReactElement
|
|
23
23
|
leftTextProps?: Partial<TextProps>
|
|
24
|
-
rightText?: TextProps['text'] |
|
|
24
|
+
rightText?: TextProps['text'] | React.ReactElement
|
|
25
25
|
rightTextProps?: Partial<TextProps>
|
|
26
26
|
}
|
|
@@ -13,7 +13,7 @@ export type ProgressCircleProps =
|
|
|
13
13
|
circleStyles?: Parameters<typeof buildStyles>[0]
|
|
14
14
|
children?: React.ReactNode
|
|
15
15
|
size?: number
|
|
16
|
-
text?: string |
|
|
16
|
+
text?: string | React.ReactElement
|
|
17
17
|
textProps?: Partial<TextProps>
|
|
18
18
|
icon?: AppIcon
|
|
19
19
|
iconProps?: Partial<IconProps>
|
|
@@ -52,7 +52,7 @@ export type SectionFiltersProps = {
|
|
|
52
52
|
onSelectItem?: (item: onSelectItemProps) => void
|
|
53
53
|
onClearItems?: ClearFunction
|
|
54
54
|
onApplyItems?: ApplyFunction
|
|
55
|
-
renderFooterComponent?: (props: SectionFilterFooterProps) =>
|
|
55
|
+
renderFooterComponent?: (props: SectionFilterFooterProps) => React.ReactElement
|
|
56
56
|
applyFilterButtonProps?: Omit<ButtonProps, 'debugName'>
|
|
57
57
|
clearFilterButtonProps?: Omit<ButtonProps, 'debugName'>
|
|
58
58
|
filterOnOptionPress?: boolean
|
|
@@ -4,7 +4,7 @@ import { TypeGuards } from '@codeleap/types'
|
|
|
4
4
|
import { useRef } from '@codeleap/hooks'
|
|
5
5
|
|
|
6
6
|
import { Text } from '../Text'
|
|
7
|
-
import { motion,
|
|
7
|
+
import { motion, TargetAndTransition } from 'motion/react'
|
|
8
8
|
import { useAnimatedVariantStyles } from '../../lib'
|
|
9
9
|
import { SegmentedControlOptionProps, SegmentedControlProps } from './types'
|
|
10
10
|
import { Touchable } from '../Touchable'
|
|
@@ -16,7 +16,7 @@ import { AnyRecord, IJSX, mergeStyles, StyledComponentProps } from '@codeleap/st
|
|
|
16
16
|
export * from './styles'
|
|
17
17
|
export * from './types'
|
|
18
18
|
|
|
19
|
-
const Option =
|
|
19
|
+
const Option = (props: SegmentedControlOptionProps) => {
|
|
20
20
|
const {
|
|
21
21
|
selected,
|
|
22
22
|
onPress,
|
|
@@ -27,6 +27,7 @@ const Option = forwardRef<HTMLButtonElement, SegmentedControlOptionProps>((props
|
|
|
27
27
|
largestWidth,
|
|
28
28
|
textProps,
|
|
29
29
|
disabled,
|
|
30
|
+
ref,
|
|
30
31
|
...touchableProps
|
|
31
32
|
} = props
|
|
32
33
|
|
|
@@ -38,7 +39,7 @@ const Option = forwardRef<HTMLButtonElement, SegmentedControlOptionProps>((props
|
|
|
38
39
|
|
|
39
40
|
return (
|
|
40
41
|
<Touchable
|
|
41
|
-
key={touchableProps.key}
|
|
42
|
+
key={touchableProps.key as any}
|
|
42
43
|
ref={ref as unknown as React.Ref<HTMLButtonElement>}
|
|
43
44
|
onPress={onPress}
|
|
44
45
|
disabled={disabled}
|
|
@@ -70,7 +71,7 @@ const Option = forwardRef<HTMLButtonElement, SegmentedControlOptionProps>((props
|
|
|
70
71
|
/>
|
|
71
72
|
</Touchable>
|
|
72
73
|
)
|
|
73
|
-
}
|
|
74
|
+
}
|
|
74
75
|
|
|
75
76
|
export const SegmentedControl = (props: SegmentedControlProps) => {
|
|
76
77
|
const {
|
|
@@ -122,7 +123,7 @@ export const SegmentedControl = (props: SegmentedControlProps) => {
|
|
|
122
123
|
duration: transitionDuration,
|
|
123
124
|
},
|
|
124
125
|
...animationProps,
|
|
125
|
-
} as
|
|
126
|
+
} as TargetAndTransition
|
|
126
127
|
},
|
|
127
128
|
dependencies: [currentOptionIdx, largestWidth.width],
|
|
128
129
|
})
|
|
@@ -3,7 +3,7 @@ import { StylesOf } from '@codeleap/types'
|
|
|
3
3
|
import { TextProps } from '../Text'
|
|
4
4
|
import { TouchableProps } from '../Touchable'
|
|
5
5
|
import { SegmentedControlComposition } from './styles'
|
|
6
|
-
import { MotionProps,
|
|
6
|
+
import { MotionProps, TargetAndTransition, ForwardRefComponent } from 'motion/react'
|
|
7
7
|
import { IconProps } from '../Icon'
|
|
8
8
|
import { AppIcon, StyledProp } from '@codeleap/styles'
|
|
9
9
|
|
|
@@ -17,7 +17,7 @@ export type SegmentedControlProps<T = string> = {
|
|
|
17
17
|
touchableProps?: Partial<TouchableProps>
|
|
18
18
|
debugName?: string
|
|
19
19
|
disabled?: boolean
|
|
20
|
-
animationProps?:
|
|
20
|
+
animationProps?: TargetAndTransition
|
|
21
21
|
transitionDuration?: number
|
|
22
22
|
RenderAnimatedView?: ForwardRefComponent<HTMLDivElement, any>
|
|
23
23
|
textProps?: TextProps
|
|
@@ -18,7 +18,7 @@ import { useValidate } from '@codeleap/form'
|
|
|
18
18
|
export * from './styles'
|
|
19
19
|
export * from './types'
|
|
20
20
|
|
|
21
|
-
const DefaultOption = (props: TCustomOption & { component: (props: TCustomOption) =>
|
|
21
|
+
const DefaultOption = (props: TCustomOption & { component: (props: TCustomOption) => React.ReactElement }) => {
|
|
22
22
|
const {
|
|
23
23
|
isSelected,
|
|
24
24
|
optionsStyles,
|
|
@@ -59,7 +59,7 @@ const DefaultOption = (props: TCustomOption & { component: (props: TCustomOption
|
|
|
59
59
|
)
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
const CustomMenu = (props: MenuProps & { Footer: () =>
|
|
62
|
+
const CustomMenu = (props: MenuProps & { Footer: () => React.ReactElement }) => {
|
|
63
63
|
const { Footer, children } = props
|
|
64
64
|
return <React.Fragment>
|
|
65
65
|
<components.Menu {...props}>
|
|
@@ -89,7 +89,7 @@ const DefaultPlaceholder = (props: PlaceholderProps) => {
|
|
|
89
89
|
if (TypeGuards.isString(TextPlaceholder)) {
|
|
90
90
|
return <Text debugName={debugName} text={TextPlaceholder} style={defaultStyles.text} />
|
|
91
91
|
} else if (React.isValidElement(TextPlaceholder)) {
|
|
92
|
-
return TextPlaceholder as
|
|
92
|
+
return TextPlaceholder as React.ReactElement
|
|
93
93
|
} else if (TypeGuards.isFunction(TextPlaceholder)) {
|
|
94
94
|
return <TextPlaceholder {...props} />
|
|
95
95
|
}
|
|
@@ -49,7 +49,7 @@ export type TCustomOption = OptionProps & ComponentPartProps & ComponentCommonPr
|
|
|
49
49
|
styles?: OptionState['baseStyles']
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
type SelectPlaceholderElement = string | ((props: PlaceholderProps) =>
|
|
52
|
+
type SelectPlaceholderElement = string | ((props: PlaceholderProps) => React.ReactElement) | React.ReactElement
|
|
53
53
|
|
|
54
54
|
export type PlaceholderProps = NoticeProps & ComponentPartProps & {
|
|
55
55
|
text: SelectPlaceholderElement
|
|
@@ -74,11 +74,11 @@ export type SelectProps<T = any, Multi extends boolean = false> = React.PropsWit
|
|
|
74
74
|
closeOnSelect?: boolean
|
|
75
75
|
focused?: boolean
|
|
76
76
|
_error?: string
|
|
77
|
-
renderItem?: (props: TCustomOption) =>
|
|
78
|
-
FooterComponent?: () =>
|
|
79
|
-
PlaceholderComponent?: (props: PlaceholderProps) =>
|
|
80
|
-
PlaceholderNoItemsComponent?: (props: PlaceholderProps) =>
|
|
81
|
-
LoadingIndicatorComponent?: (props: LoadingIndicatorProps) =>
|
|
77
|
+
renderItem?: (props: TCustomOption) => React.ReactElement
|
|
78
|
+
FooterComponent?: () => React.ReactElement
|
|
79
|
+
PlaceholderComponent?: (props: PlaceholderProps) => React.ReactElement
|
|
80
|
+
PlaceholderNoItemsComponent?: (props: PlaceholderProps) => React.ReactElement
|
|
81
|
+
LoadingIndicatorComponent?: (props: LoadingIndicatorProps) => React.ReactElement
|
|
82
82
|
noItemsText?: SelectPlaceholderElement
|
|
83
83
|
noItemsIcon?: SelectPlaceholderElement
|
|
84
84
|
noItemsImage?: PlaceholderProps['image']
|
|
@@ -2,7 +2,7 @@ import React from 'react'
|
|
|
2
2
|
import { InputBase, InputBaseDefaultOrder, selectInputBaseProps } from '../InputBase'
|
|
3
3
|
import { useAnimatedVariantStyles } from '../../lib'
|
|
4
4
|
import { WebStyleRegistry } from '../../lib/WebStyleRegistry'
|
|
5
|
-
import { motion } from '
|
|
5
|
+
import { motion } from 'motion/react'
|
|
6
6
|
import { AnyRecord, IJSX, mergeStyles, StyledComponentProps } from '@codeleap/styles'
|
|
7
7
|
import { useStylesFor } from '../../lib/hooks/useStylesFor'
|
|
8
8
|
import { SwitchProps } from './types'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TypeGuards } from '@codeleap/types'
|
|
2
|
-
import { motion } from '
|
|
2
|
+
import { motion } from 'motion/react'
|
|
3
3
|
import React, { ElementType, forwardRef } from 'react'
|
|
4
4
|
import { TextProps } from './types'
|
|
5
5
|
import { useStylesFor } from '../../lib/hooks/useStylesFor'
|
|
@@ -9,7 +9,7 @@ import { AnyRecord, IJSX, StyledComponentProps, StyledComponentWithProps } from
|
|
|
9
9
|
export * from './styles'
|
|
10
10
|
export * from './types'
|
|
11
11
|
|
|
12
|
-
export const Text =
|
|
12
|
+
export const Text = (textProps: TextProps) => {
|
|
13
13
|
const {
|
|
14
14
|
style,
|
|
15
15
|
text,
|
|
@@ -22,6 +22,7 @@ export const Text = forwardRef<HTMLParagraphElement, TextProps>((textProps, ref)
|
|
|
22
22
|
onClick,
|
|
23
23
|
animated,
|
|
24
24
|
animatedProps,
|
|
25
|
+
ref,
|
|
25
26
|
...props
|
|
26
27
|
} = {
|
|
27
28
|
...Text.defaultProps,
|
|
@@ -76,7 +77,7 @@ export const Text = forwardRef<HTMLParagraphElement, TextProps>((textProps, ref)
|
|
|
76
77
|
{text || children}
|
|
77
78
|
</Component>
|
|
78
79
|
)
|
|
79
|
-
}
|
|
80
|
+
}
|
|
80
81
|
|
|
81
82
|
Text.styleRegistryName = 'Text'
|
|
82
83
|
Text.elements = ['text']
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ComponentPropsWithoutRef, ElementType } from 'react'
|
|
1
|
+
import { ComponentPropsWithoutRef, ElementType, RefObject } from 'react'
|
|
2
2
|
import { TextComposition } from './styles'
|
|
3
3
|
import { AnyRecord, StyledProp } from '@codeleap/styles'
|
|
4
|
-
import { MotionProps } from '
|
|
4
|
+
import { MotionProps } from 'motion/react'
|
|
5
5
|
|
|
6
6
|
export type TextProps<T extends ElementType = 'p'> =
|
|
7
7
|
Omit<ComponentPropsWithoutRef<T>, 'style'> &
|
|
@@ -15,4 +15,5 @@ export type TextProps<T extends ElementType = 'p'> =
|
|
|
15
15
|
onPress?: (event: React.MouseEventHandler<T>) => void
|
|
16
16
|
animated?: boolean
|
|
17
17
|
animatedProps?: Partial<MotionProps>
|
|
18
|
+
ref?: RefObject<HTMLParagraphElement | null>
|
|
18
19
|
}
|