@widergy/energy-ui 3.103.0 → 3.103.2

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 CHANGED
@@ -1,3 +1,17 @@
1
+ ## [3.103.2](https://github.com/widergy/energy-ui/compare/v3.103.1...v3.103.2) (2025-09-18)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * [AXCH-683] panel button colors ([#688](https://github.com/widergy/energy-ui/issues/688)) ([47e8512](https://github.com/widergy/energy-ui/commit/47e8512319d756ed47ecadd0459249f7be5e724e))
7
+
8
+ ## [3.103.1](https://github.com/widergy/energy-ui/compare/v3.103.0...v3.103.1) (2025-09-18)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * [CX-1129] UTCuit field refactor ([#685](https://github.com/widergy/energy-ui/issues/685)) ([8d60b25](https://github.com/widergy/energy-ui/commit/8d60b25af5378b21fd87e93cf9ae25675674b914))
14
+
1
15
  # [3.103.0](https://github.com/widergy/energy-ui/compare/v3.102.3...v3.103.0) (2025-09-10)
2
16
 
3
17
 
@@ -4,182 +4,23 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
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");
7
+ var _react = _interopRequireDefault(require("react"));
10
8
  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"));
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
- 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
- }
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
- documentDataTestId: _propTypes.string,
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 = (0, _WithTheme.default)(null, _theme.retrieveMuiTheme)(UTCuit);
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
+ }
@@ -17,6 +17,7 @@ var _theme = require("./theme");
17
17
  var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
18
18
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
19
19
  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); }
20
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
20
21
  var Ellipsis = function Ellipsis(props) {
21
22
  return /*#__PURE__*/_react.default.createElement("svg", props, /*#__PURE__*/_react.default.createElement("path", {
22
23
  fillRule: "evenodd",
@@ -44,6 +45,7 @@ Edit.defaultProps = {
44
45
  xmlns: "http://www.w3.org/2000/svg"
45
46
  };
46
47
  const UTHeader = _ref => {
48
+ var _titleProps$variant, _titleProps$weight;
47
49
  let {
48
50
  actions,
49
51
  banner,
@@ -60,7 +62,8 @@ const UTHeader = _ref => {
60
62
  taglineDataTestId,
61
63
  title,
62
64
  titleDataTestId,
63
- TitleIcon
65
+ TitleIcon,
66
+ titleProps
64
67
  } = _ref;
65
68
  const classes = (0, _react.useMemo)(() => (0, _classesUtils.mergeClasses)(themeClasses, classNames), [classNames]);
66
69
  const mainAction = actions.find(action => action.main);
@@ -79,13 +82,14 @@ const UTHeader = _ref => {
79
82
  variant: "small",
80
83
  weight: "medium"
81
84
  }, tagline));
82
- const Title = renderComponent(title, /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
83
- className: _stylesModule.default.title,
85
+ const Title = renderComponent(title, /*#__PURE__*/_react.default.createElement(_UTLabel.default, _extends({
86
+ className: "".concat(_stylesModule.default.title, " ").concat(titleProps.className),
84
87
  dataTestId: titleDataTestId,
85
- variant: "title2",
86
- weight: "medium",
88
+ variant: (_titleProps$variant = titleProps.variant) !== null && _titleProps$variant !== void 0 ? _titleProps$variant : 'title2',
89
+ weight: (_titleProps$weight = titleProps.weight) !== null && _titleProps$weight !== void 0 ? _titleProps$weight : 'medium'
90
+ }, titleProps, {
87
91
  withMarkdown: true
88
- }, title));
92
+ }), title));
89
93
  const Subtitle = renderComponent(subtitle, /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
90
94
  className: _stylesModule.default.subtitle,
91
95
  colorTheme: "gray",
@@ -172,6 +176,16 @@ UTHeader.propTypes = {
172
176
  taglineDataTestId: _propTypes.string,
173
177
  title: _propTypes.string,
174
178
  titleDataTestId: _propTypes.string,
175
- TitleIcon: _propTypes.element
179
+ TitleIcon: _propTypes.element,
180
+ titleProps: (0, _propTypes.shape)({
181
+ align: _propTypes.string,
182
+ classes: (0, _propTypes.objectOf)(_propTypes.string),
183
+ className: _propTypes.string,
184
+ dataTestId: _propTypes.string,
185
+ markdownRenderers: (0, _propTypes.objectOf)(_propTypes.func),
186
+ title: _propTypes.string,
187
+ variant: _propTypes.string,
188
+ withMarkdown: _propTypes.bool
189
+ })
176
190
  };
177
191
  var _default = exports.default = (0, _WithTheme.default)(_theme.retrieveStyle)(UTHeader);
@@ -200,7 +200,7 @@ const UTPanel = _ref => {
200
200
  onClose: closeMenu,
201
201
  withMenuItem: true
202
202
  }), /*#__PURE__*/_react.default.createElement(_UTButton.default, _extends({
203
- colorTheme: "primary",
203
+ colorTheme: "secondary",
204
204
  dataTestId: secondaryActionDataTestId,
205
205
  onClick: secondaryActionAsMenu ? openMenu : undefined,
206
206
  variant: "semitransparent"
@@ -55,6 +55,7 @@ const UTWorkflowContainer = _ref => {
55
55
  taglineDataTestId = workflowContainer.header.tagline,
56
56
  title,
57
57
  titleDataTestId = workflowContainer.header.title,
58
+ titleProps = {},
58
59
  variant = _constants.VARIANTS.DEFAULT,
59
60
  withIcon = false,
60
61
  withStepperPadding = true,
@@ -131,7 +132,8 @@ const UTWorkflowContainer = _ref => {
131
132
  tagline: title && tagline,
132
133
  taglineDataTestId,
133
134
  title,
134
- titleDataTestId
135
+ titleDataTestId,
136
+ titleProps
135
137
  }), /*#__PURE__*/_react.default.createElement("div", {
136
138
  className: "".concat(_stylesModule.default.childrenContainer, " ").concat(classes.childrenContainer, " ").concat(variant === _constants.VARIANTS.FULL_WIDTH && "".concat(_stylesModule.default.childrenContainerFullWidth, " ").concat(classes.childrenContainerFullWidth)),
137
139
  id: _constants.CHILDREN_CONTAINER_ID + variant
@@ -197,6 +199,16 @@ UTWorkflowContainer.propTypes = {
197
199
  taglineDataTestId: _propTypes.string,
198
200
  title: _propTypes.string,
199
201
  titleDataTestId: _propTypes.string,
202
+ titleProps: (0, _propTypes.shape)({
203
+ align: _propTypes.string,
204
+ classes: (0, _propTypes.objectOf)(_propTypes.string),
205
+ className: _propTypes.string,
206
+ dataTestId: _propTypes.string,
207
+ markdownRenderers: (0, _propTypes.objectOf)(_propTypes.func),
208
+ title: _propTypes.string,
209
+ variant: _propTypes.string,
210
+ withMarkdown: _propTypes.bool
211
+ }),
200
212
  variant: _propTypes.string,
201
213
  withIcon: _propTypes.bool,
202
214
  withStepperPadding: _propTypes.bool,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widergy/energy-ui",
3
- "version": "3.103.0",
3
+ "version": "3.103.2",
4
4
  "description": "Widergy Web Components",
5
5
  "author": "widergy",
6
6
  "license": "MIT",