@ssplib/react-components 0.0.257 → 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)(() => {
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- export declare function Input({ type, numberMask, xs, sm, inputMinLength, inputMaxLength, defaultValue, md, watchValue, disabled, ...props }: {
2
+ export declare function Input({ type, numberMask, xs, sm, inputMinLength, inputMaxLength, defaultValue, md, disabled, watchValue, ...props }: {
3
3
  type: 'cnpj' | 'cpf' | 'input' | 'email' | 'cpf_cnpj' | 'phone' | 'input' | 'number' | 'rg' | 'password' | 'cep' | 'sei';
4
4
  name: string;
5
5
  watchValue?: string;
@@ -44,10 +44,11 @@ const react_1 = __importStar(require("react"));
44
44
  const MaskInput_1 = __importDefault(require("./MaskInput"));
45
45
  const form_1 = require("../../../context/form");
46
46
  function Input(_a) {
47
- var { type = 'input', numberMask = '000000000000000', xs = 12, sm, inputMinLength = 1, inputMaxLength = 255, defaultValue = '', md, watchValue = '', disabled = false } = _a, props = __rest(_a, ["type", "numberMask", "xs", "sm", "inputMinLength", "inputMaxLength", "defaultValue", "md", "watchValue", "disabled"]);
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
- context.formSetValue(props.name, watchValue);
50
+ if (watchValue !== undefined)
51
+ context.formSetValue(props.name, watchValue);
51
52
  }, [watchValue]);
52
53
  const chooseInput = () => {
53
54
  const inputConfig = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ssplib/react-components",
3
- "version": "0.0.257",
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>",