@watermarkinsights/ripple 3.0.1-0 → 3.0.2-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 (224) hide show
  1. package/dist/{ripple/functions-316c1b23.js → cjs/functions-e3f5ae65.js} +188 -2391
  2. package/dist/cjs/global-1e540de6.js +38 -0
  3. package/dist/cjs/http-service-9e8c4dd5.js +57 -0
  4. package/dist/cjs/index-d930307d.js +1392 -0
  5. package/dist/cjs/index.cjs.js +2 -0
  6. package/dist/cjs/interfaces-30a74c1f.js +35 -0
  7. package/dist/cjs/loader.cjs.js +22 -0
  8. package/dist/cjs/priv-chart-popover.cjs.entry.js +89 -0
  9. package/dist/cjs/priv-datepicker.cjs.entry.js +672 -0
  10. package/dist/cjs/priv-navigator-button.cjs.entry.js +29 -0
  11. package/dist/cjs/priv-navigator-item.cjs.entry.js +34 -0
  12. package/dist/cjs/ripple.cjs.js +20 -0
  13. package/dist/cjs/wm-action-menu_2.cjs.entry.js +318 -0
  14. package/dist/cjs/wm-button.cjs.entry.js +152 -0
  15. package/dist/cjs/wm-chart-slice.cjs.entry.js +22 -0
  16. package/dist/cjs/wm-chart.cjs.entry.js +508 -0
  17. package/dist/cjs/wm-datepicker.cjs.entry.js +257 -0
  18. package/dist/cjs/wm-input.cjs.entry.js +110 -0
  19. package/dist/cjs/wm-modal-footer.cjs.entry.js +43 -0
  20. package/dist/cjs/wm-modal-header.cjs.entry.js +45 -0
  21. package/dist/cjs/wm-modal.cjs.entry.js +149 -0
  22. package/dist/cjs/wm-navigator.cjs.entry.js +279 -0
  23. package/dist/cjs/wm-network-uploader.cjs.entry.js +431 -0
  24. package/dist/cjs/wm-option_2.cjs.entry.js +483 -0
  25. package/dist/cjs/wm-pagination.cjs.entry.js +176 -0
  26. package/dist/cjs/wm-search.cjs.entry.js +231 -0
  27. package/dist/cjs/wm-snackbar.cjs.entry.js +160 -0
  28. package/dist/cjs/wm-tab-item_3.cjs.entry.js +316 -0
  29. package/dist/cjs/wm-tag-input.cjs.entry.js +538 -0
  30. package/dist/cjs/wm-timepicker.cjs.entry.js +386 -0
  31. package/dist/cjs/wm-toggletip.cjs.entry.js +128 -0
  32. package/dist/cjs/wm-uploader.cjs.entry.js +342 -0
  33. package/dist/cjs/wm-wrapper.cjs.entry.js +21 -0
  34. package/dist/collection/collection-manifest.json +131 -0
  35. package/dist/{ripple/ripple.css → collection/components/wm-action-menu/wm-action-menu.css} +80 -42
  36. package/dist/collection/components/wm-action-menu/wm-action-menu.js +392 -0
  37. package/dist/collection/components/wm-button/wm-button.css +572 -0
  38. package/dist/collection/components/wm-button/wm-button.js +365 -0
  39. package/dist/collection/components/wm-chart/priv-chart-popover/priv-chart-popover.css +132 -0
  40. package/dist/collection/components/wm-chart/priv-chart-popover/priv-chart-popover.js +232 -0
  41. package/dist/collection/components/wm-chart/wm-chart-slice.js +64 -0
  42. package/dist/collection/components/wm-chart/wm-chart.css +337 -0
  43. package/dist/collection/components/wm-chart/wm-chart.js +710 -0
  44. package/dist/collection/components/wm-datepicker/priv-datepicker/priv-datepicker.css +374 -0
  45. package/dist/collection/components/wm-datepicker/priv-datepicker/priv-datepicker.js +1003 -0
  46. package/dist/collection/components/wm-datepicker/wm-datepicker.css +211 -0
  47. package/dist/collection/components/wm-datepicker/wm-datepicker.js +439 -0
  48. package/dist/collection/components/wm-input/wm-input.css +220 -0
  49. package/dist/collection/components/wm-input/wm-input.js +302 -0
  50. package/dist/collection/components/wm-menuitem/wm-menuitem.css +118 -0
  51. package/dist/collection/components/wm-menuitem/wm-menuitem.js +411 -0
  52. package/dist/collection/components/wm-modal/wm-modal-footer.css +84 -0
  53. package/dist/collection/components/wm-modal/wm-modal-footer.js +159 -0
  54. package/dist/collection/components/wm-modal/wm-modal-header.css +78 -0
  55. package/dist/collection/components/wm-modal/wm-modal-header.js +109 -0
  56. package/dist/collection/components/wm-modal/wm-modal.css +155 -0
  57. package/dist/collection/components/wm-modal/wm-modal.js +356 -0
  58. package/dist/collection/components/wm-navigator/priv-navigator-button/priv-navigator-button.css +94 -0
  59. package/dist/collection/components/wm-navigator/priv-navigator-button/priv-navigator-button.js +97 -0
  60. package/dist/collection/components/wm-navigator/priv-navigator-item/priv-navigator-item.css +67 -0
  61. package/dist/collection/components/wm-navigator/priv-navigator-item/priv-navigator-item.js +114 -0
  62. package/dist/collection/components/wm-navigator/wm-navigator.css +137 -0
  63. package/dist/collection/components/wm-navigator/wm-navigator.js +468 -0
  64. package/dist/collection/components/wm-option/wm-option.css +162 -0
  65. package/dist/collection/components/wm-option/wm-option.js +394 -0
  66. package/dist/collection/components/wm-pagination/wm-pagination.css +217 -0
  67. package/dist/collection/components/wm-pagination/wm-pagination.js +348 -0
  68. package/dist/collection/components/wm-search/wm-search.css +155 -0
  69. package/dist/collection/components/wm-search/wm-search.js +439 -0
  70. package/dist/collection/components/wm-select/wm-select.css +315 -0
  71. package/dist/collection/components/wm-select/wm-select.js +676 -0
  72. package/dist/collection/components/wm-snackbar/wm-snackbar.css +331 -0
  73. package/dist/collection/components/wm-snackbar/wm-snackbar.js +240 -0
  74. package/dist/collection/components/wm-tabs/wm-tab-item/wm-tab-item.css +104 -0
  75. package/dist/collection/components/wm-tabs/wm-tab-item/wm-tab-item.js +202 -0
  76. package/dist/collection/components/wm-tabs/wm-tab-list/wm-tab-list.css +73 -0
  77. package/dist/{ripple/wm-tab-list.entry.js → collection/components/wm-tabs/wm-tab-list/wm-tab-list.js} +131 -17
  78. package/dist/collection/components/wm-tabs/wm-tab-panel/wm-tab-panel.css +57 -0
  79. package/dist/collection/components/wm-tabs/wm-tab-panel/wm-tab-panel.js +104 -0
  80. package/dist/collection/components/wm-tag-input/wm-tag-input.css +431 -0
  81. package/dist/collection/components/wm-tag-input/wm-tag-input.js +754 -0
  82. package/dist/collection/components/wm-timepicker/wm-timepicker.css +370 -0
  83. package/dist/collection/components/wm-timepicker/wm-timepicker.js +567 -0
  84. package/dist/collection/components/wm-toggletip/wm-toggletip.css +350 -0
  85. package/dist/collection/components/wm-toggletip/wm-toggletip.js +217 -0
  86. package/dist/collection/components/wm-uploader/wm-network-uploader/wm-network-uploader.css +642 -0
  87. package/dist/collection/components/wm-uploader/wm-network-uploader/wm-network-uploader.js +753 -0
  88. package/dist/collection/components/wm-uploader/wm-uploader.css +666 -0
  89. package/dist/collection/components/wm-uploader/wm-uploader.js +673 -0
  90. package/dist/collection/components/wm-wrapper/wm-wrapper.js +27 -0
  91. package/dist/collection/dev/scripts.js +20 -0
  92. package/dist/collection/global/__mocks__/functions.js +5 -0
  93. package/dist/collection/global/functions.js +420 -0
  94. package/dist/{ripple/app-globals-b5693c90.js → collection/global/global.js} +3 -8
  95. package/dist/{ripple/interfaces-50753346.js → collection/global/interfaces.js} +4 -6
  96. package/dist/collection/global/services/__mocks__/http-service.js +130 -0
  97. package/dist/collection/global/services/http-service.js +50 -0
  98. package/dist/collection/lang/lang.js +5 -0
  99. package/dist/collection/lang/piglatin.js +93 -0
  100. package/dist/esm/functions-0deb7f8e.js +6117 -0
  101. package/dist/esm/global-d6b49e98.js +36 -0
  102. package/dist/{ripple → esm}/http-service-5d037e16.js +0 -0
  103. package/dist/esm/index-5a842e48.js +1363 -0
  104. package/dist/esm/index.js +1 -0
  105. package/dist/esm/interfaces-61c6305b.js +32 -0
  106. package/dist/esm/loader.js +18 -0
  107. package/dist/esm/polyfills/core-js.js +11 -0
  108. package/dist/esm/polyfills/css-shim.js +1 -0
  109. package/dist/esm/polyfills/dom.js +79 -0
  110. package/dist/esm/polyfills/es5-html-element.js +1 -0
  111. package/dist/esm/polyfills/index.js +34 -0
  112. package/dist/esm/polyfills/system.js +6 -0
  113. package/dist/{ripple → esm}/priv-chart-popover.entry.js +2 -2
  114. package/dist/{ripple → esm}/priv-datepicker.entry.js +3 -3
  115. package/dist/{ripple → esm}/priv-navigator-button.entry.js +1 -1
  116. package/dist/{ripple → esm}/priv-navigator-item.entry.js +1 -1
  117. package/dist/esm/ripple.js +18 -0
  118. package/dist/{ripple/wm-action-menu.entry.js → esm/wm-action-menu_2.entry.js} +114 -3
  119. package/dist/{ripple → esm}/wm-button.entry.js +3 -3
  120. package/dist/{ripple → esm}/wm-chart-slice.entry.js +1 -1
  121. package/dist/{ripple → esm}/wm-chart.entry.js +2 -2
  122. package/dist/{ripple → esm}/wm-datepicker.entry.js +27 -32
  123. package/dist/{ripple → esm}/wm-input.entry.js +2 -2
  124. package/dist/{ripple → esm}/wm-modal-footer.entry.js +2 -2
  125. package/dist/{ripple → esm}/wm-modal-header.entry.js +2 -2
  126. package/dist/{ripple → esm}/wm-modal.entry.js +2 -2
  127. package/dist/{ripple → esm}/wm-navigator.entry.js +3 -3
  128. package/dist/{ripple → esm}/wm-network-uploader.entry.js +2 -2
  129. package/dist/{ripple/wm-select.entry.js → esm/wm-option_2.entry.js} +119 -3
  130. package/dist/{ripple → esm}/wm-pagination.entry.js +2 -2
  131. package/dist/{ripple → esm}/wm-search.entry.js +2 -2
  132. package/dist/{ripple → esm}/wm-snackbar.entry.js +2 -2
  133. package/dist/esm/wm-tab-item_3.entry.js +310 -0
  134. package/dist/{ripple → esm}/wm-tag-input.entry.js +2 -2
  135. package/dist/{ripple → esm}/wm-timepicker.entry.js +2 -2
  136. package/dist/{ripple → esm}/wm-toggletip.entry.js +2 -2
  137. package/dist/{ripple → esm}/wm-uploader.entry.js +2 -2
  138. package/dist/{ripple → esm}/wm-wrapper.entry.js +1 -1
  139. package/dist/index.cjs.js +1 -0
  140. package/dist/index.js +1 -0
  141. package/dist/loader/cdn.js +3 -0
  142. package/dist/loader/index.cjs.js +3 -0
  143. package/dist/loader/index.d.ts +13 -0
  144. package/dist/loader/index.es2017.js +3 -0
  145. package/dist/loader/index.js +4 -0
  146. package/dist/loader/package.json +10 -0
  147. package/dist/ripple/index.esm.js +0 -1
  148. package/dist/ripple/p-103f8cae.entry.js +1 -0
  149. package/dist/ripple/p-129d94fa.entry.js +1 -0
  150. package/dist/ripple/p-139fe143.entry.js +1 -0
  151. package/dist/ripple/p-16367805.entry.js +1 -0
  152. package/dist/ripple/p-1d334060.entry.js +1 -0
  153. package/dist/ripple/p-2562f330.entry.js +1 -0
  154. package/dist/ripple/p-278b26ef.entry.js +1 -0
  155. package/dist/ripple/p-2c21bb72.entry.js +1 -0
  156. package/dist/ripple/p-2f5fda71.entry.js +1 -0
  157. package/dist/ripple/p-3e6f04d5.entry.js +1 -0
  158. package/dist/ripple/p-7185de7f.entry.js +1 -0
  159. package/dist/ripple/p-770d0798.entry.js +1 -0
  160. package/dist/ripple/p-846b4c5f.entry.js +1 -0
  161. package/dist/ripple/p-888bec42.js +1 -0
  162. package/dist/ripple/p-90779d53.entry.js +1 -0
  163. package/dist/ripple/p-934543f2.js +1 -0
  164. package/dist/ripple/p-9a087fee.entry.js +1 -0
  165. package/dist/ripple/p-a6d6eae7.js +1 -0
  166. package/dist/ripple/p-a942ad10.entry.js +1 -0
  167. package/dist/ripple/p-bfb4652d.entry.js +1 -0
  168. package/dist/ripple/p-c0fe5201.entry.js +1 -0
  169. package/dist/ripple/p-c2e27acc.entry.js +1 -0
  170. package/dist/ripple/p-c2edda64.entry.js +1 -0
  171. package/dist/ripple/p-d1fdcbcf.entry.js +1 -0
  172. package/dist/ripple/p-d40b6afb.entry.js +1 -0
  173. package/dist/ripple/p-da73db1c.entry.js +1 -0
  174. package/dist/ripple/p-e3843249.js +1 -0
  175. package/dist/ripple/p-ea5cd8b8.js +16 -0
  176. package/dist/ripple/p-ed0f43f4.entry.js +1 -0
  177. package/dist/ripple/p-ffafd363.entry.js +1 -0
  178. package/dist/ripple/ripple.esm.js +1 -125
  179. package/dist/types/components/wm-action-menu/wm-action-menu.d.ts +43 -0
  180. package/dist/types/components/wm-button/wm-button.d.ts +36 -0
  181. package/dist/types/components/wm-chart/priv-chart-popover/priv-chart-popover.d.ts +23 -0
  182. package/dist/types/components/wm-chart/wm-chart-slice.d.ts +8 -0
  183. package/dist/types/components/wm-chart/wm-chart.d.ts +77 -0
  184. package/dist/types/components/wm-datepicker/priv-datepicker/priv-datepicker.d.ts +75 -0
  185. package/dist/types/components/wm-datepicker/wm-datepicker.d.ts +39 -0
  186. package/dist/types/components/wm-input/wm-input.d.ts +30 -0
  187. package/dist/types/components/wm-menuitem/wm-menuitem.d.ts +30 -0
  188. package/dist/types/components/wm-modal/wm-modal-footer.d.ts +15 -0
  189. package/dist/types/components/wm-modal/wm-modal-header.d.ts +12 -0
  190. package/dist/types/components/wm-modal/wm-modal.d.ts +34 -0
  191. package/dist/types/components/wm-navigator/priv-navigator-button/priv-navigator-button.d.ts +10 -0
  192. package/dist/types/components/wm-navigator/priv-navigator-item/priv-navigator-item.d.ts +13 -0
  193. package/dist/types/components/wm-navigator/wm-navigator.d.ts +61 -0
  194. package/dist/types/components/wm-option/wm-option.d.ts +28 -0
  195. package/dist/types/components/wm-pagination/wm-pagination.d.ts +31 -0
  196. package/dist/types/components/wm-search/wm-search.d.ts +78 -0
  197. package/dist/types/components/wm-select/wm-select.d.ts +63 -0
  198. package/dist/types/components/wm-snackbar/wm-snackbar.d.ts +32 -0
  199. package/dist/types/components/wm-tabs/wm-tab-item/wm-tab-item.d.ts +35 -0
  200. package/dist/types/components/wm-tabs/wm-tab-list/wm-tab-list.d.ts +50 -0
  201. package/dist/types/components/wm-tabs/wm-tab-panel/wm-tab-panel.d.ts +20 -0
  202. package/dist/types/components/wm-tag-input/{wm-tag-input.d.ts~ds312_tagInputMaxTags → wm-tag-input.d.ts} +1 -1
  203. package/dist/types/components/wm-timepicker/wm-timepicker.d.ts +59 -0
  204. package/dist/types/components/wm-toggletip/wm-toggletip.d.ts +25 -0
  205. package/dist/types/components/wm-uploader/wm-network-uploader/wm-network-uploader.d.ts +85 -0
  206. package/dist/types/components/wm-uploader/wm-uploader.d.ts +75 -0
  207. package/dist/types/components/wm-wrapper/wm-wrapper.d.ts +7 -0
  208. package/dist/types/{components.d.ts~ds312_tagInputMaxTags → components.d.ts} +0 -0
  209. package/dist/types/global/__mocks__/functions.d.ts +5 -0
  210. package/dist/types/global/global.d.ts +1 -0
  211. package/dist/types/global/interfaces.d.ts +33 -0
  212. package/dist/types/global/services/__mocks__/http-service.d.ts +6 -0
  213. package/dist/types/global/services/http-service.d.ts +4 -0
  214. package/dist/types/lang/lang.d.ts +5 -0
  215. package/dist/types/{stencil-public-runtime.d.ts~ds312_tagInputMaxTags → stencil-public-runtime.d.ts} +190 -182
  216. package/package.json +1 -1
  217. package/dist/ripple/css-shim-bbdf0cc6.js +0 -4
  218. package/dist/ripple/dom-1f98a75f.js +0 -73
  219. package/dist/ripple/index-20b65f86.js +0 -2938
  220. package/dist/ripple/shadow-css-67b66845.js +0 -389
  221. package/dist/ripple/wm-menuitem.entry.js +0 -114
  222. package/dist/ripple/wm-option.entry.js +0 -119
  223. package/dist/ripple/wm-tab-item.entry.js +0 -78
  224. package/dist/ripple/wm-tab-panel.entry.js +0 -38
@@ -0,0 +1,257 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-d930307d.js');
6
+ const functions = require('./functions-e3f5ae65.js');
7
+
8
+ const wmDatepickerCss = "@charset \"UTF-8\";:host,wm-datepicker{font-family:inherit}:host *,wm-datepicker *{box-sizing:border-box}:host .wrapper,wm-datepicker .wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;flex-direction:column;font-size:0.875rem}:host .wrapper .label,wm-datepicker .wrapper .label{display:block;line-height:normal;font-weight:600;white-space:nowrap;margin-bottom:0.25rem}:host .wrapper .label .required,wm-datepicker .wrapper .label .required{color:#c0392b}:host .wrapper.label-left,wm-datepicker .wrapper.label-left{flex-direction:row}:host .wrapper.label-left .label-wrapper,wm-datepicker .wrapper.label-left .label-wrapper{line-height:2.5rem}:host .wrapper.label-left .label-wrapper .label,wm-datepicker .wrapper.label-left .label-wrapper .label{display:flex;align-items:center;min-height:2.5rem;white-space:normal;margin-bottom:0;margin-right:0.75rem}:host .wrapper.label-none label,wm-datepicker .wrapper.label-none label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}:host .wrapper.invalid .label,wm-datepicker .wrapper.invalid .label{color:#c0392b}:host .wrapper.invalid .label:after,wm-datepicker .wrapper.invalid .label:after{display:inline-block;font:normal normal normal 24px/1 \"Material Design Icons\";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:\"\";margin-left:0.3125rem}[dir=RTL] :host .wrapper.invalid .label:after,[dir=RTL] wm-datepicker .wrapper.invalid .label:after{margin-left:0;margin-right:0.3125rem}:host .wrapper.rtl.label-left .label,wm-datepicker .wrapper.rtl.label-left .label{margin-right:0;margin-left:0.75rem}:host .wrapper,wm-datepicker .wrapper{position:relative}:host .wrapper .required,wm-datepicker .wrapper .required{color:#c4431c}:host .wrapper .inner-wrapper,wm-datepicker .wrapper .inner-wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;align-items:center;height:2.5rem;border:1px solid;border-color:rgba(35, 35, 35, 0.6);-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;max-width:236px;justify-content:space-between;position:relative}:host .wrapper .inner-wrapper .date-input,wm-datepicker .wrapper .inner-wrapper .date-input{-moz-border-top-left-radius:3px;-webkit-border-top-left-radius:3px;border-top-left-radius:3px;-moz-border-bottom-left-radius:3px;-webkit-border-bottom-left-radius:3px;border-bottom-left-radius:3px;border:none;font-size:0.875rem;padding:0.625rem 0.9375rem 0.5rem;min-width:0;height:100%;flex:1;margin:0}:host .wrapper .inner-wrapper .date-input:disabled,wm-datepicker .wrapper .inner-wrapper .date-input:disabled{background-color:#f0f0f0;color:#737373}:host .wrapper .inner-wrapper .date-input:focus,wm-datepicker .wrapper .inner-wrapper .date-input:focus{outline:none}:host .wrapper.invalid .inner-wrapper,wm-datepicker .wrapper.invalid .inner-wrapper{-webkit-box-shadow:0 0 0 1px #c0392b;-moz-box-shadow:0 0 0 1px #c0392b;box-shadow:0 0 0 1px #c0392b;border-color:#c0392b}:host .wrapper.invalid .error,wm-datepicker .wrapper.invalid .error{margin-top:4px;margin-bottom:4px;display:block;top:100%;left:0;font-style:italic;font-size:0.875rem;color:#c0392b}:host .wrapper.focus .inner-wrapper,wm-datepicker .wrapper.focus .inner-wrapper{-webkit-box-shadow:0 0 0 1px #20cbd4;-moz-box-shadow:0 0 0 1px #20cbd4;box-shadow:0 0 0 1px #20cbd4;outline:none;border-color:#20cbd4}:host .user-is-tabbing .toggle:focus:not(:active),wm-datepicker .user-is-tabbing .toggle:focus:not(:active){border:none;z-index:11}";
9
+
10
+ const DatePicker = class {
11
+ constructor(hostRef) {
12
+ index.registerInstance(this, hostRef);
13
+ this.value = "";
14
+ this.disabled = false;
15
+ this.dateFormat = "US";
16
+ this.errorMessage = "";
17
+ this.labelPosition = "top";
18
+ this.label = "";
19
+ this.requiredField = false;
20
+ this.displayError = "";
21
+ // 1, 2, or 4 digits, separator, 1 or 2 digits, separator, then 1 or 2 or 4 digits
22
+ this.parsableEntry = /^(\d{1}|\d{2}|\d{4})[\-\.\/]\d{1,2}[\-\.\/](\d{1}|\d{2}|\d{4})$/;
23
+ this.isoEntry = /^\d\d\d\d[-]\d\d[-]\d\d$/;
24
+ this.eightDigitsEntry = /^\d{8}$/;
25
+ this.dateFormats = {
26
+ US: functions.intl.formatMessage({
27
+ id: "date.formatUS",
28
+ defaultMessage: "mm/dd/yyyy",
29
+ }),
30
+ INT: functions.intl.formatMessage({
31
+ id: "date.formatINT",
32
+ defaultMessage: "dd/mm/yyyy",
33
+ }),
34
+ ISO: functions.intl.formatMessage({
35
+ id: "date.formatISO",
36
+ defaultMessage: "yyyy/mm/dd",
37
+ }),
38
+ };
39
+ }
40
+ handleTabbingOn() {
41
+ this.dpWrapper && this.dpWrapper.classList.add("user-is-tabbing");
42
+ }
43
+ handleTabbingOff() {
44
+ this.dpWrapper && this.dpWrapper.classList.remove("user-is-tabbing");
45
+ }
46
+ handleError() {
47
+ if (this.errorMessage) {
48
+ this.generateError();
49
+ }
50
+ else {
51
+ this.clearError();
52
+ this.processInput();
53
+ }
54
+ }
55
+ handleValue() {
56
+ this.inputEl.value = this.reformatDate(this.dateFormat, this.value);
57
+ if (this.isValidDate(this.value)) {
58
+ this.lastValidValue = this.value;
59
+ }
60
+ this.processInput();
61
+ }
62
+ handleBlur(ev) {
63
+ // do not validate if clicking to an element that should prevent validation (e.g. close button on modal)
64
+ const shouldPreventValidation = this.preventValidation && functions.isRelatedTarget(ev, this.preventValidation);
65
+ if (!shouldPreventValidation) {
66
+ this.processInput();
67
+ }
68
+ this.dpWrapper.classList.remove("focus");
69
+ }
70
+ generateBlur() {
71
+ this.el.tabIndex = 0;
72
+ this.el.focus();
73
+ this.el.blur();
74
+ }
75
+ generateBlurAndFocusButton() {
76
+ this.generateBlur();
77
+ }
78
+ getActiveElement() {
79
+ return functions.checkForFocusableElInShadow(document.activeElement);
80
+ }
81
+ /* End blur stuff. Back to our normal programming :) */
82
+ handleCellTriggered(ev) {
83
+ let dateElement = ev.detail;
84
+ let isoDate = dateElement.getAttribute("data-year") +
85
+ "-" +
86
+ dateElement.getAttribute("data-month") +
87
+ "-" +
88
+ dateElement.textContent;
89
+ this.inputEl.value = this.reformatDate(this.dateFormat, isoDate);
90
+ this.processInput();
91
+ // Create event to trigger onInput function on host element, to get the updated value
92
+ // Because there are more ways to input than just typing, we are firing this event upon cellTriggered
93
+ let event = document.createEvent("Event");
94
+ event.initEvent("input", true, true);
95
+ this.el.dispatchEvent(event);
96
+ }
97
+ focusHandler() {
98
+ this.dpWrapper.classList.add("focus");
99
+ }
100
+ processInput() {
101
+ let isoDate = this.inputEl.value;
102
+ //If input is 8 digits, add slashes as a courtesy and process anyway
103
+ if (this.eightDigitsEntry.test(this.inputEl.value)) {
104
+ this.inputEl.value = this.addSlashes(this.inputEl.value);
105
+ }
106
+ // if we don't have 2 separators we can't reformat so we'll return what was passed in
107
+ if (this.parsableEntry.test(this.inputEl.value)) {
108
+ //ISO format for submission
109
+ isoDate = this.reformatDate("ISO", this.inputEl.value);
110
+ //User-specific format for display
111
+ this.inputEl.value = this.reformatDate(this.dateFormat, isoDate);
112
+ if (this.isValidDate(isoDate)) {
113
+ //If there's no errorMessage on state, all errors can be cleared. If there IS an error message, it will clear any internal validation errors by overriding them.
114
+ if (this.errorMessage) {
115
+ this.generateError();
116
+ }
117
+ else {
118
+ this.clearError();
119
+ }
120
+ //Update prop passed into calendar to valid date
121
+ this.lastValidValue = isoDate;
122
+ //Prevents error from appearing if input field is empty
123
+ }
124
+ else if (this.inputEl.value.length) {
125
+ this.generateError();
126
+ }
127
+ }
128
+ else if (this.inputEl.value.length || this.requiredField || this.errorMessage) {
129
+ this.generateError();
130
+ }
131
+ else if (!this.inputEl.value.length && !this.requiredField) {
132
+ this.clearError();
133
+ }
134
+ // value is set to the reformated date or whatever the user passed
135
+ this.value = isoDate;
136
+ }
137
+ // this function reformats date strings to/from the storage format ONLY. US -> INT and vice versa is not supported.
138
+ reformatDate(toFormat, date) {
139
+ if (!date) {
140
+ return "";
141
+ }
142
+ else if (!this.parsableEntry.test(date)) {
143
+ return date;
144
+ }
145
+ else {
146
+ let dateArr = date.replace(/[\-\.]/gi, "/").split("/");
147
+ switch (toFormat) {
148
+ case "US":
149
+ case this.dateFormats["US"]:
150
+ return dateArr[1].padStart(2, "0") + "/" + dateArr[2].padStart(2, "0") + "/" + dateArr[0].padStart(4, "20");
151
+ case "INT":
152
+ case this.dateFormats["INT"]:
153
+ return dateArr[2].padStart(2, "0") + "/" + dateArr[1].padStart(2, "0") + "/" + dateArr[0].padStart(4, "20");
154
+ case "ISO":
155
+ case this.dateFormats["ISO"]:
156
+ if (this.dateFormat === "US" || this.dateFormat === this.dateFormats["US"]) {
157
+ return dateArr[2].padStart(4, "20") + "-" + dateArr[0].padStart(2, "0") + "-" + dateArr[1].padStart(2, "0");
158
+ }
159
+ else if (this.dateFormat === "INT" || this.dateFormat === this.dateFormats["INT"]) {
160
+ return dateArr[2].padStart(4, "20") + "-" + dateArr[1].padStart(2, "0") + "-" + dateArr[0].padStart(2, "0");
161
+ }
162
+ else if (this.dateFormat === "ISO" || this.dateFormat === this.dateFormats["ISO"]) {
163
+ return dateArr[0].padStart(4, "20") + "-" + dateArr[1].padStart(2, "0") + "-" + dateArr[2].padStart(2, "0");
164
+ }
165
+ default:
166
+ return dateArr.join("/");
167
+ }
168
+ }
169
+ }
170
+ isValidDate(input) {
171
+ // if it's not ISO it's not valid
172
+ if (!input || !this.isoEntry.test(input)) {
173
+ return false;
174
+ }
175
+ else {
176
+ // Parse the ISO date parts to integers
177
+ let parts = input.split("-");
178
+ let day = parseInt(parts[2], 10);
179
+ let month = parseInt(parts[1], 10);
180
+ let year = parseInt(parts[0], 10);
181
+ // Check the ranges of month and year
182
+ if (year < 1000 || year > 3000 || month == 0 || month > 12)
183
+ return false;
184
+ let monthLength = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
185
+ // Adjust for leap years
186
+ if (year % 400 == 0 || (year % 100 != 0 && year % 4 == 0))
187
+ monthLength[1] = 29;
188
+ // Check the range of the day
189
+ return day > 0 && day <= monthLength[month - 1];
190
+ }
191
+ }
192
+ generateError() {
193
+ const requiredDateErr = functions.intl.formatMessage({
194
+ id: "date.requiredDateError",
195
+ defaultMessage: "A date is required.",
196
+ });
197
+ const validDateErr = functions.intl.formatMessage({
198
+ id: "date.invalidDate",
199
+ defaultMessage: "Please enter a valid date in the format {dateFormat, select, us {mm/dd/yyyy} int {dd/mm/yyyy} iso {yyyy/mm/dd}}.",
200
+ }, { dateFormat: this.dateFormat.toLowerCase() });
201
+ if (this.errorMessage) {
202
+ this.displayError = this.errorMessage;
203
+ }
204
+ else if (this.inputEl.value.length) {
205
+ this.displayError = validDateErr;
206
+ }
207
+ else if (!this.inputEl.value.length && this.requiredField) {
208
+ this.displayError = requiredDateErr;
209
+ }
210
+ }
211
+ clearError() {
212
+ this.displayError = "";
213
+ }
214
+ addSlashes(input) {
215
+ if (this.dateFormat === "ISO" || this.dateFormat === this.dateFormats["ISO"]) {
216
+ return input.substring(0, 4) + "/" + input.substring(4, 6) + "/" + input.substring(6);
217
+ }
218
+ else {
219
+ return input.substring(0, 2) + "/" + input.substring(2, 4) + "/" + input.substring(4);
220
+ }
221
+ }
222
+ componentWillLoad() {
223
+ if (this.label === "") {
224
+ throw new Error("You must include a label prop for the datepicker input (for accessibility reasons), even if the label position is none.");
225
+ }
226
+ if (this.errorMessage) {
227
+ this.generateError();
228
+ }
229
+ this.uid = this.el.id ? this.el.id : functions.generateId();
230
+ }
231
+ componentDidLoad() {
232
+ // convert passed-in starting date from ISO to locale format, update displayed input to proper format
233
+ this.inputEl.value = this.reformatDate(this.dateFormat, this.value);
234
+ if (this.value && this.isValidDate(this.value)) {
235
+ // update value passed into calendar so that it opens on the specified date
236
+ this.lastValidValue = this.value;
237
+ }
238
+ this.processInput();
239
+ }
240
+ render() {
241
+ const dateFormat = functions.intl.formatMessage({
242
+ id: "date.format",
243
+ defaultMessage: "{dateFormat, select, us {mm/dd/yyyy} int {dd/mm/yyyy} iso {yyyy/mm/dd}}",
244
+ }, { dateFormat: this.dateFormat.toLowerCase() });
245
+ return (index.h(index.Host, { id: this.uid, onBlur: () => {
246
+ this.el.removeAttribute("tabindex");
247
+ }, "aria-busy": "false", class: `${this.displayError ? "invalid" : ""}`, invalid: this.displayError ? "true" : null }, index.h("div", { ref: (d) => (this.dpWrapper = d), class: `wrapper label-${this.labelPosition} ${this.displayError ? "invalid" : ""}` }, index.h("div", { class: "label-wrapper" }, this.labelPosition !== "none" && (index.h("label", { id: `datepickerLabel-${this.uid}`, htmlFor: `date-input-${this.uid}`, class: "label", title: `${this.label} (${dateFormat})` }, this.label, this.requiredField && (index.h("span", { "aria-hidden": "true", class: "required" }, "*"))))), index.h("div", null, index.h("div", { class: "inner-wrapper" }, index.h("input", { disabled: this.disabled, type: "text", id: `date-input-${this.uid}`, class: "date-input", name: "date", placeholder: dateFormat, onFocus: this.focusHandler.bind(this), onBlur: (ev) => this.handleBlur(ev), ref: (input) => (this.inputEl = input), "aria-describedby": `error-${this.uid}`, "aria-controls": `popup-${this.uid}`, "aria-label": this.label, required: this.requiredField }), index.h("priv-datepicker", { disabled: this.disabled, date: this.lastValidValue ? new Date(this.lastValidValue) : new Date(), parentId: this.uid })), index.h("div", { id: `error-${this.uid}`, class: "error", "aria-live": "assertive", "aria-atomic": "true" }, this.displayError)))));
248
+ }
249
+ get el() { return index.getElement(this); }
250
+ static get watchers() { return {
251
+ "errorMessage": ["handleError"],
252
+ "value": ["handleValue"]
253
+ }; }
254
+ };
255
+ DatePicker.style = wmDatepickerCss;
256
+
257
+ exports.wm_datepicker = DatePicker;
@@ -0,0 +1,110 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-d930307d.js');
6
+ const functions = require('./functions-e3f5ae65.js');
7
+
8
+ const wmInputCss = "@charset \"UTF-8\";:host,wm-input{font-family:inherit;width:100%}:host *,wm-input *{box-sizing:border-box}:host .wrapper,wm-input .wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;flex-direction:column;font-size:0.875rem}:host .wrapper .label,wm-input .wrapper .label{display:block;line-height:normal;font-weight:600;white-space:nowrap;margin-bottom:0.25rem}:host .wrapper .label .required,wm-input .wrapper .label .required{color:#c0392b}:host .wrapper.label-left,wm-input .wrapper.label-left{flex-direction:row}:host .wrapper.label-left .label-wrapper,wm-input .wrapper.label-left .label-wrapper{line-height:2.5rem}:host .wrapper.label-left .label-wrapper .label,wm-input .wrapper.label-left .label-wrapper .label{display:flex;align-items:center;min-height:2.5rem;white-space:normal;margin-bottom:0;margin-right:0.75rem}:host .wrapper.label-none label,wm-input .wrapper.label-none label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}:host .wrapper.invalid .label,wm-input .wrapper.invalid .label{color:#c0392b}:host .wrapper.invalid .label:after,wm-input .wrapper.invalid .label:after{display:inline-block;font:normal normal normal 24px/1 \"Material Design Icons\";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:\"\";margin-left:0.3125rem}[dir=RTL] :host .wrapper.invalid .label:after,[dir=RTL] wm-input .wrapper.invalid .label:after{margin-left:0;margin-right:0.3125rem}:host .wrapper.rtl.label-left .label,wm-input .wrapper.rtl.label-left .label{margin-right:0;margin-left:0.75rem}:host .wrapper .inner-wrapper,wm-input .wrapper .inner-wrapper{width:100%}:host .wrapper .inputfield-wrapper,wm-input .wrapper .inputfield-wrapper{height:2.5rem;border:1px solid #4a4a4a;-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;display:flex}:host .wrapper .character-count,wm-input .wrapper .character-count{display:flex;align-items:center;justify-content:center;min-width:5rem;background-color:rgba(74, 74, 74, 0.05);font-size:0.875rem;font-weight:500;align-self:stretch}:host .wrapper input,wm-input .wrapper input{-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;border:none;font-family:inherit;font-size:0.875rem;height:100%;flex:1;padding:0.75rem 1rem;width:100%}:host .wrapper input:disabled,wm-input .wrapper input:disabled{background-color:#f0f0f0;color:#737373}:host .wrapper input:focus,wm-input .wrapper input:focus{outline:none}:host .wrapper .info,wm-input .wrapper .info{font-style:italic;line-height:100%;margin:4px 0}:host .wrapper.invalid .inputfield-wrapper,wm-input .wrapper.invalid .inputfield-wrapper{-webkit-box-shadow:0 0 0 1px #c0392b;-moz-box-shadow:0 0 0 1px #c0392b;box-shadow:0 0 0 1px #c0392b;border-color:#c0392b}:host .wrapper.invalid .error-message,wm-input .wrapper.invalid .error-message{color:#c0392b;margin:4px 0;display:block;font-style:italic;line-height:100%}:host .wrapper:focus .inputfield-wrapper,:host .wrapper.focus .inputfield-wrapper,wm-input .wrapper:focus .inputfield-wrapper,wm-input .wrapper.focus .inputfield-wrapper{-webkit-box-shadow:0 0 0 1px #20cbd4;-moz-box-shadow:0 0 0 1px #20cbd4;box-shadow:0 0 0 1px #20cbd4;outline:none;border-color:#20cbd4}:host .sr-only,wm-input .sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}";
9
+
10
+ const Input = class {
11
+ constructor(hostRef) {
12
+ index.registerInstance(this, hostRef);
13
+ this.labelPosition = "top";
14
+ this.value = "";
15
+ this.disabled = false;
16
+ this.placeholder = "";
17
+ this.requiredField = false;
18
+ this.charCount = 0;
19
+ this.announcement = "";
20
+ this.uid = "";
21
+ this.requiredErrorMessage = functions.intl.formatMessage({
22
+ id: "global.requiredError",
23
+ defaultMessage: "This field is required.",
24
+ });
25
+ }
26
+ componentWillLoad() {
27
+ this.uid = this.el.id ? this.el.id : functions.generateId();
28
+ this.el.focus = function () {
29
+ if (!this.disabled) {
30
+ this.shadowRoot.querySelector("input").focus();
31
+ }
32
+ };
33
+ if (!this.label) {
34
+ console.error("wm-input requires the label property");
35
+ }
36
+ }
37
+ componentDidLoad() {
38
+ if (this.value) {
39
+ this.inputEl.value = this.value;
40
+ }
41
+ }
42
+ handleKeyDown(ev) {
43
+ // in most browsers, onInput doesn't fire if the input's maxLength is reached
44
+ // to handle the case where a user continues to type after reaching the character limit, the keyDown event must be used
45
+ const isModifierKey = ev.ctrlKey || ev.metaKey || ev.altKey;
46
+ const isCharacter = /^.$/.test(ev.key) && !isModifierKey;
47
+ const hasReachedCharacterLimit = isCharacter && this.characterLimit && this.inputEl.value.length >= this.characterLimit;
48
+ if (hasReachedCharacterLimit) {
49
+ this.announce(this.generateCharacterLimitWarning(this.charCount, this.characterLimit));
50
+ }
51
+ }
52
+ handleBlur(ev) {
53
+ // do not validate if clicking to an element that should prevent validation (e.g. close button on modal)
54
+ const shouldPreventValidation = this.preventValidation && functions.isRelatedTarget(ev, this.preventValidation);
55
+ if (this.requiredField && !shouldPreventValidation) {
56
+ this.errorMessage = this.updateRequiredError(this.errorMessage, this.requiredErrorMessage, this.value);
57
+ }
58
+ this.inputWrapperEl.classList.remove("focus");
59
+ }
60
+ handleInput(ev) {
61
+ this.value = ev.target.value;
62
+ this.charCount = this.value.length;
63
+ if (this.characterLimit && this.charCount >= this.characterLimit - 5) {
64
+ this.announce(this.generateCharacterLimitWarning(this.charCount, this.characterLimit));
65
+ }
66
+ }
67
+ handleFocus() {
68
+ this.inputWrapperEl.classList.add("focus");
69
+ }
70
+ updateRequiredError(errorMessage, requiredErrorMessage, value) {
71
+ const errorPresent = !!errorMessage && errorMessage !== "";
72
+ let newErrorMessage = errorMessage || "";
73
+ // no error and empty value generates required error message
74
+ if (!errorPresent && value === "") {
75
+ newErrorMessage = requiredErrorMessage;
76
+ }
77
+ // if there is an error and a value, clear error message
78
+ // unless it's a custom error set by the dev
79
+ else if (errorPresent && value !== "") {
80
+ if (errorMessage === requiredErrorMessage) {
81
+ newErrorMessage = "";
82
+ }
83
+ }
84
+ return newErrorMessage;
85
+ }
86
+ announce(message) {
87
+ if (this.liveRegionEl.textContent === message) {
88
+ message += "\u00A0";
89
+ }
90
+ this.announcement = message;
91
+ }
92
+ generateCharacterLimitWarning(charCount, charLimit) {
93
+ const charactersEnteredMessage = functions.intl.formatMessage({
94
+ id: "input.charactersEntered",
95
+ defaultMessage: "{x, number} of {y, number} characters entered.",
96
+ }, { x: charCount, y: charLimit });
97
+ const characterLimitReachedMessage = functions.intl.formatMessage({
98
+ id: "input.characterLimitReached",
99
+ defaultMessage: "No additional characters will be entered.",
100
+ });
101
+ return `${charactersEnteredMessage}${charCount >= charLimit ? " " + characterLimitReachedMessage : ""}`;
102
+ }
103
+ render() {
104
+ return (index.h(index.Host, { id: this.uid }, index.h("div", { class: `wrapper label-${this.labelPosition} ${this.errorMessage ? "invalid" : ""}`, ref: (el) => (this.inputWrapperEl = el) }, index.h("div", { class: "label-wrapper" }, this.labelPosition !== "none" && (index.h("label", { htmlFor: `inputfield-${this.uid}`, class: "label" }, this.label, this.requiredField && (index.h("span", { class: "required", "aria-hidden": "true" }, "*"))))), index.h("div", { class: "inner-wrapper" }, index.h("div", { class: "inputfield-wrapper" }, index.h("input", { ref: (el) => (this.inputEl = el), id: `inputfield-${this.uid}`, disabled: this.disabled, "aria-label": this.label, "aria-describedby": `info-${this.uid} error-${this.uid}`, onInput: (ev) => this.handleInput(ev), onKeyDown: (ev) => this.handleKeyDown(ev), onBlur: (ev) => this.handleBlur(ev), onFocus: this.handleFocus.bind(this), placeholder: this.placeholder, autocomplete: "off", required: this.requiredField, maxLength: this.characterLimit || undefined }), this.characterLimit && typeof this.characterLimit === "number" ? (index.h("div", { class: "character-count" }, this.charCount, "/", this.characterLimit)) : ("")), this.info && (index.h("div", { id: `info-${this.uid}`, class: "info" }, this.info)), index.h("div", { id: `error-${this.uid}`, "aria-live": "assertive", class: "error-message", "aria-atomic": "true" }, this.errorMessage), index.h("div", { class: "sr-only", "aria-live": "polite", "aria-atomic": "true", ref: (el) => (this.liveRegionEl = el) }, this.announcement)))));
105
+ }
106
+ get el() { return index.getElement(this); }
107
+ };
108
+ Input.style = wmInputCss;
109
+
110
+ exports.wm_input = Input;
@@ -0,0 +1,43 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-d930307d.js');
6
+ const functions = require('./functions-e3f5ae65.js');
7
+
8
+ const wmModalFooterCss = "wm-modal-footer{-webkit-border-radius:0px 0px 5px 5px;-moz-border-radius:0px 0px 5px 5px;-ms-border-radius:0px 0px 5px 5px;border-radius:0px 0px 5px 5px;margin-top:-1px}wm-modal-footer .wm-wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;-webkit-justify-content:space-between;justify-content:space-between;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center}@media only screen and (max-width: 650px){wm-modal-footer .wm-wrapper.footer-text{flex-direction:column;align-items:flex-start}}wm-modal-footer .wm-wrapper wm-button+wm-button{margin-left:1rem}wm-modal-footer .wm-wrapper .wm-info{font-size:0.875rem;font-style:italic}@media only screen and (max-width: 650px){wm-modal-footer .wm-wrapper .wm-info{padding-bottom:0.625rem}}wm-modal-footer .wm-wrapper .wm-info:focus{outline:none}";
9
+
10
+ const ModalFooter = class {
11
+ constructor(hostRef) {
12
+ index.registerInstance(this, hostRef);
13
+ this.secondaryText = "";
14
+ this.primaryText = "";
15
+ this.infoText = "";
16
+ this.primaryActionDisabled = false;
17
+ this.deleteStyle = false;
18
+ }
19
+ //Trap focus when user tabs past first element in modal
20
+ focusLastEl() {
21
+ functions.checkForFocusableElInShadow(this.lastElement).focus();
22
+ }
23
+ componentWillLoad() {
24
+ this.uid = this.el.parentElement.uid;
25
+ }
26
+ emitParentPrimaryEvent() {
27
+ const parentModal = this.el.parentElement;
28
+ //@ts-ignore
29
+ parentModal.emitPrimaryEvent();
30
+ }
31
+ emitParentSecondaryEvent() {
32
+ const parentModal = this.el.parentElement;
33
+ //@ts-ignore
34
+ parentModal.emitSecondaryEvent();
35
+ }
36
+ render() {
37
+ return (index.h("div", { class: `wm-wrapper ${this.infoText ? " footer-text" : ""}` }, index.h("div", { class: "wm-info" }, this.infoText), index.h("div", { class: "wm-button-collection" }, this.secondaryText && (index.h("wm-button", { onClick: () => this.emitParentSecondaryEvent(), id: `wm-secondary-${this.uid}`, ref: (el) => (this.primaryActionDisabled ? (this.lastElement = el) : null) }, this.secondaryText)), index.h("wm-button", { buttonStyle: this.deleteStyle ? "secondary" : "primary", permanentlyDelete: this.deleteStyle, onClick: () => this.emitParentPrimaryEvent(), disabled: this.primaryActionDisabled, id: `wm-primary-${this.uid}`, ref: (el) => (!this.primaryActionDisabled ? (this.lastElement = el) : null) }, this.primaryText))));
38
+ }
39
+ get el() { return index.getElement(this); }
40
+ };
41
+ ModalFooter.style = wmModalFooterCss;
42
+
43
+ exports.wm_modal_footer = ModalFooter;
@@ -0,0 +1,45 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-d930307d.js');
6
+ const functions = require('./functions-e3f5ae65.js');
7
+
8
+ const wmModalHeaderCss = "wm-modal-header{-webkit-border-radius:5px 5px 0 0px;-moz-border-radius:5px 5px 0 0px;-ms-border-radius:5px 5px 0 0px;border-radius:5px 5px 0 0px;margin-bottom:-1px}wm-modal-header .wm-wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;-webkit-justify-content:space-between;justify-content:space-between;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center}wm-modal-header .wm-wrapper .title{margin:0;font-weight:600;font-size:1.125rem;color:#4a4a4a;line-height:normal}wm-modal-header .wm-wrapper .title .subtitle{display:block;font-size:0.875rem;font-weight:normal}wm-modal-header .wm-wrapper .title:focus{outline:none}";
9
+
10
+ const ModalHeader = class {
11
+ constructor(hostRef) {
12
+ index.registerInstance(this, hostRef);
13
+ this.heading = "";
14
+ this.subheading = "";
15
+ this.closeTooltip = functions.intl.formatMessage({
16
+ id: "global.closeVerb",
17
+ defaultMessage: "Close",
18
+ description: "For a button, to close a user interface element",
19
+ });
20
+ }
21
+ //Trap focus when user tabs past last element in modal
22
+ focusFirstEl() {
23
+ functions.checkForFocusableElInShadow(this.firstElement).focus();
24
+ }
25
+ componentWillLoad() {
26
+ this.uid = this.el.parentElement.uid;
27
+ }
28
+ emitParentCloseEvent() {
29
+ const parentModal = this.el.parentElement;
30
+ //@ts-ignore
31
+ parentModal.emitCloseEvent();
32
+ }
33
+ // @Listen("click")
34
+ // directFocusOnClick() {
35
+ // this.headingElement.tabIndex = 0;
36
+ // this.headingElement.focus();
37
+ // }
38
+ render() {
39
+ return (index.h(index.Host, null, index.h("div", { class: "wm-wrapper" }, index.h("div", null, index.h("h2", { class: "title", id: `wm-modal-heading-text-${this.uid}` }, this.heading, index.h("span", { class: "subtitle" }, this.subheading))), index.h("wm-button", { "button-style": "navigational", icon: "f156", tooltip: this.closeTooltip, "tooltip-position": "left", id: `wm-modal-close-${this.uid}`, ref: (el) => (this.firstElement = el), onClick: () => this.emitParentCloseEvent() }))));
40
+ }
41
+ get el() { return index.getElement(this); }
42
+ };
43
+ ModalHeader.style = wmModalHeaderCss;
44
+
45
+ exports.wm_modal_header = ModalHeader;
@@ -0,0 +1,149 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-d930307d.js');
6
+ const functions = require('./functions-e3f5ae65.js');
7
+
8
+ const wmModalCss = "wm-modal{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;flex-direction:column;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);z-index:2001;width:80vw;max-width:750px;max-height:80vh;-webkit-box-shadow:0px 11px 15px 0px rgba(0, 0, 0, 0.2), 0px 9px 46px 8px rgba(0, 0, 0, 0.12), 0px 24px 38px 3px rgba(0, 0, 0, 0.14);-moz-box-shadow:0px 11px 15px 0px rgba(0, 0, 0, 0.2), 0px 9px 46px 8px rgba(0, 0, 0, 0.12), 0px 24px 38px 3px rgba(0, 0, 0, 0.14);box-shadow:0px 11px 15px 0px rgba(0, 0, 0, 0.2), 0px 9px 46px 8px rgba(0, 0, 0, 0.12), 0px 24px 38px 3px rgba(0, 0, 0, 0.14)}wm-modal *{box-sizing:border-box}wm-modal>*{width:80vw;max-width:750px;background:#fff}wm-modal>*:focus{outline:none}wm-modal wm-modal-header,wm-modal wm-modal-footer{padding:1.25rem 1.875rem}wm-modal wm-modal-header{z-index:2003}wm-modal wm-modal-footer{z-index:2003}wm-modal>:not(wm-modal-header):not(wm-modal-footer){max-height:calc(80vh - 166px);z-index:2002}wm-modal.wm-modal wm-modal-header{border-bottom:1px solid #f4f3f6}wm-modal.wm-modal wm-modal-footer{border-top:1px solid #f4f3f6}@media only screen and (max-width: 768px){wm-modal.wm-modal{height:100%;max-height:none;max-width:none;width:100vw}wm-modal.wm-modal>*{max-width:none;width:100vw}wm-modal.wm-modal>*:not(wm-modal-header):not(wm-modal-footer){max-height:none;height:calc(100vh - 166px)}}wm-modal.wm-dialog>:not(wm-modal-header):not(wm-modal-footer){padding:0 1.875rem 1.25rem 1.875rem;font-size:0.875rem;border:none}wm-modal .overlay{width:100vw;height:100vh;max-width:none;max-height:none;position:fixed !important;top:-1;bottom:1;left:-1;right:1;transform:translate(0%, 0%);background-color:rgba(25, 25, 25, 0.4);-ms-transition:opacity 0.5s ease-out;-webkit-transition:opacity 0.5s ease-out;-moz-transition:opacity 0.5s ease-out;transition:opacity 0.5s ease-out;z-index:2000}wm-modal.hide{visibility:hidden}wm-modal .sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important;top:0;left:0}";
9
+
10
+ const Modal = class {
11
+ constructor(hostRef) {
12
+ index.registerInstance(this, hostRef);
13
+ this.focusLastElement = index.createEvent(this, "focusLastElement", 7);
14
+ this.focusFirstElement = index.createEvent(this, "focusFirstElement", 7);
15
+ this.wmCloseTriggered = index.createEvent(this, "wmCloseTriggered", 7);
16
+ this.wmPrimaryTriggered = index.createEvent(this, "wmPrimaryTriggered", 7);
17
+ this.wmSecondaryTriggered = index.createEvent(this, "wmSecondaryTriggered", 7);
18
+ this.isOpen = false;
19
+ this.elementToFocus = "";
20
+ this.isTypeDialog = false;
21
+ this.bodyFocusListener = () => this.redirectFocusOnBody();
22
+ }
23
+ //App can open modal by toggling the prop
24
+ toggleModal() {
25
+ this.isOpen ? this.showModal() : this.hideModal();
26
+ }
27
+ //The below not implemented in light of the fact that the app does often need to keep track of the modal's state itself so that it can update the data displayed in the body:
28
+ //App can also open modal by emitting wmShowModal event. Event needs to include the modal's unique id as the event detail, or else all modals on the page will open when wmShowModal event is dispatched.
29
+ // @Listen("wmShowModal", { target: "window" })
30
+ // doesEventMatchId(ev: CustomEvent) {
31
+ // ev.detail === this.uid && this.showModal();
32
+ // }
33
+ showModal() {
34
+ this.setElToFocusOnClose(); //Record where the user was before the modal opened so that focus can return to it when the modal closes
35
+ document.body.style.overflow = "hidden"; //Keeps the page below the modal from scrolling
36
+ //Focus listeners as a general catch for keeping focus in case of errors in finding element with id passed in by dev (element is removed from DOM, etc.) or other scenarios
37
+ document.body.tabIndex = 0;
38
+ document.body.removeEventListener("focus", this.bodyFocusListener, true);
39
+ document.body.addEventListener("focus", this.bodyFocusListener, true);
40
+ window.requestAnimationFrame(() => {
41
+ this.setElToFocusOnOpen();
42
+ window.requestAnimationFrame(() => this.focusOnOpen.focus()); //Bring focus to element inside modal
43
+ });
44
+ }
45
+ handleClick(ev) {
46
+ this.isOpen && ev.target === this.overlayEl && this.focusOnOpen.focus();
47
+ }
48
+ closeModalOnEscape(ev) {
49
+ if (ev.key === "Escape") {
50
+ this.wmCloseTriggered.emit();
51
+ this.isOpen = false;
52
+ }
53
+ }
54
+ //Close the modal and focus the triggering element when the modal buttons emit their events
55
+ hideModal() {
56
+ document.body.style.overflow = "visible";
57
+ document.body.tabIndex = -1;
58
+ document.body.removeEventListener("focus", this.bodyFocusListener, true);
59
+ window.requestAnimationFrame(() => this.focusOnClose.focus()); //Return focus
60
+ }
61
+ componentWillLoad() {
62
+ if (this.elementToFocus === "primary" || this.elementToFocus === "secondary") {
63
+ if (!this.el.id) {
64
+ throw new Error("You are telling the modal to focus an element in the footer when it opens. That's fine! But when you do that, you also need to give the wm-modal-wrapper an ID and set the ID of the modal body to 'content-[id of wm-modal-wrapper]. This is for accessibility purposes.");
65
+ }
66
+ }
67
+ this.uid = this.el.id ? this.el.id : functions.generateId();
68
+ }
69
+ componentDidLoad() {
70
+ if (this.isOpen) {
71
+ this.showModal();
72
+ }
73
+ }
74
+ async emitCloseEvent() {
75
+ this.wmCloseTriggered.emit();
76
+ }
77
+ async emitPrimaryEvent() {
78
+ this.wmPrimaryTriggered.emit();
79
+ }
80
+ async emitSecondaryEvent() {
81
+ this.wmSecondaryTriggered.emit();
82
+ }
83
+ //If the dev hasn't specified an element to focus, element to focus first will be the close (X) button
84
+ setElToFocusOnOpen() {
85
+ const closeBtn = functions.getFirstFocusableDescendant(this.el.querySelector(`#wm-modal-close-${this.uid}`));
86
+ if (this.elementToFocus) {
87
+ if (this.elementToFocus === "primary" || this.elementToFocus === "secondary") {
88
+ this.setAriaDescribedbyOnModal();
89
+ this.elementToFocus = `wm-${this.elementToFocus}-${this.uid}`;
90
+ }
91
+ const elToFocus = this.el.querySelector(`#${this.elementToFocus}`);
92
+ if (elToFocus) {
93
+ const firstEl = functions.getFirstFocusableDescendant(elToFocus);
94
+ if (firstEl) {
95
+ this.focusOnOpen = firstEl;
96
+ }
97
+ else {
98
+ console.warn("Ripple Component Library: The modal component couldn't find an element matching the value you passed for 'elementToFocus'. It will fall back to the default and focus the close button when the modal opens.");
99
+ this.focusOnOpen = closeBtn;
100
+ }
101
+ }
102
+ else {
103
+ console.warn("Ripple Component Library: The modal component couldn't find an element matching the value you passed for 'elementToFocus'. It will fall back to the default and focus the close button when the modal opens.");
104
+ this.focusOnOpen = closeBtn;
105
+ }
106
+ }
107
+ else {
108
+ this.focusOnOpen = closeBtn;
109
+ }
110
+ }
111
+ setAriaDescribedbyOnModal() {
112
+ const modalBody = document.getElementById(`content-${this.uid}`);
113
+ if (!modalBody) {
114
+ console.warn("Ripple Component Library: The element containing the body of the modal must include an id in the format 'content-[id of modal]' for accessibility purposes.");
115
+ }
116
+ else {
117
+ this.el.setAttribute("aria-describedby", `wm-modal-heading-text-${this.uid} content-${this.uid}`);
118
+ }
119
+ }
120
+ setElToFocusOnClose() {
121
+ const elToFocus = document.activeElement;
122
+ if (elToFocus.tagName === "WM-MENUITEM") {
123
+ this.focusOnClose = elToFocus.parentElement;
124
+ }
125
+ else {
126
+ this.focusOnClose = functions.checkForActiveElInShadow(elToFocus);
127
+ }
128
+ }
129
+ redirectFocusOnBody() {
130
+ if (document.activeElement.tagName === "BODY") {
131
+ this.setElToFocusOnOpen();
132
+ this.focusOnOpen.focus();
133
+ }
134
+ }
135
+ render() {
136
+ return (index.h(index.Host, { class: (this.isOpen ? "" : "hide ") + (this.isTypeDialog ? "wm-dialog" : "wm-modal"), role: "dialog", "aria-describedby": `wm-modal-heading-text-${this.uid}`, "aria-modal": "true", tabindex: this.isOpen ? 0 : null, onFocus: () => {
137
+ this.focusLastElement.emit();
138
+ } }, index.h("div", { class: "overlay", ref: (el) => (this.overlayEl = el) }), index.h("div", { class: "sr-only", tabIndex: 0, onFocus: () => {
139
+ this.focusFirstElement.emit();
140
+ } })));
141
+ }
142
+ get el() { return index.getElement(this); }
143
+ static get watchers() { return {
144
+ "isOpen": ["toggleModal"]
145
+ }; }
146
+ };
147
+ Modal.style = wmModalCss;
148
+
149
+ exports.wm_modal = Modal;