infinity-forge 0.17.8 → 0.18.0

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.
@@ -60,12 +60,12 @@ function useCreateTable(queryKey) {
60
60
  });
61
61
  }); },
62
62
  inputs: [
63
- [{ name: 'emailAddress', inputComponent: 'Input', type: 'email', label: 'Email' }],
63
+ [{ name: 'emailAddress', InputComponent: 'Input', type: 'email', label: 'Email' }],
64
64
  [
65
- { name: 'firstName', inputComponent: 'Input', type: 'text', label: 'Primeiro Nome' },
66
- { name: 'lastName', inputComponent: 'Input', type: 'text', label: 'Sobrenome' },
65
+ { name: 'firstName', InputComponent: 'Input', type: 'text', label: 'Primeiro Nome' },
66
+ { name: 'lastName', InputComponent: 'Input', type: 'text', label: 'Sobrenome' },
67
67
  ],
68
- [{ name: 'password', inputComponent: 'InputPassword', type: 'password', label: 'Senha' }],
68
+ [{ name: 'password', InputComponent: 'InputPassword', type: 'password', label: 'Senha' }],
69
69
  ],
70
70
  };
71
71
  return createTable;
@@ -68,12 +68,12 @@ function useEditTable(queryKey) {
68
68
  });
69
69
  }); },
70
70
  inputs: [
71
- [{ name: 'emailAddress', inputComponent: 'Input', type: 'email', label: 'Email' }],
71
+ [{ name: 'emailAddress', InputComponent: 'Input', type: 'email', label: 'Email' }],
72
72
  [
73
- { name: 'firstName', inputComponent: 'Input', type: 'text', label: 'Primeiro Nome' },
74
- { name: 'lastName', inputComponent: 'Input', type: 'text', label: 'Sobrenome' },
73
+ { name: 'firstName', InputComponent: 'Input', type: 'text', label: 'Primeiro Nome' },
74
+ { name: 'lastName', InputComponent: 'Input', type: 'text', label: 'Sobrenome' },
75
75
  ],
76
- [{ name: 'roleGate', inputComponent: 'Input', type: 'text', label: 'Role' }],
76
+ [{ name: 'roleGate', InputComponent: 'Input', type: 'text', label: 'Role' }],
77
77
  ],
78
78
  };
79
79
  return editTable;
@@ -108,7 +108,7 @@ function DynamicFormHandler(props) {
108
108
  });
109
109
  }); }, initialData: __assign(__assign({}, data), (props.initialData || {})), children: props.inputs.map(function (row, index) {
110
110
  return ((0, jsx_runtime_1.jsx)("div", { style: { display: 'grid', gap: 15, gridTemplateColumns: "repeat(".concat(row.length, ", 1fr)") }, children: row.map(function (input) {
111
- var Element = Inputs[input.inputComponent];
111
+ var Element = Inputs[input.InputComponent];
112
112
  return (0, jsx_runtime_1.jsx)(Element, __assign({}, input), input.name);
113
113
  }) }, index));
114
114
  }) }))] }));
@@ -4,7 +4,7 @@ import { ISelectProps } from '../../select/interfaces.js';
4
4
  import * as Inputs from '../../index.js';
5
5
  type InputProps<T = any> = {
6
6
  name: keyof T;
7
- inputComponent: keyof typeof Inputs;
7
+ InputComponent: keyof typeof Inputs;
8
8
  } & Partial<Omit<ISelectProps, 'name'>>;
9
9
  export type DynamicFormHandlerProps<T = any> = Partial<IFormHandler> & {
10
10
  button?: {
@@ -16,14 +16,17 @@ var jsx_runtime_1 = require("react/jsx-runtime");
16
16
  var formik_1 = require("formik");
17
17
  var mask_1 = require("@react-input/mask");
18
18
  var input_control_1 = require("../input-control/index.js");
19
+ var react_1 = require("react");
19
20
  function InputCpfCnpj(props) {
20
- var _a = (0, formik_1.useField)({ name: props.name }), field = _a[0], _ = _a[1], helpers = _a[2];
21
+ var _a = (0, formik_1.useField)({ name: props.name }), field = _a[0], state = _a[1], helpers = _a[2];
22
+ var ref = (0, react_1.useRef)();
21
23
  var masks = {
22
24
  cpf: '___.___.___-__',
23
25
  cnpj: '__.___.___/____-__',
24
26
  };
25
- var handleMask = function (value) { return (props.only ? masks[props.only] : (value === null || value === void 0 ? void 0 : value.length) > 11 ? masks['cnpj'] : masks['cpf']); };
26
- console.log(handleMask(''));
27
+ var handleMask = function (value) {
28
+ return props.only ? masks[props.only] : (value === null || value === void 0 ? void 0 : value.length) > 11 ? masks['cnpj'] : masks['cpf'];
29
+ };
27
30
  function modify(value) {
28
31
  return {
29
32
  mask: handleMask(value),
@@ -35,7 +38,12 @@ function InputCpfCnpj(props) {
35
38
  helpers.setValue(event.target.value);
36
39
  helpers.setTouched(true);
37
40
  };
38
- return ((0, jsx_runtime_1.jsx)(input_control_1.InputControl, __assign({}, props, { children: (0, jsx_runtime_1.jsx)(mask_1.InputMask, __assign({ className: 'font-16-regular', mask: handleMask(''), replacement: { _: /\d/ }, modify: modify }, field, { onChange: handleChange }, props)) })));
41
+ (0, react_1.useEffect)(function () {
42
+ if (state.initialValue) {
43
+ ref.current.value = state.initialValue;
44
+ }
45
+ }, [state.initialValue]);
46
+ return ((0, jsx_runtime_1.jsx)(input_control_1.InputControl, __assign({}, props, { children: (0, jsx_runtime_1.jsx)(mask_1.InputMask, { ref: ref, mask: handleMask(''), replacement: { _: /\d/ }, modify: modify, onMask: handleChange }) })));
39
47
  }
40
48
  exports.InputCpfCnpj = InputCpfCnpj;
41
49
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/ui/components/form/input-cpf-cnpj/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,iCAAiC;AACjC,0CAA6C;AAE7C,kDAA+C;AAI/C,SAAgB,YAAY,CAAC,KAAiB;IACtC,IAAA,KAAsB,IAAA,iBAAQ,EAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,EAAnD,KAAK,QAAA,EAAE,CAAC,QAAA,EAAE,OAAO,QAAkC,CAAA;IAE1D,IAAM,KAAK,GAAG;QACZ,GAAG,EAAE,gBAAgB;QACrB,IAAI,EAAE,oBAAoB;KAC3B,CAAA;IAED,IAAM,UAAU,GAAG,UAAC,KAAK,IAAK,OAAA,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,MAAM,IAAG,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,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AsCC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "infinity-forge",
3
- "version": "0.17.8",
3
+ "version": "0.18.0",
4
4
  "description": "codie Library",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",