@codeleap/mobile 3.25.0 → 3.25.2
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 +4 -6
- package/src/components/ActionIcon/index.tsx +37 -55
- package/src/components/ActionIcon/styles.ts +4 -2
- package/src/components/ActivityIndicator/index.tsx +64 -42
- package/src/components/ActivityIndicator/styles.ts +10 -1
- package/src/components/Autocomplete/index.tsx +54 -46
- package/src/components/Autocomplete/styles.ts +5 -2
- package/src/components/Autocomplete/types.ts +23 -13
- package/src/components/Avatar/index.tsx +71 -59
- package/src/components/Avatar/styles.ts +9 -1
- package/src/components/AvatarGroup/index.tsx +44 -30
- package/src/components/AvatarGroup/styles.ts +6 -0
- package/src/components/Backdrop/index.tsx +34 -51
- package/src/components/Backdrop/styles.ts +10 -5
- package/src/components/Badge/index.tsx +62 -36
- package/src/components/Badge/styles.ts +11 -3
- package/src/components/Button/index.tsx +82 -55
- package/src/components/Button/styles.ts +14 -13
- package/src/components/Calendar/index.tsx +29 -35
- package/src/components/Calendar/style.ts +6 -0
- package/src/components/Checkbox/index.tsx +64 -43
- package/src/components/Checkbox/styles.ts +6 -1
- package/src/components/ContentView/index.tsx +63 -0
- package/src/components/ContentView/styles.ts +8 -0
- package/src/components/DatePickerModal/index.tsx +65 -50
- package/src/components/DatePickerModal/styles.ts +10 -9
- package/src/components/DatePickerModal/types.ts +54 -36
- package/src/components/Drawer/index.tsx +28 -0
- package/src/components/Drawer/styles.ts +8 -0
- package/src/components/EmptyPlaceholder/index.tsx +63 -40
- package/src/components/EmptyPlaceholder/styles.ts +5 -0
- package/src/components/FileInput/index.tsx +49 -11
- package/src/components/FileInput/styles.ts +8 -0
- package/src/components/Grid/index.tsx +116 -84
- package/src/components/Grid/styles.ts +5 -0
- package/src/components/Icon/index.tsx +79 -44
- package/src/components/Icon/styles.ts +6 -0
- package/src/components/Image/index.tsx +78 -58
- package/src/components/Image/styles.ts +6 -1
- package/src/components/ImageView/Spotlight.tsx +4 -1
- package/src/components/ImageView/component.tsx +2 -1
- package/src/components/InputBase/index.tsx +24 -33
- package/src/components/InputBase/styles.ts +75 -66
- package/src/components/InputBase/types.ts +4 -3
- package/src/components/InputBase/utils.ts +4 -6
- package/src/components/InputLabel/index.tsx +38 -0
- package/src/components/InputLabel/styles.ts +7 -0
- package/src/components/List/PaginationIndicator.tsx +54 -0
- package/src/components/List/index.tsx +151 -99
- package/src/components/List/styles.ts +6 -0
- package/src/components/LoadingOverlay/index.tsx +29 -42
- package/src/components/LoadingOverlay/styles.ts +7 -7
- package/src/components/Modal/index.tsx +127 -80
- package/src/components/Modal/styles.ts +8 -0
- package/src/components/Navigation/Navigation.tsx +0 -1
- package/src/components/Navigation/types.ts +9 -2
- package/src/components/NumberIncrement/index.tsx +60 -50
- package/src/components/NumberIncrement/styles.ts +5 -0
- package/src/components/NumberIncrement/types.ts +39 -32
- package/src/components/Pager/index.tsx +94 -42
- package/src/components/Pager/styles.ts +13 -1
- package/src/components/RadioInput/index.tsx +57 -32
- package/src/components/RadioInput/styles.ts +7 -5
- package/src/components/RefreshControl/index.tsx +19 -39
- package/src/components/RefreshControl/styles.ts +6 -1
- package/src/components/Scroll/index.tsx +105 -89
- package/src/components/Scroll/styles.ts +5 -0
- package/src/components/Sections/index.tsx +161 -111
- package/src/components/Sections/styles.ts +5 -0
- package/src/components/SegmentedControl/Option.tsx +31 -46
- package/src/components/SegmentedControl/index.tsx +121 -86
- package/src/components/SegmentedControl/styles.ts +22 -15
- package/src/components/Select/index.tsx +82 -71
- package/src/components/Select/styles.ts +5 -3
- package/src/components/Select/types.ts +25 -20
- package/src/components/Slider/index.tsx +43 -58
- package/src/components/Slider/styles.ts +6 -15
- package/src/components/Slider/types.ts +14 -9
- package/src/components/Switch/index.tsx +56 -43
- package/src/components/Switch/styles.ts +7 -1
- package/src/components/Text/index.tsx +52 -56
- package/src/components/Text/styles.ts +7 -1
- package/src/components/TextInput/index.tsx +162 -49
- package/src/components/TextInput/styles.ts +8 -2
- package/src/components/Touchable/index.tsx +87 -44
- package/src/components/Touchable/styles.ts +9 -0
- package/src/components/View/index.tsx +92 -23
- package/src/components/View/styles.ts +6 -0
- package/src/components/components.ts +6 -2
- package/src/components/defaultStyles.ts +77 -0
- package/src/index.ts +0 -2
- package/src/modules/PressableRipple/type.ts +0 -1
- package/src/utils/KeyboardAware/context.tsx +2 -0
- package/src/utils/KeyboardAware/keyboardHooks.ts +2 -1
- package/src/utils/ModalManager/components.tsx +30 -1
- package/src/utils/ModalManager/context.tsx +4 -4
- package/src/utils/ModalManager/index.ts +4 -1
- package/src/utils/hooks.ts +1 -12
- package/src/Registry.ts +0 -52
- package/src/components/ActionIcon/types.ts +0 -15
- package/src/components/ActivityIndicator/types.ts +0 -9
- package/src/components/Avatar/types.ts +0 -23
- package/src/components/AvatarGroup/types.ts +0 -10
- package/src/components/Backdrop/types.ts +0 -14
- package/src/components/Badge/types.ts +0 -27
- package/src/components/Button/types.ts +0 -20
- package/src/components/Checkbox/types.ts +0 -13
- package/src/components/EmptyPlaceholder/types.ts +0 -21
- package/src/components/FileInput/types.ts +0 -27
- package/src/components/Grid/types.ts +0 -20
- package/src/components/Icon/types.ts +0 -15
- package/src/components/Image/types.ts +0 -18
- package/src/components/List/types.ts +0 -41
- package/src/components/LoadingOverlay/types.ts +0 -9
- package/src/components/Modal/types.ts +0 -41
- package/src/components/Pager/types.ts +0 -37
- package/src/components/PaginationIndicator/index.tsx +0 -51
- package/src/components/PaginationIndicator/styles.ts +0 -3
- package/src/components/PaginationIndicator/types.ts +0 -10
- package/src/components/RadioInput/types.ts +0 -31
- package/src/components/RefreshControl/types.ts +0 -9
- package/src/components/Scroll/types.ts +0 -21
- package/src/components/SearchInput/index.tsx +0 -90
- package/src/components/Sections/types.ts +0 -39
- package/src/components/SegmentedControl/types.ts +0 -31
- package/src/components/Switch/types.ts +0 -12
- package/src/components/Text/types.ts +0 -18
- package/src/components/TextInput/types.ts +0 -23
- package/src/components/Touchable/types.ts +0 -27
- package/src/components/View/types.ts +0 -13
- package/src/hooks/index.ts +0 -13
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { StyledProp } from '@codeleap/styles'
|
|
2
|
-
import { FlatListProps, AugmentedRenderItemInfo, ListItem } from '../List'
|
|
3
|
-
import { GridComposition } from './styles'
|
|
4
|
-
|
|
5
|
-
export type GridAugmentedRenderItemInfo<T> =
|
|
6
|
-
AugmentedRenderItemInfo<T> &
|
|
7
|
-
{
|
|
8
|
-
isFirstInRow: boolean
|
|
9
|
-
isLastInRow: boolean
|
|
10
|
-
isOnlyInRow: boolean
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export type GridProps<T extends ListItem = ListItem> =
|
|
14
|
-
Omit<FlatListProps<T>, 'style' | 'renderItem'> &
|
|
15
|
-
{
|
|
16
|
-
spacing?: number
|
|
17
|
-
itemDimension?: number
|
|
18
|
-
renderItem: (data: GridAugmentedRenderItemInfo<T>) => React.ReactElement
|
|
19
|
-
style?: StyledProp<GridComposition>
|
|
20
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { AppIcon, StyledProp } from '@codeleap/styles'
|
|
2
|
-
import { BadgeComponentProps } from '../Badge'
|
|
3
|
-
import { ViewProps } from '../View'
|
|
4
|
-
import { IconComposition } from './styles'
|
|
5
|
-
|
|
6
|
-
export type IconProps =
|
|
7
|
-
BadgeComponentProps &
|
|
8
|
-
{
|
|
9
|
-
name: AppIcon
|
|
10
|
-
style?: StyledProp<IconComposition>
|
|
11
|
-
color?: string
|
|
12
|
-
wrapperProps?: ViewProps
|
|
13
|
-
size?: number
|
|
14
|
-
source?: string
|
|
15
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { LoadingOverlayProps } from '../LoadingOverlay'
|
|
2
|
-
import FastImage, { Source } from 'react-native-fast-image'
|
|
3
|
-
import { ImageProps as RNImageProps } from 'react-native'
|
|
4
|
-
import { ImageComposition } from './styles'
|
|
5
|
-
import { StyledProp } from '@codeleap/styles'
|
|
6
|
-
import { FormTypes } from '@codeleap/common'
|
|
7
|
-
|
|
8
|
-
export type ImageProps =
|
|
9
|
-
Omit<RNImageProps, 'source' | 'style'> &
|
|
10
|
-
{
|
|
11
|
-
fast?: boolean
|
|
12
|
-
style?: StyledProp<ImageComposition>
|
|
13
|
-
source: Source | FormTypes.AnyFile
|
|
14
|
-
resizeMode?: keyof typeof FastImage.resizeMode
|
|
15
|
-
spotlight?: string
|
|
16
|
-
maintainAspectRatio?: boolean
|
|
17
|
-
withLoadingOverlay?: boolean | ((props: LoadingOverlayProps) => JSX.Element)
|
|
18
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
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,9 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { PropsOf } from '@codeleap/common'
|
|
2
|
-
import { AppIcon, ICSS, StyledProp } from '@codeleap/styles'
|
|
3
|
-
import { ButtonProps } from '../Button'
|
|
4
|
-
import { Scroll } from '../Scroll'
|
|
5
|
-
import { ViewProps } from '../View'
|
|
6
|
-
import { ModalComposition } from './styles'
|
|
7
|
-
|
|
8
|
-
export type ModalProps =
|
|
9
|
-
Omit<ViewProps, 'style'> &
|
|
10
|
-
{
|
|
11
|
-
dismissOnBackdrop?: boolean
|
|
12
|
-
buttonProps?: ButtonProps
|
|
13
|
-
accessible?: boolean
|
|
14
|
-
showClose?: boolean
|
|
15
|
-
closable?: boolean
|
|
16
|
-
footer?: React.ReactNode
|
|
17
|
-
title?: React.ReactNode
|
|
18
|
-
debugName?: string
|
|
19
|
-
closeIconName?: AppIcon
|
|
20
|
-
visible?: boolean
|
|
21
|
-
toggle?: () => void
|
|
22
|
-
zIndex?: number
|
|
23
|
-
description?: React.ReactElement
|
|
24
|
-
scroll?: boolean
|
|
25
|
-
header?: React.ReactElement
|
|
26
|
-
closeOnHardwareBackPress?: boolean
|
|
27
|
-
renderHeader?: (props: ModalHeaderProps) => React.ReactElement
|
|
28
|
-
keyboardAware?: boolean
|
|
29
|
-
scrollProps?: PropsOf<typeof Scroll, 'ref'>
|
|
30
|
-
style?: StyledProp<ModalComposition>
|
|
31
|
-
id?: string
|
|
32
|
-
absolute?: boolean
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export type ModalHeaderProps =
|
|
36
|
-
Omit<ModalProps, 'renderHeader'> &
|
|
37
|
-
{
|
|
38
|
-
styles: Record<ModalComposition, ICSS>
|
|
39
|
-
buttonStyles: any
|
|
40
|
-
description?: React.ReactElement
|
|
41
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { StyledProp } from '@codeleap/styles'
|
|
2
|
-
import { ReactNode } from 'react'
|
|
3
|
-
import { NativeScrollEvent, NativeSyntheticEvent, ScrollViewProps } from 'react-native'
|
|
4
|
-
import { PagerComposition } from './styles'
|
|
5
|
-
|
|
6
|
-
export type PageProps = {
|
|
7
|
-
isLast: boolean
|
|
8
|
-
isFirst: boolean
|
|
9
|
-
isActive: boolean
|
|
10
|
-
isNext: boolean
|
|
11
|
-
page: number
|
|
12
|
-
index: number
|
|
13
|
-
isPrevious: boolean
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export type ScrollEvent = NativeSyntheticEvent<NativeScrollEvent>
|
|
17
|
-
|
|
18
|
-
export type PagerProps =
|
|
19
|
-
Omit<ScrollViewProps, 'style'> &
|
|
20
|
-
{
|
|
21
|
-
children?: (((pageData: PageProps) => ReactNode) | ReactNode)[]
|
|
22
|
-
page?: number
|
|
23
|
-
setPage?: (page: number) => void
|
|
24
|
-
returnEarly?: boolean
|
|
25
|
-
renderPageWrapper?: React.FC<PageProps>
|
|
26
|
-
pageWrapperProps?: any
|
|
27
|
-
width?: number
|
|
28
|
-
onScroll?: (event: ScrollEvent, args: { isLeft?: boolean; isRight?: boolean; x?: number }) => void
|
|
29
|
-
/** If TRUE render page, nextPage and prevPage only */
|
|
30
|
-
windowing?: boolean
|
|
31
|
-
scrollRightEnabled?: boolean
|
|
32
|
-
scrollLeftEnabled?: boolean
|
|
33
|
-
scrollDirectionThrottle?: number
|
|
34
|
-
onSwipeLastPage?: (event: ScrollEvent) => void
|
|
35
|
-
waitEventDispatchTimeout?: number
|
|
36
|
-
style?: StyledProp<PagerComposition>
|
|
37
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { TypeGuards } from '@codeleap/common'
|
|
3
|
-
import { ActivityIndicator } from '../ActivityIndicator'
|
|
4
|
-
import { Text } from '../Text'
|
|
5
|
-
import { AnyRecord, useNestedStylesByKey, IJSX, StyledComponentProps } from '@codeleap/styles'
|
|
6
|
-
import { MobileStyleRegistry } from '../../Registry'
|
|
7
|
-
import { useStylesFor } from '../../hooks'
|
|
8
|
-
import { PaginationIndicatorProps } from './types'
|
|
9
|
-
|
|
10
|
-
export const PaginationIndicator = (props: PaginationIndicatorProps) => {
|
|
11
|
-
const {
|
|
12
|
-
hasMore,
|
|
13
|
-
isFetching,
|
|
14
|
-
noMoreItemsText,
|
|
15
|
-
style,
|
|
16
|
-
activityIndicator,
|
|
17
|
-
} = {
|
|
18
|
-
...PaginationIndicator.defaultProps,
|
|
19
|
-
...props,
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const styles = useStylesFor(PaginationIndicator.styleRegistryName, style)
|
|
23
|
-
|
|
24
|
-
const loaderStyles = useNestedStylesByKey('loader', styles)
|
|
25
|
-
|
|
26
|
-
if (isFetching) {
|
|
27
|
-
return activityIndicator || <ActivityIndicator style={loaderStyles} />
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (!hasMore) {
|
|
31
|
-
if (TypeGuards.isString(noMoreItemsText) || TypeGuards.isNumber(noMoreItemsText)) {
|
|
32
|
-
return <Text style={styles.text} text={noMoreItemsText.toString()} />
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return noMoreItemsText
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return null
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
PaginationIndicator.styleRegistryName = 'PaginationIndicator'
|
|
42
|
-
PaginationIndicator.elements = ['text', 'loader']
|
|
43
|
-
PaginationIndicator.rootElement = 'text'
|
|
44
|
-
|
|
45
|
-
PaginationIndicator.withVariantTypes = <S extends AnyRecord>(styles: S) => {
|
|
46
|
-
return PaginationIndicator as (props: StyledComponentProps<PaginationIndicatorProps, typeof styles>) => IJSX
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
PaginationIndicator.defaultProps = {} as PaginationIndicatorProps
|
|
50
|
-
|
|
51
|
-
MobileStyleRegistry.registerComponent(PaginationIndicator)
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { StyledProp } from '@codeleap/styles'
|
|
2
|
-
import { PaginationIndicatorComposition } from './styles'
|
|
3
|
-
|
|
4
|
-
export type PaginationIndicatorProps = {
|
|
5
|
-
isFetching?: boolean
|
|
6
|
-
noMoreItemsText: JSX.Element | string | number
|
|
7
|
-
hasMore?: boolean
|
|
8
|
-
activityIndicator?: JSX.Element
|
|
9
|
-
style?: StyledProp<PaginationIndicatorComposition>
|
|
10
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { FormTypes, StylesOf } from '@codeleap/common'
|
|
2
|
-
import { StyledProp } from '@codeleap/styles'
|
|
3
|
-
import { ReactNode } from 'react'
|
|
4
|
-
import { RadioInputComposition } from './styles'
|
|
5
|
-
import { InputBaseProps } from '../InputBase'
|
|
6
|
-
|
|
7
|
-
type RadioOption<T> = FormTypes.Options<T>[number] & {
|
|
8
|
-
disabled?: boolean
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export type RadioGroupProps<T extends string | number> =
|
|
12
|
-
Omit<InputBaseProps, 'style'> &
|
|
13
|
-
{
|
|
14
|
-
options: RadioOption<T>[]
|
|
15
|
-
value: T
|
|
16
|
-
onValueChange(value: T): void
|
|
17
|
-
label: ReactNode
|
|
18
|
-
radioOnRight?: boolean
|
|
19
|
-
style?: StyledProp<RadioInputComposition>
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export type RadioOptionProps<T extends string | number> = {
|
|
23
|
-
item: RadioOption<T>
|
|
24
|
-
selected: boolean
|
|
25
|
-
onSelect(): void
|
|
26
|
-
debugName?: string
|
|
27
|
-
disabled?: boolean
|
|
28
|
-
separator?: boolean
|
|
29
|
-
reverseOrder?: boolean
|
|
30
|
-
styles?: StylesOf<RadioInputComposition>
|
|
31
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { StyledProp } from '@codeleap/styles'
|
|
2
|
-
import { RefreshControlProps as RNRefreshControlProps } from 'react-native'
|
|
3
|
-
import { RefreshControlComposition } from './styles'
|
|
4
|
-
|
|
5
|
-
export type RefreshControlProps =
|
|
6
|
-
Omit<RNRefreshControlProps, 'style'> &
|
|
7
|
-
{
|
|
8
|
-
style?: StyledProp<RefreshControlComposition>
|
|
9
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { StyledProp } from '@codeleap/styles'
|
|
2
|
-
import { KeyboardAwareScrollView, KeyboardAwareScrollViewProps } from 'react-native-keyboard-aware-scroll-view'
|
|
3
|
-
import { ScrollComposition } from './styles'
|
|
4
|
-
import { RefreshControlProps } from '../RefreshControl'
|
|
5
|
-
import { ViewProps } from '../View'
|
|
6
|
-
|
|
7
|
-
export type ScrollProps =
|
|
8
|
-
Omit<KeyboardAwareScrollViewProps, 'style'> &
|
|
9
|
-
Omit<ViewProps, 'style'> &
|
|
10
|
-
{
|
|
11
|
-
onRefresh?: () => void
|
|
12
|
-
refreshTimeout?: number
|
|
13
|
-
changeData?: any
|
|
14
|
-
keyboardAware?: boolean
|
|
15
|
-
refreshing?: boolean
|
|
16
|
-
refreshControlProps?: Partial<RefreshControlProps>
|
|
17
|
-
debugName?: string
|
|
18
|
-
style?: StyledProp<ScrollComposition>
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export type ScrollRef = KeyboardAwareScrollView
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react'
|
|
2
|
-
import { AppIcon } from '@codeleap/styles'
|
|
3
|
-
import { ComponentWithDefaultProps } from '../../types'
|
|
4
|
-
import { TextInputProps, TextInput } from '../TextInput'
|
|
5
|
-
import { TypeGuards } from '@codeleap/common'
|
|
6
|
-
|
|
7
|
-
export type SearchInputProps = {
|
|
8
|
-
onTypingChange: (isTyping: boolean) => void
|
|
9
|
-
onSearchChange: (search: string) => void
|
|
10
|
-
onValueChange?: (search: string) => void
|
|
11
|
-
onClear?: () => void
|
|
12
|
-
debugName: string
|
|
13
|
-
debounce?: number
|
|
14
|
-
clearIcon?: AppIcon
|
|
15
|
-
searchIcon?: AppIcon
|
|
16
|
-
placeholder: string
|
|
17
|
-
} & Partial<TextInputProps>
|
|
18
|
-
|
|
19
|
-
export const SearchInput: ComponentWithDefaultProps<SearchInputProps> = (props) => {
|
|
20
|
-
const {
|
|
21
|
-
debugName,
|
|
22
|
-
onClear,
|
|
23
|
-
onSearchChange,
|
|
24
|
-
onTypingChange,
|
|
25
|
-
clearIcon,
|
|
26
|
-
searchIcon,
|
|
27
|
-
debounce,
|
|
28
|
-
placeholder,
|
|
29
|
-
value,
|
|
30
|
-
onValueChange,
|
|
31
|
-
...others
|
|
32
|
-
} = {
|
|
33
|
-
...SearchInput.defaultProps,
|
|
34
|
-
...props,
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const [search, setSearch] = !TypeGuards.isNil(value) && !!onValueChange ? [value, onValueChange] : useState('')
|
|
38
|
-
|
|
39
|
-
const setSearchTimeout = React.useRef<NodeJS.Timeout | null>(null)
|
|
40
|
-
|
|
41
|
-
const handleChangeSearch = (value: string) => {
|
|
42
|
-
setSearch(value)
|
|
43
|
-
|
|
44
|
-
if (TypeGuards.isNil(debounce)) {
|
|
45
|
-
onSearchChange?.(value)
|
|
46
|
-
} else {
|
|
47
|
-
if (setSearchTimeout.current) {
|
|
48
|
-
clearTimeout(setSearchTimeout.current)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
setSearchTimeout.current = setTimeout(() => {
|
|
52
|
-
|
|
53
|
-
onSearchChange(value)
|
|
54
|
-
onTypingChange?.(false)
|
|
55
|
-
}, debounce ?? 0)
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const handleClear = () => {
|
|
60
|
-
setSearch('')
|
|
61
|
-
onSearchChange?.('')
|
|
62
|
-
onClear?.()
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return (
|
|
66
|
-
<TextInput
|
|
67
|
-
value={search}
|
|
68
|
-
onChangeText={(value) => {
|
|
69
|
-
onTypingChange?.(true)
|
|
70
|
-
handleChangeSearch(value)
|
|
71
|
-
}}
|
|
72
|
-
placeholder={placeholder}
|
|
73
|
-
debugName={`Search ${debugName}`}
|
|
74
|
-
rightIcon={!!search?.trim?.() && {
|
|
75
|
-
name: clearIcon,
|
|
76
|
-
onPress: handleClear,
|
|
77
|
-
}}
|
|
78
|
-
leftIcon={{
|
|
79
|
-
name: searchIcon,
|
|
80
|
-
}}
|
|
81
|
-
{...others}
|
|
82
|
-
/>
|
|
83
|
-
)
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
SearchInput.defaultProps = {
|
|
87
|
-
debounce: null,
|
|
88
|
-
clearIcon: 'x' as AppIcon,
|
|
89
|
-
searchIcon: 'search' as AppIcon,
|
|
90
|
-
} as Partial<SearchInputProps>
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { StyledProp } from '@codeleap/styles'
|
|
2
|
-
import { SectionListRenderItemInfo } from 'react-native'
|
|
3
|
-
import { SectionsComposition } from './styles'
|
|
4
|
-
import { SectionListProps as RNSectionListProps } from 'react-native'
|
|
5
|
-
import { ViewProps } from '../View'
|
|
6
|
-
import { EmptyPlaceholderProps } from '../EmptyPlaceholder'
|
|
7
|
-
import { RefreshControlProps } from '../RefreshControl'
|
|
8
|
-
|
|
9
|
-
export type DataboundSectionListPropsTypes = 'data' | 'renderItem' | 'keyExtractor' | 'getItemLayout' | 'style'
|
|
10
|
-
|
|
11
|
-
export type AugmentedSectionRenderItemInfo<T> = SectionListRenderItemInfo<T> & {
|
|
12
|
-
isFirst: boolean
|
|
13
|
-
isLast: boolean
|
|
14
|
-
isOnly: boolean
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export type ReplaceSectionListProps<P, T> = Omit<P, DataboundSectionListPropsTypes> & {
|
|
18
|
-
sections: T[]
|
|
19
|
-
keyExtractor?: (item: T, index: number) => string
|
|
20
|
-
renderItem: (data: AugmentedSectionRenderItemInfo<T>) => React.ReactElement
|
|
21
|
-
onRefresh?: () => void
|
|
22
|
-
getItemLayout?: ((data: T, index: number) => { length: number; offset: number; index: number })
|
|
23
|
-
fakeEmpty?: boolean
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export type SectionListProps<
|
|
27
|
-
T = any[],
|
|
28
|
-
Data = T extends Array<infer D> ? D : never
|
|
29
|
-
> =
|
|
30
|
-
ReplaceSectionListProps<RNSectionListProps<Data>, Data> &
|
|
31
|
-
Omit<ViewProps, 'style'> &
|
|
32
|
-
{
|
|
33
|
-
separators?: boolean
|
|
34
|
-
placeholder?: EmptyPlaceholderProps
|
|
35
|
-
refreshControlProps?: Partial<RefreshControlProps>
|
|
36
|
-
fakeEmpty?: boolean
|
|
37
|
-
keyboardAware?: boolean
|
|
38
|
-
style?: StyledProp<SectionsComposition>
|
|
39
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { ScrollProps, ScrollRef } from '../Scroll'
|
|
2
|
-
import { SegmentedControlOptionProps } from './Option'
|
|
3
|
-
import { TransitionConfig } from '../../utils'
|
|
4
|
-
import { TextProps } from '../Text'
|
|
5
|
-
import { TouchableProps } from '../Touchable'
|
|
6
|
-
import { FormTypes } from '@codeleap/common'
|
|
7
|
-
import { StyledProp } from '@codeleap/styles'
|
|
8
|
-
import { SegmentedControlComposition } from '../components'
|
|
9
|
-
|
|
10
|
-
export type SegmentedControlRef = ScrollRef & {
|
|
11
|
-
scrollTo: (index: number) => void
|
|
12
|
-
scrollToCurrent: () => void
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export type SegmentedControlProps<T = string> =
|
|
16
|
-
Omit<ScrollProps, 'style'> &
|
|
17
|
-
{
|
|
18
|
-
options: SegmentedControlOptionProps[]
|
|
19
|
-
onValueChange: (value: T) => any
|
|
20
|
-
value: T
|
|
21
|
-
debugName: string
|
|
22
|
-
animation?: TransitionConfig
|
|
23
|
-
textProps?: Partial<TextProps>
|
|
24
|
-
touchableProps?: Partial<TouchableProps>
|
|
25
|
-
label?: FormTypes.Label
|
|
26
|
-
renderOption?: (props: SegmentedControlOptionProps) => JSX.Element
|
|
27
|
-
renderBubble?: (props: Partial<SegmentedControlProps>) => JSX.Element
|
|
28
|
-
getItemWidth?: (item: { label: string; value: T }, idx: number, arr: { label: string; value: T }[]) => number
|
|
29
|
-
scrollToCurrentOptionOnMount?: boolean
|
|
30
|
-
style?: StyledProp<SegmentedControlComposition>
|
|
31
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { StyledProp } from '@codeleap/styles'
|
|
2
|
-
import { InputBaseProps } from '../InputBase'
|
|
3
|
-
import { SwitchComposition } from './styles'
|
|
4
|
-
|
|
5
|
-
export type SwitchProps =
|
|
6
|
-
Omit<InputBaseProps, 'style'> &
|
|
7
|
-
{
|
|
8
|
-
value: boolean
|
|
9
|
-
onValueChange: (value: boolean) => void
|
|
10
|
-
style?: StyledProp<SwitchComposition>
|
|
11
|
-
switchOnLeft?: boolean
|
|
12
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { StyledProp } from '@codeleap/styles'
|
|
2
|
-
import { ReactNode } from 'react'
|
|
3
|
-
import { TextProps as RNTextProps, Animated, ViewStyle, ImageStyle, TextStyle } from 'react-native'
|
|
4
|
-
import { AnimatedStyleProp } from 'react-native-reanimated'
|
|
5
|
-
import { TextComposition } from './styles'
|
|
6
|
-
|
|
7
|
-
export type TextProps =
|
|
8
|
-
Omit<RNTextProps, 'style'> &
|
|
9
|
-
{
|
|
10
|
-
text?: ReactNode
|
|
11
|
-
animated?: boolean
|
|
12
|
-
colorChangeConfig?: Partial<Animated.TimingAnimationConfig>
|
|
13
|
-
debugName?: string
|
|
14
|
-
debounce?: number
|
|
15
|
-
pressDisabled?: boolean
|
|
16
|
-
style?: StyledProp<TextComposition>
|
|
17
|
-
animatedStyle?: AnimatedStyleProp<ViewStyle | ImageStyle | TextStyle>
|
|
18
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { InputBaseProps } from '../InputBase'
|
|
2
|
-
import { TextInputProps as RNTextInputProps } from 'react-native'
|
|
3
|
-
import { AnyFunction, FormTypes, yup } from '@codeleap/common'
|
|
4
|
-
import { AppIcon, StyledProp } from '@codeleap/styles'
|
|
5
|
-
import { TextInputMaskProps } from '../../modules/textInputMask'
|
|
6
|
-
import { TextInputComposition } from './styles'
|
|
7
|
-
|
|
8
|
-
export type TextInputProps =
|
|
9
|
-
Omit<InputBaseProps, 'style'> &
|
|
10
|
-
Omit<RNTextInputProps, 'style'> &
|
|
11
|
-
{
|
|
12
|
-
password?: boolean
|
|
13
|
-
validate?: FormTypes.ValidatorFunctionWithoutForm | yup.SchemaOf<string>
|
|
14
|
-
debugName: string
|
|
15
|
-
visibilityToggle?: boolean
|
|
16
|
-
masking?: FormTypes.TextField['masking']
|
|
17
|
-
onChangeMask?: TextInputMaskProps['onChangeText']
|
|
18
|
-
visibleIcon?: AppIcon
|
|
19
|
-
hiddenIcon?: AppIcon
|
|
20
|
-
_error?: string
|
|
21
|
-
onPress?: AnyFunction
|
|
22
|
-
style?: StyledProp<TextInputComposition>
|
|
23
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { AnyFunction } from '@codeleap/common'
|
|
2
|
-
import { StyledProp } from '@codeleap/styles'
|
|
3
|
-
import { View as RNView, PressableProps } from 'react-native'
|
|
4
|
-
import { TouchableComposition } from './styles'
|
|
5
|
-
|
|
6
|
-
export type TouchableProps =
|
|
7
|
-
Omit<PressableProps, 'onPress' | 'children' | 'style'> &
|
|
8
|
-
{
|
|
9
|
-
component?: any
|
|
10
|
-
ref?: React.Ref<RNView>
|
|
11
|
-
debugName: string
|
|
12
|
-
activeOpacity?: number
|
|
13
|
-
debugComponent?: string
|
|
14
|
-
onPress?: AnyFunction
|
|
15
|
-
noFeedback?: boolean
|
|
16
|
-
debounce?: number
|
|
17
|
-
leadingDebounce?: boolean
|
|
18
|
-
setPressed?: (param: boolean) => void
|
|
19
|
-
rippleDisabled?: boolean
|
|
20
|
-
children?: React.ReactNode
|
|
21
|
-
style?: StyledProp<TouchableComposition>
|
|
22
|
-
analyticsEnabled?: boolean
|
|
23
|
-
analyticsName?: string
|
|
24
|
-
analyticsData?: Record<string, any>
|
|
25
|
-
dismissKeyboard?: boolean
|
|
26
|
-
disabled?: boolean
|
|
27
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { PropsOf } from '@codeleap/common'
|
|
2
|
-
import { StyledProp } from '@codeleap/styles'
|
|
3
|
-
import { ImageStyle, TextStyle, View as RNView, ViewStyle } from 'react-native'
|
|
4
|
-
import { AnimatedStyleProp } from 'react-native-reanimated'
|
|
5
|
-
import { ViewComposition } from './styles'
|
|
6
|
-
|
|
7
|
-
export type ViewProps<T extends React.ComponentType = typeof RNView> = {
|
|
8
|
-
component?: T
|
|
9
|
-
style?: StyledProp<ViewComposition>
|
|
10
|
-
animated?: boolean
|
|
11
|
-
children?: React.ReactNode
|
|
12
|
-
animatedStyle?: AnimatedStyleProp<ViewStyle | ImageStyle | TextStyle>
|
|
13
|
-
} & PropsOf<T>
|
package/src/hooks/index.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { StyleProp, useStyleObserver } from '@codeleap/styles'
|
|
2
|
-
import { useMemo } from 'react'
|
|
3
|
-
import { MobileStyleRegistry } from '../Registry'
|
|
4
|
-
|
|
5
|
-
export const useStylesFor = <T = unknown>(componentName: string, style: StyleProp<T, string>): T => {
|
|
6
|
-
const styleObserver = useStyleObserver(style)
|
|
7
|
-
|
|
8
|
-
const styles = useMemo(() => {
|
|
9
|
-
return MobileStyleRegistry.current.styleFor(componentName, style)
|
|
10
|
-
}, [styleObserver])
|
|
11
|
-
|
|
12
|
-
return styles
|
|
13
|
-
}
|