@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,384 @@
1
+ <template>
2
+ <Teleport
3
+ :to="appendTarget"
4
+ :disabled="appendDisabled"
5
+ >
6
+ <div
7
+ v-if="containerVisible"
8
+ :ref="maskRef"
9
+ :class="maskClass"
10
+ class="vc-dialog-mask"
11
+ @click.stop.self="onMaskClick"
12
+ >
13
+ <transition
14
+ name="vc-dialog"
15
+ appear
16
+ @before-enter="onBeforeEnter"
17
+ @enter="onEnter"
18
+ @after-enter="onEnterCancelled"
19
+ @before-leave="onBeforeLeave"
20
+ @leave="onLeave"
21
+ @after-leave="onAfterLeave"
22
+ >
23
+ <div
24
+ v-if="visible"
25
+ :ref="containerRef"
26
+ :class="dialogClass"
27
+ :aria-labelledby="ariaLabelledById"
28
+ :style="{
29
+ width: modalWidth,
30
+ maxWidth: modalMaxWidth
31
+ }"
32
+ aria-modal="true"
33
+ role="dialog"
34
+ >
35
+ <div class="vc-dialog-header">
36
+ <slot name="header">
37
+ <div
38
+ v-if="header"
39
+ :id="ariaLabelledById"
40
+ class="vc-dialog-title"
41
+ >
42
+ {{ header }}
43
+ </div>
44
+ </slot>
45
+ <div class="vc-dialog-header-icons">
46
+ <button
47
+ v-if="maximizable"
48
+ class="vc-dialog-header-icon vc-dialog-header-maximize vc-link mx-3"
49
+ :aria-label="ariaCloseLabel"
50
+ type="button"
51
+ tabindex="-1"
52
+ @click="maximize"
53
+ >
54
+ <span class="vc-dialog-header-maximize-icon vc-icon-fullscreen" />
55
+ </button>
56
+ <button
57
+ v-if="closable"
58
+ class="vc-dialog-header-icon vc-dialog-header-close vc-link"
59
+ :aria-label="ariaCloseLabel"
60
+ type="button"
61
+ tabindex="-1"
62
+ @click="close"
63
+ >
64
+ <span class="vc-dialog-header-close-icon vc-icon-close" />
65
+ </button>
66
+ </div>
67
+ </div>
68
+ <div
69
+ :class="contentStyleClass"
70
+ :style="contentStyle"
71
+ >
72
+ <slot />
73
+ </div>
74
+ <div
75
+ v-if="footer || $slots.footer"
76
+ class="vc-dialog-footer"
77
+ >
78
+ <slot name="footer">
79
+ {{ footer }}
80
+ </slot>
81
+ </div>
82
+ </div>
83
+ </transition>
84
+ </div>
85
+ </Teleport>
86
+ </template>
87
+
88
+ <script lang="ts">
89
+ /* eslint-disable @typescript-eslint/no-explicit-any */
90
+ import { defineComponent, PropType } from 'vue'
91
+ import { DialogBreakpoints, DialogPositionType } from './VcModal.types'
92
+ import UniqueComponentId from '@/utils/UniqueComponentId'
93
+ import ZIndexUtils from '@/utils/ZIndexUtils'
94
+ import DomHandler from '@/utils/DomHandler'
95
+ import { convertToUnit } from '@/utils/helpers'
96
+ import appendTo from '@/mixins/common/appendTo.mixin'
97
+
98
+ export default defineComponent({
99
+ name: 'VcModal',
100
+ mixins: [appendTo],
101
+ inheritAttrs: false,
102
+ props: {
103
+ maximizable: {
104
+ type: Boolean,
105
+ default: false
106
+ },
107
+ visible: {
108
+ type: Boolean,
109
+ default: false
110
+ },
111
+ position: {
112
+ type: String as PropType<DialogPositionType>,
113
+ default: 'center'
114
+ },
115
+ header: {
116
+ type: String,
117
+ default: ''
118
+ },
119
+ footer: {
120
+ type: String,
121
+ default: ''
122
+ },
123
+ ariaCloseLabel: {
124
+ type: String,
125
+ default: 'close'
126
+ },
127
+ closable: {
128
+ type: Boolean,
129
+ default: true
130
+ },
131
+ closeOnEscape: {
132
+ type: Boolean,
133
+ default: true
134
+ },
135
+ contentClass: {
136
+ type: String,
137
+ default: ''
138
+ },
139
+ contentStyle: {
140
+ type: [String, Object],
141
+ default: null
142
+ },
143
+ baseZIndex: {
144
+ type: Number,
145
+ default: 0
146
+ },
147
+ dismissableMask: {
148
+ type: Boolean,
149
+ default: true
150
+ },
151
+ breakpoints: {
152
+ type: Object as PropType<DialogBreakpoints> | undefined,
153
+ default: undefined
154
+ },
155
+ width: {
156
+ type: String,
157
+ default: '60vw'
158
+ },
159
+ maxWidth: {
160
+ type: String,
161
+ default: '100%'
162
+ }
163
+ },
164
+ emits: ['show', 'hide', 'unmaximize', 'maximize', 'close'],
165
+ data () {
166
+ return {
167
+ containerVisible: this.visible,
168
+ maximized: false,
169
+ mask: null as HTMLElement | null,
170
+ container: null as HTMLElement | null,
171
+ styleElement: null as HTMLStyleElement | null,
172
+ documentKeydownListener: null as any,
173
+ autoZIndex: true
174
+ }
175
+ },
176
+ computed: {
177
+ maskClass (): string[] {
178
+ return [
179
+ 'vc-component-overlay vc-component-overlay-enter',
180
+ this.getPositionClass()
181
+ ]
182
+ },
183
+ dialogClass () {
184
+ return ['vc-dialog vc-dialog-component', {
185
+ 'vc-dialog-maximized': this.maximizable && this.maximized
186
+ }]
187
+ },
188
+ ariaLabelledById (): string {
189
+ return this.header != null ? this.ariaId + '_header' : 'ariaLabelledId'
190
+ },
191
+ ariaId (): string {
192
+ return UniqueComponentId()
193
+ },
194
+ contentStyleClass () {
195
+ return ['vc-dialog-content', this.contentClass, { 'vc-dialog-no-footer': !this.footer && !this.$slots.footer }]
196
+ },
197
+ attributeSelector (): string {
198
+ return UniqueComponentId()
199
+ },
200
+ modalWidth (): string | undefined {
201
+ return convertToUnit(this.width)
202
+ },
203
+ modalMaxWidth (): string | undefined {
204
+ return convertToUnit(this.maxWidth)
205
+ }
206
+ },
207
+ beforeUnmount (): void {
208
+ this.unbindGlobalListeners() // keydown
209
+ this.destroyStyle()
210
+ this.mask = null
211
+ if (this.container && this.autoZIndex) {
212
+ ZIndexUtils.clear(this.container)
213
+ }
214
+ this.container = null
215
+ },
216
+ updated (): void {
217
+ if (this.visible) {
218
+ this.containerVisible = this.visible
219
+ }
220
+ },
221
+ mounted (): void {
222
+ if (this.breakpoints) {
223
+ this.createStyle()
224
+ }
225
+ },
226
+ methods: {
227
+ destroyStyle (): void {
228
+ if (this.styleElement) {
229
+ document.head.removeChild(this.styleElement)
230
+ this.styleElement = null
231
+ }
232
+ },
233
+ /**
234
+ * Create responsive width (for breakpoints prop)
235
+ */
236
+ createStyle (): void {
237
+ if (!this.styleElement && this.breakpoints) {
238
+ this.styleElement = document.createElement('style')
239
+ this.styleElement.type = 'text/css'
240
+ document.head.appendChild(this.styleElement)
241
+ let innerHTML = ''
242
+ for (const breakpoint in this.breakpoints) {
243
+ innerHTML += `
244
+ @media screen and (max-width: ${breakpoint}) {
245
+ .vc-dialog[${this.attributeSelector}] {
246
+ width: ${this.breakpoints[breakpoint]} !important;
247
+ }
248
+ }
249
+ `
250
+ }
251
+ this.styleElement.innerHTML = innerHTML
252
+ }
253
+ },
254
+ onMaskClick (event: Event): void {
255
+ if (this.dismissableMask && this.closable && this.mask === event.target) {
256
+ this.close()
257
+ }
258
+ },
259
+ getPositionClass (): string {
260
+ const positions = ['left', 'right', 'top', 'top-left', 'top-right', 'bottom', 'bottom-left', 'bottom-right']
261
+ const pos = positions.find(item => item === this.position)
262
+ return pos ? `vc-dialog-${pos}` : ''
263
+ },
264
+ onBeforeEnter (el: HTMLElement | Element): void {
265
+ if (this.autoZIndex) {
266
+ ZIndexUtils.set(el as HTMLElement)
267
+ }
268
+ el.setAttribute(this.attributeSelector, '')
269
+ ZIndexUtils.setModal(this.ariaId)
270
+ },
271
+ onEnter (): void {
272
+ if (!this.mask || !this.container) {
273
+ return
274
+ }
275
+ this.mask.style.overflowY = 'hidden'
276
+ this.mask.style.zIndex = String(parseInt(this.container.style.zIndex, 10) - 1)
277
+ this.$emit('show')
278
+ this.focus()
279
+ this.enableDocumentSettings()
280
+ this.bindGlobalListeners()
281
+ },
282
+ onEnterCancelled () {
283
+ this.$nextTick(() => {
284
+ if (!this.mask || !this.container) {
285
+ return
286
+ }
287
+ this.mask.style.overflowY = 'auto'
288
+ })
289
+ },
290
+ bindGlobalListeners (): void {
291
+ if (this.closable && this.closeOnEscape) {
292
+ this.bindDocumentKeyDownListener()
293
+ }
294
+ },
295
+ onKeyDown (event: KeyboardEvent): void {
296
+ const lastModal = ZIndexUtils.lastModal()
297
+ if (event.code === 'Escape' && lastModal === this.ariaId) {
298
+ this.close()
299
+ }
300
+ },
301
+ bindDocumentKeyDownListener (): void {
302
+ if (!this.documentKeydownListener) {
303
+ this.documentKeydownListener = this.onKeyDown.bind(this)
304
+ document.addEventListener('keydown', this.documentKeydownListener)
305
+ }
306
+ },
307
+ enableDocumentSettings (): void {
308
+ const size = ZIndexUtils.countModals()
309
+ if (size > 1) {
310
+ return
311
+ }
312
+ DomHandler.addClass(document.body, 'overflow-hidden')
313
+ },
314
+ onBeforeLeave (): void {
315
+ if (this.mask) {
316
+ this.mask.style.overflowY = 'hidden'
317
+ }
318
+ DomHandler.addClass(this.mask, 'vc-component-overlay-leave')
319
+ },
320
+ onLeave (): void {
321
+ this.$emit('hide')
322
+ },
323
+ onAfterLeave (el: HTMLElement | Element): void {
324
+ if (this.autoZIndex) {
325
+ ZIndexUtils.clear(el as HTMLElement)
326
+ }
327
+ ZIndexUtils.removeModal(this.ariaId)
328
+ this.containerVisible = false
329
+ this.maximized = false
330
+ this.unbindDocumentState()
331
+ this.unbindGlobalListeners()
332
+ },
333
+ unbindGlobalListeners (): void {
334
+ this.unbindDocumentKeyDownListener()
335
+ },
336
+ unbindDocumentKeyDownListener (): void {
337
+ if (this.documentKeydownListener) {
338
+ document.removeEventListener('keydown', this.documentKeydownListener)
339
+ this.documentKeydownListener = null
340
+ }
341
+ },
342
+ unbindDocumentState (): void {
343
+ const size = ZIndexUtils.countModals()
344
+ if (size > 0) {
345
+ return
346
+ }
347
+ DomHandler.removeClass(document.body, 'overflow-hidden')
348
+ },
349
+ containerRef (el: HTMLElement): string {
350
+ this.container = el
351
+ return 'containerRef'
352
+ },
353
+ focus () {
354
+ if (!this.container) {
355
+ return
356
+ }
357
+ const focusTarget = this.container.querySelector('[autofocus]') as HTMLElement
358
+ if (focusTarget) {
359
+ focusTarget.focus()
360
+ }
361
+ },
362
+ maskRef (el: HTMLElement): string {
363
+ this.mask = el
364
+ return 'maskRef'
365
+ },
366
+ close (): void {
367
+ this.$emit('close', false)
368
+ },
369
+ maximize (event: Event): void {
370
+ if (this.maximized) {
371
+ this.maximized = false
372
+ this.$emit('unmaximize', event)
373
+ } else {
374
+ this.maximized = true
375
+ this.$emit('maximize', event)
376
+ }
377
+ }
378
+ }
379
+ })
380
+ </script>
381
+
382
+ <style lang="scss">
383
+ @import "VcModal";
384
+ </style>
@@ -0,0 +1,302 @@
1
+ <template>
2
+ <Teleport to="body">
3
+ <div
4
+ ref="container"
5
+ :class="containerClass"
6
+ v-bind="$attrs"
7
+ >
8
+ <transition-group
9
+ name="vc-toast-message"
10
+ tag="div"
11
+ @enter="onEnter"
12
+ @after-leave="onLeave"
13
+ >
14
+ <VcNotificationMessage
15
+ v-for="msg of messages"
16
+ :key="msg.id"
17
+ :message="msg"
18
+ @close="remove($event)"
19
+ />
20
+ </transition-group>
21
+ </div>
22
+ </Teleport>
23
+ </template>
24
+
25
+ <script lang="ts">
26
+
27
+ import { defineComponent, PropType } from 'vue'
28
+ import { ToastPositionType, ToastMessageOptions } from './VcNotification.types'
29
+ import UniqueComponentId from '@/utils/UniqueComponentId'
30
+ import ZIndexUtils from '@/utils/ZIndexUtils'
31
+ import ToastEventBus from '@/utils/ToastEventBus'
32
+ import VcNotificationMessage from '@/components/VcNotification/VcNotificationMessage.vue'
33
+
34
+ const BASE_Z_INDEX = 3000
35
+
36
+ export default defineComponent({
37
+ name: 'VcNotification',
38
+ components: { VcNotificationMessage },
39
+ inheritAttrs: false,
40
+ props: {
41
+ position: {
42
+ type: String as PropType<ToastPositionType>,
43
+ default: 'top-right'
44
+ },
45
+ group: {
46
+ type: String,
47
+ default: undefined
48
+ },
49
+ autoZIndex: {
50
+ type: Boolean,
51
+ default: true
52
+ },
53
+ baseZIndex: {
54
+ type: Number,
55
+ default: BASE_Z_INDEX
56
+ }
57
+ },
58
+ data () {
59
+ return {
60
+ messages: [] as ToastMessageOptions[],
61
+ messageIdx: 0,
62
+ styleElement: null,
63
+ customPosition: ''
64
+ }
65
+ },
66
+ computed: {
67
+ containerClass (): string[] {
68
+ const position = this.customPosition || this.position
69
+ return [
70
+ 'vc-toast vc-toast-component vc-toast-' + position
71
+ ]
72
+ },
73
+ attributeSelector (): string {
74
+ return UniqueComponentId('vc-toast-id_')
75
+ }
76
+ },
77
+ mounted () {
78
+ ToastEventBus.on('add', this.onAdd)
79
+ ToastEventBus.on('remove-group', this.onRemoveGroup)
80
+ ToastEventBus.on('remove-all-groups', this.onRemoveAllGroups)
81
+ },
82
+ beforeUnmount () {
83
+ const container = this.$refs.container as HTMLElement
84
+ if (container && this.autoZIndex) {
85
+ ZIndexUtils.clear(container)
86
+ }
87
+ ToastEventBus.off('add', this.onAdd)
88
+ ToastEventBus.off('remove-group', this.onRemoveGroup)
89
+ ToastEventBus.off('remove-all-groups', this.onRemoveAllGroups)
90
+ },
91
+ methods: {
92
+ add (message: ToastMessageOptions) {
93
+ if (message.id == null) {
94
+ message.id = this.messageIdx++
95
+ }
96
+ this.messages = [...this.messages, message]
97
+ },
98
+ remove (message: ToastMessageOptions) {
99
+ let index = -1
100
+ for (let i = 0; i < this.messages.length; i++) {
101
+ if (this.messages[i] === message) {
102
+ index = i
103
+ break
104
+ }
105
+ }
106
+ this.messages.splice(index, 1)
107
+ },
108
+ onAdd (message: ToastMessageOptions) {
109
+ if (message.position) {
110
+ this.customPosition = message.position
111
+ }
112
+ // eslint-disable-next-line eqeqeq
113
+ if (this.group == message.group) {
114
+ this.add(message)
115
+ }
116
+ },
117
+ onRemoveGroup (group: string) {
118
+ if (this.group === group) {
119
+ this.messages = []
120
+ }
121
+ },
122
+ onRemoveAllGroups () {
123
+ this.messages = []
124
+ },
125
+ onEnter () {
126
+ const container = this.$refs.container as HTMLElement
127
+ if (!container) {
128
+ return
129
+ }
130
+ container.setAttribute(this.attributeSelector, '')
131
+ if (this.autoZIndex) {
132
+ ZIndexUtils.set(container)
133
+ }
134
+ },
135
+ onLeave () {
136
+ const container = this.$refs.container as HTMLElement
137
+ if (!container) {
138
+ return
139
+ }
140
+ if (container && this.autoZIndex && !this.messages.length) {
141
+ ZIndexUtils.clear(container)
142
+ }
143
+ }
144
+ }
145
+ })
146
+ </script>
147
+
148
+ <style lang="scss">
149
+ $toastWidth: 27rem;
150
+ .vc-toast {
151
+ @apply fixed box-border text-white;
152
+ width: $toastWidth;
153
+ max-width: calc(100% - 2.5rem);
154
+ /* Positions */
155
+ &.vc-toast-top-right {
156
+ @apply top-5 right-5;
157
+ }
158
+ &.vc-toast-top-left {
159
+ @apply top-5 left-5;
160
+ }
161
+ &.vc-toast-bottom-left {
162
+ @apply bottom-5 left-5;
163
+ }
164
+ &.vc-toast-bottom-right {
165
+ @apply bottom-5 right-5;
166
+ }
167
+ &.vc-toast-top-center {
168
+ @apply top-5;
169
+ left: 50%;
170
+ transform: translateX(-50%);
171
+ }
172
+ &.vc-toast-bottom-center {
173
+ @apply bottom-5;
174
+ left: 50%;
175
+ transform: translateX(-50%);
176
+ }
177
+ &.vc-toast-center {
178
+ left: 50%;
179
+ top: 50%;
180
+ min-width: 20vw;
181
+ transform: translate(-50%, -50%);
182
+ }
183
+
184
+ /* Message */
185
+ .vc-toast-message {
186
+ @apply shadow-card bg-white opacity-90 hover:opacity-100;
187
+ margin: 0 0 1rem 0;
188
+ border-radius: 0 6px 6px 0;
189
+ transition: all .3s ease;
190
+
191
+ .vc-toast-message-content {
192
+ @apply flex items-start p-4;
193
+ border-width: 0 0 0 4px;
194
+ border-color: currentColor;
195
+ }
196
+ .vc-toast-message-text {
197
+ @apply text-default-text pl-4;
198
+ flex: 1 1 auto;
199
+ .vc-toast-summary {
200
+ @apply font-bold text-base mb-2;
201
+ }
202
+ .vc-toast-detail {
203
+ @apply font-medium text-sm;
204
+ line-height: 145%;
205
+ }
206
+ }
207
+ .vc-toast-message-icon {
208
+ @apply self-center flex-shrink-0 text-current;
209
+ }
210
+ .vc-toast-icon-close {
211
+ @apply
212
+ flex
213
+ items-center
214
+ justify-center
215
+ overflow-hidden
216
+ relative
217
+ cursor-pointer
218
+ flex-shrink-0
219
+ text-secondary-actions;
220
+ transition: all .3s ease;
221
+ &:hover {
222
+ @apply text-active-elements--focus;
223
+ }
224
+ &:active {
225
+ @apply text-active-elements--pressed;
226
+ }
227
+ }
228
+
229
+ &.vc-toast-message-info {
230
+ @apply text-primary-actions;
231
+ }
232
+ &.vc-toast-message-warn {
233
+ @apply text-warning;
234
+ }
235
+ &.vc-toast-message-error {
236
+ @apply text-error;
237
+ }
238
+ &.vc-toast-message-success {
239
+ @apply text-success;
240
+ }
241
+ }
242
+ }
243
+
244
+ /* Animations */
245
+ .vc-toast-message-enter-from {
246
+ opacity: 0;
247
+ transform: translateX(100%);
248
+ }
249
+ .vc-toast-top-left, .vc-toast-bottom-left {
250
+ .vc-toast-message-enter-from {
251
+ transform: translateX(-100%);
252
+ }
253
+ }
254
+ .vc-toast-top-right, .vc-toast-bottom-right {
255
+ .vc-toast-message-enter-from {
256
+ transform: translateX(100%);
257
+ }
258
+ }
259
+ .vc-toast-top-center {
260
+ .vc-toast-message-enter-from {
261
+ transform: translateY(-32px);
262
+ }
263
+ }
264
+ .vc-toast-bottom-center, .vc-toast-center {
265
+ .vc-toast-message-enter-from {
266
+ transform: translateY(32px);
267
+ }
268
+ }
269
+
270
+ .vc-toast-message-leave-from {
271
+ max-height: 1000px;
272
+ }
273
+ .vc-toast .vc-toast-message.vc-toast-message-leave-to {
274
+ max-height: 0;
275
+ opacity: 0;
276
+ margin-bottom: 0;
277
+ overflow: hidden;
278
+ transform: translateY(-32px);
279
+ }
280
+ .vc-toast-message-enter-active {
281
+ -webkit-transition: transform .3s, opacity .3s;
282
+ transition: transform .3s, opacity .3s;
283
+ }
284
+ .vc-toast-message-leave-active {
285
+ -webkit-transition: max-height .45s cubic-bezier(0, 1, 0, 1), opacity .3s, margin-bottom .3s;
286
+ transition: max-height .45s cubic-bezier(0, 1, 0, 1), opacity .3s, margin-bottom .3s;
287
+ }
288
+
289
+ [dir='rtl'] {
290
+ .vc-toast {
291
+ .vc-toast-message {
292
+ border-radius: 6px 0 0 6px;
293
+ .vc-toast-message-content {
294
+ border-width: 0 4px 0 0;
295
+ }
296
+ .vc-toast-message-text {
297
+ @apply pl-1 pr-4;
298
+ }
299
+ }
300
+ }
301
+ }
302
+ </style>