@webitel/ui-sdk 23.12.31 → 23.12.33
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/dist/ui-sdk.common.js +60 -61
- package/dist/ui-sdk.common.js.map +1 -1
- package/dist/ui-sdk.css +1 -1
- package/dist/ui-sdk.umd.js +60 -61
- package/dist/ui-sdk.umd.js.map +1 -1
- package/dist/ui-sdk.umd.min.js +8 -8
- package/dist/ui-sdk.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/wt-input/wt-input.vue +9 -19
- package/src/components/wt-search-bar/wt-search-bar.vue +7 -14
- package/src/components/wt-textarea/wt-textarea.vue +19 -24
- package/src/locale/.DS_Store +0 -0
- package/src/locale/en/en.js +1 -0
- package/src/locale/ru/ru.js +1 -0
- package/src/locale/ua/ua.js +1 -0
- package/src/mixins/validationMixin/useValidation.js +1 -0
- package/src/mixins/validationMixin/validationMixin.js +1 -0
- package/src/validators/websocketValidator/__tests__/websocketValidator.spec.js +4 -4
- package/src/validators/websocketValidator/websocketValidator.js +8 -1
package/package.json
CHANGED
|
@@ -8,22 +8,22 @@
|
|
|
8
8
|
class="wt-input"
|
|
9
9
|
>
|
|
10
10
|
<wt-label
|
|
11
|
-
v-bind="labelProps"
|
|
12
11
|
v-if="hasLabel"
|
|
13
12
|
:disabled="disabled"
|
|
14
13
|
:for="name"
|
|
15
14
|
:invalid="invalid"
|
|
16
15
|
:outline="outline"
|
|
16
|
+
v-bind="labelProps"
|
|
17
17
|
>
|
|
18
18
|
<!-- @slot Custom input label -->
|
|
19
19
|
<slot
|
|
20
|
-
v-bind="{ label }"
|
|
21
20
|
name="label"
|
|
22
|
-
|
|
21
|
+
v-bind="{ label }"
|
|
22
|
+
>{{ requiredLabel }}
|
|
23
|
+
</slot>
|
|
23
24
|
</wt-label>
|
|
24
25
|
<div class="wt-input__wrapper">
|
|
25
26
|
<input
|
|
26
|
-
v-bind="$attrs"
|
|
27
27
|
:id="name"
|
|
28
28
|
ref="wt-input"
|
|
29
29
|
:class="{
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
:type="inputType"
|
|
37
37
|
:value="inputValue"
|
|
38
38
|
class="wt-input__input"
|
|
39
|
+
v-bind="$attrs"
|
|
39
40
|
@input="inputHandler"
|
|
40
41
|
@keyup="$emit('keyup', $event)"
|
|
41
42
|
>
|
|
@@ -47,16 +48,16 @@
|
|
|
47
48
|
name="after-input"
|
|
48
49
|
></slot>
|
|
49
50
|
<slot
|
|
51
|
+
v-if="isPassword"
|
|
52
|
+
name="show-password"
|
|
50
53
|
v-bind="{
|
|
51
54
|
isPasswordVisible,
|
|
52
55
|
switchVisibilityPassword,
|
|
53
56
|
}"
|
|
54
|
-
v-if="isPassword"
|
|
55
|
-
name="show-password"
|
|
56
57
|
>
|
|
57
58
|
<wt-icon-btn
|
|
59
|
+
:disabled="disabled"
|
|
58
60
|
:icon="showPasswordIcon"
|
|
59
|
-
class="wt-input__password-button"
|
|
60
61
|
@click="switchVisibilityPassword"
|
|
61
62
|
></wt-icon-btn>
|
|
62
63
|
</slot>
|
|
@@ -237,7 +238,7 @@ export default {
|
|
|
237
238
|
const afterWrapperWidth = this.$refs['after-wrapper'].offsetWidth;
|
|
238
239
|
const inputEl = this.$refs['wt-input'];
|
|
239
240
|
const defaultInputPadding = getComputedStyle(document.documentElement)
|
|
240
|
-
|
|
241
|
+
.getPropertyValue('--input-padding');
|
|
241
242
|
if (afterWrapperWidth >= inputEl.offsetWidth) return; // fixes https://my.webitel.com/browse/WTEL-2635
|
|
242
243
|
inputEl.style.paddingRight = `calc(${defaultInputPadding} * 2 + ${afterWrapperWidth}px)`;
|
|
243
244
|
},
|
|
@@ -328,16 +329,5 @@ export default {
|
|
|
328
329
|
transform: translateY(-50%);
|
|
329
330
|
pointer-events: auto; // override --disabled p-events none
|
|
330
331
|
gap: var(--input-after-wrapper-gap);
|
|
331
|
-
|
|
332
|
-
.wt-input__password-button {
|
|
333
|
-
.wt-input--disabled & ::v-deep .wt-icon__icon {
|
|
334
|
-
fill: var(--icon-color-disabled);
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
.wt-input:hover & ::v-deep .wt-icon__icon,
|
|
338
|
-
.wt-input:focus-within & ::v-deep .wt-icon__icon {
|
|
339
|
-
fill: var(--icon-color--hover);
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
332
|
}
|
|
343
333
|
</style>
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
<div class="wt-search-bar__icon-controls">
|
|
30
30
|
<wt-icon-btn
|
|
31
31
|
:class="{ 'hidden': !value }"
|
|
32
|
+
:color="invalidColorProvider"
|
|
32
33
|
class="wt-search-bar__reset-icon-btn"
|
|
33
34
|
icon="close"
|
|
34
|
-
:color="invalidColorProvider"
|
|
35
35
|
@click="handleInput('')"
|
|
36
36
|
></wt-icon-btn>
|
|
37
37
|
<wt-hint
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
|
|
51
51
|
<script setup>
|
|
52
52
|
import { computed, toRefs } from 'vue';
|
|
53
|
-
import debounce from '../../scripts/debounce';
|
|
54
53
|
import { useValidation } from '../../mixins/validationMixin/useValidation';
|
|
54
|
+
import debounce from '../../scripts/debounce';
|
|
55
55
|
|
|
56
56
|
const props = defineProps({
|
|
57
57
|
v: {
|
|
@@ -94,9 +94,7 @@ const { v, customValidators } = toRefs(props);
|
|
|
94
94
|
|
|
95
95
|
const { invalid } = useValidation({ v, customValidators });
|
|
96
96
|
|
|
97
|
-
const invalidColorProvider = computed(() =>
|
|
98
|
-
return invalid.value ? 'error' : null;
|
|
99
|
-
});
|
|
97
|
+
const invalidColorProvider = computed(() => (invalid.value ? 'error' : 'default'));
|
|
100
98
|
|
|
101
99
|
const search = debounce((value) => {
|
|
102
100
|
emit('search', value);
|
|
@@ -132,18 +130,19 @@ function handleKeyup(event) {
|
|
|
132
130
|
border-color: var(--false-color);
|
|
133
131
|
outline: none; // prevent outline overlapping false color
|
|
134
132
|
}
|
|
133
|
+
|
|
135
134
|
.wt-search-bar__input {
|
|
136
135
|
color: var(--false-color);
|
|
137
136
|
}
|
|
138
137
|
}
|
|
139
138
|
|
|
140
139
|
.wt-search-bar__wrapper {
|
|
140
|
+
display: flex;
|
|
141
|
+
align-items: center;
|
|
142
|
+
padding: calc(var(--spacing-xs) - 1px) var(--spacing-xs);
|
|
141
143
|
border: var(--input-border);
|
|
142
144
|
border-color: var(--form-border-color);
|
|
143
145
|
border-radius: var(--border-radius);
|
|
144
|
-
display: flex;
|
|
145
|
-
padding: calc(var(--spacing-xs) - 1px) var(--spacing-xs);
|
|
146
|
-
align-items: center;
|
|
147
146
|
gap: var(--spacing-xs);
|
|
148
147
|
}
|
|
149
148
|
|
|
@@ -186,12 +185,6 @@ function handleKeyup(event) {
|
|
|
186
185
|
}
|
|
187
186
|
}
|
|
188
187
|
|
|
189
|
-
/* make icons black */
|
|
190
|
-
.wt-search-bar:hover ::v-deep .wt-icon__icon,
|
|
191
|
-
.wt-search-bar:focus-within ::v-deep .wt-icon__icon {
|
|
192
|
-
fill: var(--icon-color--hover);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
188
|
/* clears the 'X' from Internet Explorer */
|
|
196
189
|
.wt-search-bar__input::-ms-clear {
|
|
197
190
|
display: none;
|
|
@@ -1,41 +1,42 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
|
-
class="wt-textarea"
|
|
4
3
|
:class="{
|
|
5
4
|
'wt-textarea--disabled': disabled,
|
|
6
5
|
'wt-textarea--invalid': invalid,
|
|
7
6
|
}"
|
|
7
|
+
class="wt-textarea"
|
|
8
8
|
>
|
|
9
9
|
<wt-label
|
|
10
|
-
v-bind="labelProps"
|
|
11
|
-
:for="name"
|
|
12
10
|
:disabled="disabled"
|
|
11
|
+
:for="name"
|
|
13
12
|
:invalid="invalid"
|
|
13
|
+
v-bind="labelProps"
|
|
14
14
|
>
|
|
15
15
|
<!-- @slot Custom input label -->
|
|
16
16
|
<slot
|
|
17
|
-
v-bind="{ label }"
|
|
18
17
|
name="label"
|
|
19
|
-
|
|
18
|
+
v-bind="{ label }"
|
|
19
|
+
>{{ requiredLabel }}
|
|
20
|
+
</slot>
|
|
20
21
|
</wt-label>
|
|
21
22
|
<div class="wt-textarea__wrapper">
|
|
22
23
|
<textarea
|
|
23
24
|
:id="name"
|
|
24
25
|
ref="wt-textarea"
|
|
25
|
-
class="wt-textarea__textarea"
|
|
26
|
-
:value="value"
|
|
27
|
-
:placeholder="placeholder || label"
|
|
28
26
|
:disabled="disabled"
|
|
27
|
+
:placeholder="placeholder || label"
|
|
28
|
+
:value="value"
|
|
29
|
+
class="wt-textarea__textarea"
|
|
29
30
|
v-on="listeners"
|
|
30
31
|
></textarea>
|
|
31
|
-
<div
|
|
32
|
+
<div ref="after-wrapper" class="wt-textarea__after-wrapper">
|
|
32
33
|
<slot name="after-input"></slot>
|
|
33
34
|
<wt-icon-btn
|
|
34
|
-
class="wt-textarea__reset-icon-btn"
|
|
35
35
|
:class="{ 'hidden': !value }"
|
|
36
|
+
:disabled="disabled"
|
|
37
|
+
class="wt-textarea__reset-icon-btn"
|
|
36
38
|
icon="close--filled"
|
|
37
39
|
size="sm"
|
|
38
|
-
:disabled="disabled"
|
|
39
40
|
@click="$emit('input', '')"
|
|
40
41
|
></wt-icon-btn>
|
|
41
42
|
</div>
|
|
@@ -174,16 +175,16 @@ export default {
|
|
|
174
175
|
@include wt-placeholder;
|
|
175
176
|
|
|
176
177
|
display: block;
|
|
178
|
+
box-sizing: border-box;
|
|
177
179
|
width: 100%;
|
|
178
180
|
min-height: var(--textarea-min-height);
|
|
179
|
-
box-sizing: border-box;
|
|
180
181
|
padding: var(--textarea-padding);
|
|
182
|
+
resize: none;
|
|
183
|
+
transition: var(--transition);
|
|
181
184
|
color: var(--form-input-color);
|
|
182
185
|
border: var(--input-border);
|
|
183
186
|
border-color: var(--form-border-color);
|
|
184
187
|
border-radius: var(--border-radius);
|
|
185
|
-
transition: var(--transition);
|
|
186
|
-
resize: none;
|
|
187
188
|
|
|
188
189
|
&:focus {
|
|
189
190
|
@include wt-placeholder('focus');
|
|
@@ -194,8 +195,8 @@ export default {
|
|
|
194
195
|
.wt-textarea--disabled & {
|
|
195
196
|
@include wt-placeholder('disabled');
|
|
196
197
|
|
|
197
|
-
background: var(--form-border--disabled-color);
|
|
198
198
|
border-color: var(--form-border--disabled-color);
|
|
199
|
+
background: var(--form-border--disabled-color);
|
|
199
200
|
}
|
|
200
201
|
|
|
201
202
|
.wt-textarea--invalid &,
|
|
@@ -205,19 +206,13 @@ export default {
|
|
|
205
206
|
}
|
|
206
207
|
}
|
|
207
208
|
|
|
208
|
-
/* make icons black */
|
|
209
|
-
.wt-textarea:hover ::v-deep .wt-icon-btn:not(.wt-textarea__reset-icon-btn) .wt-icon__icon,
|
|
210
|
-
.wt-textarea:focus-within ::v-deep .wt-icon-btn:not(.wt-textarea__reset-icon-btn) .wt-icon__icon {
|
|
211
|
-
fill: var(--icon-color--hover);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
209
|
.wt-textarea__after-wrapper {
|
|
215
|
-
display: flex;
|
|
216
|
-
gap: var(--input-after-wrapper-gap);
|
|
217
|
-
align-items: center;
|
|
218
210
|
position: absolute;
|
|
219
211
|
top: var(--input-icon-margin);
|
|
220
212
|
right: var(--input-icon-margin);
|
|
213
|
+
display: flex;
|
|
214
|
+
align-items: center;
|
|
221
215
|
pointer-events: auto; // override --disabled p-events none
|
|
216
|
+
gap: var(--input-after-wrapper-gap);
|
|
222
217
|
}
|
|
223
218
|
</style>
|
|
Binary file
|
package/src/locale/en/en.js
CHANGED
|
@@ -248,6 +248,7 @@ export default {
|
|
|
248
248
|
requiredArrayValue: 'Array should not be empty',
|
|
249
249
|
minLength: 'Quantity of characters should not be less than',
|
|
250
250
|
url: 'Should look like url',
|
|
251
|
+
websocketValidator: 'Should look like WebSocket url',
|
|
251
252
|
regExpValidator: 'This regular expression is not valid',
|
|
252
253
|
domainValidator: 'Incorrect domain',
|
|
253
254
|
decimalValidator: 'Decimal precision should be no more than { count } places',
|
package/src/locale/ru/ru.js
CHANGED
|
@@ -246,6 +246,7 @@ export default {
|
|
|
246
246
|
requiredArrayValue: 'Поле не должно быть пустым',
|
|
247
247
|
minLength: 'Количество символов не должно быть меньше, чем',
|
|
248
248
|
url: 'Необходимо ввести корректный url-адрес',
|
|
249
|
+
websocketValidator: 'Необходимо ввести корректный WebSocket url-адрес',
|
|
249
250
|
regExpValidator: 'Не правильное регулярное выражение',
|
|
250
251
|
domainValidator: 'Неправильный домен',
|
|
251
252
|
decimalValidator: 'Количество десятичных знаков не должно быть больше { count }',
|
package/src/locale/ua/ua.js
CHANGED
|
@@ -246,6 +246,7 @@ export default {
|
|
|
246
246
|
requiredArrayValue: 'Поле не повинно бути пустим',
|
|
247
247
|
minLength: 'Кількість символів повинна бути не меншою, ніж',
|
|
248
248
|
url: 'Необхідно ввести правильну url-адресу',
|
|
249
|
+
websocketValidator: 'Необхідно ввести правильну WebSocket url-адресу',
|
|
249
250
|
regExpValidator: 'Не правильний регулярний вираз',
|
|
250
251
|
domainValidator: 'Невірний домен',
|
|
251
252
|
decimalValidator: 'Кількість десяткових знаків не повинна бути більше { count }',
|
|
@@ -24,6 +24,7 @@ export function useValidation({ v, customValidators }) {
|
|
|
24
24
|
else if (v.value.sameAs?.$invalid) validationText = `${t('validation.sameAs')}`;
|
|
25
25
|
else if (v.value.domainValidator?.$invalid) validationText = `${t('validation.domainValidator')}`;
|
|
26
26
|
else if (v.value.decimalValidator?.$invalid) validationText = `${t('validation.decimalValidator')} ${v.value.decimalValidator.$params.count}`;
|
|
27
|
+
else if (v.value.websocketValidator?.$invalid) validationText = `${t('validation.websocketValidator')}`;
|
|
27
28
|
else if (v.value.integer?.$invalid) validationText = `${t('validation.integer')}`;
|
|
28
29
|
}
|
|
29
30
|
// eslint-disable-next-line no-restricted-syntax
|
|
@@ -34,6 +34,7 @@ export default {
|
|
|
34
34
|
else if (this.v.sameAs?.$invalid) validationText = `${this.$t('validation.sameAs')}`;
|
|
35
35
|
else if (this.v.domainValidator?.$invalid) validationText = `${this.$t('validation.domainValidator')}`;
|
|
36
36
|
else if (this.v.decimalValidator?.$invalid) validationText = `${this.$t('validation.decimalValidator')} ${this.v.decimalValidator.$params.count}`;
|
|
37
|
+
else if (this.v.websocketValidator?.$invalid) validationText = `${this.$t('validation.websocketValidator')}`;
|
|
37
38
|
else if (this.v.integer?.$invalid) validationText = `${this.$t('validation.integer')}`;
|
|
38
39
|
}
|
|
39
40
|
// eslint-disable-next-line no-restricted-syntax
|
|
@@ -14,15 +14,15 @@ describe('websocketValidator', () => {
|
|
|
14
14
|
expect(websocketValidator('wss://example.com')).toBe(true);
|
|
15
15
|
});
|
|
16
16
|
it('truthy case 5: dns name', () => {
|
|
17
|
-
expect(websocketValidator('wss://example
|
|
17
|
+
expect(websocketValidator('wss://example')).toBe(true);
|
|
18
18
|
});
|
|
19
19
|
it('truthy case 6: dns name', () => {
|
|
20
|
+
expect(websocketValidator('wss://example.com/ws')).toBe(true);
|
|
21
|
+
});
|
|
22
|
+
it('truthy case 7: dns name', () => {
|
|
20
23
|
expect(websocketValidator('wss://socket.socket.com/v3/channel_123?api_key=123')).toBe(true);
|
|
21
24
|
});
|
|
22
25
|
it('falsy case 1: empty string', () => {
|
|
23
26
|
expect(websocketValidator('')).toBe(false);
|
|
24
27
|
});
|
|
25
|
-
it('falsy case 2: ws+ws', () => {
|
|
26
|
-
expect(websocketValidator('wss://example.com/wswss://example.com/ws')).toBe(false);
|
|
27
|
-
});
|
|
28
28
|
});
|
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
// That's strange but i haven't found any npm package with websocket validator
|
|
2
|
-
export default (value) =>
|
|
2
|
+
export default (value) => {
|
|
3
|
+
try {
|
|
4
|
+
const url = new URL(value);
|
|
5
|
+
return (/^(wss?)/i).test(url.protocol);
|
|
6
|
+
} catch (e) {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
};
|