@omniumretail/component-library 0.1.7 → 0.1.9
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/.storybook/main.js +21 -0
- package/.storybook/preview.js +11 -0
- package/.storybook/scss-presets.js +61 -0
- package/package.json +9 -29
- package/public/favicon.ico +0 -0
- package/public/index.html +43 -0
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/manifest.json +25 -0
- package/public/robots.txt +3 -0
- package/src/App.css +38 -0
- package/src/App.test.tsx +9 -0
- package/src/App.tsx +26 -0
- package/src/assets/code-brackets.svg +1 -0
- package/src/assets/colors.svg +1 -0
- package/src/assets/comments.svg +1 -0
- package/src/assets/direction.svg +1 -0
- package/src/assets/flow.svg +1 -0
- package/src/assets/plugin.svg +1 -0
- package/src/assets/repo.svg +1 -0
- package/{dist/cjs/reportWebVitals.d.ts → src/assets/scss/_combinations.scss} +0 -0
- package/src/assets/scss/_global.scss +89 -0
- package/src/assets/scss/index.scss +2 -0
- package/src/assets/stackalt.svg +1 -0
- package/src/components/Button/Button.stories.tsx +25 -0
- package/src/components/Button/Button.tsx +22 -0
- package/src/components/Button/styles.module.scss +67 -0
- package/src/components/Header/Header.stories.tsx +16 -0
- package/src/components/Header/Header.tsx +28 -0
- package/src/components/Header/styles.module.scss +34 -0
- package/{dist/esm/components/Label/Label.stories.js → src/components/Label/Label.stories.tsx} +8 -4
- package/src/components/Label/Label.tsx +11 -0
- package/src/components/Label/styles.module.scss +17 -0
- package/src/components/Link/Link.stories.tsx +31 -0
- package/src/components/Link/Link.tsx +21 -0
- package/src/components/Link/styles.module.scss +24 -0
- package/src/components/Select/Select.stories.tsx +39 -0
- package/src/components/Select/Select.tsx +16 -0
- package/src/components/Select/styles.module.scss +10 -0
- package/{dist/esm/components/Separator/Separator.stories.js → src/components/Separator/Separator.stories.tsx} +8 -4
- package/{dist/esm/components/Separator/Separator.js → src/components/Separator/Separator.tsx} +17 -10
- package/src/components/Separator/styles.module.scss +25 -0
- package/src/components/Tag/Tag.stories.tsx +14 -0
- package/src/components/Tag/Tag.tsx +109 -0
- package/src/components/Tag/styles.module.scss +42 -0
- package/src/index.css +13 -0
- package/src/index.js +11 -0
- package/src/index.tsx +19 -0
- package/src/logo.svg +1 -0
- package/src/react-app-env.d.ts +1 -0
- package/src/reportWebVitals.ts +15 -0
- package/{dist/esm/setupTests.js → src/setupTests.ts} +0 -1
- package/storybook-static/229.99f6e327a87e983c7389.manager.bundle.js +1 -0
- package/storybook-static/229.f45c6d90.iframe.bundle.js +1 -0
- package/storybook-static/273.a2543f76.iframe.bundle.js +2 -0
- package/storybook-static/273.a2543f76.iframe.bundle.js.LICENSE.txt +14 -0
- package/storybook-static/295.872d37b80366654037c8.manager.bundle.js +1 -0
- package/storybook-static/409.1f5bfb7f7210fda2e343.manager.bundle.js +2 -0
- package/storybook-static/409.1f5bfb7f7210fda2e343.manager.bundle.js.LICENSE.txt +97 -0
- package/storybook-static/51.055af41355d551455300.manager.bundle.js +2 -0
- package/storybook-static/51.055af41355d551455300.manager.bundle.js.LICENSE.txt +8 -0
- package/storybook-static/51.69587a88.iframe.bundle.js +2 -0
- package/storybook-static/51.69587a88.iframe.bundle.js.LICENSE.txt +8 -0
- package/storybook-static/548.2c621cac.iframe.bundle.js +2 -0
- package/storybook-static/548.2c621cac.iframe.bundle.js.LICENSE.txt +102 -0
- package/storybook-static/551.1647eb5d.iframe.bundle.js +1 -0
- package/storybook-static/551.7bddf628ac2ec1b17e0f.manager.bundle.js +1 -0
- package/storybook-static/701.d0c6e7bf.iframe.bundle.js +1 -0
- package/storybook-static/745.50b11d25.iframe.bundle.js +1 -0
- package/storybook-static/807.5048a3e40f1d1f1e3d8f.manager.bundle.js +2 -0
- package/storybook-static/807.5048a3e40f1d1f1e3d8f.manager.bundle.js.LICENSE.txt +31 -0
- package/storybook-static/807.899ed15a.iframe.bundle.js +2 -0
- package/storybook-static/807.899ed15a.iframe.bundle.js.LICENSE.txt +31 -0
- package/storybook-static/897.71aad9b5e10ae8334ffb.manager.bundle.js +2 -0
- package/storybook-static/897.71aad9b5e10ae8334ffb.manager.bundle.js.LICENSE.txt +12 -0
- package/storybook-static/897.e263bb0b.iframe.bundle.js +2 -0
- package/storybook-static/897.e263bb0b.iframe.bundle.js.LICENSE.txt +12 -0
- package/storybook-static/935.1d59a0f5d5ffadecc0db.manager.bundle.js +1 -0
- package/storybook-static/935.a9f48572.iframe.bundle.js +1 -0
- package/storybook-static/favicon.ico +0 -0
- package/storybook-static/iframe.html +364 -0
- package/storybook-static/index.html +59 -0
- package/storybook-static/logo192.png +0 -0
- package/storybook-static/logo512.png +0 -0
- package/storybook-static/main.bfef8ba6.iframe.bundle.js +1 -0
- package/storybook-static/main.dd12082b9ec45829986e.manager.bundle.js +1 -0
- package/storybook-static/manifest.json +25 -0
- package/storybook-static/project.json +1 -0
- package/storybook-static/robots.txt +3 -0
- package/storybook-static/runtime~main.1f97ee70.iframe.bundle.js +1 -0
- package/storybook-static/runtime~main.4332445a1662821dad2a.manager.bundle.js +1 -0
- package/storybook-static/static/css/main.f5f2ee7f.css +10 -0
- package/storybook-static/static/css/main.f5f2ee7f.css.map +1 -0
- package/tsconfig.json +26 -0
- package/dist/cjs/App.d.ts +0 -4
- package/dist/cjs/App.js +0 -14
- package/dist/cjs/App.js.map +0 -1
- package/dist/cjs/App.test.d.ts +0 -1
- package/dist/cjs/App.test.js +0 -15
- package/dist/cjs/App.test.js.map +0 -1
- package/dist/cjs/components/Label/Label.d.ts +0 -6
- package/dist/cjs/components/Label/Label.js +0 -14
- package/dist/cjs/components/Label/Label.js.map +0 -1
- package/dist/cjs/components/Separator/Separator.d.ts +0 -12
- package/dist/cjs/components/Separator/Separator.js +0 -27
- package/dist/cjs/components/Separator/Separator.js.map +0 -1
- package/dist/cjs/components/Tag/Tag.d.ts +0 -6
- package/dist/cjs/components/Tag/Tag.js +0 -63
- package/dist/cjs/components/Tag/Tag.js.map +0 -1
- package/dist/cjs/components/index.d.ts +0 -3
- package/dist/cjs/components/index.js +0 -20
- package/dist/cjs/components/index.js.map +0 -1
- package/dist/cjs/index.d.ts +0 -1
- package/dist/cjs/index.js +0 -18
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/reportWebVitals.js +0 -15
- package/dist/cjs/reportWebVitals.js.map +0 -1
- package/dist/cjs/setupTests.d.ts +0 -1
- package/dist/cjs/setupTests.js +0 -8
- package/dist/cjs/setupTests.js.map +0 -1
- package/dist/esm/App.d.ts +0 -4
- package/dist/esm/App.js +0 -9
- package/dist/esm/App.js.map +0 -1
- package/dist/esm/App.test.d.ts +0 -1
- package/dist/esm/App.test.js +0 -10
- package/dist/esm/App.test.js.map +0 -1
- package/dist/esm/components/Label/Label.d.ts +0 -6
- package/dist/esm/components/Label/Label.js +0 -7
- package/dist/esm/components/Label/Label.js.map +0 -1
- package/dist/esm/components/Label/Label.stories.d.ts +0 -6
- package/dist/esm/components/Label/Label.stories.js.map +0 -1
- package/dist/esm/components/Separator/Separator.d.ts +0 -12
- package/dist/esm/components/Separator/Separator.js.map +0 -1
- package/dist/esm/components/Separator/Separator.stories.d.ts +0 -6
- package/dist/esm/components/Separator/Separator.stories.js.map +0 -1
- package/dist/esm/components/Tag/Tag.d.ts +0 -6
- package/dist/esm/components/Tag/Tag.js +0 -56
- package/dist/esm/components/Tag/Tag.js.map +0 -1
- package/dist/esm/components/Tag/Tag.stories.d.ts +0 -5
- package/dist/esm/components/Tag/Tag.stories.js +0 -9
- package/dist/esm/components/Tag/Tag.stories.js.map +0 -1
- package/dist/esm/components/index.d.ts +0 -3
- package/dist/esm/components/index.js +0 -4
- package/dist/esm/components/index.js.map +0 -1
- package/dist/esm/index.d.ts +0 -1
- package/dist/esm/index.js +0 -2
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/reportWebVitals.d.ts +0 -0
- package/dist/esm/reportWebVitals.js +0 -15
- package/dist/esm/reportWebVitals.js.map +0 -1
- package/dist/esm/setupTests.d.ts +0 -1
- package/dist/esm/setupTests.js.map +0 -1
- package/dist/index.js +0 -48
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import styles from './styles.module.scss';
|
|
2
|
+
import { Link } from '../Link/Link';
|
|
3
|
+
import { ArrowLeftOutlined, HomeOutlined, LogoutOutlined } from '@ant-design/icons';
|
|
4
|
+
|
|
5
|
+
export interface HeaderProps {
|
|
6
|
+
backLink?: boolean;
|
|
7
|
+
title: string;
|
|
8
|
+
homeLink?: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const Header = (props: HeaderProps) => {
|
|
12
|
+
const { backLink, title, homeLink } = props;
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<div className={styles.header}>
|
|
16
|
+
<div className={styles.columnLeft}>
|
|
17
|
+
{ backLink && <Link href="#" icon={<ArrowLeftOutlined />} linkSecondary> Voltar </Link> }
|
|
18
|
+
</div>
|
|
19
|
+
<div className={styles.columnCenter}>
|
|
20
|
+
<h1 className={styles.title}>{title}</h1>
|
|
21
|
+
</div>
|
|
22
|
+
<div className={styles.columnRight}>
|
|
23
|
+
{homeLink && <Link href="#" icon={<HomeOutlined />} linkSecondary iconAlignRight> Home </Link>}
|
|
24
|
+
<Link href="#" icon={<LogoutOutlined />} linkSecondary iconAlignRight> Log Out</Link>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
)
|
|
28
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
.header {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
justify-content: space-between;
|
|
5
|
+
padding: 0 24px;
|
|
6
|
+
height: 75px;
|
|
7
|
+
gap: 0 24px;
|
|
8
|
+
position: relative;
|
|
9
|
+
|
|
10
|
+
@media(max-width: 767px) {
|
|
11
|
+
padding-top: 32px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@media(min-width: 767px) {
|
|
15
|
+
padding: 0 40px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.title {
|
|
19
|
+
font-size: var(--font-size-body-4);
|
|
20
|
+
font-weight: var(--font-weight-semibold);
|
|
21
|
+
text-transform: uppercase;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.columnCenter {
|
|
25
|
+
@media(max-width: 767px) {
|
|
26
|
+
position: absolute;
|
|
27
|
+
top: 0;
|
|
28
|
+
margin: 0 auto;
|
|
29
|
+
left: 0;
|
|
30
|
+
right: 0;
|
|
31
|
+
text-align: center;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
package/{dist/esm/components/Label/Label.stories.js → src/components/Label/Label.stories.tsx}
RENAMED
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {Meta, Story} from "@storybook/react";
|
|
2
|
+
import { Label, LabelProps } from './Label';
|
|
3
|
+
|
|
2
4
|
export default {
|
|
3
5
|
title: 'Label',
|
|
4
6
|
component: Label,
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
+
} as Meta;
|
|
8
|
+
|
|
9
|
+
const Template: Story<LabelProps> = (args) => <Label {...args}></Label>;
|
|
10
|
+
|
|
7
11
|
export const Primary = Template.bind({});
|
|
8
12
|
Primary.args = {
|
|
9
13
|
forAttribute: 'Label',
|
|
10
14
|
children: 'Label',
|
|
11
15
|
};
|
|
16
|
+
|
|
12
17
|
export const Secondary = Template.bind({});
|
|
13
18
|
Secondary.args = {
|
|
14
19
|
forAttribute: 'someinputname',
|
|
15
20
|
children: 'Label',
|
|
16
21
|
};
|
|
17
|
-
//# sourceMappingURL=Label.stories.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import styles from './styles.module.scss';
|
|
2
|
+
export interface LabelProps {
|
|
3
|
+
forAttribute?: string;
|
|
4
|
+
children?: any;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const Label = (props: LabelProps) => {
|
|
8
|
+
const { forAttribute, children } = props;
|
|
9
|
+
|
|
10
|
+
return <label className={ styles.label } htmlFor={ forAttribute }>{ children }</label>
|
|
11
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
.label {
|
|
3
|
+
display: block;
|
|
4
|
+
color: var(--color-black);
|
|
5
|
+
text-transform: capitalize;
|
|
6
|
+
font-size: var(--font-size-body-base);
|
|
7
|
+
line-height: 125%;
|
|
8
|
+
font-weight: var(--font-weight-semibold);
|
|
9
|
+
|
|
10
|
+
&:not(:first-child) {
|
|
11
|
+
margin-top: 8px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&.foo {
|
|
15
|
+
margin-top: 24px;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Meta, Story } from "@storybook/react";
|
|
2
|
+
import { Link, CustomLinkProps } from './Link';
|
|
3
|
+
import { SearchOutlined } from '@ant-design/icons';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Link',
|
|
7
|
+
component: Link,
|
|
8
|
+
} as Meta;
|
|
9
|
+
|
|
10
|
+
const Template: Story<CustomLinkProps> = (args) => <Link {...args}> this is a link </Link>;
|
|
11
|
+
|
|
12
|
+
export const Primary = Template.bind({});
|
|
13
|
+
Primary.args = {
|
|
14
|
+
href: '#',
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
export const Secondary = Template.bind({});
|
|
19
|
+
Secondary.args = {
|
|
20
|
+
href: '#',
|
|
21
|
+
linkSecondary: true
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const iconAlignRight = Template.bind({});
|
|
25
|
+
iconAlignRight.args = {
|
|
26
|
+
href: '#',
|
|
27
|
+
iconAlignRight: true,
|
|
28
|
+
linkSecondary: true,
|
|
29
|
+
icon: <SearchOutlined />
|
|
30
|
+
};
|
|
31
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Button as AntButton, ButtonProps } from 'antd';
|
|
2
|
+
import styles from './styles.module.scss';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
|
|
5
|
+
export interface CustomLinkProps extends ButtonProps {
|
|
6
|
+
iconAlignRight?: boolean;
|
|
7
|
+
linkSecondary?: boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const Link = (props: CustomLinkProps) => {
|
|
11
|
+
const { iconAlignRight, linkSecondary } = props;
|
|
12
|
+
|
|
13
|
+
const linkClasses = classNames({
|
|
14
|
+
[styles.iconAlignRight]: iconAlignRight,
|
|
15
|
+
[styles.linkSecondary]: linkSecondary,
|
|
16
|
+
}, [styles.link])
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<AntButton { ...props } className={ linkClasses } type={'link'} />
|
|
20
|
+
);
|
|
21
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
.link {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
text-decoration: none;
|
|
4
|
+
height: auto;
|
|
5
|
+
|
|
6
|
+
color: var(--color-black);
|
|
7
|
+
font-size: var(--font-size-body-3);
|
|
8
|
+
line-height: 100%;
|
|
9
|
+
font-weight: 300;
|
|
10
|
+
font-style: var(--font-style-italic);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.linkSecondary {
|
|
14
|
+
color: var(--color-orange);
|
|
15
|
+
font-style: var(--font-style-normal);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.iconAlignRight {
|
|
19
|
+
span:nth-child(2) {
|
|
20
|
+
margin-inline-end: 8px;
|
|
21
|
+
margin-inline-start: 0;
|
|
22
|
+
order: -1;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Meta, Story } from "@storybook/react";
|
|
2
|
+
import { CustomSelect } from './Select';
|
|
3
|
+
import { SelectProps } from 'antd';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Select',
|
|
7
|
+
component: CustomSelect,
|
|
8
|
+
} as Meta;
|
|
9
|
+
|
|
10
|
+
const Template: Story<SelectProps> = (args) => <CustomSelect {...args}></CustomSelect>;
|
|
11
|
+
|
|
12
|
+
export const Primary = Template.bind({});
|
|
13
|
+
Primary.args = {
|
|
14
|
+
defaultValue: 'something',
|
|
15
|
+
options: [
|
|
16
|
+
{
|
|
17
|
+
value: 'lucy',
|
|
18
|
+
label: 'Lucy',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
value: 'Yiminghe',
|
|
22
|
+
label: 'yiminghe',
|
|
23
|
+
},
|
|
24
|
+
]
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const noArguments = Template.bind({});
|
|
28
|
+
noArguments.args = {
|
|
29
|
+
options: [
|
|
30
|
+
{
|
|
31
|
+
value: 'lucy',
|
|
32
|
+
label: 'Lucy',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
value: 'Yiminghe',
|
|
36
|
+
label: 'yiminghe',
|
|
37
|
+
},
|
|
38
|
+
]
|
|
39
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import styles from './styles.module.scss';
|
|
2
|
+
import { Select, SelectProps } from 'antd';
|
|
3
|
+
|
|
4
|
+
export const CustomSelect = (props: SelectProps) => {
|
|
5
|
+
const { defaultValue, options } = props;
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
(options || defaultValue) &&
|
|
9
|
+
<Select
|
|
10
|
+
className={styles.select}
|
|
11
|
+
defaultValue={defaultValue}
|
|
12
|
+
style={{ minWidth: 180 }}
|
|
13
|
+
options={options}
|
|
14
|
+
/>
|
|
15
|
+
)
|
|
16
|
+
};
|
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {Meta, Story} from "@storybook/react";
|
|
2
|
+
import { Separator, SeparatorProps, Spaces } from './Separator';
|
|
3
|
+
|
|
2
4
|
export default {
|
|
3
5
|
title: 'Separator',
|
|
4
6
|
component: Separator,
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
+
} as Meta;
|
|
8
|
+
|
|
9
|
+
const Template: Story<SeparatorProps> = (args) => <Separator {...args}></Separator>;
|
|
10
|
+
|
|
7
11
|
export const Primary = Template.bind({});
|
|
8
12
|
Primary.args = {
|
|
9
13
|
hasOpacity: false,
|
|
10
14
|
colorIsBlue: false,
|
|
11
15
|
};
|
|
16
|
+
|
|
12
17
|
export const Secondary = Template.bind({});
|
|
13
18
|
Secondary.args = {
|
|
14
19
|
hasOpacity: true,
|
|
15
20
|
colorIsBlue: true,
|
|
16
21
|
space: Spaces.l,
|
|
17
22
|
};
|
|
18
|
-
//# sourceMappingURL=Separator.stories.js.map
|
package/{dist/esm/components/Separator/Separator.js → src/components/Separator/Separator.tsx}
RENAMED
|
@@ -1,20 +1,27 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
import styles from './styles.module.scss';
|
|
3
2
|
import classNames from 'classnames';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
3
|
+
|
|
4
|
+
export enum Spaces {
|
|
5
|
+
s = 's',
|
|
6
|
+
m = 'm',
|
|
7
|
+
l = 'l',
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface SeparatorProps {
|
|
11
|
+
hasOpacity?: boolean;
|
|
12
|
+
colorIsBlue?: boolean;
|
|
13
|
+
space: Spaces;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const Separator = (props: SeparatorProps) => {
|
|
11
17
|
const { hasOpacity, colorIsBlue, space } = props;
|
|
18
|
+
|
|
12
19
|
const separatorClasses = classNames({
|
|
13
20
|
[styles.separator]: true,
|
|
14
21
|
[styles['separator--opacity-50']]: hasOpacity,
|
|
15
22
|
[styles['separator--blue-background']]: colorIsBlue,
|
|
16
23
|
[styles[`separator--space-${space}` || '']]: space && Spaces[space],
|
|
17
24
|
});
|
|
18
|
-
|
|
25
|
+
|
|
26
|
+
return <hr className={separatorClasses} />
|
|
19
27
|
};
|
|
20
|
-
//# sourceMappingURL=Separator.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
.separator {
|
|
2
|
+
background-color: var(--color-orange);
|
|
3
|
+
height: 1px;
|
|
4
|
+
border: none;
|
|
5
|
+
|
|
6
|
+
&--opacity-50 {
|
|
7
|
+
opacity: 50%;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
&--blue-background {
|
|
11
|
+
background-color: var(--color-blue);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&--space-s {
|
|
15
|
+
margin: 8px 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&--space-m {
|
|
19
|
+
margin: 16px 0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&--space-l {
|
|
23
|
+
margin: 24px 0;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Meta, Story } from "@storybook/react";
|
|
2
|
+
import { TagField } from './Tag';
|
|
3
|
+
import { TagProps } from 'antd';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'TagField',
|
|
7
|
+
component: TagField,
|
|
8
|
+
} as Meta;
|
|
9
|
+
|
|
10
|
+
const Template: Story<TagProps> = (args) => <TagField {...args}></TagField>;
|
|
11
|
+
|
|
12
|
+
export const Primary = Template.bind({});
|
|
13
|
+
Primary.args = {
|
|
14
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { SearchOutlined } from '@ant-design/icons';
|
|
3
|
+
import type { InputRef } from 'antd';
|
|
4
|
+
import { Input, Tag, TagProps } from 'antd';
|
|
5
|
+
import { TweenOneGroup } from 'rc-tween-one';
|
|
6
|
+
import styles from './styles.module.scss';
|
|
7
|
+
import classNames from 'classnames';
|
|
8
|
+
|
|
9
|
+
export interface customTagProps extends TagProps {
|
|
10
|
+
customTags?: any,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const TagField = (props: customTagProps) => {
|
|
14
|
+
const { customTags = [] } = props;
|
|
15
|
+
|
|
16
|
+
const [tags, setTags] = useState<string[]>(customTags);
|
|
17
|
+
const [inputVisible, setInputVisible] = useState<boolean>(false);
|
|
18
|
+
const [inputValue, setInputValue] = useState('');
|
|
19
|
+
const inputRef = useRef<InputRef>(null);
|
|
20
|
+
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
if (inputVisible) {
|
|
23
|
+
inputRef.current?.focus();
|
|
24
|
+
}
|
|
25
|
+
}, [inputVisible]);
|
|
26
|
+
|
|
27
|
+
const handleClose = (removedTag: string) => {
|
|
28
|
+
const newTags = tags.filter((tag) => tag !== removedTag);
|
|
29
|
+
setTags(newTags);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const showInput = () => {
|
|
33
|
+
setInputVisible(true);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
37
|
+
setInputValue(e.target.value);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const handleInputConfirm = () => {
|
|
41
|
+
if (inputValue && tags.indexOf(inputValue) === -1) {
|
|
42
|
+
setTags([...tags, inputValue]);
|
|
43
|
+
}
|
|
44
|
+
setInputVisible(false);
|
|
45
|
+
setInputValue('');
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const forMap = (tag: string) => {
|
|
49
|
+
const tagElem = (
|
|
50
|
+
<Tag
|
|
51
|
+
closable
|
|
52
|
+
onClose={(e) => {
|
|
53
|
+
e.preventDefault();
|
|
54
|
+
handleClose(tag);
|
|
55
|
+
}}
|
|
56
|
+
>
|
|
57
|
+
{tag}
|
|
58
|
+
</Tag>
|
|
59
|
+
);
|
|
60
|
+
return (
|
|
61
|
+
<span key={tag} className={styles['tagfield__new']} style={{ display: 'inline-block' }}>
|
|
62
|
+
{tagElem}
|
|
63
|
+
</span>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const tagChild = tags.map(forMap);
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<div className={styles.tagfield}>
|
|
71
|
+
{inputVisible && (
|
|
72
|
+
<Input
|
|
73
|
+
ref={inputRef}
|
|
74
|
+
type="text"
|
|
75
|
+
size="small"
|
|
76
|
+
value={inputValue}
|
|
77
|
+
onChange={handleInputChange}
|
|
78
|
+
onBlur={handleInputConfirm}
|
|
79
|
+
onPressEnter={handleInputConfirm}
|
|
80
|
+
className={styles['tagfield__input']}
|
|
81
|
+
/>
|
|
82
|
+
)}
|
|
83
|
+
{!inputVisible && (
|
|
84
|
+
<Tag onClick={showInput} className={classNames(styles['tagfield__creator'], 'site-tag-plus')}>
|
|
85
|
+
<SearchOutlined /> Procurar
|
|
86
|
+
</Tag>
|
|
87
|
+
)}
|
|
88
|
+
<div style={{ marginTop: 16 }}>
|
|
89
|
+
<TweenOneGroup
|
|
90
|
+
enter={{
|
|
91
|
+
scale: 0.8,
|
|
92
|
+
opacity: 0,
|
|
93
|
+
type: 'from',
|
|
94
|
+
duration: 100,
|
|
95
|
+
}}
|
|
96
|
+
onEnd={(e: any) => {
|
|
97
|
+
if (e.type === 'appear' || e.type === 'enter') {
|
|
98
|
+
(e.target as any).style = 'display: inline-block';
|
|
99
|
+
}
|
|
100
|
+
}}
|
|
101
|
+
leave={{ opacity: 0, width: 0, scale: 0, duration: 200 }}
|
|
102
|
+
appear={false}
|
|
103
|
+
>
|
|
104
|
+
{tagChild}
|
|
105
|
+
</TweenOneGroup>
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
);
|
|
109
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
.tagfield {
|
|
2
|
+
contain: inline-size;
|
|
3
|
+
|
|
4
|
+
&__creator {
|
|
5
|
+
height: 50px;
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
gap: 12px;
|
|
9
|
+
padding: 16px;
|
|
10
|
+
|
|
11
|
+
:global {
|
|
12
|
+
.ant-input {
|
|
13
|
+
height: 50px;
|
|
14
|
+
padding-left: 40px;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&__input {
|
|
20
|
+
height: 50px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&__new {
|
|
24
|
+
:global {
|
|
25
|
+
.ant-tag {
|
|
26
|
+
background-color: var(--color-orange);
|
|
27
|
+
color: var(--color-white);
|
|
28
|
+
padding: 6px 16px;
|
|
29
|
+
max-width: 240px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.anticon-close {
|
|
33
|
+
color: var(--color-white);
|
|
34
|
+
font-size: 12px;
|
|
35
|
+
|
|
36
|
+
&:hover {
|
|
37
|
+
color: var(--color-black);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
package/src/index.css
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
body {
|
|
2
|
+
margin: 0;
|
|
3
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
|
4
|
+
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
|
5
|
+
sans-serif;
|
|
6
|
+
-webkit-font-smoothing: antialiased;
|
|
7
|
+
-moz-osx-font-smoothing: grayscale;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
code {
|
|
11
|
+
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
|
12
|
+
monospace;
|
|
13
|
+
}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as styles from '../src/assets/scss/index';
|
|
2
|
+
|
|
3
|
+
export { styles };
|
|
4
|
+
|
|
5
|
+
export * from '../src/components/Button';
|
|
6
|
+
export * from '../src/components/Header';
|
|
7
|
+
export * from '../src/components/Label';
|
|
8
|
+
export * from '../src/components/Link';
|
|
9
|
+
export * from '../src/components/Select';
|
|
10
|
+
export * from '../src/components/Separator';
|
|
11
|
+
export * from '../src/components/Tag';
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ReactDOM from 'react-dom/client';
|
|
3
|
+
import './index.css';
|
|
4
|
+
import App from './App';
|
|
5
|
+
import reportWebVitals from './reportWebVitals';
|
|
6
|
+
|
|
7
|
+
const root = ReactDOM.createRoot(
|
|
8
|
+
document.getElementById('root') as HTMLElement
|
|
9
|
+
);
|
|
10
|
+
root.render(
|
|
11
|
+
<React.StrictMode>
|
|
12
|
+
<App />
|
|
13
|
+
</React.StrictMode>
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
// If you want to start measuring performance in your app, pass a function
|
|
17
|
+
// to log results (for example: reportWebVitals(console.log))
|
|
18
|
+
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
|
|
19
|
+
reportWebVitals();
|
package/src/logo.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3"><g fill="#61DAFB"><path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/><circle cx="420.9" cy="296.5" r="45.7"/><path d="M520.5 78.1z"/></g></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="react-scripts" />
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReportHandler } from 'web-vitals';
|
|
2
|
+
|
|
3
|
+
const reportWebVitals = (onPerfEntry?: ReportHandler) => {
|
|
4
|
+
if (onPerfEntry && onPerfEntry instanceof Function) {
|
|
5
|
+
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
|
|
6
|
+
getCLS(onPerfEntry);
|
|
7
|
+
getFID(onPerfEntry);
|
|
8
|
+
getFCP(onPerfEntry);
|
|
9
|
+
getLCP(onPerfEntry);
|
|
10
|
+
getTTFB(onPerfEntry);
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default reportWebVitals;
|