@widergy/energy-ui 3.67.1 → 3.68.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/components/UTCheckList/versions/V1/README.MD +1 -0
- package/dist/components/UTCheckList/versions/V1/index.js +6 -0
- package/dist/components/UTCheckbox/versions/V1/README.md +1 -0
- package/dist/components/UTCheckbox/versions/V1/index.js +15 -2
- package/dist/components/UTCheckbox/versions/V1/theme.js +21 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [3.68.0](https://github.com/widergy/energy-ui/compare/v3.67.2...v3.68.0) (2025-03-26)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* [UGENSA-1520] added customrow to checklist v1 ([#592](https://github.com/widergy/energy-ui/issues/592)) ([1823fb2](https://github.com/widergy/energy-ui/commit/1823fb20ea2c9f9a2e0179c890519a22bf4e15e5))
|
|
7
|
+
|
|
8
|
+
## [3.67.2](https://github.com/widergy/energy-ui/compare/v3.67.1...v3.67.2) (2025-03-25)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* [UGC-1195] checkbox error status ([#590](https://github.com/widergy/energy-ui/issues/590)) ([897e62f](https://github.com/widergy/energy-ui/commit/897e62f243d560fe15216b1afe39b219b5b5b082))
|
|
14
|
+
|
|
1
15
|
## [3.67.1](https://github.com/widergy/energy-ui/compare/v3.67.0...v3.67.1) (2025-03-25)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
| ----------------- | ---------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
11
11
|
| actions | object | | Actions to render within `UTFieldLabel`. |
|
|
12
12
|
| classNames | objectOf(string) | | Custom class names to apply to different elements of the checklist (`root`, `header`, `checkboxesContainer`, `item`, `selectAll`). |
|
|
13
|
+
| CustomRow | elementType | | Custom component to render data of every checkbox |
|
|
13
14
|
| disabled | bool | false | Disables all checkboxes in the checklist when true. |
|
|
14
15
|
| |
|
|
15
16
|
| error | string | | Error message to display. |
|
|
@@ -23,6 +23,7 @@ const UTCheckList = _ref => {
|
|
|
23
23
|
let {
|
|
24
24
|
actions,
|
|
25
25
|
classNames = {},
|
|
26
|
+
CustomRow,
|
|
26
27
|
dataTestId,
|
|
27
28
|
disabled,
|
|
28
29
|
error,
|
|
@@ -125,6 +126,10 @@ const UTCheckList = _ref => {
|
|
|
125
126
|
weight: "medium"
|
|
126
127
|
}, category.toUpperCase()), categoryOptions.map((item, index) => /*#__PURE__*/_react.default.createElement(_UTCheckbox.default, {
|
|
127
128
|
classNames: classNames.item,
|
|
129
|
+
CustomComponent: CustomRow ? /*#__PURE__*/_react.default.createElement(CustomRow, {
|
|
130
|
+
item: item,
|
|
131
|
+
isChecked: (0, _utils2.isChecked)(item, value)
|
|
132
|
+
}) : undefined,
|
|
128
133
|
dataTestId: itemDataTestId ? "".concat(itemDataTestId, ".category_").concat(catIndex, ".").concat(index) : null,
|
|
129
134
|
disabled: item.disabled || disabled,
|
|
130
135
|
isSimple: isSimple,
|
|
@@ -142,6 +147,7 @@ const UTCheckList = _ref => {
|
|
|
142
147
|
UTCheckList.propTypes = {
|
|
143
148
|
actions: (0, _propTypes.arrayOf)(_buttonTypes.buttonTypes),
|
|
144
149
|
classNames: (0, _propTypes.objectOf)(_propTypes.string),
|
|
150
|
+
CustomRow: _propTypes.elementType,
|
|
145
151
|
dataTestId: _propTypes.string,
|
|
146
152
|
disabled: _propTypes.bool,
|
|
147
153
|
error: _propTypes.string,
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
| actions | object | | Actions to render within `UTFieldLabel`. |
|
|
12
12
|
| checkboxDataTestId | string | | Box `data-testid`. |
|
|
13
13
|
| classNames | objectOf(string) | | Additional class names to apply for further styling. |
|
|
14
|
+
| CustomComponent | elementType | | Custom component to render data next to the checkbox |
|
|
14
15
|
| dataTestId | string | | Whole component `data-testid`. |
|
|
15
16
|
| disabled | bool | false | Disables the checkbox, making it unclickable. |
|
|
16
17
|
| indeterminate | bool | false | Indicates if the checkbox is in an indeterminate state. |
|
|
@@ -6,12 +6,16 @@ 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 _form = require("@widergy/web-utils/lib/form");
|
|
9
10
|
var _classesUtils = require("../../../../utils/classesUtils");
|
|
10
11
|
var _UTFieldLabel = _interopRequireDefault(require("../../../UTFieldLabel"));
|
|
11
12
|
var _UTIcon = _interopRequireDefault(require("../../../UTIcon"));
|
|
12
13
|
var _WithTheme = _interopRequireDefault(require("../../../WithTheme"));
|
|
13
14
|
var _UTTouchableWithoutFeedback = _interopRequireDefault(require("../../../UTTouchableWithoutFeedback"));
|
|
14
15
|
var _buttonTypes = require("../../../../types/buttonTypes");
|
|
16
|
+
var _formTypes = require("../../../../types/formTypes");
|
|
17
|
+
var _utils = require("../../../UTValidation/utils");
|
|
18
|
+
var _UTValidation = _interopRequireDefault(require("../../../UTValidation"));
|
|
15
19
|
var _constants = require("./constants");
|
|
16
20
|
var _theme = require("./theme");
|
|
17
21
|
var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
|
|
@@ -25,10 +29,12 @@ const UTCheckbox = _ref => {
|
|
|
25
29
|
checkboxDataTestId,
|
|
26
30
|
classes: theme,
|
|
27
31
|
classNames,
|
|
32
|
+
CustomComponent,
|
|
28
33
|
dataTestId,
|
|
29
34
|
disabled,
|
|
30
35
|
indeterminate,
|
|
31
36
|
isSimple = false,
|
|
37
|
+
meta,
|
|
32
38
|
onChange = () => {},
|
|
33
39
|
required,
|
|
34
40
|
title,
|
|
@@ -50,6 +56,8 @@ const UTCheckbox = _ref => {
|
|
|
50
56
|
const BoxContainerComponent = variant === _constants.BUTTON_VARIANT ? 'div' : _UTTouchableWithoutFeedback.default;
|
|
51
57
|
const rootComponentProps = variant === _constants.BUTTON_VARIANT ? touchableProps : {};
|
|
52
58
|
const boxContainerProps = variant === _constants.BUTTON_VARIANT ? {} : touchableProps;
|
|
59
|
+
const error = meta && (0, _form.shouldShowErrors)(meta) && meta.error || '';
|
|
60
|
+
const validationData = (0, _utils.formatErrorToValidation)(error);
|
|
53
61
|
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, withUpperTitle && /*#__PURE__*/_react.default.createElement(_UTFieldLabel.default, {
|
|
54
62
|
actions: actions,
|
|
55
63
|
required: required
|
|
@@ -78,17 +86,21 @@ const UTCheckbox = _ref => {
|
|
|
78
86
|
colorTheme: "light",
|
|
79
87
|
name: iconName,
|
|
80
88
|
size: 16
|
|
81
|
-
})))), /*#__PURE__*/_react.default.createElement(_UTFieldLabel.default, {
|
|
89
|
+
})))), CustomComponent || /*#__PURE__*/_react.default.createElement(_UTFieldLabel.default, {
|
|
82
90
|
className: classes.title,
|
|
83
91
|
highlighted: shouldHighlightLabel,
|
|
84
92
|
required: required
|
|
85
|
-
}, title)
|
|
93
|
+
}, title), error && /*#__PURE__*/_react.default.createElement(_UTValidation.default, {
|
|
94
|
+
className: classes.validation,
|
|
95
|
+
validationData: validationData
|
|
96
|
+
})));
|
|
86
97
|
};
|
|
87
98
|
UTCheckbox.propTypes = {
|
|
88
99
|
actions: (0, _propTypes.arrayOf)(_buttonTypes.buttonTypes),
|
|
89
100
|
checkboxDataTestId: _propTypes.string,
|
|
90
101
|
classes: (0, _propTypes.objectOf)(_propTypes.string),
|
|
91
102
|
classNames: (0, _propTypes.objectOf)(_propTypes.string),
|
|
103
|
+
CustomComponent: _propTypes.elementType,
|
|
92
104
|
dataTestId: _propTypes.string,
|
|
93
105
|
disabled: _propTypes.bool,
|
|
94
106
|
indeterminate: _propTypes.bool,
|
|
@@ -96,6 +108,7 @@ UTCheckbox.propTypes = {
|
|
|
96
108
|
* @deprecated The "isSimple" prop is deprecated and will be removed in a future release. Please do not use it.
|
|
97
109
|
*/
|
|
98
110
|
isSimple: _propTypes.bool,
|
|
111
|
+
meta: _formTypes.metaPropTypes.isRequired,
|
|
99
112
|
onChange: _propTypes.func,
|
|
100
113
|
required: _propTypes.bool,
|
|
101
114
|
reversed: _propTypes.bool,
|
|
@@ -4,13 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.retrieveStyle = void 0;
|
|
7
|
+
var _form = require("@widergy/web-utils/lib/form");
|
|
7
8
|
var _constants = require("./constants");
|
|
8
9
|
const MEDIUM_SPACING = 16;
|
|
9
10
|
const SMALL_SPACING = 8;
|
|
10
11
|
const baseCheckBoxTheme = theme => ({
|
|
11
12
|
container: {
|
|
12
13
|
alignItems: 'center !important',
|
|
13
|
-
display: 'flex'
|
|
14
|
+
display: 'flex',
|
|
15
|
+
flexWrap: 'wrap',
|
|
16
|
+
rowGap: '12px'
|
|
14
17
|
},
|
|
15
18
|
iconContainer: {
|
|
16
19
|
border: "2px solid ".concat(theme.Palette.gray['04']),
|
|
@@ -25,6 +28,9 @@ const baseCheckBoxTheme = theme => ({
|
|
|
25
28
|
borderRadius: 25,
|
|
26
29
|
overflow: 'hidden',
|
|
27
30
|
padding: 6
|
|
31
|
+
},
|
|
32
|
+
validation: {
|
|
33
|
+
flexBasis: '100%'
|
|
28
34
|
}
|
|
29
35
|
});
|
|
30
36
|
const conditionalStyles = _ref => {
|
|
@@ -36,7 +42,8 @@ const conditionalStyles = _ref => {
|
|
|
36
42
|
spacing,
|
|
37
43
|
variant,
|
|
38
44
|
theme,
|
|
39
|
-
disabled
|
|
45
|
+
disabled,
|
|
46
|
+
error
|
|
40
47
|
} = _ref;
|
|
41
48
|
const spacingValue = spacing === _constants.SPACING.SMALL ? SMALL_SPACING : MEDIUM_SPACING;
|
|
42
49
|
return {
|
|
@@ -51,12 +58,16 @@ const conditionalStyles = _ref => {
|
|
|
51
58
|
...(variant === _constants.BUTTON_VARIANT && {
|
|
52
59
|
borderRadius: '8px',
|
|
53
60
|
padding: spacing === 'small' ? '8px 12px' : '12px 16px',
|
|
61
|
+
backgroundColor: error ? theme.Palette.error['01'] : 'transparent',
|
|
54
62
|
'&:active': {
|
|
55
|
-
backgroundColor: theme.Palette.light['04']
|
|
63
|
+
backgroundColor: error ? theme.Palette.error['02'] : theme.Palette.light['04']
|
|
56
64
|
}
|
|
57
65
|
})
|
|
58
66
|
},
|
|
59
67
|
iconContainer: {
|
|
68
|
+
...(error && {
|
|
69
|
+
borderColor: theme.Palette.error['04']
|
|
70
|
+
}),
|
|
60
71
|
...((value === true || indeterminate) && {
|
|
61
72
|
backgroundColor: ((_theme$Palette$action = theme.Palette.actions) === null || _theme$Palette$action === void 0 ? void 0 : _theme$Palette$action.accent['04']) || theme.Palette.accent['04'],
|
|
62
73
|
borderColor: ((_theme$Palette$action2 = theme.Palette.actions) === null || _theme$Palette$action2 === void 0 ? void 0 : _theme$Palette$action2.accent['04']) || theme.Palette.accent['04']
|
|
@@ -93,9 +104,11 @@ const retrieveStyle = _ref2 => {
|
|
|
93
104
|
reversed,
|
|
94
105
|
spacing,
|
|
95
106
|
theme,
|
|
96
|
-
variant
|
|
107
|
+
variant,
|
|
108
|
+
meta
|
|
97
109
|
} = _ref2;
|
|
98
110
|
const baseThemeStyles = baseCheckBoxTheme(theme);
|
|
111
|
+
const error = meta && (0, _form.shouldShowErrors)(meta);
|
|
99
112
|
const {
|
|
100
113
|
container,
|
|
101
114
|
iconContainer,
|
|
@@ -108,7 +121,8 @@ const retrieveStyle = _ref2 => {
|
|
|
108
121
|
reversed,
|
|
109
122
|
spacing,
|
|
110
123
|
variant,
|
|
111
|
-
theme
|
|
124
|
+
theme,
|
|
125
|
+
error
|
|
112
126
|
});
|
|
113
127
|
return {
|
|
114
128
|
box: baseThemeStyles.box,
|
|
@@ -121,7 +135,8 @@ const retrieveStyle = _ref2 => {
|
|
|
121
135
|
...iconContainer
|
|
122
136
|
},
|
|
123
137
|
boxContainer,
|
|
124
|
-
title
|
|
138
|
+
title,
|
|
139
|
+
validation: baseThemeStyles.validation
|
|
125
140
|
};
|
|
126
141
|
};
|
|
127
142
|
exports.retrieveStyle = retrieveStyle;
|