@zydon/common 2.2.27 → 2.2.29

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,8 @@
1
+ import { forwardRef, useState, useRef, useEffect } from 'react';
2
+ import { NumericFormat } from 'react-number-format';
3
+ import W from '@mui/material/TextField';
4
+ import { jsx } from 'react/jsx-runtime';
5
+
6
+ var m=forwardRef(({decimalScale:p=0,fixedDecimalScale:f=!0,prefix:c,allowNegative:s,minValue:t,maxValue:n=1/0,maxLength:d,value:I,inputProps:N,InputProps:b,size:S,disabled:T,name:u,helperText:g,error:y,fullWidth:h,label:v,required:w,onChange:r,tabIndex:x,placeholder:D,margin:F,className:P},R)=>{let[k,E]=useState(Date.now()),e=useRef(null),l=()=>E(Date.now()),L=(V,o)=>{r&&(e.current&&clearTimeout(e.current),e.current=setTimeout(()=>{let{floatValue:a}=V,i=a||0;if(t!==void 0&&t>i){r({target:{name:u,value:t},event:o}),l();return}if(a!==void 0&&n<i){r({target:{name:u,value:n},event:o}),l();return}r({target:{name:u,value:a},event:o});},500));};return useEffect(()=>()=>{e.current&&clearTimeout(e.current);},[]),jsx(NumericFormat,{getInputRef:R,value:I,prefix:c,decimalSeparator:",",thousandSeparator:".",decimalScale:p,fixedDecimalScale:f,autoComplete:"off",allowNegative:s,maxLength:d,onValueChange:L,customInput:W,InputProps:{...b},inputProps:{...N,tabIndex:x},disabled:T,size:S,helperText:g,error:y,fullWidth:h,label:v,required:w,placeholder:D,margin:F,className:P},k)});m.displayName="NumberInput";var Q=m;
7
+
8
+ export { Q as a };
@@ -1,5 +1,5 @@
1
1
  import { f } from './chunk-ANAHA3L6.js';
2
- import { a } from './chunk-PV522B4W.js';
2
+ import { a } from './chunk-7KZ2UT76.js';
3
3
  import { a as a$1 } from './chunk-A3HKJM7C.js';
4
4
  import { forwardRef, useState, useRef, useMemo, useCallback } from 'react';
5
5
  import A from '@mui/material/IconButton';
@@ -0,0 +1,7 @@
1
+ import { useFormContext, Controller } from 'react-hook-form';
2
+ import F from '@mui/material/TextField';
3
+ import { jsx } from 'react/jsx-runtime';
4
+
5
+ var P=({name:e,helperText:p,rules:s,onChange:o,tabIndex:d,className:f,...t})=>{let{control:m}=useFormContext();return jsx(Controller,{name:e,control:m,rules:s,render:({field:{ref:a,...r},fieldState:{error:l}})=>jsx(F,{...r,onChange:i=>{r.onChange(i),o&&o(i);},inputRef:a,fullWidth:!0,error:!!l,helperText:l?.message||p,"data-intercom-target":e,...t,inputProps:{...t.inputProps,tabIndex:d},className:`field-${e} ${f}`})})},C=P;
6
+
7
+ export { C as a };
@@ -1,5 +1,5 @@
1
- export { a as default } from '../../chunk-XXEER5EI.js';
1
+ export { a as default } from '../../chunk-TDNB3ZFQ.js';
2
2
  import '../../chunk-ANAHA3L6.js';
3
- import '../../chunk-PV522B4W.js';
3
+ import '../../chunk-7KZ2UT76.js';
4
4
  import '../../chunk-A3HKJM7C.js';
5
5
  import '../../chunk-HR73D35E.js';
@@ -1 +1 @@
1
- export { a as default } from '../../chunk-PV522B4W.js';
1
+ export { a as default } from '../../chunk-7KZ2UT76.js';
@@ -1,4 +1,4 @@
1
- import { a as a$2 } from '../../../chunk-HKE5Q5ID.js';
1
+ import { a as a$2 } from '../../../chunk-VTHBHXM2.js';
2
2
  import { a as a$1 } from '../../../chunk-SEVJABAI.js';
3
3
  import { a as a$3 } from '../../../chunk-AIE3DQLQ.js';
4
4
  import '../../../chunk-QNAXGE5H.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, ...other }: FieldProps) => react_jsx_runtime.JSX.Element;
7
+ declare const Field: ({ name, helperText, rules, onChange, tabIndex, className, ...other }: FieldProps) => react_jsx_runtime.JSX.Element;
8
8
 
9
9
  export { Field as default };
@@ -1 +1 @@
1
- export { a as default } from '../../../chunk-HKE5Q5ID.js';
1
+ export { a as default } from '../../../chunk-VTHBHXM2.js';
@@ -1,6 +1,6 @@
1
- import { a } from '../../../chunk-XXEER5EI.js';
1
+ import { a } from '../../../chunk-TDNB3ZFQ.js';
2
2
  import '../../../chunk-ANAHA3L6.js';
3
- import '../../../chunk-PV522B4W.js';
3
+ import '../../../chunk-7KZ2UT76.js';
4
4
  import '../../../chunk-A3HKJM7C.js';
5
5
  import '../../../chunk-HR73D35E.js';
6
6
  import { useFormContext, Controller } from 'react-hook-form';
@@ -4,6 +4,6 @@ import I from '@mui/material/Chip';
4
4
  import h from '@mui/material/TextField';
5
5
  import { jsx } from 'react/jsx-runtime';
6
6
 
7
- var C=({name:o,helperText:u,rules:a,label:p,required:m})=>{let{control:i}=useFormContext();return jsx(Controller,{name:o,control:i,rules:a,render:({field:{ref:s,value:c,onChange:d},fieldState:{error:l}})=>jsx(b,{multiple:!0,options:[],freeSolo:!0,value:c,onChange:(e,r)=>d(r),renderTags:(e,r)=>e.map((f,n)=>jsx(I,{variant:"soft",color:"primary",label:f,...r({index:n})},n)),renderInput:e=>jsx(h,{...e,inputRef:s,label:p,placeholder:"| Digite e tecle enter",error:!!l,helperText:l?.message||u,required:m}),"data-intercom-target":o})})},V=C;
7
+ var C=({name:o,helperText:u,rules:p,label:a,required:m})=>{let{control:i}=useFormContext();return jsx(Controller,{name:o,control:i,rules:p,render:({field:{ref:s,value:c,onChange:d},fieldState:{error:l}})=>jsx(b,{multiple:!0,options:[],freeSolo:!0,value:c,onChange:(e,t)=>{console.log({value:t,event:e}),d(t);},renderTags:(e,t)=>e.map((f,n)=>jsx(I,{variant:"soft",color:"primary",label:f,...t({index:n})},n)),renderInput:e=>jsx(h,{...e,inputRef:s,label:a,placeholder:"| Digite e tecle enter",error:!!l,helperText:l?.message||u,required:m}),"data-intercom-target":o})})},V=C;
8
8
 
9
9
  export { V as default };
@@ -21,6 +21,6 @@ interface Props {
21
21
  }
22
22
  type NumberInputProps = BaseField<Props & Omit<TextFieldProps, 'onChange'>>;
23
23
 
24
- declare const NumberInput: ({ name, helperText, rules, onChange, ...other }: NumberInputProps) => react_jsx_runtime.JSX.Element;
24
+ declare const NumberInput: ({ name, helperText, rules, onChange, className, ...other }: NumberInputProps) => react_jsx_runtime.JSX.Element;
25
25
 
26
26
  export { NumberInput as default };
@@ -1,7 +1,7 @@
1
- import { a } from '../../../chunk-PV522B4W.js';
1
+ import { a } from '../../../chunk-7KZ2UT76.js';
2
2
  import { useFormContext, Controller } from 'react-hook-form';
3
3
  import { jsx } from 'react/jsx-runtime';
4
4
 
5
- var b=({name:r,helperText:u,rules:l,onChange:t,...s})=>{let{control:a$1}=useFormContext();return jsx(Controller,{name:r,control:a$1,rules:l,render:({field:o,fieldState:{error:e}})=>jsx(a,{...o,onChange:n=>{o.onChange(n),t&&t(n);},fullWidth:!0,error:!!e,helperText:e?.message||u,"data-intercom-target":r,...s})})},C=b;
5
+ var d=({name:r,helperText:u,rules:l,onChange:t,className:s,...a$1})=>{let{control:f}=useFormContext();return jsx(Controller,{name:r,control:f,rules:l,render:({field:o,fieldState:{error:e}})=>jsx(a,{...o,onChange:n=>{o.onChange(n),t&&t(n);},fullWidth:!0,error:!!e,helperText:e?.message||u,"data-intercom-target":r,className:`field-${r} ${s}`,...a$1})})},C=d;
6
6
 
7
7
  export { C as default };
@@ -1,4 +1,4 @@
1
- import { a } from '../../../chunk-HKE5Q5ID.js';
1
+ import { a } from '../../../chunk-VTHBHXM2.js';
2
2
  import { d } from '../../../chunk-CQDKXUUX.js';
3
3
  import { a as a$1 } from '../../../chunk-A3HKJM7C.js';
4
4
  import '../../../chunk-HR73D35E.js';
@@ -1,4 +1,4 @@
1
- import { a } from '../../../chunk-HKE5Q5ID.js';
1
+ import { a } from '../../../chunk-VTHBHXM2.js';
2
2
  import { a as a$2 } from '../../../chunk-AIE3DQLQ.js';
3
3
  import { a as a$3 } from '../../../chunk-CAZ3WGTV.js';
4
4
  import '../../../chunk-UUVFDAMW.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zydon/common",
3
- "version": "2.2.27",
3
+ "version": "2.2.29",
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 F from '@mui/material/TextField';
3
- import { jsx } from 'react/jsx-runtime';
4
-
5
- var c=({name:o,helperText:p,rules:d,onChange:t,tabIndex:s,...e})=>{let{control:f}=useFormContext();return jsx(Controller,{name:o,control:f,rules:d,render:({field:{ref:m,...r},fieldState:{error:l}})=>jsx(F,{...r,onChange:i=>{r.onChange(i),t&&t(i);},inputRef:m,fullWidth:!0,error:!!l,helperText:l?.message||p,...e,inputProps:{...e.inputProps,tabIndex:s,"data-intercom-target":o}})})},x=c;
6
-
7
- export { x as a };
@@ -1,8 +0,0 @@
1
- import { forwardRef, useState, useRef, useEffect } from 'react';
2
- import { NumericFormat } from 'react-number-format';
3
- import M from '@mui/material/TextField';
4
- import { jsx } from 'react/jsx-runtime';
5
-
6
- var p=forwardRef(({decimalScale:f=0,fixedDecimalScale:m=!0,prefix:c,allowNegative:s,minValue:t,maxValue:n=1/0,maxLength:d,value:I,inputProps:b,InputProps:N,size:S,disabled:T,name:u,helperText:g,error:y,fullWidth:h,label:v,required:w,onChange:r,tabIndex:x,placeholder:D,margin:F},P)=>{let[R,k]=useState(Date.now()),e=useRef(null),l=()=>k(Date.now()),E=(L,o)=>{r&&(e.current&&clearTimeout(e.current),e.current=setTimeout(()=>{let{floatValue:a}=L,i=a||0;if(t!==void 0&&t>i){r({target:{name:u,value:t},event:o}),l();return}if(a!==void 0&&n<i){r({target:{name:u,value:n},event:o}),l();return}r({target:{name:u,value:a},event:o});},500));};return useEffect(()=>()=>{e.current&&clearTimeout(e.current);},[]),jsx(NumericFormat,{getInputRef:P,value:I,prefix:c,decimalSeparator:",",thousandSeparator:".",decimalScale:f,fixedDecimalScale:m,autoComplete:"off",allowNegative:s,maxLength:d,onValueChange:E,customInput:M,InputProps:{...N},inputProps:{...b,tabIndex:x},disabled:T,size:S,helperText:g,error:y,fullWidth:h,label:v,required:w,placeholder:D,margin:F},R)});p.displayName="NumberInput";var O=p;
7
-
8
- export { O as a };