pipesol-button 1.0.1-beta.5 → 1.0.1-beta.7
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/CircularIconLink.d.ts +5 -3
- package/dist/components/CircularIconLink.js +8 -6
- package/dist/components/CircularIconLink.js.map +1 -1
- package/dist/components/DownloadButton.d.ts +78 -0
- package/dist/components/DownloadButton.js +69 -0
- package/dist/components/DownloadButton.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -14,8 +14,8 @@ export interface CircularIconLinkProps {
|
|
|
14
14
|
* ```
|
|
15
15
|
*/
|
|
16
16
|
children: ReactElement<HTMLImageElement> | ReactElement<SvgIconProps>;
|
|
17
|
-
/** URL a ser aberta */
|
|
18
|
-
url
|
|
17
|
+
/** URL a ser aberta (opcional se onClick for usado) */
|
|
18
|
+
url?: string;
|
|
19
19
|
/** Cor de fundo do círculo */
|
|
20
20
|
background_color: string;
|
|
21
21
|
/** Texto para acessibilidade (`aria-label`) */
|
|
@@ -26,6 +26,8 @@ export interface CircularIconLinkProps {
|
|
|
26
26
|
border?: string;
|
|
27
27
|
/** Define se o link será aberto em nova aba. @default true */
|
|
28
28
|
openInNewTab?: boolean;
|
|
29
|
+
/** Evento de clique customizado. Se definido, sobrescreve o comportamento padrão */
|
|
30
|
+
onClick?: () => void;
|
|
29
31
|
}
|
|
30
32
|
/**
|
|
31
33
|
* **CircularIconLink**
|
|
@@ -35,7 +37,7 @@ export interface CircularIconLinkProps {
|
|
|
35
37
|
*
|
|
36
38
|
* - Aceita ícones do Material UI (`<SvgIcon>`) ou imagens (`<img>`).
|
|
37
39
|
* - O círculo possui cor de fundo, padding e borda personalizáveis.
|
|
38
|
-
* - Ao clicar,
|
|
40
|
+
* - Ao clicar, executa o `onClick` se definido, caso contrário abre a `url` em nova aba ou na mesma aba.
|
|
39
41
|
*/
|
|
40
42
|
declare const CircularIconLink: React.FC<CircularIconLinkProps>;
|
|
41
43
|
export default CircularIconLink;
|
|
@@ -19,15 +19,17 @@ 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,
|
|
22
|
+
* - Ao clicar, executa o `onClick` se definido, caso contrário abre a `url` em nova aba ou na mesma aba.
|
|
23
23
|
*/
|
|
24
|
-
const CircularIconLink = ({ url, background_color = 'transparent', aria_label, padding = '4px', border = 'none', children, openInNewTab = true, }) => {
|
|
24
|
+
const CircularIconLink = ({ url, background_color = 'transparent', aria_label, padding = '4px', border = 'none', children, openInNewTab = true, onClick, }) => {
|
|
25
25
|
const handleClick = () => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
if (url) {
|
|
27
|
+
const target = openInNewTab ? '_blank' : '_self';
|
|
28
|
+
const features = openInNewTab ? 'noopener noreferrer' : '';
|
|
29
|
+
window.open(url, target, features);
|
|
30
|
+
}
|
|
29
31
|
};
|
|
30
|
-
return (_jsx(StyledBox, { background_color: background_color, padding: padding, border: border, children: _jsx(IconButton, { "aria-label": aria_label, onClick: handleClick, children: children }) }));
|
|
32
|
+
return (_jsx(StyledBox, { background_color: background_color, padding: padding, border: border, children: _jsx(IconButton, { "aria-label": aria_label, onClick: onClick || handleClick, children: children }) }));
|
|
31
33
|
};
|
|
32
34
|
export default CircularIconLink;
|
|
33
35
|
//# sourceMappingURL=CircularIconLink.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CircularIconLink.js","sourceRoot":"","sources":["../../src/components/CircularIconLink.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,GAAG,EAAE,UAAU,EAAgB,MAAM,eAAe,CAAC;AAC9D,OAA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,KAAK,EACf,MAAM,GAAG,MAAM,EACf,QAAQ,EACR,YAAY,GAAG,IAAI,EACnB,OAAO,GACR,EAAE,EAAE;IACH,MAAM,WAAW,GAAG,GAAG,EAAE;QACvB,IAAI,GAAG,EAAE,CAAC;YACR,MAAM,MAAM,GAAG,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC;YACjD,MAAM,QAAQ,GAAG,YAAY,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,CAAC;YAC3D,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;QACrC,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,CACL,KAAC,SAAS,IAAC,gBAAgB,EAAE,gBAAgB,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,YAC7E,KAAC,UAAU,kBAAa,UAAU,EAAE,OAAO,EAAE,OAAO,IAAI,WAAW,YAChE,QAAQ,GACE,GACH,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Propriedades do componente `NavigationButton`.
|
|
4
|
+
*/
|
|
5
|
+
interface DownloadButtonProps {
|
|
6
|
+
/**
|
|
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
|
+
*/
|
|
14
|
+
file: string;
|
|
15
|
+
/** Texto para acessibilidade (atributo `aria-label`). */
|
|
16
|
+
aria_label: string;
|
|
17
|
+
/** Cor de fundo padrão do botão (ex: `#1976d2` ou `transparent`). */
|
|
18
|
+
background_color?: string;
|
|
19
|
+
/** Cor de fundo quando o botão é focado/hover. Se não informado, usa a cor padrão. */
|
|
20
|
+
background_color_hover?: string;
|
|
21
|
+
/** Cor do texto padrão (ex: `#fff`). */
|
|
22
|
+
color: string;
|
|
23
|
+
/** Cor do texto no hover. Se não informado, usa a mesma cor padrão. */
|
|
24
|
+
color_hover?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Cor da borda (ex: `#1976d2`).
|
|
27
|
+
* @default "transparent"
|
|
28
|
+
*/
|
|
29
|
+
border_color?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Raio de borda (ex: `8px`, `50%`).
|
|
32
|
+
* @default "0"
|
|
33
|
+
*/
|
|
34
|
+
border_radius?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Sombra CSS (ex: `0 2px 4px rgba(0,0,0,0.2)`).
|
|
37
|
+
* @default "none"
|
|
38
|
+
*/
|
|
39
|
+
box_shadow?: string;
|
|
40
|
+
/** Largura do botão (ex: `200px`, `100%`). */
|
|
41
|
+
width: string;
|
|
42
|
+
/**
|
|
43
|
+
* Margem externa.
|
|
44
|
+
* @default "0"
|
|
45
|
+
*/
|
|
46
|
+
margin?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Padding interno.
|
|
49
|
+
* @default "8px 24px"
|
|
50
|
+
*/
|
|
51
|
+
padding?: string;
|
|
52
|
+
/** Conteúdo interno (texto ou elementos JSX). */
|
|
53
|
+
children: React.ReactNode;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Componente `DownloadButton`
|
|
57
|
+
*
|
|
58
|
+
* Botão estilizado para **download de arquivos**.
|
|
59
|
+
* Cria um link em formato de botão que pode:
|
|
60
|
+
* - Abrir o arquivo em nova aba (para URLs externas iniciando com `http`);
|
|
61
|
+
* - Acionar o download direto de um arquivo local/relativo.
|
|
62
|
+
*
|
|
63
|
+
* Exemplo de uso:
|
|
64
|
+
* ```tsx
|
|
65
|
+
* <DownloadButton
|
|
66
|
+
* file="/docs/manual.pdf"
|
|
67
|
+
* aria_label="Baixar manual em PDF"
|
|
68
|
+
* background_color="#1976d2"
|
|
69
|
+
* color="#fff"
|
|
70
|
+
* border_radius="8px"
|
|
71
|
+
* width="200px"
|
|
72
|
+
* >
|
|
73
|
+
* Baixar Manual
|
|
74
|
+
* </DownloadButton>
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
declare const DownloadButton: React.FC<DownloadButtonProps>;
|
|
78
|
+
export default DownloadButton;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
4
|
+
const ButtonStyled = styled('a', {
|
|
5
|
+
shouldForwardProp: (prop) => ![
|
|
6
|
+
'background_color',
|
|
7
|
+
'background_color_hover',
|
|
8
|
+
'color',
|
|
9
|
+
'color_hover',
|
|
10
|
+
'padding',
|
|
11
|
+
'border_radius',
|
|
12
|
+
'border_color',
|
|
13
|
+
'color_hover',
|
|
14
|
+
'width',
|
|
15
|
+
'margin',
|
|
16
|
+
'boxshadow',
|
|
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
|
+
}));
|
|
36
|
+
/**
|
|
37
|
+
* Componente `DownloadButton`
|
|
38
|
+
*
|
|
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.
|
|
43
|
+
*
|
|
44
|
+
* Exemplo de uso:
|
|
45
|
+
* ```tsx
|
|
46
|
+
* <DownloadButton
|
|
47
|
+
* file="/docs/manual.pdf"
|
|
48
|
+
* aria_label="Baixar manual em PDF"
|
|
49
|
+
* background_color="#1976d2"
|
|
50
|
+
* color="#fff"
|
|
51
|
+
* border_radius="8px"
|
|
52
|
+
* width="200px"
|
|
53
|
+
* >
|
|
54
|
+
* Baixar Manual
|
|
55
|
+
* </DownloadButton>
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
const DownloadButton = ({ file, 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 // faz o navegador baixar ao invés de abrir, se suportado
|
|
66
|
+
: true, 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 }));
|
|
67
|
+
};
|
|
68
|
+
export default DownloadButton;
|
|
69
|
+
//# sourceMappingURL=DownloadButton.js.map
|
|
@@ -0,0 +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,EAAE,KAAK;IACZ,MAAM,EAAE,SAAS;IACjB,cAAc,EAAE,MAAM;IACtB,aAAa,EAAE,MAAM;IACrB,SAAS,EAAE,QAAQ;IACnB,SAAS,EAAE,SAAS;IACpB,eAAe,EAAE,gBAAgB;IACjC,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,aAAa,YAAY,EAAE;IACnC,YAAY,EAAE,aAAa;IAC3B,OAAO,EAAE,OAAO;IAChB,MAAM,EAAE,MAAM;IAEd,SAAS,EAAE;QACT,eAAe,EAAE,sBAAsB;QACvC,KAAK,EAAE,WAAW;KACnB;CACF,CAAC,CACH,CAAC;AAoEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,cAAc,GAAkC,CAAC,EACrD,IAAI,EACJ,UAAU,EACV,gBAAgB,EAChB,sBAAsB,EACtB,KAAK,EACL,WAAW,EACX,aAAa,GAAG,GAAG,EACnB,YAAY,GAAG,aAAa,EAC5B,UAAU,GAAG,MAAM,EACnB,KAAK,EACL,MAAM,GAAG,GAAG,EACZ,OAAO,GAAG,UAAU,EACpB,QAAQ,GACT,EAAE,EAAE;IACH,MAAM,eAAe,GAAW,gBAAgB,aAAhB,gBAAgB,cAAhB,gBAAgB,GAAI,aAAa,CAAC;IAClE,MAAM,oBAAoB,GAAW,sBAAsB,aAAtB,sBAAsB,cAAtB,sBAAsB,GAAI,eAAe,CAAC;IAC/E,MAAM,UAAU,GAAW,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,KAAK,CAAC;IAEhD,oEAAoE;IACpE,0BAA0B;IAC1B,MAAM,YAAY,GAAG,GAAG,IAAI,WAAW,CAAC;IAExC,OAAO,CACL,KAAC,YAAY,IACX,IAAI,EAAE,YAAY,EAClB,QAAQ,CAAC,yDAAyD;gBAClE,KAAK,EAAE,KAAK,EACZ,gBAAgB,EAAE,eAAe,EACjC,sBAAsB,EAAE,oBAAoB,EAC5C,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,UAAU,EACvB,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,gBACF,UAAU,EACtB,SAAS,EAAE,UAAU,YAEpB,QAAQ,GACI,CAChB,CAAC;AAEJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { default as CircularIconLink } from './components/CircularIconLink';
|
|
2
2
|
export { default as NavigationButton } from './components/NavigationButton';
|
|
3
|
+
export { default as DownloadButton } from './components/DownloadButton';
|
|
3
4
|
export { default as NavigationLink } from './components/NavigationLink';
|
|
4
5
|
export { default as ScrollToTopButton } from './components/ScrollToTopButton';
|
|
5
6
|
export { default as WhatsAppButton } from './components/WhatsAppButton';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { default as CircularIconLink } from './components/CircularIconLink';
|
|
2
2
|
export { default as NavigationButton } from './components/NavigationButton';
|
|
3
|
+
export { default as DownloadButton } from './components/DownloadButton';
|
|
3
4
|
export { default as NavigationLink } from './components/NavigationLink';
|
|
4
5
|
export { default as ScrollToTopButton } from './components/ScrollToTopButton';
|
|
5
6
|
export { default as WhatsAppButton } from './components/WhatsAppButton';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAC,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAC,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,cAAc,EAAC,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAC,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,OAAO,IAAI,cAAc,EAAC,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAC,MAAM,2BAA2B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAC,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAC,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,cAAc,EAAC,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAC,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAC,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,OAAO,IAAI,cAAc,EAAC,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAC,MAAM,2BAA2B,CAAC"}
|