@@ -2,19 +2,15 @@ import React from 'react'
2
2
import { TippyProps } from '@tippyjs/react'
3
3
import { NavLinkProps } from 'react-router-dom'
4
4
5
- interface ButtonTab {
6
- /**
7
- * Is tab active ( for button tab )
8
- */
9
- isActive : boolean
5
+ interface ButtonTab extends Required < Pick < NavLinkProps , 'isActive' > > {
10
6
/**
11
7
* The callback function to handle click events on the button.
12
8
*/
13
9
onClick ?: ( e : React . MouseEvent < HTMLButtonElement > ) => void
14
10
href ?: never
15
11
}
16
12
17
- interface NavLinkTab {
13
+ interface NavLinkTab extends Pick < NavLinkProps , 'isActive' > {
18
14
/**
19
15
* The URL of the nav link.
20
16
*/
@@ -30,38 +26,37 @@ export type TabOptions = 'button' | 'navLink'
30
26
31
27
type ConditionalTabType < TabType extends TabOptions > = TabType extends 'button' ? ButtonTab : NavLinkTab
32
28
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
29
+ export type CollapsibleListItem < TabType extends TabOptions = 'navLink' > = ConditionalTabType < TabType > & {
30
+ /**
31
+ * The title of the list item.
32
+ */
33
+ title : string
34
+ /**
35
+ * The subtitle of the list item.
36
+ */
37
+ subtitle ?: string
38
+ /**
39
+ * If true, the title will be rendered with line-through.
40
+ */
41
+ strikeThrough ?: boolean
42
+ /**
43
+ * Configuration for the icon.
44
+ */
45
+ iconConfig ?: {
39
46
/**
40
- * The subtitle of the list item.
47
+ * A React component representing an icon to be displayed with the list item.
41
48
*/
42
- subtitle ?: string
49
+ Icon : React . FunctionComponent < React . SVGProps < SVGSVGElement > >
43
50
/**
44
- * If true, the title will be rendered with line-through .
51
+ * Properties for the icon component .
45
52
*/
46
- strikeThrough ?: boolean
53
+ props ?: React . SVGProps < SVGSVGElement >
47
54
/**
48
- * Configuration for the icon.
55
+ * Properties for the tooltip component of the icon.
49
56
*/
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
- }
57
+ tooltipProps ?: TippyProps
64
58
}
59
+ }
65
60
66
61
export interface CollapsibleListConfig < TabType extends 'button' | 'navLink' > {
67
62
/**
0 commit comments