Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export interface AutocompleteProps {
/**
* Access a reference to the child `TextField`'s `input` element
*/
inputRef?: React.Ref<any> | React.MutableRefObject<any>;
inputRef?: React.Ref<any> | React.RefObject<any>;
/**
* Array of objects used to populate the suggestion list that appears below the input as users type.
* Passing an empty array will show a "No results" message. If you do not yet want to show results,
Expand Down
2 changes: 1 addition & 1 deletion packages/design-system/src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export type ButtonSize = 'small' | 'big';

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

export type ButtonRef = React.Ref<any> | React.MutableRefObject<any>;
export type ButtonRef = React.Ref<any> | React.RefObject<any>;

interface CommonButtonProps extends AnalyticsOverrideProps, AnalyticsParentDataProps {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export interface BaseChoiceProps {
/**
* Access a reference to the `input` element
*/
inputRef?: React.Ref<any> | React.MutableRefObject<any>;
inputRef?: React.Ref<any> | React.RefObject<any>;
/**
* A unique ID to be used for the input field, as well as the label's
* `for` attribute. A unique ID will be generated if one isn't provided.
Expand Down
8 changes: 4 additions & 4 deletions packages/design-system/src/components/DateField/DateInput.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DateObject } from './defaultDateFormatter';
import { MutableRefObject, PureComponent } from 'react';
import { RefObject, PureComponent } from 'react';
import type * as React from 'react';
import TextField from '../TextField/TextField';
import classNames from 'classnames';
Expand Down Expand Up @@ -72,7 +72,7 @@ export interface DateInputProps {
/**
* Access a reference to the day `input`
*/
dayFieldRef?: MutableRefObject<any> | ((...args: any[]) => any);
dayFieldRef?: RefObject<any> | ((...args: any[]) => any);
/**
* Apply error styling to the day `input`
*/
Expand Down Expand Up @@ -102,7 +102,7 @@ export interface DateInputProps {
/**
* Access a reference to the month `input`
*/
monthFieldRef?: MutableRefObject<any> | ((...args: any[]) => any);
monthFieldRef?: RefObject<any> | ((...args: any[]) => any);
/**
* Apply error styling to the month `input`
*/
Expand All @@ -120,7 +120,7 @@ export interface DateInputProps {
/**
* Access a reference to the year `input`
*/
yearFieldRef?: MutableRefObject<any> | ((...args: any[]) => any);
yearFieldRef?: RefObject<any> | ((...args: any[]) => any);
/**
* Apply error styling to the year `input`
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/design-system/src/components/Drawer/Drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export interface DrawerProps {
/**
* Ref to heading element
*/
headingRef?: React.MutableRefObject<any>;
headingRef?: React.RefObject<any>;
/**
* Enables "sticky" position of Drawer header element.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export interface BaseDropdownProps {
/**
* Access a reference to the `button` element
*/
inputRef?: React.Ref<any> | React.MutableRefObject<any>;
inputRef?: React.Ref<any> | React.RefObject<any>;
/**
* Set to `true` to apply the "inverse" color scheme
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface NativeDialogProps extends Omit<DialogHTMLAttributes<HTMLElement
* Pass `true` to have the dialog close when its backdrop pseudo-element is clicked
*/
backdropClickExits?: boolean;
boundingBoxRef?: React.MutableRefObject<any>;
boundingBoxRef?: React.RefObject<any>;
/**
* Controls whether the dialog is in an open state
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ interface BaseTextFieldProps {
/**
* Access a reference to the `input` or `textarea` element
*/
inputRef?: React.Ref<any> | React.MutableRefObject<any>;
inputRef?: React.Ref<any> | React.RefObject<any>;
/**
* Set to `true` to apply the "inverse" color scheme
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export type TextInputProps = Omit<React.ComponentPropsWithoutRef<'input'>, OmitP
* applicable if this is a multiline field.
*/
rows?: TextInputRows;
inputRef?: React.Ref<any> | React.MutableRefObject<any>;
inputRef?: React.Ref<any> | React.RefObject<any>;
/**
* Set the max-width of the input either to `'small'` or `'medium'`.
*/
Expand Down
4 changes: 2 additions & 2 deletions packages/design-system/src/components/utilities/mergeRefs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
* Borrowed from https://github.com/gregberge/react-merge-refs/blob/main/src/index.tsx
*/
export default function mergeRefs<T = any>(
refs: Array<React.MutableRefObject<T> | React.LegacyRef<T>>
refs: Array<React.RefObject<T> | React.Ref<T>>
): React.RefCallback<T> {
return (value) => {
refs.forEach((ref) => {
if (typeof ref === 'function') {
ref(value);
} else if (ref != null) {
(ref as React.MutableRefObject<T | null>).current = value;
(ref as React.RefObject<T | null>).current = value;
}
});
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export interface FilterDialogProps {
/**
* Ref to heading element
*/
headingRef?: React.MutableRefObject<any>;
headingRef?: React.RefObject<any>;
/**
* A custom `id` attribute for the dialog element
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
],
[
"inputRef",
"Access a reference to the child TextField's input element\nRef<any> | MutableRefObject<any>",
"Access a reference to the child TextField's input element\nRef<any>",
"-"
],
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
],
[
"inputRef",
"Access a reference to the input element\nRef<any> | MutableRefObject<any>",
"Access a reference to the input element\nRef<any>",
"-"
],
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
],
[
"headingRef",
"Ref to heading element\nMutableRefObject<any>",
"Ref to heading element\nRefObject<any>",
"-"
],
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
],
[
"inputRef",
"Access a reference to the button element\nRef<any> | MutableRefObject<any>",
"Access a reference to the button element\nRef<any>",
"-"
],
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
],
[
"headingRef",
"Ref to heading element\nMutableRefObject<any>",
"Ref to heading element\nRefObject<any>",
"-"
],
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
],
[
"inputRef",
"Ref<any> | MutableRefObject<any>",
"Ref<any>",
"-"
],
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
],
[
"inputRef",
"Access a reference to the input or textarea element\nRef<any> | MutableRefObject<any>",
"Access a reference to the input or textarea element\nRef<any>",
"-"
],
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
],
[
"headingRef",
"Ref to heading element\nMutableRefObject<any>",
"Ref to heading element\nRefObject<any>",
"-"
],
[
Expand Down