pipesol-button 1.0.14-beta.1 → 1.0.14-beta.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/README.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  Este projeto é uma biblioteca React preparada para publicação no npm.
4
4
  Essa biblioteca contem componentes de botao.
5
+
6
+ - ActionButton: Botão de ação estilizado baseado no tema e com tipografia configurável via `variant`.
7
+ - FormButtonGroup: Agrupador de botões "Deletar", Cancelar" e "Salvar" para uso **dentro** de formulários.
8
+ - NavigationButton: Botão de navegação reutilizável baseado em um link (`<a>`), estilizado com Material UI.
9
+ - NavigationLink: Link de navegação reutilizável baseado em um link (`<a>`), estilizado com Material UI.
10
+
5
11
 
6
12
  Abaixo está o passo a passo para publicar ou atualizar a lib.
7
13
 
@@ -35,4 +41,4 @@
35
41
 
36
42
  # Comando:
37
43
 
38
- 1. npm view pipesol-button versions --json - verifica todas as versões publicadas no npm.
44
+ 1. npm view pipesol-button versions --json - verifica todas as versões publicadas no npm.
@@ -1,28 +1,20 @@
1
1
  import React from "react";
2
2
  import { ButtonKind } from "@/types/ButtonKind";
3
3
  import { TypographyVariant } from "@mui/material/styles";
4
- export interface ActionButtonProps {
4
+ import { CommonStyleProps } from "@/types/style/CommonStyleProps";
5
+ export interface ActionButtonProps extends CommonStyleProps {
5
6
  kind?: ButtonKind;
6
- width?: string;
7
- height?: string;
8
- padding?: string;
9
- margin?: string;
10
- text?: string;
7
+ text: string;
8
+ variant?: TypographyVariant;
9
+ aria_label: string;
11
10
  icon?: React.ReactNode;
12
11
  disabled?: boolean;
13
- boxShadow?: string;
14
- background?: string;
15
- backgroundHover?: string;
16
- color?: string;
17
- colorHover?: string;
18
- borderRadius?: string;
19
- variant?: TypographyVariant;
20
12
  onClick?: React.MouseEventHandler<HTMLButtonElement>;
21
13
  }
22
14
  /**
23
15
  * Botão estilizado baseado no tema e com tipografia configurável via `variant`.
24
16
  *
25
- * @param {string} [text=""] Texto exibido dentro do botão.
17
+ * @param {string} text Texto exibido dentro do botão.
26
18
  * @param {TypographyVariant} [variant="body1"] Variante da tipografia usada no texto.
27
19
  * @param {React.ReactNode} icon Ícone opcional exibido antes do texto.
28
20
  * @param {'none' | 'primary' | 'secondary'} [kind="none"] Token visual aplicado ao botão.
@@ -33,11 +25,12 @@ export interface ActionButtonProps {
33
25
  * @param {boolean} [disabled=false] Estado desabilitado.
34
26
  * @param {string} [background="transparent"] Cor de fundo.
35
27
  * @param {string} backgroundHover Cor de fundo no hover.
36
- * @param {string} color Cor do texto.
28
+ * @param {string} colorText Cor do texto.
37
29
  * @param {string} colorHover Cor do texto no hover.
38
30
  * @param {string} [borderRadius="0"] Raio da borda.
39
31
  * @param {string} [boxShadow="none"] Sombra do botão.
40
32
  * @param {Function} onClick Evento de clique.
33
+ * @param {string} aria_label Texto para acessibilidade.
41
34
  *
42
35
  * @example
43
36
  * ```tsx
@@ -4,7 +4,7 @@ import { StyledButtonKind } from "./StyledButton";
4
4
  /**
5
5
  * Botão estilizado baseado no tema e com tipografia configurável via `variant`.
6
6
  *
7
- * @param {string} [text=""] Texto exibido dentro do botão.
7
+ * @param {string} text Texto exibido dentro do botão.
8
8
  * @param {TypographyVariant} [variant="body1"] Variante da tipografia usada no texto.
9
9
  * @param {React.ReactNode} icon Ícone opcional exibido antes do texto.
10
10
  * @param {'none' | 'primary' | 'secondary'} [kind="none"] Token visual aplicado ao botão.
@@ -15,11 +15,12 @@ import { StyledButtonKind } from "./StyledButton";
15
15
  * @param {boolean} [disabled=false] Estado desabilitado.
16
16
  * @param {string} [background="transparent"] Cor de fundo.
17
17
  * @param {string} backgroundHover Cor de fundo no hover.
18
- * @param {string} color Cor do texto.
18
+ * @param {string} colorText Cor do texto.
19
19
  * @param {string} colorHover Cor do texto no hover.
20
20
  * @param {string} [borderRadius="0"] Raio da borda.
21
21
  * @param {string} [boxShadow="none"] Sombra do botão.
22
22
  * @param {Function} onClick Evento de clique.
23
+ * @param {string} aria_label Texto para acessibilidade.
23
24
  *
24
25
  * @example
25
26
  * ```tsx
@@ -30,8 +31,8 @@ import { StyledButtonKind } from "./StyledButton";
30
31
  * />
31
32
  * ```
32
33
  */
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 }) }));
34
+ const ActionButton = ({ kind = "none", width = "auto", height = "auto", padding = "12px 20px", margin = "0", text, icon, disabled = false, onClick, background = "transparent", backgroundHover, colorText, colorHover, borderRadius = "0", boxShadow = "none", variant = "body1", aria_label }) => {
35
+ return (_jsx(StyledButtonKind, { kind: kind, width: width, height: height, padding: padding, margin: margin, disabled: disabled, startIcon: icon, onClick: onClick, background: background, backgroundHover: backgroundHover, colorText: colorText, colorHover: colorHover, borderRadius: borderRadius, boxShadow: boxShadow, "aria-label": aria_label, children: _jsx(Typography, { variant: variant, children: text }) }));
35
36
  };
36
37
  ActionButton.displayName = "ActionButton";
37
38
  export default ActionButton;
@@ -1 +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
+ {"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;AAclD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;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,EACJ,IAAI,EACJ,QAAQ,GAAG,KAAK,EAChB,OAAO,EACP,UAAU,GAAG,aAAa,EAC1B,eAAe,EACf,SAAS,EACT,UAAU,EACV,YAAY,GAAG,GAAG,EAClB,SAAS,GAAG,MAAM,EAClB,OAAO,GAAG,OAAO,EACjB,UAAU,EACX,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,SAAS,EACpB,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,SAAS,gBACR,UAAU,YAEtB,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,14 +1,17 @@
1
1
  import React from 'react';
2
+ import { TypographyVariant } from '@mui/material/styles';
2
3
  export interface FormButtonGroupProps {
3
4
  showDeleteButton?: boolean;
5
+ variant?: TypographyVariant;
4
6
  onCancel?: () => void;
5
7
  onDelete?: () => void;
6
8
  }
7
9
  /**
8
- * Agrupador de botões "Cancelar" e "Salvar" para uso **dentro** de formulários.
10
+ * Agrupador de botões "Deletar", Cancelar" e "Salvar" para uso **dentro** de formulários.
9
11
  *
10
12
  * O botão **"Salvar"** possui `type="submit"` e dispara o `onSubmit` do `<form>`.
11
13
  *
14
+ * @param {TypographyVariant} [variant="body1"] Variante da tipografia usada no texto.
12
15
  * @param {boolean} [showDeleteButton="false"] Exibir botao Deletar.
13
16
  * @param {() => void} [onCancel]
14
17
  * Função disparada ao clicar em **"Cancelar"**.
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { styled } from '@mui/material/styles';
3
3
  import { StyledButtonKind } from './StyledButton';
4
+ import { Typography } from '@mui/material';
4
5
  const ActionsContainerWithDelete = styled('div', {
5
6
  shouldForwardProp: (prop) => !['onCancel'].includes(prop),
6
7
  })(() => ({
@@ -16,14 +17,15 @@ const ActionsContainer = styled('div', {
16
17
  display: 'flex',
17
18
  flexDirection: 'row',
18
19
  gap: '16px',
19
- justifyItems: 'flex-end',
20
+ justifyContent: 'flex-end',
20
21
  width: '100%',
21
22
  }));
22
23
  /**
23
- * Agrupador de botões "Cancelar" e "Salvar" para uso **dentro** de formulários.
24
+ * Agrupador de botões "Deletar", Cancelar" e "Salvar" para uso **dentro** de formulários.
24
25
  *
25
26
  * O botão **"Salvar"** possui `type="submit"` e dispara o `onSubmit` do `<form>`.
26
27
  *
28
+ * @param {TypographyVariant} [variant="body1"] Variante da tipografia usada no texto.
27
29
  * @param {boolean} [showDeleteButton="false"] Exibir botao Deletar.
28
30
  * @param {() => void} [onCancel]
29
31
  * Função disparada ao clicar em **"Cancelar"**.
@@ -63,12 +65,12 @@ const ActionsContainer = styled('div', {
63
65
  * };
64
66
  * ```
65
67
  */
66
- const FormButtonGroup = ({ showDeleteButton = false, onCancel = () => { }, onDelete = () => { }, }) => {
68
+ const FormButtonGroup = ({ showDeleteButton = false, variant = "body1", onCancel = () => { }, onDelete = () => { }, }) => {
67
69
  if (showDeleteButton) {
68
- return (_jsxs(ActionsContainerWithDelete, { onCancel: onCancel, children: [_jsx(StyledButtonKind, { kind: "delete", type: "button", onClick: onDelete, sx: { width: 'auto' }, children: "Deletar" }), _jsx(StyledButtonKind, { kind: "secondary", type: "button", onClick: onCancel, sx: { width: 'auto' }, children: "Cancelar" }), _jsx(StyledButtonKind, { kind: "primary", type: "submit", sx: { width: 'auto' }, children: "Salvar" })] }));
70
+ return (_jsxs(ActionsContainerWithDelete, { onCancel: onCancel, children: [_jsx(StyledButtonKind, { kind: "delete", type: "button", onClick: onDelete, "aria-label": "botao Deletar", sx: { width: 'auto' }, children: _jsx(Typography, { variant: variant, children: "Deletar" }) }), _jsx(StyledButtonKind, { kind: "secondary", type: "button", onClick: onCancel, "aria-label": "botao Cancelar", sx: { width: 'auto' }, children: _jsx(Typography, { variant: variant, children: "Cancelar" }) }), _jsx(StyledButtonKind, { kind: "primary", type: "submit", "aria-label": "botao Salvar", sx: { width: 'auto' }, children: _jsx(Typography, { variant: variant, children: "Salvar" }) })] }));
69
71
  }
70
72
  else {
71
- 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" })] }));
73
+ return (_jsxs(ActionsContainer, { onCancel: onCancel, children: [_jsx(StyledButtonKind, { kind: "secondary", type: "button", "aria-label": "botao Cancelar", onClick: onCancel, sx: { width: 'auto' }, children: _jsx(Typography, { variant: variant, children: "Cancelar" }) }), _jsx(StyledButtonKind, { kind: "primary", type: "submit", "aria-label": "botao Salvar", sx: { width: 'auto' }, children: _jsx(Typography, { variant: variant, children: "Salvar" }) })] }));
72
74
  }
73
75
  };
74
76
  FormButtonGroup.displayName = 'FormButtonGroup';
@@ -1 +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;AAQlD,MAAM,0BAA0B,GAAG,MAAM,CAAC,KAAK,EAAE;IAC/C,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,mBAAmB,EAAE,eAAe;I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AChB,IAAI,EAAC,QAAQ,gBACF,gBAAgB,EAC3B,OAAO,EAAE,QAAQ,EACjB,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,YAErB,KAAC,UAAU,IAAC,OAAO,EAAE,OAAO,yBAAuB,GAClC,EAEnB,KAAC,gBAAgB,IACf,IAAI,EAAC,SAAS,EACd,IAAI,EAAC,QAAQ,gBACF,cAAc,EACzB,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,YAErB,KAAC,UAAU,IAAC,OAAO,EAAE,OAAO,uBAAqB,GAChC,IACF,CACpB,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,CAAC,WAAW,GAAG,iBAAiB,CAAC;AAChD,eAAe,eAAe,CAAC"}
@@ -1,5 +1,14 @@
1
1
  import React from 'react';
2
+ import { TypographyVariant } from '@mui/material/styles';
2
3
  import { ButtonKind } from '../types/ButtonKind';
4
+ import { CommonStyleProps } from '@/types/style/CommonStyleProps';
5
+ interface NavigationButtonProps extends CommonStyleProps {
6
+ kind?: ButtonKind;
7
+ variant?: TypographyVariant;
8
+ text: string;
9
+ aria_label: string;
10
+ url: string;
11
+ }
3
12
  /**
4
13
  * Botão de navegação reutilizável baseado em um link (`<a>`), estilizado com Material UI.
5
14
  *
@@ -10,9 +19,9 @@ import { ButtonKind } from '../types/ButtonKind';
10
19
  * @param {ButtonKind} [kind="none"] Tipo de botão baseado nos tokens do tema.
11
20
  * @param {string} url URL ou âncora de destino.
12
21
  * @param {string} aria_label Texto para acessibilidade.
13
- * @param {string} [backgroundColor] Cor de fundo do botão.
14
- * @param {string} [backgroundColorHover] Cor de fundo no hover.
15
- * @param {string} [color] Cor do texto.
22
+ * @param {string} [background] Cor de fundo do botão.
23
+ * @param {string} [backgroundHover] Cor de fundo no hover.
24
+ * @param {string} [colorText] Cor do texto.
16
25
  * @param {string} [colorHover] Cor do texto no hover.
17
26
  * @param {string} [border="none"] Borda do botão.
18
27
  * @param {string} [borderRadius="0"] Raio da borda.
@@ -20,7 +29,8 @@ import { ButtonKind } from '../types/ButtonKind';
20
29
  * @param {string} width Largura do botão.
21
30
  * @param {string} [margin="0"] Margem externa.
22
31
  * @param {string} [padding="8px 24px"] Espaçamento interno.
23
- * @param {React.ReactNode} children Conteúdo interno do botão.
32
+ * @param {string} [text] Texto do botão.
33
+ * @param {TypographyVariant} [variant="body1"] Variante da tipografia usada no texto.
24
34
  *
25
35
  * @example
26
36
  * ```tsx
@@ -34,21 +44,5 @@ import { ButtonKind } from '../types/ButtonKind';
34
44
  * </NavigationButton>
35
45
  * ```
36
46
  */
37
- interface NavigationButtonProps {
38
- kind?: ButtonKind;
39
- url: string;
40
- aria_label: string;
41
- backgroundColor?: string;
42
- backgroundColorHover?: string;
43
- color?: string;
44
- colorHover?: string;
45
- border?: string;
46
- borderRadius?: string;
47
- boxShadow?: string;
48
- width: string;
49
- margin?: string;
50
- padding?: string;
51
- children: React.ReactNode;
52
- }
53
47
  declare const NavigationButton: React.FC<NavigationButtonProps>;
54
48
  export default NavigationButton;
@@ -2,6 +2,7 @@
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { styled } from '@mui/material/styles';
4
4
  import { COMMON_STYLE_FORWARD_PROPS } from '../types/CommonForwardProps';
5
+ import { Typography } from '@mui/material';
5
6
  const ButtonStyled = styled('a', {
6
7
  shouldForwardProp: (prop) => !['kind', ...COMMON_STYLE_FORWARD_PROPS].includes(prop),
7
8
  })(({ theme, kind, background, backgroundHover, colorText, colorHover, padding, borderRadius, border, width, margin, boxShadow, }) => {
@@ -33,11 +34,46 @@ const ButtonStyled = styled('a', {
33
34
  },
34
35
  };
35
36
  });
36
- const NavigationButton = ({ url, kind = 'none', aria_label, backgroundColor, backgroundColorHover, color, colorHover, borderRadius = '0', border = 'none', boxShadow = 'none', width, margin = '0', padding = '8px 24px', children, }) => {
37
+ /**
38
+ * Botão de navegação reutilizável baseado em um link (`<a>`), estilizado com Material UI.
39
+ *
40
+ * Regras de navegação:
41
+ * - Se `url` contiver `http`, o link é tratado como externo e abre em nova aba.
42
+ * - Caso contrário, é tratado como link interno ou âncora.
43
+ *
44
+ * @param {ButtonKind} [kind="none"] Tipo de botão baseado nos tokens do tema.
45
+ * @param {string} url URL ou âncora de destino.
46
+ * @param {string} aria_label Texto para acessibilidade.
47
+ * @param {string} [background] Cor de fundo do botão.
48
+ * @param {string} [backgroundHover] Cor de fundo no hover.
49
+ * @param {string} [colorText] Cor do texto.
50
+ * @param {string} [colorHover] Cor do texto no hover.
51
+ * @param {string} [border="none"] Borda do botão.
52
+ * @param {string} [borderRadius="0"] Raio da borda.
53
+ * @param {string} [boxShadow="none"] Sombra do botão.
54
+ * @param {string} width Largura do botão.
55
+ * @param {string} [margin="0"] Margem externa.
56
+ * @param {string} [padding="8px 24px"] Espaçamento interno.
57
+ * @param {string} [text] Texto do botão.
58
+ * @param {TypographyVariant} [variant="body1"] Variante da tipografia usada no texto.
59
+ *
60
+ * @example
61
+ * ```tsx
62
+ * <NavigationButton
63
+ * kind="primary"
64
+ * url="#contato"
65
+ * aria_label="Ir para contato"
66
+ * width="fit-content"
67
+ * >
68
+ * Fale conosco
69
+ * </NavigationButton>
70
+ * ```
71
+ */
72
+ const NavigationButton = ({ url, text, kind = 'none', aria_label, background, backgroundHover, colorText, colorHover, borderRadius = '0', border = 'none', boxShadow = 'none', width, margin = '0', padding = '8px 24px', variant = "body1", }) => {
37
73
  if (url.includes('http')) {
38
- return (_jsx(ButtonStyled, { kind: kind, href: url, width: width, background: backgroundColor, backgroundHover: backgroundColorHover, color: color, colorHover: colorHover, borderRadius: borderRadius, border: border, padding: padding, margin: margin, "aria-label": aria_label, target: "_blank", rel: "noopener noreferrer", boxShadow: boxShadow, children: children }));
74
+ return (_jsx(ButtonStyled, { kind: kind, href: url, width: width, background: background, backgroundHover: backgroundHover, color: colorText, colorHover: colorHover, borderRadius: borderRadius, border: border, padding: padding, margin: margin, "aria-label": aria_label, target: "_blank", rel: "noopener noreferrer", boxShadow: boxShadow, children: _jsx(Typography, { variant: variant, children: text }) }));
39
75
  }
40
- return (_jsx(ButtonStyled, { kind: kind, href: url, width: width, background: backgroundColor, backgroundHover: backgroundColorHover, color: color, colorHover: colorHover, borderRadius: borderRadius, border: border, padding: padding, margin: margin, "aria-label": aria_label, boxShadow: boxShadow, children: children }));
76
+ return (_jsx(ButtonStyled, { kind: kind, href: url, width: width, background: background, backgroundHover: backgroundHover, color: colorText, colorHover: colorHover, borderRadius: borderRadius, border: border, padding: padding, margin: margin, "aria-label": aria_label, boxShadow: boxShadow, children: _jsx(Typography, { variant: variant, children: text }) }));
41
77
  };
42
78
  NavigationButton.displayName = 'NavigationButton';
43
79
  export default NavigationButton;
@@ -1 +1 @@
1
- {"version":3,"file":"NavigationButton.js","sourceRoot":"","sources":["../../src/components/NavigationButton.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAG9C,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AAEzE,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,EAAE;IAC/B,iBAAiB,EAAE,CAAC,IAAI,EAAE,EAAE,CAC1B,CAAC,CAAE,MAAM,EAAE,GAAG,0BAA0B,CAAE,CAAC,QAAQ,CAAC,IAAc,CAAC;CACtE,CAAC,CACA,CAAC,EACC,KAAK,EACL,IAAI,EACJ,UAAU,EACV,eAAe,EACf,SAAS,EACT,UAAU,EACV,OAAO,EACP,YAAY,EACZ,MAAM,EACN,KAAK,EACL,MAAM,EACN,SAAS,GACV,EAAE,EAAE;IACH,MAAM,MAAM,GACV,IAAI,KAAK,SAAS;QAChB,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa;QACpC,CAAC,CAAC,IAAI,KAAK,WAAW;YACtB,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,eAAe;YACtC,CAAC,CAAC,IAAI,KAAK,QAA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AM,EACf,SAAS,GAAG,MAAM,EAClB,KAAK,EACL,MAAM,GAAG,GAAG,EACZ,OAAO,GAAG,UAAU,EACpB,QAAQ,GACT,EAAE,EAAE;IACH,IAAI,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACzB,OAAO,CACL,KAAC,YAAY,IACX,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,GAAG,EACT,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,eAAe,EAC3B,eAAe,EAAE,oBAAoB,EACrC,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,gBACF,UAAU,EACtB,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,qBAAqB,EACzB,SAAS,EAAE,SAAS,YAEnB,QAAQ,GACI,CAChB,CAAC;IACJ,CAAC;IAED,OAAO,CACL,KAAC,YAAY,IACX,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,GAAG,EACT,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,eAAe,EAC3B,eAAe,EAAE,oBAAoB,EACrC,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,gBACF,UAAU,EACtB,SAAS,EAAE,SAAS,YAEnB,QAAQ,GACI,CAChB,CAAC;AACJ,CAAC,CAAC;AAEF,gBAAgB,CAAC,WAAW,GAAG,kBAAkB,CAAC;AAClD,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"NavigationButton.js","sourceRoot":"","sources":["../../src/components/NavigationButton.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,MAAM,EAAqB,MAAM,sBAAsB,CAAC;AAGjE,OAAO,EAAE,0BAA0B,EA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AAG,EAAC,qBAAqB,EACzB,SAAS,EAAE,SAAS,YAEpB,KAAC,UAAU,IAAC,OAAO,EAAE,OAAO,YAAG,IAAI,GAAc,GACpC,CAChB,CAAC;IACJ,CAAC;IAED,OAAO,CACL,KAAC,YAAY,IACX,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,GAAG,EACT,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,UAAU,EACtB,eAAe,EAAE,eAAe,EAChC,KAAK,EAAE,SAAS,EAChB,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,gBACF,UAAU,EACtB,SAAS,EAAE,SAAS,YAEpB,KAAC,UAAU,IAAC,OAAO,EAAE,OAAO,YAAG,IAAI,GAAc,GACpC,CAChB,CAAC;AACJ,CAAC,CAAC;AAEF,gBAAgB,CAAC,WAAW,GAAG,kBAAkB,CAAC;AAClD,eAAe,gBAAgB,CAAC"}
@@ -1,16 +1,73 @@
1
1
  import React from 'react';
2
- interface NavigationLinkProps {
2
+ import { TypographyVariant } from '@mui/material/styles';
3
+ import { LayoutProps } from '@/types/style/LayoutProps';
4
+ import { ColorProps } from '@/types/style/ColorProps';
5
+ export interface LinkStyleProps extends LayoutProps, ColorProps {
6
+ textDecoration: 'none' | 'underline';
7
+ }
8
+ interface NavigationLinkProps extends LinkStyleProps {
3
9
  url: string;
4
10
  aria_label: string;
5
- background_color?: string;
6
- background_color_hover?: string;
7
- color: string;
8
- color_hover?: string;
9
11
  text_decoration: 'none' | 'underline';
10
- width: string;
11
- margin?: string;
12
- padding?: string;
13
- children: React.ReactNode;
12
+ text: string;
13
+ variant?: TypographyVariant;
14
14
  }
15
+ /**
16
+ * Componente que renderiza um link de navegação estilizado usando `styled` do Material UI.
17
+ * Ele aplica estilos customizáveis (layout e cores) e encapsula o texto com `Typography`.
18
+ *
19
+ * Quando a `url` contém `"http"`, o link é tratado como **externo** e abre em uma nova aba
20
+ * com `target="_blank"` e `rel="noopener noreferrer"`. Caso contrário, o link é tratado como **interno**
21
+ * e abre na mesma aba.
22
+ *
23
+ * @param {string} url URL de destino do link. Se contiver "http", será considerado link externo.
24
+ * @param {string} aria_label Rótulo de acessibilidade aplicado em `aria-label` no elemento `<a>`.
25
+ * @param {string} [background_color='transparent'] Cor de fundo do link.
26
+ * @param {string} [background_color_hover] Cor de fundo no hover. Se não for informada, usa `background_color`.
27
+ * @param {string} color Cor do texto do link.
28
+ * @param {string} [color_hover] Cor do texto no hover. Se não for informada, usa `color`.
29
+ * @param {'none' | 'underline'} [text_decoration='none'] Estilo de decoração do texto (`text-decoration`) do link.
30
+ * @param {string} width Largura do link (ex.: `'100%'`, `'auto'`, `'200px'`).
31
+ * @param {string} [margin='0'] Margem externa do link.
32
+ * @param {string} [padding='0'] Espaçamento interno do link.
33
+ * @param {string} text Texto exibido dentro do link.
34
+ * @param {TypographyVariant} [variant='body1'] Variante do `Typography` do Material UI utilizada para renderizar o texto.
35
+ *
36
+ * @example
37
+ * ```tsx
38
+ * import { NavigationLink } from '@/components/NavigationLink';
39
+ *
40
+ * export const Example = () => {
41
+ * return (
42
+ * <>
43
+ * <NavigationLink
44
+ * url="/about"
45
+ * aria_label="Ir para a página Sobre"
46
+ * color="#222"
47
+ * text="Sobre"
48
+ * width="auto"
49
+ * padding="8px 12px"
50
+ * text_decoration="none"
51
+ * variant="body2"
52
+ * />
53
+ *
54
+ * <NavigationLink
55
+ * url="https://example.com"
56
+ * aria_label="Abrir site externo"
57
+ * color="#1976d2"
58
+ * color_hover="#0d47a1"
59
+ * background_color="transparent"
60
+ * background_color_hover="transparent"
61
+ * text="Site externo"
62
+ * width="auto"
63
+ * margin="0 0 0 12px"
64
+ * padding="8px 12px"
65
+ * text_decoration="underline"
66
+ * />
67
+ * </>
68
+ * );
69
+ * };
70
+ * ```
71
+ */
15
72
  declare const NavigationLink: React.FC<NavigationLinkProps>;
16
73
  export default NavigationLink;
@@ -1,42 +1,100 @@
1
1
  'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import { styled } from '@mui/material/styles';
4
+ import { Typography } from '@mui/material';
4
5
  const ButtonStyled = styled('a', {
5
6
  shouldForwardProp: (prop) => ![
6
- 'background_color',
7
- 'background_color_hover',
8
- 'color',
9
- 'color_hover',
10
- 'padding',
11
- 'color_hover',
12
- 'width',
13
- 'margin',
7
+ "width",
8
+ "height",
9
+ "padding",
10
+ "margin",
11
+ "background",
12
+ "backgroundHover",
13
+ "colorText",
14
+ "colorHover",
14
15
  ].includes(prop),
15
- })(({ background_color, background_color_hover, color, color_hover, padding, width, margin, }) => ({
16
+ })(({ background, backgroundHover, colorText, colorHover, padding, width, margin, textDecoration }) => ({
16
17
  width: width,
17
18
  cursor: 'pointer',
18
- textDecoration: 'none',
19
+ textDecoration: textDecoration,
19
20
  textTransform: 'none',
20
21
  textAlign: 'center',
21
- backgroundColor: background_color,
22
- color: color,
22
+ backgroundColor: background,
23
+ color: colorText,
23
24
  padding: padding,
24
25
  margin: margin,
25
26
  '&:hover': {
26
- backgroundColor: background_color_hover,
27
- borderBottom: `1px solid ${color_hover}`,
28
- color: color_hover,
27
+ backgroundColor: backgroundHover,
28
+ borderBottom: `1px solid ${colorHover}`,
29
+ color: colorHover,
29
30
  },
30
31
  }));
31
- const NavigationLink = ({ url, aria_label, background_color = 'transparent', background_color_hover, color, color_hover, text_decoration = 'none', width, margin = '0', padding = '0', children }) => {
32
- const backgroundColor = background_color;
33
- const backgroundColorHover = background_color_hover !== null && background_color_hover !== void 0 ? background_color_hover : backgroundColor;
34
- const colorHover = color_hover !== null && color_hover !== void 0 ? color_hover : color;
32
+ /**
33
+ * Componente que renderiza um link de navegação estilizado usando `styled` do Material UI.
34
+ * Ele aplica estilos customizáveis (layout e cores) e encapsula o texto com `Typography`.
35
+ *
36
+ * Quando a `url` contém `"http"`, o link é tratado como **externo** e abre em uma nova aba
37
+ * com `target="_blank"` e `rel="noopener noreferrer"`. Caso contrário, o link é tratado como **interno**
38
+ * e abre na mesma aba.
39
+ *
40
+ * @param {string} url URL de destino do link. Se contiver "http", será considerado link externo.
41
+ * @param {string} aria_label Rótulo de acessibilidade aplicado em `aria-label` no elemento `<a>`.
42
+ * @param {string} [background_color='transparent'] Cor de fundo do link.
43
+ * @param {string} [background_color_hover] Cor de fundo no hover. Se não for informada, usa `background_color`.
44
+ * @param {string} color Cor do texto do link.
45
+ * @param {string} [color_hover] Cor do texto no hover. Se não for informada, usa `color`.
46
+ * @param {'none' | 'underline'} [text_decoration='none'] Estilo de decoração do texto (`text-decoration`) do link.
47
+ * @param {string} width Largura do link (ex.: `'100%'`, `'auto'`, `'200px'`).
48
+ * @param {string} [margin='0'] Margem externa do link.
49
+ * @param {string} [padding='0'] Espaçamento interno do link.
50
+ * @param {string} text Texto exibido dentro do link.
51
+ * @param {TypographyVariant} [variant='body1'] Variante do `Typography` do Material UI utilizada para renderizar o texto.
52
+ *
53
+ * @example
54
+ * ```tsx
55
+ * import { NavigationLink } from '@/components/NavigationLink';
56
+ *
57
+ * export const Example = () => {
58
+ * return (
59
+ * <>
60
+ * <NavigationLink
61
+ * url="/about"
62
+ * aria_label="Ir para a página Sobre"
63
+ * color="#222"
64
+ * text="Sobre"
65
+ * width="auto"
66
+ * padding="8px 12px"
67
+ * text_decoration="none"
68
+ * variant="body2"
69
+ * />
70
+ *
71
+ * <NavigationLink
72
+ * url="https://example.com"
73
+ * aria_label="Abrir site externo"
74
+ * color="#1976d2"
75
+ * color_hover="#0d47a1"
76
+ * background_color="transparent"
77
+ * background_color_hover="transparent"
78
+ * text="Site externo"
79
+ * width="auto"
80
+ * margin="0 0 0 12px"
81
+ * padding="8px 12px"
82
+ * text_decoration="underline"
83
+ * />
84
+ * </>
85
+ * );
86
+ * };
87
+ * ```
88
+ */
89
+ const NavigationLink = ({ url, aria_label, background = 'transparent', backgroundHover, colorText, colorHover, text_decoration = 'none', width, margin = '0', padding = '0', text, variant = "body1", }) => {
90
+ const backgroundColor = background;
91
+ const backgroundColorHover = backgroundHover !== null && backgroundHover !== void 0 ? backgroundHover : backgroundColor;
92
+ const color_hover = colorHover ? colorHover : (colorText !== null && colorText !== void 0 ? colorText : 'black');
35
93
  if (url.indexOf('http') != -1) {
36
- return (_jsx(ButtonStyled, { href: url, width: width, background_color: backgroundColor, background_color_hover: backgroundColorHover, color: color, color_hover: colorHover, padding: padding, margin: margin, "aria-label": aria_label, target: "_blank", rel: "noopener noreferrer", children: children }));
94
+ return (_jsx(ButtonStyled, { href: url, width: width, background: backgroundColor, backgroundHover: backgroundColorHover, colorText: colorText, colorHover: color_hover, padding: padding, margin: margin, textDecoration: text_decoration, "aria-label": aria_label, target: "_blank", rel: "noopener noreferrer", children: _jsx(Typography, { variant: variant, children: text }) }));
37
95
  }
38
96
  else {
39
- return (_jsx(ButtonStyled, { href: url, width: width, background_color: backgroundColor, background_color_hover: backgroundColorHover, color: color, color_hover: colorHover, padding: padding, margin: margin, "aria-label": aria_label, children: children }));
97
+ return (_jsx(ButtonStyled, { href: url, width: width, background: backgroundColor, backgroundHover: backgroundColorHover, colorText: colorText, colorHover: color_hover, padding: padding, margin: margin, "aria-label": aria_label, textDecoration: text_decoration, children: _jsx(Typography, { variant: variant, children: text }) }));
40
98
  }
41
99
  };
42
100
  export default NavigationLink;
@@ -1 +1 @@
1
- {"version":3,"file":"NavigationLink.js","sourceRoot":"","sources":["../../src/components/NavigationLink.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,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,aAAa;QACb,OAAO;QACP,QAAQ;KACT,CAAC,QAAQ,CAAC,IAAc,CAAC;CAC7B,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AAU,EACvB,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,qBAAqB,YACxB,QAAQ,GACI,CAChB,CAAC;IACJ,CAAC;SACG,CAAC;QAEH,OAAO,CACL,KAAC,YAAY,IACX,IAAI,EAAE,GAAG,EACT,KAAK,EAAE,KAAK,EACZ,gBAAgB,EAAE,eAAe,EACjC,sBAAsB,EAAE,oBAAoB,EAC5C,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,UAAU,EACvB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,gBACD,UAAU,YAEtB,QAAQ,GACI,CAChB,CAAC;IACJ,CAAC;AACL,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"NavigationLink.js","sourceRoot":"","sources":["../../src/components/NavigationLink.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,MAAM,EAAqB,MAAM,sBAAsB,CAAC;AAGjE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAQ3C,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,EAAE;IAC/B,iBAAiB,EAAE,CAAC,IAAI,EAAE,EAAE,CAC1B,CAAC;QACC,OAAO;QACP,QAAQ;QACR,SAAS;QACT,QAAQ;QACR,YAAY;QACZ,iBAAiB;QACjB,WAAW;QACX,YAAY;KACb,CAAC,QAAQ,CAAC,IAAc,CAAC;CAC7B,CAAC,CAAiB,CAAC,EAClB,UAAU,EACV,eAAe,EACf,SAAS,EACT,UAAU,EACV,OAAO,EACP,KAAK,EACL,MAAM,EACN,cAAc,EACf,EAAE,EAAE,CAAC,CAAC;IACL,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,SAAS;IACjB,cAAc,EAAE,cAAc;IAC9B,aAAa,EAAE,MAAM;IACrB,SAAS,EAAE,QAAQ;IACnB,eAAe,EAAE,UAAU;IAC3B,KAAK,EAAE,SAAS;IAChB,OAAO,EAAE,OAAO;IAChB,MAAM,EAAE,MAA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