@zydon/common 2.5.15 → 2.5.17
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/chunk-IZOHCMZJ.js +11 -0
- package/dist/components/Incrementer/index.js +1 -1
- package/dist/components/form/Incrementer/index.js +1 -1
- package/dist/components/form/Password/index.d.ts +2 -1
- package/dist/components/form/Password/index.js +4 -4
- package/package.json +1 -1
- package/dist/chunk-X6R4YXWP.js +0 -11
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { a } from './chunk-2FXXN6VA.js';
|
|
2
|
+
import { f } from './chunk-ANAHA3L6.js';
|
|
3
|
+
import { a as a$1 } from './chunk-MAK4JF5M.js';
|
|
4
|
+
import { forwardRef, useState, useRef, useMemo, useCallback } from 'react';
|
|
5
|
+
import T from '@mui/material/IconButton';
|
|
6
|
+
import R from '@mui/material/InputAdornment';
|
|
7
|
+
import { jsx } from 'react/jsx-runtime';
|
|
8
|
+
|
|
9
|
+
var C=forwardRef(({name:M,increment:e=1,updadteForMultiple:P,allowNegative:u=!1,value:I,onChange:c,minValue:r,maxValue:o,decimalScale:p,disabled:i,tabIndex:w,labelIncrementer:B,labelDecrementer:O,placeholder:z,InputProps:y,...E},L)=>{let[N,_]=useState(`incrementer-input-${Date.now()}`),m=useRef(null),s=Number(I||0),b=()=>{m.current&&(clearTimeout(m.current),m.current=null);},$=useMemo(()=>{let n=s-e;return typeof r=="number"&&n<r?!0:i||!u&&n<0},[i,s,e,r,u]),G=useMemo(()=>{let n=s+e;return typeof o=="number"&&n>o?!0:i},[i,s,e,o]),H=useCallback(()=>{if(b(),!u&&s-e<0)return;let n=s-e,t=r!==void 0&&n<r?r:f(n,p);c(t);},[s,e,r,p,c,u]),K=n=>r!==void 0&&n<r?r:o!==void 0&&n>o?o:f(n,p),U=useCallback(()=>{b();let n=s+e,t=K(n);c(t);},[s,e,o,r,p,c]),W=useCallback(n=>{b();let t=Number(n.target.value||0);(e!==1||P)&&(t=t+e/2,t-=t%e),!u&&t<0&&(t=0),typeof r=="number"&&t<r&&(t=r),typeof o=="number"&&t>o&&(t=o),t=f(t,p),(!t||t===I)&&(m.current=setTimeout(()=>{_(`incrementer-input-${Date.now()}`);},600)),c(t);},[I,e,r,o,p,c,P,u]);return jsx(a,{ref:L,name:M,value:I,minValue:r,maxValue:o,allowNegative:u,decimalScale:p,InputProps:{...y,startAdornment:jsx(R,{position:"start",children:jsx(T,{size:"medium",onClick:H,disabled:$,"aria-label":O||"Decrementa",children:jsx(a$1,{icon:"MINUS_SIGN",width:14,height:14,color:"primary.main"})})}),endAdornment:jsx(R,{position:"end",children:jsx(T,{size:"medium",onClick:U,disabled:G,"aria-label":B||"Incrementa",children:jsx(a$1,{icon:"SIMPLE_ADD",width:14,height:14,color:"primary.main"})})}),inputProps:{...y?.inputProps,style:{...y?.inputProps?.style,textAlign:"center"}}},inputProps:{tabIndex:w},onChange:W,disabled:i,placeholder:z,...E},N)});C.displayName="Incrementer";var S=C;
|
|
10
|
+
|
|
11
|
+
export { S as a };
|
|
@@ -12,8 +12,9 @@ type PasswordProps = BaseField<TextFieldProps> & {
|
|
|
12
12
|
match?: {
|
|
13
13
|
fieldPassword: string;
|
|
14
14
|
};
|
|
15
|
+
showButtonViewPassword?: boolean;
|
|
15
16
|
};
|
|
16
17
|
|
|
17
|
-
declare const Password: ({ name, sx, rules, passwordSize, specialCharacter, upperCaseChar, numberChar, showErrorMessage, match, helperText, InputProps, ...other }: PasswordProps) => react_jsx_runtime.JSX.Element;
|
|
18
|
+
declare const Password: ({ name, sx, rules, passwordSize, specialCharacter, upperCaseChar, numberChar, showErrorMessage, match, helperText, InputProps, showButtonViewPassword, ...other }: PasswordProps) => react_jsx_runtime.JSX.Element;
|
|
18
19
|
|
|
19
20
|
export { Password as default };
|
|
@@ -4,10 +4,10 @@ import { a as a$1 } from '../../../chunk-MAK4JF5M.js';
|
|
|
4
4
|
import '../../../chunk-FUB7WQS5.js';
|
|
5
5
|
import { useState } from 'react';
|
|
6
6
|
import { useFormContext } from 'react-hook-form';
|
|
7
|
-
import
|
|
8
|
-
import
|
|
7
|
+
import y from '@mui/material/IconButton';
|
|
8
|
+
import N from '@mui/material/InputAdornment';
|
|
9
9
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var O=({name:o,sx:P,rules:n,passwordSize:d$1,specialCharacter:i,upperCaseChar:p,numberChar:l,showErrorMessage:x,match:r,helperText:m,InputProps:u,showButtonViewPassword:I=!0,...g})=>{let{watch:f}=useFormContext(),v=f(o),[t,C]=useState(!1),{hasNumberChar:V,hasSpecialCharacter:A,hasUpperCaseChar:F,isLengthValid:S}=d(v,d$1,l,i,p),H=(!A||!F||!S||!V)&&!x?"none":void 0;return jsx(a,{"data-intercom-target":o,...g,name:o,type:t?"text":"password",InputProps:{...u,endAdornment:jsxs(N,{position:"end",children:[u?.endAdornment,I&&jsx(y,{onClick:()=>C(!t),edge:"end","aria-label":"Mostrar/Ocultar senha",tabIndex:-1,children:jsx(a$1,{icon:t?"VIEW_ON":"VIEW_OFF"})})]})},rules:{...n,validate:{...n?.validate,validationPassword:h=>{let e=d(h,d$1,l,i,p);return !e.hasNumberChar||!e.hasSpecialCharacter||!e.hasUpperCaseChar||!e.isLengthValid?"Senha inv\xE1lida":r&&r.fieldPassword&&f(r.fieldPassword)!==h?"As senhas devem ser iguais":!0}}},sx:{...P,"& .MuiFormHelperText-root":{display:m?void 0:H}},forceShowHelperText:!0,helperText:m})},G=O;
|
|
12
12
|
|
|
13
|
-
export {
|
|
13
|
+
export { G as default };
|
package/package.json
CHANGED
package/dist/chunk-X6R4YXWP.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { a } from './chunk-2FXXN6VA.js';
|
|
2
|
-
import { f } from './chunk-ANAHA3L6.js';
|
|
3
|
-
import { a as a$1 } from './chunk-MAK4JF5M.js';
|
|
4
|
-
import { forwardRef, useState, useRef, useMemo, useCallback } from 'react';
|
|
5
|
-
import A from '@mui/material/IconButton';
|
|
6
|
-
import T from '@mui/material/InputAdornment';
|
|
7
|
-
import { jsx } from 'react/jsx-runtime';
|
|
8
|
-
|
|
9
|
-
var R=forwardRef(({name:C,increment:e=1,updadteForMultiple:D,allowNegative:u=!1,value:i,onChange:c,minValue:r,maxValue:o,decimalScale:p,disabled:I,tabIndex:M,labelIncrementer:w,labelDecrementer:B,placeholder:O,...z},E)=>{let[L,N]=useState(`incrementer-input-${Date.now()}`),m=useRef(null),s=Number(i||0),y=()=>{m.current&&(clearTimeout(m.current),m.current=null);},_=useMemo(()=>{let n=s-e;return typeof r=="number"&&n<r?!0:I||!u&&n<0},[I,s,e,r,u]),$=useMemo(()=>{let n=s+e;return typeof o=="number"&&n>o?!0:I},[I,s,e,o]),G=useCallback(()=>{if(y(),!u&&s-e<0)return;let n=s-e,t=r!==void 0&&n<r?r:f(n,p);c(t);},[s,e,r,p,c,u]),H=n=>r!==void 0&&n<r?r:o!==void 0&&n>o?o:f(n,p),K=useCallback(()=>{y();let n=s+e,t=H(n);c(t);},[s,e,o,r,p,c]),U=useCallback(n=>{y();let t=Number(n.target.value||0);(e!==1||D)&&(t=t+e/2,t-=t%e),!u&&t<0&&(t=0),typeof r=="number"&&t<r&&(t=r),typeof o=="number"&&t>o&&(t=o),t=f(t,p),(!t||t===i)&&(m.current=setTimeout(()=>{N(`incrementer-input-${Date.now()}`);},600)),c(t);},[i,e,r,o,p,c,D,u]);return jsx(a,{ref:E,name:C,value:i,minValue:r,maxValue:o,allowNegative:u,decimalScale:p,InputProps:{startAdornment:jsx(T,{position:"start",children:jsx(A,{size:"medium",onClick:G,disabled:_,"aria-label":B||"Decrementa",children:jsx(a$1,{icon:"MINUS_SIGN",width:14,height:14,color:"primary.main"})})}),endAdornment:jsx(T,{position:"end",children:jsx(A,{size:"medium",onClick:K,disabled:$,"aria-label":w||"Incrementa",children:jsx(a$1,{icon:"SIMPLE_ADD",width:14,height:14,color:"primary.main"})})}),inputProps:{style:{textAlign:"center"}}},inputProps:{tabIndex:M},onChange:U,disabled:I,placeholder:O,...z},L)});R.displayName="Incrementer";var F=R;
|
|
10
|
-
|
|
11
|
-
export { F as a };
|