@webitel/ui-sdk 3.1.104 → 3.1.106

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": "3.1.104",
3
+ "version": "3.1.106",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve-lib": "vue-cli-service serve",
@@ -4,6 +4,7 @@
4
4
  :visible="visible"
5
5
  :triggers="['click', 'touch']"
6
6
  placement="bottom-end"
7
+ popper-class="wt-context-menu__floating-wrapper"
7
8
  >
8
9
  <template v-slot:activator>
9
10
  <slot name="activator"></slot>
@@ -69,9 +70,9 @@ function handleOptionClick({ option, index, hide }) {
69
70
  .wt-context-menu {
70
71
  line-height: 0;
71
72
 
72
- &.wt-tooltip :deep(.wt-tooltip__floating) {
73
- padding: 0;
74
- }
73
+ &.wt-tooltip :deep(.wt-context-menu__floating-wrapper) {
74
+ padding: 0;
75
+ }
75
76
  }
76
77
 
77
78
  .wt-context-menu__menu {
@@ -13,6 +13,7 @@
13
13
  <slot name="activator"></slot>
14
14
  </div>
15
15
  <div
16
+ v-if="isVisible"
16
17
  ref="floating"
17
18
  class="wt-tooltip__floating"
18
19
  v-clickaway="hideTooltip"
@@ -143,9 +144,13 @@ const { floatingStyles } = useFloating(activator, floating, {
143
144
  placement: props.placement === 'auto' ? null : props.placement,
144
145
  strategy: 'fixed', // https://floating-ui.com/docs/computeposition#strategy
145
146
  // https://floating-ui.com/docs/middleware
147
+
148
+ /* WE SHOULD USE v-if INSTEAD OF OPACITY VISIBILITY
149
+ TOGGLE BECAUSE OF PERFORMANCE ISSUES, RELATED TO USAGE OF AUTO_UPDATE OF POSITIONS
150
+ */
146
151
  whileElementsMounted: autoUpdate, // https://floating-ui.com/docs/vue#anchoring
147
152
  middleware: [
148
- shift(), offset(8),
153
+ shift(), offset(4),
149
154
  props.placement === 'auto' ? autoPlacement() : flip(),
150
155
  ],
151
156
  });
@@ -179,7 +184,6 @@ onBeforeUnmount(() => unsubscribeTriggers());
179
184
  border-radius: var(--border-radius);
180
185
  box-shadow: var(--elevation-10);
181
186
  z-index: 1000;
182
- transition: var(--transition);
183
187
  }
184
188
 
185
189
  &--contrast {
@@ -189,18 +193,4 @@ onBeforeUnmount(() => unsubscribeTriggers());
189
193
  }
190
194
  }
191
195
  }
192
-
193
- .wt-tooltip {
194
- .wt-tooltip__floating {
195
- opacity: 0;
196
- pointer-events: none;
197
- }
198
-
199
- &--visible {
200
- .wt-tooltip__floating {
201
- opacity: 1;
202
- pointer-events: auto;
203
- }
204
- }
205
- }
206
196
  </style>
@@ -1,6 +1,13 @@
1
1
  import { shallowMount, mount } from '@vue/test-utils';
2
2
  import WtSelectButton from '../wt-button-select.vue';
3
3
 
4
+ // helps to mock @floating-ui/vue autoUpdate method
5
+ global.ResizeObserver = jest.fn().mockImplementation(() => ({
6
+ observe: jest.fn(),
7
+ unobserve: jest.fn(),
8
+ disconnect: jest.fn(),
9
+ }));
10
+
4
11
  describe('WtSelectButton', () => {
5
12
  it('renders a component', () => {
6
13
  const wrapper = shallowMount(WtSelectButton);
@@ -22,6 +29,9 @@ describe('WtSelectButton', () => {
22
29
  data: () => ({
23
30
  isOpened: true,
24
31
  }),
32
+ props: {
33
+ options: [],
34
+ },
25
35
  });
26
36
  const wtIcon = wrapper.find('.wt-button-select__select-arrow');
27
37
  expect(wtIcon.classes()).toContain('wt-button-select__select-arrow--active');