@webitel/ui-sdk 23.12.2 → 23.12.5-1

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.
Files changed (191) hide show
  1. package/dist/favicon.ico +0 -0
  2. package/dist/img/sprite/index.js +148 -1
  3. package/dist/img/sprite/link.svg +8 -0
  4. package/dist/img/sprite/variable-select.svg +9 -0
  5. package/dist/plyr.svg +70 -0
  6. package/dist/ui-sdk.css +1 -1
  7. package/dist/ui-sdk.mjs +22670 -0
  8. package/dist/ui-sdk.umd.js +37 -43084
  9. package/package.json +34 -40
  10. package/src/api/axios/generateInstance.js +1 -1
  11. package/src/components/on-demand/wt-cc-agent-status-timers/wt-cc-agent-status-timers.vue +3 -3
  12. package/src/components/on-demand/wt-save-failed-popup/__tests__/WtPopup.spec.js +9 -0
  13. package/src/components/on-demand/wt-save-failed-popup/wt-save-failed-popup.vue +70 -0
  14. package/src/components/transitions/wt-expand-transition.vue +2 -2
  15. package/src/components/wt-app-header/_variables.scss +1 -1
  16. package/src/components/wt-app-header/wt-app-header.vue +2 -5
  17. package/src/components/wt-app-header/wt-app-navigator.vue +6 -5
  18. package/src/components/wt-app-header/wt-header-actions.vue +30 -14
  19. package/src/components/wt-avatar/_variables.scss +1 -1
  20. package/src/components/wt-avatar/wt-avatar.vue +2 -2
  21. package/src/components/wt-badge/wt-badge.vue +3 -3
  22. package/src/components/wt-button/_variables.scss +2 -32
  23. package/src/components/wt-button/wt-button.vue +5 -3
  24. package/src/components/wt-button-select/__tests__/WtButtonSelect.spec.js +9 -8
  25. package/src/components/wt-button-select/wt-button-select.vue +58 -59
  26. package/src/components/wt-checkbox/wt-checkbox.vue +15 -48
  27. package/src/components/wt-chip/_variables.scss +21 -2
  28. package/src/components/wt-chip/wt-chip.scss +20 -17
  29. package/src/components/wt-chip/wt-chip.vue +10 -5
  30. package/src/components/wt-context-menu/wt-context-menu.vue +4 -4
  31. package/src/components/wt-copy-action/wt-copy-action.vue +6 -6
  32. package/src/components/wt-datepicker/_variables.scss +1 -1
  33. package/src/components/wt-datepicker/wt-datepicker.vue +14 -12
  34. package/src/components/wt-divider/wt-divider.vue +1 -1
  35. package/src/components/wt-dummy/wt-dummy.vue +6 -2
  36. package/src/components/wt-error-page/wt-error-page.vue +10 -4
  37. package/src/components/wt-expansion-panel/wt-expansion-panel.vue +4 -4
  38. package/src/components/wt-filters-panel-wrapper/wt-filters-panel-wrapper.vue +7 -4
  39. package/src/components/wt-headline/wt-headline.vue +4 -4
  40. package/src/components/wt-headline-nav/_variables.scss +5 -2
  41. package/src/components/wt-headline-nav/wt-headline-nav.vue +46 -33
  42. package/src/components/wt-hint/wt-hint.vue +5 -6
  43. package/src/components/wt-icon/_variables.scss +5 -10
  44. package/src/components/wt-icon/wt-icon.vue +15 -6
  45. package/src/components/wt-icon-action/_internals/wt-add-icon-action.vue +2 -2
  46. package/src/components/wt-icon-action/_internals/wt-delete-icon-action.vue +2 -2
  47. package/src/components/wt-icon-action/_internals/wt-download-icon-action.vue +2 -2
  48. package/src/components/wt-icon-action/_internals/wt-edit-icon-action.vue +2 -2
  49. package/src/components/wt-icon-action/_internals/wt-history-icon-action.vue +2 -2
  50. package/src/components/wt-icon-action/_internals/wt-refresh-icon-action.vue +2 -2
  51. package/src/components/wt-icon-action/wt-icon-action.vue +1 -1
  52. package/src/components/wt-icon-btn/wt-icon-btn.vue +4 -2
  53. package/src/components/wt-indicator/_variables.scss +14 -19
  54. package/src/components/wt-indicator/wt-indicator.vue +26 -27
  55. package/src/components/wt-input/wt-input.vue +200 -219
  56. package/src/components/wt-input-info/wt-input-info.vue +2 -2
  57. package/src/components/wt-item-link/wt-item-link.vue +1 -1
  58. package/src/components/wt-label/_variables.scss +4 -2
  59. package/src/components/wt-label/wt-label.vue +5 -18
  60. package/src/components/wt-load-bar/wt-load-bar.vue +7 -4
  61. package/src/components/wt-loader/_internals/wt-loader--md.vue +11 -2
  62. package/src/components/wt-loader/_internals/wt-loader--sm.vue +9 -2
  63. package/src/components/wt-loader/_variables.scss +2 -2
  64. package/src/components/wt-loader/wt-loader.vue +10 -3
  65. package/src/components/wt-navigation-bar/wt-navigation-bar.vue +17 -9
  66. package/src/components/wt-notification/wt-notification.vue +4 -4
  67. package/src/components/wt-notifications-bar/wt-notifications-bar.vue +9 -5
  68. package/src/components/wt-page-header/wt-page-header.vue +7 -8
  69. package/src/components/wt-page-wrapper/wt-page-wrapper.vue +8 -5
  70. package/src/components/wt-pagination/wt-pagination.vue +17 -15
  71. package/src/components/wt-player/__tests__/WtPlayer.spec.js +1 -1
  72. package/src/components/wt-player/_variables.scss +1 -1
  73. package/src/components/wt-player/wt-player.vue +17 -17
  74. package/src/components/wt-popup/_variables.scss +4 -3
  75. package/src/components/wt-popup/wt-popup.vue +18 -10
  76. package/src/components/wt-progress-bar/_variables.scss +10 -8
  77. package/src/components/wt-progress-bar/wt-progress-bar.vue +27 -18
  78. package/src/components/wt-radio/wt-radio.vue +26 -54
  79. package/src/components/wt-rounded-action/_variables.scss +4 -35
  80. package/src/components/wt-rounded-action/wt-rounded-action.vue +15 -70
  81. package/src/components/wt-search-bar/__tests__/WtSearchBar.spec.js +1 -1
  82. package/src/components/wt-search-bar/wt-search-bar.vue +18 -42
  83. package/src/components/wt-select/_multiselect.scss +48 -53
  84. package/src/components/wt-select/_variables.scss +0 -3
  85. package/src/components/wt-select/mixins/multiselectMixin.js +9 -1
  86. package/src/components/wt-select/wt-select.vue +41 -40
  87. package/src/components/wt-slider/_variables.scss +6 -0
  88. package/src/components/wt-slider/wt-slider.vue +25 -9
  89. package/src/components/wt-status-select/_variables.scss +7 -4
  90. package/src/components/wt-status-select/wt-status-select.vue +18 -12
  91. package/src/components/wt-stepper/_variables.scss +5 -0
  92. package/src/components/wt-stepper/wt-stepper.vue +15 -9
  93. package/src/components/wt-switcher/_variables.scss +30 -7
  94. package/src/components/wt-switcher/wt-switcher.vue +56 -35
  95. package/src/components/wt-table/_variables.scss +8 -5
  96. package/src/components/wt-table/wt-table.vue +123 -90
  97. package/src/components/wt-table-actions/wt-table-actions.vue +14 -14
  98. package/src/components/wt-table-column-select/wt-table-column-select.vue +33 -28
  99. package/src/components/wt-tabs/_variables.scss +4 -4
  100. package/src/components/wt-tabs/wt-tabs.vue +15 -13
  101. package/src/components/wt-tags-input/wt-tags-input.vue +26 -35
  102. package/src/components/wt-textarea/wt-textarea.vue +37 -54
  103. package/src/components/wt-time-input/wt-time-input.vue +24 -54
  104. package/src/components/wt-timepicker/wt-timepicker.vue +19 -27
  105. package/src/components/wt-tooltip/__tests__/WtTooltip.spec.js +0 -10
  106. package/src/components/wt-tooltip/_internals/wt-tooltip-floating.vue +2 -2
  107. package/src/components/wt-tooltip/_variables.scss +2 -4
  108. package/src/components/wt-tooltip/wt-tooltip.vue +6 -18
  109. package/src/composables/useCachedInterval/__tests__/useCachedInterval.spec.js +5 -5
  110. package/src/composables/useRepresentableAgentPauseCause/__tests__/useRepresentableAgentPauseCause.spec.js +1 -1
  111. package/src/composables/useRepresentableAgentPauseCause/useRepresentableAgentPauseCause.js +1 -1
  112. package/src/css/styleguide/colors/_colors.scss +45 -29
  113. package/src/css/styleguide/colors/reusable/_text-field.scss +36 -0
  114. package/src/css/styleguide/placeholder/_placeholder.scss +9 -9
  115. package/src/enums/WebitelApplications/AdminSections.enum.js +2 -1
  116. package/src/locale/en/en.js +11 -3
  117. package/src/locale/es/es.js +2 -0
  118. package/src/locale/i18n.js +3 -1
  119. package/src/locale/kz/kz.js +327 -0
  120. package/src/locale/ru/ru.js +11 -3
  121. package/src/locale/ua/ua.js +11 -3
  122. package/src/mixins/validationMixin/__tests__/validationMixin.spec.js +2 -2
  123. package/src/mixins/validationMixin/useValidation.js +19 -4
  124. package/src/mixins/validationMixin/validationMixin.js +1 -0
  125. package/src/modules/AgentStatusSelect/components/__tests__/wt-cc-agent-status-select.spec.js +4 -4
  126. package/src/modules/AgentStatusSelect/components/_internals/wt-cc-pause-cause-popup.vue +11 -9
  127. package/src/modules/AgentStatusSelect/components/_internals/wt-cc-status-select-error-popup.vue +6 -5
  128. package/src/modules/AgentStatusSelect/components/wt-cc-agent-status-select.vue +3 -3
  129. package/src/modules/AuditForm/components/__tests__/audit-form.spec.js +1 -1
  130. package/src/modules/AuditForm/components/audit-form-question-read-wrapper.vue +11 -8
  131. package/src/modules/AuditForm/components/audit-form-question-write-wrapper.vue +8 -8
  132. package/src/modules/AuditForm/components/audit-form-question.vue +8 -8
  133. package/src/modules/AuditForm/components/audit-form.vue +6 -5
  134. package/src/modules/AuditForm/components/questions/options/audit-form-question-options-write-row.vue +4 -4
  135. package/src/modules/AuditForm/components/questions/options/audit-form-question-options.vue +7 -4
  136. package/src/modules/AuditForm/components/questions/score/audit-form-question-score.vue +3 -3
  137. package/src/modules/CSVExport/__tests__/CSVExport.spec.js +5 -2
  138. package/src/modules/DeleteConfirmationPopup/__tests__/delete-confirmation-popup.spec.js +77 -0
  139. package/src/modules/DeleteConfirmationPopup/components/delete-confirmation-popup.vue +35 -17
  140. package/src/modules/FilesExport/__tests__/FilesExport.spec.js +6 -3
  141. package/src/modules/FilesExport/scripts/generateMediaURL.js +1 -1
  142. package/src/modules/Filters/components/filter-pagination.vue +1 -1
  143. package/src/modules/Filters/components/filter-table-fields.vue +1 -1
  144. package/src/modules/Notifications/store/__tests__/NotificationsStoreModule.actions.spec.js +6 -6
  145. package/src/modules/QueryFilters/classes/__tests__/ApiFilterSchema.spec.js +1 -1
  146. package/src/modules/QueryFilters/components/__tests__/abstract-api-filter.spec.js +7 -5
  147. package/src/modules/QueryFilters/components/__tests__/abstract-enum-filter.spec.js +3 -1
  148. package/src/modules/QueryFilters/components/__tests__/filter-datetime.spec.js +2 -2
  149. package/src/modules/QueryFilters/components/__tests__/filter-from-to.spec.js +4 -4
  150. package/src/modules/QueryFilters/components/__tests__/filter-search.spec.js +2 -2
  151. package/src/modules/QueryFilters/components/abstract-api-filter.vue +2 -2
  152. package/src/modules/QueryFilters/components/abstract-enum-filter.vue +2 -2
  153. package/src/modules/QueryFilters/components/filter-datetime.vue +2 -2
  154. package/src/modules/QueryFilters/components/filter-from-to.vue +12 -10
  155. package/src/modules/QueryFilters/components/filter-search.vue +2 -2
  156. package/src/modules/QueryFilters/components/filter-table-fields.vue +7 -7
  157. package/src/modules/QueryFilters/mixins/__tests__/apiFilterMixin.spec.js +1 -1
  158. package/src/modules/QueryFilters/mixins/__tests__/enumFilterMixin.spec.js +2 -2
  159. package/src/modules/QueryFilters/mixins/__tests__/paginationFilterMixin.spec.js +2 -2
  160. package/src/modules/QueryFilters/mixins/__tests__/sortFilterMixin.spec.js +1 -1
  161. package/src/modules/QueryFilters/store/__tests__/QueryFiltersStoreModule.spec.js +2 -2
  162. package/src/modules/Userinfo/classes/ApplicationsAccess.js +6 -2
  163. package/src/modules/Userinfo/components/__tests__/auth.spec.js +7 -8
  164. package/src/modules/Userinfo/components/the-auth.vue +8 -5
  165. package/src/scripts/debounce.js +1 -1
  166. package/src/scripts/saveAsJSON.js +9 -0
  167. package/src/store/BaseStoreModules/__tests__/BaseStoreModule.spec.js +6 -6
  168. package/src/validators/variableSearchValidator/__tests__/variableSearchValidator.spec.js +48 -0
  169. package/src/validators/variableSearchValidator/variableSearchValidator.js +10 -0
  170. package/src/validators/websocketValidator/__tests__/websocketValidator.spec.js +28 -0
  171. package/src/validators/websocketValidator/websocketValidator.js +9 -0
  172. package/dist/demo.html +0 -1
  173. package/dist/ui-sdk.common.js +0 -43066
  174. package/dist/ui-sdk.common.js.map +0 -1
  175. package/dist/ui-sdk.umd.js.map +0 -1
  176. package/dist/ui-sdk.umd.min.js +0 -35
  177. package/dist/ui-sdk.umd.min.js.map +0 -1
  178. package/src/components/wt-button/Readme.md +0 -23
  179. package/src/components/wt-button-select/Readme.md +0 -13
  180. package/src/components/wt-icon/Readme.md +0 -327
  181. package/src/components/wt-icon/docs/cleanup-svg-fill-none.png +0 -0
  182. package/src/components/wt-icon/docs/cleanup-svg-fill.png +0 -0
  183. package/src/components/wt-icon/docs/cleanup-svg-viewbox-correct.png +0 -0
  184. package/src/components/wt-icon/docs/cleanup-svg-viewbox-incorrect.png +0 -0
  185. package/src/components/wt-icon/docs/cleanup-svg-width-height.png +0 -0
  186. package/src/components/wt-icon/docs/svg-icon-code-example.png +0 -0
  187. package/src/components/wt-icon/docs/svg-sprite-in-dom.png +0 -0
  188. package/src/components/wt-icon-btn/Readme.md +0 -10
  189. package/src/components/wt-rounded-action/Readme.md +0 -68
  190. package/src/components/wt-tags-input/_variables.scss +0 -24
  191. package/src/locale/.DS_Store +0 -0
@@ -1,31 +1,30 @@
1
1
  <template>
2
2
  <div
3
3
  :class="{
4
- 'wt-input--outline': outline,
5
4
  'wt-input--disabled': disabled,
6
5
  'wt-input--invalid': invalid,
7
6
  }"
8
7
  class="wt-input"
9
8
  >
10
9
  <wt-label
11
- v-bind="labelProps"
12
10
  v-if="hasLabel"
13
11
  :disabled="disabled"
14
12
  :for="name"
15
13
  :invalid="invalid"
16
- :outline="outline"
14
+ v-bind="labelProps"
17
15
  >
18
16
  <!-- @slot Custom input label -->
19
17
  <slot
20
- v-bind="{ label }"
21
18
  name="label"
22
- >{{ requiredLabel }}</slot>
19
+ v-bind="{ label }"
20
+ >
21
+ {{ requiredLabel }}
22
+ </slot>
23
23
  </wt-label>
24
24
  <div class="wt-input__wrapper">
25
25
  <input
26
- v-bind="$attrs"
27
26
  :id="name"
28
- ref="wt-input"
27
+ ref="WtInput"
29
28
  :class="{
30
29
  'wt-input--is-password': isPassword,
31
30
  }"
@@ -36,216 +35,234 @@
36
35
  :type="inputType"
37
36
  :value="inputValue"
38
37
  class="wt-input__input"
38
+ v-bind="$attrs"
39
39
  @input="inputHandler"
40
40
  @keyup="$emit('keyup', $event)"
41
41
  >
42
42
  <div
43
- ref="after-wrapper"
43
+ ref="AfterWrapper"
44
44
  class="wt-input__after-wrapper"
45
45
  >
46
46
  <slot
47
47
  name="after-input"
48
- ></slot>
48
+ />
49
49
  <slot
50
- v-bind="{
51
- isPasswordVisible,
52
- switchVisibilityPassword,
53
- }"
54
50
  v-if="isPassword"
55
51
  name="show-password"
52
+ v-bind="{
53
+ isPasswordVisible,
54
+ switchVisibilityPassword,
55
+ }"
56
56
  >
57
57
  <wt-icon-btn
58
+ :disabled="disabled"
58
59
  :icon="showPasswordIcon"
59
- class="wt-input__password-button"
60
60
  @click="switchVisibilityPassword"
61
- ></wt-icon-btn>
61
+ />
62
62
  </slot>
63
63
  </div>
64
64
  </div>
65
65
  <wt-input-info
66
66
  v-if="isValidation"
67
67
  :invalid="invalid"
68
- >{{ validationText }}
68
+ >
69
+ {{ validationText }}
69
70
  </wt-input-info>
70
71
  </div>
71
72
  </template>
72
73
 
73
- <script>
74
- import validationMixin from '../../mixins/validationMixin/validationMixin';
74
+ <script setup>
75
+ import {
76
+ ref, computed, useSlots, onMounted,
77
+ } from 'vue';
78
+ import { useValidation } from '../../mixins/validationMixin/useValidation';
75
79
 
76
80
  /*
77
81
  * IMPORTANT: WT-INPUT SHOULD SUPPORT VUE 3 AND VUE 2 V-MODEL INTERFACES SO THAT THERE'S
78
82
  * TWO PROPS: VALUE AND MODELVALUE, AND 2 EVENTS: @UPDATE:MODELVALUE AND @INPUT
79
83
  * */
80
- export default {
81
- name: 'wt-input',
82
- mixins: [validationMixin],
83
- props: {
84
- value: {
85
- type: [String, Number],
86
- },
87
- /**
88
- * Current input modelValue (`v-model`)
89
- */
90
- modelValue: {
91
- type: [String, Number],
92
- },
93
- /**
94
- * Form input label
95
- */
96
- label: {
97
- type: String,
98
- default: '',
99
- },
100
- /**
101
- * Form input placeholder
102
- */
103
- placeholder: {
104
- type: String,
105
- },
106
- /**
107
- * Form input name
108
- */
109
- name: {
110
- type: String,
111
- default: '',
112
- },
113
- /**
114
- * Form input type
115
- */
116
- type: {
117
- type: String,
118
- default: 'text',
119
- },
120
- /**
121
- * Native input required attribute
122
- */
123
- required: {
124
- type: Boolean,
125
- default: false,
126
- description: 'Native input required attribute',
127
- },
128
- /**
129
- * Native input disabled attribute
130
- */
131
- disabled: {
132
- type: Boolean,
133
- default: false,
134
- description: 'Native input disabled attribute',
135
- },
136
- /**
137
- * Status of show password icon display
138
- */
139
- hasShowPassword: {
140
- type: Boolean,
141
- default: false,
142
- },
143
-
144
- /**
145
- * Native number input restrictions
146
- */
147
- numberMin: {
148
- type: Number,
149
- default: 0,
150
- },
151
-
152
- /**
153
- * Native number input restrictions
154
- */
155
- numberMax: {
156
- type: Number,
157
- },
158
-
159
- outline: {
160
- type: Boolean,
161
- default: false,
162
- },
163
-
164
- labelProps: {
165
- type: Object,
166
- description: 'Object with props, passed down to wt-label as props',
167
- },
168
-
169
- preventTrim: {
170
- type: Boolean,
171
- default: false,
172
- },
84
+ const props = defineProps({
85
+ value: {
86
+ type: [String, Number],
173
87
  },
174
- emits: ['update:modelValue', 'input', 'keyup'],
175
- data: () => ({
176
- inputType: '',
177
- isPasswordVisible: false,
178
- }),
179
-
180
- watch: {
181
- type: {
182
- immediate: true,
183
- handler(type) {
184
- let inputType = type;
185
- // Safari has bug for number input
186
- if (typeof window !== 'undefined' || typeof document !== 'undefined') {
187
- const ua = navigator.userAgent.toLocaleLowerCase();
188
- if (
189
- ua.indexOf('safari') !== -1
190
- && ua.indexOf('chrome') === -1
191
- && type === 'number'
192
- ) {
193
- this.isNumberTypeSafari = true;
194
- inputType = 'text';
195
- }
196
- }
197
- this.inputType = inputType;
198
- },
199
- },
88
+ /**
89
+ * Current input modelValue (`v-model`)
90
+ */
91
+ modelValue: {
92
+ type: [String, Number],
93
+ },
94
+ /**
95
+ * Form input label
96
+ */
97
+ label: {
98
+ type: String,
99
+ default: '',
100
+ },
101
+ /**
102
+ * Form input placeholder
103
+ */
104
+ placeholder: {
105
+ type: String,
106
+ },
107
+ /**
108
+ * Form input name
109
+ */
110
+ name: {
111
+ type: String,
112
+ default: '',
113
+ },
114
+ /**
115
+ * Form input type
116
+ */
117
+ type: {
118
+ type: String,
119
+ default: 'text',
120
+ },
121
+ /**
122
+ * Native input required attribute
123
+ */
124
+ required: {
125
+ type: Boolean,
126
+ default: false,
127
+ description: 'Native input required attribute',
128
+ },
129
+ /**
130
+ * Native input disabled attribute
131
+ */
132
+ disabled: {
133
+ type: Boolean,
134
+ default: false,
135
+ description: 'Native input disabled attribute',
136
+ },
137
+ /**
138
+ * Status of show password icon display
139
+ */
140
+ hasShowPassword: {
141
+ type: Boolean,
142
+ default: false,
200
143
  },
201
144
 
202
- computed: {
203
- inputValue() {
204
- return this.value !== undefined ? this.value : this.modelValue;
205
- },
206
-
207
- hasLabel() {
208
- return !!(this.label || this.$slots.label);
209
- },
210
-
211
- requiredLabel() {
212
- return this.required ? `${this.label}*` : this.label;
213
- },
145
+ /**
146
+ * Native number input restrictions
147
+ */
148
+ numberMin: {
149
+ type: Number,
150
+ default: 0,
151
+ },
214
152
 
215
- isPassword() {
216
- return this.type === 'password' && this.hasShowPassword;
217
- },
153
+ /**
154
+ * Native number input restrictions
155
+ */
156
+ numberMax: {
157
+ type: Number,
158
+ },
218
159
 
219
- showPasswordIcon() {
220
- return this.isPasswordVisible ? 'eye--closed' : 'eye--opened';
221
- },
160
+ labelProps: {
161
+ type: Object,
162
+ description: 'Object with props, passed down to wt-label as props',
222
163
  },
223
- methods: {
224
- inputHandler(event) {
225
- const value = this.preventTrim ? event.target.value : event.target.value.trim();
226
- this.$emit('update:modelValue', value);
227
- this.$emit('input', value);
228
- },
229
164
 
230
- switchVisibilityPassword() {
231
- this.isPasswordVisible = !this.isPasswordVisible;
232
- this.inputType = this.isPasswordVisible ? 'text' : 'password';
233
- },
165
+ preventTrim: {
166
+ type: Boolean,
167
+ default: false,
168
+ },
234
169
 
235
- async updateInputPaddings() {
236
- // cant test this thing cause vue test utils doesnt render elements width :/
237
- const afterWrapperWidth = this.$refs['after-wrapper'].offsetWidth;
238
- const inputEl = this.$refs['wt-input'];
239
- const defaultInputPadding = getComputedStyle(document.documentElement)
240
- .getPropertyValue('--input-padding');
241
- if (afterWrapperWidth >= inputEl.offsetWidth) return; // fixes https://my.webitel.com/browse/WTEL-2635
242
- inputEl.style.paddingRight = `calc(${defaultInputPadding} * 2 + ${afterWrapperWidth}px)`;
243
- },
170
+ // validation rules
171
+ // TODO: move to separate file to make it reusable
172
+ v: {
173
+ type: Object,
244
174
  },
245
- mounted() {
246
- this.updateInputPaddings();
175
+ customValidators: {
176
+ type: Array,
177
+ default: () => [],
247
178
  },
248
- };
179
+ });
180
+ const emit = defineEmits(['update:modelValue', 'input', 'keyup']);
181
+
182
+ const slots = useSlots();
183
+ const {
184
+ isValidation,
185
+ invalid,
186
+ validationText,
187
+ } = useValidation({ v: props.v, customValidators: props.customValidators });
188
+
189
+ // toggles password <-> text at showPassword
190
+ const inputType = ref('');
191
+ inputType.value = props.type;
192
+
193
+ // template ref
194
+ const AfterWrapper = ref(null);
195
+ // template ref
196
+ const WtInput = ref(null);
197
+
198
+ const isPasswordVisible = ref(false);
199
+
200
+ // FIXME: uncomment and test, because this code was copy-pasted from vue-storefront long ago
201
+ // watch: {
202
+ // type: {
203
+ // immediate: true,
204
+ // handler(type) {
205
+ // let inputType = type;
206
+ // // Safari has bug for number input
207
+ // if (typeof window !== 'undefined' || typeof document !== 'undefined') {
208
+ // const ua = navigator.userAgent.toLocaleLowerCase();
209
+ // if (
210
+ // ua.indexOf('safari') !== -1
211
+ // && ua.indexOf('chrome') === -1
212
+ // && type === 'number'
213
+ // ) {
214
+ // inputType = 'text';
215
+ // }
216
+ // }
217
+ // this.inputType = inputType;
218
+ // },
219
+ // },
220
+ // },
221
+
222
+ const inputValue = computed(() => {
223
+ return props.value !== undefined ? props.value : props.modelValue;
224
+ });
225
+
226
+ const hasLabel = computed(() => {
227
+ return !!(props.label || slots.label);
228
+ });
229
+
230
+ const requiredLabel = computed(() => {
231
+ return props.required ? `${props.label}*` : props.label;
232
+ });
233
+
234
+ const isPassword = computed(() => {
235
+ return props.type === 'password' && props.hasShowPassword;
236
+ });
237
+
238
+ const showPasswordIcon = computed(() => {
239
+ return isPasswordVisible.value ? 'eye--closed' : 'eye--opened';
240
+ });
241
+
242
+ function inputHandler(event) {
243
+ const value = props.preventTrim ? event.target.value : event.target.value.trim();
244
+ emit('update:modelValue', value);
245
+ emit('input', value);
246
+ }
247
+
248
+ function switchVisibilityPassword() {
249
+ isPasswordVisible.value = !isPasswordVisible.value;
250
+ inputType.value = isPasswordVisible.value ? 'text' : 'password';
251
+ }
252
+
253
+ function updateInputPaddings() {
254
+ // cant test this thing cause vue test utils doesnt render elements width :/
255
+ const afterWrapperWidth = AfterWrapper.value.offsetWidth;
256
+ const inputEl = WtInput.value;
257
+ const defaultInputPadding = getComputedStyle(document.documentElement)
258
+ .getPropertyValue('--input-padding');
259
+ if (afterWrapperWidth >= inputEl.offsetWidth) return; // fixes https://my.webitel.com/browse/WTEL-2635
260
+ inputEl.style.paddingRight = `calc(${defaultInputPadding} * 2 + ${afterWrapperWidth}px)`;
261
+ }
262
+
263
+ onMounted(() => {
264
+ updateInputPaddings();
265
+ });
249
266
  </script>
250
267
 
251
268
  <style lang="scss">
@@ -266,18 +283,6 @@ export default {
266
283
  position: relative;
267
284
  }
268
285
 
269
- .wt-label {
270
- .wt-input:hover &,
271
- .wt-input:focus-within & {
272
- color: var(--form-label--hover-color);
273
- }
274
-
275
- .wt-input--invalid:hover &,
276
- .wt-input--invalid:focus-within & {
277
- color: var(--label--invalid-color);
278
- }
279
- }
280
-
281
286
  .wt-input__input {
282
287
  @extend %typo-body-1;
283
288
  @include wt-placeholder;
@@ -287,35 +292,22 @@ export default {
287
292
  width: 100%;
288
293
  padding: var(--input-padding);
289
294
  transition: var(--transition);
290
- color: var(--form-input-color);
291
295
  border: var(--input-border);
292
- border-color: var(--form-border-color);
296
+ border-color: var(--wt-text-field-input-border-color);
293
297
  border-radius: var(--border-radius);
294
298
 
295
- &:focus {
296
- @include wt-placeholder('focus');
297
- border-color: var(--form-border--hover-color);
298
- }
299
-
300
- .wt-input--outline & {
301
- border-color: var(--form-outline-border-color);
302
- }
303
-
304
- .wt-input--outline:hover &,
305
- .wt-input--outline &:focus {
306
- border-color: var(--form-outline-border--hover-color);
307
- }
308
-
309
299
  .wt-input--invalid &,
310
300
  .wt-input--invalid:hover & {
311
- border-color: var(--false-color);
301
+ @include wt-placeholder('error');
302
+ color: var(--wt-text-field-error-text-color);
303
+ border-color: var(--wt-text-field-input-border-error-color);
312
304
  outline: none; // prevent outline overlapping false color
313
305
  }
314
306
 
315
307
  .wt-input--disabled & {
316
308
  @include wt-placeholder('disabled');
317
- border-color: var(--form-border--disabled-color);
318
- background: var(--form-border--disabled-color);
309
+ border-color: var(--wt-text-field-input-border-disabled-color);
310
+ background: var(--wt-text-field-input-background-disabled-color);
319
311
  }
320
312
  }
321
313
 
@@ -328,16 +320,5 @@ export default {
328
320
  transform: translateY(-50%);
329
321
  pointer-events: auto; // override --disabled p-events none
330
322
  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
323
  }
343
324
  </style>
@@ -5,13 +5,13 @@
5
5
  'wt-input-info--invalid': invalid,
6
6
  }"
7
7
  >
8
- <slot></slot>
8
+ <slot />
9
9
  </div>
10
10
  </template>
11
11
 
12
12
  <script>
13
13
  export default {
14
- name: 'wt-input-info',
14
+ name: 'WtInputInfo',
15
15
  props: {
16
16
  invalid: {
17
17
  type: Boolean,
@@ -5,7 +5,7 @@
5
5
  :class="{ 'wt-item-link--disabled': disabled }"
6
6
  class="wt-item-link"
7
7
  >
8
- <slot></slot>
8
+ <slot />
9
9
  </router-link>
10
10
  </template>
11
11
 
@@ -1,4 +1,6 @@
1
1
 
2
2
  :root {
3
- --label--invalid-color: var(--false-color);
4
- }
3
+ --wt-label-color: var(--text-main-color);
4
+ --wt-label-error-color: var(--text-error-color);
5
+ --wt-label-disabled-color: var(--text-disabled-color);
6
+ }
@@ -2,13 +2,11 @@
2
2
  <label
3
3
  class="wt-label"
4
4
  :class="{
5
- 'wt-label--outline': outline,
6
5
  'wt-label--invalid': invalid,
7
6
  'wt-label--disabled': disabled,
8
7
  }"
9
- :for="this.for"
10
8
  >
11
- <slot></slot>
9
+ <slot />
12
10
  <wt-hint
13
11
  v-if="hint"
14
12
  >{{ hint }}
@@ -18,19 +16,12 @@
18
16
 
19
17
  <script>
20
18
  export default {
21
- name: 'wt-label',
19
+ name: 'WtLabel',
22
20
  props: {
23
- for: {
24
- type: String,
25
- },
26
21
  disabled: {
27
22
  type: Boolean,
28
23
  default: false,
29
24
  },
30
- outline: {
31
- type: Boolean,
32
- default: false,
33
- },
34
25
  invalid: {
35
26
  type: Boolean,
36
27
  default: false,
@@ -54,20 +45,16 @@ export default {
54
45
 
55
46
  display: flex;
56
47
  align-items: center;
57
- color: var(--form-label-color);
48
+ color: var(--wt-label-color);
58
49
  transition: var(--transition);
59
50
  cursor: text;
60
51
 
61
- &--outline {
62
- color: var(--form-outline-label-color);
63
- }
64
-
65
52
  &--invalid {
66
- color: var(--label--invalid-color);
53
+ color: var(--wt-label-error-color);
67
54
  }
68
55
 
69
56
  &--disabled {
70
- color: var(--form-label--disabled-color);
57
+ color: var(--wt-label-disabled-color);
71
58
  }
72
59
  }
73
60
 
@@ -1,12 +1,15 @@
1
1
  <template>
2
2
  <div class="wt-load-bar">
3
- <span :style="`width: ${this.progressWidth}%;`" class="wt-load-bar__progress"></span>
3
+ <span
4
+ :style="`width: ${progressWidth}%;`"
5
+ class="wt-load-bar__progress"
6
+ />
4
7
  </div>
5
8
  </template>
6
9
 
7
10
  <script>
8
11
  export default {
9
- name: 'wt-load-bar',
12
+ name: 'WtLoadBar',
10
13
  props: {
11
14
  max: {
12
15
  type: [Number, String],
@@ -40,7 +43,7 @@ export default {
40
43
  width: 100%;
41
44
  padding: var(--load-bar-padding);
42
45
  line-height: 0;
43
- border: 1px solid var(--accent-color);
46
+ border: 1px solid var(--primary-color);
44
47
  border-radius: var(--border-radius);
45
48
  }
46
49
 
@@ -49,7 +52,7 @@ export default {
49
52
  height: var(--load-bar-height);
50
53
  transition: var(--transition);
51
54
  border-radius: var(--load-bar-border-radius);
52
- background: var(--accent-color);
55
+ background: var(--primary-color);
53
56
  will-change: width;
54
57
  }
55
58
  </style>
@@ -1,7 +1,16 @@
1
1
  <template>
2
2
  <div class="wt-loader wt-loader--md">
3
- <svg class="wt-loader--md__svg" viewBox="0 0 80 80">
4
- <rect class="wt-loader--md__svg__rect" x="8" y="8" width="64" height="64"></rect>
3
+ <svg
4
+ class="wt-loader--md__svg"
5
+ viewBox="0 0 80 80"
6
+ >
7
+ <rect
8
+ class="wt-loader--md__svg__rect"
9
+ x="8"
10
+ y="8"
11
+ width="64"
12
+ height="64"
13
+ />
5
14
  </svg>
6
15
  </div>
7
16
  </template>
@@ -1,9 +1,16 @@
1
1
  <!--https://codepen.io/zapdev/pen/MYJRaj-->
2
2
 
3
3
  <template>
4
- <div class="wt-loader--sm" :class="`wt-loader--sm--${color}`">
4
+ <div
5
+ class="wt-loader--sm"
6
+ :class="`wt-loader--sm--${color}`"
7
+ >
5
8
  <svg viewBox="0 0 24 24">
6
- <circle cx="12" cy="12" r="8" />
9
+ <circle
10
+ cx="12"
11
+ cy="12"
12
+ r="8"
13
+ />
7
14
  </svg>
8
15
  </div>
9
16
  </template>
@@ -3,6 +3,6 @@
3
3
  --loader-size: 44px;
4
4
  --loader-dot-size: 6px;
5
5
  --loader-path-color: var(--contrast-color);
6
- --loader-dot-color: var(--accent-color);
6
+ --loader-dot-color: var(--primary-color);
7
7
  --loader-animation-duration: 3s;
8
- }
8
+ }