@widergy/energy-ui 3.102.3 → 3.103.1
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.
- package/CHANGELOG.md +14 -0
- package/dist/components/UTActionCard/components/HeaderActions/index.js +2 -1
- package/dist/components/UTCuit/index.js +16 -175
- package/dist/components/UTCuit/versions/V0/index.js +185 -0
- package/dist/components/UTCuit/versions/V0/styles.module.scss +21 -0
- package/dist/components/UTCuit/versions/V0/theme.js +67 -0
- package/dist/components/UTCuit/versions/V1/index.js +163 -0
- package/dist/components/UTCuit/versions/V1/styles.module.scss +25 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [3.103.1](https://github.com/widergy/energy-ui/compare/v3.103.0...v3.103.1) (2025-09-18)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* [CX-1129] UTCuit field refactor ([#685](https://github.com/widergy/energy-ui/issues/685)) ([8d60b25](https://github.com/widergy/energy-ui/commit/8d60b25af5378b21fd87e93cf9ae25675674b914))
|
|
7
|
+
|
|
8
|
+
# [3.103.0](https://github.com/widergy/energy-ui/compare/v3.102.3...v3.103.0) (2025-09-10)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* custom size button in utactioncard ([#684](https://github.com/widergy/energy-ui/issues/684)) ([d4fb5a4](https://github.com/widergy/energy-ui/commit/d4fb5a4fc58f87a462cb0335fc65a6fa330ffd9a))
|
|
14
|
+
|
|
1
15
|
## [3.102.3](https://github.com/widergy/energy-ui/compare/v3.102.2...v3.102.3) (2025-09-08)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -47,6 +47,7 @@ const HeaderActions = _ref => {
|
|
|
47
47
|
primaryActions,
|
|
48
48
|
secondaryActions
|
|
49
49
|
} = (0, _utils.processActions)(headerActions, !showButtonGroup ? closeMenu : null);
|
|
50
|
+
const buttonSize = (headerActionsProps === null || headerActionsProps === void 0 ? void 0 : headerActionsProps.buttonSize) || 'medium';
|
|
50
51
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
51
52
|
className: "".concat(_stylesModule.default.headerActionsContainer, " ").concat(_stylesModule.default["placeSelf-".concat(headerActionsProps.alignment)]),
|
|
52
53
|
onClick: e => e.stopPropagation(),
|
|
@@ -62,7 +63,7 @@ const HeaderActions = _ref => {
|
|
|
62
63
|
classNames: {
|
|
63
64
|
root: _stylesModule.default.zIndex
|
|
64
65
|
},
|
|
65
|
-
size:
|
|
66
|
+
size: buttonSize,
|
|
66
67
|
variant: "text"
|
|
67
68
|
}), buttonProps.title)))), !(0, _isEmpty.default)(secondaryActions) && (!showButtonGroup ? /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(_UTMenu.default, {
|
|
68
69
|
anchor: menu,
|
|
@@ -4,182 +4,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _react =
|
|
8
|
-
var _TextField = _interopRequireDefault(require("@material-ui/core/TextField"));
|
|
9
|
-
var _form = require("@widergy/web-utils/lib/form");
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
8
|
var _propTypes = require("prop-types");
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var _formTypes = require("../../types/formTypes");
|
|
14
|
-
var _theme = require("./theme");
|
|
15
|
-
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
9
|
+
var _V = _interopRequireDefault(require("./versions/V0"));
|
|
10
|
+
var _V2 = _interopRequireDefault(require("./versions/V1"));
|
|
16
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
verificationCode
|
|
29
|
-
} = this.state;
|
|
30
|
-
this.props.input.onChange(prefix.concat(document, verificationCode));
|
|
31
|
-
});
|
|
32
|
-
_defineProperty(this, "handleKeyPress", event => {
|
|
33
|
-
const regexp = /[0-9]+/g;
|
|
34
|
-
if (!regexp.test(event.key)) {
|
|
35
|
-
event.preventDefault();
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
_defineProperty(this, "handleOnChangePrefix", event => {
|
|
39
|
-
const normalizePrefix = event.target.value.replace(/^[^2-3]/g, '');
|
|
40
|
-
const prefix = normalizePrefix.slice(0, 2);
|
|
41
|
-
this.setState({
|
|
42
|
-
prefix
|
|
43
|
-
}, this.handleChangeCuit);
|
|
44
|
-
});
|
|
45
|
-
_defineProperty(this, "handleOnChangeDocument", event => {
|
|
46
|
-
const document = event.target.value.slice(0, 8);
|
|
47
|
-
this.setState({
|
|
48
|
-
document
|
|
49
|
-
}, this.handleChangeCuit);
|
|
50
|
-
});
|
|
51
|
-
_defineProperty(this, "handleOnChangeVerificationCode", event => {
|
|
52
|
-
const verificationCode = event.target.value.slice(0, 1);
|
|
53
|
-
this.setState({
|
|
54
|
-
verificationCode
|
|
55
|
-
}, this.handleChangeCuit);
|
|
56
|
-
});
|
|
57
|
-
_defineProperty(this, "handleSetDocument", value => {
|
|
58
|
-
this.setState({
|
|
59
|
-
document: value.padStart(8, '0')
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
_defineProperty(this, "verificationCodeRef", input => {
|
|
63
|
-
this.setState({
|
|
64
|
-
verificationCodeRef: input
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
_defineProperty(this, "documentRef", input => {
|
|
68
|
-
this.setState({
|
|
69
|
-
documentRef: input
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
_defineProperty(this, "handleFocus", () => {
|
|
73
|
-
if (this.state.prefix.length === 2 && this.state.document.length === 8) {
|
|
74
|
-
this.state.verificationCodeRef.focus();
|
|
75
|
-
} else if (this.state.prefix.length === 2) {
|
|
76
|
-
this.state.documentRef.focus();
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
this.state = {
|
|
80
|
-
prefix: '',
|
|
81
|
-
verificationCode: '',
|
|
82
|
-
document: '',
|
|
83
|
-
verificationCodeRef: null,
|
|
84
|
-
documentRef: null
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
componentDidUpdate() {
|
|
88
|
-
if (this.state.prefix.length === 0 && this.state.document.length === 0 && this.state.verificationCode.length === 0 && this.props.input && this.props.input.value && this.props.field.configuration.disable_document) this.handleSetDocument(this.props.input.value);
|
|
89
|
-
}
|
|
90
|
-
render() {
|
|
91
|
-
const {
|
|
92
|
-
prefix,
|
|
93
|
-
document,
|
|
94
|
-
verificationCode
|
|
95
|
-
} = this.state;
|
|
96
|
-
const {
|
|
97
|
-
documentDataTestId,
|
|
98
|
-
prefixDataTestId,
|
|
99
|
-
verificationCodeDataTestId,
|
|
100
|
-
input: {
|
|
101
|
-
name
|
|
102
|
-
}
|
|
103
|
-
} = this.props;
|
|
104
|
-
this.handleFocus();
|
|
105
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
106
|
-
className: _stylesModule.default.container
|
|
107
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
108
|
-
className: _stylesModule.default.fieldContainer
|
|
109
|
-
}, /*#__PURE__*/_react.default.createElement(_TextField.default, {
|
|
110
|
-
autoComplete: "off",
|
|
111
|
-
autoFocus: this.props.field.configuration.auto_focus,
|
|
112
|
-
className: _stylesModule.default.fieldCuit,
|
|
113
|
-
error: (0, _form.shouldShowErrors)(this.props.meta) ? this.props.meta.error : '',
|
|
114
|
-
fullWidth: true,
|
|
115
|
-
InputLabelProps: {
|
|
116
|
-
shrink: this.props.input.value !== 0
|
|
117
|
-
},
|
|
118
|
-
InputProps: {
|
|
119
|
-
type: 'input',
|
|
120
|
-
inputProps: {
|
|
121
|
-
'data-testid': prefixDataTestId,
|
|
122
|
-
'data-keyboard': name ? "prefix-".concat(name) : null
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
label: this.props.field.label,
|
|
126
|
-
margin: "none",
|
|
127
|
-
name: "prefix",
|
|
128
|
-
onChange: this.handleOnChangePrefix,
|
|
129
|
-
onKeyPress: this.handleKeyPress,
|
|
130
|
-
placeholder: "XX",
|
|
131
|
-
value: prefix
|
|
132
|
-
}), /*#__PURE__*/_react.default.createElement(_TextField.default, {
|
|
133
|
-
autoComplete: "off",
|
|
134
|
-
className: _stylesModule.default.fieldDocument,
|
|
135
|
-
disabled: this.props.field.configuration.disable_document,
|
|
136
|
-
error: (0, _form.shouldShowErrors)(this.props.meta) ? this.props.meta.error : '',
|
|
137
|
-
fullWidth: true,
|
|
138
|
-
InputProps: {
|
|
139
|
-
type: 'text',
|
|
140
|
-
inputProps: {
|
|
141
|
-
'data-testid': documentDataTestId,
|
|
142
|
-
'data-keyboard': name ? "document-".concat(name) : null
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
|
-
inputRef: this.documentRef,
|
|
146
|
-
margin: "none",
|
|
147
|
-
name: "document",
|
|
148
|
-
onChange: this.handleOnChangeDocument,
|
|
149
|
-
onKeyPress: this.handleKeyPress,
|
|
150
|
-
placeholder: "XXXXXXXX",
|
|
151
|
-
value: document
|
|
152
|
-
}), /*#__PURE__*/_react.default.createElement(_TextField.default, {
|
|
153
|
-
autoComplete: "off",
|
|
154
|
-
className: _stylesModule.default.fieldCuit,
|
|
155
|
-
error: (0, _form.shouldShowErrors)(this.props.meta) ? this.props.meta.error : '',
|
|
156
|
-
fullWidth: true,
|
|
157
|
-
inputRef: this.verificationCodeRef,
|
|
158
|
-
InputProps: {
|
|
159
|
-
type: 'input',
|
|
160
|
-
inputProps: {
|
|
161
|
-
'data-testid': verificationCodeDataTestId,
|
|
162
|
-
'data-keyboard': name ? "verificationCode-".concat(name) : null
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
margin: "none",
|
|
166
|
-
name: "verificationCode",
|
|
167
|
-
onChange: this.handleOnChangeVerificationCode,
|
|
168
|
-
onKeyPress: this.handleKeyPress,
|
|
169
|
-
placeholder: "X",
|
|
170
|
-
value: verificationCode
|
|
171
|
-
})), /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
172
|
-
variant: "small",
|
|
173
|
-
colorTheme: "error"
|
|
174
|
-
}, (0, _form.shouldShowErrors)(this.props.meta) ? this.props.meta.error : ''));
|
|
175
|
-
}
|
|
176
|
-
}
|
|
12
|
+
const UTCuit = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
version = 'V0',
|
|
15
|
+
...props
|
|
16
|
+
} = _ref;
|
|
17
|
+
const Component = {
|
|
18
|
+
V0: _V.default,
|
|
19
|
+
V1: _V2.default
|
|
20
|
+
}[version];
|
|
21
|
+
return /*#__PURE__*/_react.default.createElement(Component, props);
|
|
22
|
+
};
|
|
177
23
|
UTCuit.propTypes = {
|
|
178
|
-
|
|
179
|
-
field: _formTypes.fieldType,
|
|
180
|
-
input: _formTypes.inputPropTypes,
|
|
181
|
-
meta: _formTypes.metaPropTypes,
|
|
182
|
-
prefixDataTestId: _propTypes.string,
|
|
183
|
-
verificationCodeDataTestId: _propTypes.string
|
|
24
|
+
version: _propTypes.string
|
|
184
25
|
};
|
|
185
|
-
var _default = exports.default =
|
|
26
|
+
var _default = exports.default = UTCuit;
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _TextField = _interopRequireDefault(require("@material-ui/core/TextField"));
|
|
9
|
+
var _form = require("@widergy/web-utils/lib/form");
|
|
10
|
+
var _propTypes = require("prop-types");
|
|
11
|
+
var _UTLabel = _interopRequireDefault(require("../../../UTLabel"));
|
|
12
|
+
var _WithTheme = _interopRequireDefault(require("../../../WithTheme"));
|
|
13
|
+
var _formTypes = require("../../../../types/formTypes");
|
|
14
|
+
var _theme = require("./theme");
|
|
15
|
+
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
16
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
18
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
19
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
20
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
21
|
+
class UTCuit extends _react.PureComponent {
|
|
22
|
+
constructor(props) {
|
|
23
|
+
super(props);
|
|
24
|
+
_defineProperty(this, "handleChangeCuit", () => {
|
|
25
|
+
const {
|
|
26
|
+
prefix,
|
|
27
|
+
document,
|
|
28
|
+
verificationCode
|
|
29
|
+
} = this.state;
|
|
30
|
+
this.props.input.onChange(prefix.concat(document, verificationCode));
|
|
31
|
+
});
|
|
32
|
+
_defineProperty(this, "handleKeyPress", event => {
|
|
33
|
+
const regexp = /[0-9]+/g;
|
|
34
|
+
if (!regexp.test(event.key)) {
|
|
35
|
+
event.preventDefault();
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
_defineProperty(this, "handleOnChangePrefix", event => {
|
|
39
|
+
const normalizePrefix = event.target.value.replace(/^[^2-3]/g, '');
|
|
40
|
+
const prefix = normalizePrefix.slice(0, 2);
|
|
41
|
+
this.setState({
|
|
42
|
+
prefix
|
|
43
|
+
}, this.handleChangeCuit);
|
|
44
|
+
});
|
|
45
|
+
_defineProperty(this, "handleOnChangeDocument", event => {
|
|
46
|
+
const document = event.target.value.slice(0, 8);
|
|
47
|
+
this.setState({
|
|
48
|
+
document
|
|
49
|
+
}, this.handleChangeCuit);
|
|
50
|
+
});
|
|
51
|
+
_defineProperty(this, "handleOnChangeVerificationCode", event => {
|
|
52
|
+
const verificationCode = event.target.value.slice(0, 1);
|
|
53
|
+
this.setState({
|
|
54
|
+
verificationCode
|
|
55
|
+
}, this.handleChangeCuit);
|
|
56
|
+
});
|
|
57
|
+
_defineProperty(this, "handleSetDocument", value => {
|
|
58
|
+
this.setState({
|
|
59
|
+
document: value.padStart(8, '0')
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
_defineProperty(this, "verificationCodeRef", input => {
|
|
63
|
+
this.setState({
|
|
64
|
+
verificationCodeRef: input
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
_defineProperty(this, "documentRef", input => {
|
|
68
|
+
this.setState({
|
|
69
|
+
documentRef: input
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
_defineProperty(this, "handleFocus", () => {
|
|
73
|
+
if (this.state.prefix.length === 2 && this.state.document.length === 8) {
|
|
74
|
+
this.state.verificationCodeRef.focus();
|
|
75
|
+
} else if (this.state.prefix.length === 2) {
|
|
76
|
+
this.state.documentRef.focus();
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
this.state = {
|
|
80
|
+
prefix: '',
|
|
81
|
+
verificationCode: '',
|
|
82
|
+
document: '',
|
|
83
|
+
verificationCodeRef: null,
|
|
84
|
+
documentRef: null
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
componentDidUpdate() {
|
|
88
|
+
if (this.state.prefix.length === 0 && this.state.document.length === 0 && this.state.verificationCode.length === 0 && this.props.input && this.props.input.value && this.props.field.configuration.disable_document) this.handleSetDocument(this.props.input.value);
|
|
89
|
+
}
|
|
90
|
+
render() {
|
|
91
|
+
const {
|
|
92
|
+
prefix,
|
|
93
|
+
document,
|
|
94
|
+
verificationCode
|
|
95
|
+
} = this.state;
|
|
96
|
+
const {
|
|
97
|
+
documentDataTestId,
|
|
98
|
+
prefixDataTestId,
|
|
99
|
+
verificationCodeDataTestId,
|
|
100
|
+
input: {
|
|
101
|
+
name
|
|
102
|
+
}
|
|
103
|
+
} = this.props;
|
|
104
|
+
this.handleFocus();
|
|
105
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
106
|
+
className: _stylesModule.default.container
|
|
107
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
108
|
+
className: _stylesModule.default.fieldContainer
|
|
109
|
+
}, /*#__PURE__*/_react.default.createElement(_TextField.default, {
|
|
110
|
+
autoComplete: "off",
|
|
111
|
+
autoFocus: this.props.field.configuration.auto_focus,
|
|
112
|
+
className: _stylesModule.default.fieldCuit,
|
|
113
|
+
error: (0, _form.shouldShowErrors)(this.props.meta) ? this.props.meta.error : '',
|
|
114
|
+
fullWidth: true,
|
|
115
|
+
InputLabelProps: {
|
|
116
|
+
shrink: this.props.input.value !== 0
|
|
117
|
+
},
|
|
118
|
+
InputProps: {
|
|
119
|
+
type: 'input',
|
|
120
|
+
inputProps: {
|
|
121
|
+
'data-testid': prefixDataTestId,
|
|
122
|
+
'data-keyboard': name ? "prefix-".concat(name) : null
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
label: this.props.field.label,
|
|
126
|
+
margin: "none",
|
|
127
|
+
name: "prefix",
|
|
128
|
+
onChange: this.handleOnChangePrefix,
|
|
129
|
+
onKeyPress: this.handleKeyPress,
|
|
130
|
+
placeholder: "XX",
|
|
131
|
+
value: prefix
|
|
132
|
+
}), /*#__PURE__*/_react.default.createElement(_TextField.default, {
|
|
133
|
+
autoComplete: "off",
|
|
134
|
+
className: _stylesModule.default.fieldDocument,
|
|
135
|
+
disabled: this.props.field.configuration.disable_document,
|
|
136
|
+
error: (0, _form.shouldShowErrors)(this.props.meta) ? this.props.meta.error : '',
|
|
137
|
+
fullWidth: true,
|
|
138
|
+
InputProps: {
|
|
139
|
+
type: 'text',
|
|
140
|
+
inputProps: {
|
|
141
|
+
'data-testid': documentDataTestId,
|
|
142
|
+
'data-keyboard': name ? "document-".concat(name) : null
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
inputRef: this.documentRef,
|
|
146
|
+
margin: "none",
|
|
147
|
+
name: "document",
|
|
148
|
+
onChange: this.handleOnChangeDocument,
|
|
149
|
+
onKeyPress: this.handleKeyPress,
|
|
150
|
+
placeholder: "XXXXXXXX",
|
|
151
|
+
value: document
|
|
152
|
+
}), /*#__PURE__*/_react.default.createElement(_TextField.default, {
|
|
153
|
+
autoComplete: "off",
|
|
154
|
+
className: _stylesModule.default.fieldCuit,
|
|
155
|
+
error: (0, _form.shouldShowErrors)(this.props.meta) ? this.props.meta.error : '',
|
|
156
|
+
fullWidth: true,
|
|
157
|
+
inputRef: this.verificationCodeRef,
|
|
158
|
+
InputProps: {
|
|
159
|
+
type: 'input',
|
|
160
|
+
inputProps: {
|
|
161
|
+
'data-testid': verificationCodeDataTestId,
|
|
162
|
+
'data-keyboard': name ? "verificationCode-".concat(name) : null
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
margin: "none",
|
|
166
|
+
name: "verificationCode",
|
|
167
|
+
onChange: this.handleOnChangeVerificationCode,
|
|
168
|
+
onKeyPress: this.handleKeyPress,
|
|
169
|
+
placeholder: "X",
|
|
170
|
+
value: verificationCode
|
|
171
|
+
})), /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
172
|
+
variant: "small",
|
|
173
|
+
colorTheme: "error"
|
|
174
|
+
}, (0, _form.shouldShowErrors)(this.props.meta) ? this.props.meta.error : ''));
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
UTCuit.propTypes = {
|
|
178
|
+
documentDataTestId: _propTypes.string,
|
|
179
|
+
field: _formTypes.fieldType,
|
|
180
|
+
input: _formTypes.inputPropTypes,
|
|
181
|
+
meta: _formTypes.metaPropTypes,
|
|
182
|
+
prefixDataTestId: _propTypes.string,
|
|
183
|
+
verificationCodeDataTestId: _propTypes.string
|
|
184
|
+
};
|
|
185
|
+
var _default = exports.default = (0, _WithTheme.default)(null, _theme.retrieveMuiTheme)(UTCuit);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
.container {
|
|
2
|
+
align-items: flex-start;
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
flex-shrink: 0;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.fieldContainer {
|
|
9
|
+
align-items: baseline;
|
|
10
|
+
display: flex;
|
|
11
|
+
width: 100%;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.fieldCuit {
|
|
15
|
+
width: 25%;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.fieldDocument {
|
|
19
|
+
margin: 0 10px;
|
|
20
|
+
width: 50%;
|
|
21
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.retrieveMuiTheme = void 0;
|
|
7
|
+
var _seamlessImmutable = require("seamless-immutable");
|
|
8
|
+
var _styles = require("@material-ui/core/styles");
|
|
9
|
+
var _colorsModule = _interopRequireDefault(require("../../../../scss/variables/colors.module.scss"));
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
const retrieveMuiTheme = theme => (0, _styles.createTheme)({
|
|
12
|
+
typography: {
|
|
13
|
+
fontFamily: (0, _seamlessImmutable.getIn)(theme, ['Fonts', 'fontFamily'])
|
|
14
|
+
},
|
|
15
|
+
overrides: {
|
|
16
|
+
MuiInput: {
|
|
17
|
+
input: {
|
|
18
|
+
fontSize: (0, _seamlessImmutable.getIn)(theme, ['UTTextInput', 'fontSize'], (0, _seamlessImmutable.getIn)(theme, ['Fonts', 'medium'], 14)),
|
|
19
|
+
color: (0, _seamlessImmutable.getIn)(theme, ['UTTextInput', 'color'])
|
|
20
|
+
},
|
|
21
|
+
underline: {
|
|
22
|
+
'&:hover:not($disabled):not($focused):not($error):before': {
|
|
23
|
+
borderBottom: (0, _seamlessImmutable.getIn)(theme, ['UTTextInput', 'underline', 'hover', 'borderBottom'], "1px solid ".concat(_colorsModule.default.gray))
|
|
24
|
+
},
|
|
25
|
+
'&$disabled:before': {
|
|
26
|
+
borderBottom: (0, _seamlessImmutable.getIn)(theme, ['UTTextInput', 'underline', 'disabled', 'borderBottom'], "1px solid ".concat(_colorsModule.default.gray))
|
|
27
|
+
},
|
|
28
|
+
'&:before': {
|
|
29
|
+
borderBottom: (0, _seamlessImmutable.getIn)(theme, ['UTTextInput', 'underline', 'unfocused', 'borderBottom'], "1px solid ".concat(_colorsModule.default.gray))
|
|
30
|
+
},
|
|
31
|
+
'&$focused:after': {
|
|
32
|
+
borderBottom: (0, _seamlessImmutable.getIn)(theme, ['UTTextInput', 'underline', 'focused', 'borderBottom'], "2px solid ".concat(_colorsModule.default.primary))
|
|
33
|
+
},
|
|
34
|
+
'&:after': {
|
|
35
|
+
borderBottom: (0, _seamlessImmutable.getIn)(theme, ['UTTextInput', 'underline', 'base', 'borderBottom'], "2px solid ".concat(_colorsModule.default.primary))
|
|
36
|
+
},
|
|
37
|
+
'&$error:after': {
|
|
38
|
+
borderBottom: "2px solid ".concat(theme.Palette.error['05']),
|
|
39
|
+
borderBottomColor: theme.Palette.error['05']
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
MuiFormLabel: {
|
|
44
|
+
root: {
|
|
45
|
+
color: (0, _seamlessImmutable.getIn)(theme, ['UTTextInput', 'formLabel', 'color']),
|
|
46
|
+
'&$error': {
|
|
47
|
+
color: (0, _seamlessImmutable.getIn)(theme, ['UTTextInput', 'formLabel', 'errorColor'], _colorsModule.default.gray)
|
|
48
|
+
},
|
|
49
|
+
'&$focused': {
|
|
50
|
+
color: (0, _seamlessImmutable.getIn)(theme, ['UTTextInput', 'formLabel', 'focusedColor'], _colorsModule.default.primary),
|
|
51
|
+
'&$error': {
|
|
52
|
+
color: theme.Palette.error['05']
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
fontFamily: (0, _seamlessImmutable.getIn)(theme, ['Fonts', 'fontFamily']),
|
|
56
|
+
fontSize: (0, _seamlessImmutable.getIn)(theme, ['UTTextInput', 'fontSize'], (0, _seamlessImmutable.getIn)(theme, ['Fonts', 'medium'], 14))
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
MuiFormHelperText: {
|
|
60
|
+
root: {
|
|
61
|
+
fontSize: (0, _seamlessImmutable.getIn)(theme, ['UTTextInput', 'helperText', 'fontSize'], 12),
|
|
62
|
+
color: (0, _seamlessImmutable.getIn)(theme, ['UTTextInput', 'helperText', 'color'], theme.Palette.error['05'])
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
exports.retrieveMuiTheme = retrieveMuiTheme;
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _form = require("@widergy/web-utils/lib/form");
|
|
9
|
+
var _propTypes = require("prop-types");
|
|
10
|
+
var _UTLabel = _interopRequireDefault(require("../../../UTLabel"));
|
|
11
|
+
var _UTTextInput = _interopRequireDefault(require("../../../UTTextInput"));
|
|
12
|
+
var _WithTheme = _interopRequireDefault(require("../../../WithTheme"));
|
|
13
|
+
var _formTypes = require("../../../../types/formTypes");
|
|
14
|
+
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
17
|
+
const UTCuit = _ref => {
|
|
18
|
+
var _field$configuration;
|
|
19
|
+
let {
|
|
20
|
+
documentDataTestId,
|
|
21
|
+
field,
|
|
22
|
+
input,
|
|
23
|
+
meta,
|
|
24
|
+
prefixDataTestId,
|
|
25
|
+
verificationCodeDataTestId,
|
|
26
|
+
dni,
|
|
27
|
+
disableDocument = false
|
|
28
|
+
} = _ref;
|
|
29
|
+
const [prefix, setPrefix] = (0, _react.useState)('');
|
|
30
|
+
const [verificationCode, setVerificationCode] = (0, _react.useState)('');
|
|
31
|
+
const [document, setDocument] = (0, _react.useState)('');
|
|
32
|
+
const verificationCodeRef = (0, _react.useRef)(null);
|
|
33
|
+
const documentRef = (0, _react.useRef)(null);
|
|
34
|
+
const getDocumentValue = (0, _react.useCallback)(() => {
|
|
35
|
+
const rawDocumentValue = disableDocument && dni ? dni : document;
|
|
36
|
+
return rawDocumentValue ? rawDocumentValue.padStart(8, '0') : '';
|
|
37
|
+
}, [disableDocument, dni, document]);
|
|
38
|
+
const handleChangeCuit = (0, _react.useCallback)(() => {
|
|
39
|
+
const documentValue = getDocumentValue();
|
|
40
|
+
const fullCuit = prefix.concat(documentValue, verificationCode);
|
|
41
|
+
input.onChange(fullCuit);
|
|
42
|
+
}, [prefix, document, verificationCode, input, disableDocument, dni]);
|
|
43
|
+
(0, _react.useEffect)(() => {
|
|
44
|
+
if (disableDocument && dni && !document) {
|
|
45
|
+
setDocument(dni.padStart(8, '0'));
|
|
46
|
+
}
|
|
47
|
+
}, [disableDocument, dni, document]);
|
|
48
|
+
const handleOnChangePrefix = (0, _react.useCallback)(event => {
|
|
49
|
+
const value = event && event.target ? event.target.value : event;
|
|
50
|
+
const numericValue = value.replace(/[^0-9]/g, '');
|
|
51
|
+
if (numericValue.length === 0) {
|
|
52
|
+
setPrefix('');
|
|
53
|
+
} else if (numericValue[0] === '2') {
|
|
54
|
+
setPrefix(numericValue);
|
|
55
|
+
} else {
|
|
56
|
+
setPrefix('');
|
|
57
|
+
}
|
|
58
|
+
}, []);
|
|
59
|
+
const handleOnChangeDocument = (0, _react.useCallback)(event => {
|
|
60
|
+
const value = event && event.target ? event.target.value : event;
|
|
61
|
+
const numericValue = value.replace(/[^0-9]/g, '');
|
|
62
|
+
setDocument(numericValue);
|
|
63
|
+
}, []);
|
|
64
|
+
const handleOnChangeVerificationCode = (0, _react.useCallback)(event => {
|
|
65
|
+
const value = event && event.target ? event.target.value : event;
|
|
66
|
+
const numericValue = value.replace(/[^0-9]/g, '');
|
|
67
|
+
setVerificationCode(numericValue);
|
|
68
|
+
}, []);
|
|
69
|
+
const handleFocus = (0, _react.useCallback)(() => {
|
|
70
|
+
const documentValue = getDocumentValue();
|
|
71
|
+
if (prefix.length === 2 && documentValue.length === 8) {
|
|
72
|
+
var _verificationCodeRef$;
|
|
73
|
+
(_verificationCodeRef$ = verificationCodeRef.current) === null || _verificationCodeRef$ === void 0 || _verificationCodeRef$.focus();
|
|
74
|
+
} else if (prefix.length === 2 && !disableDocument) {
|
|
75
|
+
var _documentRef$current;
|
|
76
|
+
(_documentRef$current = documentRef.current) === null || _documentRef$current === void 0 || _documentRef$current.focus();
|
|
77
|
+
}
|
|
78
|
+
}, [prefix, document, disableDocument, dni]);
|
|
79
|
+
(0, _react.useEffect)(() => {
|
|
80
|
+
handleChangeCuit();
|
|
81
|
+
}, [handleChangeCuit]);
|
|
82
|
+
(0, _react.useEffect)(() => {
|
|
83
|
+
handleFocus();
|
|
84
|
+
}, [handleFocus]);
|
|
85
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
86
|
+
className: _stylesModule.default.container
|
|
87
|
+
}, (field === null || field === void 0 ? void 0 : field.label) && /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
88
|
+
className: _stylesModule.default.label,
|
|
89
|
+
variant: "medium"
|
|
90
|
+
}, field === null || field === void 0 ? void 0 : field.label), /*#__PURE__*/_react.default.createElement("div", {
|
|
91
|
+
className: _stylesModule.default.fieldContainer
|
|
92
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
93
|
+
className: _stylesModule.default.fieldCuit
|
|
94
|
+
}, /*#__PURE__*/_react.default.createElement(_UTTextInput.default, {
|
|
95
|
+
version: "V1",
|
|
96
|
+
autoComplete: "off",
|
|
97
|
+
autofocus: ((_field$configuration = field.configuration) === null || _field$configuration === void 0 ? void 0 : _field$configuration.auto_focus) || false,
|
|
98
|
+
dataTestId: prefixDataTestId,
|
|
99
|
+
alwaysShowPlaceholder: true,
|
|
100
|
+
field: field,
|
|
101
|
+
input: {
|
|
102
|
+
name: 'prefix'
|
|
103
|
+
},
|
|
104
|
+
maxLength: 2,
|
|
105
|
+
meta: meta,
|
|
106
|
+
onChange: handleOnChangePrefix,
|
|
107
|
+
placeholder: "XX",
|
|
108
|
+
type: "text",
|
|
109
|
+
value: prefix || ''
|
|
110
|
+
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
111
|
+
className: _stylesModule.default.fieldDocument
|
|
112
|
+
}, /*#__PURE__*/_react.default.createElement(_UTTextInput.default, {
|
|
113
|
+
version: "V1",
|
|
114
|
+
autoComplete: "off",
|
|
115
|
+
dataTestId: documentDataTestId,
|
|
116
|
+
alwaysShowPlaceholder: !dni,
|
|
117
|
+
disabled: disableDocument && dni,
|
|
118
|
+
field: field,
|
|
119
|
+
value: dni,
|
|
120
|
+
input: {
|
|
121
|
+
value: disableDocument && dni ? dni : document,
|
|
122
|
+
onChange: disableDocument && dni ? () => {} : handleOnChangeDocument,
|
|
123
|
+
name: 'document'
|
|
124
|
+
},
|
|
125
|
+
maxLength: 8,
|
|
126
|
+
inputRef: !disableDocument ? documentRef : null,
|
|
127
|
+
meta: meta,
|
|
128
|
+
placeholder: "XXXXXXXX",
|
|
129
|
+
type: "numeric"
|
|
130
|
+
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
131
|
+
className: _stylesModule.default.fieldCuit
|
|
132
|
+
}, /*#__PURE__*/_react.default.createElement(_UTTextInput.default, {
|
|
133
|
+
version: "V1",
|
|
134
|
+
autoComplete: "off",
|
|
135
|
+
dataTestId: verificationCodeDataTestId,
|
|
136
|
+
alwaysShowPlaceholder: true,
|
|
137
|
+
field: field,
|
|
138
|
+
input: {
|
|
139
|
+
value: verificationCode || '',
|
|
140
|
+
name: 'verificationCode'
|
|
141
|
+
},
|
|
142
|
+
onChange: handleOnChangeVerificationCode,
|
|
143
|
+
maxLength: 1,
|
|
144
|
+
inputRef: verificationCodeRef,
|
|
145
|
+
meta: meta,
|
|
146
|
+
placeholder: "X",
|
|
147
|
+
type: "text"
|
|
148
|
+
}))), /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
149
|
+
variant: "small",
|
|
150
|
+
colorTheme: "error"
|
|
151
|
+
}, (0, _form.shouldShowErrors)(meta) ? meta.error : ''));
|
|
152
|
+
};
|
|
153
|
+
UTCuit.propTypes = {
|
|
154
|
+
documentDataTestId: _propTypes.string,
|
|
155
|
+
field: _formTypes.fieldType,
|
|
156
|
+
input: _formTypes.inputPropTypes,
|
|
157
|
+
meta: _formTypes.metaPropTypes,
|
|
158
|
+
prefixDataTestId: _propTypes.string,
|
|
159
|
+
verificationCodeDataTestId: _propTypes.string,
|
|
160
|
+
dni: _propTypes.string,
|
|
161
|
+
disableDocument: _propTypes.bool
|
|
162
|
+
};
|
|
163
|
+
var _default = exports.default = (0, _WithTheme.default)(null, null)(UTCuit);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
.container {
|
|
2
|
+
align-items: flex-start;
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
flex-shrink: 0;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.label {
|
|
9
|
+
margin-bottom: 8px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.fieldContainer {
|
|
13
|
+
align-items: baseline;
|
|
14
|
+
display: flex;
|
|
15
|
+
width: 100%;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.fieldCuit {
|
|
19
|
+
width: 25%;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.fieldDocument {
|
|
23
|
+
margin: 0 10px;
|
|
24
|
+
width: 50%;
|
|
25
|
+
}
|