@webitel/ui-sdk 26.8.98 → 26.8.99

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-Bbzj_P4l.js";
1
+ import "./components-CMBVRgca.js";
2
2
  import { t as e } from "./_plugin-vue_export-helper-B3ysoDQm.js";
3
3
  import { l as t } from "./enums-B_9ZBu01.js";
4
4
  import { t as n } from "./wt-button-CNQAK85M.js";
@@ -1,4 +1,4 @@
1
- import { C as e, i as t } from "./components-Bbzj_P4l.js";
1
+ import { C as e, i as t } from "./components-CMBVRgca.js";
2
2
  import { t as n } from "./_plugin-vue_export-helper-B3ysoDQm.js";
3
3
  import { s as r } from "./utils-DReAiJBV.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,5 +1,5 @@
1
- import { n as e, r as t } from "./clients-D7xoQatS.js";
2
- import { n } from "./components-Bbzj_P4l.js";
1
+ import { n as e, r as t } from "./clients-DenpsPyu.js";
2
+ import { n } from "./components-CMBVRgca.js";
3
3
  import { t as r } from "./vue-i18n-B88GcHzn.js";
4
4
  import { n as i } from "./useEventBus-B-ZeklLu.js";
5
5
  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,5 +1,5 @@
1
- import { t as e } from "./clients-D7xoQatS.js";
2
- import { a as t, o as n, r, s as i } from "./components-Bbzj_P4l.js";
1
+ import { t as e } from "./clients-DenpsPyu.js";
2
+ import { a as t, o as n, r, s as i } from "./components-CMBVRgca.js";
3
3
  import { t as a } from "./enums-B_9ZBu01.js";
4
4
  import { t as o } from "./vue-i18n-B88GcHzn.js";
5
5
  import { computed as s, createBlock as c, createCommentVNode as l, createVNode as u, defineComponent as d, mergeModels as f, mergeProps as p, openBlock as m, renderSlot as h, resolveComponent as g, unref as _, useModel as v } from "vue";
@@ -1,4 +1,4 @@
1
- import { D as e } from "./components-Bbzj_P4l.js";
1
+ import { D as e } from "./components-CMBVRgca.js";
2
2
  import { t } from "./_plugin-vue_export-helper-B3ysoDQm.js";
3
3
  import { l as n } from "./enums-B_9ZBu01.js";
4
4
  import "./wt-button-CNQAK85M.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webitel/ui-sdk",
3
- "version": "26.8.98",
3
+ "version": "26.8.99",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "npm run docs:dev",
@@ -28,32 +28,55 @@ describe('WtInputText', () => {
28
28
  expect(wrapper.find('.wt-label').text()).toBe('Name');
29
29
  });
30
30
 
31
- it('trims the value by default on input', () => {
31
+ it('does not trim the value on input', () => {
32
32
  const wrapper = mount(WtInputText);
33
33
  const input = wrapper.findComponent({
34
34
  name: 'InputText',
35
35
  });
36
36
  input.vm.$emit('update:model-value', ' hello ');
37
37
  expect(wrapper.emitted()['update:modelValue'][0]).toEqual([
38
- 'hello',
38
+ ' hello ',
39
39
  ]);
40
40
  });
41
41
 
42
- it('does not trim the value when preventTrim is true', () => {
42
+ it('trims the value on blur by default', async () => {
43
43
  const wrapper = mount(WtInputText, {
44
44
  props: {
45
- preventTrim: true,
45
+ modelValue: ' hello ',
46
46
  },
47
47
  });
48
48
  const input = wrapper.findComponent({
49
49
  name: 'InputText',
50
50
  });
51
- input.vm.$emit('update:model-value', ' hello ');
51
+ await input.vm.$emit('blur', new Event('blur'));
52
52
  expect(wrapper.emitted()['update:modelValue'][0]).toEqual([
53
- ' hello ',
53
+ 'hello',
54
54
  ]);
55
55
  });
56
56
 
57
+ it('does not trim the value on blur when preventTrim is true', async () => {
58
+ const wrapper = mount(WtInputText, {
59
+ props: {
60
+ modelValue: ' hello ',
61
+ preventTrim: true,
62
+ },
63
+ });
64
+ const input = wrapper.findComponent({
65
+ name: 'InputText',
66
+ });
67
+ await input.vm.$emit('blur', new Event('blur'));
68
+ expect(wrapper.emitted()['update:modelValue']).toBeFalsy();
69
+ });
70
+
71
+ it('emits blur when the underlying input is blurred', async () => {
72
+ const wrapper = mount(WtInputText);
73
+ const input = wrapper.findComponent({
74
+ name: 'InputText',
75
+ });
76
+ await input.vm.$emit('blur', new Event('blur'));
77
+ expect(wrapper.emitted().blur).toBeTruthy();
78
+ });
79
+
57
80
  it('toggles the eye icon and masks the input when hideInputValue is true', async () => {
58
81
  const wrapper = mount(WtInputText, {
59
82
  props: {
@@ -37,6 +37,7 @@
37
37
  @update:model-value="inputHandler"
38
38
  @keyup="handleKeyup"
39
39
  @focus="emit('focus', $event)"
40
+ @blur="handleBlur"
40
41
  />
41
42
  <p-input-group-addon
42
43
  v-if="hideInputValue || $slots.suffix"
@@ -135,6 +136,9 @@ const emit = defineEmits<{
135
136
  focus: [
136
137
  FocusEvent,
137
138
  ];
139
+ blur: [
140
+ FocusEvent,
141
+ ];
138
142
  }>();
139
143
 
140
144
  const slots = useSlots();
@@ -170,8 +174,14 @@ const requiredLabel = computed(() => {
170
174
  });
171
175
 
172
176
  const inputHandler = (value: string) => {
173
- const handledValue = props.preventTrim ? value : value.trim();
174
- model.value = handledValue;
177
+ model.value = value;
178
+ };
179
+
180
+ const handleBlur = (event: FocusEvent) => {
181
+ if (!props.preventTrim && typeof model.value === 'string') {
182
+ model.value = model.value.trim();
183
+ }
184
+ emit('blur', event);
175
185
  };
176
186
 
177
187
  const isValueHidden = ref(props.hideInputValue);