agroptima-design-system 0.37.0-beta.8 → 0.37.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.
- package/.github/workflows/run-linters.yml +1 -1
- package/.github/workflows/run-tests.yml +1 -1
- package/package.json +1 -1
- package/src/atoms/Popover/Popover.scss +37 -7
- package/src/atoms/Popover/Popover.tsx +2 -2
- package/src/icons/index.tsx +2 -0
- package/src/icons/picture.svg +1 -0
- package/src/stories/Changelog.mdx +4 -0
- package/src/stories/InputWithButton.stories.tsx +0 -8
- package/tests/Popover.spec.tsx +5 -1
package/package.json
CHANGED
|
@@ -3,6 +3,26 @@
|
|
|
3
3
|
@use '../../settings/config';
|
|
4
4
|
@use '../../settings/depth';
|
|
5
5
|
|
|
6
|
+
|
|
7
|
+
%top {
|
|
8
|
+
bottom: 42px;
|
|
9
|
+
margin-top: auto;
|
|
10
|
+
margin-bottom: config.$space-2x;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
%left {
|
|
14
|
+
left: 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
%right {
|
|
18
|
+
right: 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
%center {
|
|
22
|
+
left: 50%;
|
|
23
|
+
transform: translateX(-50%);
|
|
24
|
+
}
|
|
25
|
+
|
|
6
26
|
.popover-container {
|
|
7
27
|
pointer-events: none;
|
|
8
28
|
position: relative;
|
|
@@ -18,22 +38,32 @@
|
|
|
18
38
|
z-index: depth.$z-popover;
|
|
19
39
|
|
|
20
40
|
&.left {
|
|
21
|
-
left
|
|
41
|
+
@extend %left;
|
|
22
42
|
}
|
|
23
43
|
|
|
24
44
|
&.right {
|
|
25
|
-
right
|
|
45
|
+
@extend %right;
|
|
26
46
|
}
|
|
27
47
|
|
|
28
48
|
&.center {
|
|
29
|
-
|
|
30
|
-
transform: translateX(-50%);
|
|
49
|
+
@extend %center;
|
|
31
50
|
}
|
|
32
51
|
|
|
33
52
|
&.top {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
53
|
+
&-left {
|
|
54
|
+
@extend %top;
|
|
55
|
+
@extend %left;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
&-right {
|
|
59
|
+
@extend %top;
|
|
60
|
+
@extend %right;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&-center {
|
|
64
|
+
@extend %top;
|
|
65
|
+
@extend %center;
|
|
66
|
+
}
|
|
37
67
|
}
|
|
38
68
|
}
|
|
39
69
|
}
|
|
@@ -14,7 +14,7 @@ type Actions = {
|
|
|
14
14
|
|
|
15
15
|
type Horizontal = 'left' | 'right' | 'center'
|
|
16
16
|
|
|
17
|
-
type Position = Horizontal |
|
|
17
|
+
type Position = Horizontal | `top-${Horizontal}`
|
|
18
18
|
|
|
19
19
|
export interface PopoverProps {
|
|
20
20
|
renderButton: (props: Actions) => React.ReactNode
|
|
@@ -42,10 +42,10 @@ function Popover({
|
|
|
42
42
|
{renderButton({ isOpen, close, open, toggle })}
|
|
43
43
|
<div
|
|
44
44
|
className={classNames('popover-menu-container', position, {
|
|
45
|
-
top,
|
|
46
45
|
hidden: !isOpen,
|
|
47
46
|
})}
|
|
48
47
|
onClick={close}
|
|
48
|
+
aria-hidden={!isOpen}
|
|
49
49
|
>
|
|
50
50
|
{children}
|
|
51
51
|
</div>
|
package/src/icons/index.tsx
CHANGED
|
@@ -42,6 +42,7 @@ import More from './more.svg'
|
|
|
42
42
|
import NewView from './new-view.svg'
|
|
43
43
|
import Orders from './orders.svg'
|
|
44
44
|
import PDF from './pdf.svg'
|
|
45
|
+
import Picture from './picture.svg'
|
|
45
46
|
import Product from './product.svg'
|
|
46
47
|
import Reason from './reason.svg'
|
|
47
48
|
import Reports from './reports.svg'
|
|
@@ -102,6 +103,7 @@ export {
|
|
|
102
103
|
NewView,
|
|
103
104
|
Orders,
|
|
104
105
|
PDF,
|
|
106
|
+
Picture,
|
|
105
107
|
Product,
|
|
106
108
|
Reason,
|
|
107
109
|
Reports,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#picture__a)"><path d="M2.222 20a2.14 2.14 0 0 1-1.57-.653A2.14 2.14 0 0 1 0 17.777V2.223c0-.61.218-1.134.653-1.57A2.14 2.14 0 0 1 2.223 0h15.555a2.14 2.14 0 0 1 1.57.653c.434.435.652.958.652 1.57v15.555a2.14 2.14 0 0 1-.653 1.57 2.14 2.14 0 0 1-1.57.652H2.223Zm0-2.222h15.556V2.222H2.222v15.556Zm1.111-2.222h13.334L12.5 10l-3.333 4.444-2.5-3.333-3.334 4.445Z"/></g><defs><clipPath id="picture__a"><path fill="#fff" d="M0 0h20v20H0z"/></clipPath></defs></svg>
|
|
@@ -3,13 +3,6 @@ import { Button } from '../atoms/Button'
|
|
|
3
3
|
import { Input } from '../atoms/Input'
|
|
4
4
|
import { InputWithButton } from '../atoms/InputWithButton'
|
|
5
5
|
|
|
6
|
-
const figmaDesign = {
|
|
7
|
-
design: {
|
|
8
|
-
type: 'figma',
|
|
9
|
-
url: '',
|
|
10
|
-
},
|
|
11
|
-
}
|
|
12
|
-
|
|
13
6
|
const meta = {
|
|
14
7
|
title: 'Design System/Atoms/InputWithButton',
|
|
15
8
|
component: InputWithButton,
|
|
@@ -30,7 +23,6 @@ const meta = {
|
|
|
30
23
|
'</ul>',
|
|
31
24
|
},
|
|
32
25
|
},
|
|
33
|
-
figmaDesign,
|
|
34
26
|
},
|
|
35
27
|
tags: ['autodocs'],
|
|
36
28
|
argTypes: {
|
package/tests/Popover.spec.tsx
CHANGED
|
@@ -52,6 +52,10 @@ describe('PopoverMenu', () => {
|
|
|
52
52
|
})
|
|
53
53
|
|
|
54
54
|
it('hides when click outside of the menu', async () => {
|
|
55
|
+
document.head.insertAdjacentHTML(
|
|
56
|
+
'beforeend',
|
|
57
|
+
`<style>.hidden { display: none !important; }</style>`,
|
|
58
|
+
)
|
|
55
59
|
const user = userEvent.setup()
|
|
56
60
|
const { getByText, queryByText } = render(
|
|
57
61
|
<>
|
|
@@ -77,6 +81,6 @@ describe('PopoverMenu', () => {
|
|
|
77
81
|
expect(getByText(/Profile/i)).toBeInTheDocument()
|
|
78
82
|
await user.click(getByText(/Outside/i))
|
|
79
83
|
|
|
80
|
-
expect(queryByText(/Profile/i)).not.
|
|
84
|
+
expect(queryByText(/Profile/i)).not.toBeVisible()
|
|
81
85
|
})
|
|
82
86
|
})
|