@availity/mui-feedback 0.1.6 → 0.1.7
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 +2 -0
- package/dist/index.js +5 -4
- package/dist/index.mjs +5 -4
- package/package.json +1 -1
- package/src/lib/Feedback.tsx +1 -0
- package/src/lib/FeedbackForm.tsx +25 -29
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [0.1.7](https://github.com/Availity/element/compare/@availity/mui-feedback@0.1.6...@availity/mui-feedback@0.1.7) (2023-12-13)
|
|
6
|
+
|
|
5
7
|
## [0.1.6](https://github.com/Availity/element/compare/@availity/mui-feedback@0.1.5...@availity/mui-feedback@0.1.6) (2023-12-04)
|
|
6
8
|
|
|
7
9
|
### Dependency Updates
|
package/dist/index.js
CHANGED
|
@@ -113,9 +113,9 @@ var FeedbackForm = ({
|
|
|
113
113
|
},
|
|
114
114
|
{ Icon: import_mui_icon.FaceFrownIcon, label: "What don't you like?", value: "frown" }
|
|
115
115
|
];
|
|
116
|
+
const smileFieldValue = watch("smileField");
|
|
116
117
|
const getFeedbackLabel = () => {
|
|
117
|
-
const
|
|
118
|
-
const option = options.find((option2) => option2.value === smile);
|
|
118
|
+
const option = options.find((option2) => option2.value === smileFieldValue);
|
|
119
119
|
return (option == null ? void 0 : option.label) || "What would you improve?";
|
|
120
120
|
};
|
|
121
121
|
if (!sent) {
|
|
@@ -147,7 +147,7 @@ var FeedbackForm = ({
|
|
|
147
147
|
});
|
|
148
148
|
}
|
|
149
149
|
}),
|
|
150
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mui_textfield.TextField, {
|
|
150
|
+
smileFieldValue && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mui_textfield.TextField, {
|
|
151
151
|
...register("feedback", {
|
|
152
152
|
required: "This field is required",
|
|
153
153
|
maxLength: { value: 200, message: "This field must not exceed 200 characters" }
|
|
@@ -187,7 +187,7 @@ var FeedbackForm = ({
|
|
|
187
187
|
item: true,
|
|
188
188
|
xs: 6,
|
|
189
189
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_mui_button.LoadingButton, {
|
|
190
|
-
disabled: !
|
|
190
|
+
disabled: !smileFieldValue,
|
|
191
191
|
fullWidth: true,
|
|
192
192
|
loading,
|
|
193
193
|
type: "submit",
|
|
@@ -252,6 +252,7 @@ var Feedback = ({ analytics = import_api_axios2.avLogMessagesApi, appName }) =>
|
|
|
252
252
|
const [loading, setLoading] = (0, import_react2.useState)(false);
|
|
253
253
|
const handlePopoverOpen = (event) => {
|
|
254
254
|
setAnchorEl(event.currentTarget);
|
|
255
|
+
setSent(false);
|
|
255
256
|
};
|
|
256
257
|
const handlePopoverClose = () => {
|
|
257
258
|
setAnchorEl(null);
|
package/dist/index.mjs
CHANGED
|
@@ -87,9 +87,9 @@ var FeedbackForm = ({
|
|
|
87
87
|
},
|
|
88
88
|
{ Icon: FaceFrownIcon, label: "What don't you like?", value: "frown" }
|
|
89
89
|
];
|
|
90
|
+
const smileFieldValue = watch("smileField");
|
|
90
91
|
const getFeedbackLabel = () => {
|
|
91
|
-
const
|
|
92
|
-
const option = options.find((option2) => option2.value === smile);
|
|
92
|
+
const option = options.find((option2) => option2.value === smileFieldValue);
|
|
93
93
|
return (option == null ? void 0 : option.label) || "What would you improve?";
|
|
94
94
|
};
|
|
95
95
|
if (!sent) {
|
|
@@ -121,7 +121,7 @@ var FeedbackForm = ({
|
|
|
121
121
|
});
|
|
122
122
|
}
|
|
123
123
|
}),
|
|
124
|
-
/* @__PURE__ */ jsx(TextField, {
|
|
124
|
+
smileFieldValue && /* @__PURE__ */ jsx(TextField, {
|
|
125
125
|
...register("feedback", {
|
|
126
126
|
required: "This field is required",
|
|
127
127
|
maxLength: { value: 200, message: "This field must not exceed 200 characters" }
|
|
@@ -161,7 +161,7 @@ var FeedbackForm = ({
|
|
|
161
161
|
item: true,
|
|
162
162
|
xs: 6,
|
|
163
163
|
children: /* @__PURE__ */ jsx(LoadingButton, {
|
|
164
|
-
disabled: !
|
|
164
|
+
disabled: !smileFieldValue,
|
|
165
165
|
fullWidth: true,
|
|
166
166
|
loading,
|
|
167
167
|
type: "submit",
|
|
@@ -226,6 +226,7 @@ var Feedback = ({ analytics = avLogMessagesApi, appName }) => {
|
|
|
226
226
|
const [loading, setLoading] = useState(false);
|
|
227
227
|
const handlePopoverOpen = (event) => {
|
|
228
228
|
setAnchorEl(event.currentTarget);
|
|
229
|
+
setSent(false);
|
|
229
230
|
};
|
|
230
231
|
const handlePopoverClose = () => {
|
|
231
232
|
setAnchorEl(null);
|
package/package.json
CHANGED
package/src/lib/Feedback.tsx
CHANGED
package/src/lib/FeedbackForm.tsx
CHANGED
|
@@ -105,10 +105,10 @@ export const FeedbackForm = ({
|
|
|
105
105
|
{ Icon: FaceFrownIcon, label: "What don't you like?", value: 'frown' },
|
|
106
106
|
];
|
|
107
107
|
|
|
108
|
-
const
|
|
109
|
-
const smile = watch('smileField');
|
|
108
|
+
const smileFieldValue = watch('smileField');
|
|
110
109
|
|
|
111
|
-
|
|
110
|
+
const getFeedbackLabel = () => {
|
|
111
|
+
const option = options.find((option) => option.value === smileFieldValue);
|
|
112
112
|
|
|
113
113
|
return option?.label || 'What would you improve?';
|
|
114
114
|
};
|
|
@@ -143,25 +143,27 @@ export const FeedbackForm = ({
|
|
|
143
143
|
);
|
|
144
144
|
}}
|
|
145
145
|
/>
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
146
|
+
{smileFieldValue && (
|
|
147
|
+
<TextField
|
|
148
|
+
{...register('feedback', {
|
|
149
|
+
required: 'This field is required',
|
|
150
|
+
maxLength: { value: 200, message: 'This field must not exceed 200 characters' },
|
|
151
|
+
})}
|
|
152
|
+
fullWidth
|
|
153
|
+
multiline
|
|
154
|
+
minRows={3}
|
|
155
|
+
maxRows={3}
|
|
156
|
+
label={getFeedbackLabel()}
|
|
157
|
+
inputProps={{ 'aria-required': 'true' }}
|
|
158
|
+
InputLabelProps={{
|
|
159
|
+
component: FormLabel,
|
|
160
|
+
required: true,
|
|
161
|
+
}}
|
|
162
|
+
helperText={errors.feedback?.message || 'Max 200 characters'}
|
|
163
|
+
error={!!errors.feedback}
|
|
164
|
+
disabled={loading}
|
|
165
|
+
/>
|
|
166
|
+
)}
|
|
165
167
|
<Grid container direction="row" marginTop="16px" spacing={1}>
|
|
166
168
|
<Grid item xs={6}>
|
|
167
169
|
<Button color="secondary" disabled={loading} fullWidth onClick={handleClose}>
|
|
@@ -169,13 +171,7 @@ export const FeedbackForm = ({
|
|
|
169
171
|
</Button>
|
|
170
172
|
</Grid>
|
|
171
173
|
<Grid item xs={6}>
|
|
172
|
-
<LoadingButton
|
|
173
|
-
disabled={!watch('smileField')}
|
|
174
|
-
fullWidth
|
|
175
|
-
loading={loading}
|
|
176
|
-
type="submit"
|
|
177
|
-
variant="contained"
|
|
178
|
-
>
|
|
174
|
+
<LoadingButton disabled={!smileFieldValue} fullWidth loading={loading} type="submit" variant="contained">
|
|
179
175
|
Send Feedback
|
|
180
176
|
</LoadingButton>
|
|
181
177
|
</Grid>
|