@codeleap/web 3.23.5 → 3.24.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 -3
- package/src/components/ActivityIndicator/index.tsx +1 -1
- package/src/components/Checkbox/index.tsx +2 -1
- package/src/components/ColorPicker/types.ts +1 -1
- package/src/components/CropPicker/index.tsx +3 -3
- package/src/components/CropPicker/useCropPicker.tsx +1 -1
- package/src/components/DatePicker/index.tsx +1 -1
- package/src/components/DatePicker/types.ts +4 -4
- package/src/components/Dropzone/index.tsx +10 -13
- package/src/components/Dropzone/types.ts +2 -5
- package/src/components/EmptyPlaceholder/index.tsx +8 -11
- package/src/components/List/ListLayout.tsx +1 -0
- package/src/components/Progress/Circle/index.tsx +1 -1
- package/src/components/SearchInput/index.tsx +3 -1
- package/src/components/SegmentedControl/SegmentedControlOption.tsx +1 -1
- package/src/components/SegmentedControl/index.tsx +1 -1
- package/src/components/Select/index.tsx +2 -2
- package/src/components/Select/types.ts +4 -2
- package/src/components/Slider/index.tsx +0 -1
- package/src/components/Switch/index.tsx +1 -1
- package/src/components/Text/index.tsx +8 -4
- package/src/components/Text/types.ts +1 -1
- package/src/components/TextEditor/index.tsx +1 -1
- package/src/components/TextInput/index.tsx +6 -3
- package/src/components/Tooltip/index.tsx +3 -2
- package/src/components/Touchable/index.tsx +6 -5
- package/src/components/View/index.tsx +3 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codeleap/web",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.24.2",
|
|
4
4
|
"main": "src/index.ts",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "https://github.com/codeleap-uk/internal-libs-monorepo.git",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"license": "UNLICENSED",
|
|
11
11
|
"devDependencies": {
|
|
12
12
|
"@codeleap/config": "*",
|
|
13
|
+
"@codeleap/common": "*",
|
|
13
14
|
"@emotion/react": "link:../../apps/web/node_modules/@emotion/react",
|
|
14
15
|
"@types/react-slick": "^0.23.10",
|
|
15
16
|
"react": "link:../../apps/web/node_modules/react"
|
|
@@ -47,9 +48,9 @@
|
|
|
47
48
|
"axios": "1.3.5",
|
|
48
49
|
"gatsby-plugin-intl": "^0.3.3",
|
|
49
50
|
"react": "18.1.0",
|
|
50
|
-
"react-dom": "18.
|
|
51
|
+
"react-dom": "18.2.0",
|
|
51
52
|
"react-helmet": "^6.1.0",
|
|
52
53
|
"react-select": "*",
|
|
53
|
-
"typescript": "
|
|
54
|
+
"typescript": "5.0.4"
|
|
54
55
|
}
|
|
55
56
|
}
|
|
@@ -70,6 +70,6 @@ export const ActivityIndicator = React.forwardRef<typeof View, ActivityIndicator
|
|
|
70
70
|
}) as ComponentWithDefaultProps<ActivityIndicatorProps>
|
|
71
71
|
|
|
72
72
|
ActivityIndicator.defaultProps = {
|
|
73
|
-
component: View,
|
|
73
|
+
component: View as ActivityIndicatorProps['component'],
|
|
74
74
|
size: null,
|
|
75
75
|
}
|
|
@@ -114,8 +114,9 @@ export const Checkbox = (props: CheckboxProps) => {
|
|
|
114
114
|
const _checkboxOnLeft = checkboxOnLeft ?? variantStyles.__props?.checkboxOnLeft
|
|
115
115
|
|
|
116
116
|
const handleChange = (e) => {
|
|
117
|
+
const isSpaceBarClick = e?.keyCode === 32
|
|
117
118
|
if (disabled) return
|
|
118
|
-
if (onValueChange && (e?.type === 'click' || e?.keyCode === 13 || e?.key === 'Enter')) onValueChange?.(!value)
|
|
119
|
+
if (onValueChange && (e?.type === 'click' || e?.keyCode === 13 || isSpaceBarClick || e?.key === 'Enter')) onValueChange?.(!value)
|
|
119
120
|
}
|
|
120
121
|
|
|
121
122
|
return <InputBase
|
|
@@ -21,5 +21,5 @@ export type ColorPickerProps = React.PropsWithChildren<{
|
|
|
21
21
|
onClear?: () => void
|
|
22
22
|
openPickerComponent?: (props: { color: ColorTypes; visible: boolean; toggle: (v?: boolean) => void }) => JSX.Element
|
|
23
23
|
pickerComponent?: (props: any) => JSX.Element
|
|
24
|
-
footerComponent?: (props: {color:
|
|
24
|
+
footerComponent?: (props: {color: ColorTypes; handleConfirmation: () => void; handleClear: () => void}) => JSX.Element
|
|
25
25
|
} & ComponentVariants<typeof ColorPickerPresets>>
|
|
@@ -8,9 +8,8 @@ import { CropPickerProps } from './types'
|
|
|
8
8
|
import { useCropPicker } from './useCropPicker'
|
|
9
9
|
import { Modal, Button, FileInput, FileInputRef, LoadingOverlay } from '../components'
|
|
10
10
|
|
|
11
|
-
const ReactCrop: React.
|
|
11
|
+
const ReactCrop: React.ElementType = require('react-image-crop').Component
|
|
12
12
|
import 'react-image-crop/dist/ReactCrop.css'
|
|
13
|
-
import { ComponentWithDefaultProps } from '../../types'
|
|
14
13
|
|
|
15
14
|
export * from './styles'
|
|
16
15
|
export * from './types'
|
|
@@ -20,6 +19,7 @@ export * from './useCropPicker'
|
|
|
20
19
|
export const _CropPicker = forwardRef<FileInputRef, CropPickerProps>(
|
|
21
20
|
(props: CropPickerProps, ref) => {
|
|
22
21
|
const allProps = {
|
|
22
|
+
// @ts-ignore
|
|
23
23
|
...CropPicker.defaultProps,
|
|
24
24
|
...props,
|
|
25
25
|
}
|
|
@@ -114,4 +114,4 @@ export const _CropPicker = forwardRef<FileInputRef, CropPickerProps>(
|
|
|
114
114
|
},
|
|
115
115
|
)
|
|
116
116
|
|
|
117
|
-
export const CropPicker = React.memo(_CropPicker)
|
|
117
|
+
export const CropPicker = React.memo(_CropPicker)
|
|
@@ -119,7 +119,7 @@ export function DatePicker(props: DatePickerProps) {
|
|
|
119
119
|
|
|
120
120
|
return (
|
|
121
121
|
<View css={getStyles('dayWrapper')}>
|
|
122
|
-
<Text style={getStyles('day')} disabled={isDisabled} text={day} />
|
|
122
|
+
<Text style={getStyles('day')} disabled={isDisabled} text={String(day)} />
|
|
123
123
|
</View>
|
|
124
124
|
)
|
|
125
125
|
},
|
|
@@ -28,11 +28,11 @@ type RootStyles = ComponentVariants<typeof DatePickerPresets>
|
|
|
28
28
|
|
|
29
29
|
export type DayComponentProps = {
|
|
30
30
|
day: string | number
|
|
31
|
-
value
|
|
31
|
+
value?: Date
|
|
32
32
|
date: Date
|
|
33
|
-
disabled
|
|
34
|
-
selected
|
|
35
|
-
variantStyles
|
|
33
|
+
disabled?: boolean
|
|
34
|
+
selected?: boolean
|
|
35
|
+
variantStyles?: any
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
export type YearComponentProps = {
|
|
@@ -5,7 +5,6 @@ import { FileRejection, useDropzone } from 'react-dropzone'
|
|
|
5
5
|
import { View, ViewProps } from '../View'
|
|
6
6
|
import { Text } from '../Text'
|
|
7
7
|
import { Icon } from '../Icon'
|
|
8
|
-
|
|
9
8
|
import { forwardRef, useImperativeHandle, useState, HTMLProps } from 'react'
|
|
10
9
|
import { ActionIcon } from '../ActionIcon'
|
|
11
10
|
|
|
@@ -16,7 +15,6 @@ const defaultProps: Partial<DropzoneProps> = {
|
|
|
16
15
|
fileLeftIcon: 'file' as IconPlaceholder,
|
|
17
16
|
fileRightIcon: 'x' as IconPlaceholder,
|
|
18
17
|
withImagePreview: true,
|
|
19
|
-
|
|
20
18
|
}
|
|
21
19
|
|
|
22
20
|
function isImage(file) {
|
|
@@ -83,7 +81,7 @@ const FilePreview = (props: DropzoneFilePreviewProps) => {
|
|
|
83
81
|
const _isImage = isImage(file)
|
|
84
82
|
const isPreview = withImagePreview && _isImage
|
|
85
83
|
|
|
86
|
-
const [imageUrl, setImageUrl] = useState()
|
|
84
|
+
const [imageUrl, setImageUrl] = useState<string>()
|
|
87
85
|
|
|
88
86
|
const revokeImageUrl = () => {
|
|
89
87
|
URL.revokeObjectURL(imageUrl)
|
|
@@ -110,7 +108,7 @@ const FilePreview = (props: DropzoneFilePreviewProps) => {
|
|
|
110
108
|
|
|
111
109
|
const DropzoneComponent = (props: DropzoneProps, ref: React.ForwardedRef<DropzoneRef>) => {
|
|
112
110
|
const allProps = {
|
|
113
|
-
...defaultProps,
|
|
111
|
+
...DropzoneComponent.defaultProps,
|
|
114
112
|
...props,
|
|
115
113
|
}
|
|
116
114
|
const {
|
|
@@ -133,17 +131,15 @@ const DropzoneComponent = (props: DropzoneProps, ref: React.ForwardedRef<Dropzon
|
|
|
133
131
|
FilePreviewComponent,
|
|
134
132
|
...rest } = allProps
|
|
135
133
|
|
|
136
|
-
const [rejectedFilesState,
|
|
137
|
-
setRejectedFilesState] = useState<DropzoneProps['rejectedFiles']>([])
|
|
134
|
+
const [rejectedFilesState, setRejectedFilesState] = useState<DropzoneProps['rejectedFiles']>([])
|
|
138
135
|
const [rejectedFiles, setRejectedFiles] = [rejectedFilesProps || rejectedFilesState, setRejectedFilesProps || setRejectedFilesState]
|
|
139
136
|
|
|
140
|
-
const variantStyles = useDefaultComponentStyle<'u:Dropzone',
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
})
|
|
137
|
+
const variantStyles = useDefaultComponentStyle<'u:Dropzone', typeof DropzonePresets>('u:Dropzone', {
|
|
138
|
+
responsiveVariants,
|
|
139
|
+
variants,
|
|
140
|
+
styles,
|
|
141
|
+
rootElement: 'wrapper',
|
|
142
|
+
})
|
|
147
143
|
|
|
148
144
|
const fileRightIconStyles = useNestedStylesByKey('fileRightIcon', variantStyles)
|
|
149
145
|
|
|
@@ -235,4 +231,5 @@ export * from './types'
|
|
|
235
231
|
|
|
236
232
|
DropzoneComponent.defaultProps = defaultProps
|
|
237
233
|
|
|
234
|
+
// @ts-ignore
|
|
238
235
|
export const Dropzone = forwardRef(DropzoneComponent)
|
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
FileRejection,
|
|
12
12
|
DropzoneRef as ReactDropzoneRef,
|
|
13
13
|
} from 'react-dropzone'
|
|
14
|
-
import { ReactDispatch } from 'react'
|
|
15
14
|
import { ActionIconComposition } from '../ActionIcon'
|
|
16
15
|
|
|
17
16
|
export type DropzoneFile = File
|
|
@@ -26,10 +25,8 @@ export type DropzoneProps = ComponentVariants<typeof DropzonePresets> &
|
|
|
26
25
|
placeholder?: string
|
|
27
26
|
acceptedFiles: File[]
|
|
28
27
|
rejectedFiles?: DropzoneFileRejection[]
|
|
29
|
-
setAcceptedFiles:
|
|
30
|
-
setRejectedFiles?:
|
|
31
|
-
React.SetStateAction<DropzoneFileRejection[]>
|
|
32
|
-
>
|
|
28
|
+
setAcceptedFiles: React.Dispatch<React.SetStateAction<DropzoneFile[]>>
|
|
29
|
+
setRejectedFiles?: React.Dispatch<React.SetStateAction<DropzoneFileRejection[]>>
|
|
33
30
|
onRemove?: (file: DropzoneFile) => void
|
|
34
31
|
children?: React.ReactNode
|
|
35
32
|
fileRightIcon?: IconPlaceholder
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { Icon } from '../Icon'
|
|
3
|
-
import { View
|
|
3
|
+
import { View } from '../View'
|
|
4
4
|
import { Text } from '../Text'
|
|
5
5
|
import { ActivityIndicator, ActivityIndicatorComposition, ActivityIndicatorProps } from '../ActivityIndicator'
|
|
6
6
|
import { EmptyPlaceholderComposition, EmptyPlaceholderPresets } from './styles'
|
|
@@ -32,7 +32,7 @@ export type EmptyPlaceholderProps = ComponentVariants<typeof EmptyPlaceholderPre
|
|
|
32
32
|
loading?: boolean
|
|
33
33
|
styles?: StylesOf<EmptyPlaceholderComposition>
|
|
34
34
|
style?: React.CSSProperties
|
|
35
|
-
renderEmpty?: (props: RenderEmptyProps) =>
|
|
35
|
+
renderEmpty?: (props: RenderEmptyProps) => JSX.Element
|
|
36
36
|
wrapperProps?: Partial<typeof View>
|
|
37
37
|
imageWrapperProps?: Partial<typeof View>
|
|
38
38
|
indicatorProps?: Partial<ActivityIndicatorProps>
|
|
@@ -81,9 +81,6 @@ export const EmptyPlaceholder = (props: EmptyPlaceholderProps) => {
|
|
|
81
81
|
if (TypeGuards.isString(IconEmpty)) {
|
|
82
82
|
return <Icon debugName={debugName} name={IconEmpty as IconPlaceholder} forceStyle={variantStyles.icon} />
|
|
83
83
|
} else if (React.isValidElement(IconEmpty)) {
|
|
84
|
-
// @ts-ignore
|
|
85
|
-
return <IconEmpty {...props} />
|
|
86
|
-
} else {
|
|
87
84
|
return <IconEmpty {...props} />
|
|
88
85
|
}
|
|
89
86
|
}, [IconEmpty])
|
|
@@ -119,14 +116,14 @@ export const EmptyPlaceholder = (props: EmptyPlaceholderProps) => {
|
|
|
119
116
|
{_Image}
|
|
120
117
|
</View>
|
|
121
118
|
|
|
122
|
-
{
|
|
123
|
-
? emptyText
|
|
124
|
-
:
|
|
119
|
+
{TypeGuards.isString(emptyText)
|
|
120
|
+
? <Text debugName={debugName} text={emptyText} css={variantStyles.title}/>
|
|
121
|
+
: React.isValidElement(emptyText) ? emptyText : null
|
|
125
122
|
}
|
|
126
123
|
|
|
127
|
-
{
|
|
128
|
-
? description
|
|
129
|
-
:
|
|
124
|
+
{TypeGuards.isString(description)
|
|
125
|
+
? <Text debugName={debugName} text={description} css={variantStyles.description}/>
|
|
126
|
+
: React.isValidElement(description) ? description : null
|
|
130
127
|
}
|
|
131
128
|
</View>
|
|
132
129
|
)
|
|
@@ -92,7 +92,7 @@ export const ProgressCircle = (props: ProgressCircleProps) => {
|
|
|
92
92
|
{TypeGuards.isString(text) || showProgress ? (
|
|
93
93
|
<Text
|
|
94
94
|
style={variantStyles.text}
|
|
95
|
-
text={showProgress ? formatProgress(progress) : text}
|
|
95
|
+
text={showProgress ? formatProgress(progress) : String(text)}
|
|
96
96
|
{...textProps}
|
|
97
97
|
/>
|
|
98
98
|
) : text}
|
|
@@ -64,7 +64,7 @@ export const SearchInput: ComponentWithDefaultProps<SearchInputProps> = (props)
|
|
|
64
64
|
if (TypeGuards.isFunction(onClear)) onClear?.()
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
const showClearIcon = !!search?.trim() && clearable
|
|
67
|
+
const showClearIcon = !!String(search)?.trim() && clearable
|
|
68
68
|
|
|
69
69
|
return (
|
|
70
70
|
<TextInput
|
|
@@ -76,10 +76,12 @@ export const SearchInput: ComponentWithDefaultProps<SearchInputProps> = (props)
|
|
|
76
76
|
}}
|
|
77
77
|
debugName={`Search ${debugName}`}
|
|
78
78
|
rightIcon={showClearIcon && {
|
|
79
|
+
debugName: `Search ${debugName} right icon`,
|
|
79
80
|
name: clearIcon,
|
|
80
81
|
onPress: handleClear,
|
|
81
82
|
}}
|
|
82
83
|
leftIcon={{
|
|
84
|
+
debugName: `Search ${debugName} left icon`,
|
|
83
85
|
name: searchIcon,
|
|
84
86
|
}}
|
|
85
87
|
{...rest}
|
|
@@ -51,7 +51,7 @@ const SegmentedControlOptionCP = (props: SegmentedControlOptionProps, ref: Optio
|
|
|
51
51
|
variantStyles.button,
|
|
52
52
|
selected && variantStyles['button:selected'],
|
|
53
53
|
disabled && variantStyles['button:disabled'],
|
|
54
|
-
style,
|
|
54
|
+
style as any,
|
|
55
55
|
]}
|
|
56
56
|
onPress={onPress}
|
|
57
57
|
disabled={disabled}
|
|
@@ -135,7 +135,7 @@ export const SegmentedControl = (props: SegmentedControlProps) => {
|
|
|
135
135
|
largestWidth,
|
|
136
136
|
]
|
|
137
137
|
|
|
138
|
-
const onSelectTab = (option: SegmentedControlOptionProps, e?: React.KeyboardEvent<
|
|
138
|
+
const onSelectTab = (option: SegmentedControlOptionProps, e?: React.KeyboardEvent<HTMLButtonElement>) => {
|
|
139
139
|
if (!e || e?.keyCode === 13 || e?.key === 'Enter') {
|
|
140
140
|
if (!debounceEnabled || !TypeGuards.isNumber(debounce)) {
|
|
141
141
|
onValueChange(option.value)
|
|
@@ -418,8 +418,8 @@ export const Select = forwardRef<HTMLInputElement, SelectProps>(
|
|
|
418
418
|
tabSelectsValue={false}
|
|
419
419
|
tabIndex={0}
|
|
420
420
|
backspaceRemovesValue={true}
|
|
421
|
-
escapeRemoves={true}
|
|
422
|
-
deleteRemoves={true}
|
|
421
|
+
// escapeRemoves={true}
|
|
422
|
+
// deleteRemoves={true}
|
|
423
423
|
{...otherProps}
|
|
424
424
|
{..._props}
|
|
425
425
|
onKeyDown={isFocused ? handleKeyDown : null}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ComponentVariants, FormTypes, StylesOf, yup } from '@codeleap/common'
|
|
2
2
|
import { CSSInterpolation } from '@emotion/css'
|
|
3
3
|
import { CSSObject } from '@emotion/react'
|
|
4
|
+
import { MutableRefObject } from 'react'
|
|
4
5
|
import { GroupBase, NoticeProps, OptionProps, Props } from 'react-select'
|
|
5
6
|
import { AsyncProps } from 'react-select/async'
|
|
6
7
|
import { ComponentCommonProps } from '../../types'
|
|
@@ -95,8 +96,9 @@ export type SelectProps<T = any, Multi extends boolean = false> = React.PropsWit
|
|
|
95
96
|
limit?: number
|
|
96
97
|
loadInitialValue?: boolean
|
|
97
98
|
loadingMessage?: string
|
|
98
|
-
selectedOption?:
|
|
99
|
-
|
|
99
|
+
selectedOption?: { label: FormTypes.Label; value: T; } | SelectValue<T, Multi>
|
|
100
|
+
selectRef?: MutableRefObject<any>
|
|
101
|
+
setSelectedOption?: (value: { label: FormTypes.Label; value: T; } | SelectValue<T, Multi>) => void
|
|
100
102
|
} & Omit<
|
|
101
103
|
ReactSelectProps<T, Multi>,
|
|
102
104
|
'isSearchable' | 'isClearable' | 'isDisabled' | 'loadingMessage' | 'filterOption' |
|
|
@@ -89,7 +89,7 @@ export const Switch = (props: SwitchProps) => {
|
|
|
89
89
|
|
|
90
90
|
const _switchOnLeft = switchOnLeft ?? variantStyles.__props?.switchOnLeft
|
|
91
91
|
|
|
92
|
-
const handleChange = (e
|
|
92
|
+
const handleChange = (e) => {
|
|
93
93
|
if (disabled) return
|
|
94
94
|
if (e?.type === 'click' || e?.keyCode === 13 || e?.key === 'Enter') {
|
|
95
95
|
if (onValueChange) onValueChange?.(!value)
|
|
@@ -57,7 +57,7 @@ export const Text = <T extends ElementType>(textProps: TextProps<T>) => {
|
|
|
57
57
|
|
|
58
58
|
const disabled = isPressable === false
|
|
59
59
|
|
|
60
|
-
const _onPress = (e
|
|
60
|
+
const _onPress = (e) => {
|
|
61
61
|
if (disabled) return
|
|
62
62
|
|
|
63
63
|
const handlePress = () => {
|
|
@@ -91,12 +91,16 @@ export const Text = <T extends ElementType>(textProps: TextProps<T>) => {
|
|
|
91
91
|
onClick: disabled ? null : _onPress,
|
|
92
92
|
} : {}
|
|
93
93
|
|
|
94
|
+
const componentProps: any = {
|
|
95
|
+
...props,
|
|
96
|
+
...pressProps,
|
|
97
|
+
...animatedProps
|
|
98
|
+
}
|
|
99
|
+
|
|
94
100
|
return (
|
|
95
101
|
<Component
|
|
96
102
|
css={_styles}
|
|
97
|
-
{...
|
|
98
|
-
{...pressProps}
|
|
99
|
-
{...animatedProps}
|
|
103
|
+
{...componentProps}
|
|
100
104
|
>
|
|
101
105
|
{text || children}
|
|
102
106
|
</Component>
|
|
@@ -6,7 +6,7 @@ import { TextComposition, TextPresets } from './styles'
|
|
|
6
6
|
export type TextProps<T extends ElementType> = ComponentPropsWithoutRef<T> &
|
|
7
7
|
ComponentVariants<typeof TextPresets> & {
|
|
8
8
|
component?: T
|
|
9
|
-
text
|
|
9
|
+
text?: string
|
|
10
10
|
styles?: StylesOf<TextComposition>
|
|
11
11
|
msg?: string
|
|
12
12
|
debugName?: string
|
|
@@ -99,7 +99,7 @@ export const TextEditor = (props: TextEditorProps) => {
|
|
|
99
99
|
<_BubbleMenu />
|
|
100
100
|
<_FloatingMenu />
|
|
101
101
|
<EditorContent editor={editor} />
|
|
102
|
-
{hasError ? <Text text={errorMessage} css={variantStyles['errorMessage:error']} /> : null}
|
|
102
|
+
{hasError ? <Text text={errorMessage as string} css={variantStyles['errorMessage:error']} /> : null}
|
|
103
103
|
<FileInput
|
|
104
104
|
ref={fileInputRef}
|
|
105
105
|
/>
|
|
@@ -34,7 +34,7 @@ type NativeTextInputProps = HTMLProps<'input'>
|
|
|
34
34
|
|
|
35
35
|
export type TextInputProps =
|
|
36
36
|
Omit<InputBaseProps, 'styles' | 'variants'> &
|
|
37
|
-
Omit<NativeTextInputProps, 'value' | 'crossOrigin'> & {
|
|
37
|
+
Omit<NativeTextInputProps, 'value' | 'crossOrigin' | 'ref'> & {
|
|
38
38
|
styles?: StylesOf<TextInputComposition>
|
|
39
39
|
password?: boolean
|
|
40
40
|
validate?: FormTypes.ValidatorWithoutForm<string> | yup.SchemaOf<string>
|
|
@@ -114,10 +114,12 @@ export const TextInputComponent = forwardRef<InputRef, TextInputProps>((props, i
|
|
|
114
114
|
styles,
|
|
115
115
|
})
|
|
116
116
|
|
|
117
|
+
// @ts-ignore
|
|
117
118
|
useImperativeHandle(inputRef, () => {
|
|
118
119
|
return {
|
|
119
120
|
focus: () => {
|
|
120
121
|
if (isMasked) {
|
|
122
|
+
// @ts-expect-error
|
|
121
123
|
innerInputRef.current?.getInputDOMNode()?.focus()
|
|
122
124
|
}
|
|
123
125
|
|
|
@@ -226,6 +228,7 @@ export const TextInputComponent = forwardRef<InputRef, TextInputProps>((props, i
|
|
|
226
228
|
...(inputBaseProps.innerWrapperProps || {}),
|
|
227
229
|
[inputBaseAction]: () => {
|
|
228
230
|
if (isMasked) {
|
|
231
|
+
// @ts-expect-error
|
|
229
232
|
innerInputRef.current?.getInputDOMNode()?.focus()
|
|
230
233
|
}
|
|
231
234
|
innerInputRef.current?.focus?.()
|
|
@@ -277,6 +280,6 @@ export const TextInputComponent = forwardRef<InputRef, TextInputProps>((props, i
|
|
|
277
280
|
)
|
|
278
281
|
})
|
|
279
282
|
|
|
280
|
-
export const TextInput = TextInputComponent as ComponentWithDefaultProps<TextInputProps>
|
|
283
|
+
export const TextInput = TextInputComponent as unknown as ComponentWithDefaultProps<TextInputProps>
|
|
281
284
|
|
|
282
|
-
TextInput.defaultProps = defaultProps
|
|
285
|
+
TextInput.defaultProps = defaultProps as TextInputProps
|
|
@@ -32,7 +32,7 @@ export type TooltipProps = PrimitiveTooltipProps & TooltipComponentProps & {
|
|
|
32
32
|
toggle?: AnyFunction
|
|
33
33
|
visible?: boolean
|
|
34
34
|
content: React.ReactNode | ((props: TooltipProps & { variantsStyles: StylesOf<TooltipComposition> }) => JSX.Element)
|
|
35
|
-
triggerWrapper?: React.
|
|
35
|
+
triggerWrapper?: React.ElementType
|
|
36
36
|
triggerWrapperProps?: Partial<ViewProps<'div'>>
|
|
37
37
|
styles?: StylesOf<TooltipComposition>
|
|
38
38
|
side?: 'left' | 'right' | 'bottom' | 'top'
|
|
@@ -57,7 +57,7 @@ const defaultProps: Partial<TooltipProps> = {
|
|
|
57
57
|
delayDuration: 0,
|
|
58
58
|
closeOnClickOutside: false,
|
|
59
59
|
side: 'bottom',
|
|
60
|
-
triggerWrapper: View,
|
|
60
|
+
triggerWrapper: View as unknown as React.ElementType,
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
export const Tooltip: ComponentWithDefaultProps<TooltipProps> = (props: TooltipProps) => {
|
|
@@ -163,6 +163,7 @@ export const Tooltip: ComponentWithDefaultProps<TooltipProps> = (props: TooltipP
|
|
|
163
163
|
open={visible}
|
|
164
164
|
onOpenChange={onOpenChange}
|
|
165
165
|
{...rest}
|
|
166
|
+
// @ts-ignore expected error
|
|
166
167
|
css={[variantsStyles.wrapper, style]}
|
|
167
168
|
>
|
|
168
169
|
<TooltipTrigger
|
|
@@ -13,7 +13,7 @@ export type TouchableProps<T extends ElementType = 'button'> = ComponentPropsWit
|
|
|
13
13
|
component?: T
|
|
14
14
|
disabled?: boolean
|
|
15
15
|
propagate?: boolean
|
|
16
|
-
style?: React.
|
|
16
|
+
style?: React.CSSProperties
|
|
17
17
|
onPress?: AnyFunction
|
|
18
18
|
debugName: string
|
|
19
19
|
debugComponent?: string
|
|
@@ -26,10 +26,10 @@ export type TouchableProps<T extends ElementType = 'button'> = ComponentPropsWit
|
|
|
26
26
|
analyticsData?: Record<string, any>
|
|
27
27
|
} & ComponentVariants<typeof TouchablePresets>
|
|
28
28
|
|
|
29
|
-
const defaultProps: TouchableProps<'button'
|
|
29
|
+
const defaultProps: Partial<TouchableProps<'button'>> = {
|
|
30
30
|
propagate: true,
|
|
31
31
|
debounce: null,
|
|
32
|
-
component: View,
|
|
32
|
+
component: View as unknown as 'button',
|
|
33
33
|
style: {},
|
|
34
34
|
styles: {},
|
|
35
35
|
responsiveVariants: {},
|
|
@@ -44,7 +44,7 @@ export const TouchableCP = <T extends NativeHTMLElement = 'button'>(
|
|
|
44
44
|
touchableProps: TouchableProps<T>,
|
|
45
45
|
ref,
|
|
46
46
|
) => {
|
|
47
|
-
const mergedProps
|
|
47
|
+
const mergedProps = {
|
|
48
48
|
...(defaultProps),
|
|
49
49
|
...(touchableProps),
|
|
50
50
|
}
|
|
@@ -91,7 +91,7 @@ export const TouchableCP = <T extends NativeHTMLElement = 'button'>(
|
|
|
91
91
|
|
|
92
92
|
const notPressable = !TypeGuards.isFunction(onPress) && !TypeGuards.isFunction(onClick)
|
|
93
93
|
|
|
94
|
-
const handleClick = (event
|
|
94
|
+
const handleClick = (event) => {
|
|
95
95
|
if (disabled) return
|
|
96
96
|
|
|
97
97
|
if (!propagate) stopPropagation(event)
|
|
@@ -150,6 +150,7 @@ export const TouchableCP = <T extends NativeHTMLElement = 'button'>(
|
|
|
150
150
|
const testId = getTestId(mergedProps)
|
|
151
151
|
|
|
152
152
|
return (
|
|
153
|
+
// @ts-ignore
|
|
153
154
|
<View
|
|
154
155
|
component={Component || 'button'}
|
|
155
156
|
{...props}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { jsx, CSSObject } from '@emotion/react'
|
|
3
3
|
import { useDefaultComponentStyle, useCodeleapContext, useMemo, TypeGuards } from '@codeleap/common'
|
|
4
|
-
import { forwardRef, Ref } from 'react'
|
|
4
|
+
import React, { forwardRef, Ref } from 'react'
|
|
5
5
|
import { ViewPresets } from './styles'
|
|
6
6
|
import { useMediaQuery } from '../../lib/hooks'
|
|
7
7
|
import { NativeHTMLElement } from '../../types'
|
|
@@ -14,7 +14,7 @@ export * from './types'
|
|
|
14
14
|
|
|
15
15
|
export const ViewCP = (
|
|
16
16
|
viewProps: ViewProps<'div'>,
|
|
17
|
-
ref: Ref<any>,
|
|
17
|
+
ref: React.Ref<any>,
|
|
18
18
|
) => {
|
|
19
19
|
const {
|
|
20
20
|
responsiveVariants = {},
|
|
@@ -86,6 +86,7 @@ export const ViewCP = (
|
|
|
86
86
|
return (
|
|
87
87
|
<Component
|
|
88
88
|
css={componentStyles}
|
|
89
|
+
// @ts-expect-error
|
|
89
90
|
ref={ref}
|
|
90
91
|
{...onHoverProps}
|
|
91
92
|
{...props}
|