@availity/feedback 6.2.14-alpha.3 → 6.2.17
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 +1687 -1655
- package/LICENSE +20 -20
- package/README.md +25 -25
- package/index.d.ts +3 -3
- package/package.json +3 -3
- package/src/Feedback.d.ts +25 -25
- package/src/Feedback.js +102 -102
- package/src/FeedbackButton.d.ts +9 -9
- package/src/FeedbackDropdown.d.ts +14 -14
- package/src/FeedbackForm.d.ts +31 -31
- package/src/FeedbackModal.d.ts +9 -9
- package/src/SmileField.js +79 -79
- package/src/SupportForm.js +149 -149
package/LICENSE
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
Copyright (c) 2017-present Availity, LLC
|
|
2
|
-
|
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
-
a copy of this software and associated documentation files (the
|
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
-
the following conditions:
|
|
10
|
-
|
|
11
|
-
The above copyright notice and this permission notice shall be
|
|
12
|
-
included in all copies or substantial portions of the Software.
|
|
13
|
-
|
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1
|
+
Copyright (c) 2017-present Availity, LLC
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
# @availity/feedback
|
|
2
|
-
|
|
3
|
-
> Availity feedback with smiley faces react component.
|
|
4
|
-
|
|
5
|
-
[](https://www.npmjs.com/package/@availity/feedback)
|
|
6
|
-
[](https://www.npmjs.com/package/@availity/feedback)
|
|
7
|
-
[](https://github.com/Availity/availity-react/blob/master/packages/feedback/package.json)
|
|
8
|
-
|
|
9
|
-
## Installation
|
|
10
|
-
|
|
11
|
-
### NPM
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
npm install @availity/feedback
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
### Yarn
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
yarn add @availity/feedback
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Documentation
|
|
24
|
-
|
|
25
|
-
Check out more documentation at [availity.github.io](https://availity.github.io/availity-react/components/feedback/index)
|
|
1
|
+
# @availity/feedback
|
|
2
|
+
|
|
3
|
+
> Availity feedback with smiley faces react component.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@availity/feedback)
|
|
6
|
+
[](https://www.npmjs.com/package/@availity/feedback)
|
|
7
|
+
[](https://github.com/Availity/availity-react/blob/master/packages/feedback/package.json)
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
### NPM
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @availity/feedback
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Yarn
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
yarn add @availity/feedback
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Documentation
|
|
24
|
+
|
|
25
|
+
Check out more documentation at [availity.github.io](https://availity.github.io/availity-react/components/feedback/index)
|
package/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { default } from './src/Feedback';
|
|
2
|
-
export { default as FeedbackForm } from './src/FeedbackForm';
|
|
3
|
-
export { default as FeedbackModal } from './src/FeedbackModal';
|
|
1
|
+
export { default } from './src/Feedback';
|
|
2
|
+
export { default as FeedbackForm } from './src/FeedbackForm';
|
|
3
|
+
export { default as FeedbackModal } from './src/FeedbackModal';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@availity/feedback",
|
|
3
|
-
"version": "6.2.
|
|
3
|
+
"version": "6.2.17",
|
|
4
4
|
"description": "Availity feedback with smiley faces react component.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@availity/hooks": "^3.1.2",
|
|
26
26
|
"@availity/icon": "^0.10.2",
|
|
27
27
|
"@availity/native-form": "^4.0.5",
|
|
28
|
-
"@availity/select": "^2.
|
|
28
|
+
"@availity/select": "^2.6.2",
|
|
29
29
|
"prop-types": "^15.7.2"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"access": "public"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "6c2d3151f94deab399f1ec147e427a3458f899ea"
|
|
54
54
|
}
|
package/src/Feedback.d.ts
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { DropdownProps } from 'reactstrap';
|
|
2
|
-
|
|
3
|
-
export interface AnalyticsType {
|
|
4
|
-
[key: string]: any;
|
|
5
|
-
info: (data: any) => Promise<void>;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface FeedbackProps extends DropdownProps {
|
|
9
|
-
appName?: string;
|
|
10
|
-
modal?: boolean;
|
|
11
|
-
zIndex?: number | string;
|
|
12
|
-
outline?: boolean;
|
|
13
|
-
color?: string;
|
|
14
|
-
analytics?: AnalyticsType;
|
|
15
|
-
formProps?: { [key: string]: any };
|
|
16
|
-
prompt?: React.ReactType;
|
|
17
|
-
onFeedbackSent?: (feedback?: { [key: string]: any }) => void;
|
|
18
|
-
onModalOpenChange?: (isOpen: boolean) => void;
|
|
19
|
-
showSupport?: boolean;
|
|
20
|
-
supportZIndex?: number | string;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
declare const Feedback: React.FC<FeedbackProps>;
|
|
24
|
-
|
|
25
|
-
export default Feedback;
|
|
1
|
+
import { DropdownProps } from 'reactstrap';
|
|
2
|
+
|
|
3
|
+
export interface AnalyticsType {
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
info: (data: any) => Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface FeedbackProps extends DropdownProps {
|
|
9
|
+
appName?: string;
|
|
10
|
+
modal?: boolean;
|
|
11
|
+
zIndex?: number | string;
|
|
12
|
+
outline?: boolean;
|
|
13
|
+
color?: string;
|
|
14
|
+
analytics?: AnalyticsType;
|
|
15
|
+
formProps?: { [key: string]: any };
|
|
16
|
+
prompt?: React.ReactType;
|
|
17
|
+
onFeedbackSent?: (feedback?: { [key: string]: any }) => void;
|
|
18
|
+
onModalOpenChange?: (isOpen: boolean) => void;
|
|
19
|
+
showSupport?: boolean;
|
|
20
|
+
supportZIndex?: number | string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
declare const Feedback: React.FC<FeedbackProps>;
|
|
24
|
+
|
|
25
|
+
export default Feedback;
|
package/src/Feedback.js
CHANGED
|
@@ -1,102 +1,102 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { Dropdown, DropdownToggle } from 'reactstrap';
|
|
4
|
-
import { avLogMessagesApi } from '@availity/api-axios';
|
|
5
|
-
import { useToggle } from '@availity/hooks';
|
|
6
|
-
import FeedbackDropdown from './FeedbackDropdown';
|
|
7
|
-
import FeedbackModal from './FeedbackModal';
|
|
8
|
-
|
|
9
|
-
const Feedback = ({
|
|
10
|
-
appName,
|
|
11
|
-
modal,
|
|
12
|
-
zIndex,
|
|
13
|
-
supportZIndex,
|
|
14
|
-
children,
|
|
15
|
-
analytics,
|
|
16
|
-
className,
|
|
17
|
-
outline,
|
|
18
|
-
color,
|
|
19
|
-
formProps,
|
|
20
|
-
prompt,
|
|
21
|
-
onFeedbackSent,
|
|
22
|
-
showSupport,
|
|
23
|
-
onModalOpenChange,
|
|
24
|
-
...props
|
|
25
|
-
}) => {
|
|
26
|
-
const [feedbackIsOpen, feedbackToggle] = useToggle(false);
|
|
27
|
-
|
|
28
|
-
const handleFeedbackToggle = () => {
|
|
29
|
-
feedbackToggle();
|
|
30
|
-
onModalOpenChange(!feedbackIsOpen);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<Dropdown
|
|
35
|
-
isOpen={feedbackIsOpen && !modal}
|
|
36
|
-
toggle={handleFeedbackToggle}
|
|
37
|
-
className={`${className} hidden-print`}
|
|
38
|
-
{...props}
|
|
39
|
-
>
|
|
40
|
-
<DropdownToggle color={color} outline={outline}>
|
|
41
|
-
{children || showSupport ? 'Feedback & Support' : 'Give Feedback'}
|
|
42
|
-
</DropdownToggle>
|
|
43
|
-
{modal ? (
|
|
44
|
-
<FeedbackModal
|
|
45
|
-
onFeedbackSent={onFeedbackSent}
|
|
46
|
-
prompt={prompt}
|
|
47
|
-
isOpen={feedbackIsOpen}
|
|
48
|
-
zIndex={zIndex}
|
|
49
|
-
toggle={handleFeedbackToggle}
|
|
50
|
-
name={appName}
|
|
51
|
-
analytics={analytics}
|
|
52
|
-
showSupport={showSupport}
|
|
53
|
-
supportZIndex={supportZIndex}
|
|
54
|
-
feedbackToggle={feedbackToggle}
|
|
55
|
-
{...formProps}
|
|
56
|
-
/>
|
|
57
|
-
) : (
|
|
58
|
-
<FeedbackDropdown
|
|
59
|
-
onFeedbackSent={onFeedbackSent}
|
|
60
|
-
feedbackToggle={feedbackToggle}
|
|
61
|
-
prompt={prompt}
|
|
62
|
-
analytics={analytics}
|
|
63
|
-
toggle={handleFeedbackToggle}
|
|
64
|
-
name={appName}
|
|
65
|
-
showSupport={showSupport}
|
|
66
|
-
supportZIndex={supportZIndex}
|
|
67
|
-
modal={modal}
|
|
68
|
-
{...formProps}
|
|
69
|
-
/>
|
|
70
|
-
)}
|
|
71
|
-
</Dropdown>
|
|
72
|
-
);
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
Feedback.propTypes = {
|
|
76
|
-
appName: PropTypes.string,
|
|
77
|
-
modal: PropTypes.bool,
|
|
78
|
-
zIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
79
|
-
supportZIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
80
|
-
children: PropTypes.node,
|
|
81
|
-
className: PropTypes.string,
|
|
82
|
-
outline: PropTypes.bool,
|
|
83
|
-
color: PropTypes.string,
|
|
84
|
-
formProps: PropTypes.object,
|
|
85
|
-
prompt: PropTypes.string,
|
|
86
|
-
onFeedbackSent: PropTypes.func,
|
|
87
|
-
onModalOpenChange: PropTypes.func,
|
|
88
|
-
analytics: PropTypes.shape({
|
|
89
|
-
info: PropTypes.func.isRequired,
|
|
90
|
-
}),
|
|
91
|
-
showSupport: PropTypes.bool,
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
Feedback.defaultProps = {
|
|
95
|
-
modal: false,
|
|
96
|
-
color: 'secondary',
|
|
97
|
-
analytics: avLogMessagesApi,
|
|
98
|
-
showSupport: false,
|
|
99
|
-
onModalOpenChange: Object,
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
export default Feedback;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { Dropdown, DropdownToggle } from 'reactstrap';
|
|
4
|
+
import { avLogMessagesApi } from '@availity/api-axios';
|
|
5
|
+
import { useToggle } from '@availity/hooks';
|
|
6
|
+
import FeedbackDropdown from './FeedbackDropdown';
|
|
7
|
+
import FeedbackModal from './FeedbackModal';
|
|
8
|
+
|
|
9
|
+
const Feedback = ({
|
|
10
|
+
appName,
|
|
11
|
+
modal,
|
|
12
|
+
zIndex,
|
|
13
|
+
supportZIndex,
|
|
14
|
+
children,
|
|
15
|
+
analytics,
|
|
16
|
+
className,
|
|
17
|
+
outline,
|
|
18
|
+
color,
|
|
19
|
+
formProps,
|
|
20
|
+
prompt,
|
|
21
|
+
onFeedbackSent,
|
|
22
|
+
showSupport,
|
|
23
|
+
onModalOpenChange,
|
|
24
|
+
...props
|
|
25
|
+
}) => {
|
|
26
|
+
const [feedbackIsOpen, feedbackToggle] = useToggle(false);
|
|
27
|
+
|
|
28
|
+
const handleFeedbackToggle = () => {
|
|
29
|
+
feedbackToggle();
|
|
30
|
+
onModalOpenChange(!feedbackIsOpen);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<Dropdown
|
|
35
|
+
isOpen={feedbackIsOpen && !modal}
|
|
36
|
+
toggle={handleFeedbackToggle}
|
|
37
|
+
className={`${className} hidden-print`}
|
|
38
|
+
{...props}
|
|
39
|
+
>
|
|
40
|
+
<DropdownToggle color={color} outline={outline}>
|
|
41
|
+
{children || showSupport ? 'Feedback & Support' : 'Give Feedback'}
|
|
42
|
+
</DropdownToggle>
|
|
43
|
+
{modal ? (
|
|
44
|
+
<FeedbackModal
|
|
45
|
+
onFeedbackSent={onFeedbackSent}
|
|
46
|
+
prompt={prompt}
|
|
47
|
+
isOpen={feedbackIsOpen}
|
|
48
|
+
zIndex={zIndex}
|
|
49
|
+
toggle={handleFeedbackToggle}
|
|
50
|
+
name={appName}
|
|
51
|
+
analytics={analytics}
|
|
52
|
+
showSupport={showSupport}
|
|
53
|
+
supportZIndex={supportZIndex}
|
|
54
|
+
feedbackToggle={feedbackToggle}
|
|
55
|
+
{...formProps}
|
|
56
|
+
/>
|
|
57
|
+
) : (
|
|
58
|
+
<FeedbackDropdown
|
|
59
|
+
onFeedbackSent={onFeedbackSent}
|
|
60
|
+
feedbackToggle={feedbackToggle}
|
|
61
|
+
prompt={prompt}
|
|
62
|
+
analytics={analytics}
|
|
63
|
+
toggle={handleFeedbackToggle}
|
|
64
|
+
name={appName}
|
|
65
|
+
showSupport={showSupport}
|
|
66
|
+
supportZIndex={supportZIndex}
|
|
67
|
+
modal={modal}
|
|
68
|
+
{...formProps}
|
|
69
|
+
/>
|
|
70
|
+
)}
|
|
71
|
+
</Dropdown>
|
|
72
|
+
);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
Feedback.propTypes = {
|
|
76
|
+
appName: PropTypes.string,
|
|
77
|
+
modal: PropTypes.bool,
|
|
78
|
+
zIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
79
|
+
supportZIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
80
|
+
children: PropTypes.node,
|
|
81
|
+
className: PropTypes.string,
|
|
82
|
+
outline: PropTypes.bool,
|
|
83
|
+
color: PropTypes.string,
|
|
84
|
+
formProps: PropTypes.object,
|
|
85
|
+
prompt: PropTypes.string,
|
|
86
|
+
onFeedbackSent: PropTypes.func,
|
|
87
|
+
onModalOpenChange: PropTypes.func,
|
|
88
|
+
analytics: PropTypes.shape({
|
|
89
|
+
info: PropTypes.func.isRequired,
|
|
90
|
+
}),
|
|
91
|
+
showSupport: PropTypes.bool,
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
Feedback.defaultProps = {
|
|
95
|
+
modal: false,
|
|
96
|
+
color: 'secondary',
|
|
97
|
+
analytics: avLogMessagesApi,
|
|
98
|
+
showSupport: false,
|
|
99
|
+
onModalOpenChange: Object,
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export default Feedback;
|
package/src/FeedbackButton.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export interface FeedbackButtonProps {
|
|
2
|
-
onClick?: Function;
|
|
3
|
-
icon?: string;
|
|
4
|
-
active?: string;
|
|
5
|
-
children?: React.ReactType;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
declare const FeedbackButton: React.ComponentType<FeedbackButtonProps>;
|
|
9
|
-
|
|
1
|
+
export interface FeedbackButtonProps {
|
|
2
|
+
onClick?: Function;
|
|
3
|
+
icon?: string;
|
|
4
|
+
active?: string;
|
|
5
|
+
children?: React.ReactType;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
declare const FeedbackButton: React.ComponentType<FeedbackButtonProps>;
|
|
9
|
+
|
|
10
10
|
export default FeedbackButton;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export interface FeedbackProps {
|
|
2
|
-
appName: string;
|
|
3
|
-
className?: string;
|
|
4
|
-
prompt?: string;
|
|
5
|
-
color?: string;
|
|
6
|
-
outline?: boolean;
|
|
7
|
-
formProps?: object;
|
|
8
|
-
children?: React.ReactType;
|
|
9
|
-
onFeedbackSent: Function;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
declare const Feedback: React.StatelessComponent<FeedbackProps>;
|
|
13
|
-
|
|
14
|
-
export default Feedback;
|
|
1
|
+
export interface FeedbackProps {
|
|
2
|
+
appName: string;
|
|
3
|
+
className?: string;
|
|
4
|
+
prompt?: string;
|
|
5
|
+
color?: string;
|
|
6
|
+
outline?: boolean;
|
|
7
|
+
formProps?: object;
|
|
8
|
+
children?: React.ReactType;
|
|
9
|
+
onFeedbackSent: Function;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
declare const Feedback: React.StatelessComponent<FeedbackProps>;
|
|
13
|
+
|
|
14
|
+
export default Feedback;
|
package/src/FeedbackForm.d.ts
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { ModalHeaderProps } from 'reactstrap';
|
|
2
|
-
import { AnalyticsType } from './Feedback';
|
|
3
|
-
|
|
4
|
-
type FaceOption = {
|
|
5
|
-
icon?: string;
|
|
6
|
-
description?: string;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
type AboutOption = {
|
|
10
|
-
icon?: string;
|
|
11
|
-
label?: React.ReactNode;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export interface FeedbackFormProps {
|
|
15
|
-
name: string;
|
|
16
|
-
onFeedbackSent?: (feedback?: { [key: string]: any }) => void;
|
|
17
|
-
faceOptions?: FaceOption[];
|
|
18
|
-
aboutOptions?: AboutOption[];
|
|
19
|
-
aboutLabel?: string;
|
|
20
|
-
analytics?: AnalyticsType;
|
|
21
|
-
prompt?: string;
|
|
22
|
-
staticFields?: object;
|
|
23
|
-
modalHeaderProps?: ModalHeaderProps;
|
|
24
|
-
showSupport: boolean;
|
|
25
|
-
setSupportIsActive: Function;
|
|
26
|
-
autoFocusFeedbackButton?: Boolean;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
declare const FeedbackForm: React.FC<FeedbackFormProps>;
|
|
30
|
-
|
|
31
|
-
export default FeedbackForm;
|
|
1
|
+
import { ModalHeaderProps } from 'reactstrap';
|
|
2
|
+
import { AnalyticsType } from './Feedback';
|
|
3
|
+
|
|
4
|
+
type FaceOption = {
|
|
5
|
+
icon?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
type AboutOption = {
|
|
10
|
+
icon?: string;
|
|
11
|
+
label?: React.ReactNode;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export interface FeedbackFormProps {
|
|
15
|
+
name: string;
|
|
16
|
+
onFeedbackSent?: (feedback?: { [key: string]: any }) => void;
|
|
17
|
+
faceOptions?: FaceOption[];
|
|
18
|
+
aboutOptions?: AboutOption[];
|
|
19
|
+
aboutLabel?: string;
|
|
20
|
+
analytics?: AnalyticsType;
|
|
21
|
+
prompt?: string;
|
|
22
|
+
staticFields?: object;
|
|
23
|
+
modalHeaderProps?: ModalHeaderProps;
|
|
24
|
+
showSupport: boolean;
|
|
25
|
+
setSupportIsActive: Function;
|
|
26
|
+
autoFocusFeedbackButton?: Boolean;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
declare const FeedbackForm: React.FC<FeedbackFormProps>;
|
|
30
|
+
|
|
31
|
+
export default FeedbackForm;
|
package/src/FeedbackModal.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export interface FeedbackModalProps {
|
|
2
|
-
isOpen: boolean;
|
|
3
|
-
toggle: Function;
|
|
4
|
-
zIndex?: number | string;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
declare const FeedbackModal: React.FC<FeedbackModalProps>;
|
|
8
|
-
|
|
9
|
-
export default FeedbackModal;
|
|
1
|
+
export interface FeedbackModalProps {
|
|
2
|
+
isOpen: boolean;
|
|
3
|
+
toggle: Function;
|
|
4
|
+
zIndex?: number | string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
declare const FeedbackModal: React.FC<FeedbackModalProps>;
|
|
8
|
+
|
|
9
|
+
export default FeedbackModal;
|
package/src/SmileField.js
CHANGED
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { useField, useFormikContext } from 'formik';
|
|
4
|
-
import FeedbackButton from './FeedbackButton';
|
|
5
|
-
|
|
6
|
-
const btnStyles = { flex: 1, margin: '0 2% 0 2%' };
|
|
7
|
-
|
|
8
|
-
const SmileField = ({ name, options, onChange, autoFocusFeedbackButton, onClose, modal }) => {
|
|
9
|
-
const [{ value }] = useField(name);
|
|
10
|
-
const { setFieldValue } = useFormikContext();
|
|
11
|
-
|
|
12
|
-
return options.map((option, i) => (
|
|
13
|
-
<FeedbackButton
|
|
14
|
-
autoFocus={i === 0 && autoFocusFeedbackButton}
|
|
15
|
-
onKeyDown={(e) => {
|
|
16
|
-
if (e.shiftKey && e.keyCode === 9 && i === 0 && !modal) {
|
|
17
|
-
onClose();
|
|
18
|
-
}
|
|
19
|
-
if (e.keyCode === 13) {
|
|
20
|
-
setFieldValue(name, option);
|
|
21
|
-
if (onChange) {
|
|
22
|
-
onChange(option);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}}
|
|
26
|
-
style={btnStyles}
|
|
27
|
-
key={option.icon}
|
|
28
|
-
icon={option.icon}
|
|
29
|
-
iconSize="2x"
|
|
30
|
-
value={option}
|
|
31
|
-
active={value && value.icon}
|
|
32
|
-
onClick={() => {
|
|
33
|
-
setFieldValue(name, option);
|
|
34
|
-
if (onChange) {
|
|
35
|
-
onChange(option);
|
|
36
|
-
}
|
|
37
|
-
}}
|
|
38
|
-
>
|
|
39
|
-
{option.description}
|
|
40
|
-
</FeedbackButton>
|
|
41
|
-
));
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
SmileField.propTypes = {
|
|
45
|
-
name: PropTypes.string.isRequired,
|
|
46
|
-
options: PropTypes.arrayOf(
|
|
47
|
-
PropTypes.shape({
|
|
48
|
-
icon: PropTypes.string,
|
|
49
|
-
description: PropTypes.string,
|
|
50
|
-
label: PropTypes.string,
|
|
51
|
-
})
|
|
52
|
-
),
|
|
53
|
-
onChange: PropTypes.func,
|
|
54
|
-
autoFocusFeedbackButton: PropTypes.bool,
|
|
55
|
-
modal: PropTypes.bool,
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
SmileField.defaultProps = {
|
|
59
|
-
options: [
|
|
60
|
-
{
|
|
61
|
-
icon: 'smile',
|
|
62
|
-
description: 'Smiley face',
|
|
63
|
-
label: 'What do you like?',
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
icon: 'meh',
|
|
67
|
-
description: 'Meh face',
|
|
68
|
-
label: 'What would you improve?',
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
icon: 'frown',
|
|
72
|
-
description: 'Frowny face',
|
|
73
|
-
label: "What don't you like?",
|
|
74
|
-
},
|
|
75
|
-
],
|
|
76
|
-
autoFocusFeedbackButton: true,
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
export default SmileField;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { useField, useFormikContext } from 'formik';
|
|
4
|
+
import FeedbackButton from './FeedbackButton';
|
|
5
|
+
|
|
6
|
+
const btnStyles = { flex: 1, margin: '0 2% 0 2%' };
|
|
7
|
+
|
|
8
|
+
const SmileField = ({ name, options, onChange, autoFocusFeedbackButton, onClose, modal }) => {
|
|
9
|
+
const [{ value }] = useField(name);
|
|
10
|
+
const { setFieldValue } = useFormikContext();
|
|
11
|
+
|
|
12
|
+
return options.map((option, i) => (
|
|
13
|
+
<FeedbackButton
|
|
14
|
+
autoFocus={i === 0 && autoFocusFeedbackButton}
|
|
15
|
+
onKeyDown={(e) => {
|
|
16
|
+
if (e.shiftKey && e.keyCode === 9 && i === 0 && !modal) {
|
|
17
|
+
onClose();
|
|
18
|
+
}
|
|
19
|
+
if (e.keyCode === 13) {
|
|
20
|
+
setFieldValue(name, option);
|
|
21
|
+
if (onChange) {
|
|
22
|
+
onChange(option);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}}
|
|
26
|
+
style={btnStyles}
|
|
27
|
+
key={option.icon}
|
|
28
|
+
icon={option.icon}
|
|
29
|
+
iconSize="2x"
|
|
30
|
+
value={option}
|
|
31
|
+
active={value && value.icon}
|
|
32
|
+
onClick={() => {
|
|
33
|
+
setFieldValue(name, option);
|
|
34
|
+
if (onChange) {
|
|
35
|
+
onChange(option);
|
|
36
|
+
}
|
|
37
|
+
}}
|
|
38
|
+
>
|
|
39
|
+
{option.description}
|
|
40
|
+
</FeedbackButton>
|
|
41
|
+
));
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
SmileField.propTypes = {
|
|
45
|
+
name: PropTypes.string.isRequired,
|
|
46
|
+
options: PropTypes.arrayOf(
|
|
47
|
+
PropTypes.shape({
|
|
48
|
+
icon: PropTypes.string,
|
|
49
|
+
description: PropTypes.string,
|
|
50
|
+
label: PropTypes.string,
|
|
51
|
+
})
|
|
52
|
+
),
|
|
53
|
+
onChange: PropTypes.func,
|
|
54
|
+
autoFocusFeedbackButton: PropTypes.bool,
|
|
55
|
+
modal: PropTypes.bool,
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
SmileField.defaultProps = {
|
|
59
|
+
options: [
|
|
60
|
+
{
|
|
61
|
+
icon: 'smile',
|
|
62
|
+
description: 'Smiley face',
|
|
63
|
+
label: 'What do you like?',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
icon: 'meh',
|
|
67
|
+
description: 'Meh face',
|
|
68
|
+
label: 'What would you improve?',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
icon: 'frown',
|
|
72
|
+
description: 'Frowny face',
|
|
73
|
+
label: "What don't you like?",
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
autoFocusFeedbackButton: true,
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export default SmileField;
|