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.mjs CHANGED
@@ -1194,7 +1194,6 @@ var MultipleTextField = ({
1194
1194
  const [arrayOfTextFields, setArrayOfTextFields] = useState7(
1195
1195
  []
1196
1196
  );
1197
- const [textfieldValues, setTextfieldValues] = useState7([]);
1198
1197
  useEffect7(() => {
1199
1198
  const initialValues = Array.from({ length: numberOfTextFields }, (_, index) => ({
1200
1199
  label: `Field ${index + 1}`,
@@ -1204,15 +1203,12 @@ var MultipleTextField = ({
1204
1203
  setArrayOfTextFields(initialValues);
1205
1204
  }, []);
1206
1205
  const handleInputChange = (event, optionValue) => {
1207
- alert("handleInputChange called with optionValue: " + optionValue);
1208
1206
  const newValue = event.target.value;
1209
1207
  const updatedTextFields = arrayOfTextFields.map(
1210
1208
  (field) => field.label === optionValue ? { ...field, value: newValue } : field
1211
1209
  );
1212
1210
  setArrayOfTextFields(updatedTextFields);
1213
- alert("Updated text fields: " + JSON.stringify(updatedTextFields));
1214
- setTextfieldValues(updatedTextFields.map((field) => field.value));
1215
- const e = { target: { value: updatedTextFields.toString() } };
1211
+ const e = { target: { value: updatedTextFields.map((field) => field.value).toString() } };
1216
1212
  handleQuestionInputChange(e, question);
1217
1213
  };
1218
1214
  return /* @__PURE__ */ jsxs12(Fragment14, { children: [
@@ -1225,39 +1221,50 @@ var MultipleTextField = ({
1225
1221
  ] }),
1226
1222
  arrayOfTextFields.map((option, index) => {
1227
1223
  var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
1228
- return (
1229
- // <li key={index}>
1230
- /* @__PURE__ */ jsxs12(Fragment14, { children: [
1231
- " ",
1232
- /* @__PURE__ */ jsxs12("label", { htmlFor: `${question.id}-textfield-${index}`, children: [
1233
- option.label,
1234
- " "
1235
- ] }),
1236
- /* @__PURE__ */ jsx14(
1237
- "input",
1238
- {
1239
- type: (_b2 = (_a2 = question.questionExtraAttribute) == null ? void 0 : _a2.inputType) != null ? _b2 : "text",
1240
- autoComplete: (_d = (_c = question.questionExtraAttribute) == null ? void 0 : _c.autoComplete) != null ? _d : void 0,
1241
- inputMode: (_f = (_e = question.questionExtraAttribute) == null ? void 0 : _e.inputMode) != null ? _f : void 0,
1242
- name: `question-name-${question.id}`,
1243
- className: question.hasValidationError ? "pts-root-question-input-error-border" : void 0,
1244
- onChange: (e) => handleInputChange(e, option.label),
1245
- value: option.value,
1246
- maxLength: ((_g = question.questionExtraAttribute) == null ? void 0 : _g.answerMaxLength) || defaultMaxLength,
1247
- id: `${question.id}-textfield-${index}`,
1248
- disabled: (_h = question.questionExtraAttribute) == null ? void 0 : _h.disabled,
1249
- required: question.isQuestionMandatory,
1250
- "aria-required": question.isQuestionMandatory,
1251
- "aria-describedby": [question.aboutText ? aboutId : null].filter(Boolean).join(" ") || void 0,
1252
- "aria-invalid": question.hasValidationError,
1253
- "aria-errormessage": question.hasValidationError ? errorId : void 0,
1254
- spellCheck: (_j = (_i = question.questionExtraAttribute) == null ? void 0 : _i.spellCheck) != null ? _j : void 0,
1255
- autoCapitalize: (_l = (_k = question.questionExtraAttribute) == null ? void 0 : _k.autoCapitalize) != null ? _l : void 0
1256
- }
1257
- )
1258
- ] })
1259
- );
1260
- })
1224
+ return /* @__PURE__ */ jsxs12(Fragment14, { children: [
1225
+ /* @__PURE__ */ jsxs12("label", { htmlFor: `${question.id}-textfield-${index}`, children: [
1226
+ option.label,
1227
+ " "
1228
+ ] }),
1229
+ /* @__PURE__ */ jsx14(
1230
+ "input",
1231
+ {
1232
+ type: (_b2 = (_a2 = question.questionExtraAttribute) == null ? void 0 : _a2.inputType) != null ? _b2 : "text",
1233
+ autoComplete: (_d = (_c = question.questionExtraAttribute) == null ? void 0 : _c.autoComplete) != null ? _d : void 0,
1234
+ inputMode: (_f = (_e = question.questionExtraAttribute) == null ? void 0 : _e.inputMode) != null ? _f : void 0,
1235
+ name: `question-name-${question.id}`,
1236
+ className: question.hasValidationError ? "pts-root-question-input-error-border" : void 0,
1237
+ onChange: (e) => handleInputChange(e, option.label),
1238
+ value: option.value,
1239
+ maxLength: ((_g = question.questionExtraAttribute) == null ? void 0 : _g.answerMaxLength) || defaultMaxLength,
1240
+ id: `${question.id}-textfield-${index}`,
1241
+ disabled: (_h = question.questionExtraAttribute) == null ? void 0 : _h.disabled,
1242
+ required: question.isQuestionMandatory,
1243
+ "aria-required": question.isQuestionMandatory,
1244
+ "aria-describedby": [question.aboutText ? aboutId : null].filter(Boolean).join(" ") || void 0,
1245
+ "aria-invalid": question.hasValidationError,
1246
+ "aria-errormessage": question.hasValidationError ? errorId : void 0,
1247
+ spellCheck: (_j = (_i = question.questionExtraAttribute) == null ? void 0 : _i.spellCheck) != null ? _j : void 0,
1248
+ autoCapitalize: (_l = (_k = question.questionExtraAttribute) == null ? void 0 : _k.autoCapitalize) != null ? _l : void 0
1249
+ }
1250
+ )
1251
+ ] });
1252
+ }),
1253
+ question.aboutText && /* @__PURE__ */ jsx14(
1254
+ "div",
1255
+ {
1256
+ id: aboutId,
1257
+ className: "pts-about",
1258
+ dangerouslySetInnerHTML: { __html: question.aboutText }
1259
+ }
1260
+ ),
1261
+ " ",
1262
+ question.hasValidationError && /* @__PURE__ */ jsxs12("div", { className: "pts-root-error", id: errorId, children: [
1263
+ /* @__PURE__ */ jsx14("span", { "aria-hidden": true, className: "errorDot", children: "!" }),
1264
+ /* @__PURE__ */ jsx14("span", { className: "sr-only", children: "Valideringsfel" }),
1265
+ /* @__PURE__ */ jsx14("span", { className: "errorText", children: question.validationDefaultMessesege })
1266
+ ] }),
1267
+ " "
1261
1268
  ] }) }),
1262
1269
  " ",
1263
1270
  showPreview && /* @__PURE__ */ jsx14(PreviewMultipleTextField, { activatedLanguage, question })