@pareto-engineering/design-system 4.0.0-alpha.16 → 4.0.0-alpha.17
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/Conversation/Conversation.js +9 -14
- package/dist/cjs/a/Conversation/common/Message/Message.js +11 -12
- package/dist/cjs/a/Conversation/styles.scss +16 -120
- package/dist/cjs/a/SnapScroller/styles.scss +8 -0
- package/dist/cjs/b/Button/styles.scss +2 -2
- package/dist/es/a/Conversation/Conversation.js +9 -14
- package/dist/es/a/Conversation/common/Message/Message.js +11 -12
- package/dist/es/a/Conversation/styles.scss +16 -120
- package/dist/es/a/SnapScroller/styles.scss +8 -0
- package/dist/es/b/Button/styles.scss +2 -2
- package/package.json +2 -2
- package/src/stories/a/Conversation.stories.jsx +8 -43
- package/src/stories/b/Button/Button.stories.jsx +11 -8
- package/src/stories/colors.js +17 -5
- package/src/ui/a/Conversation/Conversation.jsx +11 -17
- package/src/ui/a/Conversation/common/Message/Message.jsx +11 -8
- package/src/ui/a/Conversation/styles.scss +16 -120
- package/src/ui/a/SnapScroller/styles.scss +8 -0
- package/src/ui/b/Button/styles.scss +2 -2
- package/tests/__snapshots__/Storyshots.test.js.snap +5938 -2426
|
@@ -21,22 +21,22 @@ export const Base = () => {
|
|
|
21
21
|
const conversations = [
|
|
22
22
|
{
|
|
23
23
|
message:'Hi Camille, please compile an assesment of top 5 firms/brand providers for the listed fields in the US.',
|
|
24
|
-
sender :'
|
|
24
|
+
sender :'Humbl',
|
|
25
25
|
from :'theirs',
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
28
|
message:'Hi Morgan! Here is the database we prepared for you.',
|
|
29
|
-
sender :'
|
|
29
|
+
sender :'Camille',
|
|
30
30
|
from :'ours',
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
33
|
message:'Hi Camille, please compile an assesment of top 6 firms/brand providers for the listed fields in the US.',
|
|
34
|
-
sender :'
|
|
34
|
+
sender :'Humbl',
|
|
35
35
|
from :'theirs',
|
|
36
36
|
},
|
|
37
37
|
{
|
|
38
38
|
message:'Hi Morgan! Here is the spreadsheet we prepared for you.',
|
|
39
|
-
sender :'
|
|
39
|
+
sender :'Camille',
|
|
40
40
|
from :'ours',
|
|
41
41
|
},
|
|
42
42
|
]
|
|
@@ -50,63 +50,28 @@ export const Base = () => {
|
|
|
50
50
|
)
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
export const WithTriangle = () => {
|
|
54
|
-
const conversations = [
|
|
55
|
-
{
|
|
56
|
-
message:'Hi Camille, please compile an assesment of top 5 firms/brand providers for the listed fields in the US.',
|
|
57
|
-
sender :'HUMBL',
|
|
58
|
-
from :'theirs',
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
message:'Hi Morgan! Here is the database we prepared for you.',
|
|
62
|
-
sender :'CAMILLE',
|
|
63
|
-
from :'ours',
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
message:'Hi Camille, please compile an assesment of top 6 firms/brand providers for the listed fields in the US.',
|
|
67
|
-
sender :'HUMBL',
|
|
68
|
-
from :'theirs',
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
message:'Hi Morgan! Here is the spreadsheet we prepared for you.',
|
|
72
|
-
sender :'CAMILLE',
|
|
73
|
-
from :'ours',
|
|
74
|
-
},
|
|
75
|
-
]
|
|
76
|
-
|
|
77
|
-
return (
|
|
78
|
-
<Conversation
|
|
79
|
-
hasTriangle
|
|
80
|
-
>
|
|
81
|
-
{conversations.map((conversation) => (
|
|
82
|
-
<Conversation.Message key={conversation.message} {...conversation} />
|
|
83
|
-
))}
|
|
84
|
-
</Conversation>
|
|
85
|
-
)
|
|
86
|
-
}
|
|
87
|
-
|
|
88
53
|
export const WithAttachment = () => {
|
|
89
54
|
const conversations = [
|
|
90
55
|
{
|
|
91
56
|
message:'Hi Camille, please compile an assesment of top 5 firms/brand providers for the listed fields in the US.',
|
|
92
|
-
sender :'
|
|
57
|
+
sender :'Humbl',
|
|
93
58
|
from :'theirs',
|
|
94
59
|
},
|
|
95
60
|
{
|
|
96
61
|
message :'Hi Morgan! Here is the database we prepared for you.',
|
|
97
|
-
sender :'
|
|
62
|
+
sender :'Camille',
|
|
98
63
|
from :'ours',
|
|
99
64
|
attachment :'spreadsheet.xlsx',
|
|
100
65
|
attachmentColor:'main4',
|
|
101
66
|
},
|
|
102
67
|
{
|
|
103
68
|
message:'Hi Camille, please compile an assesment of top 6 firms/brand providers for the listed fields in the US.',
|
|
104
|
-
sender :'
|
|
69
|
+
sender :'Humbl',
|
|
105
70
|
from :'theirs',
|
|
106
71
|
},
|
|
107
72
|
{
|
|
108
73
|
message :'Hi Morgan! Here is the spreadsheet we prepared for you.',
|
|
109
|
-
sender :'
|
|
74
|
+
sender :'Camille',
|
|
110
75
|
from :'ours',
|
|
111
76
|
attachment :'spreadsheet.xlsx',
|
|
112
77
|
attachmentColor:'main4',
|
|
@@ -112,11 +112,14 @@ ArrowRightSimple.args = {
|
|
|
112
112
|
isSimple :true,
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
export const
|
|
122
|
-
|
|
115
|
+
export const DisabledArrowLeft = MultipleTemplate.bind({})
|
|
116
|
+
DisabledArrowLeft.args = {
|
|
117
|
+
arrowDirection:'left',
|
|
118
|
+
disabled :true,
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export const DisabledArrowRight = MultipleTemplate.bind({})
|
|
122
|
+
DisabledArrowRight.args = {
|
|
123
|
+
arrowDirection:'right',
|
|
124
|
+
disabled :true,
|
|
125
|
+
}
|
package/src/stories/colors.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
const THEME = [
|
|
2
2
|
'main',
|
|
3
|
-
'
|
|
4
|
-
'
|
|
3
|
+
'main-80',
|
|
4
|
+
'main-50',
|
|
5
5
|
'main2',
|
|
6
|
-
'
|
|
7
|
-
'
|
|
6
|
+
'interactive',
|
|
7
|
+
'interactive-icons',
|
|
8
|
+
'shadow',
|
|
8
9
|
]
|
|
9
10
|
|
|
10
11
|
/*
|
|
@@ -26,19 +27,30 @@ const MODALS = [
|
|
|
26
27
|
'success',
|
|
27
28
|
'warning',
|
|
28
29
|
'error',
|
|
30
|
+
'blocked',
|
|
31
|
+
'backlog',
|
|
32
|
+
'in-progress',
|
|
33
|
+
'in-review',
|
|
34
|
+
'requested',
|
|
35
|
+
'completed',
|
|
29
36
|
]
|
|
30
37
|
|
|
31
38
|
const UI = [
|
|
32
39
|
'background-far',
|
|
33
40
|
'background-near',
|
|
34
41
|
'background-cards',
|
|
42
|
+
'background-cards-80',
|
|
43
|
+
'background-cards-50',
|
|
44
|
+
'background-inputs',
|
|
35
45
|
'background-mesh',
|
|
36
46
|
'heading',
|
|
37
47
|
'paragraph',
|
|
38
48
|
'subtitle',
|
|
39
49
|
'metadata',
|
|
40
50
|
'link',
|
|
41
|
-
'
|
|
51
|
+
'transparent',
|
|
52
|
+
'highlighted',
|
|
53
|
+
'disabled',
|
|
42
54
|
]
|
|
43
55
|
|
|
44
56
|
const SM = [
|
|
@@ -7,6 +7,8 @@ import PropTypes from 'prop-types'
|
|
|
7
7
|
|
|
8
8
|
import styleNames from '@pareto-engineering/bem/exports'
|
|
9
9
|
|
|
10
|
+
import { Card } from 'ui'
|
|
11
|
+
|
|
10
12
|
// Local Definitions
|
|
11
13
|
|
|
12
14
|
import { Message } from './common'
|
|
@@ -24,11 +26,10 @@ const Conversation = ({
|
|
|
24
26
|
id,
|
|
25
27
|
className:userClassName,
|
|
26
28
|
style,
|
|
27
|
-
backgroundColor,
|
|
28
29
|
ourColor,
|
|
29
30
|
theirColor,
|
|
30
31
|
children,
|
|
31
|
-
|
|
32
|
+
backgroundColor,
|
|
32
33
|
// ...otherProps
|
|
33
34
|
}) => {
|
|
34
35
|
useInsertionEffect(() => {
|
|
@@ -42,22 +43,20 @@ const Conversation = ({
|
|
|
42
43
|
theirColor,
|
|
43
44
|
}}
|
|
44
45
|
>
|
|
45
|
-
<
|
|
46
|
+
<Card
|
|
46
47
|
id={id}
|
|
47
48
|
className={[
|
|
48
49
|
baseClassName,
|
|
49
50
|
componentClassName,
|
|
50
51
|
userClassName,
|
|
51
|
-
hasTriangle && 'has-triangle',
|
|
52
52
|
`y-${backgroundColor}`,
|
|
53
|
-
'u1',
|
|
54
53
|
]
|
|
55
54
|
.filter((e) => e)
|
|
56
55
|
.join(' ')}
|
|
57
56
|
style={style}
|
|
58
57
|
>
|
|
59
58
|
{children}
|
|
60
|
-
</
|
|
59
|
+
</Card>
|
|
61
60
|
</ConversationContext.Provider>
|
|
62
61
|
)
|
|
63
62
|
}
|
|
@@ -88,26 +87,21 @@ Conversation.propTypes = {
|
|
|
88
87
|
*/
|
|
89
88
|
theirColor:PropTypes.string,
|
|
90
89
|
|
|
91
|
-
/**
|
|
92
|
-
* The component background color
|
|
93
|
-
*/
|
|
94
|
-
backgroundColor:PropTypes.string,
|
|
95
90
|
/**
|
|
96
91
|
* The children JSX
|
|
97
92
|
*/
|
|
98
|
-
children
|
|
93
|
+
children:PropTypes.node,
|
|
99
94
|
|
|
100
95
|
/**
|
|
101
|
-
*
|
|
96
|
+
* The background color
|
|
102
97
|
*/
|
|
103
|
-
|
|
98
|
+
backgroundColor:PropTypes.string,
|
|
104
99
|
}
|
|
105
100
|
|
|
106
101
|
Conversation.defaultProps = {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
hasTriangle :false,
|
|
102
|
+
ourColor :'main',
|
|
103
|
+
theirColor :'main2',
|
|
104
|
+
backgroundColor:'background-near',
|
|
111
105
|
}
|
|
112
106
|
|
|
113
107
|
Conversation.Message = Message
|
|
@@ -5,6 +5,8 @@ import PropTypes from 'prop-types'
|
|
|
5
5
|
|
|
6
6
|
import styleNames from '@pareto-engineering/bem/exports'
|
|
7
7
|
|
|
8
|
+
import { Card } from 'ui'
|
|
9
|
+
|
|
8
10
|
// Local Definitions
|
|
9
11
|
|
|
10
12
|
import useConversation from '../../useConversation'
|
|
@@ -31,7 +33,7 @@ const Message = ({
|
|
|
31
33
|
const { ourColor, theirColor } = useConversation()
|
|
32
34
|
|
|
33
35
|
return (
|
|
34
|
-
<
|
|
36
|
+
<Card.Section
|
|
35
37
|
id={id}
|
|
36
38
|
className={[
|
|
37
39
|
baseClassName,
|
|
@@ -39,31 +41,32 @@ const Message = ({
|
|
|
39
41
|
userClassName,
|
|
40
42
|
`x-${from === 'ours' ? ourColor : theirColor}`,
|
|
41
43
|
from === 'ours' && 'ours',
|
|
42
|
-
'v1',
|
|
43
44
|
]
|
|
44
45
|
.filter((e) => e)
|
|
45
46
|
.join(' ')}
|
|
46
47
|
style={style}
|
|
47
48
|
>
|
|
48
|
-
|
|
49
|
-
<p className="sender
|
|
49
|
+
{sender && (
|
|
50
|
+
<p className="sender">
|
|
50
51
|
{sender}
|
|
51
52
|
:
|
|
52
53
|
</p>
|
|
54
|
+
)}
|
|
55
|
+
<div className="message-content">
|
|
53
56
|
<p>
|
|
54
57
|
{message}
|
|
55
58
|
</p>
|
|
56
59
|
{attachment
|
|
57
60
|
&& (
|
|
58
61
|
<div className={`attachment y-${attachmentColor}`}>
|
|
59
|
-
<span className="
|
|
60
|
-
<p
|
|
62
|
+
<span className="icon">{attachmentIcon}</span>
|
|
63
|
+
<p>
|
|
61
64
|
{attachment}
|
|
62
65
|
</p>
|
|
63
66
|
</div>
|
|
64
67
|
)}
|
|
65
68
|
</div>
|
|
66
|
-
</
|
|
69
|
+
</Card.Section>
|
|
67
70
|
)
|
|
68
71
|
}
|
|
69
72
|
Message.propTypes = {
|
|
@@ -116,7 +119,7 @@ Message.propTypes = {
|
|
|
116
119
|
Message.defaultProps = {
|
|
117
120
|
from :'theirs',
|
|
118
121
|
attachmentIcon :'A',
|
|
119
|
-
attachmentColor:'
|
|
122
|
+
attachmentColor:'interactive',
|
|
120
123
|
}
|
|
121
124
|
|
|
122
125
|
export default Message
|
|
@@ -1,154 +1,50 @@
|
|
|
1
1
|
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
-
/* stylelint-disable selector-max-compound-selectors -- exception */
|
|
3
2
|
|
|
4
3
|
@use "@pareto-engineering/bem";
|
|
5
4
|
@use "@pareto-engineering/styles/src/mixins";
|
|
6
5
|
@use "@pareto-engineering/styles/src/globals" as *;
|
|
7
6
|
|
|
8
|
-
$default-
|
|
9
|
-
$default-
|
|
7
|
+
$default-border-radius: var(--theme-default-border-radius);
|
|
8
|
+
$default-padding: var(--gap);
|
|
10
9
|
$default-message-max-width: calc(100% - 4 * #{$default-padding});
|
|
11
10
|
$default-message-min-width: 12em;
|
|
12
|
-
$default-message-border: var(--
|
|
13
|
-
$triangle-border-size: 15px;
|
|
14
|
-
$triangle-border-style: $triangle-border-size solid;
|
|
15
|
-
$triangle-border-style-subtracted: ($triangle-border-size - 1px) solid;
|
|
16
|
-
$triangle-border1: $triangle-border-style var(--paragraph);
|
|
17
|
-
$triangle-border2: $triangle-border-style transparent;
|
|
18
|
-
$triangle-border3: $triangle-border-style-subtracted var(--x);
|
|
19
|
-
$triangle-border4: $triangle-border-style-subtracted transparent;
|
|
20
|
-
$triangle-before-side:24px;
|
|
21
|
-
$triangle-before-bottom:-30px;
|
|
22
|
-
$triangle-after-bottom:-27px;
|
|
23
|
-
$triangle-after-side:25px;
|
|
11
|
+
$default-message-border: 1px solid var(--hard-background-cards);
|
|
24
12
|
|
|
25
13
|
.#{bem.$base}.conversation {
|
|
26
|
-
background
|
|
27
|
-
border-radius: var(--theme-border-radius);
|
|
14
|
+
background: var(--y);
|
|
28
15
|
display: flex;
|
|
29
16
|
flex-direction: column;
|
|
30
17
|
padding: $default-padding;
|
|
31
18
|
|
|
32
|
-
|
|
33
|
-
margin-bottom: $default-padding;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// >:nth-child(1) {
|
|
37
|
-
// animation-delay: 1s;
|
|
38
|
-
// }
|
|
39
|
-
// >:nth-child(2) {
|
|
40
|
-
// animation-delay: 3s;
|
|
41
|
-
// }
|
|
42
|
-
|
|
43
|
-
&.has-triangle {
|
|
44
|
-
padding-bottom: calc(#{$default-padding} * 2);
|
|
45
|
-
.#{bem.$base}.message {
|
|
46
|
-
::before {
|
|
47
|
-
border-bottom: $triangle-border2;
|
|
48
|
-
border-left: $triangle-border2;
|
|
49
|
-
border-right: $triangle-border1;
|
|
50
|
-
border-top: $triangle-border1;
|
|
51
|
-
bottom: $triangle-before-bottom;
|
|
52
|
-
content: "";
|
|
53
|
-
height: 0;
|
|
54
|
-
position: absolute;
|
|
55
|
-
right: $triangle-before-side;
|
|
56
|
-
width: 0;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
::after {
|
|
60
|
-
border-bottom: $triangle-border4;
|
|
61
|
-
border-left: $triangle-border4;
|
|
62
|
-
border-right: $triangle-border3;
|
|
63
|
-
border-top: $triangle-border3;
|
|
64
|
-
bottom: $triangle-after-bottom;
|
|
65
|
-
content: "";
|
|
66
|
-
height: 0;
|
|
67
|
-
position: absolute;
|
|
68
|
-
right: $triangle-after-side;
|
|
69
|
-
width: 0;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
&:not(.ours) {
|
|
73
|
-
::before {
|
|
74
|
-
border-bottom: $triangle-border2;
|
|
75
|
-
border-left: $triangle-border1;
|
|
76
|
-
border-right: $triangle-border2;
|
|
77
|
-
border-top: $triangle-border1;
|
|
78
|
-
bottom: $triangle-before-bottom;
|
|
79
|
-
content: "";
|
|
80
|
-
height: 0;
|
|
81
|
-
left: $triangle-before-side;
|
|
82
|
-
position: absolute;
|
|
83
|
-
width: 0;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
::after {
|
|
87
|
-
border-bottom: $triangle-border4;
|
|
88
|
-
border-left: $triangle-border3;
|
|
89
|
-
border-right: $triangle-border4;
|
|
90
|
-
border-top: $triangle-border3;
|
|
91
|
-
bottom: $triangle-after-bottom;
|
|
92
|
-
content: "";
|
|
93
|
-
height: 0;
|
|
94
|
-
left: $triangle-after-side;
|
|
95
|
-
position: absolute;
|
|
96
|
-
width: 0;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.#{bem.$base}.message {
|
|
19
|
+
> .#{bem.$base}.message {
|
|
103
20
|
align-self: flex-start;
|
|
104
|
-
background-color: var(--x);
|
|
105
|
-
// animation: fadeIn 1s ease-in both;
|
|
106
|
-
border: $default-message-border;
|
|
107
|
-
border-radius: var(--theme-border-radius);
|
|
108
21
|
max-width: $default-message-max-width;
|
|
109
22
|
min-width: $default-message-min-width;
|
|
110
|
-
padding: $default-padding;
|
|
111
23
|
position: relative;
|
|
112
24
|
|
|
113
|
-
|
|
25
|
+
> .message-content {
|
|
26
|
+
background-color: var(--x);
|
|
27
|
+
border: $default-message-border;
|
|
28
|
+
border-radius: $default-border-radius;
|
|
114
29
|
display: flex;
|
|
115
30
|
flex-direction: column;
|
|
31
|
+
padding: 0 $default-padding;
|
|
116
32
|
|
|
117
|
-
>p {
|
|
33
|
+
> p {
|
|
118
34
|
color: var(--on-x);
|
|
119
35
|
}
|
|
120
36
|
|
|
121
|
-
.
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
.attachment {
|
|
127
|
-
align-self: baseline;
|
|
128
|
-
background-color: var(--y);
|
|
37
|
+
> .attachment {
|
|
38
|
+
align-items: center;
|
|
39
|
+
align-self: flex-end;
|
|
129
40
|
display: flex;
|
|
130
41
|
flex-direction: row;
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
> p {
|
|
134
|
-
margin-bottom: 0;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
> img {
|
|
138
|
-
width: 40px;
|
|
139
|
-
}
|
|
42
|
+
gap: calc($default-padding / 2);
|
|
140
43
|
}
|
|
141
44
|
}
|
|
45
|
+
|
|
142
46
|
&.#{bem.$base}.ours {
|
|
143
47
|
align-self: flex-end;
|
|
144
48
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
// mobile style
|
|
148
|
-
@include mixins.media($to:$sm-md) {
|
|
149
|
-
.message {
|
|
150
|
-
margin-top: 2em;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
49
|
}
|
|
154
50
|
}
|
|
@@ -27,6 +27,10 @@ $default-spacing: var(--gap, 1em);
|
|
|
27
27
|
&:first-child {
|
|
28
28
|
margin-left: $default-spacing;
|
|
29
29
|
}
|
|
30
|
+
|
|
31
|
+
&:last-child {
|
|
32
|
+
margin-right: $default-spacing;
|
|
33
|
+
}
|
|
30
34
|
}
|
|
31
35
|
|
|
32
36
|
@include mixins.media($from: $sm-md) {
|
|
@@ -42,6 +46,10 @@ $default-spacing: var(--gap, 1em);
|
|
|
42
46
|
&:first-child {
|
|
43
47
|
margin-left: unset;
|
|
44
48
|
}
|
|
49
|
+
|
|
50
|
+
&:last-child {
|
|
51
|
+
margin-right: unset;
|
|
52
|
+
}
|
|
45
53
|
}
|
|
46
54
|
}
|
|
47
55
|
}
|
|
@@ -30,7 +30,7 @@ $default-animation-time: .31s;
|
|
|
30
30
|
vertical-align: middle;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
&:hover {
|
|
33
|
+
&:hover:not(:disabled) {
|
|
34
34
|
&::after {
|
|
35
35
|
--final-position: 50%;
|
|
36
36
|
animation: animateArrow $default-animation-time forwards;
|
|
@@ -46,7 +46,7 @@ $default-animation-time: .31s;
|
|
|
46
46
|
vertical-align: middle;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
&:hover {
|
|
49
|
+
&:hover:not(:disabled) {
|
|
50
50
|
&::before {
|
|
51
51
|
--final-position: -50%;
|
|
52
52
|
animation: animateArrow $default-animation-time forwards;
|