wca-designsystem 0.0.28 → 0.0.29

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,5 +1,5 @@
1
1
  {
2
- "version": "0.0.28",
2
+ "version": "0.0.29",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -24,6 +24,7 @@ const IconeBotao = ({
24
24
  <S.IconeBotaoDefault color={color} {...props} data-testid="round" />
25
25
  </HoverPopUp>
26
26
  ),
27
+
27
28
  table: (
28
29
  <HoverPopUp texto={toolTipInfo!} width={100}>
29
30
  <S.IconeBotaoTable color={color} {...props} data-testid="table" />
@@ -1,127 +1,44 @@
1
- import React, { useCallback } from 'react';
1
+ import React from 'react';
2
2
  import Icone from '../../atomos/Icone';
3
3
  import * as S from './styles';
4
4
  import ajuda from '../../../assets/imagens/icons/Ajuda.svg';
5
- import ciclosEncerrados from '../../../assets/imagens/icons/CiclosEncerrados.svg';
6
- import desdobramento from '../../../assets/imagens/icons/Desdobramentos.svg';
7
- import carga from '../../../assets/imagens/icons/Carga.svg';
8
5
  import { theme } from '../../../styles/theme';
9
6
  import HoverPopUp from '../../atomos/HoverPopUp';
10
- import { useLocation } from 'react-router-dom';
11
7
  import UsuarioNotifications, {
12
8
  NotificationsProps,
13
9
  } from '../../atomos/UsuarioNotification';
14
- import usuario from '../../../assets/imagens/icons/Usuario.svg';
15
-
16
- type CabecalhoOption = {
17
- icon: string;
18
- titulo: string;
19
- subTitulo: string;
20
- info: string;
21
- };
22
-
23
- type OpcoesCabecalho = {
24
- [key: string]: CabecalhoOption;
25
- };
26
10
 
27
11
  export interface CabecalhoProps {
28
12
  notificacoes: NotificationsProps;
29
13
  temNotificacoes?: boolean;
30
14
  color?: string;
15
+ icone: string;
16
+ titulo: string;
17
+ subTitulo: string;
18
+ info: string;
31
19
  }
32
20
 
33
21
  const Cabecalho = ({
34
22
  notificacoes,
35
23
  temNotificacoes,
24
+ icone,
25
+ info,
26
+ subTitulo,
27
+ titulo,
36
28
  color = theme.colors.blue,
37
29
  }: CabecalhoProps) => {
38
- const rotaAcessada = useLocation();
39
- const paginaAtual = rotaAcessada.pathname.replace('/', '');
40
- const CabecalhoInfos = useCallback(
41
- (info: string) => {
42
- const opcoesCabecalho: OpcoesCabecalho = {
43
- usuarios: {
44
- icon: usuario,
45
- titulo: 'Usuários',
46
- subTitulo:
47
- 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.',
48
- info:
49
- 'Cadastre, edite, delete, ou consulte os usuários que iram poder acessar o sistema.',
50
- },
51
- desdobramento: {
52
- icon: desdobramento,
53
- titulo: 'Desdobramento',
54
- subTitulo:
55
- 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.',
56
- info:
57
- 'Cadastre, edite, delete, ou consulte os desdobramentos de sua venda.',
58
- },
59
- carga: {
60
- icon: carga,
61
- titulo: 'Carga e importação',
62
- subTitulo:
63
- 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.',
64
- info:
65
- 'Cadastre, edite, delete, ou consulte os desdorbramentos de sua venda.',
66
- },
67
- boasvindas: {
68
- icon: usuario,
69
- titulo: 'Boas Vindas',
70
- subTitulo:
71
- 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.',
72
- info:
73
- 'Cadastre, edite, delete, ou consulte os desdobramentos de sua venda.',
74
- },
75
- planejamento: {
76
- icon: desdobramento,
77
- titulo: 'Planejamento',
78
- subTitulo:
79
- 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.',
80
- info:
81
- 'Cadastre, edite, delete, ou consulte os desdobramentos de sua venda.',
82
- },
83
- ciclosEncerrados: {
84
- icon: ciclosEncerrados,
85
- titulo: 'Ciclos Encerrados',
86
- subTitulo:
87
- 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.',
88
- info:
89
- 'Consulte ciclos que foram cancelados e descontinuados do seu histórico de desdobramentos.',
90
- },
91
- };
92
-
93
- return (
94
- opcoesCabecalho[info] ?? {
95
- icon: usuario,
96
- titulo: 'Boas Vindas',
97
- subTitulo:
98
- 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.',
99
- info:
100
- 'Cadastre, edite, delete, ou consulte os desdorbramentos de sua venda.',
101
- }
102
- );
103
- },
104
- [paginaAtual]
105
- );
106
-
107
30
  return (
108
31
  <S.CabecalhoContainer>
109
32
  <S.CabecalhoInfoWrapper color={color}>
110
33
  <div className="icon-wrapper">
111
- <Icone
112
- fill={theme.colors.white}
113
- svg={CabecalhoInfos(paginaAtual).icon}
114
- />
34
+ <Icone fill={theme.colors.white} svg={icone} />
115
35
  </div>
116
36
  <div className="info-wrapper">
117
- <h1>{CabecalhoInfos(paginaAtual).titulo}</h1>
118
- <p>{CabecalhoInfos(paginaAtual).subTitulo}</p>
37
+ <h1>{titulo}</h1>
38
+ <p>{subTitulo}</p>
119
39
  </div>
120
40
 
121
- <HoverPopUp
122
- texto={CabecalhoInfos(paginaAtual).info}
123
- className="ajuda-wrapper"
124
- >
41
+ <HoverPopUp texto={info} className="ajuda-wrapper">
125
42
  <Icone
126
43
  width={16}
127
44
  height={16}
@@ -2,6 +2,7 @@ import type { Meta, StoryObj } from '@storybook/react';
2
2
  import { ConchaAplicacao } from '.';
3
3
  import { NotificacaoProp } from '../../atomos/UsuarioNotification';
4
4
  import { LinksDinamicosMock } from '../Navbar/mocks';
5
+ import { theme } from '../../../styles/theme';
5
6
 
6
7
  const meta: Meta<typeof ConchaAplicacao> = {
7
8
  component: ConchaAplicacao,
@@ -16,6 +17,10 @@ export const Primary: Story = {
16
17
  links: LinksDinamicosMock,
17
18
  isNavHover: true,
18
19
  temNotificacoes: false,
20
+ info:"exemplo",
21
+ subTitulo:"exemplo",
22
+ titulo:"exemplo",
23
+ color: theme.colors.blue,
19
24
  modulo: 'exemplo',
20
25
  notificacoes: {
21
26
  abre: true,
@@ -6,6 +6,8 @@ import {
6
6
  NotificationsProps,
7
7
  } from '../../atomos/UsuarioNotification';
8
8
  import { LinksDinamicosMock } from '../Navbar/mocks';
9
+ import carga from '../../../assets/imagens/icons/Carga.svg';
10
+ import { theme } from '../../../styles/theme';
9
11
 
10
12
  describe('AppShelCollapsed rendering', () => {
11
13
  it('renders without crashing', () => {
@@ -27,7 +29,12 @@ describe('AppShelCollapsed rendering', () => {
27
29
  <ConchaAplicacao
28
30
  activeLink=""
29
31
  isNavHover={true}
32
+ info="exemplo"
33
+ subTitulo="exemplo"
34
+ titulo="exemplo"
35
+ color={theme.colors.blue}
30
36
  sairFunc={() => console.log('aqui')}
37
+ icone={carga}
31
38
  modulo="exemplo"
32
39
  notificacoes={mockNotifications}
33
40
  links={LinksDinamicosMock}
@@ -3,7 +3,6 @@ import { Container } from '@mantine/core';
3
3
  import * as S from './styles';
4
4
  import Navbar from '../Navbar';
5
5
  import Cabecalho from '../Cabecalho';
6
- import { useLocation } from 'react-router-dom';
7
6
  import { NotificationsProps } from '../../atomos/UsuarioNotification';
8
7
  import { LinksProps } from '../../molecules/GrupoDeLinks';
9
8
  import { theme } from '../../../styles/theme';
@@ -19,12 +18,20 @@ type ConchaAplicacaolType = {
19
18
  sairFunc: () => void;
20
19
  activeLink: string;
21
20
  color?: string;
21
+ icone: string;
22
+ titulo: string;
23
+ subTitulo: string;
24
+ info: string;
22
25
  };
23
26
  export function ConchaAplicacao({
24
27
  children,
25
28
  modulo,
26
29
  temNotificacoes,
27
30
  isNavHover,
31
+ icone,
32
+ info,
33
+ subTitulo,
34
+ titulo,
28
35
  sairFunc,
29
36
  activeLink,
30
37
  color = theme.colors.blue,
@@ -32,9 +39,6 @@ export function ConchaAplicacao({
32
39
  links,
33
40
  navbarRef,
34
41
  }: ConchaAplicacaolType) {
35
- const rotaAcessada = useLocation();
36
- const paginaAtual = rotaAcessada.pathname.replace('/', '');
37
-
38
42
  return (
39
43
  <S.ConchaAplicacaoWrapper
40
44
  data-testid="app-shell-wrapper"
@@ -58,13 +62,16 @@ export function ConchaAplicacao({
58
62
  </S.NavbarWrapper>
59
63
  <S.ConchaAplicacaoMainWrapper>
60
64
  <Container fluid>
61
- {paginaAtual.length > 0 && (
62
- <Cabecalho
63
- color={color}
64
- temNotificacoes={temNotificacoes}
65
- notificacoes={notificacoes}
66
- />
67
- )}
65
+ <Cabecalho
66
+ icone={icone}
67
+ info={info}
68
+ subTitulo={subTitulo}
69
+ titulo={titulo}
70
+ color={color}
71
+ temNotificacoes={temNotificacoes}
72
+ notificacoes={notificacoes}
73
+ />
74
+
68
75
  {children}
69
76
  </Container>
70
77
  </S.ConchaAplicacaoMainWrapper>
@@ -26,7 +26,5 @@ export const NavbarWrapper = styled(AppShell.Navbar)<ConchaAplicacaoProps>`
26
26
  `}
27
27
  `;
28
28
  export const ConchaAplicacaoMainWrapper = styled(AppShell.Main)`
29
- ${() => css`
30
- max-width: 1500px;
31
- `}
29
+ ${() => css``}
32
30
  `;
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import Passos, { PassoProps, PassosProps } from './index';
3
3
  import { Meta } from '@storybook/react';
4
+ import { theme } from '../../../styles/theme';
4
5
 
5
6
  export default {
6
7
  title: 'Components/moleculas/Passos',
@@ -41,6 +42,7 @@ const props: PassosProps = {
41
42
  passo: 1,
42
43
  setPasso: () => props.passo + 1,
43
44
  passos: passos,
45
+ color: theme.colors.blue,
44
46
  };
45
47
 
46
48
  const Template: any = (args: PassosProps) => <Passos {...args} />;
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
- import { Stepper } from '@mantine/core';
2
+ import { ActionIcon, Stepper } from '@mantine/core';
3
3
  import * as S from './styles';
4
- import IconeBotao from '../../atomos/IconeBotao';
5
4
  import Icone from '../../atomos/Icone';
6
5
  import proximo from '../../../assets/imagens/icons/NavDireita.svg';
7
6
  import anterior from '../../../assets/imagens/icons/NavEsquerda.svg';
@@ -21,14 +20,21 @@ export type PassosProps = {
21
20
  passos: Array<PassoProps>;
22
21
  setPasso: React.Dispatch<React.SetStateAction<number>>;
23
22
  passo: number;
23
+ color?: string;
24
24
  ciclo: string;
25
25
  };
26
26
 
27
- function Passos({ passos, passo, setPasso, ciclo }: PassosProps) {
27
+ function Passos({
28
+ passos,
29
+ passo,
30
+ setPasso,
31
+ ciclo,
32
+ color = theme.colors.blue,
33
+ }: PassosProps) {
28
34
  const carrouselRef = useRef<HTMLDivElement>(null);
29
35
 
30
36
  const passoInfos = useMemo(
31
- () => passos.filter((passoFilter) => passoFilter.id === passo)[0],
37
+ () => passos.filter(passoFilter => passoFilter.id === passo)[0],
32
38
  [passo]
33
39
  );
34
40
 
@@ -53,24 +59,23 @@ function Passos({ passos, passo, setPasso, ciclo }: PassosProps) {
53
59
  [passo]
54
60
  );
55
61
  return (
56
- <S.PassosWrapper>
57
- <S.PassosContainer ref={carrouselRef}>
62
+ <S.PassosWrapper color={color}>
63
+ <S.PassosContainer color={color} ref={carrouselRef}>
58
64
  <S.BotaoEsquerda className="sticky">
59
- <IconeBotao
60
- tipo="round"
65
+ <ActionIcon
61
66
  className="controlador esquerda"
62
- color={theme.colors.gray['500']}
63
67
  onClick={() => (carrouselRef.current!.scrollLeft -= 128)}
64
68
  >
65
69
  <Icone svg={anterior} fill={theme.colors.white} />
66
- </IconeBotao>
70
+ </ActionIcon>
67
71
  </S.BotaoEsquerda>
68
72
  <S.PassoSteep
73
+ color={color}
69
74
  active={passo}
70
- onStepClick={(e) => setPasso(e)}
75
+ onStepClick={e => setPasso(e)}
71
76
  allowNextStepsSelect={true}
72
77
  >
73
- {passos?.map((passoMap) => (
78
+ {passos?.map(passoMap => (
74
79
  <Stepper.Step
75
80
  completedIcon={<>{passoMap.id + 1}</>}
76
81
  disabled={passoMap.desabilitado}
@@ -120,17 +125,15 @@ function Passos({ passos, passo, setPasso, ciclo }: PassosProps) {
120
125
  ))}
121
126
  </S.PassoSteep>
122
127
  <S.BotaoDireita className="sticky">
123
- <IconeBotao
124
- tipo="round"
128
+ <ActionIcon
125
129
  onClick={() => (carrouselRef.current!.scrollLeft += 128)}
126
- color={theme.colors.gray['500']}
127
130
  className="controlador"
128
131
  >
129
132
  <Icone svg={proximo} fill={theme.colors.white} />
130
- </IconeBotao>
133
+ </ActionIcon>
131
134
  </S.BotaoDireita>
132
135
  </S.PassosContainer>
133
- <S.PassoInfos>
136
+ <S.PassoInfos color={color}>
134
137
  <div className="infos">
135
138
  <p>Você está no Passo {passo + 1}:</p>
136
139
  <h3>{passoInfos?.titulo}</h3>
@@ -143,10 +146,10 @@ function Passos({ passos, passo, setPasso, ciclo }: PassosProps) {
143
146
 
144
147
  <Botao
145
148
  variant="outline"
146
- color={theme.colors.blue}
149
+ color={color}
147
150
  radius={'8px'}
148
151
  disabled={passo === passos.length}
149
- leftSection={<Icone svg={proximo} fill={theme.colors.blue} />}
152
+ leftSection={<Icone svg={proximo} fill={color} />}
150
153
  onClick={() => setPasso(passo + 1)}
151
154
  tipo="default"
152
155
  >
@@ -1,10 +1,14 @@
1
- import { Stepper } from "@mantine/core";
2
- import styled, { css } from "styled-components";
1
+ import { Stepper } from '@mantine/core';
2
+ import styled, { css } from 'styled-components';
3
3
 
4
- export const PassosWrapper = styled.div`
5
- ${({ theme }) => css`
4
+ type PassosWrapperProps = {
5
+ color?: string;
6
+ };
7
+
8
+ export const PassosWrapper = styled.div<PassosWrapperProps>`
9
+ ${({ color }) => css`
6
10
  .divider {
7
- background-color: ${theme.colors.blue};
11
+ background-color: ${color};
8
12
  height: 1px;
9
13
  width: 100%;
10
14
  position: relative;
@@ -60,6 +64,14 @@ export const BotaoDireita = styled.div`
60
64
  rgba(255, 255, 255, 0) 100%
61
65
  );
62
66
  justify-content: end;
67
+
68
+ button {
69
+ background-color: transparent;
70
+
71
+ &:hover {
72
+ background-color: transparent;
73
+ }
74
+ }
63
75
  `}
64
76
  `;
65
77
  export const BotaoEsquerda = styled.div`
@@ -71,11 +83,18 @@ export const BotaoEsquerda = styled.div`
71
83
  #abb5be 29.37%,
72
84
  rgba(255, 255, 255, 0) 100%
73
85
  );
86
+
87
+ button {
88
+ background-color: transparent;
89
+
90
+ &:hover {
91
+ background-color: transparent;
92
+ }
74
93
  `}
75
94
  `;
76
95
 
77
- export const PassoSteep = styled(Stepper)`
78
- ${({ theme }) => css`
96
+ export const PassoSteep = styled(Stepper)<PassosWrapperProps>`
97
+ ${({ theme, color }) => css`
79
98
  padding: 0;
80
99
  margin-left: -55px;
81
100
 
@@ -89,7 +108,7 @@ export const PassoSteep = styled(Stepper)`
89
108
  align-items: end;
90
109
  p {
91
110
  font-size: ${theme.sizes.xSmall};
92
- color: ${theme.colors.gray["500"]};
111
+ color: ${theme.colors.gray['500']};
93
112
  width: 128px;
94
113
  font-weight: light;
95
114
  }
@@ -107,7 +126,7 @@ export const PassoSteep = styled(Stepper)`
107
126
  .mantine-Stepper-stepIcon {
108
127
  height: 64px;
109
128
  width: 48px;
110
- color: ${theme.colors.gray["700"]};
129
+ color: ${theme.colors.gray['700']};
111
130
  border-radius: 5px;
112
131
  font-size: ${theme.sizes.xxLarge};
113
132
  font-weight: bold;
@@ -117,7 +136,7 @@ export const PassoSteep = styled(Stepper)`
117
136
  .mantine-Stepper-stepLabel {
118
137
  h2 {
119
138
  font-size: ${theme.sizes.large};
120
- color: ${theme.colors.gray["700"]};
139
+ color: ${theme.colors.gray['700']};
121
140
  line-height: 16px;
122
141
  font-weight: 700;
123
142
  width: 128px;
@@ -135,14 +154,14 @@ export const PassoSteep = styled(Stepper)`
135
154
 
136
155
  .ativo {
137
156
  .mantine-Stepper-stepIcon {
138
- background-color: ${theme.colors.blue};
157
+ background-color: ${color};
139
158
  color: ${theme.colors.white};
140
159
  }
141
160
  }
142
161
  .desabilitado {
143
162
  cursor: not-allowed;
144
163
  .mantine-Stepper-stepIcon {
145
- background-color: ${theme.colors.gray["500"]};
164
+ background-color: ${theme.colors.gray['500']};
146
165
  }
147
166
  }
148
167
 
@@ -154,8 +173,8 @@ export const PassoSteep = styled(Stepper)`
154
173
  `}
155
174
  `;
156
175
 
157
- export const PassoInfos = styled.div`
158
- ${({ theme }) => css`
176
+ export const PassoInfos = styled.div<PassosWrapperProps>`
177
+ ${({ theme, color }) => css`
159
178
  padding: 20px 0;
160
179
  display: block;
161
180
 
@@ -169,7 +188,7 @@ export const PassoInfos = styled.div`
169
188
  .infos {
170
189
  p {
171
190
  font-size: ${theme.sizes.small};
172
- color: ${theme.colors.blue};
191
+ color: ${color};
173
192
  line-height: 12px;
174
193
  margin: 15px 0;
175
194
 
@@ -187,7 +206,7 @@ export const PassoInfos = styled.div`
187
206
  font-weight: 700;
188
207
  line-height: 16px;
189
208
  margin: 4px 0;
190
- color: ${theme.colors.blue};
209
+ color: ${color};
191
210
  }
192
211
  }
193
212
 
@@ -197,10 +216,10 @@ export const PassoInfos = styled.div`
197
216
  gap: 24px;
198
217
 
199
218
  .ciclo {
200
- border: 1px solid ${theme.colors.blue};
219
+ border: 1px solid ${color};
201
220
  padding: 4px;
202
221
  border-radius: 4px;
203
- color: ${theme.colors.blue};
222
+ color: ${color};
204
223
 
205
224
  span {
206
225
  color: ${theme.colors.blackSti};
@@ -11,7 +11,7 @@ export const RelatorioCardWrapper = styled.div<RelatorioCardType>`
11
11
  border-style: solid;
12
12
  border-radius: 8px;
13
13
  border-color: ${color};
14
- max-width: 320px;
14
+ width: 320px;
15
15
  padding: 24px 16px;
16
16
 
17
17
  h2 {
@@ -57,6 +57,7 @@ export const RelatorioCriarWrapper = styled.div<RelatorioCardType>`
57
57
  align-items: center;
58
58
  justify-content: end;
59
59
  flex-direction: column;
60
+ background-color: ${theme.colors.white};
60
61
 
61
62
  h2 {
62
63
  color: ${color};