@weni/unnnic-system 1.16.37-develop.0 → 1.16.39-develop.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weni/unnnic-system",
3
- "version": "1.16.37-develop.0",
3
+ "version": "1.16.39-develop.0",
4
4
  "main": "./dist/unnnic.common.js",
5
5
  "files": [
6
6
  "dist/*",
@@ -30,6 +30,7 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "core-js": "^3.6.5",
33
+ "lodash": "^4.17.21",
33
34
  "mime-types": "^2.1.35",
34
35
  "moment": "^2.29.1",
35
36
  "v-click-outside": "^3.1.2",
@@ -39,6 +40,7 @@
39
40
  },
40
41
  "devDependencies": {
41
42
  "@babel/core": "^7.12.9",
43
+ "@babel/eslint-parser": "^7.22.11",
42
44
  "@storybook/addon-actions": "^6.5.16",
43
45
  "@storybook/addon-controls": "^6.5.16",
44
46
  "@storybook/addon-docs": "^6.5.16",
@@ -50,7 +52,6 @@
50
52
  "@vue/cli-service": "~4.5.0",
51
53
  "@vue/eslint-config-airbnb": "^5.0.2",
52
54
  "@vue/test-utils": "^1.0.3",
53
- "babel-eslint": "^10.1.0",
54
55
  "babel-loader": "^8.2.2",
55
56
  "copy-webpack-plugin": "^6.2.1",
56
57
  "eslint": "^6.7.2",
@@ -29,7 +29,11 @@
29
29
  />
30
30
  </div>
31
31
 
32
- <component v-else :is="'version' + version.replace(/\./g, 'dot')" v-bind="$props"></component>
32
+ <component
33
+ v-else :is="'version' + version.replace(/\./g, 'dot')"
34
+ v-bind="{ ...$props }"
35
+ @close="$emit('close')"
36
+ ></component>
33
37
  </template>
34
38
 
35
39
  <script>
@@ -75,6 +79,18 @@ export default {
75
79
  type: String,
76
80
  default: 'top-right',
77
81
  },
82
+ linkHref: {
83
+ type: String,
84
+ },
85
+ linkTarget: {
86
+ type: String,
87
+ },
88
+ linkText: {
89
+ type: String,
90
+ },
91
+ type: {
92
+ type: String,
93
+ },
78
94
  },
79
95
  };
80
96
  </script>
@@ -1,47 +1,41 @@
1
1
  <template>
2
- <div :class="['alert', `alert-position--${position}`]">
3
- <unnnic-icon-svg
4
- :icon="icon"
5
- :scheme="scheme"
6
- size="sm"
7
- />
8
-
9
- <div class="alert__content">
10
- <div class="alert__title">
11
- {{ title.toUpperCase() }}
12
- </div>
2
+ <div ref="alertContainer" class="alert-container">
3
+ <div :class="['alert', {
4
+ 'alert--scheme-aux-green': scheme === 'feedback-green' || type === 'success',
5
+ 'alert--scheme-aux-red': scheme === 'feedback-red' || type === 'error',
6
+ }]">
7
+ <div ref="progress" class="alert__progress"></div>
8
+
13
9
  <div v-show="text" class="alert__text">
14
10
  {{ text }}
15
11
  </div>
16
- </div>
17
12
 
18
- <div
19
- v-if="hideCloseText"
20
- class="alert__close-text unnnic--clickable"
21
- @click="onClose"
22
- >
23
- {{ closeText.toUpperCase() }}
13
+ <a v-if="linkHref" class="alert__link" :href="linkHref" :target="linkTarget">
14
+ {{ linkText }}
15
+ </a>
16
+
17
+ <div
18
+ class="alert__close"
19
+ @click="emitClose"
20
+ >
21
+ <unnnic-icon icon="close-1" size="sm" scheme="neutral-white" />
22
+ </div>
24
23
  </div>
25
24
  </div>
26
25
  </template>
27
26
 
28
27
  <script>
29
- import UnnnicIconSvg from '../Icon.vue';
28
+ import UnnnicIcon from '../Icon.vue';
30
29
 
31
30
  export default {
32
31
  components: {
33
- UnnnicIconSvg,
32
+ UnnnicIcon,
34
33
  },
35
34
  props: {
36
35
  version: {
37
36
  type: String,
38
37
  default: '1.0',
39
38
  },
40
-
41
- title: {
42
- type: String,
43
- default: null,
44
- },
45
39
  text: {
46
40
  type: String,
47
41
  default: null,
@@ -50,25 +44,45 @@ export default {
50
44
  type: String,
51
45
  default: null,
52
46
  },
53
- icon: {
54
- type: String,
55
- default: null,
56
- },
57
47
  onClose: {
58
48
  type: Function,
59
49
  default: () => {},
60
50
  },
61
- hideCloseText: {
62
- type: Boolean,
63
- default: true,
51
+ linkHref: {
52
+ type: String,
53
+ default: '',
54
+ },
55
+ linkTarget: {
56
+ type: String,
57
+ default: '_blank',
64
58
  },
65
- closeText: {
59
+ linkText: {
66
60
  type: String,
67
- default: 'CLOSE',
61
+ default: 'Learn more',
68
62
  },
69
- position: {
63
+ type: {
70
64
  type: String,
71
- default: 'top-right',
65
+ default: 'default',
66
+ },
67
+ },
68
+
69
+ mounted() {
70
+ this.$refs.progress.addEventListener('animationend', () => {
71
+ this.$refs.alertContainer.classList.add('slide-down');
72
+ });
73
+
74
+ this.$refs.alertContainer.addEventListener('animationend', (event) => {
75
+ if (event.animationName.startsWith('slideDown')) {
76
+ this.emitClose();
77
+ }
78
+ });
79
+ },
80
+
81
+ methods: {
82
+ emitClose() {
83
+ this.onClose();
84
+
85
+ this.$emit('close');
72
86
  },
73
87
  },
74
88
  };
@@ -77,69 +91,144 @@ export default {
77
91
  <style lang="scss" scoped>
78
92
  @import '../../assets/scss/unnnic.scss';
79
93
 
80
- .alert {
94
+ .alert-container {
81
95
  position: fixed;
82
- padding: $unnnic-inset-xs;
96
+ bottom: 0;
97
+ left: 0;
98
+ width: 100%;
99
+ text-align: center;
100
+ animation: slideUp 200ms ease;
101
+
102
+ @keyframes slideUp {
103
+ from {
104
+ bottom: -3.375 * $unnnic-font-size;
105
+ }
106
+
107
+ to {
108
+ bottom: 0;
109
+ }
110
+ }
111
+
112
+ &.slide-down {
113
+ animation-name: slideDown;
114
+ }
115
+
116
+ @keyframes slideDown {
117
+ from {
118
+ bottom: 0;
119
+ }
120
+
121
+ to {
122
+ bottom: -3.375 * $unnnic-font-size;
123
+ }
124
+ }
125
+ }
126
+
127
+ .alert {
128
+ position: relative;
129
+ border-radius: $unnnic-border-radius-sm;
83
130
 
84
131
  display: inline-flex;
85
132
  align-items: center;
133
+ margin-bottom: $unnnic-spacing-sm;
86
134
 
135
+ color: $unnnic-color-neutral-white;
87
136
  font-family: $unnnic-font-family-secondary;
88
- border-radius: $unnnic-border-radius-sm;
137
+ font-size: $unnnic-font-size-body-gt;
138
+ line-height: $unnnic-font-size-body-gt + $unnnic-line-height-md;
139
+ font-weight: $unnnic-font-weight-regular;
89
140
 
90
- background-color: $unnnic-color-background-snow;
91
- box-shadow: $unnnic-shadow-level-near;
92
- position: fixed;
141
+ background-color: $unnnic-color-neutral-dark;
93
142
 
94
143
  z-index: 9999;
95
144
 
96
- &-position {
97
- &--top-right {
98
- top: 1 * $unnnic-font-size;
99
- right: 1 * $unnnic-font-size;
100
- }
101
- &--top-left {
102
- top: 1 * $unnnic-font-size;
103
- left: 1 * $unnnic-font-size;
104
- }
105
- &--bottom-right {
106
- bottom: 1 * $unnnic-font-size;
107
- right: 1 * $unnnic-font-size;
145
+ overflow: hidden;
146
+
147
+ @keyframes progress {
148
+ from {
149
+ width: 0;
108
150
  }
109
- &--bottom-left {
110
- bottom: 1 * $unnnic-font-size;
111
- left: 1 * $unnnic-font-size;
151
+
152
+ to {
153
+ width: 100%;
112
154
  }
113
155
  }
114
156
 
115
- &__content {
116
- flex: 1;
117
- margin:0 $unnnic-inline-xs;
157
+ &__progress {
158
+ position: absolute;
159
+ height: 100%;
160
+ background-color: $unnnic-color-neutral-darkest;
161
+ border-radius: $unnnic-border-radius-sm;
162
+ left: 0;
163
+ top: 0;
164
+ pointer-events: none;
165
+ z-index: -1;
166
+ animation-name: progress;
167
+ animation-duration: 5000ms;
168
+ animation-timing-function: linear;
118
169
  }
119
170
 
120
- &__title {
121
- color: $unnnic-color-neutral-darkest;
122
- font-size: $unnnic-font-size-body-md;
123
- font-family: $unnnic-font-family-secondary;
124
- line-height: $unnnic-font-size-body-md + $unnnic-line-height-md;
125
- font-weight: $unnnic-font-weight-bold;
171
+ &:hover {
172
+ .alert__progress {
173
+ animation-play-state: paused;
174
+ }
126
175
  }
127
176
 
128
177
  &__text {
129
- color: $unnnic-color-neutral-dark;
130
- font-size: $unnnic-font-size-body-gt;
131
- line-height: $unnnic-font-size-body-gt + $unnnic-line-height-md;
132
- font-weight: $unnnic-font-weight-regular;
178
+ padding: $unnnic-spacing-xs $unnnic-spacing-sm;
179
+ }
180
+
181
+ &__link, &__close {
182
+ border-left: $unnnic-border-width-thinner solid $unnnic-color-neutral-cloudy;
183
+
184
+ &:hover {
185
+ background-color: $unnnic-color-neutral-cloudy;
186
+ }
187
+ }
188
+
189
+ &__link {
190
+ padding: $unnnic-spacing-xs $unnnic-spacing-sm;
191
+ text-decoration: none;
192
+ color: inherit;
193
+ display: block;
194
+ font-weight: $unnnic-font-weight-bold;
133
195
  }
134
196
 
135
197
  &__close {
136
- &-text {
137
- color: $unnnic-color-brand-sec;
138
- font-size: $unnnic-font-size-body-md;
139
- line-height: $unnnic-font-size-body-md + $unnnic-line-height-md;
140
- font-weight: $unnnic-font-weight-regular;
198
+ padding: $unnnic-spacing-xs $unnnic-spacing-sm;
199
+ cursor: pointer;
200
+ user-select: none;
201
+ }
202
+
203
+ &--scheme-aux-green {
204
+ background-color: $unnnic-color-aux-green-500;
205
+
206
+ .alert__progress {
207
+ background-color: $unnnic-color-aux-green-700;
208
+ }
209
+
210
+ .alert__link, .alert__close {
211
+ border-left: $unnnic-border-width-thinner solid $unnnic-color-aux-green-300;
212
+
213
+ &:hover {
214
+ background-color: $unnnic-color-aux-green-300;
215
+ }
216
+ }
217
+ }
218
+
219
+ &--scheme-aux-red {
220
+ background-color: $unnnic-color-aux-red-500;
221
+
222
+ .alert__progress {
223
+ background-color: $unnnic-color-aux-red-700;
224
+ }
225
+
226
+ .alert__link, .alert__close {
227
+ border-left: $unnnic-border-width-thinner solid $unnnic-color-aux-red-300;
141
228
 
142
- margin-left: $unnnic-inline-xs;
229
+ &:hover {
230
+ background-color: $unnnic-color-aux-red-300;
231
+ }
143
232
  }
144
233
  }
145
234
  }
@@ -0,0 +1,263 @@
1
+ <template>
2
+ <div
3
+ class="contact"
4
+ ref="transitionContainer"
5
+ :class="{
6
+ selected,
7
+ disabled,
8
+ 'unread-messages': unreadMessages,
9
+ waiting: waitingTime,
10
+ }"
11
+ @click="$emit('click')"
12
+ @keypress.enter="$emit('click')"
13
+ @mouseenter="isHovered = true"
14
+ @mouseleave="isHovered = false"
15
+ @mousedown="
16
+ (event) => {
17
+ this.$refs.transitionRipple.addRipple(event);
18
+ }
19
+ "
20
+ :tabindex="0"
21
+ >
22
+ <user-avatar
23
+ :username="username"
24
+ :photo-url="userPhoto"
25
+ :active="isHovered || selected"
26
+ />
27
+
28
+ <div class="contact__infos">
29
+ <h1
30
+ class="contact__infos__username ellipsis"
31
+ :title="username"
32
+ :class="{ bold: unreadMessages }"
33
+ >
34
+ {{ username }}
35
+ </h1>
36
+ <div class="contact__infos__additional-information" :class="{ bold: unreadMessages }">
37
+ <p v-if="waitingTime !== 0" class="ellipsis">
38
+ {{ i18n('waiting_for', waitingTime, { waitingTime }) }}
39
+ </p>
40
+ <p v-else-if="lastMessage" class="ellipsis" :title="lastMessage">
41
+ {{ lastMessage }}
42
+ </p>
43
+ </div>
44
+ </div>
45
+
46
+ <span
47
+ v-if="!selected && unreadMessages"
48
+ class="contact__infos__unread-messages"
49
+ :title="i18n('unread_messages', unreadMessages, { unreadMessages })"
50
+ >
51
+ {{ unreadMessages }}
52
+ </span>
53
+ <transition-ripple ref="transitionRipple" color="weni-500" />
54
+ </div>
55
+ </template>
56
+
57
+ <script>
58
+ import UserAvatar from '../ChatsUserAvatar/ChatsUserAvatar.vue';
59
+ import TransitionRipple from '../TransitionRipple/TransitionRipple.vue';
60
+ import UnnnicI18n from '../../mixins/i18n';
61
+
62
+ export default {
63
+ name: 'ChatsContact',
64
+
65
+ mixins: [UnnnicI18n],
66
+
67
+ components: {
68
+ UserAvatar,
69
+ TransitionRipple,
70
+ },
71
+
72
+ props: {
73
+ username: {
74
+ type: String,
75
+ default: '',
76
+ required: true,
77
+ },
78
+ lastMessage: {
79
+ type: String,
80
+ default: '',
81
+ },
82
+ userPhoto: {
83
+ type: String,
84
+ default: '',
85
+ },
86
+ waitingTime: {
87
+ type: Number,
88
+ default: 0,
89
+ },
90
+ unreadMessages: {
91
+ type: Number,
92
+ default: 0,
93
+ },
94
+ selected: {
95
+ type: Boolean,
96
+ default: false,
97
+ },
98
+ disabled: {
99
+ type: Boolean,
100
+ default: false,
101
+ },
102
+ },
103
+
104
+ data() {
105
+ return {
106
+ isHovered: false,
107
+
108
+ defaultTranslations: {
109
+ waiting_for: {
110
+ 'pt-br': 'Aguardando há 1 minuto | Aguardando há {waitingTime} minutos',
111
+ en: '1 minute waiting | {waitingTime} minutes waiting',
112
+ es: 'Esperando por un minuto | Esperando por {waitingTime} minutos',
113
+ },
114
+ unread_messages: {
115
+ 'pt-br': '{unreadMessages} mensagens não lidas',
116
+ en: '{unreadMessages} unread messages',
117
+ es: '{unreadMessages} mensajes no leídos',
118
+ },
119
+ },
120
+ };
121
+ },
122
+ };
123
+ </script>
124
+
125
+ <style lang="scss" scoped>
126
+ @import '../../assets/scss/unnnic.scss';
127
+
128
+ .contact {
129
+ display: grid;
130
+ grid-template-columns: max-content 1fr min-content;
131
+ align-items: center;
132
+ gap: $unnnic-spacing-xs;
133
+
134
+ background-color: $unnnic-color-background-white;
135
+ border-radius: $unnnic-border-radius-sm;
136
+ font-family: $unnnic-font-family-secondary;
137
+
138
+ padding: $unnnic-spacing-xs;
139
+
140
+ cursor: pointer;
141
+
142
+ &:focus-visible {
143
+ outline-color: $unnnic-color-weni-600;
144
+ outline-style: solid;
145
+ outline-width: 1px;
146
+ }
147
+
148
+ * {
149
+ margin: 0;
150
+ }
151
+
152
+ &.selected {
153
+ background-color: $unnnic-color-weni-50;
154
+ }
155
+
156
+ &.waiting {
157
+ background-color: $unnnic-color-neutral-lightest;
158
+
159
+ &:hover {
160
+ background-color: $unnnic-color-neutral-light;
161
+ }
162
+
163
+ .contact__infos__unread-messages {
164
+ background: $unnnic-color-background-white;
165
+ }
166
+ }
167
+
168
+ &.unread-messages {
169
+ .username {
170
+ color: $unnnic-color-neutral-darkest;
171
+ font-weight: $unnnic-font-weight-bold;
172
+ }
173
+
174
+ .additional-information {
175
+ color: $unnnic-color-neutral-cloudy;
176
+ font-weight: $unnnic-font-weight-bold;
177
+ }
178
+ }
179
+
180
+ &.disabled {
181
+ .content {
182
+ .username {
183
+ color: $unnnic-color-neutral-cleanest;
184
+ }
185
+
186
+ .additional-information {
187
+ color: $unnnic-color-neutral-lightest;
188
+ }
189
+ }
190
+
191
+ .unread-messages {
192
+ color: $unnnic-color-neutral-cleanest;
193
+ }
194
+ }
195
+
196
+ &:hover,
197
+ &.selected:hover {
198
+ background-color: $unnnic-color-neutral-lightest;
199
+
200
+ .contact__infos {
201
+ &__unread-messages {
202
+ background: $unnnic-color-background-white;
203
+ }
204
+ }
205
+ }
206
+
207
+ &__infos {
208
+ margin-right: auto;
209
+
210
+ display: flex;
211
+ flex-flow: column wrap;
212
+
213
+ width: 100%;
214
+ overflow: hidden;
215
+
216
+ &__username,
217
+ &__additional-information {
218
+ font-size: $unnnic-font-size-body-gt;
219
+ line-height: $unnnic-font-size-body-md + $unnnic-line-height-medium;
220
+ }
221
+
222
+ &__username {
223
+ color: $unnnic-color-neutral-darkest;
224
+ }
225
+
226
+ &__additional-information {
227
+ width: 100%; // important to ellipsis work
228
+
229
+ color: $unnnic-color-neutral-cloudy;
230
+ }
231
+
232
+ &__unread-messages {
233
+ display: flex;
234
+ justify-content: center;
235
+ align-items: center;
236
+
237
+ border-radius: 50%;
238
+ background: $unnnic-color-background-grass;
239
+
240
+ width: 1.25rem;
241
+ min-width: 1.25rem;
242
+ height: 1.25rem;
243
+
244
+ font-size: $unnnic-font-size-body-md;
245
+ font-weight: $unnnic-font-weight-bold;
246
+ line-height: $unnnic-line-height-small;
247
+ color: $unnnic-color-weni-800;
248
+ }
249
+
250
+ .ellipsis {
251
+ width: 100%;
252
+
253
+ overflow: hidden;
254
+ text-overflow: ellipsis;
255
+ white-space: nowrap;
256
+ }
257
+
258
+ .bold {
259
+ font-weight: $unnnic-font-weight-bold;
260
+ }
261
+ }
262
+ }
263
+ </style>
@@ -1,10 +1,10 @@
1
1
  <template>
2
- <nav class="unnnic-navbar-chats">
3
- <ol class="unnnic-navbar-chats__list">
2
+ <nav class="unnnic-chats-navbar">
3
+ <ol class="unnnic-chats-navbar__list">
4
4
  <li v-for="(link, index) in links" :key="link.icon + index">
5
5
  <a
6
6
  :class="[
7
- 'unnnic-navbar-chats__link',
7
+ 'unnnic-chats-navbar__link',
8
8
  'unnnic--clickable',
9
9
  { selected: isSelected(link) },
10
10
  ]"
@@ -30,7 +30,7 @@
30
30
  import UnnnicIcon from '../Icon.vue';
31
31
 
32
32
  export default {
33
- name: 'unnnic-navbar-chats',
33
+ name: 'unnnic-chats-navbar',
34
34
 
35
35
  components: {
36
36
  UnnnicIcon,
@@ -102,7 +102,7 @@ export default {
102
102
  <style lang="scss">
103
103
  @import '../../assets/scss/unnnic.scss';
104
104
 
105
- .unnnic-navbar-chats {
105
+ .unnnic-chats-navbar {
106
106
  width: 100vw;
107
107
  max-width: 100%;
108
108