1
+ import React from 'react' ;
2
+
1
3
import { ROLES } from '@/types/role' ;
2
4
5
+ /**
6
+ * Defines the properties for a generic link component.
7
+ * @property {string } url - The URL the link points to.
8
+ * @property {string | JSX.Element } children - The content inside the link.
9
+ * @property {string } [className] - Optional CSS class for styling.
10
+ * @property {string } [target] - Specifies where to open the linked document.
11
+ * @property {boolean } [aria-disabled] - Indicates that the element is perceivable but disabled.
12
+ * @property {string } [aria-label] - Defines a string value that labels the current element.
13
+ * @property {() => void } [onClick] - Function to call when the link is clicked.
14
+ * @property {() => void } [onFocus] - Function to call when the link is focused.
15
+ * @property {() => void } [onMouseEnter] - Function to call when the mouse enters the link area.
16
+ * @property {() => void } [onMouseLeave] - Function to call when the mouse leaves the link area.
17
+ * @property {ROLES } [role] - ARIA role to describe the link's type.
18
+ * @property {string } [dataTestId] - Test ID for testing purposes.
19
+ * @property {boolean } [draggable] - Indicates whether the element can be dragged.
20
+ */
3
21
export type IGenericLink = {
4
22
url : string ;
5
23
children : string | JSX . Element ;
@@ -16,14 +34,37 @@ export type IGenericLink = {
16
34
draggable ?: boolean ;
17
35
} ;
18
36
37
+ /**
38
+ * Defines the type for a generic link component, which can be either a functional component or a forward ref component.
39
+ */
19
40
export type GenericLinkType =
20
41
| ( ( props : IGenericLink ) => JSX . Element )
21
42
| React . ForwardRefExoticComponent < IGenericLink & React . RefAttributes < unknown > > ;
22
43
44
+ /**
45
+ * Defines the properties for a generic image component.
46
+ */
47
+ export interface IGenericImage extends React . ImgHTMLAttributes < HTMLImageElement > { }
48
+
49
+ /**
50
+ * Defines the type for a generic image component, which can be either a functional component or a forward ref component.
51
+ */
52
+ export type GenericImageType =
53
+ | ( ( props : IGenericImage ) => JSX . Element )
54
+ | React . ForwardRefExoticComponent < IGenericImage & React . RefAttributes < unknown > > ;
55
+
56
+ /**
57
+ * Defines the types for generic components, including links and images.
58
+ */
23
59
export type GenericComponentsType = {
24
60
LINK : GenericLinkType ;
61
+ IMAGE ?: GenericImageType ;
25
62
} ;
26
63
64
+ /**
65
+ * Provides the interface for the generic components provider.
66
+ * @property {GenericComponentsType } value - The actual components to be provided.
67
+ */
27
68
export interface IGenericComponentsProvider {
28
69
value : GenericComponentsType ;
29
70
}
0 commit comments