@webitel/ui-sdk 0.1.11 → 0.1.112

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 (254) hide show
  1. package/README.md +29 -29
  2. package/dist/img/plyr.svg +70 -0
  3. package/dist/img/svg-sprites/attach.svg +4 -0
  4. package/dist/img/svg-sprites/index.js +1 -0
  5. package/dist/img/svg-sprites/wt-icon.svg +880 -0
  6. package/dist/ui-sdk.common.js +8287 -4335
  7. package/dist/ui-sdk.common.js.map +1 -1
  8. package/dist/ui-sdk.css +1 -1
  9. package/dist/ui-sdk.umd.js +8287 -4335
  10. package/dist/ui-sdk.umd.js.map +1 -1
  11. package/dist/ui-sdk.umd.min.js +3 -1
  12. package/dist/ui-sdk.umd.min.js.map +1 -1
  13. package/package.json +62 -41
  14. package/src/components/atoms/wt-badge/__tests__/WtBadge.spec.js +19 -0
  15. package/src/components/atoms/wt-badge/wt-badge.vue +23 -0
  16. package/src/components/atoms/wt-button/__tests__/WtButton.spec.js +29 -0
  17. package/src/components/atoms/wt-button/wt-button.vue +212 -0
  18. package/src/components/atoms/wt-divider/__tests__/WtDivider.spec.js +9 -0
  19. package/src/components/atoms/wt-divider/wt-divider.vue +25 -0
  20. package/src/components/atoms/wt-icon/__tests__/WtIcon.spec.js +24 -0
  21. package/src/components/atoms/wt-icon/wt-icon.vue +138 -0
  22. package/src/components/atoms/wt-indicator/__tests__/WtIndicator.spec.js +29 -0
  23. package/src/components/atoms/wt-indicator/wt-indicator.vue +81 -0
  24. package/src/components/atoms/wt-input-info/__tests__/WtInputInfo.spec.js +9 -0
  25. package/src/components/atoms/wt-input-info/wt-input-info.vue +35 -0
  26. package/src/components/atoms/wt-loader/__tests__/WtLoader.spec.js +9 -0
  27. package/src/components/atoms/wt-loader/_internals/wt-loader--md.vue +83 -0
  28. package/src/components/atoms/wt-loader/_internals/wt-loader--sm.vue +189 -0
  29. package/src/components/atoms/wt-loader/wt-loader.vue +34 -0
  30. package/src/components/atoms/wt-rounded-action/__tests__/WtRoundedAction.spec.js +20 -0
  31. package/src/components/atoms/wt-rounded-action/wt-rounded-action.vue +227 -0
  32. package/src/components/atoms/wt-tooltip/__tests__/WtTooltip.spec.js +29 -0
  33. package/src/components/atoms/wt-tooltip/wt-tooltip.vue +54 -0
  34. package/src/components/index.js +98 -0
  35. package/src/components/molecules/wt-checkbox/__tests__/WtCheckbox.spec.js +41 -0
  36. package/src/components/molecules/wt-checkbox/wt-checkbox.vue +175 -0
  37. package/src/components/molecules/wt-datepicker/__tests__/WtDatepicker.spec.js +28 -0
  38. package/src/components/molecules/wt-datepicker/wt-datepicker.vue +209 -0
  39. package/src/components/molecules/wt-datetimepicker/__tests__/WtDatetimepicker.spec.js +67 -0
  40. package/src/components/molecules/wt-datetimepicker/wt-datetimepicker.vue +314 -0
  41. package/src/components/molecules/wt-icon-btn/__tests__/WtIconBtn.spec.js +31 -0
  42. package/src/components/molecules/wt-icon-btn/wt-icon-btn.vue +113 -0
  43. package/src/components/molecules/wt-input/__tests__/WtInput.spec.js +25 -0
  44. package/src/components/molecules/wt-input/wt-input.vue +316 -0
  45. package/src/components/molecules/wt-label/__tests__/WtLabel.spec.js +9 -0
  46. package/src/components/molecules/wt-label/wt-label.vue +87 -0
  47. package/src/components/molecules/wt-notification/__tests__/WtNotification.spec.js +21 -0
  48. package/src/components/molecules/wt-notification/wt-notification.vue +74 -0
  49. package/src/components/molecules/wt-popup/__tests__/WtPopup.spec.js +47 -0
  50. package/src/components/molecules/wt-popup/wt-popup.vue +130 -0
  51. package/src/components/molecules/wt-progress-bar/__tests__/WtProgressBar.spec.js +17 -0
  52. package/src/components/molecules/wt-progress-bar/wt-progress-bar.vue +80 -0
  53. package/src/components/molecules/wt-radio/__tests__/WtRadio.spec.js +42 -0
  54. package/src/components/molecules/wt-radio/wt-radio.vue +168 -0
  55. package/src/components/molecules/wt-search-bar/__tests__/WtSearchBar.spec.js +36 -0
  56. package/src/components/molecules/wt-search-bar/wt-search-bar.vue +203 -0
  57. package/src/components/molecules/wt-select/__tests__/WtSelect.spec.js +53 -0
  58. package/src/components/molecules/wt-select/wt-select.vue +492 -0
  59. package/src/components/molecules/wt-slider/__tests__/WtSlider.spec.js +9 -0
  60. package/src/components/molecules/wt-slider/wt-slider.vue +175 -0
  61. package/src/components/molecules/wt-switcher/__tests__/WtSwitcher.spec.js +31 -0
  62. package/src/components/molecules/wt-switcher/wt-switcher.vue +177 -0
  63. package/src/components/molecules/wt-tabs/__tests__/WtTabs.spec.js +36 -0
  64. package/src/components/molecules/wt-tabs/wt-tabs.vue +127 -0
  65. package/src/components/molecules/wt-tags-input/__tests__/WtTagsInput.spec.js +45 -0
  66. package/src/components/molecules/wt-tags-input/wt-tags-input.vue +295 -0
  67. package/src/components/molecules/wt-textarea/__tests__/WtTextarea.spec.js +46 -0
  68. package/src/components/molecules/wt-textarea/wt-textarea.vue +185 -0
  69. package/src/components/molecules/wt-time-input/__tests__/WtTimeInput.spec.js +25 -0
  70. package/src/components/molecules/wt-time-input/wt-time-input.vue +192 -0
  71. package/src/components/molecules/wt-timepicker/__tests__/WtTimepicker.spec.js +60 -0
  72. package/src/components/molecules/wt-timepicker/wt-timepicker.vue +176 -0
  73. package/src/components/organisms/wt-app-header/__tests__/WtAppHeader.spec.js +19 -0
  74. package/src/components/organisms/wt-app-header/__tests__/WtAppNavigator.spec.js +23 -0
  75. package/src/components/organisms/wt-app-header/__tests__/WtHeaderActions.spec.js +21 -0
  76. package/src/components/organisms/wt-app-header/wt-app-header.vue +23 -0
  77. package/src/components/organisms/wt-app-header/wt-app-navigator.vue +245 -0
  78. package/src/components/organisms/wt-app-header/wt-header-actions.vue +177 -0
  79. package/src/components/organisms/wt-error-page/__tests__/wt-error-page.spec.js +17 -0
  80. package/src/components/organisms/wt-error-page/wt-error-page.vue +104 -0
  81. package/src/components/organisms/wt-filters-panel-wrapper/__tests__/wt-filters-panel-wrapper.spec.js +24 -0
  82. package/src/components/organisms/wt-filters-panel-wrapper/wt-filters-panel-wrapper.vue +146 -0
  83. package/src/components/organisms/wt-headline/__tests__/WtHeadline.spec.js +47 -0
  84. package/src/components/organisms/wt-headline/wt-headline.vue +46 -0
  85. package/src/components/organisms/wt-navigation-bar/__tests__/WtNavigationBar.spec.js +64 -0
  86. package/src/components/organisms/wt-navigation-bar/wt-navigation-bar.vue +249 -0
  87. package/src/components/organisms/wt-notifications-bar/__tests__/WtNotificationsBar.spec.js +50 -0
  88. package/src/components/organisms/wt-notifications-bar/wt-notifications-bar.vue +71 -0
  89. package/src/components/organisms/wt-page-wrapper/__tests__/WtPageWrapper.spec.js +33 -0
  90. package/src/components/organisms/wt-page-wrapper/wt-page-wrapper.vue +60 -0
  91. package/src/components/organisms/wt-pagination/__tests__/WtPagination.spec.js +38 -0
  92. package/src/components/organisms/wt-pagination/wt-pagination.vue +134 -0
  93. package/src/components/organisms/wt-player/__tests__/WtPlayer.spec.js +9 -0
  94. package/src/components/organisms/wt-player/wt-player.vue +116 -0
  95. package/src/components/organisms/wt-status-select/__tests__/WtStatusSelect.spec.js +25 -0
  96. package/src/components/organisms/wt-status-select/_internals/StatusOptions.lookup.js +24 -0
  97. package/src/components/organisms/wt-status-select/wt-status-select.vue +110 -0
  98. package/src/components/organisms/wt-table/__tests__/WtTable.spec.js +133 -0
  99. package/src/components/organisms/wt-table/__tests__/WtTableDeleteAction.spec.js +9 -0
  100. package/src/components/organisms/wt-table/__tests__/WtTableEditAction.spec.js +9 -0
  101. package/src/components/organisms/wt-table/_internals/getSortOrder.js +12 -0
  102. package/src/components/organisms/wt-table/table-cells/wt-table-delete-action.vue +18 -0
  103. package/src/components/organisms/wt-table/table-cells/wt-table-edit-action.vue +19 -0
  104. package/src/components/organisms/wt-table/wt-table.vue +241 -0
  105. package/src/components/organisms/wt-table-actions/__tests__/WtTableActions.spec.js +9 -0
  106. package/src/components/organisms/wt-table-actions/wt-table-actions.vue +90 -0
  107. package/src/components/organisms/wt-table-column-select/__tests__/WtTableColumnSelect.spec.js +31 -0
  108. package/src/components/organisms/wt-table-column-select/wt-table-column-select.vue +113 -0
  109. package/src/components/transitions/__tests__/ExpandTransition.spec.js +9 -0
  110. package/src/components/transitions/expand-transition.vue +70 -0
  111. package/src/css/colors/_colors.scss +151 -67
  112. package/src/css/components/_components.scss +38 -25
  113. package/src/css/components/atoms/wt-badge/_variables.scss +6 -5
  114. package/src/css/components/atoms/wt-badge/wt-badge.scss +36 -8
  115. package/src/css/components/atoms/wt-button/_variables.scss +46 -46
  116. package/src/css/components/atoms/wt-divider/_variables.scss +4 -4
  117. package/src/css/components/atoms/wt-icon/_variables.scss +7 -28
  118. package/src/css/components/atoms/wt-indicator/_variables.scss +18 -0
  119. package/src/css/components/atoms/wt-input-info/_variables.scss +6 -5
  120. package/src/css/components/atoms/wt-label/_variables.scss +4 -4
  121. package/src/css/components/atoms/wt-loader/_variables.scss +7 -7
  122. package/src/css/components/atoms/wt-rounded-action/_variables.scss +30 -0
  123. package/src/css/components/atoms/wt-tooltip/_variables.scss +9 -9
  124. package/src/css/components/molecules/wt-checkbox/_variables.scss +3 -3
  125. package/src/css/components/molecules/wt-datepicker/_variables.scss +19 -19
  126. package/src/css/components/molecules/wt-datepicker/datepicker-calendar.scss +100 -100
  127. package/src/css/components/molecules/wt-datetimepicker/_variables.scss +11 -11
  128. package/src/css/components/molecules/wt-icon-btn/_variables.scss +2 -2
  129. package/src/css/components/molecules/wt-input/_variables.scss +5 -5
  130. package/src/css/components/molecules/wt-notification/_variables.scss +9 -9
  131. package/src/css/components/molecules/wt-popup/_variables.scss +11 -10
  132. package/src/css/components/molecules/wt-progress-bar/_variables.scss +11 -0
  133. package/src/css/components/molecules/wt-radio/_variables.scss +6 -6
  134. package/src/css/components/molecules/wt-search-bar/_variables.scss +3 -3
  135. package/src/css/components/molecules/wt-select/_variables.scss +24 -22
  136. package/src/css/components/molecules/wt-slider/_variables.scss +15 -0
  137. package/src/css/components/molecules/wt-switcher/_variables.scss +17 -14
  138. package/src/css/components/molecules/wt-tabs/_variables.scss +13 -13
  139. package/src/css/components/molecules/wt-tags-input/_variables.scss +25 -0
  140. package/src/css/components/molecules/wt-textarea/_variables.scss +4 -4
  141. package/src/css/components/molecules/wt-timepicker/_variables.scss +4 -3
  142. package/src/css/components/organisms/wt-app-header/_variables.scss +20 -0
  143. package/src/css/components/organisms/wt-headline/_variables.scss +7 -0
  144. package/src/css/components/organisms/wt-navigation-bar/_variables.scss +14 -0
  145. package/src/css/components/organisms/wt-notifications-bar/_variables.scss +7 -0
  146. package/src/css/components/organisms/wt-page-wrapper/_variables.scss +5 -0
  147. package/src/css/components/organisms/wt-pagination/_variables.scss +6 -6
  148. package/src/css/components/organisms/wt-status-select/_variables.scss +6 -0
  149. package/src/css/components/organisms/wt-table/_variables.scss +16 -0
  150. package/src/css/components/organisms/wt-table-actions/_variables.scss +4 -0
  151. package/src/css/display-helpers/_display-helpers.scss +21 -0
  152. package/src/css/fonts/_fonts.scss +9 -0
  153. package/src/css/main.scss +68 -65
  154. package/src/css/shadows/_shadows.scss +7 -0
  155. package/src/css/sizes/_sizes.scss +2 -0
  156. package/src/css/sizes/_spacing.scss +17 -0
  157. package/src/css/sizes/_viewport-breakpoints.scss +20 -0
  158. package/src/css/styleguide/{styleguide.scss → _styleguide.scss} +4 -3
  159. package/src/css/styleguide/scroll.scss +43 -40
  160. package/src/css/transitions/_transitions.scss +1 -0
  161. package/src/css/transitions/fade/_fade.scss +8 -0
  162. package/src/css/typography/_typography.scss +72 -72
  163. package/src/enums/AgentStatus/AgentStatus.enum.js +6 -0
  164. package/src/enums/WebitelApplications/AdminSections.enum.js +41 -0
  165. package/src/enums/WebitelApplications/SupervisorSections.enum.js +7 -0
  166. package/src/enums/WebitelApplications/WebitelApplications.enum.js +10 -0
  167. package/src/locale/en/en.js +135 -0
  168. package/src/locale/i18n.js +2 -0
  169. package/src/locale/ru/ru.js +135 -2
  170. package/src/locale/ua/ua.js +160 -0
  171. package/src/mixins/dataFilterMixins/__tests__/apiFilterMixin.spec.js +57 -0
  172. package/src/mixins/dataFilterMixins/__tests__/enumFilterMixin.spec.js +66 -0
  173. package/src/mixins/dataFilterMixins/__tests__/paginationFilterMixin.spec.js +93 -0
  174. package/src/mixins/dataFilterMixins/__tests__/sortFilterMixin.spec.js +60 -0
  175. package/src/mixins/dataFilterMixins/__tests__/urlControllerMixin.spec.js +48 -0
  176. package/src/mixins/dataFilterMixins/_urlControllerMixin/_urlControllerMixin.js +37 -0
  177. package/src/mixins/dataFilterMixins/apiFilterMixin.js +23 -0
  178. package/src/mixins/dataFilterMixins/baseFilterMixin/baseFilterMixin.js +29 -0
  179. package/src/mixins/dataFilterMixins/enumFilterMixin.js +30 -0
  180. package/src/mixins/dataFilterMixins/paginationFilterMixin.js +79 -0
  181. package/src/mixins/dataFilterMixins/sortFilterMixin.js +75 -0
  182. package/src/mixins/validationMixin/__tests__/validationMixin.spec.js +47 -0
  183. package/src/mixins/validationMixin/validationMixin.js +40 -0
  184. package/src/modules/CSVExport/CSVExport.js +88 -0
  185. package/src/modules/CSVExport/__tests__/CSVExport.spec.js +63 -0
  186. package/src/modules/CSVExport/mixins/exportCSVMixin.js +46 -0
  187. package/src/modules/FilesExport/FilesExport.js +110 -0
  188. package/src/modules/FilesExport/__tests__/FilesExport.spec.js +66 -0
  189. package/src/modules/FilesExport/mixins/exportFilesMixin.js +46 -0
  190. package/src/modules/FilesExport/scripts/generateMediaURL.js +7 -0
  191. package/src/modules/QueryFilters/api/__tests__/defaults.spec.js +18 -0
  192. package/src/modules/QueryFilters/api/defaults.js +16 -0
  193. package/src/modules/QueryFilters/classes/ApiFilterSchema.js +32 -0
  194. package/src/modules/QueryFilters/classes/BaseFilterSchema.js +6 -0
  195. package/src/modules/QueryFilters/classes/EnumFilterSchema.js +23 -0
  196. package/src/modules/QueryFilters/classes/__tests__/ApiFilterSchema.spec.js +25 -0
  197. package/src/modules/QueryFilters/components/__tests__/abstract-api-filter.spec.js +54 -0
  198. package/src/modules/QueryFilters/components/__tests__/abstract-enum-filter.spec.js +40 -0
  199. package/src/modules/QueryFilters/components/__tests__/filter-search.spec.js +49 -0
  200. package/src/modules/QueryFilters/components/abstract-api-filter.vue +42 -0
  201. package/src/modules/QueryFilters/components/abstract-enum-filter.vue +32 -0
  202. package/src/modules/QueryFilters/components/filter-search.vue +33 -0
  203. package/src/modules/QueryFilters/mixins/__tests__/apiFilterMixin.spec.js +48 -0
  204. package/src/modules/QueryFilters/mixins/__tests__/enumFilterMixin.spec.js +54 -0
  205. package/src/modules/QueryFilters/mixins/__tests__/paginationFilterMixin.spec.js +74 -0
  206. package/src/modules/QueryFilters/mixins/__tests__/sortFilterMixin.spec.js +58 -0
  207. package/src/modules/QueryFilters/mixins/__tests__/urlControllerMixin.spec.js +48 -0
  208. package/src/modules/QueryFilters/mixins/_urlControllerMixin/_urlControllerMixin.js +39 -0
  209. package/src/modules/QueryFilters/mixins/apiFilterMixin.js +36 -0
  210. package/src/modules/QueryFilters/mixins/baseFilterMixin/baseFilterMixin.js +34 -0
  211. package/src/modules/QueryFilters/mixins/enumFilterMixin.js +36 -0
  212. package/src/modules/QueryFilters/mixins/paginationFilterMixin.js +66 -0
  213. package/src/modules/QueryFilters/mixins/sortFilterMixin.js +56 -0
  214. package/src/modules/QueryFilters/store/QueryFiltersStoreModule.js +50 -0
  215. package/src/modules/QueryFilters/store/__tests__/QueryFiltersStoreModule.spec.js +83 -0
  216. package/src/modules/QueryFilters/store/queryFilters.js +6 -0
  217. package/src/modules/Userinfo/api/BaseAPIService.js +7 -0
  218. package/src/modules/Userinfo/api/auth.js +29 -0
  219. package/src/modules/Userinfo/api/userinfo.js +32 -0
  220. package/src/modules/Userinfo/classes/ApplicationsAccess.js +170 -0
  221. package/src/modules/Userinfo/components/__tests__/auth.spec.js +57 -0
  222. package/src/modules/Userinfo/components/the-auth.vue +75 -0
  223. package/src/modules/Userinfo/store/UserinfoStoreModule.js +112 -0
  224. package/src/scripts/__tests__/caseConverters.spec.js +65 -0
  225. package/src/scripts/__tests__/convertDuration.spec.js +21 -0
  226. package/src/scripts/__tests__/debounce.spec.js +15 -0
  227. package/src/scripts/__tests__/editProxy.spec.js +9 -0
  228. package/src/scripts/__tests__/isEmpty.spec.js +16 -0
  229. package/src/scripts/__tests__/prettifyFileSize.spec.js +18 -0
  230. package/src/scripts/__tests__/prettifyTime.spec.js +18 -0
  231. package/src/scripts/__tests__/preventHiddenPageCallsDecorator.spec.js +16 -0
  232. package/src/scripts/__tests__/sortQueryAdapters.spec.js +12 -0
  233. package/src/scripts/caseConverters.js +78 -0
  234. package/src/scripts/convertDuration.js +15 -0
  235. package/src/scripts/editProxy.js +9 -0
  236. package/src/scripts/eventBus.js +4 -0
  237. package/src/scripts/isEmpty.js +9 -0
  238. package/src/scripts/prettifyFileSize.js +11 -0
  239. package/src/scripts/prettifyTime.js +9 -0
  240. package/src/scripts/preventHiddenPageCallsDecorator.js +6 -0
  241. package/src/scripts/sortQueryAdapters.js +21 -0
  242. package/src/store/BaseStoreModules/BaseStoreModule.js +49 -0
  243. package/src/store/BaseStoreModules/__tests__/BaseStoreModule.spec.js +104 -0
  244. package/src/store/helpers/__tests__/getNamespacedState.spec.js +11 -0
  245. package/src/store/helpers/getNamespacedState.js +5 -0
  246. package/dist/img/arrow-down--active--md.7b60f2fb6090366652124f77c543a516.svg +0 -3
  247. package/dist/img/arrow-down--disabled--md.f58424cd673258365e78863edd1e92cc.svg +0 -3
  248. package/dist/img/arrow-down--md.1843b60e1c244e066a650e8d19ea83c9.svg +0 -3
  249. package/dist/img/calendar--active--md.7fd3d949ec7234a4940ea452d95b4165.svg +0 -6
  250. package/dist/img/calendar--disabled--md.8e7a1e18f93ae8af270060400e6f881c.svg +0 -3
  251. package/dist/img/calendar--md.9c265581c3a405ff0f0e46e8092f36b8.svg +0 -6
  252. package/src/css/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
  253. package/src/css/fonts/Montserrat/Montserrat-SemiBold.ttf +0 -0
  254. package/src/css/fonts.scss +0 -9
@@ -0,0 +1,177 @@
1
+ <template>
2
+ <div
3
+ class="wt-switcher"
4
+ :class="{
5
+ 'wt-switcher--off': !value,
6
+ 'wt-switcher--on': value,
7
+ 'wt-switcher--disabled': disabled,
8
+ }"
9
+ >
10
+ <wt-label
11
+ class="wt-switcher__wrapper"
12
+ :class="{'wt-switcher__wrapper--label-left': labelLeft}"
13
+ v-bind="labelProps"
14
+ >
15
+ <input
16
+ class="wt-switcher__input"
17
+ type="checkbox"
18
+ :checked="value"
19
+ :disabled="disabled"
20
+ @change="inputHandler"
21
+ >
22
+ <span class="wt-switcher__checkmark"></span>
23
+ <!-- @slot Custom input label -->
24
+ <slot name="label" v-bind="{ label, value, disabled }">
25
+ <div v-if="label" class="wt-switcher__label">{{ label }}</div>
26
+ </slot>
27
+ </wt-label>
28
+ </div>
29
+ </template>
30
+
31
+ <script>
32
+ export default {
33
+ name: 'wt-switcher',
34
+ props: {
35
+ value: {
36
+ type: Boolean,
37
+ default: false,
38
+ },
39
+ label: {
40
+ type: String,
41
+ default: '',
42
+ },
43
+ labelLeft: {
44
+ type: Boolean,
45
+ default: false,
46
+ },
47
+ disabled: {
48
+ type: Boolean,
49
+ default: false,
50
+ },
51
+ labelProps: {
52
+ type: Object,
53
+ description: 'Object with props, passed down to wt-label as props',
54
+ },
55
+ },
56
+ model: {
57
+ prop: 'value',
58
+ event: 'change',
59
+ },
60
+ methods: {
61
+ inputHandler() {
62
+ this.$emit('change', !this.value);
63
+ },
64
+ },
65
+ };
66
+ </script>
67
+
68
+ <style lang="scss" scoped>
69
+ .wt-switcher {
70
+ @include width-fit-content;
71
+ position: relative;
72
+ box-sizing: border-box;
73
+ }
74
+
75
+ .wt-switcher__wrapper {
76
+ position: relative;
77
+ display: flex;
78
+ align-items: center;
79
+ user-select: none;
80
+ cursor: pointer;
81
+
82
+ &.wt-switcher__wrapper--label-left {
83
+ flex-direction: row-reverse;
84
+ }
85
+ }
86
+
87
+ .wt-switcher__label {
88
+ margin-left: var(--switcher-icon-margin);
89
+ transition: var(--transition);
90
+
91
+ .wt-switcher__wrapper--label-left & {
92
+ margin-left: 0;
93
+ margin-right: var(--switcher-icon-margin);
94
+ }
95
+ .wt-switcher:hover & {
96
+ color: var(--form-label--hover-color);
97
+ }
98
+ }
99
+
100
+ .wt-switcher__input {
101
+ position: absolute;
102
+ width: 0;
103
+ height: 0;
104
+ opacity: 0;
105
+ pointer-events: none;
106
+ }
107
+
108
+ .wt-switcher__checkmark {
109
+ position: relative;
110
+ display: block;
111
+ width: var(--switcher-width);
112
+ height: var(--switcher-height);
113
+ border-radius: var(--switcher-border-radius);
114
+ transition: var(--transition);
115
+
116
+ &:before {
117
+ content: '';
118
+ position: absolute;
119
+ bottom: var(--switcher-cicle-margin);
120
+ left: var(--switcher-cicle-margin);
121
+ height: var(--switcher-cicle-size);
122
+ width: var(--switcher-cicle-size);
123
+ background: var(--switcher-circle-bg-color);
124
+ border-radius: 50%;
125
+ transition: var(--transition);
126
+ }
127
+ }
128
+
129
+ .wt-switcher--off {
130
+ .wt-switcher__checkmark {
131
+ background: var(--switcher-bg-color--off);
132
+ }
133
+
134
+ &:hover {
135
+ .wt-switcher__checkmark {
136
+ background: var(--switcher-bg-color--off--hover);
137
+ }
138
+ }
139
+
140
+ &.wt-switcher--disabled {
141
+ .wt-switcher__checkmark {
142
+ background: var(--switcher-bg-color--off--disabled);
143
+ }
144
+ }
145
+ }
146
+
147
+ .wt-switcher--on {
148
+ .wt-switcher__checkmark {
149
+ background: var(--switcher-bg-color--on);
150
+
151
+ /* Show the indicator (dot/circle) when checked */
152
+ &:before {
153
+ transform: translateX(var(--switcher-cicle-translateX));
154
+ }
155
+ }
156
+
157
+ &:hover {
158
+ .wt-switcher__checkmark {
159
+ background: var(--switcher-bg-color--on--hover);
160
+ }
161
+ }
162
+
163
+ &.wt-switcher--disabled {
164
+ .wt-switcher__checkmark {
165
+ background: var(--switcher-bg-color--on--disabled);
166
+ }
167
+ }
168
+ }
169
+
170
+ .wt-switcher--disabled {
171
+ pointer-events: none;
172
+
173
+ .wt-switcher__label {
174
+ color: var(--form-label--disabled-color);
175
+ }
176
+ }
177
+ </style>
@@ -0,0 +1,36 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import WtTabs from '../wt-tabs.vue';
3
+
4
+ const tabs = [{ value: 'tab1', text: 'default' }];
5
+ describe('WtTabs', () => {
6
+ it('renders a component', () => {
7
+ const wrapper = shallowMount(WtTabs);
8
+ expect(wrapper.classes('wt-tabs')).toBe(true);
9
+ });
10
+
11
+ it('component emits change at tab click', () => {
12
+ const wrapper = shallowMount(WtTabs, {
13
+ propsData: { tabs },
14
+ });
15
+ wrapper.find('.wt-tab').trigger('click');
16
+ expect(wrapper.emitted().change.pop()).toEqual([tabs[0]]);
17
+ });
18
+
19
+ it('renders tab default content', () => {
20
+ const wrapper = shallowMount(WtTabs, {
21
+ propsData: { tabs },
22
+ });
23
+ expect(wrapper.find('.wt-tab').text()).toBe(tabs[0].text);
24
+ });
25
+
26
+ it('renders tab custom content via default slot', () => {
27
+ const custom = 'custom name';
28
+ const wrapper = shallowMount(WtTabs, {
29
+ propsData: { tabs },
30
+ slots: {
31
+ tab1: custom,
32
+ },
33
+ });
34
+ expect(wrapper.find('.wt-tab').text()).toBe(custom);
35
+ });
36
+ });
@@ -0,0 +1,127 @@
1
+ <template>
2
+ <nav class="wt-tabs">
3
+ <button
4
+ class="wt-tab"
5
+ :class="{
6
+ 'wt-tab--highlight': tab.value === current.value
7
+ }"
8
+ v-for="(tab) in tabs"
9
+ :value="tab.text"
10
+ :key="tab.value"
11
+ type="button"
12
+ @click="open(tab)"
13
+ >
14
+ <slot :name="tab.value" v-bind="{ tab, current }">
15
+ {{tab.text}}
16
+ </slot>
17
+ </button>
18
+
19
+ <div class="wt-tabs__underline">
20
+ <div
21
+ class="wt-tab__underline--highlight"
22
+ :style="{
23
+ width: `${activeLineWidth}px`,
24
+ transform: `translateX(${activeLineOffset}px)`
25
+ }"
26
+ ></div>
27
+ </div>
28
+ </nav>
29
+ </template>
30
+
31
+ <script>
32
+ export default {
33
+ name: 'wt-tabs',
34
+ props: {
35
+ current: {
36
+ type: Object,
37
+ default: () => ({}),
38
+ },
39
+ tabs: {
40
+ type: Array,
41
+ default: () => [],
42
+ },
43
+ },
44
+
45
+ model: {
46
+ prop: 'current',
47
+ event: 'change',
48
+ },
49
+
50
+ data: () => ({
51
+ activeLineWidth: 0,
52
+ activeLineOffset: 0,
53
+ }),
54
+
55
+ methods: {
56
+ open(value) {
57
+ this.$emit('change', value);
58
+ this.moveActiveLine(value);
59
+ },
60
+
61
+ moveActiveLine(newValue) {
62
+ if (!this.current) return;
63
+ if (!this.$refs || !this.$refs[newValue] || !this.$refs[newValue][0]) return;
64
+ const element = this.$refs[newValue][0];
65
+ this.activeLineWidth = element.clientWidth;
66
+ this.activeLineOffset = element.offsetLeft;
67
+ },
68
+ },
69
+ };
70
+ </script>
71
+
72
+ <style lang="scss" scoped>
73
+ .wt-tabs {
74
+ position: relative;
75
+ }
76
+
77
+ .wt-tab {
78
+ @extend %typo-body-lg;
79
+ position: relative;
80
+ display: inline-block;
81
+ padding: var(--tab-padding);
82
+ margin: var(--tab-margin);
83
+ color: var(--tab-color);
84
+ background: transparent;
85
+ border: none;
86
+ border-bottom: var(--tab-border);
87
+ border-bottom-color: transparent;
88
+ transition: var(--transition);
89
+ cursor: pointer;
90
+ z-index: var(--tab-z-index);
91
+ outline: none;
92
+
93
+ &:hover,
94
+ &:focus, {
95
+ @extend %typo-strong-lg;
96
+ color: var(--tab--hover-color);
97
+ }
98
+
99
+ &.wt-tab--highlight {
100
+ @extend %typo-strong-lg;
101
+ color: var(--tab--active-color);
102
+ border-bottom-color: var(--tab--active-border-color);
103
+ }
104
+
105
+ // disables bold font resize on hover
106
+ &:after {
107
+ display: block;
108
+ content: attr(value);
109
+ font-family: 'Montserrat Semi', monospace;
110
+ height: 0;
111
+ overflow: hidden;
112
+ visibility: hidden;
113
+ }
114
+ }
115
+
116
+ // all tabs underline
117
+ .wt-tabs__underline {
118
+ position: absolute;
119
+ left: 0;
120
+ right: 0;
121
+ bottom: 0;
122
+ height: var(--tabs-underiline-height);
123
+ background: var(--tabs-underiline-color);
124
+ z-index: 0;
125
+ }
126
+
127
+ </style>
@@ -0,0 +1,45 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import WtTagsInput from '../wt-tags-input.vue';
3
+ import WtLabel from '../../wt-label/wt-label.vue';
4
+
5
+ describe('WtTagsInput', () => {
6
+ it('renders a component', () => {
7
+ const wrapper = shallowMount(WtTagsInput);
8
+ expect(wrapper.classes('wt-tags-input')).toBe(true);
9
+ });
10
+
11
+ it('renders label text when passed', () => {
12
+ const label = 'Hello there';
13
+ const wrapper = shallowMount(WtTagsInput, {
14
+ stubs: { WtLabel },
15
+ propsData: { label },
16
+ });
17
+ expect(wrapper.find('.wt-label').text()).toBe(label);
18
+ });
19
+
20
+ it('emits "input" event at native "tags-changed" event', () => {
21
+ const tags = [{ text: '123' }];
22
+ const wrapper = shallowMount(WtTagsInput);
23
+ wrapper.findComponent({ name: 'vue-tags-input' }).vm.$emit('tags-changed', tags);
24
+ expect(wrapper.emitted().input[0][0]).toEqual(tags);
25
+ });
26
+
27
+ it('correctly computes autocomplete options', () => {
28
+ const autocompleteItems = [{ name: '123' }, { name: '321' }];
29
+ const autocompleteOptions = [{ name: '123', text: '123' }, { name: '321', text: '321' }];
30
+ const wrapper = shallowMount(WtTagsInput, {
31
+ propsData: { autocompleteItems },
32
+ });
33
+ expect(wrapper.vm.autocompleteOptions).toEqual(autocompleteOptions);
34
+ });
35
+
36
+ it('correctly filters autocomplete options with search', () => {
37
+ const autocompleteItems = [{ name: '123' }, { name: '456' }];
38
+ const filteredAutocompleteOptions = [{ name: '123', text: '123' }];
39
+ const wrapper = shallowMount(WtTagsInput, {
40
+ data: () => ({ input: '1' }),
41
+ propsData: { autocompleteItems },
42
+ });
43
+ expect(wrapper.vm.autocompleteOptions).toEqual(filteredAutocompleteOptions);
44
+ });
45
+ });
@@ -0,0 +1,295 @@
1
+ <template>
2
+ <div
3
+ class="wt-tags-input"
4
+ :class="{
5
+ 'wt-tags-input--disabled': disabled,
6
+ 'wt-tags-input--invalid': invalid,
7
+ }"
8
+ >
9
+ <wt-label
10
+ class="wt-tags-input__label"
11
+ v-if="hasLabel"
12
+ :disabled="disabled"
13
+ :invalid="invalid"
14
+ v-bind="labelProps"
15
+ >
16
+ <!-- @slot Custom input label -->
17
+ <slot name="label" v-bind="{ label }">{{ requiredLabel }}</slot>
18
+ </wt-label>
19
+
20
+ <vue-tags-input
21
+ class="wt-tags-input__tags-input"
22
+ v-model="input"
23
+ v-bind="{ ...$attrs, ...$props }"
24
+ :tags="tags"
25
+ :autocomplete-items="autocompleteOptions"
26
+ :placeholder="placeholder || label"
27
+ v-on="listeners"
28
+ >
29
+ <template slot="tag-actions" slot-scope="{ index, performDelete }">
30
+ <wt-icon-btn
31
+ icon="remove-rounded"
32
+ size="sm"
33
+ color="active"
34
+ @click="performDelete(index)"
35
+ ></wt-icon-btn>
36
+ </template>
37
+ </vue-tags-input>
38
+
39
+ <wt-input-info
40
+ v-if="isValidation"
41
+ :invalid="invalid"
42
+ >{{ validationText }}
43
+ </wt-input-info>
44
+ </div>
45
+ </template>
46
+
47
+ <script>
48
+ import VueTagsInput from '@johmun/vue-tags-input';
49
+ import validationMixin from '../../../mixins/validationMixin/validationMixin';
50
+
51
+ export default {
52
+ name: 'wt-tags-input',
53
+ mixins: [validationMixin],
54
+ components: { VueTagsInput },
55
+ props: {
56
+ value: {
57
+ type: Array,
58
+ },
59
+
60
+ autocompleteItems: {
61
+ type: Array,
62
+ default: () => [],
63
+ },
64
+
65
+ label: {
66
+ type: String,
67
+ default: '',
68
+ },
69
+
70
+ placeholder: {
71
+ type: String,
72
+ default: '',
73
+ },
74
+
75
+ disabled: {
76
+ type: Boolean,
77
+ default: false,
78
+ },
79
+
80
+ autocompleteMinLength: {
81
+ type: Number,
82
+ default: 0,
83
+ },
84
+
85
+ addOnlyFromAutocomplete: {
86
+ type: Boolean,
87
+ default: false,
88
+ },
89
+
90
+ autocompleteFilterDuplicates: {
91
+ type: Boolean,
92
+ default: true,
93
+ },
94
+
95
+ labelProps: {
96
+ type: Object,
97
+ description: 'Object with props, passed down to wt-label as props',
98
+ },
99
+ },
100
+
101
+ data: () => ({
102
+ input: '',
103
+ }),
104
+
105
+ computed: {
106
+ hasLabel() {
107
+ return !!(this.label || this.$slots.label);
108
+ },
109
+
110
+ requiredLabel() {
111
+ return this.required ? `${this.label}*` : this.label;
112
+ },
113
+
114
+ tags() {
115
+ if (!this.value) return [];
116
+ return this.value.map((item) => ({ text: item.name || item.value, ...item }));
117
+ },
118
+
119
+ autocompleteOptions() {
120
+ return this.autocompleteItems
121
+ .map((item) => ({
122
+ text: typeof item === 'object' ? item.name || item.value : item,
123
+ ...item,
124
+ }))
125
+ .filter((item) => item.text?.includes(this.input));
126
+ },
127
+
128
+ listeners() {
129
+ return {
130
+ ...this.$listeners,
131
+ input: this.searchTags,
132
+ 'tags-changed': this.changeTags,
133
+ };
134
+ },
135
+ },
136
+
137
+ methods: {
138
+ searchTags(search) {
139
+ this.$emit('search', search);
140
+ },
141
+
142
+ changeTags(tags) {
143
+ this.$emit('input', tags);
144
+ },
145
+ },
146
+ };
147
+ </script>
148
+
149
+ <style lang="scss" scoped>
150
+ .wt-tags-input {
151
+ width: 100%;
152
+ }
153
+
154
+ .wt-label {
155
+ margin-bottom: var(--label-margin);
156
+ cursor: text;
157
+
158
+ .wt-tags-input:hover &,
159
+ .wt-tags-input:focus-within & {
160
+ color: var(--form-label--hover-color);
161
+ }
162
+ }
163
+
164
+ // increase specificity
165
+ .wt-tags-input .wt-tags-input__tags-input {
166
+ width: 100%;
167
+ max-width: 100%; // reset default
168
+
169
+ ::v-deep {
170
+ .ti-input {
171
+ box-sizing: border-box;
172
+ min-height: var(--tags-input-min-height); // preserve height, if tags is empty
173
+ padding: 0; // reset default
174
+ border: var(--tags-input-border);
175
+ border-color: var(--tags-input-border-color);
176
+ border-radius: var(--border-radius);
177
+ transition: var(--transition);
178
+
179
+ .ti-tags {
180
+ display: flex;
181
+ align-items: center;
182
+ padding: var(--tags-input-padding);
183
+ margin: 0; // reset default
184
+ word-break: break-word; //break long word
185
+ }
186
+
187
+ .ti-new-tag-input-wrapper {
188
+ padding: 0; // reset default
189
+ margin: 0; // reset default
190
+ }
191
+
192
+ .ti-new-tag-input {
193
+ @extend %typo-body-lg;
194
+ border-radius: var(--border-radius);
195
+
196
+ &::placeholder {
197
+ @extend %typo-body-lg;
198
+ color: var(--form-placeholder-color);
199
+ }
200
+ }
201
+
202
+ .ti-tag {
203
+ @extend %typo-body-lg;
204
+ height: fit-content;
205
+ padding: var(--tags-input-padding);
206
+ margin: 0 var(--tags-input-tag-spacing-margin) var(--tags-input-tag-spacing-margin) 0; // reset default
207
+ color: var(--tags-input-tag-text-color);
208
+ background: var(--tags-input-tag-bg-color);
209
+ border-radius: var(--tags-input-tag-border-radius);
210
+ transition: var(--transition);
211
+
212
+ .ti-actions {
213
+ margin-left: var(--tags-input-tag-actions-margin-left);
214
+ }
215
+ // pre-delete state after 1 backspace press
216
+ &.ti-deletion-mark { // FIXME
217
+ color: var(--tags-input-tag-text-color--deletion);
218
+ background: var(--tags-input-tag-bg-color--deletion);
219
+
220
+ .wt-icon__icon {
221
+ fill: var(--tags-input-tag-text-color--deletion);
222
+ }
223
+ }
224
+ }
225
+ }
226
+
227
+ .ti-autocomplete {
228
+ @extend %wt-distant-scrollbar;
229
+ max-height: var(--tags-input-autocomplete-max-height);
230
+ border: var(--tags-input-autocomplete-border);
231
+ border-color: var(--tags-input-autocomplete-border-color);
232
+ border-radius: var(--border-radius);
233
+ transition: var(--transition);
234
+ overflow: auto;
235
+
236
+ .ti-item {
237
+ background: transparent; // reset default
238
+
239
+ & > div {
240
+ @extend %typo-body-lg;
241
+ padding: var(--tags-input-autocomplete-option-padding);
242
+ color: var(--tags-input-autocomplete-option--text-color);
243
+ transition: var(--transition);
244
+
245
+ &:hover {
246
+ color: var(--tags-input-option-text-color--hover);
247
+ background: var(--tags-input-option-bg-color--hover);
248
+ }
249
+ }
250
+ }
251
+ }
252
+ }
253
+ }
254
+
255
+ .wt-tags-input--invalid,
256
+ .wt-tags-input--invalid:hover,
257
+ .wt-tags-input--invalid:focus-within, {
258
+ .wt-label {
259
+ color: var(--false-color);
260
+ }
261
+
262
+ .wt-tags-input__tags-input {
263
+ ::v-deep {
264
+ .ti-input {
265
+ border-color: var(--false-color);
266
+ }
267
+ }
268
+ }
269
+ }
270
+
271
+ .wt-tags-input--disabled {
272
+ pointer-events: none;
273
+
274
+ .wt-tags-input__tags-input {
275
+ width: 100%;
276
+ max-width: 100%; // reset default
277
+
278
+ ::v-deep {
279
+ .ti-input {
280
+ border-color: transparent;
281
+
282
+ .ti-new-tag-input-wrapper {
283
+ display: none;
284
+ }
285
+
286
+ .ti-tag {
287
+ .ti-actions {
288
+ display: none;
289
+ }
290
+ }
291
+ }
292
+ }
293
+ }
294
+ }
295
+ </style>