@webitel/ui-sdk 2.0.6 → 2.0.9

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": "2.0.6",
3
+ "version": "2.0.9",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve-lib": "vue-cli-service serve",
@@ -7,6 +7,7 @@
7
7
  :popper-class="[
8
8
  'wt-tooltip__popper',
9
9
  { 'wt-tooltip--contrast__popper': contrast },
10
+ popperClass,
10
11
  ]"
11
12
  :triggers="['hover', 'focus', 'touch']"
12
13
  class="wt-tooltip"
@@ -30,6 +31,10 @@ export default {
30
31
  type: String,
31
32
  default: 'auto',
32
33
  },
34
+ popperClass: {
35
+ type: String,
36
+ default: '',
37
+ },
33
38
  },
34
39
  };
35
40
  </script>
@@ -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
- class="wt-input__input"
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,255 @@
69
69
  import validationMixin from '../../../mixins/validationMixin/validationMixin';
70
70
 
71
71
  export default {
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
- },
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
- * Native number input restrictions
135
- */
136
- numberMin: {
137
- type: Number,
138
- default: 0,
139
- },
133
+ /**
134
+ * Native number input restrictions
135
+ */
136
+ numberMin: {
137
+ type: Number,
138
+ default: 0,
139
+ },
140
140
 
141
- /**
142
- * Native number input restrictions
143
- */
144
- numberMax: {
145
- type: Number,
146
- },
141
+ /**
142
+ * Native number input restrictions
143
+ */
144
+ numberMax: {
145
+ type: Number,
146
+ },
147
147
 
148
- outline: {
149
- type: Boolean,
150
- default: false,
151
- },
148
+ outline: {
149
+ type: Boolean,
150
+ default: false,
151
+ },
152
152
 
153
- labelProps: {
154
- type: Object,
155
- description: 'Object with props, passed down to wt-label as props',
156
- },
153
+ labelProps: {
154
+ type: Object,
155
+ description: 'Object with props, passed down to wt-label as props',
157
156
  },
157
+ },
158
158
 
159
- data: () => ({
160
- inputType: '',
161
- isPasswordVisible: false,
162
- }),
159
+ data: () => ({
160
+ inputType: '',
161
+ isPasswordVisible: false,
162
+ }),
163
163
 
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';
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
- this.inputType = inputType;
182
- },
180
+ }
181
+ this.inputType = inputType;
183
182
  },
184
183
  },
184
+ },
185
185
 
186
- computed: {
187
- hasLabel() {
188
- return !!(this.label || this.$slots.label);
189
- },
190
-
191
- requiredLabel() {
192
- return this.required ? `${this.label}*` : this.label;
193
- },
186
+ computed: {
187
+ hasLabel() {
188
+ return !!(this.label || this.$slots.label);
189
+ },
194
190
 
195
- isPassword() {
196
- return this.type === 'password' && this.hasShowPassword;
197
- },
191
+ requiredLabel() {
192
+ return this.required ? `${this.label}*` : this.label;
193
+ },
198
194
 
199
- showPasswordIcon() {
200
- return this.isPasswordVisible ? 'eye--closed' : 'eye--opened';
201
- },
195
+ isPassword() {
196
+ return this.type === 'password' && this.hasShowPassword;
197
+ },
202
198
 
203
- listeners() {
204
- return {
205
- ...this.$listeners,
206
- input: this.inputHandler,
207
- };
208
- },
199
+ showPasswordIcon() {
200
+ return this.isPasswordVisible ? 'eye--closed' : 'eye--opened';
209
201
  },
210
- methods: {
211
- inputHandler(event) {
212
- this.$emit('input', event.target.value.trim());
213
- },
214
202
 
215
- switchVisibilityPassword() {
216
- this.isPasswordVisible = !this.isPasswordVisible;
217
- this.inputType = this.isPasswordVisible ? 'text' : 'password';
218
- },
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());
213
+ },
219
214
 
220
- updateInputPaddings() {
221
- // cant test this thing cause vue test utils doesnt render elements width :/
222
- const afterWrapperWidth = this.$refs['after-wrapper'].offsetWidth;
223
- const inputEl = this.$refs['wt-input'];
224
- const defaultInputPadding = getComputedStyle(document.documentElement)
225
- .getPropertyValue('--input-padding');
226
- inputEl.style.paddingRight = `calc(${defaultInputPadding} * 2 + ${afterWrapperWidth}px)`;
227
- },
215
+ switchVisibilityPassword() {
216
+ this.isPasswordVisible = !this.isPasswordVisible;
217
+ this.inputType = this.isPasswordVisible ? 'text' : 'password';
228
218
  },
229
- mounted() {
230
- this.updateInputPaddings();
219
+
220
+ async updateInputPaddings() {
221
+ // cant test this thing cause vue test utils doesnt render elements width :/
222
+ const afterWrapperWidth = this.$refs['after-wrapper'].offsetWidth;
223
+ const inputEl = this.$refs['wt-input'];
224
+ const defaultInputPadding = getComputedStyle(document.documentElement)
225
+ .getPropertyValue('--input-padding');
226
+ if (afterWrapperWidth >= inputEl.offsetWidth) return; // fixes https://my.webitel.com/browse/WTEL-2635
227
+ inputEl.style.paddingRight = `calc(${defaultInputPadding} * 2 + ${afterWrapperWidth}px)`;
231
228
  },
229
+ },
230
+ mounted() {
231
+ this.updateInputPaddings();
232
+ },
232
233
  };
233
234
  </script>
234
235
 
235
236
  <style lang="scss" scoped>
236
- .wt-input {
237
- cursor: text;
237
+ .wt-input {
238
+ cursor: text;
238
239
 
239
- &--disabled {
240
- pointer-events: none;
241
- }
240
+ &--disabled {
241
+ pointer-events: none;
242
242
  }
243
+ }
243
244
 
244
- .wt-input__wrapper {
245
- position: relative;
246
- }
245
+ .wt-input__wrapper {
246
+ position: relative;
247
+ }
247
248
 
248
- .wt-label {
249
- .wt-input:hover &,
250
- .wt-input:focus-within & {
251
- color: var(--form-label--hover-color);
252
- }
249
+ .wt-label {
250
+ .wt-input:hover &,
251
+ .wt-input:focus-within & {
252
+ color: var(--form-label--hover-color);
253
+ }
253
254
 
254
- .wt-input--invalid:hover &,
255
- .wt-input--invalid:focus-within & {
256
- color: var(--label--invalid-color);
257
- }
255
+ .wt-input--invalid:hover &,
256
+ .wt-input--invalid:focus-within & {
257
+ color: var(--label--invalid-color);
258
258
  }
259
+ }
259
260
 
260
- .wt-input__input {
261
- @extend %typo-body-1;
262
- @include wt-placeholder;
261
+ .wt-input__input {
262
+ @extend %typo-body-1;
263
+ @include wt-placeholder;
263
264
 
264
- display: block;
265
- width: 100%;
266
- box-sizing: border-box;
267
- padding: var(--input-padding);
268
- color: var(--form-input-color);
269
- border: var(--input-border);
270
- border-color: var(--form-border-color);
271
- border-radius: var(--border-radius);
272
- transition: var(--transition);
265
+ display: block;
266
+ box-sizing: border-box;
267
+ width: 100%;
268
+ padding: var(--input-padding);
269
+ transition: var(--transition);
270
+ color: var(--form-input-color);
271
+ border: var(--input-border);
272
+ border-color: var(--form-border-color);
273
+ border-radius: var(--border-radius);
273
274
 
274
- &:focus {
275
- @include wt-placeholder('focus');
276
- border-color: var(--form-border--hover-color);
277
- }
275
+ &:focus {
276
+ @include wt-placeholder('focus');
277
+ border-color: var(--form-border--hover-color);
278
+ }
278
279
 
279
- .wt-input--outline & {
280
- border-color: var(--form-outline-border-color);
281
- }
280
+ .wt-input--outline & {
281
+ border-color: var(--form-outline-border-color);
282
+ }
282
283
 
283
- .wt-input--outline:hover &,
284
- .wt-input--outline &:focus {
285
- border-color: var(--form-outline-border--hover-color);
286
- }
284
+ .wt-input--outline:hover &,
285
+ .wt-input--outline &:focus {
286
+ border-color: var(--form-outline-border--hover-color);
287
+ }
287
288
 
288
- .wt-input--invalid &,
289
- .wt-input--invalid:hover & {
290
- border-color: var(--false-color);
291
- outline: none; // prevent outline overlapping false color
292
- }
289
+ .wt-input--invalid &,
290
+ .wt-input--invalid:hover & {
291
+ border-color: var(--false-color);
292
+ outline: none; // prevent outline overlapping false color
293
+ }
293
294
 
294
- .wt-input--disabled & {
295
- @include wt-placeholder('disabled');
296
- background: var(--form-border--disabled-color);
297
- border-color: var(--form-border--disabled-color);
298
- }
295
+ .wt-input--disabled & {
296
+ @include wt-placeholder('disabled');
297
+ border-color: var(--form-border--disabled-color);
298
+ background: var(--form-border--disabled-color);
299
299
  }
300
+ }
300
301
 
301
- .wt-input__after-wrapper {
302
- display: flex;
303
- gap: var(--input-after-wrapper-gap);
304
- align-items: center;
305
- position: absolute;
306
- top: 50%;
307
- right: var(--input-icon-margin);
308
- transform: translateY(-50%);
309
- pointer-events: auto; // override --disabled p-events none
302
+ .wt-input__after-wrapper {
303
+ position: absolute;
304
+ top: 50%;
305
+ right: var(--input-icon-margin);
306
+ display: flex;
307
+ align-items: center;
308
+ transform: translateY(-50%);
309
+ pointer-events: auto; // override --disabled p-events none
310
+ gap: var(--input-after-wrapper-gap);
310
311
 
311
- .wt-input__password-button {
312
- .wt-input--disabled & ::v-deep .wt-icon__icon {
313
- fill: var(--icon-color-disabled);
314
- }
312
+ .wt-input__password-button {
313
+ .wt-input--disabled & ::v-deep .wt-icon__icon {
314
+ fill: var(--icon-color-disabled);
315
+ }
315
316
 
316
- .wt-input:hover & ::v-deep .wt-icon__icon,
317
- .wt-input:focus-within & ::v-deep .wt-icon__icon {
318
- fill: var(--icon-color--hover);
319
- }
317
+ .wt-input:hover & ::v-deep .wt-icon__icon,
318
+ .wt-input:focus-within & ::v-deep .wt-icon__icon {
319
+ fill: var(--icon-color--hover);
320
320
  }
321
321
  }
322
+ }
322
323
  </style>
@@ -13,6 +13,8 @@
13
13
  // cause we need to set styles to element somewhere in the HTML, not inside .wt-tooltip scope
14
14
  .wt-tooltip__popper .v-popper__inner {
15
15
  @extend %typo-body-1;
16
+ max-width: 80vw;
17
+ max-height: 80vh;
16
18
  padding: var(--tooltip-padding);
17
19
  color: var(--tooltip-light-text-color);
18
20
  background: var(--tooltip-light-bg-color);