@ssplib/react-components 0.0.258 → 0.0.259

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.
@@ -49,13 +49,15 @@ const react_1 = __importStar(require("react"));
49
49
  const form_1 = require("../../../context/form");
50
50
  function DatePicker(_a) {
51
51
  var _b;
52
- var { name, required = false, title, xs = 12, sm, md, minDt, defaultValue = '', maxDt } = _a, props = __rest(_a, ["name", "required", "title", "xs", "sm", "md", "minDt", "defaultValue", "maxDt"]);
52
+ var { name, required = false, title, xs = 12, sm, md, minDt, defaultValue, maxDt } = _a, props = __rest(_a, ["name", "required", "title", "xs", "sm", "md", "minDt", "defaultValue", "maxDt"]);
53
53
  const context = (0, react_1.useContext)(form_1.FormContext);
54
- const [value, setValue] = (0, react_1.useState)(defaultValue ? (0, dayjs_1.default)(defaultValue, 'DD/MM/YYYY') : null);
54
+ const [value, setValue] = (0, react_1.useState)(defaultValue !== undefined ? (0, dayjs_1.default)(defaultValue, 'DD/MM/YYYY') : undefined);
55
55
  const handleChange = (newValue) => {
56
56
  setValue(newValue);
57
57
  };
58
58
  (0, react_1.useEffect)(() => {
59
+ if (value === undefined)
60
+ return;
59
61
  context.formSetValue(name, value ? value.format('DD/MM/YYYY') : value);
60
62
  }, [value]);
61
63
  (0, react_1.useEffect)(() => {
@@ -47,7 +47,7 @@ function Input(_a) {
47
47
  var { type = 'input', numberMask = '000000000000000', xs = 12, sm, inputMinLength = 1, inputMaxLength = 255, defaultValue = '', md, disabled = false, watchValue } = _a, props = __rest(_a, ["type", "numberMask", "xs", "sm", "inputMinLength", "inputMaxLength", "defaultValue", "md", "disabled", "watchValue"]);
48
48
  const context = (0, react_1.useContext)(form_1.FormContext);
49
49
  (0, react_1.useEffect)(() => {
50
- if (!watchValue === undefined)
50
+ if (watchValue !== undefined)
51
51
  context.formSetValue(props.name, watchValue);
52
52
  }, [watchValue]);
53
53
  const chooseInput = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ssplib/react-components",
3
- "version": "0.0.258",
3
+ "version": "0.0.259",
4
4
  "description": "SSP React Components",
5
5
  "main": "index.js",
6
6
  "author": "Pedro Henrique <sr.hudrick@gmail.com>",