@pareto-engineering/design-system 4.10.2 → 4.12.0
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/cjs/a/AreaChart/AreaChart.js +13 -5
- package/dist/cjs/d/index.js +1 -0
- package/dist/cjs/g/FormBuilder/FormBuilder.js +6 -3
- package/dist/cjs/g/FormBuilder/common/Builder/Builder.js +3 -1
- package/dist/cjs/g/FormBuilder/common/Builder/common/InputBuilder/InputBuilder.js +7 -10
- package/dist/cjs/g/FormBuilder/common/Builder/common/Section/Section.js +4 -2
- package/dist/cjs/g/FormBuilder/common/Renderer/Renderer.js +4 -2
- package/dist/cjs/g/FormBuilder/common/Renderer/common/Section/Section.js +10 -2
- package/dist/es/a/AreaChart/AreaChart.js +13 -5
- package/dist/es/d/index.js +1 -0
- package/dist/es/g/FormBuilder/FormBuilder.js +6 -3
- package/dist/es/g/FormBuilder/common/Builder/Builder.js +3 -1
- package/dist/es/g/FormBuilder/common/Builder/common/InputBuilder/InputBuilder.js +7 -10
- package/dist/es/g/FormBuilder/common/Builder/common/Section/Section.js +4 -2
- package/dist/es/g/FormBuilder/common/Renderer/Renderer.js +4 -2
- package/dist/es/g/FormBuilder/common/Renderer/common/Section/Section.js +42 -32
- package/package.json +2 -2
- package/src/ui/a/AreaChart/AreaChart.jsx +10 -3
- package/src/ui/d/index.js +1 -0
- package/src/ui/g/FormBuilder/FormBuilder.jsx +3 -0
- package/src/ui/g/FormBuilder/common/Builder/Builder.jsx +2 -0
- package/src/ui/g/FormBuilder/common/Builder/common/InputBuilder/InputBuilder.jsx +7 -22
- package/src/ui/g/FormBuilder/common/Builder/common/Section/Section.jsx +2 -0
- package/src/ui/g/FormBuilder/common/Renderer/Renderer.jsx +2 -0
- package/src/ui/g/FormBuilder/common/Renderer/common/Section/Section.jsx +64 -50
|
@@ -111,21 +111,29 @@ const AreaChart = _ref => {
|
|
|
111
111
|
value: xLabel,
|
|
112
112
|
position: 'insideBottom',
|
|
113
113
|
offset: -5
|
|
114
|
-
}
|
|
115
|
-
,
|
|
114
|
+
},
|
|
116
115
|
axisLine: false,
|
|
117
116
|
tickLine: false,
|
|
118
117
|
tickCount: 3
|
|
119
118
|
}), /*#__PURE__*/React.createElement(_recharts.YAxis, {
|
|
120
119
|
domain: yAxisBounds,
|
|
120
|
+
scale: "linear",
|
|
121
|
+
interval: "equidistantPreserveStart",
|
|
121
122
|
label: {
|
|
122
123
|
value: yLabel,
|
|
123
124
|
angle: -90,
|
|
124
|
-
position: '
|
|
125
|
-
offset:
|
|
125
|
+
position: 'left',
|
|
126
|
+
offset: 1,
|
|
127
|
+
style: {
|
|
128
|
+
textAnchor: 'middle'
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
padding: {
|
|
132
|
+
top: 10,
|
|
133
|
+
bottom: 10
|
|
126
134
|
},
|
|
127
135
|
axisLine: false,
|
|
128
|
-
tickLine:
|
|
136
|
+
tickLine: true,
|
|
129
137
|
tickFormatter: value => value.toFixed(2)
|
|
130
138
|
}), /*#__PURE__*/React.createElement(_recharts.Tooltip, {
|
|
131
139
|
content: /*#__PURE__*/React.createElement(CustomTooltipContent, null)
|
package/dist/cjs/d/index.js
CHANGED
|
@@ -40,7 +40,8 @@ const FormBuilder = _ref => {
|
|
|
40
40
|
initialBuilderValues,
|
|
41
41
|
fileUploadStatus,
|
|
42
42
|
handleFileDelete,
|
|
43
|
-
taskData
|
|
43
|
+
taskData,
|
|
44
|
+
customInputMap
|
|
44
45
|
// ...otherProps
|
|
45
46
|
} = _ref;
|
|
46
47
|
const formattedJson = JSON.stringify(taskData, null, 2);
|
|
@@ -56,7 +57,8 @@ const FormBuilder = _ref => {
|
|
|
56
57
|
formBuilderId: formBuilderId,
|
|
57
58
|
onSave: onBuilderFormSave,
|
|
58
59
|
onError: onBuilderError,
|
|
59
|
-
validate: onBuilderValidate
|
|
60
|
+
validate: onBuilderValidate,
|
|
61
|
+
customInputMap: customInputMap
|
|
60
62
|
}), mode === 'render' && /*#__PURE__*/React.createElement(_common.Renderer, {
|
|
61
63
|
formData: formData,
|
|
62
64
|
onSave: onRendererFormSave,
|
|
@@ -64,7 +66,8 @@ const FormBuilder = _ref => {
|
|
|
64
66
|
shouldSubmit: shouldSubmit,
|
|
65
67
|
fileUploadStatus: fileUploadStatus,
|
|
66
68
|
handleFileDelete: handleFileDelete,
|
|
67
|
-
onFileUpload: onFileUpload
|
|
69
|
+
onFileUpload: onFileUpload,
|
|
70
|
+
customInputMap: customInputMap
|
|
68
71
|
}));
|
|
69
72
|
};
|
|
70
73
|
FormBuilder.propTypes = {
|
|
@@ -42,6 +42,7 @@ const Builder = _ref => {
|
|
|
42
42
|
onError,
|
|
43
43
|
validate,
|
|
44
44
|
formBuilderId,
|
|
45
|
+
customInputMap,
|
|
45
46
|
initialValues = {}
|
|
46
47
|
// ...otherProps
|
|
47
48
|
} = _ref;
|
|
@@ -120,7 +121,8 @@ const Builder = _ref => {
|
|
|
120
121
|
remove,
|
|
121
122
|
values,
|
|
122
123
|
setFieldValue
|
|
123
|
-
})
|
|
124
|
+
}),
|
|
125
|
+
customInputMap: customInputMap
|
|
124
126
|
})), /*#__PURE__*/React.createElement("div", {
|
|
125
127
|
className: "section-footer"
|
|
126
128
|
}, /*#__PURE__*/React.createElement("button", {
|
|
@@ -36,8 +36,8 @@ const InputBuilder = _ref => {
|
|
|
36
36
|
style,
|
|
37
37
|
sectionIndex,
|
|
38
38
|
inputIndex,
|
|
39
|
-
onDelete
|
|
40
|
-
|
|
39
|
+
onDelete,
|
|
40
|
+
customInputMap
|
|
41
41
|
// ...otherProps
|
|
42
42
|
} = _ref;
|
|
43
43
|
const {
|
|
@@ -49,13 +49,6 @@ const InputBuilder = _ref => {
|
|
|
49
49
|
setFieldValue(`sections.${sectionIndex}.inputs.${inputIndex}.required`, !input?.required);
|
|
50
50
|
};
|
|
51
51
|
const [hasDescription, setHasDescription] = (0, _react.useState)(false);
|
|
52
|
-
|
|
53
|
-
// TODO: handle nav logic
|
|
54
|
-
// const handleToggleConditionalNavigation = () => {
|
|
55
|
-
// setFieldValue(`sections.${sectionIndex}.inputs.${inputIndex}.conditionalNavigation`,
|
|
56
|
-
// !input?.conditionalNavigation)
|
|
57
|
-
// }
|
|
58
|
-
|
|
59
52
|
const availableSections = values?.sections?.map((section, idx) => ({
|
|
60
53
|
value: idx,
|
|
61
54
|
label: `Go to ${section.title || `Untitled Section ${idx + 1}`}`
|
|
@@ -71,6 +64,7 @@ const InputBuilder = _ref => {
|
|
|
71
64
|
const handleToggleShowSpecificFileTypes = () => {
|
|
72
65
|
setFieldValue(`sections.${sectionIndex}.inputs.${inputIndex}.showSpecificFileTypes`, !input.showSpecificFileTypes);
|
|
73
66
|
};
|
|
67
|
+
const customInputTypes = customInputMap ? Object.keys(customInputMap) : [];
|
|
74
68
|
return /*#__PURE__*/React.createElement("div", {
|
|
75
69
|
id: id,
|
|
76
70
|
className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
|
|
@@ -110,7 +104,10 @@ const InputBuilder = _ref => {
|
|
|
110
104
|
}, {
|
|
111
105
|
value: 'file',
|
|
112
106
|
label: 'File upload'
|
|
113
|
-
}
|
|
107
|
+
}, ...(customInputTypes && customInputTypes.map(customInputKey => ({
|
|
108
|
+
value: customInputKey,
|
|
109
|
+
label: customInputMap[customInputKey].label
|
|
110
|
+
})))]
|
|
114
111
|
}), /*#__PURE__*/React.createElement("div", {
|
|
115
112
|
className: "controls"
|
|
116
113
|
}, /*#__PURE__*/React.createElement("button", {
|
|
@@ -33,7 +33,8 @@ const Section = _ref => {
|
|
|
33
33
|
className: userClassName,
|
|
34
34
|
style,
|
|
35
35
|
index,
|
|
36
|
-
handleDeleteSection
|
|
36
|
+
handleDeleteSection,
|
|
37
|
+
customInputMap
|
|
37
38
|
// ...otherProps
|
|
38
39
|
} = _ref;
|
|
39
40
|
const {
|
|
@@ -65,7 +66,8 @@ const Section = _ref => {
|
|
|
65
66
|
sectionIndex: index,
|
|
66
67
|
inputIndex: indx,
|
|
67
68
|
onDelete: handleDeleteInput,
|
|
68
|
-
onCopy: handleCopyInput
|
|
69
|
+
onCopy: handleCopyInput,
|
|
70
|
+
customInputMap: customInputMap
|
|
69
71
|
}),
|
|
70
72
|
identifier: input.name
|
|
71
73
|
}));
|
|
@@ -71,7 +71,8 @@ const Renderer = _ref => {
|
|
|
71
71
|
fileUploadStatus,
|
|
72
72
|
handleFileDelete,
|
|
73
73
|
onFileUpload,
|
|
74
|
-
shouldUpdateInputStateInRealTime = true
|
|
74
|
+
shouldUpdateInputStateInRealTime = true,
|
|
75
|
+
customInputMap
|
|
75
76
|
// ...otherProps
|
|
76
77
|
} = _ref;
|
|
77
78
|
const [currentSectionIndex, setCurrentSectionIndex] = (0, _react.useState)(0);
|
|
@@ -149,7 +150,8 @@ const Renderer = _ref => {
|
|
|
149
150
|
fileUploadStatus: fileUploadStatus,
|
|
150
151
|
handleFileDelete: handleFileDelete,
|
|
151
152
|
onFileUpload: onFileUpload,
|
|
152
|
-
sectionIndex: sectionIndex
|
|
153
|
+
sectionIndex: sectionIndex,
|
|
154
|
+
customInputMap: customInputMap
|
|
153
155
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
154
156
|
className: "navigator-container"
|
|
155
157
|
}, updatedFormData.sections.length > 1 && /*#__PURE__*/React.createElement(_b.Button, {
|
|
@@ -39,9 +39,11 @@ const Section = _ref => {
|
|
|
39
39
|
fileUploadStatus,
|
|
40
40
|
handleFileDelete,
|
|
41
41
|
onFileUpload,
|
|
42
|
-
sectionIndex
|
|
42
|
+
sectionIndex,
|
|
43
|
+
customInputMap
|
|
43
44
|
// ...otherProps
|
|
44
45
|
} = _ref;
|
|
46
|
+
const customInputTypes = customInputMap ? Object.keys(customInputMap) : [];
|
|
45
47
|
return /*#__PURE__*/React.createElement("div", {
|
|
46
48
|
id: id,
|
|
47
49
|
className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
|
|
@@ -53,7 +55,9 @@ const Section = _ref => {
|
|
|
53
55
|
name: "instructions"
|
|
54
56
|
}), inputs?.map((input, inputIndex) => {
|
|
55
57
|
const isFileInput = input.type === 'file';
|
|
56
|
-
|
|
58
|
+
const isCustomInput = customInputTypes.includes(input.type);
|
|
59
|
+
const CustomInputComponent = isCustomInput ? customInputMap[input.type].component : null;
|
|
60
|
+
return !isCustomInput ? /*#__PURE__*/React.createElement(_f.FormInput, _extends({
|
|
57
61
|
key: input.name
|
|
58
62
|
}, input, {
|
|
59
63
|
disabled: readOnly
|
|
@@ -72,6 +76,10 @@ const Section = _ref => {
|
|
|
72
76
|
}));
|
|
73
77
|
onFileUpload(filesToUpload);
|
|
74
78
|
}
|
|
79
|
+
})) : /*#__PURE__*/React.createElement(CustomInputComponent, _extends({
|
|
80
|
+
key: input.name
|
|
81
|
+
}, input, {
|
|
82
|
+
disabled: readOnly
|
|
75
83
|
}));
|
|
76
84
|
}));
|
|
77
85
|
};
|
|
@@ -98,21 +98,29 @@ const AreaChart = ({
|
|
|
98
98
|
value: xLabel,
|
|
99
99
|
position: 'insideBottom',
|
|
100
100
|
offset: -5
|
|
101
|
-
}
|
|
102
|
-
,
|
|
101
|
+
},
|
|
103
102
|
axisLine: false,
|
|
104
103
|
tickLine: false,
|
|
105
104
|
tickCount: 3
|
|
106
105
|
}), /*#__PURE__*/React.createElement(YAxis, {
|
|
107
106
|
domain: yAxisBounds,
|
|
107
|
+
scale: "linear",
|
|
108
|
+
interval: "equidistantPreserveStart",
|
|
108
109
|
label: {
|
|
109
110
|
value: yLabel,
|
|
110
111
|
angle: -90,
|
|
111
|
-
position: '
|
|
112
|
-
offset:
|
|
112
|
+
position: 'left',
|
|
113
|
+
offset: 1,
|
|
114
|
+
style: {
|
|
115
|
+
textAnchor: 'middle'
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
padding: {
|
|
119
|
+
top: 10,
|
|
120
|
+
bottom: 10
|
|
113
121
|
},
|
|
114
122
|
axisLine: false,
|
|
115
|
-
tickLine:
|
|
123
|
+
tickLine: true,
|
|
116
124
|
tickFormatter: value => value.toFixed(2)
|
|
117
125
|
}), /*#__PURE__*/React.createElement(Tooltip, {
|
|
118
126
|
content: /*#__PURE__*/React.createElement(CustomTooltipContent, null)
|
package/dist/es/d/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// export { Divider } from './Divider'
|
|
@@ -30,7 +30,8 @@ const FormBuilder = ({
|
|
|
30
30
|
initialBuilderValues,
|
|
31
31
|
fileUploadStatus,
|
|
32
32
|
handleFileDelete,
|
|
33
|
-
taskData
|
|
33
|
+
taskData,
|
|
34
|
+
customInputMap
|
|
34
35
|
// ...otherProps
|
|
35
36
|
}) => {
|
|
36
37
|
const formattedJson = JSON.stringify(taskData, null, 2);
|
|
@@ -46,7 +47,8 @@ const FormBuilder = ({
|
|
|
46
47
|
formBuilderId: formBuilderId,
|
|
47
48
|
onSave: onBuilderFormSave,
|
|
48
49
|
onError: onBuilderError,
|
|
49
|
-
validate: onBuilderValidate
|
|
50
|
+
validate: onBuilderValidate,
|
|
51
|
+
customInputMap: customInputMap
|
|
50
52
|
}), mode === 'render' && /*#__PURE__*/React.createElement(Renderer, {
|
|
51
53
|
formData: formData,
|
|
52
54
|
onSave: onRendererFormSave,
|
|
@@ -54,7 +56,8 @@ const FormBuilder = ({
|
|
|
54
56
|
shouldSubmit: shouldSubmit,
|
|
55
57
|
fileUploadStatus: fileUploadStatus,
|
|
56
58
|
handleFileDelete: handleFileDelete,
|
|
57
|
-
onFileUpload: onFileUpload
|
|
59
|
+
onFileUpload: onFileUpload,
|
|
60
|
+
customInputMap: customInputMap
|
|
58
61
|
}));
|
|
59
62
|
};
|
|
60
63
|
FormBuilder.propTypes = {
|
|
@@ -32,6 +32,7 @@ const Builder = ({
|
|
|
32
32
|
onError,
|
|
33
33
|
validate,
|
|
34
34
|
formBuilderId,
|
|
35
|
+
customInputMap,
|
|
35
36
|
initialValues = {}
|
|
36
37
|
// ...otherProps
|
|
37
38
|
}) => {
|
|
@@ -106,7 +107,8 @@ const Builder = ({
|
|
|
106
107
|
remove,
|
|
107
108
|
values,
|
|
108
109
|
setFieldValue
|
|
109
|
-
})
|
|
110
|
+
}),
|
|
111
|
+
customInputMap: customInputMap
|
|
110
112
|
})), /*#__PURE__*/React.createElement("div", {
|
|
111
113
|
className: "section-footer"
|
|
112
114
|
}, /*#__PURE__*/React.createElement("button", {
|
|
@@ -26,8 +26,8 @@ const InputBuilder = ({
|
|
|
26
26
|
style,
|
|
27
27
|
sectionIndex,
|
|
28
28
|
inputIndex,
|
|
29
|
-
onDelete
|
|
30
|
-
|
|
29
|
+
onDelete,
|
|
30
|
+
customInputMap
|
|
31
31
|
// ...otherProps
|
|
32
32
|
}) => {
|
|
33
33
|
const {
|
|
@@ -39,13 +39,6 @@ const InputBuilder = ({
|
|
|
39
39
|
setFieldValue(`sections.${sectionIndex}.inputs.${inputIndex}.required`, !input?.required);
|
|
40
40
|
};
|
|
41
41
|
const [hasDescription, setHasDescription] = useState(false);
|
|
42
|
-
|
|
43
|
-
// TODO: handle nav logic
|
|
44
|
-
// const handleToggleConditionalNavigation = () => {
|
|
45
|
-
// setFieldValue(`sections.${sectionIndex}.inputs.${inputIndex}.conditionalNavigation`,
|
|
46
|
-
// !input?.conditionalNavigation)
|
|
47
|
-
// }
|
|
48
|
-
|
|
49
42
|
const availableSections = values?.sections?.map((section, idx) => ({
|
|
50
43
|
value: idx,
|
|
51
44
|
label: `Go to ${section.title || `Untitled Section ${idx + 1}`}`
|
|
@@ -61,6 +54,7 @@ const InputBuilder = ({
|
|
|
61
54
|
const handleToggleShowSpecificFileTypes = () => {
|
|
62
55
|
setFieldValue(`sections.${sectionIndex}.inputs.${inputIndex}.showSpecificFileTypes`, !input.showSpecificFileTypes);
|
|
63
56
|
};
|
|
57
|
+
const customInputTypes = customInputMap ? Object.keys(customInputMap) : [];
|
|
64
58
|
return /*#__PURE__*/React.createElement("div", {
|
|
65
59
|
id: id,
|
|
66
60
|
className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
|
|
@@ -100,7 +94,10 @@ const InputBuilder = ({
|
|
|
100
94
|
}, {
|
|
101
95
|
value: 'file',
|
|
102
96
|
label: 'File upload'
|
|
103
|
-
}
|
|
97
|
+
}, ...(customInputTypes && customInputTypes.map(customInputKey => ({
|
|
98
|
+
value: customInputKey,
|
|
99
|
+
label: customInputMap[customInputKey].label
|
|
100
|
+
})))]
|
|
104
101
|
}), /*#__PURE__*/React.createElement("div", {
|
|
105
102
|
className: "controls"
|
|
106
103
|
}, /*#__PURE__*/React.createElement("button", {
|
|
@@ -23,7 +23,8 @@ const Section = ({
|
|
|
23
23
|
className: userClassName,
|
|
24
24
|
style,
|
|
25
25
|
index,
|
|
26
|
-
handleDeleteSection
|
|
26
|
+
handleDeleteSection,
|
|
27
|
+
customInputMap
|
|
27
28
|
// ...otherProps
|
|
28
29
|
}) => {
|
|
29
30
|
const {
|
|
@@ -55,7 +56,8 @@ const Section = ({
|
|
|
55
56
|
sectionIndex: index,
|
|
56
57
|
inputIndex: indx,
|
|
57
58
|
onDelete: handleDeleteInput,
|
|
58
|
-
onCopy: handleCopyInput
|
|
59
|
+
onCopy: handleCopyInput,
|
|
60
|
+
customInputMap: customInputMap
|
|
59
61
|
}),
|
|
60
62
|
identifier: input.name
|
|
61
63
|
}));
|
|
@@ -65,7 +65,8 @@ const Renderer = ({
|
|
|
65
65
|
fileUploadStatus,
|
|
66
66
|
handleFileDelete,
|
|
67
67
|
onFileUpload,
|
|
68
|
-
shouldUpdateInputStateInRealTime = true
|
|
68
|
+
shouldUpdateInputStateInRealTime = true,
|
|
69
|
+
customInputMap
|
|
69
70
|
// ...otherProps
|
|
70
71
|
}) => {
|
|
71
72
|
const [currentSectionIndex, setCurrentSectionIndex] = useState(0);
|
|
@@ -142,7 +143,8 @@ const Renderer = ({
|
|
|
142
143
|
fileUploadStatus: fileUploadStatus,
|
|
143
144
|
handleFileDelete: handleFileDelete,
|
|
144
145
|
onFileUpload: onFileUpload,
|
|
145
|
-
sectionIndex: sectionIndex
|
|
146
|
+
sectionIndex: sectionIndex,
|
|
147
|
+
customInputMap: customInputMap
|
|
146
148
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
147
149
|
className: "navigator-container"
|
|
148
150
|
}, updatedFormData.sections.length > 1 && /*#__PURE__*/React.createElement(Button, {
|
|
@@ -34,40 +34,50 @@ const Section = ({
|
|
|
34
34
|
fileUploadStatus,
|
|
35
35
|
handleFileDelete,
|
|
36
36
|
onFileUpload,
|
|
37
|
-
sectionIndex
|
|
37
|
+
sectionIndex,
|
|
38
|
+
customInputMap
|
|
38
39
|
// ...otherProps
|
|
39
|
-
}) =>
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
40
|
+
}) => {
|
|
41
|
+
const customInputTypes = customInputMap ? Object.keys(customInputMap) : [];
|
|
42
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
43
|
+
id: id,
|
|
44
|
+
className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
|
|
45
|
+
style: style
|
|
46
|
+
}, /*#__PURE__*/React.createElement("p", {
|
|
47
|
+
className: "h3"
|
|
48
|
+
}, title), /*#__PURE__*/React.createElement(ExpandableLexicalPreview, {
|
|
49
|
+
nodes: description,
|
|
50
|
+
name: "instructions"
|
|
51
|
+
}), inputs?.map((input, inputIndex) => {
|
|
52
|
+
const isFileInput = input.type === 'file';
|
|
53
|
+
const isCustomInput = customInputTypes.includes(input.type);
|
|
54
|
+
const CustomInputComponent = isCustomInput ? customInputMap[input.type].component : null;
|
|
55
|
+
return !isCustomInput ? /*#__PURE__*/React.createElement(FormInput, _extends({
|
|
56
|
+
key: input.name
|
|
57
|
+
}, input, {
|
|
58
|
+
disabled: readOnly
|
|
59
|
+
}, isFileInput && {
|
|
60
|
+
uploadStatus: fileUploadStatus,
|
|
61
|
+
handleFileDelete,
|
|
62
|
+
onChange: files => {
|
|
63
|
+
const filesToUpload = files?.filter(file => file instanceof File).map(file => ({
|
|
64
|
+
file,
|
|
65
|
+
name: file.name,
|
|
66
|
+
mimeType: file.type,
|
|
67
|
+
type: fileTypeMapper[getFileType(file)] || 'Generic',
|
|
68
|
+
title: file.name,
|
|
69
|
+
sectionIndex,
|
|
70
|
+
inputIndex
|
|
71
|
+
}));
|
|
72
|
+
onFileUpload(filesToUpload);
|
|
73
|
+
}
|
|
74
|
+
})) : /*#__PURE__*/React.createElement(CustomInputComponent, _extends({
|
|
75
|
+
key: input.name
|
|
76
|
+
}, input, {
|
|
77
|
+
disabled: readOnly
|
|
78
|
+
}));
|
|
69
79
|
}));
|
|
70
|
-
}
|
|
80
|
+
};
|
|
71
81
|
Section.propTypes = {
|
|
72
82
|
/**
|
|
73
83
|
* The HTML id for this element
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pareto-engineering/design-system",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.12.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/es/index.js",
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"relay-test-utils": "^15.0.0"
|
|
84
84
|
},
|
|
85
85
|
"browserslist": "> 2%",
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "f253e58e673c428639cc64dbb83a5fdfe9931dee"
|
|
87
87
|
}
|
|
@@ -107,18 +107,25 @@ const AreaChart = ({
|
|
|
107
107
|
<CartesianGrid strokeDasharray="3 3" />
|
|
108
108
|
<XAxis
|
|
109
109
|
dataKey={xKey}
|
|
110
|
-
label={{ value: xLabel, position: 'insideBottom', offset: -5 }}
|
|
110
|
+
label={{ value: xLabel, position: 'insideBottom', offset: -5 }}
|
|
111
111
|
axisLine={false}
|
|
112
112
|
tickLine={false}
|
|
113
113
|
tickCount={3}
|
|
114
114
|
/>
|
|
115
115
|
<YAxis
|
|
116
116
|
domain={yAxisBounds}
|
|
117
|
+
scale="linear"
|
|
118
|
+
interval="equidistantPreserveStart"
|
|
117
119
|
label={{
|
|
118
|
-
value:yLabel,
|
|
120
|
+
value :yLabel,
|
|
121
|
+
angle :-90,
|
|
122
|
+
position:'left',
|
|
123
|
+
offset :1,
|
|
124
|
+
style :{ textAnchor: 'middle' },
|
|
119
125
|
}}
|
|
126
|
+
padding={{ top: 10, bottom: 10 }}
|
|
120
127
|
axisLine={false}
|
|
121
|
-
tickLine
|
|
128
|
+
tickLine
|
|
122
129
|
tickFormatter={(value) => value.toFixed(2)}
|
|
123
130
|
/>
|
|
124
131
|
<Tooltip content={<CustomTooltipContent />} />
|
package/src/ui/d/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// export { Divider } from './Divider'
|
|
@@ -36,6 +36,7 @@ const FormBuilder = ({
|
|
|
36
36
|
fileUploadStatus,
|
|
37
37
|
handleFileDelete,
|
|
38
38
|
taskData,
|
|
39
|
+
customInputMap,
|
|
39
40
|
// ...otherProps
|
|
40
41
|
}) => {
|
|
41
42
|
const formattedJson = JSON.stringify(taskData, null, 2)
|
|
@@ -67,6 +68,7 @@ const FormBuilder = ({
|
|
|
67
68
|
onSave={onBuilderFormSave}
|
|
68
69
|
onError={onBuilderError}
|
|
69
70
|
validate={onBuilderValidate}
|
|
71
|
+
customInputMap={customInputMap}
|
|
70
72
|
/>
|
|
71
73
|
)}
|
|
72
74
|
{mode === 'render' && (
|
|
@@ -78,6 +80,7 @@ const FormBuilder = ({
|
|
|
78
80
|
fileUploadStatus={fileUploadStatus}
|
|
79
81
|
handleFileDelete={handleFileDelete}
|
|
80
82
|
onFileUpload={onFileUpload}
|
|
83
|
+
customInputMap={customInputMap}
|
|
81
84
|
/>
|
|
82
85
|
)}
|
|
83
86
|
</div>
|
|
@@ -43,6 +43,7 @@ const Builder = ({
|
|
|
43
43
|
onError,
|
|
44
44
|
validate,
|
|
45
45
|
formBuilderId,
|
|
46
|
+
customInputMap,
|
|
46
47
|
initialValues = {},
|
|
47
48
|
// ...otherProps
|
|
48
49
|
}) => {
|
|
@@ -125,6 +126,7 @@ const Builder = ({
|
|
|
125
126
|
handleDeleteSection={() => handleDeleteSection({
|
|
126
127
|
index, remove, values, setFieldValue,
|
|
127
128
|
})}
|
|
129
|
+
customInputMap={customInputMap}
|
|
128
130
|
/>
|
|
129
131
|
))}
|
|
130
132
|
<div className="section-footer">
|
|
@@ -41,7 +41,7 @@ const InputBuilder = ({
|
|
|
41
41
|
sectionIndex,
|
|
42
42
|
inputIndex,
|
|
43
43
|
onDelete,
|
|
44
|
-
|
|
44
|
+
customInputMap,
|
|
45
45
|
// ...otherProps
|
|
46
46
|
}) => {
|
|
47
47
|
const { values, setFieldValue } = useFormikContext()
|
|
@@ -53,12 +53,6 @@ const InputBuilder = ({
|
|
|
53
53
|
|
|
54
54
|
const [hasDescription, setHasDescription] = useState(false)
|
|
55
55
|
|
|
56
|
-
// TODO: handle nav logic
|
|
57
|
-
// const handleToggleConditionalNavigation = () => {
|
|
58
|
-
// setFieldValue(`sections.${sectionIndex}.inputs.${inputIndex}.conditionalNavigation`,
|
|
59
|
-
// !input?.conditionalNavigation)
|
|
60
|
-
// }
|
|
61
|
-
|
|
62
56
|
const availableSections = values?.sections?.map((section, idx) => ({
|
|
63
57
|
value:idx,
|
|
64
58
|
label:`Go to ${section.title || `Untitled Section ${idx + 1}`}`,
|
|
@@ -77,6 +71,8 @@ const InputBuilder = ({
|
|
|
77
71
|
setFieldValue(`sections.${sectionIndex}.inputs.${inputIndex}.showSpecificFileTypes`, !input.showSpecificFileTypes)
|
|
78
72
|
}
|
|
79
73
|
|
|
74
|
+
const customInputTypes = customInputMap ? Object.keys(customInputMap) : []
|
|
75
|
+
|
|
80
76
|
return (
|
|
81
77
|
<div
|
|
82
78
|
id={id}
|
|
@@ -134,13 +130,13 @@ const InputBuilder = ({
|
|
|
134
130
|
value:'file',
|
|
135
131
|
label:'File upload',
|
|
136
132
|
},
|
|
133
|
+
...(customInputTypes && customInputTypes.map((customInputKey) => ({
|
|
134
|
+
value:customInputKey,
|
|
135
|
+
label:customInputMap[customInputKey].label,
|
|
136
|
+
}))),
|
|
137
137
|
]}
|
|
138
138
|
/>
|
|
139
139
|
<div className="controls">
|
|
140
|
-
{/* TODO */}
|
|
141
|
-
{/* <button type="button" onClick={() => onCopy(inputIndex)}>
|
|
142
|
-
<span className="ai-icon x-ui-icons c-x">I</span>
|
|
143
|
-
</button> */}
|
|
144
140
|
<button type="button" onClick={() => onDelete(inputIndex)}>
|
|
145
141
|
<span className="icon x-ui-icons c-x">D</span>
|
|
146
142
|
</button>
|
|
@@ -168,17 +164,6 @@ const InputBuilder = ({
|
|
|
168
164
|
Description
|
|
169
165
|
</button>
|
|
170
166
|
</li>
|
|
171
|
-
{/* TODO: implement logic */}
|
|
172
|
-
{/*
|
|
173
|
-
<li className={`option ${input?.conditionalNavigation ? 'with-check-mark' : ''}`}>
|
|
174
|
-
{input?.conditionalNavigation && <span className="x-ui-icons c-x icon">I</span>}
|
|
175
|
-
<button
|
|
176
|
-
onClick={handleToggleConditionalNavigation}
|
|
177
|
-
type="button"
|
|
178
|
-
>
|
|
179
|
-
Go to section based on answer
|
|
180
|
-
</button>
|
|
181
|
-
</li> */}
|
|
182
167
|
</ul>
|
|
183
168
|
</ActionsContainer>
|
|
184
169
|
</div>
|
|
@@ -36,6 +36,7 @@ const Section = ({
|
|
|
36
36
|
style,
|
|
37
37
|
index,
|
|
38
38
|
handleDeleteSection,
|
|
39
|
+
customInputMap,
|
|
39
40
|
// ...otherProps
|
|
40
41
|
}) => {
|
|
41
42
|
const { values, setFieldValue } = useFormikContext()
|
|
@@ -69,6 +70,7 @@ const Section = ({
|
|
|
69
70
|
inputIndex={indx}
|
|
70
71
|
onDelete={handleDeleteInput}
|
|
71
72
|
onCopy={handleCopyInput}
|
|
73
|
+
customInputMap={customInputMap}
|
|
72
74
|
/>,
|
|
73
75
|
identifier:input.name,
|
|
74
76
|
}))
|
|
@@ -78,6 +78,7 @@ const Renderer = ({
|
|
|
78
78
|
handleFileDelete,
|
|
79
79
|
onFileUpload,
|
|
80
80
|
shouldUpdateInputStateInRealTime = true,
|
|
81
|
+
customInputMap,
|
|
81
82
|
// ...otherProps
|
|
82
83
|
}) => {
|
|
83
84
|
const [currentSectionIndex, setCurrentSectionIndex] = useState(0)
|
|
@@ -178,6 +179,7 @@ const Renderer = ({
|
|
|
178
179
|
handleFileDelete={handleFileDelete}
|
|
179
180
|
onFileUpload={onFileUpload}
|
|
180
181
|
sectionIndex={sectionIndex}
|
|
182
|
+
customInputMap={customInputMap}
|
|
181
183
|
/>
|
|
182
184
|
)
|
|
183
185
|
))}
|
|
@@ -40,57 +40,71 @@ const Section = ({
|
|
|
40
40
|
handleFileDelete,
|
|
41
41
|
onFileUpload,
|
|
42
42
|
sectionIndex,
|
|
43
|
+
customInputMap,
|
|
43
44
|
// ...otherProps
|
|
44
|
-
}) =>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
)
|
|
45
|
+
}) => {
|
|
46
|
+
const customInputTypes = customInputMap ? Object.keys(customInputMap) : []
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<div
|
|
50
|
+
id={id}
|
|
51
|
+
className={[
|
|
52
|
+
baseClassName,
|
|
53
|
+
componentClassName,
|
|
54
|
+
userClassName,
|
|
55
|
+
]
|
|
56
|
+
.filter((e) => e)
|
|
57
|
+
.join(' ')}
|
|
58
|
+
style={style}
|
|
59
|
+
>
|
|
60
|
+
<p className="h3">{title}</p>
|
|
61
|
+
<ExpandableLexicalPreview
|
|
62
|
+
nodes={description}
|
|
63
|
+
name="instructions"
|
|
64
|
+
/>
|
|
65
|
+
{inputs?.map((input, inputIndex) => {
|
|
66
|
+
const isFileInput = input.type === 'file'
|
|
67
|
+
const isCustomInput = customInputTypes.includes(input.type)
|
|
68
|
+
const CustomInputComponent = isCustomInput ? customInputMap[input.type].component : null
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
!isCustomInput ? (
|
|
72
|
+
<FormInput
|
|
73
|
+
key={input.name}
|
|
74
|
+
{...input}
|
|
75
|
+
disabled={readOnly}
|
|
76
|
+
{...(isFileInput && {
|
|
77
|
+
uploadStatus:fileUploadStatus,
|
|
78
|
+
handleFileDelete,
|
|
79
|
+
onChange :(files) => {
|
|
80
|
+
const filesToUpload = files
|
|
81
|
+
?.filter((file) => file instanceof File)
|
|
82
|
+
.map((file) => ({
|
|
83
|
+
file,
|
|
84
|
+
name :file.name,
|
|
85
|
+
mimeType:file.type,
|
|
86
|
+
type :fileTypeMapper[getFileType(file)] || 'Generic',
|
|
87
|
+
title :file.name,
|
|
88
|
+
sectionIndex,
|
|
89
|
+
inputIndex,
|
|
90
|
+
}))
|
|
91
|
+
|
|
92
|
+
onFileUpload(filesToUpload)
|
|
93
|
+
},
|
|
94
|
+
})}
|
|
95
|
+
/>
|
|
96
|
+
) : (
|
|
97
|
+
<CustomInputComponent
|
|
98
|
+
key={input.name}
|
|
99
|
+
{...input}
|
|
100
|
+
disabled={readOnly}
|
|
101
|
+
/>
|
|
102
|
+
)
|
|
103
|
+
)
|
|
104
|
+
})}
|
|
105
|
+
</div>
|
|
106
|
+
)
|
|
107
|
+
}
|
|
94
108
|
|
|
95
109
|
Section.propTypes = {
|
|
96
110
|
/**
|