@widergy/energy-ui 1.125.2 → 1.128.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 CHANGED
@@ -1,3 +1,24 @@
1
+ # [1.128.0](https://github.com/widergy/energy-ui/compare/v1.127.0...v1.128.0) (2022-07-07)
2
+
3
+
4
+ ### Features
5
+
6
+ * added utdialog footer components ([#301](https://github.com/widergy/energy-ui/issues/301)) ([12f1eb8](https://github.com/widergy/energy-ui/commit/12f1eb817a1b42a2b0d89ceaf1f3b61f2d8cecd6))
7
+
8
+ # [1.127.0](https://github.com/widergy/energy-ui/compare/v1.126.0...v1.127.0) (2022-06-22)
9
+
10
+
11
+ ### Features
12
+
13
+ * customIcon ([#299](https://github.com/widergy/energy-ui/issues/299)) ([bcc1659](https://github.com/widergy/energy-ui/commit/bcc1659663e57414179b3ebd3eb971cdba4726f4))
14
+
15
+ # [1.126.0](https://github.com/widergy/energy-ui/compare/v1.125.2...v1.126.0) (2022-06-22)
16
+
17
+
18
+ ### Features
19
+
20
+ * added UTChecklist, UTRadio and UTRating titles ([#294](https://github.com/widergy/energy-ui/issues/294)) ([39e1cf3](https://github.com/widergy/energy-ui/commit/39e1cf3f19e24ff23df4b47a48f4c91d65003155))
21
+
1
22
  ## [1.125.2](https://github.com/widergy/energy-ui/compare/v1.125.1...v1.125.2) (2022-06-22)
2
23
 
3
24
 
@@ -120,12 +120,13 @@ var Legend = function Legend(_ref) {
120
120
 
121
121
  var referenceRenderer = function referenceRenderer(reference) {
122
122
  var label = reference.label,
123
- className = reference.className;
123
+ className = reference.className,
124
+ CustomIcon = reference.CustomIcon;
124
125
  return /*#__PURE__*/_react.default.createElement("div", {
125
126
  className: _stylesModule.default["item".concat(displayAs)]
126
127
  }, /*#__PURE__*/_react.default.createElement("div", {
127
128
  className: className
128
- }), /*#__PURE__*/_react.default.createElement(_.UTLabel, {
129
+ }, CustomIcon && /*#__PURE__*/_react.default.createElement(CustomIcon, null)), /*#__PURE__*/_react.default.createElement(_.UTLabel, {
129
130
  className: "".concat(_stylesModule.default.itemLabel, " ").concat(classes.legendItemLabel)
130
131
  }, label));
131
132
  };
@@ -8,19 +8,19 @@ exports.xAxisDefinitionType = exports.referencesType = exports.linearType = expo
8
8
  var _propTypes = require("prop-types");
9
9
 
10
10
  var barType = (0, _propTypes.shape)({
11
- value: _propTypes.number,
12
- tooltipContent: _propTypes.string,
13
- color: _propTypes.string,
14
11
  clickable: _propTypes.bool,
15
- highlighted: _propTypes.string,
12
+ color: _propTypes.string,
16
13
  highlightColor: _propTypes.string,
14
+ highlighted: _propTypes.string,
15
+ tooltipContent: _propTypes.string,
16
+ value: _propTypes.number,
17
17
  values: (0, _propTypes.arrayOf)((0, _propTypes.shape)({
18
- value: _propTypes.number,
19
- tooltipContent: _propTypes.string,
20
- color: _propTypes.string,
21
18
  clickable: _propTypes.bool,
19
+ color: _propTypes.string,
20
+ highlightColor: _propTypes.string,
22
21
  highlighted: _propTypes.string,
23
- highlightColor: _propTypes.string
22
+ tooltipContent: _propTypes.string,
23
+ value: _propTypes.number
24
24
  }))
25
25
  });
26
26
  exports.barType = barType;
@@ -31,13 +31,13 @@ var linearMarkersType = (0, _propTypes.shape)({
31
31
  });
32
32
  exports.linearMarkersType = linearMarkersType;
33
33
  var linearType = (0, _propTypes.shape)({
34
+ color: _propTypes.string,
34
35
  data: (0, _propTypes.arrayOf)({
35
36
  xCoodrinate: _propTypes.number,
36
37
  value: _propTypes.number
37
38
  }),
38
- type: _propTypes.string,
39
- color: _propTypes.string,
40
- marker: linearMarkersType
39
+ marker: linearMarkersType,
40
+ type: _propTypes.string
41
41
  });
42
42
  exports.linearType = linearType;
43
43
  var linearDataType = (0, _propTypes.arrayOf)(linearType);
@@ -49,17 +49,18 @@ var levelsType = (0, _propTypes.arrayOf)((0, _propTypes.shape)({
49
49
  }));
50
50
  exports.levelsType = levelsType;
51
51
  var referencesType = (0, _propTypes.arrayOf)((0, _propTypes.shape)({
52
- id: _propTypes.string,
53
- className: _propTypes.string,
54
52
  check: _propTypes.func,
53
+ className: _propTypes.string,
54
+ CustomIcon: _propTypes.elementType,
55
+ id: _propTypes.string,
55
56
  label: _propTypes.string,
56
57
  orderFunction: _propTypes.func
57
58
  }));
58
59
  exports.referencesType = referencesType;
59
60
  var xAxisDefinitionType = (0, _propTypes.arrayOf)((0, _propTypes.shape)({
61
+ labelBackgroundPadding: _propTypes.number,
60
62
  mainLabel: _propTypes.string,
61
63
  secondaryLabel: _propTypes.string,
62
- selectedLabelBackground: _propTypes.string,
63
- labelBackgroundPadding: _propTypes.number
64
+ selectedLabelBackground: _propTypes.string
64
65
  }));
65
66
  exports.xAxisDefinitionType = xAxisDefinitionType;
@@ -39,6 +39,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
39
39
 
40
40
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
41
41
 
42
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
43
+
42
44
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
43
45
 
44
46
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -52,6 +54,8 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
52
54
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
53
55
 
54
56
  var UTCheckList = function UTCheckList(_ref) {
57
+ var _field$configuration;
58
+
55
59
  var valueKey = _ref.valueKey,
56
60
  labelKey = _ref.labelKey,
57
61
  input = _ref.input,
@@ -73,7 +77,11 @@ var UTCheckList = function UTCheckList(_ref) {
73
77
  allChecked = _ref.allChecked,
74
78
  getSelectAllNewValues = _ref.getSelectAllNewValues,
75
79
  CustomCheckedIcon = _ref.CustomCheckedIcon,
76
- CustomUncheckedIcon = _ref.CustomUncheckedIcon;
80
+ CustomUncheckedIcon = _ref.CustomUncheckedIcon,
81
+ field = _ref.field,
82
+ withUpperTitle = _ref.withUpperTitle,
83
+ titleProps = _ref.titleProps;
84
+ var shouldShowUpperTitle = (field === null || field === void 0 ? void 0 : (_field$configuration = field.configuration) === null || _field$configuration === void 0 ? void 0 : _field$configuration.ignore_title) && withUpperTitle;
77
85
 
78
86
  var handleChange = function handleChange(id) {
79
87
  var newValues = input.value.indexOf(id) === -1 ? [].concat(_toConsumableArray(input.value), [id]) : input.value.filter(function (elem) {
@@ -112,7 +120,9 @@ var UTCheckList = function UTCheckList(_ref) {
112
120
 
113
121
  return /*#__PURE__*/_react.default.createElement("div", {
114
122
  className: "".concat(_stylesModule.default.container, " ").concat(className)
115
- }, /*#__PURE__*/_react.default.createElement("div", {
123
+ }, shouldShowUpperTitle && /*#__PURE__*/_react.default.createElement(_UTLabel.default, _extends({
124
+ className: "".concat(classes.title)
125
+ }, titleProps), field.title), /*#__PURE__*/_react.default.createElement("div", {
116
126
  className: header ? classes.tableHeader : classes.selectAll
117
127
  }, header && header.map(function (item) {
118
128
  return /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
@@ -169,39 +179,42 @@ UTCheckList.defaultProps = {
169
179
  list: []
170
180
  };
171
181
  UTCheckList.propTypes = {
172
- disabled: _propTypes.bool,
173
- valueKey: _propTypes.string.isRequired,
174
- labelKey: _propTypes.string.isRequired,
175
- input: (0, _propTypes.shape)({
176
- onChange: _propTypes.func,
177
- value: _propTypes.any
178
- }),
179
182
  additionalInfo: (0, _propTypes.shape)({
180
183
  header: _propTypes.string,
181
184
  footer: _propTypes.string
182
185
  }),
183
- list: (0, _propTypes.arrayOf)((0, _propTypes.shape)({
184
- id: _propTypes.number,
185
- label: _propTypes.string,
186
- checked: _propTypes.bool
187
- })),
188
186
  allChecked: _propTypes.bool,
189
- shouldShowErrors: _propTypes.bool,
187
+ classes: (0, _propTypes.objectOf)(_propTypes.string),
190
188
  className: _propTypes.string,
191
- meta: _formTypes.metaPropTypes,
189
+ classNames: (0, _propTypes.objectOf)(_propTypes.string),
190
+ CustomCheckedIcon: _propTypes.element,
192
191
  customRowLabel: _propTypes.element,
193
192
  customSelectAllRowLabel: _propTypes.element,
193
+ CustomUncheckedIcon: _propTypes.element,
194
+ disabled: _propTypes.bool,
195
+ field: _formTypes.fieldType,
194
196
  getSelectAllNewValues: _propTypes.func,
195
- classes: (0, _propTypes.objectOf)(_propTypes.string),
196
- classNames: (0, _propTypes.objectOf)(_propTypes.string),
197
197
  header: (0, _propTypes.shape)({
198
198
  text: _propTypes.string
199
199
  }),
200
200
  headerLabel: _propTypes.string,
201
- withCheckRow: _propTypes.bool,
201
+ input: (0, _propTypes.shape)({
202
+ onChange: _propTypes.func,
203
+ value: _propTypes.any
204
+ }),
205
+ labelKey: _propTypes.string.isRequired,
206
+ list: (0, _propTypes.arrayOf)((0, _propTypes.shape)({
207
+ id: _propTypes.number,
208
+ label: _propTypes.string,
209
+ checked: _propTypes.bool
210
+ })),
211
+ meta: _formTypes.metaPropTypes,
212
+ shouldShowErrors: _propTypes.bool,
213
+ titleProps: _propTypes.object,
202
214
  useCustomIcons: _propTypes.bool,
203
- CustomCheckedIcon: _propTypes.element,
204
- CustomUncheckedIcon: _propTypes.element
215
+ valueKey: _propTypes.string.isRequired,
216
+ withCheckRow: _propTypes.bool,
217
+ withUpperTitle: _propTypes.bool
205
218
  };
206
219
 
207
220
  var _default = (0, _WithTheme.default)(_theme.retrieveStyle, _theme.retrieveMuiTheme)(UTCheckList);
@@ -53,6 +53,7 @@ var UTDialog = function UTDialog(_ref) {
53
53
  disableScrollLock = _ref.disableScrollLock,
54
54
  disableTypography = _ref.disableTypography,
55
55
  elevation = _ref.elevation,
56
+ FooterComponents = _ref.FooterComponents,
56
57
  _ref$isOpen = _ref.isOpen,
57
58
  isOpen = _ref$isOpen === void 0 ? false : _ref$isOpen,
58
59
  onRequestClose = _ref.onRequestClose,
@@ -106,7 +107,7 @@ var UTDialog = function UTDialog(_ref) {
106
107
  className: "".concat(classes.warning, " ").concat(warning)
107
108
  }), warningAlert), (cancelButton || acceptButton) && /*#__PURE__*/_react.default.createElement(_DialogActions.default, {
108
109
  className: "".concat(classes.dialogActions, " ").concat(dialogActions)
109
- }, cancelButton && /*#__PURE__*/_react.default.createElement(_ActionButton.default, {
110
+ }, FooterComponents, cancelButton && /*#__PURE__*/_react.default.createElement(_ActionButton.default, {
110
111
  ButtonComponent: ButtonComponent,
111
112
  button: cancelButton,
112
113
  className: classes.cancelButton,
@@ -140,6 +141,7 @@ UTDialog.propTypes = {
140
141
  disableScrollLock: _propTypes.bool,
141
142
  disableTypography: _propTypes.bool,
142
143
  elevation: _propTypes.number,
144
+ FooterComponents: _propTypes.elementType,
143
145
  isOpen: _propTypes.bool,
144
146
  onRequestClose: _propTypes.func,
145
147
  roundedCloseButton: _propTypes.bool,
@@ -52,25 +52,26 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
52
52
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
53
53
 
54
54
  var UTPieChart = function UTPieChart(_ref) {
55
- var className = _ref.className,
55
+ var animationLength = _ref.animationLength,
56
+ classes = _ref.classes,
57
+ className = _ref.className,
56
58
  _ref$classNames = _ref.classNames,
57
59
  classNames = _ref$classNames === void 0 ? {} : _ref$classNames,
58
- classes = _ref.classes,
59
60
  data = _ref.data,
60
- width = _ref.width,
61
+ gradientGenerator = _ref.gradientGenerator,
61
62
  height = _ref.height,
63
+ initialAngle = _ref.initialAngle,
62
64
  innerRadius = _ref.innerRadius,
63
- outerRadius = _ref.outerRadius,
64
- animationLength = _ref.animationLength,
65
65
  legend = _ref.legend,
66
- transition = _ref.transition,
67
- withLegend = _ref.withLegend,
68
- withLabels = _ref.withLabels,
66
+ minAngle = _ref.minAngle,
67
+ outerRadius = _ref.outerRadius,
69
68
  outlined = _ref.outlined,
70
69
  paddingAngle = _ref.paddingAngle,
71
70
  showPercentageInLegend = _ref.showPercentageInLegend,
72
- initialAngle = _ref.initialAngle,
73
- minAngle = _ref.minAngle;
71
+ transition = _ref.transition,
72
+ width = _ref.width,
73
+ withLabels = _ref.withLabels,
74
+ withLegend = _ref.withLegend;
74
75
  var totalSum = data.reduce(function (acc, _ref2) {
75
76
  var value = _ref2.value;
76
77
  return acc + value;
@@ -117,9 +118,9 @@ var UTPieChart = function UTPieChart(_ref) {
117
118
  className: "".concat(_stylesModule.default["".concat(position.split('-')[0], "LegendWrapper")], " ").concat(_stylesModule.default[position])
118
119
  }, withLegend && /*#__PURE__*/_react.default.createElement(_Legend.default, {
119
120
  classes: classes,
120
- showPercentage: showPercentageInLegend,
121
121
  data: data,
122
122
  legend: legend,
123
+ showPercentage: showPercentageInLegend,
123
124
  totalConsumption: totalSum
124
125
  })), /*#__PURE__*/_react.default.createElement("div", {
125
126
  className: "".concat(_stylesModule.default["".concat(position.split('-')[0], "PieWrapper")], " ").concat(classNames.chartContainer),
@@ -128,7 +129,7 @@ var UTPieChart = function UTPieChart(_ref) {
128
129
  viewBox: "".concat(-containerWidth / 2, " ").concat(-containerHeight / 2, " ").concat(containerWidth, " ").concat(containerHeight),
129
130
  width: containerWidth,
130
131
  height: containerHeight
131
- }, pie.map(function (slice) {
132
+ }, gradientGenerator === null || gradientGenerator === void 0 ? void 0 : gradientGenerator(), pie.map(function (slice) {
132
133
  return /*#__PURE__*/_react.default.createElement("path", {
133
134
  d: arcGenerator(slice),
134
135
  fill: slice.data.color
@@ -147,55 +148,56 @@ var UTPieChart = function UTPieChart(_ref) {
147
148
  value = _slice$data.value,
148
149
  id = _slice$data.id;
149
150
  return !id && (label || value) && /*#__PURE__*/_react.default.createElement(_ArrowLabel.default, {
150
- label: label,
151
151
  color: color,
152
- value: value / totalSum,
152
+ label: label,
153
153
  midAngle: (endAngle - startAngle) / 2 + startAngle,
154
- outerRadius: outerRadius + (outlined ? _constants.OUTLINE_SEPARATION + _constants.OUTLINE_WIDTH : 0)
154
+ outerRadius: outerRadius + (outlined ? _constants.OUTLINE_SEPARATION + _constants.OUTLINE_WIDTH : 0),
155
+ value: value / totalSum
155
156
  });
156
157
  })))));
157
158
  };
158
159
 
159
160
  UTPieChart.propTypes = {
161
+ animationLength: _propTypes.number,
162
+ classes: _commonTypes.classesType,
163
+ className: _propTypes.string,
164
+ classNames: (0, _propTypes.shape)({
165
+ chartContainer: _propTypes.string
166
+ }),
160
167
  data: (0, _propTypes.arrayOf)((0, _propTypes.shape)({
161
168
  color: _propTypes.string,
162
169
  label: _propTypes.string,
163
170
  value: _propTypes.number
164
171
  })),
165
- width: _propTypes.number,
172
+ gradientGenerator: _propTypes.func,
166
173
  height: _propTypes.number,
174
+ initialAngle: _propTypes.number,
167
175
  innerRadius: _propTypes.number,
168
- outerRadius: _propTypes.number,
169
- animationLength: _propTypes.number,
170
176
  legend: (0, _propTypes.shape)({
171
177
  position: _propTypes.string,
172
178
  type: _propTypes.string
173
179
  }),
174
- transition: _propTypes.string,
175
- withLegend: _propTypes.bool,
180
+ minAngle: _propTypes.number,
181
+ outerRadius: _propTypes.number,
176
182
  outlined: _propTypes.bool,
177
- withLabels: _propTypes.bool,
178
183
  paddingAngle: _propTypes.number,
179
- className: _propTypes.string,
180
- classNames: (0, _propTypes.shape)({
181
- chartContainer: _propTypes.string
182
- }),
183
184
  showPercentageInLegend: _propTypes.bool,
184
- classes: _commonTypes.classesType,
185
- initialAngle: _propTypes.number,
186
- minAngle: _propTypes.number
185
+ transition: _propTypes.string,
186
+ width: _propTypes.number,
187
+ withLabels: _propTypes.bool,
188
+ withLegend: _propTypes.bool
187
189
  };
188
190
  UTPieChart.defaultProps = {
191
+ animationLength: _constants.DEFAULT_ANIMATION_LENGTH,
192
+ classes: {},
189
193
  data: _constants.DEFAULT_DATA,
194
+ initialAngle: _constants.DEFAULT_INITIAL_ANGLE,
190
195
  innerRadius: _constants.DEFAULT_INNER_RADIUS,
191
- outerRadius: _constants.DEFAULT_OUTER_RADIUS,
192
- animationLength: _constants.DEFAULT_ANIMATION_LENGTH,
193
196
  legend: _constants.DEFAULT_LEGEND,
194
- transition: _constants.DEFAULT_TRANSITION,
195
- paddingAngle: _constants.DEFAULT_PADDING_ANGLE,
196
- initialAngle: _constants.DEFAULT_INITIAL_ANGLE,
197
197
  minAngle: _constants.DEFAULT_MIN_ANGLE,
198
- classes: {}
198
+ outerRadius: _constants.DEFAULT_OUTER_RADIUS,
199
+ paddingAngle: _constants.DEFAULT_PADDING_ANGLE,
200
+ transition: _constants.DEFAULT_TRANSITION
199
201
  };
200
202
 
201
203
  var _default = (0, _WithTheme.default)(_theme.retrieveStyle)(UTPieChart);
@@ -21,6 +21,8 @@ var _formTypes = require("../../types/formTypes");
21
21
 
22
22
  var _WithTheme = _interopRequireDefault(require("../WithTheme"));
23
23
 
24
+ var _UTLabel = _interopRequireDefault(require("../UTLabel"));
25
+
24
26
  var _theme = require("./theme");
25
27
 
26
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -29,6 +31,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
29
31
 
30
32
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
31
33
 
34
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
35
+
32
36
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
33
37
 
34
38
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
@@ -115,16 +119,25 @@ var UTRadioGroup = /*#__PURE__*/function (_PureComponent) {
115
119
  _createClass(UTRadioGroup, [{
116
120
  key: "render",
117
121
  value: function render() {
122
+ var _field$configuration;
123
+
118
124
  var _this$props2 = this.props,
119
125
  input = _this$props2.input,
120
126
  options = _this$props2.options,
121
- containerClassName = _this$props2.containerClassName;
122
- return /*#__PURE__*/_react.default.createElement(_RadioGroup.default, {
127
+ containerClassName = _this$props2.containerClassName,
128
+ field = _this$props2.field,
129
+ withUpperTitle = _this$props2.withUpperTitle,
130
+ titleProps = _this$props2.titleProps,
131
+ classes = _this$props2.classes;
132
+ var shouldShowUpperTitle = (field === null || field === void 0 ? void 0 : (_field$configuration = field.configuration) === null || _field$configuration === void 0 ? void 0 : _field$configuration.ignore_title) && withUpperTitle;
133
+ return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, shouldShowUpperTitle && /*#__PURE__*/_react.default.createElement(_UTLabel.default, _extends({
134
+ className: "".concat(classes.title)
135
+ }, titleProps), field.title), /*#__PURE__*/_react.default.createElement(_RadioGroup.default, {
123
136
  name: input.name,
124
137
  value: input.value,
125
138
  className: containerClassName,
126
139
  onChange: this.handleChange
127
- }, options.map(this.renderRadioItem));
140
+ }, options.map(this.renderRadioItem)));
128
141
  }
129
142
  }]);
130
143
 
@@ -132,23 +145,26 @@ var UTRadioGroup = /*#__PURE__*/function (_PureComponent) {
132
145
  }(_react.PureComponent);
133
146
 
134
147
  UTRadioGroup.defaultProps = {
135
- valueKey: 'value',
148
+ classes: {},
136
149
  labelKey: 'name',
137
- classes: {}
150
+ valueKey: 'value'
138
151
  };
139
152
  UTRadioGroup.propTypes = {
140
- input: _formTypes.inputPropTypes,
141
- options: (0, _propTypes.arrayOf)(_propTypes.object),
142
- valueKey: _propTypes.string,
143
- labelKey: _propTypes.string,
144
- divider: _propTypes.bool,
145
- disabled: _propTypes.bool,
153
+ classes: (0, _propTypes.objectOf)(_propTypes.string),
146
154
  className: _propTypes.string,
155
+ classNames: (0, _propTypes.objectOf)(_propTypes.string),
147
156
  containerClassName: _propTypes.string,
148
157
  customRadioLabel: _propTypes.element,
149
- classes: (0, _propTypes.objectOf)(_propTypes.string),
150
- classNames: (0, _propTypes.objectOf)(_propTypes.string),
151
- disableRipple: _propTypes.bool
158
+ disabled: _propTypes.bool,
159
+ disableRipple: _propTypes.bool,
160
+ divider: _propTypes.bool,
161
+ field: _formTypes.fieldType,
162
+ input: _formTypes.inputPropTypes,
163
+ labelKey: _propTypes.string,
164
+ options: (0, _propTypes.arrayOf)(_propTypes.object),
165
+ titleProps: _propTypes.object,
166
+ valueKey: _propTypes.string,
167
+ withUpperTitle: _propTypes.bool
152
168
  };
153
169
 
154
170
  var _default = (0, _WithTheme.default)(_theme.retrieveStyle, _theme.retrieveMuiTheme)(UTRadioGroup);
@@ -17,6 +17,8 @@ var _formTypes = require("../../types/formTypes");
17
17
 
18
18
  var _WithTheme = _interopRequireDefault(require("../WithTheme"));
19
19
 
20
+ var _UTLabel = _interopRequireDefault(require("../UTLabel"));
21
+
20
22
  var _theme = require("./theme");
21
23
 
22
24
  var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
@@ -48,10 +50,14 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
48
50
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
49
51
 
50
52
  var UTRatingContainer = function UTRatingContainer(_ref) {
51
- var options = _ref.options,
53
+ var _field$configuration;
54
+
55
+ var classes = _ref.classes,
52
56
  field = _ref.field,
53
57
  onChange = _ref.onChange,
54
- classes = _ref.classes;
58
+ options = _ref.options,
59
+ titleProps = _ref.titleProps,
60
+ withUpperTitle = _ref.withUpperTitle;
55
61
 
56
62
  var _useState = (0, _react.useState)([]),
57
63
  _useState2 = _slicedToArray(_useState, 2),
@@ -68,6 +74,8 @@ var UTRatingContainer = function UTRatingContainer(_ref) {
68
74
  temporalSelected = _useState6[0],
69
75
  setTemporalSelected = _useState6[1];
70
76
 
77
+ var shouldShowUpperTitle = (field === null || field === void 0 ? void 0 : (_field$configuration = field.configuration) === null || _field$configuration === void 0 ? void 0 : _field$configuration.ignore_title) && withUpperTitle;
78
+
71
79
  var handleClick = function handleClick(order, value) {
72
80
  setSelectedOptions((0, _array.autocompleteWithNumbers)(1, order));
73
81
  if ((0, _array.isEmpty)(selectedOptions)) setTemporalSelected((0, _array.autocompleteWithNumbers)(1, order));
@@ -92,7 +100,7 @@ var UTRatingContainer = function UTRatingContainer(_ref) {
92
100
  value: option.value,
93
101
  order: option.order,
94
102
  isFirst: options[0].order === option.order,
95
- isLast: options.length === option.order,
103
+ isLast: options[options.length - 1].order === option.order,
96
104
  textVariant: field.configuration && field.configuration.text_variant,
97
105
  name: option.name,
98
106
  classes: classes,
@@ -110,22 +118,29 @@ var UTRatingContainer = function UTRatingContainer(_ref) {
110
118
  }, defaultProps));
111
119
  };
112
120
 
113
- return /*#__PURE__*/_react.default.createElement("div", {
114
- className: _stylesModule.default.container
115
- }, options.map(handleMapOptions));
121
+ return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, shouldShowUpperTitle && /*#__PURE__*/_react.default.createElement(_UTLabel.default, _extends({
122
+ className: "".concat(classes.title)
123
+ }, titleProps), field.title), /*#__PURE__*/_react.default.createElement("div", {
124
+ className: "".concat(_stylesModule.default.container, " ").concat(classes.container)
125
+ }, options.map(handleMapOptions)));
116
126
  };
117
127
 
118
128
  UTRatingContainer.propTypes = {
129
+ classes: (0, _propTypes.shape)({
130
+ avatar: _propTypes.string,
131
+ container: _propTypes.string,
132
+ label: _propTypes.string,
133
+ ratingContainer: _propTypes.string,
134
+ title: _propTypes.string
135
+ }),
136
+ field: _formTypes.fieldType,
137
+ onChange: _propTypes.func,
119
138
  options: (0, _propTypes.arrayOf)((0, _propTypes.shape)({
120
139
  order: _propTypes.number,
121
140
  value: (0, _propTypes.oneOfType)([_propTypes.number, _propTypes.string])
122
141
  })),
123
- onChange: _propTypes.func,
124
- field: _formTypes.fieldType,
125
- classes: (0, _propTypes.shape)({
126
- label: _propTypes.string,
127
- avatar: _propTypes.string
128
- })
142
+ titleProps: _propTypes.object,
143
+ withUpperTitle: _propTypes.bool
129
144
  };
130
145
 
131
146
  var _default = (0, _WithTheme.default)(_theme.retrieveStyle)(UTRatingContainer);
@@ -3,6 +3,7 @@
3
3
  .container {
4
4
  display: flex;
5
5
  margin: 10px 0;
6
+
6
7
  @media #{$mobile} {
7
8
  margin-bottom: 15px;
8
9
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widergy/energy-ui",
3
- "version": "1.125.2",
3
+ "version": "1.128.0",
4
4
  "description": "Widergy Web Components",
5
5
  "author": "widergy",
6
6
  "license": "MIT",