@widergy/energy-ui 3.171.1 → 3.171.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -2
- package/dist/components/UTBanner/stories/UTBanner.stories.js +16 -1
- package/dist/components/UTBaseInputField/theme.js +6 -5
- package/dist/components/UTButton/styles.module.scss +11 -11
- package/dist/components/UTButton/theme.js +1 -1
- package/dist/components/UTButtonGroup/styles.module.scss +1 -1
- package/dist/components/UTCheckbox/versions/V1/theme.js +4 -1
- package/dist/components/UTDataCategory/styles.module.scss +1 -1
- package/dist/components/UTDataCategory/theme.js +1 -1
- package/dist/components/UTDataElement/index.js +1 -1
- package/dist/components/UTDataElement/styles.module.scss +9 -9
- package/dist/components/UTDatePicker/versions/V1/stories/UTDatePickerV1.stories.js +59 -1
- package/dist/components/UTLabel/UTLabel.stories.js +81 -1
- package/dist/components/UTLabel/constants.js +10 -10
- package/dist/components/UTLabel/theme.js +4 -4
- package/dist/components/UTSelect/UTSelect.stories.js +897 -0
- package/dist/components/UTSelect/versions/V1/components/InputComponent/index.js +13 -3
- package/dist/components/UTSelect/versions/V1/components/ListboxComponent/index.js +7 -6
- package/dist/components/UTSelect/versions/V1/constants.js +10 -0
- package/dist/components/UTSelect/versions/V1/index.js +41 -68
- package/dist/components/UTSelect/versions/V1/types.js +54 -0
- package/dist/components/UTSelect/versions/V1/utils.js +10 -9
- package/dist/components/UTShortcutPanel/styles.module.scss +10 -10
- package/dist/components/UTStatus/theme.js +26 -26
- package/dist/esm/components/UTBanner/stories/UTBanner.stories.js +16 -1
- package/dist/esm/components/UTBaseInputField/theme.js +6 -5
- package/dist/esm/components/UTButton/styles.module.scss +11 -11
- package/dist/esm/components/UTButton/theme.js +1 -1
- package/dist/esm/components/UTButtonGroup/styles.module.scss +1 -1
- package/dist/esm/components/UTCheckbox/versions/V1/theme.js +4 -1
- package/dist/esm/components/UTDataCategory/styles.module.scss +1 -1
- package/dist/esm/components/UTDataCategory/theme.js +1 -1
- package/dist/esm/components/UTDataElement/index.js +1 -1
- package/dist/esm/components/UTDataElement/styles.module.scss +9 -9
- package/dist/esm/components/UTDatePicker/versions/V1/stories/UTDatePickerV1.stories.js +58 -0
- package/dist/esm/components/UTLabel/UTLabel.stories.js +80 -0
- package/dist/esm/components/UTLabel/constants.js +10 -10
- package/dist/esm/components/UTLabel/theme.js +4 -4
- package/dist/esm/components/UTSelect/UTSelect.stories.js +889 -0
- package/dist/esm/components/UTSelect/versions/V1/components/InputComponent/index.js +14 -4
- package/dist/esm/components/UTSelect/versions/V1/components/ListboxComponent/index.js +4 -3
- package/dist/esm/components/UTSelect/versions/V1/constants.js +4 -0
- package/dist/esm/components/UTSelect/versions/V1/index.js +41 -68
- package/dist/esm/components/UTSelect/versions/V1/types.js +48 -0
- package/dist/esm/components/UTSelect/versions/V1/utils.js +7 -6
- package/dist/esm/components/UTShortcutPanel/styles.module.scss +10 -10
- package/dist/esm/components/UTStatus/theme.js +26 -26
- package/dist/esm/utils/hooks/useCSSVariables/constants.js +11 -9
- package/dist/utils/hooks/useCSSVariables/constants.js +11 -9
- package/package.json +10 -9
- package/dist/components/UTSelect/versions/V1/UTSelectV1.mdx +0 -13
- package/dist/components/UTSelect/versions/V1/UTSelectV1.stories.js +0 -741
- package/dist/esm/components/UTSelect/versions/V1/UTSelectV1.mdx +0 -13
- package/dist/esm/components/UTSelect/versions/V1/UTSelectV1.stories.js +0 -733
|
@@ -7,6 +7,7 @@ exports.default = void 0;
|
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _propTypes = require("prop-types");
|
|
9
9
|
var _UTBaseInputField = _interopRequireDefault(require("../../../../../UTBaseInputField"));
|
|
10
|
+
var _constants = require("../../constants");
|
|
10
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
12
|
/* eslint-disable no-unused-vars */
|
|
12
13
|
|
|
@@ -45,12 +46,21 @@ const InputComponent = _ref => {
|
|
|
45
46
|
},
|
|
46
47
|
...restParams
|
|
47
48
|
} = params;
|
|
49
|
+
const isPicker = variant === _constants.VARIANTS.picker;
|
|
48
50
|
const modifiedParams = {
|
|
49
51
|
...restParams,
|
|
50
52
|
InputProps: restInputProps,
|
|
51
|
-
inputProps:
|
|
53
|
+
inputProps: {
|
|
54
|
+
...restInputPropsFromField,
|
|
55
|
+
...(isPicker && {
|
|
56
|
+
readOnly: true,
|
|
57
|
+
style: {
|
|
58
|
+
cursor: 'default'
|
|
59
|
+
}
|
|
60
|
+
})
|
|
61
|
+
}
|
|
52
62
|
};
|
|
53
|
-
const fieldVariant =
|
|
63
|
+
const fieldVariant = isPicker ? 'transparent' : 'white';
|
|
54
64
|
return /*#__PURE__*/_react.default.createElement(_UTBaseInputField.default, {
|
|
55
65
|
alwaysShowPlaceholder: alwaysShowPlaceholder,
|
|
56
66
|
dataTestId: dataTestId,
|
|
@@ -101,6 +111,6 @@ InputComponent.propTypes = {
|
|
|
101
111
|
props: _propTypes.object
|
|
102
112
|
})),
|
|
103
113
|
value: _propTypes.string,
|
|
104
|
-
variant: _propTypes.
|
|
114
|
+
variant: (0, _propTypes.oneOf)(Object.values(_constants.VARIANTS))
|
|
105
115
|
};
|
|
106
116
|
var _default = exports.default = InputComponent;
|
|
@@ -11,8 +11,9 @@ var _propTypes = require("prop-types");
|
|
|
11
11
|
var _isFinite = _interopRequireDefault(require("lodash/isFinite"));
|
|
12
12
|
var _UTLabel = _interopRequireDefault(require("../../../../../UTLabel"));
|
|
13
13
|
var _UTCheckList = _interopRequireDefault(require("../../../../../UTCheckList"));
|
|
14
|
+
var _constants = require("../../../../../UTCheckList/versions/V1/constants");
|
|
14
15
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
15
|
-
var
|
|
16
|
+
var _constants2 = require("./constants");
|
|
16
17
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
17
18
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
19
|
const ListboxComponent = _ref => {
|
|
@@ -21,16 +22,16 @@ const ListboxComponent = _ref => {
|
|
|
21
22
|
dataTestId,
|
|
22
23
|
filteredOptions,
|
|
23
24
|
handleSelectionChange,
|
|
24
|
-
horizontalSpacing,
|
|
25
|
+
horizontalSpacing = _constants.SPACING.SMALL,
|
|
25
26
|
itemDataTestId,
|
|
26
|
-
maxHeight =
|
|
27
|
+
maxHeight = _constants2.DEFAULT_MAX_HEIGHT,
|
|
27
28
|
multiple,
|
|
28
29
|
noMatchesText,
|
|
29
30
|
value,
|
|
30
|
-
verticalSpacing
|
|
31
|
+
verticalSpacing = _constants.SPACING.SMALL
|
|
31
32
|
} = _ref;
|
|
32
33
|
const hasNoOptions = (0, _react.useMemo)(() => (0, _isEmpty.default)(filteredOptions), [filteredOptions]);
|
|
33
|
-
const maxHeightValid = (0, _react.useMemo)(() => (0, _isFinite.default)(maxHeight) ? maxHeight :
|
|
34
|
+
const maxHeightValid = (0, _react.useMemo)(() => (0, _isFinite.default)(maxHeight) ? maxHeight : _constants2.DEFAULT_MAX_HEIGHT, [maxHeight]);
|
|
34
35
|
return hasNoOptions ? /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
35
36
|
colorTheme: "gray",
|
|
36
37
|
className: _stylesModule.default.noOptionsLabel
|
|
@@ -46,7 +47,7 @@ const ListboxComponent = _ref => {
|
|
|
46
47
|
itemDataTestId: itemDataTestId,
|
|
47
48
|
onChange: handleSelectionChange,
|
|
48
49
|
options: filteredOptions,
|
|
49
|
-
reversed:
|
|
50
|
+
reversed: true,
|
|
50
51
|
showSelectAll: false,
|
|
51
52
|
value: multiple ? value : [value],
|
|
52
53
|
variant: "button",
|
|
@@ -6,18 +6,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _clone = _interopRequireDefault(require("lodash/clone"));
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
var _propTypes = require("prop-types");
|
|
10
9
|
var _lab = require("@material-ui/lab");
|
|
10
|
+
var _Popper = _interopRequireDefault(require("@material-ui/core/Popper"));
|
|
11
11
|
var _UTFieldLabel = _interopRequireDefault(require("../../../UTFieldLabel"));
|
|
12
12
|
var _UTLabel = _interopRequireDefault(require("../../../UTLabel"));
|
|
13
13
|
var _UTPaper = _interopRequireDefault(require("../../../UTPaper"));
|
|
14
14
|
var _UTValidation = _interopRequireDefault(require("../../../UTValidation"));
|
|
15
15
|
var _utils = require("../../../UTValidation/utils");
|
|
16
16
|
var _inputs = require("../../../../constants/inputs");
|
|
17
|
-
var _buttonTypes = require("../../../../types/buttonTypes");
|
|
18
17
|
var _InputComponent = _interopRequireDefault(require("./components/InputComponent"));
|
|
19
18
|
var _ListboxComponent = _interopRequireDefault(require("./components/ListboxComponent"));
|
|
19
|
+
var _types = require("./types");
|
|
20
20
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
21
|
+
var _constants = require("./constants");
|
|
21
22
|
var _utils2 = require("./utils");
|
|
22
23
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
23
24
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -43,6 +44,7 @@ const UTSelect = _ref => {
|
|
|
43
44
|
itemDataTestId,
|
|
44
45
|
listDataTestId,
|
|
45
46
|
listProps = {},
|
|
47
|
+
menuWidth,
|
|
46
48
|
multiple = false,
|
|
47
49
|
noMatchesText = 'No hay coincidencias con tu búsqueda',
|
|
48
50
|
noOptionsText = 'No hay opciones disponibles',
|
|
@@ -57,7 +59,7 @@ const UTSelect = _ref => {
|
|
|
57
59
|
title,
|
|
58
60
|
titleVariant = _inputs.TITLE_VARIANTS.large,
|
|
59
61
|
value = multiple ? [] : null,
|
|
60
|
-
variant =
|
|
62
|
+
variant = _constants.VARIANTS.select,
|
|
61
63
|
withAutoReset = true
|
|
62
64
|
} = _ref;
|
|
63
65
|
const optionsSortedByCategory = (0, _react.useMemo)(() => {
|
|
@@ -102,7 +104,8 @@ const UTSelect = _ref => {
|
|
|
102
104
|
if (isPopperOpen) setSortedOptions((0, _utils2.sortOptions)(optionsSortedByCategory, value, multiple));
|
|
103
105
|
}, [isPopperOpen]);
|
|
104
106
|
const validationData = (0, _react.useMemo)(() => error && (0, _utils.formatErrorToValidation)(error), [error]);
|
|
105
|
-
const
|
|
107
|
+
const isPicker = variant === _constants.VARIANTS.picker;
|
|
108
|
+
const filteredOptions = (0, _react.useMemo)(() => disableFilterOptions || isPicker ? sortedOptions : sortedOptions.filter(option => "".concat(option.name).toLowerCase().includes(searchTerm.toLowerCase())), [sortedOptions, searchTerm, disableFilterOptions, isPicker]);
|
|
106
109
|
const handleSearchChange = (0, _react.useCallback)(searchValue => {
|
|
107
110
|
onChangeSearchTerm === null || onChangeSearchTerm === void 0 || onChangeSearchTerm(searchValue);
|
|
108
111
|
setSearchTerm(searchValue);
|
|
@@ -154,24 +157,6 @@ const UTSelect = _ref => {
|
|
|
154
157
|
suffix,
|
|
155
158
|
variant
|
|
156
159
|
}), [suffix, showClearButton, clearable, disabled, action, handleClearSelection, variant]);
|
|
157
|
-
const InputComponentToRender = (0, _react.useMemo)(() => params => /*#__PURE__*/_react.default.createElement(_InputComponent.default, {
|
|
158
|
-
alwaysShowPlaceholder: alwaysShowPlaceholder,
|
|
159
|
-
dataTestId: dataTestId,
|
|
160
|
-
disabled: disabled,
|
|
161
|
-
error: error,
|
|
162
|
-
inputSize: inputSize,
|
|
163
|
-
inputRef: inputRef,
|
|
164
|
-
leftAdornments: leftAdornments,
|
|
165
|
-
onBlur: handleInputBlur,
|
|
166
|
-
onChange: handleSearchChange,
|
|
167
|
-
onFocus: handleInputFocus,
|
|
168
|
-
params: params,
|
|
169
|
-
placeholder: placeholder,
|
|
170
|
-
readOnly: readOnly,
|
|
171
|
-
rightAdornments: rightAdornments,
|
|
172
|
-
value: searchTerm,
|
|
173
|
-
variant: variant
|
|
174
|
-
}), [alwaysShowPlaceholder, disabled, error, handleInputBlur, handleInputFocus, leftAdornments, placeholder, rightAdornments, searchTerm]);
|
|
175
160
|
const listBoxProps = (0, _react.useMemo)(() => ({
|
|
176
161
|
CustomRow,
|
|
177
162
|
dataTestId: listDataTestId,
|
|
@@ -183,6 +168,19 @@ const UTSelect = _ref => {
|
|
|
183
168
|
value,
|
|
184
169
|
...listProps
|
|
185
170
|
}), [CustomRow, filteredOptions, handleSelectionChange, multiple, noMatchesText, value, listProps]);
|
|
171
|
+
const menuWidthRef = (0, _react.useRef)(menuWidth);
|
|
172
|
+
menuWidthRef.current = menuWidth;
|
|
173
|
+
const CustomPopper = (0, _react.useCallback)(props => {
|
|
174
|
+
const width = menuWidthRef.current;
|
|
175
|
+
return /*#__PURE__*/_react.default.createElement(_Popper.default, _extends({}, props, width ? {
|
|
176
|
+
placement: 'bottom-start'
|
|
177
|
+
} : {}, {
|
|
178
|
+
style: width ? {
|
|
179
|
+
...props.style,
|
|
180
|
+
width
|
|
181
|
+
} : props.style
|
|
182
|
+
}));
|
|
183
|
+
}, []);
|
|
186
184
|
const noOptionsTextComponent = /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
187
185
|
className: _stylesModule.default.noOptionsLabel,
|
|
188
186
|
colorTheme: "gray"
|
|
@@ -193,11 +191,12 @@ const UTSelect = _ref => {
|
|
|
193
191
|
actions: titleActions,
|
|
194
192
|
required: required,
|
|
195
193
|
size: titleVariant
|
|
196
|
-
}, title), /*#__PURE__*/_react.default.createElement(_lab.Autocomplete, _extends({}, freeWidth ? {
|
|
194
|
+
}, title), /*#__PURE__*/_react.default.createElement(_lab.Autocomplete, _extends({}, freeWidth && !menuWidth ? {
|
|
197
195
|
classes: {
|
|
198
196
|
popper: _stylesModule.default.popper
|
|
199
197
|
}
|
|
200
198
|
} : {}, {
|
|
199
|
+
PopperComponent: CustomPopper,
|
|
201
200
|
disabled: disabled || readOnly,
|
|
202
201
|
getOptionLabel: option => "".concat(option.name),
|
|
203
202
|
ListboxComponent: _ListboxComponent.default,
|
|
@@ -209,7 +208,24 @@ const UTSelect = _ref => {
|
|
|
209
208
|
open: isPopperOpen,
|
|
210
209
|
options: optionsSortedByCategory,
|
|
211
210
|
PaperComponent: _UTPaper.default,
|
|
212
|
-
renderInput:
|
|
211
|
+
renderInput: params => /*#__PURE__*/_react.default.createElement(_InputComponent.default, {
|
|
212
|
+
alwaysShowPlaceholder: alwaysShowPlaceholder,
|
|
213
|
+
dataTestId: dataTestId,
|
|
214
|
+
disabled: disabled,
|
|
215
|
+
error: error,
|
|
216
|
+
inputRef: inputRef,
|
|
217
|
+
inputSize: inputSize,
|
|
218
|
+
leftAdornments: leftAdornments,
|
|
219
|
+
onBlur: handleInputBlur,
|
|
220
|
+
onChange: handleSearchChange,
|
|
221
|
+
onFocus: handleInputFocus,
|
|
222
|
+
params: params,
|
|
223
|
+
placeholder: placeholder,
|
|
224
|
+
readOnly: readOnly,
|
|
225
|
+
rightAdornments: rightAdornments,
|
|
226
|
+
value: searchTerm,
|
|
227
|
+
variant: variant
|
|
228
|
+
})
|
|
213
229
|
}, autocompleteProps)), helpText && /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
|
|
214
230
|
colorTheme: "gray",
|
|
215
231
|
variant: "small"
|
|
@@ -218,48 +234,5 @@ const UTSelect = _ref => {
|
|
|
218
234
|
validationData: validationData
|
|
219
235
|
}));
|
|
220
236
|
};
|
|
221
|
-
UTSelect.propTypes =
|
|
222
|
-
action: (0, _propTypes.shape)({
|
|
223
|
-
Icon: _propTypes.string,
|
|
224
|
-
onClick: _propTypes.func,
|
|
225
|
-
size: _propTypes.string
|
|
226
|
-
}),
|
|
227
|
-
actions: (0, _propTypes.arrayOf)(_buttonTypes.buttonTypes),
|
|
228
|
-
alwaysShowPlaceholder: _propTypes.bool,
|
|
229
|
-
autocompleteProps: _propTypes.object,
|
|
230
|
-
className: _propTypes.string,
|
|
231
|
-
clearable: _propTypes.bool,
|
|
232
|
-
CustomRow: _propTypes.elementType,
|
|
233
|
-
dataTestId: _propTypes.string,
|
|
234
|
-
disabled: _propTypes.bool,
|
|
235
|
-
disableFilterOptions: _propTypes.bool,
|
|
236
|
-
error: _propTypes.string,
|
|
237
|
-
errorDataTestId: _propTypes.string,
|
|
238
|
-
freeWidth: _propTypes.bool,
|
|
239
|
-
helpText: _propTypes.string,
|
|
240
|
-
icon: _propTypes.string,
|
|
241
|
-
inputSize: _propTypes.string,
|
|
242
|
-
itemDataTestId: _propTypes.string,
|
|
243
|
-
listDataTestId: _propTypes.string,
|
|
244
|
-
listProps: _propTypes.object,
|
|
245
|
-
multiple: _propTypes.bool,
|
|
246
|
-
noMatchesText: _propTypes.string,
|
|
247
|
-
noOptionsText: _propTypes.string,
|
|
248
|
-
onChange: _propTypes.func,
|
|
249
|
-
onChangeSearchTerm: _propTypes.func,
|
|
250
|
-
options: (0, _propTypes.arrayOf)((0, _propTypes.shape)({
|
|
251
|
-
name: _propTypes.string,
|
|
252
|
-
value: (0, _propTypes.oneOfType)([_propTypes.string, _propTypes.number])
|
|
253
|
-
})),
|
|
254
|
-
placeholder: _propTypes.string,
|
|
255
|
-
prefix: _propTypes.string,
|
|
256
|
-
readOnly: _propTypes.bool,
|
|
257
|
-
required: _propTypes.bool,
|
|
258
|
-
suffix: _propTypes.string,
|
|
259
|
-
title: _propTypes.string,
|
|
260
|
-
titleVariant: _propTypes.string,
|
|
261
|
-
value: (0, _propTypes.oneOfType)([_propTypes.string, (0, _propTypes.arrayOf)((0, _propTypes.oneOfType)([_propTypes.string, _propTypes.number]))]),
|
|
262
|
-
variant: _propTypes.string,
|
|
263
|
-
withAutoReset: _propTypes.bool
|
|
264
|
-
};
|
|
237
|
+
UTSelect.propTypes = _types.utselectTypes;
|
|
265
238
|
var _default = exports.default = UTSelect;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.utselectTypes = void 0;
|
|
7
|
+
var _propTypes = require("prop-types");
|
|
8
|
+
var _buttonTypes = require("../../../../types/buttonTypes");
|
|
9
|
+
var _constants = require("./constants");
|
|
10
|
+
const utselectTypes = exports.utselectTypes = {
|
|
11
|
+
action: (0, _propTypes.shape)({
|
|
12
|
+
Icon: _propTypes.string,
|
|
13
|
+
onClick: _propTypes.func,
|
|
14
|
+
size: _propTypes.string
|
|
15
|
+
}),
|
|
16
|
+
actions: (0, _propTypes.arrayOf)(_buttonTypes.buttonTypes),
|
|
17
|
+
alwaysShowPlaceholder: _propTypes.bool,
|
|
18
|
+
autocompleteProps: _propTypes.object,
|
|
19
|
+
className: _propTypes.string,
|
|
20
|
+
clearable: _propTypes.bool,
|
|
21
|
+
CustomRow: _propTypes.elementType,
|
|
22
|
+
dataTestId: _propTypes.string,
|
|
23
|
+
disabled: _propTypes.bool,
|
|
24
|
+
disableFilterOptions: _propTypes.bool,
|
|
25
|
+
error: _propTypes.string,
|
|
26
|
+
errorDataTestId: _propTypes.string,
|
|
27
|
+
freeWidth: _propTypes.bool,
|
|
28
|
+
helpText: _propTypes.string,
|
|
29
|
+
icon: _propTypes.string,
|
|
30
|
+
inputSize: _propTypes.string,
|
|
31
|
+
itemDataTestId: _propTypes.string,
|
|
32
|
+
listDataTestId: _propTypes.string,
|
|
33
|
+
listProps: _propTypes.object,
|
|
34
|
+
menuWidth: _propTypes.string,
|
|
35
|
+
multiple: _propTypes.bool,
|
|
36
|
+
noMatchesText: _propTypes.string,
|
|
37
|
+
noOptionsText: _propTypes.string,
|
|
38
|
+
onChange: _propTypes.func,
|
|
39
|
+
onChangeSearchTerm: _propTypes.func,
|
|
40
|
+
options: (0, _propTypes.arrayOf)((0, _propTypes.shape)({
|
|
41
|
+
name: _propTypes.string,
|
|
42
|
+
value: (0, _propTypes.oneOfType)([_propTypes.string, _propTypes.number])
|
|
43
|
+
})),
|
|
44
|
+
placeholder: _propTypes.string,
|
|
45
|
+
prefix: _propTypes.string,
|
|
46
|
+
readOnly: _propTypes.bool,
|
|
47
|
+
required: _propTypes.bool,
|
|
48
|
+
suffix: _propTypes.string,
|
|
49
|
+
title: _propTypes.string,
|
|
50
|
+
titleVariant: _propTypes.string,
|
|
51
|
+
value: (0, _propTypes.oneOfType)([_propTypes.string, (0, _propTypes.arrayOf)((0, _propTypes.oneOfType)([_propTypes.string, _propTypes.number]))]),
|
|
52
|
+
variant: (0, _propTypes.oneOf)(Object.values(_constants.VARIANTS)),
|
|
53
|
+
withAutoReset: _propTypes.bool
|
|
54
|
+
};
|
|
@@ -4,13 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.sortOptions = exports.shouldReset = exports.getRightAdornments = exports.getLeftAdornments = exports.getDisplayValue = void 0;
|
|
7
|
-
var _array = require("@widergy/web-utils/lib/array");
|
|
8
7
|
var _clone = _interopRequireDefault(require("lodash/clone"));
|
|
8
|
+
var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
|
|
9
|
+
var _Palette = require("../../../../constants/Palette");
|
|
9
10
|
var _constants = require("../../../UTBaseInputField/constants");
|
|
10
11
|
var _constants2 = require("../../../UTCheckList/versions/V1/constants");
|
|
12
|
+
var _constants3 = require("./constants");
|
|
11
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
-
const shouldResetMultipleSelect = (value, options) => !(0,
|
|
13
|
-
const shouldResetSimpleSelect = (value, options) => value && ((0,
|
|
14
|
+
const shouldResetMultipleSelect = (value, options) => !(0, _isEmpty.default)(value) && ((0, _isEmpty.default)(options) || value.some(el => !options.some(opt => opt.value === el) && !options.some(opt => opt.subOptions && opt.subOptions.some(sub => sub.value === el))));
|
|
15
|
+
const shouldResetSimpleSelect = (value, options) => value && ((0, _isEmpty.default)(options) || !options.some(el => el.value === value) && !options.some(el => el.subOptions && el.subOptions.some(sub => sub.value === value)));
|
|
14
16
|
const shouldReset = (value, options, isMultiple) => {
|
|
15
17
|
if (isMultiple) return shouldResetMultipleSelect(value, options);
|
|
16
18
|
return shouldResetSimpleSelect(value, options);
|
|
@@ -41,11 +43,11 @@ const getLeftAdornments = _ref => {
|
|
|
41
43
|
showOnlyOnError: true
|
|
42
44
|
}
|
|
43
45
|
});
|
|
44
|
-
if (multiple && !(0,
|
|
46
|
+
if (multiple && !(0, _isEmpty.default)(value)) adornments.push({
|
|
45
47
|
name: _constants.COMPONENT_KEYS.BADGE,
|
|
46
48
|
props: {
|
|
47
49
|
text: value.length,
|
|
48
|
-
colorTheme: error ?
|
|
50
|
+
colorTheme: error ? _Palette.COLOR_THEMES.error : _Palette.COLOR_THEMES.accent
|
|
49
51
|
}
|
|
50
52
|
});
|
|
51
53
|
if (prefix) adornments.push({
|
|
@@ -91,15 +93,14 @@ const getRightAdornments = _ref2 => {
|
|
|
91
93
|
size: 'small'
|
|
92
94
|
}
|
|
93
95
|
}
|
|
94
|
-
});
|
|
95
|
-
adornments.push({
|
|
96
|
+
});else adornments.push({
|
|
96
97
|
name: _constants.COMPONENT_KEYS.ICON,
|
|
97
98
|
props: {
|
|
98
99
|
Icon: 'IconChevronDown',
|
|
99
100
|
changeIconOnError: false,
|
|
100
101
|
changeOnError: true,
|
|
101
|
-
...(variant ===
|
|
102
|
-
colorTheme:
|
|
102
|
+
...(variant === _constants3.VARIANTS.picker && !disabled && {
|
|
103
|
+
colorTheme: _Palette.COLOR_THEMES.dark
|
|
103
104
|
})
|
|
104
105
|
}
|
|
105
106
|
});
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
%animatedActionsContainer {
|
|
18
18
|
animation: slideInFromRight 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
|
|
19
19
|
display: flex;
|
|
20
|
-
grid-gap: var(--UT-shortcutPanel-header-gap,
|
|
20
|
+
grid-gap: var(--UT-shortcutPanel-header-gap, 0.5rem);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
%textWithEllipsis {
|
|
@@ -55,25 +55,25 @@
|
|
|
55
55
|
padding: var(--padding-lg, 24px) 0;
|
|
56
56
|
position: relative !important;
|
|
57
57
|
transition: width 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms !important;
|
|
58
|
-
width: var(--UT-shortcutPanel-width-collapsed,
|
|
58
|
+
width: var(--UT-shortcutPanel-width-collapsed, 3.5rem);
|
|
59
59
|
|
|
60
60
|
&Open {
|
|
61
61
|
padding: 0;
|
|
62
|
-
width: var(--UT-shortcutPanel-width,
|
|
62
|
+
width: var(--UT-shortcutPanel-width, 16rem);
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
.expandedPanelContent {
|
|
66
66
|
box-sizing: border-box;
|
|
67
67
|
display: flex;
|
|
68
68
|
flex-direction: column;
|
|
69
|
-
padding: 0 var(--UT-shortcutPanel-padding,
|
|
69
|
+
padding: 0 var(--UT-shortcutPanel-padding, 1rem);
|
|
70
70
|
position: relative;
|
|
71
71
|
width: 100%;
|
|
72
72
|
|
|
73
73
|
.expandedPanelContentHeader {
|
|
74
74
|
align-items: center;
|
|
75
75
|
display: flex;
|
|
76
|
-
grid-gap: var(--UT-shortcutPanel-header-gap,
|
|
76
|
+
grid-gap: var(--UT-shortcutPanel-header-gap, 0.5rem);
|
|
77
77
|
justify-content: space-between;
|
|
78
78
|
position: sticky;
|
|
79
79
|
top: 0;
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
.expandedPanelContentActions {
|
|
89
89
|
display: flex;
|
|
90
90
|
flex-wrap: nowrap;
|
|
91
|
-
grid-gap: var(--UT-shortcutPanel-header-gap,
|
|
91
|
+
grid-gap: var(--UT-shortcutPanel-header-gap, 0.5rem);
|
|
92
92
|
|
|
93
93
|
.expandedPanelContentActionsContainer {
|
|
94
94
|
@extend %actionsContainer;
|
|
@@ -105,14 +105,14 @@
|
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
.expandedPanelContentCategory {
|
|
108
|
-
padding: var(--UT-shortcutPanel-category-padding,
|
|
108
|
+
padding: var(--UT-shortcutPanel-category-padding, 0.5rem) 0;
|
|
109
109
|
|
|
110
110
|
.expandedPanelContentCategoryHeader {
|
|
111
111
|
align-items: center;
|
|
112
112
|
border-radius: var(--radius-sm, 4px);
|
|
113
113
|
display: flex;
|
|
114
|
-
grid-gap: var(--UT-shortcutPanel-category-gap,
|
|
115
|
-
padding: var(--UT-shortcutPanel-category-padding,
|
|
114
|
+
grid-gap: var(--UT-shortcutPanel-category-gap, 0.5rem);
|
|
115
|
+
padding: var(--UT-shortcutPanel-category-padding, 0.5rem);
|
|
116
116
|
height: var(--UT-shortcutPanel-category-height);
|
|
117
117
|
|
|
118
118
|
svg {
|
|
@@ -185,7 +185,7 @@
|
|
|
185
185
|
align-items: center;
|
|
186
186
|
display: flex;
|
|
187
187
|
flex-grow: 1;
|
|
188
|
-
grid-gap: var(--UT-shortcutPanel-item-gap,
|
|
188
|
+
grid-gap: var(--UT-shortcutPanel-item-gap, 0.5rem);
|
|
189
189
|
overflow: hidden;
|
|
190
190
|
|
|
191
191
|
.hoverableContainer {
|
|
@@ -31,11 +31,11 @@ const getGridGap = _ref3 => {
|
|
|
31
31
|
size
|
|
32
32
|
} = _ref3;
|
|
33
33
|
return {
|
|
34
|
-
[_constants.SIZES.large]: 'var(--UT-status-gap-large,
|
|
35
|
-
[_constants.SIZES.medium]: 'var(--UT-status-gap-medium,
|
|
36
|
-
[_constants.SIZES.small]: 'var(--UT-status-gap-small,
|
|
37
|
-
[_constants.SIZES.xlarge]: 'var(--UT-status-gap-xlarge,
|
|
38
|
-
[_constants.SIZES.xsmall]: 'var(--UT-status-gap-xsmall,
|
|
34
|
+
[_constants.SIZES.large]: 'var(--UT-status-gap-large, 0.5rem)',
|
|
35
|
+
[_constants.SIZES.medium]: 'var(--UT-status-gap-medium, 0.5rem)',
|
|
36
|
+
[_constants.SIZES.small]: 'var(--UT-status-gap-small, 0.25rem)',
|
|
37
|
+
[_constants.SIZES.xlarge]: 'var(--UT-status-gap-xlarge, 0.5rem)',
|
|
38
|
+
[_constants.SIZES.xsmall]: 'var(--UT-status-gap-xsmall, 0.25rem)'
|
|
39
39
|
}[size];
|
|
40
40
|
};
|
|
41
41
|
const getPadding = _ref4 => {
|
|
@@ -43,11 +43,11 @@ const getPadding = _ref4 => {
|
|
|
43
43
|
size
|
|
44
44
|
} = _ref4;
|
|
45
45
|
return {
|
|
46
|
-
[_constants.SIZES.large]: 'var(--UT-status-padding-y-large,
|
|
47
|
-
[_constants.SIZES.medium]: 'var(--UT-status-padding-y-medium,
|
|
48
|
-
[_constants.SIZES.small]: 'var(--UT-status-padding-y-small,
|
|
49
|
-
[_constants.SIZES.xlarge]: 'var(--UT-status-padding-y-xlarge,
|
|
50
|
-
[_constants.SIZES.xsmall]: 'var(--UT-status-padding-y-xsmall,
|
|
46
|
+
[_constants.SIZES.large]: 'var(--UT-status-padding-y-large, 0.25rem) var(--UT-status-padding-x-large, 0.5rem)',
|
|
47
|
+
[_constants.SIZES.medium]: 'var(--UT-status-padding-y-medium, 0.25rem) var(--UT-status-padding-x-medium, 0.5rem)',
|
|
48
|
+
[_constants.SIZES.small]: 'var(--UT-status-padding-y-small, 0.25rem) var(--UT-status-padding-x-small, 0.5rem)',
|
|
49
|
+
[_constants.SIZES.xlarge]: 'var(--UT-status-padding-y-xlarge, 0.5rem) var(--UT-status-padding-x-xlarge, 0.75rem)',
|
|
50
|
+
[_constants.SIZES.xsmall]: 'var(--UT-status-padding-y-xsmall, 0.125rem) var(--UT-status-padding-x-xsmall, 0.25rem)'
|
|
51
51
|
}[size];
|
|
52
52
|
};
|
|
53
53
|
const getLabelVariant = _ref5 => {
|
|
@@ -68,11 +68,11 @@ const getIconSize = _ref6 => {
|
|
|
68
68
|
size
|
|
69
69
|
} = _ref6;
|
|
70
70
|
return {
|
|
71
|
-
[_constants.SIZES.large]: 'var(--UT-status-icon-size-xs,
|
|
72
|
-
[_constants.SIZES.medium]: 'var(--UT-status-icon-size-2xs,
|
|
73
|
-
[_constants.SIZES.small]: 'var(--UT-status-icon-size-3xs,
|
|
74
|
-
[_constants.SIZES.xlarge]: 'var(--UT-status-icon-size-xs,
|
|
75
|
-
[_constants.SIZES.xsmall]: 'var(--UT-status-icon-size-3xs,
|
|
71
|
+
[_constants.SIZES.large]: 'var(--UT-status-icon-size-xs, 1.25rem)',
|
|
72
|
+
[_constants.SIZES.medium]: 'var(--UT-status-icon-size-2xs, 1rem)',
|
|
73
|
+
[_constants.SIZES.small]: 'var(--UT-status-icon-size-3xs, 0.75rem)',
|
|
74
|
+
[_constants.SIZES.xlarge]: 'var(--UT-status-icon-size-xs, 1.25rem)',
|
|
75
|
+
[_constants.SIZES.xsmall]: 'var(--UT-status-icon-size-3xs, 0.75rem)'
|
|
76
76
|
}[size];
|
|
77
77
|
};
|
|
78
78
|
exports.getIconSize = getIconSize;
|
|
@@ -116,7 +116,7 @@ const retrieveStyle = _ref8 => {
|
|
|
116
116
|
variant
|
|
117
117
|
})
|
|
118
118
|
}),
|
|
119
|
-
borderRadius: 'var(--UT-status-radius,
|
|
119
|
+
borderRadius: 'var(--UT-status-radius, 0.25rem)',
|
|
120
120
|
display: 'flex',
|
|
121
121
|
gridGap: getGridGap({
|
|
122
122
|
size
|
|
@@ -137,8 +137,8 @@ const retrieveStyle = _ref8 => {
|
|
|
137
137
|
},
|
|
138
138
|
icon: {
|
|
139
139
|
flexShrink: '0',
|
|
140
|
-
height: 'var(--UT-status-icon-size-xs,
|
|
141
|
-
width: 'var(--UT-status-icon-size-xs,
|
|
140
|
+
height: 'var(--UT-status-icon-size-xs, 1.25rem)',
|
|
141
|
+
width: 'var(--UT-status-icon-size-xs, 1.25rem)',
|
|
142
142
|
'& path': {
|
|
143
143
|
fill: getIconFill({
|
|
144
144
|
theme,
|
|
@@ -165,20 +165,20 @@ const retrieveStyle = _ref8 => {
|
|
|
165
165
|
}
|
|
166
166
|
},
|
|
167
167
|
iconXsmall: {
|
|
168
|
-
height: 'var(--UT-status-icon-size-3xs,
|
|
169
|
-
width: 'var(--UT-status-icon-size-3xs,
|
|
168
|
+
height: 'var(--UT-status-icon-size-3xs, 0.75rem)',
|
|
169
|
+
width: 'var(--UT-status-icon-size-3xs, 0.75rem)'
|
|
170
170
|
},
|
|
171
171
|
iconSmall: {
|
|
172
|
-
height: 'var(--UT-status-icon-size-3xs,
|
|
173
|
-
width: 'var(--UT-status-icon-size-3xs,
|
|
172
|
+
height: 'var(--UT-status-icon-size-3xs, 0.75rem)',
|
|
173
|
+
width: 'var(--UT-status-icon-size-3xs, 0.75rem)'
|
|
174
174
|
},
|
|
175
175
|
iconMedium: {
|
|
176
|
-
height: 'var(--UT-status-icon-size-2xs,
|
|
177
|
-
width: 'var(--UT-status-icon-size-2xs,
|
|
176
|
+
height: 'var(--UT-status-icon-size-2xs, 1rem)',
|
|
177
|
+
width: 'var(--UT-status-icon-size-2xs, 1rem)'
|
|
178
178
|
},
|
|
179
179
|
iconLarge: {
|
|
180
|
-
height: 'var(--UT-status-icon-size-xs,
|
|
181
|
-
width: 'var(--UT-status-icon-size-xs,
|
|
180
|
+
height: 'var(--UT-status-icon-size-xs, 1.25rem)',
|
|
181
|
+
width: 'var(--UT-status-icon-size-xs, 1.25rem)'
|
|
182
182
|
},
|
|
183
183
|
badgeXsmall: {
|
|
184
184
|
height: '8px',
|
|
@@ -59,7 +59,12 @@ export default {
|
|
|
59
59
|
description: 'Nombre del ícono (string) o componente React. Ej: "IconAlertCircle".'
|
|
60
60
|
},
|
|
61
61
|
iconProps: {
|
|
62
|
-
control: false
|
|
62
|
+
control: false,
|
|
63
|
+
description: 'Props adicionales que se pasan al componente Icon.'
|
|
64
|
+
},
|
|
65
|
+
classNames: {
|
|
66
|
+
control: false,
|
|
67
|
+
description: 'Clases CSS adicionales para personalizar el componente.'
|
|
63
68
|
},
|
|
64
69
|
onClose: {
|
|
65
70
|
control: false
|
|
@@ -90,6 +95,16 @@ export default {
|
|
|
90
95
|
}
|
|
91
96
|
},
|
|
92
97
|
component: UTBanner,
|
|
98
|
+
parameters: {
|
|
99
|
+
controls: {
|
|
100
|
+
exclude: ['classNames']
|
|
101
|
+
},
|
|
102
|
+
docs: {
|
|
103
|
+
description: {
|
|
104
|
+
component: 'Componente para mostrar mensajes de notificación con soporte para icono, título, descripción, texto de ayuda, categoría y botones de acción. Soporta múltiples variantes de color y tamaño, y layouts horizontal y vertical.'
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
},
|
|
93
108
|
title: 'Energy-UI/UTBanner'
|
|
94
109
|
};
|
|
95
110
|
export const Playground = {};
|
|
@@ -31,6 +31,7 @@ const getBackgroundColor = _ref => {
|
|
|
31
31
|
if (readOnly) return 'transparent';
|
|
32
32
|
if (variant === 'gray') return theme.Palette.light['04'];
|
|
33
33
|
if (variant === 'transparent' && error) return theme.Palette.error['01'];
|
|
34
|
+
if (variant === 'transparent') return 'transparent';
|
|
34
35
|
if (disabled) return theme.Palette.light['03'];
|
|
35
36
|
return theme.Palette.light['01'];
|
|
36
37
|
};
|
|
@@ -135,22 +136,22 @@ export const retrieveStyle = _ref4 => {
|
|
|
135
136
|
borderWidth: '1px'
|
|
136
137
|
},
|
|
137
138
|
focusedRoot: {
|
|
138
|
-
backgroundColor: theme.Palette.light['01'],
|
|
139
|
+
backgroundColor: variant === 'transparent' ? theme.Palette.light['03'] : theme.Palette.light['01'],
|
|
139
140
|
'&:hover': {
|
|
140
|
-
backgroundColor: theme.Palette.light['01']
|
|
141
|
+
backgroundColor: variant === 'transparent' ? theme.Palette.light['03'] : theme.Palette.light['01']
|
|
141
142
|
}
|
|
142
143
|
},
|
|
143
144
|
withValueRoot: {
|
|
144
145
|
...(variant === 'transparent' && !error && {
|
|
145
|
-
backgroundColor:
|
|
146
|
+
backgroundColor: 'transparent'
|
|
146
147
|
})
|
|
147
148
|
},
|
|
148
149
|
focusedInputContainer: {
|
|
149
|
-
...(!error && {
|
|
150
|
+
...(variant !== 'transparent' && !error && {
|
|
150
151
|
borderColor: "".concat(actionPalette['04'], " !important"),
|
|
151
152
|
borderWidth: '2px'
|
|
152
153
|
}),
|
|
153
|
-
...(error && {
|
|
154
|
+
...(variant !== 'transparent' && error && {
|
|
154
155
|
borderColor: "".concat(theme.Palette.error['04'], " !important")
|
|
155
156
|
})
|
|
156
157
|
},
|