@weni/unnnic-system 1.16.40 → 1.16.41-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 +1 -1
- package/src/components/ButtonClose/ButtonClose.vue +44 -0
- package/src/components/ChatsDashboardTagLive/ChatsDashboardTagLive.vue +82 -0
- package/src/components/ChatsHeader/ChatsHeader.vue +225 -0
- package/src/components/ChatsUserAvatar/ChatsUserAvatar.vue +2 -0
- package/src/stories/ButtonClose.stories.js +34 -0
- package/src/stories/ChatsDashboardTagLive.stories.js +25 -0
- package/src/stories/ChatsHeader.stories.js +84 -0
package/package.json
CHANGED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div @click="close" @keypress.enter="close" class="unnnic-button-close">
|
|
3
|
+
<unnnic-icon icon="close-1" :size="size" />
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
import UnnnicIcon from '../Icon.vue';
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
name: 'ButtonClose',
|
|
12
|
+
|
|
13
|
+
components: {
|
|
14
|
+
UnnnicIcon,
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
props: {
|
|
18
|
+
size: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: 'md',
|
|
21
|
+
validator(value) {
|
|
22
|
+
return [
|
|
23
|
+
'nano', 'xs', 'sm', 'ant', 'md', 'lg', 'xl',
|
|
24
|
+
'avatar-lg', 'avatar-md', 'avatar-sm', 'avatar-xs', 'avatar-nano',
|
|
25
|
+
].indexOf(value) !== -1;
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
close: {
|
|
29
|
+
type: Function,
|
|
30
|
+
default: () => {},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<style lang="scss">
|
|
37
|
+
@import "../../assets/scss/unnnic.scss";
|
|
38
|
+
|
|
39
|
+
.unnnic-button-close {
|
|
40
|
+
display: inline-block;
|
|
41
|
+
|
|
42
|
+
cursor: pointer;
|
|
43
|
+
}
|
|
44
|
+
</style>
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="unnnic-chats-dashboard-tag-live">
|
|
3
|
+
<unnnic-icon
|
|
4
|
+
class="unnnic-chats-dashboard-tag-live__indicator"
|
|
5
|
+
icon="indicator"
|
|
6
|
+
scheme="aux-green-300"
|
|
7
|
+
/>
|
|
8
|
+
<p class="unnnic-chats-dashboard-tag-live__text">{{ i18n('live') }}</p>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script>
|
|
13
|
+
import UnnnicI18n from '../../mixins/i18n';
|
|
14
|
+
|
|
15
|
+
import UnnnicIcon from '../Icon.vue';
|
|
16
|
+
|
|
17
|
+
export default {
|
|
18
|
+
name: 'UnnnicChatsDashboardTagLive',
|
|
19
|
+
|
|
20
|
+
mixins: [UnnnicI18n],
|
|
21
|
+
|
|
22
|
+
components: {
|
|
23
|
+
UnnnicIcon,
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
data() {
|
|
27
|
+
return {
|
|
28
|
+
defaultTranslations: {
|
|
29
|
+
live: {
|
|
30
|
+
'pt-br': 'Ao vivo',
|
|
31
|
+
en: 'Live',
|
|
32
|
+
es: 'En vivo',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<style lang="scss">
|
|
41
|
+
@import '../../assets/scss/unnnic.scss';
|
|
42
|
+
|
|
43
|
+
.unnnic-chats-dashboard-tag-live {
|
|
44
|
+
padding: $unnnic-spacing-ant;
|
|
45
|
+
|
|
46
|
+
display: inline-flex;
|
|
47
|
+
align-items: center;
|
|
48
|
+
gap: $unnnic-spacing-ant;
|
|
49
|
+
|
|
50
|
+
border-radius: $unnnic-border-radius-sm;
|
|
51
|
+
background-color: $unnnic-color-neutral-lightest;
|
|
52
|
+
|
|
53
|
+
color: $unnnic-color-neutral-dark;
|
|
54
|
+
font-family: $unnnic-font-family-secondary;
|
|
55
|
+
|
|
56
|
+
&__indicator {
|
|
57
|
+
.primary {
|
|
58
|
+
animation: ease-in-out pulse 2s infinite;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@keyframes pulse {
|
|
62
|
+
0% {
|
|
63
|
+
fill: $unnnic-color-neutral-soft;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
50% {
|
|
67
|
+
fill: $unnnic-color-aux-green-300;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
100% {
|
|
71
|
+
fill: $unnnic-color-neutral-soft;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
&__text {
|
|
77
|
+
margin: 0;
|
|
78
|
+
|
|
79
|
+
font-size: $unnnic-font-size-body-gt;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
</style>
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<header class="unnnic-chats-header" :class="{ large: size === 'large' && !avatarName }">
|
|
3
|
+
<div class="unnnic-chats-header__topbar" v-if="size === 'large' && !avatarName">
|
|
4
|
+
<unnnic-breadcrumb :crumbs="crumbs" />
|
|
5
|
+
<unnnic-button-close @close="close" size="ant" />
|
|
6
|
+
</div>
|
|
7
|
+
<main class="unnnic-chats-header__main">
|
|
8
|
+
<div v-if="back && size === 'small'" @click="back" @keypress.esc="back">
|
|
9
|
+
<unnnic-icon
|
|
10
|
+
class="unnnic-chats-header__main__back"
|
|
11
|
+
icon="keyboard-arrow-left-1"
|
|
12
|
+
size="md"
|
|
13
|
+
/>
|
|
14
|
+
</div>
|
|
15
|
+
<section class="unnnic-chats-header__infos">
|
|
16
|
+
<unnnic-chats-user-avatar v-if="avatarName" :username="avatarName" />
|
|
17
|
+
<unnnic-avatar-icon
|
|
18
|
+
v-else
|
|
19
|
+
scheme="aux-purple"
|
|
20
|
+
:icon="avatarIcon"
|
|
21
|
+
:size="size === 'small' ? 'sm' : 'lg'"
|
|
22
|
+
/>
|
|
23
|
+
|
|
24
|
+
<hgroup class="unnnic-chats-header__infos__title" :class="{ contact: !!avatarName }">
|
|
25
|
+
<h1>
|
|
26
|
+
{{ title }}
|
|
27
|
+
</h1>
|
|
28
|
+
<h2 v-if="subtitle">
|
|
29
|
+
{{ subtitle }}
|
|
30
|
+
</h2>
|
|
31
|
+
</hgroup>
|
|
32
|
+
</section>
|
|
33
|
+
<slot v-if="size === 'large'"/>
|
|
34
|
+
</main>
|
|
35
|
+
<unnnic-button-close v-if="avatarName || size === 'small'" @close="close" size="sm" />
|
|
36
|
+
</header>
|
|
37
|
+
</template>
|
|
38
|
+
<script>
|
|
39
|
+
import UnnnicI18n from '../../mixins/i18n';
|
|
40
|
+
|
|
41
|
+
import UnnnicButtonClose from '../ButtonClose/ButtonClose.vue';
|
|
42
|
+
import UnnnicAvatarIcon from '../AvatarIcon/AvatarIcon.vue';
|
|
43
|
+
import UnnnicChatsUserAvatar from '../ChatsUserAvatar/ChatsUserAvatar.vue';
|
|
44
|
+
import UnnnicBreadcrumb from '../Breadcrumb/Breadcrumb.vue';
|
|
45
|
+
import UnnnicIcon from '../Icon.vue';
|
|
46
|
+
|
|
47
|
+
export default {
|
|
48
|
+
name: 'UnnnicChatsHeader',
|
|
49
|
+
|
|
50
|
+
mixins: [UnnnicI18n],
|
|
51
|
+
|
|
52
|
+
components: {
|
|
53
|
+
UnnnicButtonClose,
|
|
54
|
+
UnnnicAvatarIcon,
|
|
55
|
+
UnnnicChatsUserAvatar,
|
|
56
|
+
UnnnicBreadcrumb,
|
|
57
|
+
UnnnicIcon,
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
props: {
|
|
61
|
+
title: {
|
|
62
|
+
type: String,
|
|
63
|
+
required: true,
|
|
64
|
+
default: '',
|
|
65
|
+
},
|
|
66
|
+
subtitle: {
|
|
67
|
+
type: String,
|
|
68
|
+
default: '',
|
|
69
|
+
},
|
|
70
|
+
avatarIcon: {
|
|
71
|
+
type: String,
|
|
72
|
+
default: '',
|
|
73
|
+
},
|
|
74
|
+
avatarName: {
|
|
75
|
+
type: String,
|
|
76
|
+
default: '',
|
|
77
|
+
},
|
|
78
|
+
back: {
|
|
79
|
+
type: Function,
|
|
80
|
+
default: null,
|
|
81
|
+
},
|
|
82
|
+
close: {
|
|
83
|
+
type: Function,
|
|
84
|
+
default: () => {},
|
|
85
|
+
},
|
|
86
|
+
crumbs: {
|
|
87
|
+
type: Array,
|
|
88
|
+
default: () => [],
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
data: () => ({
|
|
93
|
+
size: 'small',
|
|
94
|
+
}),
|
|
95
|
+
|
|
96
|
+
beforeMount() {
|
|
97
|
+
this.updateSize();
|
|
98
|
+
window.addEventListener('resize', this.updateSize);
|
|
99
|
+
},
|
|
100
|
+
beforeDestroy() {
|
|
101
|
+
window.removeEventListener('resize', this.updateSize);
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
methods: {
|
|
105
|
+
updateSize() {
|
|
106
|
+
const PHONE_SIZE = 600;
|
|
107
|
+
if (window.innerWidth < PHONE_SIZE) {
|
|
108
|
+
this.size = 'small';
|
|
109
|
+
} else {
|
|
110
|
+
this.size = 'large';
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
|
|
115
|
+
watch: {
|
|
116
|
+
size(newSize) {
|
|
117
|
+
this.$emit('resize', newSize);
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
</script>
|
|
122
|
+
<style lang="scss">
|
|
123
|
+
@import '../../assets/scss/unnnic.scss';
|
|
124
|
+
.unnnic-chats-header {
|
|
125
|
+
padding: $unnnic-spacing-sm;
|
|
126
|
+
|
|
127
|
+
display: flex;
|
|
128
|
+
justify-content: space-between;
|
|
129
|
+
align-items: center;
|
|
130
|
+
|
|
131
|
+
box-shadow: $unnnic-shadow-level-far;
|
|
132
|
+
background-color: $unnnic-color-background-white;
|
|
133
|
+
|
|
134
|
+
font-family: $unnnic-font-family-secondary;
|
|
135
|
+
|
|
136
|
+
&.large {
|
|
137
|
+
padding: $unnnic-spacing-md;
|
|
138
|
+
|
|
139
|
+
display: flex;
|
|
140
|
+
flex-direction: column;
|
|
141
|
+
align-items: stretch;
|
|
142
|
+
gap: $unnnic-spacing-md;
|
|
143
|
+
|
|
144
|
+
box-shadow: none;
|
|
145
|
+
box-shadow: inset 0 -1px 0 $unnnic-color-neutral-soft;
|
|
146
|
+
|
|
147
|
+
.unnnic-chats-header__infos__title {
|
|
148
|
+
h1 {
|
|
149
|
+
font-size: $unnnic-font-size-title-md;
|
|
150
|
+
line-height: $unnnic-font-size-body-lg + $unnnic-line-height-medium;
|
|
151
|
+
font-weight: $unnnic-font-weight-regular;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
h2 {
|
|
155
|
+
font-size: $unnnic-font-size-body-gt;
|
|
156
|
+
line-height: $unnnic-font-size-body-lg + $unnnic-line-height-small;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
&__topbar {
|
|
162
|
+
display: flex;
|
|
163
|
+
align-items: center;
|
|
164
|
+
justify-content: space-between;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
&__main {
|
|
168
|
+
display: grid;
|
|
169
|
+
align-items: center;
|
|
170
|
+
grid-template-columns: 1fr auto;
|
|
171
|
+
gap: $unnnic-spacing-xs;
|
|
172
|
+
|
|
173
|
+
&__back {
|
|
174
|
+
margin-right: $unnnic-spacing-md;
|
|
175
|
+
|
|
176
|
+
cursor: pointer;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
&__infos {
|
|
181
|
+
display: flex;
|
|
182
|
+
gap: $unnnic-spacing-ant;
|
|
183
|
+
|
|
184
|
+
color: $unnnic-color-neutral-dark;
|
|
185
|
+
|
|
186
|
+
user-select: none;
|
|
187
|
+
|
|
188
|
+
* {
|
|
189
|
+
margin: 0;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.unnnic-avatar-icon {
|
|
193
|
+
height: fit-content;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
&__title {
|
|
197
|
+
display: grid;
|
|
198
|
+
align-items: center;
|
|
199
|
+
|
|
200
|
+
&.contact h1 {
|
|
201
|
+
font-weight: $unnnic-font-weight-regular;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
h1,
|
|
205
|
+
h2 {
|
|
206
|
+
white-space: nowrap;
|
|
207
|
+
overflow: hidden;
|
|
208
|
+
text-overflow: ellipsis;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
h1 {
|
|
212
|
+
font-size: $unnnic-font-size-body-lg;
|
|
213
|
+
line-height: $unnnic-font-size-body-lg + $unnnic-line-height-medium;
|
|
214
|
+
font-weight: $unnnic-font-weight-bold;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
h2 {
|
|
218
|
+
font-size: $unnnic-font-size-body-md;
|
|
219
|
+
line-height: $unnnic-font-size-body-lg;
|
|
220
|
+
font-weight: $unnnic-font-weight-regular;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
</style>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import UnnnicButtonClose from '../components/ButtonClose/ButtonClose.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Form/ButtonClose',
|
|
5
|
+
component: UnnnicButtonClose,
|
|
6
|
+
argTypes: {
|
|
7
|
+
size: {
|
|
8
|
+
control: {
|
|
9
|
+
type: 'select',
|
|
10
|
+
options: [
|
|
11
|
+
'nano',
|
|
12
|
+
'xs',
|
|
13
|
+
'sm',
|
|
14
|
+
'md',
|
|
15
|
+
'lg',
|
|
16
|
+
'avatar-lg',
|
|
17
|
+
'avatar-md',
|
|
18
|
+
'avatar-sm',
|
|
19
|
+
'avatar-xs',
|
|
20
|
+
'avatar-nano',
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const Template = (args, { argTypes }) => ({
|
|
28
|
+
props: Object.keys(argTypes),
|
|
29
|
+
components: { UnnnicButtonClose },
|
|
30
|
+
template: '<unnnic-button-close v-bind="$props"/>',
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export const Default = Template.bind({});
|
|
34
|
+
Default.args = {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/* eslint-disable no-alert */
|
|
2
|
+
import unnnicChatsDashboardTagLive from '../components/ChatsDashboardTagLive/ChatsDashboardTagLive.vue';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Chats/DashboardTagLive',
|
|
6
|
+
component: unnnicChatsDashboardTagLive,
|
|
7
|
+
argTypes: {
|
|
8
|
+
locale: {
|
|
9
|
+
control: {
|
|
10
|
+
type: 'select',
|
|
11
|
+
options: ['pt-br', 'en', 'es'],
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const Template = (args, { argTypes }) => ({
|
|
18
|
+
props: Object.keys(argTypes),
|
|
19
|
+
components: { unnnicChatsDashboardTagLive },
|
|
20
|
+
template: '<unnnic-chats-dashboard-tag-live v-bind="$props"/>',
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export const Default = Template.bind({});
|
|
24
|
+
Default.args = {
|
|
25
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/* eslint-disable no-alert */
|
|
2
|
+
import unnnicChatsHeader from '../components/ChatsHeader/ChatsHeader.vue';
|
|
3
|
+
import unnnicChatsDashboardTagLive from '../components/ChatsDashboardTagLive/ChatsDashboardTagLive.vue';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Chats/Header',
|
|
7
|
+
component: unnnicChatsHeader,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const Template = (args, { argTypes }) => ({
|
|
11
|
+
props: Object.keys(argTypes),
|
|
12
|
+
components: { unnnicChatsHeader },
|
|
13
|
+
template: '<unnnic-chats-header v-bind="$props"/>',
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const DashboardTemplate = (args, { argTypes }) => ({
|
|
17
|
+
props: Object.keys(argTypes),
|
|
18
|
+
components: { unnnicChatsHeader, unnnicChatsDashboardTagLive },
|
|
19
|
+
template:
|
|
20
|
+
`<unnnic-chats-header v-bind="$props">
|
|
21
|
+
<unnnic-chats-dashboard-tag-live />
|
|
22
|
+
</unnnic-chats-header>`,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const back = () => alert('back');
|
|
26
|
+
const close = () => alert('close');
|
|
27
|
+
|
|
28
|
+
const size = window.innerWidth < 600 ? 'small' : 'large';
|
|
29
|
+
|
|
30
|
+
const defaultArgs = {
|
|
31
|
+
back,
|
|
32
|
+
close,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const Contact = Template.bind({});
|
|
36
|
+
Contact.args = {
|
|
37
|
+
...defaultArgs,
|
|
38
|
+
title: 'John Doe',
|
|
39
|
+
avatarName: 'John Doe',
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const ContactInfos = Template.bind({});
|
|
43
|
+
ContactInfos.args = {
|
|
44
|
+
...defaultArgs,
|
|
45
|
+
title: 'Contact information',
|
|
46
|
+
subtitle: 'John Doe',
|
|
47
|
+
avatarName: 'John Doe',
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const Dashboard = DashboardTemplate.bind({});
|
|
51
|
+
Dashboard.args = {
|
|
52
|
+
...defaultArgs,
|
|
53
|
+
title: size === 'large' ? 'Lorem Ipsum Inc.' : 'Dashboard',
|
|
54
|
+
subtitle: size === 'large' ? 'Dashboard of project' : 'Lorem Ipsum Inc.',
|
|
55
|
+
avatarIcon: 'graph-stats-1',
|
|
56
|
+
crumbs: [
|
|
57
|
+
{
|
|
58
|
+
name: 'Chats',
|
|
59
|
+
path: 'chats',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: 'Dashboard',
|
|
63
|
+
path: 'dashboard',
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export const History = Template.bind({});
|
|
69
|
+
History.args = {
|
|
70
|
+
...defaultArgs,
|
|
71
|
+
title: size === 'large' ? 'Lorem Ipsum Inc.' : 'History',
|
|
72
|
+
subtitle: size === 'large' ? 'History of project' : 'Lorem Ipsum Inc.',
|
|
73
|
+
avatarIcon: 'task-list-clock-1',
|
|
74
|
+
crumbs: [
|
|
75
|
+
{
|
|
76
|
+
name: 'Chats',
|
|
77
|
+
path: 'chats',
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: 'History',
|
|
81
|
+
path: 'history',
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
};
|