optimized-react-component-library-xyz123 0.19.22 → 0.19.24
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 +15 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -337,14 +337,13 @@ var TextFieldStandard = ({
|
|
|
337
337
|
showPreview = false,
|
|
338
338
|
activatedLanguage
|
|
339
339
|
}) => {
|
|
340
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n
|
|
340
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
341
341
|
const questionId = `question-${question.id}`;
|
|
342
342
|
const inputId = `textField-${question.id}`;
|
|
343
343
|
const aboutId = `about-${question.id}`;
|
|
344
344
|
const errorId = `error-${question.id}`;
|
|
345
|
-
const defaultMaxLength = 100;
|
|
346
345
|
const answerLength = (_b = (_a = question.answer) == null ? void 0 : _a.length) != null ? _b : 0;
|
|
347
|
-
const maxLength =
|
|
346
|
+
const maxLength = 100;
|
|
348
347
|
const isTooLong = answerLength > maxLength;
|
|
349
348
|
const maxLengthErrorText = activatedLanguage === "en" ? `The text must be ${maxLength} characters or less` : `Texten f\xE5r max vara ${maxLength} tecken`;
|
|
350
349
|
return /* @__PURE__ */ jsxs5(Fragment5, { children: [
|
|
@@ -352,7 +351,7 @@ var TextFieldStandard = ({
|
|
|
352
351
|
"div",
|
|
353
352
|
{
|
|
354
353
|
id: questionId,
|
|
355
|
-
className: `pts-root-question pts-textField-container${((
|
|
354
|
+
className: `pts-root-question pts-textField-container${((_c = question.questionExtraAttribute) == null ? void 0 : _c.disabled) ? " pts-textField-disabled" : ""}${question.aboutText ? " pts-question-hasAbout" : ""}`.trim(),
|
|
356
355
|
children: [
|
|
357
356
|
/* @__PURE__ */ jsxs5("label", { htmlFor: inputId, children: [
|
|
358
357
|
question.questionLabel,
|
|
@@ -372,25 +371,25 @@ var TextFieldStandard = ({
|
|
|
372
371
|
/* @__PURE__ */ jsx5(
|
|
373
372
|
"input",
|
|
374
373
|
{
|
|
375
|
-
type: (
|
|
376
|
-
autoComplete: (
|
|
377
|
-
inputMode: (
|
|
374
|
+
type: (_e = (_d = question.questionExtraAttribute) == null ? void 0 : _d.inputType) != null ? _e : "text",
|
|
375
|
+
autoComplete: (_g = (_f = question.questionExtraAttribute) == null ? void 0 : _f.autoComplete) != null ? _g : void 0,
|
|
376
|
+
inputMode: (_i = (_h = question.questionExtraAttribute) == null ? void 0 : _h.inputMode) != null ? _i : void 0,
|
|
378
377
|
name: `question-name-${question.id}`,
|
|
379
378
|
className: question.hasValidationError ? "pts-root-question-input-error-border" : void 0,
|
|
380
379
|
onChange: (e) => handleQuestionInputChange(e, question),
|
|
381
380
|
value: question.answer,
|
|
382
381
|
id: inputId,
|
|
383
|
-
disabled: (
|
|
382
|
+
disabled: (_j = question.questionExtraAttribute) == null ? void 0 : _j.disabled,
|
|
384
383
|
required: question.isQuestionMandatory,
|
|
385
384
|
"aria-required": question.isQuestionMandatory,
|
|
386
385
|
"aria-describedby": [question.aboutText ? aboutId : null].filter(Boolean).join(" ") || void 0,
|
|
387
386
|
"aria-invalid": question.hasValidationError,
|
|
388
387
|
"aria-errormessage": question.hasValidationError ? errorId : void 0,
|
|
389
|
-
spellCheck: (
|
|
390
|
-
autoCapitalize: (
|
|
388
|
+
spellCheck: (_l = (_k = question.questionExtraAttribute) == null ? void 0 : _k.spellCheck) != null ? _l : void 0,
|
|
389
|
+
autoCapitalize: (_n = (_m = question.questionExtraAttribute) == null ? void 0 : _m.autoCapitalize) != null ? _n : void 0
|
|
391
390
|
}
|
|
392
391
|
),
|
|
393
|
-
question.hasValidationError && /* @__PURE__ */ jsxs5("div", { className: "pts-root-error", id: errorId, children: [
|
|
392
|
+
!isTooLong && question.hasValidationError && /* @__PURE__ */ jsxs5("div", { className: "pts-root-error", id: errorId, children: [
|
|
394
393
|
/* @__PURE__ */ jsx5("span", { "aria-hidden": true, className: "errorDot", children: "!" }),
|
|
395
394
|
/* @__PURE__ */ jsx5("span", { className: "sr-only", children: "Valideringsfel" }),
|
|
396
395
|
/* @__PURE__ */ jsx5("span", { className: "errorText", children: question.validationDefaultMessesege })
|
|
@@ -1135,6 +1134,11 @@ var hasQuestionValidationError = (question, questions) => {
|
|
|
1135
1134
|
error = true;
|
|
1136
1135
|
}
|
|
1137
1136
|
}
|
|
1137
|
+
if (question.questionType === "TextField") {
|
|
1138
|
+
if (question.answer.length > 100) {
|
|
1139
|
+
error = true;
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1138
1142
|
if (((_c = question.validationType) == null ? void 0 : _c.find((e) => e === "email")) && (question.isQuestionMandatory || question.answer !== "")) {
|
|
1139
1143
|
const emailRegex = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
|
1140
1144
|
if (!emailRegex.test(question.answer)) {
|