agroptima-design-system 0.2.2 → 0.3.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.2.2",
3
+ "version": "0.3.0",
4
4
  "scripts": {
5
5
  "dev": "npm run storybook",
6
6
  "storybook": "storybook dev -p 6006 --ci",
@@ -0,0 +1,36 @@
1
+ @use '../settings/color_alias';
2
+ @use '../settings/typography';
3
+ @use '../settings/config';
4
+ @use '../settings/depth';
5
+
6
+ .empty-state {
7
+ display: flex;
8
+ flex-direction: column;
9
+ align-items: center;
10
+ width: 100%;
11
+
12
+ > p {
13
+ margin-top: config.$space-2x;
14
+ }
15
+
16
+ &:not(:has(> .button)) {
17
+ > p {
18
+ margin-top: 0;
19
+ }
20
+ }
21
+
22
+ &.primary {
23
+ > .icon {
24
+ width: 4.25rem;
25
+ height: 4.25rem;
26
+ > svg {
27
+ width: 100%;
28
+ height: 100%;
29
+ }
30
+ }
31
+
32
+ > p {
33
+ @include typography.empty-state-text;
34
+ }
35
+ }
36
+ }
@@ -0,0 +1,35 @@
1
+ import { Button } from './Button'
2
+ import './EmptyState.scss'
3
+ import { Icon, IconType } from './Icon'
4
+
5
+ export type Variant = 'primary'
6
+
7
+ interface callToAction {
8
+ (event: React.MouseEvent<HTMLButtonElement, MouseEvent>): any
9
+ }
10
+
11
+ export interface EmptyStateProps extends React.ComponentPropsWithoutRef<'div'> {
12
+ icon?: IconType
13
+ text?: string
14
+ variant?: Variant
15
+ buttonLabel?: string
16
+ action?: callToAction
17
+ }
18
+
19
+ export function EmptyState({
20
+ icon = 'EmptyState',
21
+ text = 'No data',
22
+ variant = 'primary',
23
+ buttonLabel,
24
+ action,
25
+ }: EmptyStateProps): React.JSX.Element {
26
+ const cssClasses = ['empty-state', variant].join(' ')
27
+
28
+ return (
29
+ <div className={cssClasses}>
30
+ <Icon name={icon} />
31
+ <p>{text}</p>
32
+ {buttonLabel && action && <Button label={buttonLabel} onClick={action} />}
33
+ </div>
34
+ )
35
+ }
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 69 68"><g clip-path="url(#empty-customize__a)"><path d="M68.5 30.468 53.503 11.646a3.858 3.858 0 0 0-1.293-1.06 3.6 3.6 0 0 0-1.586-.386H18.376c-1.106 0-2.158.545-2.879 1.446L.5 30.468V40.8h68V30.468Z" fill="url(#empty-customize__b)"/><path d="M65.1 39.549 51.599 24.89a3.439 3.439 0 0 0-1.18-.81 3.656 3.656 0 0 0-1.434-.28h-28.97c-.994 0-1.966.385-2.614 1.09L3.9 39.55v8.05h61.2v-8.051Z" fill="url(#empty-customize__c)"/><path d="M68.498 50.22c0 1.277-.601 2.424-1.55 3.193l-.194.15a4.458 4.458 0 0 1-2.616.837H4.862a4.48 4.48 0 0 1-1.521-.263l-.235-.09a4.342 4.342 0 0 1-1.897-1.545A4.055 4.055 0 0 1 .5 50.219V30.6h16.498c1.822 0 3.29 1.431 3.29 3.168v.022c0 1.738 1.486 3.14 3.308 3.14h21.806c.876 0 1.716-.333 2.336-.924.62-.59.97-1.392.972-2.228 0-1.744 1.47-3.178 3.29-3.178h16.5l-.002 19.62Z" fill="url(#empty-customize__d)"/></g><defs><linearGradient id="empty-customize__b" x1="34.5" y1="10.2" x2="34.5" y2="23.955" gradientUnits="userSpaceOnUse"><stop stop-color="#5F0F40"/><stop offset="1" stop-color="#90446D"/></linearGradient><linearGradient id="empty-customize__c" x1="42.667" y1="47.6" x2="42.667" y2="22.535" gradientUnits="userSpaceOnUse"><stop stop-color="#FCF0F6"/><stop offset="1" stop-color="#EDB8D1"/></linearGradient><linearGradient id="empty-customize__d" x1="34.5" y1="30.6" x2="34.5" y2="54.4" gradientUnits="userSpaceOnUse"><stop stop-color="#BF6C97"/><stop offset="1" stop-color="#EDB8D1"/></linearGradient><clipPath id="empty-customize__a"><path fill="#fff" transform="translate(.5)" d="M0 0h68v68H0z"/></clipPath></defs></svg>
@@ -9,6 +9,7 @@ import CheckboxInactive from './checkbox-inactive.svg'
9
9
  import Close from './close.svg'
10
10
  import Done from './done.svg'
11
11
  import EditColumns from './edit-columns.svg'
12
+ import EmptyState from './empty-customize.svg'
12
13
  import Error from './error.svg'
13
14
  import Export from './export.svg'
14
15
  import Info from './info.svg'
@@ -31,6 +32,7 @@ export {
31
32
  Close,
32
33
  Done,
33
34
  EditColumns,
35
+ EmptyState,
34
36
  Error,
35
37
  Export,
36
38
  Info,
@@ -104,3 +104,13 @@ $font-primary: $font-base-stretch $text-base-style $font-base-weight #{$text-bas
104
104
  font-size: 1rem;
105
105
  line-height: 1.5rem; /* 150% */
106
106
  }
107
+
108
+ @mixin empty-state-text {
109
+ font-style: $text-base-style;
110
+ font-variant: $text-base-style;
111
+ font-weight: 400;
112
+ font-family: $font-base-family;
113
+ color: color_alias.$neutral-color-1000;
114
+ font-size: 1rem;
115
+ text-align: center;
116
+ }
@@ -3,6 +3,10 @@ import { Meta } from "@storybook/addon-docs";
3
3
  <Meta title="Changelog" />
4
4
  # Changelog
5
5
 
6
+ ## 0.3.0
7
+
8
+ - Empty State component is added to Storybook.
9
+
6
10
  ## 0.2.2
7
11
 
8
12
  - Select and Multiselect options dropdown have a higher z-index.
@@ -0,0 +1,52 @@
1
+ import { EmptyState } from '../atoms/EmptyState'
2
+ import { StoryObj } from '@storybook/react'
3
+
4
+ const meta = {
5
+ title: 'Design System/Atoms/EmptyState',
6
+ component: EmptyState,
7
+ tags: ['autodocs'],
8
+ argTypes: {
9
+ icon: {
10
+ description: 'A default icon is set for the empty state.',
11
+ },
12
+ text: {
13
+ description: 'Label used to describe the empty state.',
14
+ },
15
+ variant: {
16
+ description: 'Variant used.',
17
+ },
18
+ buttonLabel: {
19
+ description: 'Label used on the button.',
20
+ },
21
+ action: {
22
+ description: 'Action called when button is pressed.',
23
+ },
24
+ },
25
+ }
26
+
27
+ const figmaPrimaryDesign = {
28
+ design: {
29
+ type: 'figma',
30
+ url: 'https://www.figma.com/file/DN2ova21vWqCRvPspBXgI1/Design-System?type=design&node-id=1719-258&mode=dev',
31
+ },
32
+ }
33
+
34
+ export default meta
35
+ type Story = StoryObj<typeof meta>
36
+
37
+ export const PrimaryCustom: Story = {
38
+ args: {
39
+ variant: 'primary',
40
+ text: 'There are no videogames yet. You can import videogames to your list.',
41
+ buttonLabel: 'Import videogames',
42
+ action: (event) => console.log('click: ', event),
43
+ },
44
+ parameters: figmaPrimaryDesign,
45
+ }
46
+
47
+ export const PrimaryBasic: Story = {
48
+ args: {
49
+ variant: 'primary',
50
+ },
51
+ parameters: figmaPrimaryDesign,
52
+ }
@@ -5,7 +5,7 @@ import * as Icons from '../icons'
5
5
 
6
6
  # Icons
7
7
 
8
- 📁 You can find the source icons on this [link]( https://drive.google.com/drive/folders/16L5iR5KnDP9kfeCF-mDU0C0LiJZi0cwi).
8
+ 📁 You can find the source icons on this [link](https://groupeisagri.sharepoint.com/sites/Maya_Espana/Drive%20Agroptima/Forms/AllItems.aspx?id=%2Fsites%2FMaya%5FEspana%2FDrive%20Agroptima%2F06%20%2D%20DESIGN%2F01%2E%20Bodegas%2FDesign%20system%2FRecursos%2Ficons&viewid=c0618b1a%2Dc398%2D461b%2D85e6%2Df088fc5fee72).
9
9
 
10
10
  â„šī¸ If you need to edit the svgo default options, check this [link](https://stackoverflow.com/a/70360615).
11
11