diff --git a/components/lib/accordion/Accordion.d.ts b/components/lib/accordion/Accordion.d.ts index 5993a05c10..b9becca91e 100644 --- a/components/lib/accordion/Accordion.d.ts +++ b/components/lib/accordion/Accordion.d.ts @@ -26,8 +26,11 @@ interface AccordionEventParams { index: number; } -export interface AccordionProps extends Omit, HTMLDivElement>, 'ref'> { +export interface AccordionProps { + id?: string; activeIndex?: AccordionActiveIndexType; + className?: string; + style?: object; multiple?: boolean; expandIcon?: IconType; collapseIcon?: IconType; @@ -39,6 +42,4 @@ export interface AccordionProps extends Omit { - public getElement(): HTMLDivElement; -} +export declare class Accordion extends React.Component { } diff --git a/components/lib/accordion/Accordion.js b/components/lib/accordion/Accordion.js index 2cb976eb25..9fa26b5769 100644 --- a/components/lib/accordion/Accordion.js +++ b/components/lib/accordion/Accordion.js @@ -8,7 +8,6 @@ export const AccordionTab = () => { } export const Accordion = React.forwardRef((props, ref) => { const [idState, setIdState] = React.useState(props.id); const [activeIndexState, setActiveIndexState] = React.useState(props.activeIndex); - const elementRef = React.useRef(null); const activeIndex = props.onTabChange ? props.activeIndex : activeIndexState; const shouldUseTab = (tab) => tab && tab.props.__TYPE === 'AccordionTab'; @@ -47,11 +46,6 @@ export const Accordion = React.forwardRef((props, ref) => { return props.multiple ? (activeIndex && activeIndex.some(i => i === index)) : activeIndex === index; } - React.useImperativeHandle(ref, () => ({ - getElement: () => elementRef.current, - ...props - })); - useMountEffect(() => { if (!idState) { setIdState(UniqueComponentId()); @@ -129,7 +123,7 @@ export const Accordion = React.forwardRef((props, ref) => { const tabs = createTabs(); return ( -
+
{tabs}
) diff --git a/components/lib/autocomplete/AutoComplete.d.ts b/components/lib/autocomplete/AutoComplete.d.ts index 5c86434bf7..934b486cb6 100755 --- a/components/lib/autocomplete/AutoComplete.d.ts +++ b/components/lib/autocomplete/AutoComplete.d.ts @@ -1,6 +1,6 @@ import * as React from 'react'; import TooltipOptions from '../tooltip/tooltipoptions'; -import { VirtualScrollerProps, VirtualScroller } from '../virtualscroller'; +import { VirtualScrollerProps } from '../virtualscroller'; import { CSSTransitionProps } from '../csstransition'; import { IconType } from '../utils'; @@ -109,8 +109,4 @@ export interface AutoCompleteProps extends Omit { public search(event:React.SyntheticEvent, query:string, source: AutoCompleteSourceType): void; - public getElement(): HTMLSpanElement; - public getInput(): HTMLInputElement; - public getOverlay(): HTMLElement; - public getVirtualScroller(): VirtualScroller; } diff --git a/components/lib/autocomplete/AutoComplete.js b/components/lib/autocomplete/AutoComplete.js index 0c5acbb3ac..c64ce2feac 100644 --- a/components/lib/autocomplete/AutoComplete.js +++ b/components/lib/autocomplete/AutoComplete.js @@ -455,10 +455,6 @@ export const AutoComplete = React.memo(React.forwardRef((props, ref) => { React.useImperativeHandle(ref, () => ({ search, - getElement: () => elementRef.current, - getOverlay: () => overlayRef.current, - getInput: () => inputRef.current, - getVirtualScroller: () => virtualScrollerRef.current, ...props })); diff --git a/components/lib/avatar/Avatar.d.ts b/components/lib/avatar/Avatar.d.ts index ead9dca3f8..f7bfade70b 100644 --- a/components/lib/avatar/Avatar.d.ts +++ b/components/lib/avatar/Avatar.d.ts @@ -20,6 +20,4 @@ export interface AvatarProps extends Omit { - public getElement(): HTMLDivElement; -} +export declare class Avatar extends React.Component { } diff --git a/components/lib/avatar/Avatar.js b/components/lib/avatar/Avatar.js index 1af08d0207..6bc3ee1271 100644 --- a/components/lib/avatar/Avatar.js +++ b/components/lib/avatar/Avatar.js @@ -2,7 +2,6 @@ import * as React from 'react'; import { classNames, IconUtils, ObjectUtils } from '../utils/Utils'; export const Avatar = React.forwardRef((props, ref) => { - const elementRef = React.useRef(null); const createContent = () => { if (props.image) { @@ -18,11 +17,6 @@ export const Avatar = React.forwardRef((props, ref) => { return null; } - React.useImperativeHandle(ref, () => ({ - getElement: () => elementRef.current, - ...props - })); - const otherProps = ObjectUtils.findDiffKeys(props, Avatar.defaultProps); const containerClassName = classNames('p-avatar p-component', { 'p-avatar-image': props.image != null, @@ -35,7 +29,7 @@ export const Avatar = React.forwardRef((props, ref) => { const content = props.template ? ObjectUtils.getJSXElement(props.template, props) : createContent(); return ( -
+
{content} {props.children}
diff --git a/components/lib/avatargroup/AvatarGroup.d.ts b/components/lib/avatargroup/AvatarGroup.d.ts index 7bf1b26767..e3a39efeae 100644 --- a/components/lib/avatargroup/AvatarGroup.d.ts +++ b/components/lib/avatargroup/AvatarGroup.d.ts @@ -1,9 +1,9 @@ import * as React from 'react'; -export interface AvatarGroupProps extends Omit, HTMLDivElement>, 'ref'> { +export interface AvatarGroupProps { + style?: object; + className?: string; children?: React.ReactNode; } -export declare class AvatarGroup extends React.Component { - public getElement(): HTMLDivElement; -} +export declare class AvatarGroup extends React.Component { } diff --git a/components/lib/avatargroup/AvatarGroup.js b/components/lib/avatargroup/AvatarGroup.js index 0bcc00b03b..57d391869c 100644 --- a/components/lib/avatargroup/AvatarGroup.js +++ b/components/lib/avatargroup/AvatarGroup.js @@ -2,17 +2,11 @@ import * as React from 'react'; import { classNames, ObjectUtils } from '../utils/Utils'; export const AvatarGroup = React.forwardRef((props, ref) => { - const elementRef = React.useRef(null); const otherProps = ObjectUtils.findDiffKeys(props, AvatarGroup.defaultProps); const className = classNames('p-avatar-group p-component', props.className); - React.useImperativeHandle(ref, () => ({ - getElement: () => elementRef.current, - ...props - })); - return ( -
+
{props.children}
) diff --git a/components/lib/badge/Badge.d.ts b/components/lib/badge/Badge.d.ts index a4ff0d4e05..5046d65a4e 100644 --- a/components/lib/badge/Badge.d.ts +++ b/components/lib/badge/Badge.d.ts @@ -11,6 +11,4 @@ export interface BadgeProps extends Omit { - public getElement(): HTMLSpanElement; - } +export declare class Badge extends React.Component { } diff --git a/components/lib/badge/Badge.js b/components/lib/badge/Badge.js index c6b8e84409..67fba161b2 100644 --- a/components/lib/badge/Badge.js +++ b/components/lib/badge/Badge.js @@ -2,7 +2,6 @@ import * as React from 'react'; import { classNames, ObjectUtils } from '../utils/Utils'; export const Badge = React.memo(React.forwardRef((props, ref) => { - const elementRef = React.useRef(null); const otherProps = ObjectUtils.findDiffKeys(props, Badge.defaultProps); const className = classNames('p-badge p-component', { 'p-badge-no-gutter': ObjectUtils.isNotEmpty(props.value) && String(props.value).length === 1, @@ -12,13 +11,8 @@ export const Badge = React.memo(React.forwardRef((props, ref) => { [`p-badge-${props.severity}`]: props.severity !== null }, props.className); - React.useImperativeHandle(ref, () => ({ - getElement: () => elementRef.current, - ...props - })); - return ( - + {props.value} ) diff --git a/components/lib/blockui/BlockUI.d.ts b/components/lib/blockui/BlockUI.d.ts index 785c04ff61..e808fe06ca 100644 --- a/components/lib/blockui/BlockUI.d.ts +++ b/components/lib/blockui/BlockUI.d.ts @@ -2,11 +2,14 @@ import * as React from 'react'; type BlockUITemplateType = React.ReactNode | ((props: BlockUIProps) => React.ReactNode); -export interface BlockUIProps extends Omit, HTMLDivElement>, 'ref'> { +export interface BlockUIProps { + id?: string; blocked?: boolean; fullScreen?: boolean; baseZIndex?: number; autoZIndex?: boolean; + style?: object; + className?: string; template?: BlockUITemplateType; onBlocked?(): void; onUnblocked?(): void; @@ -16,5 +19,4 @@ export interface BlockUIProps extends Omit { public block(): void; public unblock(): void; - public getElement(): HTMLDivElement; } diff --git a/components/lib/blockui/BlockUI.js b/components/lib/blockui/BlockUI.js index 488ad5de6b..7a4d1c9bf4 100644 --- a/components/lib/blockui/BlockUI.js +++ b/components/lib/blockui/BlockUI.js @@ -6,7 +6,6 @@ import { classNames, DomHandler, ObjectUtils, ZIndexUtils } from '../utils/Utils export const BlockUI = React.forwardRef((props, ref) => { const [visibleState, setVisibleState] = React.useState(props.blocked); - const elementRef = React.useRef(null); const maskRef = React.useRef(null); const block = () => { @@ -66,7 +65,6 @@ export const BlockUI = React.forwardRef((props, ref) => { React.useImperativeHandle(ref, () => ({ block, unblock, - getElement: () => elementRef.current, ...props })); @@ -93,7 +91,7 @@ export const BlockUI = React.forwardRef((props, ref) => { const mask = createMask(); return ( -
+
{props.children} {mask}
diff --git a/components/lib/breadcrumb/BreadCrumb.d.ts b/components/lib/breadcrumb/BreadCrumb.d.ts index b1f446ef53..32163e6b6f 100644 --- a/components/lib/breadcrumb/BreadCrumb.d.ts +++ b/components/lib/breadcrumb/BreadCrumb.d.ts @@ -1,12 +1,13 @@ import * as React from 'react'; import { MenuItem } from '../menuitem'; -export interface BreadCrumbProps extends Omit, HTMLElement>, 'ref'> { +export interface BreadCrumbProps { + id?: string; model?: MenuItem[]; home?: MenuItem; + style?: object; + className?: string; children?: React.ReactNode; } -export declare class BreadCrumb extends React.Component { - public getElement(): HTMLElement; -} +export declare class BreadCrumb extends React.Component { } diff --git a/components/lib/breadcrumb/BreadCrumb.js b/components/lib/breadcrumb/BreadCrumb.js index a085b0327e..586d93c5e8 100644 --- a/components/lib/breadcrumb/BreadCrumb.js +++ b/components/lib/breadcrumb/BreadCrumb.js @@ -2,7 +2,6 @@ import * as React from 'react'; import { classNames, IconUtils, ObjectUtils } from '../utils/Utils'; export const BreadCrumb = React.memo(React.forwardRef((props, ref) => { - const elementRef = React.useRef(null); const itemClick = (event, item) => { if (item.disabled) { @@ -111,11 +110,6 @@ export const BreadCrumb = React.memo(React.forwardRef((props, ref) => { return null; } - React.useImperativeHandle(ref, () => ({ - getElement: () => elementRef.current, - ...props - })); - const otherProps = ObjectUtils.findDiffKeys(props, BreadCrumb.defaultProps); const className = classNames('p-breadcrumb p-component', props.className); const home = createHome(); @@ -123,7 +117,7 @@ export const BreadCrumb = React.memo(React.forwardRef((props, ref) => { const separator = createSeparator(); return ( -