@codeleap/web 3.24.3 → 3.25.0
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/package.json +2 -1
- package/src/components/ActionIcon/index.tsx +51 -52
- package/src/components/ActionIcon/styles.ts +1 -5
- package/src/components/ActionIcon/types.ts +15 -0
- package/src/components/ActivityIndicator/index.tsx +34 -55
- package/src/components/ActivityIndicator/styles.ts +0 -6
- package/src/components/ActivityIndicator/types.ts +12 -0
- package/src/components/Badge/index.tsx +43 -80
- package/src/components/Badge/styles.ts +1 -11
- package/src/components/Badge/types.ts +28 -0
- package/src/components/Button/index.tsx +46 -89
- package/src/components/Button/styles.ts +0 -5
- package/src/components/Button/types.ts +25 -0
- package/src/components/Checkbox/index.tsx +83 -97
- package/src/components/Checkbox/styles.ts +1 -5
- package/src/components/Checkbox/types.ts +15 -0
- package/src/components/Collapse/index.tsx +41 -83
- package/src/components/Collapse/styles.ts +3 -6
- package/src/components/Collapse/types.ts +11 -0
- package/src/components/ColorPicker/index.tsx +95 -48
- package/src/components/ColorPicker/styles.ts +11 -11
- package/src/components/ColorPicker/types.ts +26 -12
- package/src/components/CropPicker/index.tsx +100 -104
- package/src/components/CropPicker/styles.ts +0 -7
- package/src/components/CropPicker/types.ts +8 -15
- package/src/components/DatePicker/{defaultComponents → components}/Header.tsx +9 -17
- package/src/components/DatePicker/{defaultComponents → components}/OuterInput.tsx +6 -7
- package/src/components/DatePicker/index.tsx +110 -124
- package/src/components/DatePicker/styles.ts +1 -12
- package/src/components/DatePicker/types.ts +16 -33
- package/src/components/Drawer/index.tsx +133 -125
- package/src/components/Drawer/styles.ts +0 -5
- package/src/components/Drawer/types.ts +23 -0
- package/src/components/Dropzone/index.tsx +87 -63
- package/src/components/Dropzone/styles.ts +0 -6
- package/src/components/Dropzone/types.ts +29 -37
- package/src/components/EmptyPlaceholder/index.tsx +63 -83
- package/src/components/EmptyPlaceholder/styles.ts +0 -5
- package/src/components/EmptyPlaceholder/types.ts +32 -0
- package/src/components/FileInput/index.tsx +72 -0
- package/src/components/FileInput/types.ts +14 -0
- package/src/components/Grid/index.tsx +40 -41
- package/src/components/Grid/styles.ts +2 -9
- package/src/components/Grid/types.ts +10 -12
- package/src/components/Icon/index.tsx +45 -47
- package/src/components/Icon/styles.ts +0 -8
- package/src/components/Icon/types.ts +15 -0
- package/src/components/InputBase/index.tsx +71 -42
- package/src/components/InputBase/styles.ts +37 -47
- package/src/components/InputBase/types.ts +19 -7
- package/src/components/InputBase/utils.ts +3 -23
- package/src/components/List/ListLayout.tsx +20 -37
- package/src/components/List/index.tsx +36 -41
- package/src/components/List/styles.ts +5 -11
- package/src/components/List/types.ts +30 -20
- package/src/components/LoadingOverlay/index.tsx +31 -33
- package/src/components/LoadingOverlay/styles.ts +3 -8
- package/src/components/LoadingOverlay/types.ts +16 -0
- package/src/components/Modal/index.tsx +98 -160
- package/src/components/Modal/styles.ts +0 -5
- package/src/components/Modal/types.ts +55 -0
- package/src/components/NumberIncrement/index.tsx +67 -98
- package/src/components/NumberIncrement/styles.ts +0 -5
- package/src/components/NumberIncrement/types.ts +29 -0
- package/src/components/Overlay/index.tsx +37 -35
- package/src/components/Overlay/styles.ts +3 -5
- package/src/components/Overlay/types.ts +13 -0
- package/src/components/Pager/index.tsx +65 -81
- package/src/components/Pager/styles.ts +3 -9
- package/src/components/Pager/types.ts +35 -0
- package/src/components/PaginationButtons/index.tsx +173 -0
- package/src/components/PaginationButtons/styles.ts +7 -0
- package/src/components/PaginationButtons/types.ts +26 -0
- package/src/components/PaginationIndicator/index.tsx +69 -0
- package/src/components/PaginationIndicator/styles.ts +3 -0
- package/src/components/PaginationIndicator/types.ts +18 -0
- package/src/components/Progress/Bar/index.tsx +45 -50
- package/src/components/Progress/Bar/styles.ts +10 -0
- package/src/components/Progress/Bar/types.ts +26 -0
- package/src/components/Progress/Circle/index.tsx +45 -48
- package/src/components/Progress/Circle/styles.ts +1 -8
- package/src/components/Progress/Circle/types.ts +10 -22
- package/src/components/RadioInput/index.tsx +78 -124
- package/src/components/RadioInput/styles.ts +0 -6
- package/src/components/RadioInput/types.ts +29 -0
- package/src/components/SearchInput/index.tsx +10 -10
- package/src/components/SectionFilters/index.tsx +47 -36
- package/src/components/SectionFilters/styles.ts +1 -5
- package/src/components/SectionFilters/types.ts +14 -13
- package/src/components/SegmentedControl/index.tsx +111 -89
- package/src/components/SegmentedControl/styles.ts +7 -21
- package/src/components/SegmentedControl/types.ts +44 -0
- package/src/components/Select/index.tsx +92 -56
- package/src/components/Select/styles.ts +19 -36
- package/src/components/Select/types.ts +15 -10
- package/src/components/Slider/index.tsx +85 -93
- package/src/components/Slider/styles.ts +13 -6
- package/src/components/Slider/types.ts +29 -0
- package/src/components/Switch/index.tsx +63 -74
- package/src/components/Switch/styles.ts +1 -6
- package/src/components/Switch/types.ts +13 -0
- package/src/components/Tag/index.tsx +39 -44
- package/src/components/Tag/styles.ts +1 -9
- package/src/components/Tag/types.ts +10 -10
- package/src/components/Text/index.tsx +37 -48
- package/src/components/Text/styles.ts +0 -8
- package/src/components/Text/types.ts +8 -8
- package/src/components/TextEditor/index.tsx +49 -28
- package/src/components/TextEditor/styles.ts +1 -8
- package/src/components/TextEditor/types.ts +11 -6
- package/src/components/TextInput/index.tsx +58 -96
- package/src/components/TextInput/mask.tsx +2 -50
- package/src/components/TextInput/styles.ts +3 -8
- package/src/components/TextInput/types.ts +85 -0
- package/src/components/Tooltip/index.tsx +61 -84
- package/src/components/Tooltip/styles.ts +3 -10
- package/src/components/Tooltip/types.ts +46 -0
- package/src/components/Touchable/index.tsx +43 -86
- package/src/components/Touchable/styles.ts +0 -6
- package/src/components/Touchable/types.ts +22 -0
- package/src/components/View/index.tsx +36 -50
- package/src/components/View/styles.ts +0 -6
- package/src/components/View/types.ts +14 -15
- package/src/components/components.ts +2 -3
- package/src/index.ts +1 -0
- package/src/lib/WebStyleRegistry.ts +51 -0
- package/src/lib/hooks/index.ts +5 -0
- package/src/lib/hooks/useBreakpointMatch.ts +8 -7
- package/src/{components/CropPicker/useCropPicker.tsx → lib/hooks/useCropPicker.ts} +66 -13
- package/src/lib/hooks/useFileInput.ts +15 -0
- package/src/lib/hooks/useInfiniteScroll.ts +77 -0
- package/src/lib/hooks/useMediaQuery.ts +4 -3
- package/src/lib/hooks/usePagination.ts +79 -63
- package/src/lib/hooks/useRefresh.ts +87 -0
- package/src/lib/hooks/useStylesFor.ts +13 -0
- package/src/lib/index.ts +1 -0
- package/src/lib/utils/cache.ts +9 -0
- package/src/lib/utils/index.ts +1 -0
- package/src/lib/utils/test.ts +2 -2
- package/src/components/CropPicker/utils.ts +0 -51
- package/src/components/FileInput.tsx +0 -91
- package/src/components/List/PaginationIndicator.tsx +0 -102
- package/src/components/List/useInfiniteScroll.ts +0 -159
- package/src/components/Progress/Bar/styles.tsx +0 -7
- package/src/components/Progress/Bar/types.tsx +0 -30
- package/src/components/Scroll/index.tsx +0 -32
- package/src/components/Scroll/styles.ts +0 -8
- package/src/components/SegmentedControl/SegmentedControlOption.tsx +0 -84
- package/src/components/defaultStyles.ts +0 -79
- /package/src/components/DatePicker/{defaultComponents → components}/index.tsx +0 -0
|
@@ -1,68 +1,41 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { useDefaultComponentStyle } from '@codeleap/common'
|
|
3
2
|
import { View, ViewProps } from '../View'
|
|
4
3
|
import { EmptyPlaceholder } from '../EmptyPlaceholder'
|
|
5
|
-
import {
|
|
6
|
-
import { useInfiniteScroll } from '
|
|
7
|
-
import {
|
|
4
|
+
import { ListItem, ListProps } from './types'
|
|
5
|
+
import { ItemMasonryProps, ListMasonry, useInfiniteScroll, useMasonryReload } from '../../lib'
|
|
6
|
+
import { useStylesFor } from '../../lib/hooks/useStylesFor'
|
|
7
|
+
import { WebStyleRegistry } from '../../lib/WebStyleRegistry'
|
|
8
|
+
import { AnyRecord, IJSX, StyledComponentProps } from '@codeleap/styles'
|
|
8
9
|
import { ListLayout } from './ListLayout'
|
|
9
|
-
import { ItemMasonryProps, ListMasonry, useMasonryReload } from '../../lib'
|
|
10
10
|
|
|
11
11
|
export * from './styles'
|
|
12
|
-
export * from './PaginationIndicator'
|
|
13
|
-
export * from './useInfiniteScroll'
|
|
14
12
|
export * from './types'
|
|
15
13
|
export * from './ListLayout'
|
|
16
14
|
|
|
17
|
-
const RenderSeparator = (props: { separatorStyles: ViewProps
|
|
18
|
-
return
|
|
19
|
-
<View css={[props?.separatorStyles]}></View>
|
|
20
|
-
)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const defaultProps: Partial<ListProps> = {
|
|
24
|
-
ListFooterComponent: null,
|
|
25
|
-
ListHeaderComponent: null,
|
|
26
|
-
ListLoadingIndicatorComponent: null,
|
|
27
|
-
ListEmptyComponent: EmptyPlaceholder,
|
|
28
|
-
ListSeparatorComponent: RenderSeparator,
|
|
29
|
-
refreshDebounce: 1500,
|
|
30
|
-
refreshSize: 40,
|
|
31
|
-
refreshThreshold: 0.1,
|
|
32
|
-
refreshPosition: 16,
|
|
33
|
-
refresh: true,
|
|
34
|
-
rowItemsSpacing: 8,
|
|
35
|
-
overscan: 2,
|
|
36
|
-
reloadTimeout: 350,
|
|
37
|
-
showFooter: true,
|
|
15
|
+
const RenderSeparator = (props: { separatorStyles: ViewProps['style'] }) => {
|
|
16
|
+
return <View style={props?.separatorStyles} />
|
|
38
17
|
}
|
|
39
18
|
|
|
40
|
-
export function List
|
|
19
|
+
export function List(props: ListProps) {
|
|
41
20
|
const allProps = {
|
|
42
21
|
...List.defaultProps,
|
|
43
22
|
...props,
|
|
44
23
|
} as ListProps
|
|
45
24
|
|
|
46
25
|
const {
|
|
47
|
-
variants = [],
|
|
48
|
-
responsiveVariants = {},
|
|
49
|
-
styles = {},
|
|
50
26
|
renderItem: RenderItem,
|
|
51
27
|
rowItemsSpacing,
|
|
52
28
|
ListSeparatorComponent,
|
|
53
29
|
data,
|
|
54
30
|
overscan,
|
|
55
31
|
separators,
|
|
56
|
-
masonryProps
|
|
32
|
+
masonryProps,
|
|
57
33
|
reloadTimeout,
|
|
58
34
|
showFooter,
|
|
35
|
+
style,
|
|
59
36
|
} = allProps
|
|
60
37
|
|
|
61
|
-
const
|
|
62
|
-
variants,
|
|
63
|
-
responsiveVariants,
|
|
64
|
-
styles,
|
|
65
|
-
})
|
|
38
|
+
const styles = useStylesFor(List.styleRegistryName, style)
|
|
66
39
|
|
|
67
40
|
const { layoutProps, onLoadMore } = useInfiniteScroll(allProps)
|
|
68
41
|
|
|
@@ -72,7 +45,7 @@ export function List<T = any>(props: ListProps<T>) {
|
|
|
72
45
|
})
|
|
73
46
|
|
|
74
47
|
const separator = React.useMemo(() => {
|
|
75
|
-
return separators ? <ListSeparatorComponent separatorStyles={
|
|
48
|
+
return separators ? <ListSeparatorComponent separatorStyles={styles.separator} /> : null
|
|
76
49
|
}, [])
|
|
77
50
|
|
|
78
51
|
const renderItem = React.useCallback((_item: ItemMasonryProps<any>) => {
|
|
@@ -102,7 +75,7 @@ export function List<T = any>(props: ListProps<T>) {
|
|
|
102
75
|
<ListLayout
|
|
103
76
|
{...allProps}
|
|
104
77
|
{...layoutProps}
|
|
105
|
-
|
|
78
|
+
styles={styles}
|
|
106
79
|
showFooter={reloadingLayout ? false : showFooter}
|
|
107
80
|
>
|
|
108
81
|
<ListMasonry
|
|
@@ -121,4 +94,26 @@ export function List<T = any>(props: ListProps<T>) {
|
|
|
121
94
|
)
|
|
122
95
|
}
|
|
123
96
|
|
|
124
|
-
List.
|
|
97
|
+
List.styleRegistryName = 'List'
|
|
98
|
+
List.elements = ['wrapper', 'innerWrapper', 'separator', 'refreshControl', 'refreshControlIndicator']
|
|
99
|
+
List.rootElement = 'wrapper'
|
|
100
|
+
|
|
101
|
+
List.withVariantTypes = <S extends AnyRecord>(styles: S) => {
|
|
102
|
+
return List as <T extends ListItem>(props: StyledComponentProps<ListProps<T>, typeof styles>) => IJSX
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
List.defaultProps = {
|
|
106
|
+
ListEmptyComponent: EmptyPlaceholder,
|
|
107
|
+
ListSeparatorComponent: RenderSeparator,
|
|
108
|
+
refreshDebounce: 1500,
|
|
109
|
+
refreshSize: 40,
|
|
110
|
+
refreshThreshold: 0.1,
|
|
111
|
+
refreshPosition: 16,
|
|
112
|
+
refresh: true,
|
|
113
|
+
rowItemsSpacing: 8,
|
|
114
|
+
overscan: 2,
|
|
115
|
+
reloadTimeout: 350,
|
|
116
|
+
showFooter: true,
|
|
117
|
+
} as Partial<ListProps>
|
|
118
|
+
|
|
119
|
+
WebStyleRegistry.registerComponent(List)
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
import { createDefaultVariantFactory, includePresets } from '@codeleap/common'
|
|
2
|
-
import { ViewComposition } from '../View'
|
|
3
1
|
|
|
4
|
-
type ListStates = 'empty' | 'loading'
|
|
2
|
+
type ListStates = 'empty' | 'loading'
|
|
5
3
|
|
|
6
|
-
export type ListParts =
|
|
7
|
-
|
|
8
|
-
'innerWrapper' |
|
|
9
|
-
'separator' |
|
|
4
|
+
export type ListParts =
|
|
5
|
+
'wrapper' |
|
|
6
|
+
'innerWrapper' |
|
|
7
|
+
'separator' |
|
|
10
8
|
'refreshControl' |
|
|
11
9
|
'refreshControlIndicator'
|
|
12
10
|
|
|
13
11
|
export type ListComposition = `${ListParts}:${ListStates}` | ListParts
|
|
14
|
-
|
|
15
|
-
const createListStyle = createDefaultVariantFactory<ListComposition>()
|
|
16
|
-
|
|
17
|
-
export const ListPresets = includePresets(style => createListStyle(() => ({ wrapper: style })))
|
|
@@ -1,13 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { StylesOf } from '@codeleap/common'
|
|
2
2
|
import { EmptyPlaceholderProps } from '../EmptyPlaceholder'
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { motion } from 'framer-motion'
|
|
3
|
+
import { ViewProps } from '../View'
|
|
4
|
+
import { MotionProps } from 'framer-motion'
|
|
6
5
|
import { ActivityIndicatorProps } from '../ActivityIndicator'
|
|
7
6
|
import { ComponentCommonProps } from '../../types'
|
|
8
|
-
import { UseInfiniteScrollArgs } from '
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
7
|
+
import { ItemMasonryProps, ListMasonryProps, UseInfiniteScrollArgs, UseInfiniteScrollReturn } from '../../lib'
|
|
8
|
+
import { ListComposition } from './styles'
|
|
9
|
+
import { StyledProp } from '@codeleap/styles'
|
|
10
|
+
|
|
11
|
+
export type ListLayoutProps = Omit<ListProps, 'renderItem'> & UseInfiniteScrollReturn['layoutProps'] & {
|
|
12
|
+
styles: StylesOf<ListComposition>
|
|
13
|
+
children?: React.ReactNode
|
|
14
|
+
showFooter?: boolean
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type ListRefreshControlComponent = Partial<ListLayoutProps> & {
|
|
18
|
+
styles: StylesOf<ListComposition>
|
|
19
|
+
}
|
|
11
20
|
|
|
12
21
|
export type AugmentedRenderItemInfo<T> = ItemMasonryProps<T> & {
|
|
13
22
|
item: T
|
|
@@ -16,26 +25,27 @@ export type AugmentedRenderItemInfo<T> = ItemMasonryProps<T> & {
|
|
|
16
25
|
isOnly: boolean
|
|
17
26
|
}
|
|
18
27
|
|
|
19
|
-
export type
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
28
|
+
export type ListItem = {
|
|
29
|
+
id: string | number
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export type ListProps<T extends ListItem = ListItem> =
|
|
33
|
+
ComponentCommonProps &
|
|
34
|
+
UseInfiniteScrollArgs &
|
|
35
|
+
{
|
|
36
|
+
data: T[]
|
|
26
37
|
isFetching?: boolean
|
|
27
38
|
hasNextPage?: boolean
|
|
28
39
|
separators?: boolean
|
|
29
40
|
onRefresh?: () => void
|
|
30
|
-
placeholder?: EmptyPlaceholderProps
|
|
31
|
-
styles?: StylesOf<ListComposition>
|
|
41
|
+
placeholder?: Omit<EmptyPlaceholderProps, 'debugName'>
|
|
32
42
|
keyExtractor?: (item: T, index: number) => string
|
|
33
43
|
renderItem: (data: AugmentedRenderItemInfo<T>) => React.ReactElement
|
|
34
44
|
ListFooterComponent?: (props: ListLayoutProps) => React.ReactElement
|
|
35
45
|
ListLoadingIndicatorComponent?: () => React.ReactElement
|
|
36
46
|
ListRefreshControlComponent?: () => React.ReactElement
|
|
37
47
|
ListEmptyComponent?: React.FC | ((props: EmptyPlaceholderProps) => React.ReactElement)
|
|
38
|
-
ListSeparatorComponent?: React.FC | ((props: { separatorStyles: ViewProps
|
|
48
|
+
ListSeparatorComponent?: React.FC | ((props: { separatorStyles: ViewProps['style'] }) => React.ReactElement)
|
|
39
49
|
isLoading?: boolean
|
|
40
50
|
isFetchingNextPage?: boolean
|
|
41
51
|
fetchNextPage?: () => void
|
|
@@ -45,13 +55,13 @@ Data = T extends Array<infer D> ? D : never
|
|
|
45
55
|
refreshThreshold?: number
|
|
46
56
|
refreshPosition?: number
|
|
47
57
|
refresh?: boolean
|
|
48
|
-
refreshControlProps?:
|
|
58
|
+
refreshControlProps?: Partial<MotionProps>
|
|
49
59
|
refreshControlIndicatorProps?: Partial<ActivityIndicatorProps>
|
|
50
|
-
style?:
|
|
60
|
+
style?: StyledProp<ListComposition>
|
|
51
61
|
ref?: React.MutableRefObject<undefined>
|
|
52
62
|
rowItemsSpacing?: number
|
|
53
63
|
overscan?: number
|
|
54
64
|
masonryProps?: Partial<ListMasonryProps<T>>
|
|
55
65
|
reloadTimeout?: number
|
|
56
66
|
showFooter?: boolean
|
|
57
|
-
}
|
|
67
|
+
}
|
|
@@ -1,49 +1,47 @@
|
|
|
1
|
-
import { ComponentVariants, getNestedStylesByKey, useDefaultComponentStyle } from '@codeleap/common'
|
|
2
1
|
import React from 'react'
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
style?: React.CSSProperties
|
|
13
|
-
indicatorProps?: ActivityIndicatorProps
|
|
14
|
-
children?: React.ReactNode
|
|
15
|
-
} & ComponentVariants<typeof LoadingOverlayPresets> & ComponentCommonProps
|
|
2
|
+
import { View } from '../View'
|
|
3
|
+
import { ActivityIndicator } from '../ActivityIndicator'
|
|
4
|
+
import { LoadingOverlayProps } from './types'
|
|
5
|
+
import { useStylesFor } from '../../lib/hooks/useStylesFor'
|
|
6
|
+
import { AnyRecord, IJSX, StyledComponentProps, useNestedStylesByKey } from '@codeleap/styles'
|
|
7
|
+
import { WebStyleRegistry } from '../../lib/WebStyleRegistry'
|
|
8
|
+
|
|
9
|
+
export * from './styles'
|
|
10
|
+
export * from './types'
|
|
16
11
|
|
|
17
12
|
export const LoadingOverlay = (props: LoadingOverlayProps) => {
|
|
18
|
-
const {
|
|
13
|
+
const {
|
|
19
14
|
visible,
|
|
20
15
|
children,
|
|
21
|
-
|
|
22
|
-
variants = [],
|
|
23
|
-
responsiveVariants = {},
|
|
24
|
-
style = {},
|
|
16
|
+
style,
|
|
25
17
|
indicatorProps,
|
|
26
18
|
debugName,
|
|
27
|
-
...rest
|
|
28
|
-
} =
|
|
19
|
+
...rest
|
|
20
|
+
} = {
|
|
21
|
+
...LoadingOverlay.defaultProps,
|
|
22
|
+
...props,
|
|
23
|
+
}
|
|
29
24
|
|
|
30
|
-
const
|
|
31
|
-
variants,
|
|
32
|
-
styles,
|
|
33
|
-
responsiveVariants,
|
|
34
|
-
rootElement: 'wrapper',
|
|
35
|
-
})
|
|
25
|
+
const styles = useStylesFor(LoadingOverlay.styleRegistryName, style)
|
|
36
26
|
|
|
37
|
-
const indicatorStyles =
|
|
38
|
-
return getNestedStylesByKey('indicator', variantStyles)
|
|
39
|
-
}, [variantStyles])
|
|
27
|
+
const indicatorStyles = useNestedStylesByKey('indicator', styles)
|
|
40
28
|
|
|
41
29
|
return (
|
|
42
|
-
<View
|
|
43
|
-
<ActivityIndicator debugName={debugName} {...indicatorProps}
|
|
30
|
+
<View {...rest} style={[styles.wrapper, visible && styles['wrapper:visible']]}>
|
|
31
|
+
<ActivityIndicator debugName={debugName} {...indicatorProps} style={indicatorStyles} />
|
|
44
32
|
{children}
|
|
45
33
|
</View>
|
|
46
34
|
)
|
|
47
35
|
}
|
|
48
36
|
|
|
49
|
-
|
|
37
|
+
LoadingOverlay.styleRegistryName = 'LoadingOverlay'
|
|
38
|
+
LoadingOverlay.elements = ['wrapper', 'indicator']
|
|
39
|
+
LoadingOverlay.rootElement = 'wrapper'
|
|
40
|
+
|
|
41
|
+
LoadingOverlay.withVariantTypes = <S extends AnyRecord>(styles: S) => {
|
|
42
|
+
return LoadingOverlay as (props: StyledComponentProps<LoadingOverlayProps, typeof styles>) => IJSX
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
LoadingOverlay.defaultProps = {} as Partial<LoadingOverlayProps>
|
|
46
|
+
|
|
47
|
+
WebStyleRegistry.registerComponent(LoadingOverlay)
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { ActivityIndicatorComposition } from '../ActivityIndicator'
|
|
2
|
+
|
|
3
|
+
type LoadingOverlayStates = 'visible'
|
|
3
4
|
|
|
4
|
-
type LoadingOverlayStates = 'visible'
|
|
5
|
-
|
|
6
5
|
export type LoadingOverlayParts = 'wrapper' | `indicator${Capitalize<ActivityIndicatorComposition>}`
|
|
7
6
|
|
|
8
7
|
export type LoadingOverlayComposition = `${LoadingOverlayParts}:${LoadingOverlayStates}` | LoadingOverlayParts
|
|
9
|
-
|
|
10
|
-
export const createLoadingOverlayStyle = createDefaultVariantFactory<LoadingOverlayComposition>()
|
|
11
|
-
|
|
12
|
-
export const LoadingOverlayPresets = includePresets(s => createLoadingOverlayStyle(() => ({wrapper: s})))
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { LoadingOverlayComposition } from './styles'
|
|
3
|
+
import { ViewProps } from '../View'
|
|
4
|
+
import { ActivityIndicatorProps } from '../ActivityIndicator'
|
|
5
|
+
import { ComponentCommonProps } from '../../types/utility'
|
|
6
|
+
import { StyledProp } from '@codeleap/styles'
|
|
7
|
+
|
|
8
|
+
export type LoadingOverlayProps =
|
|
9
|
+
Omit<ViewProps, 'style'> &
|
|
10
|
+
ComponentCommonProps &
|
|
11
|
+
{
|
|
12
|
+
visible?: boolean
|
|
13
|
+
style?: StyledProp<LoadingOverlayComposition>
|
|
14
|
+
indicatorProps?: ActivityIndicatorProps
|
|
15
|
+
children?: React.ReactNode
|
|
16
|
+
}
|