@zydon/common 2.2.10 → 2.2.11

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,17 @@
1
+ import { a } from './chunk-NF42ENKE.js';
2
+ import { b } from './chunk-ILHUUK4X.js';
3
+ import O, { forwardRef, useState, useMemo, useEffect } from 'react';
4
+ import fe, { autocompleteClasses } from '@mui/material/Autocomplete';
5
+ import be from '@mui/material/CircularProgress';
6
+ import ge from '@mui/material/TextField';
7
+ import { VariableSizeList } from 'react-window';
8
+ import W from '@mui/material/Typography';
9
+ import re from '@mui/material/Divider';
10
+ import L from '@mui/material/Stack';
11
+ import te from '@mui/material/Popper';
12
+ import { styled } from '@mui/material/styles';
13
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
14
+
15
+ var H=styled(te)({[`& .${autocompleteClasses.listbox}`]:{boxSizing:"border-box","& ul":{padding:0,margin:0}}}),D=styled(L)(({theme:e})=>({flex:1,width:"100%",[e.breakpoints.down("md")]:{flexDirection:"column",gap:0,width:"100%"},[e.breakpoints.up("sm")]:{width:"calc(100% - 75px)"},[e.breakpoints.up("md")]:{flexDirection:"row",gap:8}})),T=styled(L)(({theme:e})=>({flex:1,maxWidth:"100%",[e.breakpoints.up("md")]:{flex:"1 1 calc(50% - 8px)",width:"calc(50% - 8px)",minWidth:"calc(50% - 8px)",maxWidth:"calc(50% - 8px)"}})),R=styled(L)(({theme:e})=>({position:"relative",alignItems:"center",justifyContent:"center",width:68,height:68,borderRadius:8,overflow:"hidden",img:{position:"absolute",width:"100%",height:"100%",objectFit:"cover"},[e.breakpoints.down("sm")]:{display:"none"}}));var oe=({option:e})=>{let t=Object.keys(e).filter(l=>l.startsWith("field")).map((l,m)=>{let s=e[l];if(s&&typeof s=="object"){let p="label"in s?s.label:null,d="value"in s?s.value:null;return jsxs(W,{component:"span",variant:"body2",color:"textPrimary",noWrap:!0,children:[p,": ",d]},`${l}:${m}`)}}),i=e.image?jsx("img",{alt:"Imagem",src:e.image}):jsx(a,{alt:e.label||e.value.toString(),name:e.label||e.value.toString(),sx:{width:68,height:68,borderRadius:1}});return jsxs(Fragment,{children:[jsxs(L,{direction:"row",gap:2,margin:2,children:[jsx(R,{children:i}),jsxs(D,{children:[jsxs(T,{children:[jsx(L,{children:jsxs(W,{variant:"subtitle2",color:"textPrimary",noWrap:!0,children:[e.value," - ",e.label]})}),t[0]?t[0]:void 0,t[1]?t[1]:void 0]}),t.length>2&&jsxs(T,{children:[t[2]?t[2]:void 0,t[3]?t[3]:void 0,t[4]?t[4]:void 0]})]})]}),jsx(re,{className:"border",sx:{borderStyle:"dashed",position:"absolute",bottom:0,width:1}})]})},x=oe;var N=8,se=e=>{let{data:t,index:i,style:l}=e,m=t[i],s={...l,top:l.top+N,paddingTop:8,display:"block"};return jsx(W,{component:"li",...m.props,noWrap:!0,style:s,children:jsx(x,{...m?.props?.children?.props})})},X=O.createContext({}),B=forwardRef((e,t)=>{let i=O.useContext(X);return jsx("div",{ref:t,...e,...i})});B.displayName="OuterElementType";var pe=e=>{let t=O.useRef(null);return useEffect(()=>{t.current!=null&&t.current.resetAfterIndex(0,!0);},[e]),t},me=forwardRef(function(t,i){let{children:l,"data-item-height":m,...s}=t,p=[];l.forEach(a=>{p.push(a),p.push(...a.children||[]);});let d=p.length,h=m>112?m:112,c=a=>Object.prototype.hasOwnProperty.call(a,"group")?48:h,S=()=>d>8?8*h:p.map(c).reduce((a,C)=>a+C,0),v=pe(d);return jsx("div",{ref:i,children:jsx(X.Provider,{value:s,children:jsx(VariableSizeList,{itemData:p,height:S()+2*N,width:"100%",ref:v,outerElementType:B,innerElementType:"ul",itemSize:a=>c(p[a]),overscanCount:5,itemCount:d,children:se})})})}),J=me;var j=forwardRef(({label:e,value:t,options:i=[],loading:l,noOptionsText:m="Nenhum resultado encontrado.",loadingText:s="Carregando op\xE7\xF5es...",error:p,helperText:d,placeholder:h,onChange:c,groupBy:S,disabled:v,multiple:a,required:C,renderOption:G,tabIndex:U,onSearch:P,onInputChange:w,...V},_)=>{let[F,I]=useState(),q=b("down","md"),K=o=>o&&typeof o=="object"?o.value.toString():o.toString(),Q=useMemo(()=>a?(Array.isArray(t)?t:[]).reduce((r,A)=>{let E=i.find(Z=>Z.value.toString()===A.toString());return E?[...r,E]:[...r]},[]):i.find(n=>n.value.toString()===t?.toString())||null,[i,t,a]),Y=q&&i[0]?Object.keys(i[0]).length*24:void 0;return jsx(fe,{ref:_,value:F||Q,onInputChange:(o,n,r)=>{if(w&&w(o,n,r),r==="input"){P&&P(n),I(n);return}I(void 0);},options:i,loading:l,noOptionsText:m,loadingText:s,disabled:l||v,disableListWrap:!0,PopperComponent:H,ListboxProps:{"data-item-height":Y},ListboxComponent:G?void 0:J,filterOptions:(o,n)=>o.filter(r=>`${r.field1?.value} ${r.field1?.label} ${r.field2?.label} ${r.field2?.value} ${r.field3?.label} ${r.field3?.value} ${r.field4?.label} ${r.field4?.value} ${r.field5?.label} ${r.field5?.value} ${r.label}${r.value}`.toLocaleUpperCase().includes(n.inputValue.toLocaleUpperCase())),onChange:(o,n)=>{if(!n){c(a?[]:null);return}if(Array.isArray(n)){c(n.map(K));return}c(typeof n=="string"?n.toString():n.value.toString());},renderOption:({key:o,...n},r)=>jsx("li",{...n,style:{display:"block"},children:jsx(x,{option:r})},o),renderGroup:o=>o,groupBy:S,multiple:a,renderInput:o=>jsx(ge,{...o,placeholder:h,fullWidth:!0,error:!!p,helperText:d,label:e,required:C,InputProps:{...o.InputProps,endAdornment:jsxs(Fragment,{children:[l?jsx(be,{color:"primary",size:20}):null,o.InputProps.endAdornment]})},inputProps:{...o.inputProps,tabIndex:U}}),...V})});j.displayName="Autocomplete";var qe=j;
16
+
17
+ export { qe as a };
@@ -1,4 +1,4 @@
1
- import { a } from './chunk-MSH7OPW3.js';
1
+ import { a } from './chunk-WTUGAMJ5.js';
2
2
  import { useFormContext, Controller } from 'react-hook-form';
3
3
  import { jsx } from 'react/jsx-runtime';
4
4
 
@@ -0,0 +1,11 @@
1
+ import { f } from './chunk-ANAHA3L6.js';
2
+ import { a } from './chunk-PV522B4W.js';
3
+ import { a as a$1 } from './chunk-4Z2JJGWA.js';
4
+ import { forwardRef, useState, useRef, useMemo, useCallback } from 'react';
5
+ import A from '@mui/material/IconButton';
6
+ import C from '@mui/material/InputAdornment';
7
+ import { jsx } from 'react/jsx-runtime';
8
+
9
+ var M=forwardRef(({name:R,increment:r=1,updadteForMultiple:h,allowNegative:s=!1,value:D=0,onChange:c,minValue:n,maxValue:e,decimalScale:p,disabled:i,tabIndex:T,...w},B)=>{let[O,v]=useState(`incrementer-input-${Date.now()}`),I=useRef(null),u=Number(D||0),d=()=>{I.current&&(clearTimeout(I.current),I.current=null);},z=useMemo(()=>{let o=u-r;return typeof n=="number"&&o<n?!0:i||!s&&o<0},[i,u,r,n,s]),E=useMemo(()=>{let o=u+r;return typeof e=="number"&&o>e?!0:i},[i,u,r,e]),L=useCallback(()=>{if(d(),!s&&u-r<0)return;let o=u-r,t=n!==void 0&&o<n?n:f(o,p);c(t);},[u,r,n,p,c,s]),N=useCallback(()=>{d();let o=u+r,t=e!==void 0&&o>e?e:f(o,p);c(t);},[u,r,e,p,c]),_=useCallback(o=>{d();let t=Number(o.target.value||0);(r!==1||h)&&(t=t+r/2,t-=t%r),!s&&t<0&&(t=0),typeof n=="number"&&t<n&&(t=n),typeof e=="number"&&t>e&&(t=e),t=f(t,p),t===D&&(I.current=setTimeout(()=>{v(`incrementer-input-${Date.now()}`);},600)),c(t);},[r,n,e,p,c,h,s]);return jsx(a,{ref:B,name:R,value:u,minValue:n,maxValue:e,allowNegative:s,decimalScale:p,InputProps:{startAdornment:jsx(C,{position:"start",children:jsx(A,{size:"medium",onClick:L,disabled:z,children:jsx(a$1,{icon:"MINUS_SIGN",width:14,height:14,color:"primary.main"})})}),endAdornment:jsx(C,{position:"end",children:jsx(A,{size:"medium",onClick:N,disabled:E,children:jsx(a$1,{icon:"SIMPLE_ADD",width:14,height:14,color:"primary.main"})})}),inputProps:{style:{textAlign:"center"}}},inputProps:{tabIndex:T},onChange:_,disabled:i,...w},O)});M.displayName="Incrementer";var X=M;
10
+
11
+ export { X as a };
@@ -0,0 +1,17 @@
1
+ import { a } from './chunk-4Z2JJGWA.js';
2
+ import { createContext, forwardRef, useContext, useState, useMemo, useRef, useEffect } from 'react';
3
+ import pe, { autocompleteClasses } from '@mui/material/Autocomplete';
4
+ import ue from '@mui/material/CircularProgress';
5
+ import me from '@mui/material/TextField';
6
+ import { VariableSizeList } from 'react-window';
7
+ import q from '@mui/material/ListSubheader';
8
+ import F from '@mui/material/Stack';
9
+ import { useTheme, styled } from '@mui/material/styles';
10
+ import O from '@mui/material/Typography';
11
+ import K from '@mui/material/useMediaQuery';
12
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
13
+ import re from '@mui/material/Popper';
14
+
15
+ var R=8,Y=u=>{let{data:r,index:i,style:m}=u,n=r[i],{showValueInLabel:s,...d}=n[0],a$1={...m,top:m.top+R,paddingTop:8};return Object.prototype.hasOwnProperty.call(n,"group")?jsx(q,{component:"div",style:a$1,children:n.group},n.key):jsx(O,{component:"li",...d,noWrap:!0,style:a$1,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(O,{variant:"inherit",color:"grey.400",children:["(",n[1].value,")"]})]})})},z=createContext({}),M=forwardRef((u,r)=>{let i=useContext(z);return jsx("div",{ref:r,...u,...i})});M.displayName="OuterElementType";var Z=u=>{let r=useRef(null);return useEffect(()=>{r.current!=null&&r.current.resetAfterIndex(0,!0);},[u]),r},ee=forwardRef(function(r,i){let{children:m,...n}=r,s=[];m.forEach(o=>{s.push(o),s.push(...o.children||[]);});let d=useTheme(),a=K(d.breakpoints.up("sm")),f=s.length,c=a?36:48,g=o=>Object.prototype.hasOwnProperty.call(o,"group")?48:c,C=()=>f>8?8*c:s.map(g).reduce((o,P)=>o+P,0),L=Z(f);return jsx("div",{ref:i,children:jsx(z.Provider,{value:n,children:jsx(VariableSizeList,{itemData:s,height:C()+2*R,width:"100%",ref:L,outerElementType:M,innerElementType:"ul",itemSize:o=>g(s[o]),overscanCount:5,itemCount:f,children:Y})})})}),k=ee;var N=styled(re)({[`& .${autocompleteClasses.listbox}`]:{boxSizing:"border-box","& ul":{padding:0,margin:0}}});var D=forwardRef(({label:u,value:r,options:i=[],loading:m,noOptionsText:n="Nenhum resultado encontrado.",loadingText:s="Carregando op\xE7\xF5es...",error:d,helperText:a$1,placeholder:f,onChange:c,groupBy:g,showValueInLabel:C,disabled:L,multiple:o,required:P,renderOption:x,tabIndex:H,onInputChange:T,onSearch:A,...X},J)=>{let[V,v]=useState(),U=e=>e&&typeof e=="object"?e.value.toString():e.toString(),y=useMemo(()=>o?(Array.isArray(r)?r:[]).reduce((p,h)=>{let E=i.find(W=>W.value.toString()===h.toString());return E?[...p,E]:[...p]},[]):i.find(t=>t.value.toString()===r?.toString())||null,[i,r,o]);return jsx(pe,{ref:J,value:V||y,onInputChange:(e,t,p)=>{if(T&&T(e,t,p),p==="input"){A&&A(t),v(t);return}v(void 0);},options:i,loading:m,noOptionsText:n,loadingText:s,disabled:m||L,disableListWrap:!0,PopperComponent:N,ListboxComponent:x?void 0:k,filterOptions:(e,t)=>e.filter(p=>`${p.value} ${p.label}`.toLocaleUpperCase().includes(t.inputValue.toLocaleUpperCase())),onChange:(e,t)=>{if(!t){c(o?[]:null);return}if(Array.isArray(t)){c(t.map(U));return}c(typeof t=="string"?t.toString():t.value.toString());},renderOption:(e,t,p,h)=>x?x(e,t,p,h):[{...e,showValueInLabel:C},t],renderGroup:e=>e,groupBy:g,multiple:o,renderInput:e=>jsx(me,{...e,placeholder:f,fullWidth:!0,error:!!d,helperText:a$1,label:u,required:P,InputProps:{...e.InputProps,...!o&&{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:H}}),...X})});D.displayName="Autocomplete";var De=D;
16
+
17
+ export { De as a };
@@ -1,3 +1,3 @@
1
- export { a as default } from '../../chunk-MSH7OPW3.js';
1
+ export { a as default } from '../../chunk-WTUGAMJ5.js';
2
2
  import '../../chunk-4Z2JJGWA.js';
3
3
  import '../../chunk-QDDGXWNG.js';
@@ -1,3 +1,3 @@
1
- export { a as default } from '../../chunk-HIX5OGEA.js';
1
+ export { a as default } from '../../chunk-KPB2CGXZ.js';
2
2
  import '../../chunk-NF42ENKE.js';
3
3
  import '../../chunk-ILHUUK4X.js';
@@ -1,4 +1,4 @@
1
- export { a as default } from '../../chunk-MP7F5WHQ.js';
1
+ export { a as default } from '../../chunk-WRPWZC6G.js';
2
2
  import '../../chunk-ANAHA3L6.js';
3
3
  import '../../chunk-PV522B4W.js';
4
4
  import '../../chunk-4Z2JJGWA.js';
@@ -1,8 +1,8 @@
1
1
  import { a as a$2 } from '../../../chunk-P46BBUKR.js';
2
2
  import { a as a$1 } from '../../../chunk-U7BKKRLD.js';
3
- import { a as a$3 } from '../../../chunk-LJGKMBLJ.js';
3
+ import { a as a$3 } from '../../../chunk-VAZ53BM6.js';
4
4
  import '../../../chunk-QNAXGE5H.js';
5
- import '../../../chunk-MSH7OPW3.js';
5
+ import '../../../chunk-WTUGAMJ5.js';
6
6
  import '../../../chunk-4Z2JJGWA.js';
7
7
  import '../../../chunk-QDDGXWNG.js';
8
8
  import E from '@mui/material/CircularProgress';
@@ -1,4 +1,4 @@
1
- export { a as default } from '../../../chunk-LJGKMBLJ.js';
2
- import '../../../chunk-MSH7OPW3.js';
1
+ export { a as default } from '../../../chunk-VAZ53BM6.js';
2
+ import '../../../chunk-WTUGAMJ5.js';
3
3
  import '../../../chunk-4Z2JJGWA.js';
4
4
  import '../../../chunk-QDDGXWNG.js';
@@ -1,4 +1,4 @@
1
- import { a } from '../../../chunk-HIX5OGEA.js';
1
+ import { a } from '../../../chunk-KPB2CGXZ.js';
2
2
  import '../../../chunk-NF42ENKE.js';
3
3
  import '../../../chunk-ILHUUK4X.js';
4
4
  import { useFormContext, Controller } from 'react-hook-form';
@@ -1,4 +1,4 @@
1
- import { a } from '../../../chunk-MP7F5WHQ.js';
1
+ import { a } from '../../../chunk-WRPWZC6G.js';
2
2
  import '../../../chunk-ANAHA3L6.js';
3
3
  import '../../../chunk-PV522B4W.js';
4
4
  import '../../../chunk-4Z2JJGWA.js';
@@ -1,7 +1,7 @@
1
1
  import { a } from '../../../chunk-P46BBUKR.js';
2
- import { a as a$2 } from '../../../chunk-LJGKMBLJ.js';
2
+ import { a as a$2 } from '../../../chunk-VAZ53BM6.js';
3
3
  import { a as a$3 } from '../../../chunk-AKR4HFCK.js';
4
- import '../../../chunk-MSH7OPW3.js';
4
+ import '../../../chunk-WTUGAMJ5.js';
5
5
  import { a as a$1 } from '../../../chunk-4Z2JJGWA.js';
6
6
  import '../../../chunk-QDDGXWNG.js';
7
7
  import { useFormContext, useFieldArray } from 'react-hook-form';
@@ -2,10 +2,12 @@ import { Option } from '../types/option.js';
2
2
  import '../types/icon.js';
3
3
 
4
4
  declare const useAutocomplete: (initialValue?: Option | Option[]) => {
5
- buildOptions: (options?: Option[]) => Option[];
6
5
  search: string | undefined;
7
- onSearch: (search?: string) => void;
6
+ searching: boolean;
7
+ buildOptions: (options?: Option[], fetching?: boolean) => Option[];
8
+ onSearch: (term?: string) => void;
8
9
  onSelectValue: (options: Option[] | undefined, selected: unknown) => void;
10
+ finishSearch: () => void;
9
11
  };
10
12
 
11
13
  export { useAutocomplete as default };
@@ -1,6 +1,6 @@
1
1
  import { useState } from 'react';
2
2
  import { debounce } from '@mui/material/utils';
3
3
 
4
- var m=s=>{let[u,c]=useState(),[l,t]=useState(),p=debounce(e=>{c(e);},500);return {buildOptions:(e=[])=>{let n=l||s;if(!n)return e;let i=[...Array.isArray(n)?n:[n],...e];return Array.from(new Set(i.map(o=>o.value))).map(o=>i.find(f=>f.value===o))},search:u,onSearch:e=>{p(e);},onSelectValue:(e=[],n)=>{(!n||Array.isArray(n)&&n.length===0)&&t(void 0),Array.isArray(n)?t(e.filter(r=>n.includes(r.value))):t(e.find(r=>r.value===n));}}},b=m;
4
+ var h=d=>{let[o,i]=useState(!1),[s,l]=useState(),[p,a]=useState(),O=debounce(e=>{l(e),i(!1);},500),S=e=>{e&&i(!0),O(e);},c=()=>{i(!1),l(void 0);};return {search:s,searching:o,buildOptions:(e=[],r=!1)=>{let t=p||d;if(!t||s!==void 0)return e.filter(n=>n.value!==null&&n.value!==void 0);if(o||r)return [];let f=[...Array.isArray(t)?t:[t],...e];return Array.from(new Set(f.map(n=>n.value))).map(n=>f.find(m=>m.value===n)).filter(n=>n.value!==null&&n.value!==void 0)},onSearch:S,onSelectValue:(e=[],r)=>{if(!r||Array.isArray(r)&&r.length===0){a(void 0);return}Array.isArray(r)?a(e.filter(t=>r.includes(t.value))):a(e.find(t=>t.value===r)),c();},finishSearch:c}},w=h;
5
5
 
6
- export { b as default };
6
+ export { w as default };
@@ -443,7 +443,7 @@ declare function paper({ theme, color, dropdown }: PaperProps): {
443
443
  wordWrap?: csstype.Property.WordWrap | readonly NonNullable<csstype.Property.WordWrap | undefined>[] | readonly csstype.Property.WordWrap[] | undefined;
444
444
  writingMode?: csstype.Property.WritingMode | readonly NonNullable<csstype.Property.WritingMode | undefined>[] | readonly csstype.Property.WritingMode[] | undefined;
445
445
  zIndex?: csstype.Property.ZIndex | readonly NonNullable<csstype.Property.ZIndex | undefined>[] | readonly ((string & {}) | csstype.Globals | "auto")[] | undefined;
446
- zoom?: csstype.Property.Zoom | readonly NonNullable<csstype.Property.Zoom | undefined>[] | readonly ("reset" | (string & {}) | csstype.Globals | "normal")[] | undefined;
446
+ zoom?: csstype.Property.Zoom | readonly NonNullable<csstype.Property.Zoom | undefined>[] | readonly ((string & {}) | csstype.Globals | "normal" | "reset")[] | undefined;
447
447
  all?: csstype.Globals | readonly NonNullable<csstype.Globals | undefined>[] | readonly csstype.Globals[] | undefined;
448
448
  animation?: csstype.Property.Animation<string & {}> | readonly NonNullable<csstype.Property.Animation<string & {}> | undefined>[] | readonly ((string & {}) | csstype.Globals | "normal" | "reverse" | "linear" | "none" | "auto" | "both" | "alternate" | "alternate-reverse" | "backwards" | "forwards" | "infinite" | "paused" | "running" | "ease" | "ease-in" | "ease-in-out" | "ease-out" | "step-end" | "step-start")[] | undefined;
449
449
  animationRange?: csstype.Property.AnimationRange<string | number> | readonly NonNullable<csstype.Property.AnimationRange<string | number> | undefined>[] | readonly (string | (string & {}))[] | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zydon/common",
3
- "version": "2.2.10",
3
+ "version": "2.2.11",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",
@@ -1,17 +0,0 @@
1
- import { a } from './chunk-NF42ENKE.js';
2
- import { b } from './chunk-ILHUUK4X.js';
3
- import O, { forwardRef, useMemo, useEffect } from 'react';
4
- import de, { autocompleteClasses } from '@mui/material/Autocomplete';
5
- import ue from '@mui/material/CircularProgress';
6
- import ce from '@mui/material/TextField';
7
- import { VariableSizeList } from 'react-window';
8
- import W from '@mui/material/Typography';
9
- import ee from '@mui/material/Divider';
10
- import v from '@mui/material/Stack';
11
- import Z from '@mui/material/Popper';
12
- import { styled } from '@mui/material/styles';
13
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
14
-
15
- var H=styled(Z)({[`& .${autocompleteClasses.listbox}`]:{boxSizing:"border-box","& ul":{padding:0,margin:0}}}),D=styled(v)(({theme:e})=>({flex:1,width:"100%",[e.breakpoints.down("md")]:{flexDirection:"column",gap:0,width:"100%"},[e.breakpoints.up("sm")]:{width:"calc(100% - 75px)"},[e.breakpoints.up("md")]:{flexDirection:"row",gap:8}})),T=styled(v)(({theme:e})=>({flex:1,maxWidth:"100%",[e.breakpoints.up("md")]:{flex:"1 1 calc(50% - 8px)",width:"calc(50% - 8px)",minWidth:"calc(50% - 8px)",maxWidth:"calc(50% - 8px)"}})),R=styled(v)(({theme:e})=>({position:"relative",alignItems:"center",justifyContent:"center",width:68,height:68,borderRadius:8,overflow:"hidden",img:{position:"absolute",width:"100%",height:"100%",objectFit:"cover"},[e.breakpoints.down("sm")]:{display:"none"}}));var te=({option:e})=>{let t=Object.keys(e).filter(l=>l.startsWith("field")).map((l,m)=>{let s=e[l];if(s&&typeof s=="object"){let p="label"in s?s.label:null,d="value"in s?s.value:null;return jsxs(W,{component:"span",variant:"body2",color:"textPrimary",noWrap:!0,children:[p,": ",d]},`${l}:${m}`)}}),i=e.image?jsx("img",{alt:"Imagem",src:e.image}):jsx(a,{alt:e.label||e.value.toString(),name:e.label||e.value.toString(),sx:{width:68,height:68,borderRadius:1}});return jsxs(Fragment,{children:[jsxs(v,{direction:"row",gap:2,margin:2,children:[jsx(R,{children:i}),jsxs(D,{children:[jsxs(T,{children:[jsx(v,{children:jsxs(W,{variant:"subtitle2",color:"textPrimary",noWrap:!0,children:[e.value," - ",e.label]})}),t[0]?t[0]:void 0,t[1]?t[1]:void 0]}),t.length>2&&jsxs(T,{children:[t[2]?t[2]:void 0,t[3]?t[3]:void 0,t[4]?t[4]:void 0]})]})]}),jsx(ee,{className:"border",sx:{borderStyle:"dashed",position:"absolute",bottom:0,width:1}})]})},x=te;var N=8,le=e=>{let{data:t,index:i,style:l}=e,m=t[i],s={...l,top:l.top+N,paddingTop:8,display:"block"};return jsx(W,{component:"li",...m.props,noWrap:!0,style:s,children:jsx(x,{...m?.props?.children?.props})})},X=O.createContext({}),B=forwardRef((e,t)=>{let i=O.useContext(X);return jsx("div",{ref:t,...e,...i})});B.displayName="OuterElementType";var ae=e=>{let t=O.useRef(null);return useEffect(()=>{t.current!=null&&t.current.resetAfterIndex(0,!0);},[e]),t},se=forwardRef(function(t,i){let{children:l,"data-item-height":m,...s}=t,p=[];l.forEach(a=>{p.push(a),p.push(...a.children||[]);});let d=p.length,h=m>112?m:112,u=a=>Object.prototype.hasOwnProperty.call(a,"group")?48:h,S=()=>d>8?8*h:p.map(u).reduce((a,L)=>a+L,0),C=ae(d);return jsx("div",{ref:i,children:jsx(X.Provider,{value:s,children:jsx(VariableSizeList,{itemData:p,height:S()+2*N,width:"100%",ref:C,outerElementType:B,innerElementType:"ul",itemSize:a=>u(p[a]),overscanCount:5,itemCount:d,children:le})})})}),J=se;var j=forwardRef(({label:e,value:t,options:i=[],loading:l,noOptionsText:m="Nenhum resultado encontrado.",loadingText:s="Carregando op\xE7\xF5es...",error:p,helperText:d,placeholder:h,onChange:u,groupBy:S,disabled:C,multiple:a,required:L,renderOption:G,tabIndex:U,onSearch:P,onInputChange:w,..._},F)=>{let V=b("down","md"),q=r=>r&&typeof r=="object"?r.value.toString():r.toString(),I=useMemo(()=>a?(Array.isArray(t)?t:[]).reduce((o,A)=>{let E=i.find(Q=>Q.value.toString()===A.toString());return E?[...o,E]:[...o]},[]):i.find(n=>n.value.toString()===t?.toString())||null,[i,t,a]),K=V&&i[0]?Object.keys(i[0]).length*24:void 0;return jsx(de,{ref:F,value:I,onInputChange:(r,n,o)=>{!l&&!I&&u(a?[]:null),w&&w(r,n,o),P&&r&&(r.type==="change"||r.type==="blur")&&P(n);},options:i,loading:l,noOptionsText:m,loadingText:s,disabled:l||C,disableListWrap:!0,PopperComponent:H,ListboxProps:{"data-item-height":K},ListboxComponent:G?void 0:J,filterOptions:(r,n)=>r.filter(o=>`${o.field1?.value} ${o.field1?.label} ${o.field2?.label} ${o.field2?.value} ${o.field3?.label} ${o.field3?.value} ${o.field4?.label} ${o.field4?.value} ${o.field5?.label} ${o.field5?.value} ${o.label}${o.value}`.toLocaleUpperCase().includes(n.inputValue.toLocaleUpperCase())),onChange:(r,n)=>{if(!n){u(a?[]:null);return}if(Array.isArray(n)){u(n.map(q));return}u(typeof n=="string"?n.toString():n.value.toString());},renderOption:({key:r,...n},o)=>jsx("li",{...n,style:{display:"block"},children:jsx(x,{option:o})},r),renderGroup:r=>r,groupBy:S,multiple:a,renderInput:r=>jsx(ce,{...r,placeholder:h,fullWidth:!0,error:!!p,helperText:d,label:e,required:L,InputProps:{...r.InputProps,endAdornment:jsxs(Fragment,{children:[l?jsx(ue,{color:"primary",size:20}):null,r.InputProps.endAdornment]})},inputProps:{...r.inputProps,tabIndex:U}}),..._})});j.displayName="Autocomplete";var _e=j;
16
-
17
- export { _e as a };
@@ -1,11 +0,0 @@
1
- import { f } from './chunk-ANAHA3L6.js';
2
- import { a } from './chunk-PV522B4W.js';
3
- import { a as a$1 } from './chunk-4Z2JJGWA.js';
4
- import { forwardRef, useState, useRef, useMemo, useCallback } from 'react';
5
- import A from '@mui/material/IconButton';
6
- import C from '@mui/material/InputAdornment';
7
- import { jsx } from 'react/jsx-runtime';
8
-
9
- var M=forwardRef(({name:R,increment:r=1,updadteForMultiple:h,allowNegative:s=!1,value:D=0,onChange:c,minValue:n,maxValue:e,decimalScale:p,disabled:i,tabIndex:T,...w},B)=>{let[O,v]=useState(`incrementer-input-${Date.now()}`),I=useRef(null),u=Number(D||0),d=()=>{I.current&&(clearTimeout(I.current),I.current=null);},z=useMemo(()=>{let o=u-r;return typeof n=="number"&&o<n?!0:s?i:o<0},[i,u,r,n,s]),E=useMemo(()=>{let o=u+r;return typeof e=="number"&&o>e?!0:i},[i,u,r,e]),L=useCallback(()=>{if(d(),!s&&u-r<0)return;let o=u-r,t=n!==void 0&&o<n?n:f(o,p);c(t);},[u,r,n,p,c,s]),N=useCallback(()=>{d();let o=u+r,t=e!==void 0&&o>e?e:f(o,p);c(t);},[u,r,e,p,c]),_=useCallback(o=>{d();let t=Number(o.target.value||0);(r!==1||h)&&(t=t+r/2,t-=t%r),!s&&t<0&&(t=0),typeof n=="number"&&t<n&&(t=n),typeof e=="number"&&t>e&&(t=e),t=f(t,p),t===D&&(I.current=setTimeout(()=>{v(`incrementer-input-${Date.now()}`);},600)),c(t);},[r,n,e,p,c,h,s]);return jsx(a,{ref:B,name:R,value:u,minValue:n,maxValue:e,allowNegative:s,decimalScale:p,InputProps:{startAdornment:jsx(C,{position:"start",children:jsx(A,{size:"medium",disabled:z,onClick:L,children:jsx(a$1,{icon:"MINUS_SIGN",width:14,height:14,color:"primary.main"})})}),endAdornment:jsx(C,{position:"end",children:jsx(A,{size:"medium",onClick:N,disabled:E,children:jsx(a$1,{icon:"SIMPLE_ADD",width:14,height:14,color:"primary.main"})})}),inputProps:{style:{textAlign:"center"}}},inputProps:{tabIndex:T},onChange:_,disabled:i,...w},O)});M.displayName="Incrementer";var X=M;
10
-
11
- export { X as a };
@@ -1,17 +0,0 @@
1
- import { a } from './chunk-4Z2JJGWA.js';
2
- import { createContext, forwardRef, useContext, useMemo, useRef, useEffect } from 'react';
3
- import ne, { autocompleteClasses } from '@mui/material/Autocomplete';
4
- import ie from '@mui/material/CircularProgress';
5
- import se from '@mui/material/TextField';
6
- import { VariableSizeList } from 'react-window';
7
- import G from '@mui/material/ListSubheader';
8
- import _ from '@mui/material/Stack';
9
- import { useTheme, styled } from '@mui/material/styles';
10
- import v from '@mui/material/Typography';
11
- import F from '@mui/material/useMediaQuery';
12
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
13
- import ee from '@mui/material/Popper';
14
-
15
- var I=8,Q=m=>{let{data:o,index:i,style:p}=m,n=o[i],{showValueInLabel:s,...f}=n[0],c={...p,top:p.top+I,paddingTop:8};return Object.prototype.hasOwnProperty.call(n,"group")?jsx(G,{component:"div",style:c,children:n.group},n.key):jsx(v,{component:"li",...f,noWrap:!0,style:c,children:jsxs(_,{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(v,{variant:"inherit",color:"grey.400",children:["(",n[1].value,")"]})]})})},R=createContext({}),z=forwardRef((m,o)=>{let i=useContext(R);return jsx("div",{ref:o,...m,...i})});z.displayName="OuterElementType";var K=m=>{let o=useRef(null);return useEffect(()=>{o.current!=null&&o.current.resetAfterIndex(0,!0);},[m]),o},Y=forwardRef(function(o,i){let{children:p,...n}=o,s=[];p.forEach(r=>{s.push(r),s.push(...r.children||[]);});let f=useTheme(),c=F(f.breakpoints.up("sm")),y=s.length,l=c?36:48,h=r=>Object.prototype.hasOwnProperty.call(r,"group")?48:l,C=()=>y>8?8*l:s.map(h).reduce((r,P)=>r+P,0),L=K(y);return jsx("div",{ref:i,children:jsx(R.Provider,{value:n,children:jsx(VariableSizeList,{itemData:s,height:C()+2*I,width:"100%",ref:L,outerElementType:z,innerElementType:"ul",itemSize:r=>h(s[r]),overscanCount:5,itemCount:y,children:Q})})})}),M=Y;var k=styled(ee)({[`& .${autocompleteClasses.listbox}`]:{boxSizing:"border-box","& ul":{padding:0,margin:0}}});var N=forwardRef(({label:m,value:o,options:i=[],loading:p,noOptionsText:n="Nenhum resultado encontrado.",loadingText:s="Carregando op\xE7\xF5es...",error:f,helperText:c,placeholder:y,onChange:l,groupBy:h,showValueInLabel:C,disabled:L,multiple:r,required:P,renderOption:x,tabIndex:D,onInputChange:T,onSearch:A,...H},X)=>{let J=e=>e&&typeof e=="object"?e.value.toString():e.toString(),d=useMemo(()=>r?(Array.isArray(o)?o:[]).reduce((u,g)=>{let E=i.find(V=>V.value.toString()===g.toString());return E?[...u,E]:[...u]},[]):i.find(t=>t.value.toString()===o?.toString())||null,[i,o,r]);return jsx(ne,{ref:X,value:d,onInputChange:(e,t,u)=>{!p&&!d&&l(r?[]:null),T&&T(e,t,u),A&&e&&(e.type==="change"||e.type==="blur")&&A(t);},options:i,loading:p,noOptionsText:n,loadingText:s,disabled:p||L,disableListWrap:!0,PopperComponent:k,ListboxComponent:x?void 0:M,filterOptions:(e,t)=>e.filter(u=>`${u.value} ${u.label}`.toLocaleUpperCase().includes(t.inputValue.toLocaleUpperCase())),onChange:(e,t)=>{if(!t){l(r?[]:null);return}if(Array.isArray(t)){l(t.map(J));return}l(typeof t=="string"?t.toString():t.value.toString());},renderOption:(e,t,u,g)=>x?x(e,t,u,g):[{...e,showValueInLabel:C},t],renderGroup:e=>e,groupBy:h,multiple:r,renderInput:e=>jsx(se,{...e,placeholder:y,fullWidth:!0,error:!!f,helperText:c,label:m,required:P,InputProps:{...e.InputProps,...!r&&{startAdornment:d&&!Array.isArray(d)&&d.icon?jsx(a,{icon:d.icon}):void 0},endAdornment:jsxs(Fragment,{children:[p?jsx(ie,{color:"primary",size:20}):null,e.InputProps.endAdornment]})},inputProps:{...e.inputProps,tabIndex:D}}),...H})});N.displayName="Autocomplete";var Me=N;
16
-
17
- export { Me as a };