letalkui 0.0.4 → 0.0.5

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "letalkui",
3
3
  "private": false,
4
- "version": "0.0.4",
4
+ "version": "0.0.5",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "lint": "eslint .",
@@ -36,8 +36,17 @@ export const JsonEditor: React.FC<JsonEditorProps> = (props) => {
36
36
  const [jsonData, setJsonData] = useState<string>(stringifyValue)
37
37
  const [loadingSaveJson, setLoadingSaveJson] = useState<boolean>(false)
38
38
 
39
- const currentError: boolean = validation[INPUT_NAME] ?? error
40
- const currentHelperText: string = validation[INPUT_NAME] ?? helperText
39
+ const currentError: boolean = Boolean(validation[INPUT_NAME]) ?? error
40
+
41
+ const currentHelperText = (): string => {
42
+ if (INPUT_NAME in validation) {
43
+ if (helperText) return helperText
44
+
45
+ return "Ocorreu um erro inesperado. Por favor, tente novamente mais tarde."
46
+ }
47
+
48
+ return "Ocorreu um erro inesperado. Por favor, tente novamente mais tarde."
49
+ }
41
50
 
42
51
  const handleChange = (newValue: string) => {
43
52
  clearValidation(INPUT_NAME)
@@ -70,7 +79,7 @@ export const JsonEditor: React.FC<JsonEditorProps> = (props) => {
70
79
  value={value}
71
80
  onChange={handleChange}
72
81
  currentError={currentError}
73
- currentHelperText={currentHelperText}
82
+ currentHelperText={currentHelperText()}
74
83
  />
75
84
 
76
85
  <JsonForm.ActionsButtons>
package/src/index.ts CHANGED
@@ -1 +1,3 @@
1
1
  export * from "@/components/Button"
2
+ export * from "@/components/JsonEditor"
3
+ export * from "@/components/JsonView"