@webitel/ui-sdk 26.8.126 → 26.8.128

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.
@@ -1,4 +1,4 @@
1
- import "./components-BAjXjwgz.js";
1
+ import "./components-ClBeAarp.js";
2
2
  import { t as e } from "./_plugin-vue_export-helper-B3ysoDQm.js";
3
3
  import { m as t } from "./enums-Xag5PrU-.js";
4
4
  import { t as n } from "./wt-button-BfNbgYHy.js";
@@ -1,4 +1,4 @@
1
- import { C as e, i as t } from "./components-BAjXjwgz.js";
1
+ import { C as e, i as t } from "./components-ClBeAarp.js";
2
2
  import { t as n } from "./_plugin-vue_export-helper-B3ysoDQm.js";
3
3
  import { t as r } from "./utils-B4S9Yz-y.js";
4
4
  import { Fragment as i, computed as a, createCommentVNode as o, createElementBlock as s, createTextVNode as c, createVNode as l, defineComponent as u, openBlock as d, renderList as f, renderSlot as p, toDisplayString as m, unref as h, withCtx as g } from "vue";
@@ -1,6 +1,6 @@
1
- import { n as e } from "./components-BAjXjwgz.js";
1
+ import { n as e } from "./components-ClBeAarp.js";
2
2
  import "./convertDuration-B5bq1uxb.js";
3
- import { i as t, r as n } from "./clients-DV2KSEHt.js";
3
+ import { i as t, r as n } from "./clients-BIYo95Lm.js";
4
4
  import { n as r } from "./vue-i18n-VBiROMZ4.js";
5
5
  import { n as i } from "./useEventBus-B-ZeklLu.js";
6
6
  import { createBlock as a, createTextVNode as o, createVNode as s, defineComponent as c, mergeProps as l, onMounted as u, openBlock as d, ref as f, resolveComponent as p, toDisplayString as m, unref as h, withCtx as g } from "vue";
@@ -1,8 +1,8 @@
1
1
  import { a as e, c as t, i as n, n as r, r as i, s as a, t as o } from "./dist-EXdgfpvN.js";
2
2
  import { n as s } from "./genClient-CvWlQ0TZ.js";
3
3
  import { a as c } from "./caseConverters-DGri4uJo.js";
4
- import { a as l, o as u, r as d, s as f } from "./components-BAjXjwgz.js";
5
- import { a as p, n as m, t as h } from "./clients-DV2KSEHt.js";
4
+ import { a as l, o as u, r as d, s as f } from "./components-ClBeAarp.js";
5
+ import { a as p, n as m, t as h } from "./clients-BIYo95Lm.js";
6
6
  import { a as g, b as _, d as v, f as y, g as b, i as x, n as S, o as C, r as w, s as T, t as E, x as D } from "./enums-Xag5PrU-.js";
7
7
  import { n as ee, t as te } from "./vue-i18n-VBiROMZ4.js";
8
8
  import "./wt-toast-BScwyGca.js";
@@ -1,4 +1,4 @@
1
- import { w as e } from "./components-BAjXjwgz.js";
1
+ import { w as e } from "./components-ClBeAarp.js";
2
2
  import "./convertDuration-B5bq1uxb.js";
3
3
  import { t } from "./_plugin-vue_export-helper-B3ysoDQm.js";
4
4
  import { m as n } from "./enums-Xag5PrU-.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webitel/ui-sdk",
3
- "version": "26.8.126",
3
+ "version": "26.8.128",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "npm run docs:dev",
@@ -65,6 +65,7 @@
65
65
  "@tinymce/tinymce-vue": "^6.3.0",
66
66
  "@vuepic/vue-datepicker": "^4.5.1",
67
67
  "@vueuse/components": "^14.0.0",
68
+ "@vueuse/core": "^14.0.0",
68
69
  "autosize": "^6.0.1",
69
70
  "csv-parse": "^7.0.2",
70
71
  "csv-stringify": "^5.5.3",
@@ -1,4 +1,4 @@
1
- import { mount, shallowMount } from '@vue/test-utils';
1
+ import { flushPromises, mount, shallowMount } from '@vue/test-utils';
2
2
 
3
3
  import WtLayout from '../wt-layout.vue';
4
4
 
@@ -137,6 +137,45 @@ describe('WtLayout', () => {
137
137
  wrapper.unmount();
138
138
  });
139
139
 
140
+ it('reports the rendered width, keeping the preferred one when shrunk', async () => {
141
+ let notify;
142
+ vi.stubGlobal(
143
+ 'ResizeObserver',
144
+ class {
145
+ constructor(callback) {
146
+ notify = callback;
147
+ }
148
+ observe() {}
149
+ disconnect() {}
150
+ },
151
+ );
152
+ const wrapper = shallowMount(WtLayout, {
153
+ props: {
154
+ defaultWidth: 480,
155
+ resizable: true,
156
+ },
157
+ });
158
+ await flushPromises();
159
+ // container got narrower: flex shrinks the layout below its preferred width
160
+ notify([
161
+ {
162
+ borderBoxSize: [
163
+ {
164
+ inlineSize: 400.4,
165
+ blockSize: 600,
166
+ },
167
+ ],
168
+ },
169
+ ]);
170
+ await wrapper.vm.$nextTick();
171
+
172
+ expect(
173
+ wrapper.find('.wt-layout__resizer').attributes('aria-valuenow'),
174
+ ).toBe('400');
175
+ expect(wrapper.element.style.flexBasis).toBe('480px');
176
+ vi.unstubAllGlobals();
177
+ });
178
+
140
179
  it('resizes with arrow keys', async () => {
141
180
  const { wrapper, layout } = mountPair({
142
181
  resizable: true,
@@ -11,7 +11,7 @@
11
11
  <slot />
12
12
  <div
13
13
  v-if="resizable"
14
- :aria-valuenow="width"
14
+ :aria-valuenow="Math.round(renderedWidth)"
15
15
  :class="`wt-layout__resizer--${resizeEdge}`"
16
16
  aria-orientation="vertical"
17
17
  class="wt-layout__resizer"
@@ -24,6 +24,7 @@
24
24
  </template>
25
25
 
26
26
  <script setup lang="ts">
27
+ import { useElementSize } from '@vueuse/core';
27
28
  import { onBeforeUnmount, ref, useTemplateRef, watch } from 'vue';
28
29
 
29
30
  /**
@@ -56,9 +57,22 @@ const emit = defineEmits<{
56
57
  }>();
57
58
 
58
59
  const KEYBOARD_STEP = 16;
60
+ const KEY_DIRECTION: Partial<Record<string, 1 | -1>> = {
61
+ ArrowLeft: -1,
62
+ ArrowRight: 1,
63
+ };
59
64
 
60
65
  const root = useTemplateRef<HTMLElement>('root');
66
+ /**
67
+ * Preferred width: what the user dragged to. A fixed layout may still render
68
+ * narrower (it shrinks with its container) and returns to this width once
69
+ * there is room again.
70
+ */
61
71
  const width = ref<number | undefined>(props.defaultWidth);
72
+ /** Width actually on screen, kept in sync with container resizes. */
73
+ const { width: renderedWidth } = useElementSize(root, undefined, {
74
+ box: 'border-box',
75
+ });
62
76
  const resizing = ref(false);
63
77
 
64
78
  watch(
@@ -133,10 +147,7 @@ const startResize = (event: PointerEvent) => {
133
147
 
134
148
  const handleResizerKeydown = (event: KeyboardEvent) => {
135
149
  if (!root.value) return;
136
- const keyDirection = {
137
- ArrowLeft: -1,
138
- ArrowRight: 1,
139
- }[event.key];
150
+ const keyDirection = KEY_DIRECTION[event.key];
140
151
  if (!keyDirection) return;
141
152
  event.preventDefault();
142
153