agroptima-design-system 0.36.2 → 0.37.0-beta.1
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/stories/Button.stories.ts +4 -0
- package/src/stories/ButtonGroup.stories.tsx +79 -0
- package/src/stories/Changelog.mdx +5 -0
- package/src/stories/InputWithButton.stories.tsx +8 -0
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 {
|
|
8
|
+
border-top-right-radius: 0;
|
|
9
|
+
border-bottom-right-radius: 0;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
> .button:last-child {
|
|
13
|
+
border-top-left-radius: 0;
|
|
14
|
+
border-bottom-left-radius: 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
> .button: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
|
+
}
|
|
@@ -42,6 +42,10 @@ const meta = {
|
|
|
42
42
|
description: 'Button right icon from a list of values',
|
|
43
43
|
control: { type: 'select' },
|
|
44
44
|
},
|
|
45
|
+
icon: {
|
|
46
|
+
description: 'Replaces the label for a icon',
|
|
47
|
+
control: { type: 'select' },
|
|
48
|
+
},
|
|
45
49
|
href: {
|
|
46
50
|
description:
|
|
47
51
|
'If a link is provided, the component will be rendered as NextLink, otherwise as button',
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react'
|
|
2
|
+
import { Button } from '../atoms/Button'
|
|
3
|
+
import { ButtonGroup } from '../atoms/ButtonGroup'
|
|
4
|
+
|
|
5
|
+
const figmaDesign = {
|
|
6
|
+
design: {
|
|
7
|
+
type: 'figma',
|
|
8
|
+
url: 'https://www.figma.com/design/DN2ova21vWqCRvPspBXgI1/Design-System?node-id=4279-942&t=06AFHQVmeQz1JClF-0',
|
|
9
|
+
},
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const meta = {
|
|
13
|
+
title: 'Design System/Atoms/ButtonGroup',
|
|
14
|
+
component: ButtonGroup,
|
|
15
|
+
parameters: {
|
|
16
|
+
docs: {
|
|
17
|
+
description: {
|
|
18
|
+
component:
|
|
19
|
+
'<h2>Usage guidelines</h2>' +
|
|
20
|
+
'<p>The <code>ButtonGroup</code> component is used to visually group two or more buttons on a single horizontal line. This helps indicate related actions and maintain consistent UI alignment.</p>' +
|
|
21
|
+
'<ul>' +
|
|
22
|
+
' <li>Use to group related actions that should be presented together</li>' +
|
|
23
|
+
' <li>Use for things like filter options, segmented controls, or inline actions</li>' +
|
|
24
|
+
' <li>Ensure all buttons in the group are accessible and clearly labeled</li>' +
|
|
25
|
+
' <li>Pass buttons through the <code>children</code> prop as an array or fragment</li>' +
|
|
26
|
+
' <li>Do not include unrelated controls like inputs or toggles in the same group</li>' +
|
|
27
|
+
'</ul>',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
figmaDesign,
|
|
31
|
+
},
|
|
32
|
+
tags: ['autodocs'],
|
|
33
|
+
argTypes: {
|
|
34
|
+
children: {
|
|
35
|
+
description: 'prop is used to pass buttons components.',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export default meta
|
|
41
|
+
type Story = StoryObj<typeof meta>
|
|
42
|
+
|
|
43
|
+
export const TwoButtons: Story = {
|
|
44
|
+
args: {
|
|
45
|
+
children: (
|
|
46
|
+
<>
|
|
47
|
+
<Button type="button" label="Button" className="button" />
|
|
48
|
+
<Button
|
|
49
|
+
icon="AngleDown"
|
|
50
|
+
type="button"
|
|
51
|
+
label="Button"
|
|
52
|
+
className="button"
|
|
53
|
+
/>
|
|
54
|
+
</>
|
|
55
|
+
),
|
|
56
|
+
},
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export const ThreeButtons: Story = {
|
|
60
|
+
args: {
|
|
61
|
+
children: (
|
|
62
|
+
<>
|
|
63
|
+
<Button
|
|
64
|
+
icon="AngleLeft"
|
|
65
|
+
type="button"
|
|
66
|
+
label="Button"
|
|
67
|
+
className="button"
|
|
68
|
+
/>
|
|
69
|
+
<Button type="button" label="Button" className="button" />
|
|
70
|
+
<Button
|
|
71
|
+
icon="AngleRight"
|
|
72
|
+
type="button"
|
|
73
|
+
label="Button"
|
|
74
|
+
className="button"
|
|
75
|
+
/>
|
|
76
|
+
</>
|
|
77
|
+
),
|
|
78
|
+
},
|
|
79
|
+
}
|
|
@@ -3,6 +3,13 @@ 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
|
+
|
|
6
13
|
const meta = {
|
|
7
14
|
title: 'Design System/Atoms/InputWithButton',
|
|
8
15
|
component: InputWithButton,
|
|
@@ -23,6 +30,7 @@ const meta = {
|
|
|
23
30
|
'</ul>',
|
|
24
31
|
},
|
|
25
32
|
},
|
|
33
|
+
figmaDesign,
|
|
26
34
|
},
|
|
27
35
|
tags: ['autodocs'],
|
|
28
36
|
argTypes: {
|