agroptima-design-system 0.28.4 → 0.28.5-beta.0

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.28.4",
3
+ "version": "0.28.5-beta.0",
4
4
  "scripts": {
5
5
  "dev": "npm run storybook",
6
6
  "storybook": "storybook dev -p 6006 --ci",
@@ -0,0 +1,88 @@
1
+ @use '../../settings/color_alias';
2
+ @use '../../settings/breakpoints';
3
+ @use '../../settings/depth';
4
+ @use '../../settings/config';
5
+
6
+ $modal-margin: config.$space-4x;
7
+ $modal-width: 34.5rem;
8
+ $modal-background-color: color_alias.$neutral-white;
9
+ $modal-boder-color: color_alias.$neutral-color-200;
10
+ $backdrop-opacity: 0.4;
11
+ $backdrop-background-color: color_alias.$neutral-color-900;
12
+
13
+ .modal {
14
+ position: fixed;
15
+ top: 0;
16
+ left: 0;
17
+ z-index: depth.$z-modal;
18
+ width: 100%;
19
+ height: 100%;
20
+ overflow-x: hidden;
21
+ overflow-y: auto;
22
+ outline: 0;
23
+ }
24
+
25
+ .modal-dialog {
26
+ transition: transform 0.3s ease-out;
27
+ max-width: $modal-width;
28
+ position: relative;
29
+ width: auto;
30
+ margin-block: $modal-margin;
31
+ margin-inline: auto;
32
+ pointer-events: none;
33
+ }
34
+
35
+ .modal-content {
36
+ position: relative;
37
+ display: flex;
38
+ flex-direction: column;
39
+ width: 100%;
40
+ pointer-events: auto;
41
+ background-color: $modal-background-color;
42
+ background-clip: padding-box;
43
+ outline: 0;
44
+ border-radius: config.$corner-radius-xxs;
45
+ box-shadow:
46
+ 0px 3px 6px -4px rgba(0, 0, 0, 0.12),
47
+ 0px 6px 16px 0px rgba(0, 0, 0, 0.08),
48
+ 0px 9px 28px 8px rgba(0, 0, 0, 0.05);
49
+ }
50
+
51
+ .modal-header {
52
+ display: flex;
53
+ flex-shrink: 0;
54
+ align-items: center;
55
+ padding: 1rem 1rem;
56
+ border-bottom: 1px solid $modal-boder-color;
57
+ button {
58
+ margin-left: auto;
59
+ }
60
+ }
61
+
62
+ .modal-body {
63
+ position: relative;
64
+ flex: 1 1 auto;
65
+ padding: 1rem;
66
+ }
67
+
68
+ .modal-footer {
69
+ display: flex;
70
+ flex-shrink: 0;
71
+ flex-wrap: wrap;
72
+ align-items: center;
73
+ justify-content: flex-end;
74
+ padding: calc(1rem - 0.5rem * 0.5);
75
+ border-top: 1px solid $modal-boder-color;
76
+ }
77
+
78
+ .modal-backdrop {
79
+ opacity: $backdrop-opacity;
80
+ position: fixed;
81
+ top: 0;
82
+ left: 0;
83
+ z-index: depth.$z-modal;
84
+ width: 100vw;
85
+ height: 100vh;
86
+ background-color: $backdrop-background-color;
87
+ transition: opacity 0.15s linear;
88
+ }
@@ -0,0 +1,99 @@
1
+ import { Button, IconButton } from '../Button'
2
+ import { Select } from '../Select'
3
+
4
+ export function Dialog() {
5
+ return (
6
+ <>
7
+ <div className="modal-backdrop"></div>
8
+ <div className="modal modal-open">
9
+ <div className="modal-dialog">
10
+ <div className="modal-content">
11
+ <div className="modal-header">
12
+ <h1>Modal title</h1>
13
+ <IconButton accessibilityLabel="close" icon="Close" />
14
+ </div>
15
+ <div className="modal-body">
16
+ <p>
17
+ This is some placeholder content to show the scrolling behavior
18
+ for modals. Instead of repeating the text in the modal, we use
19
+ an inline style to set a minimum height, thereby extending the
20
+ length of the overall modal and demonstrating the overflow
21
+ scrolling. When content becomes longer than the height of the
22
+ viewport, scrolling will move the modal as needed.
23
+ </p>
24
+ <p>
25
+ This is some placeholder content to show the scrolling behavior
26
+ for modals. Instead of repeating the text in the modal, we use
27
+ an inline style to set a minimum height, thereby extending the
28
+ length of the overall modal and demonstrating the overflow
29
+ scrolling. When content becomes longer than the height of the
30
+ viewport, scrolling will move the modal as needed.
31
+ </p>
32
+ <p>
33
+ This is some placeholder content to show the scrolling behavior
34
+ for modals. Instead of repeating the text in the modal, we use
35
+ an inline style to set a minimum height, thereby extending the
36
+ length of the overall modal and demonstrating the overflow
37
+ scrolling. When content becomes longer than the height of the
38
+ viewport, scrolling will move the modal as needed.
39
+ </p>
40
+ <p>
41
+ This is some placeholder content to show the scrolling behavior
42
+ for modals. Instead of repeating the text in the modal, we use
43
+ an inline style to set a minimum height, thereby extending the
44
+ length of the overall modal and demonstrating the overflow
45
+ scrolling. When content becomes longer than the height of the
46
+ viewport, scrolling will move the modal as needed.
47
+ </p>
48
+ <p>
49
+ This is some placeholder content to show the scrolling behavior
50
+ for modals. Instead of repeating the text in the modal, we use
51
+ an inline style to set a minimum height, thereby extending the
52
+ length of the overall modal and demonstrating the overflow
53
+ scrolling. When content becomes longer than the height of the
54
+ viewport, scrolling will move the modal as needed.
55
+ </p>
56
+ <p>
57
+ This is some placeholder content to show the scrolling behavior
58
+ for modals. Instead of repeating the text in the modal, we use
59
+ an inline style to set a minimum height, thereby extending the
60
+ length of the overall modal and demonstrating the overflow
61
+ scrolling. When content becomes longer than the height of the
62
+ viewport, scrolling will move the modal as needed.
63
+ </p>
64
+ <div>
65
+ <Select
66
+ id="select"
67
+ label="Select"
68
+ helpText="This is a help text"
69
+ placeholder="Select an option"
70
+ options={[
71
+ { id: '1', label: 'Option 1' },
72
+ { id: '2', label: 'Option 2' },
73
+ { id: '3', label: 'Option 3' },
74
+ { id: '4', label: 'Option 4' },
75
+ { id: '5', label: 'Option 5' },
76
+ { id: '6', label: 'Option 6' },
77
+ { id: '7', label: 'Option 7' },
78
+ { id: '8', label: 'Option 8' },
79
+ { id: '9', label: 'Option 9' },
80
+ { id: '10', label: 'Option 10' },
81
+ { id: '11', label: 'Option 11' },
82
+ { id: '12', label: 'Option 12' },
83
+ { id: '13', label: 'Option 13' },
84
+ { id: '14', label: 'Option 14' },
85
+ { id: '15', label: 'Option 15' },
86
+ ]}
87
+ />
88
+ </div>
89
+ </div>
90
+ <div className="modal-footer">
91
+ <Button label="Close" variant="neutral-ghost" />
92
+ <Button label="Save" />
93
+ </div>
94
+ </div>
95
+ </div>
96
+ </div>
97
+ </>
98
+ )
99
+ }
@@ -1,11 +1,11 @@
1
- import './Actions.scss'
1
+ import './Form.scss'
2
2
  import { classNames } from '../../utils/classNames'
3
3
 
4
4
  export interface ActionsProps extends React.ComponentPropsWithoutRef<'div'> {
5
5
  children: React.ReactNode
6
6
  }
7
7
 
8
- export function Actions({ className, children }: ActionsProps) {
8
+ export default function Actions({ className, children }: ActionsProps) {
9
9
  return (
10
10
  <div className={classNames('footer-actions', className)}>{children}</div>
11
11
  )
@@ -4,6 +4,26 @@
4
4
 
5
5
  $gap: config.$space-4x;
6
6
 
7
+ .form {
8
+ display: flex;
9
+ flex-direction: column;
10
+ margin: 0 auto;
11
+ gap: $gap;
12
+ padding: 0;
13
+
14
+ width: breakpoints.$medium;
15
+ max-width: breakpoints.$medium;
16
+
17
+ &.full-width {
18
+ width: 100%;
19
+ max-width: 100%;
20
+ }
21
+
22
+ &:has(.footer-actions) {
23
+ padding-bottom: 6.25rem;
24
+ }
25
+ }
26
+
7
27
  .footer-actions {
8
28
  display: flex;
9
29
  justify-content: flex-end;
@@ -19,6 +39,13 @@ $gap: config.$space-4x;
19
39
  }
20
40
 
21
41
  @media only screen and (max-width: breakpoints.$large) {
42
+ .form {
43
+ max-width: 100%;
44
+ width: 100%;
45
+ &:has(.footer-actions) {
46
+ padding-bottom: 9rem;
47
+ }
48
+ }
22
49
  .footer-actions {
23
50
  background-color: color_alias.$neutral-white;
24
51
  border-top: 1px solid color_alias.$neutral-color-200;
@@ -1,14 +1,25 @@
1
- import { FormContainer } from './FormContainer'
1
+ import './Form.scss'
2
+ import { classNames } from '../../utils/classNames'
2
3
 
3
4
  export interface FormProps extends React.ComponentPropsWithoutRef<'form'> {
4
- fluid?: boolean
5
+ fullWidth?: boolean
5
6
  children: React.ReactNode
6
7
  }
7
8
 
8
- export function Form({ fluid, children, ...props }: FormProps) {
9
+ export default function Form({
10
+ className,
11
+ fullWidth,
12
+ children,
13
+ ...props
14
+ }: FormProps) {
9
15
  return (
10
- <form {...props}>
11
- <FormContainer fluid={fluid}>{children}</FormContainer>
16
+ <form
17
+ className={classNames(className, 'form', {
18
+ 'full-width': fullWidth,
19
+ })}
20
+ {...props}
21
+ >
22
+ {children}
12
23
  </form>
13
24
  )
14
25
  }
@@ -1,5 +1,4 @@
1
- import { Actions } from './Actions'
2
- import { Form } from './Form'
3
- import { FormContainer } from './FormContainer'
1
+ import Actions from './Actions'
2
+ import Form from './Form'
4
3
 
5
- export { Actions, Form, FormContainer }
4
+ export { Actions, Form }
@@ -1,6 +1,19 @@
1
1
  @use '../settings/color_alias';
2
2
  @use '../settings/config';
3
- @use '../settings/mixins';
3
+
4
+ @mixin color($color) {
5
+ svg {
6
+ fill: $color;
7
+ path {
8
+ fill: $color;
9
+ }
10
+ }
11
+ }
12
+
13
+ @mixin size($size) {
14
+ width: $size;
15
+ height: $size;
16
+ }
4
17
 
5
18
  .icon {
6
19
  display: inline-flex;
@@ -13,41 +26,41 @@
13
26
  }
14
27
 
15
28
  &.size-1 {
16
- @include mixins.size(config.$icon-size-1x);
29
+ @include size(config.$icon-size-1x);
17
30
  }
18
31
  &.size-2 {
19
- @include mixins.size(config.$icon-size-2x);
32
+ @include size(config.$icon-size-2x);
20
33
  }
21
34
  &.size-3 {
22
- @include mixins.size(config.$icon-size-3x);
35
+ @include size(config.$icon-size-3x);
23
36
  }
24
37
  &.size-4 {
25
- @include mixins.size(config.$icon-size-4x);
38
+ @include size(config.$icon-size-4x);
26
39
  }
27
40
  &.size-5 {
28
- @include mixins.size(config.$icon-size-5x);
41
+ @include size(config.$icon-size-5x);
29
42
  }
30
43
  &.size-6 {
31
- @include mixins.size(config.$icon-size-6x);
44
+ @include size(config.$icon-size-6x);
32
45
  }
33
46
  &.size-7 {
34
- @include mixins.size(config.$icon-size-7x);
47
+ @include size(config.$icon-size-7x);
35
48
  }
36
49
  &.size-8 {
37
- @include mixins.size(config.$icon-size-8x);
50
+ @include size(config.$icon-size-8x);
38
51
  }
39
52
 
40
53
  &.info {
41
- @include mixins.svg-color(color_alias.$info-color-1000);
54
+ @include color(color_alias.$info-color-1000);
42
55
  }
43
56
  &.success {
44
- @include mixins.svg-color(color_alias.$success-color-1000);
57
+ @include color(color_alias.$success-color-1000);
45
58
  }
46
59
  &.warning {
47
- @include mixins.svg-color(color_alias.$warning-color-1000);
60
+ @include color(color_alias.$warning-color-1000);
48
61
  }
49
62
  &.error {
50
- @include mixins.svg-color(color_alias.$error-color-1000);
63
+ @include color(color_alias.$error-color-1000);
51
64
  }
52
65
 
53
66
  @keyframes rotate {
@@ -5,9 +5,8 @@
5
5
  @use '../../settings/depth';
6
6
  @use '../../settings/config';
7
7
 
8
- $modal-margin: 3rem;
8
+ $modal-margin: config.$space-4x;
9
9
  $modal-width: 34.5rem;
10
- $modal-detail-width: 50rem;
11
10
  $modal-background-color: color_alias.$neutral-white;
12
11
  $modal-boder-color: color_alias.$neutral-color-200;
13
12
  $backdrop-opacity: 0.4;
@@ -32,7 +31,6 @@ $backdrop-background-color: color_alias.$neutral-color-900;
32
31
  width: auto;
33
32
  margin-block: $modal-margin;
34
33
  margin-inline: auto;
35
- padding-inline: config.$space-4x;
36
34
  pointer-events: none;
37
35
  }
38
36
 
@@ -97,10 +95,6 @@ $backdrop-background-color: color_alias.$neutral-color-900;
97
95
  }
98
96
 
99
97
  .modal-details {
100
- .modal-dialog {
101
- max-width: 50rem;
102
- }
103
-
104
98
  .modal-header {
105
99
  border-bottom: 1px solid $modal-boder-color;
106
100
  padding-bottom: config.$space-3x;
@@ -128,11 +122,6 @@ $backdrop-background-color: color_alias.$neutral-color-900;
128
122
  }
129
123
  }
130
124
 
131
- .modal-icon {
132
- margin-top: config.$space-1x;
133
- align-self: flex-start;
134
- }
135
-
136
125
  body:has(.modal-backdrop) {
137
126
  overflow: hidden;
138
127
  padding-right: 0px;
@@ -33,21 +33,21 @@ export interface ModalProps {
33
33
  }
34
34
 
35
35
  const ICONS: { [key: string]: ReactNode } = {
36
- info: <Icon className="modal-icon" name="Info" variant="info" />,
37
- success: <Icon className="modal-icon" name="Check" variant="success" />,
38
- warning: <Icon className="modal-icon" name="Warning" variant="warning" />,
39
- error: <Icon className="modal-icon" name="Error" variant="error" />,
40
- discard: <Icon className="modal-icon" name="Warning" variant="warning" />,
36
+ info: <Icon name="Check" size="5" variant="info" />,
37
+ success: <Icon name="Check" size="5" variant="success" />,
38
+ warning: <Icon name="Warning" size="5" variant="warning" />,
39
+ error: <Icon name="Error" size="5" variant="error" />,
40
+ discard: <Icon name="Warning" size="5" variant="warning" />,
41
41
  }
42
42
 
43
43
  export function Modal({
44
44
  id,
45
+ variant = 'details',
45
46
  title,
46
47
  buttons,
48
+ closeButton = false,
47
49
  onClose,
48
50
  children,
49
- closeButton = false,
50
- variant = 'details',
51
51
  ...props
52
52
  }: ModalProps) {
53
53
  return (
@@ -15,7 +15,6 @@ export function ModalDialog({
15
15
  children,
16
16
  details = false,
17
17
  scrollable = false,
18
- ...props
19
18
  }: ModalDialogProps) {
20
19
  const handleClick = (event: React.MouseEvent) => {
21
20
  if (event.target !== event.currentTarget) return
@@ -42,7 +41,6 @@ export function ModalDialog({
42
41
  role="dialog"
43
42
  className={classNames('modal', className, { 'modal-details': details })}
44
43
  onClick={handleClick}
45
- {...props}
46
44
  >
47
45
  <div
48
46
  className={classNames('modal-dialog', {
@@ -1,5 +1,5 @@
1
- import './Modal.scss'
2
1
  import { classNames } from '../../utils/classNames'
2
+ import './Modal.scss'
3
3
 
4
4
  export interface ModalHeaderProps
5
5
  extends React.HTMLAttributes<HTMLDivElement> {}
@@ -1,4 +1,4 @@
1
- export type { ModalProps, Variant } from './Modal'
1
+ export type { ModalProps } from './Modal'
2
2
  import { Modal } from './Modal'
3
3
  export type { ModalBodyProps } from './ModalBody'
4
4
  import { ModalBody } from './ModalBody'
@@ -6,17 +6,3 @@
6
6
  }
7
7
  }
8
8
  }
9
-
10
- @mixin svg-color($color) {
11
- svg {
12
- fill: $color;
13
- path {
14
- fill: $color;
15
- }
16
- }
17
- }
18
-
19
- @mixin size($size) {
20
- width: $size;
21
- height: $size;
22
- }
@@ -4,15 +4,6 @@ import { Meta } from "@storybook/blocks";
4
4
 
5
5
  # Changelog
6
6
 
7
- ## 0.28.4
8
-
9
- * Update Modal component to adapt to the content height.
10
- * Add a scrollable body property to the Modal component.
11
- * Add onClose property to Modal component to close it when the background is clicked.
12
- * Add closeButton property to Modal component to show or hide the close button.
13
- * Create component FormContainer for reuse.
14
- * Rename FormContainer component `fullWidth` property to `fluid`.
15
-
16
7
  ## 0.28.3
17
8
 
18
9
  * Add tertiary variant to IconButton component
@@ -3,7 +3,6 @@ import { Button } from '../atoms/Button'
3
3
  import { Card } from '../atoms/Card'
4
4
  import { Collapsible } from '../atoms/Collapsible'
5
5
  import { Actions, Form as FormComponent } from '../atoms/Form'
6
- import { FormContainer } from '../atoms/Form'
7
6
  import { Input } from '../atoms/Input'
8
7
  import { Select } from '../atoms/Select'
9
8
 
@@ -40,7 +39,14 @@ export default meta
40
39
  export const Primary = {
41
40
  render: () => (
42
41
  <Collapsible title="My personal data" name="personal-data">
43
- <FormContainer fluid>
42
+ <div
43
+ style={{
44
+ display: 'flex',
45
+ flexDirection: 'column',
46
+ width: '100%',
47
+ gap: '1rem',
48
+ }}
49
+ >
44
50
  <Input
45
51
  accessibilityLabel="Fill the form name"
46
52
  helpText="This text can help you"
@@ -85,7 +91,7 @@ export const Primary = {
85
91
  placeholder="Select your favourite gaming system..."
86
92
  variant="primary"
87
93
  />
88
- </FormContainer>
94
+ </div>
89
95
  </Collapsible>
90
96
  ),
91
97
  }
@@ -94,7 +100,14 @@ export const PrimaryOpened = {
94
100
  render: () => (
95
101
  <>
96
102
  <Collapsible title="My personal data" name="personal-data" open>
97
- <FormContainer fluid>
103
+ <div
104
+ style={{
105
+ display: 'flex',
106
+ flexDirection: 'column',
107
+ width: '100%',
108
+ gap: '1rem',
109
+ }}
110
+ >
98
111
  <Input
99
112
  accessibilityLabel="Fill the form name"
100
113
  helpText="This text can help you"
@@ -139,7 +152,7 @@ export const PrimaryOpened = {
139
152
  placeholder="Select your favourite gaming system..."
140
153
  variant="primary"
141
154
  />
142
- </FormContainer>
155
+ </div>
143
156
  </Collapsible>
144
157
  <Collapsible title="Another data" name="another-data">
145
158
  <Input label="Another data" name="anotherData" placeholder="..." />
@@ -160,67 +173,65 @@ export const PrimaryOpened = {
160
173
  export const PrimaryDisabled = {
161
174
  render: () => (
162
175
  <Collapsible title="My personal data" name="personal-data" disabled>
163
- <FormContainer fluid>
164
- <Input
165
- accessibilityLabel="Fill the form name"
166
- helpText="This text can help you"
167
- id="name_input"
168
- label="Name"
169
- name="name"
170
- placeholder="name..."
171
- type="name"
172
- variant="primary"
173
- />
174
- <Input
175
- accessibilityLabel="Fill the form email"
176
- helpText="This text can help you"
177
- id="email_input"
178
- label="Email"
179
- name="email"
180
- placeholder="Email..."
181
- type="email"
182
- variant="primary"
183
- />
184
- <Select
185
- accessibilityLabel="Select your favourite gaming system options"
186
- helpText="This text can help you"
187
- id="select-videogames"
188
- label="Videogames"
189
- name="example"
190
- onChange={() => {}}
191
- options={[
192
- {
193
- id: '1',
194
- label: 'Nintendo Switch',
195
- },
196
- {
197
- id: '2',
198
- label: 'PlayStation 5',
199
- },
200
- {
201
- id: '3',
202
- label: 'Xbox Series S/X',
203
- },
204
- ]}
205
- placeholder="Select your favourite gaming system..."
206
- variant="primary"
207
- />
208
- </FormContainer>
176
+ <Input
177
+ accessibilityLabel="Fill the form name"
178
+ helpText="This text can help you"
179
+ id="name_input"
180
+ label="Name"
181
+ name="name"
182
+ placeholder="name..."
183
+ type="name"
184
+ variant="primary"
185
+ />
186
+ <Input
187
+ accessibilityLabel="Fill the form email"
188
+ helpText="This text can help you"
189
+ id="email_input"
190
+ label="Email"
191
+ name="email"
192
+ placeholder="Email..."
193
+ type="email"
194
+ variant="primary"
195
+ />
196
+ <Select
197
+ accessibilityLabel="Select your favourite gaming system options"
198
+ helpText="This text can help you"
199
+ id="select-videogames"
200
+ label="Videogames"
201
+ name="example"
202
+ onChange={() => {}}
203
+ options={[
204
+ {
205
+ id: '1',
206
+ label: 'Nintendo Switch',
207
+ },
208
+ {
209
+ id: '2',
210
+ label: 'PlayStation 5',
211
+ },
212
+ {
213
+ id: '3',
214
+ label: 'Xbox Series S/X',
215
+ },
216
+ ]}
217
+ placeholder="Select your favourite gaming system..."
218
+ variant="primary"
219
+ />
209
220
  </Collapsible>
210
221
  ),
211
222
  }
212
223
 
213
224
  export const Form = {
214
225
  render: () => (
215
- <Collapsible open form title="User">
216
- <FormComponent>
226
+ <FormComponent>
227
+ <Collapsible open form title="User">
217
228
  <Input label="First Name" placeholder="First Name" name="firstName" />
218
229
  <Input label="Last Name" placeholder="Last Name" name="lastName" />
219
230
  <Actions>
220
231
  <Button type="button" label="Cancel" variant="primary-outlined" />
221
232
  <Button type="submit" label="Sign in" variant="primary" />
222
233
  </Actions>
223
- </FormComponent>
224
- </Collapsible>
234
+ </Collapsible>
235
+ </FormComponent>
225
236
  ),
226
237
  }
@@ -1,8 +1,8 @@
1
1
  import React from 'react'
2
2
  import { Button, IconButton } from '../atoms/Button'
3
3
  import { Card } from '../atoms/Card'
4
+ import { Collapsible } from '../atoms/Collapsible'
4
5
  import { DetailItem } from '../atoms/DetailItem'
5
- import { FormContainer } from '../atoms/Form'
6
6
  import { Input } from '../atoms/Input'
7
7
  import {
8
8
  ModalBody,
@@ -232,7 +232,7 @@ export const ScrollableModal = () => (
232
232
  </Modal>
233
233
  )
234
234
 
235
- const OpenAndCloseModalComponent = () => {
235
+ export const OpenAndCloseModal = () => {
236
236
  const [isOpen, setIsOpen] = React.useState(false)
237
237
  const closeModal = () => setIsOpen(false)
238
238
  return (
@@ -257,12 +257,6 @@ const OpenAndCloseModalComponent = () => {
257
257
  )
258
258
  }
259
259
 
260
- export const OpenAndCloseModal = {
261
- render: () => {
262
- return <OpenAndCloseModalComponent />
263
- },
264
- }
265
-
266
260
  export const FormModal = () => (
267
261
  <form
268
262
  onSubmit={(e) => {
@@ -285,32 +279,30 @@ export const FormModal = () => (
285
279
  { label: 'Save', type: 'submit' },
286
280
  ]}
287
281
  >
288
- <FormContainer fluid>
289
- <Input name="input" label="Input" placeholder="Type something" />
290
- <Select
291
- label="Select"
292
- name="select"
293
- helpText="This is a help text"
294
- placeholder="Select an option"
295
- options={[
296
- { id: '1', label: 'Option 1' },
297
- { id: '2', label: 'Option 2' },
298
- { id: '3', label: 'Option 3' },
299
- { id: '4', label: 'Option 4' },
300
- { id: '5', label: 'Option 5' },
301
- { id: '6', label: 'Option 6' },
302
- { id: '7', label: 'Option 7' },
303
- { id: '8', label: 'Option 8' },
304
- { id: '9', label: 'Option 9' },
305
- { id: '10', label: 'Option 10' },
306
- { id: '11', label: 'Option 11' },
307
- { id: '12', label: 'Option 12' },
308
- { id: '13', label: 'Option 13' },
309
- { id: '14', label: 'Option 14' },
310
- { id: '15', label: 'Option 15' },
311
- ]}
312
- />
313
- </FormContainer>
282
+ <Input name="input" label="Input" placeholder="Type something" />
283
+ <Select
284
+ label="Select"
285
+ name="select"
286
+ helpText="This is a help text"
287
+ placeholder="Select an option"
288
+ options={[
289
+ { id: '1', label: 'Option 1' },
290
+ { id: '2', label: 'Option 2' },
291
+ { id: '3', label: 'Option 3' },
292
+ { id: '4', label: 'Option 4' },
293
+ { id: '5', label: 'Option 5' },
294
+ { id: '6', label: 'Option 6' },
295
+ { id: '7', label: 'Option 7' },
296
+ { id: '8', label: 'Option 8' },
297
+ { id: '9', label: 'Option 9' },
298
+ { id: '10', label: 'Option 10' },
299
+ { id: '11', label: 'Option 11' },
300
+ { id: '12', label: 'Option 12' },
301
+ { id: '13', label: 'Option 13' },
302
+ { id: '14', label: 'Option 14' },
303
+ { id: '15', label: 'Option 15' },
304
+ ]}
305
+ />
314
306
  </Modal>
315
307
  </form>
316
308
  )
@@ -1,6 +1,6 @@
1
1
  import { render, screen } from '@testing-library/react'
2
2
  import React from 'react'
3
- import { Modal, type Variant } from '../src/atoms/Modal'
3
+ import { Modal } from '../src/atoms/Modal/Modal'
4
4
 
5
5
  describe('Modal', () => {
6
6
  const variants = ['info', 'success', 'warning', 'error']
@@ -11,7 +11,6 @@ describe('Modal', () => {
11
11
  const content = `${variant} modal content`
12
12
  const { getByRole, getByText } = render(
13
13
  <Modal
14
- variant={variant as Variant}
15
14
  id={`${variant}-modal`}
16
15
  title={title}
17
16
  buttons={[
@@ -23,7 +22,7 @@ describe('Modal', () => {
23
22
  {content}
24
23
  </Modal>,
25
24
  )
26
- expect(getByRole('img')).toHaveClass(variant)
25
+ expect(getByRole('img')).toHaveClass('info')
27
26
  expect(getByText(title)).toBeInTheDocument()
28
27
  expect(getByText(content)).toBeInTheDocument()
29
28
  expect(getByRole('button')).toHaveTextContent('Done')
@@ -53,7 +52,7 @@ describe('Modal', () => {
53
52
  {content}
54
53
  </Modal>,
55
54
  )
56
- expect(getByRole('img')).toHaveClass('warning')
55
+ expect(getByRole('img')).toHaveClass('discard')
57
56
  expect(getByText(title)).toBeInTheDocument()
58
57
  expect(getByText(content)).toBeInTheDocument()
59
58
  expect(screen.getAllByRole('button')[0]).toHaveTextContent('Cancel')
@@ -1,35 +0,0 @@
1
- @use '../../settings/config';
2
- @use '../../settings/breakpoints';
3
- @use '../../settings/color_alias';
4
-
5
- $gap: config.$space-4x;
6
-
7
- .form-container {
8
- display: flex;
9
- flex-direction: column;
10
- margin: 0 auto;
11
- gap: $gap;
12
- padding: 0;
13
-
14
- width: breakpoints.$medium;
15
- max-width: breakpoints.$medium;
16
-
17
- &.fluid {
18
- width: 100%;
19
- max-width: 100%;
20
- }
21
-
22
- &:has(.footer-actions) {
23
- padding-bottom: 6.25rem;
24
- }
25
- }
26
-
27
- @media only screen and (max-width: breakpoints.$large) {
28
- .form-container {
29
- max-width: 100%;
30
- width: 100%;
31
- &:has(.footer-actions) {
32
- padding-bottom: 9rem;
33
- }
34
- }
35
- }
@@ -1,25 +0,0 @@
1
- import './FormContainer.scss'
2
- import { classNames } from '../../utils/classNames'
3
-
4
- export interface FormContainerProps
5
- extends React.ComponentPropsWithoutRef<'div'> {
6
- fluid?: boolean
7
- }
8
-
9
- export function FormContainer({
10
- fluid,
11
- className,
12
- children,
13
- ...props
14
- }: FormContainerProps) {
15
- return (
16
- <div
17
- className={classNames(className, 'form-container', {
18
- fluid,
19
- })}
20
- {...props}
21
- >
22
- {children}
23
- </div>
24
- )
25
- }