agroptima-design-system 0.27.24 → 0.27.26

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agroptima-design-system",
3
- "version": "0.27.24",
3
+ "version": "0.27.26",
4
4
  "scripts": {
5
5
  "dev": "npm run storybook",
6
6
  "storybook": "storybook dev -p 6006 --ci",
@@ -39,12 +39,11 @@
39
39
  no-repeat;
40
40
  }
41
41
  &:hover {
42
- .checkbox:not(:checked):not(.disabled) {
42
+ .checkbox:not(:checked):not(:disabled) {
43
43
  background: url('../icons/checkbox-primary-hover-inactive.svg') left top
44
44
  no-repeat;
45
45
  }
46
46
  }
47
-
48
47
  &.indeterminate {
49
48
  .checkbox:checked {
50
49
  background: url('../icons/checkbox-indeterminate-active.svg') left top
@@ -4,6 +4,15 @@
4
4
  @use '../settings/depth';
5
5
  @use '../settings/breakpoints';
6
6
 
7
+ @mixin icon-color($color) {
8
+ .icon > svg {
9
+ fill: $color;
10
+ path {
11
+ fill: $color;
12
+ }
13
+ }
14
+ }
15
+
7
16
  .modal-container {
8
17
  position: fixed;
9
18
  inset: 0;
@@ -37,46 +46,39 @@
37
46
  0px 6px 16px 0px rgba(0, 0, 0, 0.08),
38
47
  0px 9px 28px 8px rgba(0, 0, 0, 0.05);
39
48
 
40
- .scroll-area {
41
- width: 100%;
49
+ .header {
50
+ display: flex;
51
+ gap: config.$space-2x;
52
+ align-items: flex-start;
42
53
  padding-left: config.$space-halfx;
43
54
  padding-right: config.$space-halfx;
44
- overflow-y: auto;
45
- overflow-anchor: none;
46
-
47
- .header {
48
- display: flex;
49
- gap: config.$space-2x;
50
- align-items: flex-start;
51
- padding-bottom: config.$space-2x;
52
-
53
- .icon {
54
- margin-top: 4px;
55
- min-width: config.$icon-size-5x;
56
- width: config.$icon-size-5x;
57
- height: config.$icon-size-5x;
58
- > svg {
59
- width: 100%;
60
- height: 100%;
61
- }
55
+ .icon {
56
+ margin-top: 4px;
57
+ min-width: config.$icon-size-5x;
58
+ width: config.$icon-size-5x;
59
+ height: config.$icon-size-5x;
60
+
61
+ > svg {
62
+ width: 100%;
63
+ height: 100%;
62
64
  }
63
-
64
65
  .title {
65
66
  @include typography.h4;
66
67
  }
67
68
  }
69
+ }
68
70
 
69
- .divider {
70
- width: 100%;
71
- height: 1px;
72
- background: color_alias.$neutral-color-200;
73
- margin-bottom: config.$space-2x;
74
- }
71
+ .divider {
72
+ width: 100%;
73
+ border-top: 1px solid color_alias.$neutral-color-200;
74
+ margin-bottom: config.$space-2x;
75
+ }
75
76
 
76
- .body {
77
- @include typography.body-regular-primary;
78
- width: 100%;
79
- }
77
+ .body {
78
+ @include typography.body-regular-primary;
79
+ width: 100%;
80
+ padding-left: config.$space-halfx;
81
+ padding-right: config.$space-halfx;
80
82
  }
81
83
 
82
84
  &.details {
@@ -84,75 +86,39 @@
84
86
  height: 100%;
85
87
  }
86
88
 
89
+ &.scrollable {
90
+ overflow-y: auto;
91
+ overflow-anchor: none;
92
+ }
93
+
87
94
  .footer {
88
95
  display: flex;
89
96
  align-self: flex-end;
90
97
  gap: config.$space-3x;
91
- margin-top: config.$space-2x;
92
98
  }
93
99
 
94
100
  &.info {
95
101
  .header {
96
- .icon {
97
- > svg {
98
- fill: color_alias.$info-color-1000;
99
- path {
100
- fill: color_alias.$info-color-1000;
101
- }
102
- }
103
- }
102
+ @include icon-color(color_alias.$info-color-1000);
104
103
  }
105
104
  }
106
105
 
107
106
  &.success {
108
107
  .header {
109
- .icon {
110
- > svg {
111
- fill: color_alias.$success-color-1000;
112
- path {
113
- fill: color_alias.$success-color-1000;
114
- }
115
- }
116
- }
117
- }
118
- }
119
-
120
- &.warning {
121
- .header {
122
- .icon {
123
- > svg {
124
- fill: color_alias.$warning-color-1000;
125
- path {
126
- fill: color_alias.$warning-color-1000;
127
- }
128
- }
129
- }
108
+ @include icon-color(color_alias.$success-color-1000);
130
109
  }
131
110
  }
132
111
 
112
+ &.warning,
133
113
  &.discard {
134
114
  .header {
135
- .icon {
136
- > svg {
137
- fill: color_alias.$warning-color-1000;
138
- path {
139
- fill: color_alias.$warning-color-1000;
140
- }
141
- }
142
- }
115
+ @include icon-color(color_alias.$warning-color-1000);
143
116
  }
144
117
  }
145
118
 
146
119
  &.error {
147
120
  .header {
148
- .icon {
149
- > svg {
150
- fill: color_alias.$error-color-1000;
151
- path {
152
- fill: color_alias.$error-color-1000;
153
- }
154
- }
155
- }
121
+ @include icon-color(color_alias.$error-color-1000);
156
122
  }
157
123
  }
158
124
  }
@@ -25,6 +25,7 @@ export interface ModalProps extends React.ComponentPropsWithoutRef<'div'> {
25
25
  variant?: Variant
26
26
  title: string
27
27
  buttons: ButtonProps[]
28
+ scrollable?: boolean
28
29
  }
29
30
 
30
31
  export function Modal({
@@ -34,9 +35,10 @@ export function Modal({
34
35
  title,
35
36
  buttons,
36
37
  children,
38
+ scrollable = false,
37
39
  ...props
38
40
  }: ModalProps): React.JSX.Element {
39
- const cssClasses = classNames('modal', variant, className)
41
+ const cssClasses = classNames('modal', variant, className, { scrollable })
40
42
 
41
43
  return (
42
44
  <div className="modal-container">
@@ -48,19 +50,17 @@ export function Modal({
48
50
  className={cssClasses}
49
51
  {...props}
50
52
  >
51
- <div className="scroll-area">
52
- <div className="header">
53
- {variant !== 'details' && (
54
- <Icon name={IconVariant[variant]} className={variant} />
55
- )}
56
- <h4 id={`${id}-title`} className="title">
57
- {title}
58
- </h4>
59
- </div>
60
- {variant === 'details' && <div className="divider" />}
61
- <div id={`${id}-body`} className="body">
62
- {children}
63
- </div>
53
+ <div className="header">
54
+ {variant !== 'details' && (
55
+ <Icon name={IconVariant[variant]} className={variant} />
56
+ )}
57
+ <h4 id={`${id}-title`} className="title">
58
+ {title}
59
+ </h4>
60
+ </div>
61
+ {variant === 'details' && <div className="divider" />}
62
+ <div id={`${id}-body`} className="body">
63
+ {children}
64
64
  </div>
65
65
  <div className="footer">
66
66
  {buttons.map(({ ...button }) => (
@@ -4,6 +4,14 @@ import { Meta } from "@storybook/blocks";
4
4
 
5
5
  # Changelog
6
6
 
7
+ ## 0.27.26
8
+
9
+ * Make scrolling in Modal component optional
10
+
11
+ ## 0.27.25
12
+
13
+ * Fix hover style when Checkbox component is disabled
14
+
7
15
  ## 0.27.24
8
16
 
9
17
  * Hide Safari non-desired details summary default icon on Collapsible component.
@@ -68,3 +68,14 @@ export const Indeterminate: Story = {
68
68
  },
69
69
  parameters: figmaPrimaryDesign,
70
70
  }
71
+
72
+ export const Disabled: Story = {
73
+ args: {
74
+ accessibilityLabel: 'Marks if the user likes videogames',
75
+ variant: 'primary',
76
+ disabled: true,
77
+ label: 'Do you like videogames?',
78
+ id: 'checkbox-videogames-preference',
79
+ },
80
+ parameters: figmaPrimaryDesign,
81
+ }
@@ -2,7 +2,9 @@ import React from 'react'
2
2
  import { Card } from '../atoms/Card'
3
3
  import { Collapsible } from '../atoms/Collapsible'
4
4
  import { DetailItem } from '../atoms/DetailItem'
5
+ import { Input } from '../atoms/Input'
5
6
  import { Modal } from '../atoms/Modal'
7
+ import { Select } from '../atoms/Select'
6
8
 
7
9
  const figmaPrimaryDesign = {
8
10
  design: {
@@ -140,6 +142,7 @@ export const Details = {
140
142
  id="details-dangerous-alone"
141
143
  variant="details"
142
144
  title="Game details"
145
+ scrollable
143
146
  buttons={[
144
147
  {
145
148
  label: 'Done',
@@ -173,3 +176,45 @@ export const Details = {
173
176
  </Modal>
174
177
  ),
175
178
  }
179
+
180
+ export const Form = {
181
+ render: () => (
182
+ <Modal
183
+ id="form"
184
+ variant="info"
185
+ title="Form Modal"
186
+ buttons={[
187
+ {
188
+ label: 'Save',
189
+ },
190
+ ]}
191
+ >
192
+ <Input label="Input" helpText="This text can help you" name="input" />
193
+ <Select
194
+ label="Select"
195
+ onChange={() => {}}
196
+ placeholder="Select a platform"
197
+ options={[
198
+ { id: '1', label: 'Nintendo Switch' },
199
+ { id: '2', label: 'PlayStation 5' },
200
+ { id: '3', label: 'Xbox Series S/X' },
201
+ { id: '4', label: 'PC' },
202
+ { id: '5', label: 'Mobile' },
203
+ { id: '6', label: 'PlayStation 4' },
204
+ { id: '7', label: 'Xbox One' },
205
+ { id: '8', label: 'PlayStation 3' },
206
+ { id: '9', label: 'Xbox 360' },
207
+ { id: '10', label: 'PlayStation 2' },
208
+ { id: '11', label: 'Xbox' },
209
+ { id: '12', label: 'PlayStation' },
210
+ { id: '13', label: 'Nintendo 64' },
211
+ { id: '14', label: 'Super Nintendo' },
212
+ { id: '15', label: 'Sega Genesis' },
213
+ { id: '16', label: 'Sega Saturn' },
214
+ { id: '17', label: 'Sega Dreamcast' },
215
+ { id: '18', label: 'Atari 2600' },
216
+ ]}
217
+ />
218
+ </Modal>
219
+ ),
220
+ }