@rh-support/react-context 0.2.53 → 0.2.56

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.
@@ -1 +1 @@
1
- {"version":3,"file":"CloseCaseModal.d.ts","sourceRoot":"","sources":["../../../../src/components/SharedModals/CloseCaseModal.tsx"],"names":[],"mappings":"AAeA,UAAU,MAAM;IACZ,SAAS,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;CACvB;AAUD,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,eAyJ3C"}
1
+ {"version":3,"file":"CloseCaseModal.d.ts","sourceRoot":"","sources":["../../../../src/components/SharedModals/CloseCaseModal.tsx"],"names":[],"mappings":"AAgBA,UAAU,MAAM;IACZ,SAAS,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;CACvB;AAUD,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,eA4J3C"}
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { Button, ButtonVariant, Form, FormGroup, Modal, ModalVariant, Select, SelectOption, TextArea, } from '@patternfly/react-core';
11
11
  import ExclamationCircleIcon from '@patternfly/react-icons/dist/js/icons/exclamation-circle-icon';
12
+ import { isEmpty } from 'lodash';
12
13
  import React, { useState } from 'react';
13
14
  import { Trans, useTranslation } from 'react-i18next';
14
15
  const resolutionsWithDescription = ['Other'];
@@ -22,7 +23,7 @@ export function CloseCaseModal(props) {
22
23
  const { t } = useTranslation();
23
24
  const [showTextArea, setShowTextArea] = useState(false);
24
25
  const [selectedResolution, setSelectedResolution] = useState('');
25
- const [resolutionDescripton, setResolutionDescription] = useState('');
26
+ const [resolutionDescription, setResolutionDescription] = useState('');
26
27
  const [showDropdown, setShowDropdown] = useState(false);
27
28
  const onDropdownToggle = (toggle) => setShowDropdown(toggle);
28
29
  const [showValidationError, setShowValidationError] = useState(false);
@@ -34,13 +35,13 @@ export function CloseCaseModal(props) {
34
35
  onDropdownToggle(false);
35
36
  };
36
37
  const getCommentBody = () => {
37
- return `**Reason for closing case:** \n${selectedResolution}${resolutionsWithDescription.includes(selectedResolution) ? `. ${resolutionDescripton}` : ''}`;
38
+ return `**Reason for closing case:** \n${selectedResolution}${resolutionsWithDescription.includes(selectedResolution) ? `. ${resolutionDescription}` : ''}`;
38
39
  };
39
40
  const checkForRequiredFields = () => {
40
41
  let isValid = false;
41
42
  if (selectedResolution) {
42
43
  isValid = resolutionsWithDescription.includes(selectedResolution)
43
- ? resolutionDescripton
44
+ ? resolutionDescription
44
45
  ? true
45
46
  : false
46
47
  : true;
@@ -57,8 +58,9 @@ export function CloseCaseModal(props) {
57
58
  setShowValidationError(false);
58
59
  setResolutionDescription(description);
59
60
  };
61
+ const isResolutionDescEmpty = showTextArea && isEmpty(resolutionDescription === null || resolutionDescription === void 0 ? void 0 : resolutionDescription.trim());
60
62
  return (React.createElement(Modal, { id: "case-close-modal", title: t(isCaseListPage ? 'Do you want to close the selected cases?' : 'Do you want to close this case?'), "aria-describedby": "case-close-modal", isOpen: true, onClose: props.onClose, showClose: true, actions: [
61
- React.createElement(Button, { key: "submit-description", variant: ButtonVariant.primary, onClick: onSubmit, isLoading: props.isUpdating, isDisabled: showValidationError || props.isUpdating, "data-tracking-id": "close-case-description-modal-submit" },
63
+ React.createElement(Button, { key: "submit-description", variant: ButtonVariant.primary, onClick: onSubmit, isLoading: props.isUpdating, isDisabled: isResolutionDescEmpty || showValidationError || props.isUpdating, "data-tracking-id": "close-case-description-modal-submit" },
62
64
  React.createElement(Trans, null, "Close case")),
63
65
  React.createElement(Button, { key: "close-modal", variant: ButtonVariant.secondary, onClick: props.onClose, isDisabled: props.isUpdating, "data-tracking-id": "close-case-description-modal-cancel" },
64
66
  React.createElement(Trans, null, "Cancel")),
@@ -80,5 +82,5 @@ export function CloseCaseModal(props) {
80
82
  React.createElement(Select, { "aria-label": t('Select an option that best fits'), id: "case-resolution", selections: selectedResolution, onSelect: onResolutionChange, isOpen: showDropdown, isDisabled: props.isUpdating, menuAppendTo: document.body, validated: showValidationError && !selectedResolution ? 'error' : 'default', placeholderText: t('Select an option that best fits'), onToggle: onDropdownToggle }, resolutionOptions.map((option, index) => (React.createElement(SelectOption, { key: index, value: option },
81
83
  React.createElement(Trans, null, option)))))),
82
84
  showTextArea && (React.createElement(FormGroup, { label: t('Please describe your resolution'), type: "text", isRequired: true, fieldId: "close-case-description" },
83
- React.createElement(TextArea, { validated: showValidationError && !resolutionDescripton ? 'error' : 'default', isRequired: true, id: "close-case-description", name: "close-case-description", "aria-describedby": "close-case-description", value: resolutionDescripton, placeholder: t('Please describe your resolution to help us better understand.'), onChange: onDescriptionChange, isDisabled: props.isUpdating }))))));
85
+ React.createElement(TextArea, { validated: showValidationError && !resolutionDescription ? 'error' : 'default', isRequired: true, id: "close-case-description", name: "close-case-description", "aria-describedby": "close-case-description", value: resolutionDescription, placeholder: t('Please describe your resolution to help us better understand.'), onChange: onDescriptionChange, isDisabled: props.isUpdating }))))));
84
86
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/react-context",
3
- "version": "0.2.53",
3
+ "version": "0.2.56",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -27,8 +27,8 @@
27
27
  ],
28
28
  "peerDependencies": {
29
29
  "@cee-eng/hydrajs": "4.7.22",
30
- "@patternfly/react-core": "4.194.0",
31
- "@patternfly/react-icons": "4.45.0",
30
+ "@patternfly/react-core": "4.202.16",
31
+ "@patternfly/react-icons": "4.53.16",
32
32
  "@rh-support/api": "0.3.9",
33
33
  "@rh-support/components": "^0.1.3",
34
34
  "@rh-support/types": "^0.1.3",
@@ -43,13 +43,13 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@cee-eng/hydrajs": "4.7.22",
46
- "@patternfly/react-core": "4.194.0",
47
- "@patternfly/react-icons": "4.45.0",
46
+ "@patternfly/react-core": "4.202.16",
47
+ "@patternfly/react-icons": "4.53.16",
48
48
  "@rh-support/api": "0.3.13",
49
- "@rh-support/components": "1.1.53",
49
+ "@rh-support/components": "1.1.56",
50
50
  "@rh-support/types": "0.2.0",
51
- "@rh-support/user-permissions": "0.2.43",
52
- "@rh-support/utils": "0.2.32",
51
+ "@rh-support/user-permissions": "0.2.44",
52
+ "@rh-support/utils": "0.2.33",
53
53
  "i18next": "^19.0.1",
54
54
  "localforage": "^1.7.3",
55
55
  "lodash": "^4.17.15",
@@ -89,5 +89,5 @@
89
89
  "not ie <= 11",
90
90
  "not op_mini all"
91
91
  ],
92
- "gitHead": "4fce3da5901527ba41788f587ab1852eff161cee"
92
+ "gitHead": "981468e419f36c15d6039eaa49b52e6a180752a3"
93
93
  }