@availity/mui-feedback 0.1.5 → 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 CHANGED
@@ -2,6 +2,15 @@
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
+
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)
8
+
9
+ ### Dependency Updates
10
+
11
+ * `mui-button` updated to version `0.6.0`
12
+ * `mui-form-utils` updated to version `0.6.2`
13
+ * `mui-textfield` updated to version `0.4.3`
5
14
  ## [0.1.5](https://github.com/Availity/element/compare/@availity/mui-feedback@0.1.4...@availity/mui-feedback@0.1.5) (2023-11-28)
6
15
 
7
16
  ### 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 smile = watch("smileField");
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: !watch("smileField"),
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 smile = watch("smileField");
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: !watch("smileField"),
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@availity/mui-feedback",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "Availity MUI Feedback Component - part of the @availity/element design system",
5
5
  "keywords": [
6
6
  "react",
@@ -47,11 +47,11 @@
47
47
  },
48
48
  "dependencies": {
49
49
  "@availity/api-axios": "^8.0.3",
50
- "@availity/mui-button": "^0.5.1",
51
- "@availity/mui-form-utils": "^0.6.1",
50
+ "@availity/mui-button": "^0.6.0",
51
+ "@availity/mui-form-utils": "^0.6.2",
52
52
  "@availity/mui-icon": "^0.7.3",
53
53
  "@availity/mui-popover": "^0.1.1",
54
- "@availity/mui-textfield": "^0.4.2",
54
+ "@availity/mui-textfield": "^0.4.3",
55
55
  "@availity/mui-toggle-button": "^0.1.7",
56
56
  "@availity/mui-typography": "^0.1.5",
57
57
  "react-hook-form": "^7.48.2"
@@ -21,6 +21,7 @@ export const Feedback = ({ analytics = avLogMessagesApi, appName }: FeedbackProp
21
21
 
22
22
  const handlePopoverOpen = (event: React.MouseEvent<HTMLElement>) => {
23
23
  setAnchorEl(event.currentTarget);
24
+ setSent(false);
24
25
  };
25
26
 
26
27
  const handlePopoverClose = () => {
@@ -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 getFeedbackLabel = () => {
109
- const smile = watch('smileField');
108
+ const smileFieldValue = watch('smileField');
110
109
 
111
- const option = options.find((option) => option.value === smile);
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
- <TextField
147
- {...register('feedback', {
148
- required: 'This field is required',
149
- maxLength: { value: 200, message: 'This field must not exceed 200 characters' },
150
- })}
151
- fullWidth
152
- multiline
153
- minRows={3}
154
- maxRows={3}
155
- label={getFeedbackLabel()}
156
- inputProps={{ 'aria-required': 'true' }}
157
- InputLabelProps={{
158
- component: FormLabel,
159
- required: true,
160
- }}
161
- helperText={errors.feedback?.message || 'Max 200 characters'}
162
- error={!!errors.feedback}
163
- disabled={loading}
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>