@zydon/common 2.4.86 → 2.4.88

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.
@@ -0,0 +1,7 @@
1
+ import { useFormContext, Controller } from 'react-hook-form';
2
+ import g from '@mui/material/TextField';
3
+ import { jsx } from 'react/jsx-runtime';
4
+
5
+ var C=({name:l,helperText:t,rules:n,onChange:r,tabIndex:m,className:u,id:a,forceShowHelperText:d,...e})=>{let{control:f}=useFormContext();return jsx(Controller,{name:l,control:f,rules:n,render:({field:{ref:F,value:P,...p},fieldState:{error:o}})=>jsx(g,{...p,value:P??"",onChange:s=>{p.onChange(s),r&&r(s);},inputRef:F,fullWidth:!0,error:!!o,helperText:d?t||o?.message:o?.message||t,"data-intercom-target":l,...e,InputLabelProps:{...e.InputLabelProps,htmlFor:a},inputProps:{...e.inputProps,tabIndex:m,"aria-label":e.label,id:a},className:`field-${l} ${u}`})})},L=C;
6
+
7
+ export { L as a };
@@ -1,5 +1,5 @@
1
1
  import { a as a$1 } from '../../../chunk-2NMLQNWC.js';
2
- import { a as a$2 } from '../../../chunk-PXDNVNBO.js';
2
+ import { a as a$2 } from '../../../chunk-YNOYR4WX.js';
3
3
  import { a as a$3 } from '../../../chunk-OGF32LEK.js';
4
4
  import '../../../chunk-ORLVNXTG.js';
5
5
  import '../../../chunk-SPMW5J7M.js';
@@ -4,6 +4,6 @@ import '@mui/material/TextField';
4
4
  import '../../../types/baseField.js';
5
5
  import 'react-hook-form';
6
6
 
7
- declare const Field: ({ name, helperText, rules, onChange, tabIndex, className, id, ...other }: FieldProps) => react_jsx_runtime.JSX.Element;
7
+ declare const Field: ({ name, helperText, rules, onChange, tabIndex, className, id, forceShowHelperText, ...other }: FieldProps) => react_jsx_runtime.JSX.Element;
8
8
 
9
9
  export { Field as default };
@@ -1 +1 @@
1
- export { a as default } from '../../../chunk-PXDNVNBO.js';
1
+ export { a as default } from '../../../chunk-YNOYR4WX.js';
@@ -14,6 +14,6 @@ type PasswordProps = BaseField<TextFieldProps> & {
14
14
  };
15
15
  };
16
16
 
17
- declare const Password: ({ name, sx, rules, passwordSize, specialCharacter, upperCaseChar, numberChar, showErrorMessage, match, ...other }: PasswordProps) => react_jsx_runtime.JSX.Element;
17
+ declare const Password: ({ name, sx, rules, passwordSize, specialCharacter, upperCaseChar, numberChar, showErrorMessage, match, helperText, ...other }: PasswordProps) => react_jsx_runtime.JSX.Element;
18
18
 
19
19
  export { Password as default };
@@ -1,13 +1,13 @@
1
- import { a } from '../../../chunk-PXDNVNBO.js';
1
+ import { a } from '../../../chunk-YNOYR4WX.js';
2
2
  import { d } from '../../../chunk-KOELUX3V.js';
3
3
  import { a as a$1 } from '../../../chunk-CRNP3QIS.js';
4
4
  import '../../../chunk-3UYQIK3V.js';
5
5
  import { useState } from 'react';
6
6
  import { useFormContext } from 'react-hook-form';
7
- import S from '@mui/material/IconButton';
8
- import b from '@mui/material/InputAdornment';
7
+ import b from '@mui/material/IconButton';
8
+ import N from '@mui/material/InputAdornment';
9
9
  import { jsx } from 'react/jsx-runtime';
10
10
 
11
- var N=({name:s,sx:w,rules:n,passwordSize:i,specialCharacter:d$1,upperCaseChar:p,numberChar:l,showErrorMessage:c,match:t,...P})=>{let{watch:m}=useFormContext(),I=m(s),[a$2,g]=useState(!1),{hasNumberChar:v,hasSpecialCharacter:C,hasUpperCaseChar:V,isLengthValid:x}=d(I,i,l,d$1,p);return jsx(a,{"data-intercom-target":s,...P,name:s,type:a$2?"text":"password",InputProps:{endAdornment:jsx(b,{position:"end",children:jsx(S,{onClick:()=>g(!a$2),edge:"end","aria-label":"Mostrar/Ocultar senha",tabIndex:-1,children:jsx(a$1,{icon:a$2?"VIEW_ON":"VIEW_OFF"})})})},rules:{...n,validate:{...n?.validate,validationPassword:u=>{let o=d(u,i,l,d$1,p);return !o.hasNumberChar||!o.hasSpecialCharacter||!o.hasUpperCaseChar||!o.isLengthValid?"Senha inv\xE1lida":t&&t.fieldPassword&&m(t.fieldPassword)!==u?"As senhas devem ser iguais":!0}}},sx:{...w,"& .MuiFormHelperText-root":{display:(!C||!V||!x||!v)&&!c?"none":void 0}}})},_=N;
11
+ var O=({name:s,sx:h,rules:n,passwordSize:d$1,specialCharacter:i,upperCaseChar:p,numberChar:l,showErrorMessage:P,match:t,helperText:m,...I})=>{let{watch:u}=useFormContext(),g=u(s),[a$2,v]=useState(!1),{hasNumberChar:C,hasSpecialCharacter:V,hasUpperCaseChar:x,isLengthValid:F}=d(g,d$1,l,i,p);return jsx(a,{"data-intercom-target":s,...I,name:s,type:a$2?"text":"password",InputProps:{endAdornment:jsx(N,{position:"end",children:jsx(b,{onClick:()=>v(!a$2),edge:"end","aria-label":"Mostrar/Ocultar senha",tabIndex:-1,children:jsx(a$1,{icon:a$2?"VIEW_ON":"VIEW_OFF"})})})},rules:{...n,validate:{...n?.validate,validationPassword:f=>{let o=d(f,d$1,l,i,p);return !o.hasNumberChar||!o.hasSpecialCharacter||!o.hasUpperCaseChar||!o.isLengthValid?"Senha inv\xE1lida":t&&t.fieldPassword&&u(t.fieldPassword)!==f?"As senhas devem ser iguais":!0}}},sx:{...h,"& .MuiFormHelperText-root":{display:m?void 0:(!V||!x||!F||!C)&&!P?"none":void 0}},forceShowHelperText:!!m})},_=O;
12
12
 
13
13
  export { _ as default };
@@ -1,4 +1,4 @@
1
- import { a } from '../../../chunk-PXDNVNBO.js';
1
+ import { a } from '../../../chunk-YNOYR4WX.js';
2
2
  import { a as a$2 } from '../../../chunk-OGF32LEK.js';
3
3
  import { a as a$3 } from '../../../chunk-CUQN4FZZ.js';
4
4
  import '../../../chunk-SPMW5J7M.js';
@@ -2,6 +2,8 @@ import { TextFieldProps } from '@mui/material/TextField';
2
2
  import { BaseField } from './baseField.js';
3
3
  import 'react-hook-form';
4
4
 
5
- type FieldProps = BaseField<TextFieldProps>;
5
+ type FieldProps = BaseField<TextFieldProps> & {
6
+ forceShowHelperText?: boolean;
7
+ };
6
8
 
7
9
  export { FieldProps };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zydon/common",
3
- "version": "2.4.86",
3
+ "version": "2.4.88",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",
@@ -1,7 +0,0 @@
1
- import { useFormContext, Controller } from 'react-hook-form';
2
- import b from '@mui/material/TextField';
3
- import { jsx } from 'react/jsx-runtime';
4
-
5
- var g=({name:l,helperText:n,rules:s,onChange:o,tabIndex:u,className:d,id:r,...e})=>{let{control:f}=useFormContext();return jsx(Controller,{name:l,control:f,rules:s,render:({field:{ref:m,value:F,...t},fieldState:{error:p}})=>jsx(b,{...t,value:F??"",onChange:a=>{t.onChange(a),o&&o(a);},inputRef:m,fullWidth:!0,error:!!p,helperText:p?.message||n,"data-intercom-target":l,...e,InputLabelProps:{...e.InputLabelProps,htmlFor:r},inputProps:{...e.inputProps,tabIndex:u,"aria-label":e.label,id:r},className:`field-${l} ${d}`})})},I=g;
6
-
7
- export { I as a };