@@ -2,17 +2,21 @@ import React from 'react';
2
2
import { DropdownButton } from '../DropdownButton' ;
3
3
import { Dropdown , DropdownLink , DropdownOverlay } from '..' ;
4
4
import { DropdownFooter , DropdownHeader } from '../DropdownHeaderFooter' ;
5
+ import { DropdownIconButton } from '../DropdownIconButton' ;
5
6
import {
6
7
WithControlledMenuStory ,
7
8
WithControlledMultiSelectMenuStory ,
8
9
WithLinkStory ,
9
10
WithAutoPositioningMenuStory ,
10
11
WithSimpleMenuStory ,
12
+ WithIconButtonStory ,
13
+ WithTooltipStory ,
11
14
} from './stories' ;
12
15
import { Sandbox } from '~utils/storybook/Sandbox' ;
13
16
import { Box } from '~components/Box' ;
14
17
import { ActionList , ActionListItem , ActionListItemIcon } from '~components/ActionList' ;
15
18
import {
19
+ BoxIcon ,
16
20
CheckIcon ,
17
21
ChevronDownIcon ,
18
22
ChevronUpIcon ,
@@ -25,6 +29,7 @@ import { Checkbox } from '~components/Checkbox';
25
29
import { Button } from '~components/Button' ;
26
30
import { Badge } from '~components/Badge' ;
27
31
import { Amount } from '~components/Amount' ;
32
+ import { Tooltip , TooltipInteractiveWrapper } from '~components/Tooltip' ;
28
33
29
34
const DropdownStoryMeta = {
30
35
title : 'Components/Dropdown/With Button and Link' ,
@@ -65,6 +70,14 @@ export const WithLink = (): React.ReactElement => {
65
70
) ;
66
71
} ;
67
72
73
+ export const WithIconButton = ( ) : React . ReactElement => {
74
+ return (
75
+ < Sandbox padding = "spacing.0" editorHeight = "100vh" >
76
+ { WithIconButtonStory }
77
+ </ Sandbox >
78
+ ) ;
79
+ } ;
80
+
68
81
export const WithAutoPositioning = ( ) : React . ReactElement => {
69
82
return (
70
83
< Sandbox padding = "spacing.0" editorHeight = "100vh" >
@@ -89,6 +102,14 @@ export const WithControlledMultiSelect = (): React.ReactElement => {
89
102
) ;
90
103
} ;
91
104
105
+ export const WithTooltip = ( ) : React . ReactElement => {
106
+ return (
107
+ < Sandbox padding = "spacing.0" editorHeight = "100vh" >
108
+ { WithTooltipStory }
109
+ </ Sandbox >
110
+ ) ;
111
+ } ;
112
+
92
113
// This is for Chromatic and react native testing
93
114
export const InternalMenu = ( ) : React . ReactElement => {
94
115
const [ status , setStatus ] = React . useState < string | undefined > ( ) ;
@@ -271,4 +292,53 @@ InternalLinkDropdown.parameters = {
271
292
} ,
272
293
} ;
273
294
295
+ export const InternalIconButtonDropdown = ( ) : React . ReactElement => {
296
+ const [ status , setStatus ] = React . useState < string | undefined > ( 'latest-added' ) ;
297
+ const [ isDropdownOpen , setIsDropdownOpen ] = React . useState ( false ) ;
298
+
299
+ return (
300
+ < Box padding = "spacing.10" >
301
+ < Tooltip content = "Check Status" >
302
+ < TooltipInteractiveWrapper >
303
+ < Dropdown onOpenChange = { setIsDropdownOpen } isOpen = { isDropdownOpen } >
304
+ < DropdownIconButton icon = { BoxIcon } accessibilityLabel = "Status Dropdown" />
305
+ < DropdownOverlay >
306
+ < ActionList >
307
+ < ActionListItem
308
+ onClick = { ( { name, value } ) => {
309
+ console . log ( { name, value } ) ;
310
+ setStatus ( name ) ;
311
+ } }
312
+ isSelected = { status === 'latest-added' }
313
+ title = "Latest Added"
314
+ value = "latest-added"
315
+ />
316
+ < ActionListItem
317
+ onClick = { ( { name, value } ) => {
318
+ console . log ( { name, value } ) ;
319
+ setStatus ( name ) ;
320
+ } }
321
+ isSelected = { status === 'latest-invoice' }
322
+ title = "Latest Invoice"
323
+ value = "latest-invoice"
324
+ />
325
+
326
+ < ActionListItem
327
+ onClick = { ( { name, value } ) => {
328
+ console . log ( { name, value } ) ;
329
+ setStatus ( name ) ;
330
+ } }
331
+ isSelected = { status === 'oldest-due-date' }
332
+ title = "Oldest Due Date"
333
+ value = "oldest-due-date"
334
+ />
335
+ </ ActionList >
336
+ </ DropdownOverlay >
337
+ </ Dropdown >
338
+ </ TooltipInteractiveWrapper >
339
+ </ Tooltip >
340
+ </ Box >
341
+ ) ;
342
+ } ;
343
+
274
344
export default DropdownStoryMeta ;
0 commit comments