optimized-react-component-library-xyz123 0.1.134 → 0.1.136
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.d.mts +22 -6
- package/dist/index.d.ts +22 -6
- package/dist/index.js +30 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +30 -20
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -115,7 +115,7 @@ interface IStepQuestionData {
|
|
|
115
115
|
|
|
116
116
|
interface RadioProps {
|
|
117
117
|
question: IQuestion;
|
|
118
|
-
|
|
118
|
+
handleQuestionInputChange: any;
|
|
119
119
|
showPreview?: boolean;
|
|
120
120
|
}
|
|
121
121
|
|
|
@@ -123,7 +123,7 @@ declare const InputRadio: FC<RadioProps>;
|
|
|
123
123
|
|
|
124
124
|
interface MultipleCheckboxesProps {
|
|
125
125
|
question: IQuestion;
|
|
126
|
-
|
|
126
|
+
handleQuestionInputChange: any;
|
|
127
127
|
showPreview?: boolean;
|
|
128
128
|
activatedLanguage?: string;
|
|
129
129
|
}
|
|
@@ -132,7 +132,7 @@ declare const MultipleCheckboxes: FC<MultipleCheckboxesProps>;
|
|
|
132
132
|
|
|
133
133
|
interface TextAreaProps {
|
|
134
134
|
question: IQuestion;
|
|
135
|
-
|
|
135
|
+
handleQuestionInputChange: any;
|
|
136
136
|
showPreview?: boolean;
|
|
137
137
|
activatedLanguage?: string;
|
|
138
138
|
}
|
|
@@ -141,7 +141,7 @@ declare const InputTextarea: FC<TextAreaProps>;
|
|
|
141
141
|
|
|
142
142
|
interface TextFieldStandardProps {
|
|
143
143
|
question: IQuestion;
|
|
144
|
-
|
|
144
|
+
handleQuestionInputChange: any;
|
|
145
145
|
showPreview?: boolean;
|
|
146
146
|
activatedLanguage?: string;
|
|
147
147
|
}
|
|
@@ -150,7 +150,7 @@ declare const TextFieldStandard: FC<TextFieldStandardProps>;
|
|
|
150
150
|
|
|
151
151
|
interface AddFilesProps {
|
|
152
152
|
questionObject: IQuestion;
|
|
153
|
-
|
|
153
|
+
handleQuestionInputChange: any;
|
|
154
154
|
visible?: boolean;
|
|
155
155
|
showPreview?: boolean;
|
|
156
156
|
activatedLanguage?: string;
|
|
@@ -637,7 +637,23 @@ declare const useCookieConsent: ({ cookieName, choiceKey, expiryYears, onConsent
|
|
|
637
637
|
rejectCookies: () => void;
|
|
638
638
|
};
|
|
639
639
|
|
|
640
|
-
|
|
640
|
+
/**
|
|
641
|
+
* Renderar rätt input-komponent baserat på frågans `questionType`.
|
|
642
|
+
*
|
|
643
|
+
* Denna komponent fungerar som en central "switch" som avgör vilken
|
|
644
|
+
* formulärkomponent (TextField, Radio, Checkbox, FileUpload, TextArea osv.)
|
|
645
|
+
* som ska användas för en given fråga.
|
|
646
|
+
*
|
|
647
|
+
* @param {object} question - Frågeobjektet som innehåller all metadata
|
|
648
|
+
* (questionType, id, svarsalternativ, synlighet, beskrivningar m.m.).
|
|
649
|
+
* @param {Function} handleQuestionInputChange - Event-handler som skickas vidare
|
|
650
|
+
* till underliggande komponenter och triggas när användaren ändrar ett svar.
|
|
651
|
+
* @param {string} activatedLanguage - Det aktiva språket som vissa
|
|
652
|
+
* input-komponenter använder för att visa etiketter och texter.
|
|
653
|
+
* @param {boolean} showPreview - Styr om frågan ska visas i
|
|
654
|
+
* preview-läge istället för som redigerbar input.
|
|
655
|
+
*/
|
|
656
|
+
declare const QuestionRenderer: ({ question, handleQuestionInputChange, activatedLanguage, showPreview, }: any) => react_jsx_runtime.JSX.Element;
|
|
641
657
|
|
|
642
658
|
type WrapperElement = 'fieldset' | 'section' | 'div' | 'none';
|
|
643
659
|
interface Question {
|
package/dist/index.d.ts
CHANGED
|
@@ -115,7 +115,7 @@ interface IStepQuestionData {
|
|
|
115
115
|
|
|
116
116
|
interface RadioProps {
|
|
117
117
|
question: IQuestion;
|
|
118
|
-
|
|
118
|
+
handleQuestionInputChange: any;
|
|
119
119
|
showPreview?: boolean;
|
|
120
120
|
}
|
|
121
121
|
|
|
@@ -123,7 +123,7 @@ declare const InputRadio: FC<RadioProps>;
|
|
|
123
123
|
|
|
124
124
|
interface MultipleCheckboxesProps {
|
|
125
125
|
question: IQuestion;
|
|
126
|
-
|
|
126
|
+
handleQuestionInputChange: any;
|
|
127
127
|
showPreview?: boolean;
|
|
128
128
|
activatedLanguage?: string;
|
|
129
129
|
}
|
|
@@ -132,7 +132,7 @@ declare const MultipleCheckboxes: FC<MultipleCheckboxesProps>;
|
|
|
132
132
|
|
|
133
133
|
interface TextAreaProps {
|
|
134
134
|
question: IQuestion;
|
|
135
|
-
|
|
135
|
+
handleQuestionInputChange: any;
|
|
136
136
|
showPreview?: boolean;
|
|
137
137
|
activatedLanguage?: string;
|
|
138
138
|
}
|
|
@@ -141,7 +141,7 @@ declare const InputTextarea: FC<TextAreaProps>;
|
|
|
141
141
|
|
|
142
142
|
interface TextFieldStandardProps {
|
|
143
143
|
question: IQuestion;
|
|
144
|
-
|
|
144
|
+
handleQuestionInputChange: any;
|
|
145
145
|
showPreview?: boolean;
|
|
146
146
|
activatedLanguage?: string;
|
|
147
147
|
}
|
|
@@ -150,7 +150,7 @@ declare const TextFieldStandard: FC<TextFieldStandardProps>;
|
|
|
150
150
|
|
|
151
151
|
interface AddFilesProps {
|
|
152
152
|
questionObject: IQuestion;
|
|
153
|
-
|
|
153
|
+
handleQuestionInputChange: any;
|
|
154
154
|
visible?: boolean;
|
|
155
155
|
showPreview?: boolean;
|
|
156
156
|
activatedLanguage?: string;
|
|
@@ -637,7 +637,23 @@ declare const useCookieConsent: ({ cookieName, choiceKey, expiryYears, onConsent
|
|
|
637
637
|
rejectCookies: () => void;
|
|
638
638
|
};
|
|
639
639
|
|
|
640
|
-
|
|
640
|
+
/**
|
|
641
|
+
* Renderar rätt input-komponent baserat på frågans `questionType`.
|
|
642
|
+
*
|
|
643
|
+
* Denna komponent fungerar som en central "switch" som avgör vilken
|
|
644
|
+
* formulärkomponent (TextField, Radio, Checkbox, FileUpload, TextArea osv.)
|
|
645
|
+
* som ska användas för en given fråga.
|
|
646
|
+
*
|
|
647
|
+
* @param {object} question - Frågeobjektet som innehåller all metadata
|
|
648
|
+
* (questionType, id, svarsalternativ, synlighet, beskrivningar m.m.).
|
|
649
|
+
* @param {Function} handleQuestionInputChange - Event-handler som skickas vidare
|
|
650
|
+
* till underliggande komponenter och triggas när användaren ändrar ett svar.
|
|
651
|
+
* @param {string} activatedLanguage - Det aktiva språket som vissa
|
|
652
|
+
* input-komponenter använder för att visa etiketter och texter.
|
|
653
|
+
* @param {boolean} showPreview - Styr om frågan ska visas i
|
|
654
|
+
* preview-läge istället för som redigerbar input.
|
|
655
|
+
*/
|
|
656
|
+
declare const QuestionRenderer: ({ question, handleQuestionInputChange, activatedLanguage, showPreview, }: any) => react_jsx_runtime.JSX.Element;
|
|
641
657
|
|
|
642
658
|
type WrapperElement = 'fieldset' | 'section' | 'div' | 'none';
|
|
643
659
|
interface Question {
|
package/dist/index.js
CHANGED
|
@@ -81,14 +81,18 @@ module.exports = __toCommonJS(index_exports);
|
|
|
81
81
|
|
|
82
82
|
// src/components/input-components/RadioMultipleStandard/RadioMultipleStandard.tsx
|
|
83
83
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
84
|
-
var InputRadio = ({
|
|
84
|
+
var InputRadio = ({
|
|
85
|
+
question,
|
|
86
|
+
handleQuestionInputChange,
|
|
87
|
+
showPreview = false
|
|
88
|
+
}) => {
|
|
85
89
|
var _a;
|
|
86
90
|
const questionId = `question-${question.id}`;
|
|
87
91
|
const groupId = `radio-group-${question.id}`;
|
|
88
92
|
const errorId = `error-${question.id}`;
|
|
89
93
|
const handleInputChange = (event) => {
|
|
90
94
|
const e = { target: { value: event.target.value } };
|
|
91
|
-
|
|
95
|
+
handleQuestionInputChange(e, question);
|
|
92
96
|
};
|
|
93
97
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
94
98
|
!showPreview && question.visible && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "pts-root-question pts-radioMultiple-container", id: questionId, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
@@ -151,7 +155,7 @@ var import_react = require("react");
|
|
|
151
155
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
152
156
|
var MultipleCheckboxes = ({
|
|
153
157
|
question,
|
|
154
|
-
|
|
158
|
+
handleQuestionInputChange,
|
|
155
159
|
showPreview = false,
|
|
156
160
|
activatedLanguage = "sv"
|
|
157
161
|
}) => {
|
|
@@ -176,7 +180,7 @@ var MultipleCheckboxes = ({
|
|
|
176
180
|
}
|
|
177
181
|
setCheckedValues(updatedValues);
|
|
178
182
|
const e = { target: { value: updatedValues.toString() } };
|
|
179
|
-
|
|
183
|
+
handleQuestionInputChange(e, question);
|
|
180
184
|
};
|
|
181
185
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
182
186
|
!showPreview && question.visible && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { id: questionId, className: "pts-root-question pts-multipleCheckboxes-container", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("fieldset", { children: [
|
|
@@ -229,7 +233,7 @@ var import_dompurify = __toESM(require("dompurify"));
|
|
|
229
233
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
230
234
|
var InputTextarea = ({
|
|
231
235
|
question,
|
|
232
|
-
|
|
236
|
+
handleQuestionInputChange,
|
|
233
237
|
showPreview = false,
|
|
234
238
|
activatedLanguage
|
|
235
239
|
}) => {
|
|
@@ -265,7 +269,7 @@ var InputTextarea = ({
|
|
|
265
269
|
"textarea",
|
|
266
270
|
{
|
|
267
271
|
className: question.hasValidationError ? "pts-root-question-input-error-border" : void 0,
|
|
268
|
-
onChange: (e) =>
|
|
272
|
+
onChange: (e) => handleQuestionInputChange(e, question),
|
|
269
273
|
value: question.answer,
|
|
270
274
|
required: question.isQuestionMandatory,
|
|
271
275
|
"aria-required": question.isQuestionMandatory,
|
|
@@ -325,7 +329,7 @@ var import_dompurify2 = __toESM(require("dompurify"));
|
|
|
325
329
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
326
330
|
var TextFieldStandard = ({
|
|
327
331
|
question,
|
|
328
|
-
|
|
332
|
+
handleQuestionInputChange,
|
|
329
333
|
showPreview = false,
|
|
330
334
|
activatedLanguage
|
|
331
335
|
}) => {
|
|
@@ -365,7 +369,7 @@ var TextFieldStandard = ({
|
|
|
365
369
|
inputMode: (_g = (_f = question.questionExtraAttribute) == null ? void 0 : _f.inputMode) != null ? _g : void 0,
|
|
366
370
|
name: `question-name-${question.id}`,
|
|
367
371
|
className: question.hasValidationError ? "pts-root-question-input-error-border" : void 0,
|
|
368
|
-
onChange: (e) =>
|
|
372
|
+
onChange: (e) => handleQuestionInputChange(e, question),
|
|
369
373
|
value: question.answer,
|
|
370
374
|
maxLength: ((_h = question.questionExtraAttribute) == null ? void 0 : _h.answerMaxLength) || defaultMaxLength,
|
|
371
375
|
id: inputId,
|
|
@@ -739,7 +743,7 @@ var SelectedFilesStandard_default = SelectedFiles;
|
|
|
739
743
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
740
744
|
var AddFiles = ({
|
|
741
745
|
questionObject,
|
|
742
|
-
|
|
746
|
+
handleQuestionInputChange = (e, questionObject2) => {
|
|
743
747
|
alert("no function");
|
|
744
748
|
},
|
|
745
749
|
visible,
|
|
@@ -890,7 +894,7 @@ var AddFiles = ({
|
|
|
890
894
|
files: [...currentFiles, ...newFiles]
|
|
891
895
|
}
|
|
892
896
|
};
|
|
893
|
-
|
|
897
|
+
handleQuestionInputChange(e, questionObject);
|
|
894
898
|
setNumberOfFiles(currentFiles.length + newFiles.length);
|
|
895
899
|
setNewFiles([]);
|
|
896
900
|
}
|
|
@@ -960,7 +964,7 @@ var AddFiles = ({
|
|
|
960
964
|
SelectedFilesStandard_default,
|
|
961
965
|
{
|
|
962
966
|
questionObject,
|
|
963
|
-
isTouched,
|
|
967
|
+
isTouched: handleQuestionInputChange,
|
|
964
968
|
removeFile: removeFileFromNumberOfFiles,
|
|
965
969
|
removeError,
|
|
966
970
|
errorMessageAddingFile,
|
|
@@ -1695,7 +1699,7 @@ var useCookieConsent = ({
|
|
|
1695
1699
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1696
1700
|
var QuestionRenderer = ({
|
|
1697
1701
|
question,
|
|
1698
|
-
|
|
1702
|
+
handleQuestionInputChange,
|
|
1699
1703
|
activatedLanguage = "sv",
|
|
1700
1704
|
showPreview = false
|
|
1701
1705
|
}) => {
|
|
@@ -1704,7 +1708,7 @@ var QuestionRenderer = ({
|
|
|
1704
1708
|
RadioMultipleStandard_default,
|
|
1705
1709
|
{
|
|
1706
1710
|
question,
|
|
1707
|
-
|
|
1711
|
+
handleQuestionInputChange,
|
|
1708
1712
|
showPreview
|
|
1709
1713
|
}
|
|
1710
1714
|
),
|
|
@@ -1712,7 +1716,7 @@ var QuestionRenderer = ({
|
|
|
1712
1716
|
TextFieldStandard_default,
|
|
1713
1717
|
{
|
|
1714
1718
|
question,
|
|
1715
|
-
|
|
1719
|
+
handleQuestionInputChange,
|
|
1716
1720
|
showPreview,
|
|
1717
1721
|
activatedLanguage
|
|
1718
1722
|
}
|
|
@@ -1721,7 +1725,7 @@ var QuestionRenderer = ({
|
|
|
1721
1725
|
AddFilesStandard_default,
|
|
1722
1726
|
{
|
|
1723
1727
|
questionObject: question,
|
|
1724
|
-
|
|
1728
|
+
handleQuestionInputChange,
|
|
1725
1729
|
showPreview,
|
|
1726
1730
|
activatedLanguage,
|
|
1727
1731
|
visible: question.visible
|
|
@@ -1731,12 +1735,19 @@ var QuestionRenderer = ({
|
|
|
1731
1735
|
MultipleCheckboxesStandard_default,
|
|
1732
1736
|
{
|
|
1733
1737
|
question,
|
|
1734
|
-
|
|
1738
|
+
handleQuestionInputChange,
|
|
1735
1739
|
showPreview,
|
|
1736
1740
|
activatedLanguage
|
|
1737
1741
|
}
|
|
1738
1742
|
),
|
|
1739
|
-
question.questionType === "TextArea" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1743
|
+
question.questionType === "TextArea" && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1744
|
+
TextAreaStandard_default,
|
|
1745
|
+
{
|
|
1746
|
+
question,
|
|
1747
|
+
handleQuestionInputChange,
|
|
1748
|
+
showPreview
|
|
1749
|
+
}
|
|
1750
|
+
)
|
|
1740
1751
|
] });
|
|
1741
1752
|
};
|
|
1742
1753
|
var QuestionRenderer_default = QuestionRenderer;
|
|
@@ -1770,10 +1781,9 @@ var QuestionGroup = ({
|
|
|
1770
1781
|
import_optimized_react_component_library_xyz123.QuestionRenderer,
|
|
1771
1782
|
{
|
|
1772
1783
|
question,
|
|
1773
|
-
|
|
1784
|
+
handleQuestionInputChange,
|
|
1774
1785
|
activatedLanguage,
|
|
1775
|
-
showPreview
|
|
1776
|
-
showConfigure: !showPreview
|
|
1786
|
+
showPreview
|
|
1777
1787
|
}
|
|
1778
1788
|
) }, "question-" + index);
|
|
1779
1789
|
}) });
|