@zydon/common 2.3.57 → 2.3.59

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,3 @@
1
+ var u=e=>{if(!e||(e=e?.replace(/[^\d]+/g,""),e.length!==11||e==="00000000000"||e==="11111111111"||e==="22222222222"||e==="33333333333"||e==="44444444444"||e==="55555555555"||e==="66666666666"||e==="77777777777"||e==="88888888888"||e==="99999999999"))return !1;let t=0;for(let s=0;s<9;s++)t+=parseInt(e.charAt(s))*(10-s);let r=11-t%11;if((r===10||r===11)&&(r=0),r!==parseInt(e.charAt(9)))return !1;t=0;for(let s=0;s<10;s++)t+=parseInt(e.charAt(s))*(11-s);return r=11-t%11,(r===10||r===11)&&(r=0),r===parseInt(e.charAt(10))},h=e=>{if(!e||(e=e.replace(/[^\d]+/g,""),e.length!==14)||e==="00000000000000"||e==="11111111111111"||e==="22222222222222"||e==="33333333333333"||e==="44444444444444"||e==="55555555555555"||e==="66666666666666"||e==="77777777777777"||e==="88888888888888"||e==="99999999999999")return !1;let t=e.length-2,r=e.substring(0,t),s=e.substring(t),a=0,i=t-7;for(let n=t;n>=1;n--)a+=parseInt(r.charAt(t-n))*i--,i<2&&(i=9);let l=a%11<2?0:11-a%11;if(l!==parseInt(s.charAt(0)))return !1;t+=1,r=e.substring(0,t),a=0,i=t-7;for(let n=t;n>=1;n--)a+=parseInt(r.charAt(t-n))*i--,i<2&&(i=9);return l=a%11<2?0:11-a%11,l===parseInt(s.charAt(1))},f=(e="")=>e?!!e.toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/):!1,g=(e="",t=[8,20],r=!1,s=!1,a=!1)=>{let i=e.length>=t[0]&&e.length<=t[1],l=!a||/[A-Z]/.test(e),n=!s||/[!@#$%^&*(),.?":{}|<>]/.test(e),o=!r||/\d/.test(e);return {isLengthValid:i,hasUpperCaseChar:l,hasSpecialCharacter:n,hasNumberChar:o}},d=e=>e&&e.trim().length>0?!0:"N\xE3o pode ser apenas espa\xE7os em branco",A=e=>{if(e&&e.length!==8)return "CEP inv\xE1lido"};
2
+
3
+ export { u as a, h as b, f as c, g as d, d as e, A as f };
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
1
+ import * as react from 'react';
2
2
  import { BoxProps } from '@mui/material/Box';
3
3
  import { IconButtonProps as IconButtonProps$1 } from '@mui/material/IconButton';
4
4
  import { TooltipProps } from '@mui/material/Tooltip';
@@ -15,6 +15,6 @@ interface IconButtonProps extends Omit<IconButtonProps$1, 'color'> {
15
15
  children?: React.ReactNode;
16
16
  }
17
17
 
18
- declare const IconButton: ({ icon, label, color, loading, disabled, boxProps, tooltipProps, disableTooltip, children, ...props }: IconButtonProps) => react_jsx_runtime.JSX.Element;
18
+ declare const IconButton: react.ForwardRefExoticComponent<Omit<IconButtonProps, "ref"> & react.RefAttributes<HTMLButtonElement>>;
19
19
 
20
20
  export { IconButton as default };
@@ -1,12 +1,12 @@
1
1
  import { a } from '../../chunk-V3QQVP43.js';
2
2
  import '../../chunk-XTDKAE3Z.js';
3
- import { useMemo } from 'react';
3
+ import { forwardRef, useMemo } from 'react';
4
4
  import p from '@mui/material/Box';
5
- import M from '@mui/material/CircularProgress';
6
- import h from '@mui/material/IconButton';
7
- import w from '@mui/material/Tooltip';
5
+ import h from '@mui/material/CircularProgress';
6
+ import x from '@mui/material/IconButton';
7
+ import y from '@mui/material/Tooltip';
8
8
  import { jsx } from 'react/jsx-runtime';
9
9
 
10
- var x=({icon:t,label:i,color:e="primary",loading:r=!1,disabled:l=!1,boxProps:m={},tooltipProps:B={},disableTooltip:a$1=!1,children:n,...I})=>{if(!t&&!n)throw new Error("IconButton: icon or children is required");let u=useMemo(()=>t?jsx(a,{icon:t}):n,[t,n]),d=useMemo(()=>r?jsx(M,{size:20,color:"inherit"}):u,[r,u]),c=jsx(h,{"aria-label":i,color:"inherit",disabled:r||l,...I,children:d});return a$1?jsx(p,{...m,color:e,children:c}):jsx(p,{...m,color:e,children:jsx(w,{"data-testid":"button-tooltip",...B,title:i,children:c})})},z=x;
10
+ var l=forwardRef(({icon:t,label:i,color:e="primary",loading:r=!1,disabled:a$1=!1,boxProps:m={},tooltipProps:B={},disableTooltip:I=!1,children:n,...d},M)=>{if(!t&&!n)throw new Error("IconButton: icon or children is required");let u=useMemo(()=>t?jsx(a,{icon:t}):n,[t,n]),w=useMemo(()=>r?jsx(h,{size:20,color:"inherit"}):u,[r,u]),f=jsx(x,{ref:M,"aria-label":i,color:"inherit",disabled:r||a$1,...d,children:w});return I?jsx(p,{...m,color:e,children:f}):jsx(p,{...m,color:e,children:jsx(y,{"data-testid":"button-tooltip",...B,title:i,children:f})})});l.displayName="IconButton";var H=l;
11
11
 
12
- export { z as default };
12
+ export { H as default };
@@ -1,4 +1,4 @@
1
- import { d } from '../../chunk-CQDKXUUX.js';
1
+ import { d } from '../../chunk-KOELUX3V.js';
2
2
  import { a as a$1 } from '../../chunk-V3QQVP43.js';
3
3
  import '../../chunk-XTDKAE3Z.js';
4
4
  import a from '@mui/material/Typography';
@@ -1,5 +1,5 @@
1
1
  import { a } from '../../../chunk-VTHBHXM2.js';
2
- import { d } from '../../../chunk-CQDKXUUX.js';
2
+ import { d } from '../../../chunk-KOELUX3V.js';
3
3
  import { a as a$1 } from '../../../chunk-V3QQVP43.js';
4
4
  import '../../../chunk-XTDKAE3Z.js';
5
5
  import { useState } from 'react';
@@ -7,5 +7,7 @@ declare const validatePassword: (password?: string, passwordSize?: number[], num
7
7
  hasSpecialCharacter: boolean;
8
8
  hasNumberChar: boolean;
9
9
  };
10
+ declare const notOnlySpaces: (value: string) => true | "Não pode ser apenas espaços em branco";
11
+ declare const validNumberCep: (v: string | undefined) => "CEP inválido" | undefined;
10
12
 
11
- export { cnpjIsValid, cpfIsValid, emailIsValid, validatePassword };
13
+ export { cnpjIsValid, cpfIsValid, emailIsValid, notOnlySpaces, validNumberCep, validatePassword };
@@ -1 +1 @@
1
- export { b as cnpjIsValid, a as cpfIsValid, c as emailIsValid, d as validatePassword } from '../chunk-CQDKXUUX.js';
1
+ export { b as cnpjIsValid, a as cpfIsValid, c as emailIsValid, e as notOnlySpaces, f as validNumberCep, d as validatePassword } from '../chunk-KOELUX3V.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zydon/common",
3
- "version": "2.3.57",
3
+ "version": "2.3.59",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",
@@ -1,3 +0,0 @@
1
- var h=t=>{if(!t||(t=t?.replace(/[^\d]+/g,""),t.length!==11||t==="00000000000"||t==="11111111111"||t==="22222222222"||t==="33333333333"||t==="44444444444"||t==="55555555555"||t==="66666666666"||t==="77777777777"||t==="88888888888"||t==="99999999999"))return !1;let e=0;for(let s=0;s<9;s++)e+=parseInt(t.charAt(s))*(10-s);let r=11-e%11;if((r===10||r===11)&&(r=0),r!==parseInt(t.charAt(9)))return !1;e=0;for(let s=0;s<10;s++)e+=parseInt(t.charAt(s))*(11-s);return r=11-e%11,(r===10||r===11)&&(r=0),r===parseInt(t.charAt(10))},o=t=>{if(!t||(t=t.replace(/[^\d]+/g,""),t.length!==14)||t==="00000000000000"||t==="11111111111111"||t==="22222222222222"||t==="33333333333333"||t==="44444444444444"||t==="55555555555555"||t==="66666666666666"||t==="77777777777777"||t==="88888888888888"||t==="99999999999999")return !1;let e=t.length-2,r=t.substring(0,e),s=t.substring(e),a=0,l=e-7;for(let i=e;i>=1;i--)a+=parseInt(r.charAt(e-i))*l--,l<2&&(l=9);let n=a%11<2?0:11-a%11;if(n!==parseInt(s.charAt(0)))return !1;e+=1,r=t.substring(0,e),a=0,l=e-7;for(let i=e;i>=1;i--)a+=parseInt(r.charAt(e-i))*l--,l<2&&(l=9);return n=a%11<2?0:11-a%11,n===parseInt(s.charAt(1))},f=(t="")=>t?!!t.toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/):!1,g=(t="",e=[8,20],r=!1,s=!1,a=!1)=>{let l=t.length>=e[0]&&t.length<=e[1],n=!a||/[A-Z]/.test(t),i=!s||/[!@#$%^&*(),.?":{}|<>]/.test(t),u=!r||/\d/.test(t);return {isLengthValid:l,hasUpperCaseChar:n,hasSpecialCharacter:i,hasNumberChar:u}};
2
-
3
- export { h as a, o as b, f as c, g as d };