pipesol-button 1.0.1-beta.4 → 1.0.1-beta.5

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.
@@ -14,16 +14,18 @@ export interface CircularIconLinkProps {
14
14
  * ```
15
15
  */
16
16
  children: ReactElement<HTMLImageElement> | ReactElement<SvgIconProps>;
17
- /** URL a ser aberta em nova aba. */
17
+ /** URL a ser aberta */
18
18
  url: string;
19
- /** Cor de fundo do círculo. */
19
+ /** Cor de fundo do círculo */
20
20
  background_color: string;
21
- /** Texto para acessibilidade (`aria-label`). */
21
+ /** Texto para acessibilidade (`aria-label`) */
22
22
  aria_label: string;
23
23
  /** Padding interno do círculo. @default "4px" */
24
24
  padding?: string;
25
25
  /** Estilo da borda. @default "2px solid transparent" */
26
26
  border?: string;
27
+ /** Define se o link será aberto em nova aba. @default true */
28
+ openInNewTab?: boolean;
27
29
  }
28
30
  /**
29
31
  * **CircularIconLink**
@@ -33,28 +35,7 @@ export interface CircularIconLinkProps {
33
35
  *
34
36
  * - Aceita ícones do Material UI (`<SvgIcon>`) ou imagens (`<img>`).
35
37
  * - O círculo possui cor de fundo, padding e borda personalizáveis.
36
- * - Ao clicar, abre o link em uma nova aba com `noopener noreferrer` por segurança.
37
- *
38
- * Exemplo de uso:
39
- * ```tsx
40
- * import { Instagram } from '@mui/icons-material';
41
- *
42
- * <CircularIconLink
43
- * url="https://instagram.com/seuperfil"
44
- * background_color="#E1306C"
45
- * aria_label="Abrir Instagram"
46
- * >
47
- * <Instagram sx={{ color: 'white', fontSize: 24 }} />
48
- * </CircularIconLink>
49
- *
50
- * <CircularIconLink
51
- * url="https://example.com"
52
- * background_color="#25D366"
53
- * aria_label="Logo do site"
54
- * >
55
- * <img src="/logo.png" alt="Logo" width={24} height={24} />
56
- * </CircularIconLink>
57
- * ```
38
+ * - Ao clicar, abre o link em nova aba ou na mesma aba, dependendo da prop `openInNewTab`.
58
39
  */
59
40
  declare const CircularIconLink: React.FC<CircularIconLinkProps>;
60
41
  export default CircularIconLink;
@@ -19,31 +19,15 @@ const StyledBox = styled(Box, {
19
19
  *
20
20
  * - Aceita ícones do Material UI (`<SvgIcon>`) ou imagens (`<img>`).
21
21
  * - O círculo possui cor de fundo, padding e borda personalizáveis.
22
- * - Ao clicar, abre o link em uma nova aba com `noopener noreferrer` por segurança.
23
- *
24
- * Exemplo de uso:
25
- * ```tsx
26
- * import { Instagram } from '@mui/icons-material';
27
- *
28
- * <CircularIconLink
29
- * url="https://instagram.com/seuperfil"
30
- * background_color="#E1306C"
31
- * aria_label="Abrir Instagram"
32
- * >
33
- * <Instagram sx={{ color: 'white', fontSize: 24 }} />
34
- * </CircularIconLink>
35
- *
36
- * <CircularIconLink
37
- * url="https://example.com"
38
- * background_color="#25D366"
39
- * aria_label="Logo do site"
40
- * >
41
- * <img src="/logo.png" alt="Logo" width={24} height={24} />
42
- * </CircularIconLink>
43
- * ```
22
+ * - Ao clicar, abre o link em nova aba ou na mesma aba, dependendo da prop `openInNewTab`.
44
23
  */
45
- const CircularIconLink = ({ url, background_color = 'transparent', aria_label, padding = '4px', border = 'none', children, }) => {
46
- return (_jsx(StyledBox, { background_color: background_color, padding: padding, border: border, children: _jsx(IconButton, { "aria-label": aria_label, onClick: () => window.open(url, '_blank', 'noopener noreferrer'), children: children }) }));
24
+ const CircularIconLink = ({ url, background_color = 'transparent', aria_label, padding = '4px', border = 'none', children, openInNewTab = true, }) => {
25
+ const handleClick = () => {
26
+ const target = openInNewTab ? '_blank' : '_self';
27
+ const features = openInNewTab ? 'noopener noreferrer' : '';
28
+ window.open(url, target, features);
29
+ };
30
+ return (_jsx(StyledBox, { background_color: background_color, padding: padding, border: border, children: _jsx(IconButton, { "aria-label": aria_label, onClick: handleClick, children: children }) }));
47
31
  };
48
32
  export default CircularIconLink;
49
33
  //# sourceMappingURL=CircularIconLink.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CircularIconLink.js","sourceRoot":"","sources":["../../src/components/CircularIconL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