diff --git a/packages/design-system/src/components/Autocomplete/Autocomplete.tsx b/packages/design-system/src/components/Autocomplete/Autocomplete.tsx index 4982cce006..a3cebc5582 100644 --- a/packages/design-system/src/components/Autocomplete/Autocomplete.tsx +++ b/packages/design-system/src/components/Autocomplete/Autocomplete.tsx @@ -87,7 +87,7 @@ export interface AutocompleteProps { /** * Access a reference to the child `TextField`'s `input` element */ - inputRef?: React.Ref | React.MutableRefObject; + inputRef?: React.Ref | React.RefObject; /** * 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, diff --git a/packages/design-system/src/components/Button/Button.tsx b/packages/design-system/src/components/Button/Button.tsx index f7f34932aa..d258ec4ecc 100644 --- a/packages/design-system/src/components/Button/Button.tsx +++ b/packages/design-system/src/components/Button/Button.tsx @@ -8,7 +8,7 @@ export type ButtonSize = 'small' | 'big'; export type ButtonVariation = 'solid' | 'ghost'; -export type ButtonRef = React.Ref | React.MutableRefObject; +export type ButtonRef = React.Ref | React.RefObject; interface CommonButtonProps extends AnalyticsOverrideProps, AnalyticsParentDataProps { /** diff --git a/packages/design-system/src/components/ChoiceList/Choice.tsx b/packages/design-system/src/components/ChoiceList/Choice.tsx index 3b355bfa25..b86a774ad6 100644 --- a/packages/design-system/src/components/ChoiceList/Choice.tsx +++ b/packages/design-system/src/components/ChoiceList/Choice.tsx @@ -56,7 +56,7 @@ export interface BaseChoiceProps { /** * Access a reference to the `input` element */ - inputRef?: React.Ref | React.MutableRefObject; + inputRef?: React.Ref | React.RefObject; /** * 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. diff --git a/packages/design-system/src/components/DateField/DateInput.tsx b/packages/design-system/src/components/DateField/DateInput.tsx index 18312ba31a..ca646403e5 100644 --- a/packages/design-system/src/components/DateField/DateInput.tsx +++ b/packages/design-system/src/components/DateField/DateInput.tsx @@ -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'; @@ -72,7 +72,7 @@ export interface DateInputProps { /** * Access a reference to the day `input` */ - dayFieldRef?: MutableRefObject | ((...args: any[]) => any); + dayFieldRef?: RefObject | ((...args: any[]) => any); /** * Apply error styling to the day `input` */ @@ -102,7 +102,7 @@ export interface DateInputProps { /** * Access a reference to the month `input` */ - monthFieldRef?: MutableRefObject | ((...args: any[]) => any); + monthFieldRef?: RefObject | ((...args: any[]) => any); /** * Apply error styling to the month `input` */ @@ -120,7 +120,7 @@ export interface DateInputProps { /** * Access a reference to the year `input` */ - yearFieldRef?: MutableRefObject | ((...args: any[]) => any); + yearFieldRef?: RefObject | ((...args: any[]) => any); /** * Apply error styling to the year `input` */ diff --git a/packages/design-system/src/components/Drawer/Drawer.tsx b/packages/design-system/src/components/Drawer/Drawer.tsx index a92c77b266..36cd12936f 100644 --- a/packages/design-system/src/components/Drawer/Drawer.tsx +++ b/packages/design-system/src/components/Drawer/Drawer.tsx @@ -49,7 +49,7 @@ export interface DrawerProps { /** * Ref to heading element */ - headingRef?: React.MutableRefObject; + headingRef?: React.RefObject; /** * Enables "sticky" position of Drawer header element. */ diff --git a/packages/design-system/src/components/Dropdown/Dropdown.tsx b/packages/design-system/src/components/Dropdown/Dropdown.tsx index 791cb52c7e..ae3c7863e1 100644 --- a/packages/design-system/src/components/Dropdown/Dropdown.tsx +++ b/packages/design-system/src/components/Dropdown/Dropdown.tsx @@ -70,7 +70,7 @@ export interface BaseDropdownProps { /** * Access a reference to the `button` element */ - inputRef?: React.Ref | React.MutableRefObject; + inputRef?: React.Ref | React.RefObject; /** * Set to `true` to apply the "inverse" color scheme */ diff --git a/packages/design-system/src/components/NativeDialog/NativeDialog.tsx b/packages/design-system/src/components/NativeDialog/NativeDialog.tsx index e526433dad..c20303c1da 100644 --- a/packages/design-system/src/components/NativeDialog/NativeDialog.tsx +++ b/packages/design-system/src/components/NativeDialog/NativeDialog.tsx @@ -8,7 +8,7 @@ export interface NativeDialogProps extends Omit; + boundingBoxRef?: React.RefObject; /** * Controls whether the dialog is in an open state */ diff --git a/packages/design-system/src/components/TextField/TextField.tsx b/packages/design-system/src/components/TextField/TextField.tsx index c77befeb82..756d7b0c2b 100644 --- a/packages/design-system/src/components/TextField/TextField.tsx +++ b/packages/design-system/src/components/TextField/TextField.tsx @@ -45,7 +45,7 @@ interface BaseTextFieldProps { /** * Access a reference to the `input` or `textarea` element */ - inputRef?: React.Ref | React.MutableRefObject; + inputRef?: React.Ref | React.RefObject; /** * Set to `true` to apply the "inverse" color scheme */ diff --git a/packages/design-system/src/components/TextField/TextInput.tsx b/packages/design-system/src/components/TextField/TextInput.tsx index a4acb40b13..9189a15789 100644 --- a/packages/design-system/src/components/TextField/TextInput.tsx +++ b/packages/design-system/src/components/TextField/TextInput.tsx @@ -52,7 +52,7 @@ export type TextInputProps = Omit, OmitP * applicable if this is a multiline field. */ rows?: TextInputRows; - inputRef?: React.Ref | React.MutableRefObject; + inputRef?: React.Ref | React.RefObject; /** * Set the max-width of the input either to `'small'` or `'medium'`. */ diff --git a/packages/design-system/src/components/utilities/mergeRefs.ts b/packages/design-system/src/components/utilities/mergeRefs.ts index 6ae4779b13..389901c4d9 100644 --- a/packages/design-system/src/components/utilities/mergeRefs.ts +++ b/packages/design-system/src/components/utilities/mergeRefs.ts @@ -4,14 +4,14 @@ * Borrowed from https://github.com/gregberge/react-merge-refs/blob/main/src/index.tsx */ export default function mergeRefs( - refs: Array | React.LegacyRef> + refs: Array | React.Ref> ): React.RefCallback { return (value) => { refs.forEach((ref) => { if (typeof ref === 'function') { ref(value); } else if (ref != null) { - (ref as React.MutableRefObject).current = value; + (ref as React.RefObject).current = value; } }); }; diff --git a/packages/docs/src/components/layout/FilterDialog/FilterDialog.tsx b/packages/docs/src/components/layout/FilterDialog/FilterDialog.tsx index d1abcef3f3..34f129d3e2 100644 --- a/packages/docs/src/components/layout/FilterDialog/FilterDialog.tsx +++ b/packages/docs/src/components/layout/FilterDialog/FilterDialog.tsx @@ -36,7 +36,7 @@ export interface FilterDialogProps { /** * Ref to heading element */ - headingRef?: React.MutableRefObject; + headingRef?: React.RefObject; /** * A custom `id` attribute for the dialog element */ diff --git a/tests/browser/snapshots/storybook-docs/Docs-Components-Autocomplete-Docs-prop-table-matches-snapshot-1.txt b/tests/browser/snapshots/storybook-docs/Docs-Components-Autocomplete-Docs-prop-table-matches-snapshot-1.txt index e8809ca631..1eaa43eba2 100644 --- a/tests/browser/snapshots/storybook-docs/Docs-Components-Autocomplete-Docs-prop-table-matches-snapshot-1.txt +++ b/tests/browser/snapshots/storybook-docs/Docs-Components-Autocomplete-Docs-prop-table-matches-snapshot-1.txt @@ -36,7 +36,7 @@ ], [ "inputRef", - "Access a reference to the child TextField's input element\nRef | MutableRefObject", + "Access a reference to the child TextField's input element\nRef", "-" ], [ diff --git a/tests/browser/snapshots/storybook-docs/Docs-Components-Choice-Docs-prop-table-matches-snapshot-1.txt b/tests/browser/snapshots/storybook-docs/Docs-Components-Choice-Docs-prop-table-matches-snapshot-1.txt index 0907c3f4bb..77128cc238 100644 --- a/tests/browser/snapshots/storybook-docs/Docs-Components-Choice-Docs-prop-table-matches-snapshot-1.txt +++ b/tests/browser/snapshots/storybook-docs/Docs-Components-Choice-Docs-prop-table-matches-snapshot-1.txt @@ -66,7 +66,7 @@ ], [ "inputRef", - "Access a reference to the input element\nRef | MutableRefObject", + "Access a reference to the input element\nRef", "-" ], [ diff --git a/tests/browser/snapshots/storybook-docs/Docs-Components-Drawer-Docs-prop-table-matches-snapshot-1.txt b/tests/browser/snapshots/storybook-docs/Docs-Components-Drawer-Docs-prop-table-matches-snapshot-1.txt index 21435b0a23..448092f8c8 100644 --- a/tests/browser/snapshots/storybook-docs/Docs-Components-Drawer-Docs-prop-table-matches-snapshot-1.txt +++ b/tests/browser/snapshots/storybook-docs/Docs-Components-Drawer-Docs-prop-table-matches-snapshot-1.txt @@ -66,7 +66,7 @@ ], [ "headingRef", - "Ref to heading element\nMutableRefObject", + "Ref to heading element\nRefObject", "-" ], [ diff --git a/tests/browser/snapshots/storybook-docs/Docs-Components-Dropdown-Docs-prop-table-matches-snapshot-1.txt b/tests/browser/snapshots/storybook-docs/Docs-Components-Dropdown-Docs-prop-table-matches-snapshot-1.txt index 0d2ee84a26..e33fdf9859 100644 --- a/tests/browser/snapshots/storybook-docs/Docs-Components-Dropdown-Docs-prop-table-matches-snapshot-1.txt +++ b/tests/browser/snapshots/storybook-docs/Docs-Components-Dropdown-Docs-prop-table-matches-snapshot-1.txt @@ -87,7 +87,7 @@ ], [ "inputRef", - "Access a reference to the button element\nRef | MutableRefObject", + "Access a reference to the button element\nRef", "-" ], [ diff --git a/tests/browser/snapshots/storybook-docs/Docs-Components-HelpDrawer-Docs-prop-table-matches-snapshot-1.txt b/tests/browser/snapshots/storybook-docs/Docs-Components-HelpDrawer-Docs-prop-table-matches-snapshot-1.txt index 3496903cc4..28d91b3ebb 100644 --- a/tests/browser/snapshots/storybook-docs/Docs-Components-HelpDrawer-Docs-prop-table-matches-snapshot-1.txt +++ b/tests/browser/snapshots/storybook-docs/Docs-Components-HelpDrawer-Docs-prop-table-matches-snapshot-1.txt @@ -71,7 +71,7 @@ ], [ "headingRef", - "Ref to heading element\nMutableRefObject", + "Ref to heading element\nRefObject", "-" ], [ diff --git a/tests/browser/snapshots/storybook-docs/Docs-Components-SingleInputDateField-Docs-prop-table-matches-snapshot-1.txt b/tests/browser/snapshots/storybook-docs/Docs-Components-SingleInputDateField-Docs-prop-table-matches-snapshot-1.txt index 2c1d38dc10..701b9f6bfb 100644 --- a/tests/browser/snapshots/storybook-docs/Docs-Components-SingleInputDateField-Docs-prop-table-matches-snapshot-1.txt +++ b/tests/browser/snapshots/storybook-docs/Docs-Components-SingleInputDateField-Docs-prop-table-matches-snapshot-1.txt @@ -80,7 +80,7 @@ ], [ "inputRef", - "Ref | MutableRefObject", + "Ref", "-" ], [ diff --git a/tests/browser/snapshots/storybook-docs/Docs-Components-TextField-Docs-prop-table-matches-snapshot-1.txt b/tests/browser/snapshots/storybook-docs/Docs-Components-TextField-Docs-prop-table-matches-snapshot-1.txt index b3fa35e0ba..738c15b90a 100644 --- a/tests/browser/snapshots/storybook-docs/Docs-Components-TextField-Docs-prop-table-matches-snapshot-1.txt +++ b/tests/browser/snapshots/storybook-docs/Docs-Components-TextField-Docs-prop-table-matches-snapshot-1.txt @@ -71,7 +71,7 @@ ], [ "inputRef", - "Access a reference to the input or textarea element\nRef | MutableRefObject", + "Access a reference to the input or textarea element\nRef", "-" ], [ diff --git a/tests/browser/snapshots/storybook-docs/Docs-Medicare-MedicaregovHelpDrawer-Docs-prop-table-matches-snapshot-1.txt b/tests/browser/snapshots/storybook-docs/Docs-Medicare-MedicaregovHelpDrawer-Docs-prop-table-matches-snapshot-1.txt index a1e1ba1b6b..630b96c243 100644 --- a/tests/browser/snapshots/storybook-docs/Docs-Medicare-MedicaregovHelpDrawer-Docs-prop-table-matches-snapshot-1.txt +++ b/tests/browser/snapshots/storybook-docs/Docs-Medicare-MedicaregovHelpDrawer-Docs-prop-table-matches-snapshot-1.txt @@ -66,7 +66,7 @@ ], [ "headingRef", - "Ref to heading element\nMutableRefObject", + "Ref to heading element\nRefObject", "-" ], [