@fluid-topics/ft-reader-feedback 1.0.58 → 1.0.60

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.
@@ -4,12 +4,12 @@ import { FtButtonCssVariables } from "@fluid-topics/ft-button/build/ft-button.cs
4
4
  import { FtSwitchCssVariables } from "@fluid-topics/ft-switch/build/ft-switch.css";
5
5
  import { FtTypographyTitleCssVariables, FtTypographyTitleDenseCssVariables } from "@fluid-topics/ft-typography/build/ft-typography.css";
6
6
  export const FtReaderFeedbackCssVariables = {
7
- feedbackInputMinWidth: FtCssVariableFactory.create("--ft-reader-feedback-input-min-width", "SIZE", "300px"),
7
+ feedbackInputMinWidth: FtCssVariableFactory.create("--ft-reader-feedback-input-min-width", "", "SIZE", "300px"),
8
8
  ratedDateColor: FtCssVariableFactory.external(designSystemVariables.colorOnSurfaceMedium, "Design system"),
9
- sendFeedbackColor: FtCssVariableFactory.extend("--ft-reader-feedback-send-feedback-color", designSystemVariables.colorOnPrimary),
10
- sendFeedbackBackgroundColor: FtCssVariableFactory.extend("--ft-reader-feedback-send-feedback-background-color", designSystemVariables.colorPrimary),
11
- filledRatingColor: FtCssVariableFactory.extend("--ft-reader-feedback-filled-rating-color", designSystemVariables.colorPrimary),
12
- emptyRatingColor: FtCssVariableFactory.extend("--ft-reader-feedback-empty-rating-color", designSystemVariables.colorOnSurfaceMedium),
9
+ sendFeedbackColor: FtCssVariableFactory.extend("--ft-reader-feedback-send-feedback-color", "", designSystemVariables.colorOnPrimary),
10
+ sendFeedbackBackgroundColor: FtCssVariableFactory.extend("--ft-reader-feedback-send-feedback-background-color", "", designSystemVariables.colorPrimary),
11
+ filledRatingColor: FtCssVariableFactory.extend("--ft-reader-feedback-filled-rating-color", "", designSystemVariables.colorPrimary),
12
+ emptyRatingColor: FtCssVariableFactory.extend("--ft-reader-feedback-empty-rating-color", "", designSystemVariables.colorOnSurfaceMedium),
13
13
  mainTitleFontSize: FtCssVariableFactory.external(FtTypographyTitleCssVariables.fontSize, "Typography"),
14
14
  sectionTitleFontSize: FtCssVariableFactory.external(FtTypographyTitleDenseCssVariables.fontSize, "Typography"),
15
15
  };
@@ -54,6 +54,7 @@ export declare class FtReaderFeedback extends FtReaderFeedback_base implements F
54
54
  private renderRating;
55
55
  private rate;
56
56
  private renderFeedbackSection;
57
+ private onFormSubmitEvent;
57
58
  private validFromEmail;
58
59
  private sendFeedback;
59
60
  private placeholderInEditor;
@@ -74,10 +74,10 @@ class FtReaderFeedback extends withI18n(FtReaderComponent) {
74
74
  return html `
75
75
  <div class="ft-reader-feedback">
76
76
  ${this.hideTitle ? nothing : html `
77
- <ft-typography variant="title" part="main-title">
78
- ${this.i18n(this.i18nProperties.feedbackMainTitle)}
79
- </ft-typography>
80
- `}
77
+ <ft-typography variant="title" part="main-title">
78
+ ${this.i18n(this.i18nProperties.feedbackMainTitle)}
79
+ </ft-typography>
80
+ `}
81
81
  ${this.renderRatingSection()}
82
82
  ${this.renderFeedbackSection()}
83
83
  </div>
@@ -127,17 +127,17 @@ class FtReaderFeedback extends withI18n(FtReaderComponent) {
127
127
  let active = this.ratingType === "STARS" && this.ratingValue > index;
128
128
  const ratingValue = index + 1;
129
129
  return html `
130
- <ft-button round part="rating-stars-${ratingValue}"
131
- label="${feedback.messages.starsRating(ratingValue)}"
132
- tooltipPosition="top"
133
- .iconVariant=${this.iconVariant}
134
- icon="${active ? this.filledStarIcon : this.emptyStarIcon}"
135
- class="ft-reader-feedback--${active ? "active" : "inactive"}"
136
- @click=${() => this.rate(this.ratingValue === ratingValue
130
+ <ft-button round part="rating-stars-${ratingValue}"
131
+ label="${feedback.messages.starsRating(ratingValue)}"
132
+ tooltipPosition="top"
133
+ .iconVariant=${this.iconVariant}
134
+ icon="${active ? this.filledStarIcon : this.emptyStarIcon}"
135
+ class="ft-reader-feedback--${active ? "active" : "inactive"}"
136
+ @click=${() => this.rate(this.ratingValue === ratingValue
137
137
  ? undefined
138
138
  : ratingValue)}
139
- ></ft-button>
140
- `;
139
+ ></ft-button>
140
+ `;
141
141
  })}
142
142
  </div>
143
143
  `;
@@ -193,9 +193,9 @@ class FtReaderFeedback extends withI18n(FtReaderComponent) {
193
193
  const mailLink = this.feedbackMailLinkBuilder(this.feedbackMessage);
194
194
  let button = html `
195
195
  <ft-button primary
196
+ type="submit" name="submit"
196
197
  class="ft-reader-feedback--send-feedback"
197
198
  ?disabled=${!this.feedbackMessage || !this.validFromEmail()}
198
- @click=${() => mailLink ? this.onMailerFeedbackSent() : this.sendFeedback()}
199
199
  part="send-feedback">
200
200
  ${feedback.messages.okButton()}
201
201
  </ft-button>
@@ -208,15 +208,16 @@ class FtReaderFeedback extends withI18n(FtReaderComponent) {
208
208
  `;
209
209
  }
210
210
  return html `
211
- <div class="ft-reader-feedback--feedback" part="feedback-container">
211
+ <form class="ft-reader-feedback--feedback" part="feedback-container" autocomplete="on"
212
+ @submit="${(e) => this.onFormSubmitEvent(e, !!mailLink)}">
212
213
  <ft-typography variant="title-dense" part="section-title" class="ft-reader-feedback--section-title">
213
214
  ${this.i18n(this.i18nProperties.feedbackSectionTitle)}
214
215
  </ft-typography>
215
216
  ${((_b = (_a = this.session) === null || _a === void 0 ? void 0 : _a.profile) === null || _b === void 0 ? void 0 : _b.userId) == null && ((_c = this.configuration) === null || _c === void 0 ? void 0 : _c.mailsSentByFluidTopicsForUnauthenticatedUsers) ? html `
216
- <ft-text-field outlined
217
+ <ft-text-field outlined name="email" type="email" autocomplete="email"
217
218
  class="ft-reader-feedback--from-input"
218
219
  label=${feedback.messages.feedbackfromEmail()}
219
- @live-change=${(e) => this.from = e.detail.trim()}
220
+ @change=${(e) => this.from = e.detail.trim()}
220
221
  ?error=${this.from && !this.validFromEmail()}
221
222
  helper=${this.from && !this.validFromEmail() ? feedback.messages.feedbackfromEmailInvalid() : ""}
222
223
  />
@@ -227,11 +228,15 @@ class FtReaderFeedback extends withI18n(FtReaderComponent) {
227
228
  @live-change=${(e) => this.feedbackMessage = e.detail.trim()}
228
229
  ></ft-text-area>
229
230
  ${button}
230
- </div>
231
+ </form>
231
232
  `;
232
233
  }
233
234
  return this.placeholderInEditor(designer.messages.missingFeedbackRole());
234
235
  }
236
+ onFormSubmitEvent(event, isUsingMailLink) {
237
+ event.preventDefault();
238
+ isUsingMailLink ? this.onMailerFeedbackSent() : this.sendFeedback();
239
+ }
235
240
  validFromEmail() {
236
241
  var _a, _b, _c;
237
242
  const expression = /^[a-zA-Z0-9_+&*-]+(?:\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}$/;