letalkui 0.0.7 → 0.0.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.
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +31 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +1 -0
- package/package.json +57 -54
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var U=Object.create;var m=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var W=Object.getPrototypeOf,q=Object.prototype.hasOwnProperty;var K=(o,t)=>{for(var r in t)m(o,r,{get:t[r],enumerable:!0})},V=(o,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of $(t))!q.call(o,e)&&e!==r&&m(o,e,{get:()=>t[e],enumerable:!(n=_(t,e))||n.enumerable});return o};var Q=(o,t,r)=>(r=o!=null?U(W(o)):{},V(t||!o||!o.__esModule?m(r,"default",{value:o,enumerable:!0}):r,o)),X=o=>V(m({},"__esModule",{value:!0}),o);var ro={};K(ro,{Button:()=>Y,JsonEditor:()=>oo,JsonView:()=>to});module.exports=X(ro);var C=require("react/jsx-runtime"),Y=o=>{let{backgroundColor:t,label:r,size:n,primary:e}=o,i=e?"storybook-button--primary":"storybook-button--secondary";return(0,C.jsx)("button",{type:"button",className:["storybook-button",`storybook-button--${n}`,i].join(""),style:{backgroundColor:t},...o,children:r})};var J=require("react");var A=require("@mui/material"),S=require("react/jsx-runtime"),x=o=>(0,S.jsx)(A.Grid2,{container:!0,direction:"column",spacing:2,children:o.children});var f=require("@mui/material"),g=require("react/jsx-runtime"),T=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"),b=require("react/jsx-runtime"),w=o=>(0,b.jsx)(y.Grid2,{container:!0,justify:"flex-end",children:(0,b.jsx)(y.Grid2,{item:!0,children:o.children})});var E=Q(require("react-ace"),1),p=require("@mui/material"),c=require("react/jsx-runtime"),Z="json-editor",B=o=>{let{value:t,onChange:r,currentError:n,currentHelperText:e,...i}=o,s=JSON.stringify(t,null,2);return(0,c.jsxs)(p.Grid2,{children:[(0,c.jsx)(p.FormControl,{error:n,fullWidth:!0,children:(0,c.jsx)(E.default,{...i,name:Z,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)(p.FormHelperText,{error:n,children:e})]})};var a={Root:x,ActionButton:T,ActionsButtons:w,Content:B};var F=require("react"),j=()=>{let[o,t]=(0,F.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}},N=j;var u=require("react/jsx-runtime"),v="json-editor",oo=o=>{let{value:t,onChange:r,onSave:n,helperText:e,error:i,...s}=o,{addValidation:d,clearValidation:O,validation:h}=N(),k=JSON.stringify(t,null,2),[G,I]=(0,J.useState)(k),[H,R]=(0,J.useState)(!1),z=()=>v in h&&i||!1,D=()=>v in h&&e||"Ocorreu um erro inesperado. Por favor, tente novamente mais tarde.",L=l=>{O(v),I(l),r?.(l)},M=async()=>{if(R(!0),n)try{let l=JSON.parse(G);await n(l)}catch(l){d({[v]:l})}R(!1)};return(0,u.jsxs)(a.Root,{children:[(0,u.jsx)(a.Content,{...s,value:t,onChange:L,currentError:z(),currentHelperText:D()}),(0,u.jsx)(a.ActionsButtons,{children:(0,u.jsx)(a.ActionButton,{onSave:M,loading:H})})]})};var P=require("react/jsx-runtime"),to=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/dist/index.d.cts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
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, type ButtonProps, JsonEditor, JsonView };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
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, type ButtonProps, JsonEditor, JsonView };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as O}from"react/jsx-runtime";var K=o=>{let{backgroundColor:t,label:r,size:n,primary:i}=o,e=i?"storybook-button--primary":"storybook-button--secondary";return O("button",{type:"button",className:["storybook-button",`storybook-button--${n}`,e].join(""),style:{backgroundColor:t},...o,children:r})};import{useState as V}from"react";import{Grid2 as k}from"@mui/material";import{jsx as G}from"react/jsx-runtime";var v=o=>G(k,{container:!0,direction:"column",spacing:2,children:o.children});import{Button as I,CircularProgress as H}from"@mui/material";import{jsx as g}from"react/jsx-runtime";var y=o=>{let{onSave:t,loading:r}=o;return g(I,{onClick:()=>{t()},color:"primary",variant:"contained",disableElevation:!0,disabled:r,endIcon:r&&g(H,{size:20,color:"inherit"}),children:"Salvar"})};import{Grid2 as b}from"@mui/material";import{jsx as J}from"react/jsx-runtime";var P=o=>J(b,{container:!0,justify:"flex-end",children:J(b,{item:!0,children:o.children})});import z from"react-ace";import{FormControl as D,FormHelperText as L,Grid2 as M}from"@mui/material";import{jsx as u,jsxs as _}from"react/jsx-runtime";var U="json-editor",h=o=>{let{value:t,onChange:r,currentError:n,currentHelperText:i,...e}=o,s=JSON.stringify(t,null,2);return _(M,{children:[u(D,{error:n,fullWidth:!0,children:u(z,{...e,name:U,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&&u(L,{error:n,children:i})]})};var a={Root:v,ActionButton:y,ActionsButtons:P,Content:h};import{useState as $}from"react";var W=()=>{let[o,t]=$({});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}},R=W;import{jsx as d,jsxs as q}from"react/jsx-runtime";var p="json-editor",Vo=o=>{let{value:t,onChange:r,onSave:n,helperText:i,error:e,...s}=o,{addValidation:c,clearValidation:A,validation:m}=R(),x=JSON.stringify(t,null,2),[S,T]=V(x),[w,f]=V(!1),E=()=>p in m&&e||!1,B=()=>p in m&&i||"Ocorreu um erro inesperado. Por favor, tente novamente mais tarde.",F=l=>{A(p),T(l),r?.(l)},N=async()=>{if(f(!0),n)try{let l=JSON.parse(S);await n(l)}catch(l){c({[p]:l})}f(!1)};return q(a.Root,{children:[d(a.Content,{...s,value:t,onChange:F,currentError:E(),currentHelperText:B()}),d(a.ActionsButtons,{children:d(a.ActionButton,{onSave:N,loading:w})})]})};import{jsx as C}from"react/jsx-runtime";var So=o=>{let{value:t,...r}=o;return C(a.Root,{children:C(a.Content,{...r,value:t})})};export{K as Button,Vo as JsonEditor,So as JsonView};
|
package/package.json
CHANGED
|
@@ -1,60 +1,63 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
"name": "letalkui",
|
|
3
|
+
"private": false,
|
|
4
|
+
"version": "0.0.9",
|
|
5
|
+
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
8
8
|
],
|
|
9
|
+
"main": "dist/index.js",
|
|
10
|
+
"module": "dist/index.cjs",
|
|
11
|
+
"types": "dist/index.d.ts",
|
|
9
12
|
"scripts": {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
13
|
+
"lint": "eslint .",
|
|
14
|
+
"dev": "storybook dev -p 6006",
|
|
15
|
+
"build": "tsup",
|
|
16
|
+
"build:storybook": "storybook build"
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@emotion/react": "^11.14.0",
|
|
20
|
+
"@emotion/styled": "^11.14.0",
|
|
21
|
+
"@mui/material": "^6.4.3",
|
|
22
|
+
"react": "^18.3.1",
|
|
23
|
+
"react-ace": "^10.1.0",
|
|
24
|
+
"react-dom": "^18.3.1"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@eslint/compat": "^1.2.5",
|
|
28
|
+
"@eslint/eslintrc": "^3.2.0",
|
|
29
|
+
"@eslint/js": "^9.17.0",
|
|
30
|
+
"@storybook/addon-essentials": "^8.4.7",
|
|
31
|
+
"@storybook/blocks": "^8.4.7",
|
|
32
|
+
"@storybook/react": "^8.4.7",
|
|
33
|
+
"@storybook/react-vite": "^8.4.7",
|
|
34
|
+
"@storybook/test": "^8.4.7",
|
|
35
|
+
"@types/node": "18.19",
|
|
36
|
+
"@types/react": "^18.3.18",
|
|
37
|
+
"@types/react-dom": "^18.3.5",
|
|
38
|
+
"@typescript-eslint/eslint-plugin": "^8.20.0",
|
|
39
|
+
"@typescript-eslint/parser": "^8.20.0",
|
|
40
|
+
"@vitejs/plugin-react-swc": "^3.5.0",
|
|
41
|
+
"eslint": "^9.17.0",
|
|
42
|
+
"eslint-plugin-import": "^2.31.0",
|
|
43
|
+
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
44
|
+
"eslint-plugin-react": "^7.37.4",
|
|
45
|
+
"eslint-plugin-react-hooks": "^5.0.0",
|
|
46
|
+
"eslint-plugin-react-refresh": "^0.4.16",
|
|
47
|
+
"eslint-plugin-storybook": "^0.11.2",
|
|
48
|
+
"globals": "^15.14.0",
|
|
49
|
+
"storybook": "^8.4.7",
|
|
50
|
+
"tsup": "^8.3.5",
|
|
51
|
+
"typescript": "~5.6.2",
|
|
52
|
+
"typescript-eslint": "^8.18.2",
|
|
53
|
+
"vite": "^6.0.5"
|
|
54
|
+
},
|
|
55
|
+
"eslintConfig": {
|
|
56
|
+
"extends": [
|
|
57
|
+
"plugin:storybook/recommended"
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
"engines": {
|
|
61
|
+
"node": "18.20.3"
|
|
62
|
+
}
|
|
60
63
|
}
|