wca-designsystem 0.0.58 → 0.0.59
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 +1 -1
- package/src/components/atomos/BarraDeProgresso/index.tsx +7 -1
- package/src/components/atomos/BarraDeProgresso/styles.ts +9 -3
- package/src/components/molecules/CardInicial/CardInicial.stories.tsx +18 -2
- package/src/components/molecules/CardInicial/index.tsx +29 -5
- package/src/components/molecules/CardInicial/styles.ts +19 -2
- package/src/components/molecules/Passos/Passos.stories.tsx +17 -5
- package/src/components/molecules/Passos/index.tsx +28 -11
package/package.json
CHANGED
|
@@ -4,16 +4,22 @@ import { Progress, ProgressSectionProps } from '@mantine/core';
|
|
|
4
4
|
|
|
5
5
|
export interface BarraDeProgressoProps extends ProgressSectionProps {
|
|
6
6
|
duracao: number;
|
|
7
|
+
height?: string;
|
|
7
8
|
animated?: boolean;
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
const BarraDeProgresso = ({
|
|
11
12
|
duracao,
|
|
12
13
|
animated = false,
|
|
14
|
+
height,
|
|
13
15
|
...props
|
|
14
16
|
}: BarraDeProgressoProps) => {
|
|
15
17
|
return (
|
|
16
|
-
<S.BarraDeProgressoContainer
|
|
18
|
+
<S.BarraDeProgressoContainer
|
|
19
|
+
height={height}
|
|
20
|
+
transitionDuration={duracao}
|
|
21
|
+
size="xl"
|
|
22
|
+
>
|
|
17
23
|
<Progress.Section
|
|
18
24
|
// {...props}
|
|
19
25
|
{...props}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { Progress } from '@mantine/core';
|
|
2
2
|
import styled, { css } from 'styled-components';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
interface BarraDeProgressoContainerProps {
|
|
5
|
+
height?: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const BarraDeProgressoContainer = styled(Progress.Root)<
|
|
9
|
+
BarraDeProgressoContainerProps
|
|
10
|
+
>`
|
|
11
|
+
${({ theme, height }) => css`
|
|
6
12
|
border-radius: 4px;
|
|
7
|
-
height:
|
|
13
|
+
height: ${height || '40px'};
|
|
8
14
|
width: 100%;
|
|
9
15
|
padding: 0;
|
|
10
16
|
background-color: ${theme.colors.gray['500']};
|
|
@@ -1,21 +1,37 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { theme } from '../../../styles/theme';
|
|
3
|
-
import CardInicial, { CardInicialProps } from './index';
|
|
3
|
+
import CardInicial, { avisoInfoProps, CardInicialProps } from './index';
|
|
4
4
|
import { Meta } from '@storybook/react';
|
|
5
5
|
import remuneracao from '../../../assets/imagens/icons/Lucratividade.svg';
|
|
6
|
+
import alerta from '../../../assets/imagens/icons/Alerta.svg';
|
|
7
|
+
import sucessoIcon from '../../../assets/imagens/icons/EscolheModulo.svg';
|
|
6
8
|
|
|
7
9
|
export default {
|
|
8
10
|
title: 'Components/moleculas/CardInicial',
|
|
9
11
|
component: CardInicial,
|
|
10
12
|
} as Meta;
|
|
11
13
|
|
|
14
|
+
const warning: avisoInfoProps = {
|
|
15
|
+
mensagem: 'Configuração Obrigatória',
|
|
16
|
+
icone: alerta,
|
|
17
|
+
corIcone: '#FFD638',
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const sucesso: avisoInfoProps = {
|
|
21
|
+
mensagem: 'Configuração realizada com sucesso!',
|
|
22
|
+
icone: sucessoIcon,
|
|
23
|
+
corIcone: '#03C668',
|
|
24
|
+
};
|
|
25
|
+
|
|
12
26
|
const props: CardInicialProps = {
|
|
13
27
|
color: theme.colors.blue,
|
|
14
28
|
descricao: 'exemplo descrição',
|
|
15
29
|
icone: remuneracao,
|
|
16
30
|
titulo: 'exemplo titulo',
|
|
17
31
|
onEntrar: () => console.log('test'),
|
|
18
|
-
acessoPermitido:
|
|
32
|
+
acessoPermitido: true,
|
|
33
|
+
children: 'Entrar',
|
|
34
|
+
avisoInfo: warning,
|
|
19
35
|
};
|
|
20
36
|
|
|
21
37
|
const Template: any = (args: CardInicialProps) => (
|
|
@@ -4,13 +4,22 @@ import * as S from './styles';
|
|
|
4
4
|
import { theme } from '../../../styles/theme';
|
|
5
5
|
import Botao from '../../atomos/Botao';
|
|
6
6
|
|
|
7
|
+
export type avisoInfoProps = {
|
|
8
|
+
mensagem: string;
|
|
9
|
+
icone: string;
|
|
10
|
+
corIcone: string;
|
|
11
|
+
};
|
|
12
|
+
|
|
7
13
|
export type CardInicialProps = {
|
|
8
14
|
titulo: string;
|
|
9
15
|
icone: string;
|
|
10
16
|
descricao: string;
|
|
11
17
|
color: string;
|
|
18
|
+
children: React.ReactNode;
|
|
12
19
|
acessoPermitido: boolean;
|
|
13
|
-
onEntrar: () => void
|
|
20
|
+
onEntrar: () => void;
|
|
21
|
+
aviso?: boolean;
|
|
22
|
+
avisoInfo?: avisoInfoProps;
|
|
14
23
|
};
|
|
15
24
|
const CardInicial = ({
|
|
16
25
|
descricao,
|
|
@@ -19,8 +28,10 @@ const CardInicial = ({
|
|
|
19
28
|
acessoPermitido,
|
|
20
29
|
titulo,
|
|
21
30
|
color,
|
|
31
|
+
children,
|
|
32
|
+
avisoInfo,
|
|
33
|
+
aviso = false,
|
|
22
34
|
}: CardInicialProps) => {
|
|
23
|
-
|
|
24
35
|
return (
|
|
25
36
|
<S.CardInicialWrapper>
|
|
26
37
|
<S.CardInicialHeader
|
|
@@ -46,10 +57,23 @@ const CardInicial = ({
|
|
|
46
57
|
onClick={() => onEntrar()}
|
|
47
58
|
disabled={!acessoPermitido}
|
|
48
59
|
color={color}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
</Botao>
|
|
60
|
+
children={children}
|
|
61
|
+
/>
|
|
52
62
|
</S.CardInicialFooter>
|
|
63
|
+
|
|
64
|
+
{aviso && (
|
|
65
|
+
<S.CardInicialWarning>
|
|
66
|
+
<Icone
|
|
67
|
+
width={20}
|
|
68
|
+
height={20}
|
|
69
|
+
svg={avisoInfo?.icone ?? ''}
|
|
70
|
+
fill={avisoInfo?.corIcone}
|
|
71
|
+
/>
|
|
72
|
+
<S.CardInicialWarningText>
|
|
73
|
+
{avisoInfo?.mensagem}
|
|
74
|
+
</S.CardInicialWarningText>
|
|
75
|
+
</S.CardInicialWarning>
|
|
76
|
+
)}
|
|
53
77
|
</S.CardInicialWrapper>
|
|
54
78
|
);
|
|
55
79
|
};
|
|
@@ -3,7 +3,7 @@ import styled, { css } from 'styled-components';
|
|
|
3
3
|
export const CardInicialWrapper = styled.div`
|
|
4
4
|
${({ theme }) => css`
|
|
5
5
|
width: 320px;
|
|
6
|
-
height:
|
|
6
|
+
height: min-content;
|
|
7
7
|
border-radius: 8px;
|
|
8
8
|
box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
|
|
9
9
|
background-color: ${theme.colors.white};
|
|
@@ -25,7 +25,7 @@ export const CardInicialBody = styled.div`
|
|
|
25
25
|
${({ theme }) => css`
|
|
26
26
|
text-align: center;
|
|
27
27
|
background-color: ${theme.colors.white};
|
|
28
|
-
padding:
|
|
28
|
+
padding: 25px 16px;
|
|
29
29
|
|
|
30
30
|
h2 {
|
|
31
31
|
font-size: ${theme.sizes.large};
|
|
@@ -52,3 +52,20 @@ export const CardInicialFooter = styled.div`
|
|
|
52
52
|
}
|
|
53
53
|
`}
|
|
54
54
|
`;
|
|
55
|
+
|
|
56
|
+
export const CardInicialWarning = styled.div`
|
|
57
|
+
${() => css`
|
|
58
|
+
display: flex;
|
|
59
|
+
flex-direction: column;
|
|
60
|
+
align-items: center;
|
|
61
|
+
justify-content: center;
|
|
62
|
+
padding-bottom: 20px;
|
|
63
|
+
`}
|
|
64
|
+
`;
|
|
65
|
+
|
|
66
|
+
export const CardInicialWarningText = styled.span`
|
|
67
|
+
${({ theme }) => css`
|
|
68
|
+
font-size: ${theme.sizes.xSmall};
|
|
69
|
+
color: ${theme.colors.gray[700]};
|
|
70
|
+
`}
|
|
71
|
+
`;
|
|
@@ -13,36 +13,48 @@ const passos: PassoProps[] = [
|
|
|
13
13
|
{
|
|
14
14
|
titulo: 'Execução do Desdobramento',
|
|
15
15
|
subTitulo: 'Duas linhas de resumo sobre este passo.',
|
|
16
|
-
id:
|
|
16
|
+
id: 0,
|
|
17
|
+
desabilitado: false,
|
|
17
18
|
},
|
|
18
19
|
{
|
|
19
20
|
titulo: 'Execução do Desdobramento',
|
|
20
21
|
subTitulo: 'Duas linhas de resumo sobre este passo.',
|
|
21
|
-
id:
|
|
22
|
+
id: 1,
|
|
23
|
+
desabilitado: true,
|
|
22
24
|
},
|
|
23
25
|
{
|
|
24
26
|
titulo: 'Execução do Desdobramento',
|
|
25
27
|
subTitulo: 'Duas linhas de resumo sobre este passo.',
|
|
26
|
-
id:
|
|
28
|
+
id: 2,
|
|
29
|
+
desabilitado: true,
|
|
27
30
|
},
|
|
28
31
|
{
|
|
29
32
|
titulo: 'Execução do Desdobramento',
|
|
30
33
|
subTitulo: 'Duas linhas de resumo sobre este passo.',
|
|
31
|
-
id:
|
|
34
|
+
id: 3,
|
|
35
|
+
desabilitado: true,
|
|
32
36
|
},
|
|
33
37
|
{
|
|
34
38
|
titulo: 'Execução do Desdobramento',
|
|
35
39
|
subTitulo: 'Duas linhas de resumo sobre este passo.',
|
|
36
|
-
id:
|
|
40
|
+
id: 4,
|
|
41
|
+
desabilitado: true,
|
|
37
42
|
},
|
|
38
43
|
];
|
|
39
44
|
|
|
40
45
|
const props = {
|
|
41
46
|
ciclo: 'jan/23',
|
|
47
|
+
onStepClick: () => console.log('aqui'),
|
|
42
48
|
passo: 1,
|
|
43
49
|
setPasso: () => props.passo + 1,
|
|
44
50
|
passos: passos,
|
|
45
51
|
color: theme.colors.blue,
|
|
52
|
+
moreButtons: [
|
|
53
|
+
{
|
|
54
|
+
label: 'Sincronizar Dados',
|
|
55
|
+
onClick: () => console.log('Sincronizado'),
|
|
56
|
+
},
|
|
57
|
+
],
|
|
46
58
|
};
|
|
47
59
|
|
|
48
60
|
const Template: any = (args: PassosProps) => <Passos {...args} />;
|
|
@@ -23,6 +23,13 @@ export interface PassosProps extends Omit<StepperProps, 'children' | 'active'> {
|
|
|
23
23
|
onClickSteep?: (id: number) => void;
|
|
24
24
|
ciclo: string;
|
|
25
25
|
color?: string;
|
|
26
|
+
moreButtons?: Array<{
|
|
27
|
+
label: string;
|
|
28
|
+
onClick: () => void;
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
variant?: string;
|
|
31
|
+
color?: string;
|
|
32
|
+
}>;
|
|
26
33
|
}
|
|
27
34
|
|
|
28
35
|
function Passos({
|
|
@@ -31,6 +38,7 @@ function Passos({
|
|
|
31
38
|
setPasso,
|
|
32
39
|
ciclo,
|
|
33
40
|
onClickSteep,
|
|
41
|
+
moreButtons,
|
|
34
42
|
color = theme.colors.blue,
|
|
35
43
|
...props
|
|
36
44
|
}: PassosProps) {
|
|
@@ -41,6 +49,10 @@ function Passos({
|
|
|
41
49
|
[passo]
|
|
42
50
|
);
|
|
43
51
|
|
|
52
|
+
const verificaProximoPasso = useCallback((passo: number) => {
|
|
53
|
+
return passos[passo + 1]?.desabilitado === true;
|
|
54
|
+
}, []);
|
|
55
|
+
|
|
44
56
|
const steepClasseChanger = useCallback(
|
|
45
57
|
(passoId: number, passoAtivo: boolean) => {
|
|
46
58
|
const classes = {
|
|
@@ -72,16 +84,7 @@ function Passos({
|
|
|
72
84
|
<Icone svg={anterior} fill={theme.colors.white} />
|
|
73
85
|
</ActionIcon>
|
|
74
86
|
</S.BotaoEsquerda>
|
|
75
|
-
<S.PassoSteep
|
|
76
|
-
{...props}
|
|
77
|
-
color={color}
|
|
78
|
-
active={passo}
|
|
79
|
-
onStepClick={e => {
|
|
80
|
-
setPasso(e);
|
|
81
|
-
onClickSteep!(e);
|
|
82
|
-
}}
|
|
83
|
-
allowNextStepsSelect={true}
|
|
84
|
-
>
|
|
87
|
+
<S.PassoSteep {...props} color={color} active={passo}>
|
|
85
88
|
{passos?.map(passoMap => (
|
|
86
89
|
<Stepper.Step
|
|
87
90
|
completedIcon={<>{passoMap.id + 1}</>}
|
|
@@ -151,11 +154,25 @@ function Passos({
|
|
|
151
154
|
Ciclo:<span>{ciclo}</span>{' '}
|
|
152
155
|
</p>
|
|
153
156
|
|
|
157
|
+
{moreButtons?.map((button, index) => (
|
|
158
|
+
<Botao
|
|
159
|
+
key={index}
|
|
160
|
+
tipo="default"
|
|
161
|
+
variant={button.variant || 'outline'}
|
|
162
|
+
color={button.color || color}
|
|
163
|
+
disabled={button.disabled || false}
|
|
164
|
+
onClick={button.onClick}
|
|
165
|
+
radius={'8px'}
|
|
166
|
+
>
|
|
167
|
+
{button.label}
|
|
168
|
+
</Botao>
|
|
169
|
+
))}
|
|
170
|
+
|
|
154
171
|
<Botao
|
|
155
172
|
variant="outline"
|
|
156
173
|
color={color}
|
|
157
174
|
radius={'8px'}
|
|
158
|
-
disabled={passo === passos.length}
|
|
175
|
+
disabled={passo === passos.length || verificaProximoPasso(passo)}
|
|
159
176
|
leftSection={<Icone svg={proximo} fill={color} />}
|
|
160
177
|
onClick={() => setPasso(passo + 1)}
|
|
161
178
|
tipo="default"
|