@watermarkinsights/ripple 0.0.0 → 0.1.0-alpha.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 (580) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -1
  3. package/dist/cjs/app-globals-f836e216.js +103 -0
  4. package/dist/cjs/chartFunctions-608adb05.js +908 -0
  5. package/dist/cjs/{functions-f2333f02.js → functions-b188d5b3.js} +6137 -1590
  6. package/dist/cjs/index-786066a1.js +1880 -0
  7. package/dist/cjs/interfaces-8419be91.js +59 -0
  8. package/dist/cjs/intl-01531391.js +283 -0
  9. package/dist/cjs/loader.cjs.js +7 -14
  10. package/dist/cjs/priv-calendar.cjs.entry.js +608 -0
  11. package/dist/cjs/priv-chart-popover-old.cjs.entry.js +146 -0
  12. package/dist/cjs/priv-chart-popover_2.cjs.entry.js +194 -0
  13. package/dist/cjs/priv-navigator-button.cjs.entry.js +19 -19
  14. package/dist/cjs/priv-navigator-item.cjs.entry.js +24 -23
  15. package/dist/cjs/priv-option-list.cjs.entry.js +391 -0
  16. package/dist/cjs/ripple.cjs.js +25 -0
  17. package/dist/cjs/wm-action-menu_2.cjs.entry.js +471 -302
  18. package/dist/cjs/wm-button.cjs.entry.js +263 -142
  19. package/dist/cjs/wm-chart-bar.cjs.entry.js +441 -0
  20. package/dist/cjs/wm-chart-column.cjs.entry.js +544 -0
  21. package/dist/cjs/wm-chart-slice.cjs.entry.js +17 -12
  22. package/dist/cjs/wm-chart.cjs.entry.js +133 -478
  23. package/dist/cjs/wm-date-range.cjs.entry.js +526 -0
  24. package/dist/cjs/wm-datepicker.cjs.entry.js +285 -224
  25. package/dist/cjs/wm-file-list.cjs.entry.js +23 -0
  26. package/dist/cjs/wm-file.cjs.entry.js +210 -0
  27. package/dist/cjs/wm-flyout.cjs.entry.js +181 -0
  28. package/dist/cjs/wm-input.cjs.entry.js +121 -100
  29. package/dist/cjs/wm-line-chart.cjs.entry.js +541 -0
  30. package/dist/cjs/wm-modal-pss_3.cjs.entry.js +220 -0
  31. package/dist/cjs/wm-modal_3.cjs.entry.js +223 -0
  32. package/dist/cjs/wm-navigation_3.cjs.entry.js +188 -0
  33. package/dist/cjs/wm-navigator.cjs.entry.js +305 -250
  34. package/dist/cjs/wm-nested-select.cjs.entry.js +320 -0
  35. package/dist/cjs/wm-optgroup.cjs.entry.js +74 -0
  36. package/dist/cjs/wm-option_2.cjs.entry.js +517 -465
  37. package/dist/cjs/wm-pagination.cjs.entry.js +218 -165
  38. package/dist/cjs/wm-progress-indicator_3.cjs.entry.js +204 -0
  39. package/dist/cjs/wm-search.cjs.entry.js +182 -217
  40. package/dist/cjs/wm-snackbar.cjs.entry.js +158 -142
  41. package/dist/cjs/wm-tab-item_3.cjs.entry.js +317 -276
  42. package/dist/cjs/wm-tag-input.cjs.entry.js +940 -500
  43. package/dist/cjs/wm-tag-option.cjs.entry.js +43 -0
  44. package/dist/cjs/wm-textarea.cjs.entry.js +94 -0
  45. package/dist/cjs/wm-timepicker.cjs.entry.js +276 -349
  46. package/dist/cjs/wm-toggletip.cjs.entry.js +238 -114
  47. package/dist/cjs/wm-uploader.cjs.entry.js +322 -323
  48. package/dist/cjs/wm-wrapper.cjs.entry.js +12 -12
  49. package/dist/collection/collection-manifest.json +104 -34
  50. package/dist/collection/components/charts/chartFunctions.js +833 -0
  51. package/dist/collection/components/charts/priv-chart-popover/priv-chart-popover.css +995 -0
  52. package/dist/collection/components/charts/priv-chart-popover/priv-chart-popover.js +340 -0
  53. package/dist/collection/components/charts/priv-chart-popover-old/priv-chart-popover-old.css +990 -0
  54. package/dist/collection/components/charts/priv-chart-popover-old/priv-chart-popover-old.js +263 -0
  55. package/dist/collection/components/charts/wm-chart/wm-chart-slice.js +125 -0
  56. package/dist/collection/components/charts/wm-chart/wm-chart.css +1326 -0
  57. package/dist/collection/components/charts/wm-chart/wm-chart.js +422 -0
  58. package/dist/collection/components/charts/wm-chart-bar/wm-chart-bar.css +1116 -0
  59. package/dist/collection/components/charts/wm-chart-bar/wm-chart-bar.js +579 -0
  60. package/dist/collection/components/charts/wm-chart-column/wm-chart-column.css +1169 -0
  61. package/dist/collection/components/charts/wm-chart-column/wm-chart-column.js +688 -0
  62. package/dist/collection/components/charts/wm-chart-legend/wm-chart-legend.css +932 -0
  63. package/dist/collection/components/charts/wm-chart-legend/wm-chart-legend.js +194 -0
  64. package/dist/collection/components/charts/wm-line-chart/wm-line-chart.css +1208 -0
  65. package/dist/collection/components/charts/wm-line-chart/wm-line-chart.js +862 -0
  66. package/dist/collection/components/charts/wm-progress-monitor/wm-progress-indicator.css +1326 -0
  67. package/dist/collection/components/charts/wm-progress-monitor/wm-progress-indicator.js +264 -0
  68. package/dist/collection/components/charts/wm-progress-monitor/wm-progress-monitor.css +967 -0
  69. package/dist/collection/components/charts/wm-progress-monitor/wm-progress-monitor.js +151 -0
  70. package/dist/collection/components/charts/wm-progress-monitor/wm-progress-slice.js +121 -0
  71. package/dist/collection/components/datepickers/datepicker.css +1137 -0
  72. package/dist/collection/components/datepickers/priv-calendar/priv-calendar.css +1403 -0
  73. package/dist/collection/components/datepickers/priv-calendar/priv-calendar.js +881 -0
  74. package/dist/collection/components/datepickers/wm-date-range.js +870 -0
  75. package/dist/collection/components/datepickers/wm-datepicker.js +579 -0
  76. package/dist/collection/components/selects/priv-option-list/priv-option-list.css +999 -0
  77. package/dist/collection/components/selects/priv-option-list/priv-option-list.js +778 -0
  78. package/dist/collection/components/selects/wm-nested-select/wm-nested-select.css +1259 -0
  79. package/dist/collection/components/selects/wm-nested-select/wm-nested-select.js +626 -0
  80. package/dist/collection/components/selects/wm-optgroup/wm-optgroup.css +909 -0
  81. package/dist/collection/components/selects/wm-optgroup/wm-optgroup.js +258 -0
  82. package/dist/collection/components/selects/wm-option/wm-option.css +1033 -0
  83. package/dist/collection/components/selects/wm-option/wm-option.js +530 -0
  84. package/dist/collection/components/selects/wm-select/wm-select.css +1187 -0
  85. package/dist/collection/components/selects/wm-select/wm-select.js +705 -0
  86. package/dist/collection/components/wm-action-menu/wm-action-menu.css +1614 -50
  87. package/dist/collection/components/wm-action-menu/wm-action-menu.js +605 -387
  88. package/dist/collection/components/wm-button/wm-button.css +1440 -385
  89. package/dist/collection/components/wm-button/wm-button.js +538 -348
  90. package/dist/collection/components/wm-file/wm-file.css +1086 -0
  91. package/dist/collection/components/wm-file/wm-file.js +428 -0
  92. package/dist/collection/components/wm-file-list/wm-file-list.css +899 -0
  93. package/dist/collection/components/wm-file-list/wm-file-list.js +45 -0
  94. package/dist/collection/components/wm-flyout/wm-flyout.css +1117 -0
  95. package/dist/collection/components/wm-flyout/wm-flyout.js +449 -0
  96. package/dist/collection/components/wm-input/wm-input.css +965 -96
  97. package/dist/collection/components/wm-input/wm-input.js +466 -291
  98. package/dist/collection/components/wm-menuitem/wm-menuitem.css +919 -55
  99. package/dist/collection/components/wm-menuitem/wm-menuitem.js +402 -397
  100. package/dist/collection/components/wm-modal/wm-modal-footer.css +871 -28
  101. package/dist/collection/components/wm-modal/wm-modal-footer.js +139 -156
  102. package/dist/collection/components/wm-modal/wm-modal-header.css +864 -16
  103. package/dist/collection/components/wm-modal/wm-modal-header.js +76 -106
  104. package/dist/collection/components/wm-modal/wm-modal.css +921 -93
  105. package/dist/collection/components/wm-modal/wm-modal.js +337 -337
  106. package/dist/collection/components/wm-modal-pss/wm-modal-pss-footer.css +931 -0
  107. package/dist/collection/components/wm-modal-pss/wm-modal-pss-footer.js +138 -0
  108. package/dist/collection/components/wm-modal-pss/wm-modal-pss-header.css +925 -0
  109. package/dist/collection/components/wm-modal-pss/wm-modal-pss-header.js +82 -0
  110. package/dist/collection/components/wm-modal-pss/wm-modal-pss.css +1007 -0
  111. package/dist/collection/components/wm-modal-pss/wm-modal-pss.js +365 -0
  112. package/dist/collection/components/wm-navigation/wm-navigation-hamburger.css +926 -0
  113. package/dist/collection/components/wm-navigation/wm-navigation-hamburger.js +119 -0
  114. package/dist/collection/components/wm-navigation/wm-navigation-item.css +935 -0
  115. package/dist/collection/components/wm-navigation/wm-navigation-item.js +98 -0
  116. package/dist/collection/components/wm-navigation/wm-navigation.css +977 -0
  117. package/dist/collection/components/wm-navigation/wm-navigation.js +190 -0
  118. package/dist/collection/components/wm-navigator/priv-navigator-button/priv-navigator-button.css +868 -33
  119. package/dist/collection/components/wm-navigator/priv-navigator-button/priv-navigator-button.js +83 -94
  120. package/dist/collection/components/wm-navigator/priv-navigator-item/priv-navigator-item.css +876 -25
  121. package/dist/collection/components/wm-navigator/priv-navigator-item/priv-navigator-item.js +120 -110
  122. package/dist/collection/components/wm-navigator/wm-navigator.css +891 -38
  123. package/dist/collection/components/wm-navigator/wm-navigator.js +491 -456
  124. package/dist/collection/components/wm-pagination/wm-pagination.css +895 -68
  125. package/dist/collection/components/wm-pagination/wm-pagination.js +374 -340
  126. package/dist/collection/components/wm-search/wm-search.css +895 -73
  127. package/dist/collection/components/wm-search/wm-search.js +411 -421
  128. package/dist/collection/components/wm-snackbar/wm-snackbar.css +979 -160
  129. package/dist/collection/components/wm-snackbar/wm-snackbar.js +258 -235
  130. package/dist/collection/components/wm-tabs/wm-tab-item/wm-tab-item.css +904 -50
  131. package/dist/collection/components/wm-tabs/wm-tab-item/wm-tab-item.js +162 -198
  132. package/dist/collection/components/wm-tabs/wm-tab-list/wm-tab-list.css +922 -29
  133. package/dist/collection/components/wm-tabs/wm-tab-list/wm-tab-list.js +334 -292
  134. package/dist/collection/components/wm-tabs/wm-tab-panel/wm-tab-panel.css +862 -13
  135. package/dist/collection/components/wm-tabs/wm-tab-panel/wm-tab-panel.js +83 -100
  136. package/dist/collection/components/wm-tag-input/wm-tag-input.css +1212 -200
  137. package/dist/collection/components/wm-tag-input/wm-tag-input.js +1283 -702
  138. package/dist/collection/components/wm-tag-input/wm-tag-option/wm-tag-option.js +243 -0
  139. package/dist/collection/components/wm-textarea/wm-textarea.css +1065 -0
  140. package/dist/collection/components/wm-textarea/wm-textarea.js +319 -0
  141. package/dist/collection/components/wm-timepicker/wm-timepicker.css +962 -168
  142. package/dist/collection/components/wm-timepicker/wm-timepicker.js +539 -553
  143. package/dist/collection/components/wm-toggletip/wm-toggletip.css +1094 -148
  144. package/dist/collection/components/wm-toggletip/wm-toggletip.js +370 -211
  145. package/dist/collection/components/wm-uploader/wm-uploader.css +1756 -438
  146. package/dist/collection/components/wm-uploader/wm-uploader.js +607 -661
  147. package/dist/collection/components/wm-wrapper/wm-wrapper.js +26 -25
  148. package/dist/collection/dev/action-menu.js +18 -0
  149. package/dist/collection/dev/chart-bar.js +423 -0
  150. package/dist/collection/dev/chart-column.js +437 -0
  151. package/dist/collection/dev/chart-small.js +56 -0
  152. package/dist/collection/dev/chart.js +18 -0
  153. package/dist/collection/dev/date-range.js +6 -0
  154. package/dist/collection/dev/datepicker.js +46 -0
  155. package/dist/collection/dev/file-list.js +16 -0
  156. package/dist/collection/dev/file.js +0 -0
  157. package/dist/collection/dev/flyout.js +194 -0
  158. package/dist/collection/dev/input.js +6 -0
  159. package/dist/collection/dev/line-chart.js +45 -0
  160. package/dist/collection/dev/modal.js +48 -0
  161. package/dist/collection/dev/navigation.js +13 -0
  162. package/dist/collection/dev/navigator.js +34 -0
  163. package/dist/collection/dev/nested-select.js +36 -0
  164. package/dist/collection/dev/pagination.js +7 -0
  165. package/dist/collection/dev/progress-monitor.js +0 -0
  166. package/dist/collection/dev/pss-modal.js +8 -0
  167. package/dist/collection/dev/scripts.js +43 -14
  168. package/dist/collection/dev/search.js +72 -0
  169. package/dist/collection/dev/select.js +57 -0
  170. package/dist/collection/dev/snackbar.js +68 -0
  171. package/dist/collection/dev/tabs.js +44 -0
  172. package/dist/collection/dev/tag-input.js +32 -0
  173. package/dist/collection/dev/textarea.js +28 -0
  174. package/dist/collection/dev/timepicker.js +32 -0
  175. package/dist/collection/dev/toggletip.js +9 -0
  176. package/dist/collection/dev/uploader.js +139 -0
  177. package/dist/collection/global/__mocks__/functions.js +2 -1
  178. package/dist/collection/global/functions.js +853 -371
  179. package/dist/collection/global/global.js +88 -28
  180. package/dist/collection/global/interfaces.js +62 -39
  181. package/dist/collection/global/intl.js +274 -0
  182. package/dist/collection/global/services/__mocks__/http-service.js +112 -112
  183. package/dist/collection/global/services/http-service.js +41 -41
  184. package/dist/collection/lang/missing.js +43 -0
  185. package/dist/collection/lang/piglatin.js +11 -3
  186. package/dist/esm/app-globals-d0ca31a6.js +101 -0
  187. package/dist/esm/chartFunctions-4bc77b76.js +883 -0
  188. package/dist/esm/{functions-60034bf7.js → functions-de887809.js} +6110 -1584
  189. package/dist/esm/index-ef50bc01.js +1849 -0
  190. package/dist/esm/interfaces-7e50d034.js +55 -0
  191. package/dist/esm/intl-56b47a7b.js +277 -0
  192. package/dist/esm/loader.js +7 -14
  193. package/dist/esm/priv-calendar.entry.js +604 -0
  194. package/dist/esm/priv-chart-popover-old.entry.js +142 -0
  195. package/dist/esm/priv-chart-popover_2.entry.js +189 -0
  196. package/dist/esm/priv-navigator-button.entry.js +19 -19
  197. package/dist/esm/priv-navigator-item.entry.js +24 -23
  198. package/dist/esm/priv-option-list.entry.js +387 -0
  199. package/dist/esm/ripple.js +20 -0
  200. package/dist/esm/wm-action-menu_2.entry.js +471 -302
  201. package/dist/esm/wm-button.entry.js +263 -142
  202. package/dist/esm/wm-chart-bar.entry.js +437 -0
  203. package/dist/esm/wm-chart-column.entry.js +540 -0
  204. package/dist/esm/wm-chart-slice.entry.js +17 -12
  205. package/dist/esm/wm-chart.entry.js +133 -478
  206. package/dist/esm/wm-date-range.entry.js +522 -0
  207. package/dist/esm/wm-datepicker.entry.js +285 -224
  208. package/dist/esm/wm-file-list.entry.js +19 -0
  209. package/dist/esm/wm-file.entry.js +206 -0
  210. package/dist/esm/wm-flyout.entry.js +177 -0
  211. package/dist/esm/wm-input.entry.js +121 -100
  212. package/dist/esm/wm-line-chart.entry.js +537 -0
  213. package/dist/esm/wm-modal-pss_3.entry.js +214 -0
  214. package/dist/esm/wm-modal_3.entry.js +217 -0
  215. package/dist/esm/wm-navigation_3.entry.js +182 -0
  216. package/dist/esm/wm-navigator.entry.js +305 -250
  217. package/dist/esm/wm-nested-select.entry.js +316 -0
  218. package/dist/esm/wm-optgroup.entry.js +70 -0
  219. package/dist/esm/wm-option_2.entry.js +517 -465
  220. package/dist/esm/wm-pagination.entry.js +218 -165
  221. package/dist/esm/wm-progress-indicator_3.entry.js +198 -0
  222. package/dist/esm/wm-search.entry.js +182 -217
  223. package/dist/esm/wm-snackbar.entry.js +158 -142
  224. package/dist/esm/wm-tab-item_3.entry.js +317 -276
  225. package/dist/esm/wm-tag-input.entry.js +940 -500
  226. package/dist/esm/wm-tag-option.entry.js +39 -0
  227. package/dist/esm/wm-textarea.entry.js +90 -0
  228. package/dist/esm/wm-timepicker.entry.js +276 -349
  229. package/dist/esm/wm-toggletip.entry.js +238 -114
  230. package/dist/esm/wm-uploader.entry.js +322 -323
  231. package/dist/esm/wm-wrapper.entry.js +12 -12
  232. package/dist/esm-es5/app-globals-d0ca31a6.js +1 -0
  233. package/dist/esm-es5/chartFunctions-4bc77b76.js +1 -0
  234. package/dist/esm-es5/functions-de887809.js +1 -0
  235. package/dist/esm-es5/index-ef50bc01.js +1 -0
  236. package/dist/esm-es5/index.js +0 -0
  237. package/dist/esm-es5/interfaces-7e50d034.js +1 -0
  238. package/dist/esm-es5/intl-56b47a7b.js +1 -0
  239. package/dist/esm-es5/loader.js +1 -0
  240. package/dist/esm-es5/priv-calendar.entry.js +1 -0
  241. package/dist/esm-es5/priv-chart-popover-old.entry.js +1 -0
  242. package/dist/esm-es5/priv-chart-popover_2.entry.js +1 -0
  243. package/dist/esm-es5/priv-navigator-button.entry.js +1 -0
  244. package/dist/esm-es5/priv-navigator-item.entry.js +1 -0
  245. package/dist/esm-es5/priv-option-list.entry.js +1 -0
  246. package/dist/esm-es5/ripple.js +1 -0
  247. package/dist/esm-es5/wm-action-menu_2.entry.js +1 -0
  248. package/dist/esm-es5/wm-button.entry.js +1 -0
  249. package/dist/esm-es5/wm-chart-bar.entry.js +1 -0
  250. package/dist/esm-es5/wm-chart-column.entry.js +1 -0
  251. package/dist/esm-es5/wm-chart-slice.entry.js +1 -0
  252. package/dist/esm-es5/wm-chart.entry.js +1 -0
  253. package/dist/esm-es5/wm-date-range.entry.js +1 -0
  254. package/dist/esm-es5/wm-datepicker.entry.js +1 -0
  255. package/dist/esm-es5/wm-file-list.entry.js +1 -0
  256. package/dist/esm-es5/wm-file.entry.js +1 -0
  257. package/dist/esm-es5/wm-flyout.entry.js +1 -0
  258. package/dist/esm-es5/wm-input.entry.js +1 -0
  259. package/dist/esm-es5/wm-line-chart.entry.js +1 -0
  260. package/dist/esm-es5/wm-modal-pss_3.entry.js +1 -0
  261. package/dist/esm-es5/wm-modal_3.entry.js +1 -0
  262. package/dist/esm-es5/wm-navigation_3.entry.js +1 -0
  263. package/dist/esm-es5/wm-navigator.entry.js +1 -0
  264. package/dist/esm-es5/wm-nested-select.entry.js +1 -0
  265. package/dist/esm-es5/wm-optgroup.entry.js +1 -0
  266. package/dist/esm-es5/wm-option_2.entry.js +1 -0
  267. package/dist/esm-es5/wm-pagination.entry.js +1 -0
  268. package/dist/esm-es5/wm-progress-indicator_3.entry.js +1 -0
  269. package/dist/esm-es5/wm-search.entry.js +1 -0
  270. package/dist/esm-es5/wm-snackbar.entry.js +1 -0
  271. package/dist/esm-es5/wm-tab-item_3.entry.js +1 -0
  272. package/dist/esm-es5/wm-tag-input.entry.js +1 -0
  273. package/dist/esm-es5/wm-tag-option.entry.js +1 -0
  274. package/dist/esm-es5/wm-textarea.entry.js +1 -0
  275. package/dist/esm-es5/wm-timepicker.entry.js +1 -0
  276. package/dist/esm-es5/wm-toggletip.entry.js +1 -0
  277. package/dist/esm-es5/wm-uploader.entry.js +1 -0
  278. package/dist/esm-es5/wm-wrapper.entry.js +1 -0
  279. package/dist/index.js +1 -1
  280. package/dist/loader/cdn.js +1 -2
  281. package/dist/loader/index.cjs.js +1 -2
  282. package/dist/loader/index.d.ts +13 -2
  283. package/dist/loader/index.es2017.js +1 -2
  284. package/dist/loader/index.js +1 -2
  285. package/dist/loader/package.json +2 -1
  286. package/dist/ripple/index.esm.js +0 -0
  287. package/dist/ripple/p-03a6850a.entry.js +1 -0
  288. package/dist/ripple/p-0c3162d5.system.entry.js +1 -0
  289. package/dist/ripple/p-0ec71f08.system.entry.js +1 -0
  290. package/dist/ripple/p-1032c0db.system.entry.js +1 -0
  291. package/dist/ripple/p-117c3d78.system.js +2 -0
  292. package/dist/ripple/p-12024d3b.system.entry.js +1 -0
  293. package/dist/ripple/p-13152ac1.system.entry.js +1 -0
  294. package/dist/ripple/p-1318ae67.entry.js +1 -0
  295. package/dist/ripple/p-137bf0c0.system.entry.js +1 -0
  296. package/dist/ripple/p-13bb6faf.entry.js +1 -0
  297. package/dist/ripple/p-16ff8110.entry.js +1 -0
  298. package/dist/ripple/p-1825d519.system.entry.js +1 -0
  299. package/dist/ripple/p-18417851.entry.js +1 -0
  300. package/dist/ripple/p-1c655f6b.entry.js +1 -0
  301. package/dist/ripple/p-1ce77857.system.entry.js +1 -0
  302. package/dist/ripple/p-1d76061a.entry.js +1 -0
  303. package/dist/ripple/p-22b57f73.system.entry.js +1 -0
  304. package/dist/ripple/p-24dfbf1d.system.entry.js +1 -0
  305. package/dist/ripple/p-28996d67.system.entry.js +1 -0
  306. package/dist/ripple/p-30118d12.system.entry.js +1 -0
  307. package/dist/ripple/p-32f3581a.entry.js +1 -0
  308. package/dist/ripple/p-334d8711.system.js +1 -0
  309. package/dist/ripple/p-3c8c5933.js +1 -0
  310. package/dist/ripple/p-436bf381.system.entry.js +1 -0
  311. package/dist/ripple/p-43843597.system.entry.js +1 -0
  312. package/dist/ripple/p-45999149.system.js +1 -0
  313. package/dist/ripple/p-48b596ae.entry.js +1 -0
  314. package/dist/ripple/p-4bab5360.system.js +1 -0
  315. package/dist/ripple/p-4ff0db4d.entry.js +1 -0
  316. package/dist/ripple/p-50ea2036.system.js +1 -0
  317. package/dist/ripple/p-57f1bafd.system.entry.js +1 -0
  318. package/dist/ripple/p-5b0e9165.entry.js +1 -0
  319. package/dist/ripple/p-6266fcbf.system.entry.js +1 -0
  320. package/dist/ripple/p-646e22d3.system.entry.js +1 -0
  321. package/dist/ripple/p-6950e8ed.system.js +1 -0
  322. package/dist/ripple/p-6c6da5db.entry.js +1 -0
  323. package/dist/ripple/p-6d2af8d9.system.entry.js +1 -0
  324. package/dist/ripple/p-6d46f775.system.entry.js +1 -0
  325. package/dist/ripple/p-6de0efee.entry.js +1 -0
  326. package/dist/ripple/p-7833db63.entry.js +1 -0
  327. package/dist/ripple/p-7b7c32af.entry.js +1 -0
  328. package/dist/ripple/p-817aa29c.entry.js +1 -0
  329. package/dist/ripple/p-82c9bd47.entry.js +1 -0
  330. package/dist/ripple/p-8480138d.entry.js +1 -0
  331. package/dist/ripple/p-85ef702d.entry.js +1 -0
  332. package/dist/ripple/p-86bcd942.system.entry.js +1 -0
  333. package/dist/ripple/p-8799bce9.entry.js +1 -0
  334. package/dist/ripple/p-8ac14bb1.system.js +1 -0
  335. package/dist/ripple/p-8dcc8c0c.entry.js +1 -0
  336. package/dist/ripple/p-8fa572a8.entry.js +1 -0
  337. package/dist/ripple/p-904545cc.js +1 -0
  338. package/dist/ripple/p-90cb5d27.system.entry.js +1 -0
  339. package/dist/ripple/p-9202ef69.system.entry.js +1 -0
  340. package/dist/ripple/p-9f971522.system.entry.js +1 -0
  341. package/dist/ripple/p-a5dc49c1.system.entry.js +1 -0
  342. package/dist/ripple/p-a73fb160.system.entry.js +1 -0
  343. package/dist/ripple/p-a9580e7a.system.entry.js +1 -0
  344. package/dist/ripple/p-b04a6351.entry.js +1 -0
  345. package/dist/ripple/p-b09998e1.entry.js +1 -0
  346. package/dist/ripple/p-b3a86ec4.system.entry.js +1 -0
  347. package/dist/ripple/p-b501f06c.entry.js +1 -0
  348. package/dist/ripple/p-b957033b.entry.js +1 -0
  349. package/dist/ripple/p-c2258438.entry.js +1 -0
  350. package/dist/ripple/p-ca3abcc0.system.entry.js +1 -0
  351. package/dist/ripple/p-cc455a6c.system.entry.js +1 -0
  352. package/dist/ripple/p-cda66d45.js +1 -0
  353. package/dist/ripple/p-cde2ca4d.system.entry.js +1 -0
  354. package/dist/ripple/p-cdf9c0e9.entry.js +1 -0
  355. package/dist/ripple/p-d0858afa.js +2 -0
  356. package/dist/ripple/p-d37f8f66.js +1 -0
  357. package/dist/ripple/p-d4ae193e.js +1 -0
  358. package/dist/ripple/p-d4d769a7.system.js +1 -0
  359. package/dist/ripple/p-d6a9000f.system.entry.js +1 -0
  360. package/dist/ripple/p-d6cd9f79.entry.js +1 -0
  361. package/dist/ripple/p-d9e4335e.entry.js +1 -0
  362. package/dist/ripple/p-dadf3ed3.entry.js +1 -0
  363. package/dist/ripple/p-dc3684b5.entry.js +1 -0
  364. package/dist/ripple/p-dca94e24.entry.js +1 -0
  365. package/dist/ripple/p-dcd6acc5.system.entry.js +1 -0
  366. package/dist/ripple/p-dd81e308.entry.js +1 -0
  367. package/dist/ripple/p-e11d9b06.system.entry.js +1 -0
  368. package/dist/ripple/p-e36e71dc.system.entry.js +1 -0
  369. package/dist/ripple/p-e6a81600.entry.js +1 -0
  370. package/dist/ripple/p-ef7d84da.system.entry.js +1 -0
  371. package/dist/ripple/p-f1de3153.entry.js +1 -0
  372. package/dist/ripple/p-f3e84476.system.entry.js +1 -0
  373. package/dist/ripple/p-f4d27fea.system.entry.js +1 -0
  374. package/dist/ripple/p-fcf4bd61.system.entry.js +1 -0
  375. package/dist/ripple/p-fd02c124.entry.js +1 -0
  376. package/dist/ripple/p-ffa20853.entry.js +1 -0
  377. package/dist/ripple/ripple.esm.js +1 -0
  378. package/dist/ripple/ripple.js +127 -0
  379. package/dist/types/components/charts/chartFunctions.d.ts +54 -0
  380. package/dist/types/components/charts/priv-chart-popover/priv-chart-popover.d.ts +35 -0
  381. package/dist/types/components/charts/priv-chart-popover-old/priv-chart-popover-old.d.ts +26 -0
  382. package/dist/types/components/charts/wm-chart/wm-chart-slice.d.ts +11 -0
  383. package/dist/types/components/charts/wm-chart/wm-chart.d.ts +44 -0
  384. package/dist/types/components/charts/wm-chart-bar/wm-chart-bar.d.ts +62 -0
  385. package/dist/types/components/charts/wm-chart-column/wm-chart-column.d.ts +73 -0
  386. package/dist/types/components/charts/wm-chart-legend/wm-chart-legend.d.ts +26 -0
  387. package/dist/types/components/charts/wm-line-chart/wm-line-chart.d.ts +87 -0
  388. package/dist/types/components/charts/wm-progress-monitor/wm-progress-indicator.d.ts +34 -0
  389. package/dist/types/components/charts/wm-progress-monitor/wm-progress-monitor.d.ts +22 -0
  390. package/dist/types/components/charts/wm-progress-monitor/wm-progress-slice.d.ts +10 -0
  391. package/dist/types/components/datepickers/priv-calendar/priv-calendar.d.ts +89 -0
  392. package/dist/types/components/datepickers/wm-date-range.d.ts +73 -0
  393. package/dist/types/components/datepickers/wm-datepicker.d.ts +54 -0
  394. package/dist/types/components/selects/priv-option-list/priv-option-list.d.ts +71 -0
  395. package/dist/types/components/selects/wm-nested-select/wm-nested-select.d.ts +62 -0
  396. package/dist/types/components/selects/wm-optgroup/wm-optgroup.d.ts +21 -0
  397. package/dist/types/components/selects/wm-option/wm-option.d.ts +40 -0
  398. package/dist/types/components/selects/wm-select/wm-select.d.ts +66 -0
  399. package/dist/types/components/wm-action-menu/wm-action-menu.d.ts +54 -40
  400. package/dist/types/components/wm-button/wm-button.d.ts +43 -34
  401. package/dist/types/components/wm-file/wm-file.d.ts +48 -0
  402. package/dist/types/components/wm-file-list/wm-file-list.d.ts +5 -0
  403. package/dist/types/components/wm-flyout/wm-flyout.d.ts +48 -0
  404. package/dist/types/components/wm-input/wm-input.d.ts +50 -28
  405. package/dist/types/components/wm-menuitem/wm-menuitem.d.ts +26 -27
  406. package/dist/types/components/wm-modal/wm-modal-footer.d.ts +12 -13
  407. package/dist/types/components/wm-modal/wm-modal-header.d.ts +8 -10
  408. package/dist/types/components/wm-modal/wm-modal.d.ts +28 -31
  409. package/dist/types/components/wm-modal-pss/wm-modal-pss-footer.d.ts +14 -0
  410. package/dist/types/components/wm-modal-pss/wm-modal-pss-header.d.ts +10 -0
  411. package/dist/types/components/wm-modal-pss/wm-modal-pss.d.ts +35 -0
  412. package/dist/types/components/wm-navigation/wm-navigation-hamburger.d.ts +16 -0
  413. package/dist/types/components/wm-navigation/wm-navigation-item.d.ts +9 -0
  414. package/dist/types/components/wm-navigation/wm-navigation.d.ts +24 -0
  415. package/dist/types/components/wm-navigator/priv-navigator-button/priv-navigator-button.d.ts +6 -7
  416. package/dist/types/components/wm-navigator/priv-navigator-item/priv-navigator-item.d.ts +10 -10
  417. package/dist/types/components/wm-navigator/wm-navigator.d.ts +55 -57
  418. package/dist/types/components/wm-pagination/wm-pagination.d.ts +31 -28
  419. package/dist/types/components/wm-search/wm-search.d.ts +71 -75
  420. package/dist/types/components/wm-snackbar/wm-snackbar.d.ts +27 -28
  421. package/dist/types/components/wm-tabs/wm-tab-item/wm-tab-item.d.ts +30 -31
  422. package/dist/types/components/wm-tabs/wm-tab-list/wm-tab-list.d.ts +32 -48
  423. package/dist/types/components/wm-tabs/wm-tab-panel/wm-tab-panel.d.ts +14 -16
  424. package/dist/types/components/wm-tag-input/wm-tag-input.d.ts +121 -80
  425. package/dist/types/components/wm-tag-input/wm-tag-option/wm-tag-option.d.ts +18 -0
  426. package/dist/types/components/wm-textarea/wm-textarea.d.ts +31 -0
  427. package/dist/types/components/wm-timepicker/wm-timepicker.d.ts +49 -55
  428. package/dist/types/components/wm-toggletip/wm-toggletip.d.ts +36 -23
  429. package/dist/types/components/wm-uploader/wm-uploader.d.ts +64 -72
  430. package/dist/types/components/wm-wrapper/wm-wrapper.d.ts +4 -4
  431. package/dist/types/components.d.ts +1516 -211
  432. package/dist/types/global/__mocks__/functions.d.ts +2 -1
  433. package/dist/types/global/functions.d.ts +67 -11
  434. package/dist/types/global/interfaces.d.ts +152 -23
  435. package/dist/types/global/intl.d.ts +62 -0
  436. package/dist/types/global/services/__mocks__/http-service.d.ts +1 -1
  437. package/dist/types/stencil-public-runtime.d.ts +338 -219
  438. package/package.json +16 -22
  439. package/dist/cjs/app-globals-6b0c6e80.js +0 -110
  440. package/dist/cjs/app-globals-f1dd8fda.js +0 -47
  441. package/dist/cjs/componentlibrary.cjs.js +0 -20
  442. package/dist/cjs/css-shim-a7379e2b.js +0 -6
  443. package/dist/cjs/dom-3e7d9c3b.js +0 -75
  444. package/dist/cjs/functions-65513c61.js +0 -8360
  445. package/dist/cjs/global-6849642d.js +0 -38
  446. package/dist/cjs/http-service-494d81de.js +0 -57
  447. package/dist/cjs/http-service-9e8c4dd5.js +0 -57
  448. package/dist/cjs/index-298ebef1.js +0 -2976
  449. package/dist/cjs/interfaces-a3338581.js +0 -35
  450. package/dist/cjs/interfaces-b2beb752.js +0 -54
  451. package/dist/cjs/priv-chart-popover.cjs.entry.js +0 -89
  452. package/dist/cjs/priv-datepicker.cjs.entry.js +0 -672
  453. package/dist/cjs/shadow-css-09555044.js +0 -391
  454. package/dist/cjs/wm-action-menu.cjs.entry.js +0 -206
  455. package/dist/cjs/wm-menuitem.cjs.entry.js +0 -118
  456. package/dist/cjs/wm-modal-footer.cjs.entry.js +0 -43
  457. package/dist/cjs/wm-modal-header.cjs.entry.js +0 -45
  458. package/dist/cjs/wm-modal.cjs.entry.js +0 -149
  459. package/dist/cjs/wm-network-uploader.cjs.entry.js +0 -431
  460. package/dist/cjs/wm-option.cjs.entry.js +0 -123
  461. package/dist/cjs/wm-select.cjs.entry.js +0 -366
  462. package/dist/cjs/wm-tab-item.cjs.entry.js +0 -82
  463. package/dist/cjs/wm-tab-list.cjs.entry.js +0 -205
  464. package/dist/cjs/wm-tab-panel.cjs.entry.js +0 -42
  465. package/dist/collection/components/wm-chart/priv-chart-popover/priv-chart-popover.css +0 -132
  466. package/dist/collection/components/wm-chart/priv-chart-popover/priv-chart-popover.js +0 -232
  467. package/dist/collection/components/wm-chart/wm-chart-slice.js +0 -64
  468. package/dist/collection/components/wm-chart/wm-chart.css +0 -337
  469. package/dist/collection/components/wm-chart/wm-chart.js +0 -710
  470. package/dist/collection/components/wm-datepicker/priv-datepicker/priv-datepicker.css +0 -365
  471. package/dist/collection/components/wm-datepicker/priv-datepicker/priv-datepicker.js +0 -1003
  472. package/dist/collection/components/wm-datepicker/wm-datepicker.css +0 -211
  473. package/dist/collection/components/wm-datepicker/wm-datepicker.js +0 -445
  474. package/dist/collection/components/wm-option/wm-option.css +0 -162
  475. package/dist/collection/components/wm-option/wm-option.js +0 -394
  476. package/dist/collection/components/wm-select/wm-select.css +0 -315
  477. package/dist/collection/components/wm-select/wm-select.js +0 -676
  478. package/dist/collection/components/wm-uploader/wm-network-uploader/wm-network-uploader.css +0 -642
  479. package/dist/collection/components/wm-uploader/wm-network-uploader/wm-network-uploader.js +0 -753
  480. package/dist/componentlibrary/app-globals-18876ad3.js +0 -45
  481. package/dist/componentlibrary/app-globals-307a1083.js +0 -108
  482. package/dist/componentlibrary/componentlibrary.css +0 -84
  483. package/dist/componentlibrary/componentlibrary.esm.js +0 -1
  484. package/dist/componentlibrary/css-shim-bbdf0cc6.js +0 -4
  485. package/dist/componentlibrary/dom-1f98a75f.js +0 -73
  486. package/dist/componentlibrary/functions-316c1b23.js +0 -8340
  487. package/dist/componentlibrary/http-service-5d037e16.js +0 -52
  488. package/dist/componentlibrary/index-d5997567.js +0 -2938
  489. package/dist/componentlibrary/interfaces-50753346.js +0 -51
  490. package/dist/componentlibrary/p-01bdfed8.js +0 -16
  491. package/dist/componentlibrary/p-0ca70ed4.entry.js +0 -1
  492. package/dist/componentlibrary/p-126bde92.entry.js +0 -1
  493. package/dist/componentlibrary/p-12a67d93.entry.js +0 -1
  494. package/dist/componentlibrary/p-188deaf5.entry.js +0 -1
  495. package/dist/componentlibrary/p-2514df6f.entry.js +0 -1
  496. package/dist/componentlibrary/p-269b8a5f.entry.js +0 -1
  497. package/dist/componentlibrary/p-35e57079.entry.js +0 -1
  498. package/dist/componentlibrary/p-414e20f7.entry.js +0 -1
  499. package/dist/componentlibrary/p-43f1298b.js +0 -1
  500. package/dist/componentlibrary/p-4d387ec6.entry.js +0 -1
  501. package/dist/componentlibrary/p-59ba81d6.entry.js +0 -1
  502. package/dist/componentlibrary/p-5e3cbec8.entry.js +0 -1
  503. package/dist/componentlibrary/p-5e81e830.entry.js +0 -1
  504. package/dist/componentlibrary/p-64ff5040.js +0 -1
  505. package/dist/componentlibrary/p-68a871d3.entry.js +0 -1
  506. package/dist/componentlibrary/p-996a7395.entry.js +0 -1
  507. package/dist/componentlibrary/p-9b460452.entry.js +0 -1
  508. package/dist/componentlibrary/p-a416e410.entry.js +0 -1
  509. package/dist/componentlibrary/p-d550a94f.entry.js +0 -1
  510. package/dist/componentlibrary/p-e4735c23.entry.js +0 -1
  511. package/dist/componentlibrary/p-e725f388.entry.js +0 -1
  512. package/dist/componentlibrary/p-e9532ae5.entry.js +0 -1
  513. package/dist/componentlibrary/p-edf6f848.entry.js +0 -1
  514. package/dist/componentlibrary/p-fd8070fb.js +0 -1
  515. package/dist/componentlibrary/priv-chart-popover.entry.js +0 -85
  516. package/dist/componentlibrary/priv-datepicker.entry.js +0 -668
  517. package/dist/componentlibrary/priv-navigator-button.entry.js +0 -25
  518. package/dist/componentlibrary/priv-navigator-item.entry.js +0 -30
  519. package/dist/componentlibrary/shadow-css-67b66845.js +0 -389
  520. package/dist/componentlibrary/wm-action-menu.entry.js +0 -202
  521. package/dist/componentlibrary/wm-button.entry.js +0 -148
  522. package/dist/componentlibrary/wm-chart-slice.entry.js +0 -18
  523. package/dist/componentlibrary/wm-chart.entry.js +0 -504
  524. package/dist/componentlibrary/wm-datepicker.entry.js +0 -258
  525. package/dist/componentlibrary/wm-input.entry.js +0 -106
  526. package/dist/componentlibrary/wm-menuitem.entry.js +0 -114
  527. package/dist/componentlibrary/wm-modal-footer.entry.js +0 -39
  528. package/dist/componentlibrary/wm-modal-header.entry.js +0 -41
  529. package/dist/componentlibrary/wm-modal.entry.js +0 -145
  530. package/dist/componentlibrary/wm-navigator.entry.js +0 -275
  531. package/dist/componentlibrary/wm-network-uploader.entry.js +0 -427
  532. package/dist/componentlibrary/wm-option.entry.js +0 -119
  533. package/dist/componentlibrary/wm-pagination.entry.js +0 -172
  534. package/dist/componentlibrary/wm-search.entry.js +0 -227
  535. package/dist/componentlibrary/wm-select.entry.js +0 -362
  536. package/dist/componentlibrary/wm-snackbar.entry.js +0 -156
  537. package/dist/componentlibrary/wm-tab-item.entry.js +0 -78
  538. package/dist/componentlibrary/wm-tab-list.entry.js +0 -201
  539. package/dist/componentlibrary/wm-tab-panel.entry.js +0 -38
  540. package/dist/componentlibrary/wm-tag-input.entry.js +0 -509
  541. package/dist/componentlibrary/wm-timepicker.entry.js +0 -382
  542. package/dist/componentlibrary/wm-toggletip.entry.js +0 -124
  543. package/dist/componentlibrary/wm-uploader.entry.js +0 -338
  544. package/dist/componentlibrary/wm-wrapper.entry.js +0 -17
  545. package/dist/esm/app-globals-18876ad3.js +0 -45
  546. package/dist/esm/app-globals-307a1083.js +0 -108
  547. package/dist/esm/componentlibrary.js +0 -18
  548. package/dist/esm/css-shim-bbdf0cc6.js +0 -4
  549. package/dist/esm/dom-1f98a75f.js +0 -73
  550. package/dist/esm/functions-316c1b23.js +0 -8340
  551. package/dist/esm/global-430cb201.js +0 -36
  552. package/dist/esm/http-service-3dc3b3e7.js +0 -52
  553. package/dist/esm/http-service-5d037e16.js +0 -52
  554. package/dist/esm/index-d5997567.js +0 -2938
  555. package/dist/esm/interfaces-2b97fab2.js +0 -32
  556. package/dist/esm/interfaces-50753346.js +0 -51
  557. package/dist/esm/polyfills/css-shim.js +0 -1
  558. package/dist/esm/priv-chart-popover.entry.js +0 -85
  559. package/dist/esm/priv-datepicker.entry.js +0 -668
  560. package/dist/esm/shadow-css-67b66845.js +0 -389
  561. package/dist/esm/wm-action-menu.entry.js +0 -202
  562. package/dist/esm/wm-menuitem.entry.js +0 -114
  563. package/dist/esm/wm-modal-footer.entry.js +0 -39
  564. package/dist/esm/wm-modal-header.entry.js +0 -41
  565. package/dist/esm/wm-modal.entry.js +0 -145
  566. package/dist/esm/wm-network-uploader.entry.js +0 -427
  567. package/dist/esm/wm-option.entry.js +0 -119
  568. package/dist/esm/wm-select.entry.js +0 -362
  569. package/dist/esm/wm-tab-item.entry.js +0 -78
  570. package/dist/esm/wm-tab-list.entry.js +0 -201
  571. package/dist/esm/wm-tab-panel.entry.js +0 -38
  572. package/dist/types/components/wm-chart/priv-chart-popover/priv-chart-popover.d.ts +0 -23
  573. package/dist/types/components/wm-chart/wm-chart-slice.d.ts +0 -8
  574. package/dist/types/components/wm-chart/wm-chart.d.ts +0 -77
  575. package/dist/types/components/wm-datepicker/priv-datepicker/priv-datepicker.d.ts +0 -75
  576. package/dist/types/components/wm-datepicker/wm-datepicker.d.ts +0 -39
  577. package/dist/types/components/wm-option/wm-option.d.ts +0 -28
  578. package/dist/types/components/wm-select/wm-select.d.ts +0 -63
  579. package/dist/types/components/wm-uploader/wm-network-uploader/wm-network-uploader.d.ts +0 -85
  580. /package/dist/{componentlibrary/index.esm.js → collection/dev/button.js} +0 -0
@@ -2,419 +2,901 @@ import * as lang from "../lang/lang";
2
2
  import { createIntl, createIntlCache } from "@formatjs/intl";
3
3
  const DEFAULT_LANGUAGE = "en";
4
4
  function getBrowserLang() {
5
- const langAttr = document.documentElement.getAttribute("lang");
6
- if (!!langAttr) {
7
- return langAttr;
8
- }
9
- else if (window.navigator && window.navigator.language) {
10
- const lang = window.navigator.languages ? window.navigator.languages[0] : window.navigator.language;
11
- return lang.slice(0, 2);
12
- }
13
- else {
14
- return DEFAULT_LANGUAGE;
15
- }
5
+ const langAttr = document.documentElement.getAttribute("lang");
6
+ if (!!langAttr) {
7
+ return langAttr;
8
+ }
9
+ else if (window.navigator && window.navigator.language) {
10
+ const lang = window.navigator.languages ? window.navigator.languages[0] : window.navigator.language;
11
+ return lang.slice(0, 2);
12
+ }
13
+ else {
14
+ return DEFAULT_LANGUAGE;
15
+ }
16
16
  }
17
17
  // prevents memory leak
18
18
  const cache = createIntlCache();
19
19
  const locale = getBrowserLang();
20
20
  export const intl = createIntl({
21
- locale: locale,
22
- defaultLocale: "en",
23
- messages: lang[locale] || lang.en,
21
+ locale: locale,
22
+ defaultLocale: "en",
23
+ messages: lang[locale] || lang.en,
24
24
  }, cache);
25
25
  export function generateId() {
26
- return "wmcl-" + Math.random().toString(36).substr(2, 10);
26
+ return "wmcl-" + Math.random().toString(36).substr(2, 10);
27
27
  }
28
+ // limits how many times a function fires
29
+ // use when the function should run periodically, but not too often (e.g. window resize)
30
+ export function throttle(fn, wait) {
31
+ let timeout;
32
+ let shouldWait = false;
33
+ return function () {
34
+ const context = this;
35
+ if (!shouldWait) {
36
+ fn.apply(context, arguments);
37
+ shouldWait = true;
38
+ clearTimeout(timeout);
39
+ timeout = setTimeout(function () {
40
+ shouldWait = false;
41
+ }, wait);
42
+ }
43
+ };
44
+ }
45
+ // waits until it hasn't been called for [timeout] ms.
46
+ // use when the function should run only after something (event) is done firing
28
47
  export function debounce(fn, wait) {
29
- let timeout;
30
- return function () {
31
- const context = this;
32
- const functionCall = () => fn.apply(context, arguments);
33
- clearTimeout(timeout);
34
- timeout = setTimeout(functionCall, wait);
35
- };
48
+ let timeout;
49
+ return function () {
50
+ const context = this;
51
+ const functionCall = () => fn.apply(context, arguments);
52
+ clearTimeout(timeout);
53
+ timeout = setTimeout(functionCall, wait);
54
+ };
36
55
  }
37
56
  export function getTextDir() {
38
- const dir = document.querySelector("html").getAttribute("dir");
39
- return dir ? dir.toLowerCase() : "";
57
+ const dir = document.querySelector("html").getAttribute("dir");
58
+ return dir ? dir.toLowerCase() : "";
40
59
  }
41
60
  export function getPosition(el) {
42
- const coords = el.getBoundingClientRect();
43
- let x = coords.x;
44
- let y = coords.y;
45
- // Edge doesn't have x and y
46
- if (!x) {
47
- if (getTextDir() === "rtl") {
48
- x = coords.right;
61
+ const coords = el.getBoundingClientRect();
62
+ let x = coords.x;
63
+ let y = coords.y;
64
+ // Edge doesn't have x and y
65
+ if (!x) {
66
+ if (getTextDir() === "rtl") {
67
+ x = coords.right;
68
+ }
69
+ else {
70
+ x = coords.left;
71
+ }
72
+ y = coords.top;
49
73
  }
50
- else {
51
- x = coords.left;
74
+ return { x, y };
75
+ }
76
+ function getParentOrHost(el) {
77
+ // Handle slot traversal - if element is assigned to a slot, go to the slot first
78
+ if (el.assignedSlot) {
79
+ return el.assignedSlot;
52
80
  }
53
- y = coords.top;
54
- }
55
- return { x, y };
81
+ let nextEl = el.parentElement;
82
+ if (!nextEl) {
83
+ // Check if we're at a shadow root boundary
84
+ const rootNode = el.getRootNode();
85
+ if (rootNode instanceof ShadowRoot && rootNode.host) {
86
+ nextEl = rootNode.host;
87
+ }
88
+ }
89
+ return nextEl;
56
90
  }
57
- export function findParentWithScrollbar(el) {
58
- while (!!el) {
59
- if (el.scrollHeight > el.clientHeight && ["scroll", "auto"].includes(window.getComputedStyle(el).overflowY)) {
60
- return el;
91
+ function findPositionedAncestor(el) {
92
+ // Used to find the nearest positioned ancestor of an element (typically absolute or fixed)
93
+ let positionedAncestor = getParentOrHost(el);
94
+ while (positionedAncestor && positionedAncestor !== document.documentElement) {
95
+ const ancestorStyle = window.getComputedStyle(positionedAncestor);
96
+ if (["relative", "absolute", "fixed", "sticky"].includes(ancestorStyle.position)) {
97
+ return positionedAncestor;
98
+ }
99
+ positionedAncestor = getParentOrHost(positionedAncestor);
61
100
  }
62
- el = el.parentElement;
63
- }
101
+ // If no positioned ancestor found, that ancestor is the document element
102
+ return document.documentElement;
103
+ }
104
+ function findPositioningBoundary(el) {
105
+ // Check for positioned elements that create new positioning contexts
106
+ let current = el;
107
+ while (current && current !== document.documentElement) {
108
+ const currentStyle = window.getComputedStyle(current);
109
+ // Elements with position: fixed are positioned relative to viewport
110
+ if (currentStyle.position === "fixed") {
111
+ return current;
112
+ }
113
+ // Elements with position: absolute are positioned relative to nearest positioned ancestor
114
+ if (currentStyle.position === "absolute") {
115
+ return findPositionedAncestor(current);
116
+ }
117
+ current = getParentOrHost(current);
118
+ }
119
+ return null; // No special positioning context found
120
+ }
121
+ export function findAllScrollableParents(el) {
122
+ const scrollableParents = [];
123
+ let currentEl = getParentOrHost(el);
124
+ // Traverse up to and including the document.documentElement (html element)
125
+ while (currentEl) {
126
+ const style = window.getComputedStyle(currentEl);
127
+ if (["scroll", "auto"].includes(style.overflowY) || ["scroll", "auto"].includes(style.overflowX)) {
128
+ scrollableParents.push(currentEl);
129
+ }
130
+ currentEl = getParentOrHost(currentEl);
131
+ }
132
+ if (document.documentElement && !scrollableParents.includes(document.documentElement)) {
133
+ // Check if the document itself is scrollable (common case for page-level scrolling)
134
+ // Special case: document element can scroll even with overflow: visible when content overflows viewport
135
+ const htmlStyle = window.getComputedStyle(document.documentElement);
136
+ if (["scroll", "auto"].includes(htmlStyle.overflowY) ||
137
+ ["scroll", "auto"].includes(htmlStyle.overflowX) ||
138
+ // For document element only: also check if page content can actually scroll
139
+ document.documentElement.scrollHeight > document.documentElement.clientHeight ||
140
+ document.documentElement.scrollWidth > document.documentElement.clientWidth) {
141
+ scrollableParents.push(document.documentElement);
142
+ }
143
+ }
144
+ return scrollableParents;
145
+ }
146
+ export function getCumulativeScrollOffset(el) {
147
+ const scrollableParents = findAllScrollableParents(el);
148
+ let totalScrollX = 0;
149
+ let totalScrollY = 0;
150
+ // Find the positioning context boundary - this determines which scroll offsets are relevant
151
+ const positioningBoundary = findPositioningBoundary(el);
152
+ scrollableParents.forEach((parent) => {
153
+ // Skip scroll offsets from elements outside the positioning boundary, but include the positioning boundary itself
154
+ if (positioningBoundary && parent !== positioningBoundary && !positioningBoundary.contains(parent)) {
155
+ return;
156
+ }
157
+ if (parent === document.documentElement) {
158
+ // For the document element, use window scroll values
159
+ totalScrollX += window.scrollX || window.pageXOffset || 0;
160
+ totalScrollY += window.scrollY || window.pageYOffset || 0;
161
+ }
162
+ else {
163
+ // For regular elements, use scrollLeft/scrollTop
164
+ totalScrollX += parent.scrollLeft;
165
+ totalScrollY += parent.scrollTop;
166
+ }
167
+ });
168
+ return { x: totalScrollX, y: totalScrollY };
64
169
  }
65
170
  export function findParentWithHiddenOverflow(el) {
66
- while (!!el) {
67
- if (window.getComputedStyle(el).overflowY !== "visible") {
68
- return el;
171
+ while (!!el) {
172
+ if (window.getComputedStyle(el).overflowY !== "visible") {
173
+ return el;
174
+ }
175
+ el = getParentOrHost(el);
69
176
  }
70
- el = el.parentElement;
71
- }
177
+ }
178
+ export function isElOrChild(componentEl, el) {
179
+ var _a;
180
+ // determines whether or not the element is the component, a child of the component, or exists within the component's shadowroot
181
+ return el === componentEl || componentEl.contains(el) || ((_a = componentEl.shadowRoot) === null || _a === void 0 ? void 0 : _a.contains(el));
182
+ }
183
+ export function getContextMeasurements(el) {
184
+ const fixedRect = el.getBoundingClientRect();
185
+ const parentEl = findParentWithHiddenOverflow(el);
186
+ const parentRect = parentEl && parentEl.getBoundingClientRect();
187
+ // if parentEl is not found, measurements are checked against the viewport
188
+ return {
189
+ // NB boundingClientRect.bottom is space from top of viewport to bottom of el
190
+ // to get space below the el -> height of viewport minus boundingClientRect.bottom
191
+ spaceAbove: parentRect ? fixedRect.top - parentRect.top : fixedRect.top,
192
+ // NB boundingClientRect.bottom is space from top of viewport to bottom of el
193
+ // to get space below the el -> height of viewport minus boundingClientRect.bottom
194
+ spaceBelow: parentRect
195
+ ? parentRect.bottom - fixedRect.bottom
196
+ : document.documentElement.clientHeight - fixedRect.bottom,
197
+ spaceLeft: parentRect ? fixedRect.left - parentRect.left : fixedRect.left,
198
+ spaceRight: parentRect
199
+ ? parentRect.right - fixedRect.right
200
+ : document.documentElement.clientWidth - fixedRect.right,
201
+ };
72
202
  }
73
203
  export function shouldOpenUp(fixedEl, //the element visible on the page when the component is closed
74
- closableEl, //the dropdown/popup/etc that becomes visible when the component is open
204
+ closableElHeight, //the dropdown/popup/etc that becomes visible when the component is open
75
205
  offsetAbove = 0, // if closableEl covers a part of fixedEl, that part should be offset
76
- offsetBelow = 0 // if closableEl covers a part of fixedEl, that part should be offset
77
- ) {
78
- const closableElHeight = closableEl.clientHeight;
79
- const parent = findParentWithHiddenOverflow(fixedEl);
80
- //if parent is not found, measurements are checked against the viewport
81
- let spaceAbove = parent
82
- ? fixedEl.getBoundingClientRect().top - parent.getBoundingClientRect().top
83
- : fixedEl.getBoundingClientRect().top;
84
- // NB boundingClientRect.bottom is space from top of viewport to bottom of el
85
- // to get space below the el -> height of viewport minus boundingClientRect.bottom
86
- let spaceBelow = parent
87
- ? parent.getBoundingClientRect().bottom - fixedEl.getBoundingClientRect().bottom
88
- : document.documentElement.clientHeight - fixedEl.getBoundingClientRect().bottom;
89
- spaceAbove += offsetAbove;
90
- spaceBelow += offsetBelow;
91
- //we want to open up only if there's not enough space below AND there is enough space above
92
- const openUp = closableElHeight > spaceBelow && closableElHeight <= spaceAbove;
93
- return openUp;
206
+ offsetBelow = 0) {
207
+ const { spaceAbove, spaceBelow } = getContextMeasurements(fixedEl);
208
+ //we want to open up only if there's not enough space below AND there is enough space above
209
+ const openUp = closableElHeight > spaceBelow + offsetBelow && closableElHeight <= spaceAbove + offsetAbove;
210
+ return openUp;
94
211
  }
95
212
  export function shouldOpenDown(fixedEl, //the element visible on the page when the component is closed
96
- closableEl, //the dropdown/popup/etc that becomes visible when the component is open
213
+ closableElHeight, //the dropdown/popup/etc that becomes visible when the component is open
97
214
  offsetAbove = 0, // if closableEl covers a part of fixedEl, that part should be offset
98
- offsetBelow = 0 // if closableEl covers a part of fixedEl, that part should be offset
99
- ) {
100
- const closableElHeight = closableEl.clientHeight;
101
- const parent = findParentWithHiddenOverflow(fixedEl);
102
- //if parent is not found, measurements are checked against the viewport
103
- let spaceAbove = parent
104
- ? fixedEl.getBoundingClientRect().top - parent.getBoundingClientRect().top
105
- : fixedEl.getBoundingClientRect().top;
106
- // NB boundingClientRect.bottom is space from top of viewport to bottom of el
107
- // to get space below the el -> height of viewport minus boundingClientRect.bottom
108
- let spaceBelow = parent
109
- ? parent.getBoundingClientRect().bottom - fixedEl.getBoundingClientRect().bottom
110
- : document.documentElement.clientHeight - fixedEl.getBoundingClientRect().bottom;
111
- spaceAbove += offsetAbove;
112
- spaceBelow += offsetBelow;
113
- //we want to open up only if there's not enough space below AND there is enough space above
114
- const openDown = closableElHeight > spaceAbove && closableElHeight <= spaceBelow;
115
- return openDown;
116
- }
117
- export function shouldShiftRight(fixedEl, closableEl) {
118
- const closableElWidth = closableEl.clientWidth;
119
- const parent = findParentWithHiddenOverflow(fixedEl);
120
- //if parent is not found, measurements are checked against the viewport
121
- const spaceLeft = parent
122
- ? fixedEl.getBoundingClientRect().left - parent.getBoundingClientRect().left
123
- : fixedEl.getBoundingClientRect().left;
124
- const spaceRight = parent
125
- ? parent.getBoundingClientRect().right - fixedEl.getBoundingClientRect().right
126
- : fixedEl.getBoundingClientRect().right;
127
- const needsSpaceLeft = closableElWidth > spaceLeft && spaceRight > spaceLeft;
128
- return needsSpaceLeft;
129
- }
130
- export function shouldShiftLeft(fixedEl, closableEl) {
131
- const closableElWidth = closableEl.clientWidth;
132
- const parent = findParentWithHiddenOverflow(fixedEl);
133
- //if parent is not found, measurements are checked against the viewport
134
- const spaceLeft = parent
135
- ? fixedEl.getBoundingClientRect().left - parent.getBoundingClientRect().left
136
- : fixedEl.getBoundingClientRect().left;
137
- // NB boundingClientRect.right is space from left side of viewport to right of el
138
- // to get space between right side of el and right side of viewport -> width of viewport minus boundingClientRect.right
139
- const spaceRight = parent
140
- ? parent.getBoundingClientRect().right - fixedEl.getBoundingClientRect().right
141
- : document.documentElement.clientWidth - fixedEl.getBoundingClientRect().right;
142
- const needsSpaceRight = closableElWidth > spaceRight && spaceLeft > spaceRight;
143
- return needsSpaceRight;
144
- }
145
- export function adjustTooltipPosition(tPos, el, tooltipEl) {
146
- // Use the value passed as prop (or the default) if possible
147
- // if there's not enough space, flip side
148
- // Vertical
149
- if (tPos.includes("bottom") && shouldOpenUp(el, tooltipEl)) {
150
- tPos = tPos.replace("bottom", "top");
151
- }
152
- else if (tPos.includes("top") && shouldOpenDown(el, tooltipEl)) {
153
- tPos = tPos.replace("top", "bottom");
154
- }
155
- // Horizontal
156
- if (tPos.includes("left") && shouldShiftRight(el, tooltipEl)) {
157
- tPos = tPos.replace("left", "right");
158
- }
159
- else if (tPos.includes("right") && shouldShiftLeft(el, tooltipEl)) {
160
- tPos = tPos.replace("right", "left");
161
- }
162
- return tPos;
163
- }
164
- export function hasRoomRight(x, spaceNeeded) {
165
- let horizOffset = 0;
166
- // if (getTextDir() === "ltr") {
167
- if (x.type === "click") {
168
- // if it's a mouse event, deal with mouse coords
169
- horizOffset = x.clientX;
170
- // if it's a focus event, the offset is 0
171
- }
172
- else if (x.type === "focus") {
173
- horizOffset = 0;
174
- }
175
- else {
176
- // otherwise an element was passed, calculate how far it is from the edge of the window
177
- let el = x; // re-assignment is for clarity
178
- while (el) {
179
- if (el.tagName == "BODY") {
180
- // deal with browser quirks with body/window/document and page scroll
181
- var xScroll = el.scrollLeft || document.documentElement.scrollLeft;
182
- horizOffset += el.offsetLeft - xScroll + el.clientLeft;
183
- }
184
- else {
185
- // for all other non-BODY elements
186
- horizOffset += el.offsetLeft - el.scrollLeft + el.clientLeft;
187
- }
188
- el = el.offsetParent;
189
- }
190
- // }
191
- }
192
- return window.innerWidth - horizOffset >= spaceNeeded;
215
+ offsetBelow = 0) {
216
+ const { spaceAbove, spaceBelow } = getContextMeasurements(fixedEl);
217
+ //we want to open up only if there's not enough space below AND there is enough space above
218
+ const openDown = closableElHeight > spaceAbove + offsetAbove && closableElHeight <= spaceBelow + offsetBelow;
219
+ return openDown;
193
220
  }
194
- export function checkForActiveElInShadow(element) {
195
- while (element && element.shadowRoot) {
196
- element = element.shadowRoot.activeElement;
197
- }
198
- return element;
221
+ export function shouldShiftRight(fixedEl, closableElWidth) {
222
+ const { spaceLeft, spaceRight } = getContextMeasurements(fixedEl);
223
+ const needsSpaceLeft = closableElWidth > spaceLeft && spaceRight > spaceLeft;
224
+ return needsSpaceLeft;
199
225
  }
200
- export function checkForFocusableElInShadow(element) {
201
- const selectors = [
202
- "button",
203
- "a",
204
- "input",
205
- "select",
206
- "textarea",
207
- "wm-button",
208
- "wm-search",
209
- "wm-select",
210
- "wm-action-menu",
211
- "wm-tab-item",
212
- "wm-datepicker",
213
- ];
214
- let focusableEl = element;
215
- selectors.forEach((selector) => {
216
- if (focusableEl && focusableEl.shadowRoot) {
217
- let elInShadow = focusableEl.shadowRoot.querySelector(selector);
218
- if (elInShadow) {
219
- if (selector.startsWith("wm-")) {
220
- focusableEl = checkForFocusableElInShadow(elInShadow);
226
+ export function shouldShiftLeft(fixedEl, closableElWidth) {
227
+ const { spaceLeft, spaceRight } = getContextMeasurements(fixedEl);
228
+ const needsSpaceRight = closableElWidth > spaceRight && spaceLeft > spaceRight;
229
+ return needsSpaceRight;
230
+ }
231
+ export function adjustTooltipPlacement(placement, anchorEl, tooltipHeight, tooltipWidth) {
232
+ const { spaceLeft, spaceRight, spaceBelow, spaceAbove } = getContextMeasurements(anchorEl);
233
+ const enoughSpaceAbove = spaceAbove > tooltipHeight;
234
+ const enoughSpaceBelow = spaceBelow > tooltipHeight;
235
+ // a tooltip should never be closer than 24px to the edge of a screen
236
+ const enoughSpaceLeft = spaceLeft - 24 > tooltipWidth;
237
+ const enoughSpaceRight = spaceRight - 24 > tooltipWidth;
238
+ const swapAbove = (placement) => {
239
+ return !enoughSpaceAbove ? placement.replace("top", "bottom") : placement;
240
+ };
241
+ const swapBelow = (placement) => {
242
+ return !enoughSpaceBelow && enoughSpaceAbove ? placement.replace("bottom", "top") : placement;
243
+ };
244
+ const swapLeft = (placement, centeredPosition) => {
245
+ if (!enoughSpaceLeft && enoughSpaceRight) {
246
+ placement = placement.replace("left", "right");
247
+ }
248
+ else if (!enoughSpaceLeft && !enoughSpaceRight) {
249
+ placement = centeredPosition;
250
+ }
251
+ return placement;
252
+ };
253
+ const swapRight = (placement, centeredPosition) => {
254
+ if (!enoughSpaceRight && enoughSpaceLeft) {
255
+ placement = placement.replace("right", "left");
256
+ }
257
+ else if (!enoughSpaceRight && !enoughSpaceLeft) {
258
+ placement = centeredPosition;
259
+ }
260
+ return placement;
261
+ };
262
+ // horizontal checks must occur before vertical checks, because horizontal can affect vertical placement but not vice versa
263
+ switch (placement) {
264
+ case "left":
265
+ placement = swapLeft(placement, "bottom");
266
+ case "right":
267
+ placement = swapRight(placement, "bottom");
268
+ case "top-left":
269
+ placement = swapLeft(placement, "top");
270
+ placement = swapAbove(placement);
271
+ case "top-right":
272
+ placement = swapRight(placement, "top");
273
+ placement = swapAbove(placement);
274
+ case "bottom-left":
275
+ placement = swapLeft(placement, "bottom");
276
+ placement = swapBelow(placement);
277
+ case "bottom-right":
278
+ placement = swapRight(placement, "bottom");
279
+ placement = swapBelow(placement);
280
+ case "top":
281
+ placement = swapAbove(placement);
282
+ case "bottom":
283
+ placement = swapBelow(placement);
284
+ }
285
+ return placement;
286
+ }
287
+ export function showTooltip(placement, anchorEl, tooltipText) {
288
+ // until popover is supported by firefox, we have to check for and position additional tooltip rendered within the modal's dialog element
289
+ // this additional tooltip is only rendered in browsers that do not support popover
290
+ const tooltipEls = document.querySelectorAll(".wm-tooltip");
291
+ tooltipEls.length > 0 && tooltipEls.forEach((tooltipEl) => {
292
+ if (!!tooltipEl.showPopover && tooltipEl.hasAttribute('popover')) {
293
+ tooltipEl.showPopover();
294
+ }
295
+ tooltipEl.classList.add("show");
296
+ tooltipEl.textContent = tooltipText;
297
+ // tooltip only has a maxWidth if it contains whitespace and can break
298
+ const hasNoWhitespace = tooltipText.match(/^[^\s]+$/);
299
+ if (hasNoWhitespace) {
300
+ tooltipEl.classList.add("single-word");
301
+ tooltipEl.style.setProperty("--wmTooltipMaxWidth", "none");
221
302
  }
222
303
  else {
223
- focusableEl = elInShadow;
304
+ tooltipEl.classList.remove("single-word");
305
+ tooltipEl.style.removeProperty("--wmTooltipMaxWidth");
306
+ }
307
+ const tooltipRect = tooltipEl.getBoundingClientRect();
308
+ const anchorRect = anchorEl.getBoundingClientRect();
309
+ const adjustedPlacement = adjustTooltipPlacement(placement, anchorEl, tooltipRect.height, tooltipRect.width);
310
+ let verticalPos, horizontalPos;
311
+ [verticalPos, horizontalPos] = positionTooltip(adjustedPlacement, anchorRect, tooltipRect.height, tooltipRect.width);
312
+ tooltipEl.style.setProperty("--wmTooltipTop", verticalPos + "px");
313
+ tooltipEl.style.setProperty("--wmTooltipLeft", horizontalPos + "px");
314
+ });
315
+ }
316
+ export function hideTooltip() {
317
+ const tooltipEls = document.querySelectorAll(".wm-tooltip");
318
+ tooltipEls.length > 0 && tooltipEls.forEach((tooltipEl) => {
319
+ if (!!tooltipEl.hidePopover && tooltipEl.hasAttribute('popover')) {
320
+ tooltipEl.hidePopover();
224
321
  }
225
- }
322
+ tooltipEl.classList.remove("show");
323
+ });
324
+ }
325
+ function positionTooltip(placement, anchorRect, tooltipHeight, tooltipWidth) {
326
+ // to get the center positions, calculate the difference between the button width and the tooltip width
327
+ const verticalDiff = (anchorRect.height - tooltipHeight) / 2;
328
+ const horizontalDiff = (anchorRect.width - tooltipWidth) / 2;
329
+ // the naming convention defaults to center in the absence of a value
330
+ // "top" and "bottom" imply centering horizontally; "right" and "left" imply centering vertically
331
+ // therefore we first set to center and adjust accordingly
332
+ let verticalPos = anchorRect.top + verticalDiff;
333
+ let horizontalPos = anchorRect.left + horizontalDiff;
334
+ if (placement.includes("top")) {
335
+ verticalPos = anchorRect.top - tooltipHeight - 8;
336
+ }
337
+ if (placement.includes("bottom")) {
338
+ verticalPos = anchorRect.bottom + 8;
226
339
  }
227
- });
228
- return focusableEl;
340
+ if (placement.includes("left")) {
341
+ horizontalPos = anchorRect.left - tooltipWidth - 8;
342
+ }
343
+ if (placement.includes("right")) {
344
+ horizontalPos = anchorRect.right + 8;
345
+ }
346
+ // after all positioning has been calculated, if tooltip is off-screen or closer than 24px it is readjusted
347
+ // this only occurs when the tooltip is overflowing to the left and is placed top or bottom
348
+ // (button placed too far left, or screen size under 268px)
349
+ horizontalPos = Math.max(horizontalPos, 24);
350
+ return [verticalPos, horizontalPos];
351
+ }
352
+ export function checkForActiveElInShadow(element) {
353
+ while (element && element.shadowRoot) {
354
+ element = element.shadowRoot.activeElement;
355
+ }
356
+ return element;
357
+ }
358
+ export function checkForFocusableElInShadow(element) {
359
+ const selectors = [
360
+ "button",
361
+ "a",
362
+ "input",
363
+ "select",
364
+ "textarea",
365
+ "wm-button",
366
+ "wm-search",
367
+ "wm-select",
368
+ "wm-action-menu",
369
+ "wm-tab-item",
370
+ "wm-datepicker",
371
+ ];
372
+ let focusableEl = element;
373
+ selectors.forEach((selector) => {
374
+ if (focusableEl && focusableEl.shadowRoot) {
375
+ let elInShadow = focusableEl.shadowRoot.querySelector(selector);
376
+ if (elInShadow) {
377
+ if (selector.startsWith("wm-")) {
378
+ focusableEl = checkForFocusableElInShadow(elInShadow);
379
+ }
380
+ else {
381
+ focusableEl = elInShadow;
382
+ }
383
+ }
384
+ }
385
+ });
386
+ return focusableEl;
229
387
  }
230
388
  export function isFocusable(element) {
231
- if (element.tabIndex > 0 || (element.tabIndex === 0 && element.getAttribute("tabIndex") !== null)) {
232
- return true;
233
- }
234
- if (element.disabled) {
235
- return false;
236
- }
237
- switch (element.nodeName) {
238
- case "A":
239
- return !!element.href && element.rel != "ignore";
240
- case "INPUT":
241
- return element.type != "hidden" && element.type != "file";
242
- case "BUTTON":
243
- case "SELECT":
244
- case "TEXTAREA":
245
- case "WM-BUTTON":
246
- case "WM-SELECT":
247
- case "WM-ACTION-MENU":
248
- case "WM-DATEPICKER":
249
- case "WM-TIMEPICKER":
250
- case "WM-INPUT":
251
- case "WM-TAG-INPUT":
252
- case "WM-TAB-ITEM":
253
- case "WM-SEARCH":
254
- return true;
255
- default:
256
- return false;
257
- }
389
+ if (element.tabIndex > 0 || (element.tabIndex === 0 && element.getAttribute("tabIndex") !== null)) {
390
+ return true;
391
+ }
392
+ if (element.disabled) {
393
+ return false;
394
+ }
395
+ switch (element.nodeName) {
396
+ case "A":
397
+ return !!element.href && element.rel != "ignore";
398
+ case "INPUT":
399
+ return element.type != "hidden" && element.type != "file";
400
+ case "BUTTON":
401
+ case "SELECT":
402
+ case "TEXTAREA":
403
+ case "WM-BUTTON":
404
+ case "WM-SELECT":
405
+ case "WM-ACTION-MENU":
406
+ case "WM-DATEPICKER":
407
+ case "WM-TIMEPICKER":
408
+ case "WM-INPUT":
409
+ case "WM-TAG-INPUT":
410
+ case "WM-TAB-ITEM":
411
+ case "WM-SEARCH":
412
+ return true;
413
+ default:
414
+ return false;
415
+ }
258
416
  }
259
417
  export function getFirstFocusableDescendant(element) {
260
- if (isFocusable(element)) {
261
- return checkForFocusableElInShadow(element);
262
- }
263
- else if (element.childNodes.length > 0) {
264
- element.childNodes.forEach((i) => {
265
- const childEl = getFirstFocusableDescendant(i);
266
- return childEl && checkForFocusableElInShadow(childEl);
267
- });
268
- }
269
- }
270
- export function hasValidType(file, types) {
271
- const acceptedExtensions = types.split(" ");
272
- const parts = file.name && file.name.split(".");
273
- const ext = parts && parts.length > 1 && parts[parts.length - 1];
274
- return ext
275
- ? acceptedExtensions.includes(ext.toLowerCase())
276
- : // fallback: if we couldn't obtain an extension,
277
- // validate based on MIME type...
278
- !!file.type
279
- ? getAcceptedMimeTypesList(acceptedExtensions).includes(file.type)
280
- : // ...and if that failed too, accept the file
281
- // as it's preferable to accept an invalid file
282
- // than refusing a valid one (back-end will take care of what slips through)
283
- true;
418
+ if (isFocusable(element)) {
419
+ return checkForFocusableElInShadow(element);
420
+ }
421
+ else if (element.childNodes.length > 0) {
422
+ element.childNodes.forEach((i) => {
423
+ const childEl = getFirstFocusableDescendant(i);
424
+ return childEl && checkForFocusableElInShadow(childEl);
425
+ });
426
+ }
427
+ }
428
+ export function getLastFocusableDescendant(element) {
429
+ if (isFocusable(element)) {
430
+ return checkForFocusableElInShadow(element);
431
+ }
432
+ else if (element.childNodes.length > 0) {
433
+ // Convert to array and reverse to process children from last to first
434
+ const children = Array.from(element.childNodes).reverse();
435
+ return children.reduce((focusable, child) => {
436
+ if (focusable)
437
+ return focusable;
438
+ const childEl = getLastFocusableDescendant(child);
439
+ return childEl ? checkForFocusableElInShadow(childEl) : null;
440
+ }, null);
441
+ }
442
+ return null;
284
443
  }
285
444
  // takes a string (space separated list of extensions), returns an array of strings (corresponding MIME types)
286
445
  export function getAcceptedMimeTypesList(acceptedExtensions) {
287
- // this is just a list of common file types (regardless of whether they are/can be valid or not)
288
- // front end checks are just a convenience to users, independent of security.
289
- // it allows users to be notified of an invalid type as soon as they select the file, rather than when it gets uploaded
290
- const lookupTable = {
291
- aac: ["audio/aac"],
292
- abw: ["application/x-abiword"],
293
- arc: ["application/x-freearc"],
294
- avi: ["video/x-msvideo"],
295
- azw: ["application/vnd.amazon.ebook"],
296
- bin: ["application/octet-stream"],
297
- bmp: ["image/bmp"],
298
- bz: ["application/x-bzip"],
299
- bz2: ["application/x-bzip2"],
300
- csh: ["application/x-csh"],
301
- css: ["text/css"],
302
- csv: ["text/csv"],
303
- doc: ["application/msword"],
304
- docx: ["application/vnd.openxmlformats-officedocument.wordprocessingml.document"],
305
- eot: ["application/vnd.ms-fontobject"],
306
- epub: ["application/epub+zip"],
307
- gz: ["application/gzip"],
308
- gif: ["image/gif"],
309
- htm: ["text/html"],
310
- html: ["text/html"],
311
- ico: ["image/vnd.microsoft.icon"],
312
- ics: ["text/calendar"],
313
- jar: ["application/java-archive"],
314
- jpeg: ["image/jpeg"],
315
- jpg: ["image/jpeg"],
316
- js: ["text/javascript"],
317
- json: ["application/json"],
318
- jsonld: ["application/ld+json"],
319
- log: ["text/plain"],
320
- mid: ["audio/x-midi"],
321
- midi: ["audio/x-midi"],
322
- mjs: ["text/javascript"],
323
- mp3: ["audio/mpeg"],
324
- mpeg: ["video/mpeg"],
325
- mpkg: ["application/vnd.apple.installer+xml"],
326
- odp: ["application/vnd.oasis.opendocument.presentation"],
327
- ods: ["application/vnd.oasis.opendocument.spreadsheet"],
328
- odt: ["application/vnd.oasis.opendocument.text"],
329
- oga: ["audio/ogg"],
330
- ogv: ["video/ogg"],
331
- ogx: ["application/ogg"],
332
- opus: ["audio/opus"],
333
- otf: ["font/otf"],
334
- png: ["image/png"],
335
- pdf: ["application/pdf"],
336
- php: ["application/php"],
337
- ppt: ["application/vnd.ms-powerpoint"],
338
- pptx: ["application/vnd.openxmlformats-officedocument.presentationml.presentation"],
339
- rar: ["application/vnd.rar", "application/x-rar", "application/x-rar-compressed"],
340
- rtf: ["application/rtf"],
341
- sh: ["application/x-sh"],
342
- svg: ["image/svg+xml"],
343
- swf: ["application/x-shockwave-flash"],
344
- tar: ["application/x-tar"],
345
- tif: ["image/tiff"],
346
- tiff: ["image/tiff"],
347
- ts: ["video/mp2t"],
348
- ttf: ["font/ttf"],
349
- txt: ["text/plain"],
350
- vsd: ["application/vnd.visio"],
351
- wav: ["audio/wav"],
352
- weba: ["audio/webm"],
353
- webm: ["video/webm"],
354
- webp: ["image/webp"],
355
- woff: ["font/woff"],
356
- woff2: ["font/woff2"],
357
- xhtml: ["application/xhtml+xml"],
358
- xls: ["application/vnd.ms-excel"],
359
- xlsx: ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],
360
- xml: ["application/xml", "text/xml"],
361
- xul: ["application/vnd.mozilla.xul+xml"],
362
- zip: ["application/zip", "application/x-zip-compressed", "multipart/x-zip"],
363
- "3gp": ["video/3gpp", "audio/3gpp"],
364
- "3g2": ["video/3gpp2", "audio/3gpp2"],
365
- "7z": ["application/x-7z-compressed"],
366
- };
367
- return acceptedExtensions.reduce((acc, ext) => acc.concat(lookupTable[ext]), []);
446
+ // this is just a list of common file types (regardless of whether they are/can be valid or not)
447
+ // front end checks are just a convenience to users, independent of security.
448
+ // it allows users to be notified of an invalid type as soon as they select the file, rather than when it gets uploaded
449
+ const lookupTable = {
450
+ aac: ["audio/aac"],
451
+ abw: ["application/x-abiword"],
452
+ arc: ["application/x-freearc"],
453
+ avi: ["video/x-msvideo"],
454
+ azw: ["application/vnd.amazon.ebook"],
455
+ bin: ["application/octet-stream"],
456
+ bmp: ["image/bmp"],
457
+ bz: ["application/x-bzip"],
458
+ bz2: ["application/x-bzip2"],
459
+ csh: ["application/x-csh"],
460
+ css: ["text/css"],
461
+ csv: ["text/csv"],
462
+ doc: ["application/msword"],
463
+ docx: ["application/vnd.openxmlformats-officedocument.wordprocessingml.document"],
464
+ eot: ["application/vnd.ms-fontobject"],
465
+ epub: ["application/epub+zip"],
466
+ gz: ["application/gzip"],
467
+ gif: ["image/gif"],
468
+ htm: ["text/html"],
469
+ html: ["text/html"],
470
+ ico: ["image/vnd.microsoft.icon"],
471
+ ics: ["text/calendar"],
472
+ jar: ["application/java-archive"],
473
+ jpeg: ["image/jpeg"],
474
+ jpg: ["image/jpeg"],
475
+ js: ["text/javascript"],
476
+ json: ["application/json"],
477
+ jsonld: ["application/ld+json"],
478
+ log: ["text/plain"],
479
+ mid: ["audio/x-midi"],
480
+ midi: ["audio/x-midi"],
481
+ mjs: ["text/javascript"],
482
+ mp3: ["audio/mpeg"],
483
+ mpeg: ["video/mpeg"],
484
+ mpkg: ["application/vnd.apple.installer+xml"],
485
+ odp: ["application/vnd.oasis.opendocument.presentation"],
486
+ ods: ["application/vnd.oasis.opendocument.spreadsheet"],
487
+ odt: ["application/vnd.oasis.opendocument.text"],
488
+ oga: ["audio/ogg"],
489
+ ogv: ["video/ogg"],
490
+ ogx: ["application/ogg"],
491
+ opus: ["audio/opus"],
492
+ otf: ["font/otf"],
493
+ png: ["image/png"],
494
+ pdf: ["application/pdf"],
495
+ php: ["application/php"],
496
+ ppt: ["application/vnd.ms-powerpoint"],
497
+ pptx: ["application/vnd.openxmlformats-officedocument.presentationml.presentation"],
498
+ rar: ["application/vnd.rar", "application/x-rar", "application/x-rar-compressed"],
499
+ rtf: ["application/rtf"],
500
+ sh: ["application/x-sh"],
501
+ svg: ["image/svg+xml"],
502
+ swf: ["application/x-shockwave-flash"],
503
+ tar: ["application/x-tar"],
504
+ tif: ["image/tiff"],
505
+ tiff: ["image/tiff"],
506
+ ts: ["video/mp2t"],
507
+ ttf: ["font/ttf"],
508
+ txt: ["text/plain"],
509
+ vsd: ["application/vnd.visio"],
510
+ wav: ["audio/wav"],
511
+ weba: ["audio/webm"],
512
+ webm: ["video/webm"],
513
+ webp: ["image/webp"],
514
+ woff: ["font/woff"],
515
+ woff2: ["font/woff2"],
516
+ xhtml: ["application/xhtml+xml"],
517
+ xls: ["application/vnd.ms-excel"],
518
+ xlsx: ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],
519
+ xml: ["application/xml", "text/xml"],
520
+ xul: ["application/vnd.mozilla.xul+xml"],
521
+ zip: ["application/zip", "application/x-zip-compressed", "multipart/x-zip"],
522
+ "3gp": ["video/3gpp", "audio/3gpp"],
523
+ "3g2": ["video/3gpp2", "audio/3gpp2"],
524
+ "7z": ["application/x-7z-compressed"],
525
+ };
526
+ return acceptedExtensions.reduce((acc, ext) => acc.concat(lookupTable[ext]), []);
368
527
  }
369
528
  export function snakeCaseToCamelCase(str) {
370
- const snakeCaseRegexp = /^([a-z0-9]*)(_[a-z0-9]*)*$/g;
371
- if (snakeCaseRegexp.test(str)) {
372
- let camelCase = "";
373
- let arr = str.split("_");
374
- arr.forEach((word, idx) => {
375
- camelCase += idx === 0 ? word.toLowerCase() : word.charAt(0).toUpperCase() + word.slice(1);
376
- });
377
- return camelCase;
378
- }
379
- else {
380
- return str;
381
- }
529
+ const snakeCaseRegexp = /^([a-z0-9]*)(_[a-z0-9]*)*$/g;
530
+ if (snakeCaseRegexp.test(str)) {
531
+ let camelCase = "";
532
+ let arr = str.split("_");
533
+ arr.forEach((word, idx) => {
534
+ camelCase += idx === 0 ? word.toLowerCase() : word.charAt(0).toUpperCase() + word.slice(1);
535
+ });
536
+ return camelCase;
537
+ }
538
+ else {
539
+ return str;
540
+ }
541
+ }
542
+ export function csvToArray(csv) {
543
+ return csv ? csv.split(/, ?/) : [];
382
544
  }
383
545
  export function getNewIndexToFocus(currentIndex, direction, listLength) {
384
- let newIndex = currentIndex;
385
- if (direction === "ArrowDown") {
386
- newIndex = (currentIndex + 1) % listLength;
387
- }
388
- if (direction === "ArrowUp") {
389
- newIndex = currentIndex === 0 ? listLength - 1 : currentIndex - 1;
390
- }
391
- return newIndex;
546
+ let newIndex = currentIndex;
547
+ if (direction === "ArrowDown") {
548
+ newIndex = (currentIndex + 1) % listLength;
549
+ }
550
+ if (direction === "ArrowUp") {
551
+ newIndex = currentIndex === 0 ? listLength - 1 : currentIndex - 1;
552
+ }
553
+ return newIndex;
392
554
  }
393
555
  export function isRelatedTarget(ev, id) {
394
- // used for onBlur events to check the element that has been clicked
395
- const ids = id.split(" ");
396
- return ev.relatedTarget && ids.includes(ev.relatedTarget.id);
397
- }
398
- /*
399
- * this is going to be needed to solve the extra tabbing on navigator
400
- * and for programmatic focus of tabs
401
- * Here's a draft, not bug proof, see:
402
- * https://stackoverflow.com/a/10730308/3741713
403
-
404
- function getKeyboardFocusableElements(element = document) {
405
- const els = Array.from(element.querySelectorAll('a, button, input, textarea, select, details, [tabindex]:not([tabindex="-1"]), wm-search, wm-timepicker, wm-tab-list, wm-tab-item, wm-button, wm-action-menu'));
406
- return els.filter((el: Element) => !el.hasAttribute("disabled")) as HTMLElement[];
407
- }
408
-
409
- export function getPreviousKeyboardFocusableElement(element: HTMLElement) {
410
- const els = getKeyboardFocusableElements();
411
- const current = els.indexOf(element);
412
- return els[current - 1] as HTMLElement;
413
- }
414
-
415
- export function getNextKeyboardFocusableElement(element: HTMLElement) {
416
- const els = getKeyboardFocusableElements();
417
- const current = els.indexOf(element);
418
- return els[current + 1] as HTMLElement;
419
- }
420
- */
556
+ // used for onBlur events to check the element that has been clicked
557
+ const ids = id.split(" ");
558
+ return ev.relatedTarget && ids.includes(ev.relatedTarget.id);
559
+ }
560
+ export function toBool(val) {
561
+ // string "false" needs to be treated as bool False because react wrappers convert bool to string.
562
+ return val == "false" ? false : !!val;
563
+ }
564
+ export function measureText(originEl, placeholderText) {
565
+ const measurementEl = document.createElement("div");
566
+ const originStyles = getComputedStyle(originEl);
567
+ measurementEl.style.position = "absolute";
568
+ measurementEl.style.top = "-100vh";
569
+ measurementEl.style.fontFamily = originStyles.fontFamily;
570
+ measurementEl.style.fontWeight = originStyles.fontWeight;
571
+ measurementEl.style.fontSize = originStyles.fontSize;
572
+ measurementEl.textContent = placeholderText;
573
+ document.body.appendChild(measurementEl);
574
+ const boundingClientRect = measurementEl.getBoundingClientRect();
575
+ document.body.removeChild(measurementEl);
576
+ return boundingClientRect;
577
+ }
578
+ export function truncateText(textEl, text, availableSpace, endAmt) {
579
+ const cloneEl = document.createElement("div");
580
+ cloneEl.style.visibility = "hidden";
581
+ cloneEl.style.position = "absolute";
582
+ cloneEl.style.top = "-200vh";
583
+ cloneEl.style.left = "-200vh";
584
+ cloneEl.textContent = text;
585
+ textEl.appendChild(cloneEl);
586
+ const ellipses = "...";
587
+ const minimumLength = 2 + ellipses.length + endAmt;
588
+ let canFitText = availableSpace > cloneEl.clientWidth;
589
+ if (!canFitText && text.length > minimumLength) {
590
+ let frontChars = text.slice(0, text.length - endAmt - ellipses.length).trim();
591
+ let endChars = text.slice(-endAmt).trim();
592
+ let truncatedText = frontChars + ellipses + endChars;
593
+ cloneEl.textContent = truncatedText;
594
+ canFitText = availableSpace > cloneEl.clientWidth;
595
+ while (!canFitText && truncatedText.length > minimumLength) {
596
+ frontChars = frontChars.slice(0, -1).trim();
597
+ truncatedText = frontChars + ellipses + endChars;
598
+ cloneEl.textContent = truncatedText;
599
+ canFitText = availableSpace > cloneEl.clientWidth;
600
+ }
601
+ }
602
+ const truncatedText = cloneEl.textContent;
603
+ cloneEl.remove();
604
+ return truncatedText;
605
+ }
606
+ export function transposeMatrix(originalMatrix) {
607
+ let newMatrix = [];
608
+ for (let i = 0; i < originalMatrix[0].length; i++) {
609
+ let column = [];
610
+ for (let j = 0; j < originalMatrix.length; j++) {
611
+ column.push(originalMatrix[j][i]);
612
+ }
613
+ newMatrix.push(column);
614
+ }
615
+ return newMatrix;
616
+ }
617
+ // wrap around includes 0, so it won't work for something like dates (wrapping around months)
618
+ export function wrapAround(currentIdx, step, endIdx) {
619
+ currentIdx += step;
620
+ if (currentIdx > endIdx) {
621
+ currentIdx = (currentIdx - 1) % endIdx;
622
+ }
623
+ while (currentIdx < 0) {
624
+ currentIdx = endIdx - Math.abs(currentIdx) + 1;
625
+ }
626
+ return currentIdx;
627
+ }
628
+ export function skipByInterval(list, skipInterval) {
629
+ let skippedList = [];
630
+ for (let i = 0; i < list.length; i += 1 + skipInterval) {
631
+ skippedList.push(list[i]);
632
+ }
633
+ return skippedList;
634
+ }
635
+ export function getSmallestSkipInterval(list, maxLength) {
636
+ let skipInterval = 0;
637
+ let skippedList = list;
638
+ while (skipByInterval(list, skipInterval).length > maxLength) {
639
+ skipInterval++;
640
+ skippedList = skipByInterval(list, skipInterval);
641
+ }
642
+ return { skipInterval: skipInterval, skippedList: skippedList };
643
+ }
644
+ export function calcPercentageInRange(value, rangeLowest, rangeHighest) {
645
+ const rangeDistance = rangeHighest - rangeLowest;
646
+ const adjustedValue = Math.abs(value - rangeLowest);
647
+ const percentage = (adjustedValue / rangeDistance) * 100;
648
+ return percentage;
649
+ }
650
+ export function triggerFormSubmit(formEl) {
651
+ // requestSubmit is not supported by Safari v<16, use a polyfill for this
652
+ if (formEl.requestSubmit) {
653
+ formEl.requestSubmit();
654
+ }
655
+ else {
656
+ const submitButton = document.createElement("button");
657
+ submitButton.style.display = "none";
658
+ formEl.appendChild(submitButton);
659
+ submitButton.click();
660
+ document.removeChild(submitButton);
661
+ }
662
+ }
663
+ export function handleDisabledAttribute(el, isDisabled) {
664
+ if (isDisabled == false && el.hasAttribute("disabled")) {
665
+ el.removeAttribute("disabled");
666
+ }
667
+ }
668
+ // get the prev/next element with an option to circle through the list
669
+ export function findPrev(list, item, loop = false) {
670
+ if (!!list && !item)
671
+ return list[list.length - 1]; // if list was passed but no item, get the last item
672
+ if (!list.includes(item))
673
+ return; // if list is empty or doesn't include item
674
+ let current = list.indexOf(item);
675
+ let beforeFirst = loop ? list.length - 1 : 0; // before first item can be first (hard stop) or back to last
676
+ let prev = current > 0 ? current - 1 : beforeFirst;
677
+ return list[prev];
678
+ }
679
+ export function findNext(list, item, loop = false) {
680
+ if (!!list && !item)
681
+ return list[0]; // if list was passed but no item, get the first item
682
+ if (!list.includes(item))
683
+ return; // if list is empty or doesn't include item
684
+ let current = list.indexOf(item);
685
+ const last = list.length - 1;
686
+ let afterLast = loop ? 0 : last; // after last item can be last (hard stop) or back to first
687
+ let next = current !== last ? current + 1 : afterLast;
688
+ return list[next];
689
+ }
690
+ export function safeMultiplyFloat(factor1, factor2) {
691
+ // There can be floating point precision errors when multiplying floats.
692
+ // For example 0.2 * 3 will result in 0.6000000000000001 instead of the expected 0.6
693
+ const factor1DecimalCount = countDecimals(factor1);
694
+ const factor2DecimalCount = countDecimals(factor2);
695
+ const expectedDecimals = factor1DecimalCount + factor2DecimalCount;
696
+ return parseFloat((factor1 * factor2).toFixed(expectedDecimals));
697
+ }
698
+ function countDecimals(num) {
699
+ const asString = num.toString();
700
+ const decimalPointIndex = asString.indexOf(".");
701
+ if (decimalPointIndex == -1) {
702
+ return 0;
703
+ }
704
+ else {
705
+ return asString.split(".")[1].length;
706
+ }
707
+ }
708
+ export function getMonthLength(month, year) {
709
+ const months30 = [4, 6, 9, 11];
710
+ const leapYear = year % 4 === 0;
711
+ return month === 2 ? (leapYear ? 29 : 28) : months30.includes(month) ? 30 : 31;
712
+ }
713
+ export function dateToISO(date) {
714
+ return `${date.getUTCFullYear()}-${(date.getUTCMonth() + 1).toString().padStart(2, "0")}-${date
715
+ .getDate()
716
+ .toString()
717
+ .padStart(2, "0")}`;
718
+ }
719
+ export function clampDate(isoDate) {
720
+ // clamp the day to the maximum number of days in the month
721
+ const y = dateFind.year.asInt(isoDate);
722
+ const m = dateFind.month.asInt(isoDate);
723
+ const d = dateFind.day.asInt(isoDate);
724
+ const maxDays = getMonthLength(m, y);
725
+ const clampedDay = Math.min(d, maxDays);
726
+ return makeISO(y, m, clampedDay);
727
+ }
728
+ function splitISO(isoDate) {
729
+ const [year, month, day] = isoDate.split("-");
730
+ return {
731
+ year: { asInt: parseInt(year), asString: year },
732
+ month: { asInt: parseInt(month), asString: month },
733
+ day: { asInt: parseInt(day), asString: day },
734
+ };
735
+ }
736
+ export function makeISO(y, m, d) {
737
+ return `${y}-${m.toString().padStart(2, "0")}-${d.toString().padStart(2, "0")}`;
738
+ }
739
+ export const dateFind = {
740
+ year: {
741
+ asString: (date) => splitISO(date).year.asString,
742
+ asInt: (date) => splitISO(date).year.asInt,
743
+ increase: (date, n) => {
744
+ const _date = splitISO(date);
745
+ const y = _date.year.asInt;
746
+ const m = _date.month.asInt;
747
+ const d = _date.day.asInt;
748
+ return makeISO(y + n, m, d);
749
+ },
750
+ decrease: (date, n) => {
751
+ const _date = splitISO(date);
752
+ const y = _date.year.asInt;
753
+ const m = _date.month.asInt;
754
+ const d = _date.day.asInt;
755
+ return makeISO(y - n, m, d);
756
+ },
757
+ },
758
+ month: {
759
+ asString: (date) => splitISO(date).month.asString,
760
+ asInt: (date) => splitISO(date).month.asInt,
761
+ increase: (date, n) => {
762
+ const _date = splitISO(date);
763
+ const yearsToAdd = Math.floor(n / 12);
764
+ const monthsToAdd = n % 12;
765
+ let y = _date.year.asInt;
766
+ let m = _date.month.asInt;
767
+ const d = _date.day.asInt;
768
+ y = m + monthsToAdd > 12 ? y + 1 : y;
769
+ y = y + yearsToAdd;
770
+ m = m + monthsToAdd;
771
+ // modulo requires zero-indexing
772
+ m = ((m - 1) % 12) + 1;
773
+ return makeISO(y, m, d);
774
+ },
775
+ decrease: (date, n) => {
776
+ const _date = splitISO(date);
777
+ const yearsToRemove = Math.floor(n / 12);
778
+ const monthsToRemove = n % 12;
779
+ let y = _date.year.asInt;
780
+ let m = _date.month.asInt;
781
+ const d = _date.day.asInt;
782
+ y = m - monthsToRemove < 1 ? y - 1 : y;
783
+ y = y - yearsToRemove;
784
+ // ensure no negative value by shifting up
785
+ m = m + 12;
786
+ m = m - monthsToRemove;
787
+ // modulo needs zero-indexing
788
+ m = ((m - 1) % 12) + 1;
789
+ return makeISO(y, m, d);
790
+ },
791
+ },
792
+ day: {
793
+ asString: (date) => splitISO(date).day.asString,
794
+ asInt: (date) => splitISO(date).day.asInt,
795
+ increase: (date, n) => {
796
+ if (n > 7)
797
+ throw new Error("this.dateFind.day.increase(): max 7 days");
798
+ const _date = splitISO(date);
799
+ let y = _date.year.asInt;
800
+ let m = _date.month.asInt;
801
+ let d = _date.day.asInt;
802
+ const maxDays = getMonthLength(m, y);
803
+ const goesToNextMonth = d + n > maxDays;
804
+ const goesToNextYear = goesToNextMonth && m === 12;
805
+ m = goesToNextMonth ? (goesToNextYear ? 1 : m + 1) : m;
806
+ y = goesToNextYear ? y + 1 : y;
807
+ d = ((d - 1 + n) % maxDays) + 1;
808
+ return makeISO(y, m, d);
809
+ },
810
+ decrease: (date, n) => {
811
+ if (n > 7)
812
+ throw new Error("this.dateFind.day.decrease(): max 7 days");
813
+ const _date = splitISO(date);
814
+ let y = _date.year.asInt;
815
+ let m = _date.month.asInt;
816
+ let d = _date.day.asInt;
817
+ const prevMonth = m === 1 ? 12 : m - 1;
818
+ const maxDays = getMonthLength(prevMonth, y);
819
+ const goesToPreviousMonth = d - n < 1;
820
+ const goesToPreviousYear = goesToPreviousMonth && m === 1;
821
+ // ensure no negative value by shifting up
822
+ d = d + maxDays;
823
+ d = d - n;
824
+ // modulo needs zero-indexing
825
+ d = ((d - 1) % maxDays) + 1;
826
+ m = goesToPreviousMonth ? (goesToPreviousYear ? 12 : m - 1) : m;
827
+ y = goesToPreviousYear ? y - 1 : y;
828
+ return makeISO(y, m, d);
829
+ },
830
+ },
831
+ };
832
+ export const calendar_months = [
833
+ intl.formatMessage({
834
+ id: "date.january",
835
+ defaultMessage: "January",
836
+ description: "Month of the year",
837
+ }),
838
+ intl.formatMessage({
839
+ id: "date.february",
840
+ defaultMessage: "February",
841
+ description: "Month of the year",
842
+ }),
843
+ intl.formatMessage({
844
+ id: "date.march",
845
+ defaultMessage: "March",
846
+ description: "Month of the year",
847
+ }),
848
+ intl.formatMessage({
849
+ id: "date.april",
850
+ defaultMessage: "April",
851
+ description: "Month of the year",
852
+ }),
853
+ intl.formatMessage({
854
+ id: "date.may",
855
+ defaultMessage: "May",
856
+ description: "Month of the year",
857
+ }),
858
+ intl.formatMessage({
859
+ id: "date.june",
860
+ defaultMessage: "June",
861
+ description: "Month of the year",
862
+ }),
863
+ intl.formatMessage({
864
+ id: "date.july",
865
+ defaultMessage: "July",
866
+ description: "Month of the year",
867
+ }),
868
+ intl.formatMessage({
869
+ id: "date.august",
870
+ defaultMessage: "August",
871
+ description: "Month of the year",
872
+ }),
873
+ intl.formatMessage({
874
+ id: "date.september",
875
+ defaultMessage: "September",
876
+ description: "Month of the year",
877
+ }),
878
+ intl.formatMessage({
879
+ id: "date.october",
880
+ defaultMessage: "October",
881
+ description: "Month of the year",
882
+ }),
883
+ intl.formatMessage({
884
+ id: "date.november",
885
+ defaultMessage: "November",
886
+ description: "Month of the year",
887
+ }),
888
+ intl.formatMessage({
889
+ id: "date.december",
890
+ defaultMessage: "December",
891
+ description: "Month of the year",
892
+ }),
893
+ ];
894
+ export const weekdays = [
895
+ intl.formatMessage({ id: "date.sunday", defaultMessage: "Sunday" }),
896
+ intl.formatMessage({ id: "date.monday", defaultMessage: "Monday" }),
897
+ intl.formatMessage({ id: "date.tuesday", defaultMessage: "Tuesday" }),
898
+ intl.formatMessage({ id: "date.wednesday", defaultMessage: "Wednesday" }),
899
+ intl.formatMessage({ id: "date.thursday", defaultMessage: "Thursday" }),
900
+ intl.formatMessage({ id: "date.friday", defaultMessage: "Friday" }),
901
+ intl.formatMessage({ id: "date.saturday", defaultMessage: "Saturday" }),
902
+ ];