File tree Expand file tree Collapse file tree 2 files changed +25
-8
lines changed
source/library/components/py-box Expand file tree Collapse file tree 2 files changed +25
-8
lines changed Original file line number Diff line number Diff line change 11import propTypes from "prop-types" ;
2+ import { forwardRef , type ForwardedRef } from "react" ;
23import type { PyBoxProperties , PyBoxTag } from "./py-box.types" ;
34
45/**
@@ -7,12 +8,21 @@ import type { PyBoxProperties, PyBoxTag } from "./py-box.types";
78 * @param root0.children
89 * @deprecated
910 */
10- const PyBox : PyBoxTag = < T extends object > ( {
11- children,
12- ...rest
13- } : PyBoxProperties < T > ) : JSX . Element => {
14- return < py-box { ...rest } > { children } </ py-box > ;
15- } ;
11+ const PyBox : PyBoxTag = forwardRef (
12+ < T extends object > (
13+ { children, ...rest } : PyBoxProperties < T > ,
14+ reference : ForwardedRef < HTMLElement > | undefined ,
15+ // eslint-disable-next-line max-params
16+ ) : JSX . Element => {
17+ return (
18+ < py-box ref = { reference } { ...rest } >
19+ { children }
20+ </ py-box >
21+ ) ;
22+ } ,
23+ ) as PyBoxTag ;
24+
25+ PyBox . displayName = "PyBox" ;
1626
1727PyBox . propTypes = {
1828 children : propTypes . oneOfType ( [
Original file line number Diff line number Diff line change 11import type {
22 DetailedHTMLProps ,
33 HTMLAttributes ,
4+ LegacyRef ,
45 PropsWithChildren ,
56 WeakValidationMap ,
67} from "react" ;
8+
79import type ReactElementProps from "~types/react-element-properties/react-element-properties" ;
810
911export type PyBoxPropertiesBase = PropsWithChildren <
@@ -19,6 +21,11 @@ export type PyBoxProperties<T> = T extends infer T
1921 : PyBoxPropertiesBase ;
2022
2123export type PyBoxTag = {
22- < T extends object > ( properties : PyBoxProperties < T > ) : JSX . Element ;
23- propTypes : WeakValidationMap < PyBoxPropertiesBase > ;
24+ < T extends object > (
25+ properties : PyBoxProperties < T > ,
26+ reference : LegacyRef < HTMLElement > | undefined ,
27+ ) : JSX . Element ;
28+ displayName ?: string ;
29+ defaultProps ?: Partial < PyBoxPropertiesBase > ;
30+ propTypes ?: WeakValidationMap < PyBoxPropertiesBase > ;
2431} ;
You can’t perform that action at this time.
0 commit comments