@@ -17,18 +17,24 @@ import Caption from './Caption';
17
17
import DropDown from './DropDown' ;
18
18
import Help from './Help' ;
19
19
import { ClayDropDownContext , DropDownItems , findNested } from './Items' ;
20
+ import Menu from './Menu' ;
20
21
import Search from './Search' ;
21
22
22
23
import type { AlignPoints } from '@clayui/shared' ;
23
24
24
25
import type { Item } from './Items' ;
26
+ import type { IProps as SearchProps } from './Search' ;
25
27
26
28
type Messages = {
27
29
goTo : string ;
28
30
back : string ;
29
31
} ;
30
32
31
- interface IProps extends React . HTMLAttributes < HTMLDivElement > {
33
+ type TriggerElement = React . ReactElement & {
34
+ ref ?: ( node : HTMLButtonElement | null ) => void ;
35
+ } ;
36
+
37
+ export type Props = {
32
38
/**
33
39
* Flag to indicate if the menu should be initially open (controlled).
34
40
*/
@@ -66,6 +72,8 @@ interface IProps extends React.HTMLAttributes<HTMLDivElement> {
66
72
*/
67
73
caption ?: string ;
68
74
75
+ className ?: string ;
76
+
69
77
/**
70
78
* HTML element tag that the container should render.
71
79
*/
@@ -96,9 +104,8 @@ interface IProps extends React.HTMLAttributes<HTMLDivElement> {
96
104
/**
97
105
* Prop to pass DOM element attributes to DropDown.Menu.
98
106
*/
99
- menuElementAttrs ?: React . ComponentProps <
100
- typeof DropDown
101
- > [ 'menuElementAttrs' ] ;
107
+ menuElementAttrs ?: React . HTMLAttributes < HTMLDivElement > &
108
+ Pick < React . ComponentProps < typeof Menu > , 'containerProps' > ;
102
109
103
110
/**
104
111
* Adds utility class name `dropdown-menu-height-${height}`
@@ -130,7 +137,7 @@ interface IProps extends React.HTMLAttributes<HTMLDivElement> {
130
137
/**
131
138
* Function for setting the offset of the menu from the trigger.
132
139
*/
133
- offsetFn ?: React . ComponentProps < typeof DropDown > [ 'offsetFn' ] ;
140
+ offsetFn ?: ( points : AlignPoints ) => [ number , number ] ;
134
141
135
142
/**
136
143
* Callback the will be invoked when the active prop is changed (controlled).
@@ -150,9 +157,7 @@ interface IProps extends React.HTMLAttributes<HTMLDivElement> {
150
157
/**
151
158
* Element that is used as the trigger which will activate the dropdown on click.
152
159
*/
153
- trigger : React . ReactElement & {
154
- ref ?: ( node : HTMLButtonElement | null ) => void ;
155
- } ;
160
+ trigger : TriggerElement ;
156
161
157
162
/**
158
163
* Flag indicating if the caret icon should be displayed on the right side.
@@ -177,16 +182,13 @@ interface IProps extends React.HTMLAttributes<HTMLDivElement> {
177
182
/**
178
183
* Pass the props to the Search component.
179
184
*/
180
- searchProps ?: Omit <
181
- React . ComponentProps < typeof Search > ,
182
- 'onChange' | 'spritemap' | 'value'
183
- > ;
185
+ searchProps ?: SearchProps ;
184
186
185
187
/**
186
188
* The value that will be passed to the search input element.
187
189
*/
188
190
searchValue ?: string ;
189
- }
191
+ } ;
190
192
191
193
type History = {
192
194
id : string ;
@@ -223,7 +225,7 @@ export const ClayDropDownWithDrilldown = ({
223
225
spritemap,
224
226
trigger,
225
227
triggerIcon = null ,
226
- } : IProps ) => {
228
+ } : Props ) => {
227
229
const [ activeMenu , setActiveMenu ] = useState (
228
230
defaultActiveMenu ?? initialActiveMenu
229
231
) ;
0 commit comments