@widergy/energy-ui 3.28.0 → 3.29.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 +7 -0
- package/dist/components/UTBaseInputField/constants.js +26 -0
- package/dist/components/UTBaseInputField/index.js +39 -47
- package/dist/components/UTBaseInputField/theme.js +15 -4
- package/dist/components/UTBaseInputField/utils.js +9 -0
- package/dist/components/UTPhoneInput/versions/V1/index.js +24 -10
- package/dist/components/UTSearchField/README.md +35 -0
- package/dist/components/UTSearchField/index.js +89 -0
- package/dist/components/UTSearchField/theme.js +19 -0
- package/dist/components/UTTextInput/versions/V1/README.md +0 -1
- package/dist/components/UTTextInput/versions/V1/index.js +48 -6
- package/dist/index.js +7 -0
- package/package.json +1 -1
- package/dist/components/UTTextInput/versions/V1/components/ActionAdornment/index.js +0 -31
- package/dist/components/UTTextInput/versions/V1/components/IconAdornment/constants.js +0 -8
- package/dist/components/UTTextInput/versions/V1/components/IconAdornment/index.js +0 -48
- package/dist/components/UTTextInput/versions/V1/components/IconAdornment/utils.js +0 -17
- package/dist/components/UTTextInput/versions/V1/components/PrefixAdornment/index.js +0 -24
- package/dist/components/UTTextInput/versions/V1/components/SuffixAdornment/index.js +0 -22
- package/dist/components/UTTextInput/versions/V1/components/TooltipAdornment/index.js +0 -26
- package/dist/components/UTTextInput/versions/V1/theme.js +0 -94
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [3.29.0](https://github.com/widergy/energy-ui/compare/v3.28.0...v3.29.0) (2024-10-15)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* add UTSearchField ([#507](https://github.com/widergy/energy-ui/issues/507)) ([2f53c30](https://github.com/widergy/energy-ui/commit/2f53c30719d54e36cfe2f4007cb8bce290027994))
|
|
7
|
+
|
|
1
8
|
# [3.28.0](https://github.com/widergy/energy-ui/compare/v3.27.0...v3.28.0) (2024-10-10)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.COMPONENT_KEYS = exports.COMPONENTS_MAPPER = void 0;
|
|
7
|
+
var _ActionAdornment = _interopRequireDefault(require("./components/ActionAdornment"));
|
|
8
|
+
var _IconAdornment = _interopRequireDefault(require("./components/IconAdornment"));
|
|
9
|
+
var _PrefixAdornment = _interopRequireDefault(require("./components/PrefixAdornment"));
|
|
10
|
+
var _SuffixAdornment = _interopRequireDefault(require("./components/SuffixAdornment"));
|
|
11
|
+
var _TooltipAdornment = _interopRequireDefault(require("./components/TooltipAdornment"));
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
const COMPONENT_KEYS = exports.COMPONENT_KEYS = {
|
|
14
|
+
ACTION: 'Action',
|
|
15
|
+
ICON: 'Icon',
|
|
16
|
+
PREFIX: 'Prefix',
|
|
17
|
+
SUFFIX: 'Suffix',
|
|
18
|
+
TOOLTIP: 'Tooltip'
|
|
19
|
+
};
|
|
20
|
+
const COMPONENTS_MAPPER = exports.COMPONENTS_MAPPER = {
|
|
21
|
+
[COMPONENT_KEYS.ACTION]: _ActionAdornment.default,
|
|
22
|
+
[COMPONENT_KEYS.ICON]: _IconAdornment.default,
|
|
23
|
+
[COMPONENT_KEYS.PREFIX]: _PrefixAdornment.default,
|
|
24
|
+
[COMPONENT_KEYS.SUFFIX]: _SuffixAdornment.default,
|
|
25
|
+
[COMPONENT_KEYS.TOOLTIP]: _TooltipAdornment.default
|
|
26
|
+
};
|
|
@@ -10,19 +10,16 @@ var _TextField = _interopRequireDefault(require("@material-ui/core/TextField"));
|
|
|
10
10
|
var _classesUtils = require("../../utils/classesUtils");
|
|
11
11
|
var _UTLabel = _interopRequireDefault(require("../UTLabel"));
|
|
12
12
|
var _WithTheme = _interopRequireDefault(require("../WithTheme"));
|
|
13
|
+
var _constants = require("./constants");
|
|
13
14
|
var _theme = require("./theme");
|
|
14
|
-
var
|
|
15
|
-
var _IconAdornment = _interopRequireDefault(require("./components/IconAdornment"));
|
|
16
|
-
var _PrefixAdornment = _interopRequireDefault(require("./components/PrefixAdornment"));
|
|
15
|
+
var _utils = require("./utils");
|
|
17
16
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
18
|
-
var _SuffixAdornment = _interopRequireDefault(require("./components/SuffixAdornment"));
|
|
19
|
-
var _TooltipAdornment = _interopRequireDefault(require("./components/TooltipAdornment"));
|
|
20
17
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
21
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); }
|
|
22
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
|
+
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); }
|
|
23
21
|
const UTBaseInputField = _ref => {
|
|
24
22
|
let {
|
|
25
|
-
action,
|
|
26
23
|
alwaysShowPlaceholder,
|
|
27
24
|
classes: theme,
|
|
28
25
|
classNames = {},
|
|
@@ -30,19 +27,16 @@ const UTBaseInputField = _ref => {
|
|
|
30
27
|
disabled,
|
|
31
28
|
error,
|
|
32
29
|
id,
|
|
33
|
-
|
|
30
|
+
leftAdornments = [],
|
|
34
31
|
maxLength,
|
|
35
32
|
maxRows = 1,
|
|
36
33
|
onBlur,
|
|
37
34
|
onChange = () => {},
|
|
38
35
|
onFocus,
|
|
39
36
|
placeholder,
|
|
40
|
-
prefix,
|
|
41
37
|
readOnly,
|
|
42
|
-
|
|
38
|
+
rightAdornments = [],
|
|
43
39
|
showCharacterCount,
|
|
44
|
-
suffix,
|
|
45
|
-
tooltip,
|
|
46
40
|
type,
|
|
47
41
|
value = null
|
|
48
42
|
} = _ref;
|
|
@@ -77,12 +71,25 @@ const UTBaseInputField = _ref => {
|
|
|
77
71
|
const shouldShowPlaceholder = alwaysShowPlaceholder || focused;
|
|
78
72
|
const multiline = maxRows > 1;
|
|
79
73
|
const hasCharactersCount = (0, _react.useMemo)(() => showCharacterCount && maxLength && !disabled && !readOnly, [showCharacterCount, maxLength, disabled, readOnly]);
|
|
80
|
-
const
|
|
81
|
-
const
|
|
74
|
+
const validLeftAdornments = (0, _react.useMemo)(() => (0, _utils.validateAdornments)(leftAdornments) ? leftAdornments : [], [leftAdornments]);
|
|
75
|
+
const validRightAdornments = (0, _react.useMemo)(() => (0, _utils.validateAdornments)(rightAdornments) ? rightAdornments : [], [rightAdornments]);
|
|
76
|
+
const renderAdornment = (0, _react.useCallback)(adornment => {
|
|
77
|
+
const Component = _constants.COMPONENTS_MAPPER[adornment.name];
|
|
78
|
+
const adornmentProps = {
|
|
79
|
+
...adornment.props,
|
|
80
|
+
error,
|
|
81
|
+
disabled: disabled && !readOnly,
|
|
82
|
+
classNames: adornment.name === _constants.COMPONENT_KEYS.ACTION ? {
|
|
83
|
+
root: _stylesModule.default.actionButton
|
|
84
|
+
} : undefined
|
|
85
|
+
};
|
|
86
|
+
return Component ? /*#__PURE__*/_react.default.createElement(Component, _extends({}, adornmentProps, {
|
|
87
|
+
key: adornment.name
|
|
88
|
+
})) : null;
|
|
89
|
+
}, [error, disabled, readOnly]);
|
|
82
90
|
return /*#__PURE__*/_react.default.createElement(_TextField.default, {
|
|
83
91
|
margin: "none",
|
|
84
|
-
autoComplete: "new-password"
|
|
85
|
-
,
|
|
92
|
+
autoComplete: "new-password",
|
|
86
93
|
disabled: disabled || readOnly,
|
|
87
94
|
error: error,
|
|
88
95
|
id: id,
|
|
@@ -103,45 +110,34 @@ const UTBaseInputField = _ref => {
|
|
|
103
110
|
'data-testid': dataTestId
|
|
104
111
|
},
|
|
105
112
|
classes: {
|
|
106
|
-
notchedOutline: "".concat(classes.inputContainer, " ").concat(focused && classes.focusedInputContainer),
|
|
107
|
-
adornedStart: _stylesModule.default.elementsContainer,
|
|
108
113
|
adornedEnd: _stylesModule.default.elementsContainer,
|
|
114
|
+
adornedStart: _stylesModule.default.elementsContainer,
|
|
109
115
|
input: classes.input,
|
|
110
|
-
|
|
116
|
+
notchedOutline: "".concat(classes.inputContainer, " ").concat(focused && classes.focusedInputContainer),
|
|
117
|
+
root: "".concat(classes.root, " ").concat(focused && classes.focusedRoot)
|
|
111
118
|
},
|
|
112
|
-
startAdornment:
|
|
119
|
+
startAdornment: validLeftAdornments.length > 0 ? /*#__PURE__*/_react.default.createElement("div", {
|
|
113
120
|
className: _stylesModule.default.adornmentsContainer
|
|
114
|
-
},
|
|
115
|
-
Icon: LeftIcon
|
|
116
|
-
}), prefix && /*#__PURE__*/_react.default.createElement(_PrefixAdornment.default, {
|
|
117
|
-
text: prefix
|
|
118
|
-
})) : hasCharactersCount && /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
121
|
+
}, validLeftAdornments.map(renderAdornment)) : hasCharactersCount && /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
119
122
|
className: classes.charactersCount,
|
|
120
123
|
colorTheme: "gray",
|
|
121
124
|
variant: "small"
|
|
122
125
|
}, (value === null || value === void 0 ? void 0 : value.length) || 0, "/", maxLength),
|
|
123
|
-
endAdornment:
|
|
126
|
+
endAdornment: validRightAdornments.length > 0 && /*#__PURE__*/_react.default.createElement("div", {
|
|
124
127
|
className: "".concat(_stylesModule.default.adornmentsContainer, " ").concat(multiline && _stylesModule.default.multilineAdornmentsContainer)
|
|
125
|
-
},
|
|
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
|
-
}))
|
|
128
|
+
}, validRightAdornments.map(renderAdornment))
|
|
140
129
|
}
|
|
141
130
|
});
|
|
142
131
|
};
|
|
143
132
|
const propTypes = exports.propTypes = {
|
|
144
|
-
|
|
133
|
+
leftAdornments: (0, _propTypes.arrayOf)((0, _propTypes.shape)({
|
|
134
|
+
name: _propTypes.string.isRequired,
|
|
135
|
+
props: (0, _propTypes.objectOf)(_propTypes.string)
|
|
136
|
+
})),
|
|
137
|
+
rightAdornments: (0, _propTypes.arrayOf)((0, _propTypes.shape)({
|
|
138
|
+
name: _propTypes.string.isRequired,
|
|
139
|
+
props: (0, _propTypes.objectOf)(_propTypes.string)
|
|
140
|
+
})),
|
|
145
141
|
alwaysShowPlaceholder: _propTypes.bool,
|
|
146
142
|
classes: (0, _propTypes.objectOf)(_propTypes.string),
|
|
147
143
|
classNames: (0, _propTypes.objectOf)(_propTypes.string),
|
|
@@ -149,21 +145,17 @@ const propTypes = exports.propTypes = {
|
|
|
149
145
|
disabled: _propTypes.bool,
|
|
150
146
|
error: _propTypes.bool,
|
|
151
147
|
id: _propTypes.string,
|
|
152
|
-
LeftIcon: _propTypes.elementType,
|
|
153
148
|
maxLength: _propTypes.number,
|
|
154
149
|
maxRows: _propTypes.number,
|
|
155
150
|
onBlur: _propTypes.func,
|
|
156
151
|
onChange: _propTypes.func,
|
|
157
152
|
onFocus: _propTypes.func,
|
|
158
153
|
placeholder: _propTypes.string,
|
|
159
|
-
prefix: _propTypes.string,
|
|
160
154
|
readOnly: _propTypes.bool,
|
|
161
|
-
RightIcon: _propTypes.elementType,
|
|
162
155
|
showCharacterCount: _propTypes.bool,
|
|
163
|
-
suffix: _propTypes.string,
|
|
164
|
-
tooltip: _propTypes.string,
|
|
165
156
|
type: _propTypes.string,
|
|
166
|
-
value: _propTypes.string
|
|
157
|
+
value: _propTypes.string,
|
|
158
|
+
variant: _propTypes.string
|
|
167
159
|
};
|
|
168
160
|
UTBaseInputField.propTypes = propTypes;
|
|
169
161
|
var _default = exports.default = (0, _WithTheme.default)(_theme.retrieveStyle)(UTBaseInputField);
|
|
@@ -17,13 +17,14 @@ const SMALL_PADDING = {
|
|
|
17
17
|
const GRID_GAP = 16;
|
|
18
18
|
const retrieveStyle = _ref => {
|
|
19
19
|
let {
|
|
20
|
-
theme,
|
|
21
|
-
inputSize,
|
|
22
|
-
error,
|
|
23
20
|
disabled: receivedDisabled,
|
|
21
|
+
error,
|
|
22
|
+
inputSize,
|
|
23
|
+
maxLength,
|
|
24
24
|
readOnly,
|
|
25
25
|
showCharacterCount,
|
|
26
|
-
|
|
26
|
+
theme,
|
|
27
|
+
variant
|
|
27
28
|
} = _ref;
|
|
28
29
|
const disabled = receivedDisabled && !readOnly;
|
|
29
30
|
const verticalPadding = "".concat(inputSize === 'small' ? SMALL_PADDING.VERTICAL : PADDING.VERTICAL, "px");
|
|
@@ -36,11 +37,15 @@ const retrieveStyle = _ref => {
|
|
|
36
37
|
bottom: verticalPadding
|
|
37
38
|
},
|
|
38
39
|
root: {
|
|
40
|
+
minWidth: '320px',
|
|
39
41
|
backgroundColor: theme.Palette.light['01'],
|
|
40
42
|
paddingBottom: hasCharactersCount ? multilineVerticalPadding : verticalPadding,
|
|
41
43
|
paddingLeft: horizontalPadding,
|
|
42
44
|
paddingRight: horizontalPadding,
|
|
43
45
|
paddingTop: verticalPadding,
|
|
46
|
+
...(variant === 'gray' && {
|
|
47
|
+
backgroundColor: theme.Palette.light['04']
|
|
48
|
+
}),
|
|
44
49
|
...(readOnly && {
|
|
45
50
|
backgroundColor: 'transparent',
|
|
46
51
|
paddingLeft: 0,
|
|
@@ -54,6 +59,9 @@ const retrieveStyle = _ref => {
|
|
|
54
59
|
borderColor: "".concat(theme.Palette.light['05'], " !important"),
|
|
55
60
|
borderRadius: '4px',
|
|
56
61
|
borderWidth: '1px',
|
|
62
|
+
...(variant === 'gray' && {
|
|
63
|
+
borderColor: 'transparent !important'
|
|
64
|
+
}),
|
|
57
65
|
...(error && {
|
|
58
66
|
borderColor: "".concat(theme.Palette.error['04'], " !important")
|
|
59
67
|
}),
|
|
@@ -64,6 +72,9 @@ const retrieveStyle = _ref => {
|
|
|
64
72
|
borderColor: 'transparent !important'
|
|
65
73
|
})
|
|
66
74
|
},
|
|
75
|
+
focusedRoot: {
|
|
76
|
+
backgroundColor: theme.Palette.light['01']
|
|
77
|
+
},
|
|
67
78
|
focusedInputContainer: {
|
|
68
79
|
...(!error && {
|
|
69
80
|
borderColor: "".concat(theme.Palette.accent['04'], " !important"),
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.validateAdornments = void 0;
|
|
7
|
+
var _constants = require("./constants");
|
|
8
|
+
const validateAdornments = adornments => adornments.every(adornment => _constants.COMPONENTS_MAPPER[adornment.name]);
|
|
9
|
+
exports.validateAdornments = validateAdornments;
|
|
@@ -6,23 +6,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _propTypes = require("prop-types");
|
|
9
|
+
var _constants = require("../../../UTBaseInputField/constants");
|
|
9
10
|
var _utils = require("../../../UTValidation/utils");
|
|
10
11
|
var _inputs = require("../../../../constants/inputs");
|
|
11
12
|
var _UTBaseInputField = _interopRequireDefault(require("../../../UTBaseInputField"));
|
|
12
13
|
var _UTFieldLabel = _interopRequireDefault(require("../../../UTFieldLabel"));
|
|
13
14
|
var _UTLabel = _interopRequireDefault(require("../../../UTLabel"));
|
|
14
15
|
var _UTValidation = _interopRequireWildcard(require("../../../UTValidation"));
|
|
15
|
-
var
|
|
16
|
+
var _constants2 = require("./constants");
|
|
16
17
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
17
18
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
19
|
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
20
|
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
21
|
const UTPhoneInput = _ref => {
|
|
21
22
|
let {
|
|
23
|
+
areaCodeDataTestId,
|
|
22
24
|
areaCodePlaceholder,
|
|
23
25
|
countryCode,
|
|
24
|
-
areaCodeDataTestId,
|
|
25
|
-
phoneNumberDataTestId,
|
|
26
26
|
disabled,
|
|
27
27
|
error,
|
|
28
28
|
helpText,
|
|
@@ -30,10 +30,10 @@ const UTPhoneInput = _ref => {
|
|
|
30
30
|
onBlur,
|
|
31
31
|
onChange,
|
|
32
32
|
onFocus,
|
|
33
|
+
phoneNumberDataTestId,
|
|
33
34
|
placeholder,
|
|
34
35
|
readOnly,
|
|
35
36
|
required,
|
|
36
|
-
RightIcon,
|
|
37
37
|
title,
|
|
38
38
|
titleVariant,
|
|
39
39
|
translations = {
|
|
@@ -45,9 +45,9 @@ const UTPhoneInput = _ref => {
|
|
|
45
45
|
withAreaCode = true
|
|
46
46
|
} = _ref;
|
|
47
47
|
const [areaCode, setAreaCode] = (0, _react.useState)('');
|
|
48
|
-
const [phoneNumber, setPhoneNumber] = (0, _react.useState)('');
|
|
49
48
|
const [areaCodeError, setAreaCodeError] = (0, _react.useState)('');
|
|
50
49
|
const [isValidCode, setIsValidCode] = (0, _react.useState)(false);
|
|
50
|
+
const [phoneNumber, setPhoneNumber] = (0, _react.useState)('');
|
|
51
51
|
(0, _react.useEffect)(() => {
|
|
52
52
|
if (value && withAreaCode) {
|
|
53
53
|
const [code, phone] = value.split('-');
|
|
@@ -67,7 +67,7 @@ const UTPhoneInput = _ref => {
|
|
|
67
67
|
setAreaCodeError(areaCodeWithoutZeroError);
|
|
68
68
|
setIsValidCode(false);
|
|
69
69
|
} else {
|
|
70
|
-
const code =
|
|
70
|
+
const code = _constants2.AREA_CODES.find(element => element.code === areaCode);
|
|
71
71
|
setIsValidCode(!!code);
|
|
72
72
|
setAreaCodeError(!code ? invalidAreaCodeError : '');
|
|
73
73
|
}
|
|
@@ -112,7 +112,12 @@ const UTPhoneInput = _ref => {
|
|
|
112
112
|
onFocus: onFocus,
|
|
113
113
|
placeholder: areaCodePlaceholder,
|
|
114
114
|
readOnly: readOnly,
|
|
115
|
-
|
|
115
|
+
rightAdornments: [{
|
|
116
|
+
name: _constants.COMPONENT_KEYS.ICON,
|
|
117
|
+
props: {
|
|
118
|
+
changeOnError: true
|
|
119
|
+
}
|
|
120
|
+
}],
|
|
116
121
|
value: areaCode
|
|
117
122
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
118
123
|
className: _stylesModule.default.phoneContainer
|
|
@@ -127,8 +132,18 @@ const UTPhoneInput = _ref => {
|
|
|
127
132
|
onChange: handleChangePhoneNumber,
|
|
128
133
|
onFocus: onFocus,
|
|
129
134
|
placeholder: placeholder,
|
|
130
|
-
|
|
131
|
-
|
|
135
|
+
leftAdornments: countryCode && !withAreaCode ? [{
|
|
136
|
+
name: _constants.COMPONENT_KEYS.PREFIX,
|
|
137
|
+
props: {
|
|
138
|
+
text: countryCode
|
|
139
|
+
}
|
|
140
|
+
}] : [],
|
|
141
|
+
rightAdornments: [{
|
|
142
|
+
name: _constants.COMPONENT_KEYS.ICON,
|
|
143
|
+
props: {
|
|
144
|
+
changeOnError: true
|
|
145
|
+
}
|
|
146
|
+
}],
|
|
132
147
|
value: phoneNumber
|
|
133
148
|
}))), helpText && /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
134
149
|
colorTheme: "gray",
|
|
@@ -152,7 +167,6 @@ UTPhoneInput.propTypes = {
|
|
|
152
167
|
placeholder: _propTypes.string,
|
|
153
168
|
readOnly: _propTypes.bool,
|
|
154
169
|
required: _propTypes.bool,
|
|
155
|
-
RightIcon: _propTypes.elementType,
|
|
156
170
|
title: _propTypes.string,
|
|
157
171
|
titleVariant: _propTypes.string,
|
|
158
172
|
translations: (0, _propTypes.shape)({
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# UTSearchField
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
`UTSearchField` is a customizable search field component. It includes a search icon on the left and an optional clear button on the right when there is text in the input field.
|
|
6
|
+
|
|
7
|
+
## Props
|
|
8
|
+
|
|
9
|
+
| Name | Type | Default | Description |
|
|
10
|
+
| ----------- | ------ | ------- | ----------------------------------------------------------- |
|
|
11
|
+
| className | string | | CSS class to customize the root element of the input field. |
|
|
12
|
+
| dataTestId | string | | Identifier used for testing purposes. |
|
|
13
|
+
| disabled | bool | | Disables the input field if set to true. |
|
|
14
|
+
| id | string | | Unique identifier for the input field. |
|
|
15
|
+
| onBlur | func | | Function to call when the input field loses focus. |
|
|
16
|
+
| onChange | func | | Function to call when the input field value changes. |
|
|
17
|
+
| onFocus | func | | Function to call when the input field gains focus. |
|
|
18
|
+
| placeholder | string | | Placeholder text for the input field. |
|
|
19
|
+
| size | string | | Size of the input field. One of: `small`, `large`. |
|
|
20
|
+
| type | string | | Type of input (e.g., 'numeric', 'password', 'text' ). |
|
|
21
|
+
| value | string | null | The value of the input field. |
|
|
22
|
+
| variant | string | gray | Variant of the input field. One of: `white`, `gray`. |
|
|
23
|
+
|
|
24
|
+
### Adornments
|
|
25
|
+
|
|
26
|
+
`UTSearchField` utilizes adornments on both sides of the input field:
|
|
27
|
+
|
|
28
|
+
- **Left Adornment**: A search icon is always displayed on the left side of the input field.
|
|
29
|
+
- **Right Adornment**: A clear (reset) button is displayed on the right side only when there is a value in the input field.
|
|
30
|
+
|
|
31
|
+
## Additional Information
|
|
32
|
+
|
|
33
|
+
- The clear button appears when the input field contains text and clears the input when clicked.
|
|
34
|
+
- The search icon can change its style based on the focus state of the input field.
|
|
35
|
+
- The component is built on top of `UTBaseInputField`, inheriting its flexible adornment handling.
|
|
@@ -0,0 +1,89 @@
|
|
|
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 = _interopRequireDefault(require("react"));
|
|
9
|
+
var _constants = require("../UTBaseInputField/constants");
|
|
10
|
+
var _UTBaseInputField = _interopRequireDefault(require("../UTBaseInputField"));
|
|
11
|
+
var _WithTheme = _interopRequireDefault(require("../WithTheme"));
|
|
12
|
+
var _theme = require("./theme");
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
const UTSearchField = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
classes,
|
|
17
|
+
className,
|
|
18
|
+
dataTestId,
|
|
19
|
+
disabled,
|
|
20
|
+
id,
|
|
21
|
+
onBlur,
|
|
22
|
+
onChange = () => {},
|
|
23
|
+
onFocus,
|
|
24
|
+
placeholder,
|
|
25
|
+
size,
|
|
26
|
+
type,
|
|
27
|
+
value = null,
|
|
28
|
+
variant = 'gray'
|
|
29
|
+
} = _ref;
|
|
30
|
+
const clearText = () => {
|
|
31
|
+
onChange('');
|
|
32
|
+
};
|
|
33
|
+
const action = {
|
|
34
|
+
Icon: 'IconX',
|
|
35
|
+
onClick: clearText,
|
|
36
|
+
size: 'small'
|
|
37
|
+
};
|
|
38
|
+
const leftAdornments = [{
|
|
39
|
+
name: _constants.COMPONENT_KEYS.ICON,
|
|
40
|
+
props: {
|
|
41
|
+
Icon: 'IconSearch',
|
|
42
|
+
changeOnFocus: true,
|
|
43
|
+
shade: '02'
|
|
44
|
+
}
|
|
45
|
+
}];
|
|
46
|
+
const rightAdornments = value ? [{
|
|
47
|
+
name: _constants.COMPONENT_KEYS.ACTION,
|
|
48
|
+
props: {
|
|
49
|
+
action
|
|
50
|
+
}
|
|
51
|
+
}] : [];
|
|
52
|
+
return /*#__PURE__*/_react.default.createElement(_UTBaseInputField.default, {
|
|
53
|
+
alwaysShowPlaceholder: true,
|
|
54
|
+
dataTestId: dataTestId,
|
|
55
|
+
disabled: disabled,
|
|
56
|
+
id: id,
|
|
57
|
+
inputSize: size,
|
|
58
|
+
leftAdornments: leftAdornments,
|
|
59
|
+
onBlur: onBlur,
|
|
60
|
+
onChange: onChange,
|
|
61
|
+
onFocus: onFocus,
|
|
62
|
+
placeholder: placeholder,
|
|
63
|
+
rightAdornments: rightAdornments,
|
|
64
|
+
classNames: {
|
|
65
|
+
root: className,
|
|
66
|
+
input: classes.input
|
|
67
|
+
},
|
|
68
|
+
type: type,
|
|
69
|
+
value: value,
|
|
70
|
+
variant: variant
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
const propTypes = exports.propTypes = {
|
|
74
|
+
classes: (0, _propTypes.objectOf)(_propTypes.string),
|
|
75
|
+
className: _propTypes.string,
|
|
76
|
+
dataTestId: _propTypes.string,
|
|
77
|
+
disabled: _propTypes.bool,
|
|
78
|
+
id: _propTypes.string,
|
|
79
|
+
onBlur: _propTypes.func,
|
|
80
|
+
onChange: _propTypes.func,
|
|
81
|
+
onFocus: _propTypes.func,
|
|
82
|
+
placeholder: _propTypes.string,
|
|
83
|
+
size: _propTypes.string,
|
|
84
|
+
type: _propTypes.string,
|
|
85
|
+
value: _propTypes.string,
|
|
86
|
+
variant: _propTypes.string
|
|
87
|
+
};
|
|
88
|
+
UTSearchField.propTypes = propTypes;
|
|
89
|
+
var _default = exports.default = (0, _WithTheme.default)(_theme.retrieveStyle)(UTSearchField);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.retrieveStyle = void 0;
|
|
7
|
+
const retrieveStyle = _ref => {
|
|
8
|
+
let {
|
|
9
|
+
theme
|
|
10
|
+
} = _ref;
|
|
11
|
+
return {
|
|
12
|
+
input: {
|
|
13
|
+
'&::placeholder': {
|
|
14
|
+
color: "".concat(theme.Palette.gray['04'], " !important")
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
exports.retrieveStyle = retrieveStyle;
|
|
@@ -28,7 +28,6 @@
|
|
|
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. |
|
|
30
30
|
| required | bool | false | Marks the input field as required. |
|
|
31
|
-
| returnKeyType | string | 'done' | Determines the return key type on the keyboard (e.g., `done`, `next`). |
|
|
32
31
|
| RightIcon | elementType | | Icon displayed on the right side of the input field. |
|
|
33
32
|
| showCharacterCount | bool | false | Whether the character count should be displayed (if `maxLength` is defined). |
|
|
34
33
|
| style | shape({ container: object, input: object, root: object }) | | Style object to customize the input field. Can contain `root`, `container`, `input`, or `action` styles. |
|
|
@@ -6,6 +6,7 @@ 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 _constants = require("../../../UTBaseInputField/constants");
|
|
9
10
|
var _utils = require("../../../UTValidation/utils");
|
|
10
11
|
var _inputs = require("../../../../constants/inputs.js");
|
|
11
12
|
var _UTBaseInputField = _interopRequireDefault(require("../../../UTBaseInputField"));
|
|
@@ -50,6 +51,51 @@ const UTTextInput = _ref => {
|
|
|
50
51
|
} = _ref;
|
|
51
52
|
const titleColorTheme = readOnly ? 'gray' : 'dark';
|
|
52
53
|
const validationData = (0, _react.useMemo)(() => validations || error && (0, _utils.formatErrorToValidation)(error), [error, validations]);
|
|
54
|
+
const leftAdornments = (0, _react.useMemo)(() => {
|
|
55
|
+
const adornments = [];
|
|
56
|
+
if (LeftIcon) adornments.push({
|
|
57
|
+
name: _constants.COMPONENT_KEYS.ICON,
|
|
58
|
+
props: {
|
|
59
|
+
Icon: LeftIcon
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
if (prefix) adornments.push({
|
|
63
|
+
name: _constants.COMPONENT_KEYS.PREFIX,
|
|
64
|
+
props: {
|
|
65
|
+
text: prefix
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
return adornments;
|
|
69
|
+
}, [LeftIcon, prefix]);
|
|
70
|
+
const rightAdornments = (0, _react.useMemo)(() => {
|
|
71
|
+
const adornments = [];
|
|
72
|
+
if (suffix) adornments.push({
|
|
73
|
+
name: _constants.COMPONENT_KEYS.SUFFIX,
|
|
74
|
+
props: {
|
|
75
|
+
text: suffix
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
if (RightIcon || error) adornments.push({
|
|
79
|
+
name: _constants.COMPONENT_KEYS.ICON,
|
|
80
|
+
props: {
|
|
81
|
+
Icon: RightIcon,
|
|
82
|
+
changeOnError: true
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
if (action) adornments.push({
|
|
86
|
+
name: _constants.COMPONENT_KEYS.ACTION,
|
|
87
|
+
props: {
|
|
88
|
+
action
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
if (tooltip) adornments.push({
|
|
92
|
+
name: _constants.COMPONENT_KEYS.TOOLTIP,
|
|
93
|
+
props: {
|
|
94
|
+
tooltip
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
return adornments;
|
|
98
|
+
}, [suffix, RightIcon, error, action, tooltip]);
|
|
53
99
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
54
100
|
className: "".concat(_stylesModule.default.container, " ").concat(classNames.container)
|
|
55
101
|
}, title && /*#__PURE__*/_react.default.createElement(_UTFieldLabel.default, {
|
|
@@ -57,7 +103,6 @@ const UTTextInput = _ref => {
|
|
|
57
103
|
variant: _inputs.TITLE_VARIANTS[titleVariant],
|
|
58
104
|
required: required
|
|
59
105
|
}, title), /*#__PURE__*/_react.default.createElement(_UTBaseInputField.default, {
|
|
60
|
-
action: action,
|
|
61
106
|
alwaysShowPlaceholder: alwaysShowPlaceholder,
|
|
62
107
|
classNames: classNames,
|
|
63
108
|
dataTestId: dataTestId,
|
|
@@ -65,19 +110,16 @@ const UTTextInput = _ref => {
|
|
|
65
110
|
error: error,
|
|
66
111
|
id: id,
|
|
67
112
|
inputSize: inputSize,
|
|
68
|
-
|
|
113
|
+
leftAdornments: leftAdornments,
|
|
69
114
|
maxLength: maxLength,
|
|
70
115
|
maxRows: maxRows,
|
|
71
116
|
onBlur: onBlur,
|
|
72
117
|
onChange: onChange,
|
|
73
118
|
onFocus: onFocus,
|
|
74
119
|
placeholder: placeholder,
|
|
75
|
-
prefix: prefix,
|
|
76
120
|
readOnly: readOnly,
|
|
77
|
-
|
|
121
|
+
rightAdornments: rightAdornments,
|
|
78
122
|
showCharacterCount: showCharacterCount,
|
|
79
|
-
suffix: suffix,
|
|
80
|
-
tooltip: tooltip,
|
|
81
123
|
type: type,
|
|
82
124
|
value: value
|
|
83
125
|
}), helpText && /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
package/dist/index.js
CHANGED
|
@@ -285,6 +285,12 @@ Object.defineProperty(exports, "UTRating", {
|
|
|
285
285
|
return _UTRating.default;
|
|
286
286
|
}
|
|
287
287
|
});
|
|
288
|
+
Object.defineProperty(exports, "UTSearchField", {
|
|
289
|
+
enumerable: true,
|
|
290
|
+
get: function () {
|
|
291
|
+
return _UTSearchField.default;
|
|
292
|
+
}
|
|
293
|
+
});
|
|
288
294
|
Object.defineProperty(exports, "UTSelect", {
|
|
289
295
|
enumerable: true,
|
|
290
296
|
get: function () {
|
|
@@ -465,6 +471,7 @@ var _UTProductItem = _interopRequireDefault(require("./components/UTProductItem"
|
|
|
465
471
|
var _UTProgressBar = _interopRequireDefault(require("./components/UTProgressBar"));
|
|
466
472
|
var _UTRadioGroup = _interopRequireDefault(require("./components/UTRadioGroup"));
|
|
467
473
|
var _UTRating = _interopRequireDefault(require("./components/UTRating"));
|
|
474
|
+
var _UTSearchField = _interopRequireDefault(require("./components/UTSearchField"));
|
|
468
475
|
var _UTSelect = _interopRequireDefault(require("./components/UTSelect"));
|
|
469
476
|
var _UTSelectableCard = _interopRequireDefault(require("./components/UTSelectableCard"));
|
|
470
477
|
var _UTSidebar = _interopRequireDefault(require("./components/UTSidebar"));
|
package/package.json
CHANGED
|
@@ -1,31 +0,0 @@
|
|
|
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;
|
|
@@ -1,48 +0,0 @@
|
|
|
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;
|
|
@@ -1,17 +0,0 @@
|
|
|
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;
|
|
@@ -1,24 +0,0 @@
|
|
|
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;
|
|
@@ -1,22 +0,0 @@
|
|
|
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;
|
|
@@ -1,26 +0,0 @@
|
|
|
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 _UTTooltip = _interopRequireDefault(require("../../../../../UTTooltip"));
|
|
10
|
-
var _UTIcon = _interopRequireDefault(require("../../../../../UTIcon"));
|
|
11
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
-
const TooltipAdornment = _ref => {
|
|
13
|
-
let {
|
|
14
|
-
tooltip
|
|
15
|
-
} = _ref;
|
|
16
|
-
return /*#__PURE__*/_react.default.createElement(_UTTooltip.default, {
|
|
17
|
-
content: tooltip
|
|
18
|
-
}, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_UTIcon.default, {
|
|
19
|
-
name: "IconInfoCircle",
|
|
20
|
-
colorTheme: "gray"
|
|
21
|
-
})));
|
|
22
|
-
};
|
|
23
|
-
TooltipAdornment.propTypes = {
|
|
24
|
-
tooltip: _propTypes.string
|
|
25
|
-
};
|
|
26
|
-
var _default = exports.default = TooltipAdornment;
|
|
@@ -1,94 +0,0 @@
|
|
|
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: 'hidden',
|
|
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
|
-
}
|
|
92
|
-
};
|
|
93
|
-
};
|
|
94
|
-
exports.retrieveStyle = retrieveStyle;
|