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.
@@ -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
- * Propriedades do componente `NavigationButton`.
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
- * **Arquivo a ser baixado**.
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
- * Cor da borda (ex: `#1976d2`).
29
- * @default "transparent"
17
+ * Nome do arquivo que será salvo no disco.
30
18
  */
31
- border_color?: string;
19
+ fileName: string;
32
20
  /**
33
- * Raio de borda (ex: `8px`, `50%`).
34
- * @default "0"
21
+ * Cor de fundo do botão.
22
+ * @default "#1976d2"
35
23
  */
36
- border_radius?: string;
24
+ background?: string;
37
25
  /**
38
- * Sombra CSS (ex: `0 2px 4px rgba(0,0,0,0.2)`).
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
- box_shadow?: string;
42
- /** Largura do botão (ex: `200px`, `100%`). */
43
- width: string;
49
+ boxShadow?: string;
44
50
  /**
45
- * Margem externa.
46
- * @default "0"
51
+ * Ícone opcional exibido à esquerda do conteúdo.
47
52
  */
48
- margin?: string;
53
+ icon?: React.ReactNode;
49
54
  /**
50
- * Padding interno.
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
- * Componente `DownloadButton`
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
- * Botão estilizado para **download de arquivos**.
61
- * Cria um link em formato de botão que pode:
62
- * - Abrir o arquivo em nova aba (para URLs externas iniciando com `http`);
63
- * - Acionar o download direto de um arquivo local/relativo.
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
- * Exemplo de uso:
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
- * aria_label="Baixar manual em PDF"
70
- * background_color="#1976d2"
100
+ * fileName="manual.pdf"
101
+ * arialLabel="Baixar manual do produto"
102
+ * background="#28a745"
103
+ * backgroundHover="#218838"
71
104
  * color="#fff"
72
- * border_radius="8px"
73
- * width="200px"
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
- 'use client';
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 ButtonStyled = styled('a', {
3
+ const StyledLink = styled('a', {
5
4
  shouldForwardProp: (prop) => ![
6
- 'background_color',
7
- 'background_color_hover',
5
+ 'background',
6
+ 'backgroundHover',
8
7
  'color',
9
- 'color_hover',
10
- 'padding',
11
- 'border_radius',
12
- 'border_color',
13
- 'color_hover',
8
+ 'colorHover',
9
+ 'borderRadius',
10
+ 'boxShadow',
14
11
  'width',
15
- 'margin',
16
- 'boxshadow',
12
+ 'height'
17
13
  ].includes(prop),
18
- })(({ background_color, background_color_hover, color, color_hover, padding, border_radius, border_color, width, margin, boxshadow, }) => ({
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
- textTransform: 'none',
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
- backgroundColor: background_color_hover,
33
- color: color_hover,
30
+ background: backgroundHover || '#1565c0',
31
+ color: colorHover || color || '#fff',
34
32
  },
35
33
  }));
36
34
  /**
37
- * Componente `DownloadButton`
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
- * Botão estilizado para **download de arquivos**.
40
- * Cria um link em formato de botão que pode:
41
- * - Abrir o arquivo em nova aba (para URLs externas iniciando com `http`);
42
- * - Acionar o download direto de um arquivo local/relativo.
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
- * Exemplo de uso:
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
- * aria_label="Baixar manual em PDF"
49
- * background_color="#1976d2"
60
+ * fileName="manual.pdf"
61
+ * arialLabel="Baixar manual do produto"
62
+ * background="#28a745"
63
+ * backgroundHover="#218838"
50
64
  * color="#fff"
51
- * border_radius="8px"
52
- * width="200px"
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 = ({ file, download, aria_label, background_color, background_color_hover, color, color_hover, border_radius = '0', border_color = 'transparent', box_shadow = 'none', width, margin = '0', padding = '8px 24px', children, }) => {
59
- const backgroundColor = background_color !== null && background_color !== void 0 ? background_color : 'transparent';
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":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,EAAE;IAC/B,iBAAiB,EAAE,CAAC,IAAI,EAAE,EAAE,CAC1B,CAAC;QACC,kBAAkB;QAClB,wBAAwB;QACxB,OAAO;QACP,aAAa;QACb,SAAS;QACT,eAAe;QACf,cAAc;QACd,aAAa;QACb,OAAO;QACP,QAAQ;QACR,WAAW;KACZ,CAAC,QAAQ,CAAC,IAAc,CAAC;CAC7B,CAAC,CAYA,CAAC,EACC,gBAAgB,EAChB,sBAAsB,EACtB,KAAK,EACL,WAAW,EACX,OAAO,EACP,aAAa,EACb,YAAY,EACZ,KAAK,EACL,MAAM,EACN,SAAS,GACV,EAAE,EAAE,CAAC,CAAC;IACL,KAAK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,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
- background_color?: string;
21
+ backgroundColor?: string;
16
22
  /** Cor de fundo quando o botão é focado/hover. Se não informado, usa a cor padrão. */
17
- background_color_hover?: string;
23
+ backgroundColorHover?: string;
18
24
  /** Cor do texto padrão (ex: `#fff`). */
19
- color: string;
25
+ color?: string;
20
26
  /** Cor do texto no hover. Se não informado, usa a mesma cor padrão. */
21
- color_hover?: string;
27
+ colorHover?: string;
22
28
  /**
23
- * Cor da borda (ex: `#1976d2`).
24
- * @default "transparent"
29
+ * Borda do Botao (1px solid #fff)
30
+ * @default "none"
25
31
  */
26
- border_color?: string;
32
+ border?: string;
27
33
  /**
28
34
  * Raio de borda (ex: `8px`, `50%`).
29
35
  * @default "0"
30
36
  */
31
- border_radius?: string;
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
- box_shadow?: string;
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
- 'background_color',
7
- 'background_color_hover',
8
- 'color',
9
- 'color_hover',
6
+ 'kind',
7
+ 'backgroundColor',
8
+ 'backgroundColorHover',
9
+ 'colorText',
10
+ 'colorHover',
10
11
  'padding',
11
- 'border_radius',
12
- 'border_color',
13
- 'color_hover',
12
+ 'borderRadius',
13
+ 'border',
14
14
  'width',
15
15
  'margin',
16
- 'boxshadow',
16
+ 'boxShadow',
17
17
  ].includes(prop),
18
- })(({ background_color, background_color_hover, color, color_hover, padding, border_radius, border_color, width, margin, boxshadow, }) => ({
19
- width: width,
20
- cursor: 'pointer',
21
- textDecoration: 'none',
22
- textTransform: 'none',
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,
31
- '&:hover': {
32
- backgroundColor: background_color_hover,
33
- color: color_hover,
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, background_color, background_color_hover, color, color_hover, border_radius = '0', border_color = 'transparent', box_shadow = 'none', width, margin = '0', padding = '8px 24px', children, }) => {
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, background_color: backgroundColor, background_color_hover: backgroundColorHover, color: color, color_hover: colorHover, border_radius: borderRadius, border_color: border_color, padding: padding, margin: marginButton, "aria-label": aria_label, target: "_blank", boxshadow: box_shadow, rel: "noopener noreferrer", children: children }));
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, background_color: backgroundColor, background_color_hover: backgroundColorHover, color: color, color_hover: colorHover, border_radius: borderRadius, border_color: border_color, padding: padding, margin: marginButton, "aria-label": aria_label, boxshadow: box_shadow, children: children }));
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;