@pareto-engineering/design-system 2.0.0-alpha.19 → 2.0.0-alpha.22
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/{experimental/GradientBackground/GradientBackground.js → a/RatingsInput/RatingsInput.js} +27 -37
- package/dist/cjs/a/RatingsInput/common/Rating/Rating.js +120 -0
- package/dist/cjs/a/RatingsInput/common/Rating/index.js +15 -0
- package/dist/cjs/a/RatingsInput/common/index.js +13 -0
- package/dist/cjs/a/RatingsInput/index.js +15 -0
- package/dist/cjs/a/RatingsInput/styles.scss +35 -0
- package/dist/cjs/a/index.js +8 -0
- package/dist/cjs/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.js +3 -3
- package/dist/cjs/c/ContentSlides/styles.scss +10 -4
- package/dist/es/a/RatingsInput/RatingsInput.js +72 -0
- package/dist/es/a/RatingsInput/common/Rating/Rating.js +102 -0
- package/dist/es/a/RatingsInput/common/Rating/index.js +2 -0
- package/dist/es/a/RatingsInput/common/index.js +1 -0
- package/dist/es/a/RatingsInput/index.js +2 -0
- package/dist/es/a/RatingsInput/styles.scss +35 -0
- package/dist/es/a/index.js +1 -0
- package/dist/es/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.js +3 -3
- package/dist/es/c/ContentSlides/styles.scss +10 -4
- package/package.json +1 -1
- package/src/__snapshots__/Storyshots.test.js.snap +437 -4
- package/src/stories/a/SnapScroller.stories.jsx +98 -0
- package/src/stories/c/ContentSlides.stories.jsx +154 -2
- package/src/ui/a/SnapScroller/SnapScroller.jsx +83 -0
- package/src/ui/a/SnapScroller/index.js +2 -0
- package/src/ui/a/SnapScroller/styles.scss +38 -0
- package/src/ui/a/index.js +1 -0
- package/src/ui/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.jsx +3 -3
- package/src/ui/c/ContentSlides/styles.scss +10 -4
- package/dist/cjs/a/GradientBackground/GradientBackground.js +0 -140
- package/dist/cjs/a/GradientBackground/index.js +0 -15
- package/dist/cjs/a/GradientBackground/styles.scss +0 -191
- package/dist/cjs/experimental/GradientBackground/index.js +0 -15
- package/dist/cjs/experimental/GradientBackground/styles.scss +0 -64
- package/dist/cjs/experimental/index.js +0 -13
- package/dist/es/a/GradientBackground/GradientBackground.js +0 -118
- package/dist/es/a/GradientBackground/index.js +0 -2
- package/dist/es/a/GradientBackground/styles.scss +0 -191
- package/dist/es/experimental/GradientBackground/GradientBackground.js +0 -76
- package/dist/es/experimental/GradientBackground/index.js +0 -2
- package/dist/es/experimental/GradientBackground/styles.scss +0 -64
- package/dist/es/experimental/index.js +0 -1
|
@@ -11,60 +11,52 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
11
11
|
|
|
12
12
|
var _bem = _interopRequireDefault(require("@pareto-engineering/bem"));
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
14
|
+
var _common = require("./common");
|
|
17
15
|
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
17
|
|
|
22
18
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
19
|
|
|
24
20
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
21
|
|
|
26
|
-
// Local Definitions
|
|
27
22
|
var baseClassName = _bem.default.base;
|
|
28
|
-
var componentClassName = '
|
|
23
|
+
var componentClassName = 'ratings-input';
|
|
29
24
|
/**
|
|
30
25
|
* This is the component description.
|
|
31
26
|
*/
|
|
32
27
|
|
|
33
|
-
var
|
|
28
|
+
var RatingsInput = _ref => {
|
|
34
29
|
var {
|
|
35
30
|
id,
|
|
36
31
|
className: userClassName,
|
|
37
32
|
style,
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
name,
|
|
34
|
+
ratingCount // ...otherProps
|
|
40
35
|
|
|
41
36
|
} = _ref;
|
|
42
37
|
(0, React.useLayoutEffect)(() => {
|
|
43
38
|
Promise.resolve().then(() => _interopRequireWildcard(require("./styles.scss")));
|
|
44
39
|
}, []);
|
|
40
|
+
var [hover, setHover] = (0, React.useState)(null);
|
|
45
41
|
return /*#__PURE__*/React.createElement("div", {
|
|
46
42
|
id: id,
|
|
47
43
|
className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
|
|
48
|
-
style:
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
})
|
|
61
|
-
className: "down"
|
|
62
|
-
})), shape === 'ellipse' && /*#__PURE__*/React.createElement("div", {
|
|
63
|
-
className: "ellipse"
|
|
64
|
-
})));
|
|
44
|
+
style: style // {...otherProps}
|
|
45
|
+
|
|
46
|
+
}, [...Array(ratingCount)].map((_, index) => {
|
|
47
|
+
var ratingValue = index + 1;
|
|
48
|
+
return /*#__PURE__*/React.createElement(_common.Rating, {
|
|
49
|
+
key: ratingValue,
|
|
50
|
+
ratingId: "".concat(name, "-").concat(ratingValue),
|
|
51
|
+
value: ratingValue,
|
|
52
|
+
name: name,
|
|
53
|
+
hover: hover,
|
|
54
|
+
setHover: setHover
|
|
55
|
+
});
|
|
56
|
+
}));
|
|
65
57
|
};
|
|
66
58
|
|
|
67
|
-
|
|
59
|
+
RatingsInput.propTypes = {
|
|
68
60
|
/**
|
|
69
61
|
* The HTML id for this element
|
|
70
62
|
*/
|
|
@@ -81,18 +73,16 @@ GradientBackground.propTypes = {
|
|
|
81
73
|
style: _propTypes.default.objectOf(_propTypes.default.string),
|
|
82
74
|
|
|
83
75
|
/**
|
|
84
|
-
*
|
|
76
|
+
* The number of ratings input stars to be displayed
|
|
85
77
|
*/
|
|
86
|
-
|
|
78
|
+
ratingCount: _propTypes.default.number,
|
|
87
79
|
|
|
88
80
|
/**
|
|
89
|
-
*
|
|
81
|
+
* Name of the rating input
|
|
90
82
|
*/
|
|
91
|
-
|
|
83
|
+
name: _propTypes.default.string
|
|
92
84
|
};
|
|
93
|
-
|
|
94
|
-
pin: 'center',
|
|
95
|
-
shape: 'triangle'
|
|
85
|
+
RatingsInput.defaultProps = {// someProp:false
|
|
96
86
|
};
|
|
97
|
-
var _default =
|
|
87
|
+
var _default = RatingsInput;
|
|
98
88
|
exports.default = _default;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _formik = require("formik");
|
|
13
|
+
|
|
14
|
+
var _bem = _interopRequireDefault(require("@pareto-engineering/bem"));
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
|
+
|
|
20
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
+
|
|
22
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
23
|
+
|
|
24
|
+
// Local Definitions
|
|
25
|
+
var baseClassName = _bem.default.base;
|
|
26
|
+
var componentClassName = 'rating';
|
|
27
|
+
/**
|
|
28
|
+
* This is the component description.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
var Rating = _ref => {
|
|
32
|
+
var {
|
|
33
|
+
id,
|
|
34
|
+
className: userClassName,
|
|
35
|
+
style,
|
|
36
|
+
value,
|
|
37
|
+
name,
|
|
38
|
+
ratingId,
|
|
39
|
+
hover,
|
|
40
|
+
setHover,
|
|
41
|
+
activeBackgroundColor,
|
|
42
|
+
inactiveBackgroundColor // ...otherProps
|
|
43
|
+
|
|
44
|
+
} = _ref;
|
|
45
|
+
var [field] = (0, _formik.useField)(name);
|
|
46
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
47
|
+
id: id,
|
|
48
|
+
className: [baseClassName, componentClassName, userClassName, "x-".concat(activeBackgroundColor), "y-".concat(inactiveBackgroundColor)].filter(e => e).join(' '),
|
|
49
|
+
style: style
|
|
50
|
+
}, /*#__PURE__*/React.createElement("label", {
|
|
51
|
+
htmlFor: ratingId,
|
|
52
|
+
onMouseEnter: () => setHover(value),
|
|
53
|
+
onMouseLeave: () => setHover(null)
|
|
54
|
+
}, ' ', /*#__PURE__*/React.createElement("span", {
|
|
55
|
+
className: ['f-icons', value <= (hover || Number(field.value)) ? 'c-x' : 'c-dark-y'].filter(e => e).join(' ')
|
|
56
|
+
}, "[")), /*#__PURE__*/React.createElement("input", _extends({}, field, {
|
|
57
|
+
type: "radio",
|
|
58
|
+
id: ratingId,
|
|
59
|
+
name: name,
|
|
60
|
+
value: value
|
|
61
|
+
})));
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
Rating.propTypes = {
|
|
65
|
+
/**
|
|
66
|
+
* The HTML id for this element
|
|
67
|
+
*/
|
|
68
|
+
id: _propTypes.default.string,
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* The HTML class names for this element
|
|
72
|
+
*/
|
|
73
|
+
className: _propTypes.default.string,
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* The React-written, css properties for this element.
|
|
77
|
+
*/
|
|
78
|
+
style: _propTypes.default.objectOf(_propTypes.default.string),
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* The value of each an every rating star
|
|
82
|
+
*/
|
|
83
|
+
value: _propTypes.default.number,
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* The current hover value
|
|
87
|
+
*/
|
|
88
|
+
hover: _propTypes.default.number,
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Function to update the hover value
|
|
92
|
+
*/
|
|
93
|
+
setHover: _propTypes.default.func,
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Unique Id for each rating star
|
|
97
|
+
*/
|
|
98
|
+
ratingId: _propTypes.default.string,
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Name of the rating input
|
|
102
|
+
*/
|
|
103
|
+
name: _propTypes.default.string,
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* The start rating backgriund color when hovered or clicked
|
|
107
|
+
*/
|
|
108
|
+
activeBackgroundColor: _propTypes.default.string,
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* The start rating backgriund color when not hovered and not clicked
|
|
112
|
+
*/
|
|
113
|
+
inactiveBackgroundColor: _propTypes.default.string
|
|
114
|
+
};
|
|
115
|
+
Rating.defaultProps = {
|
|
116
|
+
activeBackgroundColor: 'secondary2',
|
|
117
|
+
inactiveBackgroundColor: 'background'
|
|
118
|
+
};
|
|
119
|
+
var _default = Rating;
|
|
120
|
+
exports.default = _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "Rating", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _Rating.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
var _Rating = _interopRequireDefault(require("./Rating"));
|
|
14
|
+
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "RatingsInput", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _RatingsInput.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
var _RatingsInput = _interopRequireDefault(require("./RatingsInput"));
|
|
14
|
+
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
@use "@pareto-engineering/bem";
|
|
3
|
+
|
|
4
|
+
$default-rating-icon-margin: .5em;
|
|
5
|
+
$default-padding: .2em;
|
|
6
|
+
$default-transition: all .2s;
|
|
7
|
+
|
|
8
|
+
.#{bem.$base}.ratings-input {
|
|
9
|
+
display: flex;
|
|
10
|
+
|
|
11
|
+
>:not(:first-child) {
|
|
12
|
+
margin-left: $default-rating-icon-margin;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.#{bem.$base}.rating {
|
|
16
|
+
display: flex;
|
|
17
|
+
|
|
18
|
+
input {
|
|
19
|
+
opacity: 0;
|
|
20
|
+
position: absolute;
|
|
21
|
+
visibility: none;
|
|
22
|
+
z-index: -1;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
label {
|
|
26
|
+
padding: $default-padding;
|
|
27
|
+
transition: $default-transition;
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
package/dist/cjs/a/index.js
CHANGED
|
@@ -153,6 +153,12 @@ Object.defineProperty(exports, "OvalIllustration", {
|
|
|
153
153
|
return _OvalIllustration.OvalIllustration;
|
|
154
154
|
}
|
|
155
155
|
});
|
|
156
|
+
Object.defineProperty(exports, "SnapScroller", {
|
|
157
|
+
enumerable: true,
|
|
158
|
+
get: function get() {
|
|
159
|
+
return _SnapScroller.SnapScroller;
|
|
160
|
+
}
|
|
161
|
+
});
|
|
156
162
|
Object.defineProperty(exports, "BackgroundGradient", {
|
|
157
163
|
enumerable: true,
|
|
158
164
|
get: function get() {
|
|
@@ -204,4 +210,6 @@ var _Shapes = require("./Shapes");
|
|
|
204
210
|
|
|
205
211
|
var _OvalIllustration = require("./OvalIllustration");
|
|
206
212
|
|
|
213
|
+
var _SnapScroller = require("./SnapScroller");
|
|
214
|
+
|
|
207
215
|
var _BackgroundGradient = require("./BackgroundGradient");
|
|
@@ -75,12 +75,12 @@ var HorizontalMenu = _ref => {
|
|
|
75
75
|
}, /*#__PURE__*/React.createElement("div", {
|
|
76
76
|
className: "left"
|
|
77
77
|
}, !isFirstStep && !hideBackIcon && /*#__PURE__*/React.createElement("span", {
|
|
78
|
-
className: "
|
|
78
|
+
className: "prev-button pointer",
|
|
79
79
|
onClick: mobilePreviousStep,
|
|
80
80
|
role: "button",
|
|
81
81
|
onKeyDown: mobilePreviousStep,
|
|
82
82
|
tabIndex: 0
|
|
83
|
-
},
|
|
83
|
+
}, '<--')), /*#__PURE__*/React.createElement("div", {
|
|
84
84
|
className: "title"
|
|
85
85
|
}, /*#__PURE__*/React.createElement("span", {
|
|
86
86
|
className: "md-h lg-h"
|
|
@@ -128,7 +128,7 @@ HorizontalMenu.propTypes = {
|
|
|
128
128
|
hideBackIcon: _propTypes.default.bool
|
|
129
129
|
};
|
|
130
130
|
HorizontalMenu.defaultProps = {
|
|
131
|
-
logoColor: '
|
|
131
|
+
logoColor: 'paragraph',
|
|
132
132
|
stepsBackwards: 1
|
|
133
133
|
};
|
|
134
134
|
var _default = HorizontalMenu;
|
|
@@ -14,7 +14,7 @@ $class-navigator:navigator;
|
|
|
14
14
|
$default-sidebar-width:minmax(250px, 330px);
|
|
15
15
|
$default-border:none;//2px solid var(--grid);
|
|
16
16
|
$default-border-radius:var(--theme-border-radius);
|
|
17
|
-
$default-content-background:var(--
|
|
17
|
+
$default-content-background: var(--background1);
|
|
18
18
|
$default-padding:var(--u);
|
|
19
19
|
|
|
20
20
|
$mobile-content-margin:6em;
|
|
@@ -61,7 +61,6 @@ $mobile-content-margin:6em;
|
|
|
61
61
|
|
|
62
62
|
//.#{$class-main-container} {
|
|
63
63
|
main {
|
|
64
|
-
background: var(--dark-y);
|
|
65
64
|
overflow: hidden;
|
|
66
65
|
position: relative;
|
|
67
66
|
|
|
@@ -79,7 +78,7 @@ $mobile-content-margin:6em;
|
|
|
79
78
|
.#{bem.$element-content} {
|
|
80
79
|
background: $default-content-background;
|
|
81
80
|
|
|
82
|
-
border:
|
|
81
|
+
border: var(--theme-border);
|
|
83
82
|
border-radius: $default-border-radius;
|
|
84
83
|
max-width: 600px;
|
|
85
84
|
padding: $default-padding;
|
|
@@ -108,8 +107,9 @@ $mobile-content-margin:6em;
|
|
|
108
107
|
|
|
109
108
|
.#{$class-horizontal-menu} {
|
|
110
109
|
background: $default-content-background;
|
|
111
|
-
border-bottom:
|
|
110
|
+
border-bottom: var(--theme-border);
|
|
112
111
|
color: var(--heading);
|
|
112
|
+
z-index: 1;
|
|
113
113
|
|
|
114
114
|
.#{bem.$element-content} {
|
|
115
115
|
display: grid;
|
|
@@ -124,6 +124,11 @@ $mobile-content-margin:6em;
|
|
|
124
124
|
|
|
125
125
|
.left {
|
|
126
126
|
text-align: left;
|
|
127
|
+
|
|
128
|
+
.prev-button {
|
|
129
|
+
font-family: var(--theme-default-paragraph);
|
|
130
|
+
font-size: calc(var(--s2) * 1em);
|
|
131
|
+
}
|
|
127
132
|
}
|
|
128
133
|
|
|
129
134
|
.right {
|
|
@@ -210,6 +215,7 @@ $mobile-content-margin:6em;
|
|
|
210
215
|
|
|
211
216
|
.next {
|
|
212
217
|
flex-grow: 1;
|
|
218
|
+
justify-content: flex-end;
|
|
213
219
|
}
|
|
214
220
|
}
|
|
215
221
|
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useState, useLayoutEffect } from 'react';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import styleNames from '@pareto-engineering/bem'; // Local Definitions
|
|
6
|
+
|
|
7
|
+
import { Rating } from "./common";
|
|
8
|
+
const baseClassName = styleNames.base;
|
|
9
|
+
const componentClassName = 'ratings-input';
|
|
10
|
+
/**
|
|
11
|
+
* This is the component description.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
const RatingsInput = ({
|
|
15
|
+
id,
|
|
16
|
+
className: userClassName,
|
|
17
|
+
style,
|
|
18
|
+
name,
|
|
19
|
+
ratingCount // ...otherProps
|
|
20
|
+
|
|
21
|
+
}) => {
|
|
22
|
+
useLayoutEffect(() => {
|
|
23
|
+
import("./styles.scss");
|
|
24
|
+
}, []);
|
|
25
|
+
const [hover, setHover] = useState(null);
|
|
26
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
27
|
+
id: id,
|
|
28
|
+
className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
|
|
29
|
+
style: style // {...otherProps}
|
|
30
|
+
|
|
31
|
+
}, [...Array(ratingCount)].map((_, index) => {
|
|
32
|
+
const ratingValue = index + 1;
|
|
33
|
+
return /*#__PURE__*/React.createElement(Rating, {
|
|
34
|
+
key: ratingValue,
|
|
35
|
+
ratingId: `${name}-${ratingValue}`,
|
|
36
|
+
value: ratingValue,
|
|
37
|
+
name: name,
|
|
38
|
+
hover: hover,
|
|
39
|
+
setHover: setHover
|
|
40
|
+
});
|
|
41
|
+
}));
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
RatingsInput.propTypes = {
|
|
45
|
+
/**
|
|
46
|
+
* The HTML id for this element
|
|
47
|
+
*/
|
|
48
|
+
id: PropTypes.string,
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The HTML class names for this element
|
|
52
|
+
*/
|
|
53
|
+
className: PropTypes.string,
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* The React-written, css properties for this element.
|
|
57
|
+
*/
|
|
58
|
+
style: PropTypes.objectOf(PropTypes.string),
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The number of ratings input stars to be displayed
|
|
62
|
+
*/
|
|
63
|
+
ratingCount: PropTypes.number,
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Name of the rating input
|
|
67
|
+
*/
|
|
68
|
+
name: PropTypes.string
|
|
69
|
+
};
|
|
70
|
+
RatingsInput.defaultProps = {// someProp:false
|
|
71
|
+
};
|
|
72
|
+
export default RatingsInput;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
3
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import { useField } from 'formik';
|
|
7
|
+
import styleNames from '@pareto-engineering/bem'; // Local Definitions
|
|
8
|
+
|
|
9
|
+
const baseClassName = styleNames.base;
|
|
10
|
+
const componentClassName = 'rating';
|
|
11
|
+
/**
|
|
12
|
+
* This is the component description.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
const Rating = ({
|
|
16
|
+
id,
|
|
17
|
+
className: userClassName,
|
|
18
|
+
style,
|
|
19
|
+
value,
|
|
20
|
+
name,
|
|
21
|
+
ratingId,
|
|
22
|
+
hover,
|
|
23
|
+
setHover,
|
|
24
|
+
activeBackgroundColor,
|
|
25
|
+
inactiveBackgroundColor // ...otherProps
|
|
26
|
+
|
|
27
|
+
}) => {
|
|
28
|
+
const [field] = useField(name);
|
|
29
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
30
|
+
id: id,
|
|
31
|
+
className: [baseClassName, componentClassName, userClassName, `x-${activeBackgroundColor}`, `y-${inactiveBackgroundColor}`].filter(e => e).join(' '),
|
|
32
|
+
style: style
|
|
33
|
+
}, /*#__PURE__*/React.createElement("label", {
|
|
34
|
+
htmlFor: ratingId,
|
|
35
|
+
onMouseEnter: () => setHover(value),
|
|
36
|
+
onMouseLeave: () => setHover(null)
|
|
37
|
+
}, ' ', /*#__PURE__*/React.createElement("span", {
|
|
38
|
+
className: ['f-icons', value <= (hover || Number(field.value)) ? 'c-x' : 'c-dark-y'].filter(e => e).join(' ')
|
|
39
|
+
}, "[")), /*#__PURE__*/React.createElement("input", _extends({}, field, {
|
|
40
|
+
type: "radio",
|
|
41
|
+
id: ratingId,
|
|
42
|
+
name: name,
|
|
43
|
+
value: value
|
|
44
|
+
})));
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
Rating.propTypes = {
|
|
48
|
+
/**
|
|
49
|
+
* The HTML id for this element
|
|
50
|
+
*/
|
|
51
|
+
id: PropTypes.string,
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* The HTML class names for this element
|
|
55
|
+
*/
|
|
56
|
+
className: PropTypes.string,
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* The React-written, css properties for this element.
|
|
60
|
+
*/
|
|
61
|
+
style: PropTypes.objectOf(PropTypes.string),
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* The value of each an every rating star
|
|
65
|
+
*/
|
|
66
|
+
value: PropTypes.number,
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* The current hover value
|
|
70
|
+
*/
|
|
71
|
+
hover: PropTypes.number,
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Function to update the hover value
|
|
75
|
+
*/
|
|
76
|
+
setHover: PropTypes.func,
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Unique Id for each rating star
|
|
80
|
+
*/
|
|
81
|
+
ratingId: PropTypes.string,
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Name of the rating input
|
|
85
|
+
*/
|
|
86
|
+
name: PropTypes.string,
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* The start rating backgriund color when hovered or clicked
|
|
90
|
+
*/
|
|
91
|
+
activeBackgroundColor: PropTypes.string,
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* The start rating backgriund color when not hovered and not clicked
|
|
95
|
+
*/
|
|
96
|
+
inactiveBackgroundColor: PropTypes.string
|
|
97
|
+
};
|
|
98
|
+
Rating.defaultProps = {
|
|
99
|
+
activeBackgroundColor: 'secondary2',
|
|
100
|
+
inactiveBackgroundColor: 'background'
|
|
101
|
+
};
|
|
102
|
+
export default Rating;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Rating } from "./Rating";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
@use "@pareto-engineering/bem";
|
|
3
|
+
|
|
4
|
+
$default-rating-icon-margin: .5em;
|
|
5
|
+
$default-padding: .2em;
|
|
6
|
+
$default-transition: all .2s;
|
|
7
|
+
|
|
8
|
+
.#{bem.$base}.ratings-input {
|
|
9
|
+
display: flex;
|
|
10
|
+
|
|
11
|
+
>:not(:first-child) {
|
|
12
|
+
margin-left: $default-rating-icon-margin;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.#{bem.$base}.rating {
|
|
16
|
+
display: flex;
|
|
17
|
+
|
|
18
|
+
input {
|
|
19
|
+
opacity: 0;
|
|
20
|
+
position: absolute;
|
|
21
|
+
visibility: none;
|
|
22
|
+
z-index: -1;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
label {
|
|
26
|
+
padding: $default-padding;
|
|
27
|
+
transition: $default-transition;
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
package/dist/es/a/index.js
CHANGED
|
@@ -20,4 +20,5 @@ export { DotInfo } from "./DotInfo";
|
|
|
20
20
|
export { Timestamp } from "./Timestamp";
|
|
21
21
|
export { Shapes } from "./Shapes";
|
|
22
22
|
export { OvalIllustration } from "./OvalIllustration";
|
|
23
|
+
export { SnapScroller } from "./SnapScroller";
|
|
23
24
|
export { BackgroundGradient } from "./BackgroundGradient";
|
|
@@ -55,12 +55,12 @@ const HorizontalMenu = ({
|
|
|
55
55
|
}, /*#__PURE__*/React.createElement("div", {
|
|
56
56
|
className: "left"
|
|
57
57
|
}, !isFirstStep && !hideBackIcon && /*#__PURE__*/React.createElement("span", {
|
|
58
|
-
className: "
|
|
58
|
+
className: "prev-button pointer",
|
|
59
59
|
onClick: mobilePreviousStep,
|
|
60
60
|
role: "button",
|
|
61
61
|
onKeyDown: mobilePreviousStep,
|
|
62
62
|
tabIndex: 0
|
|
63
|
-
},
|
|
63
|
+
}, '<--')), /*#__PURE__*/React.createElement("div", {
|
|
64
64
|
className: "title"
|
|
65
65
|
}, /*#__PURE__*/React.createElement("span", {
|
|
66
66
|
className: "md-h lg-h"
|
|
@@ -108,7 +108,7 @@ HorizontalMenu.propTypes = {
|
|
|
108
108
|
hideBackIcon: PropTypes.bool
|
|
109
109
|
};
|
|
110
110
|
HorizontalMenu.defaultProps = {
|
|
111
|
-
logoColor: '
|
|
111
|
+
logoColor: 'paragraph',
|
|
112
112
|
stepsBackwards: 1
|
|
113
113
|
};
|
|
114
114
|
export default HorizontalMenu;
|