agroptima-design-system 0.24.1 → 0.24.2

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.24.1",
3
+ "version": "0.24.2",
4
4
  "scripts": {
5
5
  "dev": "npm run storybook",
6
6
  "storybook": "storybook dev -p 6006 --ci",
@@ -11,7 +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
+ margin: 0 config.$space-4x;
15
15
 
16
16
  &.fit-content {
17
17
  width: fit-content;
@@ -32,7 +32,7 @@ export function IconButton({
32
32
  {...props}
33
33
  className={classNames(props.className, 'icon-button', variant)}
34
34
  >
35
- <Icon name={icon} />
35
+ <Icon title={accessibilityLabel} name={icon} />
36
36
  </BaseButton>
37
37
  )
38
38
  }
@@ -16,14 +16,14 @@
16
16
 
17
17
  .header {
18
18
  display: flex;
19
- align-items: center;
19
+ align-items: center !important;
20
20
  gap: config.$space-3x;
21
21
  padding: config.$space-5x;
22
22
  cursor: default;
23
23
 
24
24
  .icon {
25
- width: config.$icon-size-4x;
26
- height: config.$icon-size-4x;
25
+ width: config.$icon-size-4x !important;
26
+ height: config.$icon-size-4x !important;
27
27
  > svg {
28
28
  width: 100%;
29
29
  height: 100%;
@@ -31,12 +31,15 @@
31
31
  }
32
32
 
33
33
  .title {
34
+ font-size: 1rem !important;
35
+ font-weight: normal !important;
34
36
  flex: 1;
35
37
  }
36
38
  }
37
39
 
38
40
  .content {
39
41
  padding: config.$space-7x;
42
+ padding-bottom: config.$space-3x;
40
43
  }
41
44
 
42
45
  &.primary {
@@ -8,6 +8,10 @@
8
8
  flex-direction: column;
9
9
  margin-bottom: config.$space-3x;
10
10
 
11
+ &.alignment-right {
12
+ text-align: right;
13
+ }
14
+
11
15
  .title {
12
16
  @include typography.body-bold;
13
17
  color: color_alias.$neutral-color-1000;
@@ -3,9 +3,15 @@ import './DetailItem.scss'
3
3
 
4
4
  export type Variant = 'primary'
5
5
 
6
+ export enum Alignment {
7
+ Left = 'left',
8
+ Right = 'right',
9
+ }
10
+
6
11
  export interface DetailItemProps extends React.ComponentPropsWithoutRef<'div'> {
7
12
  variant?: Variant
8
13
  title: string
14
+ align?: Alignment
9
15
  }
10
16
 
11
17
  export function DetailItem({
@@ -13,11 +19,20 @@ export function DetailItem({
13
19
  className,
14
20
  variant = 'primary',
15
21
  title,
22
+ align = Alignment.Left,
16
23
  children,
17
24
  ...props
18
25
  }: DetailItemProps): React.JSX.Element {
19
26
  return (
20
- <div className={classNames('detail-item', variant, className)} {...props}>
27
+ <div
28
+ className={classNames(
29
+ 'detail-item',
30
+ variant,
31
+ `alignment-${align}`,
32
+ className,
33
+ )}
34
+ {...props}
35
+ >
21
36
  <div className="title">{title}</div>
22
37
  <div className="information">{children}</div>
23
38
  </div>
@@ -7,6 +7,7 @@ export type IconType = keyof typeof icons
7
7
  export interface IconProps extends React.SVGAttributes<HTMLOrSVGElement> {
8
8
  name: IconType
9
9
  className?: string
10
+ title?: string
10
11
  }
11
12
 
12
13
  export const Icon: React.FC<IconProps> = ({ name, className, ...props }) => {
@@ -14,7 +15,7 @@ export const Icon: React.FC<IconProps> = ({ name, className, ...props }) => {
14
15
  rotate: name === 'Loading',
15
16
  })
16
17
  return (
17
- <span role="img" title={name} className={cssClasses}>
18
+ <span role="img" title={props.title || name} className={cssClasses}>
18
19
  {icons[name](props)}
19
20
  </span>
20
21
  )
@@ -2,6 +2,7 @@
2
2
  @use '../settings/typography/content' as typography;
3
3
  @use '../settings/config';
4
4
  @use '../settings/depth';
5
+ @use '../settings/breakpoints';
5
6
 
6
7
  .modal-container {
7
8
  position: fixed;
@@ -65,6 +66,7 @@
65
66
 
66
67
  .body {
67
68
  @include typography.body-regular-primary;
69
+ width: 100%;
68
70
  }
69
71
 
70
72
  .footer {
@@ -74,6 +76,14 @@
74
76
  margin-top: config.$space-2x;
75
77
  }
76
78
 
79
+ &.details {
80
+ max-width: 50rem;
81
+ min-height: 400px;
82
+ max-height: 90vh;
83
+ overflow-y: auto;
84
+ overflow-anchor: none;
85
+ }
86
+
77
87
  &.info {
78
88
  .header {
79
89
  .icon {
@@ -138,5 +148,13 @@
138
148
  }
139
149
  }
140
150
  }
151
+
152
+ // Media queries
153
+ // Mobile & tablet cases
154
+ @media only screen and (max-width: breakpoints.$large) {
155
+ &.details {
156
+ top: 3rem;
157
+ }
158
+ }
141
159
  }
142
160
  }
@@ -24,6 +24,7 @@ import Error from './error.svg'
24
24
  import Export from './export.svg'
25
25
  import Import from './import.svg'
26
26
  import Info from './info.svg'
27
+ import Invoice from './invoice.svg'
27
28
  import Loading from './loading.svg'
28
29
  import Logout from './logout.svg'
29
30
  import Minus from './minus.svg'
@@ -67,6 +68,7 @@ export {
67
68
  Export,
68
69
  Import,
69
70
  Info,
71
+ Invoice,
70
72
  Loading,
71
73
  Logout,
72
74
  Minus,
@@ -0,0 +1 @@
1
+ <svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.71 1.538h7.483a.259.259 0 0 1 .259.257v16.41a.255.255 0 0 1-.259.257H3.806a.259.259 0 0 1-.258-.257V6.667h3.355c.48 0 .939-.19 1.278-.526a1.79 1.79 0 0 0 .529-1.27V1.539Zm-1.549.576L4.127 5.127h2.776a.259.259 0 0 0 .258-.256V2.114ZM6.57.526C6.95.149 7.522 0 7.935 0h8.258c.48 0 .94.19 1.278.526.339.336.529.793.529 1.269v16.41c0 .476-.19.933-.53 1.27a1.813 1.813 0 0 1-1.276.525H3.806c-.479 0-.938-.19-1.277-.526A1.789 1.789 0 0 1 2 18.205V5.897c0-.41.15-.98.53-1.357M6.57.526 2.53 4.54Zm3.688 3.32c0-.425.347-.77.774-.77h3.097c.428 0 .774.345.774.77 0 .425-.346.77-.774.77h-3.097a.772.772 0 0 1-.774-.77Zm0 3.077c0-.425.347-.77.774-.77h3.097c.428 0 .774.345.774.77 0 .425-.346.77-.774.77h-3.097a.772.772 0 0 1-.774-.77ZM5.097 10c0-.425.346-.77.774-.77h8.258c.428 0 .774.345.774.77v6.154c0 .425-.346.77-.774.77H5.871a.772.772 0 0 1-.774-.77V10Zm1.548 3.846v1.539h2.58v-1.539h-2.58Zm2.58-1.538h-2.58v-1.539h2.58v1.539Zm1.55 1.538v1.539h2.58v-1.539h-2.58Zm2.58-1.538h-2.58v-1.539h2.58v1.539Z" fill="#161C26"/></svg>
@@ -4,6 +4,17 @@ import { Meta } from "@storybook/blocks";
4
4
 
5
5
  # Changelog
6
6
 
7
+ # 0.24.2
8
+
9
+ * Fix margin in Alert component.
10
+ * Ensure 100% width on Modal content.
11
+ * On Modal component, add height and scroll.
12
+ * Add Invoice icon.
13
+ * On Collapsible title element, ensure font styles when used in Modal component.
14
+ * DetailItem component now accepts `align` property with `left` or `right` values.
15
+ * Modal maximum width & mobile version properties have been updated.
16
+ * IconButton has updated title value with `accessibilityLabel`.
17
+
7
18
  # 0.24.1
8
19
 
9
20
  * PDF icon
@@ -2,6 +2,7 @@ import React from 'react'
2
2
 
3
3
  import { Modal } from '../atoms/Modal'
4
4
  import { DetailItem } from '@/atoms/DetailItem'
5
+ import { Collapsible } from '@/atoms/Collapsible'
5
6
 
6
7
  const figmaPrimaryDesign = {
7
8
  design: {
@@ -151,7 +152,13 @@ export const Details = {
151
152
  <DetailItem title="Publisher">
152
153
  <a href="#">Squaresoft</a>
153
154
  </DetailItem>
154
- <DetailItem title="Price">59,95 €</DetailItem>
155
+ <Collapsible open title="Special Features">
156
+ <p>RPG genre</p>
157
+ <p>1 player</p>
158
+ </Collapsible>
159
+ <DetailItem style={{ marginTop: '10px' }} align="right" title="Price">
160
+ 59,95 €
161
+ </DetailItem>
155
162
  </Modal>
156
163
  ),
157
164
  }
@@ -79,8 +79,8 @@ describe('Pagination', () => {
79
79
  )
80
80
 
81
81
  expect(getByRole('navigation')).toHaveClass(`pagination`)
82
- expect(getByRole('img', { name: 'AngleLeft' })).toBeInTheDocument()
83
- expect(getByRole('img', { name: 'AngleRight' })).toBeInTheDocument()
82
+ expect(getByRole('img', { name: 'Previous page' })).toBeInTheDocument()
83
+ expect(getByRole('img', { name: 'Next page' })).toBeInTheDocument()
84
84
  expect(getByText('1')).toBeInTheDocument()
85
85
  expect(getByText('4')).toBeInTheDocument()
86
86
  expect(getByText('5')).toBeInTheDocument()