@pipelinesolucoes/form 1.2.0-beta.3 → 1.2.0-beta.31

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.
Files changed (73) hide show
  1. package/README.md +16 -2
  2. package/dist/components/ChipList.d.ts +9 -0
  3. package/dist/components/ChipList.js +60 -0
  4. package/dist/components/ChipList.js.map +1 -0
  5. package/dist/components/SelectField.d.ts +73 -0
  6. package/dist/components/SelectField.js +142 -0
  7. package/dist/components/SelectField.js.map +1 -0
  8. package/dist/components/TextFieldBirthDateWithAge.d.ts +83 -0
  9. package/dist/components/TextFieldBirthDateWithAge.js +277 -0
  10. package/dist/components/TextFieldBirthDateWithAge.js.map +1 -0
  11. package/dist/components/TextFieldCPFValidate.d.ts +37 -0
  12. package/dist/components/TextFieldCPFValidate.js +147 -0
  13. package/dist/components/TextFieldCPFValidate.js.map +1 -0
  14. package/dist/components/TextFieldNumberValidate.d.ts +110 -0
  15. package/dist/components/TextFieldNumberValidate.js +196 -0
  16. package/dist/components/TextFieldNumberValidate.js.map +1 -0
  17. package/dist/components/TextFieldPassword.d.ts +141 -53
  18. package/dist/components/TextFieldPassword.js +161 -98
  19. package/dist/components/TextFieldPassword.js.map +1 -1
  20. package/dist/components/TextFieldValidate.d.ts +89 -43
  21. package/dist/components/TextFieldValidate.js +103 -94
  22. package/dist/components/TextFieldValidate.js.map +1 -1
  23. package/dist/components/login/FormLogin.d.ts +129 -6
  24. package/dist/components/login/FormLogin.js +155 -29
  25. package/dist/components/login/FormLogin.js.map +1 -1
  26. package/dist/components/login/FormPasswordRecovery.d.ts +97 -89
  27. package/dist/components/login/FormPasswordRecovery.js +131 -124
  28. package/dist/components/login/FormPasswordRecovery.js.map +1 -1
  29. package/dist/components/login/FormSignUp.d.ts +130 -11
  30. package/dist/components/login/FormSignUp.js +154 -29
  31. package/dist/components/login/FormSignUp.js.map +1 -1
  32. package/dist/components/login/StyleLogin.d.ts +7 -0
  33. package/dist/components/login/StyleLogin.js +16 -1
  34. package/dist/components/login/StyleLogin.js.map +1 -1
  35. package/dist/components/recaptcha/RecaptchaForm.d.ts +8 -14
  36. package/dist/components/recaptcha/RecaptchaForm.js +30 -25
  37. package/dist/components/recaptcha/RecaptchaForm.js.map +1 -1
  38. package/dist/constant.d.ts +11 -0
  39. package/dist/constant.js +12 -0
  40. package/dist/constant.js.map +1 -0
  41. package/dist/index.d.ts +8 -0
  42. package/dist/index.js +8 -0
  43. package/dist/index.js.map +1 -1
  44. package/dist/{components/style → style}/ButtonFormStyled.d.ts +1 -1
  45. package/dist/{components/style → style}/ButtonFormStyled.js +6 -5
  46. package/dist/style/ButtonFormStyled.js.map +1 -0
  47. package/dist/{components/style → style}/LinkFormStyled.d.ts +1 -1
  48. package/dist/{components/style → style}/LinkFormStyled.js +5 -4
  49. package/dist/style/LinkFormStyled.js.map +1 -0
  50. package/dist/style/TextFieldStyle.d.ts +19 -0
  51. package/dist/style/TextFieldStyle.js +61 -0
  52. package/dist/style/TextFieldStyle.js.map +1 -0
  53. package/dist/theme.js +46 -18
  54. package/dist/theme.js.map +1 -1
  55. package/dist/tsconfig.tsbuildinfo +1 -1
  56. package/dist/types/FieldProps.d.ts +1 -0
  57. package/dist/utils/formatCEP.d.ts +20 -0
  58. package/dist/utils/formatCEP.js +35 -0
  59. package/dist/utils/formatCEP.js.map +1 -0
  60. package/dist/utils/formatCpf.d.ts +14 -0
  61. package/dist/utils/formatCpf.js +35 -0
  62. package/dist/utils/formatCpf.js.map +1 -0
  63. package/dist/utils/validateCpf.d.ts +40 -0
  64. package/dist/utils/validateCpf.js +67 -0
  65. package/dist/utils/validateCpf.js.map +1 -0
  66. package/dist/utils/validateEmail.js +1 -1
  67. package/dist/utils/validateEmail.js.map +1 -1
  68. package/package.json +4 -2
  69. package/dist/components/recaptcha/FormStyled.d.ts +0 -30
  70. package/dist/components/recaptcha/FormStyled.js +0 -67
  71. package/dist/components/recaptcha/FormStyled.js.map +0 -1
  72. package/dist/components/style/ButtonFormStyled.js.map +0 -1
  73. package/dist/components/style/LinkFormStyled.js.map +0 -1
@@ -0,0 +1,277 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import { useTheme } from '@mui/material/styles';
4
+ import { TextFieldStyled } from '../style/TextFieldStyle';
5
+ import { fbbackground, fbbackgroundDisabled, fbborderColor, fbborderRadius, fbboxShadow, fbcolor, fbcolorDisabled, fbcolorFocused, fbheigth, fbpadding, } from '../constant';
6
+ const onlyNumbers = (raw) => (raw !== null && raw !== void 0 ? raw : '').replace(/[^\d]/g, '');
7
+ const normalizeTwoDigitYearToFourDigits = (yy) => {
8
+ const safeYY = (yy !== null && yy !== void 0 ? yy : '').slice(0, 2);
9
+ const n = Number(safeYY);
10
+ if (!safeYY || safeYY.length !== 2 || !Number.isFinite(n))
11
+ return safeYY;
12
+ const now = new Date();
13
+ const currentYear = now.getFullYear();
14
+ const currentYY = currentYear % 100;
15
+ const currentCentury = Math.floor(currentYear / 100);
16
+ // Ex.: em 2026 -> 00..26 => 20xx; 27..99 => 19xx
17
+ const century = n <= currentYY ? currentCentury : currentCentury - 1;
18
+ return `${century}${safeYY}`;
19
+ };
20
+ /**
21
+ * Máscara durante digitação:
22
+ * - Usuário digita só números (até 8)
23
+ * - Formata como dd/mm/yyyy conforme for completando
24
+ * - NÃO normaliza ano com 2 dígitos durante o change
25
+ */
26
+ const formatBirthDate = (raw) => {
27
+ const digits = onlyNumbers(raw).slice(0, 8);
28
+ if (digits.length <= 2)
29
+ return digits;
30
+ if (digits.length <= 4)
31
+ return `${digits.slice(0, 2)}/${digits.slice(2)}`;
32
+ const dd = digits.slice(0, 2);
33
+ const mm = digits.slice(2, 4);
34
+ const yyyy = digits.slice(4); // 1..4
35
+ return `${dd}/${mm}/${yyyy}`;
36
+ };
37
+ const normalizeBirthDateYearOnBlur = (formatted) => {
38
+ // Normaliza somente se estiver exatamente dd/mm/yy
39
+ if (!/^\d{2}\/\d{2}\/\d{2}$/.test(formatted))
40
+ return formatted;
41
+ const [dd, mm, yy] = formatted.split('/');
42
+ const yyyy = normalizeTwoDigitYearToFourDigits(yy);
43
+ return `${dd}/${mm}/${yyyy}`;
44
+ };
45
+ const isValidBirthDate = (formatted) => {
46
+ if (!/^\d{2}\/\d{2}\/\d{4}$/.test(formatted))
47
+ return false;
48
+ const [ddStr, mmStr, yyyyStr] = formatted.split('/');
49
+ const dd = Number(ddStr);
50
+ const mm = Number(mmStr);
51
+ const yyyy = Number(yyyyStr);
52
+ if (!Number.isFinite(dd) || !Number.isFinite(mm) || !Number.isFinite(yyyy))
53
+ return false;
54
+ if (yyyy < 1900 || yyyy > 3000)
55
+ return false;
56
+ if (mm < 1 || mm > 12)
57
+ return false;
58
+ if (dd < 1 || dd > 31)
59
+ return false;
60
+ const date = new Date(yyyy, mm - 1, dd);
61
+ if (Number.isNaN(date.getTime()))
62
+ return false;
63
+ return (date.getFullYear() === yyyy &&
64
+ date.getMonth() === mm - 1 &&
65
+ date.getDate() === dd);
66
+ };
67
+ const calculateAgeFromFormatted = (formatted) => {
68
+ if (!isValidBirthDate(formatted))
69
+ return null;
70
+ const [ddStr, mmStr, yyyyStr] = formatted.split('/');
71
+ const dd = Number(ddStr);
72
+ const mm = Number(mmStr);
73
+ const yyyy = Number(yyyyStr);
74
+ const birth = new Date(yyyy, mm - 1, dd);
75
+ const today = new Date();
76
+ const todayAtMidnight = new Date(today.getFullYear(), today.getMonth(), today.getDate());
77
+ if (birth.getTime() > todayAtMidnight.getTime())
78
+ return null;
79
+ let age = today.getFullYear() - birth.getFullYear();
80
+ const monthDiff = today.getMonth() - birth.getMonth();
81
+ if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birth.getDate())) {
82
+ age--;
83
+ }
84
+ return age >= 0 ? age : null;
85
+ };
86
+ const computeError = (value, { required, requiredMessage, minLength, maxLength, pattern, patternMessage, validate, }) => {
87
+ const v = value !== null && value !== void 0 ? value : '';
88
+ if (required && v.trim().length === 0)
89
+ return requiredMessage || 'Campo obrigatório';
90
+ if (typeof minLength === 'number' && v.length < minLength) {
91
+ return `Mínimo de ${minLength} caracteres`;
92
+ }
93
+ if (typeof maxLength === 'number' && v.length > maxLength) {
94
+ return `Máximo de ${maxLength} caracteres`;
95
+ }
96
+ if (pattern) {
97
+ const re = typeof pattern === 'string' ? new RegExp(pattern) : pattern;
98
+ if (!re.test(v))
99
+ return patternMessage || 'Formato inválido';
100
+ }
101
+ if (validate) {
102
+ const customMsg = validate(v);
103
+ if (typeof customMsg === 'string' && customMsg)
104
+ return customMsg;
105
+ }
106
+ return null;
107
+ };
108
+ /**
109
+ * Campo de data de nascimento com entrada somente numérica, máscara `dd/mm/yyyy`,
110
+ * validações comuns (required, min/maxLength, pattern) + validação customizada,
111
+ * e cálculo automático de idade exibido na label.
112
+ *
113
+ * Regras:
114
+ * - O usuário digita apenas números.
115
+ * - Ao digitar, o valor é formatado automaticamente como `dd/mm/yyyy` (sem normalizar ano).
116
+ * - Ao perder o foco, se estiver em `dd/mm/yy`, o componente normaliza o ano para 4 dígitos.
117
+ * - Quando a data estiver completa e for válida, a idade é calculada e exibida na label.
118
+ * - Erros sempre têm prioridade no helperText (a label não exibe idade quando há erro).
119
+ *
120
+ * Tokens de estilo (ordem de prioridade):
121
+ * - props do componente
122
+ * - `theme.pipelinesolucoes.forms.field`
123
+ * - fallback interno (constantes `fb*`)
124
+ *
125
+ * @param {string} [id] Identificador do campo.
126
+ * @param {string} [label] Rótulo exibido acima do campo.
127
+ * @param {string} [placeholder='dd/mm/aaaa'] Placeholder do input.
128
+ * @param {string} [value] Valor do campo (controlado).
129
+ * @param {boolean} [disabled=false] Define se o campo está desabilitado.
130
+ *
131
+ * @param {number} [minLength] Número mínimo de caracteres para validação (após máscara).
132
+ * @param {number} [maxLength] Número máximo de caracteres para validação (após máscara).
133
+ *
134
+ * @param {boolean} [required=false] Define se é obrigatório.
135
+ * @param {string} [requiredMessage='Campo obrigatório'] Mensagem de obrigatório.
136
+ * @param {RegExp | string} [pattern] Pattern para validação do valor formatado.
137
+ * @param {string} [patternMessage='Formato inválido'] Mensagem do pattern.
138
+ * @param {'change' | 'blur'} [showErrorOn='blur'] Momento de exibir o erro.
139
+ * @param {(value: string) => string | null | undefined} [validate] Validação customizada do valor formatado.
140
+ *
141
+ * @param {(age: number | null) => void} [onAgeChange] Callback com a idade calculada (ou null se inválido/incompleto).
142
+ * @param {(event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void} [onChange] Callback disparado ao alterar (já com valor formatado).
143
+ * @param {(event: React.FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => void} [onBlur] Callback disparado ao perder o foco.
144
+ *
145
+ * @example
146
+ * ```tsx
147
+ * const Example = () => {
148
+ * const [birthDate, setBirthDate] = React.useState('');
149
+ *
150
+ * return (
151
+ * <TextFieldBirthDateWithAge
152
+ * label="Data de nascimento"
153
+ * value={birthDate}
154
+ * required
155
+ * showErrorOn="blur"
156
+ * onChange={(e) => setBirthDate(e.target.value)}
157
+ * onAgeChange={(age) => console.log('idade', age)}
158
+ * />
159
+ * );
160
+ * };
161
+ * ```
162
+ */
163
+ const TextFieldBirthDateWithAge = ({ id, label, placeholder = 'dd/mm/aaaa', value = '', textVariant, background, backgroundFocused, backgroundDisabled, color, colorFocused, colorDisabled, borderRadius, boxShadow, borderColor, padding, height, disabled = false, minLength, maxLength, required = false, requiredMessage = 'Campo obrigatório', pattern, patternMessage = 'Formato inválido', validate, showErrorOn = 'blur', onChange, onBlur, onAgeChange, }) => {
164
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
165
+ const [touched, setTouched] = React.useState(false);
166
+ const formattedValue = React.useMemo(() => formatBirthDate(value), [value]);
167
+ const computedAge = React.useMemo(() => {
168
+ if (formattedValue.length !== 10)
169
+ return null;
170
+ return calculateAgeFromFormatted(formattedValue);
171
+ }, [formattedValue]);
172
+ React.useEffect(() => {
173
+ onAgeChange === null || onAgeChange === void 0 ? void 0 : onAgeChange(computedAge);
174
+ }, [computedAge, onAgeChange]);
175
+ const errorMessage = React.useMemo(() => {
176
+ const v = formattedValue;
177
+ const baseError = showErrorOn === 'change'
178
+ ? computeError(v, { required, requiredMessage, minLength, maxLength, pattern, patternMessage, validate })
179
+ : showErrorOn === 'blur' && touched
180
+ ? computeError(v, { required, requiredMessage, minLength, maxLength, pattern, patternMessage, validate })
181
+ : null;
182
+ if (baseError)
183
+ return baseError;
184
+ if (v.length === 10 && !isValidBirthDate(v))
185
+ return 'Data inválida';
186
+ if (v.length === 10 && isValidBirthDate(v) && computedAge === null)
187
+ return 'Data inválida';
188
+ return null;
189
+ }, [
190
+ formattedValue,
191
+ required,
192
+ requiredMessage,
193
+ minLength,
194
+ maxLength,
195
+ pattern,
196
+ patternMessage,
197
+ validate,
198
+ showErrorOn,
199
+ touched,
200
+ computedAge,
201
+ ]);
202
+ const computedLabel = computedAge !== null && !errorMessage
203
+ ? `${label !== null && label !== void 0 ? label : ''} (${computedAge} anos)`.trim()
204
+ : label;
205
+ const emitSyntheticChange = (baseEvent, nextValue) => {
206
+ if (!onChange)
207
+ return;
208
+ const syntheticEvent = Object.assign(Object.assign({}, baseEvent), { target: Object.assign(Object.assign({}, baseEvent.target), { value: nextValue }), currentTarget: Object.assign(Object.assign({}, baseEvent.currentTarget), { value: nextValue }) });
209
+ onChange(syntheticEvent);
210
+ };
211
+ const handleBlur = (event) => {
212
+ if (!touched)
213
+ setTouched(true);
214
+ // ✅ Normaliza ano (dd/mm/yy -> dd/mm/yyyy) SOMENTE no blur
215
+ const normalizedOnBlur = normalizeBirthDateYearOnBlur(formattedValue);
216
+ if (normalizedOnBlur !== formattedValue) {
217
+ emitSyntheticChange(event, normalizedOnBlur);
218
+ }
219
+ onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
220
+ };
221
+ const handleChange = (event) => {
222
+ if (!onChange)
223
+ return;
224
+ // ✅ Apenas máscara durante digitação (sem normalização do ano)
225
+ const next = formatBirthDate(event.target.value);
226
+ emitSyntheticChange(event, next);
227
+ };
228
+ const handleKeyDown = (event) => {
229
+ const allowed = [
230
+ 'Backspace',
231
+ 'Delete',
232
+ 'Tab',
233
+ 'Enter',
234
+ 'Escape',
235
+ 'ArrowLeft',
236
+ 'ArrowRight',
237
+ 'ArrowUp',
238
+ 'ArrowDown',
239
+ 'Home',
240
+ 'End',
241
+ ];
242
+ if (allowed.includes(event.key))
243
+ return;
244
+ if (event.ctrlKey || event.metaKey)
245
+ return;
246
+ if (!/^\d$/.test(event.key)) {
247
+ event.preventDefault();
248
+ }
249
+ };
250
+ const theme = useTheme();
251
+ const field = (_b = (_a = theme.pipelinesolucoes) === null || _a === void 0 ? void 0 : _a.forms) === null || _b === void 0 ? void 0 : _b.field;
252
+ const bg = (_c = background !== null && background !== void 0 ? background : field === null || field === void 0 ? void 0 : field.background) !== null && _c !== void 0 ? _c : fbbackground;
253
+ const bgFocused = (_d = backgroundFocused !== null && backgroundFocused !== void 0 ? backgroundFocused : field === null || field === void 0 ? void 0 : field.backgroundFocused) !== null && _d !== void 0 ? _d : bg;
254
+ const bgDisabled = (_e = backgroundDisabled !== null && backgroundDisabled !== void 0 ? backgroundDisabled : field === null || field === void 0 ? void 0 : field.backgroundDisabled) !== null && _e !== void 0 ? _e : fbbackgroundDisabled;
255
+ const txt = (_f = color !== null && color !== void 0 ? color : field === null || field === void 0 ? void 0 : field.color) !== null && _f !== void 0 ? _f : fbcolor;
256
+ const txtDisabled = (_g = colorDisabled !== null && colorDisabled !== void 0 ? colorDisabled : field === null || field === void 0 ? void 0 : field.colorDisabled) !== null && _g !== void 0 ? _g : fbcolorDisabled;
257
+ const br = (_h = borderRadius !== null && borderRadius !== void 0 ? borderRadius : field === null || field === void 0 ? void 0 : field.borderRadius) !== null && _h !== void 0 ? _h : fbborderRadius;
258
+ const sh = (_j = boxShadow !== null && boxShadow !== void 0 ? boxShadow : field === null || field === void 0 ? void 0 : field.boxShadow) !== null && _j !== void 0 ? _j : fbboxShadow;
259
+ const bd = (_k = borderColor !== null && borderColor !== void 0 ? borderColor : field === null || field === void 0 ? void 0 : field.borderColor) !== null && _k !== void 0 ? _k : fbborderColor;
260
+ const bdFocused = (_l = colorFocused !== null && colorFocused !== void 0 ? colorFocused : field === null || field === void 0 ? void 0 : field.colorFocused) !== null && _l !== void 0 ? _l : fbcolorFocused;
261
+ const pad = (_m = padding !== null && padding !== void 0 ? padding : field === null || field === void 0 ? void 0 : field.padding) !== null && _m !== void 0 ? _m : fbpadding;
262
+ const hg = (_o = height !== null && height !== void 0 ? height : field === null || field === void 0 ? void 0 : field.height) !== null && _o !== void 0 ? _o : fbheigth;
263
+ const typo = (_q = (_p = (textVariant && theme.typography[textVariant])) !== null && _p !== void 0 ? _p : field === null || field === void 0 ? void 0 : field.typography) !== null && _q !== void 0 ? _q : theme.typography.body1;
264
+ const helperText = errorMessage ? errorMessage : '\u00A0';
265
+ return (_jsx(TextFieldStyled, { id: id, label: computedLabel, placeholder: placeholder, value: formattedValue, typo: typo, onChange: handleChange, onBlur: handleBlur, background: bg, backgroundFocused: bgFocused, backgroundDisabled: bgDisabled, colorText: txt, colorFocused: bdFocused, colorDisabled: txtDisabled, borderRadius: br, boxShadow: sh, borderColor: bd, padding: pad, disabled: disabled, required: required, fullWidth: true, height: hg, error: Boolean(errorMessage), helperText: helperText, onKeyDown: handleKeyDown, slotProps: {
266
+ input: {
267
+ inputProps: {
268
+ inputMode: 'numeric',
269
+ pattern: '[0-9]*',
270
+ maxLength: 10,
271
+ },
272
+ },
273
+ } }));
274
+ };
275
+ TextFieldBirthDateWithAge.displayName = 'TextFieldBirthDateWithAge';
276
+ export default TextFieldBirthDateWithAge;
277
+ //# sourceMappingURL=TextFieldBirthDateWithAge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextFieldBirthDateWithAge.js","sourceRoot":"","sources":["../../src/components/TextFieldBirthDateWithAge.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAA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import { BorderProps, ColorProps, LayoutProps } from '@pipelinesolucoes/theme';
4
+ interface TextFieldCPFValidateProps extends Omit<ColorProps, 'backgroundHover' | 'colorHover'>, Omit<BorderProps, 'border'>, Pick<LayoutProps, 'height' | 'padding'> {
5
+ id?: string;
6
+ label?: string;
7
+ placeholder?: string;
8
+ value?: string;
9
+ textVariant?: TypographyVariant;
10
+ disabled?: boolean;
11
+ minLength?: number;
12
+ maxLength?: number;
13
+ required?: boolean;
14
+ requiredMessage?: string;
15
+ pattern?: RegExp | string;
16
+ patternMessage?: string;
17
+ showErrorOn?: 'change' | 'blur';
18
+ validate?: (value: string) => string | null | undefined;
19
+ invalidCpfMessage?: string;
20
+ onChange?: (event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
21
+ onBlur?: (event: React.FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
22
+ }
23
+ /**
24
+ * Campo de CPF com entrada somente numérica, máscara `000.000.000-00`,
25
+ * validações comuns (required, min/maxLength, pattern) + validação customizada.
26
+ *
27
+ * @example
28
+ * ```tsx
29
+ * <TextFieldCPFValidate
30
+ * label="CPF"
31
+ * value={cpf}
32
+ * onChange={(e) => setCpf(e.target.value)} // recebe SEMPRE o valor formatado
33
+ * />
34
+ * ```
35
+ */
36
+ declare const TextFieldCPFValidate: React.FC<TextFieldCPFValidateProps>;
37
+ export default TextFieldCPFValidate;
@@ -0,0 +1,147 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import { useTheme } from '@mui/material/styles';
4
+ import { TextFieldStyled } from '../style/TextFieldStyle';
5
+ import { fbbackground, fbbackgroundDisabled, fbborderColor, fbborderRadius, fbboxShadow, fbcolor, fbcolorDisabled, fbcolorFocused, fbheigth, fbpadding, } from '../constant';
6
+ import { formatCpf } from '../utils/formatCpf';
7
+ import { validateCpf } from '../utils/validateCpf';
8
+ const onlyNumbers = (raw) => (raw !== null && raw !== void 0 ? raw : '').replace(/[^\d]/g, '');
9
+ const isValidCpfFormatted = (formatted) => {
10
+ // aceita com máscara completa
11
+ if (!/^\d{3}\.\d{3}\.\d{3}-\d{2}$/.test(formatted))
12
+ return false;
13
+ const digits = onlyNumbers(formatted);
14
+ return validateCpf(digits);
15
+ };
16
+ const computeError = (value, { required, requiredMessage, minLength, maxLength, pattern, patternMessage, validate, }) => {
17
+ const v = value !== null && value !== void 0 ? value : '';
18
+ if (required && v.trim().length === 0)
19
+ return requiredMessage || 'Campo obrigatório';
20
+ if (typeof minLength === 'number' && v.length < minLength)
21
+ return `Mínimo de ${minLength} caracteres`;
22
+ if (typeof maxLength === 'number' && v.length > maxLength)
23
+ return `Máximo de ${maxLength} caracteres`;
24
+ if (pattern) {
25
+ const re = typeof pattern === 'string' ? new RegExp(pattern) : pattern;
26
+ if (!re.test(v))
27
+ return patternMessage || 'Formato inválido';
28
+ }
29
+ if (validate) {
30
+ const customMsg = validate(v);
31
+ if (typeof customMsg === 'string' && customMsg)
32
+ return customMsg;
33
+ }
34
+ return null;
35
+ };
36
+ /**
37
+ * Campo de CPF com entrada somente numérica, máscara `000.000.000-00`,
38
+ * validações comuns (required, min/maxLength, pattern) + validação customizada.
39
+ *
40
+ * @example
41
+ * ```tsx
42
+ * <TextFieldCPFValidate
43
+ * label="CPF"
44
+ * value={cpf}
45
+ * onChange={(e) => setCpf(e.target.value)} // recebe SEMPRE o valor formatado
46
+ * />
47
+ * ```
48
+ */
49
+ const TextFieldCPFValidate = ({ id, label = 'CPF', placeholder = '000.000.000-00', value = '', textVariant, background, backgroundFocused, backgroundDisabled, color, colorFocused, colorDisabled, borderRadius, boxShadow, borderColor, padding, height, disabled = false, minLength, maxLength, required = false, requiredMessage = 'Campo obrigatório', pattern, patternMessage = 'Formato inválido', validate, showErrorOn = 'blur', invalidCpfMessage = 'CPF inválido', onChange, onBlur, }) => {
50
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
51
+ const [touched, setTouched] = React.useState(false);
52
+ const formattedValue = React.useMemo(() => formatCpf(value), [value]);
53
+ const cpfValid = React.useMemo(() => {
54
+ // só valida quando estiver completo (14 com máscara)
55
+ if (formattedValue.length !== 14)
56
+ return null; // incompleto
57
+ return isValidCpfFormatted(formattedValue);
58
+ }, [formattedValue]);
59
+ const errorMessage = React.useMemo(() => {
60
+ const v = formattedValue;
61
+ const baseError = showErrorOn === 'change'
62
+ ? computeError(v, { required, requiredMessage, minLength, maxLength, pattern, patternMessage, validate })
63
+ : showErrorOn === 'blur' && touched
64
+ ? computeError(v, { required, requiredMessage, minLength, maxLength, pattern, patternMessage, validate })
65
+ : null;
66
+ if (baseError)
67
+ return baseError;
68
+ // valida CPF apenas quando completo
69
+ if (v.length === 14 && cpfValid === false)
70
+ return invalidCpfMessage;
71
+ return null;
72
+ }, [
73
+ formattedValue,
74
+ required,
75
+ requiredMessage,
76
+ minLength,
77
+ maxLength,
78
+ pattern,
79
+ patternMessage,
80
+ validate,
81
+ showErrorOn,
82
+ touched,
83
+ cpfValid,
84
+ invalidCpfMessage,
85
+ ]);
86
+ const handleBlur = (event) => {
87
+ if (!touched)
88
+ setTouched(true);
89
+ onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
90
+ };
91
+ const handleChange = (event) => {
92
+ if (!onChange)
93
+ return;
94
+ const next = formatCpf(event.target.value);
95
+ const syntheticEvent = Object.assign(Object.assign({}, event), { target: Object.assign(Object.assign({}, event.target), { value: next }), currentTarget: Object.assign(Object.assign({}, event.currentTarget), { value: next }) });
96
+ onChange(syntheticEvent);
97
+ };
98
+ const handleKeyDown = (event) => {
99
+ const allowed = [
100
+ 'Backspace',
101
+ 'Delete',
102
+ 'Tab',
103
+ 'Enter',
104
+ 'Escape',
105
+ 'ArrowLeft',
106
+ 'ArrowRight',
107
+ 'ArrowUp',
108
+ 'ArrowDown',
109
+ 'Home',
110
+ 'End',
111
+ ];
112
+ if (allowed.includes(event.key))
113
+ return;
114
+ if (event.ctrlKey || event.metaKey)
115
+ return;
116
+ if (!/^\d$/.test(event.key)) {
117
+ event.preventDefault();
118
+ }
119
+ };
120
+ const theme = useTheme();
121
+ const field = (_b = (_a = theme.pipelinesolucoes) === null || _a === void 0 ? void 0 : _a.forms) === null || _b === void 0 ? void 0 : _b.field;
122
+ const bg = (_c = background !== null && background !== void 0 ? background : field === null || field === void 0 ? void 0 : field.background) !== null && _c !== void 0 ? _c : fbbackground;
123
+ const bgFocused = (_d = backgroundFocused !== null && backgroundFocused !== void 0 ? backgroundFocused : field === null || field === void 0 ? void 0 : field.backgroundFocused) !== null && _d !== void 0 ? _d : bg;
124
+ const bgDisabled = (_e = backgroundDisabled !== null && backgroundDisabled !== void 0 ? backgroundDisabled : field === null || field === void 0 ? void 0 : field.backgroundDisabled) !== null && _e !== void 0 ? _e : fbbackgroundDisabled;
125
+ const txt = (_f = color !== null && color !== void 0 ? color : field === null || field === void 0 ? void 0 : field.color) !== null && _f !== void 0 ? _f : fbcolor;
126
+ const txtDisabled = (_g = colorDisabled !== null && colorDisabled !== void 0 ? colorDisabled : field === null || field === void 0 ? void 0 : field.colorDisabled) !== null && _g !== void 0 ? _g : fbcolorDisabled;
127
+ const br = (_h = borderRadius !== null && borderRadius !== void 0 ? borderRadius : field === null || field === void 0 ? void 0 : field.borderRadius) !== null && _h !== void 0 ? _h : fbborderRadius;
128
+ const sh = (_j = boxShadow !== null && boxShadow !== void 0 ? boxShadow : field === null || field === void 0 ? void 0 : field.boxShadow) !== null && _j !== void 0 ? _j : fbboxShadow;
129
+ const bd = (_k = borderColor !== null && borderColor !== void 0 ? borderColor : field === null || field === void 0 ? void 0 : field.borderColor) !== null && _k !== void 0 ? _k : fbborderColor;
130
+ const bdFocused = (_l = colorFocused !== null && colorFocused !== void 0 ? colorFocused : field === null || field === void 0 ? void 0 : field.colorFocused) !== null && _l !== void 0 ? _l : fbcolorFocused;
131
+ const pad = (_m = padding !== null && padding !== void 0 ? padding : field === null || field === void 0 ? void 0 : field.padding) !== null && _m !== void 0 ? _m : fbpadding;
132
+ const hg = (_o = height !== null && height !== void 0 ? height : field === null || field === void 0 ? void 0 : field.height) !== null && _o !== void 0 ? _o : fbheigth;
133
+ const typo = (_q = (_p = (textVariant && theme.typography[textVariant])) !== null && _p !== void 0 ? _p : field === null || field === void 0 ? void 0 : field.typography) !== null && _q !== void 0 ? _q : theme.typography.body1;
134
+ const helperText = errorMessage ? errorMessage : '\u00A0';
135
+ return (_jsx(TextFieldStyled, { id: id, label: label, placeholder: placeholder, value: formattedValue, typo: typo, onChange: handleChange, onBlur: handleBlur, background: bg, backgroundFocused: bgFocused, backgroundDisabled: bgDisabled, colorText: txt, colorFocused: bdFocused, colorDisabled: txtDisabled, borderRadius: br, boxShadow: sh, borderColor: bd, padding: pad, disabled: disabled, required: required, fullWidth: true, height: hg, error: Boolean(errorMessage), helperText: helperText, onKeyDown: handleKeyDown, slotProps: {
136
+ input: {
137
+ inputProps: {
138
+ inputMode: 'numeric',
139
+ pattern: '[0-9]*',
140
+ maxLength: 14, // 000.000.000-00
141
+ },
142
+ },
143
+ } }));
144
+ };
145
+ TextFieldCPFValidate.displayName = 'TextFieldCPFValidate';
146
+ export default TextFieldCPFValidate;
147
+ //# sourceMappingURL=TextFieldCPFValidate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextFieldCPFValidate.js","sourceRoot":"","sources":["../../src/components/TextFieldCPFValidate.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAqB,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEnE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,aAAa,EACb,cAAc,EACd,WAAW,EACX,OAAO,EACP,eAAe,EACf,cAAc,EACd,QAAQ,EACR,SAAS,GACV,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,WAA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AAK,CAAC;IAEzB,MAAM,UAAU,GAAG,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC;IAE1D,OAAO,CACL,KAAC,eAAe,IACd,EAAE,EAAE,EAAE,EACN,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,cAAc,EACrB,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,YAAY,EACtB,MAAM,EAAE,UAAU,EAClB,UAAU,EAAE,EAAE,EACd,iBAAiB,EAAE,SAAS,EAC5B,kBAAkB,EAAE,UAAU,EAC9B,SAAS,EAAE,GAAG,EACd,YAAY,EAAE,SAAS,EACvB,aAAa,EAAE,WAAW,EAC1B,YAAY,EAAE,EAAE,EAChB,SAAS,EAAE,EAAE,EACb,WAAW,EAAE,EAAE,EACf,OAAO,EAAE,GAAG,EACZ,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,SAAS,QACT,MAAM,EAAE,EAAE,EACV,KAAK,EAAE,OAAO,CAAC,YAAY,CAAC,EAC5B,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,aAAa,EACxB,SAAS,EAAE;YACT,KAAK,EAAE;gBACL,UAAU,EAAE;oBACV,SAAS,EAAE,SAAS;oBACpB,OAAO,EAAE,QAAQ;oBACjB,SAAS,EAAE,EAAE,EAAE,iBAAiB;iBACjC;aACF;SACF,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,oBAAoB,CAAC,WAAW,GAAG,sBAAsB,CAAC;AAE1D,eAAe,oBAAoB,CAAC"}
@@ -0,0 +1,110 @@
1
+ import React from 'react';
2
+ import { TypographyVariant } from '@mui/material/styles';
3
+ import { BorderProps, ColorProps, LayoutProps } from '@pipelinesolucoes/theme';
4
+ interface TextFieldNumberValidateProps extends Omit<ColorProps, 'backgroundHover' | 'colorHover'>, Omit<BorderProps, 'border'>, Pick<LayoutProps, 'height' | 'padding'> {
5
+ id?: string;
6
+ label?: string;
7
+ placeholder?: string;
8
+ value?: string;
9
+ textVariant?: TypographyVariant;
10
+ disabled?: boolean;
11
+ minLength?: number;
12
+ maxLength?: number;
13
+ required?: boolean;
14
+ requiredMessage?: string;
15
+ pattern?: RegExp | string;
16
+ patternMessage?: string;
17
+ showErrorOn?: 'change' | 'blur';
18
+ validate?: (value: string) => string | null | undefined;
19
+ onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
20
+ onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
21
+ }
22
+ /**
23
+ * Campo de texto numérico com suporte a validações comuns e customizadas, construído
24
+ * sobre o TextField do Material UI e estilizado via Design System da Pipeline.
25
+ *
26
+ * Diferença principal:
27
+ * - Este componente **aceita apenas números (0–9)**, removendo automaticamente qualquer caractere não numérico.
28
+ *
29
+ * Funcionalidades principais:
30
+ * - Suporte a modo controlado (`value`)
31
+ * - Validações nativas (obrigatório, tamanho mínimo, regex)
32
+ * - Validação customizada via função
33
+ * - Controle de momento de exibição do erro (`change` ou `blur`)
34
+ * - Suporte a campo multilinha (mantido por compatibilidade)
35
+ * - Customização visual via props e tokens de theme
36
+ *
37
+ * Tokens de estilo (ordem de prioridade):
38
+ * - `prop` do componente
39
+ * - `theme.pipelinesolucoes.forms.field`
40
+ * - Fallback interno (constantes `fb*`)
41
+ *
42
+ * Tipografia:
43
+ * - Suporte à tipografia do Material UI via `textVariant`
44
+ * - Fallback para `theme.pipelinesolucoes.forms.field.typography`
45
+ * - Fallback final para `theme.typography.body1`
46
+ *
47
+ * @param {string} [id] Identificador do campo, repassado ao input do Material UI.
48
+ * @param {string} [label] Texto do rótulo exibido acima do campo.
49
+ * @param {string} [placeholder] Texto exibido quando o campo está vazio.
50
+ * @param {string} [value] Valor atual do campo (modo controlado). Somente dígitos serão mantidos.
51
+ *
52
+ * @param {boolean} [disabled=false] Define se o campo está desabilitado.
53
+ *
54
+ * @param {number} [minLength] Número mínimo de caracteres permitidos.
55
+ * @param {number} [maxLength] Número máximo de caracteres permitidos.
56
+ *
57
+ * @param {boolean} [multiline=false] Define se o campo aceita múltiplas linhas (mantido por compatibilidade).
58
+ * @param {number} [rows=3] Quantidade de linhas visíveis quando `multiline` está ativo.
59
+ *
60
+ * ### Estilo / Aparência
61
+ * @param {import('@mui/material/styles').TypographyVariant} [textVariant] Variante tipográfica do Material UI aplicada ao texto e placeholder.
62
+ * @param {string} [background] Cor de fundo do campo.
63
+ * @param {string} [backgroundDisabled] Cor de fundo do campo quando desabilitado.
64
+ * @param {string} [backgroundFocused] Cor de fundo do campo quando focado.
65
+ * @param {string} [color] Cor do texto do campo (texto digitado e label).
66
+ * @param {string} [colorFocused] Cor aplicada ao estado focado (usada como cor de borda no focus).
67
+ * @param {string} [colorDisabled] Cor do texto do campo quando desabilitado.
68
+ * @param {string} [borderRadius] Raio da borda do campo.
69
+ * @param {string} [boxShadow] Sombra do campo.
70
+ * @param {string} [borderColor] Cor da borda do campo (estado padrão/hover).
71
+ * @param {string} [padding] Espaçamento interno do input (aplicado no texto e textarea).
72
+ *
73
+ * ---
74
+ * ### Validação
75
+ * @param {boolean} [required=false] Indica se o campo é obrigatório.
76
+ * @param {string} [requiredMessage] Mensagem exibida quando o campo obrigatório está vazio.
77
+ * @param {RegExp | string} [pattern] Expressão regular utilizada para validação do valor (aplicada após sanitização numérica).
78
+ * @param {string} [patternMessage] Mensagem exibida quando o valor não atende ao pattern.
79
+ * @param {'change' | 'blur'} [showErrorOn='blur'] Define quando o erro será exibido.
80
+ * @param {(value: string) => string | null | undefined} [validate] Função de validação customizada (recebe o valor sanitizado).
81
+ *
82
+ * ---
83
+ * ### Eventos
84
+ * @param {(event: React.ChangeEvent<HTMLInputElement>) => void} [onChange] Callback disparado ao alterar o valor (com `event.target.value` já sanitizado).
85
+ * @param {(event: React.FocusEvent<HTMLInputElement>) => void} [onBlur] Callback disparado ao perder o foco.
86
+ *
87
+ * @example
88
+ * ```tsx
89
+ * const Example = () => {
90
+ * const [age, setAge] = React.useState('');
91
+ *
92
+ * return (
93
+ * <TextFieldNumberValidate
94
+ * label="Idade"
95
+ * placeholder="Somente números"
96
+ * value={age}
97
+ * onChange={(e) => setAge(e.target.value)}
98
+ * required
99
+ * minLength={1}
100
+ * maxLength={3}
101
+ * showErrorOn="blur"
102
+ * borderRadius="6px"
103
+ * textVariant="subtitle2"
104
+ * />
105
+ * );
106
+ * };
107
+ * ```
108
+ */
109
+ declare const TextFieldNumberValidate: React.FC<TextFieldNumberValidateProps>;
110
+ export default TextFieldNumberValidate;