@availity/feedback 6.2.5 → 6.2.9

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
@@ -3,6 +3,49 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 6.2.9 (2021-12-09)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **feedback:** added submit on enter func and tests ([d642923](https://github.com/Availity/availity-react/commit/d642923eb0ca80ee5faff17e0f830c3e1e2181c7))
12
+
13
+
14
+
15
+
16
+
17
+ ## [6.2.8](https://github.com/Availity/availity-react/compare/@availity/feedback@6.2.7...@availity/feedback@6.2.8) (2021-12-03)
18
+
19
+ **Note:** Version bump only for package @availity/feedback
20
+
21
+
22
+
23
+
24
+
25
+ ## 6.2.7 (2021-12-03)
26
+
27
+
28
+ ### Bug Fixes
29
+
30
+ * **feedback:** modal no longer closes when tabbed ([7ce4f53](https://github.com/Availity/availity-react/commit/7ce4f53f7e86ba2aeee79db606338bca251c89ff))
31
+
32
+
33
+
34
+
35
+
36
+ ## [6.2.6](https://github.com/Availity/availity-react/compare/@availity/feedback@6.2.5...@availity/feedback@6.2.6) (2021-12-02)
37
+
38
+
39
+ ### Bug Fixes
40
+
41
+ * **feedback:** added destructering for event ([a8110d7](https://github.com/Availity/availity-react/commit/a8110d7c2d118d4e14fb142f6002790b635593c9))
42
+ * **feedback:** fix typo ([9adfd42](https://github.com/Availity/availity-react/commit/9adfd42264eb64d57c976b6118e794a9be36a605))
43
+ * **feedback:** fixed shift tab closing dropdown issue ([06aad38](https://github.com/Availity/availity-react/commit/06aad384f87e8e3a75fc469f30a0795cfee242ce))
44
+
45
+
46
+
47
+
48
+
6
49
  ## [6.2.5](https://github.com/Availity/availity-react/compare/@availity/feedback@6.2.4...@availity/feedback@6.2.5) (2021-12-01)
7
50
 
8
51
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@availity/feedback",
3
- "version": "6.2.5",
3
+ "version": "6.2.9",
4
4
  "author": "Evan Sharp <evan.sharp@availity.com>",
5
5
  "description": "Availity feedback with smiley faces react component.",
6
6
  "main": "index.js",
@@ -25,7 +25,7 @@
25
25
  "@availity/hooks": "^3.1.0",
26
26
  "@availity/icon": "^0.10.0",
27
27
  "@availity/native-form": "^4.0.5",
28
- "@availity/select": "^2.2.1",
28
+ "@availity/select": "^2.3.0",
29
29
  "prop-types": "^15.7.2"
30
30
  },
31
31
  "devDependencies": {
@@ -47,5 +47,5 @@
47
47
  "reactstrap": "^8.0.0 || ^7.0.0 || ^6.0.0",
48
48
  "yup": "^0.27.0"
49
49
  },
50
- "gitHead": "7b5ca991164f070868efc05e4cef007b16e0c7ca"
50
+ "gitHead": "0d093c128cce5680f568ab9d88e684edd6675355"
51
51
  }
@@ -42,6 +42,7 @@ const FeedbackDropdown = ({
42
42
  onClose={toggle}
43
43
  showSupport={showSupport}
44
44
  setSupportIsActive={setSupportIsActive}
45
+ modal={modal}
45
46
  {...formProps}
46
47
  />
47
48
  );
@@ -1,4 +1,4 @@
1
- import React, { useState, useEffect } from 'react';
1
+ import React, { useState, useEffect, useRef } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { Button, ModalBody, ModalHeader, ModalFooter, FormGroup } from 'reactstrap';
4
4
  import { avLogMessagesApi, avRegionsApi } from '@availity/api-axios';
@@ -40,11 +40,12 @@ const FeedbackForm = ({
40
40
  showSupport,
41
41
  setSupportIsActive,
42
42
  autoFocusFeedbackButton,
43
+ modal,
43
44
  ...formProps
44
45
  }) => {
45
46
  const [active, setActive] = useState(null);
46
47
  const [sent, setSent] = useState(null);
47
-
48
+ const ref = useRef();
48
49
  const sendFeedback = async ({ smileField, ...values }) => {
49
50
  const response = await avRegionsApi.getCurrentRegion();
50
51
 
@@ -110,10 +111,11 @@ const FeedbackForm = ({
110
111
  {prompt || `Tell us what you think about ${name}`}
111
112
  </ModalHeader>
112
113
  <Form
114
+ innerRef={ref}
113
115
  aria-label="Feedback Form"
114
116
  aria-describedby="feedback-form-header"
115
117
  role="form"
116
- onKeyDown={({ keyCode }) => keyCode === 27 && onClose()}
118
+ onKeyDown={({ key }) => key === 'Escape' && onClose()}
117
119
  data-testid="feedback-form"
118
120
  initialValues={{
119
121
  'face-options': undefined,
@@ -153,6 +155,7 @@ const FeedbackForm = ({
153
155
  onChange={(option) => setActive(option)}
154
156
  onClose={onClose}
155
157
  autoFocusFeedbackButton={autoFocusFeedbackButton}
158
+ modal={modal}
156
159
  />
157
160
  </FormGroup>
158
161
 
@@ -199,7 +202,7 @@ const FeedbackForm = ({
199
202
  onClick={() => setSupportIsActive(true)}
200
203
  color="link"
201
204
  type="button"
202
- onKeyDown={({ keyCode }) => keyCode === 13 && setSupportIsActive(true)}
205
+ onKeyDown={({ key }) => key === 'Enter' && setSupportIsActive(true)}
203
206
  >
204
207
  Open a support ticket
205
208
  </Button>
@@ -208,13 +211,14 @@ const FeedbackForm = ({
208
211
 
209
212
  {onClose ? (
210
213
  <Button
214
+ type="button"
211
215
  onClick={onClose}
212
216
  color="secondary"
213
- onKeyDown={({ keyCode }) => {
214
- if (keyCode === 13) {
217
+ onKeyDown={({ key, shiftKey }) => {
218
+ if (key === 'Enter') {
215
219
  onClose();
216
220
  }
217
- if (keyCode === 9 && !active) {
221
+ if (key === 'Tab' && !active && !shiftKey && !modal) {
218
222
  onClose();
219
223
  }
220
224
  }}
@@ -224,8 +228,11 @@ const FeedbackForm = ({
224
228
  ) : null}
225
229
 
226
230
  <Button
227
- onKeyDown={({ keyCode }) => {
228
- if (keyCode === 9) {
231
+ onKeyDown={({ key, shiftKey }) => {
232
+ if (key === 'Enter') {
233
+ ref.current.submitForm();
234
+ }
235
+ if (key === 'Tab' && !shiftKey && !modal) {
229
236
  onClose();
230
237
  }
231
238
  }}
@@ -269,6 +276,7 @@ FeedbackForm.propTypes = {
269
276
  showSupport: PropTypes.bool,
270
277
  setSupportIsActive: PropTypes.func,
271
278
  autoFocusFeedbackButton: PropTypes.bool,
279
+ modal: PropTypes.bool,
272
280
  };
273
281
 
274
282
  FeedbackForm.defaultProps = {
@@ -277,6 +285,7 @@ FeedbackForm.defaultProps = {
277
285
  additionalComments: false,
278
286
  analytics: avLogMessagesApi,
279
287
  showSupport: false,
288
+ modal: true,
280
289
  };
281
290
 
282
291
  export default FeedbackForm;
package/src/SmileField.js CHANGED
@@ -5,7 +5,7 @@ import FeedbackButton from './FeedbackButton';
5
5
 
6
6
  const btnStyles = { flex: 1, margin: '0 2% 0 2%' };
7
7
 
8
- const SmileField = ({ name, options, onChange, autoFocusFeedbackButton, onClose }) => {
8
+ const SmileField = ({ name, options, onChange, autoFocusFeedbackButton, onClose, modal }) => {
9
9
  const [{ value }] = useField(name);
10
10
  const { setFieldValue } = useFormikContext();
11
11
 
@@ -13,7 +13,7 @@ const SmileField = ({ name, options, onChange, autoFocusFeedbackButton, onClose
13
13
  <FeedbackButton
14
14
  autoFocus={i === 0 && autoFocusFeedbackButton}
15
15
  onKeyDown={(e) => {
16
- if (e.shiftKey && e.keyCode === 9 && i === 0) {
16
+ if (e.shiftKey && e.keyCode === 9 && i === 0 && !modal) {
17
17
  onClose();
18
18
  }
19
19
  if (e.keyCode === 13) {
@@ -52,6 +52,7 @@ SmileField.propTypes = {
52
52
  ),
53
53
  onChange: PropTypes.func,
54
54
  autoFocusFeedbackButton: PropTypes.bool,
55
+ modal: PropTypes.bool
55
56
  };
56
57
 
57
58
  SmileField.defaultProps = {