agroptima-design-system 0.9.1 → 0.9.3
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/Alert.scss +69 -73
- package/src/atoms/Alert.tsx +17 -15
- package/src/settings/_depth.scss +1 -2
- package/src/stories/Changelog.stories.mdx +8 -0
package/package.json
CHANGED
package/src/atoms/Alert.scss
CHANGED
|
@@ -3,46 +3,52 @@
|
|
|
3
3
|
@use '../settings/config';
|
|
4
4
|
@use '../settings/depth';
|
|
5
5
|
|
|
6
|
-
.alert
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
.alert {
|
|
7
|
+
display: flex;
|
|
8
|
+
justify-content: space-between;
|
|
9
|
+
padding: config.$space-2x config.$space-3x;
|
|
10
|
+
align-items: center;
|
|
11
|
+
gap: config.$space-2x;
|
|
12
|
+
border-radius: config.$corner-radius-xxs;
|
|
10
13
|
|
|
11
|
-
|
|
12
|
-
display: flex;
|
|
13
|
-
justify-content: space-between;
|
|
14
|
+
&.fit-content {
|
|
14
15
|
width: fit-content;
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.information-container {
|
|
19
|
+
display: flex;
|
|
20
|
+
justify-content: flex-start;
|
|
17
21
|
align-items: center;
|
|
18
22
|
gap: config.$space-2x;
|
|
19
|
-
|
|
23
|
+
}
|
|
20
24
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
align-items: center;
|
|
25
|
-
gap: config.$space-2x;
|
|
26
|
-
}
|
|
25
|
+
.text {
|
|
26
|
+
@include typography.body-regular-primary;
|
|
27
|
+
}
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
.icon {
|
|
30
|
+
width: config.$icon-size-5x;
|
|
31
|
+
height: config.$icon-size-5x;
|
|
32
|
+
> svg {
|
|
33
|
+
width: 100%;
|
|
34
|
+
height: 100%;
|
|
30
35
|
}
|
|
36
|
+
}
|
|
31
37
|
|
|
38
|
+
.icon-button {
|
|
32
39
|
.icon {
|
|
33
|
-
width: config.$icon-size-
|
|
34
|
-
height: config.$icon-size-
|
|
40
|
+
width: config.$icon-size-2x;
|
|
41
|
+
height: config.$icon-size-2x;
|
|
42
|
+
|
|
35
43
|
> svg {
|
|
36
|
-
|
|
37
|
-
|
|
44
|
+
fill: color_alias.$neutral-color-400;
|
|
45
|
+
path {
|
|
46
|
+
fill: color_alias.$neutral-color-400;
|
|
47
|
+
}
|
|
38
48
|
}
|
|
39
49
|
}
|
|
40
|
-
|
|
41
|
-
.icon-button {
|
|
50
|
+
&:hover {
|
|
42
51
|
.icon {
|
|
43
|
-
width: config.$icon-size-2x;
|
|
44
|
-
height: config.$icon-size-2x;
|
|
45
|
-
|
|
46
52
|
> svg {
|
|
47
53
|
fill: color_alias.$neutral-color-400;
|
|
48
54
|
path {
|
|
@@ -50,73 +56,63 @@
|
|
|
50
56
|
}
|
|
51
57
|
}
|
|
52
58
|
}
|
|
53
|
-
&:hover {
|
|
54
|
-
.icon {
|
|
55
|
-
> svg {
|
|
56
|
-
fill: color_alias.$neutral-color-400;
|
|
57
|
-
path {
|
|
58
|
-
fill: color_alias.$neutral-color-400;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
59
|
}
|
|
60
|
+
}
|
|
64
61
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
62
|
+
&.info {
|
|
63
|
+
border: 1px solid color_alias.$info-color-600;
|
|
64
|
+
background: color_alias.$info-color-50;
|
|
65
|
+
.information-container {
|
|
66
|
+
.icon {
|
|
67
|
+
> svg {
|
|
68
|
+
fill: color_alias.$info-color-1000;
|
|
69
|
+
path {
|
|
71
70
|
fill: color_alias.$info-color-1000;
|
|
72
|
-
path {
|
|
73
|
-
fill: color_alias.$info-color-1000;
|
|
74
|
-
}
|
|
75
71
|
}
|
|
76
72
|
}
|
|
77
73
|
}
|
|
78
74
|
}
|
|
75
|
+
}
|
|
79
76
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
77
|
+
&.success {
|
|
78
|
+
border: 1px solid color_alias.$success-color-300;
|
|
79
|
+
background: color_alias.$success-color-50;
|
|
80
|
+
.information-container {
|
|
81
|
+
.icon {
|
|
82
|
+
> svg {
|
|
83
|
+
fill: color_alias.$success-color-1000;
|
|
84
|
+
path {
|
|
86
85
|
fill: color_alias.$success-color-1000;
|
|
87
|
-
path {
|
|
88
|
-
fill: color_alias.$success-color-1000;
|
|
89
|
-
}
|
|
90
86
|
}
|
|
91
87
|
}
|
|
92
88
|
}
|
|
93
89
|
}
|
|
90
|
+
}
|
|
94
91
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
92
|
+
&.warning {
|
|
93
|
+
border: 1px solid color_alias.$warning-color-300;
|
|
94
|
+
background: color_alias.$warning-color-50;
|
|
95
|
+
.information-container {
|
|
96
|
+
.icon {
|
|
97
|
+
> svg {
|
|
98
|
+
fill: color_alias.$warning-color-1000;
|
|
99
|
+
path {
|
|
101
100
|
fill: color_alias.$warning-color-1000;
|
|
102
|
-
path {
|
|
103
|
-
fill: color_alias.$warning-color-1000;
|
|
104
|
-
}
|
|
105
101
|
}
|
|
106
102
|
}
|
|
107
103
|
}
|
|
108
104
|
}
|
|
105
|
+
}
|
|
109
106
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
107
|
+
&.error {
|
|
108
|
+
border: 1px solid color_alias.$error-color-600;
|
|
109
|
+
background: color_alias.$error-color-50;
|
|
110
|
+
.information-container {
|
|
111
|
+
.icon {
|
|
112
|
+
> svg {
|
|
113
|
+
fill: color_alias.$error-color-1000;
|
|
114
|
+
path {
|
|
116
115
|
fill: color_alias.$error-color-1000;
|
|
117
|
-
path {
|
|
118
|
-
fill: color_alias.$error-color-1000;
|
|
119
|
-
}
|
|
120
116
|
}
|
|
121
117
|
}
|
|
122
118
|
}
|
package/src/atoms/Alert.tsx
CHANGED
|
@@ -9,6 +9,7 @@ export interface AlertProps extends React.ComponentPropsWithoutRef<'div'> {
|
|
|
9
9
|
variant?: Variant
|
|
10
10
|
text: string
|
|
11
11
|
button?: IconButtonProps
|
|
12
|
+
fitContent?: boolean
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
export enum IconVariant {
|
|
@@ -21,28 +22,29 @@ export enum IconVariant {
|
|
|
21
22
|
export function Alert({
|
|
22
23
|
id,
|
|
23
24
|
variant = 'success',
|
|
25
|
+
className = '',
|
|
26
|
+
fitContent = false,
|
|
24
27
|
text,
|
|
25
28
|
button,
|
|
26
29
|
...props
|
|
27
30
|
}: AlertProps): React.JSX.Element {
|
|
28
|
-
const
|
|
31
|
+
const fitContentClass = fitContent ? 'fit-content' : ''
|
|
32
|
+
const cssClasses = ['alert', variant, className, fitContentClass].join(' ')
|
|
29
33
|
|
|
30
34
|
return (
|
|
31
|
-
<div
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
>
|
|
38
|
-
<
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
</span>
|
|
43
|
-
</div>
|
|
44
|
-
{button && <IconButton {...button} variant="primary" />}
|
|
35
|
+
<div
|
|
36
|
+
role="alert"
|
|
37
|
+
aria-labelledby={`${id}-text`}
|
|
38
|
+
className={cssClasses}
|
|
39
|
+
{...props}
|
|
40
|
+
>
|
|
41
|
+
<div className="information-container">
|
|
42
|
+
<Icon name={IconVariant[variant]} className={variant} />
|
|
43
|
+
<span id={`${id}-text`} className="text">
|
|
44
|
+
{text}
|
|
45
|
+
</span>
|
|
45
46
|
</div>
|
|
47
|
+
{button && <IconButton {...button} variant="primary" />}
|
|
46
48
|
</div>
|
|
47
49
|
)
|
|
48
50
|
}
|
package/src/settings/_depth.scss
CHANGED
|
@@ -3,6 +3,14 @@ import { Meta } from "@storybook/addon-docs";
|
|
|
3
3
|
<Meta title="Changelog" />
|
|
4
4
|
# Changelog
|
|
5
5
|
|
|
6
|
+
## 0.9.3
|
|
7
|
+
|
|
8
|
+
- Fix alert component width.
|
|
9
|
+
|
|
10
|
+
## 0.9.2
|
|
11
|
+
|
|
12
|
+
- Alert component can be rendered with fit-content width or 100% depending on the container.
|
|
13
|
+
|
|
6
14
|
## 0.9.1
|
|
7
15
|
|
|
8
16
|
- Modal and Alert components position fixed has been added.
|