@pipelinesolucoes/form 1.2.0-beta.9 → 1.3.1
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 +19 -10
- package/dist/components/ChipList.d.ts +9 -0
- package/dist/components/ChipList.js +60 -0
- package/dist/components/ChipList.js.map +1 -0
- package/dist/components/FormMessage.d.ts +268 -0
- package/dist/components/FormMessage.js +333 -0
- package/dist/components/FormMessage.js.map +1 -0
- package/dist/components/GoogleButton.js.map +1 -0
- package/dist/components/SelectField.d.ts +73 -0
- package/dist/components/SelectField.js +142 -0
- package/dist/components/SelectField.js.map +1 -0
- package/dist/components/{login/StyleLogin.js → StyleForm.js} +2 -2
- package/dist/components/StyleForm.js.map +1 -0
- package/dist/components/TextFieldBirthDateWithAge.d.ts +83 -0
- package/dist/components/TextFieldBirthDateWithAge.js +277 -0
- package/dist/components/TextFieldBirthDateWithAge.js.map +1 -0
- package/dist/components/TextFieldCPFValidate.d.ts +37 -0
- package/dist/components/TextFieldCPFValidate.js +147 -0
- package/dist/components/TextFieldCPFValidate.js.map +1 -0
- package/dist/components/TextFieldNumberValidate.d.ts +110 -0
- package/dist/components/TextFieldNumberValidate.js +196 -0
- package/dist/components/TextFieldNumberValidate.js.map +1 -0
- package/dist/components/TextFieldPassword.d.ts +141 -53
- package/dist/components/TextFieldPassword.js +161 -96
- package/dist/components/TextFieldPassword.js.map +1 -1
- package/dist/components/TextFieldValidate.d.ts +89 -43
- package/dist/components/TextFieldValidate.js +103 -93
- package/dist/components/TextFieldValidate.js.map +1 -1
- package/dist/components/recaptcha/RecaptchaForm.d.ts +8 -14
- package/dist/components/recaptcha/RecaptchaForm.js +30 -25
- package/dist/components/recaptcha/RecaptchaForm.js.map +1 -1
- package/dist/constant.d.ts +11 -0
- package/dist/constant.js +12 -0
- package/dist/constant.js.map +1 -0
- package/dist/index.d.ts +11 -5
- package/dist/index.js +11 -5
- package/dist/index.js.map +1 -1
- package/dist/services/SendFormBrevo.d.ts +11 -0
- package/dist/services/SendFormBrevo.js +28 -0
- package/dist/services/SendFormBrevo.js.map +1 -0
- package/dist/{components/style → style}/ButtonFormStyled.d.ts +1 -1
- package/dist/{components/style → style}/ButtonFormStyled.js +6 -5
- package/dist/style/ButtonFormStyled.js.map +1 -0
- package/dist/{components/style → style}/LinkFormStyled.js +5 -4
- package/dist/style/LinkFormStyled.js.map +1 -0
- package/dist/style/TextFieldStyle.d.ts +19 -0
- package/dist/style/TextFieldStyle.js +88 -0
- package/dist/style/TextFieldStyle.js.map +1 -0
- package/dist/theme.js +26 -45
- package/dist/theme.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/{components/login → types}/ClickResult.d.ts +1 -1
- package/dist/types/ClickResult.js.map +1 -0
- package/dist/types/FieldProps.d.ts +1 -0
- package/dist/utils/formatCEP.d.ts +20 -0
- package/dist/utils/formatCEP.js +35 -0
- package/dist/utils/formatCEP.js.map +1 -0
- package/dist/utils/formatCpf.d.ts +14 -0
- package/dist/utils/formatCpf.js +35 -0
- package/dist/utils/formatCpf.js.map +1 -0
- package/dist/utils/validateCpf.d.ts +40 -0
- package/dist/utils/validateCpf.js +67 -0
- package/dist/utils/validateCpf.js.map +1 -0
- package/dist/utils/validateEmail.js +1 -1
- package/dist/utils/validateEmail.js.map +1 -1
- package/package.json +4 -2
- package/dist/components/login/ClickResult.js.map +0 -1
- package/dist/components/login/FormLogin.d.ts +0 -150
- package/dist/components/login/FormLogin.js +0 -221
- package/dist/components/login/FormLogin.js.map +0 -1
- package/dist/components/login/FormPasswordRecovery.d.ts +0 -129
- package/dist/components/login/FormPasswordRecovery.js +0 -196
- package/dist/components/login/FormPasswordRecovery.js.map +0 -1
- package/dist/components/login/FormSignUp.d.ts +0 -147
- package/dist/components/login/FormSignUp.js +0 -215
- package/dist/components/login/FormSignUp.js.map +0 -1
- package/dist/components/login/GoogleButton.js.map +0 -1
- package/dist/components/login/StyleLogin.js.map +0 -1
- package/dist/components/recaptcha/FormStyled.d.ts +0 -30
- package/dist/components/recaptcha/FormStyled.js +0 -67
- package/dist/components/recaptcha/FormStyled.js.map +0 -1
- package/dist/components/style/ButtonFormStyled.js.map +0 -1
- package/dist/components/style/LinkFormStyled.js.map +0 -1
- /package/dist/components/{login/GoogleButton.d.ts → GoogleButton.d.ts} +0 -0
- /package/dist/components/{login/GoogleButton.js → GoogleButton.js} +0 -0
- /package/dist/components/{login/StyleLogin.d.ts → StyleForm.d.ts} +0 -0
- /package/dist/{components/style → style}/LinkFormStyled.d.ts +0 -0
- /package/dist/{components/login → types}/ClickResult.js +0 -0
package/README.md
CHANGED
|
@@ -14,24 +14,33 @@ A biblioteca inclui os seguintes componentes:
|
|
|
14
14
|
Componente de botão que redireciona o usuário para um endpoint externo (ex: autenticação com Google).
|
|
15
15
|
Durante o clique, o botão entra em estado de loading e, caso ocorra algum erro, exibe uma mensagem abaixo do botão.
|
|
16
16
|
|
|
17
|
-
- **
|
|
18
|
-
Componente de formulário
|
|
19
|
-
|
|
20
|
-
customização visual via props (container, campos, botão e links).
|
|
21
|
-
|
|
22
|
-
- **FormPasswordRecovery**
|
|
23
|
-
Componente de formulário para recuperação de senha via e-mail.
|
|
24
|
-
Faz a validação do e-mail, dispara um `onSubmit` assíncrono (obrigatório) e exibe a mensagem retornada.
|
|
17
|
+
- **FormMessage**
|
|
18
|
+
Componente de formulário para envio de mensagem.
|
|
19
|
+
Faz a validação do e-mail, telefone e exibe a mensagem retornada.
|
|
25
20
|
|
|
26
21
|
- **TextFieldPassword**
|
|
27
|
-
Componente de campo de senha baseado no TextField do Material UI, com botão para alternar entre mostrar/ocultar a senha.
|
|
22
|
+
Componente de campo de senha baseado no TextField do Material UI, com botão para alternar entre mostrar/ocultar a senha.
|
|
23
|
+
O componente:
|
|
28
24
|
- Retorna somente a senha digitada via `onPasswordChange`
|
|
29
25
|
- Valida obrigatório + formato (regex) e exibe mensagens de erro automaticamente
|
|
30
26
|
- Dispara um "evento" de validação via `onValidationChange`
|
|
31
27
|
|
|
32
28
|
- **TextFieldValidate**
|
|
33
29
|
Componente de campo de texto com validação, baseado no TextField do Material UI.
|
|
34
|
-
Permite personalização visual via `styled` e suporte a validações comuns (obrigatório, tamanho mínimo, regex) e validação customizada.
|
|
30
|
+
Permite personalização visual via `styled` e suporte a validações comuns (obrigatório, tamanho mínimo, regex) e validação customizada.
|
|
31
|
+
|
|
32
|
+
- **TextFieldNumberValidate**
|
|
33
|
+
Campo de texto numérico com suporte a validações comuns e customizadas, construído sobre o TextField do Material UI e
|
|
34
|
+
estilizado via Design System da Pipeline.
|
|
35
|
+
|
|
36
|
+
- **TextFieldBirthDateWithAge**
|
|
37
|
+
Campo de data de nascimento com entrada somente numérica, máscara `dd/mm/yyyy`,
|
|
38
|
+
validações comuns (required, min/maxLength, pattern) + validação customizada,
|
|
39
|
+
e cálculo automático de idade exibido na label.
|
|
40
|
+
|
|
41
|
+
- **TextFieldCPFValidate**
|
|
42
|
+
Campo de CPF com entrada somente numérica, máscara `000.000.000-00`,
|
|
43
|
+
validações comuns (required, min/maxLength, pattern) + validação customizada.
|
|
35
44
|
|
|
36
45
|
- **NotificationSnackbar**
|
|
37
46
|
Componente que exibe uma notificação no topo da tela utilizando o Snackbar e Alert do Material UI.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TypographyVariant } from '@mui/material/styles';
|
|
3
|
+
import { BorderProps, ColorProps, LayoutProps } from '@pipelinesolucoes/theme';
|
|
4
|
+
export interface ChipListProps extends Pick<ColorProps, 'background' | 'color' | 'backgroundHover' | 'colorHover'>, Pick<LayoutProps, 'width' | 'height' | 'padding' | 'margin'>, BorderProps {
|
|
5
|
+
items: string[];
|
|
6
|
+
variant?: TypographyVariant;
|
|
7
|
+
}
|
|
8
|
+
declare const ChipList: React.FC<ChipListProps>;
|
|
9
|
+
export default ChipList;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import Box from '@mui/material/Box';
|
|
4
|
+
import Chip from '@mui/material/Chip';
|
|
5
|
+
import { styled, useTheme } from '@mui/material/styles';
|
|
6
|
+
const StyledChipArea = styled(Box)({
|
|
7
|
+
display: 'flex',
|
|
8
|
+
flexWrap: 'wrap',
|
|
9
|
+
gap: 8,
|
|
10
|
+
});
|
|
11
|
+
const StyledChip = styled(Chip, {
|
|
12
|
+
shouldForwardProp: (prop) => ![
|
|
13
|
+
'width',
|
|
14
|
+
'height',
|
|
15
|
+
'padding',
|
|
16
|
+
'margin',
|
|
17
|
+
'background',
|
|
18
|
+
'colorText',
|
|
19
|
+
'borderRadius',
|
|
20
|
+
'boxShadow',
|
|
21
|
+
'border',
|
|
22
|
+
'backgroundHover',
|
|
23
|
+
'colorHover',
|
|
24
|
+
'typo',
|
|
25
|
+
].includes(prop),
|
|
26
|
+
})(({ width, height, padding, margin, background, colorText, borderRadius, boxShadow, border, backgroundHover, colorHover, typo }) => (Object.assign(Object.assign({ width,
|
|
27
|
+
height,
|
|
28
|
+
padding,
|
|
29
|
+
margin,
|
|
30
|
+
borderRadius,
|
|
31
|
+
boxShadow, backgroundColor: background, color: colorText, border }, (typo !== null && typo !== void 0 ? typo : {})), { '&:hover': {
|
|
32
|
+
backgroundColor: backgroundHover !== null && backgroundHover !== void 0 ? backgroundHover : background,
|
|
33
|
+
color: colorHover !== null && colorHover !== void 0 ? colorHover : colorText,
|
|
34
|
+
}, '&.MuiChip-outlined': {
|
|
35
|
+
backgroundColor: 'transparent',
|
|
36
|
+
}, '&.MuiChip-outlined:hover': {
|
|
37
|
+
backgroundColor: backgroundHover !== null && backgroundHover !== void 0 ? backgroundHover : 'transparent',
|
|
38
|
+
color: colorHover !== null && colorHover !== void 0 ? colorHover : colorText,
|
|
39
|
+
} })));
|
|
40
|
+
const ChipList = ({ items, variant, width, height, padding, margin, background, color, borderRadius, boxShadow, border, backgroundHover, colorHover, }) => {
|
|
41
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
|
|
42
|
+
const theme = useTheme();
|
|
43
|
+
const themechip = (_b = (_a = theme.pipelinesolucoes) === null || _a === void 0 ? void 0 : _a.forms) === null || _b === void 0 ? void 0 : _b.chip;
|
|
44
|
+
const wchip = (_d = (_c = themechip === null || themechip === void 0 ? void 0 : themechip.width) !== null && _c !== void 0 ? _c : width) !== null && _d !== void 0 ? _d : '100%';
|
|
45
|
+
const hchip = (_f = (_e = themechip === null || themechip === void 0 ? void 0 : themechip.height) !== null && _e !== void 0 ? _e : height) !== null && _f !== void 0 ? _f : 'auto';
|
|
46
|
+
const pchip = (_h = (_g = themechip === null || themechip === void 0 ? void 0 : themechip.padding) !== null && _g !== void 0 ? _g : padding) !== null && _h !== void 0 ? _h : '16px';
|
|
47
|
+
const mchip = (_k = (_j = themechip === null || themechip === void 0 ? void 0 : themechip.margin) !== null && _j !== void 0 ? _j : margin) !== null && _k !== void 0 ? _k : '0';
|
|
48
|
+
const bchip = (_m = (_l = themechip === null || themechip === void 0 ? void 0 : themechip.background) !== null && _l !== void 0 ? _l : background) !== null && _m !== void 0 ? _m : '#ffffff';
|
|
49
|
+
const clchip = (_p = (_o = themechip === null || themechip === void 0 ? void 0 : themechip.color) !== null && _o !== void 0 ? _o : color) !== null && _p !== void 0 ? _p : 'inherit';
|
|
50
|
+
const brchip = (_r = (_q = themechip === null || themechip === void 0 ? void 0 : themechip.borderRadius) !== null && _q !== void 0 ? _q : borderRadius) !== null && _r !== void 0 ? _r : 'inherit';
|
|
51
|
+
const bschip = (_t = (_s = themechip === null || themechip === void 0 ? void 0 : themechip.boxShadow) !== null && _s !== void 0 ? _s : boxShadow) !== null && _t !== void 0 ? _t : 'none';
|
|
52
|
+
const bdchip = (_v = (_u = themechip === null || themechip === void 0 ? void 0 : themechip.border) !== null && _u !== void 0 ? _u : border) !== null && _v !== void 0 ? _v : 'inherit';
|
|
53
|
+
const bHoverchip = (_x = (_w = themechip === null || themechip === void 0 ? void 0 : themechip.backgroundHover) !== null && _w !== void 0 ? _w : backgroundHover) !== null && _x !== void 0 ? _x : bchip;
|
|
54
|
+
const clHoverchip = (_z = (_y = themechip === null || themechip === void 0 ? void 0 : themechip.colorHover) !== null && _y !== void 0 ? _y : colorHover) !== null && _z !== void 0 ? _z : clchip;
|
|
55
|
+
const typo = (_1 = (_0 = (variant && theme.typography[variant])) !== null && _0 !== void 0 ? _0 : themechip === null || themechip === void 0 ? void 0 : themechip.typography) !== null && _1 !== void 0 ? _1 : theme.typography.body1;
|
|
56
|
+
return (_jsx(StyledChipArea, { children: items.map((item, idx) => (_jsx(StyledChip, { label: item, width: wchip, height: hchip, padding: pchip, margin: mchip, background: bchip, colorText: clchip, borderRadius: brchip, boxShadow: bschip, border: bdchip, backgroundHover: bHoverchip, colorHover: clHoverchip, typo: typo }, `${item}-${idx}`))) }));
|
|
57
|
+
};
|
|
58
|
+
ChipList.displayName = 'ChipList';
|
|
59
|
+
export default ChipList;
|
|
60
|
+
//# sourceMappingURL=ChipList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChipList.js","sourceRoot":"","sources":["../../src/components/ChipList.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,GAAG,MAAM,mBAAmB,CAAC;AACpC,OAAO,IAAI,MAAM,oBAAoB,CAAC;AACtC,OAAO,EAAa,MAAM,EAAqB,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAYtF,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IACjC,OAAO,EAAE,MAAM;IACf,QAAQ,EAAE,MAAM;IAChB,GAAG,EAAE,CAAC;CACP,CAAC,CAAC;AAEH,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,EAAE;IAC9B,iBAAiB,EAAE,CAAC,IAAI,EAAE,EAAE,CAC1B,CAAC;QACC,OAAO;QACP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AM,IAAI,GACR,MAAA,MAAA,CAAC,OAAO,IAAI,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,mCACtC,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,UAAU,mCACrB,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC;IAEzB,OAAO,CACL,KAAC,cAAc,cACZ,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC,CACxB,KAAC,UAAU,IAET,KAAK,EAAE,IAAI,EACX,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,KAAK,EACb,OAAO,EAAE,KAAK,EACd,MAAM,EAAE,KAAK,EACb,UAAU,EAAE,KAAK,EACjB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,UAAU,EAC3B,UAAU,EAAE,WAAW,EACvB,IAAI,EAAE,IAAI,IAbL,GAAG,IAAI,IAAI,GAAG,EAAE,CAcrB,CACH,CAAC,GACa,CAClB,CAAC;AACJ,CAAC,CAAC;AAEF,QAAQ,CAAC,WAAW,GAAG,UAAU,CAAC;AAClC,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TypographyVariant } from '@mui/material/styles';
|
|
3
|
+
import { SvgIconProps } from '@mui/material';
|
|
4
|
+
import { ButtonProps } from '../types/ButtonProps';
|
|
5
|
+
import { FieldProps } from '@/types/FieldProps';
|
|
6
|
+
import { BorderProps, ColorProps, LayoutProps } from '@pipelinesolucoes/theme';
|
|
7
|
+
import { ClickResult } from '../types/ClickResult';
|
|
8
|
+
export interface FormMessageProps extends ColorProps, BorderProps, ButtonProps, FieldProps, LayoutProps {
|
|
9
|
+
Icon?: React.ElementType<SvgIconProps>;
|
|
10
|
+
titulo?: () => React.ReactElement;
|
|
11
|
+
textButton?: string;
|
|
12
|
+
variantButton?: TypographyVariant;
|
|
13
|
+
rowsMessage?: number;
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
onClick?: (data: {
|
|
16
|
+
nome: string;
|
|
17
|
+
email: string;
|
|
18
|
+
telefone: string;
|
|
19
|
+
mensagem: string;
|
|
20
|
+
}) => Promise<ClickResult> | ClickResult;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Componente de formulário para envio de mensagem (contato), com campos controlados internamente
|
|
24
|
+
* (**nome**, **email**, **telefone** e **mensagem**) e submissão via callback assíncrono (`onClick`).
|
|
25
|
+
*
|
|
26
|
+
* Funcionalidades principais:
|
|
27
|
+
* - Renderiza campos de texto com validação (via `TextFieldValidate`) e feedback de erro ao usuário.
|
|
28
|
+
* - Validação local mínima para **email** antes de disparar o `onClick`.
|
|
29
|
+
* - Exibe mensagem de retorno (sucesso/erro) após execução do `onClick`, com cor configurável.
|
|
30
|
+
* - Suporta cabeçalho opcional com ícone (`Icon`) e título customizado (`titulo`).
|
|
31
|
+
* - Permite conteúdo adicional via `children` abaixo do feedback do formulário.
|
|
32
|
+
*
|
|
33
|
+
* Tokens de estilo (ordem de prioridade):
|
|
34
|
+
* - Container do formulário (`StyledRoot`):
|
|
35
|
+
* - `background` → `theme.pipelinesolucoes.forms.background` → `'transparent'`
|
|
36
|
+
* - `borderRadius` → `theme.pipelinesolucoes.forms.borderRadius` → `'0'`
|
|
37
|
+
* - `border` → `theme.pipelinesolucoes.forms.border` → `'0'`
|
|
38
|
+
* - `boxShadow` → `theme.pipelinesolucoes.forms.boxShadow` → `'none'`
|
|
39
|
+
* - `maxWidth` → *(sem token de theme neste componente)* → *(comportamento do styled component)*
|
|
40
|
+
* - Campos (`TextFieldValidate`), aplicados igualmente a todos os campos:
|
|
41
|
+
* - `backgroundField` → `theme.pipelinesolucoes.forms.field.background` → `undefined`
|
|
42
|
+
* - `colorField` → `theme.pipelinesolucoes.forms.field.color` → `undefined`
|
|
43
|
+
* - `borderRadiusField` → `theme.pipelinesolucoes.forms.field.borderRadius` → `undefined`
|
|
44
|
+
* - `boxShadowField` → `theme.pipelinesolucoes.forms.field.boxShadow` → `undefined`
|
|
45
|
+
* - `borderColorField` → `theme.pipelinesolucoes.forms.field.borderColor` → `undefined`
|
|
46
|
+
* - `paddingField` → `theme.pipelinesolucoes.forms.field.padding` → `undefined`
|
|
47
|
+
* - `marginField` → `theme.pipelinesolucoes.forms.field.margin` → `undefined`
|
|
48
|
+
* - `heightField` → `theme.pipelinesolucoes.forms.field.height` → `undefined`
|
|
49
|
+
* - Botão (`ButtonFormStyled`):
|
|
50
|
+
* - `backgroundButton` → `theme.pipelinesolucoes.forms.button.background` → `undefined`
|
|
51
|
+
* - `backgroundHoverButton` → `theme.pipelinesolucoes.forms.button.backgroundHover` → `undefined`
|
|
52
|
+
* - `colorButton` → `theme.pipelinesolucoes.forms.button.color` → `undefined`
|
|
53
|
+
* - `colorHoverButton` → `theme.pipelinesolucoes.forms.button.colorHover` → `undefined`
|
|
54
|
+
* - `borderRadiusButton` → `theme.pipelinesolucoes.forms.button.borderRadius` → `undefined`
|
|
55
|
+
* - `boxShadowButton` → `theme.pipelinesolucoes.forms.button.boxShadow` → `undefined`
|
|
56
|
+
* - `paddingButton` → `theme.pipelinesolucoes.forms.button.padding` → `undefined`
|
|
57
|
+
* - `borderButton` → *(prop do componente)* → `'none'`
|
|
58
|
+
* - `widthButton` → *(prop do componente)* → `'auto'`
|
|
59
|
+
* - `heightButton` → *(prop do componente)* → `'auto'`
|
|
60
|
+
* - `marginButton` → *(prop do componente)* → `'0'`
|
|
61
|
+
*
|
|
62
|
+
* Tipografia:
|
|
63
|
+
* - O texto do botão é renderizado com `Typography` do Material UI.
|
|
64
|
+
* - Ordem de prioridade:
|
|
65
|
+
* - `variantButton` → *(fallback interno)* `'body1'`
|
|
66
|
+
* - Observação: `variantButton` aceita qualquer `TypographyVariant` compatível com o theme do Material UI.
|
|
67
|
+
*
|
|
68
|
+
* @param {import('@mui/material/styles').TypographyVariant} [variantButton]
|
|
69
|
+
* Variante tipográfica do texto do botão (`Typography variant`).
|
|
70
|
+
* Ordem: `variantButton` → `'body1'`.
|
|
71
|
+
*
|
|
72
|
+
* @param {string} [textButton]
|
|
73
|
+
* Texto exibido no botão quando não está carregando.
|
|
74
|
+
* Padrão: `'Enviar'`.
|
|
75
|
+
*
|
|
76
|
+
* @param {number} [rowsMessage]
|
|
77
|
+
* Número de linhas do campo **Mensagem** quando `multiline` está ativo.
|
|
78
|
+
* Padrão: `5`.
|
|
79
|
+
*
|
|
80
|
+
* @param {React.ElementType<import('@mui/material').SvgIconProps>} [Icon]
|
|
81
|
+
* Componente de ícone (ex.: `EmailOutlined`, `ChatOutlined`) renderizado no cabeçalho do formulário.
|
|
82
|
+
* Renderizado apenas quando fornecido.
|
|
83
|
+
*
|
|
84
|
+
* @param {() => React.ReactElement} [titulo]
|
|
85
|
+
* Função que retorna o elemento React usado como título no cabeçalho do formulário.
|
|
86
|
+
* Renderizado apenas quando fornecido.
|
|
87
|
+
*
|
|
88
|
+
* @param {React.ReactNode} [children]
|
|
89
|
+
* Conteúdo adicional renderizado ao final do componente (abaixo da mensagem de feedback da API).
|
|
90
|
+
*
|
|
91
|
+
* @param {(data: { nome: string; email: string; telefone: string; mensagem: string; }) => (Promise<import('../types/ClickResult').ClickResult> | import('../types/ClickResult').ClickResult)} [onClick]
|
|
92
|
+
* Callback acionado ao clicar no botão (submissão). Recebe os valores atuais dos campos do formulário.
|
|
93
|
+
* - Se ausente, o componente exibe a mensagem: **"Nenhuma ação foi configurada para o botão."**
|
|
94
|
+
* - Se retornar `{ success: true }`, exibe `message` com cor `color` (ou `theme.palette.success.main` como fallback).
|
|
95
|
+
* - Se retornar `{ success: false }`, exibe `message` com cor `color` (ou `theme.palette.error.main` como fallback).
|
|
96
|
+
* - Em exceção (`throw`), exibe: **"Erro inesperado ao processar a solicitação."** com `theme.palette.error.main`.
|
|
97
|
+
*
|
|
98
|
+
* Estilo / Aparência:
|
|
99
|
+
* @param {import('@pipelinesolucoes/theme').ColorProps['background']} [background]
|
|
100
|
+
* Background do container do formulário.
|
|
101
|
+
* Ordem: `background` → `theme.pipelinesolucoes.forms.background` → `'transparent'`.
|
|
102
|
+
*
|
|
103
|
+
* @param {import('@pipelinesolucoes/theme').BorderProps['borderRadius']} [borderRadius]
|
|
104
|
+
* Raio de borda do container do formulário.
|
|
105
|
+
* Ordem: `borderRadius` → `theme.pipelinesolucoes.forms.borderRadius` → `'0'`.
|
|
106
|
+
*
|
|
107
|
+
* @param {import('@pipelinesolucoes/theme').BorderProps['border']} [border]
|
|
108
|
+
* Borda do container do formulário.
|
|
109
|
+
* Ordem: `border` → `theme.pipelinesolucoes.forms.border` → `'0'`.
|
|
110
|
+
*
|
|
111
|
+
* @param {import('@pipelinesolucoes/theme').LayoutProps['boxShadow']} [boxShadow]
|
|
112
|
+
* Sombra do container do formulário.
|
|
113
|
+
* Ordem: `boxShadow` → `theme.pipelinesolucoes.forms.boxShadow` → `'none'`.
|
|
114
|
+
*
|
|
115
|
+
* @param {import('@pipelinesolucoes/theme').LayoutProps['maxWidth']} [maxWidth]
|
|
116
|
+
* Largura máxima do container do formulário. *(Sem token de theme aplicado diretamente neste componente.)*
|
|
117
|
+
*
|
|
118
|
+
* @param {import('@/types/FieldProps').FieldProps['backgroundField']} [backgroundField]
|
|
119
|
+
* Background aplicado aos campos (`TextFieldValidate`).
|
|
120
|
+
* Ordem: `backgroundField` → `theme.pipelinesolucoes.forms.field.background` → `undefined`.
|
|
121
|
+
*
|
|
122
|
+
* @param {import('@/types/FieldProps').FieldProps['colorField']} [colorField]
|
|
123
|
+
* Cor do texto aplicada aos campos (`TextFieldValidate`).
|
|
124
|
+
* Ordem: `colorField` → `theme.pipelinesolucoes.forms.field.color` → `undefined`.
|
|
125
|
+
*
|
|
126
|
+
* @param {import('@/types/FieldProps').FieldProps['borderRadiusField']} [borderRadiusField]
|
|
127
|
+
* Raio de borda aplicado aos campos (`TextFieldValidate`).
|
|
128
|
+
* Ordem: `borderRadiusField` → `theme.pipelinesolucoes.forms.field.borderRadius` → `undefined`.
|
|
129
|
+
*
|
|
130
|
+
* @param {import('@/types/FieldProps').FieldProps['boxShadowField']} [boxShadowField]
|
|
131
|
+
* Sombra aplicada aos campos (`TextFieldValidate`).
|
|
132
|
+
* Ordem: `boxShadowField` → `theme.pipelinesolucoes.forms.field.boxShadow` → `undefined`.
|
|
133
|
+
*
|
|
134
|
+
* @param {import('@/types/FieldProps').FieldProps['borderColorField']} [borderColorField]
|
|
135
|
+
* Cor da borda aplicada aos campos (`TextFieldValidate`).
|
|
136
|
+
* Ordem: `borderColorField` → `theme.pipelinesolucoes.forms.field.borderColor` → `undefined`.
|
|
137
|
+
*
|
|
138
|
+
* @param {import('@/types/FieldProps').FieldProps['paddingField']} [paddingField]
|
|
139
|
+
* Padding aplicado aos campos (`TextFieldValidate`).
|
|
140
|
+
* Ordem: `paddingField` → `theme.pipelinesolucoes.forms.field.padding` → `undefined`.
|
|
141
|
+
*
|
|
142
|
+
* @param {import('@/types/FieldProps').FieldProps['marginField']} [marginField]
|
|
143
|
+
* Margem aplicada aos campos (`TextFieldValidate`).
|
|
144
|
+
* Ordem: `marginField` → `theme.pipelinesolucoes.forms.field.margin` → `undefined`.
|
|
145
|
+
*
|
|
146
|
+
* @param {import('@/types/FieldProps').FieldProps['heightField']} [heightField]
|
|
147
|
+
* Altura aplicada aos campos (`TextFieldValidate`).
|
|
148
|
+
* Ordem: `heightField` → `theme.pipelinesolucoes.forms.field.height` → `undefined`.
|
|
149
|
+
*
|
|
150
|
+
* @param {import('../types/ButtonProps').ButtonProps['backgroundButton']} [backgroundButton]
|
|
151
|
+
* Background do botão.
|
|
152
|
+
* Ordem: `backgroundButton` → `theme.pipelinesolucoes.forms.button.background` → `undefined`.
|
|
153
|
+
*
|
|
154
|
+
* @param {import('../types/ButtonProps').ButtonProps['backgroundHoverButton']} [backgroundHoverButton]
|
|
155
|
+
* Background do botão em hover.
|
|
156
|
+
* Ordem: `backgroundHoverButton` → `theme.pipelinesolucoes.forms.button.backgroundHover` → `undefined`.
|
|
157
|
+
*
|
|
158
|
+
* @param {import('../types/ButtonProps').ButtonProps['colorButton']} [colorButton]
|
|
159
|
+
* Cor do texto do botão.
|
|
160
|
+
* Ordem: `colorButton` → `theme.pipelinesolucoes.forms.button.color` → `undefined`.
|
|
161
|
+
*
|
|
162
|
+
* @param {import('../types/ButtonProps').ButtonProps['colorHoverButton']} [colorHoverButton]
|
|
163
|
+
* Cor do texto do botão em hover.
|
|
164
|
+
* Ordem: `colorHoverButton` → `theme.pipelinesolucoes.forms.button.colorHover` → `undefined`.
|
|
165
|
+
*
|
|
166
|
+
* @param {import('../types/ButtonProps').ButtonProps['borderRadiusButton']} [borderRadiusButton]
|
|
167
|
+
* Raio de borda do botão.
|
|
168
|
+
* Ordem: `borderRadiusButton` → `theme.pipelinesolucoes.forms.button.borderRadius` → `undefined`.
|
|
169
|
+
*
|
|
170
|
+
* @param {import('../types/ButtonProps').ButtonProps['borderButton']} [borderButton]
|
|
171
|
+
* Borda do botão.
|
|
172
|
+
* Ordem: `borderButton` → `'none'`.
|
|
173
|
+
*
|
|
174
|
+
* @param {import('../types/ButtonProps').ButtonProps['boxShadowButton']} [boxShadowButton]
|
|
175
|
+
* Sombra do botão.
|
|
176
|
+
* Ordem: `boxShadowButton` → `theme.pipelinesolucoes.forms.button.boxShadow` → `undefined`.
|
|
177
|
+
*
|
|
178
|
+
* @param {import('../types/ButtonProps').ButtonProps['widthButton']} [widthButton]
|
|
179
|
+
* Largura do botão.
|
|
180
|
+
* Ordem: `widthButton` → `'auto'`.
|
|
181
|
+
*
|
|
182
|
+
* @param {import('../types/ButtonProps').ButtonProps['heightButton']} [heightButton]
|
|
183
|
+
* Altura do botão.
|
|
184
|
+
* Ordem: `heightButton` → `'auto'`.
|
|
185
|
+
*
|
|
186
|
+
* @param {import('../types/ButtonProps').ButtonProps['paddingButton']} [paddingButton]
|
|
187
|
+
* Padding do botão.
|
|
188
|
+
* Ordem: `paddingButton` → `theme.pipelinesolucoes.forms.button.padding` → `undefined`.
|
|
189
|
+
*
|
|
190
|
+
* @param {import('../types/ButtonProps').ButtonProps['marginButton']} [marginButton]
|
|
191
|
+
* Margem do botão.
|
|
192
|
+
* Ordem: `marginButton` → `'0'`.
|
|
193
|
+
*
|
|
194
|
+
* Validação:
|
|
195
|
+
* - Email: validação local por regex simples (`/\S+@\S+\.\S+/`) antes de executar `onClick`.
|
|
196
|
+
* - Campos: cada `TextFieldValidate` recebe `required` e `showErrorOn="blur"`, além de validações específicas:
|
|
197
|
+
* - `validateEmailMessage` para email.
|
|
198
|
+
* - `validateTelefoneMessage` para telefone.
|
|
199
|
+
*
|
|
200
|
+
* Eventos:
|
|
201
|
+
* - Clique no botão: dispara `handleClick`, que:
|
|
202
|
+
* - Prevê `preventDefault()` no evento de formulário.
|
|
203
|
+
* - Bloqueia envio se email inválido e exibe mensagem padrão de erro.
|
|
204
|
+
* - Desabilita o botão enquanto `isLoading` estiver `true`, exibindo "Enviando...".
|
|
205
|
+
*
|
|
206
|
+
* @example
|
|
207
|
+
* ```tsx
|
|
208
|
+
* import FormMessage from './FormMessage';
|
|
209
|
+
* import EmailOutlined from '@mui/icons-material/EmailOutlined';
|
|
210
|
+
*
|
|
211
|
+
* export function Contato() {
|
|
212
|
+
* return (
|
|
213
|
+
* <FormMessage
|
|
214
|
+
* Icon={EmailOutlined}
|
|
215
|
+
* titulo={() => <strong>Fale conosco</strong>}
|
|
216
|
+
* textButton="Enviar mensagem"
|
|
217
|
+
* variantButton="body2"
|
|
218
|
+
* rowsMessage={6}
|
|
219
|
+
* onClick={async ({ nome, email, telefone, mensagem }) => {
|
|
220
|
+
* // Exemplo: chamada de API
|
|
221
|
+
* const ok = Boolean(nome && email && telefone && mensagem);
|
|
222
|
+
* return ok
|
|
223
|
+
* ? { success: true, message: 'Mensagem enviada com sucesso!' }
|
|
224
|
+
* : { success: false, message: 'Não foi possível enviar a mensagem.' };
|
|
225
|
+
* }}
|
|
226
|
+
* >
|
|
227
|
+
* <small>Responderemos em até 1 dia útil.</small>
|
|
228
|
+
* </FormMessage>
|
|
229
|
+
* );
|
|
230
|
+
* }
|
|
231
|
+
* ```
|
|
232
|
+
*
|
|
233
|
+
* @example
|
|
234
|
+
* ```ts
|
|
235
|
+
* // Exemplo de configuração no theme (Pipeline)
|
|
236
|
+
* const theme = {
|
|
237
|
+
* pipelinesolucoes: {
|
|
238
|
+
* forms: {
|
|
239
|
+
* background: 'transparent',
|
|
240
|
+
* borderRadius: '8px',
|
|
241
|
+
* border: '1px solid rgba(0,0,0,0.12)',
|
|
242
|
+
* boxShadow: 'none',
|
|
243
|
+
* field: {
|
|
244
|
+
* background: '#fff',
|
|
245
|
+
* color: '#111',
|
|
246
|
+
* borderRadius: '8px',
|
|
247
|
+
* borderColor: 'rgba(0,0,0,0.23)',
|
|
248
|
+
* boxShadow: 'none',
|
|
249
|
+
* padding: '12px',
|
|
250
|
+
* margin: '0 0 12px 0',
|
|
251
|
+
* height: '48px',
|
|
252
|
+
* },
|
|
253
|
+
* button: {
|
|
254
|
+
* background: '#111',
|
|
255
|
+
* backgroundHover: '#222',
|
|
256
|
+
* color: '#fff',
|
|
257
|
+
* colorHover: '#fff',
|
|
258
|
+
* borderRadius: '8px',
|
|
259
|
+
* boxShadow: 'none',
|
|
260
|
+
* padding: '12px 16px',
|
|
261
|
+
* },
|
|
262
|
+
* },
|
|
263
|
+
* },
|
|
264
|
+
* };
|
|
265
|
+
* ```
|
|
266
|
+
*/
|
|
267
|
+
declare const FormMessage: React.FC<FormMessageProps>;
|
|
268
|
+
export default FormMessage;
|