@availity/feedback 6.0.1 → 6.0.5

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,41 @@
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.0.5 (2021-09-23)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **feedback:** fixed focus issue for feedback in dropdowns ([378dec1](https://github.com/Availity/availity-react/commit/378dec16ee7a83cb6f078384a6bee642b32b6a21))
12
+
13
+
14
+
15
+
16
+
17
+ ## [6.0.4](https://github.com/Availity/availity-react/compare/@availity/feedback@6.0.3...@availity/feedback@6.0.4) (2021-09-17)
18
+
19
+ **Note:** Version bump only for package @availity/feedback
20
+
21
+
22
+
23
+
24
+
25
+ ## [6.0.3](https://github.com/Availity/availity-react/compare/@availity/feedback@6.0.2...@availity/feedback@6.0.3) (2021-09-13)
26
+
27
+ **Note:** Version bump only for package @availity/feedback
28
+
29
+
30
+
31
+
32
+
33
+ ## [6.0.2](https://github.com/Availity/availity-react/compare/@availity/feedback@6.0.1...@availity/feedback@6.0.2) (2021-09-13)
34
+
35
+ **Note:** Version bump only for package @availity/feedback
36
+
37
+
38
+
39
+
40
+
6
41
  ## [6.0.1](https://github.com/Availity/availity-react/compare/@availity/feedback@6.0.0...@availity/feedback@6.0.1) (2021-09-09)
7
42
 
8
43
  **Note:** Version bump only for package @availity/feedback
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@availity/feedback",
3
- "version": "6.0.1",
3
+ "version": "6.0.5",
4
4
  "author": "Evan Sharp <evan.sharp@availity.com>",
5
5
  "description": "Availity feedback with smiley faces react component.",
6
6
  "main": "index.js",
@@ -20,11 +20,11 @@
20
20
  "access": "public"
21
21
  },
22
22
  "dependencies": {
23
- "@availity/form": "^0.5.34",
23
+ "@availity/form": "^0.7.0",
24
24
  "@availity/hooks": "^3.0.2",
25
25
  "@availity/icon": "^0.8.0",
26
26
  "@availity/native-form": "^3.0.0",
27
- "@availity/select": "^0.17.11",
27
+ "@availity/select": "^0.18.1",
28
28
  "prop-types": "^15.7.2"
29
29
  },
30
30
  "devDependencies": {
@@ -50,5 +50,5 @@
50
50
  "reactstrap": "^8.0.0 || ^7.0.0 || ^6.0.0",
51
51
  "yup": "^0.27.0"
52
52
  },
53
- "gitHead": "c03afe75d0a7580650b3789a39969bb2f3b4e22c"
53
+ "gitHead": "f478e30875ffcbccc0e7495e17cfe91f7d81dff9"
54
54
  }
@@ -44,6 +44,7 @@ const FeedbackForm = ({
44
44
  modalHeaderProps,
45
45
  showSupport,
46
46
  setSupportIsActive,
47
+ autoFocusFeedbackButton,
47
48
  ...formProps
48
49
  }) => {
49
50
  const [active, setActive] = useState(null);
@@ -160,6 +161,7 @@ const FeedbackForm = ({
160
161
  options={faceOptions}
161
162
  name="smileField"
162
163
  onChange={(option) => setActive(option)}
164
+ autoFocusFeedbackButton={autoFocusFeedbackButton}
163
165
  />
164
166
  </FormGroup>
165
167
  {active ? (
@@ -261,6 +263,7 @@ FeedbackForm.propTypes = {
261
263
  }),
262
264
  showSupport: PropTypes.bool,
263
265
  setSupportIsActive: PropTypes.func,
266
+ autoFocusFeedbackButton: PropTypes.bool,
264
267
  };
265
268
 
266
269
  FeedbackForm.defaultProps = {
package/src/SmileField.js CHANGED
@@ -5,13 +5,13 @@ 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 }) => {
8
+ const SmileField = ({ name, options, onChange, autoFocusFeedbackButton }) => {
9
9
  const [{ value }] = useField(name);
10
10
  const { setFieldValue } = useFormikContext();
11
11
 
12
12
  return options.map((option, i) => (
13
13
  <FeedbackButton
14
- autoFocus={i === 0}
14
+ autoFocus={i === 0 && autoFocusFeedbackButton}
15
15
  style={btnStyles}
16
16
  key={option.icon}
17
17
  icon={option.icon}
@@ -40,6 +40,7 @@ SmileField.propTypes = {
40
40
  })
41
41
  ),
42
42
  onChange: PropTypes.func,
43
+ autoFocusFeedbackButton: PropTypes.bool,
43
44
  };
44
45
 
45
46
  SmileField.defaultProps = {
@@ -60,6 +61,7 @@ SmileField.defaultProps = {
60
61
  label: "What don't you like?",
61
62
  },
62
63
  ],
64
+ autoFocusFeedbackButton: true,
63
65
  };
64
66
 
65
67
  export default SmileField;
@@ -247,4 +247,24 @@ describe('FeedbackForm', () => {
247
247
  'feedback-form-header'
248
248
  );
249
249
  });
250
+
251
+ test('should focus first SmileField button by default', async () => {
252
+ const { getByText } = render(<FeedbackForm name="Payer Space" />);
253
+
254
+ const firstFeedbackButton = getByText('Smiley face').closest('button');
255
+ await waitFor(() => {
256
+ expect(firstFeedbackButton).toHaveFocus();
257
+ });
258
+ });
259
+
260
+ test('should not focus first SmileField button if autofocus is set to false', async () => {
261
+ const { getByText } = render(
262
+ <FeedbackForm name="Payer Space" autoFocusFeedbackButton={false} />
263
+ );
264
+
265
+ const firstFeedbackButton = getByText('Smiley face').closest('button');
266
+ await waitFor(() => {
267
+ expect(firstFeedbackButton).not.toHaveFocus();
268
+ });
269
+ });
250
270
  });