@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,46 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import WtTextarea from '../wt-textarea.vue';
3
+ import WtLabel from '../../wt-label/wt-label.vue';
4
+
5
+ describe('WtTextarea', () => {
6
+ it('renders a component', () => {
7
+ const wrapper = shallowMount(WtTextarea, {
8
+ stubs: {
9
+ WtLabel,
10
+ },
11
+ });
12
+ expect(wrapper.classes('wt-textarea')).toBe(true);
13
+ });
14
+
15
+ it('renders label text when passed', () => {
16
+ const label = 'Hello there';
17
+ const wrapper = shallowMount(WtTextarea, {
18
+ stubs: {
19
+ WtLabel,
20
+ },
21
+ propsData: { label },
22
+ });
23
+ expect(wrapper.find('.wt-label').text()).toBe(label);
24
+ });
25
+
26
+ it('emits "Enter" event if chat-mode prop is passed', () => {
27
+ const wrapper = shallowMount(WtTextarea, {
28
+ stubs: {
29
+ WtLabel,
30
+ },
31
+ propsData: { chatMode: true },
32
+ });
33
+ wrapper.find('.wt-textarea__textarea').trigger('keypress', { key: 'Enter' });
34
+ expect(wrapper.emitted().enter).toBeTruthy();
35
+ });
36
+
37
+ it('do not emit "Enter" event if chat-mode prop is not passed', () => {
38
+ const wrapper = shallowMount(WtTextarea, {
39
+ stubs: {
40
+ WtLabel,
41
+ },
42
+ });
43
+ wrapper.find('.wt-textarea__textarea').trigger('keypress', { key: 'Enter' });
44
+ expect(wrapper.emitted().enter).toBeFalsy();
45
+ });
46
+ });
@@ -0,0 +1,185 @@
1
+ <template>
2
+ <div
3
+ class="wt-textarea"
4
+ :class="{
5
+ 'wt-textarea--disabled': disabled,
6
+ }"
7
+ >
8
+ <wt-label
9
+ :for="name"
10
+ :disabled="disabled"
11
+ v-bind="labelProps"
12
+ >
13
+ <!-- @slot Custom input label -->
14
+ <slot name="label" v-bind="{ label }">{{ label }}</slot>
15
+ </wt-label>
16
+ <div class="wt-textarea__wrapper">
17
+ <textarea
18
+ :id="name"
19
+ class="wt-textarea__textarea"
20
+ :value="value"
21
+ :placeholder="placeholder || label"
22
+ :disabled="disabled"
23
+ v-on="listeners"
24
+ ></textarea>
25
+ <wt-icon-btn
26
+ class="wt-textarea__reset-icon-btn"
27
+ :class="{ 'hidden': !value }"
28
+ icon="remove-rounded"
29
+ size="sm"
30
+ :disabled="disabled"
31
+ @click="$emit('input', '')"
32
+ ></wt-icon-btn>
33
+ </div>
34
+ </div>
35
+ </template>
36
+
37
+ <script>
38
+ export default {
39
+ name: 'wt-textarea',
40
+ props: {
41
+ /**
42
+ * Current textarea value (`v-model`)
43
+ */
44
+ value: {
45
+ type: String,
46
+ default: '',
47
+ },
48
+ /**
49
+ * textarea label
50
+ */
51
+ label: {
52
+ type: String,
53
+ default: '',
54
+ },
55
+ /**
56
+ * textarea placeholder
57
+ */
58
+ placeholder: {
59
+ type: String,
60
+ },
61
+ /**
62
+ * Native textarea disabled attribute
63
+ */
64
+ disabled: {
65
+ type: Boolean,
66
+ default: false,
67
+ description: 'Native textarea disabled attribute',
68
+ },
69
+ /**
70
+ * textarea name
71
+ */
72
+ name: {
73
+ type: String,
74
+ default: '',
75
+ },
76
+ chatMode: {
77
+ type: Boolean,
78
+ default: false,
79
+ },
80
+ labelProps: {
81
+ type: Object,
82
+ description: 'Object with props, passed down to wt-label as props',
83
+ },
84
+ },
85
+
86
+ computed: {
87
+ listeners() {
88
+ return {
89
+ ...this.$listeners,
90
+ input: (event) => this.$emit('input', event.target.value),
91
+ keypress: (event) => this.handleKeypress(event),
92
+ };
93
+ },
94
+ },
95
+
96
+ methods: {
97
+ handleKeypress(event) {
98
+ if (!this.chatMode) return;
99
+ if (event.key === 'Enter' && !event.shiftKey) {
100
+ this.$emit('enter');
101
+ event.preventDefault();
102
+ }
103
+ },
104
+ },
105
+ };
106
+ </script>
107
+
108
+ <style lang="scss" scoped>
109
+ .wt-textarea {
110
+ cursor: text;
111
+
112
+ &--disabled {
113
+ pointer-events: none;
114
+ }
115
+ }
116
+
117
+ .wt-textarea__wrapper {
118
+ position: relative;
119
+ }
120
+
121
+ .wt-label {
122
+ margin-bottom: var(--label-margin);
123
+ cursor: text;
124
+
125
+ .wt-textarea:hover &,
126
+ .wt-textarea:focus-within & {
127
+ color: var(--form-label--hover-color);
128
+ }
129
+ }
130
+
131
+ .wt-textarea__reset-icon-btn {
132
+ position: absolute;
133
+ top: var(--input-icon-margin);
134
+ right: var(--input-icon-margin);
135
+
136
+ .wt-textarea:not(:focus-within) & {
137
+ opacity: 0;
138
+ pointer-events: none;
139
+ }
140
+ }
141
+
142
+ .wt-textarea__textarea {
143
+ @extend %typo-body-lg;
144
+
145
+ display: block;
146
+ width: 100%;
147
+ min-height: var(--textarea-min-height);
148
+ box-sizing: border-box;
149
+ padding: var(--textarea-padding);
150
+ color: var(--form-input-color);
151
+ border: var(--input-border);
152
+ border-color: var(--form-border-color);
153
+ border-radius: var(--border-radius);
154
+ transition: var(--transition);
155
+ resize: none;
156
+
157
+ &::placeholder {
158
+ color: var(--form-placeholder-color)
159
+ }
160
+
161
+ .wt-textarea:hover &,
162
+ &:focus {
163
+ border-color: var(--form-border--hover-color);
164
+
165
+ &::placeholder {
166
+ color: var(--form-placeholder--hover-color)
167
+ }
168
+ }
169
+
170
+ .wt-textarea--disabled & {
171
+ background: var(--form-border--disabled-color);
172
+ border-color: var(--form-border--disabled-color);
173
+
174
+ &::placeholder {
175
+ color: var(--form-placeholder--disabled-color);
176
+ }
177
+ }
178
+ }
179
+
180
+ /* make icons black */
181
+ .wt-textarea:hover ::v-deep .wt-icon__icon,
182
+ .wt-textarea:focus-within ::v-deep .wt-icon__icon {
183
+ fill: var(--icon-color--hover);
184
+ }
185
+ </style>
@@ -0,0 +1,25 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import WtTimeInput from '../wt-time-input.vue';
3
+ import WtLabel from '../../wt-label/wt-label.vue';
4
+
5
+ describe('WtTimeInput', () => {
6
+ it('renders a component', () => {
7
+ const wrapper = shallowMount(WtTimeInput, {
8
+ stubs: {
9
+ WtLabel,
10
+ },
11
+ });
12
+ expect(wrapper.classes('wt-time-input')).toBe(true);
13
+ });
14
+
15
+ it('renders label text when passed', () => {
16
+ const label = 'Hello there';
17
+ const wrapper = shallowMount(WtTimeInput, {
18
+ stubs: {
19
+ WtLabel,
20
+ },
21
+ propsData: { label },
22
+ });
23
+ expect(wrapper.find('.wt-label').text()).toBe(label);
24
+ });
25
+ });
@@ -0,0 +1,192 @@
1
+ <template>
2
+ <div
3
+ class="wt-time-input"
4
+ :class="{
5
+ 'wt-time-input--outline': outline,
6
+ 'wt-time-input--disabled': disabled,
7
+ 'wt-time-input--invalid': invalid,
8
+ }"
9
+ >
10
+ <wt-label
11
+ v-if="hasLabel"
12
+ :for="name"
13
+ :outline="outline"
14
+ :disabled="disabled"
15
+ :invalid="invalid"
16
+ v-bind="labelProps"
17
+ >
18
+ <!-- @slot Custom input label -->
19
+ <slot name="label" v-bind="{ label }">{{ label }}</slot>
20
+ </wt-label>
21
+ <div class="wt-time-input__wrapper">
22
+ <input
23
+ :id="name"
24
+ class="wt-time-input__input"
25
+ :value="value"
26
+ :min="0"
27
+ :max="maxValue"
28
+ :disabled="disabled"
29
+ type="number"
30
+ v-on="listeners"
31
+ >
32
+ </div>
33
+ <wt-input-info
34
+ v-if="showInfo"
35
+ :invalid="invalid"
36
+ >{{ validationText }}
37
+ </wt-input-info>
38
+ </div>
39
+ </template>
40
+
41
+ <script>
42
+ import validationMixin from '../../../mixins/validationMixin/validationMixin';
43
+
44
+ export default {
45
+ name: 'wt-time-input',
46
+ mixins: [validationMixin],
47
+ props: {
48
+ /**
49
+ * Current input value (`v-model`)
50
+ */
51
+ value: {
52
+ type: Number,
53
+ default: 0,
54
+ },
55
+ /**
56
+ * Form input label
57
+ */
58
+ label: {
59
+ type: String,
60
+ default: '',
61
+ },
62
+ /**
63
+ * Form input name
64
+ */
65
+ name: {
66
+ type: String,
67
+ default: '',
68
+ },
69
+ /**
70
+ * Time type: day, minute, second
71
+ */
72
+ maxValue: {
73
+ type: Number,
74
+ },
75
+ /**
76
+ * Native input required attribute
77
+ */
78
+ required: {
79
+ type: Boolean,
80
+ default: false,
81
+ description: 'Native input required attribute',
82
+ },
83
+ /**
84
+ * Native input disabled attribute
85
+ */
86
+ disabled: {
87
+ type: Boolean,
88
+ default: false,
89
+ description: 'Native input disabled attribute',
90
+ },
91
+
92
+ outline: {
93
+ type: Boolean,
94
+ default: false,
95
+ },
96
+
97
+ labelProps: {
98
+ type: Object,
99
+ description: 'Object with props, passed down to wt-label as props',
100
+ },
101
+
102
+ hideInputInfo: {
103
+ type: Boolean,
104
+ default: false,
105
+ },
106
+ },
107
+ computed: {
108
+ hasLabel() {
109
+ return !!(this.label || this.$slots.label);
110
+ },
111
+ listeners() {
112
+ return {
113
+ ...this.$listeners,
114
+ input: (event) => this.$emit('input', event.target.value),
115
+ };
116
+ },
117
+ showInfo() {
118
+ return this.isValidation && !this.hideInputInfo;
119
+ },
120
+ },
121
+ };
122
+ </script>
123
+
124
+ <style lang="scss" scoped>
125
+ .wt-time-input {
126
+ display: inline-block;
127
+ cursor: text;
128
+
129
+ &--disabled {
130
+ pointer-events: none;
131
+ }
132
+ }
133
+
134
+ .wt-time-input__wrapper {
135
+ position: relative;
136
+ }
137
+
138
+ .wt-label {
139
+ text-align: center;
140
+ margin-bottom: var(--label-margin);
141
+ cursor: text;
142
+
143
+ .wt-time-input:hover &,
144
+ .wt-time-input:focus-within & {
145
+ color: var(--form-label--hover-color);
146
+ }
147
+
148
+ .wt-time-input--invalid:hover &,
149
+ .wt-time-input--invalid:focus-within & {
150
+ color: var(--label--invalid-color);
151
+ }
152
+ }
153
+
154
+ .wt-time-input__input {
155
+ @extend %typo-body-lg;
156
+
157
+ display: block;
158
+ width: 100%;
159
+ box-sizing: border-box;
160
+ padding: var(--input-padding);
161
+ color: var(--form-input-color);
162
+ border: var(--input-border);
163
+ border-color: var(--form-border-color);
164
+ border-radius: var(--border-radius);
165
+ transition: var(--transition);
166
+
167
+ .wt-time-input:hover &,
168
+ &:focus {
169
+ border-color: var(--form-border--hover-color);
170
+ }
171
+
172
+ .wt-time-input--outline & {
173
+ border-color: var(--form-outline-border-color);
174
+ }
175
+
176
+ .wt-time-input--outline:hover &,
177
+ .wt-time-input--outline &:focus {
178
+ border-color: var(--form-outline-border--hover-color);
179
+ }
180
+
181
+ .wt-time-input--disabled & {
182
+ background: var(--form-border--disabled-color);
183
+ border-color: var(--form-border--disabled-color);
184
+ }
185
+
186
+ .wt-time-input--invalid &,
187
+ .wt-time-input--invalid:hover & {
188
+ border-color: var(--false-color);
189
+ outline: none; // prevent outline overlapping false color
190
+ }
191
+ }
192
+ </style>
@@ -0,0 +1,60 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import WtTimepicker from '../wt-timepicker.vue';
3
+ import WtTimeInput from '../../wt-time-input/wt-time-input.vue';
4
+
5
+ describe('WtTimepicker', () => {
6
+ it('renders a component', () => {
7
+ const wrapper = shallowMount(WtTimepicker, {
8
+ stubs: {
9
+ WtTimeInput: true,
10
+ },
11
+ });
12
+ expect(wrapper.classes('wt-timepicker')).toBe(true);
13
+ });
14
+
15
+ it('renders only specified by format time inputs', () => {
16
+ const wrapper = shallowMount(WtTimepicker, {
17
+ stubs: {
18
+ WtTimeInput,
19
+ },
20
+ propsData: { format: 'mm' },
21
+ });
22
+ expect(wrapper.findAllComponents(WtTimeInput).length).toBe(1);
23
+ });
24
+
25
+ it('Correctly converts value from MIN time-input to output', () => {
26
+ const value = 0;
27
+ const wrapper = shallowMount(WtTimepicker, {
28
+ stubs: {
29
+ WtTimeInput,
30
+ },
31
+ propsData: { value },
32
+ });
33
+ wrapper.findAllComponents(WtTimeInput).at(0).vm.$emit('input', 21);
34
+ expect(wrapper.emitted().input[0]).toEqual([21 * 60 * 60]);
35
+ });
36
+
37
+ it('Correctly converts value from HOUR time-input to output', () => {
38
+ const value = 0;
39
+ const wrapper = shallowMount(WtTimepicker, {
40
+ stubs: {
41
+ WtTimeInput,
42
+ },
43
+ propsData: { value },
44
+ });
45
+ wrapper.findAllComponents(WtTimeInput).at(1).vm.$emit('input', 21);
46
+ expect(wrapper.emitted().input[0]).toEqual([21 * 60]);
47
+ });
48
+
49
+ it('Correctly converts value from SEC time-input to output', () => {
50
+ const value = 0;
51
+ const wrapper = shallowMount(WtTimepicker, {
52
+ stubs: {
53
+ WtTimeInput,
54
+ },
55
+ propsData: { value },
56
+ });
57
+ wrapper.findAllComponents(WtTimeInput).at(2).vm.$emit('input', 21);
58
+ expect(wrapper.emitted().input[0]).toEqual([21]);
59
+ });
60
+ });
@@ -0,0 +1,176 @@
1
+ <template>
2
+ <div class="wt-timepicker" :class="{'wt-timepicker--invalid': invalid}">
3
+ <wt-label
4
+ v-if="label"
5
+ :invalid="invalid"
6
+ v-bind="labelProps"
7
+ >
8
+ {{ `${label} (${format})` }}
9
+ </wt-label>
10
+ <div class="wt-timepicker__wrapper">
11
+ <wt-time-input
12
+ v-if="isHour"
13
+ v-model="hour"
14
+ :v="v"
15
+ :label="label ? null : $t('webitelUI.timepicker.hour') "
16
+ :maxValue="dateMode ? null : 23"
17
+ :disabled="disabled"
18
+ hide-input-info
19
+ ></wt-time-input>
20
+ <wt-time-input
21
+ v-if="isMin"
22
+ v-model="min"
23
+ :v="v"
24
+ :label="label ? null : $t('webitelUI.timepicker.min')"
25
+ :maxValue="59"
26
+ :disabled="disabled"
27
+ hide-input-info
28
+ ></wt-time-input>
29
+ <wt-time-input
30
+ v-if="isSec"
31
+ v-model="sec"
32
+ :v="v"
33
+ :label="label ? null : $t('webitelUI.timepicker.sec')"
34
+ :maxValue="59"
35
+ :disabled="disabled"
36
+ hide-input-info
37
+ ></wt-time-input>
38
+ </div>
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 validationMixin from '../../../mixins/validationMixin/validationMixin';
49
+
50
+ const SEC_IN_HOUR = 60 * 60;
51
+ const SEC_IN_MIN = 60;
52
+
53
+ export default {
54
+ name: 'wt-timepicker',
55
+ mixins: [validationMixin],
56
+ props: {
57
+ value: {
58
+ type: [String, Number],
59
+ default: 0,
60
+ },
61
+ dateMode: {
62
+ type: Boolean,
63
+ default: false,
64
+ },
65
+ label: {
66
+ type: String,
67
+ default: '',
68
+ },
69
+ format: {
70
+ type: String,
71
+ default: 'hh:mm:ss',
72
+ },
73
+ disabled: {
74
+ type: Boolean,
75
+ default: false,
76
+ },
77
+ labelProps: {
78
+ type: Object,
79
+ description: 'Object with props, passed down to wt-label as props',
80
+ },
81
+ },
82
+ model: {
83
+ prop: 'value',
84
+ event: 'input',
85
+ },
86
+
87
+ computed: {
88
+ isHour() {
89
+ return this.format.includes('hh');
90
+ },
91
+ isMin() {
92
+ return this.format.includes('mm');
93
+ },
94
+ isSec() {
95
+ return this.format.includes('ss');
96
+ },
97
+ hour: {
98
+ get() {
99
+ return this.dateMode
100
+ ? new Date(+this.value).getHours()
101
+ : Math.floor(this.value / SEC_IN_HOUR);
102
+ },
103
+ set(value) {
104
+ const newValue = this.dateMode
105
+ ? new Date(this.value).setHours(value)
106
+ : this.value - this.hour * SEC_IN_HOUR + value * SEC_IN_HOUR;
107
+ this.$emit('input', newValue);
108
+ },
109
+ },
110
+ min: {
111
+ get() {
112
+ return this.dateMode
113
+ ? new Date(+this.value).getMinutes()
114
+ : Math.floor((this.value / SEC_IN_MIN) % 60);
115
+ },
116
+ set(value) {
117
+ const newValue = this.dateMode
118
+ ? new Date(this.value).setMinutes(value)
119
+ : this.value - this.min * SEC_IN_MIN + value * SEC_IN_MIN;
120
+ this.$emit('input', newValue);
121
+ },
122
+ },
123
+ sec: {
124
+ get() {
125
+ return this.dateMode
126
+ ? new Date(+this.value).getSeconds()
127
+ : Math.floor(this.value % 60);
128
+ },
129
+ set(value) {
130
+ const newValue = this.dateMode
131
+ ? new Date(this.value).setSeconds(value)
132
+ : this.value - this.sec + +value;
133
+ this.$emit('input', newValue);
134
+ },
135
+ },
136
+ },
137
+
138
+ methods: {},
139
+ };
140
+ </script>
141
+
142
+ <style lang="scss" scoped>
143
+ .wt-timepicker {
144
+ display: flex;
145
+ flex-direction: column;
146
+ }
147
+
148
+ .wt-label {
149
+ margin-bottom: var(--label-margin);
150
+ cursor: text;
151
+
152
+ .wt-timepicker:hover &,
153
+ .wt-timepicker:focus-within & {
154
+ color: var(--form-label--hover-color);
155
+ }
156
+
157
+ .wt-timepicker--invalid:hover &,
158
+ .wt-timepicker--invalid:focus-within & {
159
+ color: var(--label--invalid-color);
160
+ }
161
+ }
162
+
163
+ .wt-timepicker__wrapper {
164
+ display: flex;
165
+ }
166
+
167
+ .wt-time-input {
168
+ width: var(--timepicker-input-width);
169
+ margin-right: var(--timepicker-input-margin);
170
+
171
+ &:last-child {
172
+ margin-right: 0;
173
+ }
174
+ }
175
+
176
+ </style>
@@ -0,0 +1,19 @@
1
+ import { shallowMount } from '@vue/test-utils';
2
+ import WtAppHeader from '../wt-app-header.vue';
3
+
4
+ describe('WtAppHeader', () => {
5
+ it('renders a component', () => {
6
+ const wrapper = shallowMount(WtAppHeader);
7
+ expect(wrapper.classes('wt-app-header')).toBe(true);
8
+ });
9
+
10
+ it('renders a app-header content via default slot', () => {
11
+ const content = 'app header content';
12
+ const wrapper = shallowMount(WtAppHeader, {
13
+ slots: {
14
+ default: content,
15
+ },
16
+ });
17
+ expect(wrapper.find('.wt-app-header').text()).toBe(content);
18
+ });
19
+ });