@zydon/common-csr 2.0.12 → 2.0.14

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/README.md CHANGED
Binary file
@@ -0,0 +1,13 @@
1
+ import { useState, useEffect } from 'react';
2
+ import { useFormContext } from 'react-hook-form';
3
+ import v from '@mui/material/Stack';
4
+ import u from '@mui/material/Typography';
5
+ import h from '@zydon/common/form/Field';
6
+ import { styled } from '@mui/material/styles';
7
+ import s from '@mui/material/ToggleButton';
8
+ import c from '@mui/material/ToggleButtonGroup';
9
+ import { jsxs, jsx } from 'react/jsx-runtime';
10
+
11
+ var g=styled(s)(({theme:o})=>({width:"100%","&.Mui-selected":{backgroundColor:o.palette.primary.main,color:o.palette.common.white,"&:hover":{backgroundColor:o.palette.primary.main}}})),m=styled(c)(()=>({display:"flex",justifyContent:"space-between"}));var S=({rules:o,setRuleType:a})=>{let[n,i]=useState(),{setValue:d}=useFormContext();return useEffect(()=>{if(o&&o.length>0&&(i(o[0].value),a))return a(o[0].value)},[]),useEffect(()=>()=>{d("config",{});},[]),jsxs(v,{gap:2,children:[jsx(h,{name:"name",label:"Nome da regra",required:!0,rules:{required:{value:!0,message:"Nome da regra \xE9 obrigat\xF3rio"}}}),jsx(u,{color:"grey.500",variant:"overline",children:"Selecione a regra"}),o&&jsx(m,{color:"primary",value:n,size:"small",exclusive:!0,onChange:(t,e)=>{if(e!==null&&(i(e),a))return a(e)},children:o.map((t,e)=>jsx(g,{value:t.value,size:"small",color:"primary",children:jsx(u,{variant:"body2",children:t.toggleTitle})},e))}),o&&o.map((t,e)=>t.value===n?jsx("div",{children:t.component},e):null)]})},N=S;
12
+
13
+ export { N as a };
@@ -1,14 +1,2 @@
1
+ export { a as default } from '../../../chunk-CGG4TIH7.mjs';
1
2
  import '../../../chunk-6KMKD42J.mjs';
2
- import { useState, useEffect } from 'react';
3
- import { useFormContext } from 'react-hook-form';
4
- import v from '@mui/material/Stack';
5
- import u from '@mui/material/Typography';
6
- import h from '@zydon/common/form/Field';
7
- import { styled } from '@mui/material/styles';
8
- import s from '@mui/material/ToggleButton';
9
- import c from '@mui/material/ToggleButtonGroup';
10
- import { jsxs, jsx } from 'react/jsx-runtime';
11
-
12
- var g=styled(s)(({theme:o})=>({width:"100%","&.Mui-selected":{backgroundColor:o.palette.primary.main,color:o.palette.common.white,"&:hover":{backgroundColor:o.palette.primary.main}}})),m=styled(c)(()=>({display:"flex",justifyContent:"space-between"}));var S=({rules:o,setRuleType:a})=>{let[n,i]=useState(),{setValue:d}=useFormContext();return useEffect(()=>{if(o&&o.length>0&&(i(o[0].value),a))return a(o[0].value)},[]),useEffect(()=>()=>{d("config",{});},[]),jsxs(v,{gap:2,children:[jsx(h,{name:"name",label:"Nome da regra",required:!0,rules:{required:{value:!0,message:"Nome da regra \xE9 obrigat\xF3rio"}}}),jsx(u,{color:"grey.500",variant:"overline",children:"Selecione a regra"}),o&&jsx(m,{color:"primary",value:n,size:"small",exclusive:!0,onChange:(t,e)=>{if(e!==null&&(i(e),a))return a(e)},children:o.map((t,e)=>jsx(g,{value:t.value,size:"small",color:"primary",children:jsx(u,{variant:"body2",children:t.toggleTitle})},e))}),o&&o.map((t,e)=>t.value===n?jsx("div",{children:t.component},e):null)]})},N=S;
13
-
14
- export { N as default };
@@ -0,0 +1,20 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+
4
+ interface ListingRulesModalProps {
5
+ rules: {
6
+ value: string;
7
+ component: ReactNode;
8
+ toggleTitle: string;
9
+ }[];
10
+ open: boolean;
11
+ close: VoidFunction;
12
+ formId: string;
13
+ loading: boolean;
14
+ disable: boolean;
15
+ confirm: VoidFunction;
16
+ }
17
+
18
+ declare const ListingRulesModal: ({ rules, open, close, formId, loading, disable, confirm, }: ListingRulesModalProps) => react_jsx_runtime.JSX.Element;
19
+
20
+ export { ListingRulesModal as default };
@@ -0,0 +1,10 @@
1
+ import { a } from '../../../chunk-CGG4TIH7.mjs';
2
+ import '../../../chunk-6KMKD42J.mjs';
3
+ import m from '@mui/material/Button';
4
+ import u from '@zydon/common/components/ActionButton';
5
+ import p from '@zydon/common/components/Modal';
6
+ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
7
+
8
+ var c=({rules:l,open:n,close:i,formId:a$1,loading:e,disable:d,confirm:s})=>jsx(Fragment,{children:jsx(p,{fullWidth:!0,maxWidth:"lg",open:n,onClose:()=>{i();},dialogTitle:"Nova regra de listagem",actions:jsxs(Fragment,{children:[jsx(m,{variant:"outlined",color:"inherit",onClick:()=>{i();},children:"Fechar"}),jsx(u,{form:a$1,loading:e,actionType:"CREATE",color:"primary",variant:"contained",disabled:d,onClick:s,children:"Salvar"})]}),children:jsx(a,{rules:l})})}),v=c;
9
+
10
+ export { v as default };
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.0.12",
2
+ "version": "2.0.14",
3
3
  "name": "@zydon/common-csr",
4
4
  "description": "Zydon common resources for React projects (only Client-Side Rendering (CSR))",
5
5
  "license": "MIT",
@@ -7,7 +7,7 @@
7
7
  "bugs": {
8
8
  "url": "https://github.com/zydontecnologia/commons-csr"
9
9
  },
10
- "homepage": "https://github.com/zydontecnologia/commons-csr?tab=readme-ov-file#common-csr-v2",
10
+ "homepage": "https://github.com/zydontecnologia/commons-csr",
11
11
  "publishConfig": {
12
12
  "access": "public"
13
13
  },