letalkui 0.0.12 → 0.0.13

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/index.js CHANGED
@@ -1,2 +1 @@
1
- import{jsx as k}from"react/jsx-runtime";var O=o=>{let{backgroundColor:t,label:r,size:n,primary:i}=o,e=i?"storybook-button--primary":"storybook-button--secondary";return k("button",{type:"button",className:["storybook-button",`storybook-button--${n}`,e].join(""),style:{backgroundColor:t},...o,children:r})};import{useState as C}from"react";import{Grid2 as G}from"@mui/material";import{jsx as I}from"react/jsx-runtime";var v=o=>I(G,{container:!0,direction:"column",spacing:2,children:o.children});import{Button as H,CircularProgress as z}from"@mui/material";import{jsx as g}from"react/jsx-runtime";var y=o=>{let{onSave:t,loading:r}=o;return g(H,{onClick:()=>{t()},color:"primary",variant:"contained",disableElevation:!0,disabled:r,endIcon:r&&g(z,{size:20,color:"inherit"}),children:"Salvar"})};import{Grid2 as J}from"@mui/material";import{jsx as b}from"react/jsx-runtime";var P=o=>b(J,{container:!0,justify:"flex-end",children:b(J,{item:!0,children:o.children})});import D from"react-ace";import{FormControl as L,FormHelperText as M,Grid2 as U}from"@mui/material";import{jsx as p,jsxs as $}from"react/jsx-runtime";var _="json-editor",V=o=>{let{value:t,onChange:r,currentError:n,currentHelperText:i,...e}=o,s=JSON.stringify(t,null,2);return $(U,{children:[p(L,{error:n,fullWidth:!0,children:p(D,{...e,name:_,value:s,wrapEnabled:!0,mode:"json",theme:"textmate",onChange:r,fontSize:16,showPrintMargin:!0,showGutter:!0,highlightActiveLine:!0,editorProps:{$blockScrolling:!0},setOptions:{showLineNumbers:!0,tabSize:2}})}),i&&p(M,{error:n,children:i})]})};var a={Root:v,ActionButton:y,ActionsButtons:P,Content:V};import{useState as W}from"react";var q=()=>{let[o,t]=W({});return{addValidation:e=>{t(s=>({...s,...e}))},clearValidation:e=>{e in o&&t(s=>{let c={...s};return delete c[e],c})},clearAllValidations:()=>{t({})},validation:o}},h=q;import{jsx as d,jsxs as Q}from"react/jsx-runtime";var u="json-editor",K=o=>{let{value:t,onChange:r,onSave:n,helperText:i,error:e,...s}=o,{addValidation:c,clearValidation:A,validation:m}=h(),x=JSON.stringify(t,null,2),[w,E]=C(x),[S,f]=C(!1),T=()=>u in m&&e||!1,B=()=>u in m&&i||"Ocorreu um erro inesperado. Por favor, tente novamente mais tarde.",F=l=>{A(u),E(l),r?.(l)},N=async()=>{if(f(!0),n)try{let l=JSON.parse(w);await n(l)}catch(l){c({[u]:l})}f(!1)};return Q(a.Root,{children:[d(a.Content,{...s,value:t,onChange:F,currentError:T(),currentHelperText:B()}),d(a.ActionsButtons,{children:d(a.ActionButton,{onSave:N,loading:S})})]})};import{jsx as R}from"react/jsx-runtime";var X=o=>{let{value:t,...r}=o;return R(a.Root,{children:R(a.Content,{...r,value:t})})};export{O as Button,K as JsonEditor,X as JsonView};
2
- //# sourceMappingURL=index.js.map
1
+ "use strict";var W=Object.create;var m=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var Q=Object.getPrototypeOf,X=Object.prototype.hasOwnProperty;var Y=(o,t)=>{for(var r in t)m(o,r,{get:t[r],enumerable:!0})},C=(o,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of K(t))!X.call(o,e)&&e!==r&&m(o,e,{get:()=>t[e],enumerable:!(n=q(t,e))||n.enumerable});return o};var Z=(o,t,r)=>(r=o!=null?W(Q(o)):{},C(t||!o||!o.__esModule?m(r,"default",{value:o,enumerable:!0}):r,o)),j=o=>C(m({},"__esModule",{value:!0}),o);var ro={};Y(ro,{Button:()=>R,JsonEditor:()=>k,JsonView:()=>G});module.exports=j(ro);var A=require("react/jsx-runtime"),R=o=>{let{backgroundColor:t,label:r,size:n,primary:e}=o,i=e?"storybook-button--primary":"storybook-button--secondary";return(0,A.jsx)("button",{type:"button",className:["storybook-button",`storybook-button--${n}`,i].join(""),style:{backgroundColor:t},...o,children:r})};var b=require("react");var x=require("@mui/material"),E=require("react/jsx-runtime"),w=o=>(0,E.jsx)(x.Grid2,{container:!0,direction:"column",spacing:2,children:o.children});var f=require("@mui/material"),g=require("react/jsx-runtime"),S=o=>{let{onSave:t,loading:r}=o;return(0,g.jsx)(f.Button,{onClick:()=>{t()},color:"primary",variant:"contained",disableElevation:!0,disabled:r,endIcon:r&&(0,g.jsx)(f.CircularProgress,{size:20,color:"inherit"}),children:"Salvar"})};var y=require("@mui/material"),J=require("react/jsx-runtime"),T=o=>(0,J.jsx)(y.Grid2,{container:!0,justify:"flex-end",children:(0,J.jsx)(y.Grid2,{item:!0,children:o.children})});var B=Z(require("react-ace")),u=require("@mui/material"),c=require("react/jsx-runtime"),oo="json-editor",F=o=>{let{value:t,onChange:r,currentError:n,currentHelperText:e,...i}=o,s=JSON.stringify(t,null,2);return(0,c.jsxs)(u.Grid2,{children:[(0,c.jsx)(u.FormControl,{error:n,fullWidth:!0,children:(0,c.jsx)(B.default,{...i,name:oo,value:s,wrapEnabled:!0,mode:"json",theme:"textmate",onChange:r,fontSize:16,showPrintMargin:!0,showGutter:!0,highlightActiveLine:!0,editorProps:{$blockScrolling:!0},setOptions:{showLineNumbers:!0,tabSize:2}})}),e&&(0,c.jsx)(u.FormHelperText,{error:n,children:e})]})};var a={Root:w,ActionButton:S,ActionsButtons:T,Content:F};var N=require("react"),to=()=>{let[o,t]=(0,N.useState)({});return{addValidation:i=>{t(s=>({...s,...i}))},clearValidation:i=>{i in o&&t(s=>{let d={...s};return delete d[i],d})},clearAllValidations:()=>{t({})},validation:o}},O=to;var p=require("react/jsx-runtime"),v="json-editor",k=o=>{let{value:t,onChange:r,onSave:n,helperText:e,error:i,...s}=o,{addValidation:d,clearValidation:I,validation:V}=O(),H=JSON.stringify(t,null,2),[z,D]=(0,b.useState)(H),[L,h]=(0,b.useState)(!1),M=()=>v in V&&i||!1,U=()=>v in V&&e||"Ocorreu um erro inesperado. Por favor, tente novamente mais tarde.",_=l=>{I(v),D(l),r?.(l)},$=async()=>{if(h(!0),n)try{let l=JSON.parse(z);await n(l)}catch(l){d({[v]:l})}h(!1)};return(0,p.jsxs)(a.Root,{children:[(0,p.jsx)(a.Content,{...s,value:t,onChange:_,currentError:M(),currentHelperText:U()}),(0,p.jsx)(a.ActionsButtons,{children:(0,p.jsx)(a.ActionButton,{onSave:$,loading:L})})]})};var P=require("react/jsx-runtime"),G=o=>{let{value:t,...r}=o;return(0,P.jsx)(a.Root,{children:(0,P.jsx)(a.Content,{...r,value:t})})};0&&(module.exports={Button,JsonEditor,JsonView});
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "letalkui",
3
3
  "private": false,
4
- "version": "0.0.12",
5
- "type": "module",
4
+ "version": "0.0.13",
6
5
  "files": [
7
6
  "dist"
8
7
  ],
package/dist/index.cjs DELETED
@@ -1,2 +0,0 @@
1
- "use strict";var W=Object.create;var m=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var Q=Object.getPrototypeOf,X=Object.prototype.hasOwnProperty;var Y=(o,t)=>{for(var r in t)m(o,r,{get:t[r],enumerable:!0})},C=(o,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of K(t))!X.call(o,e)&&e!==r&&m(o,e,{get:()=>t[e],enumerable:!(n=q(t,e))||n.enumerable});return o};var Z=(o,t,r)=>(r=o!=null?W(Q(o)):{},C(t||!o||!o.__esModule?m(r,"default",{value:o,enumerable:!0}):r,o)),j=o=>C(m({},"__esModule",{value:!0}),o);var ro={};Y(ro,{Button:()=>R,JsonEditor:()=>k,JsonView:()=>G});module.exports=j(ro);var A=require("react/jsx-runtime"),R=o=>{let{backgroundColor:t,label:r,size:n,primary:e}=o,i=e?"storybook-button--primary":"storybook-button--secondary";return(0,A.jsx)("button",{type:"button",className:["storybook-button",`storybook-button--${n}`,i].join(""),style:{backgroundColor:t},...o,children:r})};var b=require("react");var x=require("@mui/material"),E=require("react/jsx-runtime"),w=o=>(0,E.jsx)(x.Grid2,{container:!0,direction:"column",spacing:2,children:o.children});var f=require("@mui/material"),g=require("react/jsx-runtime"),S=o=>{let{onSave:t,loading:r}=o;return(0,g.jsx)(f.Button,{onClick:()=>{t()},color:"primary",variant:"contained",disableElevation:!0,disabled:r,endIcon:r&&(0,g.jsx)(f.CircularProgress,{size:20,color:"inherit"}),children:"Salvar"})};var y=require("@mui/material"),J=require("react/jsx-runtime"),T=o=>(0,J.jsx)(y.Grid2,{container:!0,justify:"flex-end",children:(0,J.jsx)(y.Grid2,{item:!0,children:o.children})});var B=Z(require("react-ace"),1),u=require("@mui/material"),c=require("react/jsx-runtime"),oo="json-editor",F=o=>{let{value:t,onChange:r,currentError:n,currentHelperText:e,...i}=o,s=JSON.stringify(t,null,2);return(0,c.jsxs)(u.Grid2,{children:[(0,c.jsx)(u.FormControl,{error:n,fullWidth:!0,children:(0,c.jsx)(B.default,{...i,name:oo,value:s,wrapEnabled:!0,mode:"json",theme:"textmate",onChange:r,fontSize:16,showPrintMargin:!0,showGutter:!0,highlightActiveLine:!0,editorProps:{$blockScrolling:!0},setOptions:{showLineNumbers:!0,tabSize:2}})}),e&&(0,c.jsx)(u.FormHelperText,{error:n,children:e})]})};var a={Root:w,ActionButton:S,ActionsButtons:T,Content:F};var N=require("react"),to=()=>{let[o,t]=(0,N.useState)({});return{addValidation:i=>{t(s=>({...s,...i}))},clearValidation:i=>{i in o&&t(s=>{let d={...s};return delete d[i],d})},clearAllValidations:()=>{t({})},validation:o}},O=to;var p=require("react/jsx-runtime"),v="json-editor",k=o=>{let{value:t,onChange:r,onSave:n,helperText:e,error:i,...s}=o,{addValidation:d,clearValidation:I,validation:V}=O(),H=JSON.stringify(t,null,2),[z,D]=(0,b.useState)(H),[L,h]=(0,b.useState)(!1),M=()=>v in V&&i||!1,U=()=>v in V&&e||"Ocorreu um erro inesperado. Por favor, tente novamente mais tarde.",_=l=>{I(v),D(l),r?.(l)},$=async()=>{if(h(!0),n)try{let l=JSON.parse(z);await n(l)}catch(l){d({[v]:l})}h(!1)};return(0,p.jsxs)(a.Root,{children:[(0,p.jsx)(a.Content,{...s,value:t,onChange:_,currentError:M(),currentHelperText:U()}),(0,p.jsx)(a.ActionsButtons,{children:(0,p.jsx)(a.ActionButton,{onSave:$,loading:L})})]})};var P=require("react/jsx-runtime"),G=o=>{let{value:t,...r}=o;return(0,P.jsx)(a.Root,{children:(0,P.jsx)(a.Content,{...r,value:t})})};0&&(module.exports={Button,JsonEditor,JsonView});
2
- //# sourceMappingURL=index.cjs.map
package/dist/index.d.cts DELETED
@@ -1,31 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import React from 'react';
3
- import { IAceEditorProps } from 'react-ace';
4
-
5
- interface ButtonProps {
6
- primary?: boolean;
7
- backgroundColor?: string;
8
- size?: "small" | "medium" | "large";
9
- label: string;
10
- onClick?: () => void;
11
- }
12
- declare const Button: (props: ButtonProps) => react_jsx_runtime.JSX.Element;
13
-
14
- type JsonValue = Record<string | number, unknown>;
15
- type Overwrite<T, NewT> = Omit<T, keyof NewT> & NewT;
16
-
17
- type JsonEditorProps = Overwrite<IAceEditorProps, {
18
- value?: JsonValue | null;
19
- onChange?: (value: string) => void;
20
- onSave?: (value: JsonValue) => Promise<JsonValue>;
21
- helperText?: string;
22
- error?: boolean;
23
- }>;
24
- declare const JsonEditor: React.FC<JsonEditorProps>;
25
-
26
- type JsonViewProps = Overwrite<IAceEditorProps, {
27
- value?: JsonValue | null;
28
- }>;
29
- declare const JsonView: React.FC<JsonViewProps>;
30
-
31
- export { Button, JsonEditor, JsonView };