@pareto-engineering/design-system 2.0.0-alpha.12 → 2.0.0-alpha.16
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/styles.scss +2 -4
- 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 +139 -32
- package/dist/cjs/b/Button/styles.scss +43 -18
- package/dist/cjs/b/Page/common/Section/Section.js +16 -2
- package/dist/cjs/c/ContentSlides/common/Navigator/Navigator.js +4 -3
- 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 +1 -1
- 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/TextInput/TextInput.js +10 -3
- package/dist/cjs/f/fields/TextInput/styles.scss +4 -4
- package/dist/cjs/f/fields/TextareaInput/TextareaInput.js +1 -1
- package/dist/es/a/BackgroundGradient/styles.scss +2 -4
- 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 +139 -32
- package/dist/es/b/Button/styles.scss +43 -18
- package/dist/es/b/Page/common/Section/Section.js +16 -2
- package/dist/es/c/ContentSlides/common/Navigator/Navigator.js +4 -3
- 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 +1 -1
- 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/TextInput/TextInput.js +10 -3
- package/dist/es/f/fields/TextInput/styles.scss +4 -4
- package/dist/es/f/fields/TextareaInput/TextareaInput.js +1 -1
- package/package.json +2 -2
- package/src/__snapshots__/Storyshots.test.js.snap +452 -93
- package/src/local.scss +1 -0
- package/src/stories/a/BackgroundGradient.stories.jsx +4 -6
- package/src/stories/a/Conversation.stories.jsx +78 -1
- package/src/stories/b/Button.stories.jsx +5 -4
- package/src/stories/b/Page.stories.jsx +25 -1
- package/src/stories/f/SelectInput.stories.jsx +29 -0
- package/src/stories/f/TextInput.stories.jsx +10 -0
- package/src/ui/a/BackgroundGradient/styles.scss +2 -4
- 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 +139 -32
- package/src/ui/b/Button/Button.jsx +2 -1
- package/src/ui/b/Button/styles.scss +43 -18
- package/src/ui/b/Page/common/Section/Section.jsx +18 -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 +1 -1
- 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/TextInput/TextInput.jsx +7 -0
- package/src/ui/f/fields/TextInput/styles.scss +4 -4
- package/src/ui/f/fields/TextareaInput/TextareaInput.jsx +1 -1
|
@@ -7,31 +7,47 @@ $compact-padding: .6em .6em .48em;
|
|
|
7
7
|
$default-color:primary;
|
|
8
8
|
$font-weight:bold;
|
|
9
9
|
$default-margin:.5em;
|
|
10
|
+
$default-animation-time: .3s;
|
|
10
11
|
|
|
11
12
|
.#{bem.$base}.button {
|
|
12
13
|
background: var(--x, var(--#{$default-color}));
|
|
13
14
|
border: transparent;
|
|
14
15
|
border-radius: var(--theme-border-radius);
|
|
15
16
|
color: var(--on-x, var(--on-#{$default-color}));
|
|
17
|
+
display: inline-flex;
|
|
18
|
+
font-family: var(--theme-default-paragraph);
|
|
16
19
|
font-weight: 600;
|
|
20
|
+
justify-content: space-between;
|
|
17
21
|
padding: $default-padding;
|
|
18
22
|
transition: all .25s;
|
|
19
23
|
|
|
20
|
-
&.arrow-right{
|
|
24
|
+
&.arrow-right {
|
|
21
25
|
&::after {
|
|
22
|
-
content: "
|
|
23
|
-
font-family: "icons";
|
|
24
|
-
vertical-align: middle;
|
|
26
|
+
content: "-->";
|
|
25
27
|
margin-left: $default-margin;
|
|
28
|
+
vertical-align: middle;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&:hover {
|
|
32
|
+
&::after {
|
|
33
|
+
--final-position: 50%;
|
|
34
|
+
animation: animateArrow $default-animation-time forwards;
|
|
35
|
+
}
|
|
26
36
|
}
|
|
27
37
|
}
|
|
28
38
|
|
|
29
|
-
&.arrow-left{
|
|
39
|
+
&.arrow-left {
|
|
30
40
|
&::before {
|
|
31
|
-
content: "
|
|
32
|
-
font-family: "icons";
|
|
33
|
-
vertical-align: middle;
|
|
41
|
+
content: "<--";
|
|
34
42
|
margin-right: $default-margin;
|
|
43
|
+
vertical-align: middle;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&:hover {
|
|
47
|
+
&::before {
|
|
48
|
+
--final-position: -50%;
|
|
49
|
+
animation: animateArrow $default-animation-time forwards;
|
|
50
|
+
}
|
|
35
51
|
}
|
|
36
52
|
}
|
|
37
53
|
|
|
@@ -41,12 +57,12 @@ $default-margin:.5em;
|
|
|
41
57
|
&:hover {
|
|
42
58
|
background: var(--light-x, var(--light-#{$default-color}));
|
|
43
59
|
}
|
|
60
|
+
|
|
44
61
|
&:focus {
|
|
45
62
|
background: var(--dark-x, var(--dark-#{$default-color}));
|
|
46
63
|
}
|
|
47
64
|
}
|
|
48
65
|
|
|
49
|
-
|
|
50
66
|
&.#{bem.$modifier-compact} {
|
|
51
67
|
padding: $compact-padding;
|
|
52
68
|
}
|
|
@@ -58,7 +74,7 @@ $default-margin:.5em;
|
|
|
58
74
|
|
|
59
75
|
&:hover,
|
|
60
76
|
&:focus,
|
|
61
|
-
&:disabled{
|
|
77
|
+
&:disabled {
|
|
62
78
|
background: transparent;
|
|
63
79
|
}
|
|
64
80
|
|
|
@@ -74,7 +90,7 @@ $default-margin:.5em;
|
|
|
74
90
|
}
|
|
75
91
|
}
|
|
76
92
|
|
|
77
|
-
&:disabled{
|
|
93
|
+
&:disabled {
|
|
78
94
|
border: 1px solid var(--x, var(--#{$default-color}));
|
|
79
95
|
color: var(--x, var(--#{$default-color}));
|
|
80
96
|
}
|
|
@@ -83,8 +99,8 @@ $default-margin:.5em;
|
|
|
83
99
|
&.#{bem.$modifier-simple} {
|
|
84
100
|
background: transparent;
|
|
85
101
|
border: 1px solid transparent;
|
|
86
|
-
padding: 0;
|
|
87
102
|
color: var(--x, var(--#{$default-color}));
|
|
103
|
+
padding: 0;
|
|
88
104
|
|
|
89
105
|
&:disabled,
|
|
90
106
|
&:hover,
|
|
@@ -93,13 +109,13 @@ $default-margin:.5em;
|
|
|
93
109
|
}
|
|
94
110
|
|
|
95
111
|
&:not(:disabled) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
112
|
+
&:hover {
|
|
113
|
+
color: var(--light-x, var(--light-#{$default-color}));
|
|
114
|
+
}
|
|
99
115
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
116
|
+
&:focus {
|
|
117
|
+
color: var(--dark-x, var(--dark-#{$default-color}));
|
|
118
|
+
}
|
|
103
119
|
}
|
|
104
120
|
|
|
105
121
|
&:disabled {
|
|
@@ -114,3 +130,12 @@ $default-margin:.5em;
|
|
|
114
130
|
}
|
|
115
131
|
|
|
116
132
|
|
|
133
|
+
@keyframes animateArrow {
|
|
134
|
+
from {
|
|
135
|
+
transform: translateX(0);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
to {
|
|
139
|
+
transform: translateX(var(--final-position));
|
|
140
|
+
}
|
|
141
|
+
}
|
|
@@ -4,7 +4,7 @@ import PropTypes from 'prop-types'
|
|
|
4
4
|
import styleNames from '@pareto-engineering/bem'
|
|
5
5
|
|
|
6
6
|
// Local Definitions
|
|
7
|
-
import { Shapes } from 'ui/a'
|
|
7
|
+
import { Shapes, BackgroundGradient } from 'ui/a'
|
|
8
8
|
import usePage from '../../usePage'
|
|
9
9
|
|
|
10
10
|
const baseClassName = styleNames.base
|
|
@@ -16,6 +16,8 @@ const Section = ({
|
|
|
16
16
|
style,
|
|
17
17
|
children,
|
|
18
18
|
backgroundShape,
|
|
19
|
+
backgroundGradient,
|
|
20
|
+
backgroundGradientHeight,
|
|
19
21
|
backgroundVerticalAlign,
|
|
20
22
|
backgroundHorizontalAlign,
|
|
21
23
|
backgroundHeight,
|
|
@@ -50,6 +52,11 @@ const Section = ({
|
|
|
50
52
|
shape={backgroundShape}
|
|
51
53
|
/>
|
|
52
54
|
)}
|
|
55
|
+
{backgroundGradient && (
|
|
56
|
+
<BackgroundGradient
|
|
57
|
+
height={backgroundGradientHeight}
|
|
58
|
+
/>
|
|
59
|
+
)}
|
|
53
60
|
</section>
|
|
54
61
|
)
|
|
55
62
|
}
|
|
@@ -109,6 +116,16 @@ Section.propTypes = {
|
|
|
109
116
|
* The background overflow to use for if the background shape is set.
|
|
110
117
|
*/
|
|
111
118
|
backgroundOverflow:PropTypes.oneOf(['visible', 'hidden', 'scroll']),
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* The background gradient to use for if the background gradient is set.
|
|
122
|
+
*/
|
|
123
|
+
backgroundGradient:PropTypes.bool,
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* The background gradient height to use for if the background gradient is set.
|
|
127
|
+
*/
|
|
128
|
+
backgroundGradientHeight:PropTypes.string,
|
|
112
129
|
}
|
|
113
130
|
|
|
114
131
|
Section.defaultProps = {
|
|
@@ -77,6 +77,7 @@ const Navigator = ({
|
|
|
77
77
|
setNextStepIndex(stepsForward)
|
|
78
78
|
}
|
|
79
79
|
}}
|
|
80
|
+
isCompact
|
|
80
81
|
>
|
|
81
82
|
Next
|
|
82
83
|
</Button>
|
|
@@ -140,8 +141,8 @@ Navigator.propTypes = {
|
|
|
140
141
|
|
|
141
142
|
Navigator.defaultProps = {
|
|
142
143
|
canMoveForward:true,
|
|
143
|
-
previousColor :'
|
|
144
|
-
nextColor :'
|
|
144
|
+
previousColor :'main2',
|
|
145
|
+
nextColor :'main2',
|
|
145
146
|
stepsForward :1,
|
|
146
147
|
stepsBackwards:1,
|
|
147
148
|
}
|
|
@@ -27,6 +27,8 @@ const SelectInput = ({
|
|
|
27
27
|
name,
|
|
28
28
|
label,
|
|
29
29
|
options,
|
|
30
|
+
validate,
|
|
31
|
+
description,
|
|
30
32
|
disabled,
|
|
31
33
|
// ...otherProps
|
|
32
34
|
}) => {
|
|
@@ -34,7 +36,7 @@ const SelectInput = ({
|
|
|
34
36
|
import('./styles.scss')
|
|
35
37
|
}, [])
|
|
36
38
|
|
|
37
|
-
const [field, meta] = useField(name)
|
|
39
|
+
const [field, meta] = useField({ name, validate })
|
|
38
40
|
|
|
39
41
|
return (
|
|
40
42
|
<div
|
|
@@ -52,18 +54,30 @@ const SelectInput = ({
|
|
|
52
54
|
// {...otherProps}
|
|
53
55
|
>
|
|
54
56
|
<FormLabel className="input-label" name={name}>{label}</FormLabel>
|
|
55
|
-
<select className="input v25 pv-v" {...field} id={name} disabled={disabled}>
|
|
57
|
+
<select className="input v25 pv-v" {...field} value={field.value || ''} id={name} disabled={disabled}>
|
|
56
58
|
{
|
|
57
59
|
options.map((option) => {
|
|
58
60
|
// i.e if option is a string like "blah", return { value: "blah", label: "blah" }
|
|
59
61
|
const newOption = typeof option === 'string' ? { value: option, label: option } : option
|
|
62
|
+
|
|
60
63
|
return (
|
|
61
|
-
<option
|
|
64
|
+
<option
|
|
65
|
+
key={newOption.value}
|
|
66
|
+
value={newOption.value}
|
|
67
|
+
disabled={newOption?.disabled || false}
|
|
68
|
+
>
|
|
69
|
+
{newOption.label}
|
|
70
|
+
</option>
|
|
62
71
|
)
|
|
63
72
|
})
|
|
64
73
|
}
|
|
65
74
|
</select>
|
|
66
|
-
{
|
|
75
|
+
{(description || (meta.touched && meta.error))
|
|
76
|
+
&& (
|
|
77
|
+
<FormDescription isError={!!meta.error} className="v50 mt-v s-1">
|
|
78
|
+
{ meta.error || description }
|
|
79
|
+
</FormDescription>
|
|
80
|
+
)}
|
|
67
81
|
</div>
|
|
68
82
|
)
|
|
69
83
|
}
|
|
@@ -93,12 +107,28 @@ SelectInput.propTypes = {
|
|
|
93
107
|
*/
|
|
94
108
|
label:PropTypes.string,
|
|
95
109
|
|
|
110
|
+
/**
|
|
111
|
+
* The input field validator function
|
|
112
|
+
*/
|
|
113
|
+
validate:PropTypes.func,
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* The select input description
|
|
117
|
+
*/
|
|
118
|
+
description:PropTypes.string,
|
|
119
|
+
|
|
96
120
|
/**
|
|
97
121
|
* The options of the select input
|
|
98
122
|
*/
|
|
99
123
|
options:PropTypes.arrayOf(
|
|
100
124
|
PropTypes.oneOfType(
|
|
101
|
-
[
|
|
125
|
+
[
|
|
126
|
+
PropTypes.string,
|
|
127
|
+
PropTypes.shape({
|
|
128
|
+
value :PropTypes.string,
|
|
129
|
+
label :PropTypes.string,
|
|
130
|
+
disabled:PropTypes.bool,
|
|
131
|
+
})],
|
|
102
132
|
),
|
|
103
133
|
),
|
|
104
134
|
/**
|
|
@@ -14,16 +14,16 @@ $default-padding: 0.75em 0.75em 0.55em;
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
.input-label {
|
|
17
|
-
color: var(--
|
|
17
|
+
color: var(--main2);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
.input {
|
|
21
|
-
background: var(--light-
|
|
22
|
-
color: var(--on-
|
|
21
|
+
background: var(--light-background2);
|
|
22
|
+
color: var(--on-background2);
|
|
23
23
|
padding: $default-padding;
|
|
24
24
|
|
|
25
25
|
&:focus {
|
|
26
|
-
background: var(--dark-
|
|
26
|
+
background: var(--dark-background2);
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -31,6 +31,7 @@ const TextInput = ({
|
|
|
31
31
|
oneInputLabel,
|
|
32
32
|
description,
|
|
33
33
|
disabled,
|
|
34
|
+
placeholder,
|
|
34
35
|
// ...otherProps
|
|
35
36
|
}) => {
|
|
36
37
|
useLayoutEffect(() => {
|
|
@@ -66,6 +67,7 @@ const TextInput = ({
|
|
|
66
67
|
className={`input ${meta.touched && meta.error ? 'input-border-error' : 'input-border'}`}
|
|
67
68
|
type={type}
|
|
68
69
|
disabled={disabled}
|
|
70
|
+
placeholder={placeholder}
|
|
69
71
|
{...field}
|
|
70
72
|
/>
|
|
71
73
|
{(description || (meta.touched && meta.error))
|
|
@@ -136,6 +138,11 @@ TextInput.propTypes = {
|
|
|
136
138
|
* Whether the text input should be disabled
|
|
137
139
|
*/
|
|
138
140
|
disabled :PropTypes.bool,
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* The placeholder text for the input
|
|
144
|
+
*/
|
|
145
|
+
placeholder:PropTypes.string,
|
|
139
146
|
}
|
|
140
147
|
|
|
141
148
|
TextInput.defaultProps = {
|
|
@@ -10,16 +10,16 @@ $default-padding: 0.75em 0.75em 0.55em;
|
|
|
10
10
|
flex-direction: column;
|
|
11
11
|
|
|
12
12
|
.input-label {
|
|
13
|
-
color: var(--
|
|
13
|
+
color: var(--main2);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
.input {
|
|
17
|
-
background: var(--light-
|
|
18
|
-
color: var(--on-
|
|
17
|
+
background: var(--light-background2);
|
|
18
|
+
color: var(--on-background2);
|
|
19
19
|
padding: $default-padding;
|
|
20
20
|
|
|
21
21
|
&:focus {
|
|
22
|
-
background: var(--dark-
|
|
22
|
+
background: var(--dark-background2);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
}
|