@codeleap/mobile 1.4.0 → 1.5.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/dist/components/ActivityIndicator.js +3 -4
- package/dist/components/ActivityIndicator.js.map +1 -1
- package/dist/components/Button.d.ts +1 -1
- package/dist/components/Button.js +1 -1
- package/dist/components/Button.js.map +1 -1
- package/dist/components/Checkbox/index.js +1 -1
- package/dist/components/Checkbox/index.js.map +1 -1
- package/dist/components/FileInput.js +2 -2
- package/dist/components/FileInput.js.map +1 -1
- package/dist/components/Icon.d.ts +2 -1
- package/dist/components/Icon.js +9 -3
- package/dist/components/Icon.js.map +1 -1
- package/dist/components/Image.d.ts +2 -1
- package/dist/components/Image.js +9 -3
- package/dist/components/Image.js.map +1 -1
- package/dist/components/Modal/styles.d.ts +1 -1
- package/dist/components/Modal/styles.js +9 -1
- package/dist/components/Modal/styles.js.map +1 -1
- package/dist/components/Navigation/Navigation.js +11 -3
- package/dist/components/Navigation/Navigation.js.map +1 -1
- package/dist/components/Navigation/types.js.map +1 -1
- package/dist/components/Navigation/utils.js +3 -0
- package/dist/components/Navigation/utils.js.map +1 -1
- package/dist/components/Overlay.js +1 -1
- package/dist/components/Overlay.js.map +1 -1
- package/dist/components/Pager/index.js +2 -2
- package/dist/components/Pager/index.js.map +1 -1
- package/dist/components/RadioInput/index.js +2 -2
- package/dist/components/RadioInput/index.js.map +1 -1
- package/dist/components/Select/index.js +10 -9
- package/dist/components/Select/index.js.map +1 -1
- package/dist/components/Switch.js.map +1 -1
- package/dist/components/TextInput.d.ts +2 -0
- package/dist/components/TextInput.js +3 -3
- package/dist/components/TextInput.js.map +1 -1
- package/dist/components/Touchable.d.ts +1 -1
- package/dist/modules/documentPicker.js.map +1 -1
- package/dist/utils/OSAlert.d.ts +3 -3
- package/dist/utils/OSAlert.js +63 -10
- package/dist/utils/OSAlert.js.map +1 -1
- package/package.json +3 -1
- package/src/components/ActivityIndicator.tsx +6 -7
- package/src/components/Animated.tsx +7 -7
- package/src/components/Button.tsx +12 -14
- package/src/components/Checkbox/index.tsx +7 -6
- package/src/components/Checkbox/styles.ts +2 -2
- package/src/components/ContentView.tsx +4 -4
- package/src/components/FileInput.tsx +28 -27
- package/src/components/Icon.tsx +14 -4
- package/src/components/Image.tsx +19 -9
- package/src/components/List.tsx +7 -7
- package/src/components/Modal/index.tsx +15 -15
- package/src/components/Modal/styles.ts +18 -3
- package/src/components/Navigation/Navigation.tsx +22 -15
- package/src/components/Navigation/index.tsx +2 -2
- package/src/components/Navigation/types.ts +3 -5
- package/src/components/Navigation/utils.tsx +25 -20
- package/src/components/Overlay.tsx +9 -8
- package/src/components/Pager/index.tsx +20 -21
- package/src/components/Pager/styles.ts +1 -1
- package/src/components/RadioInput/index.tsx +17 -16
- package/src/components/RadioInput/styles.ts +3 -3
- package/src/components/Scroll.tsx +7 -7
- package/src/components/Sections.tsx +100 -0
- package/src/components/Select/index.tsx +36 -33
- package/src/components/Select/styles.ts +7 -7
- package/src/components/Select/types.ts +18 -18
- package/src/components/Slider/Mark.tsx +7 -7
- package/src/components/Slider/Thumb.tsx +1 -1
- package/src/components/Slider/index.tsx +14 -14
- package/src/components/Slider/types.ts +18 -18
- package/src/components/Switch.tsx +6 -7
- package/src/components/Text.tsx +3 -3
- package/src/components/TextInput.tsx +14 -13
- package/src/components/Touchable.tsx +7 -7
- package/src/components/View.tsx +3 -3
- package/src/modules/documentPicker.ts +3 -4
- package/src/modules/index.d.ts +82 -82
- package/src/modules/types/documentPicker.d.ts +191 -191
- package/src/modules/types/fileTypes.ts +138 -138
- package/src/types/utility.ts +1 -1
- package/src/utils/OSAlert.ts +83 -27
- package/src/utils/misc.ts +2 -2
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IconPlaceholder, useBooleanToggle, getNestedStylesByKey, useDefaultComponentStyle, TypeGuards } from '@codeleap/common'
|
|
2
2
|
import React, { useMemo } from 'react'
|
|
3
3
|
import { Modal, StyleSheet } from 'react-native'
|
|
4
4
|
import { Button } from '../Button'
|
|
5
5
|
import { Scroll } from '../Scroll'
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { InputLabel, TextInput } from '../TextInput'
|
|
8
8
|
import { Touchable } from '../Touchable'
|
|
9
9
|
import { AnimatedView, View } from '../View'
|
|
10
|
-
import { MobileSelectStyles } from './styles'
|
|
10
|
+
import { MobileSelectStyles } from './styles'
|
|
11
11
|
import { CustomSelectProps } from './types'
|
|
12
12
|
|
|
13
13
|
export const Select = <T extends string|number = string>(selectProps:CustomSelectProps<T>) => {
|
|
14
14
|
const {
|
|
15
15
|
value,
|
|
16
16
|
onValueChange,
|
|
17
|
-
label,
|
|
17
|
+
label,
|
|
18
18
|
styles = {},
|
|
19
19
|
options,
|
|
20
20
|
style,
|
|
@@ -44,22 +44,22 @@ export const Select = <T extends string|number = string>(selectProps:CustomSelec
|
|
|
44
44
|
})
|
|
45
45
|
|
|
46
46
|
const inputStyles = useMemo(
|
|
47
|
-
() => getNestedStylesByKey('input', variantStyles),
|
|
47
|
+
() => getNestedStylesByKey('input', variantStyles),
|
|
48
48
|
[variantStyles],
|
|
49
49
|
)
|
|
50
50
|
|
|
51
51
|
const closeButtonStyles = useMemo(
|
|
52
|
-
() => getNestedStylesByKey('modalCloseButton', variantStyles),
|
|
52
|
+
() => getNestedStylesByKey('modalCloseButton', variantStyles),
|
|
53
53
|
[variantStyles],
|
|
54
54
|
)
|
|
55
|
-
|
|
55
|
+
|
|
56
56
|
const ListComponent = scroll ? Scroll : View
|
|
57
|
-
|
|
57
|
+
|
|
58
58
|
const close = () => setModalVisibility()
|
|
59
59
|
const select = (value) => {
|
|
60
|
-
|
|
60
|
+
|
|
61
61
|
onValueChange(value)
|
|
62
|
-
if (closeOnSelect){
|
|
62
|
+
if (closeOnSelect) {
|
|
63
63
|
close()
|
|
64
64
|
}
|
|
65
65
|
}
|
|
@@ -72,9 +72,9 @@ export const Select = <T extends string|number = string>(selectProps:CustomSelec
|
|
|
72
72
|
return TypeGuards.isString(display) ? display : ''
|
|
73
73
|
}, [value, placeholder, options])
|
|
74
74
|
|
|
75
|
-
return <>
|
|
76
|
-
<TextInput
|
|
77
|
-
|
|
75
|
+
return <>
|
|
76
|
+
<TextInput
|
|
77
|
+
|
|
78
78
|
caretHidden
|
|
79
79
|
value={selectedLabel}
|
|
80
80
|
rightIcon={{
|
|
@@ -83,15 +83,17 @@ export const Select = <T extends string|number = string>(selectProps:CustomSelec
|
|
|
83
83
|
editable={false}
|
|
84
84
|
touchableWrapper
|
|
85
85
|
innerWrapperProps={{
|
|
86
|
+
debugName: 'Select',
|
|
86
87
|
onPress: close,
|
|
87
88
|
}}
|
|
88
|
-
label={label}
|
|
89
|
+
label={label}
|
|
90
|
+
debugName={'Select input'}
|
|
89
91
|
styles={inputStyles}
|
|
90
92
|
style={style}
|
|
91
93
|
{...props}
|
|
92
94
|
/>
|
|
93
95
|
<AnimatedView pointerEvents={'none'} transition='opacity' style={[
|
|
94
|
-
{
|
|
96
|
+
{
|
|
95
97
|
position: 'absolute',
|
|
96
98
|
top: 0,
|
|
97
99
|
right: 0,
|
|
@@ -99,9 +101,9 @@ export const Select = <T extends string|number = string>(selectProps:CustomSelec
|
|
|
99
101
|
bottom: 0,
|
|
100
102
|
},
|
|
101
103
|
variantStyles.backdrop,
|
|
102
|
-
isModalVisible ? variantStyles['backdrop:visible'] : variantStyles['backdrop:hidden'],
|
|
104
|
+
isModalVisible ? variantStyles['backdrop:visible'] : variantStyles['backdrop:hidden'],
|
|
103
105
|
]} />
|
|
104
|
-
|
|
106
|
+
|
|
105
107
|
<Modal
|
|
106
108
|
animationType='slide'
|
|
107
109
|
transparent={true}
|
|
@@ -109,10 +111,10 @@ export const Select = <T extends string|number = string>(selectProps:CustomSelec
|
|
|
109
111
|
onRequestClose={() => {
|
|
110
112
|
setModalVisibility()
|
|
111
113
|
}}
|
|
112
|
-
pointerEvents={isModalVisible ? 'auto': 'none'}
|
|
114
|
+
pointerEvents={isModalVisible ? 'auto' : 'none'}
|
|
113
115
|
>
|
|
114
|
-
<Touchable
|
|
115
|
-
onPress={close}
|
|
116
|
+
<Touchable
|
|
117
|
+
onPress={close}
|
|
116
118
|
style={{
|
|
117
119
|
position: 'absolute',
|
|
118
120
|
top: 0,
|
|
@@ -120,20 +122,22 @@ export const Select = <T extends string|number = string>(selectProps:CustomSelec
|
|
|
120
122
|
left: 0,
|
|
121
123
|
bottom: 0,
|
|
122
124
|
}}
|
|
125
|
+
debugName={`Close modal`}
|
|
123
126
|
/>
|
|
124
127
|
<View style={variantStyles.modalWrapper}>
|
|
125
|
-
|
|
128
|
+
|
|
126
129
|
<View style={variantStyles.modalBox}>
|
|
127
130
|
{
|
|
128
131
|
(showClose || showLabelOnModal || header) && (
|
|
129
132
|
<View style={variantStyles.modalHeader}>
|
|
130
133
|
{
|
|
131
|
-
header ? header :
|
|
134
|
+
header ? header : <>
|
|
132
135
|
{showLabelOnModal && <InputLabel label={modalLabel || label} style={variantStyles.modalLabelText}/>}
|
|
133
|
-
{showClose && <Button
|
|
134
|
-
icon={modalCloseIconName as IconPlaceholder}
|
|
135
|
-
onPress={close}
|
|
136
|
+
{showClose && <Button
|
|
137
|
+
icon={modalCloseIconName as IconPlaceholder}
|
|
138
|
+
onPress={close}
|
|
136
139
|
styles={closeButtonStyles}
|
|
140
|
+
debugName={'Close modal'}
|
|
137
141
|
{...closeButtonProps}
|
|
138
142
|
/>}
|
|
139
143
|
</>
|
|
@@ -151,31 +155,30 @@ export const Select = <T extends string|number = string>(selectProps:CustomSelec
|
|
|
151
155
|
selected: isSelected,
|
|
152
156
|
onPress: close,
|
|
153
157
|
styles: variantStyles,
|
|
154
|
-
|
|
155
|
-
})
|
|
158
|
+
|
|
159
|
+
})
|
|
156
160
|
}
|
|
157
161
|
|
|
158
162
|
return <Touchable key={idx} style={[
|
|
159
|
-
variantStyles.modalItem,
|
|
163
|
+
variantStyles.modalItem,
|
|
160
164
|
isSelected && variantStyles['modalItem:selected'],
|
|
161
|
-
]} onPress={() => select(item.value)}>
|
|
162
|
-
<InputLabel label={item.label} style={[variantStyles.modalItemText,
|
|
165
|
+
]} onPress={() => select(item.value)} debugName={`Select ${item.value}`}>
|
|
166
|
+
<InputLabel label={item.label} style={[variantStyles.modalItemText, isSelected && variantStyles['modalItemText:selected']]}/>
|
|
163
167
|
</Touchable>
|
|
164
168
|
})
|
|
165
169
|
}
|
|
166
170
|
</ListComponent>
|
|
167
|
-
|
|
171
|
+
|
|
168
172
|
{
|
|
169
173
|
footer && <View style={variantStyles.modalFooter}>
|
|
170
174
|
{footer}
|
|
171
175
|
</View>
|
|
172
|
-
}
|
|
176
|
+
}
|
|
173
177
|
</View>
|
|
174
178
|
</View>
|
|
175
179
|
</Modal>
|
|
176
180
|
</>
|
|
177
181
|
}
|
|
178
182
|
|
|
179
|
-
|
|
180
183
|
export * from './styles'
|
|
181
184
|
export * from './types'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { assignTextStyle, ButtonParts, createDefaultVariantFactory, TextInputComposition } from '@codeleap/common'
|
|
2
2
|
import { MobileModalStyles } from '../Modal'
|
|
3
|
-
type ModalParts =
|
|
3
|
+
type ModalParts =
|
|
4
4
|
'Box' |
|
|
5
5
|
'Wrapper' |
|
|
6
6
|
'Header' |
|
|
@@ -13,12 +13,12 @@ type ModalParts =
|
|
|
13
13
|
'LabelText' |
|
|
14
14
|
`CloseButton${Capitalize<ButtonParts>}`
|
|
15
15
|
|
|
16
|
-
type InputParts = `input${Capitalize<TextInputComposition>}`
|
|
16
|
+
type InputParts = `input${Capitalize<TextInputComposition>}`
|
|
17
17
|
|
|
18
|
-
export type MobileSelectParts = InputParts
|
|
19
|
-
| `backdrop`
|
|
20
|
-
| `backdrop:visible`
|
|
21
|
-
| `backdrop:hidden`
|
|
18
|
+
export type MobileSelectParts = InputParts
|
|
19
|
+
| `backdrop`
|
|
20
|
+
| `backdrop:visible`
|
|
21
|
+
| `backdrop:hidden`
|
|
22
22
|
| `modal${ModalParts}`
|
|
23
23
|
|
|
24
24
|
export type MobileSelectComposition = MobileSelectParts
|
|
@@ -56,7 +56,7 @@ export const MobileSelectStyles = {
|
|
|
56
56
|
// ...MobileModalStyles.default(theme).overlay,
|
|
57
57
|
zIndex: 10,
|
|
58
58
|
flex: 1,
|
|
59
|
-
|
|
59
|
+
|
|
60
60
|
backgroundColor: theme.colors.black,
|
|
61
61
|
},
|
|
62
62
|
'backdrop:hidden': {
|
|
@@ -8,24 +8,24 @@ import { StylesOf } from '../../types/utility'
|
|
|
8
8
|
import { ButtonProps } from '../Button'
|
|
9
9
|
import { TextInputProps } from '../TextInput'
|
|
10
10
|
import { MobileSelectComposition, MobileSelectStyles } from './styles'
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
export type SelectRenderFNProps<T> = FormTypes.Options<T>[number] & {
|
|
13
|
-
styles: StylesOf<MobileSelectComposition
|
|
14
|
-
onPress: () => void
|
|
15
|
-
selected?: boolean
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export type SelectRenderFN<T> = (props: SelectRenderFNProps<T>) => JSX.Element
|
|
19
|
-
|
|
13
|
+
styles: StylesOf<MobileSelectComposition>
|
|
14
|
+
onPress: () => void
|
|
15
|
+
selected?: boolean
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type SelectRenderFN<T> = (props: SelectRenderFNProps<T>) => JSX.Element
|
|
19
|
+
|
|
20
20
|
export type CustomSelectProps<T> = {
|
|
21
|
-
value: T
|
|
22
|
-
placeholder?: FormTypes.Label
|
|
23
|
-
label?: FormTypes.Label
|
|
24
|
-
options?: FormTypes.Options<T
|
|
25
|
-
onDropdownToggle?: (isOpen?: boolean) => void
|
|
26
|
-
onValueChange?: (value: T) => void
|
|
27
|
-
renderItem?: SelectRenderFN<T
|
|
28
|
-
styles?: StylesOf<MobileSelectComposition
|
|
21
|
+
value: T
|
|
22
|
+
placeholder?: FormTypes.Label
|
|
23
|
+
label?: FormTypes.Label
|
|
24
|
+
options?: FormTypes.Options<T>
|
|
25
|
+
onDropdownToggle?: (isOpen?: boolean) => void
|
|
26
|
+
onValueChange?: (value: T) => void
|
|
27
|
+
renderItem?: SelectRenderFN<T>
|
|
28
|
+
styles?: StylesOf<MobileSelectComposition>
|
|
29
29
|
style?: any
|
|
30
30
|
arrowIconName?: IconPlaceholder
|
|
31
31
|
scroll?: boolean
|
|
@@ -37,5 +37,5 @@ export type CustomSelectProps<T> = {
|
|
|
37
37
|
showClose?: boolean
|
|
38
38
|
modalLabel?: string
|
|
39
39
|
closeButtonProps?: Partial<ButtonProps>
|
|
40
|
-
} & ComponentVariants<typeof MobileSelectStyles> & TextInputProps
|
|
41
|
-
|
|
40
|
+
} & ComponentVariants<typeof MobileSelectStyles> & TextInputProps
|
|
41
|
+
|
|
@@ -10,22 +10,22 @@ export const SliderMark: React.FC<SliderMarkProps> = ({
|
|
|
10
10
|
variantStyles,
|
|
11
11
|
}) => {
|
|
12
12
|
const { labels = [], showMarks } = sliderProps
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
const l = labels?.[index] || ''
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
const isFirst = index === 0
|
|
17
17
|
const isLast = index === labels.length - 1
|
|
18
|
-
|
|
18
|
+
|
|
19
19
|
const centerAdjustWord = -(l.length * 2)
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
const markStyles: StyleProp<any> = {}
|
|
22
|
-
|
|
22
|
+
|
|
23
23
|
const labelStyles: StyleProp<any> = {}
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
if (!isFirst && !isLast) {
|
|
26
26
|
labelStyles.left = centerAdjustWord
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
if (isLast) {
|
|
30
30
|
labelStyles.right = -20
|
|
31
31
|
markStyles.right = -10
|
|
@@ -14,7 +14,7 @@ import { SliderProps } from './types'
|
|
|
14
14
|
|
|
15
15
|
export const Slider: React.FC<SliderProps> = (sliderProps) => {
|
|
16
16
|
const [tooltipVisible, setTooltipVisible] = React.useState(false)
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
const {
|
|
19
19
|
debounce,
|
|
20
20
|
onValueChange,
|
|
@@ -29,39 +29,39 @@ export const Slider: React.FC<SliderProps> = (sliderProps) => {
|
|
|
29
29
|
variants,
|
|
30
30
|
...props
|
|
31
31
|
} = sliderProps
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
const changeDebounce = typeof debounce === 'number' ? debounce : 100
|
|
34
|
-
|
|
34
|
+
|
|
35
35
|
const debounceTimeout = useRef(null)
|
|
36
36
|
const toggleTooltipTimeout = useRef(null)
|
|
37
37
|
const valueRef = useRef(value)
|
|
38
|
-
|
|
38
|
+
|
|
39
39
|
const variantStyles = useDefaultComponentStyle('Slider', {
|
|
40
40
|
variants,
|
|
41
41
|
})
|
|
42
|
-
|
|
42
|
+
|
|
43
43
|
function setValue() {
|
|
44
44
|
onValueChange(valueRef.current)
|
|
45
45
|
}
|
|
46
|
-
|
|
46
|
+
|
|
47
47
|
function onChange(val) {
|
|
48
48
|
let eventValue = val
|
|
49
|
-
|
|
49
|
+
|
|
50
50
|
if (Array.isArray(val) && typeof value === 'number') {
|
|
51
51
|
eventValue = val[0]
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
|
|
54
54
|
if (eventValue === value) return
|
|
55
|
-
|
|
55
|
+
|
|
56
56
|
valueRef.current = eventValue as number
|
|
57
|
-
|
|
57
|
+
|
|
58
58
|
if (debounceTimeout.current) clearTimeout(debounceTimeout.current)
|
|
59
|
-
|
|
59
|
+
|
|
60
60
|
debounceTimeout.current = setTimeout(() => {
|
|
61
61
|
setValue()
|
|
62
62
|
}, changeDebounce)
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
|
|
65
65
|
return (
|
|
66
66
|
<View style={[variantStyles.wrapper, style]}>
|
|
67
67
|
<InputLabel label={label} style={[variantStyles.label, styles.label]} />
|
|
@@ -69,7 +69,7 @@ export const Slider: React.FC<SliderProps> = (sliderProps) => {
|
|
|
69
69
|
value={value}
|
|
70
70
|
onSlidingStart={() => {
|
|
71
71
|
if (toggleTooltipTimeout.current) { clearTimeout(toggleTooltipTimeout.current) }
|
|
72
|
-
|
|
72
|
+
|
|
73
73
|
setTooltipVisible(true)
|
|
74
74
|
}}
|
|
75
75
|
onSlidingComplete={() => {
|
|
@@ -120,4 +120,4 @@ export const Slider: React.FC<SliderProps> = (sliderProps) => {
|
|
|
120
120
|
</View>
|
|
121
121
|
)
|
|
122
122
|
}
|
|
123
|
-
|
|
123
|
+
|
|
@@ -3,23 +3,23 @@ import { SliderProps as RNSliderProps } from '@miblanchard/react-native-slider/l
|
|
|
3
3
|
import { StylesOf } from '../../types/utility'
|
|
4
4
|
import { ViewProps } from '../View'
|
|
5
5
|
export type SliderProps = Partial<Omit<RNSliderProps, 'value' | 'onValueChange'>> & {
|
|
6
|
-
debounce?: number
|
|
7
|
-
labels: string[]
|
|
8
|
-
value: number
|
|
9
|
-
valueOverThumb?: boolean
|
|
10
|
-
showMarks?: boolean
|
|
11
|
-
onValueChange: (val: number) => void
|
|
12
|
-
label: Form.Label
|
|
13
|
-
formatTooltip?: (val: number) => React.ReactNode
|
|
14
|
-
variants?: ComponentVariants<typeof SliderStyles>['variants']
|
|
15
|
-
styles?: StylesOf<SliderComposition
|
|
16
|
-
style?: ViewProps['style']
|
|
6
|
+
debounce?: number
|
|
7
|
+
labels: string[]
|
|
8
|
+
value: number
|
|
9
|
+
valueOverThumb?: boolean
|
|
10
|
+
showMarks?: boolean
|
|
11
|
+
onValueChange: (val: number) => void
|
|
12
|
+
label: Form.Label
|
|
13
|
+
formatTooltip?: (val: number) => React.ReactNode
|
|
14
|
+
variants?: ComponentVariants<typeof SliderStyles>['variants']
|
|
15
|
+
styles?: StylesOf<SliderComposition>
|
|
16
|
+
style?: ViewProps['style']
|
|
17
17
|
tooltipVisibilityWindow?: number
|
|
18
|
-
}
|
|
19
|
-
|
|
18
|
+
}
|
|
19
|
+
|
|
20
20
|
export type SliderMarkProps = {
|
|
21
|
-
sliderProps: SliderProps
|
|
22
|
-
index: number
|
|
23
|
-
styles: SliderProps['styles']
|
|
24
|
-
variantStyles: SliderProps['styles']
|
|
25
|
-
}
|
|
21
|
+
sliderProps: SliderProps
|
|
22
|
+
index: number
|
|
23
|
+
styles: SliderProps['styles']
|
|
24
|
+
variantStyles: SliderProps['styles']
|
|
25
|
+
}
|
|
@@ -17,14 +17,13 @@ import { View } from './View'
|
|
|
17
17
|
type NativeSwitchProps = Omit<
|
|
18
18
|
ComponentPropsWithRef<typeof NativeSwitch>,
|
|
19
19
|
'thumbColor' | 'trackColor'
|
|
20
|
-
|
|
20
|
+
>
|
|
21
21
|
type SwitchProps = NativeSwitchProps & {
|
|
22
|
-
variants?: ComponentVariants<typeof SwitchStyles>['variants']
|
|
23
|
-
label?: ReactNode
|
|
24
|
-
styles?: StylesOf<SwitchComposition
|
|
25
|
-
validate?: FormTypes.ValidatorFunctionWithoutForm | string
|
|
26
|
-
}
|
|
27
|
-
|
|
22
|
+
variants?: ComponentVariants<typeof SwitchStyles>['variants']
|
|
23
|
+
label?: ReactNode
|
|
24
|
+
styles?: StylesOf<SwitchComposition>
|
|
25
|
+
validate?: FormTypes.ValidatorFunctionWithoutForm | string
|
|
26
|
+
}
|
|
28
27
|
|
|
29
28
|
export const Switch = forwardRef<NativeSwitch, SwitchProps>(
|
|
30
29
|
(switchProps, ref) => {
|
package/src/components/Text.tsx
CHANGED
|
@@ -9,9 +9,9 @@ import {
|
|
|
9
9
|
import { Text as NativeText } from 'react-native'
|
|
10
10
|
|
|
11
11
|
export type TextProps = ComponentPropsWithoutRef<typeof NativeText> & {
|
|
12
|
-
text?: string
|
|
13
|
-
variants?: ComponentVariants<typeof TextStyles>['variants']
|
|
14
|
-
} & BaseViewProps
|
|
12
|
+
text?: string
|
|
13
|
+
variants?: ComponentVariants<typeof TextStyles>['variants']
|
|
14
|
+
} & BaseViewProps
|
|
15
15
|
|
|
16
16
|
export const Text = forwardRef<NativeText, TextProps>((textProps, ref) => {
|
|
17
17
|
const { variants = [], text, style, ...props } = textProps
|
|
@@ -11,14 +11,14 @@ import {
|
|
|
11
11
|
} from '@codeleap/common'
|
|
12
12
|
import { ComponentPropsWithoutRef, forwardRef, useImperativeHandle, useRef, useState } from 'react'
|
|
13
13
|
import { Text } from './Text'
|
|
14
|
-
import { View, ViewProps
|
|
14
|
+
import { View, ViewProps } from './View'
|
|
15
15
|
import { Button } from './Button'
|
|
16
16
|
import { StylesOf } from '../types/utility'
|
|
17
17
|
import { Icon } from './Icon'
|
|
18
18
|
import { NativeSyntheticEvent, StyleSheet, TextInput as NativeTextInput, TextInputChangeEventData } from 'react-native'
|
|
19
19
|
import { Touchable, TouchableProps } from './Touchable'
|
|
20
20
|
|
|
21
|
-
type IconProp = { name: IconPlaceholder
|
|
21
|
+
type IconProp = { name: IconPlaceholder; action?: () => void }
|
|
22
22
|
|
|
23
23
|
type NativeProps = ComponentPropsWithoutRef<typeof NativeTextInput>
|
|
24
24
|
|
|
@@ -26,13 +26,13 @@ export type TextInputProps =
|
|
|
26
26
|
ComponentVariants<typeof TextInputStyles> &
|
|
27
27
|
Omit<NativeProps, 'value'> &
|
|
28
28
|
{
|
|
29
|
-
multiline?: boolean
|
|
30
|
-
onChangeText?: (text: string) => void
|
|
31
|
-
disabled?: boolean
|
|
32
|
-
edited?: boolean
|
|
33
|
-
type?: string
|
|
29
|
+
multiline?: boolean
|
|
30
|
+
onChangeText?: (text: string) => void
|
|
31
|
+
disabled?: boolean
|
|
32
|
+
edited?: boolean
|
|
33
|
+
type?: string
|
|
34
34
|
label?: React.ReactNode
|
|
35
|
-
|
|
35
|
+
debugName: string
|
|
36
36
|
leftIcon?: IconProp
|
|
37
37
|
rightIcon?: IconProp
|
|
38
38
|
styles?: StylesOf<TextInputComposition>
|
|
@@ -42,7 +42,7 @@ export type TextInputProps =
|
|
|
42
42
|
visibilityToggle?: boolean
|
|
43
43
|
touchableWrapper?: boolean
|
|
44
44
|
innerWrapperProps?: TouchableProps | ViewProps
|
|
45
|
-
}
|
|
45
|
+
}
|
|
46
46
|
|
|
47
47
|
export const TextInput = forwardRef<NativeTextInput, TextInputProps>((rawprops, inputRef) => {
|
|
48
48
|
const {
|
|
@@ -65,6 +65,7 @@ export const TextInput = forwardRef<NativeTextInput, TextInputProps>((rawprops,
|
|
|
65
65
|
visibilityToggle,
|
|
66
66
|
touchableWrapper,
|
|
67
67
|
innerWrapperProps,
|
|
68
|
+
debugName,
|
|
68
69
|
...props
|
|
69
70
|
} = rawprops
|
|
70
71
|
|
|
@@ -102,9 +103,9 @@ export const TextInput = forwardRef<NativeTextInput, TextInputProps>((rawprops,
|
|
|
102
103
|
if (onChangeText) onChangeText(text)
|
|
103
104
|
}
|
|
104
105
|
|
|
105
|
-
useImperativeHandle(inputRef, () => ({...input.current, focus: () => {
|
|
106
|
+
useImperativeHandle(inputRef, () => ({ ...input.current, focus: () => {
|
|
106
107
|
input.current?.focus?.()
|
|
107
|
-
}, isTextInput: true}))
|
|
108
|
+
}, isTextInput: true }))
|
|
108
109
|
|
|
109
110
|
const { showError, error } = useValidate(value, validate)
|
|
110
111
|
|
|
@@ -142,7 +143,7 @@ export const TextInput = forwardRef<NativeTextInput, TextInputProps>((rawprops,
|
|
|
142
143
|
style={getStyles('wrapper')}
|
|
143
144
|
>
|
|
144
145
|
<InputLabel label={label} style={getStyles('label')} />
|
|
145
|
-
<InnerWrapper style={getStyles('innerWrapper')} {...innerWrapperProps}>
|
|
146
|
+
<InnerWrapper debugName={debugName} style={getStyles('innerWrapper')} {...innerWrapperProps}>
|
|
146
147
|
<InputIcon {...leftIcon} style={leftIconStyle} />
|
|
147
148
|
<InputElement
|
|
148
149
|
ref={input}
|
|
@@ -182,7 +183,7 @@ export const FormError = ({ message, ...props }) => {
|
|
|
182
183
|
export const InputIcon: React.FC<{ style: any } & IconProp> = ({ name, style, action }) => {
|
|
183
184
|
if (!name) return null
|
|
184
185
|
if (action) {
|
|
185
|
-
return <Button icon={name} onPress={() => action()} styles={{
|
|
186
|
+
return <Button icon={name} debugName={`${name} icon button`} onPress={() => action()} styles={{
|
|
186
187
|
icon: style,
|
|
187
188
|
}} variants={['icon']} />
|
|
188
189
|
}
|
|
@@ -15,13 +15,13 @@ export type TouchableProps = Omit<
|
|
|
15
15
|
ComponentPropsWithoutRef<typeof NativeTouchable>,
|
|
16
16
|
'onPress'
|
|
17
17
|
> & {
|
|
18
|
-
variants?: ComponentVariants<typeof ViewStyles>['variants']
|
|
19
|
-
component?: any
|
|
20
|
-
ref?: React.Ref<NativeTouchable
|
|
21
|
-
debugName
|
|
22
|
-
debugComponent?: string
|
|
23
|
-
onPress?: AnyFunction
|
|
24
|
-
} & BaseViewProps
|
|
18
|
+
variants?: ComponentVariants<typeof ViewStyles>['variants']
|
|
19
|
+
component?: any
|
|
20
|
+
ref?: React.Ref<NativeTouchable>
|
|
21
|
+
debugName: string
|
|
22
|
+
debugComponent?: string
|
|
23
|
+
onPress?: AnyFunction
|
|
24
|
+
} & BaseViewProps
|
|
25
25
|
|
|
26
26
|
export const Touchable: React.FC<TouchableProps> = forwardRef<
|
|
27
27
|
NativeTouchable,
|
package/src/components/View.tsx
CHANGED
|
@@ -11,9 +11,9 @@ import { View as NativeView, ViewStyle } from 'react-native'
|
|
|
11
11
|
|
|
12
12
|
export type ViewProps = ComponentPropsWithoutRef<typeof NativeView> &
|
|
13
13
|
ComponentVariants<typeof ViewStyles> & {
|
|
14
|
-
ref?: any
|
|
15
|
-
component?: any
|
|
16
|
-
} & BaseViewProps
|
|
14
|
+
ref?: any
|
|
15
|
+
component?: any
|
|
16
|
+
} & BaseViewProps
|
|
17
17
|
|
|
18
18
|
export const View: React.FC<ViewProps> = forwardRef<NativeView, ViewProps>((viewProps, ref) => {
|
|
19
19
|
const {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
// @ts-ignore
|
|
2
|
-
import
|
|
3
|
-
import * as
|
|
4
|
-
|
|
2
|
+
import DP from 'react-native-document-picker'
|
|
3
|
+
import * as DocumentPickerTypes from './types/documentPicker'
|
|
5
4
|
|
|
6
5
|
export const DocumentPicker = DP as DocumentPickerTypes.DocumentPicker
|
|
7
6
|
|
|
8
|
-
export {default as ImageCropPicker} from 'react-native-image-crop-picker'
|
|
7
|
+
export { default as ImageCropPicker } from 'react-native-image-crop-picker'
|