agroptima-design-system 1.2.8 → 1.2.10
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/package.json +1 -1
- package/src/atoms/Notification/NotificationCenter.scss +20 -7
- package/src/atoms/Notification/NotificationHeader.tsx +8 -4
- package/src/icons/improvements.svg +1 -0
- package/src/icons/index.tsx +2 -0
- package/src/stories/Changelog.mdx +8 -0
- package/src/stories/Notification.stories.tsx +18 -10
- package/tests/Notification.spec.tsx +9 -5
package/package.json
CHANGED
|
@@ -42,18 +42,31 @@
|
|
|
42
42
|
.notification-header-content {
|
|
43
43
|
display: flex;
|
|
44
44
|
flex-direction: row;
|
|
45
|
-
justify-content: space-between;
|
|
46
45
|
align-items: center;
|
|
47
46
|
padding: config.$space-2x config.$space-3x;
|
|
48
47
|
gap: config.$space-2x;
|
|
48
|
+
flex-wrap: wrap;
|
|
49
49
|
background: var(--neutral-white);
|
|
50
50
|
|
|
51
|
-
> .
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
> .checkable-tag-group {
|
|
52
|
+
flex-grow: 1;
|
|
53
|
+
min-width: 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
> .notification-header-actions {
|
|
57
|
+
flex-basis: 100%;
|
|
58
|
+
text-align: right;
|
|
59
|
+
flex-shrink: 1;
|
|
60
|
+
min-width: 0;
|
|
61
|
+
|
|
62
|
+
> .button {
|
|
63
|
+
@include typography.footnote-primary;
|
|
64
|
+
color: var(--primary-color-600);
|
|
65
|
+
border: 0;
|
|
66
|
+
background-color: transparent;
|
|
67
|
+
padding: 0;
|
|
68
|
+
white-space: normal;
|
|
69
|
+
}
|
|
57
70
|
}
|
|
58
71
|
}
|
|
59
72
|
}
|
|
@@ -2,25 +2,29 @@
|
|
|
2
2
|
import './NotificationCenter.scss'
|
|
3
3
|
import React from 'react'
|
|
4
4
|
import { classNames } from '../../utils/classNames'
|
|
5
|
-
import { IconButton } from '../Button'
|
|
6
|
-
import type { Variant } from '../Button/IconButton'
|
|
7
|
-
import { Popover, type Position } from '../Popover'
|
|
8
5
|
|
|
9
6
|
export interface NotificationHeaderProps {
|
|
10
7
|
title: string
|
|
11
8
|
className?: string
|
|
12
9
|
children: React.ReactNode
|
|
10
|
+
actions?: React.ReactNode
|
|
13
11
|
}
|
|
14
12
|
|
|
15
13
|
function NotificationHeader({
|
|
16
14
|
title,
|
|
17
15
|
className,
|
|
18
16
|
children,
|
|
17
|
+
actions,
|
|
19
18
|
}: NotificationHeaderProps) {
|
|
20
19
|
return (
|
|
21
20
|
<div className={classNames('notification-header', className)}>
|
|
22
21
|
<div className="notification-header-title">{title}</div>
|
|
23
|
-
<div className="notification-header-content">
|
|
22
|
+
<div className="notification-header-content">
|
|
23
|
+
{children}
|
|
24
|
+
{actions && (
|
|
25
|
+
<div className="notification-header-actions">{actions}</div>
|
|
26
|
+
)}
|
|
27
|
+
</div>
|
|
24
28
|
</div>
|
|
25
29
|
)
|
|
26
30
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#improvements__a)"><path d="m3.642 7.997 1.945.822a25.6 25.6 0 0 1 .723-1.345c.25-.432.524-.864.823-1.296l-1.396-.274-2.095 2.093Zm3.541 2.068 2.844 2.815c.698-.266 1.446-.673 2.244-1.221a15.944 15.944 0 0 0 2.245-1.868 13.41 13.41 0 0 0 2.731-3.874c.657-1.42.944-2.728.86-3.924-1.196-.083-2.51.204-3.94.86a13.367 13.367 0 0 0-3.89 2.727 15.934 15.934 0 0 0-1.872 2.242c-.548.798-.956 1.545-1.222 2.243Zm3.866-3.027c0-.557.192-1.026.574-1.408.382-.382.856-.573 1.422-.573.565 0 1.039.191 1.421.573.383.382.574.851.574 1.408a1.91 1.91 0 0 1-.574 1.407c-.382.382-.856.573-1.421.573-.566 0-1.04-.19-1.422-.573a1.912 1.912 0 0 1-.574-1.407Zm1.048 9.404 2.095-2.092-.274-1.396c-.433.3-.865.57-1.297.81-.433.24-.882.478-1.347.71l.823 1.968ZM19.904.174c.316 2.01.12 3.966-.587 5.867-.706 1.902-1.924 3.716-3.653 5.444l.498 2.466c.067.332.05.656-.05.971-.1.316-.266.59-.498.823l-4.19 4.185-2.096-4.908-4.265-4.26L.15 8.67l4.165-4.186a1.99 1.99 0 0 1 .836-.498c.324-.1.652-.116.985-.05l2.469.498c1.73-1.727 3.542-2.947 5.437-3.662a11.36 11.36 0 0 1 5.862-.598ZM1.92 13.926c.582-.581 1.292-.876 2.132-.884.84-.009 1.55.278 2.133.86.582.58.868 1.29.86 2.129-.008.839-.303 1.549-.885 2.13-.416.415-1.11.772-2.083 1.071-.973.3-2.315.565-4.028.797.233-1.71.499-3.051.798-4.023.3-.971.657-1.665 1.073-2.08Zm1.421 1.395c-.166.166-.332.47-.499.91a6.48 6.48 0 0 0-.349 1.332 6.98 6.98 0 0 0 1.335-.336c.44-.158.744-.32.91-.486.2-.2.308-.44.324-.722a.903.903 0 0 0-.274-.723.944.944 0 0 0-.723-.286 1.031 1.031 0 0 0-.724.311Z" fill="#161C26"/></g><defs><clipPath id="improvements__a"><path fill="#fff" d="M0 0h20v20H0z"/></clipPath></defs></svg>
|
package/src/icons/index.tsx
CHANGED
|
@@ -33,6 +33,7 @@ import Error from './error.svg'
|
|
|
33
33
|
import Export from './export.svg'
|
|
34
34
|
import Filter from './filter.svg'
|
|
35
35
|
import Import from './import.svg'
|
|
36
|
+
import Improvements from './improvements.svg'
|
|
36
37
|
import Info from './info.svg'
|
|
37
38
|
import Invoice from './invoice.svg'
|
|
38
39
|
import Loading from './loading.svg'
|
|
@@ -102,6 +103,7 @@ export {
|
|
|
102
103
|
Export,
|
|
103
104
|
Filter,
|
|
104
105
|
Import,
|
|
106
|
+
Improvements,
|
|
105
107
|
Info,
|
|
106
108
|
Invoice,
|
|
107
109
|
Loading,
|
|
@@ -49,7 +49,15 @@ export const NotificationCenterWithNotifications: Story = {
|
|
|
49
49
|
|
|
50
50
|
<div style={{ display: 'flex', gap: '10px' }}>
|
|
51
51
|
<NotificationCenter hasNewNotifications={true}>
|
|
52
|
-
<NotificationHeader
|
|
52
|
+
<NotificationHeader
|
|
53
|
+
title="Notifications"
|
|
54
|
+
actions={
|
|
55
|
+
<Button
|
|
56
|
+
onClick={() => alert('mark all as read')}
|
|
57
|
+
label="Mark all as read"
|
|
58
|
+
/>
|
|
59
|
+
}
|
|
60
|
+
>
|
|
53
61
|
<CheckableTagGroup>
|
|
54
62
|
<CheckableTag
|
|
55
63
|
variant="primary"
|
|
@@ -73,10 +81,6 @@ export const NotificationCenterWithNotifications: Story = {
|
|
|
73
81
|
isChecked={false}
|
|
74
82
|
/>
|
|
75
83
|
</CheckableTagGroup>
|
|
76
|
-
<Button
|
|
77
|
-
onClick={() => alert('mark all as read')}
|
|
78
|
-
label="Mark all as read"
|
|
79
|
-
/>
|
|
80
84
|
</NotificationHeader>
|
|
81
85
|
<NotificationList>
|
|
82
86
|
<NotificationLine
|
|
@@ -134,7 +138,15 @@ export const NotificationCenterEmptyState: Story = {
|
|
|
134
138
|
|
|
135
139
|
<div style={{ display: 'flex', gap: '10px' }}>
|
|
136
140
|
<NotificationCenter {...props}>
|
|
137
|
-
<NotificationHeader
|
|
141
|
+
<NotificationHeader
|
|
142
|
+
title="Notifications"
|
|
143
|
+
actions={
|
|
144
|
+
<Button
|
|
145
|
+
onClick={() => alert('mark all as read')}
|
|
146
|
+
label="Mark all as read"
|
|
147
|
+
/>
|
|
148
|
+
}
|
|
149
|
+
>
|
|
138
150
|
<CheckableTagGroup>
|
|
139
151
|
<CheckableTag
|
|
140
152
|
variant="primary"
|
|
@@ -158,10 +170,6 @@ export const NotificationCenterEmptyState: Story = {
|
|
|
158
170
|
isChecked={false}
|
|
159
171
|
/>
|
|
160
172
|
</CheckableTagGroup>
|
|
161
|
-
<Button
|
|
162
|
-
onClick={() => alert('mark all as read')}
|
|
163
|
-
label="Mark all as read"
|
|
164
|
-
/>
|
|
165
173
|
</NotificationHeader>
|
|
166
174
|
<NotificationEmptyState
|
|
167
175
|
title="No new notifications"
|
|
@@ -13,7 +13,15 @@ describe('NotificationCenter', () => {
|
|
|
13
13
|
it('renders with expected content and buttons', () => {
|
|
14
14
|
const { getByText } = render(
|
|
15
15
|
<NotificationCenter>
|
|
16
|
-
<NotificationHeader
|
|
16
|
+
<NotificationHeader
|
|
17
|
+
title="Notifications"
|
|
18
|
+
actions={
|
|
19
|
+
<Button
|
|
20
|
+
onClick={() => alert('mark all as read')}
|
|
21
|
+
label="Mark all as read"
|
|
22
|
+
/>
|
|
23
|
+
}
|
|
24
|
+
>
|
|
17
25
|
<CheckableTagGroup>
|
|
18
26
|
<CheckableTag
|
|
19
27
|
variant="primary"
|
|
@@ -37,10 +45,6 @@ describe('NotificationCenter', () => {
|
|
|
37
45
|
isChecked={false}
|
|
38
46
|
/>
|
|
39
47
|
</CheckableTagGroup>
|
|
40
|
-
<Button
|
|
41
|
-
onClick={() => alert('mark all as read')}
|
|
42
|
-
label="Mark all as read"
|
|
43
|
-
/>
|
|
44
48
|
</NotificationHeader>
|
|
45
49
|
<NotificationList>
|
|
46
50
|
<NotificationLine
|