@arkyn/components 1.3.111 → 1.3.112

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/RichText/index.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAgB,UAAU,EAAE,MAAM,OAAO,CAAC;AAajD,OAAO,cAAc,CAAC;AAGtB,KAAK,aAAa,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,IAAI,CAAC;IACzC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC,CAAC;AAEF,iBAAS,QAAQ,CAAC,EAChB,IAAI,EACJ,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,OAAO,EAAE,WAAW,GACrB,EAAE,aAAa,2CAkFf;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/RichText/index.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAgB,UAAU,EAAE,MAAM,OAAO,CAAC;AAajD,OAAO,cAAc,CAAC;AAGtB,KAAK,aAAa,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,IAAI,CAAC;IACzC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC,CAAC;AAEF,iBAAS,QAAQ,CAAC,EAChB,IAAI,EACJ,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,OAAO,EAAE,WAAW,GACrB,EAAE,aAAa,2CAoFf;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
@@ -16,7 +16,7 @@ import { INITIAL_VALUE } from "./template/INITIAL_VALUE";
16
16
  import "./styles.css";
17
17
  import { useFormController } from "../Form/FormController";
18
18
  function RichText({ name, defaultValue, onValueChange, onChange, isError: baseIsError, }) {
19
- const [editorValue, setEditorValue] = useState([]);
19
+ const [editorValue, setEditorValue] = useState(defaultValue ? JSON.parse(defaultValue) : INITIAL_VALUE);
20
20
  const [onFocus, setOnFocus] = useState(false);
21
21
  const { id, inputRef, error } = useFormController();
22
22
  const baseRef = useRef(null);
@@ -34,7 +34,7 @@ function TabContainer(props) {
34
34
  if (!tabContainer)
35
35
  return;
36
36
  let activeButton = null;
37
- activeButton = tabContainer.querySelector("button.active");
37
+ activeButton = tabContainer.querySelector("button.activeTrue");
38
38
  if (activeButton)
39
39
  updateActiveLine(activeButton);
40
40
  }, []);
@@ -42,7 +42,7 @@ function TabContainer(props) {
42
42
  const target = event.target;
43
43
  if (target) {
44
44
  setValue(target.value);
45
- target.classList.add("active");
45
+ target.classList.add("activeTrue");
46
46
  updateActiveLine(target, true);
47
47
  onClick && onClick(target.value);
48
48
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkyn/components",
3
- "version": "1.3.111",
3
+ "version": "1.3.112",
4
4
  "main": "./dist/bundle.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "author": "Lucas Gonçalves",
@@ -44,7 +44,9 @@ function RichText({
44
44
  onChange,
45
45
  isError: baseIsError,
46
46
  }: RichTextProps) {
47
- const [editorValue, setEditorValue] = useState<Descendant[]>([]);
47
+ const [editorValue, setEditorValue] = useState<Descendant[]>(
48
+ defaultValue ? JSON.parse(defaultValue) : INITIAL_VALUE
49
+ );
48
50
  const [onFocus, setOnFocus] = useState(false);
49
51
 
50
52
  const { id, inputRef, error } = useFormController();
@@ -69,7 +69,7 @@ function TabContainer(props: TabContainerProps) {
69
69
 
70
70
  let activeButton: HTMLButtonElement | null = null;
71
71
 
72
- activeButton = tabContainer.querySelector("button.active");
72
+ activeButton = tabContainer.querySelector("button.activeTrue");
73
73
  if (activeButton) updateActiveLine(activeButton);
74
74
  }, []);
75
75
 
@@ -78,7 +78,7 @@ function TabContainer(props: TabContainerProps) {
78
78
 
79
79
  if (target) {
80
80
  setValue(target.value);
81
- target.classList.add("active");
81
+ target.classList.add("activeTrue");
82
82
 
83
83
  updateActiveLine(target, true);
84
84
  onClick && onClick(target.value);