@ssplib/react-components 0.0.255 → 0.0.256

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.
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- export default function FetchAutoComplete({ name, url, title, customLoadingText, shouldRefetch, required, defaultValue, route, onChange, xs, sm, watchValue, md, }: {
2
+ export default function FetchAutoComplete({ name, url, title, customLoadingText, shouldRefetch, required, defaultValue, route, onChange, xs, sm, watchValue, md, disabled, }: {
3
3
  name: string;
4
4
  url: string;
5
5
  title: string;
@@ -16,4 +16,5 @@ export default function FetchAutoComplete({ name, url, title, customLoadingText,
16
16
  xs?: number;
17
17
  sm?: number;
18
18
  md?: number;
19
+ disabled?: boolean;
19
20
  }): JSX.Element;
@@ -32,7 +32,7 @@ const react_1 = __importStar(require("react"));
32
32
  const auth_1 = require("../../../context/auth");
33
33
  const form_1 = require("../../../context/form");
34
34
  let useDefault = true;
35
- function FetchAutoComplete({ name, url, title, customLoadingText, shouldRefetch = true, required = false, defaultValue, route = '', onChange = () => { }, xs = 12, sm, watchValue, md, }) {
35
+ function FetchAutoComplete({ name, url, title, customLoadingText, shouldRefetch = true, required = false, defaultValue, route = '', onChange = () => { }, xs = 12, sm, watchValue, md, disabled = false, }) {
36
36
  const context = (0, react_1.useContext)(form_1.FormContext);
37
37
  const [loading, setLoading] = (0, react_1.useState)(true);
38
38
  const [list, setList] = (0, react_1.useState)([]);
@@ -127,6 +127,6 @@ function FetchAutoComplete({ name, url, title, customLoadingText, shouldRefetch
127
127
  return (react_1.default.createElement(material_1.TextField, Object.assign({}, params, { size: 'small', fullWidth: true, placeholder: title, onFocus: onFocus, error: (0, lodash_get_1.default)(context === null || context === void 0 ? void 0 : context.errors, name) ? true : false, helperText: (_a = (0, lodash_get_1.default)(context === null || context === void 0 ? void 0 : context.errors, name)) === null || _a === void 0 ? void 0 : _a.message })));
128
128
  }, sx: {
129
129
  bgcolor: 'white',
130
- }, size: 'small', fullWidth: true })));
130
+ }, size: 'small', fullWidth: true, disabled: disabled })));
131
131
  }
132
132
  exports.default = FetchAutoComplete;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- export declare function Input({ type, numberMask, xs, sm, inputMinLength, inputMaxLength, defaultValue, md, watchValue, ...props }: {
2
+ export declare function Input({ type, numberMask, xs, sm, inputMinLength, inputMaxLength, defaultValue, md, watchValue, disabled, ...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;
@@ -13,6 +13,7 @@ export declare function Input({ type, numberMask, xs, sm, inputMinLength, inputM
13
13
  xs?: number;
14
14
  sm?: number;
15
15
  md?: number;
16
+ disabled?: boolean;
16
17
  }): JSX.Element;
17
18
  declare const _default: React.MemoExoticComponent<typeof Input>;
18
19
  export default _default;
@@ -44,7 +44,7 @@ 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 = '' } = _a, props = __rest(_a, ["type", "numberMask", "xs", "sm", "inputMinLength", "inputMaxLength", "defaultValue", "md", "watchValue"]);
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"]);
48
48
  const context = (0, react_1.useContext)(form_1.FormContext);
49
49
  (0, react_1.useEffect)(() => {
50
50
  context.formSetValue(props.name, watchValue);
@@ -114,28 +114,28 @@ function Input(_a) {
114
114
  switch (type) {
115
115
  case 'input':
116
116
  case 'email':
117
- return react_1.default.createElement(material_1.TextField, Object.assign({}, formConfig, { defaultValue: defaultValue }));
117
+ return react_1.default.createElement(material_1.TextField, Object.assign({}, formConfig, { defaultValue: defaultValue, disabled: disabled }));
118
118
  case 'password':
119
- return react_1.default.createElement(material_1.TextField, Object.assign({}, formConfig, { type: 'password' }));
119
+ return react_1.default.createElement(material_1.TextField, Object.assign({}, formConfig, { type: 'password', disabled: disabled }));
120
120
  case 'number':
121
121
  return (react_1.default.createElement(MaskInput_1.default, { formConfig: formConfig, defaultValue: defaultValue, maskProps: {
122
122
  mask: numberMask,
123
- }, watchValue: watchValue }));
123
+ }, watchValue: watchValue, disabled: disabled }));
124
124
  case 'cep':
125
125
  return (react_1.default.createElement(MaskInput_1.default, { formConfig: formConfig, defaultValue: defaultValue, maskProps: {
126
126
  mask: '00000-000',
127
- }, watchValue: watchValue }));
127
+ }, watchValue: watchValue, disabled: disabled }));
128
128
  case 'phone':
129
129
  return (react_1.default.createElement(MaskInput_1.default, { formConfig: formConfig, defaultValue: defaultValue, maskProps: {
130
130
  mask: '(00) [#]0000-0000',
131
131
  definitions: {
132
132
  '#': /^9$/,
133
133
  },
134
- }, watchValue: watchValue }));
134
+ }, watchValue: watchValue, disabled: disabled }));
135
135
  case 'sei':
136
136
  return (react_1.default.createElement(MaskInput_1.default, { formConfig: formConfig, defaultValue: defaultValue, maskProps: {
137
137
  mask: '00000-00000000/0000-00',
138
- }, watchValue: watchValue }));
138
+ }, watchValue: watchValue, disabled: disabled }));
139
139
  case 'cpf_cnpj':
140
140
  return (react_1.default.createElement(MaskInput_1.default, { formConfig: formConfig, defaultValue: defaultValue, maskProps: {
141
141
  mask: '000.000.000-00[0]',
@@ -144,19 +144,19 @@ function Input(_a) {
144
144
  setMask('00.000.000/0000-00');
145
145
  else
146
146
  setMask('000.000.000-00[0]');
147
- }, watchValue: watchValue }));
147
+ }, watchValue: watchValue, disabled: disabled }));
148
148
  case 'cpf':
149
149
  return (react_1.default.createElement(MaskInput_1.default, { formConfig: formConfig, defaultValue: defaultValue, maskProps: {
150
150
  mask: '000.000.000-00',
151
- }, watchValue: watchValue }));
151
+ }, watchValue: watchValue, disabled: disabled }));
152
152
  case 'cnpj':
153
153
  return (react_1.default.createElement(MaskInput_1.default, { formConfig: formConfig, defaultValue: defaultValue, maskProps: {
154
154
  mask: '00.000.000/0000-00',
155
- }, watchValue: watchValue }));
155
+ }, watchValue: watchValue, disabled: disabled }));
156
156
  case 'rg':
157
157
  return (react_1.default.createElement(MaskInput_1.default, { formConfig: formConfig, defaultValue: defaultValue, maskProps: {
158
158
  mask: '00000[000000]',
159
- }, watchValue: watchValue }));
159
+ }, watchValue: watchValue, disabled: disabled }));
160
160
  }
161
161
  };
162
162
  return (react_1.default.createElement(material_1.Grid, Object.assign({ item: true }, { xs, sm, md }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ssplib/react-components",
3
- "version": "0.0.255",
3
+ "version": "0.0.256",
4
4
  "description": "SSP React Components",
5
5
  "main": "index.js",
6
6
  "author": "Pedro Henrique <sr.hudrick@gmail.com>",