@codeleap/mobile 3.24.2 → 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.
Files changed (131) hide show
  1. package/package.json +6 -4
  2. package/src/Registry.ts +52 -0
  3. package/src/components/ActionIcon/index.tsx +55 -37
  4. package/src/components/ActionIcon/styles.ts +2 -4
  5. package/src/components/ActionIcon/types.ts +15 -0
  6. package/src/components/ActivityIndicator/index.tsx +42 -64
  7. package/src/components/ActivityIndicator/styles.ts +1 -10
  8. package/src/components/ActivityIndicator/types.ts +9 -0
  9. package/src/components/Autocomplete/index.tsx +46 -54
  10. package/src/components/Autocomplete/styles.ts +2 -5
  11. package/src/components/Autocomplete/types.ts +13 -23
  12. package/src/components/Avatar/index.tsx +59 -71
  13. package/src/components/Avatar/styles.ts +1 -9
  14. package/src/components/Avatar/types.ts +23 -0
  15. package/src/components/AvatarGroup/index.tsx +30 -44
  16. package/src/components/AvatarGroup/styles.ts +0 -6
  17. package/src/components/AvatarGroup/types.ts +10 -0
  18. package/src/components/Backdrop/index.tsx +51 -34
  19. package/src/components/Backdrop/styles.ts +5 -10
  20. package/src/components/Backdrop/types.ts +14 -0
  21. package/src/components/Badge/index.tsx +36 -62
  22. package/src/components/Badge/styles.ts +3 -11
  23. package/src/components/Badge/types.ts +27 -0
  24. package/src/components/Button/index.tsx +55 -82
  25. package/src/components/Button/styles.ts +13 -14
  26. package/src/components/Button/types.ts +20 -0
  27. package/src/components/Calendar/index.tsx +35 -29
  28. package/src/components/Checkbox/index.tsx +43 -64
  29. package/src/components/Checkbox/styles.ts +1 -6
  30. package/src/components/Checkbox/types.ts +13 -0
  31. package/src/components/DatePickerModal/index.tsx +50 -65
  32. package/src/components/DatePickerModal/styles.ts +9 -10
  33. package/src/components/DatePickerModal/types.ts +36 -54
  34. package/src/components/EmptyPlaceholder/index.tsx +40 -63
  35. package/src/components/EmptyPlaceholder/styles.ts +0 -5
  36. package/src/components/EmptyPlaceholder/types.ts +21 -0
  37. package/src/components/FileInput/index.tsx +11 -49
  38. package/src/components/FileInput/types.ts +27 -0
  39. package/src/components/Grid/index.tsx +84 -116
  40. package/src/components/Grid/styles.ts +0 -5
  41. package/src/components/Grid/types.ts +20 -0
  42. package/src/components/Icon/index.tsx +44 -79
  43. package/src/components/Icon/styles.ts +0 -6
  44. package/src/components/Icon/types.ts +15 -0
  45. package/src/components/Image/index.tsx +58 -78
  46. package/src/components/Image/styles.ts +1 -6
  47. package/src/components/Image/types.ts +18 -0
  48. package/src/components/ImageView/Spotlight.tsx +1 -4
  49. package/src/components/ImageView/component.tsx +1 -2
  50. package/src/components/InputBase/index.tsx +33 -24
  51. package/src/components/InputBase/styles.ts +66 -75
  52. package/src/components/InputBase/types.ts +3 -4
  53. package/src/components/InputBase/utils.ts +6 -4
  54. package/src/components/List/index.tsx +99 -151
  55. package/src/components/List/styles.ts +0 -6
  56. package/src/components/List/types.ts +41 -0
  57. package/src/components/LoadingOverlay/index.tsx +42 -29
  58. package/src/components/LoadingOverlay/styles.ts +7 -7
  59. package/src/components/LoadingOverlay/types.ts +9 -0
  60. package/src/components/Modal/index.tsx +80 -127
  61. package/src/components/Modal/styles.ts +0 -8
  62. package/src/components/Modal/types.ts +41 -0
  63. package/src/components/Navigation/Navigation.tsx +1 -0
  64. package/src/components/Navigation/types.ts +2 -9
  65. package/src/components/NumberIncrement/index.tsx +50 -60
  66. package/src/components/NumberIncrement/styles.ts +0 -5
  67. package/src/components/NumberIncrement/types.ts +32 -39
  68. package/src/components/Pager/index.tsx +42 -94
  69. package/src/components/Pager/styles.ts +1 -13
  70. package/src/components/Pager/types.ts +37 -0
  71. package/src/components/PaginationIndicator/index.tsx +51 -0
  72. package/src/components/PaginationIndicator/styles.ts +3 -0
  73. package/src/components/PaginationIndicator/types.ts +10 -0
  74. package/src/components/RadioInput/index.tsx +32 -57
  75. package/src/components/RadioInput/styles.ts +5 -7
  76. package/src/components/RadioInput/types.ts +31 -0
  77. package/src/components/RefreshControl/index.tsx +39 -19
  78. package/src/components/RefreshControl/styles.ts +1 -6
  79. package/src/components/RefreshControl/types.ts +9 -0
  80. package/src/components/Scroll/index.tsx +89 -105
  81. package/src/components/Scroll/styles.ts +0 -5
  82. package/src/components/Scroll/types.ts +21 -0
  83. package/src/components/SearchInput/index.tsx +90 -0
  84. package/src/components/Sections/index.tsx +111 -161
  85. package/src/components/Sections/styles.ts +0 -5
  86. package/src/components/Sections/types.ts +39 -0
  87. package/src/components/SegmentedControl/Option.tsx +46 -31
  88. package/src/components/SegmentedControl/index.tsx +86 -121
  89. package/src/components/SegmentedControl/styles.ts +15 -22
  90. package/src/components/SegmentedControl/types.ts +31 -0
  91. package/src/components/Select/index.tsx +71 -82
  92. package/src/components/Select/styles.ts +3 -5
  93. package/src/components/Select/types.ts +20 -25
  94. package/src/components/Slider/index.tsx +58 -43
  95. package/src/components/Slider/styles.ts +15 -6
  96. package/src/components/Slider/types.ts +9 -14
  97. package/src/components/Switch/index.tsx +43 -56
  98. package/src/components/Switch/styles.ts +1 -7
  99. package/src/components/Switch/types.ts +12 -0
  100. package/src/components/Text/index.tsx +56 -52
  101. package/src/components/Text/styles.ts +1 -7
  102. package/src/components/Text/types.ts +18 -0
  103. package/src/components/TextInput/index.tsx +49 -162
  104. package/src/components/TextInput/styles.ts +2 -8
  105. package/src/components/TextInput/types.ts +23 -0
  106. package/src/components/Touchable/index.tsx +44 -87
  107. package/src/components/Touchable/styles.ts +0 -9
  108. package/src/components/Touchable/types.ts +27 -0
  109. package/src/components/View/index.tsx +23 -92
  110. package/src/components/View/styles.ts +0 -6
  111. package/src/components/View/types.ts +13 -0
  112. package/src/components/components.ts +2 -6
  113. package/src/hooks/index.ts +13 -0
  114. package/src/index.ts +2 -0
  115. package/src/modules/PressableRipple/type.ts +1 -0
  116. package/src/utils/KeyboardAware/context.tsx +0 -2
  117. package/src/utils/KeyboardAware/keyboardHooks.ts +1 -2
  118. package/src/utils/ModalManager/components.tsx +1 -30
  119. package/src/utils/ModalManager/context.tsx +4 -4
  120. package/src/utils/ModalManager/index.ts +1 -4
  121. package/src/utils/hooks.ts +12 -1
  122. package/src/components/Calendar/style.ts +0 -6
  123. package/src/components/ContentView/index.tsx +0 -63
  124. package/src/components/ContentView/styles.ts +0 -8
  125. package/src/components/Drawer/index.tsx +0 -28
  126. package/src/components/Drawer/styles.ts +0 -8
  127. package/src/components/FileInput/styles.ts +0 -8
  128. package/src/components/InputLabel/index.tsx +0 -38
  129. package/src/components/InputLabel/styles.ts +0 -7
  130. package/src/components/List/PaginationIndicator.tsx +0 -54
  131. package/src/components/defaultStyles.ts +0 -77
@@ -1,171 +1,119 @@
1
- import * as React from 'react'
2
- import { forwardRef } from 'react'
3
- import {
4
- useDefaultComponentStyle,
5
- ComponentVariants,
6
- useCallback,
7
- TypeGuards,
8
- } from '@codeleap/common'
9
-
10
- import { FlatListProps as RNFlatListProps, ListRenderItemInfo, StyleSheet, FlatList } from 'react-native'
1
+ import React, { forwardRef } from 'react'
2
+ import { useCallback, TypeGuards } from '@codeleap/common'
3
+ import { ListRenderItemInfo, FlatList } from 'react-native'
11
4
  import { View, ViewProps } from '../View'
12
- import { EmptyPlaceholder, EmptyPlaceholderProps } from '../EmptyPlaceholder'
13
- import { RefreshControl, RefreshControlProps } from '../RefreshControl'
14
- import { ListComposition, ListPresets } from './styles'
15
- import { StylesOf } from '../../types'
16
-
17
- import { KeyboardAwareFlatList } from 'react-native-keyboard-aware-scroll-view'
5
+ import { EmptyPlaceholder } from '../EmptyPlaceholder'
6
+ import { RefreshControl } from '../RefreshControl'
18
7
  import { useKeyboardPaddingStyle } from '../../utils'
19
-
20
- export type DataboundFlatListPropsTypes = 'data' | 'renderItem' | 'keyExtractor' | 'getItemLayout'
21
-
22
- export type AugmentedRenderItemInfo<T> = ListRenderItemInfo<T> & {
23
- isFirst: boolean
24
- isLast: boolean
25
- isOnly: boolean
26
- }
27
-
28
- export type ReplaceFlatlistProps<P, T> = Omit<P, DataboundFlatListPropsTypes> & {
29
- data: T[]
30
- keyExtractor?: (item: T, index: number) => string
31
- renderItem: (data: AugmentedRenderItemInfo<T>) => React.ReactElement
32
- onRefresh?: () => void
33
- getItemLayout?: ((
34
- data: T,
35
- index: number,
36
- ) => { length: number; offset: number; index: number })
37
- fakeEmpty?: boolean
38
- loading?: boolean
39
- }
8
+ import { AnyRecord, IJSX, StyledComponentProps, StyledComponentWithProps } from '@codeleap/styles'
9
+ import { FlatListProps, ListItem } from './types'
10
+ import { MobileStyleRegistry } from '../../Registry'
11
+ import { useStylesFor } from '../../hooks'
40
12
 
41
13
  export * from './styles'
42
- export * from './PaginationIndicator'
43
-
44
- export type FlatListProps<
45
- T = any[],
46
- Data = T extends Array<infer D> ? D : never
47
- > = ReplaceFlatlistProps<RNFlatListProps<Data>, Data> &
48
- Omit<ViewProps, 'variants'> & {
49
- separators?: boolean
50
- placeholder?: EmptyPlaceholderProps
51
- styles?: StylesOf<ListComposition>
52
- refreshControlProps?: Partial<RefreshControlProps>
53
- fakeEmpty?: boolean
54
- loading?: boolean
55
- keyboardAware?: boolean
56
- } & ComponentVariants<typeof ListPresets>
14
+ export * from './types'
57
15
 
58
16
  const RenderSeparator = (props: { separatorStyles: ViewProps['style'] }) => {
59
- return (
60
- <View style={props.separatorStyles}></View>
61
- )
17
+ return <View style={props.separatorStyles} />
62
18
  }
63
19
 
64
- const defaultProps: Partial<FlatListProps> = {
65
- keyboardShouldPersistTaps: 'handled',
66
- styles: {},
67
- variants: [],
68
- refreshControlProps: {},
69
- fakeEmpty: false,
70
- loading: false,
71
- keyboardAware: true,
72
- }
73
-
74
- const ListCP = forwardRef<FlatList, FlatListProps>(
75
- (flatListProps, ref) => {
76
- const {
77
- variants,
78
- style,
79
- styles,
80
- onRefresh,
81
- component,
82
- refreshing,
83
- placeholder,
84
- refreshControlProps,
85
- loading,
86
- keyboardAware,
87
- fakeEmpty = loading,
88
- contentContainerStyle,
89
- ...props
90
- } = {
91
- ...defaultProps,
92
- ...flatListProps,
20
+ export const List = forwardRef<FlatList, FlatListProps>((flatListProps, ref) => {
21
+ const {
22
+ style,
23
+ onRefresh,
24
+ component,
25
+ refreshing,
26
+ placeholder,
27
+ refreshControlProps,
28
+ loading,
29
+ keyboardAware,
30
+ fakeEmpty = loading,
31
+ contentContainerStyle,
32
+ renderItem: RenderItem,
33
+ data,
34
+ ...props
35
+ } = {
36
+ ...List.defaultProps,
37
+ ...flatListProps,
38
+ }
39
+
40
+ const styles = useStylesFor(List.styleRegistryName, style)
41
+
42
+ const separator = props?.separators && <RenderSeparator separatorStyles={styles.separator} />
43
+
44
+ const dataLength = data?.length || 0
45
+
46
+ const renderItem = useCallback((data: ListRenderItemInfo<any>) => {
47
+ if (!RenderItem) return null
48
+
49
+ const isFirst = data.index === 0
50
+ const isLast = data.index === dataLength - 1
51
+
52
+ const isOnly = isFirst && isLast
53
+
54
+ const itemProps = {
55
+ ...data,
56
+ isFirst,
57
+ isLast,
58
+ isOnly,
93
59
  }
94
60
 
95
- const variantStyles = useDefaultComponentStyle<'u:List', typeof ListPresets>('u:List', {
96
- variants,
97
- styles,
98
- transform: StyleSheet.flatten,
99
-
100
- })
61
+ return <RenderItem {...itemProps} />
62
+ }, [dataLength, RenderItem])
101
63
 
102
- // const isEmpty = !props.data || !props.data.length
103
- const separator = props?.separators && <RenderSeparator separatorStyles={variantStyles.separator} />
64
+ const isEmpty = !data || !data?.length
104
65
 
105
- const renderItem = useCallback((data: ListRenderItemInfo<any>) => {
106
- if (!props?.renderItem) return null
107
- const listLength = props?.data?.length || 0
66
+ const _placeholder = {
67
+ ...placeholder,
68
+ loading: TypeGuards.isBoolean(placeholder?.loading) ? placeholder.loading : loading,
69
+ }
108
70
 
109
- const isFirst = data.index === 0
110
- const isLast = data.index === listLength - 1
71
+ const keyboardStyle = useKeyboardPaddingStyle([
72
+ styles.content,
73
+ contentContainerStyle,
74
+ isEmpty && styles['content:empty'],
75
+ loading && styles['content:loading'],
76
+ ], keyboardAware && !props.horizontal)
111
77
 
112
- const isOnly = isFirst && isLast
78
+ const wrapperStyle = [styles.wrapper, isEmpty && styles['wrapper:empty'], loading && styles['wrapper:loading']]
113
79
 
114
- return props?.renderItem({
115
- ...data,
116
- isFirst,
117
- isLast,
118
- isOnly,
119
- })
120
- }, [props?.renderItem, props?.data?.length])
80
+ return (
81
+ <FlatList
82
+ ItemSeparatorComponent={separator as unknown as React.ComponentType}
83
+ refreshControl={!!onRefresh && (
84
+ <RefreshControl
85
+ refreshing={refreshing}
86
+ onRefresh={onRefresh}
87
+ {...refreshControlProps}
88
+ />
89
+ )}
90
+ ListEmptyComponent={<EmptyPlaceholder {..._placeholder} />}
91
+ showsVerticalScrollIndicator={false}
92
+ showsHorizontalScrollIndicator={false}
93
+ {...props}
94
+ ListHeaderComponentStyle={styles.header}
95
+ style={wrapperStyle}
96
+ contentContainerStyle={keyboardStyle}
97
+ data={fakeEmpty ? [] : data}
98
+ ref={ref}
99
+ renderItem={renderItem}
100
+ />
101
+ )
102
+ }) as StyledComponentWithProps<FlatListProps>
121
103
 
122
- const isEmpty = !props.data || !props.data.length
104
+ List.styleRegistryName = 'List'
105
+ List.elements = ['wrapper', 'content', 'separator', 'header', 'refreshControl']
106
+ List.rootElement = 'wrapper'
123
107
 
124
- const _placeholder = {
125
- ...placeholder,
126
- loading: TypeGuards.isBoolean(placeholder?.loading) ? placeholder.loading : loading,
127
- }
128
-
129
- const keyboardStyle = useKeyboardPaddingStyle([
130
- variantStyles.content,
131
- contentContainerStyle,
132
- isEmpty && variantStyles['content:empty'],
133
- ], keyboardAware && !props.horizontal)
134
-
135
- return (
136
- <FlatList
137
- style={[
138
- variantStyles.wrapper,
139
- style,
140
- isEmpty && variantStyles['wrapper:empty'],
141
- ]}
142
- contentContainerStyle={keyboardStyle}
143
- // @ts-expect-error This works
144
- ItemSeparatorComponent={separator}
145
- ListHeaderComponentStyle={variantStyles.header}
146
- refreshControl={!!onRefresh && (
147
- <RefreshControl
148
- refreshing={refreshing}
149
- onRefresh={onRefresh}
150
- {...refreshControlProps}
151
- />
152
- )}
153
-
154
- ListEmptyComponent={<EmptyPlaceholder {..._placeholder} />}
155
- {...props}
156
- data={fakeEmpty ? [] : props.data}
157
- ref={ref}
158
- renderItem={renderItem}
159
-
160
- />
161
- )
162
- },
163
- )
164
-
165
- export type ListComponentType = (<T extends any[] = any[]>(props: FlatListProps<T>) => JSX.Element) & {
166
- defaultProps: Partial<FlatListProps>
108
+ List.withVariantTypes = <S extends AnyRecord>(styles: S) => {
109
+ return List as <T extends ListItem>(props: StyledComponentProps<FlatListProps<T>, typeof styles>) => IJSX
167
110
  }
168
- export const List = ListCP as unknown as ListComponentType
169
111
 
170
- List.defaultProps = defaultProps
112
+ List.defaultProps = {
113
+ keyboardShouldPersistTaps: 'handled',
114
+ fakeEmpty: false,
115
+ loading: false,
116
+ keyboardAware: true,
117
+ } as Partial<FlatListProps>
171
118
 
119
+ MobileStyleRegistry.registerComponent(List)
@@ -1,13 +1,7 @@
1
- import { createDefaultVariantFactory, includePresets } from '@codeleap/common'
2
1
  import { ScrollComposition } from '../Scroll/styles'
3
2
 
4
-
5
3
  type ListStates = 'empty' | 'loading'
6
4
 
7
5
  type ListParts = ScrollComposition | 'separator' | 'header' | 'refreshControl'
8
6
 
9
7
  export type ListComposition = `${ListParts}:${ListStates}` | ListParts
10
-
11
- const createListStyle = createDefaultVariantFactory<ListComposition>()
12
-
13
- export const ListPresets = includePresets(style => createListStyle(() => ({ content: style })))
@@ -0,0 +1,41 @@
1
+ import { StyledProp } from '@codeleap/styles'
2
+ import { ListRenderItemInfo, FlatListProps as RNFlatListProps } from 'react-native'
3
+ import { ListComposition } from './styles'
4
+ import { EmptyPlaceholderProps } from '../EmptyPlaceholder'
5
+ import { RefreshControlProps } from '../RefreshControl'
6
+ import { ViewProps } from '../View'
7
+
8
+ export type DataboundFlatListPropsTypes = 'data' | 'renderItem' | 'keyExtractor' | 'getItemLayout' | 'style'
9
+
10
+ export type AugmentedRenderItemInfo<T> = ListRenderItemInfo<T> & {
11
+ isFirst: boolean
12
+ isLast: boolean
13
+ isOnly: boolean
14
+ }
15
+
16
+ export type ReplaceFlatlistProps<P, T> =
17
+ Omit<P, DataboundFlatListPropsTypes> &
18
+ {
19
+ data: T[]
20
+ keyExtractor?: (item: T, index: number) => string
21
+ renderItem: (data: AugmentedRenderItemInfo<T>) => React.ReactElement
22
+ onRefresh?: () => void
23
+ getItemLayout?: ((data: T, index: number) => { length: number; offset: number; index: number })
24
+ fakeEmpty?: boolean
25
+ loading?: boolean
26
+ }
27
+
28
+ export type ListItem = any
29
+
30
+ export type FlatListProps<T extends ListItem = ListItem> =
31
+ ReplaceFlatlistProps<RNFlatListProps<T>, T> &
32
+ Omit<ViewProps, 'style'> &
33
+ {
34
+ separators?: boolean
35
+ placeholder?: EmptyPlaceholderProps
36
+ refreshControlProps?: Partial<RefreshControlProps>
37
+ fakeEmpty?: boolean
38
+ loading?: boolean
39
+ keyboardAware?: boolean
40
+ style?: StyledProp<ListComposition>
41
+ }
@@ -1,55 +1,68 @@
1
1
  import React, { useRef } from 'react'
2
- import { ComponentVariants, getNestedStylesByKey, onUpdate, useDefaultComponentStyle, useMemo } from '@codeleap/common'
3
- import { StyleSheet } from 'react-native'
4
- import { StylesOf } from '../../types'
5
2
  import { ActivityIndicator } from '../ActivityIndicator'
6
3
  import { View } from '../View'
7
- import { LoadingOverlayComposition, LoadingOverlayPresets } from './styles'
8
4
  import { useAnimatedVariantStyles } from '../../utils'
5
+ import { LoadingOverlayProps } from './types'
6
+ import { MobileStyleRegistry } from '../../Registry'
7
+ import { AnyRecord, useNestedStylesByKey, IJSX, StyledComponentProps } from '@codeleap/styles'
8
+ import { useStylesFor } from '../../hooks'
9
9
 
10
10
  export * from './styles'
11
-
12
- export type LoadingOverlayProps = React.PropsWithChildren<{
13
- variants?: ComponentVariants<typeof LoadingOverlayPresets>['variants']
14
- styles?: StylesOf<LoadingOverlayComposition>
15
- visible?: boolean
16
- } >
11
+ export * from './types'
17
12
 
18
13
  export const LoadingOverlay = (props: LoadingOverlayProps) => {
19
14
  const {
20
15
  children,
21
- styles,
22
- variants,
23
16
  visible,
24
- } = props
17
+ style,
18
+ } = {
19
+ ...LoadingOverlay.defaultProps,
20
+ ...props
21
+ }
25
22
 
26
- const variantStyles = useDefaultComponentStyle<'u:LoadingOverlay', typeof LoadingOverlayPresets>('u:LoadingOverlay', {
27
- variants,
28
- rootElement: 'wrapper',
29
- styles,
30
- transform: StyleSheet.flatten,
31
- })
23
+ const transition = useRef(null)
24
+
25
+ const styles = useStylesFor(LoadingOverlay.styleRegistryName, style)
32
26
 
33
- const loaderStyles = useMemo(() => getNestedStylesByKey('loader', variantStyles), [variantStyles])
27
+ const loaderStyles = useNestedStylesByKey('loader', styles)
34
28
 
35
29
  const wrapperAnimation = useAnimatedVariantStyles({
36
- variantStyles,
30
+ variantStyles: styles,
37
31
  animatedProperties: ['wrapper:visible', 'wrapper:hidden'],
38
32
  updater: (s) => {
39
33
  'worklet'
40
34
  return visible ? s['wrapper:visible'] : s['wrapper:hidden']
41
35
  },
42
- transition: variantStyles.transition,
36
+ transition: styles.transition,
43
37
  dependencies: [visible],
44
38
  })
45
-
46
39
 
47
- const transition = useRef(null)
48
40
  if (!transition.current) {
49
- transition.current = JSON.parse(JSON.stringify(variantStyles['wrapper:transition']))
41
+ transition.current = JSON.parse(JSON.stringify(styles['wrapper:transition']))
50
42
  }
51
- return <View style={[variantStyles.wrapper, wrapperAnimation]} animated transition={transition.current}>
52
- <ActivityIndicator styles={loaderStyles}/>
53
- {children}
54
- </View>
43
+
44
+ return (
45
+ <View
46
+ animated
47
+ animatedStyle={wrapperAnimation}
48
+ style={styles.wrapper}
49
+ // @ts-expect-error
50
+ transition={transition.current}
51
+ >
52
+ <ActivityIndicator style={loaderStyles} />
53
+ {children}
54
+ </View>
55
+ )
56
+ }
57
+
58
+ LoadingOverlay.styleRegistryName = 'LoadingOverlay'
59
+ LoadingOverlay.elements = ['wrapper', 'loader', 'transition']
60
+ LoadingOverlay.rootElement = 'wrapper'
61
+
62
+ LoadingOverlay.defaultProps = {} as Partial<LoadingOverlayProps>
63
+
64
+ LoadingOverlay.withVariantTypes = <S extends AnyRecord>(styles: S) => {
65
+ return LoadingOverlay as (props: StyledComponentProps<LoadingOverlayProps, typeof styles>) => IJSX
55
66
  }
67
+
68
+ MobileStyleRegistry.registerComponent(LoadingOverlay)
@@ -1,10 +1,10 @@
1
- import { createDefaultVariantFactory, includePresets } from '@codeleap/common'
2
1
  import { ActivityIndicatorComposition } from '../ActivityIndicator'
3
2
 
4
- type WrapperStates = 'hidden'| 'visible'
3
+ type WrapperStates = 'hidden' | 'visible'
5
4
 
6
- export type LoadingOverlayComposition = 'wrapper' | `wrapper:${WrapperStates}` | 'wrapper:transition' | `loader${Capitalize<ActivityIndicatorComposition>}` | 'transition'
7
-
8
- const createLoadingOverlayStyle = createDefaultVariantFactory<LoadingOverlayComposition>()
9
-
10
- export const LoadingOverlayPresets = includePresets((styles) => createLoadingOverlayStyle(() => ({ wrapper: styles })))
5
+ export type LoadingOverlayComposition =
6
+ 'wrapper' |
7
+ `wrapper:${WrapperStates}` |
8
+ 'wrapper:transition' |
9
+ `loader${Capitalize<ActivityIndicatorComposition>}` |
10
+ 'transition'
@@ -0,0 +1,9 @@
1
+ import { StyledProp } from '@codeleap/styles'
2
+ import { ReactNode } from 'react'
3
+ import { LoadingOverlayComposition } from './styles'
4
+
5
+ export type LoadingOverlayProps = {
6
+ style?: StyledProp<LoadingOverlayComposition>
7
+ visible?: boolean
8
+ children?: ReactNode
9
+ }