agroptima-design-system 0.27.5 → 0.27.7

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.5",
3
+ "version": "0.27.7",
4
4
  "scripts": {
5
5
  "dev": "npm run storybook",
6
6
  "storybook": "storybook dev -p 6006 --ci",
@@ -1,7 +1,7 @@
1
- @use '../settings/color_alias';
2
- @use '../settings/typography/content' as typography;
3
- @use '../settings/config';
4
- @use '../settings/depth';
1
+ @use '../../settings/color_alias';
2
+ @use '../../settings/typography/content' as typography;
3
+ @use '../../settings/config';
4
+ @use '../../settings/depth';
5
5
 
6
6
  .alert {
7
7
  display: flex;
@@ -66,6 +66,10 @@
66
66
  }
67
67
  }
68
68
 
69
+ &.fade-out {
70
+ animation: fadeOut 3s ease-out forwards;
71
+ }
72
+
69
73
  &.info {
70
74
  border: 1px solid color_alias.$info-color-600;
71
75
  background: color_alias.$info-color-50;
@@ -125,4 +129,17 @@
125
129
  }
126
130
  }
127
131
  }
132
+
133
+ @keyframes fadeOut {
134
+ 0% {
135
+ opacity: 1;
136
+ }
137
+ 75% {
138
+ opacity: 1;
139
+ }
140
+ 100% {
141
+ opacity: 0;
142
+ display: none;
143
+ }
144
+ }
128
145
  }
@@ -1,8 +1,8 @@
1
- import type { IconButtonProps } from './Button'
2
- import { IconButton } from './Button'
3
- import { Icon } from './Icon'
1
+ import type { IconButtonProps } from '../Button'
2
+ import { IconButton } from '../Button'
3
+ import { Icon } from '../Icon'
4
4
  import './Alert.scss'
5
- import { classNames } from '../utils/classNames'
5
+ import { classNames } from '../../utils/classNames'
6
6
 
7
7
  export type Variant = 'info' | 'success' | 'warning' | 'error'
8
8
 
@@ -11,6 +11,7 @@ export interface AlertProps extends React.ComponentPropsWithoutRef<'div'> {
11
11
  variant?: Variant
12
12
  text: string
13
13
  button?: IconButtonProps
14
+ fadeOut?: boolean
14
15
  fitContent?: boolean
15
16
  }
16
17
 
@@ -26,12 +27,14 @@ export function Alert({
26
27
  variant = 'success',
27
28
  className,
28
29
  fitContent = false,
30
+ fadeOut = false,
29
31
  text,
30
32
  button,
31
33
  ...props
32
34
  }: AlertProps): React.JSX.Element {
33
35
  const cssClasses = classNames('alert', variant, className, {
34
36
  'fit-content': fitContent,
37
+ 'fade-out': fadeOut,
35
38
  })
36
39
 
37
40
  return (
@@ -0,0 +1,15 @@
1
+ @use '../../settings/depth';
2
+ @use '../../settings/config';
3
+
4
+ .alert-container {
5
+ display: flex;
6
+ flex-direction: column;
7
+ gap: config.$space-2x;
8
+ pointer-events: none;
9
+ position: fixed;
10
+ top: 73px;
11
+ left: 0;
12
+ width: 100%;
13
+ z-index: depth.$z-alert-container;
14
+ align-items: center;
15
+ }
@@ -0,0 +1,11 @@
1
+ import { classNames } from '../../utils/classNames'
2
+ import './AlertContainer.scss'
3
+
4
+ export interface AlertContainerProps
5
+ extends React.ComponentPropsWithoutRef<'section'> {}
6
+
7
+ export function AlertContainer({ className, ...props }: AlertContainerProps) {
8
+ return (
9
+ <section className={classNames('alert-container', className)} {...props} />
10
+ )
11
+ }
@@ -0,0 +1,6 @@
1
+ import { Alert } from './Alert'
2
+ import { AlertContainer } from './AlertContainer'
3
+
4
+ export type { AlertProps } from './Alert'
5
+
6
+ export { Alert, AlertContainer }
@@ -4,7 +4,7 @@ import { Icon } from './Icon'
4
4
  import { IconButton } from './Button'
5
5
  import { classNames } from '../utils/classNames'
6
6
  import { buildHelpText } from '../utils/buildHelpText'
7
- import { useOutsideClick } from '@/utils/useOutsideClick'
7
+ import { useOutsideClick } from '../utils/useOutsideClick'
8
8
  import './Select.scss'
9
9
 
10
10
  export type Variant = 'primary'
@@ -6,6 +6,7 @@ $above: 1; // use this for all values above the base
6
6
  $below: -1; // and this for all values below the base
7
7
 
8
8
  $z-dropdown-options: $base + $above;
9
- $z-modal: $z-dropdown-options + $above;
9
+ $z-alert-container: $z-dropdown-options + $above;
10
+ $z-modal: $z-alert-container + $above;
10
11
  $z-aside-desktop: $base + $above;
11
12
  $z-aside-mobile: $z-modal + $above;
@@ -18,6 +18,10 @@ const meta = {
18
18
  button: {
19
19
  description: 'Add an IconButton component to have the close button.',
20
20
  },
21
+ fadeOut: {
22
+ description: 'Add fade out animation.',
23
+ control: 'boolean',
24
+ },
21
25
  },
22
26
  }
23
27
 
@@ -49,6 +53,16 @@ export const Success: Story = {
49
53
  parameters: figmaPrimaryDesign,
50
54
  }
51
55
 
56
+ export const SuccessWithFadeOut: Story = {
57
+ args: {
58
+ id: 'success-alert',
59
+ variant: 'success',
60
+ text: 'Thank you! But our princess is in another castle!',
61
+ fadeOut: true,
62
+ },
63
+ parameters: figmaPrimaryDesign,
64
+ }
65
+
52
66
  export const Warning: Story = {
53
67
  args: {
54
68
  id: 'warning-alert',
@@ -0,0 +1,28 @@
1
+ import React from 'react'
2
+ import { Alert, AlertContainer } from '../atoms/Alert'
3
+
4
+ const figmaPrimaryDesign = {
5
+ design: {
6
+ type: 'figma',
7
+ url: 'https://www.figma.com/file/DN2ova21vWqCRvPspBXgI1/Design-System?type=design&node-id=570-118&mode=dev',
8
+ },
9
+ }
10
+
11
+ const meta = {
12
+ title: 'Design System/Atoms/AlertContainer',
13
+ component: AlertContainer,
14
+ tags: ['autodocs'],
15
+ argTypes: {},
16
+ parameters: figmaPrimaryDesign,
17
+ }
18
+
19
+ export default meta
20
+
21
+ export const Primary = {
22
+ render: () => (
23
+ <AlertContainer>
24
+ <Alert variant="success" id="success" text="This is a success alert" />
25
+ <Alert variant="error" id="error" text="This is a error alert" />
26
+ </AlertContainer>
27
+ ),
28
+ }
@@ -4,7 +4,13 @@ import { Meta } from "@storybook/blocks";
4
4
 
5
5
  # Changelog
6
6
 
7
+ # 0.27.6
8
+
9
+ * Add AlertContiner component
10
+ * Add fadeOut prop to Alert component
11
+
7
12
  # 0.27.5
13
+
8
14
  * Add required hint to Select component
9
15
 
10
16
  # 0.27.3
@@ -1,4 +1,4 @@
1
- import type { Variant } from '@/atoms/Alert'
1
+ import type { Variant } from '@/atoms/Alert/Alert'
2
2
  import React from 'react'
3
3
  import { screen, render } from '@testing-library/react'
4
4
  import { Alert } from '@/atoms/Alert'
package/tsconfig.json CHANGED
@@ -28,12 +28,14 @@
28
28
  "**/*.ts",
29
29
  "**/*.tsx",
30
30
  ".next/types/**/*.ts",
31
+ "src/stories/Typography.stories.mdx",
31
32
  "src/stories/CardsTable.stories.js",
32
33
  "src/stories/Modal.stories.js",
33
- "src/stories/Typography.stories.mdx",
34
34
  "src/stories/Card.stories.js",
35
35
  "src/stories/Menu.stories.js",
36
- "src/stories/EmptyState.stories.js"
37
- , "src/stories/CheckableTag.stories.js", "src/stories/RadioButton.stories.js" ],
36
+ "src/stories/EmptyState.stories.js",
37
+ "src/stories/CheckableTag.stories.js",
38
+ "src/stories/RadioButton.stories.js"
39
+ ],
38
40
  "exclude": ["node_modules"]
39
41
  }