@webitel/ui-sdk 23.12.16 → 23.12.18
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 +74 -72
- package/dist/ui-sdk.common.js.map +1 -1
- package/dist/ui-sdk.css +1 -1
- package/dist/ui-sdk.umd.js +71 -69
- 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/wt-button-select.vue +61 -57
- package/src/components/wt-icon/Readme.md +1 -1
- package/src/components/wt-icon/_variables.scss +2 -0
- package/src/components/wt-icon/wt-icon.vue +4 -1
package/package.json
CHANGED
|
@@ -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>
|
|
@@ -16,24 +15,24 @@
|
|
|
16
15
|
|
|
17
16
|
<wt-context-menu
|
|
18
17
|
:options="options"
|
|
19
|
-
:visible="
|
|
18
|
+
:visible="isContextMenuVisible"
|
|
20
19
|
@click="selectOption"
|
|
21
20
|
>
|
|
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,63 @@
|
|
|
41
40
|
</div>
|
|
42
41
|
</template>
|
|
43
42
|
|
|
44
|
-
<script>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
options: {
|
|
55
|
-
type: Array,
|
|
56
|
-
required: true,
|
|
57
|
-
},
|
|
58
|
-
/**
|
|
59
|
-
* @values 'primary', 'secondary'
|
|
60
|
-
* @example <wt-button color="secondary"></wt-button>
|
|
61
|
-
*/
|
|
62
|
-
color: {
|
|
63
|
-
type: String,
|
|
64
|
-
default: 'primary',
|
|
65
|
-
},
|
|
66
|
-
disabled: {
|
|
67
|
-
type: Boolean,
|
|
68
|
-
default: false,
|
|
69
|
-
},
|
|
43
|
+
<script setup>
|
|
44
|
+
import { computed, ref } from 'vue';
|
|
45
|
+
|
|
46
|
+
const props = defineProps({
|
|
47
|
+
/**
|
|
48
|
+
* See context-menu component docs
|
|
49
|
+
*/
|
|
50
|
+
options: {
|
|
51
|
+
type: Array,
|
|
52
|
+
required: true,
|
|
70
53
|
},
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
|
-
},
|
|
54
|
+
/**
|
|
55
|
+
* @values 'primary', 'secondary'
|
|
56
|
+
* @example <wt-button color="secondary"></wt-button>
|
|
57
|
+
*/
|
|
58
|
+
color: {
|
|
59
|
+
type: String,
|
|
60
|
+
default: 'primary',
|
|
94
61
|
},
|
|
95
|
-
|
|
62
|
+
disabled: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: false,
|
|
65
|
+
},
|
|
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
|
+
const isContextMenuVisible = computed(() => {
|
|
87
|
+
if (props.disabled) return false;
|
|
88
|
+
return isOpened.value;
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
function selectOption({ option, index }) {
|
|
92
|
+
emit('click:option', option, index);
|
|
93
|
+
isOpened.value = false;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function atClickaway() {
|
|
97
|
+
isOpened.value = false;
|
|
98
|
+
}
|
|
99
|
+
|
|
96
100
|
</script>
|
|
97
101
|
|
|
98
102
|
<style lang="scss">
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
Different color icons:
|
|
7
7
|
```vue
|
|
8
|
-
const colors = ['default', 'disabled', 'primary', 'error', 'success', 'warning', 'on-dark', 'on-light', 'on-primary', 'info', 'chat', 'transfer', 'job'];
|
|
8
|
+
const colors = ['default', 'active', 'disabled', 'primary', 'error', 'success', 'warning', 'on-dark', 'on-light', 'on-primary', 'info', 'chat', 'transfer', 'job'];
|
|
9
9
|
|
|
10
10
|
<div
|
|
11
11
|
style="display: flex; align-items: center; gap: 5px;"
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
--icon-xs-size: 8px;
|
|
10
10
|
|
|
11
11
|
--icon-color: var(--grey-darken-2);
|
|
12
|
+
--icon-active-color: var(--grey-darken-4);
|
|
12
13
|
--icon-primary-color: var(--primary-color);
|
|
13
14
|
--icon-error-color: var(--error-color);
|
|
14
15
|
--icon-success-color: var(--success-color);
|
|
@@ -25,5 +26,6 @@
|
|
|
25
26
|
|
|
26
27
|
:root.theme--dark {
|
|
27
28
|
--icon-color: var(--grey-lighten-2);
|
|
29
|
+
--icon-active-color: var(--grey-lighten-4);
|
|
28
30
|
--icon-disabled-color: var(--grey-darken-2);
|
|
29
31
|
}
|
|
@@ -35,7 +35,7 @@ const props = defineProps({
|
|
|
35
35
|
default: 'md',
|
|
36
36
|
},
|
|
37
37
|
/**
|
|
38
|
-
* @values 'default', 'disabled', 'primary', 'error', 'success', 'warning', 'on-dark', 'on-light', 'on-primary', 'info', 'chat', 'transfer', 'job'
|
|
38
|
+
* @values 'default', 'active', 'disabled', 'primary', 'error', 'success', 'warning', 'on-dark', 'on-light', 'on-primary', 'info', 'chat', 'transfer', 'job'
|
|
39
39
|
*/
|
|
40
40
|
color: {
|
|
41
41
|
type: String,
|
|
@@ -88,6 +88,9 @@ svg {
|
|
|
88
88
|
&-default .wt-icon__icon {
|
|
89
89
|
fill: var(--icon-color);
|
|
90
90
|
}
|
|
91
|
+
&-active .wt-icon__icon {
|
|
92
|
+
fill: var(--icon-active-color);
|
|
93
|
+
}
|
|
91
94
|
&-primary .wt-icon__icon {
|
|
92
95
|
fill: var(--icon-primary-color);
|
|
93
96
|
}
|