17
17
import { action } from '@storybook/addon-actions'
18
18
import type { Meta , StoryObj } from '@storybook/react'
19
19
20
- import { ActionMenu , ActionMenuProps , Button , Icon } from '@devtron-labs/devtron-fe-common-lib'
20
+ import { ActionMenu , ActionMenuProps , Icon } from '@devtron-labs/devtron-fe-common-lib'
21
21
22
22
const Component = ( props : ActionMenuProps ) => (
23
23
< div className = "flex w-100" style = { { height : '90vh' } } >
@@ -51,8 +51,8 @@ const options: ActionMenuProps['options'] = [
51
51
{
52
52
items : [
53
53
{
54
+ id : 'value-1' ,
54
55
label : 'Label 1' ,
55
- value : 'value-1' ,
56
56
startIcon : {
57
57
name : 'ic-cube' ,
58
58
color : 'N800' ,
@@ -64,32 +64,33 @@ const options: ActionMenuProps['options'] = [
64
64
groupLabel : 'Group 1' ,
65
65
items : [
66
66
{
67
+ id : 'group-value-1' ,
67
68
label : 'Group Label 1' ,
68
- value : 'group-value-1' ,
69
69
startIcon : {
70
70
name : 'ic-cube' ,
71
71
color : 'N800' ,
72
72
} ,
73
73
isDisabled : true ,
74
74
} ,
75
75
{
76
+ id : 'group-value-2' ,
76
77
label : 'Lorem ipsum dolor sit amet, consectetur adipiscing elitLorem ipsum dolor sit amet, consectetur adipiscing elit' ,
77
- value : 'group-value-2' ,
78
78
description : 'Lorem ipsum dolor sit amet, consectetur adipiscing elit' ,
79
79
tooltipProps : {
80
80
content : 'There is an error' ,
81
81
} ,
82
82
type : 'negative' ,
83
83
} ,
84
84
{
85
+ id : 'group-value-3' ,
85
86
label : 'Lorem ipsum dolor sit amet, consectetur adipiscing elitLorem ipsum dolor sit amet, consectetur adipiscing elit' ,
86
- value : 'group-value-3' ,
87
87
} ,
88
88
{
89
+ id : 'group-value-4' ,
89
90
label : 'Group Label 4' ,
90
- value : 'group-value-4' ,
91
91
} ,
92
92
{
93
+ id : 'group-value-5' ,
93
94
startIcon : {
94
95
name : 'ic-cube' ,
95
96
color : 'N800' ,
@@ -98,7 +99,6 @@ const options: ActionMenuProps['options'] = [
98
99
name : 'ic-cube' ,
99
100
color : 'N800' ,
100
101
} ,
101
- value : 'group-value-5' ,
102
102
tooltipProps : {
103
103
content : 'Tooltip content for value 5' ,
104
104
} ,
@@ -111,22 +111,23 @@ const options: ActionMenuProps['options'] = [
111
111
{
112
112
items : [
113
113
{
114
+ id : 'value-2' ,
114
115
label : 'Label 2' ,
115
- value : 'value-2' ,
116
116
description : 'Lorem ipsum dolor sit amet, consectetur adipiscing elit' ,
117
117
tooltipProps : {
118
118
content : 'There is an error' ,
119
119
} ,
120
120
} ,
121
121
{
122
+ id : 'value-3' ,
122
123
label : 'Label 3' ,
123
- value : 'value-3' ,
124
124
} ,
125
125
{
126
+ id : 'value-4' ,
126
127
label : 'Label 4' ,
127
- value : 'value-4' ,
128
128
} ,
129
129
{
130
+ id : 'value-5' ,
130
131
startIcon : {
131
132
name : 'ic-cube' ,
132
133
color : 'N800' ,
@@ -135,7 +136,6 @@ const options: ActionMenuProps['options'] = [
135
136
name : 'ic-cube' ,
136
137
color : 'N800' ,
137
138
} ,
138
- value : 'value-5' ,
139
139
tooltipProps : {
140
140
content : 'Tooltip content for value 5' ,
141
141
} ,
@@ -149,30 +149,33 @@ const options: ActionMenuProps['options'] = [
149
149
150
150
export const WithButtonElement : Story = {
151
151
args : {
152
+ id : 'action-menu-with-button' ,
152
153
options,
153
154
position : 'bottom' ,
154
155
alignment : 'start' ,
155
156
disableDescriptionEllipsis : false ,
156
- children : < Button text = "Open Action Menu" dataTestId = "action-menu" /> ,
157
157
onClick : action ( 'option clicked' ) ,
158
158
isSearchable : true ,
159
+ buttonProps : {
160
+ text : 'Open Action Menu' ,
161
+ dataTestId : 'action-menu' ,
162
+ } ,
159
163
} ,
160
164
}
161
165
162
166
export const WithIconButtonElement : Story = {
163
167
args : {
168
+ id : 'action-menu-with-icon-button' ,
164
169
options,
165
170
position : 'bottom' ,
166
171
alignment : 'start' ,
167
172
disableDescriptionEllipsis : false ,
168
- children : (
169
- < Button
170
- icon = { < Icon name = "ic-cube" color = "N800" /> }
171
- ariaLabel = "action-menu"
172
- showAriaLabelInTippy = { false }
173
- dataTestId = "action-menu"
174
- />
175
- ) ,
176
173
onClick : action ( 'option clicked' ) ,
174
+ buttonProps : {
175
+ icon : < Icon name = "ic-cube" color = "N800" /> ,
176
+ ariaLabel : 'action-menu' ,
177
+ showAriaLabelInTippy : false ,
178
+ dataTestId : 'action-menu' ,
179
+ } ,
177
180
} ,
178
181
}
0 commit comments