File tree Expand file tree Collapse file tree 2 files changed +29
-12
lines changed
source/library/components/py-input-box Expand file tree Collapse file tree 2 files changed +29
-12
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 { PyInputBoxProperties , PyInputBoxTag } from "./py-input-box.types" ;
34
45/**
56 * @param root0
67 * @param root0.children
78 * @deprecated
89 */
9- const PyInputBox : PyInputBoxTag = < T extends object > ( {
10- children,
11- ...rest
12- } : PyInputBoxProperties < T > ) : JSX . Element => {
13- return < py-inputbox { ...rest } > { children } </ py-inputbox > ;
14- } ;
10+ const PyInputBox : PyInputBoxTag = forwardRef (
11+ < OptionalProperties extends object > (
12+ { children, ...rest } : PyInputBoxProperties < OptionalProperties > ,
13+ reference : ForwardedRef < HTMLElement > | undefined ,
14+ // eslint-disable-next-line max-params
15+ ) : JSX . Element => {
16+ return (
17+ < py-inputbox ref = { reference } { ...rest } >
18+ { children }
19+ </ py-inputbox >
20+ ) ;
21+ } ,
22+ ) as PyInputBoxTag ;
23+
24+ PyInputBox . displayName = "PyInputBox" ;
1525
1626PyInputBox . propTypes = {
1727 children : propTypes . string . isRequired ,
Original file line number Diff line number Diff line change 1- import type {
1+ import {
22 DetailedHTMLProps ,
3+ ForwardedRef ,
34 HTMLAttributes ,
45 WeakValidationMap ,
56} from "react" ;
@@ -14,11 +15,17 @@ export type PyInputBoxPropertiesBase = Omit<
1415 children : string ;
1516} ;
1617
17- export type PyInputBoxProperties < T > = T extends infer T
18- ? T & PyInputBoxPropertiesBase
19- : PyInputBoxPropertiesBase ;
18+ export type PyInputBoxProperties < OptionalProperties > =
19+ OptionalProperties extends infer OptionalProperties
20+ ? OptionalProperties & PyInputBoxPropertiesBase
21+ : PyInputBoxPropertiesBase ;
2022
2123export type PyInputBoxTag = {
22- < T extends object > ( properties : PyInputBoxProperties < T > ) : JSX . Element ;
23- propTypes : WeakValidationMap < PyInputBoxPropertiesBase > ;
24+ < OptionalProperties extends object > (
25+ properties : PyInputBoxProperties < OptionalProperties > ,
26+ reference ?: ForwardedRef < HTMLElement > ,
27+ ) : JSX . Element ;
28+ displayName ?: string ;
29+ defaultProps ?: Partial < PyInputBoxPropertiesBase > ;
30+ propTypes ?: WeakValidationMap < PyInputBoxPropertiesBase > ;
2431} ;
You can’t perform that action at this time.
0 commit comments