@zydon/common 2.0.82 → 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 m from '@mui/material/Checkbox';
9
+ import h from '@mui/material/Checkbox';
10
10
  import T from '@mui/material/CircularProgress';
11
- import h from '@mui/material/Divider';
12
- import o from '@mui/material/Stack';
13
- import f from '@mui/material/Typography';
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]})),I=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:S,selectedItemChild:A,onSearch:N})=>{let[k,_]=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(k.toLowerCase())),u=S&&k?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(o,{children:jsxs(o,{direction:"row",alignItems:"center",gap:3,children:[jsx(I,{flex:1,children:jsxs(o,{flex:1,overflow:"hidden",children:[jsxs(o,{direction:"row",gap:1,padding:2,children:[jsx(m,{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(o,{children:[jsx(f,{variant:"subtitle2",color:"text.primary",children:`${W} cadastrados(as)`}),jsx(f,{variant:"caption",color:"text.disabled",children:`${i.length}/${d.length} selecionados`})]})]}),jsx(h,{}),jsxs(o,{p:2,flex:1,overflow:"hidden",children:[jsxs(o,{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(o,{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(o,{gap:1,marginTop:"8px",children:[jsxs(o,{direction:"row",gap:.5,alignItems:"center",marginTop:"8px",children:[jsx(m,{size:"small",checked:i.includes(e),onChange:n=>Q(e,n.target.checked)}),e.label]}),jsx(h,{})]},e.id))})})]})]})}),jsxs(o,{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(I,{flex:1,children:jsxs(o,{flex:1,overflow:"hidden",children:[jsxs(o,{direction:"row",gap:1,padding:2,children:[jsx(m,{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(o,{children:[jsx(f,{variant:"subtitle2",color:"text.primary",children:`${H} selecionados(as)`}),jsx(f,{variant:"caption",color:"text.disabled",children:`${l.length}/${a$5.length} selecionados`})]})]}),jsx(h,{}),jsxs(o,{p:2,gap:1,overflow:"hidden",children:[S&&jsx(a,{iconPosition:"start",placeholder:"Buscar",size:"small",fullWidth:!0,trigger:"change",onSearch:e=>_(e??""),onKeyDown:E}),jsx(a$1,{isLoading:$,loading:jsx(o,{alignItems:"center",justifyContent:"center",flex:1,children:jsx(T,{})}),isEmpty:u.length===0,empty:jsx(a$2,{text:k&&S?`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(o,{gap:1,children:[jsxs(o,{direction:"row",gap:.5,alignItems:"center",marginTop:"8px",children:[jsxs(o,{direction:"row",children:[A&&A(e),jsx(m,{size:"small",checked:l.includes(e),onChange:n=>J(e,n.target.checked)})]}),e.label]}),jsx(h,{})]},e.id))})})]})]})})]})})},ue=Z;
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zydon/common",
3
- "version": "2.0.82",
3
+ "version": "2.0.83",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",