@widergy/energy-ui 3.4.2 → 3.4.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,10 @@
1
+ ## [3.4.3](https://github.com/widergy/energy-ui/compare/v3.4.2...v3.4.3) (2024-02-28)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * utworkflowcontainer fixes ([#426](https://github.com/widergy/energy-ui/issues/426)) ([d2c5e3f](https://github.com/widergy/energy-ui/commit/d2c5e3f589dc85187b2c1d783b631a2dc8687d86))
7
+
1
8
  ## [3.4.2](https://github.com/widergy/energy-ui/compare/v3.4.1...v3.4.2) (2024-02-27)
2
9
 
3
10
 
@@ -32,7 +32,7 @@ const UTBanner = _ref => {
32
32
  UTBanner.propTypes = {
33
33
  classes: (0, _propTypes.objectOf)(_propTypes.string),
34
34
  classNames: (0, _propTypes.objectOf)(_propTypes.string),
35
- Icon: _propTypes.element,
35
+ Icon: _propTypes.object,
36
36
  iconProps: _propTypes.object
37
37
  };
38
38
  var _default = exports.default = (0, _WithTheme.default)(_theme.retrieveStyle)(UTBanner);
@@ -61,12 +61,13 @@ const UTHeader = _ref => {
61
61
  const mainAction = actions.find(action => action.main);
62
62
  const moreActions = actions.filter((_action, index) => index !== actions.indexOf(mainAction));
63
63
  const MainIcon = (mainAction === null || mainAction === void 0 ? void 0 : mainAction.Icon) || Edit;
64
+ const hasHeader = tagline || title || subtitle || requiredFieldInfo || helpText || banner;
64
65
  const [menuAnchor, setMenuAnchor] = (0, _react.useState)();
65
66
  const openMenu = event => setMenuAnchor(event.target);
66
67
  const closeMenu = () => setMenuAnchor();
67
68
  const BANNER_ICON_SIZE = '20px';
68
69
  return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
69
- className: _stylesModule.default.container
70
+ className: "".concat(_stylesModule.default.container, " ").concat(!hasHeader && _stylesModule.default.containerMargin)
70
71
  }, /*#__PURE__*/_react.default.createElement("div", {
71
72
  className: "".concat(_stylesModule.default.header, " ").concat((banner === null || banner === void 0 ? void 0 : banner.text) && _stylesModule.default.bottomPadding)
72
73
  }, tagline && /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
@@ -134,7 +135,7 @@ const UTHeader = _ref => {
134
135
  UTHeader.propTypes = {
135
136
  actions: (0, _propTypes.arrayOf)(_propTypes.object),
136
137
  banner: (0, _propTypes.shape)({
137
- Icon: _propTypes.element,
138
+ Icon: _propTypes.object,
138
139
  text: _propTypes.string
139
140
  }),
140
141
  classes: (0, _propTypes.objectOf)(_propTypes.string),
@@ -10,6 +10,10 @@
10
10
  justify-content: space-between;
11
11
  }
12
12
 
13
+ .containerMargin {
14
+ margin-bottom: 32px;
15
+ }
16
+
13
17
  .header {
14
18
  display: flex;
15
19
  flex-direction: column;
@@ -19,8 +19,10 @@ const Connectors = _ref => {
19
19
  const connectorMaxWidth = "".concat(100 / (numberOfSteps - 1), "%");
20
20
  const containerMaxWidth = "".concat(100 - 100 / numberOfSteps, "%");
21
21
  const connectors = new Array(numberOfSteps - 1).fill(null).map((key, index) => /*#__PURE__*/_react.default.createElement("div", {
22
- className: "\n ".concat(_stylesModule.default.connector, " ").concat(classes.connector, " ").concat(isCompleted(index + 1) && classes.coloredProgress, "\n "),
23
- key: key,
22
+ className: "\n ".concat(_stylesModule.default.connector, " ").concat(classes.connector, " ").concat(isCompleted(index + 1) && classes.coloredProgress, "\n ")
23
+ // eslint-disable-next-line react/no-array-index-key
24
+ ,
25
+ key: "connector_".concat(index),
24
26
  style: {
25
27
  maxWidth: withPadding ? connectorMaxWidth : null,
26
28
  height: 2
@@ -9,6 +9,7 @@ var _react = _interopRequireDefault(require("react"));
9
9
  var _UTLabel = _interopRequireDefault(require("../../../UTLabel"));
10
10
  var _commonTypes = require("../../../../types/commonTypes");
11
11
  var _constants = require("../../constants");
12
+ var _useScreenSize = require("../../../../utils/useScreenSize");
12
13
  var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
13
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
15
  var CompletedIcon = function CompletedIcon(props) {
@@ -35,13 +36,16 @@ const Step = _ref => {
35
36
  const stageCompleted = isCompleted(stage === null || stage === void 0 ? void 0 : stage.id);
36
37
  const stageActive = isActive(stage === null || stage === void 0 ? void 0 : stage.id);
37
38
  const CustomIcon = stage.Icon;
39
+ const {
40
+ isMobileOrTablet
41
+ } = (0, _useScreenSize.useScreenSize)();
38
42
  return /*#__PURE__*/_react.default.createElement("div", {
39
43
  className: "\n ".concat(_stylesModule.default["stepContainer".concat(size)], " ").concat(classes["stepContainer".concat(size)], "\n ").concat(stageActive ? classes["active".concat(size)] : '', " \n ").concat(stageCompleted ? classes.completed : '', "\n ")
40
44
  }, stageCompleted && /*#__PURE__*/_react.default.createElement(CompletedIcon, {
41
45
  className: _stylesModule.default["checkIcon".concat(size)]
42
46
  }), !stageCompleted && size === _constants.SIZES.LARGE && /*#__PURE__*/_react.default.createElement(CustomIcon, {
43
47
  className: "\n ".concat(stageActive ? classes.activeIcon : classes.nextIcxon, " \n ").concat(_stylesModule.default["customIcon".concat(size)], "\n ")
44
- }), /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
48
+ }), (stageActive || !isMobileOrTablet) && /*#__PURE__*/_react.default.createElement(_UTLabel.default, {
45
49
  variant: "xsmall",
46
50
  className: "\n ".concat(_stylesModule.default.label, "\n ").concat(stageActive || stageCompleted ? classes.coloredLabel : '', "\n "),
47
51
  colorTheme: !stageActive && !stageCompleted ? 'gray' : null
@@ -36,6 +36,7 @@ const UTStepper = _ref => {
36
36
  }, /*#__PURE__*/_react.default.createElement("div", {
37
37
  className: withPadding ? _stylesModule.default.paddingContainer : _stylesModule.default.container
38
38
  }, orderedStages.map(stage => /*#__PURE__*/_react.default.createElement(_Step.default, {
39
+ key: stage.id,
39
40
  classes,
40
41
  withPadding,
41
42
  size,
@@ -53,11 +54,7 @@ UTStepper.propTypes = {
53
54
  classes: (0, _propTypes.objectOf)(_propTypes.string),
54
55
  classNames: (0, _propTypes.objectOf)(_propTypes.string),
55
56
  currentStage: _propTypes.number,
56
- stages: (0, _propTypes.arrayOf)((0, _propTypes.shape)({
57
- id: _propTypes.number,
58
- label: _propTypes.string,
59
- Icon: _propTypes.elementType
60
- })),
57
+ stages: _propTypes.object,
61
58
  stepperSize: (0, _propTypes.oneOf)([_constants.SIZES.LARGE, _constants.SIZES.SMALL]),
62
59
  withPadding: _propTypes.bool
63
60
  };
@@ -28,11 +28,10 @@ const NavActions = _ref => {
28
28
  isMobileOrTablet
29
29
  } = (0, _useScreenSize.useScreenSize)();
30
30
  const isBackButtonHidden = currentStep === 1 && !backButton.isVisible || backButton.isHidden;
31
- const hideActions = isBackButtonHidden && nextButton.isHidden;
32
31
  return /*#__PURE__*/_react.default.createElement("div", {
33
- className: "\n ".concat(_stylesModule.default.actionsContainer, "\n ").concat(hideActions ? _stylesModule.default.hidden : '')
34
- }, /*#__PURE__*/_react.default.createElement("div", {
35
- className: _stylesModule.default.actionsGroup
32
+ className: _stylesModule.default.actionsContainer
33
+ }, (!isMobileOrTablet || !isBackButtonHidden) && /*#__PURE__*/_react.default.createElement("div", {
34
+ className: "".concat(_stylesModule.default.actionsGroup, " ").concat(!isBackButtonHidden && _stylesModule.default.actionsGroupResponsive)
36
35
  }, !isBackButtonHidden && /*#__PURE__*/_react.default.createElement(_UTButton.default, {
37
36
  classNames: {
38
37
  root: _stylesModule.default.navAction
@@ -57,7 +56,7 @@ const NavActions = _ref => {
57
56
  }, secondaryAction.label), checkbox && !isMobileOrTablet && /*#__PURE__*/_react.default.createElement("div", {
58
57
  className: _stylesModule.default.checkboxContainer
59
58
  }, /*#__PURE__*/_react.default.createElement(_UTCheckbox.default, checkbox))), /*#__PURE__*/_react.default.createElement("div", {
60
- className: _stylesModule.default.actionsGroup
59
+ className: "".concat(_stylesModule.default.actionsGroup, " ").concat(isMobileOrTablet && _stylesModule.default.actionsGroupResponsive)
61
60
  }, primaryAction && !isMobileOrTablet && /*#__PURE__*/_react.default.createElement(_UTButton.default, {
62
61
  classNames: {
63
62
  root: _stylesModule.default.navAction
@@ -1,17 +1,14 @@
1
1
  @import '../../../../../../scss/variables/mediaQueries.module.scss';
2
2
 
3
- .hidden {
4
- display: none;
5
- }
6
-
7
3
  .actionsContainer {
8
4
  align-items: center;
9
5
  display: flex;
10
6
  gap: 16px;
11
7
  justify-content: space-between;
8
+ min-height: 48px;
12
9
  padding: 16px 32px;
13
10
 
14
- @media #{$mobile} {
11
+ @media #{$tablet-mobile} {
15
12
  padding: 16px;
16
13
  }
17
14
  }
@@ -22,13 +19,17 @@
22
19
  grid-gap: 8px;
23
20
  }
24
21
 
22
+ .actionsGroupResponsive {
23
+ flex-grow: 1;
24
+ }
25
+
25
26
  .checkboxContainer {
26
27
  width: 100%;
27
28
  }
28
29
 
29
30
  .navAction {
30
31
  flex-shrink: 0;
31
- @media #{$mobile} {
32
+ @media #{$tablet-mobile} {
32
33
  width: 100%;
33
34
  }
34
- }
35
+ }
@@ -61,13 +61,13 @@ const UTWorkflowContainer = _ref => {
61
61
  currentStage,
62
62
  stages,
63
63
  withPadding: withStepperPadding
64
- }), title && /*#__PURE__*/_react.default.createElement(_UTHeader.default, {
65
- actions: [...(headerActions || []), ...(isMobileOrTablet ? [primaryAction, secondaryAction] : [])],
66
- banner,
67
- helpText,
68
- requiredFieldInfo,
69
- subtitle,
70
- tagline,
64
+ }), (title || isMobileOrTablet && (primaryAction || secondaryAction)) && /*#__PURE__*/_react.default.createElement(_UTHeader.default, {
65
+ actions: [...(headerActions || []), ...(isMobileOrTablet ? [primaryAction, secondaryAction].filter(action => action) : [])],
66
+ banner: title && banner,
67
+ helpText: title && helpText,
68
+ requiredFieldInfo: title && requiredFieldInfo,
69
+ subititle: title && subtitle,
70
+ tagline: title && tagline,
71
71
  title,
72
72
  TitleIcon
73
73
  }), children), /*#__PURE__*/_react.default.createElement("div", {
@@ -96,7 +96,7 @@ const UTWorkflowContainer = _ref => {
96
96
  UTWorkflowContainer.propTypes = {
97
97
  backButton: _types.buttonTypes,
98
98
  banner: (0, _propTypes.shape)({
99
- Icon: _propTypes.element,
99
+ Icon: _propTypes.object,
100
100
  text: _propTypes.string
101
101
  }),
102
102
  checkbox: (0, _propTypes.shape)({
@@ -115,11 +115,7 @@ UTWorkflowContainer.propTypes = {
115
115
  primaryAction: _types.buttonTypes,
116
116
  requiredFieldInfo: _propTypes.string,
117
117
  secondaryAction: _types.buttonTypes,
118
- stages: (0, _propTypes.arrayOf)((0, _propTypes.shape)({
119
- id: _propTypes.number,
120
- label: _propTypes.string,
121
- Icon: _propTypes.elementType
122
- })),
118
+ stages: _propTypes.object,
123
119
  stepperSize: _propTypes.string,
124
120
  stepsCount: _propTypes.number,
125
121
  subtitle: _propTypes.string,
@@ -2,11 +2,13 @@
2
2
  @import '../../../../scss/variables/mediaQueries.module.scss';
3
3
 
4
4
  .container {
5
- border-radius: '4px';
5
+ align-items: center;
6
+ border-radius: 4px;
6
7
  box-sizing: border-box;
7
8
  display: flex;
8
9
  flex-direction: column;
9
- align-items: center;
10
+ height: 100%;
11
+ justify-content: space-between;
10
12
  width: 100%;
11
13
  }
12
14
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widergy/energy-ui",
3
- "version": "3.4.2",
3
+ "version": "3.4.3",
4
4
  "description": "Widergy Web Components",
5
5
  "author": "widergy",
6
6
  "license": "MIT",