optimized-react-component-library-xyz123 0.21.1 → 0.22.1

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
@@ -705,7 +705,9 @@ var SelectedFiles = ({
705
705
  let newFiles = questionObject.files.filter((f) => f !== file);
706
706
  const newCountOfFiles = newFiles.length;
707
707
  setNumberOfFiles(newCountOfFiles);
708
- const e = { target: { value: `${newCountOfFiles} files`, files: newFiles } };
708
+ let e = { target: { value: `${newCountOfFiles} files`, files: newFiles } };
709
+ const targetValue = e.target.value === "0 files" ? "" : e.target.value;
710
+ e = { ...e, target: { ...e.target, value: targetValue } };
709
711
  isTouched(e, questionObject);
710
712
  removeFile(newCountOfFiles);
711
713
  };
@@ -991,7 +993,7 @@ var AddFiles = ({
991
993
  const currentFiles = questionObject.files ? questionObject.files : [];
992
994
  const e = {
993
995
  target: {
994
- value: `${currentFiles.length + newFiles.length} files`,
996
+ value: currentFiles.length + newFiles.length > 0 ? `${currentFiles.length + newFiles.length} files` : "",
995
997
  files: [...currentFiles, ...newFiles]
996
998
  }
997
999
  };
@@ -1014,68 +1016,75 @@ var AddFiles = ({
1014
1016
  setErrorMessageAddingFile([]);
1015
1017
  };
1016
1018
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
1017
- !showPreview && visible && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "root-question addFile-question-container", id: `question-${questionObject.id}`, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { role: "group", children: [
1018
- questionObject.aboutText && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1019
- "p",
1020
- {
1021
- id: aboutId,
1022
- className: (0, import_clsx3.default)(
1023
- "addFilesMandatory",
1024
- questionObject.hasValidationError ? " error" : ""
1019
+ !showPreview && visible && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1020
+ "div",
1021
+ {
1022
+ className: "root-question addFile-question-container",
1023
+ id: `question-${questionObject.id}`,
1024
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { role: "group", children: [
1025
+ questionObject.aboutText && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1026
+ "p",
1027
+ {
1028
+ id: aboutId,
1029
+ className: (0, import_clsx3.default)(
1030
+ "addFilesMandatory",
1031
+ questionObject.hasValidationError ? " error" : ""
1032
+ ),
1033
+ children: [
1034
+ questionObject.aboutText,
1035
+ questionObject.isQuestionMandatory && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "pts-root-mandatoryAsterisk", "aria-label": "Obligatorisk fr\xE5ga", children: [
1036
+ " ",
1037
+ "*"
1038
+ ] })
1039
+ ]
1040
+ }
1025
1041
  ),
1026
- children: [
1027
- questionObject.aboutText,
1028
- questionObject.isQuestionMandatory && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "pts-root-mandatoryAsterisk", "aria-label": "Obligatorisk fr\xE5ga", children: [
1029
- " ",
1030
- "*"
1031
- ] })
1032
- ]
1033
- }
1034
- ),
1035
- questionObject.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "pts-root-error error addfileserror", id: errorId, children: [
1036
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { "aria-hidden": true, className: "errorDot", children: "!" }),
1037
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "sr-only", children: "Valideringsfel" }),
1038
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "errorText", children: questionObject.validationDefaultMessesege })
1039
- ] }),
1040
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1041
- ExploreFilesStandard_default,
1042
- {
1043
- FilesSelected: onDrop,
1044
- numberOfFiles,
1045
- allowedNumberOfFiles,
1046
- activatedLanguage,
1047
- inputId,
1048
- labelId,
1049
- aboutId,
1050
- errorId,
1051
- questionObject,
1052
- errorMessageAddingFile,
1053
- removeUploadErrors: handleRemoveErrors
1054
- }
1055
- ),
1056
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1057
- DropFilesStandard_default,
1058
- {
1059
- FilesSelected: onDrop,
1060
- DropFilesText: dropFilesText,
1061
- language: activatedLanguage
1062
- }
1063
- ),
1064
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1065
- SelectedFilesStandard_default,
1066
- {
1067
- questionObject,
1068
- isTouched: handleQuestionInputChange,
1069
- removeFile: removeFileFromNumberOfFiles,
1070
- removeError,
1071
- errorMessageAddingFile,
1072
- activatedLanguage,
1073
- numberOfFiles,
1074
- setNumberOfFiles,
1075
- removeUploadErrors: handleRemoveErrors
1076
- }
1077
- )
1078
- ] }) }),
1042
+ questionObject.hasValidationError && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "pts-root-error error addfileserror", id: errorId, children: [
1043
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { "aria-hidden": true, className: "errorDot", children: "!" }),
1044
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "sr-only", children: "Valideringsfel" }),
1045
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "errorText", children: questionObject.validationDefaultMessesege })
1046
+ ] }),
1047
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1048
+ ExploreFilesStandard_default,
1049
+ {
1050
+ FilesSelected: onDrop,
1051
+ numberOfFiles,
1052
+ allowedNumberOfFiles,
1053
+ activatedLanguage,
1054
+ inputId,
1055
+ labelId,
1056
+ aboutId,
1057
+ errorId,
1058
+ questionObject,
1059
+ errorMessageAddingFile,
1060
+ removeUploadErrors: handleRemoveErrors
1061
+ }
1062
+ ),
1063
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1064
+ DropFilesStandard_default,
1065
+ {
1066
+ FilesSelected: onDrop,
1067
+ DropFilesText: dropFilesText,
1068
+ language: activatedLanguage
1069
+ }
1070
+ ),
1071
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1072
+ SelectedFilesStandard_default,
1073
+ {
1074
+ questionObject,
1075
+ isTouched: handleQuestionInputChange,
1076
+ removeFile: removeFileFromNumberOfFiles,
1077
+ removeError,
1078
+ errorMessageAddingFile,
1079
+ activatedLanguage,
1080
+ numberOfFiles,
1081
+ setNumberOfFiles,
1082
+ removeUploadErrors: handleRemoveErrors
1083
+ }
1084
+ )
1085
+ ] })
1086
+ }
1087
+ ),
1079
1088
  showPreview && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PreviewAddFiles, { activatedLanguage, questionObject })
1080
1089
  ] });
1081
1090
  };