@zydon/common 2.0.81 → 2.0.83
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.
|
@@ -6,17 +6,17 @@ import '../../chunk-ZDHXW74M.js';
|
|
|
6
6
|
import { a as a$4 } from '../../chunk-QACPD766.js';
|
|
7
7
|
import '../../chunk-S3U3CT7C.js';
|
|
8
8
|
import { useState } from 'react';
|
|
9
|
-
import
|
|
9
|
+
import h from '@mui/material/Checkbox';
|
|
10
10
|
import T from '@mui/material/CircularProgress';
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
11
|
+
import f from '@mui/material/Divider';
|
|
12
|
+
import t from '@mui/material/Stack';
|
|
13
|
+
import S from '@mui/material/Typography';
|
|
14
14
|
import { debounce } from '@mui/material/utils';
|
|
15
15
|
import U from '@mui/material/Box';
|
|
16
16
|
import X from '@mui/material/Button';
|
|
17
17
|
import { styled } from '@mui/material/styles';
|
|
18
18
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
19
19
|
|
|
20
|
-
var R=styled(X)(({theme:a})=>({borderColor:a.palette.grey[300]})),
|
|
20
|
+
var R=styled(X)(({theme:a})=>({borderColor:a.palette.grey[300]})),L=styled(U)(({theme:a})=>({display:"flex",border:`1.5px solid ${a.palette.grey[300]}`,height:450,borderRadius:8,flex:1,overflow:"hidden"}));var Z=({selectedItems:a$5,items:B,loading:$,searchText:g,onAdd:D,onRemove:P,search:z,itemsTitle:W,selectedItemsTitle:H,additionalContent:K,enableSearchInSelectedItems:k,selectedItemChild:A,onSearch:N})=>{let[m,_]=useState(""),M=debounce(N,400),d=B.filter(e=>!a$5.some(n=>n.id===e.id)),O=a$5.filter(e=>e.name?.toLowerCase().includes(m.toLowerCase())||e.id?.toLowerCase().includes(m.toLowerCase())),u=k&&m?O:a$5,[i,s]=useState([]),[l,p]=useState([]),j=()=>{D(i),s([]);},G=()=>{P(l),p([]);},V=e=>{p(e?u:[]);},q=e=>{s(e?d:[]);},J=(e,n)=>{p(n?c=>[...c,e]:c=>c.filter(y=>y.id!==e.id));},Q=(e,n)=>{s(n?c=>[...c,e]:c=>c.filter(y=>y.id!==e.id));},E=e=>{e.key==="Enter"&&e.preventDefault();};return jsx(t,{children:jsxs(t,{direction:"row",alignItems:"center",gap:3,children:[jsx(L,{flex:1,children:jsxs(t,{flex:1,overflow:"hidden",children:[jsxs(t,{direction:"row",gap:1,padding:2,children:[jsx(h,{size:"small",indeterminate:i.length>0&&i.length!==d.length,checked:i.length>0&&i.length===d.length,onChange:e=>q(e.target.checked)}),jsxs(t,{children:[jsx(S,{variant:"subtitle2",color:"text.primary",children:`${W} cadastrados(as)`}),jsx(S,{variant:"caption",color:"text.disabled",children:`${i.length}/${d.length} selecionados`})]})]}),jsx(f,{}),jsxs(t,{p:2,flex:1,overflow:"hidden",children:[jsxs(t,{direction:"row",gap:1,children:[jsx(a,{iconPosition:"start",placeholder:"Buscar",onKeyDown:E,size:"small",fullWidth:!0,trigger:"change",onSearch:e=>M(e)}),K]}),jsx(a$1,{isLoading:$,loading:jsx(t,{alignItems:"center",justifyContent:"center",flex:1,children:jsx(T,{})}),isEmpty:d.length===0,empty:jsx(a$2,{text:z?`Nenhum ${g} encontrado`:`Nenhum ${g} dispon\xEDvel`,sx:{svg:{height:140}}}),children:jsx(a$3,{sx:{maxHeight:280},children:d.map(e=>jsxs(t,{gap:1,marginTop:"8px",children:[jsxs(t,{direction:"row",gap:.5,alignItems:"center",marginTop:"8px",children:[jsx(h,{size:"small",checked:i.includes(e),onChange:n=>Q(e,n.target.checked)}),e.label]}),jsx(f,{})]},e.id))})})]})]})}),jsxs(t,{gap:3,children:[jsx(R,{variant:"outlined",onClick:j,children:jsx(a$4,{icon:"ARROW_RIGHT_SIMPLE"})}),jsx(R,{variant:"outlined",onClick:G,children:jsx(a$4,{icon:"ARROW_LEFT_SIMPLE"})})]}),jsx(L,{flex:1,children:jsxs(t,{flex:1,overflow:"hidden",children:[jsxs(t,{direction:"row",gap:1,padding:2,children:[jsx(h,{size:"small",indeterminate:l.length>0&&l.length!==a$5.length,checked:l.length>0&&l.length===a$5.length,onChange:e=>V(e.target.checked)}),jsxs(t,{children:[jsx(S,{variant:"subtitle2",color:"text.primary",children:`${H} selecionados(as)`}),jsx(S,{variant:"caption",color:"text.disabled",children:`${l.length}/${a$5.length} selecionados`})]})]}),jsx(f,{}),jsxs(t,{p:2,gap:1,overflow:"hidden",children:[k&&jsx(a,{iconPosition:"start",placeholder:"Buscar",size:"small",fullWidth:!0,trigger:"change",onSearch:e=>_(e??""),onKeyDown:E}),jsx(a$1,{isLoading:$,loading:jsx(t,{alignItems:"center",justifyContent:"center",flex:1,children:jsx(T,{})}),isEmpty:u.length===0,empty:jsx(a$2,{text:m&&k?`Nenhum ${g} encontrado`:`Nenhum ${g} selecionado`,sx:{svg:{height:140},marginTop:"56px",backgroundColor:"transparent"}}),children:jsx(a$3,{sx:{maxHeight:280},children:u.map(e=>jsxs(t,{gap:1,children:[jsxs(t,{direction:"row",gap:.5,alignItems:"center",marginTop:"8px",children:[jsxs(t,{direction:"row",children:[A&&A(e),jsx(h,{size:"small",checked:l.includes(e),onChange:n=>J(e,n.target.checked)})]}),e.label]}),jsx(f,{})]},e.id))})})]})]})})]})})},ue=Z;
|
|
21
21
|
|
|
22
22
|
export { ue as default };
|
|
@@ -5,7 +5,7 @@ declare const useAutocomplete: (initialValue?: Option | Option[]) => {
|
|
|
5
5
|
buildOptions: (options?: Option[]) => Option[];
|
|
6
6
|
search: string | undefined;
|
|
7
7
|
onSearch: (search?: string) => void;
|
|
8
|
-
onSelectValue: (options: Option[] | undefined, selected:
|
|
8
|
+
onSelectValue: (options: Option[] | undefined, selected: unknown) => void;
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
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[c
|
|
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;
|
|
5
5
|
|
|
6
|
-
export {
|
|
6
|
+
export { b as default };
|