@widergy/energy-ui 3.67.1 → 3.67.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 CHANGED
@@ -1,3 +1,10 @@
1
+ ## [3.67.2](https://github.com/widergy/energy-ui/compare/v3.67.1...v3.67.2) (2025-03-25)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * [UGC-1195] checkbox error status ([#590](https://github.com/widergy/energy-ui/issues/590)) ([897e62f](https://github.com/widergy/energy-ui/commit/897e62f243d560fe15216b1afe39b219b5b5b082))
7
+
1
8
  ## [3.67.1](https://github.com/widergy/energy-ui/compare/v3.67.0...v3.67.1) (2025-03-25)
2
9
 
3
10
 
@@ -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"));
@@ -29,6 +33,7 @@ const UTCheckbox = _ref => {
29
33
  disabled,
30
34
  indeterminate,
31
35
  isSimple = false,
36
+ meta,
32
37
  onChange = () => {},
33
38
  required,
34
39
  title,
@@ -50,6 +55,8 @@ const UTCheckbox = _ref => {
50
55
  const BoxContainerComponent = variant === _constants.BUTTON_VARIANT ? 'div' : _UTTouchableWithoutFeedback.default;
51
56
  const rootComponentProps = variant === _constants.BUTTON_VARIANT ? touchableProps : {};
52
57
  const boxContainerProps = variant === _constants.BUTTON_VARIANT ? {} : touchableProps;
58
+ const error = meta && (0, _form.shouldShowErrors)(meta) && meta.error || '';
59
+ const validationData = (0, _utils.formatErrorToValidation)(error);
53
60
  return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, withUpperTitle && /*#__PURE__*/_react.default.createElement(_UTFieldLabel.default, {
54
61
  actions: actions,
55
62
  required: required
@@ -82,7 +89,10 @@ const UTCheckbox = _ref => {
82
89
  className: classes.title,
83
90
  highlighted: shouldHighlightLabel,
84
91
  required: required
85
- }, title)));
92
+ }, title), error && /*#__PURE__*/_react.default.createElement(_UTValidation.default, {
93
+ className: classes.validation,
94
+ validationData: validationData
95
+ })));
86
96
  };
87
97
  UTCheckbox.propTypes = {
88
98
  actions: (0, _propTypes.arrayOf)(_buttonTypes.buttonTypes),
@@ -96,6 +106,7 @@ UTCheckbox.propTypes = {
96
106
  * @deprecated The "isSimple" prop is deprecated and will be removed in a future release. Please do not use it.
97
107
  */
98
108
  isSimple: _propTypes.bool,
109
+ meta: _formTypes.metaPropTypes.isRequired,
99
110
  onChange: _propTypes.func,
100
111
  required: _propTypes.bool,
101
112
  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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widergy/energy-ui",
3
- "version": "3.67.1",
3
+ "version": "3.67.2",
4
4
  "description": "Widergy Web Components",
5
5
  "author": "widergy",
6
6
  "license": "MIT",