@webitel/ui-sdk 23.12.17 → 23.12.19
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/ui-sdk.common.js +101 -102
- package/dist/ui-sdk.common.js.map +1 -1
- package/dist/ui-sdk.css +1 -1
- package/dist/ui-sdk.umd.js +101 -102
- package/dist/ui-sdk.umd.js.map +1 -1
- package/dist/ui-sdk.umd.min.js +2 -2
- package/dist/ui-sdk.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/wt-button-select/__tests__/WtButtonSelect.spec.js +5 -4
- package/src/components/wt-button-select/wt-button-select.vue +55 -56
- package/src/components/wt-headline-nav/Readme.md +9 -0
- package/src/components/wt-headline-nav/_variables.scss +5 -2
- package/src/components/wt-headline-nav/wt-headline-nav.vue +36 -30
package/package.json
CHANGED
|
@@ -24,15 +24,16 @@ describe('WtSelectButton', () => {
|
|
|
24
24
|
expect(wrapper.find('.wt-button-select__button').text()).toBe(content);
|
|
25
25
|
});
|
|
26
26
|
|
|
27
|
-
it('should rotate the arrow', () => {
|
|
27
|
+
it('should rotate the arrow', async () => {
|
|
28
28
|
const wrapper = mount(WtSelectButton, {
|
|
29
|
-
data: () => ({
|
|
30
|
-
isOpened: true,
|
|
31
|
-
}),
|
|
32
29
|
props: {
|
|
33
30
|
options: [],
|
|
34
31
|
},
|
|
35
32
|
});
|
|
33
|
+
const arrowBtn = wrapper.findAllComponents({ name: 'wt-button' })
|
|
34
|
+
.find((component) => component.classes().includes('wt-button-select__select-btn'));
|
|
35
|
+
arrowBtn.vm.$emit('click');
|
|
36
|
+
await wrapper.vm.$nextTick();
|
|
36
37
|
const wtIcon = wrapper.find('.wt-button-select__select-arrow');
|
|
37
38
|
expect(wtIcon.classes()).toContain('wt-button-select__select-arrow--active');
|
|
38
39
|
});
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
|
+
v-clickaway="atClickaway"
|
|
3
4
|
class="wt-button-select"
|
|
4
|
-
v-clickaway="away"
|
|
5
5
|
>
|
|
6
|
-
|
|
7
6
|
<wt-button
|
|
8
7
|
v-bind="$attrs"
|
|
9
|
-
class="wt-button-select__button"
|
|
10
8
|
:color="color"
|
|
11
9
|
:disabled="disabled"
|
|
10
|
+
class="wt-button-select__button"
|
|
12
11
|
@click="$emit('click', $event)"
|
|
13
12
|
>
|
|
14
13
|
<slot></slot>
|
|
@@ -22,18 +21,18 @@
|
|
|
22
21
|
<template v-slot:activator>
|
|
23
22
|
<wt-button
|
|
24
23
|
v-bind="$attrs"
|
|
25
|
-
class="wt-button-select__select-btn"
|
|
26
24
|
:color="color"
|
|
27
25
|
:disabled="disabled"
|
|
28
26
|
:loading="false"
|
|
27
|
+
class="wt-button-select__select-btn"
|
|
29
28
|
@click="isOpened = !isOpened"
|
|
30
29
|
>
|
|
31
30
|
<wt-icon
|
|
32
|
-
class="wt-button-select__select-arrow"
|
|
33
31
|
:class="{'wt-button-select__select-arrow--active': isOpened}"
|
|
34
|
-
icon="arrow-down"
|
|
35
32
|
:color="color === 'primary' ? 'on-primary' : 'default'"
|
|
36
33
|
:disabled="disabled"
|
|
34
|
+
class="wt-button-select__select-arrow"
|
|
35
|
+
icon="arrow-down"
|
|
37
36
|
></wt-icon>
|
|
38
37
|
</wt-button>
|
|
39
38
|
</template>
|
|
@@ -41,58 +40,58 @@
|
|
|
41
40
|
</div>
|
|
42
41
|
</template>
|
|
43
42
|
|
|
44
|
-
<script>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
color: {
|
|
63
|
-
type: String,
|
|
64
|
-
default: 'primary',
|
|
65
|
-
},
|
|
66
|
-
disabled: {
|
|
67
|
-
type: Boolean,
|
|
68
|
-
default: false,
|
|
69
|
-
},
|
|
43
|
+
<script setup>
|
|
44
|
+
import { ref } from 'vue';
|
|
45
|
+
|
|
46
|
+
const props = defineProps({
|
|
47
|
+
/**
|
|
48
|
+
* See context-menu component docs
|
|
49
|
+
*/
|
|
50
|
+
options: {
|
|
51
|
+
type: Array,
|
|
52
|
+
required: true,
|
|
53
|
+
},
|
|
54
|
+
/**
|
|
55
|
+
* @values 'primary', 'secondary'
|
|
56
|
+
* @example <wt-button color="secondary"></wt-button>
|
|
57
|
+
*/
|
|
58
|
+
color: {
|
|
59
|
+
type: String,
|
|
60
|
+
default: 'primary',
|
|
70
61
|
},
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
*/
|
|
75
|
-
'click',
|
|
76
|
-
/**
|
|
77
|
-
* Click on option in context-menu
|
|
78
|
-
*
|
|
79
|
-
* @event click:option
|
|
80
|
-
*
|
|
81
|
-
* @property {object} option clicked option object
|
|
82
|
-
* @property {index} index clicked option index in options list
|
|
83
|
-
*/
|
|
84
|
-
'click:option',
|
|
85
|
-
],
|
|
86
|
-
methods: {
|
|
87
|
-
selectOption({ option, index }) {
|
|
88
|
-
this.$emit('click:option', option, index);
|
|
89
|
-
this.isOpened = false;
|
|
90
|
-
},
|
|
91
|
-
away() {
|
|
92
|
-
this.isOpened = false;
|
|
93
|
-
},
|
|
62
|
+
disabled: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: false,
|
|
94
65
|
},
|
|
95
|
-
};
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
const emit = defineEmits([
|
|
69
|
+
/**
|
|
70
|
+
* @event click
|
|
71
|
+
*/
|
|
72
|
+
'click',
|
|
73
|
+
/**
|
|
74
|
+
* Click on option in context-menu
|
|
75
|
+
*
|
|
76
|
+
* @event click:option
|
|
77
|
+
*
|
|
78
|
+
* @property {object} option clicked option object
|
|
79
|
+
* @property {index} index clicked option index in options list
|
|
80
|
+
*/
|
|
81
|
+
'click:option',
|
|
82
|
+
]);
|
|
83
|
+
|
|
84
|
+
const isOpened = ref(false);
|
|
85
|
+
|
|
86
|
+
function selectOption({ option, index }) {
|
|
87
|
+
emit('click:option', option, index);
|
|
88
|
+
isOpened.value = false;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function atClickaway() {
|
|
92
|
+
isOpened.value = false;
|
|
93
|
+
}
|
|
94
|
+
|
|
96
95
|
</script>
|
|
97
96
|
|
|
98
97
|
<style lang="scss">
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
:root {
|
|
3
|
-
--headline-nav-indicator-size:
|
|
4
|
-
--headline-nav-
|
|
3
|
+
--headline-nav-indicator-size: 4px;
|
|
4
|
+
--headline-nav-gap: var(--spacing-sm);
|
|
5
|
+
--headline-nav-dot-gap: var(--spacing-2xs);
|
|
6
|
+
--headline-nav-indicator-color: var(--primary-color);
|
|
7
|
+
--headline-nav-accent-indicator-color: var(--primary-color);
|
|
5
8
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<nav class="wt-headline-nav">
|
|
3
3
|
<div
|
|
4
|
-
class="wt-headline-nav__wrapper"
|
|
5
4
|
v-for="(singlePath, key) of path"
|
|
6
5
|
:key="key"
|
|
6
|
+
class="wt-headline-nav__wrapper"
|
|
7
7
|
>
|
|
8
8
|
<span v-if="key !== 0" class="wt-headline-nav__indicator"></span>
|
|
9
9
|
<h1 class="wt-headline-nav__title">
|
|
10
10
|
<router-link
|
|
11
11
|
v-if="singlePath.route"
|
|
12
|
-
class="wt-headline-nav__text wt-headline-nav__title-link"
|
|
13
12
|
:to="singlePath.route"
|
|
13
|
+
class="wt-headline-nav__text wt-headline-nav__text--link"
|
|
14
14
|
>{{ singlePath.name }}
|
|
15
15
|
</router-link>
|
|
16
16
|
<span v-else class="wt-headline-nav__text">{{ singlePath.name }}</span>
|
|
@@ -19,22 +19,21 @@
|
|
|
19
19
|
</nav>
|
|
20
20
|
</template>
|
|
21
21
|
|
|
22
|
-
<script>
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
},
|
|
22
|
+
<script setup>
|
|
23
|
+
const props = defineProps({
|
|
24
|
+
/**
|
|
25
|
+
* PATH EXAMPLE
|
|
26
|
+
* default: () => [
|
|
27
|
+
* { name: 'directory' },
|
|
28
|
+
* { name: 'users', route: '/directory/users' },
|
|
29
|
+
* { name: 'adm', route: '/directory/users/3' },
|
|
30
|
+
* ],
|
|
31
|
+
*/
|
|
32
|
+
path: {
|
|
33
|
+
type: Array,
|
|
34
|
+
required: true,
|
|
36
35
|
},
|
|
37
|
-
};
|
|
36
|
+
});
|
|
38
37
|
</script>
|
|
39
38
|
|
|
40
39
|
<style lang="scss">
|
|
@@ -42,26 +41,35 @@ export default {
|
|
|
42
41
|
</style>
|
|
43
42
|
|
|
44
43
|
<style lang="scss" scoped>
|
|
45
|
-
|
|
46
44
|
.wt-headline-nav {
|
|
47
45
|
display: flex;
|
|
48
46
|
align-items: center;
|
|
49
47
|
max-width: 100%;
|
|
48
|
+
gap: var(--headline-nav-gap);
|
|
50
49
|
}
|
|
51
50
|
|
|
52
51
|
.wt-headline-nav__wrapper {
|
|
53
52
|
display: flex;
|
|
54
53
|
align-items: center;
|
|
54
|
+
gap: var(--headline-nav-dot-gap);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
.wt-headline-nav__indicator {
|
|
58
|
-
display:
|
|
59
|
-
|
|
60
|
-
height: var(--headline-nav-indicator-size);
|
|
61
|
-
margin: 0 var(--headline-nav-indicator-margin);
|
|
62
|
-
background: var(--icon-color);
|
|
63
|
-
border-radius: 50%;
|
|
58
|
+
display: flex;
|
|
59
|
+
align-items: center;
|
|
64
60
|
flex-shrink: 0;
|
|
61
|
+
justify-content: center;
|
|
62
|
+
width: var(--icon-md-size);
|
|
63
|
+
height: var(--icon-md-size);
|
|
64
|
+
|
|
65
|
+
&:before {
|
|
66
|
+
display: block;
|
|
67
|
+
width: var(--headline-nav-indicator-size);
|
|
68
|
+
height: var(--headline-nav-indicator-size);
|
|
69
|
+
content: '';
|
|
70
|
+
border-radius: 50%;
|
|
71
|
+
background: var(--icon-color);
|
|
72
|
+
}
|
|
65
73
|
}
|
|
66
74
|
|
|
67
75
|
.wt-headline-nav__title {
|
|
@@ -69,23 +77,21 @@ export default {
|
|
|
69
77
|
}
|
|
70
78
|
|
|
71
79
|
.wt-headline-nav__text {
|
|
72
|
-
color: var(--text-
|
|
80
|
+
color: var(--main-text-color);
|
|
73
81
|
}
|
|
74
82
|
|
|
75
83
|
.wt-headline-nav__wrapper:last-child {
|
|
76
84
|
min-width: 0;
|
|
77
85
|
|
|
78
86
|
.wt-headline-nav__indicator {
|
|
79
|
-
|
|
87
|
+
&:before {
|
|
88
|
+
background: var(--icon-primary-color);
|
|
89
|
+
}
|
|
80
90
|
}
|
|
81
91
|
|
|
82
92
|
.wt-headline-nav__title {
|
|
83
93
|
overflow: hidden;
|
|
84
94
|
text-overflow: ellipsis;
|
|
85
95
|
}
|
|
86
|
-
|
|
87
|
-
.wt-headline-nav__text {
|
|
88
|
-
color: var(--text-primary-color);
|
|
89
|
-
}
|
|
90
96
|
}
|
|
91
97
|
</style>
|