@availity/feedback 6.0.4 → 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 +11 -0
- package/package.json +2 -2
- package/src/FeedbackForm.js +3 -0
- package/src/SmileField.js +4 -2
- package/tests/FeedbackForm.test.js +20 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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
|
+
|
|
6
17
|
## [6.0.4](https://github.com/Availity/availity-react/compare/@availity/feedback@6.0.3...@availity/feedback@6.0.4) (2021-09-17)
|
|
7
18
|
|
|
8
19
|
**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.
|
|
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",
|
|
@@ -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": "
|
|
53
|
+
"gitHead": "f478e30875ffcbccc0e7495e17cfe91f7d81dff9"
|
|
54
54
|
}
|
package/src/FeedbackForm.js
CHANGED
|
@@ -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
|
});
|