agroptima-design-system 0.22.6 → 0.23.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.22.6",
3
+ "version": "0.23.0",
4
4
  "scripts": {
5
5
  "dev": "npm run storybook",
6
6
  "storybook": "storybook dev -p 6006 --ci",
@@ -11,6 +11,7 @@
11
11
  align-items: flex-start;
12
12
  border-radius: config.$corner-radius-xxs;
13
13
  pointer-events: none;
14
+ margin: config.$space-4x;
14
15
 
15
16
  &.fit-content {
16
17
  width: fit-content;
@@ -169,7 +169,6 @@
169
169
 
170
170
  th.actions {
171
171
  justify-content: center;
172
- flex: 1;
173
172
  }
174
173
 
175
174
  td.actions {
@@ -243,12 +242,17 @@
243
242
  .alignment-right {
244
243
  justify-content: flex-start;
245
244
  }
245
+
246
246
  .badge {
247
247
  position: absolute;
248
- inset: auto config.$space-3x config.$space-3x auto;
248
+ inset: auto auto config.$space-2x config.$space-2x;
249
249
  }
250
- tr:has(.badge) {
250
+ // Specify Badge vertical position depending on having a right aligned item or not
251
+ tr:not(.alignment-right) {
251
252
  padding-bottom: config.$space-10x;
252
253
  }
254
+ tr:has(.alignment-right) {
255
+ padding-bottom: config.$space-2x;
256
+ }
253
257
  }
254
258
  }
@@ -0,0 +1,20 @@
1
+ @use '../settings/color_alias';
2
+ @use '../settings/typography/content' as typography;
3
+ @use '../settings/config';
4
+ @use '../settings/depth';
5
+
6
+ .detail-item {
7
+ display: flex;
8
+ flex-direction: column;
9
+ margin-bottom: config.$space-3x;
10
+
11
+ .title {
12
+ @include typography.body-bold;
13
+ color: color_alias.$neutral-color-1000;
14
+ }
15
+
16
+ .information {
17
+ @include typography.body-regular-primary;
18
+ color: color_alias.$neutral-color-1000;
19
+ }
20
+ }
@@ -0,0 +1,25 @@
1
+ import { classNames } from '../utils/classNames'
2
+ import './DetailItem.scss'
3
+
4
+ export type Variant = 'primary'
5
+
6
+ export interface DetailItemProps extends React.ComponentPropsWithoutRef<'div'> {
7
+ variant?: Variant
8
+ title: string
9
+ }
10
+
11
+ export function DetailItem({
12
+ id,
13
+ className,
14
+ variant = 'primary',
15
+ title,
16
+ children,
17
+ ...props
18
+ }: DetailItemProps): React.JSX.Element {
19
+ return (
20
+ <div className={classNames('detail-item', variant, className)} {...props}>
21
+ <div className="title">{title}</div>
22
+ <div className="information">{children}</div>
23
+ </div>
24
+ )
25
+ }
@@ -56,6 +56,13 @@
56
56
  }
57
57
  }
58
58
 
59
+ .divider {
60
+ width: 100%;
61
+ height: 1px;
62
+ background: color_alias.$neutral-color-200;
63
+ margin-bottom: config.$space-2x;
64
+ }
65
+
59
66
  .body {
60
67
  @include typography.body-regular-primary;
61
68
  }
@@ -3,7 +3,13 @@ import { Button, ButtonProps } from './Button'
3
3
  import { Icon } from './Icon'
4
4
  import './Modal.scss'
5
5
 
6
- export type Variant = 'info' | 'success' | 'warning' | 'error' | 'discard'
6
+ export type Variant =
7
+ | 'info'
8
+ | 'success'
9
+ | 'warning'
10
+ | 'error'
11
+ | 'discard'
12
+ | 'details'
7
13
 
8
14
  export enum IconVariant {
9
15
  info = 'Info',
@@ -42,11 +48,14 @@ export function Modal({
42
48
  {...props}
43
49
  >
44
50
  <div className="header">
45
- <Icon name={IconVariant[variant]} className={variant} />
51
+ {variant !== 'details' && (
52
+ <Icon name={IconVariant[variant]} className={variant} />
53
+ )}
46
54
  <h4 id={`${id}-title`} className="title">
47
55
  {title}
48
56
  </h4>
49
57
  </div>
58
+ {variant === 'details' && <div className="divider" />}
50
59
  <div id={`${id}-body`} className="body">
51
60
  {children}
52
61
  </div>
@@ -50,7 +50,7 @@ export const Primary = {
50
50
  <CardsTableBody>
51
51
  <CardsTableRow>
52
52
  <CardsTableCell titleWithActions={3}>
53
- <span>Metal Gear Solid 5: The Phantom Pain</span>
53
+ <span>Zone of the Enders: The 2nd Runner</span>
54
54
  <Badge
55
55
  accessibilityLabel="Game is bought"
56
56
  text="Bought"
@@ -62,7 +62,7 @@ export const Primary = {
62
62
  Tokyo, 104-0061 Japan
63
63
  </CardsTableCell>
64
64
  <CardsTableCell>konami@fakemail.com</CardsTableCell>
65
- <CardsTableCell>No price never</CardsTableCell>
65
+ <CardsTableCell>Not available</CardsTableCell>
66
66
  <CardsTableCell actions>
67
67
  <IconButton
68
68
  icon="Edit"
@@ -4,6 +4,13 @@ import { Meta } from "@storybook/blocks";
4
4
 
5
5
  # Changelog
6
6
 
7
+ # 0.23.0
8
+
9
+ * Add Details variant to Modal component.
10
+ * Add DetailItem component.
11
+ * On CardsTable component, align Badge correctly on mobile and fix Actions misalignment.
12
+ * On Alert component, add margin.
13
+
7
14
  # 0.22.6
8
15
 
9
16
  * Add property to IconButton component for set the visibility.
@@ -1,6 +1,7 @@
1
1
  import React from 'react'
2
2
 
3
3
  import { Modal } from '../atoms/Modal'
4
+ import { DetailItem } from '@/atoms/DetailItem'
4
5
 
5
6
  const figmaPrimaryDesign = {
6
7
  design: {
@@ -131,3 +132,26 @@ export const DeleteOrDiscard = {
131
132
  </Modal>
132
133
  ),
133
134
  }
135
+
136
+ export const Details = {
137
+ render: () => (
138
+ <Modal
139
+ id="details-dangerous-alone"
140
+ variant="details"
141
+ title="Game details"
142
+ buttons={[
143
+ {
144
+ label: 'Done',
145
+ onClick: () => alert('click'),
146
+ },
147
+ ]}
148
+ >
149
+ <DetailItem title="Title">Final Fantasy VIII</DetailItem>
150
+ <DetailItem title="Release date">11/02/1999</DetailItem>
151
+ <DetailItem title="Publisher">
152
+ <a href="#">Squaresoft</a>
153
+ </DetailItem>
154
+ <DetailItem title="Price">59,95 €</DetailItem>
155
+ </Modal>
156
+ ),
157
+ }