@pareto-engineering/design-system 2.0.0-alpha.13 → 2.0.0-alpha.14

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.
@@ -5,11 +5,11 @@
5
5
  position: absolute;
6
6
  top: 0;
7
7
  left: 0;
8
- justify-content: var(--vertical-align);
9
8
  width: 100%;
10
9
  height: var(--gradient-height);
11
10
  background-image: linear-gradient(transparent, var(--y) 25%, var(--light-y) 75%, transparent);
12
- opacity: .8;
11
+ opacity: .4;
12
+ z-index: -1;
13
13
  }
14
14
 
15
15
 
@@ -35,17 +35,18 @@ var Conversation = _ref => {
35
35
  backgroundColor,
36
36
  ourColor,
37
37
  theirColor,
38
- children // ...otherProps
38
+ children,
39
+ hasTriangle // ...otherProps
39
40
 
40
41
  } = _ref;
41
42
  (0, React.useLayoutEffect)(() => {
42
43
  Promise.resolve().then(() => _interopRequireWildcard(require("./styles.scss")));
43
- }, []); // const messageColors = { ours: color, theirs: 'main2' }
44
-
44
+ }, []);
45
45
  return /*#__PURE__*/React.createElement(_Context.default.Provider, {
46
46
  value: {
47
47
  ourColor,
48
- theirColor
48
+ theirColor,
49
+ hasTriangle
49
50
  }
50
51
  }, /*#__PURE__*/React.createElement("div", {
51
52
  id: id,
@@ -88,12 +89,18 @@ Conversation.propTypes = {
88
89
  /**
89
90
  * The children JSX
90
91
  */
91
- children: _propTypes.default.node
92
+ children: _propTypes.default.node,
93
+
94
+ /**
95
+ * whether to add triangle to bubble chats
96
+ */
97
+ hasTriangle: _propTypes.default.bool
92
98
  };
93
99
  Conversation.defaultProps = {
94
- backgroundColor: 'background',
95
- ourColor: 'main2',
96
- theirColor: 'background2'
100
+ backgroundColor: 'background2',
101
+ ourColor: 'background1',
102
+ theirColor: 'background1',
103
+ hasTriangle: 'false'
97
104
  };
98
105
  Conversation.Message = _common.Message;
99
106
  var _default = Conversation;
@@ -34,22 +34,32 @@ var Message = _ref => {
34
34
  style,
35
35
  message,
36
36
  sender,
37
- from // ...otherProps
37
+ from,
38
+ attachment,
39
+ attachmentIcon,
40
+ attachmentColor // ...otherProps
38
41
 
39
42
  } = _ref;
40
43
  var {
44
+ hasTriangle,
41
45
  ourColor,
42
46
  theirColor
43
47
  } = (0, _useConversation.default)();
44
48
  return /*#__PURE__*/React.createElement("div", {
45
49
  id: id,
46
- className: [baseClassName, componentClassName, userClassName, "x-".concat(from === 'ours' ? ourColor : theirColor), from === 'ours' && 'ours'].filter(e => e).join(' '),
50
+ className: [baseClassName, componentClassName, userClassName, "x-".concat(from === 'ours' ? ourColor : theirColor), from === 'ours' && 'ours', hasTriangle === true ? 'has-triangle' : '', 'v1'].filter(e => e).join(' '),
47
51
  style: style
48
52
  }, /*#__PURE__*/React.createElement("div", {
49
53
  className: _bem.default.elementContent
50
54
  }, /*#__PURE__*/React.createElement("p", {
51
55
  className: "sender v25 mb-v s-1"
52
- }, sender, ":"), /*#__PURE__*/React.createElement("p", null, message)));
56
+ }, sender, ":"), /*#__PURE__*/React.createElement("p", null, message), attachment && /*#__PURE__*/React.createElement("div", {
57
+ className: "attachment y-".concat(attachmentColor)
58
+ }, /*#__PURE__*/React.createElement("span", {
59
+ className: "f-icons"
60
+ }, attachmentIcon), /*#__PURE__*/React.createElement("p", {
61
+ className: "ml-v"
62
+ }, attachment))));
53
63
  };
54
64
 
55
65
  Message.propTypes = {
@@ -63,6 +73,11 @@ Message.propTypes = {
63
73
  */
64
74
  className: _propTypes.default.string,
65
75
 
76
+ /**
77
+ * The React-written, css properties for this element.
78
+ */
79
+ style: _propTypes.default.objectOf(_propTypes.default.string),
80
+
66
81
  /**
67
82
  * The message in the conversation
68
83
  */
@@ -79,12 +94,24 @@ Message.propTypes = {
79
94
  from: _propTypes.default.oneOf(['ours', 'theirs']),
80
95
 
81
96
  /**
82
- * The React-written, css properties for this element.
97
+ * name of the attachment file
98
+ */
99
+ attachment: _propTypes.default.string,
100
+
101
+ /**
102
+ * source of the attachment icon
103
+ */
104
+ attachmentIcon: _propTypes.default.string,
105
+
106
+ /**
107
+ * background color of the attachment box
83
108
  */
84
- style: _propTypes.default.objectOf(_propTypes.default.string)
109
+ attachmentColor: _propTypes.default.string
85
110
  };
86
111
  Message.defaultProps = {
87
- from: 'theirs'
112
+ from: 'theirs',
113
+ attachmentIcon: 'A',
114
+ attachmentColor: 'main4'
88
115
  };
89
116
  var _default = Message;
90
117
  exports.default = _default;
@@ -1,4 +1,5 @@
1
1
  /* @pareto-engineering/generator-front 1.0.12 */
2
+
2
3
  @use "@pareto-engineering/bem";
3
4
  @use "@aztlan/stylebook/src/mixins";
4
5
  @use "@aztlan/stylebook/src/globals" as *;
@@ -8,47 +9,153 @@ $default-conversation-background: var(--y);
8
9
  $default-message-max-width: calc(100% - #{$default-padding});
9
10
  $default-message-min-width: 12em;
10
11
  $default-message-border: var(--theme-border);
12
+ $triangle-border-size: 15px;
13
+ $triangle-border-style: $triangle-border-size solid;
14
+ $triangle-border-style-subtracted: ($triangle-border-size - 1px) solid;
15
+ $triangle-border1: $triangle-border-style var(--paragraph);
16
+ $triangle-border2: $triangle-border-style transparent;
17
+ $triangle-border3: $triangle-border-style-subtracted var(--x);
18
+ $triangle-border4: $triangle-border-style-subtracted transparent;
19
+ $triangle-before-side:24px;
20
+ $triangle-before-bottom:-30px;
21
+ $triangle-after-bottom:-27px;
22
+ $triangle-after-side:25px;
11
23
 
12
24
  .#{bem.$base}.conversation {
13
- display: flex;
14
- flex-direction: column;
15
- background-color: $default-conversation-background;
16
- padding: $default-padding;
25
+ background-color: $default-conversation-background;
26
+ border-radius: var(--theme-border-radius);
27
+ display: flex;
28
+ flex-direction: column;
29
+ padding: $default-padding;
30
+
31
+ >:not(:last-child) {
32
+ margin-bottom: $default-padding;
33
+ }
34
+
35
+ // >:nth-child(1) {
36
+ // animation-delay: 1s;
37
+ // }
38
+ // >:nth-child(2) {
39
+ // animation-delay: 3s;
40
+ // }
41
+
42
+ .#{bem.$base}.message {
43
+ align-self: flex-start;
44
+ background-color: var(--x);
45
+ // animation: fadeIn 1s ease-in both;
46
+ border: $default-message-border;
17
47
  border-radius: var(--theme-border-radius);
48
+ max-width: $default-message-max-width;
49
+ min-width: $default-message-min-width;
50
+ padding: $default-padding;
51
+ position: relative;
18
52
 
19
- >:not(:last-child) {
20
- margin-bottom: $default-padding;
21
- }
53
+ .#{bem.$element-content} {
54
+ display: flex;
55
+ flex-direction: column;
56
+
57
+ >p {
58
+ color: var(--on-x);
59
+ }
60
+
61
+ .sender {
62
+ font-weight: 800;
63
+ margin-bottom: .5em;
64
+ }
22
65
 
23
- .#{bem.$base}.message {
24
- min-width: $default-message-min-width;
25
- max-width: $default-message-max-width;
26
- padding: $default-padding;
27
- border-radius: var(--theme-border-radius);
28
- background-color: var(--x);
29
- align-self: flex-start;
30
- border: $default-message-border;
31
-
32
- .#{bem.$element-content} {
33
- display: flex;
34
- flex-direction: column;
35
-
36
- >p {
37
- color: var(--on-x);
38
- }
39
-
40
- .sender {
41
- font-weight: 800;
42
- margin-bottom: .5em;
43
- }
66
+ .attachment {
67
+ align-self: baseline;
68
+ background-color: var(--y);
69
+ display: flex;
70
+ flex-direction: row;
71
+ padding: .5em 1em;
72
+
73
+ > p {
74
+ margin-bottom: 0;
44
75
  }
45
- }
46
76
 
47
- .#{bem.$base}.ours {
48
- align-self: flex-end;
77
+ > img {
78
+ width: 40px;
79
+ }
80
+ }
81
+ }
82
+ &.#{bem.$base}.ours {
83
+ align-self: flex-end;
49
84
  }
50
85
 
51
- }
86
+ &.has-triangle {
87
+ ::before {
88
+ border-bottom: $triangle-border2;
89
+ border-left: $triangle-border2;
90
+ border-right: $triangle-border1;
91
+ border-top: $triangle-border1;
92
+ bottom: $triangle-before-bottom;
93
+ content: "";
94
+ height: 0;
95
+ position: absolute;
96
+ right: $triangle-before-side;
97
+ width: 0;
98
+ }
99
+
100
+ ::after {
101
+ border-bottom: $triangle-border4;
102
+ border-left: $triangle-border4;
103
+ border-right: $triangle-border3;
104
+ border-top: $triangle-border3;
105
+ bottom: $triangle-after-bottom;
106
+ content: "";
107
+ height: 0;
108
+ position: absolute;
109
+ right: $triangle-after-side;
110
+ width: 0;
111
+ }
112
+
113
+ &:not(.ours) {
114
+ ::before {
115
+ border-bottom: $triangle-border2;
116
+ border-left: $triangle-border1;
117
+ border-right: $triangle-border2;
118
+ border-top: $triangle-border1;
119
+ bottom: $triangle-before-bottom;
120
+ content: "";
121
+ height: 0;
122
+ left: $triangle-before-side;
123
+ position: absolute;
124
+ width: 0;
125
+ }
52
126
 
127
+ ::after {
128
+ border-bottom: $triangle-border4;
129
+ border-left: $triangle-border3;
130
+ border-right: $triangle-border4;
131
+ border-top: $triangle-border3;
132
+ bottom: $triangle-after-bottom;
133
+ content: "";
134
+ height: 0;
135
+ left: $triangle-after-side;
136
+ position: absolute;
137
+ width: 0;
138
+ }
139
+ }
140
+ }
53
141
 
142
+ // mobile style
143
+ @include mixins.media($to:$sm-md) {
144
+ .message {
145
+ margin-top: 2em;
146
+ }
147
+ }
148
+ }
149
+ }
54
150
 
151
+ //@keyframes fadeIn {
152
+ // from {
153
+ // opacity: 0;
154
+ // transform: translate3d(0, 50%, 0);
155
+ // }
156
+ //
157
+ // to {
158
+ // opacity: 1;
159
+ // transform: translate3d(0, 0, 0);
160
+ // }
161
+ //}
@@ -13,24 +13,23 @@ $default-margin:.5em;
13
13
  border: transparent;
14
14
  border-radius: var(--theme-border-radius);
15
15
  color: var(--on-x, var(--on-#{$default-color}));
16
+ display: inline-flex;
16
17
  font-weight: 600;
18
+ font-family: var(--theme-default-paragraph);
19
+ justify-content: space-between;
17
20
  padding: $default-padding;
18
21
  transition: all .25s;
19
22
 
20
- &.arrow-right{
23
+ &.arrow-right {
21
24
  &::after {
22
- content: "L";
23
- font-family: "icons";
24
- vertical-align: middle;
25
+ content: "-->";
25
26
  margin-left: $default-margin;
26
27
  }
27
28
  }
28
29
 
29
- &.arrow-left{
30
+ &.arrow-left {
30
31
  &::before {
31
- content: "H";
32
- font-family: "icons";
33
- vertical-align: middle;
32
+ content: "<--";
34
33
  margin-right: $default-margin;
35
34
  }
36
35
  }
@@ -41,6 +40,7 @@ $default-margin:.5em;
41
40
  &:hover {
42
41
  background: var(--light-x, var(--light-#{$default-color}));
43
42
  }
43
+
44
44
  &:focus {
45
45
  background: var(--dark-x, var(--dark-#{$default-color}));
46
46
  }
@@ -58,7 +58,7 @@ $default-margin:.5em;
58
58
 
59
59
  &:hover,
60
60
  &:focus,
61
- &:disabled{
61
+ &:disabled {
62
62
  background: transparent;
63
63
  }
64
64
 
@@ -74,7 +74,7 @@ $default-margin:.5em;
74
74
  }
75
75
  }
76
76
 
77
- &:disabled{
77
+ &:disabled {
78
78
  border: 1px solid var(--x, var(--#{$default-color}));
79
79
  color: var(--x, var(--#{$default-color}));
80
80
  }
@@ -83,8 +83,8 @@ $default-margin:.5em;
83
83
  &.#{bem.$modifier-simple} {
84
84
  background: transparent;
85
85
  border: 1px solid transparent;
86
- padding: 0;
87
86
  color: var(--x, var(--#{$default-color}));
87
+ padding: 0;
88
88
 
89
89
  &:disabled,
90
90
  &:hover,
@@ -93,13 +93,13 @@ $default-margin:.5em;
93
93
  }
94
94
 
95
95
  &:not(:disabled) {
96
- &:hover {
97
- color: var(--light-x, var(--light-#{$default-color}));
98
- }
96
+ &:hover {
97
+ color: var(--light-x, var(--light-#{$default-color}));
98
+ }
99
99
 
100
- &:focus {
101
- color: var(--dark-x, var(--dark-#{$default-color}));
102
- }
100
+ &:focus {
101
+ color: var(--dark-x, var(--dark-#{$default-color}));
102
+ }
103
103
  }
104
104
 
105
105
  &:disabled {
@@ -5,11 +5,11 @@
5
5
  position: absolute;
6
6
  top: 0;
7
7
  left: 0;
8
- justify-content: var(--vertical-align);
9
8
  width: 100%;
10
9
  height: var(--gradient-height);
11
10
  background-image: linear-gradient(transparent, var(--y) 25%, var(--light-y) 75%, transparent);
12
- opacity: .8;
11
+ opacity: .4;
12
+ z-index: -1;
13
13
  }
14
14
 
15
15
 
@@ -19,17 +19,18 @@ const Conversation = ({
19
19
  backgroundColor,
20
20
  ourColor,
21
21
  theirColor,
22
- children // ...otherProps
22
+ children,
23
+ hasTriangle // ...otherProps
23
24
 
24
25
  }) => {
25
26
  useLayoutEffect(() => {
26
27
  import("./styles.scss");
27
- }, []); // const messageColors = { ours: color, theirs: 'main2' }
28
-
28
+ }, []);
29
29
  return /*#__PURE__*/React.createElement(ConversationContext.Provider, {
30
30
  value: {
31
31
  ourColor,
32
- theirColor
32
+ theirColor,
33
+ hasTriangle
33
34
  }
34
35
  }, /*#__PURE__*/React.createElement("div", {
35
36
  id: id,
@@ -72,12 +73,18 @@ Conversation.propTypes = {
72
73
  /**
73
74
  * The children JSX
74
75
  */
75
- children: PropTypes.node
76
+ children: PropTypes.node,
77
+
78
+ /**
79
+ * whether to add triangle to bubble chats
80
+ */
81
+ hasTriangle: PropTypes.bool
76
82
  };
77
83
  Conversation.defaultProps = {
78
- backgroundColor: 'background',
79
- ourColor: 'main2',
80
- theirColor: 'background2'
84
+ backgroundColor: 'background2',
85
+ ourColor: 'background1',
86
+ theirColor: 'background1',
87
+ hasTriangle: 'false'
81
88
  };
82
89
  Conversation.Message = Message;
83
90
  export default Conversation;
@@ -16,22 +16,32 @@ const Message = ({
16
16
  style,
17
17
  message,
18
18
  sender,
19
- from // ...otherProps
19
+ from,
20
+ attachment,
21
+ attachmentIcon,
22
+ attachmentColor // ...otherProps
20
23
 
21
24
  }) => {
22
25
  const {
26
+ hasTriangle,
23
27
  ourColor,
24
28
  theirColor
25
29
  } = useConversation();
26
30
  return /*#__PURE__*/React.createElement("div", {
27
31
  id: id,
28
- className: [baseClassName, componentClassName, userClassName, `x-${from === 'ours' ? ourColor : theirColor}`, from === 'ours' && 'ours'].filter(e => e).join(' '),
32
+ className: [baseClassName, componentClassName, userClassName, `x-${from === 'ours' ? ourColor : theirColor}`, from === 'ours' && 'ours', hasTriangle === true ? 'has-triangle' : '', 'v1'].filter(e => e).join(' '),
29
33
  style: style
30
34
  }, /*#__PURE__*/React.createElement("div", {
31
35
  className: styleNames.elementContent
32
36
  }, /*#__PURE__*/React.createElement("p", {
33
37
  className: "sender v25 mb-v s-1"
34
- }, sender, ":"), /*#__PURE__*/React.createElement("p", null, message)));
38
+ }, sender, ":"), /*#__PURE__*/React.createElement("p", null, message), attachment && /*#__PURE__*/React.createElement("div", {
39
+ className: `attachment y-${attachmentColor}`
40
+ }, /*#__PURE__*/React.createElement("span", {
41
+ className: "f-icons"
42
+ }, attachmentIcon), /*#__PURE__*/React.createElement("p", {
43
+ className: "ml-v"
44
+ }, attachment))));
35
45
  };
36
46
 
37
47
  Message.propTypes = {
@@ -45,6 +55,11 @@ Message.propTypes = {
45
55
  */
46
56
  className: PropTypes.string,
47
57
 
58
+ /**
59
+ * The React-written, css properties for this element.
60
+ */
61
+ style: PropTypes.objectOf(PropTypes.string),
62
+
48
63
  /**
49
64
  * The message in the conversation
50
65
  */
@@ -61,11 +76,23 @@ Message.propTypes = {
61
76
  from: PropTypes.oneOf(['ours', 'theirs']),
62
77
 
63
78
  /**
64
- * The React-written, css properties for this element.
79
+ * name of the attachment file
80
+ */
81
+ attachment: PropTypes.string,
82
+
83
+ /**
84
+ * source of the attachment icon
85
+ */
86
+ attachmentIcon: PropTypes.string,
87
+
88
+ /**
89
+ * background color of the attachment box
65
90
  */
66
- style: PropTypes.objectOf(PropTypes.string)
91
+ attachmentColor: PropTypes.string
67
92
  };
68
93
  Message.defaultProps = {
69
- from: 'theirs'
94
+ from: 'theirs',
95
+ attachmentIcon: 'A',
96
+ attachmentColor: 'main4'
70
97
  };
71
98
  export default Message;