pipesol-button 1.0.1-beta.8 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ActionButton.d.ts +52 -0
- package/dist/components/ActionButton.js +38 -0
- package/dist/components/ActionButton.js.map +1 -0
- package/dist/components/DownloadButton.d.ts +84 -48
- package/dist/components/DownloadButton.js +55 -43
- package/dist/components/DownloadButton.js.map +1 -1
- package/dist/components/FormButtonGroup.d.ts +42 -0
- package/dist/components/FormButtonGroup.js +53 -0
- package/dist/components/FormButtonGroup.js.map +1 -0
- package/dist/components/NavigationButton.d.ts +15 -9
- package/dist/components/NavigationButton.js +37 -33
- package/dist/components/NavigationButton.js.map +1 -1
- package/dist/components/PrimaryButton.d.ts +37 -0
- package/dist/components/PrimaryButton.js +48 -0
- package/dist/components/PrimaryButton.js.map +1 -0
- package/dist/components/StyledButton.d.ts +14 -0
- package/dist/components/StyledButton.js +48 -0
- package/dist/components/StyledButton.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/theme.d.ts +14 -23
- package/dist/theme.js +115 -35
- package/dist/theme.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/ButtonKind.d.ts +4 -0
- package/dist/types/ButtonKind.js +2 -0
- package/dist/types/ButtonKind.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ButtonKind } from "@/types/ButtonKind";
|
|
3
|
+
import { TypographyVariant } from "@mui/material/styles";
|
|
4
|
+
export interface ActionButtonProps {
|
|
5
|
+
kind?: ButtonKind;
|
|
6
|
+
width?: string;
|
|
7
|
+
height?: string;
|
|
8
|
+
padding?: string;
|
|
9
|
+
margin?: string;
|
|
10
|
+
text?: string;
|
|
11
|
+
icon?: React.ReactNode;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
boxShadow?: string;
|
|
14
|
+
background?: string;
|
|
15
|
+
backgroundHover?: string;
|
|
16
|
+
color?: string;
|
|
17
|
+
colorHover?: string;
|
|
18
|
+
borderRadius?: string;
|
|
19
|
+
variant?: TypographyVariant;
|
|
20
|
+
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Botão estilizado baseado no tema e com tipografia configurável via `variant`.
|
|
24
|
+
*
|
|
25
|
+
* @param {string} [text=""] Texto exibido dentro do botão.
|
|
26
|
+
* @param {TypographyVariant} [variant="body1"] Variante da tipografia usada no texto.
|
|
27
|
+
* @param {React.ReactNode} icon Ícone opcional exibido antes do texto.
|
|
28
|
+
* @param {'none' | 'primary' | 'secondary'} [kind="none"] Token visual aplicado ao botão.
|
|
29
|
+
* @param {string} [width="auto"] Largura do botão.
|
|
30
|
+
* @param {string} [height="auto"] Altura do botão.
|
|
31
|
+
* @param {string} [padding="12px 20px"] Espaçamento interno.
|
|
32
|
+
* @param {string} [margin="0"] Margem externa.
|
|
33
|
+
* @param {boolean} [disabled=false] Estado desabilitado.
|
|
34
|
+
* @param {string} [background="transparent"] Cor de fundo.
|
|
35
|
+
* @param {string} backgroundHover Cor de fundo no hover.
|
|
36
|
+
* @param {string} color Cor do texto.
|
|
37
|
+
* @param {string} colorHover Cor do texto no hover.
|
|
38
|
+
* @param {string} [borderRadius="0"] Raio da borda.
|
|
39
|
+
* @param {string} [boxShadow="none"] Sombra do botão.
|
|
40
|
+
* @param {Function} onClick Evento de clique.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```tsx
|
|
44
|
+
* <ActionButton
|
|
45
|
+
* text="Enviar"
|
|
46
|
+
* variant="h6"
|
|
47
|
+
* onClick={() => console.log("clicou")}
|
|
48
|
+
* />
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
declare const ActionButton: React.FC<ActionButtonProps>;
|
|
52
|
+
export default ActionButton;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import Typography from "@mui/material/Typography";
|
|
3
|
+
import { StyledButtonKind } from "./StyledButton";
|
|
4
|
+
/**
|
|
5
|
+
* Botão estilizado baseado no tema e com tipografia configurável via `variant`.
|
|
6
|
+
*
|
|
7
|
+
* @param {string} [text=""] Texto exibido dentro do botão.
|
|
8
|
+
* @param {TypographyVariant} [variant="body1"] Variante da tipografia usada no texto.
|
|
9
|
+
* @param {React.ReactNode} icon Ícone opcional exibido antes do texto.
|
|
10
|
+
* @param {'none' | 'primary' | 'secondary'} [kind="none"] Token visual aplicado ao botão.
|
|
11
|
+
* @param {string} [width="auto"] Largura do botão.
|
|
12
|
+
* @param {string} [height="auto"] Altura do botão.
|
|
13
|
+
* @param {string} [padding="12px 20px"] Espaçamento interno.
|
|
14
|
+
* @param {string} [margin="0"] Margem externa.
|
|
15
|
+
* @param {boolean} [disabled=false] Estado desabilitado.
|
|
16
|
+
* @param {string} [background="transparent"] Cor de fundo.
|
|
17
|
+
* @param {string} backgroundHover Cor de fundo no hover.
|
|
18
|
+
* @param {string} color Cor do texto.
|
|
19
|
+
* @param {string} colorHover Cor do texto no hover.
|
|
20
|
+
* @param {string} [borderRadius="0"] Raio da borda.
|
|
21
|
+
* @param {string} [boxShadow="none"] Sombra do botão.
|
|
22
|
+
* @param {Function} onClick Evento de clique.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <ActionButton
|
|
27
|
+
* text="Enviar"
|
|
28
|
+
* variant="h6"
|
|
29
|
+
* onClick={() => console.log("clicou")}
|
|
30
|
+
* />
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
const ActionButton = ({ kind = "none", width = "auto", height = "auto", padding = "12px 20px", margin = "0", text = "", icon, disabled = false, onClick, background = "transparent", backgroundHover, color, colorHover, borderRadius = "0", boxShadow = "none", variant = "body1", }) => {
|
|
34
|
+
return (_jsx(StyledButtonKind, { kind: kind, width: width, height: height, padding: padding, margin: margin, disabled: disabled, startIcon: icon, onClick: onClick, background: background, backgroundHover: backgroundHover, colorText: color, colorHover: colorHover, borderRadius: borderRadius, boxShadow: boxShadow, children: _jsx(Typography, { variant: variant, children: text }) }));
|
|
35
|
+
};
|
|
36
|
+
ActionButton.displayName = "ActionButton";
|
|
37
|
+
export default ActionButton;
|
|
38
|
+
//# sourceMappingURL=ActionButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActionButton.js","sourceRoot":"","sources":["../../src/components/ActionButton.tsx"],"names":[],"mappings":";AACA,OAAO,UAAU,MAAM,0BAA0B,CAAC;AAElD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAsBlD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,YAAY,GAAgC,CAAC,EACjD,IAAI,GAAG,MAAM,EACb,KAAK,GAAG,MAAM,EACd,MAAM,GAAG,MAAM,EACf,OAAO,GAAG,WAAW,EACrB,MAAM,GAAG,GAAG,EACZ,IAAI,GAAG,EAAE,EACT,IAAI,EACJ,QAAQ,GAAG,KAAK,EAChB,OAAO,EACP,UAAU,GAAG,aAAa,EAC1B,eAAe,EACf,KAAK,EACL,UAAU,EACV,YAAY,GAAG,GAAG,EAClB,SAAS,GAAG,MAAM,EAClB,OAAO,GAAG,OAAO,GAClB,EAAE,EAAE;IACH,OAAO,CACL,KAAC,gBAAgB,IACf,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,IAAI,EACf,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,UAAU,EACtB,eAAe,EAAE,eAAe,EAChC,SAAS,EAAE,KAAK,EAChB,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,SAAS,YAEpB,KAAC,UAAU,IAAC,OAAO,EAAE,OAAO,YAAG,IAAI,GAAc,GAChC,CACpB,CAAC;AACJ,CAAC,CAAC;AAEF,YAAY,CAAC,WAAW,GAAG,cAAc,CAAC;AAC1C,eAAe,YAAY,CAAC"}
|
|
@@ -1,78 +1,114 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Interface de propriedades para o componente `DownloadButton`.
|
|
4
|
+
*
|
|
5
|
+
* Use este botão para disponibilizar o download de um arquivo mantendo
|
|
6
|
+
* controle total sobre cores, raio de borda, sombra, dimensões e ícone.
|
|
7
|
+
*
|
|
8
|
+
* As propriedades marcadas com `@default` indicam o valor que será utilizado
|
|
9
|
+
* quando a prop não for fornecida ao componente.
|
|
4
10
|
*/
|
|
5
|
-
interface DownloadButtonProps {
|
|
11
|
+
export interface DownloadButtonProps {
|
|
6
12
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* - Pode ser um caminho relativo dentro do projeto (ex: `/arquivos/relatorio.pdf`),
|
|
10
|
-
* que o navegador tratará como download automático.
|
|
11
|
-
* - Pode ser uma URL absoluta/externa (ex: `https://exemplo.com/arquivo.zip`),
|
|
12
|
-
* que será aberta em nova aba para que o usuário faça o download.
|
|
13
|
+
* URL do arquivo a ser baixado.
|
|
13
14
|
*/
|
|
14
15
|
file: string;
|
|
15
|
-
/** Nome do arquivo salvo no computador (por exemplo, "meu-arquivo.pdf"). */
|
|
16
|
-
download: string;
|
|
17
|
-
/** Texto para acessibilidade (atributo `aria-label`). */
|
|
18
|
-
aria_label: string;
|
|
19
|
-
/** Cor de fundo padrão do botão (ex: `#1976d2` ou `transparent`). */
|
|
20
|
-
background_color?: string;
|
|
21
|
-
/** Cor de fundo quando o botão é focado/hover. Se não informado, usa a cor padrão. */
|
|
22
|
-
background_color_hover?: string;
|
|
23
|
-
/** Cor do texto padrão (ex: `#fff`). */
|
|
24
|
-
color: string;
|
|
25
|
-
/** Cor do texto no hover. Se não informado, usa a mesma cor padrão. */
|
|
26
|
-
color_hover?: string;
|
|
27
16
|
/**
|
|
28
|
-
*
|
|
29
|
-
* @default "transparent"
|
|
17
|
+
* Nome do arquivo que será salvo no disco.
|
|
30
18
|
*/
|
|
31
|
-
|
|
19
|
+
fileName: string;
|
|
32
20
|
/**
|
|
33
|
-
*
|
|
34
|
-
* @default "
|
|
21
|
+
* Cor de fundo do botão.
|
|
22
|
+
* @default "#1976d2"
|
|
35
23
|
*/
|
|
36
|
-
|
|
24
|
+
background?: string;
|
|
37
25
|
/**
|
|
38
|
-
*
|
|
26
|
+
* Cor de fundo exibida no estado hover.
|
|
27
|
+
* @default "#1565c0"
|
|
28
|
+
*/
|
|
29
|
+
backgroundHover?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Cor do texto do botão.
|
|
32
|
+
* @default "#fff"
|
|
33
|
+
*/
|
|
34
|
+
color?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Cor do texto exibida no estado hover.
|
|
37
|
+
* Se não informada, herda a mesma cor definida em `color`.
|
|
38
|
+
*/
|
|
39
|
+
colorHover?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Raio da borda do botão (qualquer valor CSS válido).
|
|
42
|
+
* @default "8px"
|
|
43
|
+
*/
|
|
44
|
+
borderRadius?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Sombra do botão (valor CSS de box-shadow).
|
|
39
47
|
* @default "none"
|
|
40
48
|
*/
|
|
41
|
-
|
|
42
|
-
/** Largura do botão (ex: `200px`, `100%`). */
|
|
43
|
-
width: string;
|
|
49
|
+
boxShadow?: string;
|
|
44
50
|
/**
|
|
45
|
-
*
|
|
46
|
-
* @default "0"
|
|
51
|
+
* Ícone opcional exibido à esquerda do conteúdo.
|
|
47
52
|
*/
|
|
48
|
-
|
|
53
|
+
icon?: React.ReactNode;
|
|
49
54
|
/**
|
|
50
|
-
*
|
|
51
|
-
* @default "8px 24px"
|
|
55
|
+
* Conteúdo textual do botão (recomendado utilizar `Typography`).
|
|
52
56
|
*/
|
|
53
|
-
padding?: string;
|
|
54
|
-
/** Conteúdo interno (texto ou elementos JSX). */
|
|
55
57
|
children: React.ReactNode;
|
|
58
|
+
/**
|
|
59
|
+
* Texto de acessibilidade que descreve a função do botão
|
|
60
|
+
* para leitores de tela (atributo `aria-label`).
|
|
61
|
+
*/
|
|
62
|
+
arialLabel: string;
|
|
63
|
+
/**
|
|
64
|
+
* Largura do botão (valor CSS).
|
|
65
|
+
* @default "auto"
|
|
66
|
+
*/
|
|
67
|
+
width?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Altura do botão (valor CSS).
|
|
70
|
+
* @default "fit-content"
|
|
71
|
+
*/
|
|
72
|
+
height?: string;
|
|
56
73
|
}
|
|
57
74
|
/**
|
|
58
|
-
*
|
|
75
|
+
* Botão de download customizável com suporte a ícone e conteúdo centralizado.
|
|
76
|
+
* O texto deve ser passado via `Typography` como children.
|
|
59
77
|
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
78
|
+
* ### Parâmetros
|
|
79
|
+
* @param {string} file URL do arquivo a ser baixado.
|
|
80
|
+
* @param {string} fileName Nome do arquivo que será salvo.
|
|
81
|
+
* @param {string} [background="#1976d2"] Cor de fundo padrão do botão. **@default** "#1976d2"
|
|
82
|
+
* @param {string} [backgroundHover="#1565c0"] Cor de fundo no hover. **@default** "#1565c0"
|
|
83
|
+
* @param {string} [color="#fff"] Cor do texto padrão. **@default** "#fff"
|
|
84
|
+
* @param {string} [colorHover] Cor do texto no hover (herda `color` quando ausente).
|
|
85
|
+
* @param {string} [borderRadius="8px"] Raio da borda do botão. **@default** "8px"
|
|
86
|
+
* @param {string} [boxShadow="none"] Sombra do botão. **@default** "none"
|
|
87
|
+
* @param {string} arialLabel Texto de acessibilidade (atributo `aria-label`).
|
|
88
|
+
* @param {React.ReactNode} [icon] Ícone opcional exibido à esquerda do conteúdo.
|
|
89
|
+
* @param {React.ReactNode} children Conteúdo do botão (ex.: `Typography`).
|
|
90
|
+
* @param {string} [width="auto"] Largura do botão (valor CSS). **@default** "auto"
|
|
91
|
+
* @param {string} [height="fit-content"] Altura do botão (valor CSS). **@default** "fit-content"
|
|
64
92
|
*
|
|
65
|
-
*
|
|
93
|
+
* @example
|
|
66
94
|
* ```tsx
|
|
95
|
+
* import { Typography } from '@mui/material';
|
|
96
|
+
* import { Download as DownloadIcon } from '@mui/icons-material';
|
|
97
|
+
*
|
|
67
98
|
* <DownloadButton
|
|
68
99
|
* file="/docs/manual.pdf"
|
|
69
|
-
*
|
|
70
|
-
*
|
|
100
|
+
* fileName="manual.pdf"
|
|
101
|
+
* arialLabel="Baixar manual do produto"
|
|
102
|
+
* background="#28a745"
|
|
103
|
+
* backgroundHover="#218838"
|
|
71
104
|
* color="#fff"
|
|
72
|
-
*
|
|
73
|
-
*
|
|
105
|
+
* borderRadius="12px"
|
|
106
|
+
* boxShadow="0 2px 8px rgba(0,0,0,0.15)"
|
|
107
|
+
* width="220px"
|
|
108
|
+
* height="44px"
|
|
109
|
+
* icon={<DownloadIcon />}
|
|
74
110
|
* >
|
|
75
|
-
* Baixar Manual
|
|
111
|
+
* <Typography variant="button">Baixar Manual</Typography>
|
|
76
112
|
* </DownloadButton>
|
|
77
113
|
* ```
|
|
78
114
|
*/
|
|
@@ -1,68 +1,80 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
2
|
import { styled } from '@mui/material/styles';
|
|
4
|
-
const
|
|
3
|
+
const StyledLink = styled('a', {
|
|
5
4
|
shouldForwardProp: (prop) => ![
|
|
6
|
-
'
|
|
7
|
-
'
|
|
5
|
+
'background',
|
|
6
|
+
'backgroundHover',
|
|
8
7
|
'color',
|
|
9
|
-
'
|
|
10
|
-
'
|
|
11
|
-
'
|
|
12
|
-
'border_color',
|
|
13
|
-
'color_hover',
|
|
8
|
+
'colorHover',
|
|
9
|
+
'borderRadius',
|
|
10
|
+
'boxShadow',
|
|
14
11
|
'width',
|
|
15
|
-
'
|
|
16
|
-
'boxshadow',
|
|
12
|
+
'height'
|
|
17
13
|
].includes(prop),
|
|
18
|
-
})(({
|
|
14
|
+
})(({ background, backgroundHover, color, colorHover, borderRadius, boxShadow, width, height }) => ({
|
|
19
15
|
width: width,
|
|
16
|
+
height: height,
|
|
17
|
+
display: 'inline-flex',
|
|
18
|
+
alignItems: 'center',
|
|
19
|
+
justifyContent: 'center',
|
|
20
|
+
gap: '8px',
|
|
21
|
+
background: background || '#1976d2',
|
|
22
|
+
color: color || '#fff',
|
|
23
|
+
borderRadius: borderRadius || '8px',
|
|
24
|
+
boxShadow: boxShadow || 'none',
|
|
25
|
+
padding: '8px 16px',
|
|
20
26
|
cursor: 'pointer',
|
|
21
27
|
textDecoration: 'none',
|
|
22
|
-
|
|
23
|
-
textAlign: 'center',
|
|
24
|
-
boxShadow: boxshadow,
|
|
25
|
-
backgroundColor: background_color,
|
|
26
|
-
color: color,
|
|
27
|
-
border: `1px solid ${border_color}`,
|
|
28
|
-
borderRadius: border_radius,
|
|
29
|
-
padding: padding,
|
|
30
|
-
margin: margin,
|
|
28
|
+
transition: 'all 0.3s ease',
|
|
31
29
|
'&:hover': {
|
|
32
|
-
|
|
33
|
-
color:
|
|
30
|
+
background: backgroundHover || '#1565c0',
|
|
31
|
+
color: colorHover || color || '#fff',
|
|
34
32
|
},
|
|
35
33
|
}));
|
|
36
34
|
/**
|
|
37
|
-
*
|
|
35
|
+
* Botão de download customizável com suporte a ícone e conteúdo centralizado.
|
|
36
|
+
* O texto deve ser passado via `Typography` como children.
|
|
38
37
|
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
38
|
+
* ### Parâmetros
|
|
39
|
+
* @param {string} file URL do arquivo a ser baixado.
|
|
40
|
+
* @param {string} fileName Nome do arquivo que será salvo.
|
|
41
|
+
* @param {string} [background="#1976d2"] Cor de fundo padrão do botão. **@default** "#1976d2"
|
|
42
|
+
* @param {string} [backgroundHover="#1565c0"] Cor de fundo no hover. **@default** "#1565c0"
|
|
43
|
+
* @param {string} [color="#fff"] Cor do texto padrão. **@default** "#fff"
|
|
44
|
+
* @param {string} [colorHover] Cor do texto no hover (herda `color` quando ausente).
|
|
45
|
+
* @param {string} [borderRadius="8px"] Raio da borda do botão. **@default** "8px"
|
|
46
|
+
* @param {string} [boxShadow="none"] Sombra do botão. **@default** "none"
|
|
47
|
+
* @param {string} arialLabel Texto de acessibilidade (atributo `aria-label`).
|
|
48
|
+
* @param {React.ReactNode} [icon] Ícone opcional exibido à esquerda do conteúdo.
|
|
49
|
+
* @param {React.ReactNode} children Conteúdo do botão (ex.: `Typography`).
|
|
50
|
+
* @param {string} [width="auto"] Largura do botão (valor CSS). **@default** "auto"
|
|
51
|
+
* @param {string} [height="fit-content"] Altura do botão (valor CSS). **@default** "fit-content"
|
|
43
52
|
*
|
|
44
|
-
*
|
|
53
|
+
* @example
|
|
45
54
|
* ```tsx
|
|
55
|
+
* import { Typography } from '@mui/material';
|
|
56
|
+
* import { Download as DownloadIcon } from '@mui/icons-material';
|
|
57
|
+
*
|
|
46
58
|
* <DownloadButton
|
|
47
59
|
* file="/docs/manual.pdf"
|
|
48
|
-
*
|
|
49
|
-
*
|
|
60
|
+
* fileName="manual.pdf"
|
|
61
|
+
* arialLabel="Baixar manual do produto"
|
|
62
|
+
* background="#28a745"
|
|
63
|
+
* backgroundHover="#218838"
|
|
50
64
|
* color="#fff"
|
|
51
|
-
*
|
|
52
|
-
*
|
|
65
|
+
* borderRadius="12px"
|
|
66
|
+
* boxShadow="0 2px 8px rgba(0,0,0,0.15)"
|
|
67
|
+
* width="220px"
|
|
68
|
+
* height="44px"
|
|
69
|
+
* icon={<DownloadIcon />}
|
|
53
70
|
* >
|
|
54
|
-
* Baixar Manual
|
|
71
|
+
* <Typography variant="button">Baixar Manual</Typography>
|
|
55
72
|
* </DownloadButton>
|
|
56
73
|
* ```
|
|
57
74
|
*/
|
|
58
|
-
const DownloadButton = ({
|
|
59
|
-
|
|
60
|
-
const backgroundColorHover = background_color_hover !== null && background_color_hover !== void 0 ? background_color_hover : backgroundColor;
|
|
61
|
-
const colorHover = color_hover !== null && color_hover !== void 0 ? color_hover : color;
|
|
62
|
-
// Se sua rota de download for algo como /api/files/[file]/download,
|
|
63
|
-
// você pode ajustar aqui:
|
|
64
|
-
const downloadHref = `${file}/download`;
|
|
65
|
-
return (_jsx(ButtonStyled, { href: downloadHref, download: download, width: width, background_color: backgroundColor, background_color_hover: backgroundColorHover, color: color, color_hover: colorHover, border_radius: border_radius, border_color: border_color, padding: padding, margin: margin, "aria-label": aria_label, boxshadow: box_shadow, children: children }));
|
|
75
|
+
const DownloadButton = ({ width = 'auto', height = 'fit-content', file, fileName, background, backgroundHover, color, colorHover, borderRadius, boxShadow, arialLabel, icon, children, }) => {
|
|
76
|
+
return (_jsxs(StyledLink, { href: file, download: fileName, background: background, backgroundHover: backgroundHover, color: color, colorHover: colorHover, borderRadius: borderRadius, boxShadow: boxShadow, "aria-label": arialLabel, width: width, height: height, children: [icon && _jsx("span", { children: icon }), children] }));
|
|
66
77
|
};
|
|
78
|
+
DownloadButton.displayName = 'DownloadButton';
|
|
67
79
|
export default DownloadButton;
|
|
68
80
|
//# sourceMappingURL=DownloadButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DownloadButton.js","sourceRoot":"","sources":["../../src/components/DownloadButton.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DownloadButton.js","sourceRoot":"","sources":["../../src/components/DownloadButton.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAuF9C,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,EAAE;IAC7B,iBAAiB,EAAE,CAAC,IAAI,EAAE,EAAE,CAC1B,CAAC;QACC,YAAY;QACZ,iBAAiB;QACjB,OAAO;QACP,YAAY;QACZ,cAAc;QACd,WAAW;QACX,OAAO;QACP,QAAQ;KACT,CAAC,QAAQ,CAAC,IAAc,CAAC;CAC7B,CAAC,CASC,CAAC,EAAE,UAAU,EAAE,eAAe,EAAE,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;IAClG,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,MAAM;IACd,OAAO,EAAE,aAAa;IACtB,UAAU,EAAE,QAAQ;IACpB,cAAc,EAAE,QAAQ;IACxB,GAAG,EAAE,KAAK;IACV,UAAU,EAAE,UAAU,IAAI,SAAS;IACnC,KAAK,EAAE,KAAK,IAAI,MAAM;IACtB,YAAY,EAAE,YAAY,IAAI,KAAK;IACnC,SAAS,EAAE,SAAS,IAAI,MAAM;IAC9B,OAAO,EAAE,UAAU;IACnB,MAAM,EAAE,SAAS;IACjB,cAAc,EAAE,MAAM;IACtB,UAAU,EAAE,eAAe;IAC3B,SAAS,EAAE;QACT,UAAU,EAAE,eAAe,IAAI,SAAS;QACxC,KAAK,EAAE,UAAU,IAAI,KAAK,IAAI,MAAM;KACrC;CACF,CAAC,CAAC,CAAC;AAEJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAM,cAAc,GAAkC,CAAC,EACrD,KAAK,GAAG,MAAM,EACd,MAAM,GAAG,aAAa,EACtB,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,eAAe,EACf,KAAK,EACL,UAAU,EACV,YAAY,EACZ,SAAS,EACT,UAAU,EACV,IAAI,EACJ,QAAQ,GACT,EAAE,EAAE;IACH,OAAO,CACL,MAAC,UAAU,IACT,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,UAAU,EACtB,eAAe,EAAE,eAAe,EAChC,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,SAAS,gBACR,UAAU,EACtB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,aAEb,IAAI,IAAI,yBAAO,IAAI,GAAQ,EAC3B,QAAQ,IACE,CACd,CAAC;AACJ,CAAC,CAAC;AAEF,cAAc,CAAC,WAAW,GAAG,gBAAgB,CAAC;AAE9C,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface FormButtonGroupProps {
|
|
3
|
+
onCancel?: () => void;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Agrupador de botões "Cancelar" e "Salvar" para uso **dentro** de formulários.
|
|
7
|
+
*
|
|
8
|
+
* O botão **"Salvar"** possui `type="submit"` e dispara o `onSubmit` do `<form>`.
|
|
9
|
+
*
|
|
10
|
+
* @param {() => void} [onCancel]
|
|
11
|
+
* Função disparada ao clicar em **"Cancelar"**.
|
|
12
|
+
* Ideal para fechar modal, navegar de volta, limpar estado ou desfazer alterações.
|
|
13
|
+
*
|
|
14
|
+
* @default onCancel = () => {}
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* import React from 'react';
|
|
19
|
+
* import Box from '@mui/material/Box';
|
|
20
|
+
* import TextField from '@mui/material/TextField';
|
|
21
|
+
* import { FormButtonGroup } from './FormButtonGroup';
|
|
22
|
+
*
|
|
23
|
+
* const MyForm: React.FC = () => {
|
|
24
|
+
* const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {
|
|
25
|
+
* event.preventDefault();
|
|
26
|
+
* // sua lógica de envio...
|
|
27
|
+
* console.log('Form submetido');
|
|
28
|
+
* };
|
|
29
|
+
*
|
|
30
|
+
* return (
|
|
31
|
+
* <Box component="form" onSubmit={handleSubmit} noValidate>
|
|
32
|
+
* <TextField label="Nome" fullWidth margin="normal" />
|
|
33
|
+
* <FormButtonGroup
|
|
34
|
+
* onCancel={() => console.log('cancelado')}
|
|
35
|
+
* />
|
|
36
|
+
* </Box>
|
|
37
|
+
* );
|
|
38
|
+
* };
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
declare const FormButtonGroup: React.FC<FormButtonGroupProps>;
|
|
42
|
+
export default FormButtonGroup;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { styled } from '@mui/material/styles';
|
|
3
|
+
import { StyledButtonKind } from './StyledButton';
|
|
4
|
+
const ActionsContainer = styled('div', {
|
|
5
|
+
shouldForwardProp: (prop) => !['onCancel'].includes(prop),
|
|
6
|
+
})(() => ({
|
|
7
|
+
display: 'flex',
|
|
8
|
+
gap: '8px',
|
|
9
|
+
justifyContent: 'flex-end',
|
|
10
|
+
width: '100%',
|
|
11
|
+
}));
|
|
12
|
+
/**
|
|
13
|
+
* Agrupador de botões "Cancelar" e "Salvar" para uso **dentro** de formulários.
|
|
14
|
+
*
|
|
15
|
+
* O botão **"Salvar"** possui `type="submit"` e dispara o `onSubmit` do `<form>`.
|
|
16
|
+
*
|
|
17
|
+
* @param {() => void} [onCancel]
|
|
18
|
+
* Função disparada ao clicar em **"Cancelar"**.
|
|
19
|
+
* Ideal para fechar modal, navegar de volta, limpar estado ou desfazer alterações.
|
|
20
|
+
*
|
|
21
|
+
* @default onCancel = () => {}
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```tsx
|
|
25
|
+
* import React from 'react';
|
|
26
|
+
* import Box from '@mui/material/Box';
|
|
27
|
+
* import TextField from '@mui/material/TextField';
|
|
28
|
+
* import { FormButtonGroup } from './FormButtonGroup';
|
|
29
|
+
*
|
|
30
|
+
* const MyForm: React.FC = () => {
|
|
31
|
+
* const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {
|
|
32
|
+
* event.preventDefault();
|
|
33
|
+
* // sua lógica de envio...
|
|
34
|
+
* console.log('Form submetido');
|
|
35
|
+
* };
|
|
36
|
+
*
|
|
37
|
+
* return (
|
|
38
|
+
* <Box component="form" onSubmit={handleSubmit} noValidate>
|
|
39
|
+
* <TextField label="Nome" fullWidth margin="normal" />
|
|
40
|
+
* <FormButtonGroup
|
|
41
|
+
* onCancel={() => console.log('cancelado')}
|
|
42
|
+
* />
|
|
43
|
+
* </Box>
|
|
44
|
+
* );
|
|
45
|
+
* };
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
const FormButtonGroup = ({ onCancel = () => { }, }) => {
|
|
49
|
+
return (_jsxs(ActionsContainer, { onCancel: onCancel, children: [_jsx(StyledButtonKind, { kind: "secondary", type: "button", onClick: onCancel, sx: { width: 'auto' }, children: "Cancelar" }), _jsx(StyledButtonKind, { kind: "primary", type: "submit", sx: { width: 'auto' }, children: "Salvar" })] }));
|
|
50
|
+
};
|
|
51
|
+
FormButtonGroup.displayName = 'FormButtonGroup';
|
|
52
|
+
export default FormButtonGroup;
|
|
53
|
+
//# sourceMappingURL=FormButtonGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormButtonGroup.js","sourceRoot":"","sources":["../../src/components/FormButtonGroup.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAMlD,MAAM,gBAAgB,GAAG,MAAM,CAAC,KAAK,EAAE;IACrC,iBAAiB,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAE,CAAC,UAAU,CAAc,CAAC,QAAQ,CAAC,IAAc,CAAC;CAClF,CAAC,CAAyC,GAAG,EAAE,CAAC,CAAC;IAChD,OAAO,EAAE,MAAM;IACf,GAAG,EAAE,KAAK;IACV,cAAc,EAAE,UAAU;IAC1B,KAAK,EAAE,MAAM;CACd,CAAC,CAAC,CAAC;AAEJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,eAAe,GAAmC,CAAC,EACvD,QAAQ,GAAG,GAAG,EAAE,GAAE,CAAC,GACpB,EAAE,EAAE;IACH,OAAO,CACL,MAAC,gBAAgB,IAAC,QAAQ,EAAE,QAAQ,aAClC,KAAC,gBAAgB,IACf,IAAI,EAAC,WAAW,EAChB,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,QAAQ,EACjB,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,yBAGJ,EAEnB,KAAC,gBAAgB,IACf,IAAI,EAAC,SAAS,EACd,IAAI,EAAC,QAAQ,EACb,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,uBAGJ,IACF,CACpB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,CAAC,WAAW,GAAG,iBAAiB,CAAC;AAChD,eAAe,eAAe,CAAC"}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { ButtonKind } from '@/types/ButtonKind';
|
|
2
3
|
/**
|
|
3
4
|
* Propriedades do componente `NavigationButton`.
|
|
4
5
|
*/
|
|
5
6
|
interface NavigationButtonProps {
|
|
7
|
+
/**
|
|
8
|
+
* Seleciona o conjunto de tokens do tema.
|
|
9
|
+
* @default "none"
|
|
10
|
+
*/
|
|
11
|
+
kind?: ButtonKind;
|
|
6
12
|
/**
|
|
7
13
|
* URL ou âncora para onde o botão deve navegar.
|
|
8
14
|
* - Se começar com `http`, abre em nova aba.
|
|
@@ -12,28 +18,28 @@ interface NavigationButtonProps {
|
|
|
12
18
|
/** Texto para acessibilidade (atributo `aria-label`). */
|
|
13
19
|
aria_label: string;
|
|
14
20
|
/** Cor de fundo padrão do botão (ex: `#1976d2` ou `transparent`). */
|
|
15
|
-
|
|
21
|
+
backgroundColor?: string;
|
|
16
22
|
/** Cor de fundo quando o botão é focado/hover. Se não informado, usa a cor padrão. */
|
|
17
|
-
|
|
23
|
+
backgroundColorHover?: string;
|
|
18
24
|
/** Cor do texto padrão (ex: `#fff`). */
|
|
19
|
-
color
|
|
25
|
+
color?: string;
|
|
20
26
|
/** Cor do texto no hover. Se não informado, usa a mesma cor padrão. */
|
|
21
|
-
|
|
27
|
+
colorHover?: string;
|
|
22
28
|
/**
|
|
23
|
-
*
|
|
24
|
-
* @default "
|
|
29
|
+
* Borda do Botao (1px solid #fff)
|
|
30
|
+
* @default "none"
|
|
25
31
|
*/
|
|
26
|
-
|
|
32
|
+
border?: string;
|
|
27
33
|
/**
|
|
28
34
|
* Raio de borda (ex: `8px`, `50%`).
|
|
29
35
|
* @default "0"
|
|
30
36
|
*/
|
|
31
|
-
|
|
37
|
+
borderRadius?: string;
|
|
32
38
|
/**
|
|
33
39
|
* Sombra CSS (ex: `0 2px 4px rgba(0,0,0,0.2)`).
|
|
34
40
|
* @default "none"
|
|
35
41
|
*/
|
|
36
|
-
|
|
42
|
+
boxShadow?: string;
|
|
37
43
|
/** Largura do botão (ex: `200px`, `100%`). */
|
|
38
44
|
width: string;
|
|
39
45
|
/**
|
|
@@ -3,54 +3,58 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { styled } from '@mui/material/styles';
|
|
4
4
|
const ButtonStyled = styled('a', {
|
|
5
5
|
shouldForwardProp: (prop) => ![
|
|
6
|
-
'
|
|
7
|
-
'
|
|
8
|
-
'
|
|
9
|
-
'
|
|
6
|
+
'kind',
|
|
7
|
+
'backgroundColor',
|
|
8
|
+
'backgroundColorHover',
|
|
9
|
+
'colorText',
|
|
10
|
+
'colorHover',
|
|
10
11
|
'padding',
|
|
11
|
-
'
|
|
12
|
-
'
|
|
13
|
-
'color_hover',
|
|
12
|
+
'borderRadius',
|
|
13
|
+
'border',
|
|
14
14
|
'width',
|
|
15
15
|
'margin',
|
|
16
|
-
'
|
|
16
|
+
'boxShadow',
|
|
17
17
|
].includes(prop),
|
|
18
|
-
})(({
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
18
|
+
})(({ theme, kind, backgroundColor, backgroundColorHover, colorText, colorHover, padding, borderRadius, border, width, margin, boxShadow, }) => {
|
|
19
|
+
const tokens = kind === "primary"
|
|
20
|
+
? theme.palette.custom.primaryButton
|
|
21
|
+
: (kind === "secondary" ? theme.palette.custom.secondaryButton : undefined);
|
|
22
|
+
return {
|
|
23
|
+
// Dimensões
|
|
24
|
+
width: width !== null && width !== void 0 ? width : "auto",
|
|
25
|
+
padding: padding !== null && padding !== void 0 ? padding : "12px 20px",
|
|
26
|
+
margin: margin !== null && margin !== void 0 ? margin : "0",
|
|
27
|
+
// Visual
|
|
28
|
+
borderRadius: tokens ? tokens.borderRadius : borderRadius,
|
|
29
|
+
boxShadow: tokens ? tokens.boxShadow : boxShadow,
|
|
30
|
+
border: border,
|
|
31
|
+
textDecoration: 'none',
|
|
32
|
+
textTransform: 'none',
|
|
33
|
+
cursor: 'pointer',
|
|
34
|
+
textAlign: 'center',
|
|
35
|
+
// Cores
|
|
36
|
+
background: tokens ? tokens.background : backgroundColor,
|
|
37
|
+
color: tokens ? tokens.color : colorText,
|
|
38
|
+
"&:hover": {
|
|
39
|
+
background: tokens ? tokens.backgroundHover : (backgroundColorHover !== null && backgroundColorHover !== void 0 ? backgroundColorHover : backgroundColor),
|
|
40
|
+
color: tokens ? tokens.colorHover : (colorHover !== null && colorHover !== void 0 ? colorHover : colorText),
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
});
|
|
36
44
|
/**
|
|
37
45
|
* Botão de navegação reutilizável.
|
|
38
46
|
* Cria um link estilizado que pode ser usado para redirecionar
|
|
39
47
|
* para páginas externas ou seções internas.
|
|
40
48
|
*/
|
|
41
|
-
const NavigationButton = ({ url, aria_label,
|
|
42
|
-
const backgroundColor = background_color !== null && background_color !== void 0 ? background_color : 'transparent';
|
|
43
|
-
const backgroundColorHover = background_color_hover !== null && background_color_hover !== void 0 ? background_color_hover : backgroundColor;
|
|
44
|
-
const colorHover = color_hover !== null && color_hover !== void 0 ? color_hover : color;
|
|
45
|
-
const borderRadius = border_radius;
|
|
49
|
+
const NavigationButton = ({ url, kind = "none", aria_label, backgroundColor, backgroundColorHover, color, colorHover, borderRadius = '0', border = 'none', boxShadow = 'none', width, margin = '0', padding = '8px 24px', children, }) => {
|
|
46
50
|
const marginButton = margin;
|
|
47
51
|
if (url.indexOf('http') !== -1) {
|
|
48
52
|
// Link externo: abre em nova aba
|
|
49
|
-
return (_jsx(ButtonStyled, { href: url, width: width,
|
|
53
|
+
return (_jsx(ButtonStyled, { kind: kind, href: url, width: width, backgroundColor: backgroundColor, backgroundColorHover: backgroundColorHover, color: color, colorHover: colorHover, borderRadius: borderRadius, border: border, padding: padding, margin: marginButton, "aria-label": aria_label, target: "_blank", boxShadow: boxShadow, rel: "noopener noreferrer", children: children }));
|
|
50
54
|
}
|
|
51
55
|
else {
|
|
52
56
|
// Link interno ou âncora
|
|
53
|
-
return (_jsx(ButtonStyled, { href: url, width: width,
|
|
57
|
+
return (_jsx(ButtonStyled, { kind: kind, href: url, width: width, backgroundColor: backgroundColor, backgroundColorHover: backgroundColorHover, color: color, colorHover: colorHover, borderRadius: borderRadius, border: border, padding: padding, margin: marginButton, "aria-label": aria_label, boxShadow: boxShadow, children: children }));
|
|
54
58
|
}
|
|
55
59
|
};
|
|
56
60
|
export default NavigationButton;
|