@kaizen/components 1.68.13 → 1.69.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/dist/cjs/__actions__/Menu/v3/MenuHeader.cjs +22 -0
  2. package/dist/cjs/__actions__/Menu/v3/MenuPopover.cjs +22 -0
  3. package/dist/cjs/__actions__/Menu/v3/MenuSection.cjs +22 -0
  4. package/dist/cjs/__actions__/Menu/v3/MenuTrigger.cjs +1 -1
  5. package/dist/cjs/actionsV3.cjs +6 -0
  6. package/dist/esm/__actions__/Menu/v3/MenuHeader.mjs +17 -0
  7. package/dist/esm/__actions__/Menu/v3/MenuPopover.mjs +17 -0
  8. package/dist/esm/__actions__/Menu/v3/MenuSection.mjs +17 -0
  9. package/dist/esm/__actions__/Menu/v3/MenuTrigger.mjs +1 -1
  10. package/dist/esm/actionsV3.mjs +3 -0
  11. package/dist/styles.css +51 -51
  12. package/dist/types/__actions__/Menu/v3/MenuHeader.d.ts +8 -0
  13. package/dist/types/__actions__/Menu/v3/MenuPopover.d.ts +7 -0
  14. package/dist/types/__actions__/Menu/v3/MenuSection.d.ts +7 -0
  15. package/dist/types/__actions__/Menu/v3/MenuTrigger.d.ts +1 -1
  16. package/dist/types/__actions__/Menu/v3/index.d.ts +3 -0
  17. package/package.json +3 -3
  18. package/src/__actions__/Menu/v3/MenuHeader.tsx +12 -0
  19. package/src/__actions__/Menu/v3/MenuPopover.tsx +12 -0
  20. package/src/__actions__/Menu/v3/MenuSection.tsx +15 -0
  21. package/src/__actions__/Menu/v3/MenuTrigger.tsx +1 -1
  22. package/src/__actions__/Menu/v3/_docs/ApiSpecification.mdx +13 -43
  23. package/src/__actions__/Menu/v3/_docs/Menu.docs.stories.tsx +33 -31
  24. package/src/__actions__/Menu/v3/_docs/Menu.mdx +92 -155
  25. package/src/__actions__/Menu/v3/_docs/Menu.spec.stories.tsx +24 -25
  26. package/src/__actions__/Menu/v3/_docs/Menu.stories.tsx +39 -7
  27. package/src/__actions__/Menu/v3/index.ts +3 -0
@@ -1,10 +1,9 @@
1
1
  import React, { FunctionComponent, ReactNode } from 'react'
2
2
  import { Meta, StoryObj } from '@storybook/react'
3
3
  import isChromatic from 'chromatic'
4
- import { Popover } from 'react-aria-components'
5
4
  import { Button } from '~components/__actions__/v3'
6
5
  import { Icon } from '~components/__future__/Icon'
7
- import { Menu, MenuItem, MenuTrigger } from '../index'
6
+ import { Menu, MenuItem, MenuTrigger, MenuPopover, MenuSection, MenuHeader } from '../index'
8
7
 
9
8
  const meta = {
10
9
  title: 'Actions/Menu/v3/Docs Assets',
@@ -13,7 +12,10 @@ const meta = {
13
12
  defaultOpen: isChromatic(),
14
13
  children: <></>,
15
14
  },
16
- subcomponents: { Menu, MenuItem } as Record<string, FunctionComponent<any>>,
15
+ subcomponents: { Menu, MenuItem, MenuPopover, MenuSection, MenuHeader } as Record<
16
+ string,
17
+ FunctionComponent<any>
18
+ >,
17
19
  } satisfies Meta<typeof MenuTrigger>
18
20
 
19
21
  export default meta
@@ -41,12 +43,12 @@ export const Actions: Story = {
41
43
  >
42
44
  Additional actions
43
45
  </Button>
44
- <Popover>
46
+ <MenuPopover>
45
47
  <Menu>
46
48
  <MenuItem href="https://cultureamp.com">Action that navigates</MenuItem>
47
49
  <MenuItem onAction={() => null}>Non-navigation action</MenuItem>
48
50
  </Menu>
49
- </Popover>
51
+ </MenuPopover>
50
52
  </MenuTrigger>
51
53
  ),
52
54
  }
@@ -62,11 +64,11 @@ export const ItemsDo: Story = {
62
64
  >
63
65
  Additional actions
64
66
  </Button>
65
- <Popover>
67
+ <MenuPopover>
66
68
  <Menu>
67
69
  <DefaultMenuItems />
68
70
  </Menu>
69
- </Popover>
71
+ </MenuPopover>
70
72
  </MenuTrigger>
71
73
  ),
72
74
  }
@@ -82,11 +84,11 @@ export const ItemsDont: Story = {
82
84
  >
83
85
  Additional actions
84
86
  </Button>
85
- <Popover>
87
+ <MenuPopover>
86
88
  <Menu>
87
89
  <MenuItem icon={<Icon name="delete" isPresentational isFilled />}>Delete</MenuItem>
88
90
  </Menu>
89
- </Popover>
91
+ </MenuPopover>
90
92
  </MenuTrigger>
91
93
  ),
92
94
  }
@@ -98,12 +100,12 @@ export const SelectionDont: Story = {
98
100
  Sort by
99
101
  <Icon name="keyboard_arrow_down" isPresentational />
100
102
  </Button>
101
- <Popover>
103
+ <MenuPopover>
102
104
  <Menu>
103
105
  <MenuItem icon={<Icon name="check" isPresentational />}>Recommended</MenuItem>
104
106
  <MenuItem>Most recent</MenuItem>
105
107
  </Menu>
106
- </Popover>
108
+ </MenuPopover>
107
109
  </MenuTrigger>
108
110
  ),
109
111
  }
@@ -115,11 +117,11 @@ export const LabelChevronDo: Story = {
115
117
  Edit item
116
118
  <Icon name="keyboard_arrow_down" isPresentational />
117
119
  </Button>
118
- <Popover>
120
+ <MenuPopover>
119
121
  <Menu>
120
122
  <DefaultMenuItems />
121
123
  </Menu>
122
- </Popover>
124
+ </MenuPopover>
123
125
  </MenuTrigger>
124
126
  ),
125
127
  }
@@ -128,11 +130,11 @@ export const LabelChevronDont: Story = {
128
130
  render: ({ defaultOpen, ...args }) => (
129
131
  <MenuTrigger defaultOpen={defaultOpen} {...args}>
130
132
  <Button variant="secondary">Edit item</Button>
131
- <Popover>
133
+ <MenuPopover>
132
134
  <Menu>
133
135
  <DefaultMenuItems />
134
136
  </Menu>
135
- </Popover>
137
+ </MenuPopover>
136
138
  </MenuTrigger>
137
139
  ),
138
140
  }
@@ -144,11 +146,11 @@ export const LabelDo: Story = {
144
146
  Actions [visually hidden], conversation with Harper[/visually hidden]
145
147
  <Icon name="keyboard_arrow_down" isPresentational />
146
148
  </Button>
147
- <Popover>
149
+ <MenuPopover>
148
150
  <Menu {...args}>
149
151
  <DefaultMenuItems />
150
152
  </Menu>
151
- </Popover>
153
+ </MenuPopover>
152
154
  </MenuTrigger>
153
155
  ),
154
156
  }
@@ -160,11 +162,11 @@ export const LabelDont: Story = {
160
162
  Open menu
161
163
  <Icon name="keyboard_arrow_down" isPresentational />
162
164
  </Button>
163
- <Popover>
165
+ <MenuPopover>
164
166
  <Menu {...args}>
165
167
  <DefaultMenuItems />
166
168
  </Menu>
167
- </Popover>
169
+ </MenuPopover>
168
170
  </MenuTrigger>
169
171
  ),
170
172
  }
@@ -180,7 +182,7 @@ export const IconsDont: Story = {
180
182
  >
181
183
  Additional actions
182
184
  </Button>
183
- <Popover>
185
+ <MenuPopover>
184
186
  <Menu {...args}>
185
187
  <MenuItem icon={<Icon name="edit" isPresentational isFilled />}>
186
188
  Edit &lsquo;Strengths&rsquo;
@@ -191,7 +193,7 @@ export const IconsDont: Story = {
191
193
  <MenuItem>Export PDF</MenuItem>
192
194
  <MenuItem>Export Powerpoint</MenuItem>
193
195
  </Menu>
194
- </Popover>
196
+ </MenuPopover>
195
197
  </MenuTrigger>
196
198
  ),
197
199
  }
@@ -207,13 +209,13 @@ export const MenuItemLabelsDont: Story = {
207
209
  >
208
210
  Additional actions
209
211
  </Button>
210
- <Popover>
212
+ <MenuPopover>
211
213
  <Menu {...args}>
212
214
  <MenuItem>Save comment</MenuItem>
213
215
  <MenuItem>Edit comment</MenuItem>
214
216
  <MenuItem>Delete comment</MenuItem>
215
217
  </Menu>
216
- </Popover>
218
+ </MenuPopover>
217
219
  </MenuTrigger>
218
220
  ),
219
221
  }
@@ -229,13 +231,13 @@ export const SentenceCaseDo: Story = {
229
231
  >
230
232
  Additional actions
231
233
  </Button>
232
- <Popover>
234
+ <MenuPopover>
233
235
  <Menu {...args}>
234
236
  <MenuItem>Quick export</MenuItem>
235
237
  <MenuItem>Open a copy</MenuItem>
236
238
  <MenuItem>Share a link</MenuItem>
237
239
  </Menu>
238
- </Popover>
240
+ </MenuPopover>
239
241
  </MenuTrigger>
240
242
  ),
241
243
  }
@@ -251,13 +253,13 @@ export const SentenceCaseDont: Story = {
251
253
  >
252
254
  Additional actions
253
255
  </Button>
254
- <Popover>
256
+ <MenuPopover>
255
257
  <Menu {...args}>
256
258
  <MenuItem>Quick Export</MenuItem>
257
259
  <MenuItem>Open A Copy</MenuItem>
258
260
  <MenuItem>Share A Link</MenuItem>
259
261
  </Menu>
260
- </Popover>
262
+ </MenuPopover>
261
263
  </MenuTrigger>
262
264
  ),
263
265
  }
@@ -273,13 +275,13 @@ export const ElipsesDo: Story = {
273
275
  >
274
276
  Additional actions
275
277
  </Button>
276
- <Popover>
278
+ <MenuPopover>
277
279
  <Menu {...args}>
278
280
  <MenuItem>Quick export</MenuItem>
279
281
  <MenuItem>Open a copy</MenuItem>
280
282
  <MenuItem>Share a link</MenuItem>
281
283
  </Menu>
282
- </Popover>
284
+ </MenuPopover>
283
285
  </MenuTrigger>
284
286
  ),
285
287
  }
@@ -295,13 +297,13 @@ export const ElipsesDont: Story = {
295
297
  >
296
298
  Additional actions
297
299
  </Button>
298
- <Popover>
300
+ <MenuPopover>
299
301
  <Menu {...args}>
300
302
  <MenuItem>Quick export…</MenuItem>
301
303
  <MenuItem>Open a copy…</MenuItem>
302
304
  <MenuItem>Share a link…</MenuItem>
303
305
  </Menu>
304
- </Popover>
306
+ </MenuPopover>
305
307
  </MenuTrigger>
306
308
  ),
307
309
  }
@@ -1,23 +1,14 @@
1
1
  import { Canvas, Meta, Controls } from '@storybook/blocks'
2
- import {
3
- ResourceLinks,
4
- SbContent,
5
- Installation,
6
- DosAndDonts,
7
- DoOrDont,
8
- } from '~storybook/components'
2
+ import { ResourceLinks, Installation, DosAndDonts, DoOrDont } from '~storybook/components'
9
3
  import * as MenuDocsStories from './Menu.docs.stories'
10
4
  import * as MenuStories from './Menu.stories'
11
5
 
12
6
  <Meta title="Actions/Menu/v3/Usage Guidelines" />
13
7
 
14
- <SbContent>
15
- # Menu (v3)
8
+ # Menu (v3)
16
9
 
17
10
  Updated July 6, 2024
18
11
 
19
- </SbContent>
20
-
21
12
  <ResourceLinks
22
13
  sourceCode="https://github.com/cultureamp/kaizen-design-system/tree/main/packages/components/src/__actions__/Menu"
23
14
  figma="https://www.figma.com/design/eZKEE5kXbEMY3lx84oz8iN/%F0%9F%92%9C-Heart-UI-Kit?m=auto&node-id=6262-0&t=I4H23jCrCJz4O2nf-1"
@@ -25,41 +16,37 @@ Updated July 6, 2024
25
16
  apiSpecification="/?path=/docs/actions-menu-v3-api-specification--docs"
26
17
  />
27
18
 
28
- <SbContent>
29
- <Installation
30
- installCommand="pnpm add @kaizen/components"
31
- importStatement='import { MenuTrigger, Menu, MenuItem } from "@kaizen/components/v3/actions"'
32
- />
19
+ <Installation
20
+ installCommand="pnpm add @kaizen/components"
21
+ importStatement='import { MenuTrigger, Menu, MenuItem, MenuPopover, MenuSection, MenuHeader } from "@kaizen/components/v3/actions"'
22
+ />
33
23
 
34
24
  ## Overview
35
25
 
36
26
  A menu displays a list of actions in a popover, toggled opened with a button.
37
27
 
38
- </SbContent>
39
-
40
28
  <Canvas
41
29
  of={MenuStories.Playground}
42
30
  source={{
43
31
  code: `
44
- <TooltipTrigger>
32
+ <MenuTrigger>
45
33
  <Button>
46
34
  <Icon name="more_horiz" alt="Additional actions" />
47
35
  </Button>
48
- <Popover>
36
+ <MenuPopover>
49
37
  <Menu>
50
38
  <MenuItem>Save</MenuItem>
51
39
  <MenuItem>Edit</MenuItem>
52
40
  <MenuItem>Delete</MenuItem>
53
41
  </Menu>
54
- </Popover>
55
- </TooltipTrigger>
42
+ </MenuPopover>
43
+ </MenuTrigger>
56
44
  `,
57
45
  }}
58
46
  />
59
47
  <Controls of={MenuStories.Playground} include={['placement', 'isOpen']} className="mb-64" />
60
48
 
61
- <SbContent className="mb-64">
62
- ### Anatomy
49
+ ### Anatomy
63
50
 
64
51
  - A Menu is made up of:
65
52
  - A trigger button
@@ -68,17 +55,11 @@ A menu displays a list of actions in a popover, toggled opened with a button.
68
55
  - Menu items may be organised into sections, with a heading for each section.
69
56
  - The menu trigger button, which may be any variation of a button.
70
57
 
71
- </SbContent>
72
-
73
- <SbContent className="mb-64">
74
58
  ### When to use
75
59
 
76
60
  - When you have a group of related actions for a page or item on the page.
77
61
  - The actions either: - Cause an action on the page (e.g. delete), or - Navigate somewhere
78
62
 
79
- </SbContent>
80
-
81
- <SbContent className="mb-64">
82
63
  ### When not to use
83
64
 
84
65
  - When you want to persist a user selection.
@@ -88,128 +69,84 @@ A menu displays a list of actions in a popover, toggled opened with a button.
88
69
  - It's recommended that you avoid this because of the complexity it adds for accessibility.
89
70
  - Inside a navigation bar - Different DOM elements and behaviour is required for a dropdown menu in a navigation bar.
90
71
 
91
- </SbContent>
92
-
93
- <div className="flex flex-col mt-16 gap-40 mb-64">
94
- <div className="flex flex-col m-0 gap-16">
95
- <SbContent>
96
- #### Do use a menu for an overflow of actions
97
- Menus work well as an overflow for a list of actions on a page or section. Try to avoid using menus for a single action, favouring an inline button/link instead.
98
-
99
- </SbContent>
100
- <DosAndDonts>
101
- <DoOrDont story={MenuDocsStories.ItemsDo} />
102
- <DoOrDont story={MenuDocsStories.ItemsDont} isDont />
103
- </DosAndDonts>
104
-
105
- </div>
106
- </div>
107
-
108
- <div className="flex flex-col mt-16 gap-40 mb-64">
109
- <div className="flex flex-col m-0 gap-16">
110
- <SbContent>
111
- #### Don't use Menus to persist a user selection
112
-
113
- Menus are not intended for a list of options where a user selection persists. Use a Select/Multi-Select or Combobox/Multi-Combobox component instead.
114
-
115
- </SbContent>
116
- <DosAndDonts>
117
- <DoOrDont story={MenuDocsStories.SelectionDont} isDont />
118
- </DosAndDonts>
119
-
120
- </div>
121
- </div>
122
-
123
- <div className="flex flex-col mt-16 gap-40 mb-64">
124
- <div className="flex flex-col m-0 gap-16">
125
- <SbContent>
126
- #### Do use a chevron icon when using a text label
127
- Providing this icon is an important part of visually communicating that the button triggers a menu.
128
-
129
- </SbContent>
130
- <DosAndDonts>
131
- <DoOrDont story={MenuDocsStories.LabelChevronDo} />
132
- <DoOrDont story={MenuDocsStories.LabelChevronDont} isDont />
133
- </DosAndDonts>
134
-
135
- </div>
136
- </div>
137
-
138
- <div className="flex flex-col mt-16 gap-40 mb-64">
139
- <div className="flex flex-col m-0 gap-16">
140
- <SbContent>
141
- #### Do give the trigger button a concise and unique label
142
- The label of the trigger button will be important for screen reader users to understand the purpose of the menu.
143
-
144
- Menu button labels are often too generic and need context added. E.g. a label of &ldquo;Actions&rdquo; is too generic if you have multiple menus on a single page.
145
-
146
- Avoid using the words &ldquo;Open/close&rdquo; or &ldquo;Menu&rdquo; in the label, both of these things are communicated to screen reader users already with ARIA properties.
147
-
148
- The following examples show you the verbose labels. In practice you will either want to use visually hidden text (when using a text-based trigger button), or an aria-label (when using an icon-based trigger button) to create the label.
149
- </SbContent>
150
- <DosAndDonts>
151
- <DoOrDont story={MenuDocsStories.LabelDo} />
152
- <DoOrDont story={MenuDocsStories.LabelDont} isDont />
153
- </DosAndDonts>
154
-
155
- </div>
156
- </div>
157
-
158
- <div className="flex flex-col mt-16 gap-40 mb-64">
159
- <div className="flex flex-col m-0 gap-16">
160
- <SbContent>
161
- #### Do use icons in menu items for common actions
162
- Icons beside items make sense for common actions (pencil for edit, trash can for delete, etc).
163
-
164
- Avoid using icons when:
165
- - The action is unique and doesn't have a commonly known icon associated.
166
- - Not all menu items will have an icon
167
- - You will have duplicates of icons in the list
168
-
169
- </SbContent>
170
- <DosAndDonts>
171
- <DoOrDont story={MenuDocsStories.ItemsDo} />
172
- <DoOrDont story={MenuDocsStories.IconsDont} isDont />
173
- </DosAndDonts>
174
-
175
- </div>
176
- </div>
177
-
178
- <div className="flex flex-col mt-16 gap-40 mb-64">
179
- <div className="flex flex-col m-0 gap-16">
180
- <SbContent>
181
- #### Don't repeat the same word in the menu item labels Context may be useful in some cases,
182
- but avoid adding context if it will be repeated in every menu item label.
183
- </SbContent>
184
- <DosAndDonts>
185
- <DoOrDont story={MenuDocsStories.MenuItemLabelsDont} isDont />
186
- </DosAndDonts>
187
- </div>
188
- </div>
189
-
190
- <div className="flex flex-col mt-16 gap-40 mb-64">
191
- <div className="flex flex-col m-0 gap-16">
192
- <SbContent>
193
- #### Do use sentence case for menu items Write menu items in sentence case unless they contain
194
- words that are branded terms.
195
- </SbContent>
196
- <DosAndDonts>
197
- <DoOrDont story={MenuDocsStories.SentenceCaseDo} />
198
- <DoOrDont story={MenuDocsStories.SentenceCaseDont} isDont />
199
- </DosAndDonts>
200
- </div>
201
- </div>
202
-
203
- <div className="flex flex-col mt-16 gap-40 mb-64">
204
- <div className="flex flex-col m-0 gap-16">
205
- <SbContent>
206
- #### Don't use elipses in menu items Avoid using ellipses (…) in menu item names within
207
- products whenever possible. An ellipsis often implies that the action for a menu item will
208
- open in a new view, or that a user will be taken elsewhere.
209
- </SbContent>
210
- <DosAndDonts>
211
- <DoOrDont story={MenuDocsStories.ElipsesDo} />
212
- <DoOrDont story={MenuDocsStories.ElipsesDont} isDont />
213
- </DosAndDonts>
214
- </div>
215
- </div>
72
+ #### Do use a menu for an overflow of actions
73
+
74
+ Menus work well as an overflow for a list of actions on a page or section. Try to avoid using menus for a single action, favouring an inline button/link instead.
75
+
76
+ <DosAndDonts>
77
+ <DoOrDont story={MenuDocsStories.ItemsDo} />
78
+ <DoOrDont story={MenuDocsStories.ItemsDont} isDont />
79
+ </DosAndDonts>
80
+
81
+ #### Don't use Menus to persist a user selection
82
+
83
+ Menus are not intended for a list of options where a user selection persists. Use a Select/Multi-Select or Combobox/Multi-Combobox component instead.
84
+
85
+ <DosAndDonts>
86
+ <DoOrDont story={MenuDocsStories.SelectionDont} isDont />
87
+ </DosAndDonts>
88
+
89
+ #### Do use a chevron icon when using a text label
90
+
91
+ Providing this icon is an important part of visually communicating that the button triggers a menu.
92
+
93
+ <DosAndDonts>
94
+ <DoOrDont story={MenuDocsStories.LabelChevronDo} />
95
+ <DoOrDont story={MenuDocsStories.LabelChevronDont} isDont />
96
+ </DosAndDonts>
97
+
98
+ #### Do give the trigger button a concise and unique label
99
+
100
+ The label of the trigger button will be important for screen reader users to understand the purpose of the menu.
101
+
102
+ Menu button labels are often too generic and need context added. E.g. a label of &ldquo;Actions&rdquo; is too generic if you have multiple menus on a single page.
103
+
104
+ Avoid using the words &ldquo;Open/close&rdquo; or &ldquo;Menu&rdquo; in the label, both of these things are communicated to screen reader users already with ARIA properties.
105
+
106
+ The following examples show you the verbose labels. In practice you will either want to use visually hidden text (when using a text-based trigger button), or an aria-label (when using an icon-based trigger button) to create the label.
107
+
108
+ <DosAndDonts>
109
+ <DoOrDont story={MenuDocsStories.LabelDo} />
110
+ <DoOrDont story={MenuDocsStories.LabelDont} isDont />
111
+ </DosAndDonts>
112
+
113
+ #### Do use icons in menu items for common actions
114
+
115
+ Icons beside items make sense for common actions (pencil for edit, trash can for delete, etc).
116
+
117
+ Avoid using icons when:
118
+
119
+ - The action is unique and doesn't have a commonly known icon associated.
120
+ - Not all menu items will have an icon
121
+ - You will have duplicates of icons in the list
122
+
123
+ <DosAndDonts>
124
+ <DoOrDont story={MenuDocsStories.ItemsDo} />
125
+ <DoOrDont story={MenuDocsStories.IconsDont} isDont />
126
+ </DosAndDonts>
127
+
128
+ #### Don't repeat the same word in the menu item labels
129
+
130
+ Context may be useful in some cases, but avoid adding context if it will be repeated in every menu item label.
131
+
132
+ <DosAndDonts>
133
+ <DoOrDont story={MenuDocsStories.MenuItemLabelsDont} isDont />
134
+ </DosAndDonts>
135
+
136
+ #### Do use sentence case for menu items
137
+
138
+ Write menu items in sentence case unless they contain words that are branded terms.
139
+
140
+ <DosAndDonts>
141
+ <DoOrDont story={MenuDocsStories.SentenceCaseDo} />
142
+ <DoOrDont story={MenuDocsStories.SentenceCaseDont} isDont />
143
+ </DosAndDonts>
144
+
145
+ #### Don't use elipses in menu items
146
+
147
+ Avoid using ellipses (…) in menu item names within products whenever possible. An ellipsis often implies that the action for a menu item will open in a new view, or that a user will be taken elsewhere.
148
+
149
+ <DosAndDonts>
150
+ <DoOrDont story={MenuDocsStories.ElipsesDo} />
151
+ <DoOrDont story={MenuDocsStories.ElipsesDont} isDont />
152
+ </DosAndDonts>
@@ -2,10 +2,9 @@ import React, { useState } from 'react'
2
2
  import { Meta, StoryObj } from '@storybook/react'
3
3
  import { expect, userEvent, waitFor, within, fn } from '@storybook/test'
4
4
  import isChromatic from 'chromatic'
5
- import { Popover, Header, Section } from 'react-aria-components'
6
5
  import { Button } from '~components/__actions__/v3'
7
6
  import { Icon } from '~components/__future__/Icon'
8
- import { Menu, MenuItem, MenuTrigger } from '../index'
7
+ import { Menu, MenuItem, MenuTrigger, MenuPopover, MenuHeader, MenuSection } from '../index'
9
8
 
10
9
  const meta = {
11
10
  title: 'Actions/Menu/v3/Tests',
@@ -44,10 +43,10 @@ export const KitchenSink: Story = {
44
43
  >
45
44
  Additional actions
46
45
  </Button>
47
- <Popover>
46
+ <MenuPopover>
48
47
  <Menu>
49
- <Section>
50
- <Header>Section One</Header>
48
+ <MenuSection>
49
+ <MenuHeader>Section One</MenuHeader>
51
50
  <MenuItem
52
51
  icon={<Icon name="bookmark" isPresentational />}
53
52
  href="https://cultureamp.com"
@@ -55,14 +54,14 @@ export const KitchenSink: Story = {
55
54
  Save
56
55
  </MenuItem>
57
56
  <MenuItem icon={<Icon name="edit" isPresentational isFilled />}>Edit</MenuItem>
58
- </Section>
59
- <Section>
57
+ </MenuSection>
58
+ <MenuSection>
60
59
  <MenuItem icon={<Icon name="arrow_upward" isPresentational />}>Move Up</MenuItem>
61
60
  <MenuItem icon={<Icon name="arrow_downward" isPresentational />}>
62
61
  Menu item with a longer label
63
62
  </MenuItem>
64
- </Section>
65
- <Section>
63
+ </MenuSection>
64
+ <MenuSection>
66
65
  <MenuItem icon={<Icon name="delete" isPresentational isFilled />}>Delete</MenuItem>
67
66
  <MenuItem icon={<Icon name="delete" isPresentational isFilled />} isDisabled>
68
67
  Delete but disabled
@@ -70,9 +69,9 @@ export const KitchenSink: Story = {
70
69
  <MenuItem>Other action</MenuItem>
71
70
  <MenuItem>Other action</MenuItem>
72
71
  <MenuItem>Other action</MenuItem>
73
- </Section>
72
+ </MenuSection>
74
73
  </Menu>
75
- </Popover>
74
+ </MenuPopover>
76
75
  </MenuTrigger>
77
76
  ),
78
77
  }
@@ -89,7 +88,7 @@ export const Basic: Story = {
89
88
  Additional actions
90
89
  </Button>
91
90
 
92
- <Popover>
91
+ <MenuPopover>
93
92
  <Menu>
94
93
  <MenuItem
95
94
  icon={<Icon name="warning" isPresentational isFilled />}
@@ -108,7 +107,7 @@ export const Basic: Story = {
108
107
  <MenuItem>Item 4</MenuItem>
109
108
  <MenuItem>Item 5</MenuItem>
110
109
  </Menu>
111
- </Popover>
110
+ </MenuPopover>
112
111
  </MenuTrigger>
113
112
  ),
114
113
  play: async ({ canvasElement, step }) => {
@@ -165,7 +164,7 @@ export const DisabledItems: Story = {
165
164
  >
166
165
  Additional actions
167
166
  </Button>
168
- <Popover>
167
+ <MenuPopover>
169
168
  <Menu>
170
169
  <MenuItem isDisabled onAction={mockOnClick}>
171
170
  Item 1
@@ -175,7 +174,7 @@ export const DisabledItems: Story = {
175
174
  <MenuItem>Item 4</MenuItem>
176
175
  <MenuItem>Item 5</MenuItem>
177
176
  </Menu>
178
- </Popover>
177
+ </MenuPopover>
179
178
  </MenuTrigger>
180
179
  ),
181
180
  play: async ({ canvasElement, step }) => {
@@ -210,22 +209,22 @@ export const WithSections: Story = {
210
209
  >
211
210
  Additional actions
212
211
  </Button>
213
- <Popover>
212
+ <MenuPopover>
214
213
  <Menu>
215
- <Section>
216
- <Header>Section One</Header>
214
+ <MenuSection>
215
+ <MenuHeader>Section One</MenuHeader>
217
216
  <MenuItem>Item 1</MenuItem>
218
217
  <MenuItem>Item 2</MenuItem>
219
- </Section>
218
+ </MenuSection>
220
219
 
221
- <Section>
222
- <Header>Section Two</Header>
220
+ <MenuSection>
221
+ <MenuHeader>Section Two</MenuHeader>
223
222
  <MenuItem>Item 3</MenuItem>
224
223
  <MenuItem>Item 4</MenuItem>
225
224
  <MenuItem>Item 5</MenuItem>
226
- </Section>
225
+ </MenuSection>
227
226
  </Menu>
228
- </Popover>
227
+ </MenuPopover>
229
228
  </MenuTrigger>
230
229
  ),
231
230
  }
@@ -246,7 +245,7 @@ export const Controlled: Story = {
246
245
  >
247
246
  Additional actions
248
247
  </Button>
249
- <Popover>
248
+ <MenuPopover>
250
249
  <Menu>
251
250
  <MenuItem>Item 1</MenuItem>
252
251
  <MenuItem onAction={() => setOpen(true)}>Item 2</MenuItem>
@@ -254,7 +253,7 @@ export const Controlled: Story = {
254
253
  <MenuItem>Item 4</MenuItem>
255
254
  <MenuItem>Item 5</MenuItem>
256
255
  </Menu>
257
- </Popover>
256
+ </MenuPopover>
258
257
  </MenuTrigger>
259
258
  </>
260
259
  )