Skip to content

Commit 363ab7b

Browse files
[NO-TICKET] Remove deprecated ref types (#3868)
* Remove deprecated types * Update snapshots * Update snapshot
1 parent 95befd9 commit 363ab7b

19 files changed

+23
-23
lines changed

packages/design-system/src/components/Autocomplete/Autocomplete.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export interface AutocompleteProps {
8787
/**
8888
* Access a reference to the child `TextField`'s `input` element
8989
*/
90-
inputRef?: React.Ref<any> | React.MutableRefObject<any>;
90+
inputRef?: React.Ref<any> | React.RefObject<any>;
9191
/**
9292
* Array of objects used to populate the suggestion list that appears below the input as users type.
9393
* Passing an empty array will show a "No results" message. If you do not yet want to show results,

packages/design-system/src/components/Button/Button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export type ButtonSize = 'small' | 'big';
88

99
export type ButtonVariation = 'solid' | 'ghost';
1010

11-
export type ButtonRef = React.Ref<any> | React.MutableRefObject<any>;
11+
export type ButtonRef = React.Ref<any> | React.RefObject<any>;
1212

1313
interface CommonButtonProps extends AnalyticsOverrideProps, AnalyticsParentDataProps {
1414
/**

packages/design-system/src/components/ChoiceList/Choice.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export interface BaseChoiceProps {
5656
/**
5757
* Access a reference to the `input` element
5858
*/
59-
inputRef?: React.Ref<any> | React.MutableRefObject<any>;
59+
inputRef?: React.Ref<any> | React.RefObject<any>;
6060
/**
6161
* A unique ID to be used for the input field, as well as the label's
6262
* `for` attribute. A unique ID will be generated if one isn't provided.

packages/design-system/src/components/DateField/DateInput.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { DateObject } from './defaultDateFormatter';
2-
import { MutableRefObject, PureComponent } from 'react';
2+
import { RefObject, PureComponent } from 'react';
33
import type * as React from 'react';
44
import TextField from '../TextField/TextField';
55
import classNames from 'classnames';
@@ -72,7 +72,7 @@ export interface DateInputProps {
7272
/**
7373
* Access a reference to the day `input`
7474
*/
75-
dayFieldRef?: MutableRefObject<any> | ((...args: any[]) => any);
75+
dayFieldRef?: RefObject<any> | ((...args: any[]) => any);
7676
/**
7777
* Apply error styling to the day `input`
7878
*/
@@ -102,7 +102,7 @@ export interface DateInputProps {
102102
/**
103103
* Access a reference to the month `input`
104104
*/
105-
monthFieldRef?: MutableRefObject<any> | ((...args: any[]) => any);
105+
monthFieldRef?: RefObject<any> | ((...args: any[]) => any);
106106
/**
107107
* Apply error styling to the month `input`
108108
*/
@@ -120,7 +120,7 @@ export interface DateInputProps {
120120
/**
121121
* Access a reference to the year `input`
122122
*/
123-
yearFieldRef?: MutableRefObject<any> | ((...args: any[]) => any);
123+
yearFieldRef?: RefObject<any> | ((...args: any[]) => any);
124124
/**
125125
* Apply error styling to the year `input`
126126
*/

packages/design-system/src/components/Drawer/Drawer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export interface DrawerProps {
4949
/**
5050
* Ref to heading element
5151
*/
52-
headingRef?: React.MutableRefObject<any>;
52+
headingRef?: React.RefObject<any>;
5353
/**
5454
* Enables "sticky" position of Drawer header element.
5555
*/

packages/design-system/src/components/Dropdown/Dropdown.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export interface BaseDropdownProps {
7070
/**
7171
* Access a reference to the `button` element
7272
*/
73-
inputRef?: React.Ref<any> | React.MutableRefObject<any>;
73+
inputRef?: React.Ref<any> | React.RefObject<any>;
7474
/**
7575
* Set to `true` to apply the "inverse" color scheme
7676
*/

packages/design-system/src/components/NativeDialog/NativeDialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export interface NativeDialogProps extends Omit<DialogHTMLAttributes<HTMLElement
88
* Pass `true` to have the dialog close when its backdrop pseudo-element is clicked
99
*/
1010
backdropClickExits?: boolean;
11-
boundingBoxRef?: React.MutableRefObject<any>;
11+
boundingBoxRef?: React.RefObject<any>;
1212
/**
1313
* Controls whether the dialog is in an open state
1414
*/

packages/design-system/src/components/TextField/TextField.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ interface BaseTextFieldProps {
4545
/**
4646
* Access a reference to the `input` or `textarea` element
4747
*/
48-
inputRef?: React.Ref<any> | React.MutableRefObject<any>;
48+
inputRef?: React.Ref<any> | React.RefObject<any>;
4949
/**
5050
* Set to `true` to apply the "inverse" color scheme
5151
*/

packages/design-system/src/components/TextField/TextInput.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export type TextInputProps = Omit<React.ComponentPropsWithoutRef<'input'>, OmitP
5252
* applicable if this is a multiline field.
5353
*/
5454
rows?: TextInputRows;
55-
inputRef?: React.Ref<any> | React.MutableRefObject<any>;
55+
inputRef?: React.Ref<any> | React.RefObject<any>;
5656
/**
5757
* Set the max-width of the input either to `'small'` or `'medium'`.
5858
*/

packages/design-system/src/components/utilities/mergeRefs.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
* Borrowed from https://github.com/gregberge/react-merge-refs/blob/main/src/index.tsx
55
*/
66
export default function mergeRefs<T = any>(
7-
refs: Array<React.MutableRefObject<T> | React.LegacyRef<T>>
7+
refs: Array<React.RefObject<T> | React.Ref<T>>
88
): React.RefCallback<T> {
99
return (value) => {
1010
refs.forEach((ref) => {
1111
if (typeof ref === 'function') {
1212
ref(value);
1313
} else if (ref != null) {
14-
(ref as React.MutableRefObject<T | null>).current = value;
14+
(ref as React.RefObject<T | null>).current = value;
1515
}
1616
});
1717
};

0 commit comments

Comments
 (0)