@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
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [3.26.0](https://github.com/widergy/energy-ui/compare/v3.25.0...v3.26.0) (2024-10-08)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* button, label and input test-id ([#498](https://github.com/widergy/energy-ui/issues/498)) ([9ba23dc](https://github.com/widergy/energy-ui/commit/9ba23dc19ec632ee02dca97f1fa6c5a8f7bdd582))
|
|
7
|
+
|
|
8
|
+
# [3.25.0](https://github.com/widergy/energy-ui/compare/v3.24.0...v3.25.0) (2024-10-07)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* add UTPhoneInput ([#503](https://github.com/widergy/energy-ui/issues/503)) ([c8e1cc8](https://github.com/widergy/energy-ui/commit/c8e1cc8618899fdd7cc5268698296df2a7130dae))
|
|
14
|
+
|
|
1
15
|
# [3.24.0](https://github.com/widergy/energy-ui/compare/v3.23.0...v3.24.0) (2024-10-07)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -24,6 +24,7 @@ const BottomActions = _ref => {
|
|
|
24
24
|
}, actions.map(_ref2 => {
|
|
25
25
|
let {
|
|
26
26
|
colorTheme = 'primary',
|
|
27
|
+
dataTestId,
|
|
27
28
|
disabled,
|
|
28
29
|
Icon,
|
|
29
30
|
label,
|
|
@@ -37,6 +38,7 @@ const BottomActions = _ref => {
|
|
|
37
38
|
text: "".concat(type === _constants.ACTION_TYPES.REDIRECTION ? _stylesModule.default.redirectionText : _stylesModule.default.defaultText)
|
|
38
39
|
},
|
|
39
40
|
colorTheme: colorTheme,
|
|
41
|
+
dataTestId: dataTestId,
|
|
40
42
|
disabled: disabled,
|
|
41
43
|
Icon: type === _constants.ACTION_TYPES.REDIRECTION ? 'IconChevronRight' : Icon,
|
|
42
44
|
iconPlacement: type === _constants.ACTION_TYPES.REDIRECTION ? 'right' : 'left',
|
|
@@ -51,6 +53,7 @@ const BottomActions = _ref => {
|
|
|
51
53
|
BottomActions.propTypes = {
|
|
52
54
|
actions: (0, _propTypes.arrayOf)((0, _propTypes.shape)({
|
|
53
55
|
colorTheme: _propTypes.string,
|
|
56
|
+
dataTestId: _propTypes.string,
|
|
54
57
|
disabled: _propTypes.bool,
|
|
55
58
|
Icon: (0, _propTypes.oneOfType)([_propTypes.elementType, _propTypes.string]),
|
|
56
59
|
label: _propTypes.string,
|
|
@@ -27,6 +27,7 @@ const UTAutocomplete = _ref => {
|
|
|
27
27
|
ArrowIcon,
|
|
28
28
|
autocompleteProps,
|
|
29
29
|
classes = {},
|
|
30
|
+
dataTestId,
|
|
30
31
|
disabled,
|
|
31
32
|
field,
|
|
32
33
|
fixedSizeListProps,
|
|
@@ -103,6 +104,9 @@ const UTAutocomplete = _ref => {
|
|
|
103
104
|
colorTheme: "error",
|
|
104
105
|
variant: "small"
|
|
105
106
|
}, errorMessage) : undefined,
|
|
107
|
+
inputProps: {
|
|
108
|
+
'data-testid': dataTestId
|
|
109
|
+
},
|
|
106
110
|
placeholder: placeholder,
|
|
107
111
|
variant: variant
|
|
108
112
|
}, textFieldProps))
|
|
@@ -112,6 +116,7 @@ UTAutocomplete.propTypes = {
|
|
|
112
116
|
ArrowIcon: _propTypes.elementType,
|
|
113
117
|
autocompleteProps: _propTypes.object,
|
|
114
118
|
classes: (0, _propTypes.objectOf)(_propTypes.string),
|
|
119
|
+
dataTestId: _propTypes.string,
|
|
115
120
|
disabled: _propTypes.bool,
|
|
116
121
|
input: _formTypes.inputPropTypes.isRequired,
|
|
117
122
|
field: _formTypes.fieldType,
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _propTypes = require("prop-types");
|
|
9
|
+
var _UTButton = _interopRequireDefault(require("../../../UTButton"));
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
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); }
|
|
12
|
+
const ActionAdornment = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
action = {},
|
|
15
|
+
disabled,
|
|
16
|
+
classNames
|
|
17
|
+
} = _ref;
|
|
18
|
+
if (!action) return null;
|
|
19
|
+
return /*#__PURE__*/_react.default.createElement(_UTButton.default, _extends({
|
|
20
|
+
disabled: disabled,
|
|
21
|
+
classNames: classNames,
|
|
22
|
+
variant: "text",
|
|
23
|
+
size: "small"
|
|
24
|
+
}, action), action.text);
|
|
25
|
+
};
|
|
26
|
+
ActionAdornment.propTypes = {
|
|
27
|
+
action: _propTypes.object,
|
|
28
|
+
classNames: (0, _propTypes.objectOf)(_propTypes.string),
|
|
29
|
+
disabled: _propTypes.bool
|
|
30
|
+
};
|
|
31
|
+
var _default = exports.default = ActionAdornment;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _propTypes = require("prop-types");
|
|
9
|
+
var _UTIcon = _interopRequireDefault(require("../../../UTIcon"));
|
|
10
|
+
var _componentUtils = require("../../../../utils/componentUtils");
|
|
11
|
+
var _constants = require("./constants");
|
|
12
|
+
var _utils = require("./utils");
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
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); }
|
|
15
|
+
const IconAdornment = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
changeOnError = false,
|
|
18
|
+
changeOnFocus = false,
|
|
19
|
+
colorTheme,
|
|
20
|
+
error,
|
|
21
|
+
focused,
|
|
22
|
+
Icon,
|
|
23
|
+
inputStyle,
|
|
24
|
+
shade
|
|
25
|
+
} = _ref;
|
|
26
|
+
const IconToRender = error && changeOnError ? _constants.ERROR_ICON : Icon;
|
|
27
|
+
if (!IconToRender) return null;
|
|
28
|
+
return (0, _componentUtils.isUTIcon)(IconToRender) ? /*#__PURE__*/_react.default.createElement(_UTIcon.default, _extends({
|
|
29
|
+
name: IconToRender,
|
|
30
|
+
size: _constants.ICON_SIZE
|
|
31
|
+
}, (0, _utils.getIconColorProps)(changeOnError, changeOnFocus, colorTheme, error, focused, shade))) : /*#__PURE__*/_react.default.createElement(Icon, {
|
|
32
|
+
size: _constants.ICON_SIZE,
|
|
33
|
+
fill: inputStyle.root.color
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
IconAdornment.propTypes = {
|
|
37
|
+
changeOnError: _propTypes.bool,
|
|
38
|
+
changeOnFocus: _propTypes.bool,
|
|
39
|
+
colorTheme: _propTypes.string,
|
|
40
|
+
error: (0, _propTypes.oneOfType)([_propTypes.bool, _propTypes.string]),
|
|
41
|
+
focused: _propTypes.bool,
|
|
42
|
+
Icon: _propTypes.elementType,
|
|
43
|
+
inputStyle: (0, _propTypes.shape)({
|
|
44
|
+
root: _propTypes.object
|
|
45
|
+
}),
|
|
46
|
+
shade: _propTypes.string
|
|
47
|
+
};
|
|
48
|
+
var _default = exports.default = IconAdornment;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getIconColorProps = void 0;
|
|
7
|
+
const getIconColorProps = (changeOnError, changeOnFocus, colorTheme, error, focused, shade) => changeOnError && error ? {
|
|
8
|
+
colorTheme: 'error',
|
|
9
|
+
shade: '04'
|
|
10
|
+
} : changeOnFocus && focused ? {
|
|
11
|
+
colorTheme: 'accent',
|
|
12
|
+
shade: '04'
|
|
13
|
+
} : {
|
|
14
|
+
colorTheme: colorTheme || 'gray',
|
|
15
|
+
shade
|
|
16
|
+
};
|
|
17
|
+
exports.getIconColorProps = getIconColorProps;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _propTypes = require("prop-types");
|
|
9
|
+
var _UTLabel = _interopRequireDefault(require("../../../UTLabel"));
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
const PrefixAdornment = _ref => {
|
|
12
|
+
let {
|
|
13
|
+
text
|
|
14
|
+
} = _ref;
|
|
15
|
+
return /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
16
|
+
colorTheme: "gray",
|
|
17
|
+
variant: "small",
|
|
18
|
+
weight: "medium"
|
|
19
|
+
}, text);
|
|
20
|
+
};
|
|
21
|
+
PrefixAdornment.propTypes = {
|
|
22
|
+
text: _propTypes.string
|
|
23
|
+
};
|
|
24
|
+
var _default = exports.default = PrefixAdornment;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _propTypes = require("prop-types");
|
|
9
|
+
var _UTLabel = _interopRequireDefault(require("../../../UTLabel"));
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
const SuffixAdornment = _ref => {
|
|
12
|
+
let {
|
|
13
|
+
text
|
|
14
|
+
} = _ref;
|
|
15
|
+
return /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
16
|
+
colorTheme: "gray"
|
|
17
|
+
}, text);
|
|
18
|
+
};
|
|
19
|
+
SuffixAdornment.propTypes = {
|
|
20
|
+
text: _propTypes.string
|
|
21
|
+
};
|
|
22
|
+
var _default = exports.default = SuffixAdornment;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _propTypes = require("prop-types");
|
|
9
|
+
var _UTIcon = _interopRequireDefault(require("../../../UTIcon"));
|
|
10
|
+
var _UTTooltip = _interopRequireDefault(require("../../../UTTooltip"));
|
|
11
|
+
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
const TooltipAdornment = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
tooltip
|
|
16
|
+
} = _ref;
|
|
17
|
+
return /*#__PURE__*/_react.default.createElement(_UTTooltip.default, {
|
|
18
|
+
content: tooltip
|
|
19
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
20
|
+
className: _stylesModule.default.tooltip
|
|
21
|
+
}, /*#__PURE__*/_react.default.createElement(_UTIcon.default, {
|
|
22
|
+
name: "IconInfoCircle",
|
|
23
|
+
colorTheme: "gray"
|
|
24
|
+
})));
|
|
25
|
+
};
|
|
26
|
+
TooltipAdornment.propTypes = {
|
|
27
|
+
tooltip: _propTypes.string
|
|
28
|
+
};
|
|
29
|
+
var _default = exports.default = TooltipAdornment;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.propTypes = exports.default = void 0;
|
|
7
|
+
var _propTypes = require("prop-types");
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _TextField = _interopRequireDefault(require("@material-ui/core/TextField"));
|
|
10
|
+
var _classesUtils = require("../../utils/classesUtils");
|
|
11
|
+
var _UTLabel = _interopRequireDefault(require("../UTLabel"));
|
|
12
|
+
var _WithTheme = _interopRequireDefault(require("../WithTheme"));
|
|
13
|
+
var _theme = require("./theme");
|
|
14
|
+
var _ActionAdornment = _interopRequireDefault(require("./components/ActionAdornment"));
|
|
15
|
+
var _IconAdornment = _interopRequireDefault(require("./components/IconAdornment"));
|
|
16
|
+
var _PrefixAdornment = _interopRequireDefault(require("./components/PrefixAdornment"));
|
|
17
|
+
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
18
|
+
var _SuffixAdornment = _interopRequireDefault(require("./components/SuffixAdornment"));
|
|
19
|
+
var _TooltipAdornment = _interopRequireDefault(require("./components/TooltipAdornment"));
|
|
20
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
21
|
+
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); }
|
|
22
|
+
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; }
|
|
23
|
+
const UTBaseInputField = _ref => {
|
|
24
|
+
let {
|
|
25
|
+
action,
|
|
26
|
+
alwaysShowPlaceholder,
|
|
27
|
+
classes: theme,
|
|
28
|
+
classNames = {},
|
|
29
|
+
dataTestId,
|
|
30
|
+
disabled,
|
|
31
|
+
error,
|
|
32
|
+
id,
|
|
33
|
+
LeftIcon,
|
|
34
|
+
maxLength,
|
|
35
|
+
maxRows = 1,
|
|
36
|
+
onBlur,
|
|
37
|
+
onChange = () => {},
|
|
38
|
+
onFocus,
|
|
39
|
+
placeholder,
|
|
40
|
+
prefix,
|
|
41
|
+
readOnly,
|
|
42
|
+
RightIcon,
|
|
43
|
+
showCharacterCount,
|
|
44
|
+
suffix,
|
|
45
|
+
tooltip,
|
|
46
|
+
type,
|
|
47
|
+
value = null
|
|
48
|
+
} = _ref;
|
|
49
|
+
const classes = (0, _react.useMemo)(() => (0, _classesUtils.mergeClasses)(theme, classNames), [classNames, theme]);
|
|
50
|
+
const [focused, setFocused] = (0, _react.useState)(false);
|
|
51
|
+
const handleFocus = (0, _react.useCallback)(event => {
|
|
52
|
+
setFocused(true);
|
|
53
|
+
onFocus === null || onFocus === void 0 || onFocus(event);
|
|
54
|
+
}, [onFocus]);
|
|
55
|
+
const handleBlur = (0, _react.useCallback)(event => {
|
|
56
|
+
setFocused(false);
|
|
57
|
+
onBlur === null || onBlur === void 0 || onBlur(event);
|
|
58
|
+
}, [onBlur]);
|
|
59
|
+
const handleChange = (0, _react.useCallback)(event => {
|
|
60
|
+
const inputValue = event.target.value;
|
|
61
|
+
if (type === 'numeric') {
|
|
62
|
+
const numericValue = inputValue.replace(/\D/g, '');
|
|
63
|
+
onChange === null || onChange === void 0 || onChange(numericValue);
|
|
64
|
+
} else {
|
|
65
|
+
onChange === null || onChange === void 0 || onChange(inputValue);
|
|
66
|
+
}
|
|
67
|
+
}, [onChange, type]);
|
|
68
|
+
const handleKeyDown = (0, _react.useCallback)(event => {
|
|
69
|
+
if (type === 'numeric') {
|
|
70
|
+
const allowedKeys = ['Backspace', 'ArrowLeft', 'ArrowRight', 'Delete', 'Tab'];
|
|
71
|
+
const isNumericKey = /^[0-9]$/;
|
|
72
|
+
if (!isNumericKey.test(event.key) && !allowedKeys.includes(event.key)) {
|
|
73
|
+
event.preventDefault();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}, [type]);
|
|
77
|
+
const shouldShowPlaceholder = alwaysShowPlaceholder || focused;
|
|
78
|
+
const multiline = maxRows > 1;
|
|
79
|
+
const hasCharactersCount = (0, _react.useMemo)(() => showCharacterCount && maxLength && !disabled && !readOnly, [showCharacterCount, maxLength, disabled, readOnly]);
|
|
80
|
+
const hasStartAdornments = (0, _react.useMemo)(() => LeftIcon || prefix, [LeftIcon, prefix]);
|
|
81
|
+
const hasEndAdornments = suffix || RightIcon || action || tooltip || error;
|
|
82
|
+
return /*#__PURE__*/_react.default.createElement(_TextField.default, {
|
|
83
|
+
margin: "none",
|
|
84
|
+
autoComplete: "new-password" // in the new MUI's version, the autocomplete='off' doesn't work for Chrome, please use this instead
|
|
85
|
+
,
|
|
86
|
+
disabled: disabled || readOnly,
|
|
87
|
+
error: error,
|
|
88
|
+
id: id,
|
|
89
|
+
maxRows: maxRows,
|
|
90
|
+
minRows: maxRows,
|
|
91
|
+
multiline: multiline,
|
|
92
|
+
onBlur: handleBlur,
|
|
93
|
+
onChange: handleChange,
|
|
94
|
+
onFocus: handleFocus,
|
|
95
|
+
onKeyDown: handleKeyDown,
|
|
96
|
+
placeholder: shouldShowPlaceholder ? placeholder : '',
|
|
97
|
+
type: type === 'numeric' ? 'text' : type,
|
|
98
|
+
value: value,
|
|
99
|
+
variant: "outlined",
|
|
100
|
+
InputProps: {
|
|
101
|
+
inputProps: {
|
|
102
|
+
maxLength,
|
|
103
|
+
'data-testid': dataTestId
|
|
104
|
+
},
|
|
105
|
+
classes: {
|
|
106
|
+
notchedOutline: "".concat(classes.inputContainer, " ").concat(focused && classes.focusedInputContainer),
|
|
107
|
+
adornedStart: _stylesModule.default.elementsContainer,
|
|
108
|
+
adornedEnd: _stylesModule.default.elementsContainer,
|
|
109
|
+
input: classes.input,
|
|
110
|
+
root: classes.root
|
|
111
|
+
},
|
|
112
|
+
startAdornment: hasStartAdornments ? /*#__PURE__*/_react.default.createElement("div", {
|
|
113
|
+
className: _stylesModule.default.adornmentsContainer
|
|
114
|
+
}, LeftIcon && /*#__PURE__*/_react.default.createElement(_IconAdornment.default, {
|
|
115
|
+
Icon: LeftIcon
|
|
116
|
+
}), prefix && /*#__PURE__*/_react.default.createElement(_PrefixAdornment.default, {
|
|
117
|
+
text: prefix
|
|
118
|
+
})) : hasCharactersCount && /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
119
|
+
className: classes.charactersCount,
|
|
120
|
+
colorTheme: "gray",
|
|
121
|
+
variant: "small"
|
|
122
|
+
}, (value === null || value === void 0 ? void 0 : value.length) || 0, "/", maxLength),
|
|
123
|
+
endAdornment: hasEndAdornments && /*#__PURE__*/_react.default.createElement("div", {
|
|
124
|
+
className: "".concat(_stylesModule.default.adornmentsContainer, " ").concat(multiline && _stylesModule.default.multilineAdornmentsContainer)
|
|
125
|
+
}, suffix && /*#__PURE__*/_react.default.createElement(_SuffixAdornment.default, {
|
|
126
|
+
text: suffix
|
|
127
|
+
}), (RightIcon || error) && /*#__PURE__*/_react.default.createElement(_IconAdornment.default, {
|
|
128
|
+
changeOnError: true,
|
|
129
|
+
error: error,
|
|
130
|
+
Icon: RightIcon
|
|
131
|
+
}), action && /*#__PURE__*/_react.default.createElement(_ActionAdornment.default, {
|
|
132
|
+
action: action,
|
|
133
|
+
classNames: {
|
|
134
|
+
root: _stylesModule.default.actionButton
|
|
135
|
+
},
|
|
136
|
+
disabled: disabled && !readOnly
|
|
137
|
+
}), tooltip && /*#__PURE__*/_react.default.createElement(_TooltipAdornment.default, {
|
|
138
|
+
tooltip: tooltip
|
|
139
|
+
}))
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
const propTypes = exports.propTypes = {
|
|
144
|
+
action: _propTypes.elementType,
|
|
145
|
+
alwaysShowPlaceholder: _propTypes.bool,
|
|
146
|
+
classes: (0, _propTypes.objectOf)(_propTypes.string),
|
|
147
|
+
classNames: (0, _propTypes.objectOf)(_propTypes.string),
|
|
148
|
+
dataTestId: _propTypes.string,
|
|
149
|
+
disabled: _propTypes.bool,
|
|
150
|
+
error: _propTypes.bool,
|
|
151
|
+
id: _propTypes.string,
|
|
152
|
+
LeftIcon: _propTypes.elementType,
|
|
153
|
+
maxLength: _propTypes.number,
|
|
154
|
+
maxRows: _propTypes.number,
|
|
155
|
+
onBlur: _propTypes.func,
|
|
156
|
+
onChange: _propTypes.func,
|
|
157
|
+
onFocus: _propTypes.func,
|
|
158
|
+
placeholder: _propTypes.string,
|
|
159
|
+
prefix: _propTypes.string,
|
|
160
|
+
readOnly: _propTypes.bool,
|
|
161
|
+
RightIcon: _propTypes.elementType,
|
|
162
|
+
showCharacterCount: _propTypes.bool,
|
|
163
|
+
suffix: _propTypes.string,
|
|
164
|
+
tooltip: _propTypes.string,
|
|
165
|
+
type: _propTypes.string,
|
|
166
|
+
value: _propTypes.string
|
|
167
|
+
};
|
|
168
|
+
UTBaseInputField.propTypes = propTypes;
|
|
169
|
+
var _default = exports.default = (0, _WithTheme.default)(_theme.retrieveStyle)(UTBaseInputField);
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
.container {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
grid-gap: 8px;
|
|
16
|
+
}
|
|
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
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.retrieveStyle = void 0;
|
|
7
|
+
var _theme = require("../UTLabel/theme");
|
|
8
|
+
const charactersCountRowHeight = 20;
|
|
9
|
+
const PADDING = {
|
|
10
|
+
HORIZONTAL: 16,
|
|
11
|
+
VERTICAL: 12
|
|
12
|
+
};
|
|
13
|
+
const SMALL_PADDING = {
|
|
14
|
+
HORIZONTAL: 12,
|
|
15
|
+
VERTICAL: 8
|
|
16
|
+
};
|
|
17
|
+
const GRID_GAP = 16;
|
|
18
|
+
const retrieveStyle = _ref => {
|
|
19
|
+
let {
|
|
20
|
+
theme,
|
|
21
|
+
inputSize,
|
|
22
|
+
error,
|
|
23
|
+
disabled: receivedDisabled,
|
|
24
|
+
readOnly,
|
|
25
|
+
showCharacterCount,
|
|
26
|
+
maxLength
|
|
27
|
+
} = _ref;
|
|
28
|
+
const disabled = receivedDisabled && !readOnly;
|
|
29
|
+
const verticalPadding = "".concat(inputSize === 'small' ? SMALL_PADDING.VERTICAL : PADDING.VERTICAL, "px");
|
|
30
|
+
const multilineVerticalPadding = "".concat((inputSize === 'small' ? SMALL_PADDING.VERTICAL : PADDING.VERTICAL) + GRID_GAP + charactersCountRowHeight, "px");
|
|
31
|
+
const horizontalPadding = "".concat(inputSize === 'small' ? SMALL_PADDING.HORIZONTAL : PADDING.HORIZONTAL, "px");
|
|
32
|
+
const hasCharactersCount = showCharacterCount && maxLength && !disabled && !readOnly;
|
|
33
|
+
return {
|
|
34
|
+
charactersCount: {
|
|
35
|
+
position: 'absolute',
|
|
36
|
+
bottom: verticalPadding
|
|
37
|
+
},
|
|
38
|
+
root: {
|
|
39
|
+
backgroundColor: theme.Palette.light['01'],
|
|
40
|
+
paddingBottom: hasCharactersCount ? multilineVerticalPadding : verticalPadding,
|
|
41
|
+
paddingLeft: horizontalPadding,
|
|
42
|
+
paddingRight: horizontalPadding,
|
|
43
|
+
paddingTop: verticalPadding,
|
|
44
|
+
...(readOnly && {
|
|
45
|
+
backgroundColor: 'transparent',
|
|
46
|
+
paddingLeft: 0,
|
|
47
|
+
paddingRight: 0
|
|
48
|
+
}),
|
|
49
|
+
...(disabled && {
|
|
50
|
+
backgroundColor: theme.Palette.light['03']
|
|
51
|
+
})
|
|
52
|
+
},
|
|
53
|
+
inputContainer: {
|
|
54
|
+
borderColor: "".concat(theme.Palette.light['05'], " !important"),
|
|
55
|
+
borderRadius: '4px',
|
|
56
|
+
borderWidth: '1px',
|
|
57
|
+
...(error && {
|
|
58
|
+
borderColor: "".concat(theme.Palette.error['04'], " !important")
|
|
59
|
+
}),
|
|
60
|
+
...(readOnly && {
|
|
61
|
+
borderColor: 'transparent !important'
|
|
62
|
+
}),
|
|
63
|
+
...(disabled && {
|
|
64
|
+
borderColor: 'transparent !important'
|
|
65
|
+
})
|
|
66
|
+
},
|
|
67
|
+
focusedInputContainer: {
|
|
68
|
+
...(!error && {
|
|
69
|
+
borderColor: "".concat(theme.Palette.accent['04'], " !important"),
|
|
70
|
+
borderWidth: '2px'
|
|
71
|
+
})
|
|
72
|
+
},
|
|
73
|
+
input: {
|
|
74
|
+
...(0, _theme.getFontStyles)({
|
|
75
|
+
theme,
|
|
76
|
+
variant: 'body',
|
|
77
|
+
weight: 'regular'
|
|
78
|
+
}),
|
|
79
|
+
caretColor: theme.Palette.accent['04'],
|
|
80
|
+
color: theme.Palette.dark['05'],
|
|
81
|
+
minHeight: '22px',
|
|
82
|
+
overflow: 'auto',
|
|
83
|
+
padding: 0,
|
|
84
|
+
textOverflow: 'ellipsis',
|
|
85
|
+
'&::placeholder': {
|
|
86
|
+
color: theme.Palette.gray['02']
|
|
87
|
+
},
|
|
88
|
+
'&::selection': {
|
|
89
|
+
backgroundColor: theme.Palette.accent['02']
|
|
90
|
+
},
|
|
91
|
+
...(disabled && {
|
|
92
|
+
color: theme.Palette.gray['04']
|
|
93
|
+
})
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
exports.retrieveStyle = retrieveStyle;
|
|
@@ -25,12 +25,14 @@ const UTButtonGroup = _ref => {
|
|
|
25
25
|
className: "".concat(_stylesModule.default["".concat(type, "Container")], " ").concat(backgroundColor)
|
|
26
26
|
}, actions.map(_ref2 => {
|
|
27
27
|
let {
|
|
28
|
+
dataTestId,
|
|
28
29
|
Icon,
|
|
29
30
|
id,
|
|
30
31
|
onClick
|
|
31
32
|
} = _ref2;
|
|
32
33
|
return /*#__PURE__*/_react.default.createElement(_UTButton.default, {
|
|
33
34
|
colorTheme: colorTheme,
|
|
35
|
+
dataTestId: dataTestId,
|
|
34
36
|
Icon: Icon,
|
|
35
37
|
key: id,
|
|
36
38
|
onClick: onClick,
|
|
@@ -15,10 +15,11 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
15
15
|
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; }
|
|
16
16
|
const UTCBUInput = _ref => {
|
|
17
17
|
let {
|
|
18
|
-
|
|
18
|
+
classes,
|
|
19
|
+
dataTestId,
|
|
19
20
|
field,
|
|
20
21
|
input,
|
|
21
|
-
|
|
22
|
+
meta
|
|
22
23
|
} = _ref;
|
|
23
24
|
const {
|
|
24
25
|
onChange,
|
|
@@ -45,6 +46,14 @@ const UTCBUInput = _ref => {
|
|
|
45
46
|
});
|
|
46
47
|
};
|
|
47
48
|
return /*#__PURE__*/_react.default.createElement(_UTTextInput.default, {
|
|
49
|
+
captionLabel: entity,
|
|
50
|
+
dataTestId: dataTestId,
|
|
51
|
+
field: field,
|
|
52
|
+
FormHelperTextProps: {
|
|
53
|
+
classes: {
|
|
54
|
+
root: classes.helper
|
|
55
|
+
}
|
|
56
|
+
},
|
|
48
57
|
input: {
|
|
49
58
|
onChange: onChangeText,
|
|
50
59
|
value: {
|
|
@@ -52,28 +61,15 @@ const UTCBUInput = _ref => {
|
|
|
52
61
|
[cbuEntityKey]: entity
|
|
53
62
|
}
|
|
54
63
|
},
|
|
55
|
-
|
|
56
|
-
placeholder: placeholder,
|
|
64
|
+
inputObjectKey: cbuNumberKey,
|
|
57
65
|
label: title,
|
|
58
66
|
meta: meta,
|
|
59
|
-
|
|
60
|
-
FormHelperTextProps: {
|
|
61
|
-
classes: {
|
|
62
|
-
root: classes.helper
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
inputObjectKey: cbuNumberKey
|
|
67
|
+
placeholder: placeholder
|
|
66
68
|
});
|
|
67
69
|
};
|
|
68
70
|
UTCBUInput.propTypes = {
|
|
69
71
|
classes: (0, _propTypes.objectOf)(_propTypes.string),
|
|
70
|
-
|
|
71
|
-
onChange: _propTypes.func,
|
|
72
|
-
value: (0, _propTypes.shape)({
|
|
73
|
-
cbuNumber: _propTypes.string,
|
|
74
|
-
entityName: _propTypes.string
|
|
75
|
-
})
|
|
76
|
-
}),
|
|
72
|
+
dataTestId: _propTypes.string,
|
|
77
73
|
field: (0, _propTypes.shape)({
|
|
78
74
|
placeholder: _propTypes.string,
|
|
79
75
|
title: _propTypes.string,
|
|
@@ -83,6 +79,13 @@ UTCBUInput.propTypes = {
|
|
|
83
79
|
cbu_number_key: _propTypes.string,
|
|
84
80
|
cbu_entity_key: _propTypes.string
|
|
85
81
|
}),
|
|
82
|
+
input: (0, _propTypes.shape)({
|
|
83
|
+
onChange: _propTypes.func,
|
|
84
|
+
value: (0, _propTypes.shape)({
|
|
85
|
+
cbuNumber: _propTypes.string,
|
|
86
|
+
entityName: _propTypes.string
|
|
87
|
+
})
|
|
88
|
+
}),
|
|
86
89
|
meta: _formTypes.metaPropTypes
|
|
87
90
|
};
|
|
88
91
|
var _default = exports.default = (0, _WithTheme.default)(_theme.retrieveStyle)(UTCBUInput);
|