@watermarkinsights/ripple 5.3.0-2 → 5.3.0-4

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 (221) hide show
  1. package/dist/cjs/{chartFunctions-246529c5.js → chartFunctions-0238043b.js} +3 -3
  2. package/dist/cjs/{functions-be4156cf.js → functions-3be85c6d.js} +2 -0
  3. package/dist/cjs/{global-6b1a23e9.js → global-6a36ad09.js} +1 -1
  4. package/dist/cjs/{index-f8ef86de.js → index-e86c28b6.js} +60 -1
  5. package/dist/cjs/{intl-a13884e8.js → intl-567eb9d8.js} +1 -1
  6. package/dist/cjs/loader.cjs.js +3 -3
  7. package/dist/cjs/priv-calendar.cjs.entry.js +64 -48
  8. package/dist/cjs/priv-chart-popover.cjs.entry.js +2 -2
  9. package/dist/cjs/priv-navigator-button.cjs.entry.js +1 -1
  10. package/dist/cjs/priv-navigator-item.cjs.entry.js +1 -1
  11. package/dist/cjs/ripple.cjs.js +3 -3
  12. package/dist/cjs/wm-action-menu_2.cjs.entry.js +2 -2
  13. package/dist/cjs/wm-button.cjs.entry.js +2 -2
  14. package/dist/cjs/wm-chart-slice.cjs.entry.js +1 -1
  15. package/dist/cjs/wm-chart.cjs.entry.js +4 -4
  16. package/dist/cjs/wm-date-range.cjs.entry.js +37 -13
  17. package/dist/cjs/wm-datepicker.cjs.entry.js +12 -9
  18. package/dist/cjs/wm-file-list.cjs.entry.js +1 -1
  19. package/dist/cjs/wm-file.cjs.entry.js +2 -2
  20. package/dist/cjs/wm-input.cjs.entry.js +3 -3
  21. package/dist/cjs/wm-line-chart.cjs.entry.js +4 -4
  22. package/dist/cjs/wm-modal-footer.cjs.entry.js +1 -1
  23. package/dist/cjs/wm-modal-header.cjs.entry.js +3 -3
  24. package/dist/cjs/wm-modal.cjs.entry.js +3 -3
  25. package/dist/cjs/wm-navigation_3.cjs.entry.js +3 -3
  26. package/dist/cjs/wm-navigator.cjs.entry.js +2 -2
  27. package/dist/cjs/wm-option_2.cjs.entry.js +3 -3
  28. package/dist/cjs/wm-pagination.cjs.entry.js +2 -2
  29. package/dist/cjs/wm-progress-indicator_3.cjs.entry.js +3 -3
  30. package/dist/cjs/wm-search.cjs.entry.js +3 -3
  31. package/dist/cjs/wm-snackbar.cjs.entry.js +3 -3
  32. package/dist/cjs/wm-tab-item_3.cjs.entry.js +2 -2
  33. package/dist/cjs/wm-tag-input.cjs.entry.js +3 -3
  34. package/dist/cjs/wm-tag-option.cjs.entry.js +2 -2
  35. package/dist/cjs/wm-textarea.cjs.entry.js +3 -3
  36. package/dist/cjs/wm-timepicker.cjs.entry.js +2 -2
  37. package/dist/cjs/wm-toggletip.cjs.entry.js +2 -2
  38. package/dist/cjs/wm-uploader.cjs.entry.js +3 -3
  39. package/dist/cjs/wm-wrapper.cjs.entry.js +1 -1
  40. package/dist/collection/components/charts/chartFunctions.js +1 -1
  41. package/dist/collection/components/datepickers/datepicker.css +47 -5
  42. package/dist/collection/components/datepickers/priv-calendar/priv-calendar.css +92 -56
  43. package/dist/collection/components/datepickers/priv-calendar/priv-calendar.js +61 -45
  44. package/dist/collection/components/datepickers/wm-date-range.js +50 -19
  45. package/dist/collection/components/datepickers/wm-datepicker.js +14 -6
  46. package/dist/collection/components/wm-modal/wm-modal.css +0 -1
  47. package/dist/collection/dev/modal.js +15 -45
  48. package/dist/collection/global/functions.js +1 -1
  49. package/dist/esm/{chartFunctions-e2554a36.js → chartFunctions-036fdb89.js} +3 -3
  50. package/dist/esm/{functions-f65dbb96.js → functions-46843ea0.js} +1 -1
  51. package/dist/esm/{global-b3bbb95e.js → global-bcdca57d.js} +1 -1
  52. package/dist/esm/{index-f164fbca.js → index-558b5a82.js} +60 -2
  53. package/dist/esm/{intl-f7f77de7.js → intl-8b8740b9.js} +1 -1
  54. package/dist/esm/loader.js +4 -4
  55. package/dist/esm/priv-calendar.entry.js +64 -48
  56. package/dist/esm/priv-chart-popover.entry.js +2 -2
  57. package/dist/esm/priv-navigator-button.entry.js +1 -1
  58. package/dist/esm/priv-navigator-item.entry.js +1 -1
  59. package/dist/esm/ripple.js +4 -4
  60. package/dist/esm/wm-action-menu_2.entry.js +2 -2
  61. package/dist/esm/wm-button.entry.js +2 -2
  62. package/dist/esm/wm-chart-slice.entry.js +1 -1
  63. package/dist/esm/wm-chart.entry.js +4 -4
  64. package/dist/esm/wm-date-range.entry.js +37 -13
  65. package/dist/esm/wm-datepicker.entry.js +12 -9
  66. package/dist/esm/wm-file-list.entry.js +1 -1
  67. package/dist/esm/wm-file.entry.js +2 -2
  68. package/dist/esm/wm-input.entry.js +3 -3
  69. package/dist/esm/wm-line-chart.entry.js +4 -4
  70. package/dist/esm/wm-modal-footer.entry.js +1 -1
  71. package/dist/esm/wm-modal-header.entry.js +3 -3
  72. package/dist/esm/wm-modal.entry.js +3 -3
  73. package/dist/esm/wm-navigation_3.entry.js +3 -3
  74. package/dist/esm/wm-navigator.entry.js +2 -2
  75. package/dist/esm/wm-option_2.entry.js +3 -3
  76. package/dist/esm/wm-pagination.entry.js +2 -2
  77. package/dist/esm/wm-progress-indicator_3.entry.js +3 -3
  78. package/dist/esm/wm-search.entry.js +3 -3
  79. package/dist/esm/wm-snackbar.entry.js +3 -3
  80. package/dist/esm/wm-tab-item_3.entry.js +2 -2
  81. package/dist/esm/wm-tag-input.entry.js +3 -3
  82. package/dist/esm/wm-tag-option.entry.js +2 -2
  83. package/dist/esm/wm-textarea.entry.js +3 -3
  84. package/dist/esm/wm-timepicker.entry.js +2 -2
  85. package/dist/esm/wm-toggletip.entry.js +2 -2
  86. package/dist/esm/wm-uploader.entry.js +3 -3
  87. package/dist/esm/wm-wrapper.entry.js +1 -1
  88. package/dist/esm-es5/{chartFunctions-e2554a36.js → chartFunctions-036fdb89.js} +1 -1
  89. package/dist/esm-es5/{functions-f65dbb96.js → functions-46843ea0.js} +1 -1
  90. package/dist/esm-es5/{global-b3bbb95e.js → global-bcdca57d.js} +1 -1
  91. package/dist/esm-es5/index-558b5a82.js +1 -0
  92. package/dist/esm-es5/{intl-f7f77de7.js → intl-8b8740b9.js} +1 -1
  93. package/dist/esm-es5/loader.js +1 -1
  94. package/dist/esm-es5/priv-calendar.entry.js +1 -1
  95. package/dist/esm-es5/priv-chart-popover.entry.js +1 -1
  96. package/dist/esm-es5/priv-navigator-button.entry.js +1 -1
  97. package/dist/esm-es5/priv-navigator-item.entry.js +1 -1
  98. package/dist/esm-es5/ripple.js +1 -1
  99. package/dist/esm-es5/wm-action-menu_2.entry.js +1 -1
  100. package/dist/esm-es5/wm-button.entry.js +1 -1
  101. package/dist/esm-es5/wm-chart-slice.entry.js +1 -1
  102. package/dist/esm-es5/wm-chart.entry.js +1 -1
  103. package/dist/esm-es5/wm-date-range.entry.js +1 -1
  104. package/dist/esm-es5/wm-datepicker.entry.js +1 -1
  105. package/dist/esm-es5/wm-file-list.entry.js +1 -1
  106. package/dist/esm-es5/wm-file.entry.js +1 -1
  107. package/dist/esm-es5/wm-input.entry.js +1 -1
  108. package/dist/esm-es5/wm-line-chart.entry.js +1 -1
  109. package/dist/esm-es5/wm-modal-footer.entry.js +1 -1
  110. package/dist/esm-es5/wm-modal-header.entry.js +1 -1
  111. package/dist/esm-es5/wm-modal.entry.js +1 -1
  112. package/dist/esm-es5/wm-navigation_3.entry.js +1 -1
  113. package/dist/esm-es5/wm-navigator.entry.js +1 -1
  114. package/dist/esm-es5/wm-option_2.entry.js +1 -1
  115. package/dist/esm-es5/wm-pagination.entry.js +1 -1
  116. package/dist/esm-es5/wm-progress-indicator_3.entry.js +1 -1
  117. package/dist/esm-es5/wm-search.entry.js +1 -1
  118. package/dist/esm-es5/wm-snackbar.entry.js +1 -1
  119. package/dist/esm-es5/wm-tab-item_3.entry.js +1 -1
  120. package/dist/esm-es5/wm-tag-input.entry.js +1 -1
  121. package/dist/esm-es5/wm-tag-option.entry.js +1 -1
  122. package/dist/esm-es5/wm-textarea.entry.js +1 -1
  123. package/dist/esm-es5/wm-timepicker.entry.js +1 -1
  124. package/dist/esm-es5/wm-toggletip.entry.js +1 -1
  125. package/dist/esm-es5/wm-uploader.entry.js +1 -1
  126. package/dist/esm-es5/wm-wrapper.entry.js +1 -1
  127. package/dist/ripple/{p-5dbad2ff.entry.js → p-09a31f0c.entry.js} +1 -1
  128. package/dist/ripple/{p-ae8ad491.entry.js → p-0dc51fad.entry.js} +1 -1
  129. package/dist/ripple/{p-c38f2a00.system.entry.js → p-0ea8609b.system.entry.js} +1 -1
  130. package/dist/ripple/{p-ae32eb8d.system.js → p-1ac66a15.system.js} +1 -1
  131. package/dist/ripple/{p-eb649319.system.js → p-1c32dc29.system.js} +1 -1
  132. package/dist/ripple/{p-2bac4b4e.system.entry.js → p-240124b0.system.entry.js} +1 -1
  133. package/dist/ripple/{p-ef3fe609.system.entry.js → p-26fbc7f5.system.entry.js} +1 -1
  134. package/dist/ripple/{p-45126063.system.entry.js → p-294b38ca.system.entry.js} +1 -1
  135. package/dist/ripple/{p-76d2dada.entry.js → p-2b05bf05.entry.js} +1 -1
  136. package/dist/ripple/{p-3db9e0d8.system.entry.js → p-2ba7e68e.system.entry.js} +1 -1
  137. package/dist/ripple/{p-d88d806e.js → p-2de2c954.js} +1 -1
  138. package/dist/ripple/{p-b0579a2a.system.entry.js → p-311923b2.system.entry.js} +1 -1
  139. package/dist/ripple/p-3183bba8.entry.js +1 -0
  140. package/dist/ripple/{p-04bf6c89.entry.js → p-31976813.entry.js} +1 -1
  141. package/dist/ripple/{p-7e56da2e.system.entry.js → p-32bf3f5b.system.entry.js} +1 -1
  142. package/dist/ripple/{p-2197287c.entry.js → p-33679b9d.entry.js} +1 -1
  143. package/dist/ripple/p-34b5830f.system.js +1 -0
  144. package/dist/ripple/{p-30a9ba6e.entry.js → p-3568472c.entry.js} +1 -1
  145. package/dist/ripple/{p-d265a41e.entry.js → p-359d45dc.entry.js} +1 -1
  146. package/dist/ripple/{p-98120733.entry.js → p-3a44e1c8.entry.js} +1 -1
  147. package/dist/ripple/{p-8f38dc86.entry.js → p-42d1c301.entry.js} +1 -1
  148. package/dist/ripple/{p-4e616347.entry.js → p-45abd8fe.entry.js} +1 -1
  149. package/dist/ripple/{p-3a070f35.entry.js → p-48e09589.entry.js} +1 -1
  150. package/dist/ripple/{p-d325a37b.entry.js → p-4b0d5b98.entry.js} +1 -1
  151. package/dist/ripple/{p-ff80aadd.system.entry.js → p-4e56f3f5.system.entry.js} +1 -1
  152. package/dist/ripple/{p-780d4673.system.entry.js → p-5029fcd8.system.entry.js} +1 -1
  153. package/dist/ripple/p-54922aa3.system.entry.js +1 -0
  154. package/dist/ripple/p-568c595f.js +2 -0
  155. package/dist/ripple/{p-c717d895.entry.js → p-591918a4.entry.js} +1 -1
  156. package/dist/ripple/p-5b9de05a.system.entry.js +1 -0
  157. package/dist/ripple/{p-5a04c222.entry.js → p-5d9bccfb.entry.js} +1 -1
  158. package/dist/ripple/p-61bcfba6.system.js +1 -0
  159. package/dist/ripple/{p-0b77b2a1.entry.js → p-624a2812.entry.js} +1 -1
  160. package/dist/ripple/{p-f6f29a56.entry.js → p-62a8f09c.entry.js} +1 -1
  161. package/dist/ripple/{p-92c1ff36.system.entry.js → p-64e929d6.system.entry.js} +1 -1
  162. package/dist/ripple/{p-a99b05de.system.entry.js → p-65d26233.system.entry.js} +1 -1
  163. package/dist/ripple/p-685db40b.entry.js +1 -0
  164. package/dist/ripple/{p-7a9ffbcb.system.entry.js → p-79106e23.system.entry.js} +1 -1
  165. package/dist/ripple/p-7e6f5a1e.system.entry.js +1 -0
  166. package/dist/ripple/{p-625aeeec.system.entry.js → p-8029af07.system.entry.js} +1 -1
  167. package/dist/ripple/{p-79af9baf.entry.js → p-8159cdf5.entry.js} +1 -1
  168. package/dist/ripple/{p-7573a2fa.entry.js → p-822618d7.entry.js} +1 -1
  169. package/dist/ripple/{p-11383396.system.entry.js → p-86d655fb.system.entry.js} +1 -1
  170. package/dist/ripple/{p-cda6c77e.entry.js → p-884294c6.entry.js} +1 -1
  171. package/dist/ripple/{p-25446670.entry.js → p-88ebddd7.entry.js} +1 -1
  172. package/dist/ripple/{p-f93858ad.system.entry.js → p-8fbddb6c.system.entry.js} +1 -1
  173. package/dist/ripple/{p-63fabfed.entry.js → p-902a54c5.entry.js} +1 -1
  174. package/dist/ripple/{p-8081f931.system.entry.js → p-a152cf3a.system.entry.js} +1 -1
  175. package/dist/ripple/{p-19dec591.entry.js → p-a37cf34a.entry.js} +1 -1
  176. package/dist/ripple/p-ab8d78cc.system.js +2 -0
  177. package/dist/ripple/p-b516b418.entry.js +1 -0
  178. package/dist/ripple/{p-9d8c2a52.system.entry.js → p-b7ead395.system.entry.js} +1 -1
  179. package/dist/ripple/{p-109684b1.entry.js → p-bc5e9d24.entry.js} +1 -1
  180. package/dist/ripple/{p-635f40b1.entry.js → p-c4b9d46d.entry.js} +1 -1
  181. package/dist/ripple/{p-379fe53e.entry.js → p-c885c7f9.entry.js} +1 -1
  182. package/dist/ripple/{p-88406560.system.entry.js → p-c91b10f3.system.entry.js} +1 -1
  183. package/dist/ripple/{p-577ea283.system.entry.js → p-c9543950.system.entry.js} +1 -1
  184. package/dist/ripple/{p-7144d185.system.entry.js → p-cacfbaf1.system.entry.js} +1 -1
  185. package/dist/ripple/{p-22e6104e.entry.js → p-cc4a429b.entry.js} +1 -1
  186. package/dist/ripple/{p-dcfdbd30.entry.js → p-ce9a8bd1.entry.js} +1 -1
  187. package/dist/ripple/{p-32cf6907.system.entry.js → p-d24882a7.system.entry.js} +1 -1
  188. package/dist/ripple/{p-84926b89.system.entry.js → p-d33d6e96.system.entry.js} +1 -1
  189. package/dist/ripple/{p-5bbf7fdc.system.js → p-d4b209ec.system.js} +1 -1
  190. package/dist/ripple/{p-5b2c1bd1.js → p-d79fdf0b.js} +1 -1
  191. package/dist/ripple/p-d837c1f5.js +1 -0
  192. package/dist/ripple/{p-48a6acfa.system.entry.js → p-df1a11f1.system.entry.js} +1 -1
  193. package/dist/ripple/p-df2560f3.system.entry.js +1 -0
  194. package/dist/ripple/{p-b0f14557.system.entry.js → p-e3bcdde8.system.entry.js} +1 -1
  195. package/dist/ripple/{p-c51293e2.entry.js → p-e83a98d3.entry.js} +1 -1
  196. package/dist/ripple/{p-ba751ca4.js → p-e995f7f0.js} +1 -1
  197. package/dist/ripple/{p-1cb6b37e.entry.js → p-eaac6bcd.entry.js} +1 -1
  198. package/dist/ripple/p-f67fd802.system.entry.js +1 -0
  199. package/dist/ripple/{p-c8873e0c.system.entry.js → p-fe8d02c3.system.entry.js} +1 -1
  200. package/dist/ripple/{p-d7c47dc0.system.entry.js → p-ff23d5e2.system.entry.js} +1 -1
  201. package/dist/ripple/{p-bd27ded2.system.entry.js → p-ffb31979.system.entry.js} +1 -1
  202. package/dist/ripple/ripple.esm.js +1 -1
  203. package/dist/ripple/ripple.js +1 -1
  204. package/dist/types/components/datepickers/wm-datepicker.d.ts +2 -2
  205. package/dist/types/components.d.ts +4 -4
  206. package/dist/types/global/functions.d.ts +6 -0
  207. package/package.json +1 -1
  208. package/dist/esm-es5/index-f164fbca.js +0 -1
  209. package/dist/ripple/p-0fe97e85.system.js +0 -2
  210. package/dist/ripple/p-24d88d8d.system.entry.js +0 -1
  211. package/dist/ripple/p-41e8a079.entry.js +0 -1
  212. package/dist/ripple/p-4272aa37.system.js +0 -1
  213. package/dist/ripple/p-4de51706.js +0 -2
  214. package/dist/ripple/p-6dc3ee86.system.js +0 -1
  215. package/dist/ripple/p-720b6ab0.entry.js +0 -1
  216. package/dist/ripple/p-7f4b4071.system.entry.js +0 -1
  217. package/dist/ripple/p-9c6d6b26.system.entry.js +0 -1
  218. package/dist/ripple/p-ca9d9447.system.entry.js +0 -1
  219. package/dist/ripple/p-ce5455a3.system.entry.js +0 -1
  220. package/dist/ripple/p-f79a6e32.js +0 -1
  221. package/dist/ripple/p-fc7e5296.entry.js +0 -1
@@ -35,6 +35,22 @@
35
35
  --wmcolor-calendar-range-background: var(--wmcolor-interactive-background-hover);
36
36
  --wmcolor-datepicker-range-background-hover: var(--wmcolor-datepicker-day-background-hover);
37
37
  --wmcolor-datepicker-range-background-selected: var(--wmcolor-background-selected);
38
+ --range-start-svg: url('data:image/svg+xml,<svg width="44" height="44" viewBox="0 0 44 44" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0 6C0 2.68629 2.68629 0 6 0H28.8457C31.0777 0 33.1251 1.23886 34.1607 3.21596L42.5417 19.216C43.455 20.9596 43.455 23.0404 42.5417 24.784L34.1607 40.784C33.1251 42.7611 31.0777 44 28.8458 44H6C2.68629 44 0 41.3137 0 38V6Z" fill="%23575195"/></svg>');
39
+ --range-end-svg: url('data:image/svg+xml,<svg width="44" height="44" viewBox="0 0 44 44" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M44 6C44 2.68629 41.3137 0 38 0H15.1543C12.9223 0 10.8749 1.23886 9.83926 3.21596L1.45831 19.216C0.544956 20.9596 0.54496 23.0404 1.45831 24.784L9.83926 40.784C10.8749 42.7611 12.9223 44 15.1542 44H38C41.3137 44 44 41.3137 44 38V6Z" fill="%23575195"/></svg>');
40
+ --range-background-selected: linear-gradient(
41
+ transparent,
42
+ transparent 5px,
43
+ var(--wmcolor-datepicker-range-background-selected) 5px,
44
+ var(--wmcolor-datepicker-range-background-selected) 39px,
45
+ transparent 39px
46
+ );
47
+ --range-background-hover: linear-gradient(
48
+ transparent,
49
+ transparent 5px,
50
+ var(--wmcolor-datepicker-range-background-hover) 5px,
51
+ var(--wmcolor-datepicker-range-background-hover) 39px,
52
+ transparent 39px
53
+ );
38
54
  }
39
55
  :host priv-calendar + priv-calendar {
40
56
  border-inline-start: 1px solid var(--wmcolor-calendar-border);
@@ -110,7 +126,7 @@
110
126
  z-index: 10;
111
127
  position: absolute;
112
128
  left: 0;
113
- top: 40px;
129
+ top: calc(100% + 2px);
114
130
  min-height: 21.0625rem;
115
131
  transition: transform 0.25s ease;
116
132
  transform-origin: center top;
@@ -264,7 +280,7 @@
264
280
  font-weight: 500;
265
281
  position: relative;
266
282
  display: flex;
267
- flex: 1 1 2.75rem;
283
+ flex: 1 0 2.75rem;
268
284
  align-items: center;
269
285
  justify-content: center;
270
286
  }
@@ -274,80 +290,102 @@
274
290
  .popup-wrapper .day-view .date-grid .date-cell:hover {
275
291
  background-color: var(--wmcolor-datepicker-day-background-hover);
276
292
  }
277
- .popup-wrapper .day-view .date-grid .date-cell:hover:not(.preview, .range-start, .range-end) {
278
- margin: 1px;
279
- flex: 1 0 42px;
280
- }
281
293
  .popup-wrapper .day-view .date-grid .date-cell[aria-selected=true] {
282
294
  background-color: var(--wmcolor-datepicker-day-background-selected);
283
295
  color: var(--wmcolor-datepicker-day-text-selected);
284
296
  }
285
297
  .popup-wrapper .day-view .date-grid .date-cell.in-range {
286
- background: var(--wmcolor-datepicker-range-background-selected);
287
- margin-inline: 0;
298
+ background: var(--range-background-selected);
288
299
  border-radius: 0;
289
- flex-shrink: 0;
290
- margin-top: 5px;
291
- margin-bottom: 5px;
292
300
  }
293
301
  .popup-wrapper .day-view .date-grid .date-cell.in-range.range-start:not(.preview):hover {
294
- border-top-left-radius: 22px;
295
- border-bottom-left-radius: 22px;
302
+ background-repeat: no-repeat;
303
+ background-position: center, center left 17px;
296
304
  }
297
305
  .popup-wrapper .day-view .date-grid .date-cell.in-range.range-end:not(.preview):hover {
298
- border-top-right-radius: 22px;
299
- border-bottom-right-radius: 22px;
306
+ background-position: center, center right 17px;
307
+ background-repeat: no-repeat;
300
308
  }
301
309
  .popup-wrapper .day-view .date-grid .date-cell.in-range:not(.preview):hover {
302
- background-image: radial-gradient(#dbd9ef 20px, transparent 21px), linear-gradient(transparent, transparent 5px, var(--wmcolor-datepicker-range-background-selected) 5px, var(--wmcolor-datepicker-range-background-selected) 39px, transparent 39px);
303
- margin: 0;
304
- flex: 1 0 44px;
305
- background-color: transparent;
310
+ background-image: radial-gradient(#dbd9ef 20px, transparent 21px), var(--range-background-selected);
306
311
  color: var(--wmcolor-datepicker-day-text);
307
312
  }
308
- .popup-wrapper .day-view .date-grid .date-cell.in-range.preview:not(.range-start):not(.range-end) {
313
+ .popup-wrapper .day-view .date-grid .date-cell.in-range.preview {
309
314
  position: relative;
310
- background-color: var(--wmcolor-datepicker-range-background-hover);
315
+ background-image: var(--range-background-hover);
311
316
  }
312
- .popup-wrapper .day-view .date-grid .date-cell.in-range.preview-end:first-child, .popup-wrapper .day-view .date-grid .date-cell.in-range.preview-end.first-of-month, .popup-wrapper .day-view .date-grid .date-cell.in-range.preview-start:first-child, .popup-wrapper .day-view .date-grid .date-cell.in-range.preview-start.first-of-month {
313
- border-top-left-radius: 22px;
314
- border-bottom-left-radius: 22px;
317
+ .popup-wrapper .day-view .date-grid .date-cell.in-range.preview:last-child:not(.preview-start, .preview-end, .range-start, .range-end), .popup-wrapper .day-view .date-grid .date-cell.in-range.preview:last-of-type:not(.preview-start, .preview-end, .range-start, .range-end), .popup-wrapper .day-view .date-grid .date-cell.in-range.preview:first-child:not(.preview-start, .preview-end, .range-start, .range-end), .popup-wrapper .day-view .date-grid .date-cell.in-range.preview:first-of-type:not(.preview-start, .preview-end, .range-start, .range-end), .popup-wrapper .day-view .date-grid .date-cell.in-range.preview.last-of-month:not(.preview-start, .preview-end, .range-start, .range-end), .popup-wrapper .day-view .date-grid .date-cell.in-range.preview.first-of-month:not(.preview-start, .preview-end, .range-start, .range-end) {
318
+ background-image: radial-gradient(var(--wmcolor-datepicker-range-background-hover) 16px, transparent 17px), var(--range-background-hover);
319
+ background-repeat: no-repeat;
315
320
  }
316
- .popup-wrapper .day-view .date-grid .date-cell.in-range.preview-end:hover:before, .popup-wrapper .day-view .date-grid .date-cell.in-range.preview-start:hover:before {
317
- content: "";
318
- position: absolute;
319
- border-radius: 50%;
320
- outline: 3px solid var(--wmcolor-calendar-day-border-hover);
321
- height: 34px;
322
- width: 34px;
323
- pointer-events: none;
321
+ .popup-wrapper .day-view .date-grid .date-cell.in-range.preview:first-child:not(.preview-start, .preview-end, .range-start, .range-end), .popup-wrapper .day-view .date-grid .date-cell.in-range.preview:first-of-type:not(.preview-start, .preview-end, .range-start, .range-end), .popup-wrapper .day-view .date-grid .date-cell.in-range.preview.first-of-month:not(.preview-start, .preview-end, .range-start, .range-end) {
322
+ background-position: center left -5px, center left 17px;
323
+ }
324
+ .popup-wrapper .day-view .date-grid .date-cell.in-range.preview:last-child:not(.preview-start, .preview-end, .range-start, .range-end), .popup-wrapper .day-view .date-grid .date-cell.in-range.preview:last-of-type:not(.preview-start, .preview-end, .range-start, .range-end), .popup-wrapper .day-view .date-grid .date-cell.in-range.preview.last-of-month:not(.preview-start, .preview-end, .range-start, .range-end) {
325
+ background-position: center right -5px, center right 17px;
326
+ }
327
+ .popup-wrapper .day-view .date-grid .date-cell.in-range.preview.last-of-month:first-child:not(.preview-start, .preview-end) {
328
+ background-image: radial-gradient(var(--wmcolor-datepicker-range-background-hover) 16px, transparent 17px), radial-gradient(var(--wmcolor-datepicker-range-background-hover) 16px, transparent 17px), linear-gradient(transparent, transparent 15px, var(--wmcolor-datepicker-range-background-hover) 15px, var(--wmcolor-datepicker-range-background-hover) 29px, transparent 29px);
329
+ background-position: center left -5px, center right -5px, center;
330
+ background-size: auto, auto, 9px;
331
+ }
332
+ .popup-wrapper .day-view .date-grid .date-cell.in-range.preview-start:last-child, .popup-wrapper .day-view .date-grid .date-cell.in-range.preview-end:first-child {
333
+ background-image: radial-gradient(var(--wmcolor-datepicker-range-background-hover) 17px, var(--wmcolor-calendar-day-border-hover) 18px, var(--wmcolor-calendar-day-border-hover) 20px, transparent 21px);
324
334
  }
325
335
  .popup-wrapper .day-view .date-grid .date-cell.in-range.preview-start {
326
- border-top-left-radius: 22px;
327
- border-bottom-left-radius: 22px;
336
+ background-position: center, center left 17px;
337
+ background-repeat: no-repeat;
338
+ }
339
+ .popup-wrapper .day-view .date-grid .date-cell.in-range.preview-start:first-child {
340
+ background-position: center, center left 17px;
341
+ background-repeat: no-repeat;
328
342
  }
329
343
  .popup-wrapper .day-view .date-grid .date-cell.in-range.preview-end {
330
- border-top-right-radius: 22px;
331
- border-bottom-right-radius: 22px;
344
+ background-position: center, center right 17px;
345
+ background-repeat: no-repeat;
346
+ }
347
+ .popup-wrapper .day-view .date-grid .date-cell.in-range.preview-end:last-child {
348
+ background-position: center, center right 17px;
349
+ background-repeat: no-repeat;
350
+ }
351
+ .popup-wrapper .day-view .date-grid .date-cell.in-range.preview-end, .popup-wrapper .day-view .date-grid .date-cell.in-range.preview-start {
352
+ background-image: radial-gradient(var(--wmcolor-datepicker-range-background-hover) 17px, var(--wmcolor-calendar-day-border-hover) 18px, var(--wmcolor-calendar-day-border-hover) 20px, transparent 21px), var(--range-background-hover);
353
+ }
354
+ .popup-wrapper .day-view .date-grid .date-cell.in-range:first-of-type:not(.preview-start, .preview-end, .range-start, .range-end), .popup-wrapper .day-view .date-grid .date-cell.in-range:first-child:not(.preview-start, .preview-end, .range-start, .range-end) {
355
+ background-image: radial-gradient(var(--wmcolor-datepicker-range-background-selected) 16px, transparent 17px), var(--range-background-selected);
356
+ background-position: -5px center, center left 17px;
357
+ background-repeat: no-repeat;
358
+ }
359
+ .popup-wrapper .day-view .date-grid .date-cell.in-range:first-of-type:not(.preview-start, .preview-end, .range-start, .range-end):hover, .popup-wrapper .day-view .date-grid .date-cell.in-range:first-child:not(.preview-start, .preview-end, .range-start, .range-end):hover {
360
+ background-image: radial-gradient(#dbd9ef 20px, transparent 21px), radial-gradient(var(--wmcolor-datepicker-range-background-selected) 16px, transparent 17px), var(--range-background-selected);
361
+ background-position: center, -5px center, center left 17px;
362
+ background-repeat: no-repeat;
332
363
  }
333
- .popup-wrapper .day-view .date-grid .date-cell.in-range:first-of-type:not(.range-start, .range-end), .popup-wrapper .day-view .date-grid .date-cell.in-range:first-child:not(.range-start, .range-end), .popup-wrapper .day-view .date-grid .date-cell.in-range.first-of-month:not(.range-start, .range-end) {
334
- border-top-left-radius: 22px;
335
- border-bottom-left-radius: 22px;
364
+ .popup-wrapper .day-view .date-grid .date-cell.in-range.range-start:last-child:hover, .popup-wrapper .day-view .date-grid .date-cell.in-range.range-end:first-child:hover {
365
+ background: radial-gradient(#dbd9ef 20px, transparent 21px);
366
+ background-position: center;
336
367
  }
337
- .popup-wrapper .day-view .date-grid .date-cell.in-range:last-of-type:not(.range-start, .range-end), .popup-wrapper .day-view .date-grid .date-cell.in-range:last-child:not(.range-start, .range-end), .popup-wrapper .day-view .date-grid .date-cell.in-range.last-of-month:not(.range-start, .range-end) {
338
- border-top-right-radius: 22px;
339
- border-bottom-right-radius: 22px;
368
+ .popup-wrapper .day-view .date-grid .date-cell.in-range:last-of-type:not(.range-start, .range-end, .preview), .popup-wrapper .day-view .date-grid .date-cell.in-range:last-child:not(.range-start, .range-end, .preview), .popup-wrapper .day-view .date-grid .date-cell.in-range.last-of-month:not(.range-start, .range-end, .preview) {
369
+ background: radial-gradient(var(--wmcolor-datepicker-range-background-selected) 16px, transparent 17px), var(--range-background-selected);
370
+ background-position: 5px center, center right 17px;
371
+ background-repeat: no-repeat;
372
+ }
373
+ .popup-wrapper .day-view .date-grid .date-cell.in-range:last-of-type:not(.range-start, .range-end, .preview-start, .preview-end):hover, .popup-wrapper .day-view .date-grid .date-cell.in-range:last-child:not(.range-start, .range-end, .preview-start, .preview-end):hover, .popup-wrapper .day-view .date-grid .date-cell.in-range.last-of-month:not(.range-start, .range-end, .preview-start, .preview-end):hover {
374
+ background-image: radial-gradient(#dbd9ef 20px, transparent 21px), radial-gradient(var(--wmcolor-datepicker-range-background-selected) 16px, transparent 17px), var(--range-background-selected);
375
+ background-position: center, 5px center, center right 17px;
376
+ background-repeat: no-repeat;
340
377
  }
341
378
  .popup-wrapper .day-view .date-grid .date-cell.today:after {
342
379
  content: "";
343
380
  display: block;
344
381
  position: absolute;
345
- inset: auto 0 2px 0;
382
+ inset: auto 0 6px 0;
346
383
  width: 6px;
347
384
  aspect-ratio: 1;
348
385
  border-radius: 50%;
349
386
  justify-self: center;
350
387
  background-color: var(--wmcolor-datepicker-day-background-selected);
388
+ margin: auto;
351
389
  }
352
390
  .popup-wrapper .day-view .date-grid .date-cell.range-start, .popup-wrapper .day-view .date-grid .date-cell.range-end {
353
391
  border-radius: 0;
@@ -355,28 +393,30 @@
355
393
  outline: none;
356
394
  font-weight: 600;
357
395
  color: var(--wmcolor-datepicker-day-text-selected);
358
- flex-shrink: 0;
359
396
  }
360
397
  .popup-wrapper .day-view .date-grid .date-cell.range-start {
361
- background-image: url('data:image/svg+xml,<svg width="44" height="44" viewBox="0 0 44 44" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0 6C0 2.68629 2.68629 0 6 0H28.8457C31.0777 0 33.1251 1.23886 34.1607 3.21596L42.5417 19.216C43.455 20.9596 43.455 23.0404 42.5417 24.784L34.1607 40.784C33.1251 42.7611 31.0777 44 28.8458 44H6C2.68629 44 0 41.3137 0 38V6Z" fill="%23575195"/></svg>');
398
+ background-image: var(--range-start-svg);
362
399
  padding-inline-end: 2px;
363
400
  background-color: transparent;
364
401
  }
365
- .popup-wrapper .day-view .date-grid .date-cell.range-start.in-range {
366
- background-image: url('data:image/svg+xml,<svg width="44" height="44" viewBox="0 0 44 44" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0 6C0 2.68629 2.68629 0 6 0H28.8457C31.0777 0 33.1251 1.23886 34.1607 3.21596L42.5417 19.216C43.455 20.9596 43.455 23.0404 42.5417 24.784L34.1607 40.784C33.1251 42.7611 31.0777 44 28.8458 44H6C2.68629 44 0 41.3137 0 38V6Z" fill="%23575195"/></svg>'), linear-gradient(transparent, transparent 5px, var(--wmcolor-datepicker-range-background-selected) 5px, var(--wmcolor-datepicker-range-background-selected) 39px, transparent 39px);
402
+ .popup-wrapper .day-view .date-grid .date-cell.range-start.in-range:not(:last-of-type, :last-child) {
403
+ background-image: var(--range-start-svg), var(--range-background-selected);
367
404
  border-radius: 0;
368
405
  }
369
- .popup-wrapper .day-view .date-grid .date-cell.range-start.in-range.preview {
370
- background-image: url('data:image/svg+xml,<svg width="44" height="44" viewBox="0 0 44 44" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0 6C0 2.68629 2.68629 0 6 0H28.8457C31.0777 0 33.1251 1.23886 34.1607 3.21596L42.5417 19.216C43.455 20.9596 43.455 23.0404 42.5417 24.784L34.1607 40.784C33.1251 42.7611 31.0777 44 28.8458 44H6C2.68629 44 0 41.3137 0 38V6Z" fill="%23575195"/></svg>'), linear-gradient(transparent, transparent 5px, var(--wmcolor-datepicker-range-background-hover) 5px, var(--wmcolor-datepicker-range-background-hover) 39px, transparent 39px);
406
+ .popup-wrapper .day-view .date-grid .date-cell.range-start.in-range.preview:not(:last-of-type, :last-child) {
407
+ background-image: var(--range-start-svg), var(--range-background-hover);
371
408
  }
372
409
  .popup-wrapper .day-view .date-grid .date-cell.range-end {
373
- background-image: url('data:image/svg+xml,<svg width="44" height="44" viewBox="0 0 44 44" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M44 6C44 2.68629 41.3137 0 38 0H15.1543C12.9223 0 10.8749 1.23886 9.83926 3.21596L1.45831 19.216C0.544956 20.9596 0.54496 23.0404 1.45831 24.784L9.83926 40.784C10.8749 42.7611 12.9223 44 15.1542 44H38C41.3137 44 44 41.3137 44 38V6Z" fill="%23575195"/></svg>'), linear-gradient(transparent, transparent 5px, var(--wmcolor-datepicker-range-background-selected) 5px, var(--wmcolor-datepicker-range-background-selected) 39px, transparent 39px);
410
+ background-image: var(--range-end-svg);
374
411
  padding-inline-start: 2px;
375
412
  background-color: transparent;
413
+ }
414
+ .popup-wrapper .day-view .date-grid .date-cell.range-end.in-range:not(:first-of-type, :first-child) {
415
+ background-image: var(--range-end-svg), var(--range-background-selected);
376
416
  border-radius: 0;
377
417
  }
378
- .popup-wrapper .day-view .date-grid .date-cell.range-end.preview {
379
- background-image: url('data:image/svg+xml,<svg width="44" height="44" viewBox="0 0 44 44" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M44 6C44 2.68629 41.3137 0 38 0H15.1543C12.9223 0 10.8749 1.23886 9.83926 3.21596L1.45831 19.216C0.544956 20.9596 0.54496 23.0404 1.45831 24.784L9.83926 40.784C10.8749 42.7611 12.9223 44 15.1542 44H38C41.3137 44 44 41.3137 44 38V6Z" fill="%23575195"/></svg>'), linear-gradient(transparent, transparent 5px, var(--wmcolor-datepicker-range-background-hover) 5px, var(--wmcolor-datepicker-range-background-hover) 39px, transparent 39px);
418
+ .popup-wrapper .day-view .date-grid .date-cell.range-end.in-range.preview:not(:first-of-type, :first-child) {
419
+ background-image: var(--range-end-svg), var(--range-background-hover);
380
420
  }
381
421
  .popup-wrapper .day-view .date-grid .date-cell.range-start.range-end {
382
422
  background: var(--wmcolor-datepicker-day-background-selected);
@@ -385,10 +425,6 @@
385
425
  margin: 1px;
386
426
  flex-basis: 42px;
387
427
  }
388
- .popup-wrapper .day-view .date-grid .date-cell:active {
389
- background-color: var(--wmcolor-datepicker-day-background-selected);
390
- color: var(--wmcolor-datepicker-day-text-selected);
391
- }
392
428
  .popup-wrapper .month-view .months {
393
429
  border-top: 2px solid;
394
430
  border-top-color: var(--wmcolor-datepicker-month-border);
@@ -3,6 +3,12 @@ import { intl, dateFind, getMonthLength, makeISO, calendar_months, weekdays } fr
3
3
  export class PrivCalendar {
4
4
  constructor() {
5
5
  this.today = this.dateToISO(new Date());
6
+ this.calType = "single";
7
+ this.calName = "";
8
+ this.calInstructions = intl.formatMessage({
9
+ id: "date.instructions",
10
+ defaultMessage: "Use arrows to select a date in the table. Tab left or right to buttons for selecting previous month, next month, or the month selection table.",
11
+ });
6
12
  this._focus = {
7
13
  year: {
8
14
  asString: () => dateFind.year.asString(this.focusDate),
@@ -105,45 +111,49 @@ export class PrivCalendar {
105
111
  const monthOfDate = dateFind.month.asInt(date);
106
112
  const dayOfDate = dateFind.day.asInt(date);
107
113
  const yearOfDate = dateFind.year.asInt(date);
108
- const isToday = date === this.today;
109
114
  const isStartDate = this.startDate && this.startDate === date;
110
- const isEndDate = eitherStart && this.endDate && this.endDate === date && eitherStart < this.endDate;
111
- const isFirstOfMonth = dayOfDate === 1;
112
- const isLastOfMonth = dayOfDate === getMonthLength(monthOfDate, yearOfDate);
113
- const isInRange = this.isInRange(date);
114
- const isInRangePreview = this.isInRangePreview(date);
115
- const isPreviewStartOrEnd = !eitherEnd && eitherStart && this.hoverDate && date === this.hoverDate;
116
- const isPreviewStart = isPreviewStartOrEnd && this.hoverDate < eitherStart;
117
- const isPreviewEnd = isPreviewStartOrEnd && this.hoverDate > eitherStart;
118
- const isFocused = date === this.focusDate;
115
+ let selected = isStartDate ? "true" : "false";
119
116
  const classesArr = ["date-cell"];
117
+ const isFocused = date === this.focusDate;
118
+ const isToday = date === this.today;
120
119
  if (isToday)
121
120
  classesArr.push("today");
122
- if (isFirstOfMonth)
123
- classesArr.push("first-of-month");
124
- if (isLastOfMonth)
125
- classesArr.push("last-of-month");
126
- if (isStartDate) {
127
- if (isInRangePreview && !isEndDate && this.hoverDate && this.hoverDate < this.startDate) {
128
- // invert the arrow direction if user mouses over a prior date
129
- classesArr.push("range-end");
130
- }
131
- else {
132
- classesArr.push("range-start");
121
+ if (this.calType === "range") {
122
+ const isEndDate = eitherStart && this.endDate && this.endDate === date && eitherStart < this.endDate;
123
+ selected = isEndDate ? "true" : selected;
124
+ const isFirstOfMonth = dayOfDate === 1;
125
+ const isLastOfMonth = dayOfDate === getMonthLength(monthOfDate, yearOfDate);
126
+ const isInRange = this.isInRange(date);
127
+ const isInRangePreview = this.isInRangePreview(date);
128
+ const isPreviewStartOrEnd = !eitherEnd && eitherStart && this.hoverDate && date === this.hoverDate;
129
+ const isPreviewStart = isPreviewStartOrEnd && this.hoverDate < eitherStart;
130
+ const isPreviewEnd = isPreviewStartOrEnd && this.hoverDate > eitherStart;
131
+ if (isFirstOfMonth)
132
+ classesArr.push("first-of-month");
133
+ if (isLastOfMonth)
134
+ classesArr.push("last-of-month");
135
+ if (isStartDate) {
136
+ if (isInRangePreview && !isEndDate && this.hoverDate && this.hoverDate < this.startDate) {
137
+ // invert the arrow direction if user mouses over a prior date
138
+ classesArr.push("range-end");
139
+ }
140
+ else {
141
+ classesArr.push("range-start");
142
+ }
133
143
  }
144
+ if (isEndDate)
145
+ classesArr.push("range-end");
146
+ if (isInRange)
147
+ classesArr.push("in-range");
148
+ if (isInRangePreview)
149
+ classesArr.push("in-range preview");
150
+ if (isPreviewStart)
151
+ classesArr.push("preview-start");
152
+ if (isPreviewEnd)
153
+ classesArr.push("preview-end");
134
154
  }
135
- if (isEndDate)
136
- classesArr.push("range-end");
137
- if (isInRange)
138
- classesArr.push("in-range");
139
- if (isInRangePreview)
140
- classesArr.push("in-range preview");
141
- if (isPreviewStart)
142
- classesArr.push("preview-start");
143
- if (isPreviewEnd)
144
- classesArr.push("preview-end");
145
155
  const classes = classesArr.join(" ");
146
- return (h("div", { role: "gridcell", id: `cell-${date}`, class: classes, "aria-selected": isStartDate || isEndDate ? "true" : "false", "aria-label": `${isToday
156
+ return (h("div", { role: "gridcell", id: `cell-${date}`, class: classes, "aria-selected": selected, "aria-label": `${isToday
147
157
  ? `${intl.formatMessage({
148
158
  id: "date.today",
149
159
  defaultMessage: "today",
@@ -160,18 +170,18 @@ export class PrivCalendar {
160
170
  this.endDate = undefined;
161
171
  this.hoverDate = undefined;
162
172
  }
163
- get calName() {
164
- const bothCals = this.el.parentElement.querySelectorAll("priv-calendar");
173
+ setCalName() {
174
+ const cals = this.el.parentElement.querySelectorAll("priv-calendar");
165
175
  let calname;
166
176
  // if the parent el only contains one calendar
167
- if (bothCals.length === 1) {
177
+ if (cals.length === 1) {
168
178
  calname = intl.formatMessage({
169
179
  id: "date.calName",
170
180
  defaultMessage: "Calendar. ",
171
181
  });
172
182
  // if this calendar is the first of the two
173
183
  }
174
- else if (bothCals[0] === this.el) {
184
+ else if (cals[0] === this.el) {
175
185
  calname = intl.formatMessage({
176
186
  id: "date.firstCalName",
177
187
  defaultMessage: "First calendar. ",
@@ -183,7 +193,16 @@ export class PrivCalendar {
183
193
  defaultMessage: "Second calendar. ",
184
194
  });
185
195
  }
186
- return calname;
196
+ this.calName = calname;
197
+ }
198
+ setCalType() {
199
+ const cals = this.el.parentElement.querySelectorAll("priv-calendar");
200
+ // if the parent el only contains one calendar
201
+ this.calType = cals.length === 1 ? "single" : "range";
202
+ }
203
+ componentWillLoad() {
204
+ this.setCalName();
205
+ this.setCalType();
187
206
  }
188
207
  handleFocusDate(newVal, oldVal) {
189
208
  if (this.view === "day") {
@@ -359,21 +378,21 @@ export class PrivCalendar {
359
378
  return false;
360
379
  if (_startDate && this.hoverDate) {
361
380
  // if only startDate exists, the hovered date functions as the other end of the range
362
- if (_startDate < this.hoverDate) {
381
+ if (this.hoverDate > _startDate) {
363
382
  return _startDate <= date && date <= this.hoverDate;
364
383
  }
365
- else {
384
+ else if (this.hoverDate < _startDate) {
366
385
  // user is mousing over a date prior to the start date
367
386
  // start date considered as end of range
368
387
  return this.hoverDate <= date && date <= _startDate;
369
- }
388
+ } // if neither < or > then it's the same date and should return false
370
389
  }
371
390
  else if (_endDate && this.hoverDate) {
372
391
  // if only endDate exists, the hovered date functions as the other end of the range
373
392
  if (this.hoverDate < _endDate) {
374
393
  return this.hoverDate <= date && date <= _endDate;
375
394
  }
376
- else {
395
+ else if (this.hoverDate > _endDate) {
377
396
  // user is mousing over a date later than the end date
378
397
  // end date considered as beggining of range
379
398
  return _endDate <= date && date <= this.hoverDate;
@@ -525,10 +544,7 @@ export class PrivCalendar {
525
544
  // @ts-ignore
526
545
  if (!this.el.parentElement.contains(ev.toElement))
527
546
  this.outOfCal.emit();
528
- }, role: "application", "aria-describedby": "application" }, this.view === "day" ? this.renderDayView() : this.renderMonthView(), h("div", { id: "application", class: "sr-only" }, this.calName, intl.formatMessage({
529
- id: "date.instructions",
530
- defaultMessage: "Use arrows to select a date in the table. Tab left or right to buttons for selecting previous month, next month, or the month selection table.",
531
- }))));
547
+ }, role: "application", "aria-describedby": "application" }, this.view === "day" ? this.renderDayView() : this.renderMonthView(), h("div", { id: "application", class: "sr-only" }, this.calName, this.calInstructions)));
532
548
  }
533
549
  static get is() { return "priv-calendar"; }
534
550
  static get originalStyleUrls() {
@@ -1,8 +1,9 @@
1
- import { h, Host } from "@stencil/core";
2
- import { intl, dateFind, toBool, handleDisabledAttribute, hasRoomRight, dateToISO, shouldOpenUp, calendar_months, } from "../../global/functions";
1
+ import { h, Host, Fragment, } from "@stencil/core";
2
+ import { intl, dateFind, toBool, handleDisabledAttribute, getContextMeasurements, findParentWithHiddenOverflow, dateToISO, shouldOpenUp, calendar_months, } from "../../global/functions";
3
3
  export class DateRange {
4
4
  constructor() {
5
5
  this.openUp = false;
6
+ this.calWidth = 673;
6
7
  this.popupClicked = false;
7
8
  this.toggleButtonClicked = false;
8
9
  this.formats = { "mm/dd/yyyy": "US", "dd/mm/yyyy": "INT", "yyyy/mm/dd": "ISO" };
@@ -11,12 +12,13 @@ export class DateRange {
11
12
  this.errorMessage = undefined;
12
13
  this.invalidStart = false;
13
14
  this.invalidEnd = false;
14
- this.label = "";
15
- this.labelPosition = "top";
15
+ this.labelStart = "";
16
+ this.labelEnd = "";
16
17
  this.preselected = undefined;
17
18
  this.requiredField = false;
18
19
  this.valueStart = "";
19
20
  this.valueEnd = "";
21
+ this.availSpace = 0;
20
22
  this.isExpanded = false;
21
23
  }
22
24
  get _disabled() {
@@ -134,15 +136,21 @@ export class DateRange {
134
136
  }
135
137
  openPopup() {
136
138
  // display stuff
137
- this.openUp = shouldOpenUp(this.el, this.popupEl.clientHeight, this.labelWrapperEl.clientHeight);
138
- if (hasRoomRight(this.el, 336)) {
139
+ this.openUp = shouldOpenUp(this.el, this.popupEl.clientHeight, this.labelEl.clientHeight);
140
+ const { spaceLeft, spaceRight } = getContextMeasurements(this.el);
141
+ if (spaceRight >= this.popupEl.clientWidth - this.el.clientWidth) {
139
142
  this.popupEl.style.left = "0";
140
143
  this.popupEl.style.right = "auto";
141
144
  }
142
- else {
145
+ else if (spaceLeft >= this.popupEl.clientWidth - this.el.clientWidth) {
143
146
  this.popupEl.style.right = "0";
144
147
  this.popupEl.style.left = "auto";
145
148
  }
149
+ else {
150
+ const offset = (this.availSpace - this.calWidth) / 2 - spaceLeft;
151
+ this.popupEl.style.left = `${offset}px`;
152
+ this.popupEl.style.right = "auto";
153
+ }
146
154
  this.popupEl.style.visibility = "visible";
147
155
  window.requestAnimationFrame(() => {
148
156
  this.popupEl.classList.add("open");
@@ -392,11 +400,22 @@ export class DateRange {
392
400
  return day > 0 && day <= monthLength[month - 1];
393
401
  }
394
402
  }
403
+ setAvailSpace() {
404
+ this.availSpace = (this.hiddenOverflowParent || document.body).clientWidth;
405
+ }
395
406
  componentWillLoad() {
396
- if (this.label === "") {
397
- console.error("You must include a label prop for the datepicker input (for accessibility reasons), even if the label position is none.");
407
+ if (this.labelStart === "" || this.labelEnd === "") {
408
+ console.error("For accessibility reasons you must specify labels for the date range inputs.");
398
409
  }
399
410
  handleDisabledAttribute(this.el, this._disabled);
411
+ this.hiddenOverflowParent = findParentWithHiddenOverflow(this.el);
412
+ if (this.hiddenOverflowParent) {
413
+ const resizeObserver = new ResizeObserver(() => {
414
+ this.availSpace = this.hiddenOverflowParent.clientWidth;
415
+ });
416
+ resizeObserver.observe(this.hiddenOverflowParent);
417
+ }
418
+ this.setAvailSpace();
400
419
  }
401
420
  announce(message) {
402
421
  // \u00A0 is a non-breaking space character, which causes the message to be read as a new one
@@ -405,12 +424,17 @@ export class DateRange {
405
424
  }
406
425
  this.liveRegionEl.textContent = message;
407
426
  }
427
+ renderCalendars() {
428
+ if (this.calWidth <= this.availSpace) {
429
+ return (h(Fragment, null, h("div", { class: `popup-wrapper ${this.startCalEl && this.startCalEl.view}-view ${this.openUp ? "expand-upwards" : ""}`, id: "popup-wrapper", ref: (el) => (this.popupEl = el), onClick: () => (this.popupClicked = true), style: { display: "flex" } }, h("div", { class: "trapfocus", tabIndex: this.isExpanded ? 0 : undefined, onFocus: () => this.endCalEl.focusLastFocusable() }), h("priv-calendar", { ref: (el) => (this.startCalEl = el), onClick: () => (this.popupClicked = true), onDateFocus: (ev) => this.handleDateFocus(ev) }), h("priv-calendar", { ref: (el) => (this.endCalEl = el), onClick: () => (this.popupClicked = true), onDateFocus: (ev) => this.handleDateFocus(ev) }), h("div", { class: "trapfocus", tabIndex: this.isExpanded ? 0 : undefined, onFocus: () => this.startCalEl.focusFirstFocusable() }))));
430
+ }
431
+ }
408
432
  render() {
409
- return (h(Host, { "aria-busy": "false" }, h("div", { ref: (d) => (this.wrapperEl = d), class: `wrapper label-${this.labelPosition}` }, h("div", { class: "label-wrapper", ref: (e) => (this.labelWrapperEl = e) }, this.labelPosition !== "none" && (h("label", { id: "dateRangeLabel", htmlFor: "date-input", class: "label", title: `${this.label} (${this.dateFormat})` }, this.label, this.requiredField && (h("span", { "aria-hidden": "true", class: "required" }, "*"))))), h("div", null, h("div", { class: "range-wrapper" }, h("input", { disabled: this._disabled, type: "text", id: "start-date-input", class: `date-input input ${this.invalidStart ? "invalid" : ""}`, name: "start-date", placeholder: this.dateFormat, value: this.valueStart, onFocus: () => this.handleFocus(), onInput: (ev) => this.handleStartInput(ev), onBlur: () => this.handleStartInputBlur(), ref: (input) => (this.startInputEl = input), "aria-describedby": "error", "aria-label": this.label, "aria-required": this.requiredField ? "true" : null }), "\u00A0-\u00A0", h("input", { disabled: this._disabled, type: "text", id: "end-date-input", class: `date-input input ${this.invalidEnd ? "invalid" : ""}`, name: "end-date", placeholder: this.dateFormat, value: this.valueEnd, onFocus: () => this.handleFocus(), onInput: (ev) => this.handleEndInput(ev), onBlur: () => this.handleEndInputBlur(), ref: (input) => (this.endInputEl = input), "aria-describedby": "error", "aria-label": this.label, "aria-required": this.requiredField ? "true" : null }), h("div", { class: "container", id: "wm-container" }, h("button", { disabled: this.disabled, onClick: this.togglePopup.bind(this), "aria-describedby": "date-input", ref: (el) => (this.toggleEl = el), "aria-expanded": `${this.isExpanded}`, class: "toggle", id: "toggle" }, h("span", { class: "calendar", title: intl.formatMessage({
433
+ return (h(Host, { "aria-busy": "false" }, h("div", { ref: (d) => (this.wrapperEl = d), class: "wrapper" }, h("div", { class: `range-wrapper ${this.calWidth <= this.availSpace ? "cal" : ""}` }, h("div", { class: "label-wrapper", id: "start-label-wrapper" }, h("label", { ref: (e) => (this.labelEl = e), id: "startlabel", htmlFor: "start-date-input", class: "label", title: `${this.labelStart} (${this.dateFormat})` }, this.labelStart, this.requiredField && (h("span", { "aria-hidden": "true", class: "required" }, "*")))), h("div", { class: "label-wrapper", id: "end-label-wrapper" }, h("label", { id: "endlabel", htmlFor: "end-date-input", class: "label", title: `${this.labelEnd} (${this.dateFormat})` }, this.labelEnd, this.requiredField && (h("span", { "aria-hidden": "true", class: "required" }, "*")))), h("input", { disabled: this._disabled, type: "text", id: "start-date-input", class: `date-input input ${this.invalidStart ? "invalid" : ""}`, name: "start-date", placeholder: this.dateFormat, value: this.valueStart, onFocus: () => this.handleFocus(), onInput: (ev) => this.handleStartInput(ev), onBlur: () => this.handleStartInputBlur(), ref: (input) => (this.startInputEl = input), "aria-describedby": "error", "aria-label": this.labelStart, "aria-required": this.requiredField ? "true" : null }), h("div", { id: "hyphen" }, "\u00A0-\u00A0"), h("input", { disabled: this._disabled, type: "text", id: "end-date-input", class: `date-input input ${this.invalidEnd ? "invalid" : ""}`, name: "end-date", placeholder: this.dateFormat, value: this.valueEnd, onFocus: () => this.handleFocus(), onInput: (ev) => this.handleEndInput(ev), onBlur: () => this.handleEndInputBlur(), ref: (input) => (this.endInputEl = input), "aria-describedby": "error", "aria-label": this.labelEnd, "aria-required": this.requiredField ? "true" : null }), h("div", { class: "toggle-wrapper", id: "toggle-wrapper" }, this.calWidth <= this.availSpace && (h("button", { disabled: this.disabled, onClick: this.togglePopup.bind(this), "aria-describedby": "date-input", ref: (el) => (this.toggleEl = el), "aria-expanded": `${this.isExpanded}`, class: "toggle", id: "toggle" }, h("span", { class: "calendar", title: intl.formatMessage({
410
434
  id: "date.calendarView",
411
435
  defaultMessage: "Calendar View",
412
436
  description: "Calendar button",
413
- }) })), h("div", { class: `popup-wrapper ${this.startCalEl && this.startCalEl.view}-view ${this.openUp ? "expand-upwards" : ""}`, id: "popup-wrapper", ref: (el) => (this.popupEl = el), onClick: () => (this.popupClicked = true), style: { display: "flex" } }, h("div", { class: "trapfocus", tabIndex: this.isExpanded ? 0 : undefined, onFocus: () => this.endCalEl.focusLastFocusable() }), h("priv-calendar", { ref: (el) => (this.startCalEl = el), onClick: () => (this.popupClicked = true), onDateFocus: (ev) => this.handleDateFocus(ev) }), h("priv-calendar", { ref: (el) => (this.endCalEl = el), onClick: () => (this.popupClicked = true), onDateFocus: (ev) => this.handleDateFocus(ev) }), h("div", { class: "trapfocus", tabIndex: this.isExpanded ? 0 : undefined, onFocus: () => this.startCalEl.focusFirstFocusable() })), h("div", { id: "live-region", "aria-live": "polite", "aria-relevant": "text", class: "sr-only" }), h("div", { id: "month-title", class: "sr-only" }, intl.formatMessage({
437
+ }) })))), this.renderCalendars()), h("div", null, h("div", { id: "live-region", "aria-live": "polite", "aria-relevant": "text", class: "sr-only" }), h("div", { id: "month-title", class: "sr-only" }, intl.formatMessage({
414
438
  id: "date.selectMonth",
415
439
  defaultMessage: "Activate to select a month.",
416
440
  description: "Calendar button",
@@ -418,7 +442,7 @@ export class DateRange {
418
442
  id: "date.selectYear",
419
443
  defaultMessage: "Activate to select a year.",
420
444
  description: "Calendar button",
421
- })))), h("div", { id: "error", class: "error" }, this.errorMessage), h("div", { ref: (el) => (this.liveRegionEl = el), class: "sr-only", "aria-live": "polite", "aria-atomic": "true" })))));
445
+ }))), h("div", { id: "error", class: "error" }, this.errorMessage), h("div", { ref: (el) => (this.liveRegionEl = el), class: "sr-only", "aria-live": "polite", "aria-atomic": "true" }))));
422
446
  }
423
447
  static get is() { return "wm-date-range"; }
424
448
  static get encapsulation() { return "shadow"; }
@@ -524,7 +548,7 @@ export class DateRange {
524
548
  "reflect": false,
525
549
  "defaultValue": "false"
526
550
  },
527
- "label": {
551
+ "labelStart": {
528
552
  "type": "string",
529
553
  "mutable": false,
530
554
  "complexType": {
@@ -538,16 +562,16 @@ export class DateRange {
538
562
  "tags": [],
539
563
  "text": ""
540
564
  },
541
- "attribute": "label",
565
+ "attribute": "label-start",
542
566
  "reflect": false,
543
567
  "defaultValue": "\"\""
544
568
  },
545
- "labelPosition": {
569
+ "labelEnd": {
546
570
  "type": "string",
547
571
  "mutable": false,
548
572
  "complexType": {
549
- "original": "\"top\" | \"left\" | \"none\"",
550
- "resolved": "\"left\" | \"none\" | \"top\"",
573
+ "original": "string",
574
+ "resolved": "string",
551
575
  "references": {}
552
576
  },
553
577
  "required": false,
@@ -556,9 +580,9 @@ export class DateRange {
556
580
  "tags": [],
557
581
  "text": ""
558
582
  },
559
- "attribute": "label-position",
583
+ "attribute": "label-end",
560
584
  "reflect": false,
561
- "defaultValue": "\"top\""
585
+ "defaultValue": "\"\""
562
586
  },
563
587
  "preselected": {
564
588
  "type": "string",
@@ -635,6 +659,7 @@ export class DateRange {
635
659
  }
636
660
  static get states() {
637
661
  return {
662
+ "availSpace": {},
638
663
  "isExpanded": {}
639
664
  };
640
665
  }
@@ -795,6 +820,12 @@ export class DateRange {
795
820
  "target": undefined,
796
821
  "capture": false,
797
822
  "passive": false
823
+ }, {
824
+ "name": "resize",
825
+ "method": "setAvailSpace",
826
+ "target": "window",
827
+ "capture": false,
828
+ "passive": true
798
829
  }];
799
830
  }
800
831
  }