@@ -14,7 +14,7 @@ interface ButtonTab {
14
14
href ?: never
15
15
}
16
16
17
- interface NavLinkTab {
17
+ interface NavLinkTab extends Pick < NavLinkProps , 'isActive' > {
18
18
/**
19
19
* The URL of the nav link.
20
20
*/
@@ -23,47 +23,45 @@ interface NavLinkTab {
23
23
* The callback function to handle click events on the nav link.
24
24
*/
25
25
onClick ?: ( e : React . MouseEvent < HTMLAnchorElement > ) => void
26
- isActive ?: never
27
26
}
28
27
29
28
export type TabOptions = 'button' | 'navLink'
30
29
31
30
type ConditionalTabType < TabType extends TabOptions > = TabType extends 'button' ? ButtonTab : NavLinkTab
32
31
33
- export type CollapsibleListItem < TabType extends TabOptions > = Pick < NavLinkProps , 'isActive' > &
34
- ConditionalTabType < TabType > & {
35
- /**
36
- * The title of the list item.
37
- */
38
- title : string
32
+ export type CollapsibleListItem < TabType extends TabOptions = 'navLink' > = ConditionalTabType < TabType > & {
33
+ /**
34
+ * The title of the list item.
35
+ */
36
+ title : string
37
+ /**
38
+ * The subtitle of the list item.
39
+ */
40
+ subtitle ?: string
41
+ /**
42
+ * If true, the title will be rendered with line-through.
43
+ */
44
+ strikeThrough ?: boolean
45
+ /**
46
+ * Configuration for the icon.
47
+ */
48
+ iconConfig ?: {
39
49
/**
40
- * The subtitle of the list item.
50
+ * A React component representing an icon to be displayed with the list item.
41
51
*/
42
- subtitle ?: string
52
+ Icon : React . FunctionComponent < React . SVGProps < SVGSVGElement > >
43
53
/**
44
- * If true, the title will be rendered with line-through .
54
+ * Properties for the icon component .
45
55
*/
46
- strikeThrough ?: boolean
56
+ props ?: React . SVGProps < SVGSVGElement >
47
57
/**
48
- * Configuration for the icon.
58
+ * Properties for the tooltip component of the icon.
49
59
*/
50
- iconConfig ?: {
51
- /**
52
- * A React component representing an icon to be displayed with the list item.
53
- */
54
- Icon : React . FunctionComponent < React . SVGProps < SVGSVGElement > >
55
- /**
56
- * Properties for the icon component.
57
- */
58
- props ?: React . SVGProps < SVGSVGElement >
59
- /**
60
- * Properties for the tooltip component of the icon.
61
- */
62
- tooltipProps ?: TippyProps
63
- }
60
+ tooltipProps ?: TippyProps
64
61
}
62
+ }
65
63
66
- export interface CollapsibleListConfig < TabType extends 'button' | 'navLink' > {
64
+ export interface CollapsibleListConfig < TabType extends TabOptions = 'navLink' > {
67
65
/**
68
66
* The unique identifier for the collapsible list.
69
67
*/
@@ -108,7 +106,7 @@ export interface CollapsibleListConfig<TabType extends 'button' | 'navLink'> {
108
106
isExpanded ?: boolean
109
107
}
110
108
111
- export interface CollapsibleListProps < TabType extends TabOptions > {
109
+ export interface CollapsibleListProps < TabType extends TabOptions = 'navLink' > {
112
110
/**
113
111
* An array of collapsible list configurations.
114
112
*/
0 commit comments