comand-component-library 3.1.43 → 3.1.46

Sign up to get free protection for your applications and to get access to all the features.
Files changed (236) hide show
  1. package/dist/comand-component-library.css +1 -1
  2. package/dist/comand-component-library.umd.min.js +1 -1
  3. package/package.json +47 -40
  4. package/src/App.vue +379 -136
  5. package/src/ComponentDocumentation.vue +156 -0
  6. package/src/ComponentLibraryHelp.vue +20 -0
  7. package/src/assets/data/accordion.json +21 -24
  8. package/src/assets/data/address-data.json +34 -0
  9. package/src/assets/data/bank-account-data.json +22 -0
  10. package/src/assets/data/box-product.json +14 -4
  11. package/src/assets/data/box-user.json +48 -22
  12. package/src/assets/data/breadcrumbs.json +11 -3
  13. package/src/assets/data/cookie-disclaimer.json +4 -4
  14. package/src/assets/data/fake-select-colors.json +4 -0
  15. package/src/assets/data/fake-select-countries.json +12 -12
  16. package/src/assets/data/fake-select-filter-options.json +14 -0
  17. package/src/assets/data/fake-select-options-with-icons.json +6 -12
  18. package/src/assets/data/fake-select-options.json +3 -3
  19. package/src/assets/data/list-of-links-section-anchors.json +23 -0
  20. package/src/assets/data/list-of-links-top-header-navigation.json +20 -0
  21. package/src/assets/data/list-of-links.json +42 -0
  22. package/src/assets/data/main-navigation.json +48 -0
  23. package/src/assets/data/multistep-form-progress-bar.json +33 -0
  24. package/src/assets/data/select-options.json +4 -0
  25. package/src/assets/data/{share-buttons.json → share-buttons-page-by-json.json} +8 -8
  26. package/src/assets/data/share-buttons-page-by-property.json +30 -0
  27. package/src/assets/data/switch-language.json +20 -0
  28. package/src/assets/data/table-large.json +1 -1
  29. package/src/assets/data/table-small.json +1 -1
  30. package/src/assets/styles/global-styles.scss +43 -14
  31. package/src/assets/styles/transitions.scss +21 -1
  32. package/src/components/CmdAccordion.vue +43 -42
  33. package/src/components/CmdAddressData.vue +124 -56
  34. package/src/components/CmdBackToTopButton.vue +3 -3
  35. package/src/components/CmdBankAccountData.vue +104 -0
  36. package/src/components/CmdBox.vue +253 -56
  37. package/src/components/CmdBoxSiteSearch.vue +138 -39
  38. package/src/components/CmdBoxWrapper.vue +206 -0
  39. package/src/components/CmdBreadcrumbs.vue +29 -13
  40. package/src/components/CmdCompanyLogo.vue +6 -4
  41. package/src/components/CmdCookieDisclaimer.vue +99 -75
  42. package/src/components/CmdCopyrightInformation.vue +1 -1
  43. package/src/components/CmdCustomHeadline.vue +93 -0
  44. package/src/components/CmdFakeSelect.vue +330 -66
  45. package/src/components/CmdFancyBox.vue +47 -33
  46. package/src/components/CmdForm.vue +107 -0
  47. package/src/components/CmdFormElement.vue +528 -83
  48. package/src/components/CmdFormFilters.vue +25 -11
  49. package/src/components/CmdGoogleMaps.vue +9 -3
  50. package/src/components/CmdImageGallery.vue +28 -5
  51. package/src/components/CmdImageZoom.vue +9 -1
  52. package/src/components/CmdListOfLinks.vue +169 -0
  53. package/src/components/CmdLoginForm.vue +146 -66
  54. package/src/components/CmdMainNavigation.vue +140 -42
  55. package/src/components/CmdMultipleSwitch.vue +33 -2
  56. package/src/components/CmdMultistepFormProgressBar.vue +60 -10
  57. package/src/components/CmdOpeningHours.vue +36 -10
  58. package/src/components/CmdPager.vue +7 -5
  59. package/src/components/CmdProgressBar.vue +21 -4
  60. package/src/components/CmdShareButtons.vue +64 -9
  61. package/src/components/CmdSiteHeader.vue +25 -12
  62. package/src/components/CmdSlideButton.vue +5 -2
  63. package/src/components/CmdSlideshow.vue +23 -7
  64. package/src/components/CmdSwitchButton.vue +15 -6
  65. package/src/components/CmdSwitchLanguage.vue +18 -10
  66. package/src/components/CmdSystemMessage.vue +30 -17
  67. package/src/components/CmdTable.vue +15 -7
  68. package/src/components/CmdTabs.vue +43 -3
  69. package/src/components/CmdThumbnailScroller.vue +22 -6
  70. package/src/components/CmdTooltip.vue +184 -11
  71. package/src/components/CmdUploadForm.vue +830 -176
  72. package/src/components/CmdWidthLimitationWrapper.vue +9 -6
  73. package/src/composables/event.js +8 -0
  74. package/src/composables/scrollspy.js +52 -0
  75. package/src/directives/focus.js +19 -0
  76. package/src/directives/telephone.js +1 -1
  77. package/src/documentation/commonProps.js +6 -0
  78. package/src/documentation/components/ComponentCode.vue +50 -0
  79. package/src/documentation/components/ComponentProperties.vue +237 -0
  80. package/src/documentation/components/ExampleSectionWrapper.vue +46 -0
  81. package/src/documentation/components/ViewCodeData.vue +113 -0
  82. package/src/documentation/data/CmdAccordionHelp.js +22 -0
  83. package/src/documentation/data/CmdAddressDataHelp.js +17 -0
  84. package/src/documentation/data/CmdBackToTopButtonHelp.js +3 -0
  85. package/src/documentation/data/CmdBankAccountDataHelp.js +8 -0
  86. package/src/documentation/data/CmdBoxHelp.js +45 -0
  87. package/src/documentation/data/CmdBoxSiteSearchHelp.js +11 -0
  88. package/src/documentation/data/CmdBreadcrumbsHelp.js +6 -0
  89. package/src/documentation/data/CmdCompanyLogoHelp.js +8 -0
  90. package/src/documentation/data/CmdCookieDisclaimerHelp.js +9 -0
  91. package/src/documentation/data/CmdCopyrightInformation.js +2 -0
  92. package/src/documentation/data/CmdCustomHeadlineHelp.js +8 -0
  93. package/src/documentation/data/CmdFakeSelectHelp.js +60 -0
  94. package/src/documentation/data/CmdFancyBoxHelp.js +7 -0
  95. package/src/documentation/data/CmdFooterNavigationHelp.js +5 -0
  96. package/src/documentation/data/CmdFormElementHelp.js +189 -0
  97. package/src/documentation/data/CmdFormFiltersHelp.js +6 -0
  98. package/src/documentation/data/CmdFormHelp.js +10 -0
  99. package/src/documentation/data/CmdGoogleMapsHelp.js +5 -0
  100. package/src/documentation/data/CmdImageGalleryHelp.js +5 -0
  101. package/src/documentation/data/CmdImageZoomHelp.js +6 -0
  102. package/src/documentation/data/CmdListOfLinksHelp.js +24 -0
  103. package/src/documentation/data/CmdLoginFormHelp.js +6 -0
  104. package/src/documentation/data/CmdMainNavigationHelp.js +7 -0
  105. package/src/documentation/data/CmdMultistepFormProgressBarHelp.js +6 -0
  106. package/src/documentation/data/CmdOpeningHoursHelp.js +10 -0
  107. package/src/documentation/data/CmdPagerHelp.js +7 -0
  108. package/src/documentation/data/CmdProgressBarHelp.js +13 -0
  109. package/src/documentation/data/CmdShareButtonsHelp.js +13 -0
  110. package/src/documentation/data/CmdSiteHeaderHelp.js +21 -0
  111. package/src/documentation/data/CmdSlideButtonHelp.js +10 -0
  112. package/src/documentation/data/CmdSlideshowHelp.js +7 -0
  113. package/src/documentation/data/CmdSwitchLanguageHelp.js +6 -0
  114. package/src/documentation/data/CmdSystemMessageHelp.js +32 -0
  115. package/src/documentation/data/CmdTableHelp.js +14 -0
  116. package/src/documentation/data/CmdTabsHelp.js +10 -0
  117. package/src/documentation/data/CmdThumbnailScrollerHelp.js +5 -0
  118. package/src/documentation/data/CmdTooltipHelp.js +13 -0
  119. package/src/documentation/data/CmdUploadFormHelp.js +17 -0
  120. package/src/documentation/data/CmdWidthLimitationWrapperHelp.js +7 -0
  121. package/src/documentation/data/componentsDescription.json +158 -0
  122. package/src/documentation/generated/CmdAccordionPropertyDescriptions.json +57 -0
  123. package/src/documentation/generated/CmdAddressDataPropertyDescriptions.json +32 -0
  124. package/src/documentation/generated/CmdBackToTopButtonPropertyDescriptions.json +12 -0
  125. package/src/documentation/generated/CmdBankAccountDataPropertyDescriptions.json +34 -0
  126. package/src/documentation/generated/CmdBoxPropertyDescriptions.json +91 -0
  127. package/src/documentation/generated/CmdBoxSiteSearchPropertyDescriptions.json +41 -0
  128. package/src/documentation/generated/CmdBoxWrapperPropertyDescriptions.json +47 -0
  129. package/src/documentation/generated/CmdBreadcrumbsPropertyDescriptions.json +17 -0
  130. package/src/documentation/generated/CmdCompanyLogoPropertyDescriptions.json +27 -0
  131. package/src/documentation/generated/CmdCookieDisclaimerPropertyDescriptions.json +22 -0
  132. package/src/documentation/generated/CmdCustomHeadlinePropertyDescriptions.json +22 -0
  133. package/src/documentation/generated/CmdFakeSelectPropertyDescriptions.json +79 -0
  134. package/src/documentation/generated/CmdFancyBoxPropertyDescriptions.json +62 -0
  135. package/src/documentation/generated/CmdFooterNavigationPropertyDescriptions.json +17 -0
  136. package/src/documentation/generated/CmdFormElementPropertyDescriptions.json +178 -0
  137. package/src/documentation/generated/CmdFormFiltersPropertyDescriptions.json +32 -0
  138. package/src/documentation/generated/CmdFormPropertyDescriptions.json +40 -0
  139. package/src/documentation/generated/CmdGoogleMapsPropertyDescriptions.json +7 -0
  140. package/src/documentation/generated/CmdImageGalleryPropertyDescriptions.json +22 -0
  141. package/src/documentation/generated/CmdImageZoomPropertyDescriptions.json +12 -0
  142. package/src/documentation/generated/CmdListOfLinksPropertyDescriptions.json +60 -0
  143. package/src/documentation/generated/CmdLoginFormPropertyDescriptions.json +90 -0
  144. package/src/documentation/generated/CmdMainNavigationPropertyDescriptions.json +62 -0
  145. package/src/documentation/generated/CmdMultipleSwitchPropertyDescriptions.json +52 -0
  146. package/src/documentation/generated/CmdMultistepFormProgressBarPropertyDescriptions.json +17 -0
  147. package/src/documentation/generated/CmdOpeningHoursPropertyDescriptions.json +42 -0
  148. package/src/documentation/generated/CmdPagerPropertyDescriptions.json +37 -0
  149. package/src/documentation/generated/CmdProgressBarPropertyDescriptions.json +32 -0
  150. package/src/documentation/generated/CmdShareButtonsPropertyDescriptions.json +34 -0
  151. package/src/documentation/generated/CmdSiteHeaderPropertyDescriptions.json +27 -0
  152. package/src/documentation/generated/CmdSlideButtonPropertyDescriptions.json +25 -0
  153. package/src/documentation/generated/CmdSlideshowPropertyDescriptions.json +42 -0
  154. package/src/documentation/generated/CmdSwitchButtonPropertyDescriptions.json +79 -0
  155. package/src/documentation/generated/CmdSwitchLanguagePropertyDescriptions.json +7 -0
  156. package/src/documentation/generated/CmdSystemMessagePropertyDescriptions.json +40 -0
  157. package/src/documentation/generated/CmdTablePropertyDescriptions.json +62 -0
  158. package/src/documentation/generated/CmdTabsPropertyDescriptions.json +27 -0
  159. package/src/documentation/generated/CmdThumbnailScrollerPropertyDescriptions.json +32 -0
  160. package/src/documentation/generated/CmdTooltipPropertyDescriptions.json +17 -0
  161. package/src/documentation/generated/CmdUploadFormPropertyDescriptions.json +90 -0
  162. package/src/documentation/generated/CmdWidthLimitationWrapperPropertyDescriptions.json +41 -0
  163. package/src/documentation/generated/frameworkIcons.json +730 -0
  164. package/src/documentation/generated/logosIcons.json +110 -0
  165. package/src/documentation/tabs.js +46 -0
  166. package/src/documentation/views/ContainerPage.vue +237 -0
  167. package/src/documentation/views/HelpHome.vue +13 -0
  168. package/src/documentation/views/IconFont.vue +80 -0
  169. package/src/documentation/views/components/CmdAccordionHelp.vue +78 -0
  170. package/src/documentation/views/components/CmdAddressDataHelp.vue +65 -0
  171. package/src/documentation/views/components/CmdBackToTopButtonHelp.vue +62 -0
  172. package/src/documentation/views/components/CmdBankAccountDataHelp.vue +88 -0
  173. package/src/documentation/views/components/CmdBoxHelp.vue +137 -0
  174. package/src/documentation/views/components/CmdBoxSiteSearchHelp.vue +60 -0
  175. package/src/documentation/views/components/CmdBoxWrapperHelp.vue +111 -0
  176. package/src/documentation/views/components/CmdBreadcrumbsHelp.vue +51 -0
  177. package/src/documentation/views/components/CmdCompanyLogoHelp.vue +48 -0
  178. package/src/documentation/views/components/CmdCookieDisclaimerHelp.vue +105 -0
  179. package/src/documentation/views/components/CmdCustomHeadlineHelp.vue +53 -0
  180. package/src/documentation/views/components/CmdFakeSelectHelp.vue +175 -0
  181. package/src/documentation/views/components/CmdFancyBoxHelp.vue +79 -0
  182. package/src/documentation/views/components/CmdFormElementHelp.vue +412 -0
  183. package/src/documentation/views/components/CmdFormFiltersHelp.vue +69 -0
  184. package/src/documentation/views/components/CmdFormHelp.vue +41 -0
  185. package/src/documentation/views/components/CmdGoogleMapsHelp.vue +55 -0
  186. package/src/documentation/views/components/CmdImageGalleryHelp.vue +46 -0
  187. package/src/documentation/views/components/CmdImageZoomHelp.vue +34 -0
  188. package/src/documentation/views/components/CmdListOfLinksHelp.vue +64 -0
  189. package/src/documentation/views/components/CmdLoginFormHelp.vue +117 -0
  190. package/src/documentation/views/components/CmdMainNavigationHelp.vue +94 -0
  191. package/src/documentation/views/components/CmdMultistepFormProgressBarHelp.vue +49 -0
  192. package/src/documentation/views/components/CmdOpeningHoursHelp.vue +49 -0
  193. package/src/documentation/views/components/CmdPagerHelp.vue +57 -0
  194. package/src/documentation/views/components/CmdProgressBarHelp.vue +47 -0
  195. package/src/documentation/views/components/CmdShareButtonsHelp.vue +65 -0
  196. package/src/documentation/views/components/CmdSiteHeaderHelp.vue +72 -0
  197. package/src/documentation/views/components/CmdSlideButtonHelp.vue +90 -0
  198. package/src/documentation/views/components/CmdSlideshowHelp.vue +60 -0
  199. package/src/documentation/views/components/CmdSwitchLanguageHelp.vue +64 -0
  200. package/src/documentation/views/components/CmdSystemMessageHelp.vue +86 -0
  201. package/src/documentation/views/components/CmdTableHelp.vue +84 -0
  202. package/src/documentation/views/components/CmdTabsHelp.vue +52 -0
  203. package/src/documentation/views/components/CmdThumbnailScrollerHelp.vue +50 -0
  204. package/src/documentation/views/components/CmdTooltipHelp.vue +59 -0
  205. package/src/documentation/views/components/CmdUploadFormHelp.vue +59 -0
  206. package/src/documentation/views/components/CmdWidthLimitationWrapperHelp.vue +46 -0
  207. package/src/index.js +6 -3
  208. package/src/main.js +25 -15
  209. package/src/mixins/CmdAddressData/DefaultMessageProperties.js +17 -0
  210. package/src/mixins/CmdBox/DefaultMessageProperties.js +10 -0
  211. package/src/mixins/CmdFakeSelect/DefaultMessageProperties.js +9 -0
  212. package/src/mixins/CmdFormElement/DefaultMessageProperties.js +9 -0
  213. package/src/mixins/CmdImageGallery/DefaultMessageProperties.js +9 -0
  214. package/src/mixins/CmdSiteSearch/DefaultMessageProperties.js +14 -0
  215. package/src/mixins/CmdUploadForm/DefaultMessageProperties.js +53 -0
  216. package/src/mixins/FieldValidation.js +220 -0
  217. package/src/mixins/GlobalDefaultMessageProperties.js +15 -0
  218. package/src/mixins/I18n.js +56 -0
  219. package/src/mixins/Tooltip.js +26 -0
  220. package/src/router/index.js +67 -0
  221. package/src/utilities.js +3 -6
  222. package/src/utils/GetFileExtension.js +15 -0
  223. package/src/utils/common.js +6 -0
  224. package/src/utils/dom.js +8 -0
  225. package/src/utils/globalSequence.js +13 -0
  226. package/src/utils/string.js +8 -0
  227. package/src/assets/data/address.json +0 -13
  228. package/src/assets/data/footer-navigation.json +0 -38
  229. package/src/assets/data/languages.json +0 -31
  230. package/src/assets/data/multisteps.json +0 -27
  231. package/src/assets/data/navigation.json +0 -47
  232. package/src/assets/data/pager.json +0 -11
  233. package/src/assets/data/top-header-navigation.json +0 -27
  234. package/src/components/CmdFooterNavigation.vue +0 -71
  235. package/src/components/CmdMainHeadline.vue +0 -75
  236. package/src/components/CmdTopHeaderNavigation.vue +0 -88
@@ -2,7 +2,7 @@
2
2
  <div class="cmd-tabs">
3
3
  <ul :class="{'stretch-tabs' : stretchTabs}">
4
4
  <li :class="{active : showTab === index}" v-for="(tab, index) in tabs" :key="index" role="tab">
5
- <a @click.prevent="showTab = index" :title="!tab.name ? tab.tooltip : false">
5
+ <a @click.prevent="setActiveTab(index)" :title="!tab.name ? tab.tooltip : false">
6
6
  <span v-if="tab.iconClass">{{ tab.iconClass }}</span>
7
7
  <span v-if="tab.name">{{ tab.name }}</span>
8
8
  </a>
@@ -10,25 +10,47 @@
10
10
  </ul>
11
11
  <template v-if="useSlot">
12
12
  <div v-show="showTab === index" v-for="(tab, index) in tabs" :key="index" aria-live="assertive">
13
+ <!-- begin slot-content -->
13
14
  <slot :name="'tab-content-' + index"></slot>
15
+ <!-- end slot-content -->
14
16
  </div>
15
17
  </template>
16
18
  <div v-else aria-live="assertive">
17
- <h3 class="headline">{{ tabs[showTab].headline }}</h3>
19
+ <!-- begin CmdCustomHeadline -->
20
+ <CmdCustomHeadline
21
+ v-bind="cmdCustomHeadline"
22
+ :headlineText="tabs[showTab].headline"
23
+ />
24
+ <!-- end CmdCustomHeadline -->
25
+
18
26
  <div v-html="tabs[showTab].htmlContent"></div>
19
27
  </div>
20
28
  </div>
21
29
  </template>
22
30
 
23
31
  <script>
32
+ // import components
33
+ import CmdCustomHeadline from "./CmdCustomHeadline"
34
+
24
35
  export default {
25
36
  name: "CmdTabs",
37
+ components: {
38
+ CmdCustomHeadline
39
+ },
26
40
  data() {
27
41
  return {
28
- showTab: 0
42
+ showTab: this.activeTab
29
43
  }
30
44
  },
45
+ emits: ["active-tab"],
31
46
  props: {
47
+ /**
48
+ * properties for CmdCustomHeadline-component
49
+ */
50
+ cmdCustomHeadline: {
51
+ type: Object,
52
+ required: false
53
+ },
32
54
  /**
33
55
  * activate if tabs should be (equally) stretched horizontally over full width of tab-content
34
56
  */
@@ -49,6 +71,24 @@ export default {
49
71
  useSlot: {
50
72
  type: Boolean,
51
73
  default: false
74
+ },
75
+ /**
76
+ * set default active/shown tab
77
+ */
78
+ activeTab: {
79
+ type: Number,
80
+ default: 0
81
+ }
82
+ },
83
+ methods: {
84
+ setActiveTab(index) {
85
+ this.showTab = index
86
+ this.$emit("active-tab", index)
87
+ }
88
+ },
89
+ watch: {
90
+ activeTab() {
91
+ this.showTab = this.activeTab
52
92
  }
53
93
  }
54
94
  }
@@ -1,6 +1,13 @@
1
1
  <template>
2
2
  <div :class="['cmd-thumbnail-scroller', {'gallery-scroller' : !allowOpenFancyBox}]">
3
- <CmdSlideButton @click.prevent="showPrevItem" slideButtonType="prev" />
3
+ <!-- begin CmdSlideButton -->
4
+ <CmdSlideButton
5
+ @click.prevent="showPrevItem"
6
+ slideButtonType="prev"
7
+ />
8
+ <!-- end CmdSlideButton -->
9
+
10
+ <!-- begin list of images to slide -->
4
11
  <transition-group name="slide" tag="ul">
5
12
  <li v-for="(image, index) in thumbnails" :key="image.imgId" :class="{'active' : imgIndex === index}">
6
13
  <a href="#" @click.prevent="showFancyBox(index)">
@@ -12,7 +19,14 @@
12
19
  </a>
13
20
  </li>
14
21
  </transition-group>
15
- <CmdSlideButton @click.prevent="showNextItem" :slideButtons="cmdSlideButtons.next"/>
22
+ <!-- end list of images to slide -->
23
+
24
+ <!-- begin CmdSlideButton -->
25
+ <CmdSlideButton
26
+ @click.prevent="showNextItem"
27
+ :slideButtons="cmdSlideButtons.next"
28
+ />
29
+ <!-- end CmdSlideButton -->
16
30
  </div>
17
31
  </template>
18
32
 
@@ -22,14 +36,14 @@ import CmdSlideButton from "./CmdSlideButton.vue"
22
36
 
23
37
  export default {
24
38
  name: "CmdThumbnailScroller",
39
+ components: {
40
+ CmdSlideButton
41
+ },
25
42
  data() {
26
43
  return {
27
44
  thumbnails: []
28
45
  }
29
46
  },
30
- components: {
31
- CmdSlideButton
32
- },
33
47
  props: {
34
48
  /**
35
49
  * list of thumbnail-scroller-items
@@ -65,7 +79,9 @@ export default {
65
79
  }
66
80
  },
67
81
  /**
68
- * properties for cmdSlideButtons-component
82
+ * properties for CmdSlideButtons-component
83
+ *
84
+ * @requiredForAccessibility: partial
69
85
  */
70
86
  cmdSlideButtons: {
71
87
  type: Object,
@@ -1,17 +1,168 @@
1
1
  <template>
2
- <span class="cmd-tooltip">{{ tooltipText }}</span>
2
+ <div v-if="tooltipVisibility" :class="['cmd-tooltip', status]" ref="tooltip" aria-role="tooltip">
3
+ <div v-if="cmdCustomHeadline || iconClose.show" class="headline-wrapper">
4
+ <!-- begin CmdCustomHeadline -->
5
+ <CmdCustomHeadline v-if="cmdCustomHeadline"
6
+ :iconClass="cmdCustomHeadline.iconClass"
7
+ :preHeadline="cmdCustomHeadline.preHeadline"
8
+ :headlineLevel="cmdCustomHeadline.headlineLevel"
9
+ :headlineText="cmdCustomHeadline.headlineText"/>
10
+ <!-- end CmdCustomHeadline -->
11
+
12
+ <!-- begin icon to close tooltip -->
13
+ <a v-if="iconClose.show && toggleVisibilityByClick" href="#" @click.prevent="tooltipVisibility = false" :title="iconClose.tooltip">
14
+ <span :class="iconClose.iconClass"></span>
15
+ </a>
16
+ <!-- end icon to close tooltip -->
17
+ </div>
18
+ <!-- begin slot-content -->
19
+ <slot>
20
+ {{ tooltipText }}
21
+ </slot>
22
+ <!-- end slot-content -->
23
+ </div>
3
24
  </template>
4
25
 
5
26
  <script>
27
+ // import components
28
+ import CmdCustomHeadline from "./CmdCustomHeadline"
29
+
6
30
  export default {
7
31
  name: "CmdTooltip",
32
+ components: {
33
+ CmdCustomHeadline
34
+ },
35
+ data() {
36
+ return {
37
+ tooltipVisibility: false,
38
+ pointerX: 0,
39
+ pointerY: 0
40
+ }
41
+ },
8
42
  props: {
9
43
  /**
10
- * text for tooltip
44
+ * properties for CmdCustomHeadline-component
45
+ */
46
+ cmdCustomHeadline: {
47
+ type: Object,
48
+ default() {}
49
+ },
50
+ /**
51
+ * text shown as tooltip
11
52
  */
12
53
  tooltipText: {
13
54
  type: String,
14
- required: true
55
+ required: false
56
+ },
57
+ /**
58
+ * id of related input-element
59
+ */
60
+ relatedId: {
61
+ type: String,
62
+ required: false
63
+ },
64
+ /**
65
+ * status
66
+ *
67
+ * @allowedValues: error, warning, success, info
68
+ */
69
+ status: {
70
+ type: String,
71
+ required: false
72
+ },
73
+ /**
74
+ * icon 'close'
75
+ *
76
+ * @requiredForAccessibility: partial
77
+ */
78
+ iconClose: {
79
+ type: Object,
80
+ default() {
81
+ return {
82
+ show: true,
83
+ iconClass: "icon-cancel",
84
+ tooltip: "Close this tooltip!"
85
+ }
86
+ }
87
+ },
88
+ /**
89
+ * enable toggling tooltip-visibility by click
90
+ */
91
+ toggleVisibilityByClick: {
92
+ type: Boolean,
93
+ default: false
94
+ }
95
+ },
96
+ mounted() {
97
+ if(this.relatedId) {
98
+ const relatedElement = document.getElementById(this.relatedId)
99
+
100
+ if(relatedElement) {
101
+ relatedElement.addEventListener("mouseenter", this.showTooltip)
102
+ document.addEventListener("scroll", this.hideTooltip) // avoid fixed tooltip on scroll
103
+ document.addEventListener("keyup", this.hideTooltipOnEsc) // close tooltip by using "escape"-key
104
+
105
+ if (this.toggleVisibilityByClick) {
106
+ relatedElement.addEventListener("click", this.toggleTooltipVisibility)
107
+ } else {
108
+ relatedElement.addEventListener("mouseleave", this.hideTooltip)
109
+ }
110
+ }
111
+ }
112
+ },
113
+ methods: {
114
+ toggleTooltipVisibility(event) {
115
+ this.getPointerPosition(event)
116
+ this.tooltipVisibility = !this.tooltipVisibility
117
+ },
118
+ showTooltip(event) {
119
+ if(!this.toggleVisibilityByClick) {
120
+ this.tooltipVisibility = true
121
+ }
122
+ this.getPointerPosition(event)
123
+ },
124
+ hideTooltipOnEsc(event) {
125
+ if(this.allowEscapeKey) {
126
+ if (event.key === 'Escape' || event.key === 'Esc') {
127
+ this.hideTooltip()
128
+ }
129
+ }
130
+ },
131
+ hideTooltip() {
132
+ this.tooltipVisibility = false
133
+ },
134
+ getPointerPosition(event) {
135
+ this.pointerX = event.clientX
136
+ this.pointerY = event.clientY
137
+ }
138
+ },
139
+ unmounted() {
140
+ if(this.relatedId) {
141
+ const relatedElement = document.getElementById(this.relatedId)
142
+
143
+ if(relatedElement) {
144
+ relatedElement.removeEventListener("mouseenter", this.showTooltip)
145
+ document.removeEventListener("scroll", this.hideTooltip)
146
+ document.removeEventListener("keyup", this.hideTooltipOnEsc)
147
+
148
+ if (this.toggleVisibilityByClick) {
149
+ relatedElement.removeEventListener("click", this.toggleTooltipVisibility)
150
+ } else {
151
+ relatedElement.removeEventListener("mouseleave", this.showTooltip)
152
+ }
153
+ }
154
+ }
155
+ },
156
+ watch: {
157
+ tooltipVisibility() {
158
+ if(this.tooltipVisibility) {
159
+ this.$nextTick( () => {
160
+ const verticalOffset = 25
161
+ // this.$refs.tooltip.addEventListener("keyup", this.hideTooltip)
162
+ this.$refs.tooltip.style.left = this.pointerX / 10 + "rem"
163
+ this.$refs.tooltip.style.top = (this.pointerY + verticalOffset) / 10 + "rem"
164
+ })
165
+ }
15
166
  }
16
167
  }
17
168
  }
@@ -20,16 +171,38 @@ export default {
20
171
  <style lang="scss">
21
172
  /* begin cmd-tooltip ------------------------------------------------------------------------------------------ */
22
173
  .cmd-tooltip {
23
- position: absolute;
24
- padding: .2rem calc(var(--default-padding) / 2);
25
- top: .3rem;
174
+ padding: .6rem .7rem .4rem .7rem;
26
175
  line-height: 100%;
27
- right: 0;
176
+ font-size: 1.1rem;
177
+ position: fixed;
28
178
  background: var(--pure-white);
29
- border: var(--primary-border);
30
- font-weight: bold;
31
- font-size: 1.2rem;
32
- border-bottom: 0;
179
+ z-index: 100;
180
+ border: var(--default-border);
181
+ border-color: hsl(220, 2%, 25%);
182
+ border-right-color: hsl(240, 1%, 81%);
183
+ border-bottom-color: hsl(240, 1%, 81%);
184
+ display: flex;
185
+ flex-direction: column;
186
+
187
+ .headline-wrapper {
188
+ display: flex;
189
+
190
+ a {
191
+ margin-left: auto;
192
+
193
+ span[class*="icon"] {
194
+ padding-left: 1rem;
195
+ font-size: 1.2rem;
196
+ }
197
+ }
198
+ }
199
+ }
200
+
201
+ @-moz-document url-prefix() {
202
+ .cmd-tooltip {
203
+ font-size: 1.3rem;
204
+ border-color: hsl(0, 0%, 46%);
205
+ }
33
206
  }
34
207
 
35
208
  /* end cmd-tooltip ------------------------------------------------------------------------------------------ */