@arquimedes.co/eureka-forms 1.6.2-test → 1.6.3-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.
@@ -95,7 +95,7 @@ function ColumnForm(_a) {
95
95
  return __generator(this, function (_c) {
96
96
  switch (_c.label) {
97
97
  case 0:
98
- if (!(apiKey || internal)) return [3 /*break*/, 11];
98
+ if (!(apiKey || internal || customSend)) return [3 /*break*/, 11];
99
99
  return [4 /*yield*/, trigger(undefined, { shouldFocus: true })];
100
100
  case 1:
101
101
  valid = _c.sent();
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import { RatingStepProps } from '../RatingStep';
3
- declare function MaterialRatingStep({ step, errors, ...others }: RatingStepProps): JSX.Element;
3
+ declare function MaterialRatingStep({ step, errors, editable, control, postview, formStyle, widthStats, }: RatingStepProps): JSX.Element;
4
4
  export default MaterialRatingStep;
@@ -9,56 +9,29 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
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
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
13
  import styles from './MaterialRatingStep.module.css';
25
- import { RatingTypes } from '../../../../constants/FormStepTypes';
26
- import LikeRating from './Ratings/LikeRating';
27
- import ScaleRating from './Ratings/ScaleRating';
28
- import SatisfactionRating from './Ratings/SatisfactionRating';
29
14
  import { Controller } from 'react-hook-form';
30
15
  import React from 'react';
16
+ import Rating from '../../../../shared/Rating/Rating';
31
17
  function MaterialRatingStep(_a) {
32
- var step = _a.step, errors = _a.errors, others = __rest(_a, ["step", "errors"]);
33
- var mapRating = function (field) {
34
- switch (step.ratingType) {
35
- case RatingTypes.LIKE:
36
- return (_jsx(LikeRating, __assign({ step: step, errors: errors }, others, { inputRef: field.ref, value: field.value, onChange: field.onChange }), void 0));
37
- case RatingTypes.SATISFACTION:
38
- return (_jsx(SatisfactionRating, __assign({ step: step, errors: errors }, others, { inputRef: field.ref, value: field.value, onChange: field.onChange }), void 0));
39
- case RatingTypes.SCALE:
40
- return (_jsx(ScaleRating, __assign({ step: step, errors: errors }, others, { inputRef: field.ref, value: field.value, onChange: field.onChange }), void 0));
41
- default:
42
- return _jsx("div", {}, void 0);
43
- }
44
- };
18
+ var step = _a.step, errors = _a.errors, editable = _a.editable, control = _a.control, postview = _a.postview, formStyle = _a.formStyle, widthStats = _a.widthStats;
45
19
  return (_jsxs("div", __assign({ className: styles.container, style: {
46
20
  paddingBottom: step.description || step.required ? 0 : 15,
47
- } }, { children: [_jsx("div", __assign({ className: styles.labelLabel }, { children: step.label + (step.required ? ' *' : '') }), void 0), _jsx(Controller, { name: step.id, control: others.control, defaultValue: 1, rules: {
21
+ } }, { children: [_jsx("div", __assign({ className: styles.labelLabel }, { children: step.label + (step.required ? ' *' : '') }), void 0), _jsx(Controller, { name: step.id, control: control, defaultValue: 1, rules: {
48
22
  required: step.required
49
23
  ? 'Este campo es obligatorio'
50
24
  : undefined,
51
25
  }, shouldUnregister: true, render: function (_a) {
52
- var _b, _c, _d;
26
+ var _b, _c, _d, _e, _f;
53
27
  var field = _a.field;
54
- return (_jsxs(React.Fragment, { children: [_jsx("div", __assign({ className: styles.ratingContainer }, { children: mapRating(field) }), void 0), (step.description || step.required) && (_jsx("div", __assign({ className: styles.stepDescriptionLabel, style: {
28
+ return (_jsxs(React.Fragment, { children: [_jsx("div", __assign({ className: styles.ratingContainer }, { children: _jsx(Rating, { type: step.ratingType, isMobile: widthStats.isMobile, focusColor: (_b = formStyle.primaryColor) !== null && _b !== void 0 ? _b : '#3d5a7f', unSelectedColor: (_c = formStyle.outlineColor) !== null && _c !== void 0 ? _c : '#b8b8b8', disabled: !editable || postview, value: field.value, onChange: field.onChange, inputRef: field.ref }, void 0) }), void 0), (step.description || step.required) && (_jsx("div", __assign({ className: styles.stepDescriptionLabel, style: {
55
29
  color: !!errors[step.id] &&
56
30
  field.value === null
57
- ? (_b = others.formStyle.errorColor) !== null && _b !== void 0 ? _b : '#cc2936'
58
- : (_c = others.formStyle
59
- .descriptionTextColor) !== null && _c !== void 0 ? _c : '#989898',
31
+ ? (_d = formStyle.errorColor) !== null && _d !== void 0 ? _d : '#cc2936'
32
+ : (_e = formStyle.descriptionTextColor) !== null && _e !== void 0 ? _e : '#989898',
60
33
  } }, { children: !!errors[step.id] && field.value === null
61
- ? (_d = errors[step.id]) === null || _d === void 0 ? void 0 : _d.message
34
+ ? (_f = errors[step.id]) === null || _f === void 0 ? void 0 : _f.message
62
35
  : step.description }), void 0))] }, void 0));
63
36
  } }, void 0)] }), void 0));
64
37
  }
@@ -28,28 +28,3 @@
28
28
  text-align: center;
29
29
  min-height: 20px;
30
30
  }
31
- .disabledSentimentContainer,
32
- .sentimentContainer {
33
- font-size: 60px;
34
- height: 60px;
35
- color: var(--eureka-outline);
36
- }
37
- .disabledLikeContainer,
38
- .likeContainer {
39
- font-size: 60px;
40
- height: 75px;
41
- color: var(--eureka-outline);
42
- }
43
-
44
- .likeContainer:hover,
45
- .sentimentContainer:hover {
46
- transform: scale(1.2);
47
- cursor: pointer;
48
- color: var(--eureka-primary);
49
- }
50
- .hiddenInput {
51
- height: 0;
52
- width: 0;
53
- padding: 0;
54
- border-width: 0;
55
- }
@@ -0,0 +1,15 @@
1
+ /// <reference types="react" />
2
+ import { RatingTypes } from '../../constants/FormStepTypes';
3
+ export interface RatingProps {
4
+ disabled?: boolean;
5
+ isMobile?: boolean;
6
+ value: any;
7
+ onChange: Function;
8
+ inputRef: any;
9
+ focusColor: string;
10
+ unSelectedColor: string;
11
+ }
12
+ declare function Rating({ type, ...others }: RatingProps & {
13
+ type: RatingTypes;
14
+ }): JSX.Element;
15
+ export default Rating;
@@ -0,0 +1,41 @@
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
+ import { jsx as _jsx } from "react/jsx-runtime";
24
+ import LikeRating from './Ratings/LikeRating';
25
+ import ScaleRating from './Ratings/ScaleRating';
26
+ import SatisfactionRating from './Ratings/SatisfactionRating';
27
+ import { RatingTypes } from '../../constants/FormStepTypes';
28
+ function Rating(_a) {
29
+ var type = _a.type, others = __rest(_a, ["type"]);
30
+ switch (type) {
31
+ case RatingTypes.LIKE:
32
+ return _jsx(LikeRating, __assign({}, others), void 0);
33
+ case RatingTypes.SATISFACTION:
34
+ return _jsx(SatisfactionRating, __assign({}, others), void 0);
35
+ case RatingTypes.SCALE:
36
+ return _jsx(ScaleRating, __assign({}, others), void 0);
37
+ default:
38
+ return _jsx("div", {}, void 0);
39
+ }
40
+ }
41
+ export default Rating;
@@ -0,0 +1,32 @@
1
+ .ratingContainer {
2
+ display: flex;
3
+ align-items: center;
4
+ justify-content: center;
5
+ }
6
+
7
+ .disabledSentimentContainer,
8
+ .sentimentContainer {
9
+ font-size: 60px;
10
+ height: 60px;
11
+ color: var(--eureka-outline);
12
+ }
13
+ .disabledLikeContainer,
14
+ .likeContainer {
15
+ font-size: 60px;
16
+ height: 75px;
17
+ color: var(--eureka-outline);
18
+ }
19
+
20
+ .likeContainer:hover,
21
+ .sentimentContainer:hover {
22
+ transform: scale(1.2);
23
+ cursor: pointer;
24
+ color: var(--eureka-primary);
25
+ }
26
+
27
+ .hiddenInput {
28
+ height: 0;
29
+ width: 0;
30
+ padding: 0;
31
+ border-width: 0;
32
+ }
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { RatingProps } from '../Rating';
3
+ declare function LikeRating({ disabled, inputRef, value, onChange, focusColor, unSelectedColor, }: RatingProps): JSX.Element;
4
+ export default LikeRating;
@@ -12,31 +12,29 @@ var __assign = (this && this.__assign) || function () {
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import ThumbDownRoundedIcon from '@material-ui/icons/ThumbDownRounded';
14
14
  import ThumbUpRoundedIcon from '@material-ui/icons/ThumbUpRounded';
15
- import styles from '../MaterialRatingStep.module.css';
15
+ import styles from '../Rating.module.css';
16
16
  function LikeRating(_a) {
17
- var _b, _c, _d, _e;
18
- var value = _a.value, inputRef = _a.inputRef, editable = _a.editable, postview = _a.postview, onChange = _a.onChange, formStyle = _a.formStyle;
19
- var cantEdit = !editable || postview;
17
+ var disabled = _a.disabled, inputRef = _a.inputRef, value = _a.value, onChange = _a.onChange, focusColor = _a.focusColor, unSelectedColor = _a.unSelectedColor;
20
18
  return (_jsxs("div", __assign({ className: styles.ratingContainer, style: {
21
- '--eureka-primary': (_b = formStyle.primaryColor) !== null && _b !== void 0 ? _b : '#3d5a7f',
22
- '--eureka-outline': (_c = formStyle.outlineColor) !== null && _c !== void 0 ? _c : '#b8b8b8',
23
- } }, { children: [_jsx("input", { ref: inputRef, className: styles.hiddenInput }, void 0), _jsx("div", __assign({ className: cantEdit
19
+ '--eureka-primary': focusColor,
20
+ '--eureka-outline': unSelectedColor,
21
+ } }, { children: [_jsx("input", { ref: inputRef, className: styles.hiddenInput }, void 0), _jsx("div", __assign({ className: disabled
24
22
  ? styles.disabledLikeContainer
25
23
  : styles.likeContainer, onClick: function () {
26
- if (!cantEdit)
24
+ if (!disabled)
27
25
  onChange(value === 1 ? null : 1);
28
26
  } }, { children: _jsx(ThumbUpRoundedIcon, { fontSize: "inherit", style: value === 1
29
27
  ? {
30
- color: (_d = formStyle.primaryColor) !== null && _d !== void 0 ? _d : '#3d5a7f',
28
+ color: focusColor,
31
29
  }
32
- : {} }, void 0) }), void 0), _jsx("div", __assign({ className: cantEdit
30
+ : {} }, void 0) }), void 0), _jsx("div", __assign({ className: disabled
33
31
  ? styles.disabledLikeContainer
34
32
  : styles.likeContainer, onClick: function () {
35
- if (!cantEdit)
33
+ if (!disabled)
36
34
  onChange(value === 0 ? null : 0);
37
35
  } }, { children: _jsx(ThumbDownRoundedIcon, { fontSize: "inherit", style: value === 0
38
36
  ? {
39
- color: (_e = formStyle.primaryColor) !== null && _e !== void 0 ? _e : '#3d5a7f',
37
+ color: focusColor,
40
38
  marginTop: 14,
41
39
  marginLeft: 15,
42
40
  }
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { RatingProps } from '../Rating';
3
+ declare function SatisfactionRating({ value, inputRef, disabled, onChange, focusColor, unSelectedColor, }: RatingProps): JSX.Element;
4
+ export default SatisfactionRating;
@@ -10,53 +10,51 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- import styles from '../MaterialRatingStep.module.css';
13
+ import styles from '../Rating.module.css';
14
14
  import SentimentVeryDissatisfiedIcon from '@material-ui/icons/SentimentVeryDissatisfied';
15
15
  import SentimentDissatisfiedIcon from '@material-ui/icons/SentimentDissatisfied';
16
16
  import SentimentSatisfiedAltIcon from '@material-ui/icons/SentimentSatisfiedAltOutlined';
17
17
  import SentimentVerySatisfiedIcon from '@material-ui/icons/SentimentVerySatisfied';
18
18
  function SatisfactionRating(_a) {
19
- var _b, _c, _d, _e, _f, _g;
20
- var value = _a.value, inputRef = _a.inputRef, editable = _a.editable, postview = _a.postview, onChange = _a.onChange, formStyle = _a.formStyle;
21
- var cantEdit = !editable || postview;
19
+ var value = _a.value, inputRef = _a.inputRef, disabled = _a.disabled, onChange = _a.onChange, focusColor = _a.focusColor, unSelectedColor = _a.unSelectedColor;
22
20
  return (_jsxs("div", __assign({ className: styles.ratingContainer, style: {
23
- '--eureka-primary': (_b = formStyle.primaryColor) !== null && _b !== void 0 ? _b : '#3d5a7f',
24
- '--eureka-outline': (_c = formStyle.outlineColor) !== null && _c !== void 0 ? _c : '#b8b8b8',
25
- } }, { children: [_jsx("input", { ref: inputRef, className: styles.hiddenInput }, void 0), _jsx("div", __assign({ className: cantEdit
21
+ '--eureka-primary': focusColor,
22
+ '--eureka-outline': unSelectedColor,
23
+ } }, { children: [_jsx("input", { ref: inputRef, className: styles.hiddenInput }, void 0), _jsx("div", __assign({ className: disabled
26
24
  ? styles.disabledSentimentContainer
27
25
  : styles.sentimentContainer, onClick: function () {
28
- if (!cantEdit)
26
+ if (!disabled)
29
27
  onChange(value === 1 ? null : 1);
30
28
  } }, { children: _jsx(SentimentVeryDissatisfiedIcon, { fontSize: "inherit", style: value === 1
31
29
  ? {
32
- color: (_d = formStyle.primaryColor) !== null && _d !== void 0 ? _d : '#3d5a7f',
30
+ color: focusColor,
33
31
  }
34
- : {} }, void 0) }), void 0), _jsx("div", __assign({ className: cantEdit
32
+ : {} }, void 0) }), void 0), _jsx("div", __assign({ className: disabled
35
33
  ? styles.disabledSentimentContainer
36
34
  : styles.sentimentContainer, onClick: function () {
37
- if (!cantEdit)
35
+ if (!disabled)
38
36
  onChange(value === 2 ? null : 2);
39
37
  } }, { children: _jsx(SentimentDissatisfiedIcon, { fontSize: "inherit", style: value === 2
40
38
  ? {
41
- color: (_e = formStyle.primaryColor) !== null && _e !== void 0 ? _e : '#3d5a7f',
39
+ color: focusColor,
42
40
  }
43
- : {} }, void 0) }), void 0), _jsx("div", __assign({ className: cantEdit
41
+ : {} }, void 0) }), void 0), _jsx("div", __assign({ className: disabled
44
42
  ? styles.disabledSentimentContainer
45
43
  : styles.sentimentContainer, onClick: function () {
46
- if (!cantEdit)
44
+ if (!disabled)
47
45
  onChange(value === 3 ? null : 3);
48
46
  } }, { children: _jsx(SentimentSatisfiedAltIcon, { fontSize: "inherit", style: value === 3
49
47
  ? {
50
- color: (_f = formStyle.primaryColor) !== null && _f !== void 0 ? _f : '#3d5a7f',
48
+ color: focusColor,
51
49
  }
52
- : {} }, void 0) }), void 0), _jsx("div", __assign({ className: cantEdit
50
+ : {} }, void 0) }), void 0), _jsx("div", __assign({ className: disabled
53
51
  ? styles.disabledSentimentContainer
54
52
  : styles.sentimentContainer, onClick: function () {
55
- if (!cantEdit)
53
+ if (!disabled)
56
54
  onChange(value === 4 ? null : 4);
57
55
  } }, { children: _jsx(SentimentVerySatisfiedIcon, { fontSize: "inherit", style: value === 4
58
56
  ? {
59
- color: (_g = formStyle.primaryColor) !== null && _g !== void 0 ? _g : '#3d5a7f',
57
+ color: focusColor,
60
58
  }
61
59
  : {} }, void 0) }), void 0)] }), void 0));
62
60
  }
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { RatingProps } from '../Rating';
3
+ declare function ScaleRating({ value, inputRef, disabled, onChange, isMobile, focusColor, unSelectedColor, }: RatingProps): JSX.Element;
4
+ export default ScaleRating;
@@ -21,38 +21,36 @@ var __rest = (this && this.__rest) || function (s, e) {
21
21
  return t;
22
22
  };
23
23
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
- import styles from '../MaterialRatingStep.module.css';
24
+ import styles from '../Rating.module.css';
25
25
  import { Rating } from '@material-ui/lab';
26
26
  import GradeRoundedIcon from '@material-ui/icons/GradeRounded';
27
27
  import { makeStyles } from '@material-ui/core';
28
28
  import React from 'react';
29
29
  var useRatingStyles = function (props) {
30
- var _a, _b;
31
30
  return makeStyles({
32
31
  root: {
33
32
  '&.Mui-disabled': {
34
33
  opacity: 1,
35
34
  },
36
35
  '& .EF-MuiRating-iconFilled': {
37
- color: (_a = props.focusColor) !== null && _a !== void 0 ? _a : '#3d5a7f',
36
+ color: props.focusColor,
38
37
  },
39
38
  '& .EF-MuiRating-iconEmpty': {
40
- color: (_b = props.outlineColor) !== null && _b !== void 0 ? _b : '#b8b8b8',
39
+ color: props.unSelectedColor,
41
40
  },
42
41
  },
43
42
  });
44
43
  };
45
44
  function ScaleRating(_a) {
46
- var value = _a.value, inputRef = _a.inputRef, editable = _a.editable, postview = _a.postview, onChange = _a.onChange, widthStats = _a.widthStats, formStyle = _a.formStyle;
47
- var cantEdit = !editable || postview;
45
+ var value = _a.value, inputRef = _a.inputRef, disabled = _a.disabled, onChange = _a.onChange, isMobile = _a.isMobile, focusColor = _a.focusColor, unSelectedColor = _a.unSelectedColor;
48
46
  var ratingClasses = useRatingStyles({
49
- outlineColor: formStyle.outlineColor,
50
- focusColor: formStyle.primaryColor,
47
+ unSelectedColor: unSelectedColor,
48
+ focusColor: focusColor,
51
49
  })();
52
50
  return (_jsxs(React.Fragment, { children: [_jsx("input", { ref: inputRef, className: styles.hiddenInput }, void 0), _jsx(Rating, { value: value, onChange: function (_event, newValue) {
53
- if (!cantEdit)
51
+ if (!disabled)
54
52
  onChange(newValue);
55
- }, disabled: cantEdit, classes: ratingClasses, name: "customized-icons", size: "large", defaultValue: 0, getLabelText: function (value) { return value + '/5'; }, max: 5, IconContainerComponent: widthStats.isMobile ? SmallIconContainer : IconContainer }, void 0)] }, void 0));
53
+ }, disabled: disabled, classes: ratingClasses, name: "customized-icons", size: "large", defaultValue: 0, getLabelText: function (value) { return value + '/5'; }, max: 5, IconContainerComponent: isMobile ? SmallIconContainer : IconContainer }, void 0)] }, void 0));
56
54
  }
57
55
  function IconContainer(_a) {
58
56
  var value = _a.value, other = __rest(_a, ["value"]);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@arquimedes.co/eureka-forms",
3
3
  "repository": "git://github.com/Arquimede5/Eureka-Forms.git",
4
- "version":"1.6.2-test",
4
+ "version":"1.6.3-test",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
7
7
  "build": "react-scripts build",
@@ -1,8 +0,0 @@
1
- /// <reference types="react" />
2
- import { RatingStepProps } from '../../RatingStep';
3
- declare function LikeRating({ value, inputRef, editable, postview, onChange, formStyle, }: RatingStepProps & {
4
- value: any;
5
- onChange: Function;
6
- inputRef: any;
7
- }): JSX.Element;
8
- export default LikeRating;
@@ -1,8 +0,0 @@
1
- /// <reference types="react" />
2
- import { RatingStepProps } from '../../RatingStep';
3
- declare function SatisfactionRating({ value, inputRef, editable, postview, onChange, formStyle, }: RatingStepProps & {
4
- value: any;
5
- onChange: Function;
6
- inputRef: any;
7
- }): JSX.Element;
8
- export default SatisfactionRating;
@@ -1,8 +0,0 @@
1
- /// <reference types="react" />
2
- import { RatingStepProps } from '../../RatingStep';
3
- declare function ScaleRating({ value, inputRef, editable, postview, onChange, widthStats, formStyle, }: RatingStepProps & {
4
- value: any;
5
- onChange: Function;
6
- inputRef: any;
7
- }): JSX.Element;
8
- export default ScaleRating;