@voicenter-team/voicenter-ui-plus 0.0.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 (237) hide show
  1. package/README.md +35 -0
  2. package/library/favicon.ico +0 -0
  3. package/library/fonts/VC-icon.eot +0 -0
  4. package/library/fonts/VC-icon.svg +268 -0
  5. package/library/fonts/VC-icon.ttf +0 -0
  6. package/library/fonts/VC-icon.woff +0 -0
  7. package/library/icon-vc.css +753 -0
  8. package/library/images/logo-icon.svg +6 -0
  9. package/library/images/not-found.png +0 -0
  10. package/library/images/perfil.jpg +0 -0
  11. package/library/sound/test-audio.mp3 +0 -0
  12. package/library/style.css +1 -0
  13. package/library/super.mjs +24050 -0
  14. package/library/super.mjs.map +1 -0
  15. package/library/super.umd.js +37 -0
  16. package/library/super.umd.js.map +1 -0
  17. package/library/types/src/components/VcButton/VcButton.types.d.ts +5 -0
  18. package/library/types/src/components/VcButton/VcButton.vue.d.ts +94 -0
  19. package/library/types/src/components/VcButton/VcButtonIcon.vue.d.ts +89 -0
  20. package/library/types/src/components/VcCard/VcCard.vue.d.ts +23 -0
  21. package/library/types/src/components/VcCheckbox/VcCheckbox.vue.d.ts +133 -0
  22. package/library/types/src/components/VcCheckbox/VcCheckboxGroupEl.vue.d.ts +2 -0
  23. package/library/types/src/components/VcCheckbox/group.mixin.d.ts +60 -0
  24. package/library/types/src/components/VcCheckboxGroup/VcCheckboxGroup.vue.d.ts +140 -0
  25. package/library/types/src/components/VcCollapse/VcCollapse.vue.d.ts +33 -0
  26. package/library/types/src/components/VcCollapse/VcCollapseItem.vue.d.ts +106 -0
  27. package/library/types/src/components/VcCollapse/VcCollapseTransition.vue.d.ts +14 -0
  28. package/library/types/src/components/VcColorPicker/ColorPicker/ColorPicker.vue.d.ts +67 -0
  29. package/library/types/src/components/VcColorPicker/ColorPicker/Hue.vue.d.ts +40 -0
  30. package/library/types/src/components/VcColorPicker/ColorPicker/Saturation.vue.d.ts +49 -0
  31. package/library/types/src/components/VcColorPicker/ColorPicker/composible.d.ts +23 -0
  32. package/library/types/src/components/VcColorPicker/VcColorPicker.types.d.ts +10 -0
  33. package/library/types/src/components/VcColorPicker/VcColorPicker.vue.d.ts +65 -0
  34. package/library/types/src/components/VcDatetimeRangePicker/VcDatetimeRangePicker.types.d.ts +27 -0
  35. package/library/types/src/components/VcDatetimeRangePicker/VcDatetimeRangePicker.vue.d.ts +360 -0
  36. package/library/types/src/components/VcDelimitedList/VcDelimitedList.types.d.ts +4 -0
  37. package/library/types/src/components/VcDelimitedList/VcDelimitedList.vue.d.ts +92 -0
  38. package/library/types/src/components/VcExtendedDatetimeRangePicker/ExtendedDatetimeRangePickerPart.vue.d.ts +208 -0
  39. package/library/types/src/components/VcExtendedDatetimeRangePicker/ExtendedDatetimeRangePickerRelative.vue.d.ts +96 -0
  40. package/library/types/src/components/VcExtendedDatetimeRangePicker/VcExtendedDatetimeRangePicker.types.d.ts +11 -0
  41. package/library/types/src/components/VcExtendedDatetimeRangePicker/VcExtendedDatetimeRangePicker.vue.d.ts +276 -0
  42. package/library/types/src/components/VcExtendedDatetimeRangePicker/VcExtendedDatetimeRangePickerQuickOptionsSelection.vue.d.ts +51 -0
  43. package/library/types/src/components/VcExtendedDatetimeRangePicker/enum.d.ts +6 -0
  44. package/library/types/src/components/VcFileUploader/VcFileUploader.types.d.ts +4 -0
  45. package/library/types/src/components/VcFileUploader/VcFileUploader.vue.d.ts +388 -0
  46. package/library/types/src/components/VcForm/UiComponents/VcInputLabel.vue.d.ts +204 -0
  47. package/library/types/src/components/VcForm/VcForm.vue.d.ts +348 -0
  48. package/library/types/src/components/VcForm/VcFormItem.vue.d.ts +69 -0
  49. package/library/types/src/components/VcHyperLink/VcHyperLink.types.d.ts +2 -0
  50. package/library/types/src/components/VcHyperLink/VcHyperLink.vue.d.ts +54 -0
  51. package/library/types/src/components/VcIconPicker/VcIconPicker.types.d.ts +15 -0
  52. package/library/types/src/components/VcIconPicker/VcIconPicker.vue.d.ts +105 -0
  53. package/library/types/src/components/VcIconPicker/iconPicker.mixin.d.ts +51 -0
  54. package/library/types/src/components/VcInput/VcInput.types.d.ts +2 -0
  55. package/library/types/src/components/VcInput/VcInput.vue.d.ts +202 -0
  56. package/library/types/src/components/VcInputNumber/VcInputNumber.vue.d.ts +256 -0
  57. package/library/types/src/components/VcLoading/Loaders/Circles.vue.d.ts +28 -0
  58. package/library/types/src/components/VcLoading/Loaders/LdsSpinner.vue.d.ts +29 -0
  59. package/library/types/src/components/VcLoading/Loaders/LoadIcon.vue.d.ts +36 -0
  60. package/library/types/src/components/VcLoading/Loaders/Stretch.vue.d.ts +28 -0
  61. package/library/types/src/components/VcLoading/VcLoading.types.d.ts +1 -0
  62. package/library/types/src/components/VcLoading/VcLoading.vue.d.ts +66 -0
  63. package/library/types/src/components/VcModal/VcModal.types.d.ts +4 -0
  64. package/library/types/src/components/VcModal/VcModal.vue.d.ts +210 -0
  65. package/library/types/src/components/VcPagination/VcPagination.types.d.ts +4 -0
  66. package/library/types/src/components/VcPagination/VcPagination.vue.d.ts +64 -0
  67. package/library/types/src/components/VcPagination/VcPaginationButton.vue.d.ts +34 -0
  68. package/library/types/src/components/VcPopover/VcPopover.types.d.ts +3 -0
  69. package/library/types/src/components/VcPopover/VcPopover.vue.d.ts +150 -0
  70. package/library/types/src/components/VcProgress/VcProgress.types.d.ts +16 -0
  71. package/library/types/src/components/VcProgress/VcProgress.vue.d.ts +147 -0
  72. package/library/types/src/components/VcProgress/progress.options.d.ts +13 -0
  73. package/library/types/src/components/VcRadio/VcRadio.vue.d.ts +88 -0
  74. package/library/types/src/components/VcRadioGroup/VcRadioGroup.vue.d.ts +96 -0
  75. package/library/types/src/components/VcRadioTabs/UiComponents/VcRadioTabsNav.vue.d.ts +41 -0
  76. package/library/types/src/components/VcRadioTabs/VcRadioTabs.vue.d.ts +78 -0
  77. package/library/types/src/components/VcSelect/VcSelect.options.d.ts +78 -0
  78. package/library/types/src/components/VcSelect/VcSelect.vue.d.ts +293 -0
  79. package/library/types/src/components/VcSkeletonLoader/Loaders/Card.vue.d.ts +18 -0
  80. package/library/types/src/components/VcSkeletonLoader/Loaders/Circle.vue.d.ts +28 -0
  81. package/library/types/src/components/VcSkeletonLoader/Loaders/Row.vue.d.ts +18 -0
  82. package/library/types/src/components/VcSkeletonLoader/Loaders/Square.vue.d.ts +28 -0
  83. package/library/types/src/components/VcSkeletonLoader/Loaders/Text.vue.d.ts +16 -0
  84. package/library/types/src/components/VcSkeletonLoader/VcSkeletonLoader.types.d.ts +1 -0
  85. package/library/types/src/components/VcSkeletonLoader/VcSkeletonLoader.vue.d.ts +81 -0
  86. package/library/types/src/components/VcSoundplayer/VcSoundPlayer.types.d.ts +2 -0
  87. package/library/types/src/components/VcSoundplayer/VcSoundPlayer.vue.d.ts +130 -0
  88. package/library/types/src/components/VcSplitButton/VcSplitButton.types.d.ts +8 -0
  89. package/library/types/src/components/VcSplitButton/VcSplitButton.vue.d.ts +68 -0
  90. package/library/types/src/components/VcSwitch/VcSwitch.types.d.ts +1 -0
  91. package/library/types/src/components/VcSwitch/VcSwitch.vue.d.ts +151 -0
  92. package/library/types/src/components/VcTable/VcTable.types.d.ts +45 -0
  93. package/library/types/src/components/VcTable/VcTable.vue.d.ts +334 -0
  94. package/library/types/src/components/VcTable/tableOptions.d.ts +6 -0
  95. package/library/types/src/components/VcTabs/VcTabNav.vue.d.ts +54 -0
  96. package/library/types/src/components/VcTabs/VcTabPane.vue.d.ts +92 -0
  97. package/library/types/src/components/VcTabs/VcTabs.types.d.ts +14 -0
  98. package/library/types/src/components/VcTabs/VcTabs.vue.d.ts +62 -0
  99. package/library/types/src/components/VcTag/VcTag.types.d.ts +1 -0
  100. package/library/types/src/components/VcTag/VcTag.vue.d.ts +99 -0
  101. package/library/types/src/components/VcTagInput/VcTagInput.vue.d.ts +290 -0
  102. package/library/types/src/components/VcTimeInput/VcTimeInput.vue.d.ts +269 -0
  103. package/library/types/src/components/VcTree/VcTree.types.d.ts +36 -0
  104. package/library/types/src/components/VcTree/VcTree.vue.d.ts +209 -0
  105. package/library/types/src/components/VcTree/VcTreeNode.vue.d.ts +104 -0
  106. package/library/types/src/components/VcTree/VcTreeSelect.vue.d.ts +305 -0
  107. package/library/types/src/components/VcVerticalTabs/UiComponents/VerticalTabNav.vue.d.ts +54 -0
  108. package/library/types/src/components/VcVerticalTabs/VcVerticalTabs.vue.d.ts +76 -0
  109. package/library/types/src/components/VcViewSwitcher/VcViewSwitcher.vue.d.ts +74 -0
  110. package/library/types/src/components/VcWizard/VcSummaryProgress.vue.d.ts +55 -0
  111. package/library/types/src/components/VcWizard/VcSummaryStep.vue.d.ts +70 -0
  112. package/library/types/src/components/VcWizard/VcWizard.types.d.ts +15 -0
  113. package/library/types/src/components/VcWizard/VcWizard.vue.d.ts +157 -0
  114. package/library/types/src/components/VcWizard/VcWizardNavigation.vue.d.ts +110 -0
  115. package/library/types/src/components/VcWizard/VcWizardSummary.vue.d.ts +47 -0
  116. package/library/types/src/components/VcWizard/VcWizardTransition.vue.d.ts +83 -0
  117. package/library/types/src/components/index.d.ts +43 -0
  118. package/library/types/src/directives/resize.d.ts +6 -0
  119. package/library/types/src/entry.d.ts +2 -0
  120. package/library/types/src/entry.esm.d.ts +4 -0
  121. package/library/types/src/env.d.ts +18 -0
  122. package/library/types/src/localization/Localization.types.d.ts +17 -0
  123. package/library/types/src/localization/index.d.ts +9 -0
  124. package/library/types/src/mixins/common/appendTo.mixin.d.ts +19 -0
  125. package/library/types/src/mixins/defaultComponent.mixin.d.ts +14 -0
  126. package/library/types/src/mixins/input/baseInput.mixin.d.ts +100 -0
  127. package/library/types/src/mixins/input/color.mixin.d.ts +33 -0
  128. package/library/types/src/mixins/input/error.mixin.d.ts +23 -0
  129. package/library/types/src/mixins/input/input.mixin.d.ts +146 -0
  130. package/library/types/src/mixins/input/label.mixin.d.ts +52 -0
  131. package/library/types/src/mixins/optionMethods.mixin.d.ts +38 -0
  132. package/library/types/src/mixins/table/tableProps.mixin.d.ts +108 -0
  133. package/library/types/src/theme/index.d.ts +1 -0
  134. package/library/types/src/theme/theme.types.d.ts +6 -0
  135. package/library/types/src/types/AppendToTarget.types.d.ts +1 -0
  136. package/library/types/src/types/Entry.types.d.ts +6 -0
  137. package/library/types/src/types/OptionAndConfig.types.d.ts +23 -0
  138. package/library/types/src/types/VueGeneric.types.d.ts +1 -0
  139. package/library/types/src/utils/DomHandler.d.ts +5 -0
  140. package/library/types/src/utils/UniqueComponentId.d.ts +1 -0
  141. package/library/types/src/utils/ZIndexUtils.d.ts +12 -0
  142. package/library/types/src/utils/helpers.d.ts +6 -0
  143. package/library/types/src/utils/isValidTime.d.ts +2 -0
  144. package/package.json +66 -0
  145. package/src/assets/element/index.scss +161 -0
  146. package/src/assets/sass/main/_icons.scss +36 -0
  147. package/src/assets/sass/main/_loading.scss +51 -0
  148. package/src/assets/sass/main/_mixins.scss +339 -0
  149. package/src/assets/sass/main/_typography.scss +29 -0
  150. package/src/assets/sass/main.scss +9 -0
  151. package/src/components/VcButton/VcButton.scss +190 -0
  152. package/src/components/VcButton/VcButton.vue +117 -0
  153. package/src/components/VcButton/VcButtonIcon.scss +100 -0
  154. package/src/components/VcButton/VcButtonIcon.vue +97 -0
  155. package/src/components/VcCard/VcCard.vue +53 -0
  156. package/src/components/VcCheckbox/VcCheckbox.scss +66 -0
  157. package/src/components/VcCheckbox/VcCheckbox.vue +99 -0
  158. package/src/components/VcCheckbox/VcCheckboxGroupEl.vue +18 -0
  159. package/src/components/VcCheckboxGroup/VcCheckboxGroup.vue +164 -0
  160. package/src/components/VcCollapse/VcCollapse.vue +70 -0
  161. package/src/components/VcCollapse/VcCollapseItem.vue +229 -0
  162. package/src/components/VcCollapse/VcCollapseTransition.vue +78 -0
  163. package/src/components/VcColorPicker/ColorPicker/ColorPicker.vue +192 -0
  164. package/src/components/VcColorPicker/ColorPicker/Hue.vue +130 -0
  165. package/src/components/VcColorPicker/ColorPicker/Saturation.vue +146 -0
  166. package/src/components/VcColorPicker/VcColorPicker.vue +140 -0
  167. package/src/components/VcDatetimeRangePicker/VcDatetimeRangePicker.vue +474 -0
  168. package/src/components/VcDelimitedList/VcDelimitedList.vue +223 -0
  169. package/src/components/VcExtendedDatetimeRangePicker/ExtendedDatetimeRangePickerPart.vue +166 -0
  170. package/src/components/VcExtendedDatetimeRangePicker/ExtendedDatetimeRangePickerRelative.vue +180 -0
  171. package/src/components/VcExtendedDatetimeRangePicker/VcExtendedDatetimeRangePicker.vue +178 -0
  172. package/src/components/VcExtendedDatetimeRangePicker/VcExtendedDatetimeRangePickerQuickOptionsSelection.vue +128 -0
  173. package/src/components/VcFileUploader/VcFileUploader.vue +324 -0
  174. package/src/components/VcForm/Styles/VcInputLabel.scss +24 -0
  175. package/src/components/VcForm/UiComponents/VcInputError.vue +31 -0
  176. package/src/components/VcForm/UiComponents/VcInputLabel.vue +67 -0
  177. package/src/components/VcForm/VcForm.vue +88 -0
  178. package/src/components/VcForm/VcFormItem.vue +115 -0
  179. package/src/components/VcHyperLink/VcHyperLink.vue +83 -0
  180. package/src/components/VcIconPicker/VcIconPicker.vue +142 -0
  181. package/src/components/VcInput/VcInput.vue +220 -0
  182. package/src/components/VcInputNumber/VcInputNumber.vue +128 -0
  183. package/src/components/VcLoading/Loaders/Circles.vue +100 -0
  184. package/src/components/VcLoading/Loaders/LdsSpinner.vue +52 -0
  185. package/src/components/VcLoading/Loaders/LoadIcon.vue +56 -0
  186. package/src/components/VcLoading/Loaders/Stretch.vue +82 -0
  187. package/src/components/VcLoading/VcLoading.vue +159 -0
  188. package/src/components/VcModal/VcModal.scss +227 -0
  189. package/src/components/VcModal/VcModal.vue +384 -0
  190. package/src/components/VcNotification/VcNotification.vue +302 -0
  191. package/src/components/VcNotification/VcNotificationMessage.vue +119 -0
  192. package/src/components/VcPagination/VcPagination.vue +175 -0
  193. package/src/components/VcPagination/VcPaginationButton.vue +37 -0
  194. package/src/components/VcPopover/VcPopover.vue +186 -0
  195. package/src/components/VcProgress/VcProgress.vue +235 -0
  196. package/src/components/VcRadio/VcRadio.scss +59 -0
  197. package/src/components/VcRadio/VcRadio.vue +89 -0
  198. package/src/components/VcRadioGroup/VcRadioGroup.vue +146 -0
  199. package/src/components/VcRadioTabs/UiComponents/VcRadioTabsNav.vue +128 -0
  200. package/src/components/VcRadioTabs/VcRadioTabs.vue +151 -0
  201. package/src/components/VcSelect/VcSelect.scss +135 -0
  202. package/src/components/VcSelect/VcSelect.vue +191 -0
  203. package/src/components/VcSkeletonLoader/Loaders/Card.vue +79 -0
  204. package/src/components/VcSkeletonLoader/Loaders/Circle.vue +45 -0
  205. package/src/components/VcSkeletonLoader/Loaders/Row.vue +36 -0
  206. package/src/components/VcSkeletonLoader/Loaders/Square.vue +44 -0
  207. package/src/components/VcSkeletonLoader/Loaders/Text.vue +42 -0
  208. package/src/components/VcSkeletonLoader/VcSkeletonLoader.vue +111 -0
  209. package/src/components/VcSoundplayer/VcSoundPlayer.vue +497 -0
  210. package/src/components/VcSplitButton/VcSplitButton.vue +338 -0
  211. package/src/components/VcSwitch/VcSwitch.vue +352 -0
  212. package/src/components/VcTable/VcTable.vue +869 -0
  213. package/src/components/VcTabs/VcTabNav.scss +120 -0
  214. package/src/components/VcTabs/VcTabNav.vue +203 -0
  215. package/src/components/VcTabs/VcTabPane.vue +128 -0
  216. package/src/components/VcTabs/VcTabs.vue +186 -0
  217. package/src/components/VcTag/VcTag.vue +186 -0
  218. package/src/components/VcTagInput/VcTagInput.vue +280 -0
  219. package/src/components/VcTagInput/VcTagInputStyle.scss +224 -0
  220. package/src/components/VcTimeInput/VcTimeInput.vue +441 -0
  221. package/src/components/VcTree/VcTree.vue +410 -0
  222. package/src/components/VcTree/VcTreeNode.vue +283 -0
  223. package/src/components/VcTree/VcTreeSelect.vue +472 -0
  224. package/src/components/VcVerticalTabs/UiComponents/VerticalTabNav.vue +99 -0
  225. package/src/components/VcVerticalTabs/VcVerticalTabs.vue +125 -0
  226. package/src/components/VcViewSwitcher/VcViewSwitcher.vue +137 -0
  227. package/src/components/VcWizard/VcSummaryProgress.vue +193 -0
  228. package/src/components/VcWizard/VcSummaryStep.vue +172 -0
  229. package/src/components/VcWizard/VcWizard.vue +292 -0
  230. package/src/components/VcWizard/VcWizardNavigation.vue +196 -0
  231. package/src/components/VcWizard/VcWizardSummary.vue +73 -0
  232. package/src/components/VcWizard/VcWizardTransition.vue +119 -0
  233. package/src/theme/index.ts +47 -0
  234. package/src/theme/tailwindConfig.js +143 -0
  235. package/src/theme/tailwindScheme.js +9 -0
  236. package/src/theme/theme.types.ts +6 -0
  237. package/src/theme/themes.json +130 -0
@@ -0,0 +1,42 @@
1
+ <template>
2
+ <div class="vc-text-loader text-inactive-text w-max">
3
+ {{ loadingText }}
4
+ <span class="dot">.</span>
5
+ <span class="dot">.</span>
6
+ <span class="dot">.</span>
7
+ </div>
8
+ </template>
9
+
10
+ <script lang="ts">
11
+ import { defineComponent } from 'vue'
12
+
13
+ export default defineComponent({
14
+ // eslint-disable-next-line vue/no-reserved-component-names
15
+ name: 'Text',
16
+ props: {
17
+ text: {
18
+ type: String,
19
+ default: ''
20
+ }
21
+ },
22
+ computed: {
23
+ loadingText () {
24
+ return this.text ? this.text : this.$tVU.t('loader.loading')
25
+ }
26
+ }
27
+ })
28
+ </script>
29
+
30
+ <style lang="scss" scoped>
31
+ .vc-text-loader {
32
+ .dot:nth-child(1) {
33
+ animation: dotsAnimation 1s .2s linear infinite;
34
+ }
35
+ .dot:nth-child(2) {
36
+ animation: dotsAnimation 1s .4s linear infinite;
37
+ }
38
+ .dot:nth-child(3) {
39
+ animation: dotsAnimation 1s .6s linear infinite;
40
+ }
41
+ }
42
+ </style>
@@ -0,0 +1,111 @@
1
+ <template>
2
+ <div
3
+ class="vc-skeleton-loader w-full h-full animation-block"
4
+ :style="styles"
5
+ v-bind="$attrs"
6
+ >
7
+ <component
8
+ :is="loaderType"
9
+ :row-height="heightRows"
10
+ :cols="colsCount"
11
+ v-bind="additionalAttrs"
12
+ />
13
+ </div>
14
+ </template>
15
+
16
+ <script lang="ts">
17
+ /* eslint-disable vue/no-reserved-component-names */
18
+ import { defineComponent, PropType } from 'vue'
19
+ import Card from '@/components/VcSkeletonLoader/Loaders/Card.vue'
20
+ import Row from '@/components/VcSkeletonLoader/Loaders/Row.vue'
21
+ import Square from '@/components/VcSkeletonLoader/Loaders/Square.vue'
22
+ import Text from '@/components/VcSkeletonLoader/Loaders/Text.vue'
23
+ import Circle from '@/components/VcSkeletonLoader/Loaders/Circle.vue'
24
+ import { convertToUnit } from '@/utils/helpers'
25
+ import { LoaderType } from '@/components/VcSkeletonLoader/VcSkeletonLoader.types'
26
+
27
+ type NumberOrNumberString = PropType<string | number | undefined>
28
+
29
+ const DEFAULT_TYPE = 'row'
30
+ const DEFAULT_HEIGHT = '1.5rem'
31
+
32
+ export default defineComponent({
33
+ name: 'VcSkeletonLoader',
34
+ components: {
35
+ Card,
36
+ Row,
37
+ Square,
38
+ Text,
39
+ Circle
40
+ },
41
+ props: {
42
+ height: {
43
+ type: [Number, String] as NumberOrNumberString,
44
+ default: undefined
45
+ },
46
+ width: {
47
+ type: [Number, String] as NumberOrNumberString,
48
+ default: undefined
49
+ },
50
+ maxWidth: {
51
+ type: [Number, String] as NumberOrNumberString,
52
+ default: undefined
53
+ },
54
+ maxHeight: {
55
+ type: [Number, String] as NumberOrNumberString,
56
+ default: undefined
57
+ },
58
+ type: {
59
+ type: String,
60
+ default: DEFAULT_TYPE
61
+ },
62
+ rowHeight: {
63
+ type: [Number, String] as NumberOrNumberString,
64
+ default: DEFAULT_HEIGHT
65
+ },
66
+ textLoading: {
67
+ type: String,
68
+ default: ''
69
+ }
70
+ },
71
+ computed: {
72
+ styles () {
73
+ const styles: Record<string, string> = {}
74
+
75
+ const height = convertToUnit(this.height)
76
+ const width = convertToUnit(this.width)
77
+ const maxHeight = convertToUnit(this.maxHeight)
78
+ const maxWidth = convertToUnit(this.maxWidth)
79
+
80
+ if (height) styles.height = height
81
+ if (maxHeight) styles.maxHeight = maxHeight
82
+ if (maxWidth) styles.maxWidth = maxWidth
83
+ if (width) styles.width = width
84
+
85
+ return styles
86
+ },
87
+ heightRows () {
88
+ return convertToUnit(this.rowHeight)
89
+ },
90
+ loaderType () {
91
+ const [type] = this.type.split('@') as [LoaderType, number]
92
+ return type
93
+ },
94
+ colsCount () {
95
+ const [type, len] = this.type.split('@') as [LoaderType, number]
96
+ if (type === 'square' || type === 'circle') {
97
+ return +len || 1
98
+ }
99
+ return undefined
100
+ },
101
+ additionalAttrs () {
102
+ if (this.type === 'text') {
103
+ return {
104
+ text: this.textLoading
105
+ }
106
+ }
107
+ return {}
108
+ }
109
+ }
110
+ })
111
+ </script>
@@ -0,0 +1,497 @@
1
+ <template>
2
+ <div
3
+ class="w-full flex items-center"
4
+ v-bind="$attrs"
5
+ >
6
+ <div
7
+ v-if="isError"
8
+ class="flex items-center text-destructive-actions text-xs h-8"
9
+ >
10
+ <div
11
+ v-if="!simple"
12
+ class="flex items-center"
13
+ >
14
+ <i class="vc-icon-alert icon-2md mr-2" />
15
+ {{ audioErrorMessage }}
16
+ </div>
17
+ <div
18
+ v-else
19
+ class="flex items-center"
20
+ >
21
+ <i class="vc-icon-alert icon-2md error-icon" />
22
+ </div>
23
+ </div>
24
+ <div
25
+ v-else
26
+ class="w-full flex items-center relative"
27
+ >
28
+ <div
29
+ v-if="!isPlaying"
30
+ class="sound-controls"
31
+ :class="{'right-offset': !simple}"
32
+ @click.stop="play"
33
+ >
34
+ <i
35
+ class="vc-icon-play"
36
+ :class="[iconClass, disabled ? 'text-inactive-elements' : 'text-primary-actions']"
37
+ />
38
+ </div>
39
+ <div
40
+ v-else
41
+ class="sound-controls"
42
+ :class="{'right-offset': !simple}"
43
+ @click.stop="pause"
44
+ >
45
+ <i
46
+ class="vc-icon-pause2 text-primary-actions"
47
+ :class="iconClass"
48
+ />
49
+ </div>
50
+ <div
51
+ v-if="showReset"
52
+ class="sound-controls"
53
+ :class="simple ? 'left-offset' : 'right-offset'"
54
+ @click.stop="stop"
55
+ >
56
+ <i
57
+ class="vc-icon-restart text-primary-actions"
58
+ :class="iconClass"
59
+ />
60
+ </div>
61
+ <div
62
+ v-if="preIcon && !simple"
63
+ class="flex items-center right-offset"
64
+ >
65
+ <i
66
+ :class="preIcon"
67
+ class="text-primary-actions icon-base"
68
+ />
69
+ </div>
70
+ <div
71
+ v-show="!simple"
72
+ class="sound-time-current"
73
+ >
74
+ {{ toMinutes(currentTime) }}
75
+ </div>
76
+ <div
77
+ v-show="!simple"
78
+ class="sound-progress-bar"
79
+ :class="height"
80
+ >
81
+ <VcSkeletonLoader
82
+ v-if="loading"
83
+ type="row"
84
+ row-height="16"
85
+ class="sound-loading"
86
+ />
87
+ <div
88
+ v-show="isPlayingInProgress"
89
+ class="flex-grow w-full h-full wave-form-content"
90
+ >
91
+ <div :id="`waveform-${soundId}`" />
92
+ </div>
93
+ <div
94
+ v-if="!isPlayingInProgress && !loading"
95
+ class="w-full h-px bg-ui-lines rounded-full"
96
+ />
97
+ </div>
98
+ <div
99
+ v-show="!simple"
100
+ class="sound-duration"
101
+ >
102
+ {{ toMinutes(duration) }}
103
+ </div>
104
+ <div
105
+ v-if="!simple"
106
+ class="sound-volume"
107
+ >
108
+ <i
109
+ ref="volumeIcon"
110
+ :class="disabled ? 'text-inactive-elements' : 'text-primary-actions'"
111
+ class="vc-icon-sounds cursor-pointer icon-base"
112
+ @click="toggleVolumeTooltip"
113
+ />
114
+ <div
115
+ v-if="volumeTooltip"
116
+ class="volume-input-block"
117
+ >
118
+ <input
119
+ v-model="volume"
120
+ v-click-outside="onClickOutsideVolume"
121
+ type="range"
122
+ min="0"
123
+ max="100"
124
+ step="1"
125
+ class="range-input"
126
+ :style="{
127
+ backgroundSize: `${volume}% 100%`
128
+ }"
129
+ >
130
+ </div>
131
+ </div>
132
+ <div
133
+ v-if="showDownloadButton && !simple"
134
+ class="flex items-center"
135
+ >
136
+ <div
137
+ v-for="(item, index) in downloadLinks"
138
+ :key="index"
139
+ class="cursor-pointer right-offset"
140
+ @click.stop="download(item)"
141
+ >
142
+ <i
143
+ class="text-primary-actions icon-base"
144
+ :class="downloadIconType(item)"
145
+ />
146
+ </div>
147
+ </div>
148
+ </div>
149
+ </div>
150
+ </template>
151
+
152
+ <script lang="ts">
153
+ import WaveSurfer from 'wavesurfer.js'
154
+ import { defineComponent, PropType } from 'vue'
155
+ import VcSkeletonLoader from '@/components/VcSkeletonLoader/VcSkeletonLoader.vue'
156
+ import clickOutside from '@/directives/click-outside'
157
+ import { VcSoundPlayerSize, VcSoundDownloads } from './VcSoundPlayer.types'
158
+
159
+ export default defineComponent({
160
+ name: 'VcSoundPlayer',
161
+ components: { VcSkeletonLoader },
162
+ directives: {
163
+ 'click-outside': clickOutside
164
+ },
165
+ props: {
166
+ soundId: {
167
+ type: [String, Number],
168
+ default: 'soundId'
169
+ },
170
+ src: {
171
+ type: String,
172
+ default: ''
173
+ },
174
+ simple: {
175
+ type: Boolean,
176
+ default: false
177
+ },
178
+ size: {
179
+ type: String as PropType<VcSoundPlayerSize>,
180
+ default: 'md'
181
+ },
182
+ disabled: {
183
+ type: Boolean,
184
+ default: false
185
+ },
186
+ preIcon: {
187
+ type: String,
188
+ default: ''
189
+ },
190
+ currentPlay: {
191
+ type: String,
192
+ default: ''
193
+ },
194
+ downloadLinks: {
195
+ type: Array as PropType<VcSoundDownloads>,
196
+ default: () => []
197
+ }
198
+ },
199
+ emits: ['start', 'stop', 'onPlay', 'pause'],
200
+ data () {
201
+ return {
202
+ loading: false,
203
+ volumeTooltip: false,
204
+ isPlaying: false,
205
+ showReset: false,
206
+ duration: 0,
207
+ currentTime: 0,
208
+ volume: 100,
209
+ wavesurfer: {} as WaveSurfer,
210
+ wavesurferOptions: {
211
+ height: this.size === 'sm' ? 16 : 32,
212
+ container: `#waveform-${this.soundId}`,
213
+ barWidth: 0.5,
214
+ barHeight: 1,
215
+ barMinHeight: 0.5,
216
+ waveColor: '#E0E2E5',
217
+ progressColor: '#2675FF'
218
+ },
219
+ audioErrorMessage: '',
220
+ isInitSound: false,
221
+ firstPlay: false,
222
+ timeInterval: 0 as number
223
+ }
224
+ },
225
+ computed: {
226
+ isError (): boolean {
227
+ return this.audioErrorMessage !== ''
228
+ },
229
+ height (): string {
230
+ return this.size === 'sm' ? 'h-4' : 'h-8'
231
+ },
232
+ iconClass (): string {
233
+ const classes: {[key: number | string]: string} = {
234
+ md: 'icon-2xl',
235
+ sm: 'icon-lg'
236
+ }
237
+ return classes[this.size] || 'icon-2md'
238
+ },
239
+ isPlayingInProgress (): boolean {
240
+ return this.isPlaying || this.showReset
241
+ },
242
+ showDownloadButton (): boolean {
243
+ return this.downloadLinks.length > 0 && this.size === 'md'
244
+ },
245
+ progressTime (): number {
246
+ return this.isPlayingInProgress ? this.currentTime : 0
247
+ }
248
+ },
249
+ watch: {
250
+ volume (val: number):void {
251
+ this.setVolume(val)
252
+ },
253
+ src (newValue: string) {
254
+ this.audioErrorMessage = ''
255
+ if (newValue && this.isInitSound) {
256
+ this.initSound()
257
+ }
258
+ },
259
+ isPlaying (playing: boolean) {
260
+ if (playing) {
261
+ this.$emit('start', this.soundId, this.src)
262
+ } else {
263
+ this.$emit('stop', this.soundId, this.src)
264
+ }
265
+ },
266
+ currentPlay (newValue: string) {
267
+ if (newValue && newValue !== this.src && this.isPlaying) {
268
+ this.pause()
269
+ }
270
+ }
271
+ },
272
+ mounted () {
273
+ this.wavesurfer = WaveSurfer.create(this.wavesurferOptions)
274
+ },
275
+ beforeUnmount () {
276
+ if (this.wavesurfer) {
277
+ this.wavesurfer.destroy()
278
+ }
279
+ this.clearInterval()
280
+ },
281
+ methods: {
282
+ onClickOutsideVolume (e: PointerEvent): void {
283
+ if (e.target !== this.$refs.volumeIcon) {
284
+ this.volumeTooltip = false
285
+ }
286
+ },
287
+ toggleVolumeTooltip (): void {
288
+ this.volumeTooltip = !this.volumeTooltip
289
+ },
290
+ closeTooltip (): void {
291
+ this.volumeTooltip = false
292
+ },
293
+ initSound (): void {
294
+ this.stop()
295
+ this.loadingSound()
296
+ },
297
+ loadingSound (): void {
298
+ if (!this.wavesurfer) {
299
+ return
300
+ }
301
+ this.loading = true
302
+ this.wavesurfer.load(this.src)
303
+ this.wavesurfer.on('ready', this.wavesurfer.play.bind(this.wavesurfer))
304
+ this.wavesurfer.on('play', () => this.onPlay())
305
+ this.wavesurfer.on('finish', () => this.onFinish())
306
+
307
+ this.wavesurfer.on('error', (errorMessage: Error) => {
308
+ this.audioErrorMessage = errorMessage.message
309
+ })
310
+ },
311
+ onPlay (): void {
312
+ if (!this.wavesurfer) {
313
+ return
314
+ }
315
+ this.loading = false
316
+ this.duration = this.wavesurfer.getDuration()
317
+ this.$emit('onPlay', this.soundId, this.src)
318
+ this.timeInterval = window.setInterval(() => {
319
+ if (this.isPlayingInProgress && this.wavesurfer) {
320
+ this.currentTime = this.wavesurfer.getCurrentTime()
321
+ } else {
322
+ this.clearInterval()
323
+ }
324
+ }, 300)
325
+ },
326
+ onFinish (): void {
327
+ this.isPlaying = false
328
+ this.showReset = false
329
+ this.currentTime = 0
330
+ this.clearInterval()
331
+ },
332
+ stop (): void {
333
+ this.isPlaying = false
334
+ this.showReset = false
335
+ if (this.wavesurfer) {
336
+ this.wavesurfer.pause()
337
+ }
338
+ this.currentTime = 0
339
+ },
340
+ play (): void {
341
+ if (this.disabled || !this.wavesurfer) {
342
+ return
343
+ }
344
+ this.isPlaying = true
345
+ this.showReset = true
346
+
347
+ if (!this.isInitSound) {
348
+ this.isInitSound = true
349
+ this.loadingSound()
350
+ return
351
+ }
352
+ if (!this.currentTime) {
353
+ this.wavesurfer.play(0)
354
+ } else {
355
+ this.wavesurfer.play()
356
+ }
357
+ },
358
+ pause (): void {
359
+ this.isPlaying = false
360
+ this.$emit('pause', this.soundId, this.src)
361
+ if (this.wavesurfer) {
362
+ this.wavesurfer.pause()
363
+ }
364
+ },
365
+ clearInterval () {
366
+ if (this.timeInterval) {
367
+ window.clearInterval(this.timeInterval)
368
+ }
369
+ },
370
+ setVolume (val: number): void {
371
+ if (!this.wavesurfer) {
372
+ return
373
+ }
374
+ const floatValue = val * 0.01
375
+ this.wavesurfer.setVolume(Number.parseFloat(floatValue.toFixed(2)))
376
+ },
377
+ toMinutes (seconds: number): string {
378
+ const minutes = Math.floor(seconds / 60)
379
+ const remainingSecondsInt = Math.floor(seconds - minutes * 60)
380
+ let remainingSeconds = ''
381
+
382
+ if (remainingSecondsInt < 10) {
383
+ remainingSeconds = `0${remainingSecondsInt}`
384
+ } else {
385
+ remainingSeconds = `${remainingSecondsInt}`
386
+ }
387
+
388
+ return `${minutes}:${remainingSeconds}`
389
+ },
390
+ async download (sound: string): Promise<Blob> {
391
+ const response = await fetch(sound)
392
+ const dataBlob = await response.blob()
393
+ const url = window.URL.createObjectURL(dataBlob)
394
+ const link = document.createElement('a')
395
+ const splitedUrl = sound.split('/')
396
+ link.href = url
397
+ link.setAttribute('download', splitedUrl[splitedUrl.length - 1])
398
+ document.body.appendChild(link)
399
+ link.click()
400
+ return dataBlob
401
+ },
402
+ downloadIconType (item: string): string {
403
+ const splittedUrl = item.split('.')
404
+ const type = splittedUrl[splittedUrl.length - 1]
405
+ if (type === 'mp3') {
406
+ return 'vc-icon-mp3'
407
+ }
408
+ return 'vc-icon-wav'
409
+ }
410
+ }
411
+ })
412
+ </script>
413
+
414
+ <style lang="scss" scoped>
415
+ .wave-form-content :deep(wave) {
416
+ border: none !important;
417
+ }
418
+
419
+ .right-offset {
420
+ @apply mr-3;
421
+ }
422
+ .left-offset {
423
+ @apply ml-3;
424
+ }
425
+
426
+ [dir=rtl] {
427
+ .right-offset {
428
+ @apply ml-3;
429
+ }
430
+ .left-offset {
431
+ @apply mr-3;
432
+ }
433
+ }
434
+
435
+ .sound-loading {
436
+ @apply px-2 absolute top-0 left-0 flex items-center;
437
+ }
438
+
439
+ .sound-controls {
440
+ @apply flex items-center cursor-pointer;
441
+ }
442
+
443
+ .sound-time-current {
444
+ @apply text-xs w-9;
445
+ }
446
+
447
+ .sound-progress-bar {
448
+ @apply flex-grow flex flex-col items-center justify-center px-2 relative;
449
+ }
450
+
451
+ .sound-duration {
452
+ @apply text-xs w-9 opacity-50;
453
+ }
454
+
455
+ .sound-volume {
456
+ @apply flex items-center mx-3 relative;
457
+ .volume-input-block {
458
+ @apply absolute bg-white flex items-center justify-center border border-ui-lines rounded-sm;
459
+ height: 24px;
460
+ width: 80px;
461
+ top: -60px;
462
+ left: -34px;
463
+ padding: 4px;
464
+ transform: rotate(-90deg);
465
+ }
466
+ .range-input {
467
+ -webkit-appearance: none;
468
+ width: 60px;
469
+ height: 4px;
470
+ background: var(--ui-lines);
471
+ border-radius: 5px;
472
+ background-size: 70% 100%;
473
+ background-image: linear-gradient(var(--active-elements), var(--active-elements));
474
+ background-repeat: no-repeat;
475
+ &::-webkit-slider-thumb {
476
+ -webkit-appearance: none;
477
+ height: 12px;
478
+ width: 12px;
479
+ border-radius: 50%;
480
+ background: var(--active-elements);
481
+ cursor: pointer;
482
+ box-shadow: 0 0 2px 0 #555;
483
+ transition: background .3s ease-in-out;
484
+ &:hover {
485
+ background-color: var(--active-elements--focus);
486
+ }
487
+ }
488
+ &::-webkit-slider-runnable-track {
489
+ -webkit-appearance: none;
490
+ box-shadow: none;
491
+ border: none;
492
+ background: transparent;
493
+ }
494
+
495
+ }
496
+ }
497
+ </style>