@pareto-engineering/design-system 2.0.0-alpha.4 → 2.0.0-alpha.42
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/BackgroundGradient/BackgroundGradient.js +77 -0
- package/dist/cjs/a/BackgroundGradient/index.js +15 -0
- package/dist/cjs/a/BackgroundGradient/styles.scss +16 -0
- package/dist/cjs/a/ContentTree/ContentTree.js +83 -0
- package/dist/cjs/a/ContentTree/common/Tree/Tree.js +116 -0
- package/dist/cjs/a/ContentTree/common/Tree/index.js +15 -0
- package/dist/cjs/a/ContentTree/common/index.js +31 -0
- package/dist/cjs/a/ContentTree/common/useContentTree.js +82 -0
- package/dist/cjs/a/ContentTree/common/useFirstVisibleNode.js +65 -0
- package/dist/cjs/a/ContentTree/index.js +15 -0
- package/dist/cjs/a/ContentTree/styles.scss +33 -0
- package/dist/cjs/a/Conversation/Conversation.js +14 -8
- package/dist/cjs/a/Conversation/common/Message/Message.js +32 -6
- package/dist/cjs/a/Conversation/styles.scss +132 -33
- 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/Popover/Popover.js +134 -0
- package/dist/cjs/a/Popover/common/Divider/Divider.js +67 -0
- package/dist/cjs/a/Popover/common/Divider/index.js +15 -0
- package/dist/cjs/a/Popover/common/Item/Item.js +67 -0
- package/dist/cjs/a/Popover/common/Item/index.js +15 -0
- package/dist/cjs/a/Popover/common/index.js +21 -0
- package/dist/cjs/a/Popover/index.js +15 -0
- package/dist/cjs/a/Popover/styles.scss +43 -0
- package/dist/cjs/a/Shapes/Shapes.js +39 -9
- package/dist/cjs/a/Shapes/styles.scss +78 -22
- package/dist/cjs/a/SnapScroller/SnapScroller.js +77 -0
- package/dist/cjs/a/SnapScroller/index.js +15 -0
- package/dist/cjs/a/SnapScroller/styles.scss +38 -0
- package/dist/cjs/a/index.js +49 -1
- package/dist/cjs/b/Button/Button.js +10 -4
- package/dist/cjs/b/Button/styles.scss +55 -10
- package/dist/cjs/b/Logo/Logo.js +41 -41
- package/dist/cjs/b/Logo/styles.scss +0 -138
- package/dist/cjs/b/Page/common/Section/Section.js +56 -5
- package/dist/cjs/b/Page/styles.scss +8 -2
- package/dist/cjs/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.js +16 -9
- package/dist/cjs/c/ContentSlides/common/Navigator/Navigator.js +4 -3
- package/dist/cjs/c/ContentSlides/styles.scss +10 -4
- package/dist/cjs/c/SocialMediaShareButton/SocialMediaShareButton.js +105 -0
- package/dist/cjs/c/SocialMediaShareButton/index.js +15 -0
- package/dist/cjs/c/SocialMediaShareButton/styles.scss +39 -0
- package/dist/cjs/c/index.js +9 -1
- package/dist/cjs/f/common/Debugger/Debugger.js +1 -1
- package/dist/cjs/f/common/Label/Label.js +1 -1
- package/dist/cjs/f/common/Label/styles.scss +1 -1
- package/dist/cjs/f/fields/ChoicesInput/ChoicesInput.js +1 -1
- package/dist/cjs/f/fields/ChoicesInput/styles.scss +17 -2
- package/dist/cjs/f/fields/RatingsInput/RatingsInput.js +39 -6
- package/dist/cjs/f/fields/RatingsInput/styles.scss +29 -20
- package/dist/cjs/f/fields/SelectInput/SelectInput.js +36 -10
- package/dist/cjs/f/fields/SelectInput/styles.scss +13 -8
- package/dist/cjs/f/fields/TaskRecommendationInput/TaskRecommendationInput.js +1 -1
- package/dist/cjs/f/fields/TextInput/TextInput.js +35 -7
- package/dist/cjs/f/fields/TextInput/styles.scss +16 -7
- package/dist/cjs/f/fields/TextareaInput/TextareaInput.js +15 -8
- package/dist/cjs/f/fields/TextareaInput/styles.scss +19 -6
- package/dist/cjs/f/fields/index.js +0 -24
- package/dist/cjs/form-reset.scss +1 -1
- package/dist/cjs/index.js +13 -0
- package/dist/cjs/utils/hooks/index.js +23 -0
- package/dist/cjs/utils/hooks/useDynamicPosition.js +107 -0
- package/dist/cjs/utils/hooks/useWindowSize.js +39 -0
- package/dist/cjs/utils/index.js +19 -0
- 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/ContentTree/ContentTree.js +67 -0
- package/dist/es/a/ContentTree/common/Tree/Tree.js +98 -0
- package/dist/es/a/ContentTree/common/Tree/index.js +2 -0
- package/dist/es/a/ContentTree/common/index.js +3 -0
- package/dist/es/a/ContentTree/common/useContentTree.js +74 -0
- package/dist/es/a/ContentTree/common/useFirstVisibleNode.js +54 -0
- package/dist/es/a/ContentTree/index.js +2 -0
- package/dist/es/a/ContentTree/styles.scss +33 -0
- package/dist/es/a/Conversation/Conversation.js +14 -8
- package/dist/es/a/Conversation/common/Message/Message.js +32 -6
- package/dist/es/a/Conversation/styles.scss +132 -33
- 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/Popover/Popover.js +118 -0
- package/dist/es/a/Popover/common/Divider/Divider.js +47 -0
- package/dist/es/a/Popover/common/Divider/index.js +2 -0
- package/dist/es/a/Popover/common/Item/Item.js +47 -0
- package/dist/es/a/Popover/common/Item/index.js +2 -0
- package/dist/es/a/Popover/common/index.js +2 -0
- package/dist/es/a/Popover/index.js +2 -0
- package/dist/es/a/Popover/styles.scss +43 -0
- package/dist/es/a/Shapes/Shapes.js +39 -9
- package/dist/es/a/Shapes/styles.scss +78 -22
- package/dist/es/a/SnapScroller/SnapScroller.js +61 -0
- package/dist/es/a/SnapScroller/index.js +2 -0
- package/dist/es/a/SnapScroller/styles.scss +38 -0
- package/dist/es/a/index.js +7 -1
- package/dist/es/b/Button/Button.js +8 -2
- package/dist/es/b/Button/styles.scss +55 -10
- package/dist/es/b/Logo/Logo.js +41 -41
- package/dist/es/b/Logo/styles.scss +0 -138
- package/dist/es/b/Page/common/Section/Section.js +55 -4
- package/dist/es/b/Page/styles.scss +8 -2
- package/dist/es/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.js +16 -9
- package/dist/es/c/ContentSlides/common/Navigator/Navigator.js +4 -3
- package/dist/es/c/ContentSlides/styles.scss +10 -4
- package/dist/es/c/SocialMediaShareButton/SocialMediaShareButton.js +89 -0
- package/dist/es/c/SocialMediaShareButton/index.js +2 -0
- package/dist/es/c/SocialMediaShareButton/styles.scss +39 -0
- package/dist/es/c/index.js +2 -1
- package/dist/es/f/common/Debugger/Debugger.js +1 -1
- package/dist/es/f/common/Label/Label.js +1 -1
- package/dist/es/f/common/Label/styles.scss +1 -1
- package/dist/es/f/fields/ChoicesInput/ChoicesInput.js +1 -1
- package/dist/es/f/fields/ChoicesInput/styles.scss +17 -2
- package/dist/es/f/fields/RatingsInput/RatingsInput.js +38 -6
- package/dist/es/f/fields/RatingsInput/styles.scss +29 -20
- package/dist/es/f/fields/SelectInput/SelectInput.js +36 -10
- package/dist/es/f/fields/SelectInput/styles.scss +13 -8
- package/dist/es/f/fields/TaskRecommendationInput/TaskRecommendationInput.js +1 -1
- package/dist/es/f/fields/TextInput/TextInput.js +35 -7
- package/dist/es/f/fields/TextInput/styles.scss +16 -7
- package/dist/es/f/fields/TextareaInput/TextareaInput.js +15 -8
- package/dist/es/f/fields/TextareaInput/styles.scss +19 -6
- package/dist/es/f/fields/index.js +0 -3
- package/dist/es/form-reset.scss +1 -1
- package/dist/es/index.js +2 -1
- package/dist/es/utils/hooks/index.js +2 -0
- package/dist/es/utils/hooks/useDynamicPosition.js +93 -0
- package/dist/es/utils/hooks/useWindowSize.js +27 -0
- package/dist/es/utils/index.js +1 -0
- package/package.json +4 -3
- package/src/__snapshots__/Storyshots.test.js.snap +4755 -1734
- package/src/local.scss +2 -0
- package/src/stories/StyleGuide/Sprites.stories.mdx +25 -0
- package/src/stories/StyleGuide/helpers.js +16 -0
- package/src/stories/a/BackgroundGradient.stories.jsx +38 -0
- package/src/stories/a/ContentTree.stories.jsx +662 -0
- package/src/stories/a/Conversation.stories.jsx +78 -1
- package/src/stories/a/OvalIllustration.stories.jsx +59 -0
- package/src/stories/a/Popover.stories.jsx +106 -0
- package/src/stories/a/Shapes.stories.jsx +143 -0
- package/src/stories/a/SnapScroller.stories.jsx +98 -0
- package/src/stories/b/Button.stories.jsx +27 -4
- package/src/stories/b/Logo.stories.jsx +17 -9
- package/src/stories/b/Page.stories.jsx +51 -1
- package/src/stories/c/ContentSlides.stories.jsx +154 -2
- package/src/stories/c/SocialMediaShareButton.stories.jsx +25 -0
- package/src/stories/f/RatingsInput.stories.jsx +3 -2
- package/src/stories/f/SelectInput.stories.jsx +36 -5
- package/src/stories/f/TextInput.stories.jsx +15 -4
- package/src/stories/f/TextareaInput.stories.jsx +42 -6
- package/src/stories/utils/lorem.js +15 -0
- 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/ContentTree/ContentTree.jsx +88 -0
- package/src/ui/a/ContentTree/common/Tree/Tree.jsx +138 -0
- package/src/ui/a/ContentTree/common/Tree/index.js +2 -0
- package/src/ui/a/ContentTree/common/index.js +3 -0
- package/src/ui/a/ContentTree/common/useContentTree.js +83 -0
- package/src/ui/a/ContentTree/common/useFirstVisibleNode.js +59 -0
- package/src/ui/a/ContentTree/index.js +2 -0
- package/src/ui/a/ContentTree/styles.scss +33 -0
- package/src/ui/a/Conversation/Conversation.jsx +15 -7
- package/src/ui/a/Conversation/common/Message/Message.jsx +38 -6
- package/src/ui/a/Conversation/styles.scss +132 -33
- 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/Popover/Popover.jsx +157 -0
- package/src/ui/a/Popover/index.js +2 -0
- package/src/ui/a/Popover/styles.scss +43 -0
- 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/index.js +6 -0
- package/src/ui/b/Button/Button.jsx +9 -1
- package/src/ui/b/Button/styles.scss +55 -10
- package/src/ui/b/Logo/Logo.jsx +41 -41
- package/src/ui/b/Logo/styles.scss +0 -138
- package/src/ui/b/Page/common/Section/Section.jsx +68 -2
- package/src/ui/b/Page/styles.scss +8 -2
- package/src/ui/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.jsx +12 -5
- package/src/ui/c/ContentSlides/common/Navigator/Navigator.jsx +3 -2
- package/src/ui/c/ContentSlides/styles.scss +10 -4
- package/src/ui/c/SocialMediaShareButton/SocialMediaShareButton.jsx +113 -0
- package/src/ui/c/SocialMediaShareButton/index.js +2 -0
- package/src/ui/c/SocialMediaShareButton/styles.scss +39 -0
- package/src/ui/c/index.js +1 -0
- package/src/ui/f/common/Debugger/Debugger.jsx +1 -1
- package/src/ui/f/common/Label/Label.jsx +1 -1
- package/src/ui/f/common/Label/styles.scss +1 -1
- package/src/ui/f/fields/ChoicesInput/ChoicesInput.jsx +1 -1
- package/src/ui/f/fields/ChoicesInput/styles.scss +17 -2
- package/src/ui/f/fields/RatingsInput/RatingsInput.jsx +54 -19
- package/src/ui/f/fields/RatingsInput/styles.scss +29 -20
- package/src/ui/f/fields/SelectInput/SelectInput.jsx +43 -5
- package/src/ui/f/fields/SelectInput/styles.scss +13 -8
- package/src/ui/f/fields/TextInput/TextInput.jsx +31 -3
- package/src/ui/f/fields/TextInput/styles.scss +16 -7
- package/src/ui/f/fields/TextareaInput/TextareaInput.jsx +24 -13
- package/src/ui/f/fields/TextareaInput/styles.scss +19 -6
- package/src/ui/f/fields/index.js +0 -3
- package/src/ui/form-reset.scss +1 -1
- package/src/ui/index.js +1 -0
- package/src/ui/utils/hooks/index.js +2 -0
- package/src/ui/utils/hooks/useDynamicPosition.js +104 -0
- package/src/ui/utils/hooks/useWindowSize.js +32 -0
- package/src/ui/utils/index.js +1 -0
- package/stylelint.config.js +13 -13
- package/src/stories/f/CheckboxInput.stories.jsx +0 -37
- package/src/stories/f/RadioInput.stories.jsx +0 -37
- package/src/stories/f/TaskRecommendationInput.stories.jsx +0 -38
- package/src/ui/f/fields/CheckboxInput/CheckboxInput.jsx +0 -107
- package/src/ui/f/fields/CheckboxInput/index.js +0 -2
- package/src/ui/f/fields/CheckboxInput/styles.scss +0 -28
- package/src/ui/f/fields/RadioInput/RadioInput.jsx +0 -112
- package/src/ui/f/fields/RadioInput/index.js +0 -2
- package/src/ui/f/fields/RadioInput/styles.scss +0 -26
- package/src/ui/f/fields/TaskRecommendationInput/TaskRecommendationInput.jsx +0 -130
- package/src/ui/f/fields/TaskRecommendationInput/index.js +0 -2
- package/src/ui/f/fields/TaskRecommendationInput/styles.scss +0 -41
|
@@ -10,6 +10,7 @@ import styleNames from '@pareto-engineering/bem'
|
|
|
10
10
|
// Local Definitions
|
|
11
11
|
|
|
12
12
|
import { Rating } from './common'
|
|
13
|
+
import { FormLabel } from '../../common'
|
|
13
14
|
|
|
14
15
|
const baseClassName = styleNames.base
|
|
15
16
|
|
|
@@ -25,9 +26,13 @@ const RatingsInput = ({
|
|
|
25
26
|
name,
|
|
26
27
|
ratingCount,
|
|
27
28
|
showRatingValue,
|
|
29
|
+
oneInputLabel,
|
|
30
|
+
label,
|
|
31
|
+
labelColor,
|
|
28
32
|
labelMax,
|
|
29
33
|
labelMin,
|
|
30
34
|
displayRatingsLabel,
|
|
35
|
+
optional,
|
|
31
36
|
// ...otherProps
|
|
32
37
|
}) => {
|
|
33
38
|
useLayoutEffect(() => {
|
|
@@ -47,24 +52,36 @@ const RatingsInput = ({
|
|
|
47
52
|
.filter((e) => e)
|
|
48
53
|
.join(' ')}
|
|
49
54
|
style={style}
|
|
50
|
-
// {...otherProps}
|
|
51
55
|
>
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
)
|
|
66
|
-
|
|
67
|
-
|
|
56
|
+
<FormLabel
|
|
57
|
+
className={[
|
|
58
|
+
'input-label', oneInputLabel ? 'md-s2 s0 v1 mb-v' : 'v50 mb-v']
|
|
59
|
+
.filter((e) => e)
|
|
60
|
+
.join(' ')}
|
|
61
|
+
name={name}
|
|
62
|
+
color={labelColor}
|
|
63
|
+
optional={optional}
|
|
64
|
+
>
|
|
65
|
+
{ label }
|
|
66
|
+
</FormLabel>
|
|
67
|
+
<div className="stars">
|
|
68
|
+
{displayRatingsLabel && <p className="label-text md-s-1 s-2 x-metadata c-x">{labelMin}</p>}
|
|
69
|
+
{[...Array(ratingCount)].map((_, index) => {
|
|
70
|
+
const ratingValue = index + 1
|
|
71
|
+
return (
|
|
72
|
+
<Rating
|
|
73
|
+
key={ratingValue}
|
|
74
|
+
ratingId={`${name}-${ratingValue}`}
|
|
75
|
+
value={ratingValue}
|
|
76
|
+
name={name}
|
|
77
|
+
hover={hover}
|
|
78
|
+
setHover={setHover}
|
|
79
|
+
showRatingValue={showRatingValue}
|
|
80
|
+
/>
|
|
81
|
+
)
|
|
82
|
+
})}
|
|
83
|
+
{displayRatingsLabel && <p className="label-text md-s-1 s-2 x-metadata c-x">{labelMax}</p>}
|
|
84
|
+
</div>
|
|
68
85
|
</div>
|
|
69
86
|
)
|
|
70
87
|
}
|
|
@@ -97,6 +114,10 @@ RatingsInput.propTypes = {
|
|
|
97
114
|
* Determines if the rating start value should be shown
|
|
98
115
|
*/
|
|
99
116
|
showRatingValue :PropTypes.bool,
|
|
117
|
+
/**
|
|
118
|
+
* The label of the ratings input
|
|
119
|
+
*/
|
|
120
|
+
label :PropTypes.string.isRequired,
|
|
100
121
|
/**
|
|
101
122
|
* description for the highest rating value
|
|
102
123
|
*/
|
|
@@ -109,11 +130,25 @@ RatingsInput.propTypes = {
|
|
|
109
130
|
* If the rating lables should be shown
|
|
110
131
|
*/
|
|
111
132
|
displayRatingsLabel:PropTypes.bool,
|
|
133
|
+
/**
|
|
134
|
+
* Whether the input is optional or not
|
|
135
|
+
*/
|
|
136
|
+
optional :PropTypes.bool,
|
|
137
|
+
/**
|
|
138
|
+
* If the slide will only have one input
|
|
139
|
+
*/
|
|
140
|
+
oneInputLabel :PropTypes.bool,
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* String that will represent color for the label
|
|
144
|
+
*/
|
|
145
|
+
labelColor:PropTypes.string,
|
|
112
146
|
}
|
|
113
147
|
|
|
114
148
|
RatingsInput.defaultProps = {
|
|
115
|
-
labelMin:'not satisfied.',
|
|
116
|
-
labelMax:'very satisfied.',
|
|
149
|
+
labelMin :'not satisfied.',
|
|
150
|
+
labelMax :'very satisfied.',
|
|
151
|
+
labelColor:'main2',
|
|
117
152
|
}
|
|
118
153
|
|
|
119
154
|
export default memo(RatingsInput)
|
|
@@ -7,34 +7,43 @@ $default-transition: all .2s;
|
|
|
7
7
|
|
|
8
8
|
.#{bem.$base}.ratings-input {
|
|
9
9
|
display: flex;
|
|
10
|
+
flex-direction: column;
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
p {
|
|
13
|
+
padding: $default-padding;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
.stars {
|
|
16
17
|
display: flex;
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
position: absolute;
|
|
21
|
-
visibility: none;
|
|
22
|
-
z-index: -1;
|
|
19
|
+
>:not(:last-child) {
|
|
20
|
+
margin-right: $default-rating-icon-margin;
|
|
23
21
|
}
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
|
|
23
|
+
.#{bem.$base}.rating {
|
|
26
24
|
display: flex;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
|
|
26
|
+
input {
|
|
27
|
+
opacity: 0;
|
|
28
|
+
position: absolute;
|
|
29
|
+
visibility: none;
|
|
30
|
+
z-index: -1;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
label {
|
|
34
|
+
display: flex;
|
|
35
|
+
flex-direction: column;
|
|
36
|
+
align-items: center;
|
|
37
|
+
padding: $default-padding;
|
|
38
|
+
transition: $default-transition;
|
|
39
|
+
cursor: pointer;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.label-text {
|
|
44
|
+
margin-bottom: 0;
|
|
45
|
+
align-self: flex-end;
|
|
32
46
|
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.label-text {
|
|
36
|
-
margin-bottom: 0;
|
|
37
|
-
align-self: flex-end;
|
|
38
47
|
}
|
|
39
48
|
}
|
|
40
49
|
|
|
@@ -26,7 +26,10 @@ const SelectInput = ({
|
|
|
26
26
|
style,
|
|
27
27
|
name,
|
|
28
28
|
label,
|
|
29
|
+
color,
|
|
29
30
|
options,
|
|
31
|
+
validate,
|
|
32
|
+
description,
|
|
30
33
|
disabled,
|
|
31
34
|
// ...otherProps
|
|
32
35
|
}) => {
|
|
@@ -34,7 +37,7 @@ const SelectInput = ({
|
|
|
34
37
|
import('./styles.scss')
|
|
35
38
|
}, [])
|
|
36
39
|
|
|
37
|
-
const [field, meta] = useField(name)
|
|
40
|
+
const [field, meta] = useField({ name, validate })
|
|
38
41
|
|
|
39
42
|
return (
|
|
40
43
|
<div
|
|
@@ -45,6 +48,7 @@ const SelectInput = ({
|
|
|
45
48
|
|
|
46
49
|
componentClassName,
|
|
47
50
|
userClassName,
|
|
51
|
+
`y-${color}`,
|
|
48
52
|
]
|
|
49
53
|
.filter((e) => e)
|
|
50
54
|
.join(' ')}
|
|
@@ -52,18 +56,30 @@ const SelectInput = ({
|
|
|
52
56
|
// {...otherProps}
|
|
53
57
|
>
|
|
54
58
|
<FormLabel className="input-label" name={name}>{label}</FormLabel>
|
|
55
|
-
<select className="input
|
|
59
|
+
<select className="input" {...field} value={field.value || ''} id={name} disabled={disabled}>
|
|
56
60
|
{
|
|
57
61
|
options.map((option) => {
|
|
58
62
|
// i.e if option is a string like "blah", return { value: "blah", label: "blah" }
|
|
59
63
|
const newOption = typeof option === 'string' ? { value: option, label: option } : option
|
|
64
|
+
|
|
60
65
|
return (
|
|
61
|
-
<option
|
|
66
|
+
<option
|
|
67
|
+
key={newOption.value}
|
|
68
|
+
value={newOption.value}
|
|
69
|
+
disabled={newOption?.disabled || false}
|
|
70
|
+
>
|
|
71
|
+
{newOption.label}
|
|
72
|
+
</option>
|
|
62
73
|
)
|
|
63
74
|
})
|
|
64
75
|
}
|
|
65
76
|
</select>
|
|
66
|
-
{
|
|
77
|
+
{(description || (meta.touched && meta.error))
|
|
78
|
+
&& (
|
|
79
|
+
<FormDescription isError={!!meta.error} className="v50 mt-v s-1">
|
|
80
|
+
{ meta.error || description }
|
|
81
|
+
</FormDescription>
|
|
82
|
+
)}
|
|
67
83
|
</div>
|
|
68
84
|
)
|
|
69
85
|
}
|
|
@@ -93,22 +109,44 @@ SelectInput.propTypes = {
|
|
|
93
109
|
*/
|
|
94
110
|
label:PropTypes.string,
|
|
95
111
|
|
|
112
|
+
/**
|
|
113
|
+
* The input field validator function
|
|
114
|
+
*/
|
|
115
|
+
validate:PropTypes.func,
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* The select input description
|
|
119
|
+
*/
|
|
120
|
+
description:PropTypes.string,
|
|
121
|
+
|
|
96
122
|
/**
|
|
97
123
|
* The options of the select input
|
|
98
124
|
*/
|
|
99
125
|
options:PropTypes.arrayOf(
|
|
100
126
|
PropTypes.oneOfType(
|
|
101
|
-
[
|
|
127
|
+
[
|
|
128
|
+
PropTypes.string,
|
|
129
|
+
PropTypes.shape({
|
|
130
|
+
value :PropTypes.string,
|
|
131
|
+
label :PropTypes.string,
|
|
132
|
+
disabled:PropTypes.bool,
|
|
133
|
+
})],
|
|
102
134
|
),
|
|
103
135
|
),
|
|
104
136
|
/**
|
|
105
137
|
* Whether the select input should be disabled
|
|
106
138
|
*/
|
|
107
139
|
disabled:PropTypes.bool,
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* The color of the select input
|
|
143
|
+
*/
|
|
144
|
+
color:PropTypes.string,
|
|
108
145
|
}
|
|
109
146
|
|
|
110
147
|
SelectInput.defaultProps = {
|
|
111
148
|
disabled:false,
|
|
149
|
+
color :'background2',
|
|
112
150
|
}
|
|
113
151
|
|
|
114
152
|
export default memo(SelectInput)
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
@use "../../../form.scss";
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
$default-padding: 0.75em
|
|
8
|
+
$default-padding: 0.75em;
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
.#{bem.$base}.select-input {
|
|
@@ -13,17 +13,22 @@ $default-padding: 0.75em 0.75em 0.55em;
|
|
|
13
13
|
flex-direction: column;
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
.input-label {
|
|
17
|
-
color: var(--main1);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
16
|
.input {
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
border: var(--theme-border-style) var(--dark-y);
|
|
18
|
+
background: var(--light-y);
|
|
19
|
+
color:var(--on-y);
|
|
23
20
|
padding: $default-padding;
|
|
24
21
|
|
|
22
|
+
&:not(:disabled):hover{
|
|
23
|
+
border: var(--theme-border-style) var(--light-background4);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&:disabled {
|
|
27
|
+
background-color: var(--dark-y);
|
|
28
|
+
}
|
|
29
|
+
|
|
25
30
|
&:focus {
|
|
26
|
-
background: var(--
|
|
31
|
+
background: var(--y);
|
|
27
32
|
}
|
|
28
33
|
}
|
|
29
34
|
}
|
|
@@ -27,10 +27,14 @@ const TextInput = ({
|
|
|
27
27
|
type,
|
|
28
28
|
name,
|
|
29
29
|
label,
|
|
30
|
+
color,
|
|
31
|
+
labelColor,
|
|
30
32
|
validate,
|
|
31
33
|
oneInputLabel,
|
|
32
34
|
description,
|
|
33
35
|
disabled,
|
|
36
|
+
placeholder,
|
|
37
|
+
optional,
|
|
34
38
|
// ...otherProps
|
|
35
39
|
}) => {
|
|
36
40
|
useLayoutEffect(() => {
|
|
@@ -46,6 +50,7 @@ const TextInput = ({
|
|
|
46
50
|
baseClassName,
|
|
47
51
|
componentClassName,
|
|
48
52
|
userClassName,
|
|
53
|
+
`y-${color}`,
|
|
49
54
|
]
|
|
50
55
|
.filter((e) => e)
|
|
51
56
|
.join(' ')}
|
|
@@ -53,19 +58,21 @@ const TextInput = ({
|
|
|
53
58
|
// {...otherProps}
|
|
54
59
|
>
|
|
55
60
|
<FormLabel
|
|
56
|
-
className={[
|
|
57
|
-
'input-label', oneInputLabel ? 'md-s2 s0 v1 mb-v' : 'v50 mb-v']
|
|
61
|
+
className={[oneInputLabel ? 'md-s2 s0 v1 mb-v' : 'v50 mb-v']
|
|
58
62
|
.filter((e) => e)
|
|
59
63
|
.join(' ')}
|
|
60
64
|
name={name}
|
|
65
|
+
color={labelColor}
|
|
66
|
+
optional={optional}
|
|
61
67
|
>
|
|
62
68
|
{ label }
|
|
63
69
|
</FormLabel>
|
|
64
70
|
<input
|
|
65
71
|
id={name}
|
|
66
|
-
className=
|
|
72
|
+
className="input"
|
|
67
73
|
type={type}
|
|
68
74
|
disabled={disabled}
|
|
75
|
+
placeholder={placeholder}
|
|
69
76
|
{...field}
|
|
70
77
|
/>
|
|
71
78
|
{(description || (meta.touched && meta.error))
|
|
@@ -104,6 +111,11 @@ TextInput.propTypes = {
|
|
|
104
111
|
*/
|
|
105
112
|
label:PropTypes.string.isRequired,
|
|
106
113
|
|
|
114
|
+
/**
|
|
115
|
+
* The input label color
|
|
116
|
+
*/
|
|
117
|
+
labelColor:PropTypes.string,
|
|
118
|
+
|
|
107
119
|
/**
|
|
108
120
|
* The type of the input (html)
|
|
109
121
|
*/
|
|
@@ -136,10 +148,26 @@ TextInput.propTypes = {
|
|
|
136
148
|
* Whether the text input should be disabled
|
|
137
149
|
*/
|
|
138
150
|
disabled :PropTypes.bool,
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* The placeholder text for the input
|
|
154
|
+
*/
|
|
155
|
+
placeholder:PropTypes.string,
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* The text input color
|
|
159
|
+
*/
|
|
160
|
+
color:PropTypes.string,
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Whether the input is optional or not
|
|
164
|
+
*/
|
|
165
|
+
optional:PropTypes.bool,
|
|
139
166
|
}
|
|
140
167
|
|
|
141
168
|
TextInput.defaultProps = {
|
|
142
169
|
type :'text',
|
|
170
|
+
color :'background2',
|
|
143
171
|
disabled:false,
|
|
144
172
|
}
|
|
145
173
|
|
|
@@ -9,17 +9,26 @@ $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
|
-
|
|
18
|
-
|
|
13
|
+
border: var(--theme-border-style) var(--dark-y);
|
|
14
|
+
background: var(--light-y);
|
|
15
|
+
color: var(--on-y);
|
|
19
16
|
padding: $default-padding;
|
|
20
17
|
|
|
18
|
+
&::placeholder{
|
|
19
|
+
color: var(--metadata);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&:not(:disabled):hover{
|
|
23
|
+
border: var(--theme-border-style) var(--light-background4);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&:disabled {
|
|
27
|
+
background-color: var(--dark-y);
|
|
28
|
+
}
|
|
29
|
+
|
|
21
30
|
&:focus {
|
|
22
|
-
background: var(--
|
|
31
|
+
background: var(--light-background4);
|
|
23
32
|
}
|
|
24
33
|
}
|
|
25
34
|
}
|
|
@@ -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(() => {
|
|
@@ -51,8 +52,7 @@ const TextareaInput = ({
|
|
|
51
52
|
|
|
52
53
|
componentClassName,
|
|
53
54
|
userClassName,
|
|
54
|
-
`
|
|
55
|
-
`y-${labelColor}`,
|
|
55
|
+
`y-${textAreaColor}`,
|
|
56
56
|
]
|
|
57
57
|
.filter((e) => e)
|
|
58
58
|
.join(' ')}
|
|
@@ -60,18 +60,19 @@ 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>
|
|
71
71
|
<textarea
|
|
72
72
|
id={textAreaId}
|
|
73
|
-
className=
|
|
73
|
+
className="textarea"
|
|
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:'background2',
|
|
156
167
|
disabled :false,
|
|
157
168
|
}
|
|
158
169
|
|
|
@@ -1,19 +1,32 @@
|
|
|
1
1
|
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
2
|
@use "@pareto-engineering/bem";
|
|
3
3
|
|
|
4
|
+
$default-padding: .5em;
|
|
5
|
+
|
|
4
6
|
.#{bem.$base}.text-area-input{
|
|
5
7
|
display: flex;
|
|
6
8
|
flex-direction: column;
|
|
7
9
|
|
|
8
10
|
.textarea {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
border: var(--theme-border-style) var(--dark-y);
|
|
12
|
+
background: var(--light-y);
|
|
13
|
+
color: var(--on-y);
|
|
14
|
+
padding: $default-padding;
|
|
11
15
|
|
|
12
|
-
|
|
13
|
-
|
|
16
|
+
&::placeholder{
|
|
17
|
+
color: var(--metadata);
|
|
14
18
|
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
19
|
|
|
20
|
+
&:not(:disabled):hover{
|
|
21
|
+
border: var(--theme-border-style) var(--light-background4);
|
|
22
|
+
}
|
|
18
23
|
|
|
24
|
+
&:disabled {
|
|
25
|
+
background-color: var(--dark-y);
|
|
26
|
+
}
|
|
19
27
|
|
|
28
|
+
&:focus {
|
|
29
|
+
background: var(--light-background4);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
package/src/ui/f/fields/index.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
export { TextInput } from './TextInput'
|
|
2
2
|
export { SelectInput } from './SelectInput'
|
|
3
|
-
export { RadioInput } from './RadioInput'
|
|
4
|
-
export { CheckboxInput } from './CheckboxInput'
|
|
5
|
-
export { TaskRecommendationInput } from './TaskRecommendationInput'
|
|
6
3
|
export { ChoicesInput } from './ChoicesInput'
|
|
7
4
|
export { TextareaInput } from './TextareaInput'
|
|
8
5
|
export { RatingsInput } from './RatingsInput'
|
package/src/ui/form-reset.scss
CHANGED
package/src/ui/index.js
CHANGED