@zydon/common 2.2.20 → 2.2.21

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.
@@ -12,6 +12,6 @@ import K from '@mui/material/useMediaQuery';
12
12
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
13
13
  import re from '@mui/material/Popper';
14
14
 
15
- var k=8,Y=u=>{let{data:o,index:i,style:m}=u,n=o[i],{showValueInLabel:s,key:c,...f}=n[0],l={...m,top:m.top+k,paddingTop:8};return Object.prototype.hasOwnProperty.call(n,"group")?jsx(q,{component:"div",style:l,children:n.group},`list-box-item-group-${c}`):jsx(I,{component:"li",...f,noWrap:!0,style:l,children:jsxs(F,{component:"div",direction:"row",flex:1,gap:1,justifyContent:"start",children:[n[1].icon&&jsx(a,{icon:n[1].icon}),n[1].label,s&&jsxs(I,{variant:"inherit",color:"grey.400",children:["(",n[1].value,")"]})]})},`list-box-item-${c}`)},z=createContext({}),M=forwardRef((u,o)=>{let i=useContext(z);return jsx("div",{ref:o,...u,...i})});M.displayName="OuterElementType";var Z=u=>{let o=useRef(null);return useEffect(()=>{o.current!=null&&o.current.resetAfterIndex(0,!0);},[u]),o},ee=forwardRef(function(o,i){let{children:m,...n}=o,s=[];m.forEach(r=>{s.push(r),s.push(...r.children||[]);});let c=useTheme(),f=K(c.breakpoints.up("sm")),l=s.length,d=f?36:48,g=r=>Object.prototype.hasOwnProperty.call(r,"group")?48:d,C=()=>l>8?8*d:s.map(g).reduce((r,L)=>r+L,0),x=Z(l);return jsx("div",{ref:i,children:jsx(z.Provider,{value:n,children:jsx(VariableSizeList,{itemData:s,height:C()+2*k,width:"100%",ref:x,outerElementType:M,innerElementType:"ul",itemSize:r=>g(s[r]),overscanCount:5,itemCount:l,children:Y})})})}),N=ee;var D=styled(re)({[`& .${autocompleteClasses.listbox}`]:{boxSizing:"border-box","& ul":{padding:0,margin:0}}});var H=forwardRef(({label:u,value:o,options:i=[],loading:m,noOptionsText:n="Nenhum resultado encontrado.",loadingText:s="Carregando op\xE7\xF5es...",error:c,helperText:f,placeholder:l,onChange:d,groupBy:g,showValueInLabel:C,disabled:x,multiple:r,required:L,renderOption:P,tabIndex:X,onInputChange:T,onSearch:A,...J},$)=>{let[v,E]=useState(),V=e=>e&&typeof e=="object"?e.value.toString():e.toString(),y=useMemo(()=>r?(Array.isArray(o)?o:[]).reduce((p,h)=>{let O=i.find(U=>U.value.toString()===h.toString());return O?[...p,O]:[...p]},[]):i.find(t=>t.value.toString()===o?.toString())||null,[i,o,r]);return jsx(pe,{ref:$,value:v?r?void 0:v:y,onInputChange:(e,t,p)=>{if(T&&T(e,t,p),p==="input"){A&&A(t),E(t);return}E(void 0);},options:i,loading:m,noOptionsText:n,loadingText:s,disabled:m||x,disableListWrap:!0,PopperComponent:D,ListboxComponent:P?void 0:N,filterOptions:(e,t)=>e.filter(p=>`${p.value} ${p.label}`.toLocaleUpperCase().includes(t.inputValue.toLocaleUpperCase())),onChange:(e,t)=>{if(!t){d(r?[]:null);return}if(Array.isArray(t)){d(t.map(V));return}d(typeof t=="string"?t.toString():t.value.toString());},renderOption:(e,t,p,h)=>P?P(e,t,p,h):[{...e,showValueInLabel:C},t],renderGroup:e=>e,groupBy:g,multiple:r,renderInput:e=>jsx(me,{...e,placeholder:l,fullWidth:!0,error:!!c,helperText:f,label:u,required:L,InputProps:{...e.InputProps,...!r&&{startAdornment:y&&!Array.isArray(y)&&y.icon?jsx(a,{icon:y.icon}):void 0},endAdornment:jsxs(Fragment,{children:[m?jsx(ue,{color:"primary",size:20}):null,e.InputProps.endAdornment]})},inputProps:{...e.inputProps,tabIndex:X}}),...J})});H.displayName="Autocomplete";var De=H;
15
+ var k=8,Y=u=>{let{data:o,index:i,style:m}=u,n=o[i],{showValueInLabel:s,key:c,...f}=n[0],l={...m,top:m.top+k,paddingTop:8};return Object.prototype.hasOwnProperty.call(n,"group")?jsx(q,{component:"div",style:l,children:n.group},`list-box-item-group-${c}`):jsx(I,{component:"li",...f,noWrap:!0,style:l,children:jsxs(F,{component:"div",direction:"row",flex:1,gap:1,justifyContent:"start",children:[n[1].icon&&jsx(a,{icon:n[1].icon}),n[1].label,s&&jsxs(I,{variant:"inherit",color:"grey.400",children:["(",n[1].value,")"]})]})},`list-box-item-${c}`)},z=createContext({}),M=forwardRef((u,o)=>{let i=useContext(z);return jsx("div",{ref:o,...u,...i})});M.displayName="OuterElementType";var Z=u=>{let o=useRef(null);return useEffect(()=>{o.current!=null&&o.current.resetAfterIndex(0,!0);},[u]),o},ee=forwardRef(function(o,i){let{children:m,...n}=o,s=[];m.forEach(r=>{s.push(r),s.push(...r.children||[]);});let c=useTheme(),f=K(c.breakpoints.up("sm")),l=s.length,d=f?36:48,g=r=>Object.prototype.hasOwnProperty.call(r,"group")?48:d,C=()=>l>8?8*d:s.map(g).reduce((r,L)=>r+L,0),x=Z(l);return jsx("div",{ref:i,children:jsx(z.Provider,{value:n,children:jsx(VariableSizeList,{itemData:s,height:C()+2*k,width:"100%",ref:x,outerElementType:M,innerElementType:"ul",itemSize:r=>g(s[r]),overscanCount:5,itemCount:l,children:Y})})})}),N=ee;var D=styled(re)({[`& .${autocompleteClasses.listbox}`]:{boxSizing:"border-box","& ul":{padding:0,margin:0}}});var H=forwardRef(({label:u,value:o,options:i=[],loading:m,noOptionsText:n="Nenhum resultado encontrado.",loadingText:s="Carregando op\xE7\xF5es...",error:c,helperText:f,placeholder:l,onChange:d,groupBy:g,showValueInLabel:C,disabled:x,multiple:r,required:L,renderOption:P,tabIndex:X,onInputChange:T,onSearch:A,...J},$)=>{let[v,E]=useState(),V=e=>e&&typeof e=="object"?e.value.toString():e.toString(),y=useMemo(()=>r?(Array.isArray(o)?o:[]).reduce((p,h)=>{let O=i.find(U=>U.value.toString()===h.toString());return O?[...p,O]:[...p]},[]):i.find(t=>t.value.toString()===o?.toString())||null,[i,o,r]);return jsx(pe,{ref:$,value:v?r?[]:v:y,onInputChange:(e,t,p)=>{if(T&&T(e,t,p),p==="input"){A&&A(t),E(t);return}E(void 0);},options:i,loading:m,noOptionsText:n,loadingText:s,disabled:m||x,disableListWrap:!0,PopperComponent:D,ListboxComponent:P?void 0:N,filterOptions:(e,t)=>e.filter(p=>`${p.value} ${p.label}`.toLocaleUpperCase().includes(t.inputValue.toLocaleUpperCase())),onChange:(e,t)=>{if(!t){d(r?[]:null);return}if(Array.isArray(t)){d(t.map(V));return}d(typeof t=="string"?t.toString():t.value.toString());},renderOption:(e,t,p,h)=>P?P(e,t,p,h):[{...e,showValueInLabel:C},t],renderGroup:e=>e,groupBy:g,multiple:r,renderInput:e=>jsx(me,{...e,placeholder:l,fullWidth:!0,error:!!c,helperText:f,label:u,required:L,InputProps:{...e.InputProps,...!r&&{startAdornment:y&&!Array.isArray(y)&&y.icon?jsx(a,{icon:y.icon}):void 0},endAdornment:jsxs(Fragment,{children:[m?jsx(ue,{color:"primary",size:20}):null,e.InputProps.endAdornment]})},inputProps:{...e.inputProps,tabIndex:X}}),...J})});H.displayName="Autocomplete";var De=H;
16
16
 
17
17
  export { De as a };
@@ -1,4 +1,4 @@
1
- import { a } from './chunk-A7ON4DTB.js';
1
+ import { a } from './chunk-KKDBAR6W.js';
2
2
  import { useFormContext, Controller } from 'react-hook-form';
3
3
  import { jsx } from 'react/jsx-runtime';
4
4
 
@@ -1,3 +1,3 @@
1
- export { a as default } from '../../chunk-A7ON4DTB.js';
1
+ export { a as default } from '../../chunk-KKDBAR6W.js';
2
2
  import '../../chunk-A3HKJM7C.js';
3
3
  import '../../chunk-HR73D35E.js';
@@ -1,8 +1,8 @@
1
1
  import { a as a$2 } from '../../../chunk-JAIK5CGA.js';
2
2
  import { a as a$1 } from '../../../chunk-SEVJABAI.js';
3
- import { a as a$3 } from '../../../chunk-OYL26XOP.js';
3
+ import { a as a$3 } from '../../../chunk-RUVKZ7C3.js';
4
4
  import '../../../chunk-QNAXGE5H.js';
5
- import '../../../chunk-A7ON4DTB.js';
5
+ import '../../../chunk-KKDBAR6W.js';
6
6
  import '../../../chunk-A3HKJM7C.js';
7
7
  import '../../../chunk-HR73D35E.js';
8
8
  import E from '@mui/material/CircularProgress';
@@ -1,4 +1,4 @@
1
- export { a as default } from '../../../chunk-OYL26XOP.js';
2
- import '../../../chunk-A7ON4DTB.js';
1
+ export { a as default } from '../../../chunk-RUVKZ7C3.js';
2
+ import '../../../chunk-KKDBAR6W.js';
3
3
  import '../../../chunk-A3HKJM7C.js';
4
4
  import '../../../chunk-HR73D35E.js';
@@ -1,7 +1,7 @@
1
1
  import { a } from '../../../chunk-JAIK5CGA.js';
2
- import { a as a$2 } from '../../../chunk-OYL26XOP.js';
2
+ import { a as a$2 } from '../../../chunk-RUVKZ7C3.js';
3
3
  import { a as a$3 } from '../../../chunk-CAZ3WGTV.js';
4
- import '../../../chunk-A7ON4DTB.js';
4
+ import '../../../chunk-KKDBAR6W.js';
5
5
  import { a as a$1 } from '../../../chunk-A3HKJM7C.js';
6
6
  import '../../../chunk-HR73D35E.js';
7
7
  import { useFormContext, useFieldArray } from 'react-hook-form';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zydon/common",
3
- "version": "2.2.20",
3
+ "version": "2.2.21",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",