agroptima-design-system 0.13.1 → 0.14.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 (28) hide show
  1. package/package.json +1 -1
  2. package/src/atoms/{Card.scss → Card/Card.scss} +4 -4
  3. package/src/atoms/{Card.tsx → Card/Card.tsx} +1 -1
  4. package/src/atoms/{CardContent.tsx → Card/CardContent.tsx} +1 -1
  5. package/src/atoms/{CardFooter.tsx → Card/CardFooter.tsx} +1 -1
  6. package/src/atoms/{CardHeader.tsx → Card/CardHeader.tsx} +1 -1
  7. package/src/atoms/Card/index.ts +6 -0
  8. package/src/atoms/{CardsTable.scss → CardsTable/CardsTable.scss} +4 -4
  9. package/src/atoms/{CardsTable.tsx → CardsTable/CardsTable.tsx} +1 -1
  10. package/src/atoms/{CardsTableCell.tsx → CardsTable/CardsTableCell.tsx} +1 -1
  11. package/src/atoms/{CardsTableHeader.tsx → CardsTable/CardsTableHeader.tsx} +1 -1
  12. package/src/atoms/CardsTable/index.ts +16 -0
  13. package/src/atoms/CardsTableList.tsx +10 -7
  14. package/src/atoms/Menu/Menu.scss +109 -0
  15. package/src/atoms/Menu/Menu.tsx +28 -0
  16. package/src/atoms/Menu/MenuOption.tsx +79 -0
  17. package/src/atoms/Menu/index.ts +4 -0
  18. package/src/stories/Card.stories.js +1 -4
  19. package/src/stories/CardsTable.stories.js +1 -6
  20. package/src/stories/Changelog.stories.mdx +2 -0
  21. package/src/stories/Menu.stories.js +150 -0
  22. package/tests/Card.spec.tsx +1 -4
  23. package/tests/CardsTable.spec.tsx +9 -6
  24. package/tests/Menu.spec.tsx +59 -0
  25. package/tsconfig.json +1 -1
  26. /package/src/atoms/{CardsTableBody.tsx → CardsTable/CardsTableBody.tsx} +0 -0
  27. /package/src/atoms/{CardsTableHead.tsx → CardsTable/CardsTableHead.tsx} +0 -0
  28. /package/src/atoms/{CardsTableRow.tsx → CardsTable/CardsTableRow.tsx} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agroptima-design-system",
3
- "version": "0.13.1",
3
+ "version": "0.14.0",
4
4
  "scripts": {
5
5
  "dev": "npm run storybook",
6
6
  "storybook": "storybook dev -p 6006 --ci",
@@ -1,7 +1,7 @@
1
- @use '../settings/color_alias';
2
- @use '../settings/typography/content' as typography;
3
- @use '../settings/config';
4
- @use '../settings/breakpoints';
1
+ @use '../../settings/color_alias';
2
+ @use '../../settings/typography/content' as typography;
3
+ @use '../../settings/config';
4
+ @use '../../settings/breakpoints';
5
5
 
6
6
  .card {
7
7
  display: flex;
@@ -1,6 +1,6 @@
1
1
  import './Card.scss'
2
2
  import React from 'react'
3
- import { classNames } from '../utils/classNames'
3
+ import { classNames } from '../../utils/classNames'
4
4
 
5
5
  export type Variant = 'primary'
6
6
 
@@ -1,6 +1,6 @@
1
1
  import './Card.scss'
2
2
  import React from 'react'
3
- import { classNames } from '../utils/classNames'
3
+ import { classNames } from '../../utils/classNames'
4
4
 
5
5
  export interface CardContentProps
6
6
  extends React.ComponentPropsWithoutRef<'div'> {}
@@ -1,6 +1,6 @@
1
1
  import './Card.scss'
2
2
  import React from 'react'
3
- import { classNames } from '../utils/classNames'
3
+ import { classNames } from '../../utils/classNames'
4
4
 
5
5
  export interface CardFooterProps
6
6
  extends React.ComponentPropsWithoutRef<'div'> {}
@@ -1,6 +1,6 @@
1
1
  import './Card.scss'
2
2
  import React from 'react'
3
- import { classNames } from '../utils/classNames'
3
+ import { classNames } from '../../utils/classNames'
4
4
 
5
5
  export interface CardHeaderProps extends React.ComponentPropsWithoutRef<'div'> {
6
6
  title: string
@@ -0,0 +1,6 @@
1
+ import { Card } from './Card'
2
+ import { CardHeader } from './CardHeader'
3
+ import { CardContent } from './CardContent'
4
+ import { CardFooter } from './CardFooter'
5
+
6
+ export { Card, CardHeader, CardContent, CardFooter }
@@ -1,7 +1,7 @@
1
- @use '../settings/color_alias';
2
- @use '../settings/typography/cards_table' as typography;
3
- @use '../settings/config';
4
- @use '../settings/breakpoints';
1
+ @use '../../settings/color_alias';
2
+ @use '../../settings/typography/cards_table' as typography;
3
+ @use '../../settings/config';
4
+ @use '../../settings/breakpoints';
5
5
 
6
6
  .cards-table-list {
7
7
  display: flex;
@@ -1,4 +1,4 @@
1
- import { classNames } from '../utils/classNames'
1
+ import { classNames } from '../../utils/classNames'
2
2
  import './CardsTable.scss'
3
3
 
4
4
  export type Variant = 'primary'
@@ -1,4 +1,4 @@
1
- import { classNames } from '../utils/classNames'
1
+ import { classNames } from '../../utils/classNames'
2
2
  import './CardsTable.scss'
3
3
  import React from 'react'
4
4
 
@@ -1,4 +1,4 @@
1
- import { classNames } from '../utils/classNames'
1
+ import { classNames } from '../../utils/classNames'
2
2
  import { Alignment } from './CardsTableCell'
3
3
 
4
4
  export interface CardsTableHeaderProps
@@ -0,0 +1,16 @@
1
+ import { CardsTable } from './CardsTable'
2
+ import { CardsTableHead } from './CardsTableHead'
3
+ import { CardsTableHeader } from './CardsTableHeader'
4
+ import { CardsTableRow } from './CardsTableRow'
5
+ import { CardsTableBody } from './CardsTableBody'
6
+ import { CardsTableCell, Alignment } from './CardsTableCell'
7
+
8
+ export {
9
+ CardsTable,
10
+ CardsTableHead,
11
+ CardsTableHeader,
12
+ CardsTableRow,
13
+ CardsTableBody,
14
+ CardsTableCell,
15
+ Alignment,
16
+ }
@@ -1,13 +1,16 @@
1
- import './CardsTable.scss'
1
+ import './CardsTable/CardsTable.scss'
2
2
  import React, { useState } from 'react'
3
3
  import { sortBy } from '../utils/sort'
4
- import { CardsTableHeader } from './CardsTableHeader'
5
- import { CardsTableCell } from './CardsTableCell'
6
- import { CardsTableRow } from './CardsTableRow'
4
+ import {
5
+ CardsTableHeader,
6
+ CardsTableCell,
7
+ CardsTableRow,
8
+ CardsTable,
9
+ CardsTableHead,
10
+ CardsTableBody,
11
+ } from './CardsTable'
12
+
7
13
  import { Icon, IconType } from './Icon'
8
- import { CardsTable } from './CardsTable'
9
- import { CardsTableHead } from './CardsTableHead'
10
- import { CardsTableBody } from './CardsTableBody'
11
14
 
12
15
  export type Variant = 'primary'
13
16
 
@@ -0,0 +1,109 @@
1
+ @use '../../settings/color_alias';
2
+ @use '../../settings/typography/content' as typography;
3
+ @use '../../settings/config';
4
+ @use '../../settings/depth';
5
+
6
+ .menu {
7
+ list-style-type: none;
8
+ display: flex;
9
+ flex-direction: column;
10
+ padding: 0;
11
+
12
+ .menu-option {
13
+ display: flex;
14
+ flex-direction: column;
15
+ gap: config.$space-2x;
16
+ cursor: default;
17
+
18
+ .icon {
19
+ width: config.$icon-size-3x;
20
+ height: config.$icon-size-3x;
21
+ > svg {
22
+ width: 100%;
23
+ height: 100%;
24
+ }
25
+ }
26
+
27
+ details {
28
+ &[open] {
29
+ > .container .right .icon {
30
+ transform: rotate(180deg);
31
+ }
32
+ }
33
+ &:has(> .dropdown) {
34
+ > .container .right {
35
+ display: inline-block;
36
+ }
37
+
38
+ > .dropdown {
39
+ > .menu-option details .container {
40
+ padding-left: config.$space-8x;
41
+ }
42
+ }
43
+ }
44
+
45
+ .container {
46
+ display: flex;
47
+ padding: config.$space-3x;
48
+
49
+ .left {
50
+ display: flex;
51
+ width: 100%;
52
+ gap: config.$space-2x;
53
+ justify-content: flex-start;
54
+ align-items: baseline;
55
+ }
56
+
57
+ .right {
58
+ display: none;
59
+ margin-top: auto;
60
+ margin-bottom: auto;
61
+ }
62
+ }
63
+ }
64
+
65
+ @include typography.body-regular-primary;
66
+
67
+ &.primary {
68
+ color: color_alias.$neutral-white;
69
+ background: color_alias.$neutral-color-900;
70
+
71
+ .icon {
72
+ > svg {
73
+ fill: color_alias.$neutral-white;
74
+ path {
75
+ fill: color_alias.$neutral-white;
76
+ }
77
+ }
78
+ }
79
+
80
+ &:hover {
81
+ background: color_alias.$primary-color-600;
82
+ }
83
+
84
+ &.selected {
85
+ background: color_alias.$primary-color-600;
86
+ }
87
+
88
+ details {
89
+ &:has(> .dropdown) {
90
+ > .dropdown {
91
+ .menu-option {
92
+ background: color_alias.$neutral-color-100;
93
+ color: color_alias.$neutral-color-1000;
94
+
95
+ &:hover {
96
+ background: color_alias.$primary-color-100;
97
+ }
98
+ }
99
+
100
+ .selected {
101
+ background: color_alias.$primary-color-100;
102
+ box-shadow: inset -3px 0px 0px 0px color_alias.$primary-color-600;
103
+ }
104
+ }
105
+ }
106
+ }
107
+ }
108
+ }
109
+ }
@@ -0,0 +1,28 @@
1
+ import './Menu.scss'
2
+ import React from 'react'
3
+ import { classNames } from '../../utils/classNames'
4
+
5
+ export type Variant = 'primary'
6
+
7
+ export interface MenuProps extends React.ComponentPropsWithoutRef<'ul'> {
8
+ variant?: Variant
9
+ isDropdown?: boolean
10
+ }
11
+
12
+ export function Menu({
13
+ variant = 'primary',
14
+ className,
15
+ isDropdown = false,
16
+ children,
17
+ ...props
18
+ }: MenuProps): React.JSX.Element {
19
+ const cssClasses = classNames('menu', variant, className, {
20
+ dropdown: isDropdown,
21
+ })
22
+
23
+ return (
24
+ <ul className={cssClasses} role="menu" {...props}>
25
+ {children}
26
+ </ul>
27
+ )
28
+ }
@@ -0,0 +1,79 @@
1
+ import './Menu.scss'
2
+ import React from 'react'
3
+ import { Icon, IconType } from '../Icon'
4
+ import { classNames } from '../../utils/classNames'
5
+
6
+ export type Variant = 'primary'
7
+
8
+ export interface MenuOptionProps extends React.ComponentPropsWithoutRef<'li'> {
9
+ variant?: Variant
10
+ icon?: IconType
11
+ title: string
12
+ isSelected?: boolean
13
+ }
14
+
15
+ export function MenuOption({
16
+ variant = 'primary',
17
+ className,
18
+ isSelected = false,
19
+ icon,
20
+ title,
21
+ children,
22
+ onClick,
23
+ ...props
24
+ }: MenuOptionProps): React.JSX.Element {
25
+ const cssClasses = classNames('menu-option', variant, className, {
26
+ selected: isSelected,
27
+ })
28
+
29
+ function closePreviousSelectedDropdown(currentTarget: HTMLLIElement) {
30
+ document.querySelectorAll('details[open]').forEach((detailElement) => {
31
+ const firstLevelMenuOption = detailElement?.closest('li')
32
+ const currentFirstLevelMenuOption = currentTarget
33
+ ?.closest('details')
34
+ ?.closest('li')
35
+
36
+ if (firstLevelMenuOption !== currentFirstLevelMenuOption)
37
+ detailElement.removeAttribute('open')
38
+ })
39
+ }
40
+
41
+ function unselectPreviousOption() {
42
+ document
43
+ .querySelectorAll('.selected')
44
+ .forEach((option) => option.classList.remove('selected'))
45
+ }
46
+
47
+ function setOptionSelected(event: React.MouseEvent<HTMLLIElement>) {
48
+ event.stopPropagation()
49
+
50
+ closePreviousSelectedDropdown(event.currentTarget)
51
+ unselectPreviousOption()
52
+
53
+ event.currentTarget.classList.add('selected')
54
+ if (onClick) onClick(event)
55
+ }
56
+
57
+ return (
58
+ <li
59
+ className={cssClasses}
60
+ tabIndex={0}
61
+ role="menuitem"
62
+ onClick={setOptionSelected}
63
+ {...props}
64
+ >
65
+ <details open={isSelected}>
66
+ <summary className="container">
67
+ <div className="left">
68
+ {icon && <Icon name={icon} />}
69
+ <span className="title">{title}</span>
70
+ </div>
71
+ <div className="right">
72
+ <Icon name="AngleDown" />
73
+ </div>
74
+ </summary>
75
+ {children}
76
+ </details>
77
+ </li>
78
+ )
79
+ }
@@ -0,0 +1,4 @@
1
+ import { Menu } from './Menu'
2
+ import { MenuOption } from './MenuOption'
3
+
4
+ export { Menu, MenuOption }
@@ -1,8 +1,5 @@
1
1
  import { IconButton } from '../atoms/IconButton'
2
- import { Card } from '../atoms/Card'
3
- import { CardHeader } from '../atoms/CardHeader'
4
- import { CardContent } from '../atoms/CardContent'
5
- import { CardFooter } from '../atoms/CardFooter'
2
+ import { Card, CardHeader, CardContent, CardFooter } from '../atoms/Card'
6
3
  import { Button } from '../atoms/Button'
7
4
 
8
5
  const figmaPrimaryDesign = {
@@ -1,11 +1,6 @@
1
1
  import React from 'react'
2
2
 
3
- import { CardsTable } from '../atoms/CardsTable'
4
- import { CardsTableHead } from '../atoms/CardsTableHead'
5
- import { CardsTableHeader } from '../atoms/CardsTableHeader'
6
- import { CardsTableRow } from '../atoms/CardsTableRow'
7
- import { CardsTableBody } from '../atoms/CardsTableBody'
8
- import { CardsTableCell } from '../atoms/CardsTableCell'
3
+ import { CardsTable, CardsTableHead, CardsTableHeader, CardsTableRow, CardsTableBody, CardsTableCell } from '../atoms/CardsTable'
9
4
  import { IconButton } from '../atoms/IconButton'
10
5
  import { Badge } from '../atoms/Badge'
11
6
 
@@ -3,6 +3,8 @@ import { Meta } from "@storybook/addon-docs";
3
3
  <Meta title="Changelog" />
4
4
  # Changelog
5
5
 
6
+ ## 0.14.0
7
+ - Added Menu component to Storybook.
6
8
 
7
9
  ## 0.13.0
8
10
  - Added CardMenuOption component to Storybook.
@@ -0,0 +1,150 @@
1
+ import React from 'react'
2
+
3
+ import { Menu, MenuOption } from '../atoms/Menu'
4
+
5
+ const figmaPrimaryDesign = {
6
+ design: {
7
+ type: 'figma',
8
+ url: 'https://www.figma.com/design/DN2ova21vWqCRvPspBXgI1/Design-System?node-id=2464-3456&m=dev',
9
+ },
10
+ }
11
+
12
+ const meta = {
13
+ title: 'Design System/Atoms/Menu',
14
+ component: Menu,
15
+ tags: ['autodocs'],
16
+ argTypes: {
17
+ icon: {
18
+ description: 'Component icon used',
19
+ },
20
+ variant: {
21
+ description: 'Component variant used',
22
+ },
23
+ title: {
24
+ description: 'Component title text',
25
+ },
26
+ isSelected: {
27
+ description: 'Is the element selected?',
28
+ },
29
+ onClick: {
30
+ description: 'Event triggered when the component is clicked',
31
+ },
32
+ },
33
+ parameters: figmaPrimaryDesign,
34
+ }
35
+
36
+ export default meta
37
+
38
+ export const MenuWithSecondLevelDropdown = {
39
+ render: () => (
40
+ <Menu>
41
+ <MenuOption title="Tekken 8" icon="Edit">
42
+ <Menu isDropdown>
43
+ <MenuOption title="Walkthrough" onClick={() => alert('click')} />
44
+ <MenuOption title="Characters" onClick={() => alert('click')} />
45
+ <MenuOption title="Story" onClick={() => alert('click')} />
46
+ </Menu>
47
+ </MenuOption>
48
+ <MenuOption
49
+ title="The Legend of Zelda: Tears of the Kingdom"
50
+ icon="Delete"
51
+ onClick={() => alert('click')}
52
+ />
53
+ <MenuOption
54
+ title="Metal Gear Solid 5: Ground Zeroes + The Phantom Pain"
55
+ icon="Show"
56
+ >
57
+ <Menu isDropdown>
58
+ <MenuOption title="Walkthrough" onClick={() => alert('click')} />
59
+ <MenuOption title="Characters" onClick={() => alert('click')} />
60
+ <MenuOption title="Story" onClick={() => alert('click')} />
61
+ </Menu>
62
+ </MenuOption>
63
+ <MenuOption title="Stray" icon="Info" onClick={() => alert('click')} />
64
+ </Menu>
65
+ ),
66
+ }
67
+
68
+ export const FirstLevelMenu = {
69
+ render: () => (
70
+ <Menu>
71
+ <MenuOption title="Tekken 8" icon="Edit" onClick={() => alert('click')} />
72
+ <MenuOption
73
+ title="The Legend of Zelda: Tears of the Kingdom"
74
+ icon="Delete"
75
+ onClick={() => alert('click')}
76
+ />
77
+ <MenuOption
78
+ title="Metal Gear Solid 5: Ground Zeroes + The Phantom Pain"
79
+ icon="Show"
80
+ onClick={() => alert('click')}
81
+ />
82
+ <MenuOption title="Stray" icon="Info" onClick={() => alert('click')} />
83
+ </Menu>
84
+ ),
85
+ }
86
+
87
+ export const MenuWithSecondLevelPreselectedOption = {
88
+ render: () => (
89
+ <Menu>
90
+ <MenuOption isSelected title="Tekken 8" icon="Edit">
91
+ <Menu isDropdown>
92
+ <MenuOption title="Walkthrough" onClick={() => alert('click')} />
93
+ <MenuOption
94
+ isSelected
95
+ title="Characters"
96
+ onClick={() => alert('click')}
97
+ />
98
+ <MenuOption title="Story" onClick={() => alert('click')} />
99
+ </Menu>
100
+ </MenuOption>
101
+ <MenuOption
102
+ title="The Legend of Zelda: Tears of the Kingdom"
103
+ icon="Delete"
104
+ onClick={() => alert('click')}
105
+ />
106
+ <MenuOption
107
+ title="Metal Gear Solid 5: Ground Zeroes + The Phantom Pain"
108
+ icon="Show"
109
+ >
110
+ <Menu isDropdown>
111
+ <MenuOption title="Walkthrough" onClick={() => alert('click')} />
112
+ <MenuOption title="Characters" onClick={() => alert('click')} />
113
+ <MenuOption title="Story" onClick={() => alert('click')} />
114
+ </Menu>
115
+ </MenuOption>
116
+ <MenuOption title="Stray" icon="Info" onClick={() => alert('click')} />
117
+ </Menu>
118
+ ),
119
+ }
120
+
121
+ export const MenuWithFirstLevelPreselectedOption = {
122
+ render: () => (
123
+ <Menu>
124
+ <MenuOption title="Tekken 8" icon="Edit">
125
+ <Menu isDropdown>
126
+ <MenuOption title="Walkthrough" onClick={() => alert('click')} />
127
+ <MenuOption title="Characters" onClick={() => alert('click')} />
128
+ <MenuOption title="Story" onClick={() => alert('click')} />
129
+ </Menu>
130
+ </MenuOption>
131
+ <MenuOption
132
+ isSelected
133
+ title="The Legend of Zelda: Tears of the Kingdom"
134
+ icon="Delete"
135
+ onClick={() => alert('click')}
136
+ />
137
+ <MenuOption
138
+ title="Metal Gear Solid 5: Ground Zeroes + The Phantom Pain"
139
+ icon="Show"
140
+ >
141
+ <Menu isDropdown>
142
+ <MenuOption title="Walkthrough" onClick={() => alert('click')} />
143
+ <MenuOption title="Characters" onClick={() => alert('click')} />
144
+ <MenuOption title="Story" onClick={() => alert('click')} />
145
+ </Menu>
146
+ </MenuOption>
147
+ <MenuOption title="Stray" icon="Info" onClick={() => alert('click')} />
148
+ </Menu>
149
+ ),
150
+ }
@@ -1,9 +1,6 @@
1
1
  import React from 'react'
2
2
  import { render } from '@testing-library/react'
3
- import { Card } from '@/atoms/Card'
4
- import { CardHeader } from '@/atoms/CardHeader'
5
- import { CardContent } from '@/atoms/CardContent'
6
- import { CardFooter } from '@/atoms/CardFooter'
3
+ import { Card, CardHeader, CardContent, CardFooter } from '@/atoms/Card'
7
4
  import { Button } from '@/atoms/Button'
8
5
 
9
6
  describe('Product card', () => {
@@ -1,11 +1,14 @@
1
1
  import React from 'react'
2
2
  import { render } from '@testing-library/react'
3
- import { CardsTable } from '@/atoms/CardsTable'
4
- import { CardsTableHead } from '@/atoms/CardsTableHead'
5
- import { CardsTableHeader } from '@/atoms/CardsTableHeader'
6
- import { CardsTableRow } from '@/atoms/CardsTableRow'
7
- import { CardsTableBody } from '@/atoms/CardsTableBody'
8
- import { CardsTableCell, Alignment } from '@/atoms/CardsTableCell'
3
+ import {
4
+ CardsTable,
5
+ CardsTableHead,
6
+ CardsTableHeader,
7
+ CardsTableRow,
8
+ CardsTableBody,
9
+ CardsTableCell,
10
+ Alignment,
11
+ } from '@/atoms/CardsTable'
9
12
  import { IconButton } from '@/atoms/IconButton'
10
13
  import { Badge } from '@/atoms/Badge'
11
14
 
@@ -0,0 +1,59 @@
1
+ import React from 'react'
2
+ import { render } from '@testing-library/react'
3
+ import { Menu } from '@/atoms/Menu/Menu'
4
+ import { MenuOption } from '@/atoms/Menu/MenuOption'
5
+
6
+ describe('Menu', () => {
7
+ it('renders first-level menu', () => {
8
+ const { getByRole, getByText, getAllByRole } = render(
9
+ <Menu>
10
+ <MenuOption title="Tekken 8" icon="Edit" />
11
+ <MenuOption
12
+ isSelected
13
+ title="The Legend of Zelda: Tears of the Kingdom"
14
+ icon="Delete"
15
+ />
16
+ </Menu>,
17
+ )
18
+
19
+ expect(getByRole('menu')).toHaveClass(`menu primary`)
20
+ expect(getAllByRole('menuitem')[1]).toHaveClass(`selected`)
21
+ expect(getByText(/Tekken/i)).toBeInTheDocument()
22
+ expect(getByText(/Zelda/i)).toBeInTheDocument()
23
+ expect(getAllByRole('img')[0].title).toBe('Edit')
24
+ expect(getAllByRole('img')[2].title).toBe('Delete')
25
+ })
26
+
27
+ it('renders second-level menu', () => {
28
+ const { getByText, getAllByRole } = render(
29
+ <Menu>
30
+ <MenuOption title="Tekken 8" icon="Edit">
31
+ <Menu isDropdown>
32
+ <MenuOption title="Walkthrough" onClick={() => alert('click')} />
33
+ <MenuOption
34
+ isSelected
35
+ title="Characters"
36
+ onClick={() => alert('click')}
37
+ />
38
+ <MenuOption title="Story" onClick={() => alert('click')} />
39
+ </Menu>
40
+ </MenuOption>
41
+ <MenuOption
42
+ title="The Legend of Zelda: Tears of the Kingdom"
43
+ icon="Delete"
44
+ />
45
+ </Menu>,
46
+ )
47
+
48
+ expect(getAllByRole('menu').length).toBe(2)
49
+ expect(getAllByRole('menuitem')[2]).toHaveClass(`selected`)
50
+ expect(getByText(/Tekken/i)).toBeInTheDocument()
51
+ expect(getByText(/Walkthrough/i)).toBeInTheDocument()
52
+ expect(getByText(/Characters/i)).toBeInTheDocument()
53
+ expect(getByText(/Story/i)).toBeInTheDocument()
54
+ expect(getByText(/Zelda/i)).toBeInTheDocument()
55
+ expect(getAllByRole('img')[0].title).toBe('Edit')
56
+ expect(getAllByRole('img')[2].title).toBe('AngleDown')
57
+ expect(getAllByRole('img')[5].title).toBe('Delete')
58
+ })
59
+ })
package/tsconfig.json CHANGED
@@ -22,6 +22,6 @@
22
22
  "@/*": ["./src/*"]
23
23
  }
24
24
  },
25
- "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "src/stories/CardsTable.stories.js", "src/stories/Modal.stories.js", "src/stories/Typography.stories.mdx", "src/stories/Card.stories.js"],
25
+ "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "src/stories/CardsTable.stories.js", "src/stories/Modal.stories.js", "src/stories/Typography.stories.mdx", "src/stories/Card.stories.js", "src/stories/Menu.stories.js"],
26
26
  "exclude": ["node_modules"]
27
27
  }