@arquimedes.co/eureka-forms 1.9.16-test → 1.9.17-test
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/App.js +98 -205
- package/dist/AxiosAPI.js +3 -3
- package/dist/AxiosWidget.js +4 -4
- package/dist/FormComponents/Form/ColumnForm/ColumnForm.js +104 -207
- package/dist/FormComponents/Form/ConfirmationDialog/ConfirmationDialog.js +5 -17
- package/dist/FormComponents/Form/Form.js +29 -56
- package/dist/FormComponents/Form/StepperForm/StepperForm.js +1 -1
- package/dist/FormComponents/Section/MaterialSection/MaterialSection.js +7 -30
- package/dist/FormComponents/Section/Section.js +2 -13
- package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/CBRIncidentsStep.js +2 -13
- package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/Incident/Incident.js +9 -32
- package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/MaterialCBRIncidentsStep.js +47 -64
- package/dist/FormComponents/Step/@Construction/CBRLocativasStep/CBRLocativasStep.js +41 -102
- package/dist/FormComponents/Step/@Construction/CBRPropertyStep/CBRPropertyStep.js +37 -92
- package/dist/FormComponents/Step/AYFStepMapper.js +23 -75
- package/dist/FormComponents/Step/CBRStepMapper.js +56 -144
- package/dist/FormComponents/Step/CheckBoxStep/CheckBoxStep.js +3 -26
- package/dist/FormComponents/Step/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.js +6 -21
- package/dist/FormComponents/Step/ClassifierSelectorStep/ClassifierSelectorStep.js +3 -26
- package/dist/FormComponents/Step/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.js +32 -65
- package/dist/FormComponents/Step/DatePickerStep/DatePickerStep.js +2 -13
- package/dist/FormComponents/Step/DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.js +6 -21
- package/dist/FormComponents/Step/FileUploadStep/FileUploadStep.js +2 -13
- package/dist/FormComponents/Step/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.js +27 -88
- package/dist/FormComponents/Step/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.js +81 -171
- package/dist/FormComponents/Step/RatingStep/MaterialRatingStep/MaterialRatingStep.js +15 -41
- package/dist/FormComponents/Step/RatingStep/RatingStep.js +2 -13
- package/dist/FormComponents/Step/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.js +25 -52
- package/dist/FormComponents/Step/SelectorStep/SelectorStep.js +3 -26
- package/dist/FormComponents/Step/SeparatorStep/MaterialSeparatorStep/MaterialSeparatorStep.js +1 -2
- package/dist/FormComponents/Step/SeparatorStep/SeparatorStep.js +3 -26
- package/dist/FormComponents/Step/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.js +83 -145
- package/dist/FormComponents/Step/SmartSelectStep/SmartSelectStep.js +2 -13
- package/dist/FormComponents/Step/Step.js +19 -39
- package/dist/FormComponents/Step/StepFunctions.js +14 -16
- package/dist/FormComponents/Step/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.js +43 -62
- package/dist/FormComponents/Step/TextAreaStep/TextAreaStep.js +2 -13
- package/dist/FormComponents/Step/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.js +6 -21
- package/dist/FormComponents/Step/TextInputStep/TextInputStep.js +2 -13
- package/dist/FormComponents/Step/TitleStep/MaterialTitleStep/MaterialTitleStep.js +3 -15
- package/dist/FormComponents/Step/TitleStep/TitleStep.js +3 -26
- package/dist/FormComponents/Term/MaterialTerm/MaterialTerm.js +19 -35
- package/dist/FormComponents/Term/Term.js +2 -13
- package/dist/Widget.js +13 -25
- package/dist/constants/Files/FileExtensions.js +3 -3
- package/dist/constants/Files/FileMaxSize.js +1 -1
- package/dist/constants/InternalFormStyle.js +1 -1
- package/dist/constants/MaterialClassNameSeed.js +1 -1
- package/dist/controllers/FileService.js +29 -86
- package/dist/index.js +4 -15
- package/dist/shared/Loader/Loader.js +5 -17
- package/dist/shared/Navbar/Navbar.js +2 -14
- package/dist/shared/Rating/Rating.js +4 -27
- package/dist/shared/Rating/Ratings/LikeRating.js +9 -21
- package/dist/shared/Rating/Ratings/SatisfactionRating.js +15 -27
- package/dist/shared/Rating/Ratings/ScaleRating.js +22 -49
- package/dist/shared/RoundedButton/RoundedButton.js +12 -24
- package/dist/shared/RoundedCheckBox/RoundedCheckBox.js +39 -84
- package/dist/shared/RoundedDatePicker/RoundedDatePicker.js +235 -286
- package/dist/shared/RoundedSelect/RoundedSelect.js +103 -152
- package/dist/shared/RoundedSmartSelect/RoundedSmartSelect.js +125 -160
- package/dist/shared/RoundedTextField/RoundedTextField.js +92 -137
- package/dist/utils/CbrFunctions.js +30 -30
- package/package.json +4 -4
package/dist/Widget.js
CHANGED
|
@@ -1,57 +1,45 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var _a;
|
|
13
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
2
|
import ReactDOM from 'react-dom';
|
|
15
3
|
import App from './App';
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
4
|
+
const WIDGET_ID = 'widget:eureka';
|
|
5
|
+
const element = document.getElementById(WIDGET_ID);
|
|
6
|
+
const props = {};
|
|
19
7
|
if (element) {
|
|
20
|
-
|
|
8
|
+
const url = element.getAttribute('data-formurl');
|
|
21
9
|
if (url) {
|
|
22
|
-
|
|
10
|
+
const splitUrl = url.split('/');
|
|
23
11
|
if (splitUrl.length > 0) {
|
|
24
12
|
props.apiKey = splitUrl[splitUrl.length - 1];
|
|
25
13
|
}
|
|
26
|
-
|
|
14
|
+
const domain = /:\/\/([^\/]+)/.exec(url)?.[1];
|
|
27
15
|
if (domain) {
|
|
28
|
-
|
|
16
|
+
const splitDomain = domain.split('.');
|
|
29
17
|
if (splitDomain.length > 0 && splitDomain[0] !== 'forms') {
|
|
30
18
|
props.domain = splitDomain[0];
|
|
31
19
|
}
|
|
32
20
|
}
|
|
33
21
|
}
|
|
34
|
-
|
|
22
|
+
const formDataString = element.getAttribute('data-formdata');
|
|
35
23
|
if (formDataString) {
|
|
36
24
|
props.formData = JSON.parse(formDataString);
|
|
37
25
|
}
|
|
38
|
-
|
|
26
|
+
const valuesString = element.getAttribute('data-values');
|
|
39
27
|
if (valuesString) {
|
|
40
28
|
props.valuesData = JSON.parse(valuesString);
|
|
41
29
|
}
|
|
42
|
-
|
|
30
|
+
const internal = element.getAttribute('data-internal');
|
|
43
31
|
if (internal) {
|
|
44
32
|
props.internal = true;
|
|
45
33
|
}
|
|
46
|
-
|
|
34
|
+
const postview = element.getAttribute('data-postview');
|
|
47
35
|
if (postview) {
|
|
48
36
|
props.postview = true;
|
|
49
37
|
}
|
|
50
|
-
|
|
38
|
+
const preview = element.getAttribute('data-preview');
|
|
51
39
|
if (preview) {
|
|
52
40
|
props.preview = true;
|
|
53
41
|
}
|
|
54
42
|
// eslint-disable-next-line no-console
|
|
55
43
|
console.log(props);
|
|
56
44
|
}
|
|
57
|
-
ReactDOM.render(_jsx(App,
|
|
45
|
+
ReactDOM.render(_jsx(App, { isWidget: true, ...props }), document.getElementById(WIDGET_ID));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
1
|
+
export const getAcceptedExtensions = () => {
|
|
2
|
+
let extensionString = extensions.reduce((acc, current) => acc + ',.' + current);
|
|
3
3
|
extensionString = '.' + extensionString;
|
|
4
4
|
return extensionString;
|
|
5
5
|
};
|
|
6
|
-
|
|
6
|
+
const extensions = [
|
|
7
7
|
'aif',
|
|
8
8
|
'cda',
|
|
9
9
|
'mid',
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
const maxSize = 31457280;
|
|
2
2
|
export default maxSize;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export const SEED = 'EF';
|
|
@@ -1,92 +1,35 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
-
function step(op) {
|
|
15
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
-
switch (op[0]) {
|
|
20
|
-
case 0: case 1: t = op; break;
|
|
21
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
-
default:
|
|
25
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
-
if (t[2]) _.ops.pop();
|
|
30
|
-
_.trys.pop(); continue;
|
|
31
|
-
}
|
|
32
|
-
op = body.call(thisArg, _);
|
|
33
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
1
|
import axios from 'axios';
|
|
38
2
|
import axiosInstance from '../AxiosAPI';
|
|
39
3
|
import widgetInstance from '../AxiosWidget';
|
|
40
|
-
export function getUploadUrls(files, domain) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
case 1:
|
|
54
|
-
response = _b.sent();
|
|
55
|
-
return [3 /*break*/, 4];
|
|
56
|
-
case 2: return [4 /*yield*/, axiosInstance.post('/uploadfile', filesArray)];
|
|
57
|
-
case 3:
|
|
58
|
-
response = _b.sent();
|
|
59
|
-
_b.label = 4;
|
|
60
|
-
case 4: return [2 /*return*/, (_a = response.data) !== null && _a !== void 0 ? _a : undefined];
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
});
|
|
4
|
+
export async function getUploadUrls(files, domain) {
|
|
5
|
+
const filesArray = files.map((file) => ({
|
|
6
|
+
publicFile: false,
|
|
7
|
+
extension: file.name.split('.').pop(),
|
|
8
|
+
}));
|
|
9
|
+
let response;
|
|
10
|
+
if (domain) {
|
|
11
|
+
response = await widgetInstance.post(`/uploadfile?idOrganization=${domain}`, filesArray);
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
response = await axiosInstance.post('/uploadfile', filesArray);
|
|
15
|
+
}
|
|
16
|
+
return response.data ?? undefined;
|
|
64
17
|
}
|
|
65
|
-
export function postFile(file, postInfo) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
return [4 /*yield*/, axios.post(postInfo.postInfo.url, formData, {
|
|
78
|
-
timeout: 300000,
|
|
79
|
-
headers: {
|
|
80
|
-
'Content-Type': 'multipart/form-data',
|
|
81
|
-
},
|
|
82
|
-
})];
|
|
83
|
-
case 1:
|
|
84
|
-
_a.sent();
|
|
85
|
-
return [2 /*return*/, {
|
|
86
|
-
fileName: file.name,
|
|
87
|
-
S3Key: postInfo.S3Key,
|
|
88
|
-
}];
|
|
89
|
-
}
|
|
90
|
-
});
|
|
18
|
+
export async function postFile(file, postInfo) {
|
|
19
|
+
const formData = new FormData();
|
|
20
|
+
Object.keys(postInfo.postInfo.fields).forEach((key) => {
|
|
21
|
+
formData.append(key, postInfo.postInfo.fields[key]);
|
|
22
|
+
});
|
|
23
|
+
// Actual file has to be appended last.
|
|
24
|
+
formData.append('file', file);
|
|
25
|
+
await axios.post(postInfo.postInfo.url, formData, {
|
|
26
|
+
timeout: 300000,
|
|
27
|
+
headers: {
|
|
28
|
+
'Content-Type': 'multipart/form-data',
|
|
29
|
+
},
|
|
91
30
|
});
|
|
31
|
+
return {
|
|
32
|
+
fileName: file.name,
|
|
33
|
+
S3Key: postInfo.S3Key,
|
|
34
|
+
};
|
|
92
35
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,21 +1,10 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
2
|
import * as ReactDOM from 'react-dom';
|
|
14
3
|
import App from './App';
|
|
15
4
|
import styles from './index.module.css';
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
5
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
6
|
+
const values = urlParams.get('data-values');
|
|
7
|
+
let dataValues = undefined;
|
|
19
8
|
if (values) {
|
|
20
9
|
try {
|
|
21
10
|
dataValues = JSON.parse(decodeURIComponent(values));
|
|
@@ -26,4 +15,4 @@ if (values) {
|
|
|
26
15
|
console.error('Invalid data-values JSON', error);
|
|
27
16
|
}
|
|
28
17
|
}
|
|
29
|
-
ReactDOM.render(_jsx("div",
|
|
18
|
+
ReactDOM.render(_jsx("div", { className: styles.eurekaForm, children: _jsx(App, { isWidget: false, apiKey: window.location.pathname.replace('/', ''), valuesData: dataValues }) }), document.getElementById('eureka-root'));
|
|
@@ -1,26 +1,14 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
2
|
import CircularProgress from '@material-ui/core/CircularProgress';
|
|
14
3
|
import styles from './Loader.module.css';
|
|
15
4
|
/**
|
|
16
5
|
* Generic Loader Component with optional curtain.
|
|
17
6
|
*/
|
|
18
|
-
function Loader(
|
|
19
|
-
|
|
20
|
-
return (_jsx("div", __assign({ className: styles.loaderContainer + ' flexbox', style: {
|
|
7
|
+
function Loader({ color = '#3d5a7f', curtain = false, zIndex = 20, size = 40, position = 'absolute', }) {
|
|
8
|
+
return (_jsx("div", { className: styles.loaderContainer + ' flexbox', style: {
|
|
21
9
|
backgroundColor: curtain ? 'rgb(0, 0, 0, 0.4)' : '',
|
|
22
|
-
zIndex
|
|
23
|
-
position
|
|
24
|
-
}
|
|
10
|
+
zIndex,
|
|
11
|
+
position,
|
|
12
|
+
}, children: _jsx("div", { className: styles.loader, children: _jsx(CircularProgress, { size: size, style: { color } }) }) }));
|
|
25
13
|
}
|
|
26
14
|
export default Loader;
|
|
@@ -1,18 +1,6 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
2
|
import styles from './Navbar.module.css';
|
|
14
|
-
function Navbar(
|
|
15
|
-
|
|
16
|
-
return (_jsx("div", __assign({ className: styles.navContainer, style: { backgroundColor: color } }, { children: _jsx("img", { src: logo, alt: "Organization Logo", className: styles.navImage }) })));
|
|
3
|
+
function Navbar({ logo, color }) {
|
|
4
|
+
return (_jsx("div", { className: styles.navContainer, style: { backgroundColor: color }, children: _jsx("img", { src: logo, alt: "Organization Logo", className: styles.navImage }) }));
|
|
17
5
|
}
|
|
18
6
|
export default Navbar;
|
|
@@ -1,39 +1,16 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
2
|
import LikeRating from './Ratings/LikeRating';
|
|
25
3
|
import ScaleRating from './Ratings/ScaleRating';
|
|
26
4
|
import SatisfactionRating from './Ratings/SatisfactionRating';
|
|
27
5
|
import { RatingTypes } from '../../constants/FormStepTypes';
|
|
28
|
-
function Rating(
|
|
29
|
-
var type = _a.type, others = __rest(_a, ["type"]);
|
|
6
|
+
function Rating({ type, ...others }) {
|
|
30
7
|
switch (type) {
|
|
31
8
|
case RatingTypes.LIKE:
|
|
32
|
-
return _jsx(LikeRating,
|
|
9
|
+
return _jsx(LikeRating, { ...others });
|
|
33
10
|
case RatingTypes.SATISFACTION:
|
|
34
|
-
return _jsx(SatisfactionRating,
|
|
11
|
+
return _jsx(SatisfactionRating, { ...others });
|
|
35
12
|
case RatingTypes.SCALE:
|
|
36
|
-
return _jsx(ScaleRating,
|
|
13
|
+
return _jsx(ScaleRating, { ...others });
|
|
37
14
|
default:
|
|
38
15
|
return _jsx("div", {});
|
|
39
16
|
}
|
|
@@ -1,43 +1,31 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
2
|
import ThumbDownRoundedIcon from '@material-ui/icons/ThumbDownRounded';
|
|
14
3
|
import ThumbUpRoundedIcon from '@material-ui/icons/ThumbUpRounded';
|
|
15
4
|
import styles from '../Rating.module.css';
|
|
16
|
-
function LikeRating(
|
|
17
|
-
|
|
18
|
-
return (_jsxs("div", __assign({ className: styles.ratingContainer, style: {
|
|
5
|
+
function LikeRating({ disabled, inputRef, value, onChange, focusColor, unSelectedColor, }) {
|
|
6
|
+
return (_jsxs("div", { className: styles.ratingContainer, style: {
|
|
19
7
|
'--eureka-primary': focusColor,
|
|
20
8
|
'--eureka-outline': unSelectedColor,
|
|
21
|
-
}
|
|
9
|
+
}, children: [_jsx("input", { ref: inputRef, className: styles.hiddenInput }), _jsx("div", { className: disabled
|
|
22
10
|
? styles.disabledLikeContainer
|
|
23
|
-
: styles.likeContainer, onClick:
|
|
11
|
+
: styles.likeContainer, onClick: () => {
|
|
24
12
|
if (!disabled)
|
|
25
13
|
onChange(value === 1 ? null : 1);
|
|
26
|
-
}
|
|
14
|
+
}, children: _jsx(ThumbUpRoundedIcon, { fontSize: "inherit", style: value === 1
|
|
27
15
|
? {
|
|
28
16
|
color: focusColor,
|
|
29
17
|
}
|
|
30
|
-
: {} }) })
|
|
18
|
+
: {} }) }), _jsx("div", { className: disabled
|
|
31
19
|
? styles.disabledLikeContainer
|
|
32
|
-
: styles.likeContainer, onClick:
|
|
20
|
+
: styles.likeContainer, onClick: () => {
|
|
33
21
|
if (!disabled)
|
|
34
22
|
onChange(value === 0 ? null : 0);
|
|
35
|
-
}
|
|
23
|
+
}, children: _jsx(ThumbDownRoundedIcon, { fontSize: "inherit", style: value === 0
|
|
36
24
|
? {
|
|
37
25
|
color: focusColor,
|
|
38
26
|
marginTop: 14,
|
|
39
27
|
marginLeft: 15,
|
|
40
28
|
}
|
|
41
|
-
: { marginTop: 14, marginLeft: 15 } }) })
|
|
29
|
+
: { marginTop: 14, marginLeft: 15 } }) })] }));
|
|
42
30
|
}
|
|
43
31
|
export default LikeRating;
|
|
@@ -1,61 +1,49 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
2
|
import styles from '../Rating.module.css';
|
|
14
3
|
import SentimentVeryDissatisfiedIcon from '@material-ui/icons/SentimentVeryDissatisfied';
|
|
15
4
|
import SentimentDissatisfiedIcon from '@material-ui/icons/SentimentDissatisfied';
|
|
16
5
|
import SentimentSatisfiedAltIcon from '@material-ui/icons/SentimentSatisfiedAltOutlined';
|
|
17
6
|
import SentimentVerySatisfiedIcon from '@material-ui/icons/SentimentVerySatisfied';
|
|
18
|
-
function SatisfactionRating(
|
|
19
|
-
|
|
20
|
-
return (_jsxs("div", __assign({ className: styles.ratingContainer, style: {
|
|
7
|
+
function SatisfactionRating({ value, inputRef, disabled, onChange, focusColor, unSelectedColor, }) {
|
|
8
|
+
return (_jsxs("div", { className: styles.ratingContainer, style: {
|
|
21
9
|
'--eureka-primary': focusColor,
|
|
22
10
|
'--eureka-outline': unSelectedColor,
|
|
23
|
-
}
|
|
11
|
+
}, children: [_jsx("input", { ref: inputRef, className: styles.hiddenInput }), _jsx("div", { className: disabled
|
|
24
12
|
? styles.disabledSentimentContainer
|
|
25
|
-
: styles.sentimentContainer, onClick:
|
|
13
|
+
: styles.sentimentContainer, onClick: () => {
|
|
26
14
|
if (!disabled)
|
|
27
15
|
onChange(value === 1 ? null : 1);
|
|
28
|
-
}
|
|
16
|
+
}, children: _jsx(SentimentVeryDissatisfiedIcon, { fontSize: "inherit", style: value === 1
|
|
29
17
|
? {
|
|
30
18
|
color: focusColor,
|
|
31
19
|
}
|
|
32
|
-
: {} }) })
|
|
20
|
+
: {} }) }), _jsx("div", { className: disabled
|
|
33
21
|
? styles.disabledSentimentContainer
|
|
34
|
-
: styles.sentimentContainer, onClick:
|
|
22
|
+
: styles.sentimentContainer, onClick: () => {
|
|
35
23
|
if (!disabled)
|
|
36
24
|
onChange(value === 2 ? null : 2);
|
|
37
|
-
}
|
|
25
|
+
}, children: _jsx(SentimentDissatisfiedIcon, { fontSize: "inherit", style: value === 2
|
|
38
26
|
? {
|
|
39
27
|
color: focusColor,
|
|
40
28
|
}
|
|
41
|
-
: {} }) })
|
|
29
|
+
: {} }) }), _jsx("div", { className: disabled
|
|
42
30
|
? styles.disabledSentimentContainer
|
|
43
|
-
: styles.sentimentContainer, onClick:
|
|
31
|
+
: styles.sentimentContainer, onClick: () => {
|
|
44
32
|
if (!disabled)
|
|
45
33
|
onChange(value === 3 ? null : 3);
|
|
46
|
-
}
|
|
34
|
+
}, children: _jsx(SentimentSatisfiedAltIcon, { fontSize: "inherit", style: value === 3
|
|
47
35
|
? {
|
|
48
36
|
color: focusColor,
|
|
49
37
|
}
|
|
50
|
-
: {} }) })
|
|
38
|
+
: {} }) }), _jsx("div", { className: disabled
|
|
51
39
|
? styles.disabledSentimentContainer
|
|
52
|
-
: styles.sentimentContainer, onClick:
|
|
40
|
+
: styles.sentimentContainer, onClick: () => {
|
|
53
41
|
if (!disabled)
|
|
54
42
|
onChange(value === 4 ? null : 4);
|
|
55
|
-
}
|
|
43
|
+
}, children: _jsx(SentimentVerySatisfiedIcon, { fontSize: "inherit", style: value === 4
|
|
56
44
|
? {
|
|
57
45
|
color: focusColor,
|
|
58
46
|
}
|
|
59
|
-
: {} }) })
|
|
47
|
+
: {} }) })] }));
|
|
60
48
|
}
|
|
61
49
|
export default SatisfactionRating;
|
|
@@ -1,63 +1,36 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
2
|
import styles from '../Rating.module.css';
|
|
25
3
|
import { Rating } from '@material-ui/lab';
|
|
26
4
|
import GradeRoundedIcon from '@material-ui/icons/GradeRounded';
|
|
27
5
|
import { makeStyles } from '@material-ui/core';
|
|
28
6
|
import React from 'react';
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
opacity: 1,
|
|
34
|
-
},
|
|
35
|
-
'& .EF-MuiRating-iconFilled': {
|
|
36
|
-
color: props.focusColor,
|
|
37
|
-
},
|
|
38
|
-
'& .EF-MuiRating-iconEmpty': {
|
|
39
|
-
color: props.unSelectedColor,
|
|
40
|
-
},
|
|
7
|
+
const useRatingStyles = (props) => makeStyles({
|
|
8
|
+
root: {
|
|
9
|
+
'&.Mui-disabled': {
|
|
10
|
+
opacity: 1,
|
|
41
11
|
},
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
12
|
+
'& .EF-MuiRating-iconFilled': {
|
|
13
|
+
color: props.focusColor,
|
|
14
|
+
},
|
|
15
|
+
'& .EF-MuiRating-iconEmpty': {
|
|
16
|
+
color: props.unSelectedColor,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
function ScaleRating({ value, name, inputRef, disabled, onChange, isMobile, focusColor, unSelectedColor, }) {
|
|
21
|
+
const ratingClasses = useRatingStyles({
|
|
22
|
+
unSelectedColor,
|
|
23
|
+
focusColor,
|
|
49
24
|
})();
|
|
50
|
-
return (_jsxs(React.Fragment, { children: [_jsx("input", { ref: inputRef, className: styles.hiddenInput }), _jsx(Rating, { value: value, onChange:
|
|
25
|
+
return (_jsxs(React.Fragment, { children: [_jsx("input", { ref: inputRef, className: styles.hiddenInput }), _jsx(Rating, { value: value, onChange: (_event, newValue) => {
|
|
51
26
|
if (!disabled)
|
|
52
27
|
onChange(newValue);
|
|
53
|
-
}, disabled: disabled, classes: ratingClasses, name: name, size: "large", defaultValue: 0, getLabelText:
|
|
28
|
+
}, disabled: disabled, classes: ratingClasses, name: name, size: "large", defaultValue: 0, getLabelText: (value) => value + '/5', max: 5, IconContainerComponent: isMobile ? SmallIconContainer : IconContainer })] }));
|
|
54
29
|
}
|
|
55
|
-
function IconContainer(
|
|
56
|
-
|
|
57
|
-
return (_jsx("span", __assign({ className: 'icon' + value }, other, { children: _jsx(GradeRoundedIcon, { style: { fontSize: 60 } }) })));
|
|
30
|
+
function IconContainer({ value, ...other }) {
|
|
31
|
+
return (_jsx("span", { className: 'icon' + value, ...other, children: _jsx(GradeRoundedIcon, { style: { fontSize: 60 } }) }));
|
|
58
32
|
}
|
|
59
|
-
function SmallIconContainer(
|
|
60
|
-
|
|
61
|
-
return (_jsx("span", __assign({ className: 'icon' + value }, other, { children: _jsx(GradeRoundedIcon, { style: { fontSize: 50 } }) })));
|
|
33
|
+
function SmallIconContainer({ value, ...other }) {
|
|
34
|
+
return (_jsx("span", { className: 'icon' + value, ...other, children: _jsx(GradeRoundedIcon, { style: { fontSize: 50 } }) }));
|
|
62
35
|
}
|
|
63
36
|
export default ScaleRating;
|
|
@@ -1,45 +1,33 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
2
|
import { Button, withStyles } from '@material-ui/core';
|
|
14
3
|
/**
|
|
15
4
|
* Generic rounded button
|
|
16
5
|
*/
|
|
17
|
-
function RoundedButton(
|
|
18
|
-
|
|
19
|
-
var CustomButton = withStyles({
|
|
6
|
+
function RoundedButton({ text, backgroundColor = '#3d5a7f', color = '#ffffff', onClick, disabled, fontSize = '1rem', padding = '0 13px 0 13px', borderRadius = 10, height = 28, bold = false, width = 'fit-content', }) {
|
|
7
|
+
const CustomButton = withStyles({
|
|
20
8
|
root: {
|
|
21
|
-
width
|
|
9
|
+
width,
|
|
22
10
|
textTransform: 'none',
|
|
23
11
|
fontFamily: 'inherit',
|
|
24
|
-
fontSize
|
|
25
|
-
borderRadius
|
|
26
|
-
padding
|
|
12
|
+
fontSize,
|
|
13
|
+
borderRadius,
|
|
14
|
+
padding,
|
|
27
15
|
height: height,
|
|
28
16
|
boxShadow: 'none',
|
|
29
|
-
backgroundColor
|
|
30
|
-
color
|
|
17
|
+
backgroundColor,
|
|
18
|
+
color,
|
|
31
19
|
'&:hover': {
|
|
32
20
|
boxShadow: 'none',
|
|
33
|
-
backgroundColor
|
|
21
|
+
backgroundColor,
|
|
34
22
|
},
|
|
35
23
|
'&:disabled': {
|
|
36
|
-
backgroundColor
|
|
37
|
-
color
|
|
24
|
+
backgroundColor,
|
|
25
|
+
color,
|
|
38
26
|
opacity: 0.5,
|
|
39
27
|
},
|
|
40
28
|
fontWeight: bold ? 'bold' : 'normal',
|
|
41
29
|
},
|
|
42
30
|
})(Button);
|
|
43
|
-
return (_jsx(CustomButton,
|
|
31
|
+
return (_jsx(CustomButton, { variant: "contained", onMouseDown: onClick, disabled: disabled, children: text }));
|
|
44
32
|
}
|
|
45
33
|
export default RoundedButton;
|