@webitel/ui-sdk 2.0.4 → 2.0.5-4
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/img/sprite/index.js +1 -1
- package/dist/img/sprite/instagram.svg +28 -0
- package/dist/ui-sdk.common.js +1251 -1220
- package/dist/ui-sdk.common.js.map +1 -1
- package/dist/ui-sdk.css +1 -1
- package/dist/ui-sdk.umd.js +1251 -1220
- package/dist/ui-sdk.umd.js.map +1 -1
- package/dist/ui-sdk.umd.min.js +3 -3
- package/dist/ui-sdk.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/wt-context-menu/wt-context-menu.vue +13 -3
- package/src/components/molecules/wt-input/wt-input.vue +216 -213
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
placement="bottom-end"
|
|
7
7
|
>
|
|
8
8
|
<slot name="activator"></slot>
|
|
9
|
-
<template #popper>
|
|
9
|
+
<template #popper="{ hide }">
|
|
10
10
|
<ul class="wt-context-menu__menu">
|
|
11
11
|
<li
|
|
12
12
|
class="wt-context-menu__option-wrapper"
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<a
|
|
18
18
|
class="wt-context-menu__option"
|
|
19
19
|
href="#"
|
|
20
|
-
@click.prevent="
|
|
20
|
+
@click.prevent="handleOptionClick({ option, index, hide })"
|
|
21
21
|
>
|
|
22
22
|
{{ option.text || option }}
|
|
23
23
|
</a>
|
|
@@ -38,13 +38,23 @@ export default {
|
|
|
38
38
|
},
|
|
39
39
|
visible: {
|
|
40
40
|
type: Boolean,
|
|
41
|
-
default:
|
|
41
|
+
default: false,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
methods: {
|
|
45
|
+
handleOptionClick({ option, index, hide }) {
|
|
46
|
+
this.$emit('click', { option, index });
|
|
47
|
+
hide();
|
|
42
48
|
},
|
|
43
49
|
},
|
|
44
50
|
};
|
|
45
51
|
</script>
|
|
46
52
|
|
|
47
53
|
<style lang="scss" scoped>
|
|
54
|
+
.wt-context-menu {
|
|
55
|
+
line-height: 0;
|
|
56
|
+
}
|
|
57
|
+
|
|
48
58
|
.wt-context-menu__menu {
|
|
49
59
|
@extend %typo-body-2;
|
|
50
60
|
min-width: var(--context-menu-min-width);
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
|
-
class="wt-input"
|
|
4
3
|
:class="{
|
|
5
4
|
'wt-input--outline': outline,
|
|
6
5
|
'wt-input--disabled': disabled,
|
|
7
6
|
'wt-input--invalid': invalid,
|
|
8
7
|
}"
|
|
8
|
+
class="wt-input"
|
|
9
9
|
>
|
|
10
10
|
<wt-label
|
|
11
11
|
v-if="hasLabel"
|
|
12
|
-
:for="name"
|
|
13
|
-
:outline="outline"
|
|
14
12
|
:disabled="disabled"
|
|
13
|
+
:for="name"
|
|
15
14
|
:invalid="invalid"
|
|
15
|
+
:outline="outline"
|
|
16
16
|
v-bind="labelProps"
|
|
17
17
|
>
|
|
18
18
|
<!-- @slot Custom input label -->
|
|
@@ -21,22 +21,22 @@
|
|
|
21
21
|
<div class="wt-input__wrapper">
|
|
22
22
|
<input
|
|
23
23
|
:id="name"
|
|
24
|
-
|
|
24
|
+
ref="wt-input"
|
|
25
25
|
:class="{
|
|
26
26
|
'wt-input--is-password': isPassword,
|
|
27
27
|
}"
|
|
28
|
-
ref="wt-input"
|
|
29
|
-
:value="value"
|
|
30
|
-
:type="inputType"
|
|
31
|
-
:placeholder="placeholder || label"
|
|
32
28
|
:disabled="disabled"
|
|
33
|
-
:min="numberMin"
|
|
34
29
|
:max="numberMax"
|
|
30
|
+
:min="numberMin"
|
|
31
|
+
:placeholder="placeholder || label"
|
|
32
|
+
:type="inputType"
|
|
33
|
+
:value="value"
|
|
34
|
+
class="wt-input__input"
|
|
35
35
|
v-on="listeners"
|
|
36
36
|
>
|
|
37
37
|
<div
|
|
38
|
-
class="wt-input__after-wrapper"
|
|
39
38
|
ref="after-wrapper"
|
|
39
|
+
class="wt-input__after-wrapper"
|
|
40
40
|
>
|
|
41
41
|
<slot
|
|
42
42
|
name="after-input"
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
}"
|
|
51
51
|
>
|
|
52
52
|
<wt-icon-btn
|
|
53
|
-
class="wt-input__password-button"
|
|
54
53
|
:icon="showPasswordIcon"
|
|
54
|
+
class="wt-input__password-button"
|
|
55
55
|
@click.native="switchVisibilityPassword"
|
|
56
56
|
></wt-icon-btn>
|
|
57
57
|
</slot>
|
|
@@ -69,254 +69,257 @@
|
|
|
69
69
|
import validationMixin from '../../../mixins/validationMixin/validationMixin';
|
|
70
70
|
|
|
71
71
|
export default {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
72
|
+
name: 'wt-input',
|
|
73
|
+
mixins: [validationMixin],
|
|
74
|
+
props: {
|
|
75
|
+
/**
|
|
76
|
+
* Current input value (`v-model`)
|
|
77
|
+
*/
|
|
78
|
+
value: {
|
|
79
|
+
type: [String, Number],
|
|
80
|
+
default: '',
|
|
81
|
+
},
|
|
82
|
+
/**
|
|
83
|
+
* Form input label
|
|
84
|
+
*/
|
|
85
|
+
label: {
|
|
86
|
+
type: String,
|
|
87
|
+
default: '',
|
|
88
|
+
},
|
|
89
|
+
/**
|
|
90
|
+
* Form input placeholder
|
|
91
|
+
*/
|
|
92
|
+
placeholder: {
|
|
93
|
+
type: String,
|
|
94
|
+
},
|
|
95
|
+
/**
|
|
96
|
+
* Form input name
|
|
97
|
+
*/
|
|
98
|
+
name: {
|
|
99
|
+
type: String,
|
|
100
|
+
default: '',
|
|
101
|
+
},
|
|
102
|
+
/**
|
|
103
|
+
* Form input type
|
|
104
|
+
*/
|
|
105
|
+
type: {
|
|
106
|
+
type: String,
|
|
107
|
+
default: 'text',
|
|
108
|
+
},
|
|
109
|
+
/**
|
|
110
|
+
* Native input required attribute
|
|
111
|
+
*/
|
|
112
|
+
required: {
|
|
113
|
+
type: Boolean,
|
|
114
|
+
default: false,
|
|
115
|
+
description: 'Native input required attribute',
|
|
116
|
+
},
|
|
117
|
+
/**
|
|
118
|
+
* Native input disabled attribute
|
|
119
|
+
*/
|
|
120
|
+
disabled: {
|
|
121
|
+
type: Boolean,
|
|
122
|
+
default: false,
|
|
123
|
+
description: 'Native input disabled attribute',
|
|
124
|
+
},
|
|
125
|
+
/**
|
|
126
|
+
* Status of show password icon display
|
|
127
|
+
*/
|
|
128
|
+
hasShowPassword: {
|
|
129
|
+
type: Boolean,
|
|
130
|
+
default: false,
|
|
131
|
+
},
|
|
132
132
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
133
|
+
/**
|
|
134
|
+
* Native number input restrictions
|
|
135
|
+
*/
|
|
136
|
+
numberMin: {
|
|
137
|
+
type: Number,
|
|
138
|
+
default: 0,
|
|
139
|
+
},
|
|
140
140
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
141
|
+
/**
|
|
142
|
+
* Native number input restrictions
|
|
143
|
+
*/
|
|
144
|
+
numberMax: {
|
|
145
|
+
type: Number,
|
|
146
|
+
},
|
|
147
147
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
148
|
+
outline: {
|
|
149
|
+
type: Boolean,
|
|
150
|
+
default: false,
|
|
151
|
+
},
|
|
152
152
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
},
|
|
153
|
+
labelProps: {
|
|
154
|
+
type: Object,
|
|
155
|
+
description: 'Object with props, passed down to wt-label as props',
|
|
157
156
|
},
|
|
157
|
+
},
|
|
158
158
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
159
|
+
data: () => ({
|
|
160
|
+
inputType: '',
|
|
161
|
+
isPasswordVisible: false,
|
|
162
|
+
}),
|
|
163
163
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
}
|
|
164
|
+
watch: {
|
|
165
|
+
type: {
|
|
166
|
+
immediate: true,
|
|
167
|
+
handler(type) {
|
|
168
|
+
let inputType = type;
|
|
169
|
+
// Safari has bug for number input
|
|
170
|
+
if (typeof window !== 'undefined' || typeof document !== 'undefined') {
|
|
171
|
+
const ua = navigator.userAgent.toLocaleLowerCase();
|
|
172
|
+
if (
|
|
173
|
+
ua.indexOf('safari') !== -1
|
|
174
|
+
&& ua.indexOf('chrome') === -1
|
|
175
|
+
&& type === 'number'
|
|
176
|
+
) {
|
|
177
|
+
this.isNumberTypeSafari = true;
|
|
178
|
+
inputType = 'text';
|
|
180
179
|
}
|
|
181
|
-
|
|
182
|
-
|
|
180
|
+
}
|
|
181
|
+
this.inputType = inputType;
|
|
183
182
|
},
|
|
184
183
|
},
|
|
184
|
+
},
|
|
185
185
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
186
|
+
computed: {
|
|
187
|
+
hasLabel() {
|
|
188
|
+
return !!(this.label || this.$slots.label);
|
|
189
|
+
},
|
|
190
190
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
191
|
+
requiredLabel() {
|
|
192
|
+
return this.required ? `${this.label}*` : this.label;
|
|
193
|
+
},
|
|
194
194
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
195
|
+
isPassword() {
|
|
196
|
+
return this.type === 'password' && this.hasShowPassword;
|
|
197
|
+
},
|
|
198
198
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
199
|
+
showPasswordIcon() {
|
|
200
|
+
return this.isPasswordVisible ? 'eye--closed' : 'eye--opened';
|
|
201
|
+
},
|
|
202
202
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
203
|
+
listeners() {
|
|
204
|
+
return {
|
|
205
|
+
...this.$listeners,
|
|
206
|
+
input: this.inputHandler,
|
|
207
|
+
};
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
methods: {
|
|
211
|
+
inputHandler(event) {
|
|
212
|
+
this.$emit('input', event.target.value.trim());
|
|
209
213
|
},
|
|
210
|
-
methods: {
|
|
211
|
-
inputHandler(event) {
|
|
212
|
-
this.$emit('input', event.target.value.trim());
|
|
213
|
-
},
|
|
214
214
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
215
|
+
switchVisibilityPassword() {
|
|
216
|
+
this.isPasswordVisible = !this.isPasswordVisible;
|
|
217
|
+
this.inputType = this.isPasswordVisible ? 'text' : 'password';
|
|
218
|
+
},
|
|
219
219
|
|
|
220
|
-
|
|
220
|
+
async updateInputPaddings() {
|
|
221
|
+
this.setTimeout(() => {
|
|
221
222
|
// cant test this thing cause vue test utils doesnt render elements width :/
|
|
222
223
|
const afterWrapperWidth = this.$refs['after-wrapper'].offsetWidth;
|
|
223
224
|
const inputEl = this.$refs['wt-input'];
|
|
224
225
|
const defaultInputPadding = getComputedStyle(document.documentElement)
|
|
225
226
|
.getPropertyValue('--input-padding');
|
|
227
|
+
console.info('ipnut:', defaultInputPadding, afterWrapperWidth, defaultInputPadding * 2 + afterWrapperWidth);
|
|
226
228
|
inputEl.style.paddingRight = `calc(${defaultInputPadding} * 2 + ${afterWrapperWidth}px)`;
|
|
227
|
-
},
|
|
228
|
-
},
|
|
229
|
-
mounted() {
|
|
230
|
-
this.updateInputPaddings();
|
|
229
|
+
}, 100);
|
|
231
230
|
},
|
|
231
|
+
},
|
|
232
|
+
mounted() {
|
|
233
|
+
this.updateInputPaddings();
|
|
234
|
+
},
|
|
232
235
|
};
|
|
233
236
|
</script>
|
|
234
237
|
|
|
235
238
|
<style lang="scss" scoped>
|
|
236
|
-
|
|
237
|
-
|
|
239
|
+
.wt-input {
|
|
240
|
+
cursor: text;
|
|
238
241
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
}
|
|
242
|
+
&--disabled {
|
|
243
|
+
pointer-events: none;
|
|
242
244
|
}
|
|
245
|
+
}
|
|
243
246
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
+
.wt-input__wrapper {
|
|
248
|
+
position: relative;
|
|
249
|
+
}
|
|
247
250
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
251
|
+
.wt-label {
|
|
252
|
+
.wt-input:hover &,
|
|
253
|
+
.wt-input:focus-within & {
|
|
254
|
+
color: var(--form-label--hover-color);
|
|
255
|
+
}
|
|
253
256
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
}
|
|
257
|
+
.wt-input--invalid:hover &,
|
|
258
|
+
.wt-input--invalid:focus-within & {
|
|
259
|
+
color: var(--label--invalid-color);
|
|
258
260
|
}
|
|
261
|
+
}
|
|
259
262
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
+
.wt-input__input {
|
|
264
|
+
@extend %typo-body-1;
|
|
265
|
+
@include wt-placeholder;
|
|
263
266
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
267
|
+
display: block;
|
|
268
|
+
box-sizing: border-box;
|
|
269
|
+
width: 100%;
|
|
270
|
+
padding: var(--input-padding);
|
|
271
|
+
transition: var(--transition);
|
|
272
|
+
color: var(--form-input-color);
|
|
273
|
+
border: var(--input-border);
|
|
274
|
+
border-color: var(--form-border-color);
|
|
275
|
+
border-radius: var(--border-radius);
|
|
273
276
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
277
|
+
&:focus {
|
|
278
|
+
@include wt-placeholder('focus');
|
|
279
|
+
border-color: var(--form-border--hover-color);
|
|
280
|
+
}
|
|
278
281
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
+
.wt-input--outline & {
|
|
283
|
+
border-color: var(--form-outline-border-color);
|
|
284
|
+
}
|
|
282
285
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
286
|
+
.wt-input--outline:hover &,
|
|
287
|
+
.wt-input--outline &:focus {
|
|
288
|
+
border-color: var(--form-outline-border--hover-color);
|
|
289
|
+
}
|
|
287
290
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
291
|
+
.wt-input--invalid &,
|
|
292
|
+
.wt-input--invalid:hover & {
|
|
293
|
+
border-color: var(--false-color);
|
|
294
|
+
outline: none; // prevent outline overlapping false color
|
|
295
|
+
}
|
|
293
296
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
}
|
|
297
|
+
.wt-input--disabled & {
|
|
298
|
+
@include wt-placeholder('disabled');
|
|
299
|
+
border-color: var(--form-border--disabled-color);
|
|
300
|
+
background: var(--form-border--disabled-color);
|
|
299
301
|
}
|
|
302
|
+
}
|
|
300
303
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
304
|
+
.wt-input__after-wrapper {
|
|
305
|
+
position: absolute;
|
|
306
|
+
top: 50%;
|
|
307
|
+
right: var(--input-icon-margin);
|
|
308
|
+
display: flex;
|
|
309
|
+
align-items: center;
|
|
310
|
+
transform: translateY(-50%);
|
|
311
|
+
pointer-events: auto; // override --disabled p-events none
|
|
312
|
+
gap: var(--input-after-wrapper-gap);
|
|
310
313
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
314
|
+
.wt-input__password-button {
|
|
315
|
+
.wt-input--disabled & ::v-deep .wt-icon__icon {
|
|
316
|
+
fill: var(--icon-color-disabled);
|
|
317
|
+
}
|
|
315
318
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
}
|
|
319
|
+
.wt-input:hover & ::v-deep .wt-icon__icon,
|
|
320
|
+
.wt-input:focus-within & ::v-deep .wt-icon__icon {
|
|
321
|
+
fill: var(--icon-color--hover);
|
|
320
322
|
}
|
|
321
323
|
}
|
|
324
|
+
}
|
|
322
325
|
</style>
|