takeat-design-system-ui-kit 0.0.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/.storybook/main.ts +17 -0
- package/.storybook/preview.tsx +41 -0
- package/README.md +50 -0
- package/cli/create-story.js +65 -0
- package/eslint.config.js +26 -0
- package/index.html +13 -0
- package/package.json +66 -0
- package/public/vite.svg +1 -0
- package/src/App.css +42 -0
- package/src/App.tsx +7 -0
- package/src/LibraryProvider.tsx +17 -0
- package/src/assets/Spinner.svg +3 -0
- package/src/assets/icons/addCircleFilled.svg +8 -0
- package/src/assets/icons/arrowDown.svg +8 -0
- package/src/assets/icons/arrowDropDown.svg +8 -0
- package/src/assets/icons/arrowDropUp.svg +8 -0
- package/src/assets/icons/arrowUp.svg +8 -0
- package/src/assets/icons/barGraph.svg +8 -0
- package/src/assets/icons/bell.svg +8 -0
- package/src/assets/icons/bellFilled.svg +8 -0
- package/src/assets/icons/bellNotification.svg +8 -0
- package/src/assets/icons/bellNotificationFilled.svg +8 -0
- package/src/assets/icons/bill.svg +8 -0
- package/src/assets/icons/billFilled.svg +8 -0
- package/src/assets/icons/bookOpen.svg +8 -0
- package/src/assets/icons/bookOpenFilled.svg +8 -0
- package/src/assets/icons/bullhorn.svg +3 -0
- package/src/assets/icons/cached.svg +8 -0
- package/src/assets/icons/calendar.svg +8 -0
- package/src/assets/icons/calendarCheck.svg +8 -0
- package/src/assets/icons/calendarCheckFilled.svg +8 -0
- package/src/assets/icons/calendarFilled.svg +8 -0
- package/src/assets/icons/cashier.svg +35 -0
- package/src/assets/icons/cashierFilled.svg +6 -0
- package/src/assets/icons/chat.svg +8 -0
- package/src/assets/icons/chatFilled.svg +8 -0
- package/src/assets/icons/check.svg +8 -0
- package/src/assets/icons/checkbox.svg +8 -0
- package/src/assets/icons/checkboxChecked.svg +8 -0
- package/src/assets/icons/checkboxCheckedFilled.svg +11 -0
- package/src/assets/icons/chevronDown.svg +3 -0
- package/src/assets/icons/chevronLeft.svg +3 -0
- package/src/assets/icons/chevronRight.svg +3 -0
- package/src/assets/icons/chevronUp.svg +3 -0
- package/src/assets/icons/clipboardCheck.svg +8 -0
- package/src/assets/icons/clipboardCheckFilled.svg +8 -0
- package/src/assets/icons/clock.svg +8 -0
- package/src/assets/icons/close.svg +8 -0
- package/src/assets/icons/closeCircle.svg +8 -0
- package/src/assets/icons/closeCircleFilled.svg +8 -0
- package/src/assets/icons/cloud.svg +8 -0
- package/src/assets/icons/cloudFilled.svg +8 -0
- package/src/assets/icons/copy.svg +4 -0
- package/src/assets/icons/copyFilled.svg +4 -0
- package/src/assets/icons/deleteFilled.svg +8 -0
- package/src/assets/icons/dollarSign.svg +8 -0
- package/src/assets/icons/download.svg +8 -0
- package/src/assets/icons/exchange.svg +8 -0
- package/src/assets/icons/exclamation.svg +8 -0
- package/src/assets/icons/externalLink.svg +4 -0
- package/src/assets/icons/eye.svg +3 -0
- package/src/assets/icons/eyeFilled.svg +3 -0
- package/src/assets/icons/eyeSlash.svg +8 -0
- package/src/assets/icons/eyeSlashFilled.svg +8 -0
- package/src/assets/icons/filterList.svg +10 -0
- package/src/assets/icons/folderOpen.svg +8 -0
- package/src/assets/icons/folderOpenFilled.svg +8 -0
- package/src/assets/icons/hand.svg +8 -0
- package/src/assets/icons/handFilled.svg +8 -0
- package/src/assets/icons/helpFilled.svg +8 -0
- package/src/assets/icons/home.svg +8 -0
- package/src/assets/icons/homeFilled.svg +9 -0
- package/src/assets/icons/idCard.svg +8 -0
- package/src/assets/icons/idCardFilled.svg +8 -0
- package/src/assets/icons/info.svg +8 -0
- package/src/assets/icons/infoFilled.svg +8 -0
- package/src/assets/icons/instagram.svg +5 -0
- package/src/assets/icons/like.svg +3 -0
- package/src/assets/icons/likeFilled.svg +4 -0
- package/src/assets/icons/loading.svg +17 -0
- package/src/assets/icons/logout.svg +4 -0
- package/src/assets/icons/mail.svg +8 -0
- package/src/assets/icons/mailFilled.svg +8 -0
- package/src/assets/icons/manager.svg +4 -0
- package/src/assets/icons/menu.svg +8 -0
- package/src/assets/icons/menuCircles.svg +8 -0
- package/src/assets/icons/minus.svg +8 -0
- package/src/assets/icons/minusCircle.svg +8 -0
- package/src/assets/icons/minusCircleFilled.svg +8 -0
- package/src/assets/icons/money.svg +8 -0
- package/src/assets/icons/moneyCircle.svg +8 -0
- package/src/assets/icons/moneyFilled.svg +8 -0
- package/src/assets/icons/motorcycle.svg +3 -0
- package/src/assets/icons/pencil.svg +3 -0
- package/src/assets/icons/pencilFilled.svg +4 -0
- package/src/assets/icons/percent.svg +8 -0
- package/src/assets/icons/phone.svg +8 -0
- package/src/assets/icons/phoneFilled.svg +8 -0
- package/src/assets/icons/piggyBank.svg +8 -0
- package/src/assets/icons/piggyBankFilled.svg +8 -0
- package/src/assets/icons/playCircle.svg +8 -0
- package/src/assets/icons/playCircleFilled.svg +8 -0
- package/src/assets/icons/playSquare.svg +8 -0
- package/src/assets/icons/playSquareFilled.svg +8 -0
- package/src/assets/icons/plus.svg +8 -0
- package/src/assets/icons/plusCircle.svg +8 -0
- package/src/assets/icons/power.svg +8 -0
- package/src/assets/icons/printer.svg +8 -0
- package/src/assets/icons/printerFilled.svg +8 -0
- package/src/assets/icons/qrCode.svg +8 -0
- package/src/assets/icons/question.svg +8 -0
- package/src/assets/icons/radioButton.svg +8 -0
- package/src/assets/icons/radioButtonChecked.svg +8 -0
- package/src/assets/icons/refresh.svg +8 -0
- package/src/assets/icons/scheduleFilled.svg +8 -0
- package/src/assets/icons/search.svg +8 -0
- package/src/assets/icons/settings.svg +4 -0
- package/src/assets/icons/settingsFilled.svg +3 -0
- package/src/assets/icons/star.svg +8 -0
- package/src/assets/icons/starFilled.svg +8 -0
- package/src/assets/icons/store.svg +8 -0
- package/src/assets/icons/storeFilled.svg +8 -0
- package/src/assets/icons/takeatIcon.svg +6 -0
- package/src/assets/icons/takeatIconFilled.svg +6 -0
- package/src/assets/icons/ticket.svg +8 -0
- package/src/assets/icons/ticketFilled.svg +8 -0
- package/src/assets/icons/trash.svg +8 -0
- package/src/assets/icons/trendingDown.svg +8 -0
- package/src/assets/icons/trendingUp.svg +8 -0
- package/src/assets/icons/user.svg +8 -0
- package/src/assets/icons/userAdd.svg +8 -0
- package/src/assets/icons/userAddFilled.svg +8 -0
- package/src/assets/icons/userCircle.svg +8 -0
- package/src/assets/icons/userCircleFilled.svg +8 -0
- package/src/assets/icons/userFilled.svg +8 -0
- package/src/assets/icons/utensils.svg +8 -0
- package/src/assets/icons/waiter.svg +3 -0
- package/src/assets/icons/warning.svg +8 -0
- package/src/assets/icons/warningFilled.svg +8 -0
- package/src/assets/icons/whatsapp.svg +10 -0
- package/src/assets/icons/whatsappFilled.svg +10 -0
- package/src/components/Accordion/Accordion.stories.tsx +19 -0
- package/src/components/Accordion/index.tsx +8 -0
- package/src/components/Accordion/styles.ts +1 -0
- package/src/components/Badge/Badge.stories.tsx +21 -0
- package/src/components/Badge/index.tsx +8 -0
- package/src/components/Badge/styles.ts +1 -0
- package/src/components/Button/Button.stories.tsx +186 -0
- package/src/components/Button/index.tsx +71 -0
- package/src/components/Button/styles.ts +216 -0
- package/src/components/Calendar/Calendar.stories.tsx +69 -0
- package/src/components/Calendar/CalendarComponents/index.tsx +214 -0
- package/src/components/Calendar/CalendarComponents/styles.ts +46 -0
- package/src/components/Calendar/index.tsx +290 -0
- package/src/components/Calendar/styles.ts +203 -0
- package/src/components/Divider/Divider.stories.tsx +57 -0
- package/src/components/Divider/index.tsx +22 -0
- package/src/components/Divider/styles.ts +25 -0
- package/src/components/FormItens/Checkbox/Checkbox.stories.tsx +50 -0
- package/src/components/FormItens/Checkbox/index.tsx +34 -0
- package/src/components/FormItens/Checkbox/styles.ts +96 -0
- package/src/components/FormItens/Input/Input.stories.tsx +138 -0
- package/src/components/FormItens/Input/index.tsx +72 -0
- package/src/components/FormItens/Input/styles.ts +136 -0
- package/src/components/FormItens/Radio/Radio.stories.tsx +76 -0
- package/src/components/FormItens/Radio/index.tsx +35 -0
- package/src/components/FormItens/Radio/styles.ts +112 -0
- package/src/components/FormItens/Select/Select.stories.tsx +83 -0
- package/src/components/FormItens/Select/index.tsx +117 -0
- package/src/components/FormItens/Select/styles.ts +149 -0
- package/src/components/FormItens/Switch/Switch.stories.tsx +127 -0
- package/src/components/FormItens/Switch/index.tsx +59 -0
- package/src/components/FormItens/Switch/styles.ts +123 -0
- package/src/components/Icon/Icon.stories.tsx +87 -0
- package/src/components/Icon/index.tsx +24 -0
- package/src/components/Icon/styles.ts +36 -0
- package/src/components/Layouts/ColumnsGrid/ColumnsGrid.stories.tsx +66 -0
- package/src/components/Layouts/ColumnsGrid/index.tsx +35 -0
- package/src/components/Layouts/ColumnsGrid/styles.ts +21 -0
- package/src/components/Layouts/Grid/Grid.stories.tsx +61 -0
- package/src/components/Layouts/Grid/index.tsx +42 -0
- package/src/components/Layouts/Grid/styles.ts +16 -0
- package/src/components/Layouts/GridArea/GridArea.stories.tsx +64 -0
- package/src/components/Layouts/GridArea/index.tsx +51 -0
- package/src/components/Layouts/GridArea/styles.ts +12 -0
- package/src/components/Layouts/ResponsiveGrid/ResponsiveGrid.stories.tsx +71 -0
- package/src/components/Layouts/ResponsiveGrid/index.tsx +34 -0
- package/src/components/Layouts/ResponsiveGrid/styles.ts +19 -0
- package/src/components/MockComponent/index.tsx +9 -0
- package/src/components/MockComponent/styles.ts +14 -0
- package/src/components/Modal/Modal.stories.tsx +75 -0
- package/src/components/Modal/index.tsx +81 -0
- package/src/components/Modal/styles.ts +75 -0
- package/src/components/NotificationBanner/NotificationBanner.stories.tsx +49 -0
- package/src/components/NotificationBanner/index.tsx +54 -0
- package/src/components/NotificationBanner/styles.ts +48 -0
- package/src/components/SingleTab/SingleTab.stories.tsx +50 -0
- package/src/components/SingleTab/index.tsx +36 -0
- package/src/components/SingleTab/styles.ts +110 -0
- package/src/components/Spinner/Spinner.stories.tsx +20 -0
- package/src/components/Spinner/index.tsx +14 -0
- package/src/components/Spinner/styles.ts +31 -0
- package/src/components/StoriesComponents/index.tsx +0 -0
- package/src/components/StoriesComponents/styles.ts +17 -0
- package/src/components/TabGroup/TabGroup.stories.tsx +64 -0
- package/src/components/TabGroup/index.tsx +75 -0
- package/src/components/TabGroup/styles.ts +7 -0
- package/src/components/Tooltip/Tooltip.stories.tsx +78 -0
- package/src/components/Tooltip/index.tsx +38 -0
- package/src/index.css +68 -0
- package/src/index.ts +19 -0
- package/src/main.tsx +10 -0
- package/src/styled.d.ts +6 -0
- package/src/svg.d.ts +9 -0
- package/src/utils/GlobalStyle.ts +47 -0
- package/src/utils/consts.ts +241 -0
- package/src/utils/functions.ts +327 -0
- package/src/utils/globalTypes.ts +8 -0
- package/src/utils/icons.tsx +15 -0
- package/src/vite-env.d.ts +1 -0
- package/tsconfig.app.json +24 -0
- package/tsconfig.json +7 -0
- package/tsconfig.node.json +22 -0
- package/vite.config.ts +8 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Button } from "../Button";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import Modal from ".";
|
|
5
|
+
import { defaultTheme } from "../../utils/consts";
|
|
6
|
+
import { Icon } from "../Icon";
|
|
7
|
+
|
|
8
|
+
const meta: Meta<typeof Modal> = {
|
|
9
|
+
component: Modal,
|
|
10
|
+
title: "Design System/Modal",
|
|
11
|
+
argTypes: {
|
|
12
|
+
open: {
|
|
13
|
+
description: "Variável que diz se o modal está aberto ou fechado",
|
|
14
|
+
control: {
|
|
15
|
+
type: "boolean",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
toggle: {
|
|
19
|
+
description: "Função chamada ao clicar fora do modal",
|
|
20
|
+
control: {
|
|
21
|
+
disable: true,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
overlayStyles: {
|
|
25
|
+
description:
|
|
26
|
+
"Estilos CSS para a div que fica atras do modal e que chama o função toggle ao ser clicada",
|
|
27
|
+
control: {
|
|
28
|
+
type: "object",
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export default meta;
|
|
35
|
+
|
|
36
|
+
type Story = StoryObj<typeof Modal>;
|
|
37
|
+
|
|
38
|
+
export const Example: Story = {
|
|
39
|
+
render: () => {
|
|
40
|
+
const [modalOpen, setModalOpen] = useState(false);
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<div style={{ height: 400, width: 500, backgroundColor: "lightblue" }}>
|
|
44
|
+
<Button onClick={() => setModalOpen(!modalOpen)}>Open Modal</Button>
|
|
45
|
+
|
|
46
|
+
<Modal
|
|
47
|
+
open={modalOpen}
|
|
48
|
+
toggle={() => setModalOpen(!modalOpen)}
|
|
49
|
+
overlayStyles={{ width: "100%", height: "100%" }}
|
|
50
|
+
>
|
|
51
|
+
<Modal.Header>
|
|
52
|
+
<h1>Modal de teste</h1>
|
|
53
|
+
<h2>Subtitulo do modal de teste</h2>
|
|
54
|
+
</Modal.Header>
|
|
55
|
+
<Modal.Body>
|
|
56
|
+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Recusandae
|
|
57
|
+
dignissimos tempore repellendus expedita quia voluptatibus
|
|
58
|
+
asperiores inventore vero. Sed neque sit quisquam consequatur
|
|
59
|
+
blanditiis perferendis dolorum asperiores nisi omnis non!{" "}
|
|
60
|
+
<Icon icon="takeatIconFilled" />
|
|
61
|
+
</Modal.Body>
|
|
62
|
+
<Modal.Footer>
|
|
63
|
+
<Button onClick={() => setModalOpen(!modalOpen)}>Fechar</Button>
|
|
64
|
+
<Button
|
|
65
|
+
customColor={defaultTheme.colors.green.default}
|
|
66
|
+
onClick={() => setModalOpen(!modalOpen)}
|
|
67
|
+
>
|
|
68
|
+
Salvar
|
|
69
|
+
</Button>
|
|
70
|
+
</Modal.Footer>
|
|
71
|
+
</Modal>
|
|
72
|
+
</div>
|
|
73
|
+
);
|
|
74
|
+
},
|
|
75
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import {
|
|
3
|
+
ModalBody,
|
|
4
|
+
ModalContent,
|
|
5
|
+
ModalFooter,
|
|
6
|
+
ModalHeader,
|
|
7
|
+
ModalOverlay,
|
|
8
|
+
ModalTitles,
|
|
9
|
+
} from "./styles";
|
|
10
|
+
import { Icon } from "../Icon";
|
|
11
|
+
import { Divider } from "../Divider";
|
|
12
|
+
|
|
13
|
+
interface ModalProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
14
|
+
open?: boolean;
|
|
15
|
+
toggle?: () => void;
|
|
16
|
+
overlayStyles?: React.CSSProperties;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const Modal = forwardRef(function Modal(
|
|
20
|
+
{ open, toggle, overlayStyles, children, ...props }: ModalProps,
|
|
21
|
+
ref: React.Ref<HTMLDivElement>
|
|
22
|
+
) {
|
|
23
|
+
const modifiedChildren = React.Children.map(
|
|
24
|
+
children,
|
|
25
|
+
(child: React.ReactNode) => {
|
|
26
|
+
if (React.isValidElement(child) && child.props.hasClose) {
|
|
27
|
+
// @ts-ignore
|
|
28
|
+
return React.cloneElement(child, { toggle });
|
|
29
|
+
}
|
|
30
|
+
return child;
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<ModalOverlay
|
|
36
|
+
ref={ref}
|
|
37
|
+
style={overlayStyles}
|
|
38
|
+
open={open}
|
|
39
|
+
onClick={() => toggle?.()}
|
|
40
|
+
>
|
|
41
|
+
<ModalContent onClick={(e) => e.stopPropagation()} {...props}>
|
|
42
|
+
{modifiedChildren}
|
|
43
|
+
</ModalContent>
|
|
44
|
+
</ModalOverlay>
|
|
45
|
+
);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
interface ModalHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
49
|
+
toggle?: () => void;
|
|
50
|
+
hasClose?: boolean;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const Header = ({ children, hasClose, toggle, ...props }: ModalHeaderProps) => {
|
|
54
|
+
return (
|
|
55
|
+
<ModalHeader {...props}>
|
|
56
|
+
<ModalTitles>{children}</ModalTitles>
|
|
57
|
+
{hasClose && <Icon icon="close" onClick={() => toggle?.()} />}
|
|
58
|
+
</ModalHeader>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
interface ModalBodyProps extends React.HTMLAttributes<HTMLDivElement> {}
|
|
63
|
+
|
|
64
|
+
const Body = ({ children, ...props }: ModalBodyProps) => {
|
|
65
|
+
return <ModalBody {...props}>{children}</ModalBody>;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
interface ModalFooterProps extends React.HTMLAttributes<HTMLDivElement> {}
|
|
69
|
+
|
|
70
|
+
const Footer = ({ children, ...props }: ModalFooterProps) => {
|
|
71
|
+
return (
|
|
72
|
+
<>
|
|
73
|
+
<Divider />
|
|
74
|
+
<ModalFooter {...props}>{children}</ModalFooter>
|
|
75
|
+
</>
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const ModalComponent = Object.assign(Modal, { Header, Body, Footer });
|
|
80
|
+
|
|
81
|
+
export default ModalComponent;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
|
|
3
|
+
interface ModalOverlayProps {
|
|
4
|
+
open?: boolean;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const ModalOverlay = styled.div<ModalOverlayProps>`
|
|
8
|
+
position: fixed;
|
|
9
|
+
top: 0;
|
|
10
|
+
left: 0;
|
|
11
|
+
width: 100dvw;
|
|
12
|
+
height: 100dvh;
|
|
13
|
+
padding: ${({ theme }) => theme.spacing.m};
|
|
14
|
+
background-color: transparent;
|
|
15
|
+
display: ${({ open }) => (open ? "flex" : "none")};
|
|
16
|
+
justify-content: center;
|
|
17
|
+
align-items: center;
|
|
18
|
+
backdrop-filter: blur(2px);
|
|
19
|
+
`;
|
|
20
|
+
|
|
21
|
+
export const ModalContent = styled.div`
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
gap: ${({ theme }) => theme.spacing.s};
|
|
25
|
+
background-color: white;
|
|
26
|
+
border-radius: ${({ theme }) => theme.radius.m};
|
|
27
|
+
box-shadow: ${({ theme }) => theme.shadows.default};
|
|
28
|
+
padding: ${({ theme }) => theme.spacing.s};
|
|
29
|
+
width: 100%;
|
|
30
|
+
height: 100%;
|
|
31
|
+
min-width: fit-content;
|
|
32
|
+
`;
|
|
33
|
+
|
|
34
|
+
export const ModalHeader = styled.div`
|
|
35
|
+
display: flex;
|
|
36
|
+
justify-content: space-between;
|
|
37
|
+
align-items: flex-start;
|
|
38
|
+
|
|
39
|
+
svg {
|
|
40
|
+
cursor: pointer;
|
|
41
|
+
}
|
|
42
|
+
`;
|
|
43
|
+
|
|
44
|
+
export const ModalTitles = styled.div`
|
|
45
|
+
display: flex;
|
|
46
|
+
flex-direction: column;
|
|
47
|
+
flex-grow: 1;
|
|
48
|
+
|
|
49
|
+
h1 {
|
|
50
|
+
color: ${({ theme }) => theme.colors.neutral.darker};
|
|
51
|
+
font-size: 22px;
|
|
52
|
+
font-style: normal;
|
|
53
|
+
font-weight: 600;
|
|
54
|
+
line-height: 28px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
h2 {
|
|
58
|
+
color: ${({ theme }) => theme.colors.neutral.dark};
|
|
59
|
+
font-size: 14px;
|
|
60
|
+
font-style: normal;
|
|
61
|
+
font-weight: 500;
|
|
62
|
+
line-height: 20px;
|
|
63
|
+
letter-spacing: 0.1px;
|
|
64
|
+
}
|
|
65
|
+
`;
|
|
66
|
+
|
|
67
|
+
export const ModalBody = styled.div`
|
|
68
|
+
flex-grow: 1;
|
|
69
|
+
`;
|
|
70
|
+
|
|
71
|
+
export const ModalFooter = styled.div`
|
|
72
|
+
display: flex;
|
|
73
|
+
justify-content: flex-end;
|
|
74
|
+
gap: ${({ theme }) => theme.spacing.xs};
|
|
75
|
+
`;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { NotificationBanner } from ".";
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof NotificationBanner> = {
|
|
5
|
+
component: NotificationBanner,
|
|
6
|
+
title: "Design System/NotificationBanner",
|
|
7
|
+
argTypes: {
|
|
8
|
+
variant: {
|
|
9
|
+
control: {
|
|
10
|
+
type: "inline-radio",
|
|
11
|
+
options: ["success", "error", "warning", "info"],
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
children: {
|
|
15
|
+
description: "Conteúdo do banner. Pode ser um texto ou um componente.",
|
|
16
|
+
control: {
|
|
17
|
+
type: "text",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
isOpen: {
|
|
21
|
+
description: "Controla a visibilidade do banner.",
|
|
22
|
+
control: {
|
|
23
|
+
type: "boolean",
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
onClose: {
|
|
27
|
+
description:
|
|
28
|
+
"Função chamada ao fechar o banner. Habilita o botão de fechar.",
|
|
29
|
+
action: "onClose",
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export default meta;
|
|
35
|
+
|
|
36
|
+
type Story = StoryObj<typeof NotificationBanner>;
|
|
37
|
+
|
|
38
|
+
export const Example: Story = {
|
|
39
|
+
args: {
|
|
40
|
+
isOpen: true,
|
|
41
|
+
variant: "info",
|
|
42
|
+
children: (
|
|
43
|
+
<div>
|
|
44
|
+
<h2>Titulo</h2>
|
|
45
|
+
<p>conteúdo do banner</p>
|
|
46
|
+
</div>
|
|
47
|
+
),
|
|
48
|
+
},
|
|
49
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import { ContentWrapper, NotificationBannerWrapper } from "./styles";
|
|
3
|
+
import { Icon } from "../Icon";
|
|
4
|
+
|
|
5
|
+
interface NotificationBannerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
variant?: keyof typeof BANNER_OPTIONS;
|
|
7
|
+
onClose?: () => void;
|
|
8
|
+
isOpen?: boolean;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const BANNER_OPTIONS = {
|
|
12
|
+
success: {
|
|
13
|
+
color: "green",
|
|
14
|
+
icon: <Icon icon="check" />,
|
|
15
|
+
},
|
|
16
|
+
warning: {
|
|
17
|
+
color: "yellow",
|
|
18
|
+
icon: <Icon icon="warning" />,
|
|
19
|
+
},
|
|
20
|
+
error: {
|
|
21
|
+
color: "red",
|
|
22
|
+
icon: <Icon icon="closeCircle" />,
|
|
23
|
+
},
|
|
24
|
+
info: {
|
|
25
|
+
color: "blue",
|
|
26
|
+
icon: <Icon icon="info" />,
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const NotificationBanner = forwardRef(function NotificationBanner(
|
|
31
|
+
{
|
|
32
|
+
variant = "info",
|
|
33
|
+
onClose,
|
|
34
|
+
isOpen,
|
|
35
|
+
children,
|
|
36
|
+
...props
|
|
37
|
+
}: NotificationBannerProps,
|
|
38
|
+
ref: React.Ref<HTMLDivElement>
|
|
39
|
+
) {
|
|
40
|
+
return (
|
|
41
|
+
<NotificationBannerWrapper
|
|
42
|
+
ref={ref}
|
|
43
|
+
color={BANNER_OPTIONS[variant].color}
|
|
44
|
+
isOpen={isOpen}
|
|
45
|
+
{...props}
|
|
46
|
+
>
|
|
47
|
+
{BANNER_OPTIONS[variant].icon}
|
|
48
|
+
<ContentWrapper>{children}</ContentWrapper>
|
|
49
|
+
{!!onClose && (
|
|
50
|
+
<Icon className="close-icon" icon="close" onClick={() => onClose()} />
|
|
51
|
+
)}
|
|
52
|
+
</NotificationBannerWrapper>
|
|
53
|
+
);
|
|
54
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
|
|
3
|
+
interface NotificationBannerWrapperProps {
|
|
4
|
+
color: string;
|
|
5
|
+
isOpen?: boolean;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const NotificationBannerWrapper = styled.div<NotificationBannerWrapperProps>`
|
|
9
|
+
padding: ${({ theme }) => theme.spacing.s};
|
|
10
|
+
border-radius: ${({ theme }) => theme.radius.m};
|
|
11
|
+
background-color: ${({ theme, color }) =>
|
|
12
|
+
theme.colors[color as keyof typeof theme.colors].lightest + "66"};
|
|
13
|
+
border: 1px solid
|
|
14
|
+
${({ theme, color }) =>
|
|
15
|
+
theme.colors[color as keyof typeof theme.colors].lighter};
|
|
16
|
+
display: flex;
|
|
17
|
+
gap: ${({ theme }) => theme.spacing.s};
|
|
18
|
+
align-items: flex-start;
|
|
19
|
+
transition: all 0.3s;
|
|
20
|
+
|
|
21
|
+
color: ${({ theme }) => theme.colors.neutral.dark};
|
|
22
|
+
font-size: 14px;
|
|
23
|
+
font-style: normal;
|
|
24
|
+
font-weight: 500;
|
|
25
|
+
line-height: 24px;
|
|
26
|
+
|
|
27
|
+
svg {
|
|
28
|
+
flex-shrink: 0;
|
|
29
|
+
fill: ${({ theme, color }) =>
|
|
30
|
+
theme.colors[color as keyof typeof theme.colors].default};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.close-icon {
|
|
34
|
+
cursor: pointer;
|
|
35
|
+
fill: ${({ theme }) => theme.colors.neutral.dark};
|
|
36
|
+
height: 18px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
transform-origin: top;
|
|
40
|
+
${({ isOpen }) =>
|
|
41
|
+
isOpen
|
|
42
|
+
? "pointer-events: auto; transform: scaleY(1);"
|
|
43
|
+
: " pointer-events: none; transform: scaleY(0);"}
|
|
44
|
+
`;
|
|
45
|
+
|
|
46
|
+
export const ContentWrapper = styled.div`
|
|
47
|
+
flex-grow: 1;
|
|
48
|
+
`;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { SingleTab } from ".";
|
|
3
|
+
import { Icon } from "../Icon";
|
|
4
|
+
import { ICON_NAMES } from "../../utils/consts";
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof SingleTab> = {
|
|
7
|
+
component: SingleTab,
|
|
8
|
+
title: "Design System/SingleTab",
|
|
9
|
+
argTypes: {
|
|
10
|
+
children: {
|
|
11
|
+
description: "Conteúdo da tab. Pode ser um texto ou um componente.",
|
|
12
|
+
},
|
|
13
|
+
counter: {
|
|
14
|
+
description:
|
|
15
|
+
"Número a ser exibido no badge. Se deixado em branco, o badge não será exibido.",
|
|
16
|
+
control: {
|
|
17
|
+
type: "number",
|
|
18
|
+
allowNegative: false,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
icon: {
|
|
22
|
+
description:
|
|
23
|
+
"Ícone a ser exibido no início do botão. Se deixado em branco, nenhum ícone será exibido.",
|
|
24
|
+
control: {
|
|
25
|
+
type: "select",
|
|
26
|
+
options: ICON_NAMES,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
variant: {
|
|
30
|
+
control: {
|
|
31
|
+
type: "radio",
|
|
32
|
+
options: ["default", "transparent"],
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default meta;
|
|
39
|
+
|
|
40
|
+
type Story = StoryObj<typeof SingleTab>;
|
|
41
|
+
|
|
42
|
+
export const Example: Story = {
|
|
43
|
+
args: {
|
|
44
|
+
children: "Exemplo Tab",
|
|
45
|
+
icon: <Icon icon="bell" />,
|
|
46
|
+
counter: 9,
|
|
47
|
+
isSelected: false,
|
|
48
|
+
variant: "default",
|
|
49
|
+
},
|
|
50
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import { NumberTag, Tab, TransparentTab } from "./styles";
|
|
3
|
+
|
|
4
|
+
interface SingleTabProps extends React.HTMLAttributes<HTMLButtonElement> {
|
|
5
|
+
counter?: number;
|
|
6
|
+
icon?: React.ReactNode;
|
|
7
|
+
isSelected?: boolean;
|
|
8
|
+
variant?: keyof typeof TAB_OPTIONS;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const TAB_OPTIONS = {
|
|
12
|
+
default: Tab,
|
|
13
|
+
transparent: TransparentTab,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const SingleTab = forwardRef(function SingleTab(
|
|
17
|
+
{
|
|
18
|
+
icon,
|
|
19
|
+
counter,
|
|
20
|
+
isSelected,
|
|
21
|
+
children,
|
|
22
|
+
variant = "default",
|
|
23
|
+
...props
|
|
24
|
+
}: SingleTabProps,
|
|
25
|
+
ref: React.Ref<HTMLButtonElement>
|
|
26
|
+
) {
|
|
27
|
+
const TabToRender = TAB_OPTIONS[variant];
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<TabToRender ref={ref} isSelected={isSelected} {...props}>
|
|
31
|
+
{icon}
|
|
32
|
+
{children}
|
|
33
|
+
{!isNaN(Number(counter)) && <NumberTag>{counter}</NumberTag>}
|
|
34
|
+
</TabToRender>
|
|
35
|
+
);
|
|
36
|
+
});
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
|
|
3
|
+
interface TabProps {
|
|
4
|
+
isSelected?: boolean;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const Tab = styled.button<TabProps>`
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
gap: ${({ theme }) => theme.spacing.xs};
|
|
12
|
+
padding: ${({ theme }) => theme.spacing.xxs + " " + theme.spacing.xs};
|
|
13
|
+
border: none;
|
|
14
|
+
background-color: ${({ theme }) => theme.colors.neutral.lightest};
|
|
15
|
+
border-radius: ${({ theme }) =>
|
|
16
|
+
theme.radius.m + " " + theme.radius.m + " 0 0"};
|
|
17
|
+
width: fit-content;
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
|
|
20
|
+
color: ${({ theme }) => theme.colors.neutral.dark};
|
|
21
|
+
font-family: ${({ theme }) => theme.typography.family.default};
|
|
22
|
+
font-size: 14px;
|
|
23
|
+
font-style: normal;
|
|
24
|
+
font-weight: 500;
|
|
25
|
+
line-height: normal;
|
|
26
|
+
|
|
27
|
+
svg {
|
|
28
|
+
fill: ${({ theme }) => theme.colors.neutral.dark};
|
|
29
|
+
width: 20px;
|
|
30
|
+
height: 20px;
|
|
31
|
+
flex-shrink: 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&:hover {
|
|
35
|
+
background-color: ${({ theme }) => theme.colors.neutral.lighter};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
${({ isSelected, theme }) =>
|
|
39
|
+
isSelected &&
|
|
40
|
+
`
|
|
41
|
+
background-color: #fff;
|
|
42
|
+
color: ${theme.colors.neutral.darker};
|
|
43
|
+
|
|
44
|
+
svg {
|
|
45
|
+
fill: ${theme.colors.neutral.darker};
|
|
46
|
+
}
|
|
47
|
+
`}
|
|
48
|
+
|
|
49
|
+
&:disabled {
|
|
50
|
+
cursor: default;
|
|
51
|
+
color: ${({ theme }) => theme.colors.neutral.light};
|
|
52
|
+
background-color: ${({ theme }) => theme.colors.neutral.lighter};
|
|
53
|
+
|
|
54
|
+
svg {
|
|
55
|
+
fill: ${({ theme }) => theme.colors.neutral.light};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
`;
|
|
59
|
+
|
|
60
|
+
export const NumberTag = styled.span`
|
|
61
|
+
display: flex;
|
|
62
|
+
align-items: center;
|
|
63
|
+
justify-content: center;
|
|
64
|
+
background-color: ${({ theme }) => theme.colors.neutral.light};
|
|
65
|
+
border-radius: ${({ theme }) => theme.radius.s};
|
|
66
|
+
padding: ${({ theme }) => theme.spacing.xxs};
|
|
67
|
+
min-width: 19px;
|
|
68
|
+
|
|
69
|
+
color: #fff;
|
|
70
|
+
font-size: 11px;
|
|
71
|
+
font-style: normal;
|
|
72
|
+
font-weight: 600;
|
|
73
|
+
line-height: 11px;
|
|
74
|
+
`;
|
|
75
|
+
|
|
76
|
+
export const TransparentTab = styled(Tab)`
|
|
77
|
+
background-color: transparent;
|
|
78
|
+
position: relative;
|
|
79
|
+
|
|
80
|
+
&::after {
|
|
81
|
+
content: "";
|
|
82
|
+
position: absolute;
|
|
83
|
+
bottom: 0px;
|
|
84
|
+
left: 50%;
|
|
85
|
+
height: 2px;
|
|
86
|
+
width: 0px;
|
|
87
|
+
background-color: ${({ theme }) => theme.colors.neutral.default};
|
|
88
|
+
border-radius: 2px;
|
|
89
|
+
transition: all 0.2s;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
&:hover {
|
|
93
|
+
background-color: transparent;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
&:hover::after {
|
|
97
|
+
width: calc(100% - 16px);
|
|
98
|
+
left: 8px;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
${({ isSelected, theme }) =>
|
|
102
|
+
isSelected &&
|
|
103
|
+
`
|
|
104
|
+
&::after {
|
|
105
|
+
width: calc(100% - 16px);
|
|
106
|
+
left: 8px;
|
|
107
|
+
background-color: ${theme.colors.primary.default};
|
|
108
|
+
}
|
|
109
|
+
`}
|
|
110
|
+
`;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { Spinner } from ".";
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof Spinner> = {
|
|
5
|
+
component: Spinner,
|
|
6
|
+
title: "Design System/Spinner",
|
|
7
|
+
argTypes: {
|
|
8
|
+
size: {
|
|
9
|
+
control: {
|
|
10
|
+
type: "number",
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default meta;
|
|
17
|
+
|
|
18
|
+
type Story = StoryObj<typeof Spinner>;
|
|
19
|
+
|
|
20
|
+
export const Example: Story = {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import { SpinnerStyles } from "./styles";
|
|
3
|
+
|
|
4
|
+
interface SpinnerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
color?: string;
|
|
6
|
+
size?: number;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const Spinner = forwardRef(function Spinner(
|
|
10
|
+
{ color, size, ...props }: SpinnerProps,
|
|
11
|
+
ref: React.Ref<HTMLDivElement>
|
|
12
|
+
) {
|
|
13
|
+
return <SpinnerStyles ref={ref} size={size} color={color} {...props} />;
|
|
14
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
|
|
3
|
+
interface SpinnerStylesProps {
|
|
4
|
+
color?: string;
|
|
5
|
+
size?: number;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const SpinnerStyles = styled.div<SpinnerStylesProps>`
|
|
9
|
+
width: ${({ size }) => size || 22}px;
|
|
10
|
+
height: ${({ size }) => size || 22}px;
|
|
11
|
+
background-image: ${({ theme, color }) => `conic-gradient(
|
|
12
|
+
${color || theme.colors.primary.default} 0%,
|
|
13
|
+
transparent 5%,
|
|
14
|
+
transparent 10%,
|
|
15
|
+
${color || theme.colors.primary.default} 100%
|
|
16
|
+
)`};
|
|
17
|
+
mask-image: url("data:image/svg+xml, <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 22'><path d='M9.249 0.645999C9.63764 0.588245 10.0334 0.685283 10.3513 0.916254C10.6691 1.14722 10.8837 1.49369 10.9488 1.88116C11.0139 2.26864 10.9243 2.66619 10.6994 2.98835C10.4745 3.31051 10.1322 3.53157 9.746 3.604C7.99897 3.90027 6.41326 4.80555 5.26996 6.15934C4.12666 7.51314 3.49963 9.22802 3.5 11C3.5 12.9891 4.29018 14.8968 5.6967 16.3033C7.10322 17.7098 9.01088 18.5 11 18.5V21.5C5.201 21.5 0.5 16.8 0.5 11C0.5 5.855 4.226 1.49 9.249 0.645999ZM15.892 3.29799C16.0235 3.15124 16.1827 3.03185 16.3604 2.94664C16.5381 2.86143 16.7309 2.81208 16.9277 2.8014C17.1245 2.79072 17.3214 2.81892 17.5073 2.8844C17.6932 2.94987 17.8643 3.05134 18.011 3.18299C19.11 4.16702 19.9888 5.37197 20.59 6.71901C21.1913 8.06606 21.5013 9.52486 21.5 11C21.5 16.8 16.799 21.5 11 21.5V18.5C12.5182 18.5 14.0006 18.0393 15.2513 17.1788C16.502 16.3182 17.4621 15.0984 18.0047 13.6805C18.5473 12.2626 18.6469 10.7135 18.2902 9.23782C17.9335 7.76216 17.1373 6.42949 16.007 5.41599C15.7109 5.15036 15.5325 4.778 15.5109 4.38081C15.4893 3.98361 15.6264 3.59412 15.892 3.29799Z'/></svg>");
|
|
18
|
+
mask-size: contain;
|
|
19
|
+
mask-repeat: no-repeat;
|
|
20
|
+
mask-position: center;
|
|
21
|
+
animation: spin 2s linear infinite;
|
|
22
|
+
|
|
23
|
+
@keyframes spin {
|
|
24
|
+
0% {
|
|
25
|
+
rotate: 0deg;
|
|
26
|
+
}
|
|
27
|
+
100% {
|
|
28
|
+
rotate: 360deg;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
|
|
3
|
+
export const Subtitle = styled.h2`
|
|
4
|
+
font-family: "Poppins", sans-serif;
|
|
5
|
+
font-size: 14px;
|
|
6
|
+
font-weight: 500;
|
|
7
|
+
line-height: normal;
|
|
8
|
+
`;
|
|
9
|
+
|
|
10
|
+
export const ResizeableContainer = styled.div`
|
|
11
|
+
width: 100%;
|
|
12
|
+
border: 1px solid black;
|
|
13
|
+
padding: 8px;
|
|
14
|
+
border-radius: 8px 8px 0 8px;
|
|
15
|
+
resize: horizontal;
|
|
16
|
+
overflow: auto;
|
|
17
|
+
`;
|