From a11d0364a5beaa3d018db559656c3d7806e1b484 Mon Sep 17 00:00:00 2001 From: Afsal K Date: Wed, 13 Nov 2024 10:38:11 +0530 Subject: [PATCH] fix(tearsheet): address portalTarget type (#6400) * fix(tearsheet): address portalTarget type * fix(addSelect): address portalTarget type --- packages/ibm-products/src/components/AddSelect/AddSelect.tsx | 5 +++-- .../ibm-products/src/components/AddSelect/AddSelectBody.tsx | 5 +++-- packages/ibm-products/src/components/Tearsheet/Tearsheet.tsx | 2 +- .../src/components/Tearsheet/TearsheetNarrow.tsx | 2 +- .../ibm-products/src/components/Tearsheet/TearsheetShell.tsx | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/ibm-products/src/components/AddSelect/AddSelect.tsx b/packages/ibm-products/src/components/AddSelect/AddSelect.tsx index de3a3aa11f..474ac88a1f 100644 --- a/packages/ibm-products/src/components/AddSelect/AddSelect.tsx +++ b/packages/ibm-products/src/components/AddSelect/AddSelect.tsx @@ -5,7 +5,7 @@ // LICENSE file in the root directory of this source tree. // -import React, { ForwardedRef, ReactNode, forwardRef } from 'react'; +import React, { ForwardedRef, forwardRef } from 'react'; import PropTypes from 'prop-types'; import { AddSelectBody } from './AddSelectBody'; import { normalize, getGlobalFilterValues } from './add-select-utils'; @@ -48,7 +48,7 @@ export interface AddSelectProps { /** * portal target for the all tags modal */ - portalTarget?: ReactNode; + portalTarget?: HTMLElement; searchResultsTitle?: string; sortByLabel?: string; title: string; @@ -172,6 +172,7 @@ AddSelect.propTypes = { /** * portal target for the all tags modal */ + /**@ts-ignore */ portalTarget: PropTypes.node, searchResultsTitle: PropTypes.string, sortByLabel: PropTypes.string, diff --git a/packages/ibm-products/src/components/AddSelect/AddSelectBody.tsx b/packages/ibm-products/src/components/AddSelect/AddSelectBody.tsx index 125f65fa55..94fed778e3 100644 --- a/packages/ibm-products/src/components/AddSelect/AddSelectBody.tsx +++ b/packages/ibm-products/src/components/AddSelect/AddSelectBody.tsx @@ -5,7 +5,7 @@ // LICENSE file in the root directory of this source tree. // -import React, { ForwardedRef, ReactNode, forwardRef, useState } from 'react'; +import React, { ForwardedRef, forwardRef, useState } from 'react'; import PropTypes from 'prop-types'; import cx from 'classnames'; import { Tag } from '@carbon/react'; @@ -67,7 +67,7 @@ export interface AddSelectBodyProps { onSubmit?: (selection) => void; onSubmitButtonText?: string; open?: boolean; - portalTarget?: ReactNode; + portalTarget?: HTMLElement; searchResultsTitle?: string; sortByLabel?: string; title?: string; @@ -457,6 +457,7 @@ AddSelectBody.propTypes = { onSubmit: PropTypes.func, onSubmitButtonText: PropTypes.string, open: PropTypes.bool, + /**@ts-ignore */ portalTarget: PropTypes.node, searchResultsTitle: PropTypes.string, sortByLabel: PropTypes.string, diff --git a/packages/ibm-products/src/components/Tearsheet/Tearsheet.tsx b/packages/ibm-products/src/components/Tearsheet/Tearsheet.tsx index 74c1eb598f..655a76b8b1 100644 --- a/packages/ibm-products/src/components/Tearsheet/Tearsheet.tsx +++ b/packages/ibm-products/src/components/Tearsheet/Tearsheet.tsx @@ -145,7 +145,7 @@ export interface TearsheetProps extends PropsWithChildren { /** * The DOM element that the tearsheet should be rendered within. Defaults to document.body. */ - portalTarget?: ReactNode; + portalTarget?: HTMLElement; /** * Specify a CSS selector that matches the DOM element that should be diff --git a/packages/ibm-products/src/components/Tearsheet/TearsheetNarrow.tsx b/packages/ibm-products/src/components/Tearsheet/TearsheetNarrow.tsx index ee3ea2f50b..0d2e51d871 100644 --- a/packages/ibm-products/src/components/Tearsheet/TearsheetNarrow.tsx +++ b/packages/ibm-products/src/components/Tearsheet/TearsheetNarrow.tsx @@ -86,7 +86,7 @@ interface TearsheetNarrowBaseProps extends PropsWithChildren { /** * The DOM element that the tearsheet should be rendered within. Defaults to document.body. */ - portalTarget?: ReactNode; + portalTarget?: HTMLElement; /** * Specify a CSS selector that matches the DOM element that should be diff --git a/packages/ibm-products/src/components/Tearsheet/TearsheetShell.tsx b/packages/ibm-products/src/components/Tearsheet/TearsheetShell.tsx index 96f33c4130..bebe1617c8 100644 --- a/packages/ibm-products/src/components/Tearsheet/TearsheetShell.tsx +++ b/packages/ibm-products/src/components/Tearsheet/TearsheetShell.tsx @@ -141,7 +141,7 @@ interface TearsheetShellProps extends PropsWithChildren { /** * The DOM element that the tearsheet should be rendered within. Defaults to document.body. */ - portalTarget?: ReactNode; + portalTarget?: HTMLElement; /** * Specify a CSS selector that matches the DOM element that should be