@webitel/ui-sdk 0.9.28 → 0.9.32

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": "@webitel/ui-sdk",
3
- "version": "0.9.28",
3
+ "version": "0.9.32",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve-lib": "vue-cli-service serve",
@@ -20,7 +20,6 @@
20
20
  </template>
21
21
 
22
22
  <script>
23
-
24
23
  export default {
25
24
  name: 'wt-button',
26
25
  props: {
@@ -32,19 +31,19 @@
32
31
  type: Boolean,
33
32
  default: false,
34
33
  },
35
- large: {
34
+ outline: {
36
35
  type: Boolean,
37
36
  default: false,
38
37
  },
39
- outline: {
38
+ loading: {
40
39
  type: Boolean,
41
40
  default: false,
42
41
  },
43
- wide: {
42
+ large: {
44
43
  type: Boolean,
45
44
  default: false,
46
45
  },
47
- loading: {
46
+ wide: {
48
47
  type: Boolean,
49
48
  default: false,
50
49
  },
@@ -0,0 +1,76 @@
1
+ <template>
2
+ <ul
3
+ class="wt-context-menu"
4
+ :class="{'wt-context-menu--hidden': !visible}"
5
+ >
6
+ <li
7
+ class="wt-context-menu__option-wrapper"
8
+ v-for="(option, index) in options"
9
+ :key="index"
10
+ >
11
+ <a
12
+ class="wt-context-menu__option"
13
+ href="#"
14
+ @click="$emit('click', { option, index })"
15
+ >
16
+ {{ option.text || option }}
17
+ </a>
18
+ </li>
19
+ </ul>
20
+ </template>
21
+
22
+ <script>
23
+ export default {
24
+ name: 'wt-context-menu',
25
+ props: {
26
+ options: {
27
+ type: Array,
28
+ required: true,
29
+ description: '[{ text }] or [\'str\']',
30
+ },
31
+ visible: {
32
+ type: Boolean,
33
+ default: true,
34
+ },
35
+ },
36
+ };
37
+ </script>
38
+
39
+ <style lang="scss" scoped>
40
+ .wt-context-menu {
41
+ @extend %typo-body-sm;
42
+ min-width: var(--context-menu-min-width);
43
+ background-color: var(--context-menu-background-color);
44
+ border-radius: var(--border-radius);
45
+ box-shadow: var(--box-shadow);
46
+ transition: var(--transition);
47
+ z-index: 1;
48
+
49
+ &--hidden {
50
+ opacity: 0;
51
+ pointer-events: none;
52
+ }
53
+ }
54
+
55
+ .wt-context-menu__option-wrapper {
56
+ &:first-of-type {
57
+ border-radius: var(--border-radius) var(--border-radius) 0 0;
58
+ }
59
+ &:last-of-type {
60
+ border-radius: 0 0 var(--border-radius) var(--border-radius);
61
+ }
62
+ &:only-of-type {
63
+ border-radius: var(--border-radius);
64
+ }
65
+ &:hover {
66
+ background-color: var( --context-menu-option-color--hover);
67
+ transition: var(--transition);
68
+ }
69
+ }
70
+
71
+ .wt-context-menu__option {
72
+ display: block;
73
+ padding: var(--context-menu-option-padding);
74
+ cursor: pointer;
75
+ }
76
+ </style>
@@ -8,6 +8,7 @@ import WtDivider from './atoms/wt-divider/wt-divider.vue';
8
8
  import WtTooltip from './atoms/wt-tooltip/wt-tooltip.vue';
9
9
  import WtRoundedAction from './atoms/wt-rounded-action/wt-rounded-action.vue';
10
10
  import WtLoader from './atoms/wt-loader/wt-loader.vue';
11
+ import WtContextMenu from './atoms/wt-context-menu/wt-context-menu.vue';
11
12
 
12
13
  import WtCheckbox from './molecules/wt-checkbox/wt-checkbox.vue';
13
14
  import WtDatepicker from './molecules/wt-datepicker/wt-datepicker.vue';
@@ -28,6 +29,7 @@ import WtTimeInput from './molecules/wt-time-input/wt-time-input.vue';
28
29
  import WtTextarea from './molecules/wt-textarea/wt-textarea.vue';
29
30
  import WtTimepicker from './molecules/wt-timepicker/wt-timepicker.vue';
30
31
  import WtLabel from './molecules/wt-label/wt-label.vue';
32
+ import WtButtonSelect from './molecules/wt-button-select/wt-button-select.vue';
31
33
 
32
34
  import WtAppHeader from './organisms/wt-app-header/wt-app-header.vue';
33
35
  import WtAppNavigator from './organisms/wt-app-header/wt-app-navigator.vue';
@@ -89,6 +91,8 @@ const Components = {
89
91
  WtTable,
90
92
  WtTableActions,
91
93
  WtTableColumnSelect,
94
+ WtButtonSelect,
95
+ WtContextMenu,
92
96
  };
93
97
 
94
98
  Object.keys(Components).forEach((name) => {
@@ -0,0 +1,172 @@
1
+ <template>
2
+ <div
3
+ class="wt-button-select"
4
+ v-clickaway="away">
5
+
6
+ <wt-button
7
+ class="wt-button-select__button"
8
+ v-bind="$attrs"
9
+ @click="$emit('click', $event)"
10
+ >
11
+ <slot></slot>
12
+ </wt-button>
13
+
14
+ <wt-button
15
+ class="wt-button-select__select-btn"
16
+ v-bind="$attrs"
17
+ :loading="false"
18
+ @click="isOpened = !isOpened"
19
+ >
20
+ <wt-icon
21
+ class="wt-button-select__select-arrow"
22
+ :class="{'wt-button-select__select-arrow--active': isOpened}"
23
+ v-bind="$attrs"
24
+ icon="arrow-down"
25
+ size="sm"
26
+ ></wt-icon>
27
+ </wt-button>
28
+
29
+ <wt-context-menu
30
+ v-bind="$attrs"
31
+ :visible="isOpened"
32
+ @click="selectOption"
33
+ ></wt-context-menu>
34
+ </div>
35
+ </template>
36
+
37
+ <script>
38
+ export default {
39
+ name: 'wt-button-select',
40
+ data: () => ({
41
+ isOpened: false,
42
+ }),
43
+ methods: {
44
+ selectOption({ option, index }) {
45
+ this.$emit('click:option', option, index);
46
+ this.isOpened = false;
47
+ },
48
+ away() {
49
+ this.isOpened = false;
50
+ },
51
+ },
52
+ };
53
+ </script>
54
+ <style lang="scss" scoped>
55
+ .wt-button-select {
56
+ position: relative;
57
+ display: inline-flex;
58
+ align-items: center;
59
+ gap: var(--button-select-buttons-gap);
60
+
61
+ .wt-context-menu {
62
+ position: absolute;
63
+ top: 100%;
64
+ left: 0;
65
+ }
66
+ }
67
+
68
+ .wt-button-select__button {
69
+ padding: var(--button-select-button-padding);
70
+ border-radius: var(--border-radius) 0 0 var(--border-radius);
71
+ }
72
+
73
+ .wt-button-select__select-btn {
74
+ padding: var(--button-select-icon-button-padding);
75
+ border-radius: 0 var(--border-radius) var(--border-radius) 0;
76
+
77
+ // NORMAL MODE
78
+ &:not(.wt-button--outline)::v-deep {
79
+ & .wt-icon--color-default .wt-icon__icon {
80
+ fill: var(--button-select-icon-color-dark);
81
+ }
82
+
83
+ //For danger, success, transfer icon fill-colors.
84
+ //In another case we will need to write three additional strings
85
+ & .wt-icon__icon {
86
+ fill: var(--button-select-icon-color-ligth);
87
+ }
88
+
89
+ &.secondary .wt-icon--color-secondary .wt-icon__icon {
90
+ fill: var(--button-select-icon-color-secondary);
91
+ }
92
+
93
+ &.secondary {
94
+ &:hover,
95
+ &:active {
96
+ .wt-icon__icon {
97
+ fill: var(--button-select-icon-color-secondary--hover);
98
+ }
99
+ }
100
+ }
101
+ }
102
+
103
+ //OUTLINE MODE
104
+ &.wt-button--outline::v-deep {
105
+ & .wt-icon--color-default .wt-icon__icon {
106
+ fill: var(--button-select-icon-color-primary);
107
+ }
108
+
109
+ &:hover,
110
+ &:active {
111
+ .wt-icon__icon {
112
+ fill: var(--button-select-icon-color-primary--hover);
113
+ }
114
+ }
115
+
116
+ .wt-icon--color-secondary .wt-icon__icon {
117
+ fill: var(--button-select-icon-color-secondary);
118
+ }
119
+
120
+ &.danger {
121
+ &:hover,
122
+ &:active {
123
+ .wt-icon__icon {
124
+ fill: var(--button-select-icon-color-danger--hover);
125
+ }
126
+ }
127
+ }
128
+
129
+ &.success {
130
+ &:hover,
131
+ &:active {
132
+ .wt-icon__icon {
133
+ fill: var(--button-select-icon-color-success--hover);
134
+ }
135
+ }
136
+ }
137
+
138
+ &.transfer {
139
+ &:hover,
140
+ &:active {
141
+ .wt-icon__icon {
142
+ fill: var(--button-select-icon-color-transfer--hover);
143
+ }
144
+ }
145
+ }
146
+
147
+ &.secondary {
148
+ &:hover,
149
+ &:active {
150
+ .wt-icon__icon {
151
+ fill: var(--button-select-icon-color-secondary--hover);
152
+ }
153
+ }
154
+ }
155
+ }
156
+
157
+ // DISABLED MODE
158
+ &.wt-button--disabled .wt-icon::v-deep .wt-icon__icon {
159
+ fill: var(--icon-color-disabled);
160
+ }
161
+
162
+ // OPEN AND SHUT ARROW
163
+ .wt-button-select__select-arrow {
164
+ display: flex;
165
+ transform: rotate(0);
166
+
167
+ &--active {
168
+ transform: rotate(180deg);
169
+ }
170
+ }
171
+ }
172
+ </style>
@@ -9,7 +9,7 @@
9
9
  <input
10
10
  class="wt-search-bar__input"
11
11
  :value="value"
12
- :placeholder="placeholder"
12
+ :placeholder="searchBarPlaceholder"
13
13
  type="search"
14
14
  v-on="listeners"
15
15
  >
@@ -46,7 +46,6 @@
46
46
  */
47
47
  placeholder: {
48
48
  type: String,
49
- default: 'Search',
50
49
  },
51
50
  debounce: {
52
51
  type: Boolean,
@@ -82,6 +81,9 @@
82
81
  keyup: this.handleKeyup,
83
82
  };
84
83
  },
84
+ searchBarPlaceholder() {
85
+ return this.placeholder || this.$t('webitelUI.searchBar.placeholder');
86
+ },
85
87
  },
86
88
 
87
89
  methods: {
@@ -8,6 +8,7 @@
8
8
  @import "atoms/wt-loader/variables";
9
9
  @import "atoms/wt-rounded-action/variables";
10
10
  @import "atoms/wt-tooltip/variables";
11
+ @import "atoms/wt-context-menu/variables";
11
12
 
12
13
  @import "molecules/wt-icon-btn/variables";
13
14
  @import "molecules/wt-popup/variables";
@@ -26,6 +27,7 @@
26
27
  @import "molecules/wt-tags-input/variables";
27
28
  @import "molecules/wt-textarea/variables";
28
29
  @import "molecules/wt-timepicker/variables";
30
+ @import "molecules/wt-button-select/variables";
29
31
 
30
32
  @import "organisms/wt-headline/variables";
31
33
  @import "organisms/wt-app-header/variables";
@@ -0,0 +1,8 @@
1
+ .wt-context-menu {
2
+ --context-menu-option-color--hover: var(--secondary-color);
3
+
4
+ --context-menu-background-color: var(--main-color);
5
+
6
+ --context-menu-option-padding: var(--spacing--sm);
7
+ --context-menu-min-width : 150px;
8
+ }
@@ -0,0 +1,21 @@
1
+ .wt-button-select {
2
+ --button-select-button-padding: var(--spacing--md) var(--spacing--lg);
3
+ /*
4
+ Reduce 1px from "spacing--md" for align a difference between arrow size in "wt-button-select__select"
5
+ and line-height of text in "wt-button-select__button"
6
+ */
7
+ --button-select-icon-button-padding: calc(var(--spacing--md) - 1px);
8
+
9
+ --button-select-buttons-gap: 1px;
10
+
11
+ --button-select-icon-color-primary: var(--btn-primary-color);
12
+ --button-select-icon-color-secondary: var(--btn-secondary-color);
13
+ --button-select-icon-color-dark: var(--btn-dark-font-color);
14
+ --button-select-icon-color-ligth: var(--main-color);
15
+
16
+ --button-select-icon-color-primary--hover: var(--btn-primary--hover-color);
17
+ --button-select-icon-color-danger--hover: var(--btn-false--hover-color);
18
+ --button-select-icon-color-success--hover: var(--btn-true--hover-color);
19
+ --button-select-icon-color-transfer--hover: var(--btn-transfer--hover-color);
20
+ --button-select-icon-color-secondary--hover: var(--btn-dark-font-color);
21
+ }
@@ -16,6 +16,7 @@
16
16
  // Border radius
17
17
  --border-radius: var(--spacing--xs);
18
18
 
19
+ // DEPRECATED
19
20
  --component-padding: var(--spacing--lg);
20
21
  --component-spacing: var(--spacing--lg);
21
22
  --icon-spacing: var(--spacing--sm);
@@ -96,6 +96,9 @@ export default {
96
96
  url: 'Should look like url',
97
97
  },
98
98
  webitelUI: {
99
+ searchBar: {
100
+ placeholder: 'Search',
101
+ },
99
102
  timepicker: {
100
103
  hour: 'Hour:',
101
104
  min: 'Min:',
@@ -94,6 +94,9 @@ export default {
94
94
  url: 'Необходимо ввести корректный url-адрес',
95
95
  },
96
96
  webitelUI: {
97
+ searchBar: {
98
+ placeholder: 'Поиск',
99
+ },
97
100
  timepicker: {
98
101
  hour: 'Час:',
99
102
  min: 'Мин:',
@@ -94,6 +94,9 @@ export default {
94
94
  url: 'Необхідно ввести правильну url-адресу',
95
95
  },
96
96
  webitelUI: {
97
+ searchBar: {
98
+ placeholder: 'Пошук',
99
+ },
97
100
  timepicker: {
98
101
  hour: 'Год:',
99
102
  min: 'Хв:',