@pareto-engineering/design-system 2.0.0-alpha.2 → 2.0.0-alpha.20
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/AnimatedCounter/AnimatedCounter.js +16 -29
- package/dist/cjs/a/AnimatedCounter/styles.scss +3 -11
- package/dist/cjs/a/{RatingsInput/common/Rating/Rating.js → BackgroundGradient/BackgroundGradient.js} +22 -65
- package/dist/cjs/a/BackgroundGradient/index.js +15 -0
- package/dist/cjs/a/BackgroundGradient/styles.scss +16 -0
- package/dist/cjs/a/Conversation/Conversation.js +15 -8
- package/dist/cjs/a/Conversation/common/Message/Message.js +33 -6
- package/dist/cjs/a/Conversation/styles.scss +129 -32
- package/dist/cjs/a/GradientBackground/GradientBackground.js +140 -0
- package/dist/cjs/a/GradientBackground/index.js +15 -0
- package/dist/cjs/a/GradientBackground/styles.scss +191 -0
- package/dist/cjs/a/OvalIllustration/OvalIllustration.js +133 -0
- package/dist/cjs/a/OvalIllustration/index.js +15 -0
- package/dist/cjs/a/OvalIllustration/styles.scss +102 -0
- package/dist/cjs/a/People/People.js +15 -7
- package/dist/cjs/a/People/common/Person/Person.js +11 -4
- package/dist/cjs/a/People/styles.scss +13 -15
- package/dist/cjs/a/Shapes/Shapes.js +171 -0
- package/dist/cjs/a/{RatingsInput/common/Rating → Shapes}/index.js +3 -3
- package/dist/cjs/a/Shapes/styles.scss +255 -0
- package/dist/cjs/a/{RatingsInput/RatingsInput.js → SnapScroller/SnapScroller.js} +15 -26
- package/dist/cjs/a/{RatingsInput → SnapScroller}/index.js +3 -3
- package/dist/cjs/a/SnapScroller/styles.scss +38 -0
- package/dist/cjs/a/TeamInfo/styles.scss +2 -2
- package/dist/cjs/a/index.js +33 -1
- package/dist/cjs/b/Button/Button.js +10 -4
- package/dist/cjs/b/Button/styles.scss +82 -18
- package/dist/cjs/b/Metrics/Metrics.js +89 -0
- package/dist/cjs/b/Metrics/index.js +15 -0
- package/dist/cjs/b/Metrics/styles.scss +91 -0
- package/dist/cjs/b/Page/common/Section/Section.js +56 -5
- package/dist/cjs/b/Page/styles.scss +8 -2
- package/dist/cjs/b/QuestionDropdown/styles.scss +1 -1
- package/dist/cjs/b/index.js +9 -1
- package/dist/cjs/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.js +1 -1
- package/dist/cjs/c/ContentSlides/common/Navigator/Navigator.js +4 -3
- package/dist/cjs/experimental/GradientBackground/GradientBackground.js +98 -0
- package/dist/cjs/experimental/GradientBackground/index.js +15 -0
- package/dist/cjs/experimental/GradientBackground/styles.scss +64 -0
- package/dist/cjs/experimental/index.js +13 -0
- package/dist/cjs/f/common/Debugger/Debugger.js +1 -1
- package/dist/cjs/f/common/Label/Label.js +1 -1
- package/dist/cjs/f/fields/ChoicesInput/ChoicesInput.js +2 -2
- package/dist/cjs/f/fields/RatingsInput/common/Rating/Rating.js +2 -2
- package/dist/cjs/f/fields/SelectInput/SelectInput.js +25 -6
- package/dist/cjs/f/fields/SelectInput/styles.scss +4 -4
- package/dist/cjs/f/fields/TaskRecommendationInput/TaskRecommendationInput.js +1 -1
- package/dist/cjs/f/fields/TaskRecommendationInput/styles.scss +4 -0
- package/dist/cjs/f/fields/TextInput/TextInput.js +19 -5
- package/dist/cjs/f/fields/TextInput/styles.scss +3 -7
- package/dist/cjs/f/fields/TextareaInput/TextareaInput.js +14 -7
- package/dist/cjs/form.scss +1 -1
- package/dist/es/a/AnimatedCounter/AnimatedCounter.js +17 -30
- package/dist/es/a/AnimatedCounter/styles.scss +3 -11
- package/dist/es/a/BackgroundGradient/BackgroundGradient.js +55 -0
- package/dist/es/a/BackgroundGradient/index.js +2 -0
- package/dist/es/a/BackgroundGradient/styles.scss +16 -0
- package/dist/es/a/Conversation/Conversation.js +15 -8
- package/dist/es/a/Conversation/common/Message/Message.js +33 -6
- package/dist/es/a/Conversation/styles.scss +129 -32
- package/dist/es/a/GradientBackground/GradientBackground.js +118 -0
- package/dist/es/a/GradientBackground/index.js +2 -0
- package/dist/es/a/GradientBackground/styles.scss +191 -0
- package/dist/es/a/OvalIllustration/OvalIllustration.js +111 -0
- package/dist/es/a/OvalIllustration/index.js +2 -0
- package/dist/es/a/OvalIllustration/styles.scss +102 -0
- package/dist/es/a/People/People.js +14 -7
- package/dist/es/a/People/common/Person/Person.js +11 -4
- package/dist/es/a/People/styles.scss +13 -15
- package/dist/es/a/Shapes/Shapes.js +149 -0
- package/dist/es/a/{RatingsInput/common/Rating → Shapes}/index.js +1 -1
- package/dist/es/a/Shapes/styles.scss +255 -0
- package/dist/es/a/{RatingsInput/RatingsInput.js → SnapScroller/SnapScroller.js} +15 -26
- package/dist/es/a/SnapScroller/index.js +2 -0
- package/dist/es/a/SnapScroller/styles.scss +38 -0
- package/dist/es/a/TeamInfo/styles.scss +2 -2
- package/dist/es/a/index.js +5 -1
- package/dist/es/b/Button/Button.js +8 -2
- package/dist/es/b/Button/styles.scss +82 -18
- package/dist/es/b/Metrics/Metrics.js +72 -0
- package/dist/es/b/Metrics/index.js +2 -0
- package/dist/es/b/Metrics/styles.scss +91 -0
- package/dist/es/b/Page/common/Section/Section.js +55 -4
- package/dist/es/b/Page/styles.scss +8 -2
- package/dist/es/b/QuestionDropdown/styles.scss +1 -1
- package/dist/es/b/index.js +2 -1
- package/dist/es/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.js +1 -1
- package/dist/es/c/ContentSlides/common/Navigator/Navigator.js +4 -3
- package/dist/es/experimental/GradientBackground/GradientBackground.js +76 -0
- package/dist/es/experimental/GradientBackground/index.js +2 -0
- package/dist/es/experimental/GradientBackground/styles.scss +64 -0
- package/dist/es/experimental/index.js +1 -0
- package/dist/es/f/common/Debugger/Debugger.js +1 -1
- package/dist/es/f/common/Label/Label.js +1 -1
- package/dist/es/f/fields/ChoicesInput/ChoicesInput.js +2 -2
- package/dist/es/f/fields/RatingsInput/common/Rating/Rating.js +2 -2
- package/dist/es/f/fields/SelectInput/SelectInput.js +25 -6
- package/dist/es/f/fields/SelectInput/styles.scss +4 -4
- package/dist/es/f/fields/TaskRecommendationInput/TaskRecommendationInput.js +1 -1
- package/dist/es/f/fields/TaskRecommendationInput/styles.scss +4 -0
- package/dist/es/f/fields/TextInput/TextInput.js +19 -5
- package/dist/es/f/fields/TextInput/styles.scss +3 -7
- package/dist/es/f/fields/TextareaInput/TextareaInput.js +14 -7
- package/dist/es/form.scss +1 -1
- package/package.json +3 -3
- package/src/__snapshots__/Storyshots.test.js.snap +5662 -449
- package/src/local.scss +4 -0
- package/src/stories/a/AnimatedCounter.stories.jsx +9 -5
- package/src/stories/a/BackgroundGradient.stories.jsx +38 -0
- package/src/stories/a/ContentCard.stories.jsx +1 -1
- package/src/stories/a/Conversation.stories.jsx +78 -1
- package/src/stories/a/OvalIllustration.stories.jsx +59 -0
- package/src/stories/a/People.stories.jsx +25 -1
- package/src/stories/a/ProgressBar.stories.jsx +1 -1
- package/src/stories/a/Quote.stories.jsx +1 -1
- package/src/stories/a/Shapes.stories.jsx +143 -0
- package/src/stories/a/SnapScroller.stories.jsx +98 -0
- package/src/stories/a/Spinner.stories.jsx +1 -1
- package/src/stories/b/Button.stories.jsx +83 -54
- package/src/stories/b/Metrics.stories.jsx +62 -0
- package/src/stories/b/Page.stories.jsx +51 -1
- package/src/stories/b/ThemeSelector.stories.jsx +1 -1
- package/src/stories/b/Title.stories.jsx +1 -1
- package/src/stories/c/ContentSlides.stories.jsx +2 -2
- package/src/stories/colors.js +5 -3
- package/src/stories/f/CheckboxInput.stories.jsx +1 -1
- package/src/stories/f/SelectInput.stories.jsx +29 -0
- package/src/stories/f/TaskRecommendationInput.stories.jsx +1 -1
- package/src/stories/f/TextInput.stories.jsx +14 -4
- package/src/stories/f/TextareaInput.stories.jsx +42 -6
- package/src/ui/a/AnimatedCounter/AnimatedCounter.jsx +21 -27
- package/src/ui/a/AnimatedCounter/styles.scss +3 -11
- package/src/ui/a/BackgroundGradient/BackgroundGradient.jsx +76 -0
- package/src/ui/a/BackgroundGradient/index.js +2 -0
- package/src/ui/a/BackgroundGradient/styles.scss +16 -0
- package/src/ui/a/Conversation/Conversation.jsx +15 -7
- package/src/ui/a/Conversation/common/Message/Message.jsx +40 -7
- package/src/ui/a/Conversation/styles.scss +129 -32
- package/src/ui/a/OvalIllustration/OvalIllustration.jsx +134 -0
- package/src/ui/a/OvalIllustration/index.js +2 -0
- package/src/ui/a/OvalIllustration/styles.scss +102 -0
- package/src/ui/a/People/People.jsx +12 -4
- package/src/ui/a/People/common/Person/Person.jsx +7 -1
- package/src/ui/a/People/styles.scss +13 -15
- package/src/ui/a/Shapes/Shapes.jsx +191 -0
- package/src/ui/a/Shapes/index.js +2 -0
- package/src/ui/a/Shapes/styles.scss +255 -0
- 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/TeamInfo/styles.scss +2 -2
- package/src/ui/a/index.js +4 -0
- package/src/ui/b/Button/Button.jsx +9 -1
- package/src/ui/b/Button/styles.scss +82 -18
- package/src/ui/b/Metrics/Metrics.jsx +93 -0
- package/src/ui/b/Metrics/index.js +2 -0
- package/src/ui/b/Metrics/styles.scss +91 -0
- package/src/ui/b/Page/common/Section/Section.jsx +68 -2
- package/src/ui/b/Page/styles.scss +8 -2
- package/src/ui/b/QuestionDropdown/styles.scss +1 -1
- package/src/ui/b/index.js +1 -0
- package/src/ui/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.jsx +1 -1
- package/src/ui/c/ContentSlides/common/Navigator/Navigator.jsx +3 -2
- package/src/ui/f/common/Debugger/Debugger.jsx +1 -1
- package/src/ui/f/common/Label/Label.jsx +1 -1
- package/src/ui/f/fields/ChoicesInput/ChoicesInput.jsx +2 -2
- package/src/ui/f/fields/RatingsInput/common/Rating/Rating.jsx +2 -2
- package/src/ui/f/fields/SelectInput/SelectInput.jsx +35 -5
- package/src/ui/f/fields/SelectInput/styles.scss +4 -4
- package/src/ui/f/fields/TaskRecommendationInput/TaskRecommendationInput.jsx +1 -1
- package/src/ui/f/fields/TaskRecommendationInput/styles.scss +4 -0
- package/src/ui/f/fields/TextInput/TextInput.jsx +15 -2
- package/src/ui/f/fields/TextInput/styles.scss +3 -7
- package/src/ui/f/fields/TextareaInput/TextareaInput.jsx +22 -11
- package/src/ui/form.scss +1 -1
- package/dist/cjs/a/RatingsInput/common/index.js +0 -13
- package/dist/cjs/a/RatingsInput/styles.scss +0 -35
- package/dist/es/a/RatingsInput/common/Rating/Rating.js +0 -102
- package/dist/es/a/RatingsInput/common/index.js +0 -1
- package/dist/es/a/RatingsInput/index.js +0 -2
- package/dist/es/a/RatingsInput/styles.scss +0 -35
|
@@ -57,7 +57,7 @@ const TaskRecommendationInput = ({
|
|
|
57
57
|
<div className={`task-content ${isOptionSelected ? 'b-x' : 'b-on-x'}`}>
|
|
58
58
|
<div className="v1 p-v task">
|
|
59
59
|
<FormLabel
|
|
60
|
-
className={`uc mb-v ${isOptionSelected ?
|
|
60
|
+
className={`uc mb-v ${isOptionSelected ? styleNames.modifierActive : ''}`}
|
|
61
61
|
name={name}
|
|
62
62
|
>
|
|
63
63
|
{label}
|
|
@@ -27,10 +27,12 @@ const TextInput = ({
|
|
|
27
27
|
type,
|
|
28
28
|
name,
|
|
29
29
|
label,
|
|
30
|
+
labelColor,
|
|
30
31
|
validate,
|
|
31
32
|
oneInputLabel,
|
|
32
33
|
description,
|
|
33
34
|
disabled,
|
|
35
|
+
placeholder,
|
|
34
36
|
// ...otherProps
|
|
35
37
|
}) => {
|
|
36
38
|
useLayoutEffect(() => {
|
|
@@ -53,11 +55,11 @@ const TextInput = ({
|
|
|
53
55
|
// {...otherProps}
|
|
54
56
|
>
|
|
55
57
|
<FormLabel
|
|
56
|
-
className={[
|
|
57
|
-
'input-label', oneInputLabel ? 'md-s2 s0 v1 mb-v' : 'v50 mb-v']
|
|
58
|
+
className={[oneInputLabel ? 'md-s2 s0 v1 mb-v' : 'v50 mb-v']
|
|
58
59
|
.filter((e) => e)
|
|
59
60
|
.join(' ')}
|
|
60
61
|
name={name}
|
|
62
|
+
color={labelColor}
|
|
61
63
|
>
|
|
62
64
|
{ label }
|
|
63
65
|
</FormLabel>
|
|
@@ -66,6 +68,7 @@ const TextInput = ({
|
|
|
66
68
|
className={`input ${meta.touched && meta.error ? 'input-border-error' : 'input-border'}`}
|
|
67
69
|
type={type}
|
|
68
70
|
disabled={disabled}
|
|
71
|
+
placeholder={placeholder}
|
|
69
72
|
{...field}
|
|
70
73
|
/>
|
|
71
74
|
{(description || (meta.touched && meta.error))
|
|
@@ -104,6 +107,11 @@ TextInput.propTypes = {
|
|
|
104
107
|
*/
|
|
105
108
|
label:PropTypes.string.isRequired,
|
|
106
109
|
|
|
110
|
+
/**
|
|
111
|
+
* The input label color
|
|
112
|
+
*/
|
|
113
|
+
labelColor:PropTypes.string,
|
|
114
|
+
|
|
107
115
|
/**
|
|
108
116
|
* The type of the input (html)
|
|
109
117
|
*/
|
|
@@ -136,6 +144,11 @@ TextInput.propTypes = {
|
|
|
136
144
|
* Whether the text input should be disabled
|
|
137
145
|
*/
|
|
138
146
|
disabled :PropTypes.bool,
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* The placeholder text for the input
|
|
150
|
+
*/
|
|
151
|
+
placeholder:PropTypes.string,
|
|
139
152
|
}
|
|
140
153
|
|
|
141
154
|
TextInput.defaultProps = {
|
|
@@ -9,17 +9,13 @@ $default-padding: 0.75em 0.75em 0.55em;
|
|
|
9
9
|
display: flex;
|
|
10
10
|
flex-direction: column;
|
|
11
11
|
|
|
12
|
-
.input-label {
|
|
13
|
-
color: var(--main1);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
12
|
.input {
|
|
17
|
-
background: var(--light-
|
|
18
|
-
color: var(--on-
|
|
13
|
+
background: var(--light-background2);
|
|
14
|
+
color: var(--on-background2);
|
|
19
15
|
padding: $default-padding;
|
|
20
16
|
|
|
21
17
|
&:focus {
|
|
22
|
-
background: var(--dark-
|
|
18
|
+
background: var(--dark-background2);
|
|
23
19
|
}
|
|
24
20
|
}
|
|
25
21
|
}
|
|
@@ -34,6 +34,7 @@ const TextareaInput = ({
|
|
|
34
34
|
labelColor,
|
|
35
35
|
description,
|
|
36
36
|
disabled,
|
|
37
|
+
placeholder,
|
|
37
38
|
// ...otherProps
|
|
38
39
|
}) => {
|
|
39
40
|
useLayoutEffect(() => {
|
|
@@ -52,7 +53,6 @@ const TextareaInput = ({
|
|
|
52
53
|
componentClassName,
|
|
53
54
|
userClassName,
|
|
54
55
|
`x-${textAreaColor}`,
|
|
55
|
-
`y-${labelColor}`,
|
|
56
56
|
]
|
|
57
57
|
.filter((e) => e)
|
|
58
58
|
.join(' ')}
|
|
@@ -60,11 +60,11 @@ const TextareaInput = ({
|
|
|
60
60
|
// {...otherProps}
|
|
61
61
|
>
|
|
62
62
|
<FormLabel
|
|
63
|
-
className={[
|
|
64
|
-
'c-y', labelAsDescription ? 'md-s2 s0 v1 mb-v' : 'v50 mb-v']
|
|
63
|
+
className={[labelAsDescription ? 'md-s2 s0 v1 mb-v' : 'v50 mb-v']
|
|
65
64
|
.filter((e) => e)
|
|
66
65
|
.join(' ')}
|
|
67
66
|
name={name}
|
|
67
|
+
color={labelColor}
|
|
68
68
|
>
|
|
69
69
|
{ label }
|
|
70
70
|
</FormLabel>
|
|
@@ -72,6 +72,7 @@ const TextareaInput = ({
|
|
|
72
72
|
id={textAreaId}
|
|
73
73
|
className={`textarea v50 pv-v ${meta.touched && meta.error ? 'input-border-error' : 'input-border'}`}
|
|
74
74
|
{...field}
|
|
75
|
+
placeholder={placeholder}
|
|
75
76
|
rows={rows}
|
|
76
77
|
disabled={disabled}
|
|
77
78
|
>
|
|
@@ -123,36 +124,46 @@ TextareaInput.propTypes = {
|
|
|
123
124
|
* If the text area depends on it's label's text as the default description
|
|
124
125
|
*/
|
|
125
126
|
labelAsDescription:PropTypes.bool,
|
|
127
|
+
|
|
126
128
|
/**
|
|
127
129
|
* The textarea id
|
|
128
130
|
*/
|
|
129
|
-
textAreaId
|
|
131
|
+
textAreaId:PropTypes.string,
|
|
132
|
+
|
|
130
133
|
/**
|
|
131
134
|
* The number of rows int the text area
|
|
132
135
|
*/
|
|
133
|
-
rows
|
|
136
|
+
rows:PropTypes.number,
|
|
137
|
+
|
|
134
138
|
/**
|
|
135
139
|
* Text area base color
|
|
136
140
|
*/
|
|
137
|
-
textAreaColor
|
|
141
|
+
textAreaColor:PropTypes.string,
|
|
142
|
+
|
|
138
143
|
/**
|
|
139
144
|
* Label base color
|
|
140
145
|
*/
|
|
141
|
-
labelColor
|
|
146
|
+
labelColor:PropTypes.string,
|
|
147
|
+
|
|
142
148
|
/**
|
|
143
149
|
* Text area description
|
|
144
150
|
*/
|
|
145
|
-
description
|
|
151
|
+
description:PropTypes.string,
|
|
152
|
+
|
|
146
153
|
/**
|
|
147
154
|
* Whether the text area should be disabled
|
|
148
155
|
*/
|
|
149
|
-
disabled
|
|
156
|
+
disabled:PropTypes.bool,
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* The textarea placeholder text
|
|
160
|
+
*/
|
|
161
|
+
placeholder:PropTypes.string,
|
|
150
162
|
}
|
|
151
163
|
|
|
152
164
|
TextareaInput.defaultProps = {
|
|
153
165
|
rows :3,
|
|
154
|
-
textAreaColor:'
|
|
155
|
-
labelColor :'main1',
|
|
166
|
+
textAreaColor:'background1',
|
|
156
167
|
disabled :false,
|
|
157
168
|
}
|
|
158
169
|
|
package/src/ui/form.scss
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
@use "form-reset.scss";
|
|
2
2
|
|
|
3
|
-
$form-input-border-bottom: 1px solid var(--dark-
|
|
3
|
+
$form-input-border-bottom: 1px solid var(--dark-background1);
|
|
4
4
|
$form-input-on-focus-border-bottom: 1px solid var(--light-main1);
|
|
5
5
|
$form-input-on-error-border-bottom: 1px solid var(--error);
|
|
6
6
|
$label-input-heigth-width: 100%;
|
|
@@ -1,35 +0,0 @@
|
|
|
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
|
-
|
|
@@ -1,102 +0,0 @@
|
|
|
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;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Rating } from "./Rating";
|
|
@@ -1,35 +0,0 @@
|
|
|
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
|
-
|