@watermarkinsights/ripple 3.26.0-9 → 3.26.0

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 (278) hide show
  1. package/README.md +3 -3
  2. package/dist/cjs/{chartFunctions-d746b939.js → chartFunctions-b7452189.js} +596 -596
  3. package/dist/cjs/{functions-68f637b4.js → functions-a047a8ea.js} +503 -503
  4. package/dist/cjs/{global-0f60d748.js → global-21ae6c78.js} +72 -72
  5. package/dist/cjs/{http-service-9e8c4dd5.js → http-service-494d81de.js} +49 -49
  6. package/dist/cjs/{interfaces-30a74c1f.js → interfaces-a3338581.js} +29 -29
  7. package/dist/cjs/{intl-d9ffc76c.js → intl-47d63c8f.js} +131 -131
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/cjs/priv-chart-popover.cjs.entry.js +91 -91
  10. package/dist/cjs/priv-datepicker.cjs.entry.js +657 -657
  11. package/dist/cjs/priv-navigator-button.cjs.entry.js +19 -19
  12. package/dist/cjs/priv-navigator-item.cjs.entry.js +23 -23
  13. package/dist/cjs/ripple.cjs.js +1 -1
  14. package/dist/cjs/wm-action-menu_2.cjs.entry.js +334 -334
  15. package/dist/cjs/wm-button.cjs.entry.js +260 -260
  16. package/dist/cjs/wm-chart-slice.cjs.entry.js +18 -18
  17. package/dist/cjs/wm-chart.cjs.entry.js +183 -183
  18. package/dist/cjs/wm-datepicker.cjs.entry.js +263 -263
  19. package/dist/cjs/wm-file-list.cjs.entry.js +35 -35
  20. package/dist/cjs/wm-file.cjs.entry.js +181 -181
  21. package/dist/cjs/wm-input.cjs.entry.js +137 -137
  22. package/dist/cjs/wm-modal-footer.cjs.entry.js +33 -33
  23. package/dist/cjs/wm-modal-header.cjs.entry.js +32 -32
  24. package/dist/cjs/wm-modal.cjs.entry.js +152 -152
  25. package/dist/cjs/wm-navigation_3.cjs.entry.js +225 -225
  26. package/dist/cjs/wm-navigator.cjs.entry.js +264 -264
  27. package/dist/cjs/wm-network-uploader.cjs.entry.js +465 -465
  28. package/dist/cjs/wm-option_2.cjs.entry.js +768 -768
  29. package/dist/cjs/wm-pagination.cjs.entry.js +179 -179
  30. package/dist/cjs/wm-progress-indicator_3.cjs.entry.js +155 -155
  31. package/dist/cjs/wm-search.cjs.entry.js +184 -184
  32. package/dist/cjs/wm-snackbar.cjs.entry.js +155 -155
  33. package/dist/cjs/wm-tab-item_3.cjs.entry.js +264 -264
  34. package/dist/cjs/wm-tag-input-row.cjs.entry.js +14 -14
  35. package/dist/cjs/wm-tag-input.cjs.entry.js +939 -939
  36. package/dist/cjs/wm-timepicker.cjs.entry.js +385 -385
  37. package/dist/cjs/wm-toggletip.cjs.entry.js +130 -130
  38. package/dist/cjs/wm-uploader.cjs.entry.js +441 -441
  39. package/dist/cjs/wm-wrapper.cjs.entry.js +12 -12
  40. package/dist/collection/components/charts/chartFunctions.js +562 -562
  41. package/dist/collection/components/charts/priv-chart-popover/priv-chart-popover.js +267 -267
  42. package/dist/collection/components/charts/wm-chart/wm-chart-slice.js +125 -125
  43. package/dist/collection/components/charts/wm-chart/wm-chart.js +450 -450
  44. package/dist/collection/components/charts/wm-progress-monitor/wm-progress-indicator.js +207 -207
  45. package/dist/collection/components/charts/wm-progress-monitor/wm-progress-monitor.js +143 -143
  46. package/dist/collection/components/charts/wm-progress-monitor/wm-progress-slice.js +121 -121
  47. package/dist/collection/components/wm-action-menu/wm-action-menu.js +472 -472
  48. package/dist/collection/components/wm-button/wm-button.js +575 -575
  49. package/dist/collection/components/wm-datepicker/priv-datepicker/priv-datepicker.js +983 -983
  50. package/dist/collection/components/wm-datepicker/wm-datepicker.js +491 -491
  51. package/dist/collection/components/wm-file/wm-file.js +313 -313
  52. package/dist/collection/components/wm-file-list/wm-file-list.js +152 -152
  53. package/dist/collection/components/wm-input/wm-input.css +5 -1
  54. package/dist/collection/components/wm-input/wm-input.js +509 -509
  55. package/dist/collection/components/wm-menuitem/wm-menuitem.js +454 -454
  56. package/dist/collection/components/wm-modal/wm-modal-footer.js +138 -138
  57. package/dist/collection/components/wm-modal/wm-modal-header.js +82 -82
  58. package/dist/collection/components/wm-modal/wm-modal.js +462 -462
  59. package/dist/collection/components/wm-navigation/wm-navigation-hamburger.js +176 -176
  60. package/dist/collection/components/wm-navigation/wm-navigation-item.js +130 -130
  61. package/dist/collection/components/wm-navigation/wm-navigation.js +217 -217
  62. package/dist/collection/components/wm-navigator/priv-navigator-button/priv-navigator-button.js +106 -106
  63. package/dist/collection/components/wm-navigator/priv-navigator-item/priv-navigator-item.js +123 -123
  64. package/dist/collection/components/wm-navigator/wm-navigator.js +467 -467
  65. package/dist/collection/components/wm-option/wm-option.js +435 -435
  66. package/dist/collection/components/wm-pagination/wm-pagination.js +370 -370
  67. package/dist/collection/components/wm-search/wm-search.js +439 -439
  68. package/dist/collection/components/wm-select/wm-select.js +1054 -1054
  69. package/dist/collection/components/wm-snackbar/wm-snackbar.js +282 -282
  70. package/dist/collection/components/wm-tabs/wm-tab-item/wm-tab-item.js +211 -211
  71. package/dist/collection/components/wm-tabs/wm-tab-list/wm-tab-list.js +327 -327
  72. package/dist/collection/components/wm-tabs/wm-tab-panel/wm-tab-panel.js +108 -108
  73. package/dist/collection/components/wm-tag-input/wm-tag-input-row/wm-tag-input-row.js +122 -122
  74. package/dist/collection/components/wm-tag-input/wm-tag-input.js +1294 -1294
  75. package/dist/collection/components/wm-timepicker/wm-timepicker.js +605 -605
  76. package/dist/collection/components/wm-toggletip/wm-toggletip.js +253 -253
  77. package/dist/collection/components/wm-uploader/wm-network-uploader/wm-network-uploader.js +772 -772
  78. package/dist/collection/components/wm-uploader/wm-uploader.js +964 -964
  79. package/dist/collection/components/wm-wrapper/wm-wrapper.js +28 -28
  80. package/dist/collection/dev/scripts.js +20 -20
  81. package/dist/collection/global/__mocks__/functions.js +6 -6
  82. package/dist/collection/global/functions.js +546 -546
  83. package/dist/collection/global/global.js +79 -79
  84. package/dist/collection/global/interfaces.js +49 -49
  85. package/dist/collection/global/intl.js +132 -132
  86. package/dist/collection/global/services/__mocks__/http-service.js +130 -130
  87. package/dist/collection/global/services/http-service.js +50 -50
  88. package/dist/collection/lang/lang.js +5 -5
  89. package/dist/collection/lang/missing.js +43 -43
  90. package/dist/collection/lang/piglatin.js +93 -93
  91. package/dist/esm/{chartFunctions-5c1ad085.js → chartFunctions-9d629e09.js} +596 -596
  92. package/dist/esm/{functions-b2582352.js → functions-3b813e0c.js} +503 -503
  93. package/dist/esm/{global-86bf0ca6.js → global-c7bb5530.js} +72 -72
  94. package/dist/esm/{http-service-5d037e16.js → http-service-3dc3b3e7.js} +49 -49
  95. package/dist/esm/{interfaces-61c6305b.js → interfaces-2b97fab2.js} +29 -29
  96. package/dist/esm/{intl-6732dd5b.js → intl-d544f922.js} +131 -131
  97. package/dist/esm/loader.js +1 -1
  98. package/dist/esm/polyfills/core-js.js +0 -0
  99. package/dist/esm/polyfills/dom.js +0 -0
  100. package/dist/esm/polyfills/es5-html-element.js +0 -0
  101. package/dist/esm/polyfills/index.js +0 -0
  102. package/dist/esm/polyfills/system.js +0 -0
  103. package/dist/esm/priv-chart-popover.entry.js +91 -91
  104. package/dist/esm/priv-datepicker.entry.js +657 -657
  105. package/dist/esm/priv-navigator-button.entry.js +19 -19
  106. package/dist/esm/priv-navigator-item.entry.js +23 -23
  107. package/dist/esm/ripple.js +1 -1
  108. package/dist/esm/wm-action-menu_2.entry.js +334 -334
  109. package/dist/esm/wm-button.entry.js +260 -260
  110. package/dist/esm/wm-chart-slice.entry.js +18 -18
  111. package/dist/esm/wm-chart.entry.js +183 -183
  112. package/dist/esm/wm-datepicker.entry.js +263 -263
  113. package/dist/esm/wm-file-list.entry.js +35 -35
  114. package/dist/esm/wm-file.entry.js +181 -181
  115. package/dist/esm/wm-input.entry.js +137 -137
  116. package/dist/esm/wm-modal-footer.entry.js +33 -33
  117. package/dist/esm/wm-modal-header.entry.js +32 -32
  118. package/dist/esm/wm-modal.entry.js +152 -152
  119. package/dist/esm/wm-navigation_3.entry.js +225 -225
  120. package/dist/esm/wm-navigator.entry.js +264 -264
  121. package/dist/esm/wm-network-uploader.entry.js +465 -465
  122. package/dist/esm/wm-option_2.entry.js +768 -768
  123. package/dist/esm/wm-pagination.entry.js +179 -179
  124. package/dist/esm/wm-progress-indicator_3.entry.js +155 -155
  125. package/dist/esm/wm-search.entry.js +184 -184
  126. package/dist/esm/wm-snackbar.entry.js +155 -155
  127. package/dist/esm/wm-tab-item_3.entry.js +264 -264
  128. package/dist/esm/wm-tag-input-row.entry.js +14 -14
  129. package/dist/esm/wm-tag-input.entry.js +939 -939
  130. package/dist/esm/wm-timepicker.entry.js +385 -385
  131. package/dist/esm/wm-toggletip.entry.js +130 -130
  132. package/dist/esm/wm-uploader.entry.js +441 -441
  133. package/dist/esm/wm-wrapper.entry.js +12 -12
  134. package/dist/esm-es5/{chartFunctions-5c1ad085.js → chartFunctions-9d629e09.js} +1 -1
  135. package/dist/esm-es5/global-c7bb5530.js +1 -0
  136. package/dist/esm-es5/{intl-6732dd5b.js → intl-d544f922.js} +1 -1
  137. package/dist/esm-es5/loader.js +1 -1
  138. package/dist/esm-es5/priv-chart-popover.entry.js +1 -1
  139. package/dist/esm-es5/priv-datepicker.entry.js +1 -1
  140. package/dist/esm-es5/ripple.js +1 -1
  141. package/dist/esm-es5/wm-action-menu_2.entry.js +1 -1
  142. package/dist/esm-es5/wm-button.entry.js +1 -1
  143. package/dist/esm-es5/wm-chart.entry.js +1 -1
  144. package/dist/esm-es5/wm-datepicker.entry.js +1 -1
  145. package/dist/esm-es5/wm-file.entry.js +1 -1
  146. package/dist/esm-es5/wm-input.entry.js +1 -1
  147. package/dist/esm-es5/wm-modal-header.entry.js +1 -1
  148. package/dist/esm-es5/wm-modal.entry.js +1 -1
  149. package/dist/esm-es5/wm-navigation_3.entry.js +1 -1
  150. package/dist/esm-es5/wm-navigator.entry.js +1 -1
  151. package/dist/esm-es5/wm-network-uploader.entry.js +1 -1
  152. package/dist/esm-es5/wm-option_2.entry.js +1 -1
  153. package/dist/esm-es5/wm-pagination.entry.js +1 -1
  154. package/dist/esm-es5/wm-progress-indicator_3.entry.js +1 -1
  155. package/dist/esm-es5/wm-search.entry.js +1 -1
  156. package/dist/esm-es5/wm-snackbar.entry.js +1 -1
  157. package/dist/esm-es5/wm-tab-item_3.entry.js +1 -1
  158. package/dist/esm-es5/wm-tag-input.entry.js +1 -1
  159. package/dist/esm-es5/wm-timepicker.entry.js +1 -1
  160. package/dist/esm-es5/wm-toggletip.entry.js +1 -1
  161. package/dist/esm-es5/wm-uploader.entry.js +1 -1
  162. package/dist/ripple/{p-d5a420fa.entry.js → p-05563588.entry.js} +1 -1
  163. package/dist/ripple/{p-061914bf.system.entry.js → p-09a04f55.system.entry.js} +1 -1
  164. package/dist/ripple/{p-a2f10a77.entry.js → p-09bc0aa7.entry.js} +1 -1
  165. package/dist/ripple/{p-0414179c.entry.js → p-0cfc0d13.entry.js} +1 -1
  166. package/dist/ripple/{p-a9080b82.entry.js → p-0ef638b7.entry.js} +1 -1
  167. package/dist/ripple/{p-f740c48c.system.entry.js → p-12c70659.system.entry.js} +1 -1
  168. package/dist/ripple/p-169606b9.system.js +1 -0
  169. package/dist/ripple/{p-7ee31208.js → p-18c2f4fe.js} +1 -1
  170. package/dist/ripple/{p-462e7cf8.system.entry.js → p-236dab05.system.entry.js} +1 -1
  171. package/dist/ripple/{p-9baf62ae.entry.js → p-2cd5477a.entry.js} +1 -1
  172. package/dist/ripple/{p-2cef256c.system.entry.js → p-2cde4ade.system.entry.js} +1 -1
  173. package/dist/ripple/{p-076a8729.entry.js → p-2d46dbea.entry.js} +1 -1
  174. package/dist/ripple/{p-3313df40.system.entry.js → p-2dd5f5c3.system.entry.js} +1 -1
  175. package/dist/ripple/{p-64b64f40.system.entry.js → p-35790e4e.system.entry.js} +1 -1
  176. package/dist/ripple/{p-4e7489a3.system.entry.js → p-38819b27.system.entry.js} +1 -1
  177. package/dist/ripple/{p-926aab51.entry.js → p-3aa8e5f5.entry.js} +1 -1
  178. package/dist/ripple/{p-42739dba.entry.js → p-42f8f3ff.entry.js} +1 -1
  179. package/dist/ripple/{p-c1d814f8.system.entry.js → p-4444add0.system.entry.js} +1 -1
  180. package/dist/ripple/{p-0648aa61.system.entry.js → p-4f5a48dd.system.entry.js} +1 -1
  181. package/dist/ripple/{p-2948bf33.system.entry.js → p-4fb81a33.system.entry.js} +1 -1
  182. package/dist/ripple/{p-22b74491.entry.js → p-51b38033.entry.js} +1 -1
  183. package/dist/ripple/{p-9706537b.system.js → p-54a2b7d6.system.js} +1 -1
  184. package/dist/ripple/{p-00edfbc8.system.entry.js → p-56ba575c.system.entry.js} +1 -1
  185. package/dist/ripple/{p-b7f204e6.entry.js → p-5708349e.entry.js} +1 -1
  186. package/dist/ripple/{p-7dafc84b.system.entry.js → p-630bd6f5.system.entry.js} +1 -1
  187. package/dist/ripple/{p-b7982fab.system.js → p-6eb2c2d5.system.js} +1 -1
  188. package/dist/ripple/{p-a966a18c.entry.js → p-72b9b986.entry.js} +1 -1
  189. package/dist/ripple/p-76015762.js +1 -0
  190. package/dist/ripple/{p-3aaf86e4.entry.js → p-7f15df83.entry.js} +1 -1
  191. package/dist/ripple/{p-5ddb1660.entry.js → p-832910a0.entry.js} +1 -1
  192. package/dist/ripple/{p-66bb46e5.system.entry.js → p-84ce9b67.system.entry.js} +1 -1
  193. package/dist/ripple/{p-e6fde200.system.entry.js → p-8775e10b.system.entry.js} +1 -1
  194. package/dist/ripple/{p-6f96c28d.entry.js → p-8b23f32b.entry.js} +1 -1
  195. package/dist/ripple/{p-17490d32.entry.js → p-8c853762.entry.js} +1 -1
  196. package/dist/ripple/{p-81b26d3a.system.entry.js → p-8ff578ad.system.entry.js} +1 -1
  197. package/dist/ripple/{p-9b9e60aa.system.entry.js → p-95aa793b.system.entry.js} +1 -1
  198. package/dist/ripple/{p-9b28a31f.entry.js → p-95f4e5a1.entry.js} +1 -1
  199. package/dist/ripple/{p-accdf91c.system.entry.js → p-a006968b.system.entry.js} +1 -1
  200. package/dist/ripple/{p-2d33df00.system.js → p-a48e4f1a.system.js} +1 -1
  201. package/dist/ripple/{p-094388f1.entry.js → p-ae1e1db8.entry.js} +1 -1
  202. package/dist/ripple/{p-3b582301.entry.js → p-b3d97de8.entry.js} +1 -1
  203. package/dist/ripple/{p-f8418ac9.entry.js → p-bdecbb63.entry.js} +1 -1
  204. package/dist/ripple/{p-b805612a.system.entry.js → p-c3665c9f.system.entry.js} +1 -1
  205. package/dist/ripple/{p-d7f77b2c.js → p-d96b86c9.js} +1 -1
  206. package/dist/ripple/p-d973fe13.system.entry.js +1 -0
  207. package/dist/ripple/{p-0503e614.system.entry.js → p-ea99fb58.system.entry.js} +1 -1
  208. package/dist/ripple/{p-bd94e7c3.entry.js → p-eeeec290.entry.js} +1 -1
  209. package/dist/ripple/{p-a5662a2c.system.entry.js → p-f2bb38d0.system.entry.js} +1 -1
  210. package/dist/ripple/{p-043b4874.entry.js → p-f6c9c95f.entry.js} +1 -1
  211. package/dist/ripple/{p-731beaab.system.entry.js → p-f6f80b8d.system.entry.js} +1 -1
  212. package/dist/ripple/{p-49f7f1da.entry.js → p-fe76e568.entry.js} +1 -1
  213. package/dist/ripple/{p-60f58a39.system.entry.js → p-fea37751.system.entry.js} +1 -1
  214. package/dist/ripple/{p-5b7e1b5d.entry.js → p-ffb83b6f.entry.js} +1 -1
  215. package/dist/ripple/ripple.esm.js +1 -1
  216. package/dist/ripple/ripple.js +1 -1
  217. package/dist/types/components/charts/chartFunctions.d.ts +37 -37
  218. package/dist/types/components/charts/priv-chart-popover/priv-chart-popover.d.ts +27 -27
  219. package/dist/types/components/charts/wm-chart/wm-chart-slice.d.ts +11 -11
  220. package/dist/types/components/charts/wm-chart/wm-chart.d.ts +47 -47
  221. package/dist/types/components/charts/wm-progress-monitor/wm-progress-indicator.d.ts +29 -29
  222. package/dist/types/components/charts/wm-progress-monitor/wm-progress-monitor.d.ts +20 -20
  223. package/dist/types/components/charts/wm-progress-monitor/wm-progress-slice.d.ts +10 -10
  224. package/dist/types/components/wm-action-menu/wm-action-menu.d.ts +49 -49
  225. package/dist/types/components/wm-button/wm-button.d.ts +49 -49
  226. package/dist/types/components/wm-datepicker/priv-datepicker/priv-datepicker.d.ts +80 -80
  227. package/dist/types/components/wm-datepicker/wm-datepicker.d.ts +42 -42
  228. package/dist/types/components/wm-file/wm-file.d.ts +40 -40
  229. package/dist/types/components/wm-file-list/wm-file-list.d.ts +16 -16
  230. package/dist/types/components/wm-input/wm-input.d.ts +57 -57
  231. package/dist/types/components/wm-menuitem/wm-menuitem.d.ts +34 -34
  232. package/dist/types/components/wm-modal/wm-modal-footer.d.ts +14 -14
  233. package/dist/types/components/wm-modal/wm-modal-header.d.ts +10 -10
  234. package/dist/types/components/wm-modal/wm-modal.d.ts +40 -40
  235. package/dist/types/components/wm-navigation/wm-navigation-hamburger.d.ts +21 -21
  236. package/dist/types/components/wm-navigation/wm-navigation-item.d.ts +13 -13
  237. package/dist/types/components/wm-navigation/wm-navigation.d.ts +26 -26
  238. package/dist/types/components/wm-navigator/priv-navigator-button/priv-navigator-button.d.ts +10 -10
  239. package/dist/types/components/wm-navigator/priv-navigator-item/priv-navigator-item.d.ts +13 -13
  240. package/dist/types/components/wm-navigator/wm-navigator.d.ts +61 -61
  241. package/dist/types/components/wm-option/wm-option.d.ts +34 -34
  242. package/dist/types/components/wm-pagination/wm-pagination.d.ts +32 -32
  243. package/dist/types/components/wm-search/wm-search.d.ts +77 -77
  244. package/dist/types/components/wm-select/wm-select.d.ts +101 -101
  245. package/dist/types/components/wm-snackbar/wm-snackbar.d.ts +31 -31
  246. package/dist/types/components/wm-tabs/wm-tab-item/wm-tab-item.d.ts +37 -37
  247. package/dist/types/components/wm-tabs/wm-tab-list/wm-tab-list.d.ts +52 -52
  248. package/dist/types/components/wm-tabs/wm-tab-panel/wm-tab-panel.d.ts +20 -20
  249. package/dist/types/components/wm-tag-input/wm-tag-input-row/wm-tag-input-row.d.ts +11 -11
  250. package/dist/types/components/wm-tag-input/wm-tag-input.d.ts +136 -136
  251. package/dist/types/components/wm-timepicker/wm-timepicker.d.ts +62 -62
  252. package/dist/types/components/wm-toggletip/wm-toggletip.d.ts +28 -28
  253. package/dist/types/components/wm-uploader/wm-network-uploader/wm-network-uploader.d.ts +85 -85
  254. package/dist/types/components/wm-uploader/wm-uploader.d.ts +99 -99
  255. package/dist/types/components/wm-wrapper/wm-wrapper.d.ts +7 -7
  256. package/dist/types/components.d.ts +27 -27
  257. package/dist/types/global/__mocks__/functions.d.ts +6 -6
  258. package/dist/types/global/functions.d.ts +49 -49
  259. package/dist/types/global/global.d.ts +1 -1
  260. package/dist/types/global/interfaces.d.ts +74 -74
  261. package/dist/types/global/intl.d.ts +29 -29
  262. package/dist/types/global/services/__mocks__/http-service.d.ts +6 -6
  263. package/dist/types/global/services/http-service.d.ts +4 -4
  264. package/dist/types/lang/lang.d.ts +5 -5
  265. package/package.json +46 -46
  266. package/dist/esm-es5/global-86bf0ca6.js +0 -1
  267. package/dist/ripple/p-233c8059.js +0 -1
  268. package/dist/ripple/p-9f9a5a1f.system.js +0 -1
  269. package/dist/ripple/p-e4cef02b.system.entry.js +0 -1
  270. /package/dist/esm-es5/{functions-b2582352.js → functions-3b813e0c.js} +0 -0
  271. /package/dist/esm-es5/{http-service-5d037e16.js → http-service-3dc3b3e7.js} +0 -0
  272. /package/dist/esm-es5/{interfaces-61c6305b.js → interfaces-2b97fab2.js} +0 -0
  273. /package/dist/ripple/{p-9e94ae94.system.js → p-190afa40.system.js} +0 -0
  274. /package/dist/ripple/{p-888bec42.js → p-43f1298b.js} +0 -0
  275. /package/dist/ripple/{p-5384856b.js → p-4a0e1d2d.js} +0 -0
  276. /package/dist/ripple/{p-313b6073.system.js → p-9d02957d.system.js} +0 -0
  277. /package/dist/ripple/{p-08b7ec08.system.js → p-f5df5903.system.js} +0 -0
  278. /package/dist/ripple/{p-a6d6eae7.js → p-fd8070fb.js} +0 -0
@@ -1,575 +1,575 @@
1
- import { h, Host } from "@stencil/core";
2
- import { getIconCodeFromName } from "../../global/interfaces";
3
- import { generateId, adjustTooltipPlacement, toBool } from "../../global/functions";
4
- export class Button {
5
- constructor() {
6
- this.btnPos = { old: {}, new: {} }; // for tooltip position. old and new are DOMRect
7
- this.id = generateId();
8
- this.ariaPopup = false;
9
- this.disabled = false;
10
- this.buttonType = null;
11
- this.buttonStyle = null;
12
- this.icon = undefined;
13
- this.iconSize = undefined;
14
- this.iconRotate = undefined;
15
- this.iconFlip = undefined;
16
- this.tooltip = undefined;
17
- this.labelForIdenticalButtons = undefined;
18
- this.tooltipPosition = "bottom-right";
19
- this.permanentlyDelete = false;
20
- this.textWrap = true;
21
- this.customBackground = undefined;
22
- this.tooltipVisible = false;
23
- this.isTabbing = false;
24
- }
25
- get isDisabled() {
26
- // string "false" needs to be treated as bool False because react wrappers convert bool to string.
27
- return toBool(this.disabled);
28
- }
29
- get tempButtonType() {
30
- // uses of this getter should be replaced with this.buttonType when buttonStyle is fully phased out
31
- // don't forget to reset this.buttonType's default value to secondary
32
- return this.buttonType || this.buttonStyle || "secondary";
33
- }
34
- get isTruncated() {
35
- return (!!this.buttonEl && this.tempButtonType === "textonly" && this.buttonEl.offsetWidth < this.buttonEl.scrollWidth);
36
- }
37
- get hasTooltip() {
38
- // tooltip is only rendered for icononly and navigational types, or if the button text is truncated
39
- return this.tempButtonType === "icononly" || this.tempButtonType === "navigational" || this.isTruncated;
40
- }
41
- get tooltipEl() {
42
- return document.getElementById("wm-tooltip");
43
- }
44
- get buttonClasses() {
45
- let classes = "wm-button";
46
- classes += this.permanentlyDelete ? " -permanentlydelete" : "";
47
- classes += this.tempButtonType ? " -" + this.tempButtonType : " -secondary";
48
- classes += this.textWrap ? "" : " nowrap";
49
- classes += this.isTabbing ? " user-is-tabbing" : "";
50
- classes += this.isTruncated ? " -truncated" : "";
51
- classes += this.customBackground === "dark" ? " dark" : "";
52
- return classes;
53
- }
54
- get iconStyles() {
55
- let transformStyle = "";
56
- transformStyle += this.iconRotate ? `rotate(${this.iconRotate}deg)` : "";
57
- transformStyle += this.iconFlip === "horizontal" ? `scaleX(-1)` : "";
58
- transformStyle += this.iconFlip === "vertical" ? `scaleY(-1)` : "";
59
- return Object.assign(Object.assign({}, (this.iconSize && { fontSize: this.iconSize })), ((this.iconRotate || this.iconFlip) && { transform: transformStyle }));
60
- }
61
- toggleTabbingOn() {
62
- this.isTabbing = true;
63
- }
64
- toggleTabbingOff() {
65
- this.isTabbing = false;
66
- }
67
- // we need to listen for scroll events during the capture phase because they do not bubble up
68
- // there can be layouts where the main content has 100vh and overflows
69
- // in these cases window will register no scroll events unless we catch on they way down
70
- handleScroll() {
71
- if (this.tooltipVisible) {
72
- this.hideTooltip();
73
- }
74
- }
75
- validateType(newValue) {
76
- const valid = [
77
- "primary",
78
- "secondary",
79
- "textonly",
80
- "icononly",
81
- "navigational",
82
- "selector",
83
- "selector-primary",
84
- "pairpositive",
85
- "pairnegative",
86
- ].includes(newValue);
87
- if (!valid) {
88
- this.buttonType = "secondary";
89
- }
90
- this.validateIcon();
91
- }
92
- // remove entire watcher after buttonStyle has been fully removed
93
- validateDeprecatedType(newValue) {
94
- const valid = ["primary", "secondary", "textonly", "icononly", "navigational", "selector"].includes(newValue);
95
- if (!valid) {
96
- this.buttonStyle = "secondary";
97
- }
98
- this.validateIcon();
99
- }
100
- updateIcon() {
101
- this.icon = getIconCodeFromName(this.icon);
102
- }
103
- validateIcon() {
104
- switch (this.tempButtonType) {
105
- case "icononly":
106
- case "navigational":
107
- // if the style is icononly or navigational...
108
- // - an icon must be provided
109
- if (!this.icon) {
110
- console.error("wm-button should have a valid 'icon' property when button-type is set to 'icononly' or 'navigational'.");
111
- }
112
- // - if no tooltip text was passed and we couldn't generate one, throw an error
113
- if (!this.tooltip) {
114
- console.error("wm-button should have a valid 'tooltip' property when button-type is set to 'icononly' or 'navigational'.");
115
- }
116
- break;
117
- case "pairpositive":
118
- this.icon = "f12c";
119
- break;
120
- case "pairnegative":
121
- this.icon = "f739";
122
- break;
123
- }
124
- }
125
- handleKeydown(ev) {
126
- switch (ev.key) {
127
- case "Enter":
128
- ev.preventDefault();
129
- if (!this.isDisabled) {
130
- this.el.click();
131
- }
132
- break;
133
- }
134
- }
135
- componentWillLoad() {
136
- if (this.buttonStyle) {
137
- console.warn("wm-button: button-style has been deprecated as of v3.1.0. Please use button-type instead.");
138
- }
139
- this.validateType(this.tempButtonType);
140
- if (this.icon) {
141
- this.icon = this.icon = getIconCodeFromName(this.icon);
142
- }
143
- }
144
- componentDidLoad() {
145
- if (document.body.classList.contains("wmcl-user-is-tabbing")) {
146
- this.toggleTabbingOn();
147
- }
148
- this.ariaPopup = !!this.el.getAttribute("aria-haspopup");
149
- this.btnPos.new = this.buttonEl.getBoundingClientRect();
150
- }
151
- showTooltip() {
152
- if (this.hasTooltip) {
153
- // set tooltip text
154
- let tooltipText = "";
155
- if (this.isTruncated && this.el.textContent) {
156
- // when truncated, tooltip text is the button's content
157
- tooltipText = this.el.textContent;
158
- }
159
- else if (this.tooltip) {
160
- // otherwise it is the tooltip property if present
161
- tooltipText = this.tooltip;
162
- }
163
- this.tooltipEl.textContent = tooltipText;
164
- // tooltip only has a maxWidth if it contains whitespace and can break
165
- const hasNoWhitespace = tooltipText.match(/^[^\s]+$/);
166
- if (hasNoWhitespace) {
167
- this.tooltipEl.classList.add("single-word");
168
- this.tooltipEl.style.setProperty("--wmTooltipMaxWidth", "none");
169
- }
170
- else {
171
- this.tooltipEl.classList.remove("single-word");
172
- this.tooltipEl.style.removeProperty("--wmTooltipMaxWidth");
173
- }
174
- // adjust placement in case there is no space to place the tooltip where specified via prop
175
- // calculation outside of the function to keep it pure
176
- const adjustedTooltipPlacement = adjustTooltipPlacement(this.tooltipPosition, this.buttonEl, this.tooltipEl);
177
- this.btnPos.old = {};
178
- const tooltipRect = this.tooltipEl.getBoundingClientRect();
179
- this.tooltipEl.style.transitionDelay = "500ms";
180
- this.tooltipEl.style.opacity = "1";
181
- // This slight delay fixes an issue for keyboard users:
182
- // if they tab to a button out of screen bounds, the page scrolls
183
- // and hideTooltip() would be triggered before the tooltip would show
184
- setTimeout(() => {
185
- this.tooltipVisible = true;
186
- this.positionTooltip(adjustedTooltipPlacement, tooltipRect);
187
- }, 50);
188
- }
189
- }
190
- positionTooltip(tPos, tooltipRect) {
191
- if (this.tooltipVisible) {
192
- window.requestAnimationFrame(() => this.positionTooltip(tPos, tooltipRect));
193
- }
194
- this.btnPos.new = this.buttonEl.getBoundingClientRect();
195
- if (this.btnPos.new.top != this.btnPos.old.top || this.btnPos.new.left != this.btnPos.old.left) {
196
- // this is to figure out how to offset, given the size of the button and of the tooltip
197
- // to get the center positions, calculate the difference between the button width and the tooltip width
198
- const vDiff = (this.btnPos.new.height - tooltipRect.height) / 2;
199
- const hDiff = (this.btnPos.new.width - tooltipRect.width) / 2;
200
- // the naming convention defaults to center in the absence of a value
201
- // Values "top" and "bottom" imply horizontal centering; Values "right" and "left" imply vertical centering
202
- // therefore we first set to center first, then adjust accordingly
203
- let vPos = this.btnPos.new.top + vDiff;
204
- let hPos = this.btnPos.new.left + hDiff;
205
- if (tPos.includes("top")) {
206
- vPos = this.btnPos.new.top - tooltipRect.height - 8;
207
- }
208
- if (tPos.includes("bottom")) {
209
- vPos = this.btnPos.new.bottom + 8;
210
- }
211
- if (tPos.includes("left")) {
212
- hPos = this.btnPos.new.left - tooltipRect.width - 8;
213
- }
214
- if (tPos.includes("right")) {
215
- hPos = this.btnPos.new.right + 8;
216
- }
217
- // after all positioning has been calculated, if tooltip is off-screen or closer than 24px it is readjusted
218
- // this only occurs when the tooltip is overflowing to the left and is positioned top or bottom
219
- // (button placed too far left, or screen size under 268px)
220
- hPos = Math.max(hPos, 24);
221
- this.tooltipEl.style.setProperty("--wmTooltipTop", vPos + "px");
222
- this.tooltipEl.style.setProperty("--wmTooltipLeft", hPos + "px");
223
- // this.tooltipEl.style.top = vPos + "px";
224
- // this.tooltipEl.style.left = hPos + "px";
225
- // this.tooltipEl.style.top = (vPos / 16).toString() + "rem";
226
- // this.tooltipEl.style.left = (hPos / 16).toString() + "rem";
227
- this.btnPos.old = this.btnPos.new;
228
- }
229
- }
230
- hideTooltip() {
231
- if (this.hasTooltip) {
232
- this.tooltipEl.style.transitionDelay = "0s";
233
- this.tooltipEl.style.opacity = "0";
234
- this.tooltipVisible = false;
235
- }
236
- }
237
- showTooltipForKeyboardUsers() {
238
- if (this.isTabbing) {
239
- this.showTooltip();
240
- }
241
- }
242
- getAriaLabel() {
243
- if (this.tempButtonType === "icononly" || this.tempButtonType === "navigational") {
244
- return this.labelForIdenticalButtons || this.tooltip;
245
- }
246
- if (this.labelForIdenticalButtons) {
247
- return this.labelForIdenticalButtons;
248
- }
249
- }
250
- render() {
251
- return (h(Host, { class: this.isDisabled ? "button-disabled" : "" }, h("button", { id: this.id, class: `${this.buttonClasses}`, disabled: this.isDisabled, ref: (el) => (this.buttonEl = el), "aria-label": this.getAriaLabel(), "aria-hasPopup": this.ariaPopup ? "menu" : null, onMouseEnter: () => this.showTooltip(), onMouseLeave: () => this.hideTooltip(), onFocus: () => this.showTooltipForKeyboardUsers(), onBlur: () => this.hideTooltip(), onClick: () => this.hideTooltip() }, this.icon && (h("span", { class: "mdi", style: this.iconStyles }, String.fromCodePoint(parseInt(`0x${this.icon}`)))), h("span", { class: "button-text" }, h("slot", null)))));
252
- }
253
- static get is() { return "wm-button"; }
254
- static get encapsulation() { return "shadow"; }
255
- static get delegatesFocus() { return true; }
256
- static get originalStyleUrls() {
257
- return {
258
- "$": ["wm-button.scss"]
259
- };
260
- }
261
- static get styleUrls() {
262
- return {
263
- "$": ["wm-button.css"]
264
- };
265
- }
266
- static get properties() {
267
- return {
268
- "disabled": {
269
- "type": "boolean",
270
- "mutable": false,
271
- "complexType": {
272
- "original": "boolean",
273
- "resolved": "boolean",
274
- "references": {}
275
- },
276
- "required": false,
277
- "optional": false,
278
- "docs": {
279
- "tags": [],
280
- "text": ""
281
- },
282
- "attribute": "disabled",
283
- "reflect": true,
284
- "defaultValue": "false"
285
- },
286
- "buttonType": {
287
- "type": "string",
288
- "mutable": true,
289
- "complexType": {
290
- "original": "validButtonTypes | null",
291
- "resolved": "\"icononly\" | \"navigational\" | \"pairnegative\" | \"pairpositive\" | \"primary\" | \"secondary\" | \"selector\" | \"selector-primary\" | \"textonly\" | null",
292
- "references": {
293
- "validButtonTypes": {
294
- "location": "import",
295
- "path": "../../global/interfaces"
296
- }
297
- }
298
- },
299
- "required": false,
300
- "optional": false,
301
- "docs": {
302
- "tags": [],
303
- "text": ""
304
- },
305
- "attribute": "button-type",
306
- "reflect": false,
307
- "defaultValue": "null"
308
- },
309
- "buttonStyle": {
310
- "type": "string",
311
- "mutable": true,
312
- "complexType": {
313
- "original": "validButtonTypes | null",
314
- "resolved": "\"icononly\" | \"navigational\" | \"pairnegative\" | \"pairpositive\" | \"primary\" | \"secondary\" | \"selector\" | \"selector-primary\" | \"textonly\" | null",
315
- "references": {
316
- "validButtonTypes": {
317
- "location": "import",
318
- "path": "../../global/interfaces"
319
- }
320
- }
321
- },
322
- "required": false,
323
- "optional": false,
324
- "docs": {
325
- "tags": [],
326
- "text": ""
327
- },
328
- "attribute": "button-style",
329
- "reflect": false,
330
- "defaultValue": "null"
331
- },
332
- "icon": {
333
- "type": "string",
334
- "mutable": true,
335
- "complexType": {
336
- "original": "string",
337
- "resolved": "string | undefined",
338
- "references": {}
339
- },
340
- "required": false,
341
- "optional": true,
342
- "docs": {
343
- "tags": [],
344
- "text": ""
345
- },
346
- "attribute": "icon",
347
- "reflect": true
348
- },
349
- "iconSize": {
350
- "type": "string",
351
- "mutable": false,
352
- "complexType": {
353
- "original": "string",
354
- "resolved": "string | undefined",
355
- "references": {}
356
- },
357
- "required": false,
358
- "optional": true,
359
- "docs": {
360
- "tags": [],
361
- "text": ""
362
- },
363
- "attribute": "icon-size",
364
- "reflect": false
365
- },
366
- "iconRotate": {
367
- "type": "number",
368
- "mutable": false,
369
- "complexType": {
370
- "original": "number",
371
- "resolved": "number | undefined",
372
- "references": {}
373
- },
374
- "required": false,
375
- "optional": true,
376
- "docs": {
377
- "tags": [],
378
- "text": ""
379
- },
380
- "attribute": "icon-rotate",
381
- "reflect": false
382
- },
383
- "iconFlip": {
384
- "type": "string",
385
- "mutable": false,
386
- "complexType": {
387
- "original": "\"horizontal\" | \"vertical\"",
388
- "resolved": "\"horizontal\" | \"vertical\" | undefined",
389
- "references": {}
390
- },
391
- "required": false,
392
- "optional": true,
393
- "docs": {
394
- "tags": [],
395
- "text": ""
396
- },
397
- "attribute": "icon-flip",
398
- "reflect": false
399
- },
400
- "tooltip": {
401
- "type": "string",
402
- "mutable": true,
403
- "complexType": {
404
- "original": "string",
405
- "resolved": "string | undefined",
406
- "references": {}
407
- },
408
- "required": false,
409
- "optional": true,
410
- "docs": {
411
- "tags": [],
412
- "text": ""
413
- },
414
- "attribute": "tooltip",
415
- "reflect": true
416
- },
417
- "labelForIdenticalButtons": {
418
- "type": "string",
419
- "mutable": false,
420
- "complexType": {
421
- "original": "string",
422
- "resolved": "string | undefined",
423
- "references": {}
424
- },
425
- "required": false,
426
- "optional": true,
427
- "docs": {
428
- "tags": [],
429
- "text": ""
430
- },
431
- "attribute": "label-for-identical-buttons",
432
- "reflect": false
433
- },
434
- "tooltipPosition": {
435
- "type": "string",
436
- "mutable": false,
437
- "complexType": {
438
- "original": "TooltipPlacement",
439
- "resolved": "\"bottom\" | \"bottom-left\" | \"bottom-right\" | \"left\" | \"right\" | \"top\" | \"top-left\" | \"top-right\"",
440
- "references": {
441
- "TooltipPlacement": {
442
- "location": "import",
443
- "path": "../../global/interfaces"
444
- }
445
- }
446
- },
447
- "required": false,
448
- "optional": false,
449
- "docs": {
450
- "tags": [],
451
- "text": ""
452
- },
453
- "attribute": "tooltip-position",
454
- "reflect": false,
455
- "defaultValue": "\"bottom-right\""
456
- },
457
- "permanentlyDelete": {
458
- "type": "boolean",
459
- "mutable": false,
460
- "complexType": {
461
- "original": "boolean",
462
- "resolved": "boolean | undefined",
463
- "references": {}
464
- },
465
- "required": false,
466
- "optional": true,
467
- "docs": {
468
- "tags": [],
469
- "text": ""
470
- },
471
- "attribute": "permanently-delete",
472
- "reflect": false,
473
- "defaultValue": "false"
474
- },
475
- "textWrap": {
476
- "type": "boolean",
477
- "mutable": false,
478
- "complexType": {
479
- "original": "boolean",
480
- "resolved": "boolean",
481
- "references": {}
482
- },
483
- "required": false,
484
- "optional": false,
485
- "docs": {
486
- "tags": [],
487
- "text": ""
488
- },
489
- "attribute": "text-wrap",
490
- "reflect": false,
491
- "defaultValue": "true"
492
- },
493
- "customBackground": {
494
- "type": "string",
495
- "mutable": false,
496
- "complexType": {
497
- "original": "string",
498
- "resolved": "string | undefined",
499
- "references": {}
500
- },
501
- "required": false,
502
- "optional": true,
503
- "docs": {
504
- "tags": [],
505
- "text": ""
506
- },
507
- "attribute": "custom-background",
508
- "reflect": false
509
- },
510
- "tooltipVisible": {
511
- "type": "boolean",
512
- "mutable": true,
513
- "complexType": {
514
- "original": "boolean",
515
- "resolved": "boolean",
516
- "references": {}
517
- },
518
- "required": false,
519
- "optional": false,
520
- "docs": {
521
- "tags": [],
522
- "text": ""
523
- },
524
- "attribute": "tooltip-visible",
525
- "reflect": false,
526
- "defaultValue": "false"
527
- }
528
- };
529
- }
530
- static get states() {
531
- return {
532
- "isTabbing": {}
533
- };
534
- }
535
- static get elementRef() { return "el"; }
536
- static get watchers() {
537
- return [{
538
- "propName": "buttonType",
539
- "methodName": "validateType"
540
- }, {
541
- "propName": "buttonStyle",
542
- "methodName": "validateDeprecatedType"
543
- }, {
544
- "propName": "icon",
545
- "methodName": "updateIcon"
546
- }];
547
- }
548
- static get listeners() {
549
- return [{
550
- "name": "wmUserIsTabbing",
551
- "method": "toggleTabbingOn",
552
- "target": "window",
553
- "capture": false,
554
- "passive": false
555
- }, {
556
- "name": "wmUserIsNotTabbing",
557
- "method": "toggleTabbingOff",
558
- "target": "window",
559
- "capture": false,
560
- "passive": false
561
- }, {
562
- "name": "scroll",
563
- "method": "handleScroll",
564
- "target": "window",
565
- "capture": true,
566
- "passive": true
567
- }, {
568
- "name": "keydown",
569
- "method": "handleKeydown",
570
- "target": undefined,
571
- "capture": false,
572
- "passive": false
573
- }];
574
- }
575
- }
1
+ import { h, Host } from "@stencil/core";
2
+ import { getIconCodeFromName } from "../../global/interfaces";
3
+ import { generateId, adjustTooltipPlacement, toBool } from "../../global/functions";
4
+ export class Button {
5
+ constructor() {
6
+ this.btnPos = { old: {}, new: {} }; // for tooltip position. old and new are DOMRect
7
+ this.id = generateId();
8
+ this.ariaPopup = false;
9
+ this.disabled = false;
10
+ this.buttonType = null;
11
+ this.buttonStyle = null;
12
+ this.icon = undefined;
13
+ this.iconSize = undefined;
14
+ this.iconRotate = undefined;
15
+ this.iconFlip = undefined;
16
+ this.tooltip = undefined;
17
+ this.labelForIdenticalButtons = undefined;
18
+ this.tooltipPosition = "bottom-right";
19
+ this.permanentlyDelete = false;
20
+ this.textWrap = true;
21
+ this.customBackground = undefined;
22
+ this.tooltipVisible = false;
23
+ this.isTabbing = false;
24
+ }
25
+ get isDisabled() {
26
+ // string "false" needs to be treated as bool False because react wrappers convert bool to string.
27
+ return toBool(this.disabled);
28
+ }
29
+ get tempButtonType() {
30
+ // uses of this getter should be replaced with this.buttonType when buttonStyle is fully phased out
31
+ // don't forget to reset this.buttonType's default value to secondary
32
+ return this.buttonType || this.buttonStyle || "secondary";
33
+ }
34
+ get isTruncated() {
35
+ return (!!this.buttonEl && this.tempButtonType === "textonly" && this.buttonEl.offsetWidth < this.buttonEl.scrollWidth);
36
+ }
37
+ get hasTooltip() {
38
+ // tooltip is only rendered for icononly and navigational types, or if the button text is truncated
39
+ return this.tempButtonType === "icononly" || this.tempButtonType === "navigational" || this.isTruncated;
40
+ }
41
+ get tooltipEl() {
42
+ return document.getElementById("wm-tooltip");
43
+ }
44
+ get buttonClasses() {
45
+ let classes = "wm-button";
46
+ classes += this.permanentlyDelete ? " -permanentlydelete" : "";
47
+ classes += this.tempButtonType ? " -" + this.tempButtonType : " -secondary";
48
+ classes += this.textWrap ? "" : " nowrap";
49
+ classes += this.isTabbing ? " user-is-tabbing" : "";
50
+ classes += this.isTruncated ? " -truncated" : "";
51
+ classes += this.customBackground === "dark" ? " dark" : "";
52
+ return classes;
53
+ }
54
+ get iconStyles() {
55
+ let transformStyle = "";
56
+ transformStyle += this.iconRotate ? `rotate(${this.iconRotate}deg)` : "";
57
+ transformStyle += this.iconFlip === "horizontal" ? `scaleX(-1)` : "";
58
+ transformStyle += this.iconFlip === "vertical" ? `scaleY(-1)` : "";
59
+ return Object.assign(Object.assign({}, (this.iconSize && { fontSize: this.iconSize })), ((this.iconRotate || this.iconFlip) && { transform: transformStyle }));
60
+ }
61
+ toggleTabbingOn() {
62
+ this.isTabbing = true;
63
+ }
64
+ toggleTabbingOff() {
65
+ this.isTabbing = false;
66
+ }
67
+ // we need to listen for scroll events during the capture phase because they do not bubble up
68
+ // there can be layouts where the main content has 100vh and overflows
69
+ // in these cases window will register no scroll events unless we catch on they way down
70
+ handleScroll() {
71
+ if (this.tooltipVisible) {
72
+ this.hideTooltip();
73
+ }
74
+ }
75
+ validateType(newValue) {
76
+ const valid = [
77
+ "primary",
78
+ "secondary",
79
+ "textonly",
80
+ "icononly",
81
+ "navigational",
82
+ "selector",
83
+ "selector-primary",
84
+ "pairpositive",
85
+ "pairnegative",
86
+ ].includes(newValue);
87
+ if (!valid) {
88
+ this.buttonType = "secondary";
89
+ }
90
+ this.validateIcon();
91
+ }
92
+ // remove entire watcher after buttonStyle has been fully removed
93
+ validateDeprecatedType(newValue) {
94
+ const valid = ["primary", "secondary", "textonly", "icononly", "navigational", "selector"].includes(newValue);
95
+ if (!valid) {
96
+ this.buttonStyle = "secondary";
97
+ }
98
+ this.validateIcon();
99
+ }
100
+ updateIcon() {
101
+ this.icon = getIconCodeFromName(this.icon);
102
+ }
103
+ validateIcon() {
104
+ switch (this.tempButtonType) {
105
+ case "icononly":
106
+ case "navigational":
107
+ // if the style is icononly or navigational...
108
+ // - an icon must be provided
109
+ if (!this.icon) {
110
+ console.error("wm-button should have a valid 'icon' property when button-type is set to 'icononly' or 'navigational'.");
111
+ }
112
+ // - if no tooltip text was passed and we couldn't generate one, throw an error
113
+ if (!this.tooltip) {
114
+ console.error("wm-button should have a valid 'tooltip' property when button-type is set to 'icononly' or 'navigational'.");
115
+ }
116
+ break;
117
+ case "pairpositive":
118
+ this.icon = "f12c";
119
+ break;
120
+ case "pairnegative":
121
+ this.icon = "f739";
122
+ break;
123
+ }
124
+ }
125
+ handleKeydown(ev) {
126
+ switch (ev.key) {
127
+ case "Enter":
128
+ ev.preventDefault();
129
+ if (!this.isDisabled) {
130
+ this.el.click();
131
+ }
132
+ break;
133
+ }
134
+ }
135
+ componentWillLoad() {
136
+ if (this.buttonStyle) {
137
+ console.warn("wm-button: button-style has been deprecated as of v3.1.0. Please use button-type instead.");
138
+ }
139
+ this.validateType(this.tempButtonType);
140
+ if (this.icon) {
141
+ this.icon = this.icon = getIconCodeFromName(this.icon);
142
+ }
143
+ }
144
+ componentDidLoad() {
145
+ if (document.body.classList.contains("wmcl-user-is-tabbing")) {
146
+ this.toggleTabbingOn();
147
+ }
148
+ this.ariaPopup = !!this.el.getAttribute("aria-haspopup");
149
+ this.btnPos.new = this.buttonEl.getBoundingClientRect();
150
+ }
151
+ showTooltip() {
152
+ if (this.hasTooltip) {
153
+ // set tooltip text
154
+ let tooltipText = "";
155
+ if (this.isTruncated && this.el.textContent) {
156
+ // when truncated, tooltip text is the button's content
157
+ tooltipText = this.el.textContent;
158
+ }
159
+ else if (this.tooltip) {
160
+ // otherwise it is the tooltip property if present
161
+ tooltipText = this.tooltip;
162
+ }
163
+ this.tooltipEl.textContent = tooltipText;
164
+ // tooltip only has a maxWidth if it contains whitespace and can break
165
+ const hasNoWhitespace = tooltipText.match(/^[^\s]+$/);
166
+ if (hasNoWhitespace) {
167
+ this.tooltipEl.classList.add("single-word");
168
+ this.tooltipEl.style.setProperty("--wmTooltipMaxWidth", "none");
169
+ }
170
+ else {
171
+ this.tooltipEl.classList.remove("single-word");
172
+ this.tooltipEl.style.removeProperty("--wmTooltipMaxWidth");
173
+ }
174
+ // adjust placement in case there is no space to place the tooltip where specified via prop
175
+ // calculation outside of the function to keep it pure
176
+ const adjustedTooltipPlacement = adjustTooltipPlacement(this.tooltipPosition, this.buttonEl, this.tooltipEl);
177
+ this.btnPos.old = {};
178
+ const tooltipRect = this.tooltipEl.getBoundingClientRect();
179
+ this.tooltipEl.style.transitionDelay = "500ms";
180
+ this.tooltipEl.style.opacity = "1";
181
+ // This slight delay fixes an issue for keyboard users:
182
+ // if they tab to a button out of screen bounds, the page scrolls
183
+ // and hideTooltip() would be triggered before the tooltip would show
184
+ setTimeout(() => {
185
+ this.tooltipVisible = true;
186
+ this.positionTooltip(adjustedTooltipPlacement, tooltipRect);
187
+ }, 50);
188
+ }
189
+ }
190
+ positionTooltip(tPos, tooltipRect) {
191
+ if (this.tooltipVisible) {
192
+ window.requestAnimationFrame(() => this.positionTooltip(tPos, tooltipRect));
193
+ }
194
+ this.btnPos.new = this.buttonEl.getBoundingClientRect();
195
+ if (this.btnPos.new.top != this.btnPos.old.top || this.btnPos.new.left != this.btnPos.old.left) {
196
+ // this is to figure out how to offset, given the size of the button and of the tooltip
197
+ // to get the center positions, calculate the difference between the button width and the tooltip width
198
+ const vDiff = (this.btnPos.new.height - tooltipRect.height) / 2;
199
+ const hDiff = (this.btnPos.new.width - tooltipRect.width) / 2;
200
+ // the naming convention defaults to center in the absence of a value
201
+ // Values "top" and "bottom" imply horizontal centering; Values "right" and "left" imply vertical centering
202
+ // therefore we first set to center first, then adjust accordingly
203
+ let vPos = this.btnPos.new.top + vDiff;
204
+ let hPos = this.btnPos.new.left + hDiff;
205
+ if (tPos.includes("top")) {
206
+ vPos = this.btnPos.new.top - tooltipRect.height - 8;
207
+ }
208
+ if (tPos.includes("bottom")) {
209
+ vPos = this.btnPos.new.bottom + 8;
210
+ }
211
+ if (tPos.includes("left")) {
212
+ hPos = this.btnPos.new.left - tooltipRect.width - 8;
213
+ }
214
+ if (tPos.includes("right")) {
215
+ hPos = this.btnPos.new.right + 8;
216
+ }
217
+ // after all positioning has been calculated, if tooltip is off-screen or closer than 24px it is readjusted
218
+ // this only occurs when the tooltip is overflowing to the left and is positioned top or bottom
219
+ // (button placed too far left, or screen size under 268px)
220
+ hPos = Math.max(hPos, 24);
221
+ this.tooltipEl.style.setProperty("--wmTooltipTop", vPos + "px");
222
+ this.tooltipEl.style.setProperty("--wmTooltipLeft", hPos + "px");
223
+ // this.tooltipEl.style.top = vPos + "px";
224
+ // this.tooltipEl.style.left = hPos + "px";
225
+ // this.tooltipEl.style.top = (vPos / 16).toString() + "rem";
226
+ // this.tooltipEl.style.left = (hPos / 16).toString() + "rem";
227
+ this.btnPos.old = this.btnPos.new;
228
+ }
229
+ }
230
+ hideTooltip() {
231
+ if (this.hasTooltip) {
232
+ this.tooltipEl.style.transitionDelay = "0s";
233
+ this.tooltipEl.style.opacity = "0";
234
+ this.tooltipVisible = false;
235
+ }
236
+ }
237
+ showTooltipForKeyboardUsers() {
238
+ if (this.isTabbing) {
239
+ this.showTooltip();
240
+ }
241
+ }
242
+ getAriaLabel() {
243
+ if (this.tempButtonType === "icononly" || this.tempButtonType === "navigational") {
244
+ return this.labelForIdenticalButtons || this.tooltip;
245
+ }
246
+ if (this.labelForIdenticalButtons) {
247
+ return this.labelForIdenticalButtons;
248
+ }
249
+ }
250
+ render() {
251
+ return (h(Host, { class: this.isDisabled ? "button-disabled" : "" }, h("button", { id: this.id, class: `${this.buttonClasses}`, disabled: this.isDisabled, ref: (el) => (this.buttonEl = el), "aria-label": this.getAriaLabel(), "aria-hasPopup": this.ariaPopup ? "menu" : null, onMouseEnter: () => this.showTooltip(), onMouseLeave: () => this.hideTooltip(), onFocus: () => this.showTooltipForKeyboardUsers(), onBlur: () => this.hideTooltip(), onClick: () => this.hideTooltip() }, this.icon && (h("span", { class: "mdi", style: this.iconStyles }, String.fromCodePoint(parseInt(`0x${this.icon}`)))), h("span", { class: "button-text" }, h("slot", null)))));
252
+ }
253
+ static get is() { return "wm-button"; }
254
+ static get encapsulation() { return "shadow"; }
255
+ static get delegatesFocus() { return true; }
256
+ static get originalStyleUrls() {
257
+ return {
258
+ "$": ["wm-button.scss"]
259
+ };
260
+ }
261
+ static get styleUrls() {
262
+ return {
263
+ "$": ["wm-button.css"]
264
+ };
265
+ }
266
+ static get properties() {
267
+ return {
268
+ "disabled": {
269
+ "type": "boolean",
270
+ "mutable": false,
271
+ "complexType": {
272
+ "original": "boolean",
273
+ "resolved": "boolean",
274
+ "references": {}
275
+ },
276
+ "required": false,
277
+ "optional": false,
278
+ "docs": {
279
+ "tags": [],
280
+ "text": ""
281
+ },
282
+ "attribute": "disabled",
283
+ "reflect": true,
284
+ "defaultValue": "false"
285
+ },
286
+ "buttonType": {
287
+ "type": "string",
288
+ "mutable": true,
289
+ "complexType": {
290
+ "original": "validButtonTypes | null",
291
+ "resolved": "\"icononly\" | \"navigational\" | \"pairnegative\" | \"pairpositive\" | \"primary\" | \"secondary\" | \"selector\" | \"selector-primary\" | \"textonly\" | null",
292
+ "references": {
293
+ "validButtonTypes": {
294
+ "location": "import",
295
+ "path": "../../global/interfaces"
296
+ }
297
+ }
298
+ },
299
+ "required": false,
300
+ "optional": false,
301
+ "docs": {
302
+ "tags": [],
303
+ "text": ""
304
+ },
305
+ "attribute": "button-type",
306
+ "reflect": false,
307
+ "defaultValue": "null"
308
+ },
309
+ "buttonStyle": {
310
+ "type": "string",
311
+ "mutable": true,
312
+ "complexType": {
313
+ "original": "validButtonTypes | null",
314
+ "resolved": "\"icononly\" | \"navigational\" | \"pairnegative\" | \"pairpositive\" | \"primary\" | \"secondary\" | \"selector\" | \"selector-primary\" | \"textonly\" | null",
315
+ "references": {
316
+ "validButtonTypes": {
317
+ "location": "import",
318
+ "path": "../../global/interfaces"
319
+ }
320
+ }
321
+ },
322
+ "required": false,
323
+ "optional": false,
324
+ "docs": {
325
+ "tags": [],
326
+ "text": ""
327
+ },
328
+ "attribute": "button-style",
329
+ "reflect": false,
330
+ "defaultValue": "null"
331
+ },
332
+ "icon": {
333
+ "type": "string",
334
+ "mutable": true,
335
+ "complexType": {
336
+ "original": "string",
337
+ "resolved": "string | undefined",
338
+ "references": {}
339
+ },
340
+ "required": false,
341
+ "optional": true,
342
+ "docs": {
343
+ "tags": [],
344
+ "text": ""
345
+ },
346
+ "attribute": "icon",
347
+ "reflect": true
348
+ },
349
+ "iconSize": {
350
+ "type": "string",
351
+ "mutable": false,
352
+ "complexType": {
353
+ "original": "string",
354
+ "resolved": "string | undefined",
355
+ "references": {}
356
+ },
357
+ "required": false,
358
+ "optional": true,
359
+ "docs": {
360
+ "tags": [],
361
+ "text": ""
362
+ },
363
+ "attribute": "icon-size",
364
+ "reflect": false
365
+ },
366
+ "iconRotate": {
367
+ "type": "number",
368
+ "mutable": false,
369
+ "complexType": {
370
+ "original": "number",
371
+ "resolved": "number | undefined",
372
+ "references": {}
373
+ },
374
+ "required": false,
375
+ "optional": true,
376
+ "docs": {
377
+ "tags": [],
378
+ "text": ""
379
+ },
380
+ "attribute": "icon-rotate",
381
+ "reflect": false
382
+ },
383
+ "iconFlip": {
384
+ "type": "string",
385
+ "mutable": false,
386
+ "complexType": {
387
+ "original": "\"horizontal\" | \"vertical\"",
388
+ "resolved": "\"horizontal\" | \"vertical\" | undefined",
389
+ "references": {}
390
+ },
391
+ "required": false,
392
+ "optional": true,
393
+ "docs": {
394
+ "tags": [],
395
+ "text": ""
396
+ },
397
+ "attribute": "icon-flip",
398
+ "reflect": false
399
+ },
400
+ "tooltip": {
401
+ "type": "string",
402
+ "mutable": true,
403
+ "complexType": {
404
+ "original": "string",
405
+ "resolved": "string | undefined",
406
+ "references": {}
407
+ },
408
+ "required": false,
409
+ "optional": true,
410
+ "docs": {
411
+ "tags": [],
412
+ "text": ""
413
+ },
414
+ "attribute": "tooltip",
415
+ "reflect": true
416
+ },
417
+ "labelForIdenticalButtons": {
418
+ "type": "string",
419
+ "mutable": false,
420
+ "complexType": {
421
+ "original": "string",
422
+ "resolved": "string | undefined",
423
+ "references": {}
424
+ },
425
+ "required": false,
426
+ "optional": true,
427
+ "docs": {
428
+ "tags": [],
429
+ "text": ""
430
+ },
431
+ "attribute": "label-for-identical-buttons",
432
+ "reflect": false
433
+ },
434
+ "tooltipPosition": {
435
+ "type": "string",
436
+ "mutable": false,
437
+ "complexType": {
438
+ "original": "TooltipPlacement",
439
+ "resolved": "\"bottom\" | \"bottom-left\" | \"bottom-right\" | \"left\" | \"right\" | \"top\" | \"top-left\" | \"top-right\"",
440
+ "references": {
441
+ "TooltipPlacement": {
442
+ "location": "import",
443
+ "path": "../../global/interfaces"
444
+ }
445
+ }
446
+ },
447
+ "required": false,
448
+ "optional": false,
449
+ "docs": {
450
+ "tags": [],
451
+ "text": ""
452
+ },
453
+ "attribute": "tooltip-position",
454
+ "reflect": false,
455
+ "defaultValue": "\"bottom-right\""
456
+ },
457
+ "permanentlyDelete": {
458
+ "type": "boolean",
459
+ "mutable": false,
460
+ "complexType": {
461
+ "original": "boolean",
462
+ "resolved": "boolean | undefined",
463
+ "references": {}
464
+ },
465
+ "required": false,
466
+ "optional": true,
467
+ "docs": {
468
+ "tags": [],
469
+ "text": ""
470
+ },
471
+ "attribute": "permanently-delete",
472
+ "reflect": false,
473
+ "defaultValue": "false"
474
+ },
475
+ "textWrap": {
476
+ "type": "boolean",
477
+ "mutable": false,
478
+ "complexType": {
479
+ "original": "boolean",
480
+ "resolved": "boolean",
481
+ "references": {}
482
+ },
483
+ "required": false,
484
+ "optional": false,
485
+ "docs": {
486
+ "tags": [],
487
+ "text": ""
488
+ },
489
+ "attribute": "text-wrap",
490
+ "reflect": false,
491
+ "defaultValue": "true"
492
+ },
493
+ "customBackground": {
494
+ "type": "string",
495
+ "mutable": false,
496
+ "complexType": {
497
+ "original": "string",
498
+ "resolved": "string | undefined",
499
+ "references": {}
500
+ },
501
+ "required": false,
502
+ "optional": true,
503
+ "docs": {
504
+ "tags": [],
505
+ "text": ""
506
+ },
507
+ "attribute": "custom-background",
508
+ "reflect": false
509
+ },
510
+ "tooltipVisible": {
511
+ "type": "boolean",
512
+ "mutable": true,
513
+ "complexType": {
514
+ "original": "boolean",
515
+ "resolved": "boolean",
516
+ "references": {}
517
+ },
518
+ "required": false,
519
+ "optional": false,
520
+ "docs": {
521
+ "tags": [],
522
+ "text": ""
523
+ },
524
+ "attribute": "tooltip-visible",
525
+ "reflect": false,
526
+ "defaultValue": "false"
527
+ }
528
+ };
529
+ }
530
+ static get states() {
531
+ return {
532
+ "isTabbing": {}
533
+ };
534
+ }
535
+ static get elementRef() { return "el"; }
536
+ static get watchers() {
537
+ return [{
538
+ "propName": "buttonType",
539
+ "methodName": "validateType"
540
+ }, {
541
+ "propName": "buttonStyle",
542
+ "methodName": "validateDeprecatedType"
543
+ }, {
544
+ "propName": "icon",
545
+ "methodName": "updateIcon"
546
+ }];
547
+ }
548
+ static get listeners() {
549
+ return [{
550
+ "name": "wmUserIsTabbing",
551
+ "method": "toggleTabbingOn",
552
+ "target": "window",
553
+ "capture": false,
554
+ "passive": false
555
+ }, {
556
+ "name": "wmUserIsNotTabbing",
557
+ "method": "toggleTabbingOff",
558
+ "target": "window",
559
+ "capture": false,
560
+ "passive": false
561
+ }, {
562
+ "name": "scroll",
563
+ "method": "handleScroll",
564
+ "target": "window",
565
+ "capture": true,
566
+ "passive": true
567
+ }, {
568
+ "name": "keydown",
569
+ "method": "handleKeydown",
570
+ "target": undefined,
571
+ "capture": false,
572
+ "passive": false
573
+ }];
574
+ }
575
+ }