Skip to content

Commit f34ef54

Browse files
committed
fix: Omit props removed in future versions of @types/react
1 parent c3ac8d1 commit f34ef54

File tree

7 files changed

+49
-7
lines changed

7 files changed

+49
-7
lines changed

src/checkbox-field/checkbox-field.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ import { CheckboxIcon } from './checkbox-icon'
66

77
import styles from './checkbox-field.module.css'
88

9+
/**
10+
* FIXME: This is a workaround for consumers that are using newer versions of React types that no longer have these props.
11+
* Once we upgrade Reactist to the newest React types, we should be able to remove these.
12+
*/
13+
type DeprecatedProps = 'crossOrigin' | 'onPointerEnterCapture' | 'onPointerLeaveCapture'
14+
915
type CheckboxFieldProps = Omit<
1016
JSX.IntrinsicElements['input'],
1117
| 'type'
@@ -15,7 +21,7 @@ type CheckboxFieldProps = Omit<
1521
| 'aria-describedby'
1622
| 'aria-label'
1723
| 'aria-labelledby'
18-
| 'crossOrigin'
24+
| DeprecatedProps
1925
> & {
2026
'aria-checked'?: never
2127
/** Identifies the set of checkboxes controlled by the mixed checkbox for assistive technologies. */

src/heading/heading.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,15 @@ import type { BoxProps } from '../box'
99
type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6 | '1' | '2' | '3' | '4' | '5' | '6'
1010
type HeadingElement = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'
1111

12+
/**
13+
* FIXME: This is a workaround for consumers that are using newer versions of React types that no longer have these props.
14+
* Once we upgrade Reactist to the newest React types, we should be able to remove these.
15+
*/
16+
type DeprecatedProps = 'placeholder' | 'onPointerEnterCapture' | 'onPointerLeaveCapture'
17+
1218
type SupportedHeadingElementProps = Omit<
1319
JSX.IntrinsicElements[HeadingElement],
14-
'className' | 'children' | 'placeholder'
20+
'className' | 'children' | DeprecatedProps
1521
>
1622

1723
type HeadingProps = SupportedHeadingElementProps & {

src/password-field/password-field.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,13 @@ import { Button } from '../button'
88

99
import type { BaseFieldVariantProps } from '../base-field'
1010

11-
type PasswordFieldProps = Omit<TextFieldProps, 'type' | 'startSlot' | 'endSlot' | 'crossOrigin'> &
11+
/**
12+
* FIXME: This is a workaround for consumers that are using newer versions of React types that no longer have these props.
13+
* Once we upgrade Reactist to the newest React types, we should be able to remove these.
14+
*/
15+
type DeprecatedProps = 'crossOrigin' | 'onPointerEnterCapture' | 'onPointerLeaveCapture'
16+
17+
type PasswordFieldProps = Omit<TextFieldProps, 'type' | 'startSlot' | 'endSlot' | DeprecatedProps> &
1218
BaseFieldVariantProps & {
1319
togglePasswordLabel?: string
1420
}

src/select-field/select-field.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@ import { BaseField, BaseFieldVariantProps, FieldComponentProps } from '../base-f
33
import { Box } from '../box'
44
import styles from './select-field.module.css'
55

6-
type SelectFieldProps = Omit<FieldComponentProps<HTMLSelectElement>, 'crossOrigin'> &
6+
/**
7+
* FIXME: This is a workaround for consumers that are using newer versions of React types that no longer have these props.
8+
* Once we upgrade Reactist to the newest React types, we should be able to remove these.
9+
*/
10+
type DeprecatedProps = 'crossOrigin' | 'onPointerEnterCapture' | 'onPointerLeaveCapture'
11+
12+
type SelectFieldProps = Omit<FieldComponentProps<HTMLSelectElement>, DeprecatedProps> &
713
BaseFieldVariantProps
814

915
const SelectField = React.forwardRef<HTMLSelectElement, SelectFieldProps>(function SelectField(

src/switch-field/switch-field.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ import { FieldComponentProps, FieldHint } from '../base-field'
77
import { useId } from '../utils/common-helpers'
88
import styles from './switch-field.module.css'
99

10+
/**
11+
* FIXME: This is a workaround for consumers that are using newer versions of React types that no longer have these props.
12+
* Once we upgrade Reactist to the newest React types, we should be able to remove these.
13+
*/
14+
type DeprecatedProps = 'crossOrigin' | 'onPointerEnterCapture' | 'onPointerLeaveCapture'
15+
1016
type SwitchFieldProps = Omit<
1117
FieldComponentProps<HTMLInputElement>,
1218
| 'type'
@@ -16,7 +22,7 @@ type SwitchFieldProps = Omit<
1622
| 'aria-describedby'
1723
| 'aria-label'
1824
| 'aria-labelledby'
19-
| 'crossOrigin'
25+
| DeprecatedProps
2026
> & {
2127
/** Identifies the element (or elements) that describes the switch for assistive technologies. */
2228
'aria-describedby'?: string

src/text-area/text-area.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@ import { BaseField, BaseFieldVariantProps, FieldComponentProps } from '../base-f
44
import { Box } from '../box'
55
import styles from './text-area.module.css'
66

7-
type TextAreaProps = Omit<FieldComponentProps<HTMLTextAreaElement>, 'crossOrigin'> &
7+
/**
8+
* FIXME: This is a workaround for consumers that are using newer versions of React types that no longer have these props.
9+
* Once we upgrade Reactist to the newest React types, we should be able to remove these.
10+
*/
11+
type DeprecatedProps = 'crossOrigin' | 'onPointerEnterCapture' | 'onPointerLeaveCapture'
12+
13+
type TextAreaProps = Omit<FieldComponentProps<HTMLTextAreaElement>, DeprecatedProps> &
814
BaseFieldVariantProps & {
915
/**
1016
* The number of visible text lines for the text area.

src/text-field/text-field.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,15 @@ import styles from './text-field.module.css'
55
import type { FieldComponentProps } from '../base-field'
66
import { useMergeRefs } from 'use-callback-ref'
77

8+
/**
9+
* FIXME: This is a workaround for consumers that are using newer versions of React types that no longer have these props.
10+
* Once we upgrade Reactist to the newest React types, we should be able to remove these.
11+
*/
12+
type DeprecatedProps = 'crossOrigin' | 'onPointerEnterCapture' | 'onPointerLeaveCapture'
13+
814
type TextFieldType = 'email' | 'search' | 'tel' | 'text' | 'url'
915

10-
type TextFieldProps = Omit<FieldComponentProps<HTMLInputElement>, 'type' | 'crossOrigin'> &
16+
type TextFieldProps = Omit<FieldComponentProps<HTMLInputElement>, 'type' | DeprecatedProps> &
1117
BaseFieldVariantProps & {
1218
type?: TextFieldType
1319
startSlot?: React.ReactChild

0 commit comments

Comments
 (0)