agroptima-design-system 0.23.0 → 0.24.0-beta.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.23.0",
3
+ "version": "0.24.0-beta.2",
4
4
  "scripts": {
5
5
  "dev": "npm run storybook",
6
6
  "storybook": "storybook dev -p 6006 --ci",
@@ -0,0 +1,30 @@
1
+ @use '../../settings/config';
2
+ @use '../../settings/breakpoints';
3
+ @use '../../settings/color_alias';
4
+
5
+ .actions {
6
+ display: flex;
7
+ justify-content: flex-end;
8
+ gap: config.$space-4x;
9
+ // margin: config.$space-1x 0 config.$space-6x;
10
+
11
+ flex-direction: row;
12
+ padding: config.$space-3x config.$space-5x;
13
+ background-color: color_alias.$neutral-white;
14
+ box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0.3);
15
+
16
+ position: fixed;
17
+ inset: auto 0 0 0;
18
+ }
19
+
20
+ @media only screen and (max-width: breakpoints.$large) {
21
+ .actions {
22
+ margin: 0;
23
+ flex-direction: column;
24
+ position: fixed;
25
+ width: calc(100% - config.$space-3x - config.$space-3x);
26
+ right: config.$space-3x;
27
+ left: config.$space-3x;
28
+ bottom: config.$space-4x;
29
+ }
30
+ }
@@ -0,0 +1,10 @@
1
+ import { classNames } from '@/utils/classNames'
2
+ import './Actions.scss'
3
+
4
+ export interface ActionsProps extends React.ComponentPropsWithoutRef<'div'> {
5
+ children: React.ReactNode
6
+ }
7
+
8
+ export default function Actions({ className, children }: ActionsProps) {
9
+ return <div className={classNames('actions', className)}>{children}</div>
10
+ }
@@ -0,0 +1,25 @@
1
+ @use '../../settings/config';
2
+ @use '../../settings/breakpoints';
3
+
4
+ .form {
5
+ display: flex;
6
+ flex-direction: column;
7
+ margin: 0 auto;
8
+ gap: config.$space-4x;
9
+ padding: 0;
10
+
11
+ width: breakpoints.$medium;
12
+ max-width: breakpoints.$medium;
13
+
14
+ &.full-width {
15
+ width: 100%;
16
+ max-width: 100%;
17
+ }
18
+ }
19
+
20
+ @media only screen and (max-width: breakpoints.$large) {
21
+ .form {
22
+ max-width: 100%;
23
+ width: 100%;
24
+ }
25
+ }
@@ -0,0 +1,25 @@
1
+ import { classNames } from '../../utils/classNames'
2
+ import './Form.scss'
3
+
4
+ export interface FormProps extends React.ComponentPropsWithoutRef<'form'> {
5
+ fullWidth?: boolean
6
+ children: React.ReactNode
7
+ }
8
+
9
+ export default function Form({
10
+ className,
11
+ fullWidth,
12
+ children,
13
+ ...props
14
+ }: FormProps) {
15
+ return (
16
+ <form
17
+ className={classNames(className, 'form', {
18
+ 'full-width': fullWidth,
19
+ })}
20
+ {...props}
21
+ >
22
+ {children}
23
+ </form>
24
+ )
25
+ }
@@ -0,0 +1,4 @@
1
+ import Form from './Form'
2
+ import Actions from './Actions'
3
+
4
+ export { Form, Actions }
@@ -0,0 +1,44 @@
1
+ import { Form, Actions } from '@/atoms/Form'
2
+ import { Input } from '@/atoms/Input'
3
+ import { Button } from '@/atoms/Button'
4
+
5
+ const meta = {
6
+ title: 'Design System/Atoms/Form',
7
+ component: Form,
8
+ tags: ['autodocs'],
9
+ argTypes: {
10
+ fullWidth: {
11
+ description: 'Should the form take full width?',
12
+ control: { type: 'boolean', default: false },
13
+ },
14
+ },
15
+ }
16
+
17
+ export default meta
18
+
19
+ export const FormWithActions = {
20
+ render: (args) => (
21
+ <Form {...args}>
22
+ <Input label="First Name" placeholder="First Name" name="firstName" />
23
+ <Input label="Last Name" placeholder="Last Name" name="lastName" />
24
+ <Input label="Username" placeholder="Username" name="username" />
25
+ <Input label="Email" placeholder="Email" type="email" name="email" />
26
+ <Input
27
+ label="Password"
28
+ placeholder="Password"
29
+ type="password"
30
+ name="password"
31
+ />
32
+ <Input
33
+ label="Repeat password"
34
+ placeholder="Repeat password"
35
+ type="repeatPassword"
36
+ name="repeatPassword"
37
+ />
38
+ <Actions>
39
+ <Button type="button" label="Cancel" variant="primary-outlined" />
40
+ <Button type="submit" label="Sign in" variant="primary" />
41
+ </Actions>
42
+ </Form>
43
+ ),
44
+ }
package/tests/library.ts CHANGED
@@ -8,3 +8,4 @@ export * as Input from '../src/stories/Input.stories'
8
8
  export * as Multiselect from '../src/stories/Multiselect.stories'
9
9
  export * as Modal from '../src/stories/Modal.stories'
10
10
  export * as Select from '../src/stories/Select.stories'
11
+ export * as Form from '../src/stories/Form.stories'