@codeleap/mobile 2.3.25 → 2.3.27

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 (139) hide show
  1. package/dist/components/ActionIcon/index.js +1 -5
  2. package/dist/components/ActionIcon/index.js.map +1 -1
  3. package/dist/components/ActivityIndicator/index.js +1 -5
  4. package/dist/components/ActivityIndicator/index.js.map +1 -1
  5. package/dist/components/Animated.d.ts +1 -110
  6. package/dist/components/Animated.js +1 -5
  7. package/dist/components/Animated.js.map +1 -1
  8. package/dist/components/AutoComplete/index.js +1 -5
  9. package/dist/components/AutoComplete/index.js.map +1 -1
  10. package/dist/components/Backdrop/index.d.ts +3 -3
  11. package/dist/components/Backdrop/index.js +2 -6
  12. package/dist/components/Backdrop/index.js.map +1 -1
  13. package/dist/components/Button/index.d.ts +4 -4
  14. package/dist/components/Button/index.js +1 -5
  15. package/dist/components/Button/index.js.map +1 -1
  16. package/dist/components/Calendar/index.js +1 -5
  17. package/dist/components/Calendar/index.js.map +1 -1
  18. package/dist/components/Checkbox/index.js +1 -5
  19. package/dist/components/Checkbox/index.js.map +1 -1
  20. package/dist/components/ContentView/index.js +1 -5
  21. package/dist/components/ContentView/index.js.map +1 -1
  22. package/dist/components/Drawer/index.js +1 -5
  23. package/dist/components/Drawer/index.js.map +1 -1
  24. package/dist/components/EmptyPlaceholder/index.js +1 -5
  25. package/dist/components/EmptyPlaceholder/index.js.map +1 -1
  26. package/dist/components/FileInput/index.js +1 -5
  27. package/dist/components/FileInput/index.js.map +1 -1
  28. package/dist/components/Grid/index.js +1 -5
  29. package/dist/components/Grid/index.js.map +1 -1
  30. package/dist/components/Icon/index.js +1 -5
  31. package/dist/components/Icon/index.js.map +1 -1
  32. package/dist/components/Image/index.js +1 -5
  33. package/dist/components/Image/index.js.map +1 -1
  34. package/dist/components/ImageView/Spotlight.d.ts +1 -1
  35. package/dist/components/ImageView/Spotlight.js +1 -5
  36. package/dist/components/ImageView/Spotlight.js.map +1 -1
  37. package/dist/components/ImageView/component.js +1 -5
  38. package/dist/components/ImageView/component.js.map +1 -1
  39. package/dist/components/ImageView/index.js +1 -5
  40. package/dist/components/ImageView/index.js.map +1 -1
  41. package/dist/components/InputLabel/index.js +1 -5
  42. package/dist/components/InputLabel/index.js.map +1 -1
  43. package/dist/components/List/index.js +1 -5
  44. package/dist/components/List/index.js.map +1 -1
  45. package/dist/components/Modal/index.js +1 -5
  46. package/dist/components/Modal/index.js.map +1 -1
  47. package/dist/components/MultiSelect/index.js +1 -5
  48. package/dist/components/MultiSelect/index.js.map +1 -1
  49. package/dist/components/Navigation/Navigation.js +1 -5
  50. package/dist/components/Navigation/Navigation.js.map +1 -1
  51. package/dist/components/Navigation/index.js +1 -5
  52. package/dist/components/Navigation/index.js.map +1 -1
  53. package/dist/components/Pager/index.js +1 -5
  54. package/dist/components/Pager/index.js.map +1 -1
  55. package/dist/components/RadioInput/index.js +1 -5
  56. package/dist/components/RadioInput/index.js.map +1 -1
  57. package/dist/components/Scroll/index.d.ts +105 -1
  58. package/dist/components/Scroll/index.js +2 -6
  59. package/dist/components/Scroll/index.js.map +1 -1
  60. package/dist/components/Sections/index.d.ts +105 -1
  61. package/dist/components/Sections/index.js +1 -5
  62. package/dist/components/Sections/index.js.map +1 -1
  63. package/dist/components/SegmentedControl/index.js +1 -5
  64. package/dist/components/SegmentedControl/index.js.map +1 -1
  65. package/dist/components/Select/index.js +1 -5
  66. package/dist/components/Select/index.js.map +1 -1
  67. package/dist/components/Slider/index.js +1 -5
  68. package/dist/components/Slider/index.js.map +1 -1
  69. package/dist/components/Switch/index.js +1 -5
  70. package/dist/components/Switch/index.js.map +1 -1
  71. package/dist/components/Text/index.js +1 -5
  72. package/dist/components/Text/index.js.map +1 -1
  73. package/dist/components/TextInput/index.js +1 -5
  74. package/dist/components/TextInput/index.js.map +1 -1
  75. package/dist/components/Touchable/index.d.ts +2 -2
  76. package/dist/components/Touchable/index.js +1 -5
  77. package/dist/components/Touchable/index.js.map +1 -1
  78. package/dist/components/View/index.d.ts +7 -116
  79. package/dist/components/View/index.js +2 -8
  80. package/dist/components/View/index.js.map +1 -1
  81. package/dist/components/components.d.ts +0 -2
  82. package/dist/components/components.js +1 -20
  83. package/dist/components/components.js.map +1 -1
  84. package/dist/index.js +1 -5
  85. package/dist/index.js.map +1 -1
  86. package/dist/modules/textInputMask.js +1 -5
  87. package/dist/modules/textInputMask.js.map +1 -1
  88. package/dist/types/index.js +1 -5
  89. package/dist/types/index.js.map +1 -1
  90. package/dist/types/utility.d.ts +8 -2
  91. package/dist/utils/KeyboardAware/index.js +1 -5
  92. package/dist/utils/KeyboardAware/index.js.map +1 -1
  93. package/dist/utils/KeyboardAware/lib/KeyboardAwareHOC.js +0 -12
  94. package/dist/utils/KeyboardAware/lib/KeyboardAwareHOC.js.map +1 -1
  95. package/dist/utils/ModalManager/components.js +1 -5
  96. package/dist/utils/ModalManager/components.js.map +1 -1
  97. package/dist/utils/ModalManager/context.js +1 -5
  98. package/dist/utils/ModalManager/context.js.map +1 -1
  99. package/dist/utils/OSAlert.js.map +1 -1
  100. package/dist/utils/PermissionManager/context.d.ts +1 -0
  101. package/dist/utils/PermissionManager/context.js +11 -8
  102. package/dist/utils/PermissionManager/context.js.map +1 -1
  103. package/dist/utils/index.js +1 -5
  104. package/dist/utils/index.js.map +1 -1
  105. package/package.json +9 -8
  106. package/src/components/Backdrop/index.tsx +5 -3
  107. package/src/components/Grid/index.tsx +4 -3
  108. package/src/components/ImageView/Spotlight.tsx +1 -1
  109. package/src/components/Pager/index.tsx +1 -0
  110. package/src/components/Scroll/index.tsx +1 -1
  111. package/src/components/SegmentedControl/index.tsx +1 -0
  112. package/src/components/Text/index.tsx +1 -0
  113. package/src/components/Touchable/index.tsx +17 -15
  114. package/src/components/View/index.tsx +16 -13
  115. package/src/components/components.ts +1 -4
  116. package/src/types/utility.ts +12 -5
  117. package/src/utils/KeyboardAware/lib/KeyboardAwareHOC.tsx +3 -29
  118. package/src/utils/PermissionManager/context.tsx +16 -4
  119. package/CodeLeap-Mobile-Packages.code-workspace +0 -8
  120. package/dist/components/legacy/Modal/index.d.ts +0 -28
  121. package/dist/components/legacy/Modal/index.js +0 -114
  122. package/dist/components/legacy/Modal/index.js.map +0 -1
  123. package/dist/components/legacy/Modal/styles.d.ts +0 -64
  124. package/dist/components/legacy/Modal/styles.js +0 -60
  125. package/dist/components/legacy/Modal/styles.js.map +0 -1
  126. package/dist/components/legacy/Pager/index.d.ts +0 -20
  127. package/dist/components/legacy/Pager/index.js +0 -168
  128. package/dist/components/legacy/Pager/index.js.map +0 -1
  129. package/dist/components/legacy/Pager/styles.d.ts +0 -54
  130. package/dist/components/legacy/Pager/styles.js +0 -44
  131. package/dist/components/legacy/Pager/styles.js.map +0 -1
  132. package/dist/components/legacy/index.d.ts +0 -2
  133. package/dist/components/legacy/index.js +0 -19
  134. package/dist/components/legacy/index.js.map +0 -1
  135. package/src/components/legacy/Modal/index.tsx +0 -163
  136. package/src/components/legacy/Modal/styles.ts +0 -125
  137. package/src/components/legacy/Pager/index.tsx +0 -242
  138. package/src/components/legacy/Pager/styles.ts +0 -51
  139. package/src/components/legacy/index.ts +0 -2
@@ -1,163 +0,0 @@
1
- import * as React from 'react'
2
- import { View, ViewProps, AnimatedView } from '../../View'
3
- import { Button, ButtonProps } from '../../Button'
4
- import { Scroll } from '../../Scroll'
5
- import {
6
- capitalize,
7
- ComponentVariants,
8
- IconPlaceholder,
9
- useDefaultComponentStyle,
10
- } from '@codeleap/common'
11
- import {
12
- MobileModalComposition,
13
- MobileModalStyles,
14
- MobileModalParts,
15
- } from './styles'
16
- import { StyleSheet } from 'react-native'
17
- import { StylesOf } from '../../../types/utility'
18
-
19
- import { Touchable } from '../../Touchable'
20
- import { Text } from '../../Text'
21
- import { Animated } from '../../Animated'
22
- import { GetKeyboardAwarePropsOptions } from '../../../utils'
23
-
24
- export * from './styles'
25
-
26
- export type ModalProps = Omit<ViewProps, 'variants' | 'styles'> & {
27
- variants?: ComponentVariants<typeof MobileModalStyles>['variants']
28
- styles?: StylesOf<MobileModalComposition>
29
- dismissOnBackdrop?: boolean
30
- buttonProps?: ButtonProps
31
- accessible?: boolean
32
- showClose?: boolean
33
- closable?: boolean
34
- footer?: React.ReactNode
35
- title?: React.ReactNode
36
- debugName?: string
37
- closeIconName?: IconPlaceholder
38
- visible: boolean
39
- toggle?: () => void
40
- zIndex?: number
41
- scroll?: boolean
42
- keyboardAware?: GetKeyboardAwarePropsOptions
43
- }
44
-
45
- export const Modal: React.FC<ModalProps> = (modalProps) => {
46
- const {
47
- variants = [],
48
- styles = {},
49
- visible,
50
- showClose,
51
- closable = true,
52
- title,
53
- footer,
54
- children,
55
- toggle = () => null,
56
- dismissOnBackdrop = true,
57
- closeIconName = 'close',
58
- debugName,
59
- scroll = true,
60
- keyboardAware,
61
- zIndex = null,
62
- ...props
63
- } = modalProps
64
-
65
- const variantStyles = useDefaultComponentStyle('Modal', {
66
- variants: variants as any,
67
- transform: StyleSheet.flatten,
68
- styles,
69
- }) as ModalProps['styles']
70
-
71
- function getStyles(key: MobileModalParts) {
72
- const s = [
73
- variantStyles[key],
74
- styles[key],
75
- visible ? variantStyles[key + ':visible'] : {},
76
- visible ? styles[key + ':visible'] : {},
77
- ]
78
-
79
- return s
80
- }
81
-
82
- const buttonStyles = React.useMemo(() => {
83
- const buttonEntries = {}
84
-
85
- for (const [key, style] of Object.entries(variantStyles)) {
86
- if (key.startsWith('closeButton')) {
87
- buttonEntries[capitalize(key.replace('closeButton', ''), true)] = style
88
- }
89
- }
90
- return buttonEntries
91
- }, [variantStyles])
92
-
93
- const boxAnimation = {
94
- hidden: {
95
- ...variantStyles['box:pose'],
96
- ...styles['box:pose'],
97
- },
98
- visible: {
99
- ...variantStyles['box:pose:visible'],
100
- ...styles['box:pose:visible'],
101
- },
102
- }
103
-
104
- const wrapperStyle = StyleSheet.flatten(getStyles('wrapper'))
105
- return (
106
- <View
107
- style={[wrapperStyle, { zIndex: typeof zIndex === 'number' ? zIndex : wrapperStyle?.zIndex }]}
108
- pointerEvents={visible ? 'auto' : 'none'}
109
- >
110
- <AnimatedView style={getStyles('overlay')} transition={'opacity'} />
111
- <Scroll
112
- style={getStyles('innerWrapper')}
113
- contentContainerStyle={getStyles('innerWrapperScroll')}
114
- scrollEnabled={scroll}
115
- keyboardAware={keyboardAware}
116
- >
117
- {dismissOnBackdrop && (
118
- <Touchable
119
- debugName={`${debugName} modal backdrop`}
120
- activeOpacity={1}
121
- onPress={() => toggle()}
122
- style={getStyles('touchableBackdrop')}
123
- />
124
- )}
125
- <Animated
126
- component='View'
127
- config={boxAnimation}
128
- pose={visible ? 'visible' : 'hidden'}
129
- style={getStyles('box')}
130
- >
131
- {(title || showClose) && (
132
- <View style={getStyles('header')}>
133
- {typeof title === 'string' ? (
134
- <Text text={title} style={getStyles('title')} />
135
- ) : (
136
- title
137
- )}
138
-
139
- {showClose && closable && (
140
- <Button
141
- debugName={`${debugName} modal close button`}
142
- icon={closeIconName as IconPlaceholder}
143
- variants={['icon']}
144
- onPress={toggle}
145
- styles={buttonStyles}
146
- />
147
- )}
148
- </View>
149
- )}
150
-
151
- <View style={getStyles('body')}>{children}</View>
152
- {footer && (
153
- <View style={getStyles('footer')}>
154
- {typeof footer === 'string' ? <Text text={footer} /> : footer}
155
- </View>
156
- )}
157
- </Animated>
158
- </Scroll>
159
- </View>
160
- )
161
- }
162
-
163
- export default Modal
@@ -1,125 +0,0 @@
1
- import {
2
- ButtonComposition,
3
- createDefaultVariantFactory,
4
- includePresets,
5
- ModalStyles,
6
- assignTextStyle,
7
- } from '@codeleap/common'
8
-
9
- export const modalTransition = {
10
- duration: 150,
11
- ease: 'easeOut',
12
- useNativeDriver: false,
13
- }
14
-
15
- export type MobileModalParts =
16
- | 'wrapper'
17
- | 'overlay'
18
- | 'innerWrapper'
19
- | 'innerWrapperScroll'
20
- | 'box'
21
- | 'footer'
22
- | 'body'
23
- | 'header'
24
- | 'touchableBackdrop'
25
- | 'box:pose'
26
- | 'title'
27
- | `closeButton${Capitalize<ButtonComposition>}`
28
-
29
- export type MobileModalComposition =
30
- | MobileModalParts
31
- | `${MobileModalParts}:visible`
32
-
33
- const createModalStyle = createDefaultVariantFactory<MobileModalComposition>()
34
-
35
- const presets = includePresets((style) => createModalStyle(() => ({ body: style })))
36
-
37
- const defaultModalStyles = ModalStyles
38
-
39
- export const MobileModalStyles = {
40
- ...defaultModalStyles,
41
- ...presets,
42
- default: createModalStyle((theme) => {
43
- const fullSize = {
44
- ...theme.presets.whole,
45
- position: 'absolute',
46
- width: theme?.values?.width,
47
- height: theme?.values?.height,
48
- }
49
-
50
- return {
51
- wrapper: {
52
- zIndex: 1,
53
-
54
- ...fullSize,
55
- },
56
-
57
- overlay: {
58
- opacity: 0,
59
-
60
- backgroundColor: theme.colors.black,
61
- ...fullSize,
62
- },
63
- 'overlay:visible': {
64
- opacity: 0.5,
65
- },
66
- innerWrapper: {},
67
- innerWrapperScroll: {
68
- display: 'flex',
69
- alignItems: 'center',
70
- ...theme.presets.justifyCenter,
71
- minHeight: theme.values.window.height,
72
- },
73
- box: {
74
- width: '80%',
75
- backgroundColor: theme.colors.background,
76
- borderRadius: theme.borderRadius.medium,
77
- ...theme.spacing.padding(2),
78
- },
79
- touchableBackdrop: {
80
- ...fullSize,
81
- },
82
- 'box:pose': {
83
- opacity: 0,
84
- scale: 0.8,
85
- transition: modalTransition,
86
- },
87
- 'box:pose:visible': {
88
- opacity: 1,
89
- scale: 1,
90
- transition: modalTransition,
91
- },
92
- header: {
93
- flexDirection: 'row',
94
- ...theme.presets.justifySpaceBetween,
95
- ...theme.presets.alignCenter,
96
- },
97
- closeButtonWrapper: {
98
- alignSelf: 'center',
99
- ...theme.spacing.marginLeft('auto'),
100
- },
101
- title: {
102
- ...theme.presets.textCenter,
103
- ...assignTextStyle('h3')(theme).text,
104
- ...theme.spacing.paddingBottom(1),
105
- flex: 1,
106
- },
107
- }
108
- }),
109
- popup: createModalStyle(() => ({})),
110
- fullscreen: createModalStyle((theme) => ({
111
- overlay: {
112
- backgroundColor: theme.colors.background,
113
- },
114
- 'overlay:visible': {
115
- opacity: 1,
116
- },
117
- box: {
118
- flex: 1,
119
- borderRadius: 0,
120
- width: theme.values.width,
121
- height: theme.values.window.height,
122
- ...theme.presets.center,
123
- },
124
- })),
125
- }
@@ -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'