@widergy/energy-ui 3.24.0 → 3.26.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.
- package/CHANGELOG.md +14 -0
- package/dist/components/UTActionCard/components/BottomActions/index.js +3 -0
- package/dist/components/UTAutocomplete/index.js +5 -0
- package/dist/components/UTBaseInputField/components/ActionAdornment/index.js +31 -0
- package/dist/components/UTBaseInputField/components/IconAdornment/constants.js +8 -0
- package/dist/components/UTBaseInputField/components/IconAdornment/index.js +48 -0
- package/dist/components/UTBaseInputField/components/IconAdornment/utils.js +17 -0
- package/dist/components/UTBaseInputField/components/PrefixAdornment/index.js +24 -0
- package/dist/components/UTBaseInputField/components/SuffixAdornment/index.js +22 -0
- package/dist/components/UTBaseInputField/components/TooltipAdornment/index.js +29 -0
- package/dist/components/UTBaseInputField/components/TooltipAdornment/styles.module.scss +3 -0
- package/dist/components/UTBaseInputField/index.js +169 -0
- package/dist/components/UTBaseInputField/styles.module.scss +29 -0
- package/dist/components/UTBaseInputField/theme.js +97 -0
- package/dist/components/UTButtonGroup/index.js +2 -0
- package/dist/components/UTCBUInput/index.js +21 -18
- package/dist/components/UTCard/index.js +6 -2
- package/dist/components/UTCheckbox/index.js +8 -0
- package/dist/components/UTCuit/index.js +51 -27
- package/dist/components/UTGoogleAutocomplete/index.js +2 -0
- package/dist/components/UTLabel/index.js +4 -1
- package/dist/components/UTOnboarding/index.js +15 -0
- package/dist/components/UTPasswordField/versions/V0/index.js +3 -0
- package/dist/components/UTPhoneInput/index.js +16 -277
- package/dist/components/UTPhoneInput/versions/V0/index.js +297 -0
- package/dist/components/UTPhoneInput/{styles.module.scss → versions/V0/styles.module.scss} +10 -10
- package/dist/components/UTPhoneInput/{theme.js → versions/V0/theme.js} +1 -1
- package/dist/components/UTPhoneInput/versions/V1/README.md +57 -0
- package/dist/components/UTPhoneInput/versions/V1/constants.js +910 -0
- package/dist/components/UTPhoneInput/versions/V1/index.js +166 -0
- package/dist/components/UTPhoneInput/versions/V1/styles.module.scss +20 -0
- package/dist/components/UTStatus/index.js +3 -0
- package/dist/components/UTTable/index.js +4 -1
- package/dist/components/UTTextArea/versions/V0/index.js +3 -0
- package/dist/components/UTTextInput/versions/V0/index.js +5 -0
- package/dist/components/UTTextInput/versions/V1/README.md +1 -1
- package/dist/components/UTTextInput/versions/V1/index.js +30 -87
- package/dist/components/UTTextInput/versions/V1/styles.module.scss +0 -24
- package/dist/constants/inputs.js +10 -0
- package/dist/types/googleMapsTypes.js +1 -0
- package/package.json +3 -2
- /package/dist/components/UTPhoneInput/{constants.js → versions/V0/constants.js} +0 -0
|
@@ -0,0 +1,166 @@
|
|
|
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 _propTypes = require("prop-types");
|
|
9
|
+
var _utils = require("../../../UTValidation/utils");
|
|
10
|
+
var _inputs = require("../../../../constants/inputs");
|
|
11
|
+
var _UTBaseInputField = _interopRequireDefault(require("../../../UTBaseInputField"));
|
|
12
|
+
var _UTFieldLabel = _interopRequireDefault(require("../../../UTFieldLabel"));
|
|
13
|
+
var _UTLabel = _interopRequireDefault(require("../../../UTLabel"));
|
|
14
|
+
var _UTValidation = _interopRequireWildcard(require("../../../UTValidation"));
|
|
15
|
+
var _constants = require("./constants");
|
|
16
|
+
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
17
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
19
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
20
|
+
const UTPhoneInput = _ref => {
|
|
21
|
+
let {
|
|
22
|
+
areaCodePlaceholder,
|
|
23
|
+
countryCode,
|
|
24
|
+
areaCodeDataTestId,
|
|
25
|
+
phoneNumberDataTestId,
|
|
26
|
+
disabled,
|
|
27
|
+
error,
|
|
28
|
+
helpText,
|
|
29
|
+
maxLength = 10,
|
|
30
|
+
onBlur,
|
|
31
|
+
onChange,
|
|
32
|
+
onFocus,
|
|
33
|
+
placeholder,
|
|
34
|
+
readOnly,
|
|
35
|
+
required,
|
|
36
|
+
RightIcon,
|
|
37
|
+
title,
|
|
38
|
+
titleVariant,
|
|
39
|
+
translations = {
|
|
40
|
+
areaCodeWithoutZeroError: 'Ingrese el código sin 0',
|
|
41
|
+
invalidAreaCodeError: 'Código de área inválido'
|
|
42
|
+
},
|
|
43
|
+
validations,
|
|
44
|
+
value,
|
|
45
|
+
withAreaCode = true
|
|
46
|
+
} = _ref;
|
|
47
|
+
const [areaCode, setAreaCode] = (0, _react.useState)('');
|
|
48
|
+
const [phoneNumber, setPhoneNumber] = (0, _react.useState)('');
|
|
49
|
+
const [areaCodeError, setAreaCodeError] = (0, _react.useState)('');
|
|
50
|
+
const [isValidCode, setIsValidCode] = (0, _react.useState)(false);
|
|
51
|
+
(0, _react.useEffect)(() => {
|
|
52
|
+
if (value && withAreaCode) {
|
|
53
|
+
const [code, phone] = value.split('-');
|
|
54
|
+
setAreaCode(code || '');
|
|
55
|
+
setPhoneNumber(phone || '');
|
|
56
|
+
} else if (value && !withAreaCode) {
|
|
57
|
+
setPhoneNumber(value);
|
|
58
|
+
}
|
|
59
|
+
}, [value, withAreaCode]);
|
|
60
|
+
(0, _react.useEffect)(() => {
|
|
61
|
+
const {
|
|
62
|
+
areaCodeWithoutZeroError,
|
|
63
|
+
invalidAreaCodeError
|
|
64
|
+
} = translations;
|
|
65
|
+
if (areaCode) {
|
|
66
|
+
if (areaCode.startsWith('0')) {
|
|
67
|
+
setAreaCodeError(areaCodeWithoutZeroError);
|
|
68
|
+
setIsValidCode(false);
|
|
69
|
+
} else {
|
|
70
|
+
const code = _constants.AREA_CODES.find(element => element.code === areaCode);
|
|
71
|
+
setIsValidCode(!!code);
|
|
72
|
+
setAreaCodeError(!code ? invalidAreaCodeError : '');
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}, [areaCode, translations]);
|
|
76
|
+
const handleChangeAreaCode = (0, _react.useCallback)(areaCodeValue => {
|
|
77
|
+
setAreaCode(areaCodeValue);
|
|
78
|
+
}, []);
|
|
79
|
+
const handleChangePhoneNumber = (0, _react.useCallback)(phoneNumberValue => {
|
|
80
|
+
setPhoneNumber(phoneNumberValue);
|
|
81
|
+
}, []);
|
|
82
|
+
(0, _react.useEffect)(() => {
|
|
83
|
+
if (areaCode !== '' || phoneNumber !== '') {
|
|
84
|
+
const newValue = withAreaCode ? "".concat(areaCode, "-").concat(phoneNumber) : phoneNumber;
|
|
85
|
+
if (newValue !== value) {
|
|
86
|
+
onChange(newValue);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}, [areaCode, phoneNumber, withAreaCode, onChange, value]);
|
|
90
|
+
const validationData = validations || areaCodeError && (0, _utils.formatErrorToValidation)(areaCodeError) || error && (0, _utils.formatErrorToValidation)(error);
|
|
91
|
+
const hasError = (validationData === null || validationData === void 0 ? void 0 : validationData.length) > 0;
|
|
92
|
+
const titleColorTheme = readOnly ? 'gray' : 'dark';
|
|
93
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
94
|
+
className: _stylesModule.default.container
|
|
95
|
+
}, title && /*#__PURE__*/_react.default.createElement(_UTFieldLabel.default, {
|
|
96
|
+
colorTheme: titleColorTheme,
|
|
97
|
+
required: required,
|
|
98
|
+
variant: _inputs.TITLE_VARIANTS[titleVariant]
|
|
99
|
+
}, title), /*#__PURE__*/_react.default.createElement("div", {
|
|
100
|
+
className: _stylesModule.default.inputsContainer
|
|
101
|
+
}, withAreaCode && /*#__PURE__*/_react.default.createElement("div", {
|
|
102
|
+
className: _stylesModule.default.areaCodeContainer
|
|
103
|
+
}, /*#__PURE__*/_react.default.createElement(_UTBaseInputField.default, {
|
|
104
|
+
type: "numeric",
|
|
105
|
+
alwaysShowPlaceholder: true,
|
|
106
|
+
dataTestId: areaCodeDataTestId,
|
|
107
|
+
disabled: disabled,
|
|
108
|
+
error: hasError,
|
|
109
|
+
maxLength: 4,
|
|
110
|
+
onBlur: onBlur,
|
|
111
|
+
onChange: handleChangeAreaCode,
|
|
112
|
+
onFocus: onFocus,
|
|
113
|
+
placeholder: areaCodePlaceholder,
|
|
114
|
+
readOnly: readOnly,
|
|
115
|
+
RightIcon: RightIcon,
|
|
116
|
+
value: areaCode
|
|
117
|
+
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
118
|
+
className: _stylesModule.default.phoneContainer
|
|
119
|
+
}, /*#__PURE__*/_react.default.createElement(_UTBaseInputField.default, {
|
|
120
|
+
type: "numeric",
|
|
121
|
+
alwaysShowPlaceholder: true,
|
|
122
|
+
dataTestId: phoneNumberDataTestId,
|
|
123
|
+
disabled: withAreaCode && !isValidCode || disabled || readOnly,
|
|
124
|
+
error: hasError && !areaCodeError,
|
|
125
|
+
maxLength: withAreaCode ? maxLength - ((areaCode === null || areaCode === void 0 ? void 0 : areaCode.length) || 0) : maxLength,
|
|
126
|
+
onBlur: onBlur,
|
|
127
|
+
onChange: handleChangePhoneNumber,
|
|
128
|
+
onFocus: onFocus,
|
|
129
|
+
placeholder: placeholder,
|
|
130
|
+
prefix: countryCode,
|
|
131
|
+
RightIcon: RightIcon,
|
|
132
|
+
value: phoneNumber
|
|
133
|
+
}))), helpText && /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
134
|
+
colorTheme: "gray",
|
|
135
|
+
variant: "small"
|
|
136
|
+
}, helpText), validationData && /*#__PURE__*/_react.default.createElement(_UTValidation.default, {
|
|
137
|
+
validationData: validationData
|
|
138
|
+
}));
|
|
139
|
+
};
|
|
140
|
+
UTPhoneInput.propTypes = {
|
|
141
|
+
areaCodeDataTestId: _propTypes.string,
|
|
142
|
+
areaCodePlaceholder: _propTypes.string,
|
|
143
|
+
countryCode: _propTypes.string,
|
|
144
|
+
disabled: _propTypes.bool,
|
|
145
|
+
error: _propTypes.string,
|
|
146
|
+
helpText: _propTypes.string,
|
|
147
|
+
maxLength: _propTypes.number,
|
|
148
|
+
onBlur: _propTypes.func,
|
|
149
|
+
onChange: _propTypes.func,
|
|
150
|
+
onFocus: _propTypes.func,
|
|
151
|
+
phoneNumberDataTestId: _propTypes.string,
|
|
152
|
+
placeholder: _propTypes.string,
|
|
153
|
+
readOnly: _propTypes.bool,
|
|
154
|
+
required: _propTypes.bool,
|
|
155
|
+
RightIcon: _propTypes.elementType,
|
|
156
|
+
title: _propTypes.string,
|
|
157
|
+
titleVariant: _propTypes.string,
|
|
158
|
+
translations: (0, _propTypes.shape)({
|
|
159
|
+
areaCodeWithoutZeroError: _propTypes.string,
|
|
160
|
+
invalidAreaCodeError: _propTypes.string
|
|
161
|
+
}),
|
|
162
|
+
validations: _UTValidation.validationDataProptypes,
|
|
163
|
+
value: _propTypes.string,
|
|
164
|
+
withAreaCode: _propTypes.bool
|
|
165
|
+
};
|
|
166
|
+
var _default = exports.default = UTPhoneInput;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
.container {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
grid-gap: 12px;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.inputsContainer {
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: flex-start;
|
|
10
|
+
flex-direction: row;
|
|
11
|
+
grid-gap: 8px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.areaCodeContainer {
|
|
15
|
+
width: 110px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.phoneContainer {
|
|
19
|
+
width: 209px;
|
|
20
|
+
}
|
|
@@ -20,6 +20,7 @@ const UTStatus = _ref => {
|
|
|
20
20
|
classes,
|
|
21
21
|
className,
|
|
22
22
|
Icon,
|
|
23
|
+
labelDataTestId,
|
|
23
24
|
size,
|
|
24
25
|
title,
|
|
25
26
|
type,
|
|
@@ -34,6 +35,7 @@ const UTStatus = _ref => {
|
|
|
34
35
|
className: classes.icon
|
|
35
36
|
}), /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
36
37
|
className: classes.label,
|
|
38
|
+
dataTestId: labelDataTestId,
|
|
37
39
|
variant: _constants.SIZES[size] || _constants.SIZES[_constants.DEFAULT_PROPS.size],
|
|
38
40
|
colorTheme: (0, _theme.getLabelTheme)((0, _theme.validateProps)({
|
|
39
41
|
type,
|
|
@@ -47,6 +49,7 @@ UTStatus.propTypes = {
|
|
|
47
49
|
classes: (0, _propTypes.objectOf)(_propTypes.string),
|
|
48
50
|
className: _propTypes.string,
|
|
49
51
|
Icon: _propTypes.elementType,
|
|
52
|
+
labelDataTestId: _propTypes.string,
|
|
50
53
|
size: _propTypes.string,
|
|
51
54
|
title: _propTypes.string,
|
|
52
55
|
type: _propTypes.string,
|
|
@@ -57,6 +57,7 @@ const UTTable = _ref => {
|
|
|
57
57
|
initialSelectedRows = [],
|
|
58
58
|
integrationType = _UTTable.INTEGRATION_TYPES.INTERNAL,
|
|
59
59
|
loading,
|
|
60
|
+
noResultDataTestId,
|
|
60
61
|
noResultsLabel = _constants.NO_RESULTS_LABEL,
|
|
61
62
|
onOrderChange,
|
|
62
63
|
onPageChange,
|
|
@@ -199,7 +200,8 @@ const UTTable = _ref => {
|
|
|
199
200
|
width: tableWidth
|
|
200
201
|
}
|
|
201
202
|
}, /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
202
|
-
className: classes.noResultsLabel
|
|
203
|
+
className: classes.noResultsLabel,
|
|
204
|
+
dataTestId: noResultDataTestId
|
|
203
205
|
}, noResultsLabel)) : currentRows.map((row, index) => {
|
|
204
206
|
const isSelected = selectedRows.includes(row[rowKey]);
|
|
205
207
|
const selectedClassNames = isSelected ? classes.selectedRow : rowSpacing === _constants.ROW_SPACING_NAMES.NONE && index < currentRows.length - 1 ? _stylesModule.default.unselectedSmallRow : undefined;
|
|
@@ -336,6 +338,7 @@ UTTable.propTypes = {
|
|
|
336
338
|
initialSelectedRows: (0, _propTypes.arrayOf)((0, _propTypes.oneOfType)([_propTypes.number, _propTypes.string])),
|
|
337
339
|
integrationType: (0, _propTypes.oneOf)([...Object.values(_UTTable.INTEGRATION_TYPES)]),
|
|
338
340
|
loading: _propTypes.bool,
|
|
341
|
+
noResultDataTestId: _propTypes.string,
|
|
339
342
|
noResultsLabel: _propTypes.string,
|
|
340
343
|
onOrderChange: _propTypes.func,
|
|
341
344
|
onPageChange: _propTypes.func,
|
|
@@ -21,6 +21,7 @@ const UTTextArea = _ref => {
|
|
|
21
21
|
let {
|
|
22
22
|
classes,
|
|
23
23
|
classNames = {},
|
|
24
|
+
dataTestId,
|
|
24
25
|
disabled,
|
|
25
26
|
field,
|
|
26
27
|
HelpIcon,
|
|
@@ -62,6 +63,7 @@ const UTTextArea = _ref => {
|
|
|
62
63
|
className: _stylesModule.default.componentWrapper
|
|
63
64
|
}, /*#__PURE__*/_react.default.createElement("textarea", _extends({}, inputProps, {
|
|
64
65
|
className: "".concat(_stylesModule.default.textarea, " ").concat(textarea, " ").concat(classes.textarea),
|
|
66
|
+
"data-testid": dataTestId,
|
|
65
67
|
onChange: handleOnChange,
|
|
66
68
|
onBlur: onBlur,
|
|
67
69
|
onFocus: onFocus,
|
|
@@ -87,6 +89,7 @@ UTTextArea.propTypes = {
|
|
|
87
89
|
textarea: _propTypes.string,
|
|
88
90
|
textAreaContainer: _propTypes.string
|
|
89
91
|
}),
|
|
92
|
+
dataTestId: _propTypes.string,
|
|
90
93
|
disabled: _propTypes.bool,
|
|
91
94
|
field: _formTypes.fieldType,
|
|
92
95
|
HelpIcon: _propTypes.elementType,
|
|
@@ -52,6 +52,7 @@ class UTTextInput extends _react.PureComponent {
|
|
|
52
52
|
captionLabel,
|
|
53
53
|
classes,
|
|
54
54
|
containerClassName,
|
|
55
|
+
dataTestId,
|
|
55
56
|
disabled,
|
|
56
57
|
field,
|
|
57
58
|
id,
|
|
@@ -141,6 +142,9 @@ class UTTextInput extends _react.PureComponent {
|
|
|
141
142
|
autoComplete: "off",
|
|
142
143
|
InputProps: {
|
|
143
144
|
id: fieldId,
|
|
145
|
+
inputProps: {
|
|
146
|
+
'data-testid': dataTestId
|
|
147
|
+
},
|
|
144
148
|
endAdornment: endAction && /*#__PURE__*/_react.default.createElement(_InputAdornment.default, {
|
|
145
149
|
position: "end",
|
|
146
150
|
className: "".concat(adornmentInside && _stylesModule.default.adornmentInside)
|
|
@@ -178,6 +182,7 @@ UTTextInput.propTypes = {
|
|
|
178
182
|
captionLabel: _propTypes.string,
|
|
179
183
|
classes: (0, _propTypes.objectOf)(_propTypes.string),
|
|
180
184
|
containerClassName: _propTypes.string,
|
|
185
|
+
dataTestId: _propTypes.string,
|
|
181
186
|
disabled: _propTypes.bool,
|
|
182
187
|
field: _propTypes.object,
|
|
183
188
|
id: _propTypes.string,
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
| alwaysShowPlaceholder | bool | false | Whether the placeholder should always be displayed, even when the input is focused. |
|
|
13
13
|
| blurOnSubmit | bool | false | Whether the input should lose focus after submitting (e.g., after pressing "Enter"). |
|
|
14
14
|
| classNames | objectOf(string) | | Additional classes for customizing the component, independent of Material-UI. |
|
|
15
|
+
| dataTestId | string | | Identifier for the input field, useful for testing purposes. |
|
|
15
16
|
| disabled | bool | false | Disables the input field. |
|
|
16
17
|
| error | string | | Error message displayed below the input field. |
|
|
17
18
|
| helpText | string | | Help text displayed below the input field. |
|
|
@@ -23,7 +24,6 @@
|
|
|
23
24
|
| onBlur | func | | Function called when the input field loses focus. |
|
|
24
25
|
| onChange | func | | Function called when the input field value changes. |
|
|
25
26
|
| onFocus | func | | Function called when the input field gains focus. |
|
|
26
|
-
| onSubmitEditing | func | | Function called when the input field is submitted (e.g., pressing Enter on a keyboard). |
|
|
27
27
|
| placeholder | string | | Placeholder text displayed when the input field is empty. |
|
|
28
28
|
| prefix | string | | Text displayed before the entered value in the input field. |
|
|
29
29
|
| readOnly | bool | false | Makes the input field read-only. |
|
|
@@ -6,20 +6,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.propTypes = exports.default = void 0;
|
|
7
7
|
var _propTypes = require("prop-types");
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
var _TextField = _interopRequireDefault(require("@material-ui/core/TextField"));
|
|
10
9
|
var _utils = require("../../../UTValidation/utils");
|
|
11
|
-
var
|
|
12
|
-
var
|
|
10
|
+
var _inputs = require("../../../../constants/inputs.js");
|
|
11
|
+
var _UTBaseInputField = _interopRequireDefault(require("../../../UTBaseInputField"));
|
|
13
12
|
var _UTFieldLabel = _interopRequireDefault(require("../../../UTFieldLabel"));
|
|
14
13
|
var _UTLabel = _interopRequireDefault(require("../../../UTLabel"));
|
|
15
|
-
var
|
|
16
|
-
var _theme = require("./theme");
|
|
17
|
-
var _ActionAdornment = _interopRequireDefault(require("./components/ActionAdornment"));
|
|
18
|
-
var _IconAdornment = _interopRequireDefault(require("./components/IconAdornment"));
|
|
19
|
-
var _PrefixAdornment = _interopRequireDefault(require("./components/PrefixAdornment"));
|
|
14
|
+
var _UTValidation = _interopRequireWildcard(require("../../../UTValidation"));
|
|
20
15
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
21
|
-
var _SuffixAdornment = _interopRequireDefault(require("./components/SuffixAdornment"));
|
|
22
|
-
var _TooltipAdornment = _interopRequireDefault(require("./components/TooltipAdornment"));
|
|
23
16
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
24
17
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
25
18
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -27,12 +20,13 @@ const UTTextInput = _ref => {
|
|
|
27
20
|
let {
|
|
28
21
|
action,
|
|
29
22
|
alwaysShowPlaceholder,
|
|
30
|
-
classes: theme,
|
|
31
23
|
classNames = {},
|
|
24
|
+
dataTestId,
|
|
32
25
|
disabled,
|
|
33
26
|
error,
|
|
34
27
|
helpText,
|
|
35
28
|
id,
|
|
29
|
+
inputSize,
|
|
36
30
|
LeftIcon,
|
|
37
31
|
maxLength,
|
|
38
32
|
maxRows = 1,
|
|
@@ -53,90 +47,38 @@ const UTTextInput = _ref => {
|
|
|
53
47
|
validations,
|
|
54
48
|
value = null
|
|
55
49
|
} = _ref;
|
|
56
|
-
const classes = (0, _react.useMemo)(() => (0, _classesUtils.mergeClasses)(theme, classNames), [classNames, theme]);
|
|
57
|
-
const [focused, setFocused] = (0, _react.useState)(false);
|
|
58
|
-
const handleFocus = event => {
|
|
59
|
-
setFocused(true);
|
|
60
|
-
onFocus === null || onFocus === void 0 || onFocus(event);
|
|
61
|
-
};
|
|
62
|
-
const handleBlur = event => {
|
|
63
|
-
setFocused(false);
|
|
64
|
-
onBlur === null || onBlur === void 0 || onBlur(event);
|
|
65
|
-
};
|
|
66
|
-
const handleChange = event => {
|
|
67
|
-
onChange === null || onChange === void 0 || onChange(event.target.value);
|
|
68
|
-
};
|
|
69
50
|
const titleColorTheme = readOnly ? 'gray' : 'dark';
|
|
70
|
-
const titleComponentVariant = titleVariant === 'small' ? 'small' : 'body';
|
|
71
|
-
const shouldShowPlaceholder = alwaysShowPlaceholder || focused;
|
|
72
51
|
const validationData = (0, _react.useMemo)(() => validations || error && (0, _utils.formatErrorToValidation)(error), [error, validations]);
|
|
73
|
-
const multiline = maxRows > 1;
|
|
74
|
-
const hasStartAdornments = LeftIcon || prefix;
|
|
75
|
-
const hasCharactersCount = showCharacterCount && maxLength && !disabled && !readOnly;
|
|
76
|
-
const hasEndAdornments = suffix || RightIcon || action || tooltip || error;
|
|
77
52
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
78
|
-
className: "".concat(_stylesModule.default.container, " ").concat(
|
|
53
|
+
className: "".concat(_stylesModule.default.container, " ").concat(classNames.container)
|
|
79
54
|
}, title && /*#__PURE__*/_react.default.createElement(_UTFieldLabel.default, {
|
|
80
55
|
colorTheme: titleColorTheme,
|
|
81
|
-
variant:
|
|
56
|
+
variant: _inputs.TITLE_VARIANTS[titleVariant],
|
|
82
57
|
required: required
|
|
83
|
-
}, title), /*#__PURE__*/_react.default.createElement(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
,
|
|
87
|
-
|
|
58
|
+
}, title), /*#__PURE__*/_react.default.createElement(_UTBaseInputField.default, {
|
|
59
|
+
action: action,
|
|
60
|
+
alwaysShowPlaceholder: alwaysShowPlaceholder,
|
|
61
|
+
classNames: classNames,
|
|
62
|
+
dataTestId: dataTestId,
|
|
63
|
+
disabled: disabled,
|
|
88
64
|
error: error,
|
|
89
65
|
id: id,
|
|
66
|
+
inputSize: inputSize,
|
|
67
|
+
LeftIcon: LeftIcon,
|
|
68
|
+
maxLength: maxLength,
|
|
90
69
|
maxRows: maxRows,
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
70
|
+
onBlur: onBlur,
|
|
71
|
+
onChange: onChange,
|
|
72
|
+
onFocus: onFocus,
|
|
73
|
+
placeholder: placeholder,
|
|
74
|
+
prefix: prefix,
|
|
75
|
+
readOnly: readOnly,
|
|
76
|
+
RightIcon: RightIcon,
|
|
77
|
+
showCharacterCount: showCharacterCount,
|
|
78
|
+
suffix: suffix,
|
|
79
|
+
tooltip: tooltip,
|
|
97
80
|
type: type,
|
|
98
|
-
value: value
|
|
99
|
-
variant: "outlined",
|
|
100
|
-
InputProps: {
|
|
101
|
-
inputProps: {
|
|
102
|
-
maxLength
|
|
103
|
-
},
|
|
104
|
-
classes: {
|
|
105
|
-
notchedOutline: "".concat(classes.inputContainer, " ").concat(focused && classes.focusedInputContainer),
|
|
106
|
-
adornedStart: _stylesModule.default.elementsContainer,
|
|
107
|
-
adornedEnd: _stylesModule.default.elementsContainer,
|
|
108
|
-
input: classes.input,
|
|
109
|
-
root: classes.root
|
|
110
|
-
},
|
|
111
|
-
startAdornment: hasStartAdornments ? /*#__PURE__*/_react.default.createElement("div", {
|
|
112
|
-
className: _stylesModule.default.adornmentsContainer
|
|
113
|
-
}, LeftIcon && /*#__PURE__*/_react.default.createElement(_IconAdornment.default, {
|
|
114
|
-
Icon: LeftIcon
|
|
115
|
-
}), prefix && /*#__PURE__*/_react.default.createElement(_PrefixAdornment.default, {
|
|
116
|
-
text: prefix
|
|
117
|
-
})) : hasCharactersCount && /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
118
|
-
className: classes.charactersCount,
|
|
119
|
-
colorTheme: "gray",
|
|
120
|
-
variant: "small"
|
|
121
|
-
}, (value === null || value === void 0 ? void 0 : value.length) || 0, "/", maxLength),
|
|
122
|
-
endAdornment: hasEndAdornments && /*#__PURE__*/_react.default.createElement("div", {
|
|
123
|
-
className: "".concat(_stylesModule.default.adornmentsContainer, " ").concat(multiline && _stylesModule.default.multilineAdornmentsContainer)
|
|
124
|
-
}, suffix && /*#__PURE__*/_react.default.createElement(_SuffixAdornment.default, {
|
|
125
|
-
text: suffix
|
|
126
|
-
}), RightIcon && /*#__PURE__*/_react.default.createElement(_IconAdornment.default, {
|
|
127
|
-
changeOnError: true,
|
|
128
|
-
error: error,
|
|
129
|
-
Icon: RightIcon
|
|
130
|
-
}), action && /*#__PURE__*/_react.default.createElement(_ActionAdornment.default, {
|
|
131
|
-
action: action,
|
|
132
|
-
classNames: {
|
|
133
|
-
root: _stylesModule.default.actionButton
|
|
134
|
-
},
|
|
135
|
-
disabled: disabled && !readOnly
|
|
136
|
-
}), tooltip && /*#__PURE__*/_react.default.createElement(_TooltipAdornment.default, {
|
|
137
|
-
tooltip: tooltip
|
|
138
|
-
}))
|
|
139
|
-
}
|
|
81
|
+
value: value
|
|
140
82
|
}), helpText && /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
141
83
|
colorTheme: "gray",
|
|
142
84
|
variant: "small"
|
|
@@ -147,12 +89,13 @@ const UTTextInput = _ref => {
|
|
|
147
89
|
const propTypes = exports.propTypes = {
|
|
148
90
|
action: _propTypes.elementType,
|
|
149
91
|
alwaysShowPlaceholder: _propTypes.bool,
|
|
150
|
-
classes: (0, _propTypes.objectOf)(_propTypes.string),
|
|
151
92
|
classNames: (0, _propTypes.objectOf)(_propTypes.string),
|
|
93
|
+
dataTestId: _propTypes.string,
|
|
152
94
|
disabled: _propTypes.bool,
|
|
153
95
|
error: _propTypes.bool,
|
|
154
96
|
helpText: _propTypes.string,
|
|
155
97
|
id: _propTypes.string,
|
|
98
|
+
inputSize: _propTypes.string,
|
|
156
99
|
LeftIcon: _propTypes.elementType,
|
|
157
100
|
maxLength: _propTypes.number,
|
|
158
101
|
maxRows: _propTypes.number,
|
|
@@ -174,4 +117,4 @@ const propTypes = exports.propTypes = {
|
|
|
174
117
|
value: _propTypes.string
|
|
175
118
|
};
|
|
176
119
|
UTTextInput.propTypes = propTypes;
|
|
177
|
-
var _default = exports.default =
|
|
120
|
+
var _default = exports.default = UTTextInput;
|
|
@@ -1,29 +1,5 @@
|
|
|
1
|
-
.actionButton {
|
|
2
|
-
margin: -4px !important;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.adornmentsContainer {
|
|
6
|
-
align-items: center;
|
|
7
|
-
display: flex;
|
|
8
|
-
flex-shrink: 0;
|
|
9
|
-
grid-gap: 16px;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
1
|
.container {
|
|
13
2
|
display: flex;
|
|
14
3
|
flex-direction: column;
|
|
15
4
|
grid-gap: 8px;
|
|
16
5
|
}
|
|
17
|
-
|
|
18
|
-
.elementsContainer {
|
|
19
|
-
grid-gap: 16px;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.multilineAdornmentsContainer {
|
|
23
|
-
place-self: start;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.startAdornments {
|
|
27
|
-
display: flex;
|
|
28
|
-
flex-direction: column;
|
|
29
|
-
}
|
|
@@ -41,6 +41,7 @@ const UTGoogleAutocompletePropTypes = exports.UTGoogleAutocompletePropTypes = {
|
|
|
41
41
|
alert: _propTypes.string,
|
|
42
42
|
apikey: _propTypes.string,
|
|
43
43
|
classes: (0, _propTypes.objectOf)(_propTypes.string),
|
|
44
|
+
dataTestId: _propTypes.string,
|
|
44
45
|
detailErrorLabel: _propTypes.string,
|
|
45
46
|
inputProps: _propTypes.object,
|
|
46
47
|
minChar: _propTypes.number,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@widergy/energy-ui",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.26.0",
|
|
4
4
|
"description": "Widergy Web Components",
|
|
5
5
|
"author": "widergy",
|
|
6
6
|
"license": "MIT",
|
|
@@ -92,7 +92,8 @@
|
|
|
92
92
|
},
|
|
93
93
|
"resolutions": {
|
|
94
94
|
"@babel/preset-env": "^7.8.7",
|
|
95
|
-
"caniuse-lite": "1.0.30001632"
|
|
95
|
+
"caniuse-lite": "1.0.30001632",
|
|
96
|
+
"react-error-overlay": "6.0.9"
|
|
96
97
|
},
|
|
97
98
|
"browserslist": [
|
|
98
99
|
">0.2%",
|
|
File without changes
|