@zydon/common 2.3.31 → 2.3.32
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-7HCMY4TM.js +17 -0
- package/dist/chunk-M7BRHRFK.js +7 -0
- package/dist/components/Autocomplete/index.d.ts +1 -0
- package/dist/components/Autocomplete/index.js +1 -1
- package/dist/components/form/Address/index.js +2 -2
- package/dist/components/form/Autocomplete/index.d.ts +3 -1
- package/dist/components/form/Autocomplete/index.js +2 -2
- package/dist/components/form/Webhook/index.js +2 -2
- package/dist/types/autoCompleteProps.d.ts +2 -0
- package/package.json +1 -1
- package/dist/chunk-LX7UN2X7.js +0 -17
- package/dist/chunk-NDLAVFYV.js +0 -7
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { a } from './chunk-HMOIIKEY.js';
|
|
2
|
+
import { createContext, forwardRef, useContext, useState, useMemo, useRef, useEffect } from 'react';
|
|
3
|
+
import me, { autocompleteClasses } from '@mui/material/Autocomplete';
|
|
4
|
+
import le from '@mui/material/CircularProgress';
|
|
5
|
+
import ae from '@mui/material/TextField';
|
|
6
|
+
import { VariableSizeList } from 'react-window';
|
|
7
|
+
import Q from '@mui/material/ListSubheader';
|
|
8
|
+
import K from '@mui/material/Stack';
|
|
9
|
+
import { useTheme, styled } from '@mui/material/styles';
|
|
10
|
+
import I from '@mui/material/Typography';
|
|
11
|
+
import Z from '@mui/material/useMediaQuery';
|
|
12
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
13
|
+
import ne from '@mui/material/Popper';
|
|
14
|
+
|
|
15
|
+
var k=8,ee=u=>{let{data:r,index:i,style:m}=u,n=r[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(K,{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,r)=>{let i=useContext(z);return jsx("div",{ref:r,...u,...i})});M.displayName="OuterElementType";var te=u=>{let r=useRef(null);return useEffect(()=>{r.current!=null&&r.current.resetAfterIndex(0,!0);},[u]),r},re=forwardRef(function(r,i){let{children:m,...n}=r,s=[];m.forEach(o=>{s.push(o),s.push(...o.children||[]);});let c=useTheme(),f=Z(c.breakpoints.up("sm")),l=s.length,d=f?36:48,g=o=>Object.prototype.hasOwnProperty.call(o,"group")?48:d,C=()=>l>8?8*d:s.map(g).reduce((o,P)=>o+P,0),L=te(l);return jsx("div",{ref:i,children:jsx(z.Provider,{value:n,children:jsx(VariableSizeList,{itemData:s,height:C()+2*k,width:"100%",ref:L,outerElementType:M,innerElementType:"ul",itemSize:o=>g(s[o]),overscanCount:5,itemCount:l,children:ee})})})}),N=re;var D=styled(ne)({[`& .${autocompleteClasses.listbox}`]:{boxSizing:"border-box","& ul":{padding:0,margin:0}}});var H=forwardRef(({label:u,value:r,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:L,multiple:o,required:P,renderOption:x,tabIndex:X,onInputChange:A,onSearch:v,onBlur:E,InputLabelProps:J,...$},V)=>{let[U,T]=useState(),W=e=>e&&typeof e=="object"?e.value.toString():e.toString(),y=useMemo(()=>o?(Array.isArray(r)?r:[]).reduce((p,b)=>{let O=i.find(j=>j.value.toString()===b.toString());return O?[...p,O]:[...p]},[]):i.find(t=>t.value.toString()===r?.toString())||null,[i,r,o]);return jsx(me,{ref:V,value:U||y,onInputChange:(e,t,p)=>{if(A&&A(e,t,p),p==="input"){v&&(v(t),T(t));return}T(void 0);},options:i,loading:m,noOptionsText:n,loadingText:s,disabled:m||L,disableListWrap:!0,PopperComponent:D,ListboxComponent:x?void 0:N,filterOptions:(e,t)=>e.filter(p=>`${p.value} ${p.label}`.toLocaleUpperCase().includes(t.inputValue.toLocaleUpperCase())),onChange:(e,t)=>{if(!t){d(o?[]:null);return}if(Array.isArray(t)){d(t.map(W));return}d(typeof t=="string"?t.toString():t.value.toString());},onBlur:e=>{E&&E(e),T(void 0);},renderOption:(e,t,p,b)=>x?x(e,t,p,b):[{...e,showValueInLabel:C},t],renderGroup:e=>e,groupBy:g,multiple:o,renderInput:e=>jsx(ae,{...e,placeholder:l,fullWidth:!0,error:!!c,helperText:f,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(le,{color:"primary",size:20}):null,e.InputProps.endAdornment]})},inputProps:{...e.inputProps,tabIndex:X},InputLabelProps:J}),...$})});H.displayName="Autocomplete";var Xe=H;
|
|
16
|
+
|
|
17
|
+
export { Xe as a };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { a } from './chunk-7HCMY4TM.js';
|
|
2
|
+
import { useFormContext, Controller } from 'react-hook-form';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
var f=({name:t,helperText:l,rules:s,onSelectOption:e,InputLabelProps:a$1,...u})=>{let{control:c}=useFormContext();return jsx(Controller,{name:t,control:c,rules:s,render:({field:o,fieldState:{error:r}})=>jsx(a,{"data-intercom-target":t,...o,...u,onChange:n=>{e&&e(n,o.value),o.onChange(n);},error:!!r,helperText:r?.message||l,InputLabelProps:a$1})})},i=f;
|
|
6
|
+
|
|
7
|
+
export { i as a };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { a as a$2 } from '../../../chunk-VTHBHXM2.js';
|
|
2
2
|
import { a as a$1 } from '../../../chunk-2NMLQNWC.js';
|
|
3
|
-
import { a as a$3 } from '../../../chunk-
|
|
3
|
+
import { a as a$3 } from '../../../chunk-M7BRHRFK.js';
|
|
4
4
|
import '../../../chunk-ORLVNXTG.js';
|
|
5
|
-
import '../../../chunk-
|
|
5
|
+
import '../../../chunk-7HCMY4TM.js';
|
|
6
6
|
import '../../../chunk-HMOIIKEY.js';
|
|
7
7
|
import '../../../chunk-RPKNOLCY.js';
|
|
8
8
|
import E from '@mui/material/CircularProgress';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { InputLabelProps } from '@mui/material/InputLabel';
|
|
2
3
|
import { BaseAutoComplete } from '../../../types/autoComplete.js';
|
|
3
4
|
import { BaseField } from '../../../types/baseField.js';
|
|
4
5
|
import { Option } from '../../../types/option.js';
|
|
@@ -9,8 +10,9 @@ import 'react-hook-form';
|
|
|
9
10
|
|
|
10
11
|
type AutocompleteProps = BaseField<BaseAutoComplete> & {
|
|
11
12
|
onSelectOption?(newValue: NonNullable<string | Option> | (string | Option)[] | null | undefined, oldValue?: NonNullable<string | Option> | (string | Option)[] | null | undefined): void;
|
|
13
|
+
InputLabelProps?: Partial<InputLabelProps>;
|
|
12
14
|
};
|
|
13
15
|
|
|
14
|
-
declare const Autocomplete: ({ name, helperText, rules, onSelectOption, ...other }: AutocompleteProps) => react_jsx_runtime.JSX.Element;
|
|
16
|
+
declare const Autocomplete: ({ name, helperText, rules, onSelectOption, InputLabelProps, ...other }: AutocompleteProps) => react_jsx_runtime.JSX.Element;
|
|
15
17
|
|
|
16
18
|
export { Autocomplete as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { a as default } from '../../../chunk-
|
|
2
|
-
import '../../../chunk-
|
|
1
|
+
export { a as default } from '../../../chunk-M7BRHRFK.js';
|
|
2
|
+
import '../../../chunk-7HCMY4TM.js';
|
|
3
3
|
import '../../../chunk-HMOIIKEY.js';
|
|
4
4
|
import '../../../chunk-RPKNOLCY.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a } from '../../../chunk-VTHBHXM2.js';
|
|
2
|
-
import { a as a$2 } from '../../../chunk-
|
|
2
|
+
import { a as a$2 } from '../../../chunk-M7BRHRFK.js';
|
|
3
3
|
import { a as a$3 } from '../../../chunk-7SYZRGWH.js';
|
|
4
|
-
import '../../../chunk-
|
|
4
|
+
import '../../../chunk-7HCMY4TM.js';
|
|
5
5
|
import { a as a$1 } from '../../../chunk-HMOIIKEY.js';
|
|
6
6
|
import '../../../chunk-RPKNOLCY.js';
|
|
7
7
|
import { useFormContext, useFieldArray } from 'react-hook-form';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { InputLabelProps } from '@mui/material/InputLabel';
|
|
1
2
|
import { BaseAutoComplete } from './autoComplete.js';
|
|
2
3
|
import { Option } from './option.js';
|
|
3
4
|
import 'react';
|
|
@@ -12,6 +13,7 @@ type AutocompleteProps = BaseAutoComplete & {
|
|
|
12
13
|
helperText?: string;
|
|
13
14
|
showValueInLabel?: boolean;
|
|
14
15
|
showAdditionalFields?: boolean;
|
|
16
|
+
InputLabelProps?: Partial<InputLabelProps>;
|
|
15
17
|
};
|
|
16
18
|
|
|
17
19
|
export { AutocompleteProps };
|
package/package.json
CHANGED
package/dist/chunk-LX7UN2X7.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { a } from './chunk-HMOIIKEY.js';
|
|
2
|
-
import { createContext, forwardRef, useContext, useState, useMemo, useRef, useEffect } from 'react';
|
|
3
|
-
import ue, { autocompleteClasses } from '@mui/material/Autocomplete';
|
|
4
|
-
import me from '@mui/material/CircularProgress';
|
|
5
|
-
import le from '@mui/material/TextField';
|
|
6
|
-
import { VariableSizeList } from 'react-window';
|
|
7
|
-
import F from '@mui/material/ListSubheader';
|
|
8
|
-
import Q from '@mui/material/Stack';
|
|
9
|
-
import { useTheme, styled } from '@mui/material/styles';
|
|
10
|
-
import I from '@mui/material/Typography';
|
|
11
|
-
import Y from '@mui/material/useMediaQuery';
|
|
12
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
13
|
-
import oe from '@mui/material/Popper';
|
|
14
|
-
|
|
15
|
-
var k=8,Z=u=>{let{data:r,index:i,style:m}=u,n=r[i],{showValueInLabel:s,key:c,...f}=n[0],l={...m,top:m.top+k,paddingTop:8};return Object.prototype.hasOwnProperty.call(n,"group")?jsx(F,{component:"div",style:l,children:n.group},`list-box-item-group-${c}`):jsx(I,{component:"li",...f,noWrap:!0,style:l,children:jsxs(Q,{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,r)=>{let i=useContext(z);return jsx("div",{ref:r,...u,...i})});M.displayName="OuterElementType";var ee=u=>{let r=useRef(null);return useEffect(()=>{r.current!=null&&r.current.resetAfterIndex(0,!0);},[u]),r},te=forwardRef(function(r,i){let{children:m,...n}=r,s=[];m.forEach(o=>{s.push(o),s.push(...o.children||[]);});let c=useTheme(),f=Y(c.breakpoints.up("sm")),l=s.length,d=f?36:48,g=o=>Object.prototype.hasOwnProperty.call(o,"group")?48:d,C=()=>l>8?8*d:s.map(g).reduce((o,L)=>o+L,0),x=ee(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:o=>g(s[o]),overscanCount:5,itemCount:l,children:Z})})})}),N=te;var D=styled(oe)({[`& .${autocompleteClasses.listbox}`]:{boxSizing:"border-box","& ul":{padding:0,margin:0}}});var H=forwardRef(({label:u,value:r,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:o,required:L,renderOption:P,tabIndex:X,onInputChange:A,onSearch:v,onBlur:E,...J},$)=>{let[V,T]=useState(),U=e=>e&&typeof e=="object"?e.value.toString():e.toString(),y=useMemo(()=>o?(Array.isArray(r)?r:[]).reduce((p,h)=>{let O=i.find(W=>W.value.toString()===h.toString());return O?[...p,O]:[...p]},[]):i.find(t=>t.value.toString()===r?.toString())||null,[i,r,o]);return jsx(ue,{ref:$,value:V||y,onInputChange:(e,t,p)=>{if(A&&A(e,t,p),p==="input"){v&&(v(t),T(t));return}T(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(o?[]:null);return}if(Array.isArray(t)){d(t.map(U));return}d(typeof t=="string"?t.toString():t.value.toString());},onBlur:e=>{E&&E(e),T(void 0);},renderOption:(e,t,p,h)=>P?P(e,t,p,h):[{...e,showValueInLabel:C},t],renderGroup:e=>e,groupBy:g,multiple:o,renderInput:e=>jsx(le,{...e,placeholder:l,fullWidth:!0,error:!!c,helperText:f,label:u,required:L,InputProps:{...e.InputProps,...!o&&{startAdornment:y&&!Array.isArray(y)&&y.icon?jsx(a,{icon:y.icon}):void 0},endAdornment:jsxs(Fragment,{children:[m?jsx(me,{color:"primary",size:20}):null,e.InputProps.endAdornment]})},inputProps:{...e.inputProps,tabIndex:X}}),...J})});H.displayName="Autocomplete";var He=H;
|
|
16
|
-
|
|
17
|
-
export { He as a };
|
package/dist/chunk-NDLAVFYV.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { a } from './chunk-LX7UN2X7.js';
|
|
2
|
-
import { useFormContext, Controller } from 'react-hook-form';
|
|
3
|
-
import { jsx } from 'react/jsx-runtime';
|
|
4
|
-
|
|
5
|
-
var C=({name:t,helperText:l,rules:s,onSelectOption:e,...a$1})=>{let{control:u}=useFormContext();return jsx(Controller,{name:t,control:u,rules:s,render:({field:o,fieldState:{error:r}})=>jsx(a,{"data-intercom-target":t,...o,...a$1,onChange:n=>{e&&e(n,o.value),o.onChange(n);},error:!!r,helperText:r?.message||l})})},h=C;
|
|
6
|
-
|
|
7
|
-
export { h as a };
|