@widergy/energy-ui 2.1.1 → 2.1.3

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,17 @@
1
+ ## [2.1.3](https://github.com/widergy/energy-ui/compare/v2.1.2...v2.1.3) (2023-02-15)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * markdown problem ([a210770](https://github.com/widergy/energy-ui/commit/a21077080d455014251558f1cd8f5184e2b76660))
7
+
8
+ ## [2.1.2](https://github.com/widergy/energy-ui/compare/v2.1.1...v2.1.2) (2023-02-10)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * table fixes ([#343](https://github.com/widergy/energy-ui/issues/343)) ([2a7d92b](https://github.com/widergy/energy-ui/commit/2a7d92bc08bfecd695d81b79f50a15cd9304a7d7))
14
+
1
15
  ## [2.1.1](https://github.com/widergy/energy-ui/compare/v2.1.0...v2.1.1) (2023-02-09)
2
16
 
3
17
 
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ var _propTypes = require("prop-types");
10
+ var _object = require("@widergy/web-utils/lib/object");
11
+ var _UTButton = _interopRequireDefault(require("../../../../../UTButton"));
12
+ var _types = require("../../../../types");
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
+ 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; }
16
+ var ActionButton = function ActionButton(_ref) {
17
+ var _column$actions;
18
+ var column = _ref.column,
19
+ rowData = _ref.rowData;
20
+ var actionConfig = (_column$actions = column.actions) === null || _column$actions === void 0 ? void 0 : _column$actions[0];
21
+ return !(0, _object.objectIsEmpty)(actionConfig) && /*#__PURE__*/_react.default.createElement(_UTButton.default, {
22
+ classNames: actionConfig.buttonClassNames,
23
+ key: actionConfig.key,
24
+ onClick: function onClick() {
25
+ return actionConfig.onClick(rowData);
26
+ },
27
+ variant: "text"
28
+ }, actionConfig.text);
29
+ };
30
+ ActionButton.propTypes = {
31
+ column: _types.columnType,
32
+ rowData: _propTypes.object
33
+ };
34
+ var _default = /*#__PURE__*/(0, _react.memo)(ActionButton);
35
+ exports.default = _default;
@@ -10,6 +10,7 @@ var _constants = require("../../constants");
10
10
  var _types = require("../../types");
11
11
  var _ActionIcons = _interopRequireDefault(require("../ActionIcons"));
12
12
  var _Status = _interopRequireDefault(require("../Status"));
13
+ var _ActionButton = _interopRequireDefault(require("./components/ActionButton"));
13
14
  var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
14
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
16
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -26,16 +27,19 @@ var Cell = function Cell(_ref) {
26
27
  classes = _ref.classes,
27
28
  column = _ref.column,
28
29
  columnSizes = _ref.columnSizes,
30
+ defaultNullValue = _ref.defaultNullValue,
29
31
  rowData = _ref.rowData,
30
- style = _ref.style,
31
- defaultNullValue = _ref.defaultNullValue;
32
- var cellAlignStyles = column.type === _constants.CELL_TYPES.ACTION_ICONS ? _stylesModule.default.centerAlign : _stylesModule.default["".concat(align, "Align")];
32
+ style = _ref.style;
33
+ var cellAlignStyles = [_constants.CELL_TYPES.ACTION_ICONS, _constants.CELL_TYPES.ACTION_BUTTON].includes(column.type) ? _stylesModule.default.centerAlign : _stylesModule.default["".concat(align, "Align")];
33
34
  return /*#__PURE__*/_react.default.createElement("div", {
34
35
  className: " ".concat(_stylesModule.default.rowElement, " ").concat(cellAlignStyles, " ").concat(classes.rowCell),
35
36
  style: _objectSpread({
36
37
  width: columnSizes[column.key]
37
38
  }, style)
38
- }, column.cellRenderer ? column.cellRenderer(rowData[column.key], rowData) : column.type === _constants.CELL_TYPES.ACTION_ICONS ? /*#__PURE__*/_react.default.createElement(_ActionIcons.default, {
39
+ }, column.cellRenderer ? column.cellRenderer(rowData[column.key], rowData) : column.type === _constants.CELL_TYPES.ACTION_BUTTON ? /*#__PURE__*/_react.default.createElement(_ActionButton.default, {
40
+ column: column,
41
+ rowData: rowData
42
+ }) : column.type === _constants.CELL_TYPES.ACTION_ICONS ? /*#__PURE__*/_react.default.createElement(_ActionIcons.default, {
39
43
  column: column,
40
44
  rowData: rowData,
41
45
  classes: classes
@@ -51,9 +55,9 @@ Cell.propTypes = {
51
55
  classes: _types.classesType,
52
56
  column: _types.columnType,
53
57
  columnSizes: _types.columnSizesType,
58
+ defaultNullValue: _propTypes.string,
54
59
  rowData: _propTypes.object,
55
- style: _propTypes.object,
56
- defaultNullValue: _propTypes.string
60
+ style: _propTypes.object
57
61
  };
58
62
  var _default = /*#__PURE__*/(0, _react.memo)(Cell);
59
63
  exports.default = _default;
@@ -37,7 +37,7 @@ var HeaderCell = function HeaderCell(_ref) {
37
37
  return handleOrder((0, _utils.getNewOrder)(order, column));
38
38
  };
39
39
  var OrderICon = order.key !== column.key ? _UnfoldMore.default : _ArrowUpward.default;
40
- var cellAlignStyles = column.type === _constants.CELL_TYPES.ACTION_ICONS ? _stylesModule.default.centerAlign : _stylesModule.default["".concat(align, "Align")];
40
+ var cellAlignStyles = [_constants.CELL_TYPES.ACTION_ICONS, _constants.CELL_TYPES.ACTION_BUTTON].includes(column.type) ? _stylesModule.default.centerAlign : _stylesModule.default["".concat(align, "Align")];
41
41
  var activeCell = order.key === column.key;
42
42
  var isSortable = column.sortable && !_constants.CELL_ACTION_TYPES.includes(column.type);
43
43
  return /*#__PURE__*/_react.default.createElement(_UTTouchableWithoutFeedback.default, {
@@ -11,7 +11,7 @@ var _types = require("../../types");
11
11
  var _ActionIcons = _interopRequireDefault(require("../ActionIcons"));
12
12
  var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
13
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
- var ResponsiveCell = function ResponsiveCell(_ref) {
14
+ var PrimaryAction = function PrimaryAction(_ref) {
15
15
  var column = _ref.column,
16
16
  classes = _ref.classes,
17
17
  rowData = _ref.rowData,
@@ -30,11 +30,11 @@ var ResponsiveCell = function ResponsiveCell(_ref) {
30
30
  rowData: rowData
31
31
  }));
32
32
  };
33
- ResponsiveCell.propTypes = {
33
+ PrimaryAction.propTypes = {
34
34
  column: _types.columnType,
35
35
  classes: (0, _propTypes.objectOf)(_propTypes.string),
36
36
  rowData: _propTypes.object,
37
37
  showBottomBorder: _propTypes.bool
38
38
  };
39
- var _default = ResponsiveCell;
39
+ var _default = PrimaryAction;
40
40
  exports.default = _default;
@@ -141,7 +141,8 @@ var UTTextInput = /*#__PURE__*/function (_PureComponent) {
141
141
  helperText: errorMessage ? /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
142
142
  className: _stylesModule.default.errorLabel,
143
143
  colorTheme: "error",
144
- variant: "small"
144
+ variant: "small",
145
+ withMarkdown: true
145
146
  }, errorMessage) : undefined,
146
147
  disabled: disabled,
147
148
  onChange: handleChange,
@@ -91,8 +91,9 @@ var UTWorkflowContainer = function UTWorkflowContainer(_ref) {
91
91
  iconPlacement: 'left',
92
92
  variant: 'semitransparent'
93
93
  }
94
- }, !smallButtons && (backButton.label || _constants.BACK)), !hideStepCounter && actionsPosition === _constants.ACTIONS_POSITIONS.TOP && stepsCount && (StepCounter ? /*#__PURE__*/_react.default.createElement(StepCounter, null) : /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
95
- className: "".concat(_stylesModule.default.stepInfo, " ").concat(classes.stepCounter)
94
+ }, !smallButtons && (backButton.label || _constants.BACK)), !hideStepCounter && actionsPosition === _constants.ACTIONS_POSITIONS.TOP && visibleStepNumber && (StepCounter ? /*#__PURE__*/_react.default.createElement(StepCounter, null) : /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
95
+ className: "".concat(_stylesModule.default.stepInfo, " ").concat(classes.stepCounter),
96
+ weight: "medium"
96
97
  }, "".concat(_constants.STEP, " ").concat(visibleStepNumber))), extraActions, /*#__PURE__*/_react.default.createElement(_ActionButton.default, {
97
98
  isHidden: nextButton.isHidden,
98
99
  button: nextButton,
@@ -112,12 +113,11 @@ var UTWorkflowContainer = function UTWorkflowContainer(_ref) {
112
113
  className: classes.titleIcon
113
114
  }), /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
114
115
  className: classes.title,
115
- variant: "title3",
116
- weight: "bold",
116
+ variant: "title2",
117
+ weight: "medium",
117
118
  withMarkdown: true
118
119
  }, title)), subtitle && /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
119
120
  className: classes.subtitle,
120
- variant: "subtitle2",
121
121
  withMarkdown: true
122
122
  }, subtitle)), children));
123
123
  };
@@ -13,7 +13,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
13
13
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
14
14
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
15
15
  var retrieveStyle = function retrieveStyle(_ref) {
16
- var _container, _theme$UTWorkflowCont, _theme$UTWorkflowCont2, _theme$UTWorkflowCont3, _theme$UTWorkflowCont4, _theme$UTWorkflowCont5, _theme$UTWorkflowCont6, _theme$UTWorkflowCont7, _theme$UTWorkflowCont8, _theme$UTWorkflowCont9, _theme$UTWorkflowCont10, _theme$UTWorkflowCont11, _theme$UTWorkflowCont12, _subtitle, _theme$UTWorkflowCont13, _theme$UTWorkflowCont14, _theme$UTWorkflowCont15;
16
+ var _container, _theme$UTWorkflowCont, _theme$UTWorkflowCont2, _theme$UTWorkflowCont3, _theme$UTWorkflowCont4, _theme$UTWorkflowCont5, _theme$UTWorkflowCont6, _theme$UTWorkflowCont7, _theme$UTWorkflowCont8, _theme$UTWorkflowCont9, _theme$UTWorkflowCont10, _theme$UTWorkflowCont11, _theme$UTWorkflowCont12, _theme$UTWorkflowCont13, _theme$UTWorkflowCont14, _theme$UTWorkflowCont15;
17
17
  var theme = _ref.theme;
18
18
  var mobile = (0, _seamlessImmutable.getIn)(theme, ['Media', 'mobile']);
19
19
  var tabletMobile = (0, _seamlessImmutable.getIn)(theme, ['Media', 'tabletMobile']);
@@ -66,7 +66,7 @@ var retrieveStyle = function retrieveStyle(_ref) {
66
66
  titles: _defineProperty({
67
67
  display: 'flex',
68
68
  flexDirection: 'column',
69
- margin: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'titles', 'margin'], '0'),
69
+ marginBottom: 12,
70
70
  alignItems: 'center',
71
71
  maxWidth: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'titles', 'maxWidth'])
72
72
  }, tabletMobile, {
@@ -84,14 +84,10 @@ var retrieveStyle = function retrieveStyle(_ref) {
84
84
  }),
85
85
  title: _defineProperty({
86
86
  color: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'title', 'color']),
87
- fontSize: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'title', 'fontSize']),
88
- fontWeight: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'title', 'fontWeight']),
89
87
  margin: (0, _classesUtils.withImportant)((theme === null || theme === void 0 ? void 0 : (_theme$UTWorkflowCont7 = theme.UTWorkflowContainer) === null || _theme$UTWorkflowCont7 === void 0 ? void 0 : (_theme$UTWorkflowCont8 = _theme$UTWorkflowCont7.title) === null || _theme$UTWorkflowCont8 === void 0 ? void 0 : _theme$UTWorkflowCont8.margin) || '0 0 2px 0'),
90
- marginBottom: (0, _classesUtils.withImportant)(theme === null || theme === void 0 ? void 0 : (_theme$UTWorkflowCont9 = theme.UTWorkflowContainer) === null || _theme$UTWorkflowCont9 === void 0 ? void 0 : (_theme$UTWorkflowCont10 = _theme$UTWorkflowCont9.title) === null || _theme$UTWorkflowCont10 === void 0 ? void 0 : _theme$UTWorkflowCont10.marginBottom),
91
- textAlign: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'title', 'textAlign'])
88
+ marginBottom: (0, _classesUtils.withImportant)(theme === null || theme === void 0 ? void 0 : (_theme$UTWorkflowCont9 = theme.UTWorkflowContainer) === null || _theme$UTWorkflowCont9 === void 0 ? void 0 : (_theme$UTWorkflowCont10 = _theme$UTWorkflowCont9.title) === null || _theme$UTWorkflowCont10 === void 0 ? void 0 : _theme$UTWorkflowCont10.marginBottom)
92
89
  }, tabletMobile, {
93
- marginTop: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'title', 'tabletMobile', 'marginTop']),
94
- fontSize: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'title', 'tabletMobile', 'fontSize'])
90
+ marginTop: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'title', 'tabletMobile', 'marginTop'])
95
91
  }),
96
92
  titleIcon: {
97
93
  color: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'titleIcon', 'color']),
@@ -100,23 +96,17 @@ var retrieveStyle = function retrieveStyle(_ref) {
100
96
  width: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'titleIcon', 'width']),
101
97
  marginBottom: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'title', 'marginBottom'])
102
98
  },
103
- subtitle: (_subtitle = {
99
+ subtitle: {
104
100
  color: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'subtitle', 'color']),
105
- fontSize: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'subtitle', 'fontSize']),
106
- fontWeight: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'subtitle', 'fontWeight']),
107
101
  margin: (0, _classesUtils.withImportant)((theme === null || theme === void 0 ? void 0 : (_theme$UTWorkflowCont11 = theme.UTWorkflowContainer) === null || _theme$UTWorkflowCont11 === void 0 ? void 0 : (_theme$UTWorkflowCont12 = _theme$UTWorkflowCont11.subtitle) === null || _theme$UTWorkflowCont12 === void 0 ? void 0 : _theme$UTWorkflowCont12.margin) || '0 0 10px 0'),
108
- textAlign: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'subtitle', 'textAlign'])
109
- }, _defineProperty(_subtitle, tabletMobile, {
110
- fontSize: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'subtitle', 'tabletMobile', 'fontSize'])
111
- }), _defineProperty(_subtitle, '& > a', {
112
- color: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'subtitle', '& > a', 'color'])
113
- }), _subtitle),
102
+ '& > a': {
103
+ color: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'subtitle', '& > a', 'color'])
104
+ }
105
+ },
114
106
  stepCounter: _defineProperty({
115
107
  alignItems: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'stepCounter', 'alignItems']),
116
108
  color: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'stepCounter', 'color']),
117
109
  display: 'flex',
118
- fontSize: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'stepCounter', 'fontSize']),
119
- fontWeight: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'stepCounter', 'fontWeight']),
120
110
  height: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'stepCounter', 'height'])
121
111
  }, tabletMobile, {
122
112
  height: (0, _seamlessImmutable.getIn)(theme, ['UTWorkflowContainer', 'stepCounter', 'tabletMobile', 'height'])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widergy/energy-ui",
3
- "version": "2.1.1",
3
+ "version": "2.1.3",
4
4
  "description": "Widergy Web Components",
5
5
  "author": "widergy",
6
6
  "license": "MIT",