@webitel/ui-sdk 1.0.46 → 2.0.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.
Files changed (27) hide show
  1. package/README.md +1 -1
  2. package/dist/ui-sdk.common.js +169 -92
  3. package/dist/ui-sdk.common.js.map +1 -1
  4. package/dist/ui-sdk.css +1 -1
  5. package/dist/ui-sdk.umd.js +169 -92
  6. package/dist/ui-sdk.umd.js.map +1 -1
  7. package/dist/ui-sdk.umd.min.js +2 -2
  8. package/dist/ui-sdk.umd.min.js.map +1 -1
  9. package/package.json +1 -1
  10. package/src/components/atoms/wt-tooltip/__tests__/WtTooltip.spec.js +2 -1
  11. package/src/components/atoms/wt-tooltip/wt-tooltip.vue +28 -41
  12. package/src/components/index.js +2 -0
  13. package/src/components/molecules/wt-hint/__tests__/WtHint.spec.js +9 -0
  14. package/src/components/molecules/wt-hint/wt-hint.vue +21 -0
  15. package/src/components/molecules/wt-icon-btn/__tests__/WtIconBtn.spec.js +0 -15
  16. package/src/components/molecules/wt-icon-btn/wt-icon-btn.vue +46 -88
  17. package/src/components/molecules/wt-label/wt-label.vue +4 -22
  18. package/src/components/organisms/wt-app-header/wt-app-navigator.vue +12 -12
  19. package/src/components/organisms/wt-app-header/wt-header-actions.vue +13 -13
  20. package/src/components/organisms/wt-pagination/__tests__/WtPagination.spec.js +2 -2
  21. package/src/components/organisms/wt-pagination/wt-pagination.vue +22 -16
  22. package/src/components/organisms/wt-table/table-cells/wt-table-delete-action.vue +9 -6
  23. package/src/components/organisms/wt-table/table-cells/wt-table-edit-action.vue +10 -7
  24. package/src/components/organisms/wt-table-actions/wt-table-actions.vue +62 -38
  25. package/src/components/organisms/wt-table-column-select/__tests__/WtTableColumnSelect.spec.js +2 -2
  26. package/src/components/organisms/wt-table-column-select/wt-table-column-select.vue +13 -9
  27. package/src/css/components/atoms/wt-tooltip/_variables.scss +17 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webitel/ui-sdk",
3
- "version": "1.0.46",
3
+ "version": "2.0.0",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve-lib": "vue-cli-service serve",
@@ -7,7 +7,8 @@ describe('WtTooltip', () => {
7
7
  expect(wrapper.classes('wt-tooltip')).toBe(true);
8
8
  });
9
9
 
10
- it('renders a component text, if passed', () => {
10
+ // tooltip content is rendered outside of wt-tooltip compoent
11
+ it.skip('renders a component text, if passed', () => {
11
12
  const content = 'Hello there!';
12
13
  const wrapper = shallowMount(WtTooltip, {
13
14
  slots: {
@@ -1,54 +1,41 @@
1
1
  <template>
2
- <span
3
- class="wt-tooltip"
2
+ <v-tooltip
4
3
  :class="{
5
- 'wt-tooltip--visible': visible,
6
4
  'wt-tooltip--contrast': contrast
7
5
  }"
6
+ :placement="placement"
7
+ :popper-class="[
8
+ 'wt-tooltip__popper',
9
+ { 'wt-tooltip--contrast__popper': contrast },
10
+ ]"
11
+ class="wt-tooltip"
8
12
  >
9
- <slot></slot>
10
- </span>
13
+ <slot name="activator"></slot>
14
+ <template #popper>
15
+ <slot></slot>
16
+ </template>
17
+ </v-tooltip>
11
18
  </template>
12
19
 
13
20
  <script>
14
- export default {
15
- name: 'wt-tooltip',
16
- props: {
17
- visible: {
18
- type: Boolean,
19
- default: false,
20
- },
21
- contrast: {
22
- type: Boolean,
23
- default: false,
24
- },
21
+ export default {
22
+ name: 'wt-tooltip',
23
+ props: {
24
+ contrast: {
25
+ type: Boolean,
26
+ default: false,
27
+ },
28
+ placement: {
29
+ type: String,
30
+ default: 'auto',
25
31
  },
26
- };
32
+ },
33
+ };
27
34
  </script>
28
35
 
29
36
  <style lang="scss" scoped>
30
- .wt-tooltip {
31
- @extend %typo-body-1;
32
- display: inline-block;
33
- min-width: 0;
34
- padding: var(--tooltip-padding);
35
- color: var(--tooltip-light-text-color);
36
- background: var(--tooltip-light-bg-color);
37
- border-radius: var(--border-radius);
38
- box-shadow: var(--tooltip-elevation);
39
- transition: var(--transition);
40
- opacity: 0;
41
- pointer-events: none;
42
- z-index: var(--tooltip-z-index);
43
-
44
- &--contrast {
45
- color: var(--tooltip-dark-text-color);
46
- background: var(--tooltip-dark-bg-color);
47
- }
48
-
49
- &--visible, &:hover {
50
- opacity: 1;
51
- pointer-events: auto;
52
- }
53
- }
37
+ .wt-tooltip {
38
+ display: inline-block;
39
+ line-height: 0;
40
+ }
54
41
  </style>
@@ -32,6 +32,7 @@ import WtTextarea from './molecules/wt-textarea/wt-textarea.vue';
32
32
  import WtTimepicker from './molecules/wt-timepicker/wt-timepicker.vue';
33
33
  import WtLabel from './molecules/wt-label/wt-label.vue';
34
34
  import WtButtonSelect from './molecules/wt-button-select/wt-button-select.vue';
35
+ import WtHint from './molecules/wt-hint/wt-hint.vue';
35
36
 
36
37
  import WtAppHeader from './organisms/wt-app-header/wt-app-header.vue';
37
38
  import WtAppNavigator from './organisms/wt-app-header/wt-app-navigator.vue';
@@ -67,6 +68,7 @@ const Components = {
67
68
  WtDatetimepicker,
68
69
  WtIconBtn,
69
70
  WtInput,
71
+ WtHint,
70
72
  WtNotification,
71
73
  WtPopup,
72
74
  WtProgressBar,
@@ -0,0 +1,9 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import WtHint from '../wt-hint.vue';
3
+
4
+ describe('WtHint', () => {
5
+ it('renders a component', () => {
6
+ const wrapper = shallowMount(WtHint);
7
+ expect(wrapper.isVisible()).toBe(true);
8
+ });
9
+ });
@@ -0,0 +1,21 @@
1
+ <template>
2
+ <wt-tooltip class="wt-hint">
3
+ <template v-slot:activator>
4
+ <wt-icon-btn
5
+ icon="rounded-info"
6
+ color="outline"
7
+ ></wt-icon-btn>
8
+ </template>
9
+ <slot></slot>
10
+ </wt-tooltip>
11
+ </template>
12
+
13
+ <script>
14
+ export default {
15
+ name: 'wt-hint',
16
+ };
17
+ </script>
18
+
19
+ <style lang="scss" scoped>
20
+
21
+ </style>
@@ -13,19 +13,4 @@ describe('WtIconBtn', () => {
13
13
  });
14
14
  expect(wrapper.classes('wt-icon-btn')).toBe(true);
15
15
  });
16
-
17
- it('renders tooltip text when passed', () => {
18
- const tooltip = 'Hello there';
19
- const wrapper = shallowMount(WtIconBtn, {
20
- stubs: {
21
- WtTooltip,
22
- WtIcon: true,
23
- },
24
- propsData: {
25
- tooltip,
26
- icon: 'bucket',
27
- },
28
- });
29
- expect(wrapper.find('.wt-tooltip').text()).toBe(tooltip);
30
- });
31
16
  });
@@ -1,113 +1,71 @@
1
1
  <template>
2
- <div class="wt-icon-btn" :class="{ 'wt-icon-btn--disabled': disabled }">
2
+ <div :class="{ 'wt-icon-btn--disabled': disabled }" class="wt-icon-btn">
3
3
  <button class="wt-icon-btn__button" type="button">
4
4
  <wt-icon
5
+ :color="iconColor"
5
6
  :icon="icon"
6
7
  :icon-prefix="iconPrefix"
7
8
  :size="size"
8
- :color="iconColor"
9
9
  @click.native="$emit('click', $event)"
10
10
  ></wt-icon>
11
11
  </button>
12
- <wt-tooltip
13
- v-if="tooltip"
14
- class="wt-icon-btn__tooltip"
15
- :class="`wt-icon-btn__tooltip--tooltip-${tooltipPosition}`"
16
- >{{tooltip}}</wt-tooltip>
17
12
  </div>
18
13
  </template>
19
14
 
20
15
  <script>
21
- export default {
22
- name: 'wt-icon-btn',
23
- props: {
24
- icon: {
25
- type: String,
26
- required: true,
27
- },
28
- iconPrefix: {
29
- type: String,
30
- default: '',
31
- },
32
- size: {
33
- type: String,
34
- },
35
- tooltip: {
36
- type: String,
37
- },
38
- tooltipPosition: {
39
- type: String,
40
- default: 'bottom',
41
- },
42
- disabled: {
43
- type: Boolean,
44
- default: false,
45
- },
46
- color: {
47
- type: String,
48
- },
16
+ export default {
17
+ name: 'wt-icon-btn',
18
+ props: {
19
+ icon: {
20
+ type: String,
21
+ required: true,
22
+ },
23
+ iconPrefix: {
24
+ type: String,
25
+ default: '',
26
+ },
27
+ size: {
28
+ type: String,
29
+ },
30
+ disabled: {
31
+ type: Boolean,
32
+ default: false,
33
+ },
34
+ color: {
35
+ type: String,
49
36
  },
50
- computed: {
51
- iconColor() {
52
- if (this.disabled) return 'disabled';
53
- return this.color;
54
- },
37
+ },
38
+ computed: {
39
+ iconColor() {
40
+ if (this.disabled) return 'disabled';
41
+ return this.color;
55
42
  },
56
- };
43
+ },
44
+ };
57
45
  </script>
58
46
 
59
47
  <style lang="scss" scoped>
60
- .wt-icon-btn {
61
- position: relative;
62
- display: inline-block;
48
+ .wt-icon-btn {
49
+ position: relative;
50
+ display: inline-block;
63
51
 
64
- .wt-icon {
65
- display: flex;
66
- }
67
-
68
- // add hover style only for "default" icon color cause non-default already may have opacity 1
69
- &:hover ::v-deep .wt-icon__icon.wt-icon__icon--color-default {
70
- fill: var(--icon-color--hover);
71
- }
72
-
73
- // icon "disabled" color is set from iconColor computed
74
- &--disabled {
75
- pointer-events: none;
76
- }
52
+ .wt-icon {
53
+ display: flex;
77
54
  }
78
55
 
79
- .wt-icon-btn,
80
- .wt-icon-btn__button {
81
- line-height: 0;
56
+ // add hover style only for "default" icon color cause non-default already may have opacity 1
57
+ &:hover ::v-deep .wt-icon__icon.wt-icon__icon--color-default {
58
+ fill: var(--icon-color--hover);
82
59
  }
83
60
 
84
- .wt-icon-btn__tooltip {
85
- position: absolute;
86
-
87
- &--tooltip-top {
88
- bottom: calc(100% + 11px); // icon height + 11px margin
89
- left: 50%;
90
- transform: translateX(-50%);
91
- }
92
- &--tooltip-bottom {
93
- top: calc(100% + 11px);
94
- left: 50%;
95
- transform: translateX(-50%);
96
- }
97
- &--tooltip-right {
98
- top: 50%;
99
- left: calc(100% + 11px);
100
- transform: translateY(-50%);
101
- }
102
- &--tooltip-left {
103
- top: 50%;
104
- right: calc(100% + 11px);
105
- transform: translateY(-50%);
106
- }
107
-
108
- .wt-icon-btn:hover & {
109
- opacity: 1;
110
- pointer-events: auto;
111
- }
61
+ // icon "disabled" color is set from iconColor computed
62
+ &--disabled {
63
+ pointer-events: none;
112
64
  }
65
+ }
66
+
67
+ .wt-icon-btn,
68
+ .wt-icon-btn__button {
69
+ line-height: 0;
70
+ }
113
71
  </style>
@@ -9,14 +9,10 @@
9
9
  :for="this.for"
10
10
  >
11
11
  <slot></slot>
12
- <wt-icon-btn
12
+ <wt-hint
13
13
  v-if="hint"
14
- class="wt-label__hint"
15
- icon="rounded-info"
16
- color="outline"
17
- :tooltip="hint"
18
- :tooltip-position="hintPosition"
19
- ></wt-icon-btn>
14
+ >{{ hint }}
15
+ </wt-hint>
20
16
  </label>
21
17
  </template>
22
18
 
@@ -43,10 +39,6 @@ export default {
43
39
  type: String,
44
40
  description: 'Adds hint icon + tooltip with text, passed as "hint" prop',
45
41
  },
46
- hintPosition: {
47
- type: String,
48
- description: 'See wt-icon-btn tooltip-position prop',
49
- },
50
42
  },
51
43
  };
52
44
  </script>
@@ -74,17 +66,7 @@ export default {
74
66
  }
75
67
  }
76
68
 
77
- .wt-label__hint {
78
- cursor: pointer;
69
+ .wt-hint {
79
70
  margin-left: var(--spacing-xs);
80
-
81
- ::v-deep {
82
- .wt-tooltip {
83
- width: max-content; // experimental css property
84
- width: -moz-max-content; // experimental css property
85
- min-width: 120px;
86
- max-width: 280px;
87
- }
88
- }
89
71
  }
90
72
  </style>
@@ -1,12 +1,17 @@
1
1
  <template>
2
2
  <div v-clickaway="close" class="wt-app-navigator">
3
- <wt-icon-btn
4
- :class="{'active': isOpened}"
5
- :tooltip="$t('webitelUI.appNavigator.title')"
6
- class="wt-app-navigator__btn"
7
- icon="app-navigator"
8
- @click="isOpened = !isOpened"
9
- ></wt-icon-btn>
3
+ <wt-tooltip>
4
+ <template v-slot:activator>
5
+ <wt-icon-btn
6
+ :class="{'active': isOpened}"
7
+ class="wt-app-navigator__btn"
8
+ icon="app-navigator"
9
+ @click="isOpened = !isOpened"
10
+ ></wt-icon-btn>
11
+ </template>
12
+ {{ $t('webitelUI.appNavigator.title') }}
13
+ </wt-tooltip>
14
+
10
15
  <transition name="fade">
11
16
  <nav
12
17
  v-show="isOpened"
@@ -183,11 +188,6 @@ export default {
183
188
  z-index: var(--wt-app-header-content-z-index);
184
189
  display: flex;
185
190
  align-items: center;
186
-
187
- ::v-deep .wt-icon-btn__tooltip {
188
- left: 50%;
189
- transform: translateX(-100%);
190
- }
191
191
  }
192
192
 
193
193
  // dropdown part
@@ -1,13 +1,18 @@
1
1
  <template>
2
2
  <div class="wt-header-actions">
3
- <wt-icon-btn
4
- v-clickaway="close"
5
- :class="{'active': isOpened}"
6
- :tooltip="$t('webitelUI.headerActions.account')"
7
- class="wt-header-actions__btn"
8
- icon="account"
9
- @click="isOpened = !isOpened"
10
- ></wt-icon-btn>
3
+ <wt-tooltip>
4
+ <template v-slot:activator>
5
+ <wt-icon-btn
6
+ v-clickaway="close"
7
+ :class="{'active': isOpened}"
8
+ class="wt-header-actions__btn"
9
+ icon="account"
10
+ @click="isOpened = !isOpened"
11
+ ></wt-icon-btn>
12
+ </template>
13
+ {{ $t('webitelUI.headerActions.account') }}
14
+ </wt-tooltip>
15
+
11
16
  <transition name="fade">
12
17
  <section v-show="isOpened" class="wt-header-actions__panel-wrapper">
13
18
  <header v-if="isHeader" class="wt-header-actions__header">
@@ -117,11 +122,6 @@ export default {
117
122
  z-index: var(--wt-app-header-content-z-index);
118
123
  display: flex;
119
124
  align-items: center;
120
-
121
- ::v-deep .wt-icon-btn__tooltip {
122
- left: 50%;
123
- transform: translateX(-100%);
124
- }
125
125
  }
126
126
 
127
127
  .wt-header-actions__panel-wrapper {
@@ -1,4 +1,4 @@
1
- import { shallowMount } from '@vue/test-utils';
1
+ import { shallowMount, mount } from '@vue/test-utils';
2
2
  import WtPagination from '../wt-pagination.vue';
3
3
 
4
4
  describe('WtPagination', () => {
@@ -25,7 +25,7 @@ describe('WtPagination', () => {
25
25
  });
26
26
 
27
27
  it('changes pages at icon btn click', async () => {
28
- const wrapper = shallowMount(WtPagination, {
28
+ const wrapper = mount(WtPagination, {
29
29
  props: { isNext: true, page: 2 },
30
30
  });
31
31
  const pageControls = wrapper.findAll('.wt-pagination__page-control');
@@ -12,22 +12,28 @@
12
12
  ></wt-input>
13
13
  </div>
14
14
  <div class="wt-pagination__page-controls">
15
- <wt-icon-btn
16
- :disabled="!prev"
17
- :tooltip="$t('webitelUI.pagination.prev')"
18
- class="wt-pagination__page-control"
19
- icon="arrow-left"
20
- tooltip-position="left"
21
- @click="goPrev"
22
- ></wt-icon-btn>
23
- <wt-icon-btn
24
- :disabled="!next"
25
- :tooltip="$t('webitelUI.pagination.next')"
26
- class="wt-pagination__page-control"
27
- icon="arrow-right"
28
- tooltip-position="left"
29
- @click="goNext"
30
- ></wt-icon-btn>
15
+ <wt-tooltip>
16
+ <template v-slot:activator>
17
+ <wt-icon-btn
18
+ :disabled="!prev"
19
+ class="wt-pagination__page-control"
20
+ icon="arrow-left"
21
+ @click="goPrev"
22
+ ></wt-icon-btn>
23
+ </template>
24
+ {{ $t('webitelUI.pagination.prev') }}
25
+ </wt-tooltip>
26
+ <wt-tooltip>
27
+ <template v-slot:activator>
28
+ <wt-icon-btn
29
+ :disabled="!next"
30
+ class="wt-pagination__page-control"
31
+ icon="arrow-right"
32
+ @click="goNext"
33
+ ></wt-icon-btn>
34
+ </template>
35
+ {{ $t('webitelUI.pagination.next') }}
36
+ </wt-tooltip>
31
37
  </div>
32
38
  </footer>
33
39
  </template>
@@ -1,10 +1,13 @@
1
1
  <template>
2
- <wt-icon-btn
3
- icon="bucket"
4
- :tooltip="$t('webitelUI.table.tableCells.deleteActionHint')"
5
- tooltip-position="left"
6
- @click="$emit('click')"
7
- ></wt-icon-btn>
2
+ <wt-tooltip>
3
+ <template v-slot:activator>
4
+ <wt-icon-btn
5
+ icon="bucket"
6
+ @click="$emit('click')"
7
+ ></wt-icon-btn>
8
+ </template>
9
+ {{ $t('webitelUI.table.tableCells.deleteActionHint') }}
10
+ </wt-tooltip>
8
11
  </template>
9
12
 
10
13
  <script>
@@ -1,11 +1,14 @@
1
1
  <template>
2
- <wt-icon-btn
3
- class="table-action"
4
- icon="edit"
5
- :tooltip="$t('webitelUI.table.tableCells.editActionHint')"
6
- tooltip-position="left"
7
- @click="$emit('click')"
8
- ></wt-icon-btn>
2
+ <wt-tooltip>
3
+ <template v-slot:activator>
4
+ <wt-icon-btn
5
+ class="table-action"
6
+ icon="edit"
7
+ @click="$emit('click')"
8
+ ></wt-icon-btn>
9
+ </template>
10
+ {{ $t('webitelUI.table.tableCells.editActionHint') }}
11
+ </wt-tooltip>
9
12
  </template>
10
13
 
11
14
  <script>