optimized-react-component-library-xyz123 0.13.5 → 0.13.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/dist/index.js CHANGED
@@ -1278,7 +1278,6 @@ var MultipleTextField = ({
1278
1278
  const [arrayOfTextFields, setArrayOfTextFields] = (0, import_react9.useState)(
1279
1279
  []
1280
1280
  );
1281
- const [textfieldValues, setTextfieldValues] = (0, import_react9.useState)([]);
1282
1281
  (0, import_react9.useEffect)(() => {
1283
1282
  const initialValues = Array.from({ length: numberOfTextFields }, (_, index) => ({
1284
1283
  label: `Field ${index + 1}`,
@@ -1288,15 +1287,12 @@ var MultipleTextField = ({
1288
1287
  setArrayOfTextFields(initialValues);
1289
1288
  }, []);
1290
1289
  const handleInputChange = (event, optionValue) => {
1291
- alert("handleInputChange called with optionValue: " + optionValue);
1292
1290
  const newValue = event.target.value;
1293
1291
  const updatedTextFields = arrayOfTextFields.map(
1294
1292
  (field) => field.label === optionValue ? { ...field, value: newValue } : field
1295
1293
  );
1296
1294
  setArrayOfTextFields(updatedTextFields);
1297
- alert("Updated text fields: " + JSON.stringify(updatedTextFields));
1298
- setTextfieldValues(updatedTextFields.map((field) => field.value));
1299
- const e = { target: { value: updatedTextFields.toString() } };
1295
+ const e = { target: { value: updatedTextFields.map((field) => field.value).toString() } };
1300
1296
  handleQuestionInputChange(e, question);
1301
1297
  };
1302
1298
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
@@ -1309,39 +1305,50 @@ var MultipleTextField = ({
1309
1305
  ] }),
1310
1306
  arrayOfTextFields.map((option, index) => {
1311
1307
  var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
1312
- return (
1313
- // <li key={index}>
1314
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
1315
- " ",
1316
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { htmlFor: `${question.id}-textfield-${index}`, children: [
1317
- option.label,
1318
- " "
1319
- ] }),
1320
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1321
- "input",
1322
- {
1323
- type: (_b2 = (_a2 = question.questionExtraAttribute) == null ? void 0 : _a2.inputType) != null ? _b2 : "text",
1324
- autoComplete: (_d = (_c = question.questionExtraAttribute) == null ? void 0 : _c.autoComplete) != null ? _d : void 0,
1325
- inputMode: (_f = (_e = question.questionExtraAttribute) == null ? void 0 : _e.inputMode) != null ? _f : void 0,
1326
- name: `question-name-${question.id}`,
1327
- className: question.hasValidationError ? "pts-root-question-input-error-border" : void 0,
1328
- onChange: (e) => handleInputChange(e, option.label),
1329
- value: option.value,
1330
- maxLength: ((_g = question.questionExtraAttribute) == null ? void 0 : _g.answerMaxLength) || defaultMaxLength,
1331
- id: `${question.id}-textfield-${index}`,
1332
- disabled: (_h = question.questionExtraAttribute) == null ? void 0 : _h.disabled,
1333
- required: question.isQuestionMandatory,
1334
- "aria-required": question.isQuestionMandatory,
1335
- "aria-describedby": [question.aboutText ? aboutId : null].filter(Boolean).join(" ") || void 0,
1336
- "aria-invalid": question.hasValidationError,
1337
- "aria-errormessage": question.hasValidationError ? errorId : void 0,
1338
- spellCheck: (_j = (_i = question.questionExtraAttribute) == null ? void 0 : _i.spellCheck) != null ? _j : void 0,
1339
- autoCapitalize: (_l = (_k = question.questionExtraAttribute) == null ? void 0 : _k.autoCapitalize) != null ? _l : void 0
1340
- }
1341
- )
1342
- ] })
1343
- );
1344
- })
1308
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
1309
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("label", { htmlFor: `${question.id}-textfield-${index}`, children: [
1310
+ option.label,
1311
+ " "
1312
+ ] }),
1313
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1314
+ "input",
1315
+ {
1316
+ type: (_b2 = (_a2 = question.questionExtraAttribute) == null ? void 0 : _a2.inputType) != null ? _b2 : "text",
1317
+ autoComplete: (_d = (_c = question.questionExtraAttribute) == null ? void 0 : _c.autoComplete) != null ? _d : void 0,
1318
+ inputMode: (_f = (_e = question.questionExtraAttribute) == null ? void 0 : _e.inputMode) != null ? _f : void 0,
1319
+ name: `question-name-${question.id}`,
1320
+ className: question.hasValidationError ? "pts-root-question-input-error-border" : void 0,
1321
+ onChange: (e) => handleInputChange(e, option.label),
1322
+ value: option.value,
1323
+ maxLength: ((_g = question.questionExtraAttribute) == null ? void 0 : _g.answerMaxLength) || defaultMaxLength,
1324
+ id: `${question.id}-textfield-${index}`,
1325
+ disabled: (_h = question.questionExtraAttribute) == null ? void 0 : _h.disabled,
1326
+ required: question.isQuestionMandatory,
1327
+ "aria-required": question.isQuestionMandatory,
1328
+ "aria-describedby": [question.aboutText ? aboutId : null].filter(Boolean).join(" ") || void 0,
1329
+ "aria-invalid": question.hasValidationError,
1330
+ "aria-errormessage": question.hasValidationError ? errorId : void 0,
1331
+ spellCheck: (_j = (_i = question.questionExtraAttribute) == null ? void 0 : _i.spellCheck) != null ? _j : void 0,
1332
+ autoCapitalize: (_l = (_k = question.questionExtraAttribute) == null ? void 0 : _k.autoCapitalize) != null ? _l : void 0
1333
+ }
1334
+ )
1335
+ ] });
1336
+ }),
1337
+ question.aboutText && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1338
+ "div",
1339
+ {
1340
+ id: aboutId,
1341
+ className: "pts-about",
1342
+ dangerouslySetInnerHTML: { __html: question.aboutText }
1343
+ }
1344
+ ),
1345
+ " ",
1346
+ question.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "pts-root-error", id: errorId, children: [
1347
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { "aria-hidden": true, className: "errorDot", children: "!" }),
1348
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "sr-only", children: "Valideringsfel" }),
1349
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "errorText", children: question.validationDefaultMessesege })
1350
+ ] }),
1351
+ " "
1345
1352
  ] }) }),
1346
1353
  " ",
1347
1354
  showPreview && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(PreviewMultipleTextField, { activatedLanguage, question })