@codeleap/mobile 2.3.5 → 2.3.6

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 (116) hide show
  1. package/package.json +3 -2
  2. package/src/components/ActionIcon/index.tsx +0 -32
  3. package/src/components/ActionIcon/styles.ts +0 -97
  4. package/src/components/ActivityIndicator/index.tsx +0 -50
  5. package/src/components/ActivityIndicator/styles.ts +0 -68
  6. package/src/components/Animated.tsx +0 -34
  7. package/src/components/AutoComplete/index.tsx +0 -163
  8. package/src/components/AutoComplete/styles.ts +0 -44
  9. package/src/components/Backdrop/index.tsx +0 -48
  10. package/src/components/Backdrop/styles.ts +0 -33
  11. package/src/components/Button/index.tsx +0 -155
  12. package/src/components/Button/styles.ts +0 -129
  13. package/src/components/Calendar/index.tsx +0 -65
  14. package/src/components/Calendar/style.ts +0 -35
  15. package/src/components/Calendar/types.ts +0 -102
  16. package/src/components/Checkbox/index.tsx +0 -91
  17. package/src/components/Checkbox/styles.ts +0 -81
  18. package/src/components/ContentView/index.tsx +0 -63
  19. package/src/components/ContentView/styles.ts +0 -24
  20. package/src/components/Drawer/index.tsx +0 -33
  21. package/src/components/Drawer/styles.ts +0 -43
  22. package/src/components/EmptyPlaceholder/index.tsx +0 -88
  23. package/src/components/EmptyPlaceholder/styles.ts +0 -58
  24. package/src/components/FileInput/index.tsx +0 -181
  25. package/src/components/FileInput/styles.ts +0 -15
  26. package/src/components/Grid/index.tsx +0 -117
  27. package/src/components/Grid/styles.ts +0 -11
  28. package/src/components/Icon/index.tsx +0 -69
  29. package/src/components/Icon/styles.ts +0 -57
  30. package/src/components/Image/index.tsx +0 -91
  31. package/src/components/Image/styles.ts +0 -20
  32. package/src/components/ImageView/Spotlight.tsx +0 -157
  33. package/src/components/ImageView/component.tsx +0 -38
  34. package/src/components/ImageView/index.ts +0 -2
  35. package/src/components/InputLabel/index.tsx +0 -38
  36. package/src/components/InputLabel/styles.ts +0 -19
  37. package/src/components/List/PaginationIndicator.tsx +0 -71
  38. package/src/components/List/index.tsx +0 -114
  39. package/src/components/List/styles.ts +0 -19
  40. package/src/components/Modal/index.tsx +0 -218
  41. package/src/components/Modal/styles.ts +0 -153
  42. package/src/components/MultiSelect/index.tsx +0 -138
  43. package/src/components/MultiSelect/styles.ts +0 -18
  44. package/src/components/MultiSelect/types.ts +0 -42
  45. package/src/components/Navigation/Navigation.tsx +0 -54
  46. package/src/components/Navigation/constants.ts +0 -8
  47. package/src/components/Navigation/index.tsx +0 -3
  48. package/src/components/Navigation/types.ts +0 -35
  49. package/src/components/Navigation/utils.tsx +0 -57
  50. package/src/components/Pager/index.tsx +0 -121
  51. package/src/components/Pager/styles.ts +0 -81
  52. package/src/components/RadioInput/index.tsx +0 -106
  53. package/src/components/RadioInput/styles.ts +0 -67
  54. package/src/components/Scroll/index.tsx +0 -124
  55. package/src/components/Scroll/styles.ts +0 -18
  56. package/src/components/Sections/index.tsx +0 -91
  57. package/src/components/SegmentedControl/index.tsx +0 -204
  58. package/src/components/SegmentedControl/styles.ts +0 -89
  59. package/src/components/Select/index.tsx +0 -167
  60. package/src/components/Select/styles.ts +0 -62
  61. package/src/components/Select/types.ts +0 -43
  62. package/src/components/Slider/Mark.tsx +0 -46
  63. package/src/components/Slider/Thumb.tsx +0 -29
  64. package/src/components/Slider/index.tsx +0 -130
  65. package/src/components/Slider/styles.ts +0 -76
  66. package/src/components/Slider/types.ts +0 -30
  67. package/src/components/Switch/index.tsx +0 -91
  68. package/src/components/Switch/styles.ts +0 -38
  69. package/src/components/Text/index.tsx +0 -123
  70. package/src/components/Text/styles.ts +0 -50
  71. package/src/components/TextInput/index.tsx +0 -319
  72. package/src/components/TextInput/styles.ts +0 -127
  73. package/src/components/Touchable/index.tsx +0 -174
  74. package/src/components/Touchable/styles.ts +0 -28
  75. package/src/components/View/index.tsx +0 -103
  76. package/src/components/View/styles.ts +0 -24
  77. package/src/components/components.ts +0 -42
  78. package/src/components/defaultStyles.ts +0 -62
  79. package/src/components/legacy/Modal/index.tsx +0 -163
  80. package/src/components/legacy/Modal/styles.ts +0 -125
  81. package/src/components/legacy/Pager/index.tsx +0 -242
  82. package/src/components/legacy/Pager/styles.ts +0 -51
  83. package/src/components/legacy/index.ts +0 -2
  84. package/src/modules/documentPicker.ts +0 -7
  85. package/src/modules/fastImage.ts +0 -2
  86. package/src/modules/imageCropPicker.d.ts +0 -497
  87. package/src/modules/index.d.ts +0 -682
  88. package/src/modules/reactNavigation.ts +0 -15
  89. package/src/modules/textInputMask.ts +0 -11
  90. package/src/modules/types/documentPicker.d.ts +0 -215
  91. package/src/modules/types/fileTypes.ts +0 -138
  92. package/src/modules/types/textInputMask.ts +0 -9
  93. package/src/types/index.ts +0 -1
  94. package/src/types/utility.ts +0 -9
  95. package/src/utils/KeyboardAware/context.tsx +0 -75
  96. package/src/utils/KeyboardAware/index.ts +0 -17
  97. package/src/utils/KeyboardAware/keyboardHooks.ts +0 -124
  98. package/src/utils/KeyboardAware/lib/KeyboardAwareFlatList.ts +0 -4
  99. package/src/utils/KeyboardAware/lib/KeyboardAwareHOC.tsx +0 -618
  100. package/src/utils/KeyboardAware/lib/KeyboardAwareInterface.ts +0 -13
  101. package/src/utils/KeyboardAware/lib/KeyboardAwareScrollView.ts +0 -6
  102. package/src/utils/KeyboardAware/lib/KeyboardAwareSectionList.ts +0 -6
  103. package/src/utils/KeyboardAware/types.ts +0 -159
  104. package/src/utils/ModalManager/components.tsx +0 -112
  105. package/src/utils/ModalManager/context.tsx +0 -260
  106. package/src/utils/ModalManager/index.ts +0 -16
  107. package/src/utils/OSAlert.ts +0 -180
  108. package/src/utils/PermissionManager/context.tsx +0 -302
  109. package/src/utils/PermissionManager/index.ts +0 -20
  110. package/src/utils/PermissionManager/types.ts +0 -24
  111. package/src/utils/hooks.ts +0 -163
  112. package/src/utils/index.ts +0 -11
  113. package/src/utils/input.ts +0 -51
  114. package/src/utils/misc.ts +0 -83
  115. package/src/utils/notifications.ts +0 -206
  116. package/src/utils/theme.ts +0 -58
@@ -1,242 +0,0 @@
1
- import {
2
- ComponentVariants,
3
- onUpdate,
4
- useDefaultComponentStyle,
5
- useDebounce,
6
- useCodeleapContext,
7
- } from '@codeleap/common'
8
- import React, {
9
- forwardRef,
10
- ReactNode,
11
- useImperativeHandle,
12
- useMemo,
13
- useRef,
14
- useState,
15
- } from 'react'
16
- import { StyleSheet } from 'react-native'
17
- import { StylesOf } from '../../../types/utility'
18
- import { Animated } from '../../Animated'
19
- import { Button } from '../../Button'
20
- import { View } from '../../View'
21
- import { Text } from '../../Text'
22
- import { MobilePagerStyles, PagerComposition } from './styles'
23
-
24
- export * from './styles'
25
-
26
- export type PagerProps = {
27
- variants?: ComponentVariants<typeof MobilePagerStyles>['variants']
28
- styles?: StylesOf<PagerComposition>
29
- page?: number
30
- loop?: boolean
31
- debug?: boolean
32
- children?: ReactNode
33
- onPageChange?: (page: number) => void
34
- }
35
-
36
- export type PagerRef = {
37
- forward(by?: number): void
38
- back(by?: number): void
39
- to(index?: number): void
40
- }
41
-
42
- export const Pager = forwardRef<PagerRef, PagerProps>((pagerProps, ref) => {
43
- const {
44
- children,
45
- styles,
46
- variants,
47
- page: propPage,
48
- debug,
49
- loop,
50
- onPageChange,
51
- } = pagerProps
52
-
53
- const [page, setPage] = useState(() => propPage ?? 0)
54
-
55
- const variantStyles = useDefaultComponentStyle<'u:Pager', typeof MobilePagerStyles>(
56
- 'u:Pager',
57
- {
58
- styles,
59
- transform: StyleSheet.flatten,
60
- variants,
61
- },
62
- )
63
- const { logger } = useCodeleapContext()
64
- const nChildren = React.Children.count(children)
65
-
66
- const lastPage = nChildren - 1
67
-
68
- const pagerRef = useRef<PagerRef>({
69
- forward: (by = 1) => {
70
- setPage((currentPage) => {
71
- if (currentPage < lastPage) {
72
- return currentPage + by
73
- } else if (loop) {
74
- return by - 1
75
- }
76
- return currentPage
77
- })
78
- },
79
- back: (by = 1) => {
80
- setPage((currentPage) => {
81
- if (currentPage > 0) {
82
- return currentPage - by
83
- } else if (loop) {
84
- return nChildren - by
85
- }
86
- return currentPage
87
- })
88
- },
89
- to: (n: number) => {
90
- if (n >= 0 && n <= lastPage) {
91
- setPage(n)
92
- } else {
93
- logger.warn(
94
- 'Attempted to go to a page which falls outside range',
95
- { currentPage: page, attemptedToGoTo: n, pageRange: [0, lastPage] },
96
- 'Component',
97
- )
98
- }
99
- },
100
- })
101
-
102
- onUpdate(() => {
103
- onPageChange?.(page)
104
- }, [page])
105
-
106
- onUpdate(() => {
107
- if (typeof propPage === 'number') {
108
- setPage(propPage)
109
- }
110
- }, [propPage])
111
-
112
- useImperativeHandle(ref, () => pagerRef.current)
113
-
114
- const pagePoses = useMemo(() => {
115
- return {
116
- current: variantStyles['page:pose:current'],
117
- next: variantStyles['page:pose:next'],
118
- previous: variantStyles['page:pose:previous'],
119
- }
120
- }, [variantStyles])
121
-
122
- return (
123
- <View style={variantStyles.wrapper}>
124
- {React.Children.map(children, (child, idx) => (
125
- <Page
126
- {...pagerProps}
127
- idx={idx}
128
- lastPage={lastPage}
129
- pagePoses={pagePoses}
130
- style={[variantStyles.page]}
131
- page={page}
132
- >
133
- {child}
134
- </Page>
135
- ))}
136
-
137
- {debug && (
138
- <View
139
- variants={['absolute']}
140
- style={{ bottom: 0, left: 0, right: 0 }}
141
- >
142
- <Button text='previous' debugName='Previous Pager' onPress={pagerRef.current.back} />
143
- <Text text={page.toString()} />
144
- <Button text='next' debugName='Next Pager' onPress={pagerRef.current.forward} />
145
- </View>
146
- )}
147
- </View>
148
-
149
- )
150
- })
151
- type PageProps = PagerProps & {
152
- idx: number
153
- lastPage: number
154
- page: number
155
- pagePoses: any
156
- style: any
157
- }
158
- const Page: React.FC<PageProps> = (pageProps) => {
159
- const {
160
- children: child,
161
- idx,
162
- loop,
163
- lastPage,
164
- page,
165
- style,
166
- pagePoses,
167
- } = pageProps
168
-
169
- if (!React.isValidElement(child)) return null
170
-
171
- // const isLast = idx === lastPage
172
- // const isFirst = idx === 0
173
-
174
- // const isLoopNext = (loop && isFirst && page === lastPage)
175
- // const isLoopPrevious = (loop && isLast && page === 0)
176
-
177
- // const isCurrent = idx === page
178
- // const isSequenceNext = idx === page + 1
179
- // const isSequencePrevious = idx === page - 1
180
-
181
- // const isNext = isSequenceNext || isLoopNext
182
-
183
- // const isPrevious = isSequencePrevious || isLoopPrevious
184
-
185
- // const isCurrentOrAdjacent = [
186
- // isCurrent,
187
- // isNext,
188
- // isPrevious
189
- // ].includes(true)
190
-
191
- // if(isCurrentOrAdjacent){
192
- // return <Animated
193
- // key={idx}
194
- // component='View'
195
- // config={pagePoses}
196
- // pose={isCurrent ? 'current' : (isNext ? 'next' : 'previous')}
197
- // style={[{
198
- // position: 'absolute',
199
- // top: 0,
200
-
201
- // },style]}
202
- // >
203
- // {child}
204
- // </Animated>
205
- // }
206
- const isCurrent = idx === page
207
- const isNext = idx > page
208
- const [_opacity, setOpacity] = useState(isCurrent ? 1 : 0)
209
-
210
- const [opacity, resetDebounceTimer] = useDebounce(_opacity, 800)
211
-
212
- onUpdate(() => {
213
- if (isCurrent) {
214
- setOpacity(1)
215
- } else {
216
- setOpacity(0)
217
- }
218
-
219
- return resetDebounceTimer
220
- }, [idx, page])
221
-
222
- return (
223
- <Animated
224
- key={idx}
225
- component='View'
226
- config={pagePoses}
227
- pose={isCurrent ? 'current' : isNext ? 'next' : 'previous'}
228
- style={[
229
- {
230
- position: 'absolute',
231
- top: 0,
232
- opacity: isCurrent ? _opacity : opacity,
233
- },
234
- style,
235
- ]}
236
- >
237
- {child}
238
- </Animated>
239
- )
240
-
241
- // return <View style={{display:'none'}} key={idx}>{child}</View>
242
- }
@@ -1,51 +0,0 @@
1
- import {
2
- createDefaultVariantFactory,
3
- includePresets,
4
- } from '@codeleap/common'
5
-
6
- export type PagerComposition =
7
- | 'page'
8
- | 'page:transition'
9
- | 'page:pose:previous'
10
- | 'page:pose:next'
11
- | 'page:pose:current'
12
- | 'wrapper'
13
-
14
- const createPagerStyle = createDefaultVariantFactory<PagerComposition>()
15
-
16
- const presets = includePresets((style) => createPagerStyle(() => ({ wrapper: style })),
17
- )
18
-
19
- export const MobilePagerStyles = {
20
- ...presets,
21
- default: createPagerStyle((Theme) => {
22
- const transition = {
23
- duration: 500,
24
- ease: 'easeInOut',
25
- useNativeDriver: true,
26
- }
27
-
28
- return {
29
- wrapper: {
30
- ...Theme.presets.full,
31
- },
32
- 'page:pose:next': {
33
- left: Theme.values.width * 1.8,
34
- transition: transition,
35
- },
36
- 'page:pose:current': {
37
- left: 0,
38
- transition: transition,
39
- },
40
- 'page:pose:previous': {
41
- left: -Theme.values.width * 1.8,
42
- transition: transition,
43
- },
44
- page: {
45
- width: '100%',
46
- height: '100%',
47
- },
48
- }
49
- }),
50
- pageless: createPagerStyle(() => ({})),
51
- }
@@ -1,2 +0,0 @@
1
- export * from './Modal'
2
- export * from './Pager'
@@ -1,7 +0,0 @@
1
- // @ts-ignore
2
- import DP from 'react-native-document-picker'
3
- import * as DocumentPickerTypes from './types/documentPicker'
4
-
5
- export const DocumentPicker = DP as DocumentPickerTypes.DocumentPicker
6
-
7
- export { default as ImageCropPicker } from 'react-native-image-crop-picker'
@@ -1,2 +0,0 @@
1
- // @ts-ignore
2
- export { default as FastImage } from 'react-native-fast-image'