@widergy/energy-ui 3.48.0 → 3.49.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,17 @@
1
+ # [3.49.0](https://github.com/widergy/energy-ui/compare/v3.48.1...v3.49.0) (2024-12-12)
2
+
3
+
4
+ ### Features
5
+
6
+ * [UG-2247] forms container in workflows ([#539](https://github.com/widergy/energy-ui/issues/539)) ([7cfb289](https://github.com/widergy/energy-ui/commit/7cfb2895239959f0a154d8fd07d0648d731e10d4))
7
+
8
+ ## [3.48.1](https://github.com/widergy/energy-ui/compare/v3.48.0...v3.48.1) (2024-12-12)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * fixes ([#543](https://github.com/widergy/energy-ui/issues/543)) ([3cc67b9](https://github.com/widergy/energy-ui/commit/3cc67b926b20bb9faeccf1aa29ee584aa6fb1382))
14
+
1
15
  # [3.48.0](https://github.com/widergy/energy-ui/compare/v3.47.0...v3.48.0) (2024-12-11)
2
16
 
3
17
 
@@ -24,16 +24,18 @@ const UTVirtualKeyboard = _ref => {
24
24
  const [fieldValue, setFieldValue] = (0, _react.useState)(currentFieldValue);
25
25
  const [layoutName, setLayoutName] = (0, _react.useState)(_constants.DEFAULT);
26
26
  const [shiftPressTimeStamp, setShiftPressTimeStamp] = (0, _react.useState)(null);
27
+ const [lastPressedKey, setLastPressedKey] = (0, _react.useState)(null);
27
28
  const resetState = () => {
28
29
  setFieldValue(currentFieldValue);
29
30
  setShiftPressTimeStamp(null);
30
31
  };
31
32
  (0, _react.useEffect)(() => {
32
- handleChangeValue(fieldValue);
33
+ if (!fieldValue && lastPressedKey === '{bksp}' || fieldValue) handleChangeValue(fieldValue);
33
34
  }, [fieldValue]);
34
35
  (0, _react.useEffect)(resetState, [handleChangeValue]);
35
36
  (0, _react.useEffect)(() => setLayoutName(_constants.DEFAULT), [show]);
36
37
  const handleKeyPress = pressedKey => {
38
+ setLastPressedKey(pressedKey);
37
39
  if (Object.values(_constants.SPECIAL_KEYS).includes(pressedKey)) {
38
40
  (0, _utils.localKeysHandle)({
39
41
  fieldValue,
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.childrenContentStyle = exports.VARIANTS = void 0;
6
+ exports.childrenContentStyle = exports.VARIANTS = exports.FORMS_QUERY_SELECTOR = exports.CHILDREN_CONTAINER_ID = void 0;
7
7
  var _stylesModule = _interopRequireDefault(require("./styles.module.scss"));
8
8
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
9
  const DEFAULT = 'default';
@@ -15,4 +15,6 @@ const VARIANTS = exports.VARIANTS = {
15
15
  const childrenContentStyle = exports.childrenContentStyle = {
16
16
  [VARIANTS.DEFAULT]: _stylesModule.default.childrenContent,
17
17
  [VARIANTS.FULL_WIDTH]: _stylesModule.default.childrenContentFullWidth
18
- };
18
+ };
19
+ const CHILDREN_CONTAINER_ID = exports.CHILDREN_CONTAINER_ID = 'workflow-children-container-';
20
+ const FORMS_QUERY_SELECTOR = exports.FORMS_QUERY_SELECTOR = "#".concat(CHILDREN_CONTAINER_ID).concat(VARIANTS.DEFAULT, " form");
@@ -6,6 +6,7 @@ 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 _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
9
10
  var _UTProgressBar = _interopRequireDefault(require("../../../UTProgressBar"));
10
11
  var _WithTheme = _interopRequireDefault(require("../../../WithTheme"));
11
12
  var _classesUtils = require("../../../../utils/classesUtils");
@@ -60,6 +61,29 @@ const UTWorkflowContainer = _ref => {
60
61
  const isNextButtonHidden = nextButton === null || nextButton === void 0 ? void 0 : nextButton.isHidden;
61
62
  const isLastStep = stepsCount && stepsCount === currentStep;
62
63
  const isNavHidden = !!isLastStep && isBackButtonHidden && isNextButtonHidden;
64
+ (0, _react.useEffect)(() => {
65
+ const applyStylesToForms = () => {
66
+ const formComponents = document.querySelectorAll(_constants.FORMS_QUERY_SELECTOR);
67
+ if (!(0, _isEmpty.default)(formComponents)) formComponents.forEach(form => {
68
+ const childrenIsNotEmpty = !(0, _isEmpty.default)(form === null || form === void 0 ? void 0 : form.children);
69
+ const hasInputs = !(0, _isEmpty.default)(form.querySelectorAll('input'));
70
+ if (childrenIsNotEmpty && hasInputs) {
71
+ var _form$classList;
72
+ form === null || form === void 0 || (_form$classList = form.classList) === null || _form$classList === void 0 || _form$classList.add(_stylesModule.default.formContainer);
73
+ }
74
+ });
75
+ };
76
+ const observer = new MutationObserver(() => applyStylesToForms());
77
+ observer.observe(document.body, {
78
+ childList: true,
79
+ subtree: true
80
+ });
81
+ applyStylesToForms();
82
+ return () => {
83
+ applyStylesToForms();
84
+ observer.disconnect();
85
+ };
86
+ }, [currentStep, currentStage]);
63
87
  return /*#__PURE__*/_react.default.createElement("div", {
64
88
  className: "".concat(_stylesModule.default.container, " ").concat(classes.container)
65
89
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -83,7 +107,8 @@ const UTWorkflowContainer = _ref => {
83
107
  tagline: title && tagline,
84
108
  title
85
109
  }), /*#__PURE__*/_react.default.createElement("div", {
86
- className: "".concat(_stylesModule.default.childrenContainer, " ").concat(classes.childrenContainer, " ").concat(variant === _constants.VARIANTS.FULL_WIDTH && "".concat(_stylesModule.default.childrenContainerFullWidth, " ").concat(classes.childrenContainerFullWidth))
110
+ className: "".concat(_stylesModule.default.childrenContainer, " ").concat(classes.childrenContainer, " ").concat(variant === _constants.VARIANTS.FULL_WIDTH && "".concat(_stylesModule.default.childrenContainerFullWidth, " ").concat(classes.childrenContainerFullWidth)),
111
+ id: _constants.CHILDREN_CONTAINER_ID + variant
87
112
  }, /*#__PURE__*/_react.default.createElement("div", {
88
113
  className: "".concat(_constants.childrenContentStyle[variant] || _stylesModule.default.childrenContent, " ").concat(classes.childrenContent)
89
114
  }, children))), /*#__PURE__*/_react.default.createElement("div", {
@@ -1,4 +1,5 @@
1
1
  @use '../../../../scss/variables/mediaQueries.module.scss' as *;
2
+ @use '../../../../scss/variables/colors.module.scss' as *;
2
3
 
3
4
  $default-variant-max-width: 966px;
4
5
 
@@ -91,3 +92,10 @@ $default-variant-max-width: 966px;
91
92
  position: relative;
92
93
  width: 100%;
93
94
  }
95
+
96
+ .formContainer {
97
+ background-color: var(--light03, $default-background-form);
98
+ border-radius: 8px;
99
+ box-sizing: border-box;
100
+ padding: 32px 54px;
101
+ }
@@ -56,6 +56,7 @@ $usage-indicator-gray: #C3C3C3;
56
56
 
57
57
  $error-red: #F44336;
58
58
  $card-background: #FAFAFA;
59
+ $default-background-form: #F4F5F7;
59
60
 
60
61
  // sass-lint:disable no-misspelled-properties
61
62
  // sass-lint:disable property-sort-order
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widergy/energy-ui",
3
- "version": "3.48.0",
3
+ "version": "3.49.0",
4
4
  "description": "Widergy Web Components",
5
5
  "author": "widergy",
6
6
  "license": "MIT",