@ssplib/react-components 0.0.239 → 0.0.240

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.
@@ -53,13 +53,10 @@ function DatePicker(_a) {
53
53
  const context = (0, react_1.useContext)(form_1.FormContext);
54
54
  const [value, setValue] = (0, react_1.useState)(defaultValue ? (0, dayjs_1.default)(defaultValue, 'DD/MM/YYYY') : null);
55
55
  const handleChange = (newValue) => {
56
- console.log('mudou');
57
56
  setValue(newValue);
58
57
  };
59
58
  (0, react_1.useEffect)(() => {
60
- if (!value)
61
- return;
62
- context.formSetValue(name, value.format('DD/MM/YYYY'));
59
+ context.formSetValue(name, value ? value.format('DD/MM/YYYY') : value);
63
60
  }, [value]);
64
61
  (0, react_1.useEffect)(() => {
65
62
  return () => {
@@ -41,13 +41,10 @@ function TimePicker({ name, required = false, title, defaultValue = '', xs = 12,
41
41
  const [value, setValue] = (0, react_1.useState)(defaultValue ? (0, dayjs_1.default)(defaultValue, 'HH:mm') : null);
42
42
  const handleChange = (newValue) => {
43
43
  setValue(newValue);
44
- context === null || context === void 0 ? void 0 : context.formSetValue(name, newValue === null || newValue === void 0 ? void 0 : newValue.format('HH:mm'));
45
44
  };
46
45
  (0, react_1.useEffect)(() => {
47
- if (!value)
48
- return;
49
- context.formSetValue(name, value.format('HH:mm'));
50
- }, []);
46
+ context.formSetValue(name, value ? value.format('HH:mm') : value);
47
+ }, [value]);
51
48
  (0, react_1.useEffect)(() => {
52
49
  return () => {
53
50
  context.formUnregister(name);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ssplib/react-components",
3
- "version": "0.0.239",
3
+ "version": "0.0.240",
4
4
  "description": "SSP React Components",
5
5
  "main": "index.js",
6
6
  "author": "Pedro Henrique <sr.hudrick@gmail.com>",