optimized-react-component-library-xyz123 0.19.18 → 0.19.19

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/dist/index.js CHANGED
@@ -327,7 +327,7 @@ var InputTextarea = ({
327
327
  showPreview = false,
328
328
  activatedLanguage
329
329
  }) => {
330
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
330
+ var _a, _b, _c, _d, _e;
331
331
  const questionId = `question-${question.id}`;
332
332
  const inputId = `textarea-${question.id}`;
333
333
  const aboutId = `about-${question.id}`;
@@ -336,6 +336,8 @@ var InputTextarea = ({
336
336
  const answerLength = (_b = (_a = question.answer) == null ? void 0 : _a.length) != null ? _b : 0;
337
337
  const maxLength = (_d = (_c = question.questionExtraAttribute) == null ? void 0 : _c.answerMaxLength) != null ? _d : defaultMaxLength;
338
338
  const isTooLong = answerLength > maxLength;
339
+ const counterText = activatedLanguage === "en" ? `${answerLength} of ${maxLength} characters` : `${answerLength} av ${maxLength} tecken`;
340
+ const maxLengthErrorText = activatedLanguage === "en" ? `The text must be ${maxLength} characters or less` : `Texten f\xE5r max vara ${maxLength} tecken`;
339
341
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
340
342
  !showPreview && question.visible && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
341
343
  "div",
@@ -367,7 +369,6 @@ var InputTextarea = ({
367
369
  required: question.isQuestionMandatory,
368
370
  "aria-required": question.isQuestionMandatory,
369
371
  "aria-invalid": question.hasValidationError,
370
- maxLength: ((_e = question.questionExtraAttribute) == null ? void 0 : _e.answerMaxLength) || defaultMaxLength,
371
372
  "aria-describedby": [question.aboutText ? aboutId : null, question.hasValidationError ? errorId : null].filter(Boolean).join(" ") || void 0,
372
373
  id: inputId
373
374
  }
@@ -379,21 +380,9 @@ var InputTextarea = ({
379
380
  ] }),
380
381
  isTooLong && question.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "pts-root-error", id: errorId, children: [
381
382
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { "aria-label": "Felmeddelande.", className: "errorDot", children: "!" }),
382
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "errorText", children: "Texten f\xE5r max vara 1000 tecken" })
383
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "errorText", children: maxLengthErrorText })
383
384
  ] }),
384
- !((_f = question.questionExtraAttribute) == null ? void 0 : _f.hideTextCounter) && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
385
- "div",
386
- {
387
- className: `pts-character-counter ${question.answer && (((_g = question.questionExtraAttribute) == null ? void 0 : _g.answerMaxLength) || defaultMaxLength) && question.answer.length > (((_h = question.questionExtraAttribute) == null ? void 0 : _h.answerMaxLength) || defaultMaxLength) ? "error" : ""}`,
388
- children: [
389
- question.answer ? question.answer.length : 0,
390
- " av",
391
- " ",
392
- ((_i = question.questionExtraAttribute) == null ? void 0 : _i.answerMaxLength) || defaultMaxLength,
393
- " tecken"
394
- ]
395
- }
396
- )
385
+ !((_e = question.questionExtraAttribute) == null ? void 0 : _e.hideTextCounter) && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { "aria-live": "polite", className: `pts-character-counter`, children: counterText })
397
386
  ] })
398
387
  ]
399
388
  }