agroptima-design-system 0.36.2 → 0.37.0-beta.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/Button/Button.scss +73 -61
- package/src/atoms/Button/Button.tsx +3 -1
- package/src/atoms/ButtonGroup/ButtonGroup.scss +20 -0
- package/src/atoms/ButtonGroup/ButtonGroup.tsx +10 -0
- package/src/atoms/ButtonGroup/index.ts +3 -0
- package/src/atoms/Popover/Popover.scss +46 -8
- package/src/atoms/Popover/Popover.tsx +32 -17
- package/src/atoms/Popover/PopoverMenu.tsx +1 -0
- package/src/atoms/Popover/PopoverMenuOption.tsx +8 -13
- package/src/icons/index.tsx +2 -0
- package/src/icons/more.svg +11 -0
- package/src/stories/Alert.stories.ts +9 -1
- package/src/stories/{AlertContainer.stories.js → AlertContainer.stories.tsx} +3 -1
- package/src/stories/Badge.stories.ts +2 -1
- package/src/stories/Button.stories.ts +12 -1
- package/src/stories/ButtonGroup.stories.tsx +115 -0
- package/src/stories/{Card.stories.js → Card.stories.tsx} +21 -15
- package/src/stories/{CardMenu.stories.js → CardMenu.stories.tsx} +18 -12
- package/src/stories/{CardsTable.stories.js → CardsTable.stories.tsx} +23 -13
- package/src/stories/Changelog.mdx +8 -0
- package/src/stories/{CheckableTag.stories.js → CheckableTag.stories.tsx} +9 -3
- package/src/stories/Checkbox.stories.tsx +6 -1
- package/src/stories/Collapsible.stories.tsx +7 -2
- package/src/stories/DateRangePicker.stories.ts +2 -1
- package/src/stories/DateSinglePicker.stories.ts +2 -1
- package/src/stories/Divider.stories.tsx +5 -1
- package/src/stories/{Drawer.stories.js → Drawer.stories.tsx} +7 -3
- package/src/stories/{EmptyState.stories.js → EmptyState.stories.tsx} +6 -3
- package/src/stories/FloatingButton.stories.ts +2 -1
- package/src/stories/{Form.stories.js → Form.stories.tsx} +13 -4
- package/src/stories/HelpText.stories.ts +2 -1
- package/src/stories/IconButton.stories.ts +8 -1
- package/src/stories/Input.stories.ts +8 -1
- package/src/stories/InputWithButton.stories.tsx +8 -0
- package/src/stories/Label.stories.ts +4 -1
- package/src/stories/{Menu.stories.js → Menu.stories.tsx} +9 -2
- package/src/stories/Modal.stories.tsx +1 -1
- package/src/stories/Multiselect.stories.ts +8 -1
- package/src/stories/{Pagination.stories.js → Pagination.stories.tsx} +7 -7
- package/src/stories/{Popover.stories.js → Popover.stories.tsx} +48 -5
- package/src/stories/{PopoverMenu.stories.js → PopoverMenu.stories.tsx} +9 -3
- package/src/stories/RadioGroup.stories.ts +6 -1
- package/src/stories/Select.stories.ts +10 -1
- package/src/stories/Switch.stories.ts +2 -1
- package/src/stories/{TabMenu.stories.js → TabMenu.stories.tsx} +8 -2
- package/src/stories/TextArea.stories.ts +9 -1
- package/src/stories/{Typography.stories.js → Typography.stories.tsx} +3 -1
- package/tsconfig.json +6 -5
package/package.json
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
> .icon {
|
|
10
10
|
> svg {
|
|
11
11
|
fill: $secondary-color;
|
|
12
|
+
|
|
12
13
|
path {
|
|
13
14
|
fill: $secondary-color;
|
|
14
15
|
}
|
|
@@ -36,38 +37,33 @@
|
|
|
36
37
|
border: 1px solid transparent;
|
|
37
38
|
|
|
38
39
|
> .icon {
|
|
39
|
-
margin
|
|
40
|
-
width: config.$icon-size-3x;
|
|
41
|
-
height: config.$icon-size-3x;
|
|
42
|
-
> svg {
|
|
43
|
-
width: 100%;
|
|
44
|
-
height: 100%;
|
|
45
|
-
}
|
|
40
|
+
margin: 6px 2px;
|
|
46
41
|
}
|
|
47
42
|
|
|
48
43
|
&.primary {
|
|
49
44
|
@include button-style(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
color_alias.$primary-color-600,
|
|
46
|
+
color_alias.$neutral-white,
|
|
47
|
+
color_alias.$primary-color-800
|
|
53
48
|
);
|
|
54
49
|
}
|
|
55
50
|
|
|
56
51
|
&.primary-outlined {
|
|
57
52
|
border: 1px solid color_alias.$primary-color-600;
|
|
58
53
|
@include button-style(
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
54
|
+
color_alias.$neutral-white,
|
|
55
|
+
color_alias.$primary-color-600,
|
|
56
|
+
color_alias.$primary-color-50
|
|
62
57
|
);
|
|
63
58
|
}
|
|
64
59
|
|
|
65
60
|
&.primary-ghost {
|
|
66
61
|
@include button-style(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
62
|
+
color_alias.$neutral-white,
|
|
63
|
+
color_alias.$primary-color-600,
|
|
64
|
+
transparent
|
|
70
65
|
);
|
|
66
|
+
|
|
71
67
|
&:not(:disabled):hover,
|
|
72
68
|
&:not(:disabled):active {
|
|
73
69
|
border: 1px solid color_alias.$primary-color-600;
|
|
@@ -76,16 +72,19 @@
|
|
|
76
72
|
|
|
77
73
|
&.error {
|
|
78
74
|
@include button-style(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
75
|
+
color_alias.$error-color-1000,
|
|
76
|
+
color_alias.$neutral-color-1000,
|
|
77
|
+
color_alias.$error-color-700
|
|
82
78
|
);
|
|
79
|
+
|
|
83
80
|
&:not(:disabled):hover,
|
|
84
81
|
&:not(:disabled):active {
|
|
85
82
|
color: color_alias.$neutral-white;
|
|
83
|
+
|
|
86
84
|
> .icon {
|
|
87
85
|
> svg {
|
|
88
86
|
fill: color_alias.$neutral-white;
|
|
87
|
+
|
|
89
88
|
path {
|
|
90
89
|
fill: color_alias.$neutral-white;
|
|
91
90
|
}
|
|
@@ -97,18 +96,19 @@
|
|
|
97
96
|
&.error-outlined {
|
|
98
97
|
border: 1px solid color_alias.$error-color-600;
|
|
99
98
|
@include button-style(
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
99
|
+
color_alias.$neutral-white,
|
|
100
|
+
color_alias.$error-color-600,
|
|
101
|
+
color_alias.$error-color-50
|
|
103
102
|
);
|
|
104
103
|
}
|
|
105
104
|
|
|
106
105
|
&.error-ghost {
|
|
107
106
|
@include button-style(
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
107
|
+
color_alias.$neutral-white,
|
|
108
|
+
color_alias.$error-color-600,
|
|
109
|
+
transparent
|
|
111
110
|
);
|
|
111
|
+
|
|
112
112
|
&:not(:disabled):hover,
|
|
113
113
|
&:not(:disabled):active {
|
|
114
114
|
border: 1px solid color_alias.$error-color-600;
|
|
@@ -117,16 +117,19 @@
|
|
|
117
117
|
|
|
118
118
|
&.success {
|
|
119
119
|
@include button-style(
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
120
|
+
color_alias.$success-color-1000,
|
|
121
|
+
color_alias.$neutral-color-900,
|
|
122
|
+
color_alias.$success-color-700
|
|
123
123
|
);
|
|
124
|
+
|
|
124
125
|
&:not(:disabled):hover,
|
|
125
126
|
&:not(:disabled):active {
|
|
126
127
|
color: color_alias.$neutral-white;
|
|
128
|
+
|
|
127
129
|
> .icon {
|
|
128
130
|
> svg {
|
|
129
131
|
fill: color_alias.$neutral-white;
|
|
132
|
+
|
|
130
133
|
path {
|
|
131
134
|
fill: color_alias.$neutral-white;
|
|
132
135
|
}
|
|
@@ -139,18 +142,19 @@
|
|
|
139
142
|
border: 1px solid color_alias.$success-color-1000;
|
|
140
143
|
|
|
141
144
|
@include button-style(
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
+
color_alias.$neutral-white,
|
|
146
|
+
color_alias.$neutral-color-900,
|
|
147
|
+
color_alias.$success-color-50
|
|
145
148
|
);
|
|
146
149
|
}
|
|
147
150
|
|
|
148
151
|
&.success-ghost {
|
|
149
152
|
@include button-style(
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
+
color_alias.$neutral-white,
|
|
154
|
+
color_alias.$success-color-1000,
|
|
155
|
+
transparent
|
|
153
156
|
);
|
|
157
|
+
|
|
154
158
|
&:not(:disabled):hover,
|
|
155
159
|
&:not(:disabled):active {
|
|
156
160
|
border: 1px solid color_alias.$success-color-1000;
|
|
@@ -159,16 +163,19 @@
|
|
|
159
163
|
|
|
160
164
|
&.warning {
|
|
161
165
|
@include button-style(
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
166
|
+
color_alias.$warning-color-1000,
|
|
167
|
+
color_alias.$neutral-color-900,
|
|
168
|
+
color_alias.$warning-color-700
|
|
165
169
|
);
|
|
170
|
+
|
|
166
171
|
&:not(:disabled):hover,
|
|
167
172
|
&:not(:disabled):active {
|
|
168
173
|
color: color_alias.$neutral-white;
|
|
174
|
+
|
|
169
175
|
> .icon {
|
|
170
176
|
> svg {
|
|
171
177
|
fill: color_alias.$neutral-white;
|
|
178
|
+
|
|
172
179
|
path {
|
|
173
180
|
fill: color_alias.$neutral-white;
|
|
174
181
|
}
|
|
@@ -180,18 +187,19 @@
|
|
|
180
187
|
&.warning-outlined {
|
|
181
188
|
border: 1px solid color_alias.$warning-color-1000;
|
|
182
189
|
@include button-style(
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
190
|
+
color_alias.$neutral-white,
|
|
191
|
+
color_alias.$neutral-color-900,
|
|
192
|
+
color_alias.$warning-color-50
|
|
186
193
|
);
|
|
187
194
|
}
|
|
188
195
|
|
|
189
196
|
&.warning-ghost {
|
|
190
197
|
@include button-style(
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
198
|
+
color_alias.$neutral-white,
|
|
199
|
+
color_alias.$warning-color-1000,
|
|
200
|
+
transparent
|
|
194
201
|
);
|
|
202
|
+
|
|
195
203
|
&:not(:disabled):hover,
|
|
196
204
|
&:not(:disabled):active {
|
|
197
205
|
border: 1px solid color_alias.$warning-color-1000;
|
|
@@ -200,27 +208,28 @@
|
|
|
200
208
|
|
|
201
209
|
&.info {
|
|
202
210
|
@include button-style(
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
211
|
+
color_alias.$info-color-600,
|
|
212
|
+
color_alias.$neutral-white,
|
|
213
|
+
color_alias.$info-color-900
|
|
206
214
|
);
|
|
207
215
|
}
|
|
208
216
|
|
|
209
217
|
&.info-outlined {
|
|
210
218
|
border: 1px solid color_alias.$info-color-600;
|
|
211
219
|
@include button-style(
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
220
|
+
color_alias.$neutral-white,
|
|
221
|
+
color_alias.$info-color-600,
|
|
222
|
+
color_alias.$info-color-50
|
|
215
223
|
);
|
|
216
224
|
}
|
|
217
225
|
|
|
218
226
|
&.info-ghost {
|
|
219
227
|
@include button-style(
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
228
|
+
color_alias.$neutral-white,
|
|
229
|
+
color_alias.$info-color-600,
|
|
230
|
+
transparent
|
|
223
231
|
);
|
|
232
|
+
|
|
224
233
|
&:not(:disabled):hover,
|
|
225
234
|
&:not(:disabled):active {
|
|
226
235
|
border: 1px solid color_alias.$info-color-600;
|
|
@@ -229,27 +238,28 @@
|
|
|
229
238
|
|
|
230
239
|
&.neutral {
|
|
231
240
|
@include button-style(
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
241
|
+
color_alias.$neutral-color-100,
|
|
242
|
+
color_alias.$neutral-color-1000,
|
|
243
|
+
color_alias.$neutral-color-300
|
|
235
244
|
);
|
|
236
245
|
}
|
|
237
246
|
|
|
238
247
|
&.neutral-outlined {
|
|
239
248
|
border: 1px solid color_alias.$neutral-color-100;
|
|
240
249
|
@include button-style(
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
250
|
+
color_alias.$neutral-white,
|
|
251
|
+
color_alias.$neutral-color-1000,
|
|
252
|
+
color_alias.$neutral-color-50
|
|
244
253
|
);
|
|
245
254
|
}
|
|
246
255
|
|
|
247
256
|
&.neutral-ghost {
|
|
248
257
|
@include button-style(
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
258
|
+
color_alias.$neutral-white,
|
|
259
|
+
color_alias.$neutral-color-1000,
|
|
260
|
+
transparent
|
|
252
261
|
);
|
|
262
|
+
|
|
253
263
|
&:not(:disabled):hover,
|
|
254
264
|
&:not(:disabled):active {
|
|
255
265
|
border: 1px solid color_alias.$neutral-color-100;
|
|
@@ -258,9 +268,11 @@
|
|
|
258
268
|
|
|
259
269
|
&:disabled {
|
|
260
270
|
color: color_alias.$neutral-color-400;
|
|
271
|
+
|
|
261
272
|
> .icon {
|
|
262
273
|
> svg {
|
|
263
274
|
fill: color_alias.$neutral-color-400;
|
|
275
|
+
|
|
264
276
|
path {
|
|
265
277
|
fill: color_alias.$neutral-color-400;
|
|
266
278
|
}
|
|
@@ -7,6 +7,7 @@ import { BaseButton } from './BaseButton'
|
|
|
7
7
|
|
|
8
8
|
interface CustomProps {
|
|
9
9
|
label: string
|
|
10
|
+
icon?: IconType
|
|
10
11
|
accessibilityLabel?: string
|
|
11
12
|
leftIcon?: IconType
|
|
12
13
|
rightIcon?: IconType
|
|
@@ -40,6 +41,7 @@ export type ButtonVariant =
|
|
|
40
41
|
|
|
41
42
|
export function Button({
|
|
42
43
|
label,
|
|
44
|
+
icon,
|
|
43
45
|
accessibilityLabel,
|
|
44
46
|
leftIcon,
|
|
45
47
|
rightIcon,
|
|
@@ -63,7 +65,7 @@ export function Button({
|
|
|
63
65
|
{...props}
|
|
64
66
|
>
|
|
65
67
|
{leftIconName && <Icon name={leftIconName} size="3" />}
|
|
66
|
-
{label}
|
|
68
|
+
{icon ? <Icon name={icon} size="3" /> : label}
|
|
67
69
|
{rightIcon && <Icon name={rightIcon} size="3" />}
|
|
68
70
|
</BaseButton>
|
|
69
71
|
)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
.button-group {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: row;
|
|
4
|
+
align-items: center;
|
|
5
|
+
gap: 1px;
|
|
6
|
+
|
|
7
|
+
> .button:first-child, > .popover-container:first-child > .button {
|
|
8
|
+
border-top-right-radius: 0;
|
|
9
|
+
border-bottom-right-radius: 0;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
> .button:last-child, > .popover-container:last-child > .button {
|
|
13
|
+
border-top-left-radius: 0;
|
|
14
|
+
border-bottom-left-radius: 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
> .button:not(:first-child):not(:last-child), > .popover-container:not(:first-child):not(:last-child) {
|
|
18
|
+
border-radius: 0;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import './ButtonGroup.scss'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { classNames } from '../../utils/classNames'
|
|
4
|
+
|
|
5
|
+
export interface ButtonGroupProps
|
|
6
|
+
extends React.HTMLAttributes<HTMLDivElement> {}
|
|
7
|
+
|
|
8
|
+
export function ButtonGroup({ className, children }: ButtonGroupProps) {
|
|
9
|
+
return <div className={classNames('button-group', className)}>{children}</div>
|
|
10
|
+
}
|
|
@@ -3,26 +3,64 @@
|
|
|
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;
|
|
29
|
+
|
|
9
30
|
> * {
|
|
10
31
|
pointer-events: auto;
|
|
11
32
|
}
|
|
33
|
+
|
|
12
34
|
.popover-menu-container {
|
|
13
35
|
position: absolute;
|
|
14
36
|
white-space: nowrap;
|
|
15
37
|
margin-top: config.$space-2x;
|
|
16
38
|
z-index: depth.$z-popover;
|
|
39
|
+
|
|
17
40
|
&.left {
|
|
18
|
-
left
|
|
41
|
+
@extend %left;
|
|
19
42
|
}
|
|
43
|
+
|
|
20
44
|
&.right {
|
|
21
|
-
right
|
|
45
|
+
@extend %right;
|
|
22
46
|
}
|
|
47
|
+
|
|
23
48
|
&.center {
|
|
24
|
-
|
|
25
|
-
|
|
49
|
+
@extend %center;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&.top {
|
|
53
|
+
&-left {
|
|
54
|
+
@extend %top %left;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&-right {
|
|
58
|
+
@extend %top %right;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&-center {
|
|
62
|
+
@extend %top %center;
|
|
63
|
+
}
|
|
26
64
|
}
|
|
27
65
|
}
|
|
28
66
|
}
|
|
@@ -31,10 +69,9 @@
|
|
|
31
69
|
display: flex;
|
|
32
70
|
flex-direction: column;
|
|
33
71
|
justify-content: flex-start;
|
|
34
|
-
box-shadow:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
0px 9px 28px 8px rgba(0, 0, 0, 0.05);
|
|
72
|
+
box-shadow: 0 3px 6px -4px rgba(0, 0, 0, 0.12),
|
|
73
|
+
0px 6px 16px 0px rgba(0, 0, 0, 0.08),
|
|
74
|
+
0px 9px 28px 8px rgba(0, 0, 0, 0.05);
|
|
38
75
|
|
|
39
76
|
.popover-menu-option {
|
|
40
77
|
@include typography.body-regular-primary;
|
|
@@ -44,6 +81,7 @@
|
|
|
44
81
|
border-radius: config.$corner-radius-xxs;
|
|
45
82
|
text-decoration: none;
|
|
46
83
|
cursor: default;
|
|
84
|
+
border: none;
|
|
47
85
|
|
|
48
86
|
&:hover {
|
|
49
87
|
text-decoration: none;
|
|
@@ -5,34 +5,49 @@ import { useOpen } from '../../hooks/useOpen'
|
|
|
5
5
|
import { useOutsideClick } from '../../hooks/useOutsideClick'
|
|
6
6
|
import { classNames } from '../../utils/classNames'
|
|
7
7
|
|
|
8
|
+
type Actions = {
|
|
9
|
+
isOpen: boolean
|
|
10
|
+
close: () => void
|
|
11
|
+
open: () => void
|
|
12
|
+
toggle: () => void
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
type Horizontal = 'left' | 'right' | 'center'
|
|
16
|
+
|
|
17
|
+
type Position = Horizontal | `top-${Horizontal}`
|
|
18
|
+
|
|
8
19
|
export interface PopoverProps {
|
|
9
|
-
renderButton: (props:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
open: () => void
|
|
13
|
-
toggle: () => void
|
|
14
|
-
}) => React.ReactNode
|
|
15
|
-
position?: 'left' | 'right' | 'center'
|
|
20
|
+
renderButton: (props: Actions) => React.ReactNode
|
|
21
|
+
position?: Position
|
|
22
|
+
className?: string
|
|
16
23
|
children: React.ReactNode
|
|
17
24
|
}
|
|
18
25
|
|
|
19
|
-
function Popover({
|
|
26
|
+
function Popover({
|
|
27
|
+
renderButton,
|
|
28
|
+
position = 'left',
|
|
29
|
+
className,
|
|
30
|
+
children,
|
|
31
|
+
}: PopoverProps) {
|
|
20
32
|
const { isOpen, close, open, toggle } = useOpen()
|
|
21
33
|
|
|
22
34
|
const popoverRef = useRef(null)
|
|
23
35
|
useOutsideClick(popoverRef, close)
|
|
24
36
|
|
|
25
37
|
return (
|
|
26
|
-
<div
|
|
38
|
+
<div
|
|
39
|
+
className={classNames('popover-container', className)}
|
|
40
|
+
ref={popoverRef}
|
|
41
|
+
>
|
|
27
42
|
{renderButton({ isOpen, close, open, toggle })}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
43
|
+
<div
|
|
44
|
+
className={classNames('popover-menu-container', position, {
|
|
45
|
+
hidden: !isOpen,
|
|
46
|
+
})}
|
|
47
|
+
onClick={close}
|
|
48
|
+
>
|
|
49
|
+
{children}
|
|
50
|
+
</div>
|
|
36
51
|
</div>
|
|
37
52
|
)
|
|
38
53
|
}
|
|
@@ -1,26 +1,24 @@
|
|
|
1
1
|
import './Popover.scss'
|
|
2
|
-
import
|
|
3
|
-
import Link from 'next/link'
|
|
4
|
-
import React, { type AnchorHTMLAttributes } from 'react'
|
|
2
|
+
import React from 'react'
|
|
5
3
|
import { classNames } from '../../utils/classNames'
|
|
4
|
+
import { BaseButton, type BaseButtonProps } from '../Button'
|
|
6
5
|
|
|
7
6
|
export type Variant = 'primary'
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
export interface PopoverMenuOptionProps extends LinkProps {
|
|
8
|
+
export interface CustomProps {
|
|
11
9
|
variant?: Variant
|
|
12
10
|
title: string
|
|
13
11
|
disabled?: boolean
|
|
14
|
-
href: string
|
|
15
12
|
active?: boolean
|
|
16
13
|
}
|
|
17
14
|
|
|
15
|
+
export type PopoverMenuOptionProps = CustomProps & BaseButtonProps
|
|
16
|
+
|
|
18
17
|
export function PopoverMenuOption({
|
|
19
18
|
variant = 'primary',
|
|
20
19
|
className,
|
|
21
20
|
title,
|
|
22
21
|
disabled,
|
|
23
|
-
href,
|
|
24
22
|
active,
|
|
25
23
|
prefetch = false,
|
|
26
24
|
...props
|
|
@@ -29,17 +27,14 @@ export function PopoverMenuOption({
|
|
|
29
27
|
disabled,
|
|
30
28
|
active,
|
|
31
29
|
})
|
|
32
|
-
|
|
33
30
|
return (
|
|
34
|
-
<
|
|
31
|
+
<BaseButton
|
|
35
32
|
role="menuitem"
|
|
36
33
|
className={cssClasses}
|
|
37
|
-
href={disabled ? '#' : href}
|
|
38
34
|
aria-disabled={disabled}
|
|
39
|
-
prefetch={prefetch}
|
|
40
35
|
{...props}
|
|
41
36
|
>
|
|
42
|
-
|
|
43
|
-
</
|
|
37
|
+
{title}
|
|
38
|
+
</BaseButton>
|
|
44
39
|
)
|
|
45
40
|
}
|
package/src/icons/index.tsx
CHANGED
|
@@ -38,6 +38,7 @@ import Invoice from './invoice.svg'
|
|
|
38
38
|
import Loading from './loading.svg'
|
|
39
39
|
import Logout from './logout.svg'
|
|
40
40
|
import Minus from './minus.svg'
|
|
41
|
+
import More from './more.svg'
|
|
41
42
|
import NewView from './new-view.svg'
|
|
42
43
|
import Orders from './orders.svg'
|
|
43
44
|
import PDF from './pdf.svg'
|
|
@@ -97,6 +98,7 @@ export {
|
|
|
97
98
|
Loading,
|
|
98
99
|
Logout,
|
|
99
100
|
Minus,
|
|
101
|
+
More,
|
|
100
102
|
NewView,
|
|
101
103
|
Orders,
|
|
102
104
|
PDF,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!-- Generator: Adobe Illustrator 22.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
|
3
|
+
<svg version="1.1" id="Capa_2" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
4
|
+
viewBox="0 0 32 32" style="enable-background:new 0 0 32 32;" xml:space="preserve">
|
|
5
|
+
<g>
|
|
6
|
+
<g id="keyboard-control">
|
|
7
|
+
<path d="M20,4c0-2.2-1.8-4-4-4s-4,1.8-4,4s1.8,4,4,4S20,6.2,20,4z M20,28c0-2.2-1.8-4-4-4s-4,1.8-4,4s1.8,4,4,4S20,30.2,20,28z
|
|
8
|
+
M20,16c0-2.2-1.8-4-4-4s-4,1.8-4,4s1.8,4,4,4S20,18.2,20,16z"/>
|
|
9
|
+
</g>
|
|
10
|
+
</g>
|
|
11
|
+
</svg>
|
|
@@ -8,7 +8,15 @@ const meta = {
|
|
|
8
8
|
docs: {
|
|
9
9
|
description: {
|
|
10
10
|
component:
|
|
11
|
-
|
|
11
|
+
'<h2>Usage guidelines</h2>' +
|
|
12
|
+
'<ul>' +
|
|
13
|
+
' <li>Make Alerts actionable and including a close button</li>' +
|
|
14
|
+
' <li>Be aware of color and semantic meaning</li>' +
|
|
15
|
+
' <li>Include only one action per Alert</li>' +
|
|
16
|
+
' <li>Place Alerts at the top</li>' +
|
|
17
|
+
" <li>Don't place Alerts over navigation</li>" +
|
|
18
|
+
' <li>Persist errors to maintain visibility</li>' +
|
|
19
|
+
'</ul>',
|
|
12
20
|
},
|
|
13
21
|
},
|
|
14
22
|
},
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react'
|
|
1
2
|
import React from 'react'
|
|
2
3
|
import { Alert, AlertContainer } from '../atoms/Alert'
|
|
3
4
|
|
|
@@ -17,8 +18,9 @@ const meta = {
|
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
export default meta
|
|
21
|
+
type Story = StoryObj<typeof meta>
|
|
20
22
|
|
|
21
|
-
export const Primary = {
|
|
23
|
+
export const Primary: Story = {
|
|
22
24
|
render: () => (
|
|
23
25
|
<AlertContainer>
|
|
24
26
|
<Alert variant="success" id="success" text="This is a success alert" />
|
|
@@ -8,7 +8,8 @@ const meta = {
|
|
|
8
8
|
docs: {
|
|
9
9
|
description: {
|
|
10
10
|
component:
|
|
11
|
-
'<h2>Usage guidelines</h2
|
|
11
|
+
'<h2>Usage guidelines</h2>' +
|
|
12
|
+
'<p>Use Badge component when content is mapped to multiple categories and the user needs a way to differentiate between them such as labeling or read-only situations.</p>',
|
|
12
13
|
},
|
|
13
14
|
},
|
|
14
15
|
},
|
|
@@ -8,7 +8,14 @@ const meta = {
|
|
|
8
8
|
docs: {
|
|
9
9
|
description: {
|
|
10
10
|
component:
|
|
11
|
-
'<h2>Usage guidelines</h2
|
|
11
|
+
'<h2>Usage guidelines</h2>' +
|
|
12
|
+
'<ul>' +
|
|
13
|
+
' <li>Button can be used as an action trigger or as a navigational component</li>' +
|
|
14
|
+
' <li>Use icons at the page first level actions such as Create, Edit, Delete or mass actions</li>' +
|
|
15
|
+
' <li>Display a popover when featuring subsequent options</li>' +
|
|
16
|
+
' <li>Be aware of color and semantic meaning</li>' +
|
|
17
|
+
' <li>Write labels as verbs</li>' +
|
|
18
|
+
'</ul>',
|
|
12
19
|
},
|
|
13
20
|
},
|
|
14
21
|
},
|
|
@@ -42,6 +49,10 @@ const meta = {
|
|
|
42
49
|
description: 'Button right icon from a list of values',
|
|
43
50
|
control: { type: 'select' },
|
|
44
51
|
},
|
|
52
|
+
icon: {
|
|
53
|
+
description: 'Replaces the label for a icon',
|
|
54
|
+
control: { type: 'select' },
|
|
55
|
+
},
|
|
45
56
|
href: {
|
|
46
57
|
description:
|
|
47
58
|
'If a link is provided, the component will be rendered as NextLink, otherwise as button',
|