File tree Expand file tree Collapse file tree 2 files changed +25
-12
lines changed
source/library/components/py-loader Expand file tree Collapse file tree 2 files changed +25
-12
lines changed Original file line number Diff line number Diff line change
1
+ import { forwardRef , type ForwardedRef } from "react" ;
1
2
import type { PyLoaderProperties , PyLoaderTag } from "./py-loader.types" ;
2
3
3
4
/**
4
5
* @param root0
5
6
* @deprecated
6
7
*/
7
- const PyLoader : PyLoaderTag = < T extends object > ( {
8
- ...rest
9
- } : PyLoaderProperties < T > ) : JSX . Element => {
10
- return < py-loader { ...rest } /> ;
11
- } ;
8
+ const PyLoader : PyLoaderTag = forwardRef (
9
+ < OptionalProperties extends object > (
10
+ properties : PyLoaderProperties < OptionalProperties > ,
11
+ reference : ForwardedRef < HTMLElement > | undefined ,
12
+ // eslint-disable-next-line max-params
13
+ ) : JSX . Element => {
14
+ return < py-loader ref = { reference } { ...properties } /> ;
15
+ } ,
16
+ ) as PyLoaderTag ;
12
17
13
- PyLoader . propTypes = { } ;
18
+ PyLoader . displayName = "PyLoader" ;
14
19
15
20
export default PyLoader ;
Original file line number Diff line number Diff line change 1
1
import type {
2
2
DetailedHTMLProps ,
3
+ ForwardedRef ,
3
4
HTMLAttributes ,
4
5
WeakValidationMap ,
5
6
} from "react" ;
@@ -12,13 +13,20 @@ export type PyLoaderPropertiesBase = Omit<
12
13
"children"
13
14
> ;
14
15
15
- export type PyLoaderProperties < T > = T extends infer T
16
- ? T & PyLoaderPropertiesBase
17
- : PyLoaderPropertiesBase ;
16
+ export type PyLoaderProperties < OptionalProperties > =
17
+ OptionalProperties extends infer OptionalProperties
18
+ ? OptionalProperties & PyLoaderPropertiesBase
19
+ : PyLoaderPropertiesBase ;
18
20
19
- export type PyLoaderProps < T > = PyLoaderProperties < T > ;
21
+ export type PyLoaderProps < OptionalProperties > =
22
+ PyLoaderProperties < OptionalProperties > ;
20
23
21
24
export type PyLoaderTag = {
22
- < T extends object > ( properties : PyLoaderProperties < T > ) : JSX . Element ;
23
- propTypes : WeakValidationMap < PyLoaderPropertiesBase > ;
25
+ < OptionalProperties extends object > (
26
+ properties : PyLoaderProperties < OptionalProperties > ,
27
+ reference ?: ForwardedRef < HTMLElement > ,
28
+ ) : JSX . Element ;
29
+ displayName ?: string ;
30
+ defaultProps ?: Partial < PyLoaderPropertiesBase > ;
31
+ propTypes ?: WeakValidationMap < PyLoaderPropertiesBase > ;
24
32
} ;
You can’t perform that action at this time.
0 commit comments