optimized-react-component-library-xyz123 0.1.36 → 0.1.38

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
@@ -118,10 +118,10 @@ var RadioMultipleStandard_default = InputRadio;
118
118
  var PreviewRadio = ({ question }) => {
119
119
  var _a, _b;
120
120
  const previewId = `preview-${question.id}`;
121
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "pts-question-preview pts-radioMultiple-preview", id: `question-${previewId}`, children: [
122
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { id: previewId, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
123
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "pts-root-answer", "aria-labelledby": previewId, children: ((_b = question.answer) == null ? void 0 : _b.trim()) ? question.answer : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "no-answer-preview-page", children: "Inget svar" }) })
124
- ] }) });
121
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
122
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("dt", { id: `question-${previewId}`, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
123
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("dd", { className: "pts-radioMultiple-preview pts-root-answer", id: `answer-${previewId}`, children: ((_b = question.answer) == null ? void 0 : _b.trim()) ? question.answer : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "no-answer-preview-page", children: "Inget svar" }) })
124
+ ] });
125
125
  };
126
126
 
127
127
  // src/NewInputComponentStandard/MultipleCheckboxesStandard/MultipleCheckboxesStandard.tsx
@@ -193,20 +193,16 @@ var PrevieMultipleCheckboxes = ({
193
193
  }) => {
194
194
  var _a, _b;
195
195
  const previewId = `preview-${question.id}`;
196
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
197
- "div",
198
- {
199
- className: "pts-question-preview pts-multipleCheckboxes-preview",
200
- id: `question-${previewId}`,
201
- children: [
202
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { id: previewId, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
203
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "pts-root-answer", children: question.answer ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("ul", { "aria-labelledby": previewId, children: (_b = question.options) == null ? void 0 : _b.filter((option) => {
204
- var _a2;
205
- return (_a2 = question.answer) == null ? void 0 : _a2.includes(option.label);
206
- }).map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("li", { children: option.label }, index)) }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "no-answer-preview-page", children: activatedLanguage === "en" ? "No Answer" : "Inget svar" }) })
207
- ]
208
- }
209
- ) });
196
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
197
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("dt", { id: `question-${previewId}`, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
198
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("dd", { className: "pts-multipleCheckboxes-preview pts-root-answer", id: `answer-${previewId}`, children: [
199
+ question.answer ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("ul", { "aria-labelledby": previewId, children: (_b = question.options) == null ? void 0 : _b.filter((option) => {
200
+ var _a2;
201
+ return (_a2 = question.answer) == null ? void 0 : _a2.includes(option.label);
202
+ }).map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("li", { children: option.label }, index)) }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "no-answer-preview-page", children: activatedLanguage === "en" ? "No Answer" : "Inget svar" }),
203
+ " "
204
+ ] })
205
+ ] });
210
206
  };
211
207
 
212
208
  // src/NewInputComponentStandard/TextAreaStandard/TextAreaStandard.tsx
@@ -292,10 +288,10 @@ var PreviewTextarea = ({
292
288
  }) => {
293
289
  var _a, _b;
294
290
  const previewId = `preview-${question.id}`;
295
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "pts-question-preview pts-textArea-preview", id: `question-${previewId}`, children: [
296
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h3", { id: previewId, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
297
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "pts-root-answer", "aria-labelledby": previewId, children: ((_b = question.answer) == null ? void 0 : _b.trim()) ? question.answer : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "no-answer-preview-page", children: activatedLanguage === "en" ? "No Answer" : "Inget svar" }) })
298
- ] }) });
291
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
292
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("dt", { id: `question-${previewId}`, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
293
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("dd", { className: "pts-textArea-preview pts-root-answer", id: `answer-${previewId}`, children: ((_b = question.answer) == null ? void 0 : _b.trim()) ? question.answer : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "no-answer-preview-page", children: activatedLanguage === "en" ? "No Answer" : "Inget svar" }) })
294
+ ] });
299
295
  };
300
296
 
301
297
  // src/NewInputComponentStandard/TextFieldStandard/TextFieldStandard.tsx
@@ -371,10 +367,10 @@ var PreviewTextField = ({
371
367
  }) => {
372
368
  var _a, _b;
373
369
  const previewId = `preview-${question.id}`;
374
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "pts-question-preview pts-textField-preview", id: `question-${previewId}`, children: [
375
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h3", { id: previewId, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
376
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "pts-root-answer", "aria-labelledby": previewId, children: ((_b = question.answer) == null ? void 0 : _b.trim()) ? question.answer : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "no-answer-preview-page", children: activatedLanguage === "en" ? "No Answer" : "Inget svar" }) })
377
- ] }) });
370
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
371
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dt", { id: `question-${previewId}`, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
372
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dd", { className: "pts-textField-preview pts-root-answer", id: `answer-${previewId}`, children: ((_b = question.answer) == null ? void 0 : _b.trim()) ? question.answer : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "no-answer-preview-page", children: activatedLanguage === "en" ? "No Answer" : "Inget svar" }) })
373
+ ] });
378
374
  };
379
375
 
380
376
  // src/NewInputComponentStandard/FilesUploadStandard/FilesUploadStandard.tsx
@@ -2066,6 +2062,24 @@ var ValidationErrorSummaryList = ({
2066
2062
  }) => {
2067
2063
  console.log(formQuestions);
2068
2064
  console.log(validationErrorsList);
2065
+ function filterIdsByGroupCheck(ids, questions) {
2066
+ var _a;
2067
+ const tailIds = /* @__PURE__ */ new Set();
2068
+ for (const q of questions) {
2069
+ const rules = (_a = q.validationType) != null ? _a : [];
2070
+ for (const rule of rules) {
2071
+ const m = /^groupCheck-(\d+(?:-\d+)*)$/.exec(rule.trim());
2072
+ if (!m) continue;
2073
+ const nums = m[1].split("-").map((s) => Number(s)).filter((n) => Number.isFinite(n));
2074
+ if (nums.length > 1) {
2075
+ for (let i = 1; i < nums.length; i++) {
2076
+ tailIds.add(nums[i]);
2077
+ }
2078
+ }
2079
+ }
2080
+ }
2081
+ return ids.filter((id) => !tailIds.has(id));
2082
+ }
2069
2083
  function scrollToQuestion(questionId) {
2070
2084
  const container = document.getElementById(`question-${questionId}`);
2071
2085
  if (container) {
@@ -2079,7 +2093,8 @@ var ValidationErrorSummaryList = ({
2079
2093
  }
2080
2094
  }
2081
2095
  if (!validationErrorsList.length) return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, {});
2082
- const count = validationErrorsList.length;
2096
+ const filteredIds = filterIdsByGroupCheck(validationErrorsList, formQuestions);
2097
+ const count = filteredIds.length;
2083
2098
  const title = summaryText.replace("{count}", count.toString()).replace("{plural}", count === 1 ? "sak" : "saker");
2084
2099
  function getQuestionLabelById(id) {
2085
2100
  const found = formQuestions.find((item) => item.id === id);
@@ -2089,7 +2104,7 @@ var ValidationErrorSummaryList = ({
2089
2104
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { "aria-hidden": "true", className: "errorDot", children: "!" }),
2090
2105
  /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "errorSummary-content", id: "pts-errorSummary-content", children: [
2091
2106
  /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("h2", { children: title }),
2092
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("ul", { children: validationErrorsList.map((questionId, i) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2107
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("ul", { children: filteredIds.map((questionId, i) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2093
2108
  "a",
2094
2109
  {
2095
2110
  href: `#question-${questionId}`,
package/dist/index.mjs CHANGED
@@ -54,10 +54,10 @@ var RadioMultipleStandard_default = InputRadio;
54
54
  var PreviewRadio = ({ question }) => {
55
55
  var _a, _b;
56
56
  const previewId = `preview-${question.id}`;
57
- return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: "pts-question-preview pts-radioMultiple-preview", id: `question-${previewId}`, children: [
58
- /* @__PURE__ */ jsx("h3", { id: previewId, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
59
- /* @__PURE__ */ jsx("div", { className: "pts-root-answer", "aria-labelledby": previewId, children: ((_b = question.answer) == null ? void 0 : _b.trim()) ? question.answer : /* @__PURE__ */ jsx("span", { className: "no-answer-preview-page", children: "Inget svar" }) })
60
- ] }) });
57
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
58
+ /* @__PURE__ */ jsx("dt", { id: `question-${previewId}`, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
59
+ /* @__PURE__ */ jsx("dd", { className: "pts-radioMultiple-preview pts-root-answer", id: `answer-${previewId}`, children: ((_b = question.answer) == null ? void 0 : _b.trim()) ? question.answer : /* @__PURE__ */ jsx("span", { className: "no-answer-preview-page", children: "Inget svar" }) })
60
+ ] });
61
61
  };
62
62
 
63
63
  // src/NewInputComponentStandard/MultipleCheckboxesStandard/MultipleCheckboxesStandard.tsx
@@ -129,20 +129,16 @@ var PrevieMultipleCheckboxes = ({
129
129
  }) => {
130
130
  var _a, _b;
131
131
  const previewId = `preview-${question.id}`;
132
- return /* @__PURE__ */ jsx2(Fragment2, { children: /* @__PURE__ */ jsxs2(
133
- "div",
134
- {
135
- className: "pts-question-preview pts-multipleCheckboxes-preview",
136
- id: `question-${previewId}`,
137
- children: [
138
- /* @__PURE__ */ jsx2("h3", { id: previewId, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
139
- /* @__PURE__ */ jsx2("div", { className: "pts-root-answer", children: question.answer ? /* @__PURE__ */ jsx2("ul", { "aria-labelledby": previewId, children: (_b = question.options) == null ? void 0 : _b.filter((option) => {
140
- var _a2;
141
- return (_a2 = question.answer) == null ? void 0 : _a2.includes(option.label);
142
- }).map((option, index) => /* @__PURE__ */ jsx2("li", { children: option.label }, index)) }) : /* @__PURE__ */ jsx2("span", { className: "no-answer-preview-page", children: activatedLanguage === "en" ? "No Answer" : "Inget svar" }) })
143
- ]
144
- }
145
- ) });
132
+ return /* @__PURE__ */ jsxs2(Fragment2, { children: [
133
+ /* @__PURE__ */ jsx2("dt", { id: `question-${previewId}`, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
134
+ /* @__PURE__ */ jsxs2("dd", { className: "pts-multipleCheckboxes-preview pts-root-answer", id: `answer-${previewId}`, children: [
135
+ question.answer ? /* @__PURE__ */ jsx2("ul", { "aria-labelledby": previewId, children: (_b = question.options) == null ? void 0 : _b.filter((option) => {
136
+ var _a2;
137
+ return (_a2 = question.answer) == null ? void 0 : _a2.includes(option.label);
138
+ }).map((option, index) => /* @__PURE__ */ jsx2("li", { children: option.label }, index)) }) : /* @__PURE__ */ jsx2("span", { className: "no-answer-preview-page", children: activatedLanguage === "en" ? "No Answer" : "Inget svar" }),
139
+ " "
140
+ ] })
141
+ ] });
146
142
  };
147
143
 
148
144
  // src/NewInputComponentStandard/TextAreaStandard/TextAreaStandard.tsx
@@ -228,10 +224,10 @@ var PreviewTextarea = ({
228
224
  }) => {
229
225
  var _a, _b;
230
226
  const previewId = `preview-${question.id}`;
231
- return /* @__PURE__ */ jsx3(Fragment3, { children: /* @__PURE__ */ jsxs3("div", { className: "pts-question-preview pts-textArea-preview", id: `question-${previewId}`, children: [
232
- /* @__PURE__ */ jsx3("h3", { id: previewId, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
233
- /* @__PURE__ */ jsx3("div", { className: "pts-root-answer", "aria-labelledby": previewId, children: ((_b = question.answer) == null ? void 0 : _b.trim()) ? question.answer : /* @__PURE__ */ jsx3("span", { className: "no-answer-preview-page", children: activatedLanguage === "en" ? "No Answer" : "Inget svar" }) })
234
- ] }) });
227
+ return /* @__PURE__ */ jsxs3(Fragment3, { children: [
228
+ /* @__PURE__ */ jsx3("dt", { id: `question-${previewId}`, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
229
+ /* @__PURE__ */ jsx3("dd", { className: "pts-textArea-preview pts-root-answer", id: `answer-${previewId}`, children: ((_b = question.answer) == null ? void 0 : _b.trim()) ? question.answer : /* @__PURE__ */ jsx3("span", { className: "no-answer-preview-page", children: activatedLanguage === "en" ? "No Answer" : "Inget svar" }) })
230
+ ] });
235
231
  };
236
232
 
237
233
  // src/NewInputComponentStandard/TextFieldStandard/TextFieldStandard.tsx
@@ -307,10 +303,10 @@ var PreviewTextField = ({
307
303
  }) => {
308
304
  var _a, _b;
309
305
  const previewId = `preview-${question.id}`;
310
- return /* @__PURE__ */ jsx4(Fragment4, { children: /* @__PURE__ */ jsxs4("div", { className: "pts-question-preview pts-textField-preview", id: `question-${previewId}`, children: [
311
- /* @__PURE__ */ jsx4("h3", { id: previewId, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
312
- /* @__PURE__ */ jsx4("div", { className: "pts-root-answer", "aria-labelledby": previewId, children: ((_b = question.answer) == null ? void 0 : _b.trim()) ? question.answer : /* @__PURE__ */ jsx4("span", { className: "no-answer-preview-page", children: activatedLanguage === "en" ? "No Answer" : "Inget svar" }) })
313
- ] }) });
306
+ return /* @__PURE__ */ jsxs4(Fragment4, { children: [
307
+ /* @__PURE__ */ jsx4("dt", { id: `question-${previewId}`, children: (_a = question.previewLabel) != null ? _a : question.questionLabel }),
308
+ /* @__PURE__ */ jsx4("dd", { className: "pts-textField-preview pts-root-answer", id: `answer-${previewId}`, children: ((_b = question.answer) == null ? void 0 : _b.trim()) ? question.answer : /* @__PURE__ */ jsx4("span", { className: "no-answer-preview-page", children: activatedLanguage === "en" ? "No Answer" : "Inget svar" }) })
309
+ ] });
314
310
  };
315
311
 
316
312
  // src/NewInputComponentStandard/FilesUploadStandard/FilesUploadStandard.tsx
@@ -2002,6 +1998,24 @@ var ValidationErrorSummaryList = ({
2002
1998
  }) => {
2003
1999
  console.log(formQuestions);
2004
2000
  console.log(validationErrorsList);
2001
+ function filterIdsByGroupCheck(ids, questions) {
2002
+ var _a;
2003
+ const tailIds = /* @__PURE__ */ new Set();
2004
+ for (const q of questions) {
2005
+ const rules = (_a = q.validationType) != null ? _a : [];
2006
+ for (const rule of rules) {
2007
+ const m = /^groupCheck-(\d+(?:-\d+)*)$/.exec(rule.trim());
2008
+ if (!m) continue;
2009
+ const nums = m[1].split("-").map((s) => Number(s)).filter((n) => Number.isFinite(n));
2010
+ if (nums.length > 1) {
2011
+ for (let i = 1; i < nums.length; i++) {
2012
+ tailIds.add(nums[i]);
2013
+ }
2014
+ }
2015
+ }
2016
+ }
2017
+ return ids.filter((id) => !tailIds.has(id));
2018
+ }
2005
2019
  function scrollToQuestion(questionId) {
2006
2020
  const container = document.getElementById(`question-${questionId}`);
2007
2021
  if (container) {
@@ -2015,7 +2029,8 @@ var ValidationErrorSummaryList = ({
2015
2029
  }
2016
2030
  }
2017
2031
  if (!validationErrorsList.length) return /* @__PURE__ */ jsx20(Fragment9, {});
2018
- const count = validationErrorsList.length;
2032
+ const filteredIds = filterIdsByGroupCheck(validationErrorsList, formQuestions);
2033
+ const count = filteredIds.length;
2019
2034
  const title = summaryText.replace("{count}", count.toString()).replace("{plural}", count === 1 ? "sak" : "saker");
2020
2035
  function getQuestionLabelById(id) {
2021
2036
  const found = formQuestions.find((item) => item.id === id);
@@ -2025,7 +2040,7 @@ var ValidationErrorSummaryList = ({
2025
2040
  /* @__PURE__ */ jsx20("span", { "aria-hidden": "true", className: "errorDot", children: "!" }),
2026
2041
  /* @__PURE__ */ jsxs18("div", { className: "errorSummary-content", id: "pts-errorSummary-content", children: [
2027
2042
  /* @__PURE__ */ jsx20("h2", { children: title }),
2028
- /* @__PURE__ */ jsx20("ul", { children: validationErrorsList.map((questionId, i) => /* @__PURE__ */ jsx20("li", { children: /* @__PURE__ */ jsx20(
2043
+ /* @__PURE__ */ jsx20("ul", { children: filteredIds.map((questionId, i) => /* @__PURE__ */ jsx20("li", { children: /* @__PURE__ */ jsx20(
2029
2044
  "a",
2030
2045
  {
2031
2046
  href: `#question-${questionId}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "optimized-react-component-library-xyz123",
3
- "version": "0.1.36",
3
+ "version": "0.1.38",
4
4
  "description": "A modern React component library using TypeScript with React 19 support.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",