@zydon/common 2.3.7 → 2.3.9

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,18 @@
1
+ import { a as a$2 } from './chunk-TWGGHTU5.js';
2
+ import { a } from './chunk-JQB6LCBL.js';
3
+ import { a as a$3 } from './chunk-2MVQI7NJ.js';
4
+ import { a as a$1 } from './chunk-E5MGOPPQ.js';
5
+ import { a as a$4 } from './chunk-X7L4MC53.js';
6
+ import { useState, useMemo } from 'react';
7
+ import z from '@mui/material/Button';
8
+ import D from '@mui/material/CircularProgress';
9
+ import v from '@mui/material/Grid';
10
+ import n from '@mui/material/Stack';
11
+ import p from '@mui/material/Typography';
12
+ import $ from '@mui/material/Card';
13
+ import { styled, alpha } from '@mui/material/styles';
14
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
15
+
16
+ var C=styled($,{shouldForwardProp:r=>r!=="active"})(({theme:r,active:s})=>({boxShadow:"none",cursor:"pointer",borderRadius:8,borderStyle:"solid",borderWidth:1.5,borderColor:s?r.palette.primary.main:r.palette.grey[300],color:r.palette.primary.main,backgroundColor:s?alpha(r.palette.primary.main,.04):"white","&:hover":{borderColor:r.palette.primary.main}}));var G=({title:r,action:s,loading:w,items:i,values:a$5,onChange:f})=>{let[c,k]=useState(),m=e=>a$5.includes(e),x=useMemo(()=>(c?i.filter(o=>o.title.toLowerCase().includes(c.toLowerCase())):i).sort((o,l)=>{let u=a$5.includes(o.value),O=a$5.includes(l.value);return u===O?0:u?-1:1}),[c,i]),I=e=>{let o=m(e.value),l;o?l=a$5.filter(u=>u!==e.value):l=[...a$5,e.value],f(l);},P=()=>{a$5.length===i.length?f([]):f(i.map(e=>e.value));},R=new Intl.PluralRules("pt-BR"),T=new Map([["one","selecionado"],["other","selecionados"]]),E=e=>{let o=R.select(e),l=T.get(o);return `${e} ${l}`};return jsxs(n,{gap:1.5,height:450,children:[jsxs(n,{direction:"row",justifyContent:"space-between",children:[typeof r=="string"?jsx(p,{variant:"overline",color:"text.disabled",children:r}):r,jsx(p,{variant:"overline",color:"text.disabled",children:a$5.length===0?"nenhum selecionado":E(a$5.length)})]}),jsxs(n,{direction:"row",alignItems:"center",spacing:1.5,children:[jsx(a,{fullWidth:!0,size:"small",iconPosition:"start",placeholder:"Buscar",trigger:"change",onSearch:e=>k(e),onKeyDown:e=>{e.key==="Enter"&&e.preventDefault();}}),s?jsx(Fragment,{children:s}):jsx(z,{onClick:P,size:"small",children:jsx(p,{variant:"overline",children:"TODOS"})})]}),jsx(a$1,{children:jsx(n,{flex:1,mb:2,children:jsx(a$2,{isLoading:w,loading:jsx(n,{alignItems:"center",mt:3,children:jsx(D,{})}),isEmpty:i.length===0,empty:jsx(a$3,{sx:{svg:{height:140}},text:c?`N\xE3o foi possivel encontrar o item "${c}"`:"Nenhum item dispon\xEDvel"}),children:jsx(v,{container:!0,spacing:1.5,children:x.map(e=>jsx(v,{item:!0,xs:4,children:jsx(C,{active:m(e.value),onClick:()=>I(e),children:jsxs(n,{padding:1.5,width:"100%",children:[jsxs(n,{direction:"row",alignItems:"center",justifyContent:"space-between",children:[jsx(p,{color:m(e.value)?"primary.main":"text.primary",variant:"subtitle2",textAlign:"left",noWrap:!0,children:e.title}),m(e.value)&&jsx(a$4,{icon:"CHECK_CIRCLE",width:24})]}),e.options.map(o=>jsx(p,{mt:1,variant:"body2",color:"text.disabled",fontSize:12,textAlign:"left",noWrap:!0,children:`${o.label}: ${o.value}`},o.label))]})})},e.title))})})})})]})},te=G;
17
+
18
+ export { te as a };
@@ -1,4 +1,4 @@
1
- export { a as default } from '../../chunk-QTPELB6U.js';
1
+ export { a as default } from '../../chunk-CFZGOATH.js';
2
2
  import '../../chunk-TWGGHTU5.js';
3
3
  import '../../chunk-JQB6LCBL.js';
4
4
  import '../../chunk-2MVQI7NJ.js';
@@ -1,4 +1,4 @@
1
- import { a } from '../../../chunk-QTPELB6U.js';
1
+ import { a } from '../../../chunk-CFZGOATH.js';
2
2
  import '../../../chunk-TWGGHTU5.js';
3
3
  import '../../../chunk-JQB6LCBL.js';
4
4
  import '../../../chunk-2MVQI7NJ.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zydon/common",
3
- "version": "2.3.7",
3
+ "version": "2.3.9",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",
@@ -1,18 +0,0 @@
1
- import { a as a$3 } from './chunk-TWGGHTU5.js';
2
- import { a as a$1 } from './chunk-JQB6LCBL.js';
3
- import { a as a$4 } from './chunk-2MVQI7NJ.js';
4
- import { a as a$2 } from './chunk-E5MGOPPQ.js';
5
- import { a as a$5 } from './chunk-X7L4MC53.js';
6
- import { useState } from 'react';
7
- import L from '@mui/material/Button';
8
- import N from '@mui/material/CircularProgress';
9
- import C from '@mui/material/Grid';
10
- import a from '@mui/material/Stack';
11
- import c from '@mui/material/Typography';
12
- import O from '@mui/material/Card';
13
- import { styled, alpha } from '@mui/material/styles';
14
- import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
15
-
16
- var b=styled(O,{shouldForwardProp:t=>t!=="active"})(({theme:t,active:n})=>({boxShadow:"none",cursor:"pointer",borderRadius:8,borderStyle:"solid",borderWidth:1.5,borderColor:n?t.palette.primary.main:t.palette.grey[300],color:t.palette.primary.main,backgroundColor:n?alpha(t.palette.primary.main,.04):"white","&:hover":{borderColor:t.palette.primary.main}}));var W=({title:t,action:n,loading:v,items:s,values:l,onChange:u})=>{let[m,w]=useState(),i=e=>l.includes(e),k=(m?s.filter(e=>e.title.toLowerCase().includes(m.toLowerCase())):s).sort((e,o)=>Number(i(o.value))-Number(i(e.value))),x=e=>{let o=i(e.value),p;o?p=l.filter(E=>E!==e.value):p=[...l,e.value],u(p);},I=()=>{l.length===s.length?u([]):u(s.map(e=>e.value));},P=new Intl.PluralRules("pt-BR"),R=new Map([["one","selecionado"],["other","selecionados"]]),T=e=>{let o=P.select(e),p=R.get(o);return `${e} ${p}`};return jsxs(a,{gap:1.5,height:450,children:[jsxs(a,{direction:"row",justifyContent:"space-between",children:[typeof t=="string"?jsx(c,{variant:"overline",color:"text.disabled",children:t}):t,jsx(c,{variant:"overline",color:"text.disabled",children:l.length===0?"nenhum selecionado":T(l.length)})]}),jsxs(a,{direction:"row",alignItems:"center",spacing:1.5,children:[jsx(a$1,{fullWidth:!0,size:"small",iconPosition:"start",placeholder:"Buscar",trigger:"change",onSearch:e=>w(e),onKeyDown:e=>{e.key==="Enter"&&e.preventDefault();}}),n?jsx(Fragment,{children:n}):jsx(L,{onClick:I,size:"small",children:jsx(c,{variant:"overline",children:"TODOS"})})]}),jsx(a$2,{children:jsx(a,{flex:1,mb:2,children:jsx(a$3,{isLoading:v,loading:jsx(a,{alignItems:"center",mt:3,children:jsx(N,{})}),isEmpty:s.length===0,empty:jsx(a$4,{sx:{svg:{height:140}},text:m?`N\xE3o foi possivel encontrar o item "${m}"`:"Nenhum item dispon\xEDvel"}),children:jsx(C,{container:!0,spacing:1.5,children:k.map(e=>jsx(C,{item:!0,xs:4,children:jsx(b,{active:i(e.value),onClick:()=>x(e),children:jsxs(a,{padding:1.5,width:"100%",children:[jsxs(a,{direction:"row",alignItems:"center",justifyContent:"space-between",children:[jsx(c,{color:i(e.value)?"primary.main":"text.primary",variant:"subtitle2",textAlign:"left",noWrap:!0,children:e.title}),i(e.value)&&jsx(a$5,{icon:"CHECK_CIRCLE",width:24})]}),e.options.map(o=>jsx(c,{mt:1,variant:"body2",color:"text.disabled",fontSize:12,textAlign:"left",noWrap:!0,children:`${o.label}: ${o.value}`},o.label))]})})},e.title))})})})})]})},Z=W;
17
-
18
- export { Z as a };