@widergy/energy-ui 3.37.2 → 3.38.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/UTBadge/index.js +1 -1
- package/dist/components/UTBaseInputField/components/BadgeAdornment/index.js +24 -0
- package/dist/components/UTBaseInputField/components/IconAdornment/index.js +12 -6
- package/dist/components/UTBaseInputField/constants.js +3 -0
- package/dist/components/UTBaseInputField/index.js +32 -18
- package/dist/components/UTBaseInputField/theme.js +83 -31
- package/dist/components/UTCheckList/versions/V1/constants.js +3 -2
- package/dist/components/UTCheckList/versions/V1/index.js +15 -13
- package/dist/components/UTCheckbox/versions/V1/index.js +2 -4
- package/dist/components/UTCheckbox/versions/V1/theme.js +1 -1
- package/dist/components/UTPaper/index.js +29 -0
- package/dist/components/UTPaper/theme.js +26 -0
- package/dist/components/UTPasswordField/versions/V0/index.js +1 -1
- package/dist/components/UTPhoneInput/versions/V1/index.js +3 -3
- package/dist/components/UTSelect/index.js +12 -185
- package/dist/components/UTSelect/versions/V0/index.js +199 -0
- package/dist/components/UTSelect/{stylesJS.js → versions/V0/stylesJS.js} +1 -1
- package/dist/components/UTSelect/{theme.js → versions/V0/theme.js} +1 -1
- package/dist/components/UTSelect/versions/V1/README.md +90 -0
- package/dist/components/UTSelect/versions/V1/components/InputComponent/index.js +98 -0
- package/dist/components/UTSelect/versions/V1/components/ListboxComponent/index.js +51 -0
- package/dist/components/UTSelect/versions/V1/components/ListboxComponent/styles.module.scss +7 -0
- package/dist/components/UTSelect/versions/V1/index.js +203 -0
- package/dist/components/UTSelect/versions/V1/styles.module.scss +5 -0
- package/dist/components/UTSelect/versions/V1/utils.js +116 -0
- package/dist/components/UTTouchableWithoutFeedback/index.js +9 -4
- package/package.json +1 -1
- /package/dist/components/UTSelect/{components → versions/V0/components}/Option/index.js +0 -0
- /package/dist/components/UTSelect/{constants.js → versions/V0/constants.js} +0 -0
- /package/dist/components/UTSelect/{styles.module.scss → versions/V0/styles.module.scss} +0 -0
- /package/dist/components/UTSelect/{utils.js → versions/V0/utils.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [3.38.0](https://github.com/widergy/energy-ui/compare/v3.37.2...v3.38.0) (2024-11-04)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* [UGB-1632] select ([#518](https://github.com/widergy/energy-ui/issues/518)) ([6224204](https://github.com/widergy/energy-ui/commit/6224204cb5e0071add57d2063a756bc6e1f7850c))
|
|
7
|
+
|
|
1
8
|
## [3.37.2](https://github.com/widergy/energy-ui/compare/v3.37.1...v3.37.2) (2024-11-01)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -42,7 +42,7 @@ const UTBadge = _ref => {
|
|
|
42
42
|
};
|
|
43
43
|
UTBadge.defaultProps = _constants.DEFAULT_PROPS;
|
|
44
44
|
UTBadge.propTypes = {
|
|
45
|
-
children: _propTypes.string,
|
|
45
|
+
children: (0, _propTypes.oneOfType)([_propTypes.number, _propTypes.string]),
|
|
46
46
|
classes: (0, _propTypes.objectOf)(_propTypes.string),
|
|
47
47
|
className: _propTypes.string,
|
|
48
48
|
colorTheme: _propTypes.string
|
|
@@ -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 _UTBadge = _interopRequireDefault(require("../../../UTBadge"));
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
const BadgeAdornment = _ref => {
|
|
12
|
+
let {
|
|
13
|
+
text,
|
|
14
|
+
colorTheme
|
|
15
|
+
} = _ref;
|
|
16
|
+
return /*#__PURE__*/_react.default.createElement(_UTBadge.default, {
|
|
17
|
+
colorTheme: colorTheme
|
|
18
|
+
}, text);
|
|
19
|
+
};
|
|
20
|
+
BadgeAdornment.propTypes = {
|
|
21
|
+
colorTheme: _propTypes.string,
|
|
22
|
+
text: (0, _propTypes.oneOfType)([_propTypes.string, _propTypes.number])
|
|
23
|
+
};
|
|
24
|
+
var _default = exports.default = BadgeAdornment;
|
|
@@ -14,26 +14,31 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
14
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
15
|
const IconAdornment = _ref => {
|
|
16
16
|
let {
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
changeIconOnError = true,
|
|
18
|
+
changeOnError,
|
|
19
|
+
changeOnFocus,
|
|
19
20
|
colorTheme,
|
|
20
21
|
error,
|
|
21
22
|
focused,
|
|
22
23
|
Icon,
|
|
23
24
|
inputStyle,
|
|
24
|
-
shade
|
|
25
|
+
shade,
|
|
26
|
+
showOnlyOnError
|
|
25
27
|
} = _ref;
|
|
26
|
-
const
|
|
28
|
+
const effectiveChangeOnError = showOnlyOnError || changeOnError;
|
|
29
|
+
if (showOnlyOnError && !error) return null;
|
|
30
|
+
const IconToRender = error && changeIconOnError ? _constants.ERROR_ICON : Icon;
|
|
27
31
|
if (!IconToRender) return null;
|
|
28
32
|
return (0, _componentUtils.isUTIcon)(IconToRender) ? /*#__PURE__*/_react.default.createElement(_UTIcon.default, _extends({
|
|
29
33
|
name: IconToRender,
|
|
30
34
|
size: _constants.ICON_SIZE
|
|
31
|
-
}, (0, _utils.getIconColorProps)(
|
|
35
|
+
}, (0, _utils.getIconColorProps)(effectiveChangeOnError, changeOnFocus, colorTheme, error, focused, shade))) : /*#__PURE__*/_react.default.createElement(Icon, {
|
|
32
36
|
size: _constants.ICON_SIZE,
|
|
33
37
|
fill: inputStyle.root.color
|
|
34
38
|
});
|
|
35
39
|
};
|
|
36
40
|
IconAdornment.propTypes = {
|
|
41
|
+
changeIconOnError: _propTypes.bool,
|
|
37
42
|
changeOnError: _propTypes.bool,
|
|
38
43
|
changeOnFocus: _propTypes.bool,
|
|
39
44
|
colorTheme: _propTypes.string,
|
|
@@ -43,6 +48,7 @@ IconAdornment.propTypes = {
|
|
|
43
48
|
inputStyle: (0, _propTypes.shape)({
|
|
44
49
|
root: _propTypes.object
|
|
45
50
|
}),
|
|
46
|
-
shade: _propTypes.string
|
|
51
|
+
shade: _propTypes.string,
|
|
52
|
+
showOnlyOnError: _propTypes.bool
|
|
47
53
|
};
|
|
48
54
|
var _default = exports.default = IconAdornment;
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.COMPONENT_KEYS = exports.COMPONENTS_MAPPER = void 0;
|
|
7
7
|
var _ActionAdornment = _interopRequireDefault(require("./components/ActionAdornment"));
|
|
8
|
+
var _BadgeAdornment = _interopRequireDefault(require("./components/BadgeAdornment"));
|
|
8
9
|
var _IconAdornment = _interopRequireDefault(require("./components/IconAdornment"));
|
|
9
10
|
var _PrefixAdornment = _interopRequireDefault(require("./components/PrefixAdornment"));
|
|
10
11
|
var _SuffixAdornment = _interopRequireDefault(require("./components/SuffixAdornment"));
|
|
@@ -12,6 +13,7 @@ var _TooltipAdornment = _interopRequireDefault(require("./components/TooltipAdor
|
|
|
12
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
14
|
const COMPONENT_KEYS = exports.COMPONENT_KEYS = {
|
|
14
15
|
ACTION: 'Action',
|
|
16
|
+
BADGE: 'Badge',
|
|
15
17
|
ICON: 'Icon',
|
|
16
18
|
PREFIX: 'Prefix',
|
|
17
19
|
SUFFIX: 'Suffix',
|
|
@@ -19,6 +21,7 @@ const COMPONENT_KEYS = exports.COMPONENT_KEYS = {
|
|
|
19
21
|
};
|
|
20
22
|
const COMPONENTS_MAPPER = exports.COMPONENTS_MAPPER = {
|
|
21
23
|
[COMPONENT_KEYS.ACTION]: _ActionAdornment.default,
|
|
24
|
+
[COMPONENT_KEYS.BADGE]: _BadgeAdornment.default,
|
|
22
25
|
[COMPONENT_KEYS.ICON]: _IconAdornment.default,
|
|
23
26
|
[COMPONENT_KEYS.PREFIX]: _PrefixAdornment.default,
|
|
24
27
|
[COMPONENT_KEYS.SUFFIX]: _SuffixAdornment.default,
|
|
@@ -27,9 +27,11 @@ const UTBaseInputField = _ref => {
|
|
|
27
27
|
disabled,
|
|
28
28
|
error,
|
|
29
29
|
id,
|
|
30
|
+
inputRef,
|
|
30
31
|
leftAdornments = [],
|
|
31
32
|
maxLength,
|
|
32
33
|
maxRows = 1,
|
|
34
|
+
muiProps,
|
|
33
35
|
onBlur,
|
|
34
36
|
onChange = () => {},
|
|
35
37
|
onFocus,
|
|
@@ -85,15 +87,15 @@ const UTBaseInputField = _ref => {
|
|
|
85
87
|
} : undefined
|
|
86
88
|
};
|
|
87
89
|
return Component ? /*#__PURE__*/_react.default.createElement(Component, _extends({}, adornmentProps, {
|
|
88
|
-
key: adornment.name
|
|
90
|
+
key: adornment.key || adornment.name
|
|
89
91
|
})) : null;
|
|
90
92
|
}, [error, disabled, readOnly, focused]);
|
|
91
|
-
return /*#__PURE__*/_react.default.createElement(_TextField.default, {
|
|
92
|
-
margin: "none",
|
|
93
|
+
return /*#__PURE__*/_react.default.createElement(_TextField.default, _extends({
|
|
93
94
|
autoComplete: "new-password",
|
|
94
95
|
disabled: disabled || readOnly,
|
|
95
96
|
error: error,
|
|
96
97
|
id: id,
|
|
98
|
+
margin: "none",
|
|
97
99
|
maxRows: maxRows,
|
|
98
100
|
minRows: maxRows,
|
|
99
101
|
multiline: multiline,
|
|
@@ -104,18 +106,22 @@ const UTBaseInputField = _ref => {
|
|
|
104
106
|
placeholder: shouldShowPlaceholder ? placeholder : '',
|
|
105
107
|
type: type === 'numeric' ? 'text' : type,
|
|
106
108
|
value: value,
|
|
107
|
-
|
|
109
|
+
inputRef: inputRef,
|
|
110
|
+
variant: "outlined"
|
|
111
|
+
}, muiProps, {
|
|
108
112
|
InputProps: {
|
|
109
113
|
inputProps: {
|
|
114
|
+
'data-testid': dataTestId,
|
|
110
115
|
maxLength,
|
|
111
|
-
|
|
116
|
+
readOnly,
|
|
117
|
+
...(muiProps === null || muiProps === void 0 ? void 0 : muiProps.inputProps)
|
|
112
118
|
},
|
|
113
119
|
classes: {
|
|
114
120
|
adornedEnd: _stylesModule.default.elementsContainer,
|
|
115
121
|
adornedStart: _stylesModule.default.elementsContainer,
|
|
116
|
-
input: classes.input,
|
|
122
|
+
input: "".concat(classes.input, " ").concat(focused && classes.focusedInput),
|
|
117
123
|
notchedOutline: "".concat(classes.inputContainer, " ").concat(focused && classes.focusedInputContainer),
|
|
118
|
-
root: "".concat(classes.root, " ").concat(focused && classes.focusedRoot)
|
|
124
|
+
root: "".concat(classes.root, " ").concat(focused && classes.focusedRoot, " ").concat(value && classes.withValueRoot)
|
|
119
125
|
},
|
|
120
126
|
startAdornment: validLeftAdornments.length > 0 ? /*#__PURE__*/_react.default.createElement("div", {
|
|
121
127
|
className: _stylesModule.default.adornmentsContainer
|
|
@@ -126,33 +132,41 @@ const UTBaseInputField = _ref => {
|
|
|
126
132
|
}, (value === null || value === void 0 ? void 0 : value.length) || 0, "/", maxLength),
|
|
127
133
|
endAdornment: validRightAdornments.length > 0 && /*#__PURE__*/_react.default.createElement("div", {
|
|
128
134
|
className: "".concat(_stylesModule.default.adornmentsContainer, " ").concat(multiline && _stylesModule.default.multilineAdornmentsContainer)
|
|
129
|
-
}, validRightAdornments.map(renderAdornment))
|
|
135
|
+
}, validRightAdornments.map(renderAdornment)),
|
|
136
|
+
...(muiProps === null || muiProps === void 0 ? void 0 : muiProps.InputProps)
|
|
130
137
|
}
|
|
131
|
-
});
|
|
138
|
+
}));
|
|
132
139
|
};
|
|
133
140
|
const propTypes = exports.propTypes = {
|
|
134
|
-
leftAdornments: (0, _propTypes.arrayOf)((0, _propTypes.shape)({
|
|
135
|
-
name: _propTypes.string.isRequired,
|
|
136
|
-
props: (0, _propTypes.objectOf)(_propTypes.string)
|
|
137
|
-
})),
|
|
138
|
-
rightAdornments: (0, _propTypes.arrayOf)((0, _propTypes.shape)({
|
|
139
|
-
name: _propTypes.string.isRequired,
|
|
140
|
-
props: (0, _propTypes.objectOf)(_propTypes.string)
|
|
141
|
-
})),
|
|
142
141
|
alwaysShowPlaceholder: _propTypes.bool,
|
|
143
142
|
classes: (0, _propTypes.objectOf)(_propTypes.string),
|
|
144
143
|
classNames: (0, _propTypes.objectOf)(_propTypes.string),
|
|
145
144
|
dataTestId: _propTypes.string,
|
|
146
145
|
disabled: _propTypes.bool,
|
|
147
|
-
error: _propTypes.bool,
|
|
146
|
+
error: (0, _propTypes.oneOfType)([_propTypes.bool, _propTypes.string]),
|
|
148
147
|
id: _propTypes.string,
|
|
148
|
+
inputRef: (0, _propTypes.oneOfType)([_propTypes.func, (0, _propTypes.shape)({
|
|
149
|
+
current: (0, _propTypes.instanceOf)(Element)
|
|
150
|
+
})]),
|
|
151
|
+
leftAdornments: (0, _propTypes.arrayOf)((0, _propTypes.shape)({
|
|
152
|
+
name: _propTypes.string.isRequired,
|
|
153
|
+
props: _propTypes.object
|
|
154
|
+
})),
|
|
149
155
|
maxLength: _propTypes.number,
|
|
150
156
|
maxRows: _propTypes.number,
|
|
157
|
+
muiProps: (0, _propTypes.shape)({
|
|
158
|
+
inputProps: _propTypes.object,
|
|
159
|
+
InputProps: _propTypes.object
|
|
160
|
+
}),
|
|
151
161
|
onBlur: _propTypes.func,
|
|
152
162
|
onChange: _propTypes.func,
|
|
153
163
|
onFocus: _propTypes.func,
|
|
154
164
|
placeholder: _propTypes.string,
|
|
155
165
|
readOnly: _propTypes.bool,
|
|
166
|
+
rightAdornments: (0, _propTypes.arrayOf)((0, _propTypes.shape)({
|
|
167
|
+
name: _propTypes.string.isRequired,
|
|
168
|
+
props: _propTypes.object
|
|
169
|
+
})),
|
|
156
170
|
showCharacterCount: _propTypes.bool,
|
|
157
171
|
type: _propTypes.string,
|
|
158
172
|
value: _propTypes.string,
|
|
@@ -15,8 +15,44 @@ const SMALL_PADDING = {
|
|
|
15
15
|
VERTICAL: 8
|
|
16
16
|
};
|
|
17
17
|
const GRID_GAP = 16;
|
|
18
|
-
const
|
|
18
|
+
const getPaddingValues = inputSize => {
|
|
19
|
+
const vertical = inputSize === 'small' ? SMALL_PADDING.VERTICAL : PADDING.VERTICAL;
|
|
20
|
+
const horizontal = inputSize === 'small' ? SMALL_PADDING.HORIZONTAL : PADDING.HORIZONTAL;
|
|
21
|
+
const multiline = vertical + GRID_GAP + charactersCountRowHeight;
|
|
22
|
+
return {
|
|
23
|
+
verticalPadding: "".concat(vertical, "px"),
|
|
24
|
+
horizontalPadding: "".concat(horizontal, "px"),
|
|
25
|
+
multilineVerticalPadding: "".concat(multiline, "px")
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
const getBackgroundColor = _ref => {
|
|
29
|
+
let {
|
|
30
|
+
theme,
|
|
31
|
+
variant,
|
|
32
|
+
error,
|
|
33
|
+
disabled,
|
|
34
|
+
readOnly
|
|
35
|
+
} = _ref;
|
|
36
|
+
if (readOnly) return 'transparent';
|
|
37
|
+
if (variant === 'gray') return theme.Palette.light['04'];
|
|
38
|
+
if (variant === 'transparent' && error) return theme.Palette.error['01'];
|
|
39
|
+
if (disabled) return theme.Palette.light['03'];
|
|
40
|
+
return theme.Palette.light['01'];
|
|
41
|
+
};
|
|
42
|
+
const getBorderColor = _ref2 => {
|
|
19
43
|
let {
|
|
44
|
+
theme,
|
|
45
|
+
variant,
|
|
46
|
+
error,
|
|
47
|
+
readOnly,
|
|
48
|
+
disabled
|
|
49
|
+
} = _ref2;
|
|
50
|
+
if (variant === 'gray' || variant === 'transparent' || readOnly || disabled) return 'transparent !important';
|
|
51
|
+
if (error) return "".concat(theme.Palette.error['04'], " !important");
|
|
52
|
+
return "".concat(theme.Palette.light['05'], " !important");
|
|
53
|
+
};
|
|
54
|
+
const retrieveStyle = props => {
|
|
55
|
+
const {
|
|
20
56
|
disabled: receivedDisabled,
|
|
21
57
|
error,
|
|
22
58
|
inputSize,
|
|
@@ -25,59 +61,68 @@ const retrieveStyle = _ref => {
|
|
|
25
61
|
showCharacterCount,
|
|
26
62
|
theme,
|
|
27
63
|
variant
|
|
28
|
-
} =
|
|
64
|
+
} = props;
|
|
29
65
|
const disabled = receivedDisabled && !readOnly;
|
|
30
|
-
const verticalPadding = "".concat(inputSize === 'small' ? SMALL_PADDING.VERTICAL : PADDING.VERTICAL, "px");
|
|
31
|
-
const multilineVerticalPadding = "".concat((inputSize === 'small' ? SMALL_PADDING.VERTICAL : PADDING.VERTICAL) + GRID_GAP + charactersCountRowHeight, "px");
|
|
32
|
-
const horizontalPadding = "".concat(inputSize === 'small' ? SMALL_PADDING.HORIZONTAL : PADDING.HORIZONTAL, "px");
|
|
33
66
|
const hasCharactersCount = showCharacterCount && maxLength && !disabled && !readOnly;
|
|
67
|
+
const {
|
|
68
|
+
verticalPadding,
|
|
69
|
+
horizontalPadding,
|
|
70
|
+
multilineVerticalPadding
|
|
71
|
+
} = getPaddingValues(inputSize);
|
|
34
72
|
return {
|
|
35
73
|
charactersCount: {
|
|
36
|
-
|
|
37
|
-
|
|
74
|
+
bottom: verticalPadding,
|
|
75
|
+
position: 'absolute'
|
|
38
76
|
},
|
|
39
77
|
root: {
|
|
40
|
-
backgroundColor:
|
|
78
|
+
backgroundColor: getBackgroundColor({
|
|
79
|
+
theme,
|
|
80
|
+
variant,
|
|
81
|
+
error,
|
|
82
|
+
disabled,
|
|
83
|
+
readOnly
|
|
84
|
+
}),
|
|
41
85
|
paddingBottom: hasCharactersCount ? multilineVerticalPadding : verticalPadding,
|
|
42
86
|
paddingLeft: horizontalPadding,
|
|
43
87
|
paddingRight: horizontalPadding,
|
|
44
88
|
paddingTop: verticalPadding,
|
|
45
|
-
...(variant === 'gray' && {
|
|
46
|
-
backgroundColor: theme.Palette.light['04']
|
|
47
|
-
}),
|
|
48
89
|
...(readOnly && {
|
|
49
|
-
backgroundColor: 'transparent',
|
|
50
90
|
paddingLeft: 0,
|
|
51
91
|
paddingRight: 0
|
|
52
92
|
}),
|
|
53
|
-
|
|
54
|
-
backgroundColor: theme.Palette.light['03']
|
|
55
|
-
}
|
|
93
|
+
'&:hover': {
|
|
94
|
+
backgroundColor: variant === 'transparent' && error ? theme.Palette.error['02'] : !readOnly && theme.Palette.light['03']
|
|
95
|
+
}
|
|
56
96
|
},
|
|
57
97
|
inputContainer: {
|
|
58
|
-
borderColor:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
...(error && {
|
|
65
|
-
borderColor: "".concat(theme.Palette.error['04'], " !important")
|
|
66
|
-
}),
|
|
67
|
-
...(readOnly && {
|
|
68
|
-
borderColor: 'transparent !important'
|
|
98
|
+
borderColor: getBorderColor({
|
|
99
|
+
theme,
|
|
100
|
+
variant,
|
|
101
|
+
error,
|
|
102
|
+
readOnly,
|
|
103
|
+
disabled
|
|
69
104
|
}),
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
})
|
|
105
|
+
borderRadius: '4px',
|
|
106
|
+
borderWidth: '1px'
|
|
73
107
|
},
|
|
74
108
|
focusedRoot: {
|
|
75
|
-
backgroundColor: theme.Palette.light['01']
|
|
109
|
+
backgroundColor: theme.Palette.light['01'],
|
|
110
|
+
'&:hover': {
|
|
111
|
+
backgroundColor: theme.Palette.light['01']
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
withValueRoot: {
|
|
115
|
+
...(variant === 'transparent' && !error && {
|
|
116
|
+
backgroundColor: theme.Palette.accent['01']
|
|
117
|
+
})
|
|
76
118
|
},
|
|
77
119
|
focusedInputContainer: {
|
|
78
120
|
...(!error && {
|
|
79
121
|
borderColor: "".concat(theme.Palette.accent['04'], " !important"),
|
|
80
122
|
borderWidth: '2px'
|
|
123
|
+
}),
|
|
124
|
+
...(error && {
|
|
125
|
+
borderColor: "".concat(theme.Palette.error['04'], " !important")
|
|
81
126
|
})
|
|
82
127
|
},
|
|
83
128
|
input: {
|
|
@@ -93,7 +138,8 @@ const retrieveStyle = _ref => {
|
|
|
93
138
|
padding: 0,
|
|
94
139
|
textOverflow: 'ellipsis',
|
|
95
140
|
'&::placeholder': {
|
|
96
|
-
color: theme.Palette.gray['02']
|
|
141
|
+
color: variant === 'transparent' && !disabled ? theme.Palette.dark['05'] : theme.Palette.gray['02'],
|
|
142
|
+
opacity: 1
|
|
97
143
|
},
|
|
98
144
|
'&::selection': {
|
|
99
145
|
backgroundColor: theme.Palette.accent['02']
|
|
@@ -101,6 +147,12 @@ const retrieveStyle = _ref => {
|
|
|
101
147
|
...(disabled && {
|
|
102
148
|
color: theme.Palette.gray['04']
|
|
103
149
|
})
|
|
150
|
+
},
|
|
151
|
+
focusedInput: {
|
|
152
|
+
'&::placeholder': {
|
|
153
|
+
color: theme.Palette.gray['02'],
|
|
154
|
+
opacity: 1
|
|
155
|
+
}
|
|
104
156
|
}
|
|
105
157
|
};
|
|
106
158
|
};
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.SPACING = void 0;
|
|
6
|
+
exports.SPACING = exports.NO_CATEGORY = void 0;
|
|
7
7
|
const SPACING = exports.SPACING = {
|
|
8
8
|
SMALL: 'small',
|
|
9
9
|
MEDIUM: 'medium'
|
|
10
|
-
};
|
|
10
|
+
};
|
|
11
|
+
const NO_CATEGORY = exports.NO_CATEGORY = 'No Category';
|
|
@@ -14,11 +14,10 @@ var _UTLabel = _interopRequireDefault(require("../../../UTLabel"));
|
|
|
14
14
|
var _UTValidation = _interopRequireDefault(require("../../../UTValidation"));
|
|
15
15
|
var _utils2 = require("./utils");
|
|
16
16
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
17
|
+
var _constants2 = require("./constants");
|
|
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
|
-
/* eslint-disable no-unused-vars */
|
|
21
|
-
|
|
22
21
|
const UTCheckList = _ref => {
|
|
23
22
|
let {
|
|
24
23
|
classNames = {},
|
|
@@ -53,19 +52,22 @@ const UTCheckList = _ref => {
|
|
|
53
52
|
}, [value, onChange]);
|
|
54
53
|
const categorizedOptions = (0, _react.useMemo)(() => {
|
|
55
54
|
const optionsGrouped = options.reduce((groupedOptions, option) => {
|
|
56
|
-
const category = option.category ||
|
|
55
|
+
const category = option.category || _constants2.NO_CATEGORY;
|
|
57
56
|
if (!groupedOptions[category]) {
|
|
58
57
|
groupedOptions[category] = [];
|
|
59
58
|
}
|
|
60
59
|
groupedOptions[category].push(option);
|
|
61
60
|
return groupedOptions;
|
|
62
61
|
}, {
|
|
63
|
-
|
|
62
|
+
NO_CATEGORY: []
|
|
64
63
|
});
|
|
65
|
-
return Object.entries(optionsGrouped).
|
|
66
|
-
let [
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
return Object.entries(optionsGrouped).filter(_ref2 => {
|
|
65
|
+
let [, categoryOptions] = _ref2;
|
|
66
|
+
return categoryOptions.length > 0;
|
|
67
|
+
}).sort((_ref3, _ref4) => {
|
|
68
|
+
let [categoryA] = _ref3;
|
|
69
|
+
let [categoryB] = _ref4;
|
|
70
|
+
return categoryA === _constants2.NO_CATEGORY ? -1 : categoryB === _constants2.NO_CATEGORY ? 1 : 0;
|
|
69
71
|
});
|
|
70
72
|
}, [options]);
|
|
71
73
|
const enabledOptions = (0, _react.useMemo)(() => options.filter(option => !option.disabled), [options]);
|
|
@@ -85,7 +87,7 @@ const UTCheckList = _ref => {
|
|
|
85
87
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
86
88
|
className: "".concat(_stylesModule.default.container, " ").concat(smallVerticalSpacingClass, " ").concat(classNames.root),
|
|
87
89
|
"data-testid": dataTestId
|
|
88
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
90
|
+
}, (title || validationData) && /*#__PURE__*/_react.default.createElement("div", {
|
|
89
91
|
className: "".concat(_stylesModule.default.headerContainer, " ").concat(classNames.header)
|
|
90
92
|
}, title && /*#__PURE__*/_react.default.createElement(_UTFieldLabel.default, {
|
|
91
93
|
required: required
|
|
@@ -103,12 +105,12 @@ const UTCheckList = _ref => {
|
|
|
103
105
|
value: areAllSelected,
|
|
104
106
|
variant: variant,
|
|
105
107
|
version: "V1"
|
|
106
|
-
}), categorizedOptions.map(
|
|
107
|
-
let [category, categoryOptions] =
|
|
108
|
+
}), categorizedOptions.map(_ref5 => {
|
|
109
|
+
let [category, categoryOptions] = _ref5;
|
|
108
110
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
109
111
|
className: "".concat(_stylesModule.default.categoryContainer, " ").concat(smallVerticalSpacingClass),
|
|
110
112
|
key: category
|
|
111
|
-
}, category !==
|
|
113
|
+
}, category !== _constants2.NO_CATEGORY && /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
112
114
|
className: _stylesModule.default.categoryTitle,
|
|
113
115
|
colorTheme: "gray",
|
|
114
116
|
variant: "small",
|
|
@@ -119,7 +121,7 @@ const UTCheckList = _ref => {
|
|
|
119
121
|
isSimple: isSimple,
|
|
120
122
|
key: item.value,
|
|
121
123
|
onChange: () => handleChange(item.value),
|
|
122
|
-
reversed: reversedBasedOnVariant,
|
|
124
|
+
reversed: isSimple ? reversedBasedOnVariant : reversed,
|
|
123
125
|
spacing: horizontalSpacing,
|
|
124
126
|
title: item.label,
|
|
125
127
|
value: (0, _utils2.isChecked)(item, value),
|
|
@@ -36,13 +36,11 @@ const UTCheckbox = _ref => {
|
|
|
36
36
|
const classes = (0, _react.useMemo)(() => (0, _classesUtils.mergeClasses)(theme, classNames), [classNames, theme]);
|
|
37
37
|
const iconName = (0, _react.useMemo)(() => indeterminate ? _constants.INDETERMINATE_ICON : value ? _constants.CHECKED_ICON : '', [indeterminate, value]);
|
|
38
38
|
const handlePress = (0, _react.useCallback)(() => {
|
|
39
|
-
if (!disabled && onChange)
|
|
40
|
-
onChange(!value);
|
|
41
|
-
}
|
|
39
|
+
if (!disabled && onChange) onChange(!value);
|
|
42
40
|
}, [disabled, onChange, value]);
|
|
43
41
|
const shouldHighlightLabel = value && variant === _constants.BUTTON_VARIANT;
|
|
44
42
|
const touchableProps = {
|
|
45
|
-
|
|
43
|
+
onMouseDown: handlePress,
|
|
46
44
|
disabled
|
|
47
45
|
};
|
|
48
46
|
const RootComponent = variant === _constants.BUTTON_VARIANT ? _UTTouchableWithoutFeedback.default : 'div';
|
|
@@ -49,7 +49,7 @@ const conditionalStyles = _ref => {
|
|
|
49
49
|
}),
|
|
50
50
|
...(variant === _constants.BUTTON_VARIANT && {
|
|
51
51
|
borderRadius: '8px',
|
|
52
|
-
padding: '12px 16px',
|
|
52
|
+
padding: spacing === 'small' ? '8px 12px' : '12px 16px',
|
|
53
53
|
'&:active': {
|
|
54
54
|
backgroundColor: theme.Palette.light['04']
|
|
55
55
|
}
|
|
@@ -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 _core = require("@material-ui/core");
|
|
10
|
+
var _WithTheme = _interopRequireDefault(require("../WithTheme"));
|
|
11
|
+
var _theme = require("./theme");
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
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); }
|
|
14
|
+
const UTPaper = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
children,
|
|
17
|
+
classes,
|
|
18
|
+
...otherProps
|
|
19
|
+
} = _ref;
|
|
20
|
+
return /*#__PURE__*/_react.default.createElement(_core.Paper, _extends({}, otherProps, {
|
|
21
|
+
className: classes.paper
|
|
22
|
+
}), children);
|
|
23
|
+
};
|
|
24
|
+
UTPaper.propTypes = {
|
|
25
|
+
children: _propTypes.object,
|
|
26
|
+
classes: (0, _propTypes.objectOf)(_propTypes.string),
|
|
27
|
+
otherProps: _propTypes.object
|
|
28
|
+
};
|
|
29
|
+
var _default = exports.default = (0, _WithTheme.default)(_theme.retrieveStyle)(UTPaper);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.retrieveStyle = void 0;
|
|
7
|
+
var _shadowUtils = require("../../utils/shadowUtils");
|
|
8
|
+
const retrieveStyle = _ref => {
|
|
9
|
+
var _theme$Palette$shadow;
|
|
10
|
+
let {
|
|
11
|
+
theme
|
|
12
|
+
} = _ref;
|
|
13
|
+
return {
|
|
14
|
+
paper: {
|
|
15
|
+
backgroundColor: theme.Palette.light['01'],
|
|
16
|
+
borderRadius: '8px',
|
|
17
|
+
boxShadow: (0, _shadowUtils.getShadow)({
|
|
18
|
+
color: (_theme$Palette$shadow = theme.Palette.shadows) === null || _theme$Palette$shadow === void 0 ? void 0 : _theme$Palette$shadow.grayscale,
|
|
19
|
+
level: 2
|
|
20
|
+
}),
|
|
21
|
+
marginTop: '8px',
|
|
22
|
+
padding: '16px'
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
exports.retrieveStyle = retrieveStyle;
|
|
@@ -37,7 +37,7 @@ const UTPhoneInput = _ref => {
|
|
|
37
37
|
title,
|
|
38
38
|
titleVariant,
|
|
39
39
|
translations = {
|
|
40
|
-
areaCodeMinLenghtError: 'El código de área debe contener al menos 2
|
|
40
|
+
areaCodeMinLenghtError: 'El código de área debe contener al menos 2 dígitos.',
|
|
41
41
|
areaCodeWithoutZeroError: 'El código de área debe comenzar sin 0.',
|
|
42
42
|
invalidAreaCodeError: 'No pudimos reconocer el código de área ingresado. Intenta con uno diferente.'
|
|
43
43
|
},
|
|
@@ -140,7 +140,7 @@ const UTPhoneInput = _ref => {
|
|
|
140
140
|
rightAdornments: [{
|
|
141
141
|
name: _constants.COMPONENT_KEYS.ICON,
|
|
142
142
|
props: {
|
|
143
|
-
|
|
143
|
+
showOnlyOnError: true
|
|
144
144
|
}
|
|
145
145
|
}],
|
|
146
146
|
value: areaCodeState.code
|
|
@@ -165,7 +165,7 @@ const UTPhoneInput = _ref => {
|
|
|
165
165
|
rightAdornments: [{
|
|
166
166
|
name: _constants.COMPONENT_KEYS.ICON,
|
|
167
167
|
props: {
|
|
168
|
-
|
|
168
|
+
showOnlyOnError: true
|
|
169
169
|
}
|
|
170
170
|
}],
|
|
171
171
|
type: "numeric",
|