@ukic/canary-web-components 2.0.0-canary.8 → 2.0.0-canary.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (371) hide show
  1. package/dist/cjs/core.cjs.js +1 -1
  2. package/dist/cjs/date-helpers-c9551119.js +150 -0
  3. package/dist/cjs/date-helpers-c9551119.js.map +1 -0
  4. package/dist/cjs/{helpers-b525d45a.js → helpers-7a069459.js} +7 -2
  5. package/dist/cjs/helpers-7a069459.js.map +1 -0
  6. package/dist/cjs/{helpers-93c5fc92.js → helpers-f75cf7cf.js} +94 -12
  7. package/dist/cjs/helpers-f75cf7cf.js.map +1 -0
  8. package/dist/cjs/ic-accordion.cjs.entry.js +1 -1
  9. package/dist/cjs/ic-alert.cjs.entry.js +1 -1
  10. package/dist/cjs/ic-back-to-top.cjs.entry.js +1 -1
  11. package/dist/cjs/ic-badge.cjs.entry.js +1 -1
  12. package/dist/cjs/ic-breadcrumb-group.cjs.entry.js +1 -1
  13. package/dist/cjs/ic-breadcrumb.cjs.entry.js +1 -1
  14. package/dist/cjs/ic-button_3.cjs.entry.js +8 -2
  15. package/dist/cjs/ic-button_3.cjs.entry.js.map +1 -1
  16. package/dist/cjs/ic-card.cjs.entry.js +1 -1
  17. package/dist/cjs/ic-checkbox-group.cjs.entry.js +1 -1
  18. package/dist/cjs/ic-checkbox.cjs.entry.js +1 -1
  19. package/dist/cjs/ic-chip.cjs.entry.js +1 -1
  20. package/dist/cjs/ic-data-row.cjs.entry.js +1 -1
  21. package/dist/cjs/ic-date-input.cjs.entry.js +1073 -0
  22. package/dist/cjs/ic-date-input.cjs.entry.js.map +1 -0
  23. package/dist/cjs/ic-date-picker.cjs.entry.js +1043 -0
  24. package/dist/cjs/ic-date-picker.cjs.entry.js.map +1 -0
  25. package/dist/cjs/ic-dialog.cjs.entry.js +1 -1
  26. package/dist/cjs/ic-divider.cjs.entry.js +1 -1
  27. package/dist/cjs/ic-empty-state.cjs.entry.js +1 -1
  28. package/dist/cjs/ic-footer-link-group.cjs.entry.js +1 -1
  29. package/dist/cjs/ic-footer-link.cjs.entry.js +1 -1
  30. package/dist/cjs/ic-footer.cjs.entry.js +1 -1
  31. package/dist/cjs/ic-hero.cjs.entry.js +1 -1
  32. package/dist/cjs/ic-horizontal-scroll.cjs.entry.js +1 -1
  33. package/dist/cjs/ic-input-component-container_4.cjs.entry.js +150 -0
  34. package/dist/cjs/ic-input-component-container_4.cjs.entry.js.map +1 -0
  35. package/dist/cjs/ic-link.cjs.entry.js +1 -1
  36. package/dist/cjs/ic-menu-group.cjs.entry.js +1 -1
  37. package/dist/cjs/ic-menu-item.cjs.entry.js +1 -1
  38. package/dist/cjs/ic-menu-with-multi.cjs.entry.js +1 -1
  39. package/dist/cjs/ic-menu-with-multi.cjs.entry.js.map +1 -1
  40. package/dist/cjs/{ic-input-component-container_3.cjs.entry.js → ic-menu.cjs.entry.js} +3 -67
  41. package/dist/cjs/ic-menu.cjs.entry.js.map +1 -0
  42. package/dist/cjs/ic-navigation-button.cjs.entry.js +1 -1
  43. package/dist/cjs/ic-navigation-group.cjs.entry.js +1 -1
  44. package/dist/cjs/ic-navigation-item.cjs.entry.js +1 -1
  45. package/dist/cjs/ic-navigation-menu.cjs.entry.js +1 -1
  46. package/dist/cjs/ic-page-header.cjs.entry.js +1 -1
  47. package/dist/cjs/ic-pagination-bar.cjs.entry.js +1 -1
  48. package/dist/cjs/ic-pagination_4.cjs.entry.js +1 -1
  49. package/dist/cjs/ic-popover-menu.cjs.entry.js +1 -1
  50. package/dist/cjs/ic-radio-group.cjs.entry.js +1 -1
  51. package/dist/cjs/ic-radio-option.cjs.entry.js +1 -1
  52. package/dist/cjs/ic-search-bar.cjs.entry.js +1 -1
  53. package/dist/cjs/ic-select-with-multi.cjs.entry.js +6 -19
  54. package/dist/cjs/ic-select-with-multi.cjs.entry.js.map +1 -1
  55. package/dist/cjs/ic-side-navigation.cjs.entry.js +1 -1
  56. package/dist/cjs/ic-status-tag.cjs.entry.js +1 -1
  57. package/dist/cjs/ic-step.cjs.entry.js +1 -1
  58. package/dist/cjs/ic-stepper.cjs.entry.js +1 -1
  59. package/dist/cjs/ic-switch.cjs.entry.js +1 -1
  60. package/dist/cjs/ic-tab-group.cjs.entry.js +1 -1
  61. package/dist/cjs/ic-tab-panel.cjs.entry.js +1 -1
  62. package/dist/cjs/ic-tab.cjs.entry.js +1 -1
  63. package/dist/cjs/ic-theme.cjs.entry.js +1 -1
  64. package/dist/cjs/ic-toast.cjs.entry.js +1 -1
  65. package/dist/cjs/ic-toggle-button.cjs.entry.js +1 -1
  66. package/dist/cjs/ic-top-navigation.cjs.entry.js +1 -1
  67. package/dist/cjs/ic-typography.cjs.entry.js +1 -1
  68. package/dist/cjs/index-4cf27b16.js +12 -4
  69. package/dist/cjs/loader.cjs.js +1 -1
  70. package/dist/collection/assets/calendar.svg +3 -0
  71. package/dist/collection/collection-manifest.json +2 -0
  72. package/dist/collection/components/ic-date-input/ic-date-input.css +560 -0
  73. package/dist/collection/components/ic-date-input/ic-date-input.js +1668 -0
  74. package/dist/collection/components/ic-date-input/ic-date-input.js.map +1 -0
  75. package/dist/collection/components/ic-date-input/story-data.js +28 -0
  76. package/dist/collection/components/ic-date-input/story-data.js.map +1 -0
  77. package/dist/collection/components/ic-date-input/test/basic/ic-date-input.spec.js +1156 -0
  78. package/dist/collection/components/ic-date-input/test/basic/ic-date-input.spec.js.map +1 -0
  79. package/dist/collection/components/ic-date-input/test/helpers/ic-date-input.js +42 -0
  80. package/dist/collection/components/ic-date-input/test/helpers/ic-date-input.js.map +1 -0
  81. package/dist/collection/components/ic-date-picker/ic-date-picker.css +878 -0
  82. package/dist/collection/components/ic-date-picker/ic-date-picker.js +1499 -0
  83. package/dist/collection/components/ic-date-picker/ic-date-picker.js.map +1 -0
  84. package/dist/collection/components/ic-date-picker/ic-day-button.js +36 -0
  85. package/dist/collection/components/ic-date-picker/ic-day-button.js.map +1 -0
  86. package/dist/collection/components/ic-date-picker/ic-month-picker.js +29 -0
  87. package/dist/collection/components/ic-date-picker/ic-month-picker.js.map +1 -0
  88. package/dist/collection/components/ic-date-picker/ic-year-picker.js +39 -0
  89. package/dist/collection/components/ic-date-picker/ic-year-picker.js.map +1 -0
  90. package/dist/collection/components/ic-date-picker/story-data.js +143 -0
  91. package/dist/collection/components/ic-date-picker/story-data.js.map +1 -0
  92. package/dist/collection/components/ic-date-picker/test/a11y/ic-date-picker.test.a11y.js +13 -0
  93. package/dist/collection/components/ic-date-picker/test/a11y/ic-date-picker.test.a11y.js.map +1 -0
  94. package/dist/collection/components/ic-date-picker/test/basic/ic-date-picker-utils.spec.js +207 -0
  95. package/dist/collection/components/ic-date-picker/test/basic/ic-date-picker-utils.spec.js.map +1 -0
  96. package/dist/collection/components/ic-date-picker/test/basic/ic-date-picker.spec.js +962 -0
  97. package/dist/collection/components/ic-date-picker/test/basic/ic-date-picker.spec.js.map +1 -0
  98. package/dist/collection/components/ic-menu-with-multi/ic-menu.js +2 -2
  99. package/dist/collection/components/ic-menu-with-multi/ic-menu.js.map +1 -1
  100. package/dist/collection/components/ic-select-with-multi/ic-select.js +2 -2
  101. package/dist/collection/components/ic-select-with-multi/ic-select.js.map +1 -1
  102. package/dist/collection/utils/constants.js +55 -0
  103. package/dist/collection/utils/constants.js.map +1 -1
  104. package/dist/collection/utils/date-helpers.js +133 -0
  105. package/dist/collection/utils/date-helpers.js.map +1 -0
  106. package/dist/collection/utils/helpers.js +259 -10
  107. package/dist/collection/utils/helpers.js.map +1 -1
  108. package/dist/collection/utils/types.js +45 -0
  109. package/dist/collection/utils/types.js.map +1 -1
  110. package/dist/components/helpers.js +7 -2
  111. package/dist/components/helpers.js.map +1 -1
  112. package/dist/components/helpers2.js +91 -12
  113. package/dist/components/helpers2.js.map +1 -1
  114. package/dist/components/ic-button2.js +11 -3
  115. package/dist/components/ic-button2.js.map +1 -1
  116. package/dist/components/ic-card.js +1 -1
  117. package/dist/components/ic-checkbox-group.js +1 -1
  118. package/dist/components/ic-checkbox.js +1 -1
  119. package/dist/components/ic-chip.js +1 -1
  120. package/dist/components/ic-date-input.d.ts +11 -0
  121. package/dist/components/ic-date-input.js +8 -0
  122. package/dist/components/ic-date-input.js.map +1 -0
  123. package/dist/components/ic-date-input2.js +1301 -0
  124. package/dist/components/ic-date-input2.js.map +1 -0
  125. package/dist/components/ic-date-picker.d.ts +11 -0
  126. package/dist/components/ic-date-picker.js +1164 -0
  127. package/dist/components/ic-date-picker.js.map +1 -0
  128. package/dist/components/ic-input-component-container2.js +1 -1
  129. package/dist/components/ic-input-component-container2.js.map +1 -1
  130. package/dist/components/ic-link2.js +1 -1
  131. package/dist/components/ic-menu-item2.js +1 -1
  132. package/dist/components/ic-menu3.js +1 -1
  133. package/dist/components/ic-menu3.js.map +1 -1
  134. package/dist/components/ic-navigation-button.js +1 -1
  135. package/dist/components/ic-pagination-item2.js +1 -1
  136. package/dist/components/ic-pagination2.js +1 -1
  137. package/dist/components/ic-radio-group.js +1 -1
  138. package/dist/components/ic-radio-option.js +1 -1
  139. package/dist/components/ic-search-bar.js +1 -1
  140. package/dist/components/ic-select-with-multi.js +1 -14
  141. package/dist/components/ic-select-with-multi.js.map +1 -1
  142. package/dist/components/ic-select2.js +1 -1
  143. package/dist/components/ic-switch.js +1 -1
  144. package/dist/components/ic-tab.js +1 -1
  145. package/dist/components/ic-text-field2.js +1 -1
  146. package/dist/components/ic-toggle-button.js +1 -1
  147. package/dist/core/core.css +1 -1
  148. package/dist/core/core.esm.js +1 -1
  149. package/dist/core/core.esm.js.map +1 -1
  150. package/dist/core/{p-8b08d8fe.entry.js → p-06ae5bec.entry.js} +2 -2
  151. package/dist/core/{p-f843da01.entry.js → p-0939ce92.entry.js} +2 -2
  152. package/dist/core/{p-e0462b23.entry.js → p-16f67397.entry.js} +2 -2
  153. package/dist/core/{p-db9c03c0.entry.js → p-1832f4b5.entry.js} +2 -2
  154. package/dist/core/{p-ab09986c.entry.js → p-1b7d426b.entry.js} +2 -2
  155. package/dist/core/{p-5e0c830b.entry.js → p-1ce75941.entry.js} +2 -2
  156. package/dist/core/{p-1ca332ca.entry.js → p-2e2e0099.entry.js} +2 -2
  157. package/dist/core/p-33679c06.entry.js +2 -0
  158. package/dist/core/p-33679c06.entry.js.map +1 -0
  159. package/dist/core/{p-4753bac8.entry.js → p-36508aad.entry.js} +2 -2
  160. package/dist/core/{p-10fb4c46.entry.js → p-3745da83.entry.js} +2 -2
  161. package/dist/core/{p-3803a5b5.entry.js → p-3f2e77c3.entry.js} +2 -2
  162. package/dist/core/{p-88d54b72.entry.js → p-47ac6838.entry.js} +2 -2
  163. package/dist/core/{p-4baa0916.entry.js → p-4f1ffa39.entry.js} +2 -2
  164. package/dist/core/{p-f7a14c01.entry.js → p-5759d771.entry.js} +2 -2
  165. package/dist/core/{p-6c3044b6.entry.js → p-5e2e6c3b.entry.js} +2 -2
  166. package/dist/core/{p-2eac7dcc.entry.js → p-5fe96107.entry.js} +2 -2
  167. package/dist/core/{p-b82dcc29.entry.js → p-62e22508.entry.js} +2 -2
  168. package/dist/core/{p-75dac3d1.entry.js → p-6690bc04.entry.js} +2 -2
  169. package/dist/core/{p-c125b65a.entry.js → p-6c0e2ceb.entry.js} +2 -2
  170. package/dist/core/{p-a0f8efb2.entry.js → p-76d26018.entry.js} +2 -2
  171. package/dist/core/{p-4f413fc0.entry.js → p-776671cf.entry.js} +2 -2
  172. package/dist/core/{p-5ae93c16.entry.js → p-7cecf5d5.entry.js} +2 -2
  173. package/dist/core/{p-7ef8d616.entry.js → p-85609bdd.entry.js} +2 -2
  174. package/dist/core/{p-a43c12cd.entry.js → p-86012178.entry.js} +2 -2
  175. package/dist/core/{p-942282cd.entry.js → p-8a7e7d23.entry.js} +2 -2
  176. package/dist/core/{p-a50c3b9e.entry.js → p-8c90110a.entry.js} +2 -2
  177. package/dist/core/{p-045359e1.entry.js → p-8ea47d42.entry.js} +2 -2
  178. package/dist/core/{p-e834344e.entry.js → p-982a6e88.entry.js} +2 -2
  179. package/dist/core/{p-d8469ac0.entry.js → p-98448bdb.entry.js} +2 -2
  180. package/dist/core/{p-6933f8e9.entry.js → p-9d01a7ad.entry.js} +2 -2
  181. package/dist/core/{p-595be57d.entry.js → p-9d540656.entry.js} +2 -2
  182. package/dist/core/{p-fde45b29.entry.js → p-9e3178e8.entry.js} +2 -2
  183. package/dist/core/{p-fde45b29.entry.js.map → p-9e3178e8.entry.js.map} +1 -1
  184. package/dist/core/{p-81ddc39d.entry.js → p-a0f9b259.entry.js} +2 -2
  185. package/dist/core/{p-a31031a5.entry.js → p-a42c2f37.entry.js} +2 -2
  186. package/dist/core/{p-869954a2.entry.js → p-a6447b13.entry.js} +2 -2
  187. package/dist/core/p-aabab75f.entry.js +2 -0
  188. package/dist/core/p-aabab75f.entry.js.map +1 -0
  189. package/dist/core/{p-e3997d60.entry.js → p-ae422058.entry.js} +2 -2
  190. package/dist/core/{p-a434c3d4.entry.js → p-b306cbc8.entry.js} +2 -2
  191. package/dist/core/{p-ac4e40a7.entry.js → p-c7590421.entry.js} +2 -2
  192. package/dist/core/{p-f3c840cd.entry.js → p-c7820c23.entry.js} +2 -2
  193. package/dist/core/{p-917c5721.entry.js → p-ca8cbd6a.entry.js} +2 -2
  194. package/dist/core/{p-73be1251.entry.js → p-caf857de.entry.js} +2 -2
  195. package/dist/core/p-cc7bc438.entry.js +2 -0
  196. package/dist/core/p-cc7bc438.entry.js.map +1 -0
  197. package/dist/core/p-cd799087.js +2 -0
  198. package/dist/core/p-cd799087.js.map +1 -0
  199. package/dist/core/p-d32692e2.entry.js +2 -0
  200. package/dist/core/p-d32692e2.entry.js.map +1 -0
  201. package/dist/core/p-d35c7c18.js +2 -0
  202. package/dist/core/p-d35c7c18.js.map +1 -0
  203. package/dist/core/{p-c34848da.entry.js → p-d3856ed3.entry.js} +2 -2
  204. package/dist/core/{p-204ace96.entry.js → p-d4fdd8c1.entry.js} +2 -2
  205. package/dist/core/{p-ba86928c.entry.js → p-d5c99ec3.entry.js} +2 -2
  206. package/dist/core/p-e473bbf8.entry.js +2 -0
  207. package/dist/core/p-e473bbf8.entry.js.map +1 -0
  208. package/dist/core/{p-624d4f5f.entry.js → p-e74f1d09.entry.js} +2 -2
  209. package/dist/core/{p-fc5611e2.entry.js → p-e84b0310.entry.js} +2 -2
  210. package/dist/core/p-f55ad6ae.entry.js +2 -0
  211. package/dist/core/{p-f14454b1.entry.js.map → p-f55ad6ae.entry.js.map} +1 -1
  212. package/dist/core/p-f8cf2978.js +2 -0
  213. package/dist/core/p-f8cf2978.js.map +1 -0
  214. package/dist/core/p-f91527a0.entry.js +2 -0
  215. package/dist/core/p-f91527a0.entry.js.map +1 -0
  216. package/dist/core/{p-169bfa51.entry.js → p-fbf4e9b7.entry.js} +2 -2
  217. package/dist/esm/core.js +1 -1
  218. package/dist/esm/date-helpers-4f432e92.js +136 -0
  219. package/dist/esm/date-helpers-4f432e92.js.map +1 -0
  220. package/dist/esm/{helpers-12b4266a.js → helpers-7aa21b0a.js} +7 -2
  221. package/dist/esm/helpers-7aa21b0a.js.map +1 -0
  222. package/dist/esm/{helpers-5271897c.js → helpers-f328a7b6.js} +92 -13
  223. package/dist/esm/helpers-f328a7b6.js.map +1 -0
  224. package/dist/esm/ic-accordion.entry.js +1 -1
  225. package/dist/esm/ic-alert.entry.js +1 -1
  226. package/dist/esm/ic-back-to-top.entry.js +1 -1
  227. package/dist/esm/ic-badge.entry.js +1 -1
  228. package/dist/esm/ic-breadcrumb-group.entry.js +1 -1
  229. package/dist/esm/ic-breadcrumb.entry.js +1 -1
  230. package/dist/esm/ic-button_3.entry.js +8 -2
  231. package/dist/esm/ic-button_3.entry.js.map +1 -1
  232. package/dist/esm/ic-card.entry.js +1 -1
  233. package/dist/esm/ic-checkbox-group.entry.js +1 -1
  234. package/dist/esm/ic-checkbox.entry.js +1 -1
  235. package/dist/esm/ic-chip.entry.js +1 -1
  236. package/dist/esm/ic-data-row.entry.js +1 -1
  237. package/dist/esm/ic-date-input.entry.js +1069 -0
  238. package/dist/esm/ic-date-input.entry.js.map +1 -0
  239. package/dist/esm/ic-date-picker.entry.js +1039 -0
  240. package/dist/esm/ic-date-picker.entry.js.map +1 -0
  241. package/dist/esm/ic-dialog.entry.js +1 -1
  242. package/dist/esm/ic-divider.entry.js +1 -1
  243. package/dist/esm/ic-empty-state.entry.js +1 -1
  244. package/dist/esm/ic-footer-link-group.entry.js +1 -1
  245. package/dist/esm/ic-footer-link.entry.js +1 -1
  246. package/dist/esm/ic-footer.entry.js +1 -1
  247. package/dist/esm/ic-hero.entry.js +1 -1
  248. package/dist/esm/ic-horizontal-scroll.entry.js +1 -1
  249. package/dist/esm/ic-input-component-container_4.entry.js +143 -0
  250. package/dist/esm/ic-input-component-container_4.entry.js.map +1 -0
  251. package/dist/esm/ic-link.entry.js +1 -1
  252. package/dist/esm/ic-menu-group.entry.js +1 -1
  253. package/dist/esm/ic-menu-item.entry.js +1 -1
  254. package/dist/esm/ic-menu-with-multi.entry.js +1 -1
  255. package/dist/esm/ic-menu-with-multi.entry.js.map +1 -1
  256. package/dist/esm/{ic-input-component-container_3.entry.js → ic-menu.entry.js} +5 -67
  257. package/dist/esm/ic-menu.entry.js.map +1 -0
  258. package/dist/esm/ic-navigation-button.entry.js +1 -1
  259. package/dist/esm/ic-navigation-group.entry.js +1 -1
  260. package/dist/esm/ic-navigation-item.entry.js +1 -1
  261. package/dist/esm/ic-navigation-menu.entry.js +1 -1
  262. package/dist/esm/ic-page-header.entry.js +1 -1
  263. package/dist/esm/ic-pagination-bar.entry.js +1 -1
  264. package/dist/esm/ic-pagination_4.entry.js +1 -1
  265. package/dist/esm/ic-popover-menu.entry.js +1 -1
  266. package/dist/esm/ic-radio-group.entry.js +1 -1
  267. package/dist/esm/ic-radio-option.entry.js +1 -1
  268. package/dist/esm/ic-search-bar.entry.js +1 -1
  269. package/dist/esm/ic-select-with-multi.entry.js +1 -14
  270. package/dist/esm/ic-select-with-multi.entry.js.map +1 -1
  271. package/dist/esm/ic-side-navigation.entry.js +1 -1
  272. package/dist/esm/ic-status-tag.entry.js +1 -1
  273. package/dist/esm/ic-step.entry.js +1 -1
  274. package/dist/esm/ic-stepper.entry.js +1 -1
  275. package/dist/esm/ic-switch.entry.js +1 -1
  276. package/dist/esm/ic-tab-group.entry.js +1 -1
  277. package/dist/esm/ic-tab-panel.entry.js +1 -1
  278. package/dist/esm/ic-tab.entry.js +1 -1
  279. package/dist/esm/ic-theme.entry.js +1 -1
  280. package/dist/esm/ic-toast.entry.js +1 -1
  281. package/dist/esm/ic-toggle-button.entry.js +1 -1
  282. package/dist/esm/ic-top-navigation.entry.js +1 -1
  283. package/dist/esm/ic-typography.entry.js +1 -1
  284. package/dist/esm/index-93509377.js +12 -4
  285. package/dist/esm/loader.js +1 -1
  286. package/dist/types/components/ic-date-input/ic-date-input.d.ts +242 -0
  287. package/dist/types/components/ic-date-input/story-data.d.ts +1 -0
  288. package/dist/types/components/ic-date-input/test/helpers/ic-date-input.d.ts +23 -0
  289. package/dist/types/components/ic-date-picker/ic-date-picker.d.ts +251 -0
  290. package/dist/types/components/ic-date-picker/ic-day-button.d.ts +16 -0
  291. package/dist/types/components/ic-date-picker/ic-month-picker.d.ts +14 -0
  292. package/dist/types/components/ic-date-picker/ic-year-picker.d.ts +16 -0
  293. package/dist/types/components/ic-date-picker/story-data.d.ts +22 -0
  294. package/dist/types/components/ic-date-picker/test/a11y/ic-date-picker.test.a11y.d.ts +1 -0
  295. package/dist/types/components/ic-menu-with-multi/ic-menu.d.ts +2 -2
  296. package/dist/types/components/ic-select-with-multi/ic-select.d.ts +2 -2
  297. package/dist/types/components.d.ts +439 -4
  298. package/dist/types/utils/constants.d.ts +37 -0
  299. package/dist/types/utils/date-helpers.d.ts +22 -0
  300. package/dist/types/utils/helpers.d.ts +83 -11
  301. package/dist/types/utils/types.d.ts +92 -1
  302. package/hydrate/index.js +2653 -253
  303. package/package.json +3 -3
  304. package/dist/cjs/helpers-93c5fc92.js.map +0 -1
  305. package/dist/cjs/helpers-b525d45a.js.map +0 -1
  306. package/dist/cjs/ic-input-component-container_3.cjs.entry.js.map +0 -1
  307. package/dist/cjs/ic-input-label_2.cjs.entry.js +0 -86
  308. package/dist/cjs/ic-input-label_2.cjs.entry.js.map +0 -1
  309. package/dist/core/p-21150122.entry.js +0 -2
  310. package/dist/core/p-21150122.entry.js.map +0 -1
  311. package/dist/core/p-99cad6c2.js +0 -2
  312. package/dist/core/p-99cad6c2.js.map +0 -1
  313. package/dist/core/p-9caf19eb.js +0 -2
  314. package/dist/core/p-9caf19eb.js.map +0 -1
  315. package/dist/core/p-e0a94f2d.entry.js +0 -2
  316. package/dist/core/p-e0a94f2d.entry.js.map +0 -1
  317. package/dist/core/p-f14454b1.entry.js +0 -2
  318. package/dist/core/p-f6888309.entry.js +0 -2
  319. package/dist/core/p-f6888309.entry.js.map +0 -1
  320. package/dist/core/p-f74a8752.entry.js +0 -2
  321. package/dist/core/p-f74a8752.entry.js.map +0 -1
  322. package/dist/esm/helpers-12b4266a.js.map +0 -1
  323. package/dist/esm/helpers-5271897c.js.map +0 -1
  324. package/dist/esm/ic-input-component-container_3.entry.js.map +0 -1
  325. package/dist/esm/ic-input-label_2.entry.js +0 -81
  326. package/dist/esm/ic-input-label_2.entry.js.map +0 -1
  327. /package/dist/core/{p-8b08d8fe.entry.js.map → p-06ae5bec.entry.js.map} +0 -0
  328. /package/dist/core/{p-f843da01.entry.js.map → p-0939ce92.entry.js.map} +0 -0
  329. /package/dist/core/{p-e0462b23.entry.js.map → p-16f67397.entry.js.map} +0 -0
  330. /package/dist/core/{p-db9c03c0.entry.js.map → p-1832f4b5.entry.js.map} +0 -0
  331. /package/dist/core/{p-ab09986c.entry.js.map → p-1b7d426b.entry.js.map} +0 -0
  332. /package/dist/core/{p-5e0c830b.entry.js.map → p-1ce75941.entry.js.map} +0 -0
  333. /package/dist/core/{p-1ca332ca.entry.js.map → p-2e2e0099.entry.js.map} +0 -0
  334. /package/dist/core/{p-4753bac8.entry.js.map → p-36508aad.entry.js.map} +0 -0
  335. /package/dist/core/{p-10fb4c46.entry.js.map → p-3745da83.entry.js.map} +0 -0
  336. /package/dist/core/{p-3803a5b5.entry.js.map → p-3f2e77c3.entry.js.map} +0 -0
  337. /package/dist/core/{p-88d54b72.entry.js.map → p-47ac6838.entry.js.map} +0 -0
  338. /package/dist/core/{p-4baa0916.entry.js.map → p-4f1ffa39.entry.js.map} +0 -0
  339. /package/dist/core/{p-f7a14c01.entry.js.map → p-5759d771.entry.js.map} +0 -0
  340. /package/dist/core/{p-6c3044b6.entry.js.map → p-5e2e6c3b.entry.js.map} +0 -0
  341. /package/dist/core/{p-2eac7dcc.entry.js.map → p-5fe96107.entry.js.map} +0 -0
  342. /package/dist/core/{p-b82dcc29.entry.js.map → p-62e22508.entry.js.map} +0 -0
  343. /package/dist/core/{p-75dac3d1.entry.js.map → p-6690bc04.entry.js.map} +0 -0
  344. /package/dist/core/{p-c125b65a.entry.js.map → p-6c0e2ceb.entry.js.map} +0 -0
  345. /package/dist/core/{p-a0f8efb2.entry.js.map → p-76d26018.entry.js.map} +0 -0
  346. /package/dist/core/{p-4f413fc0.entry.js.map → p-776671cf.entry.js.map} +0 -0
  347. /package/dist/core/{p-5ae93c16.entry.js.map → p-7cecf5d5.entry.js.map} +0 -0
  348. /package/dist/core/{p-7ef8d616.entry.js.map → p-85609bdd.entry.js.map} +0 -0
  349. /package/dist/core/{p-a43c12cd.entry.js.map → p-86012178.entry.js.map} +0 -0
  350. /package/dist/core/{p-942282cd.entry.js.map → p-8a7e7d23.entry.js.map} +0 -0
  351. /package/dist/core/{p-a50c3b9e.entry.js.map → p-8c90110a.entry.js.map} +0 -0
  352. /package/dist/core/{p-045359e1.entry.js.map → p-8ea47d42.entry.js.map} +0 -0
  353. /package/dist/core/{p-e834344e.entry.js.map → p-982a6e88.entry.js.map} +0 -0
  354. /package/dist/core/{p-d8469ac0.entry.js.map → p-98448bdb.entry.js.map} +0 -0
  355. /package/dist/core/{p-6933f8e9.entry.js.map → p-9d01a7ad.entry.js.map} +0 -0
  356. /package/dist/core/{p-595be57d.entry.js.map → p-9d540656.entry.js.map} +0 -0
  357. /package/dist/core/{p-81ddc39d.entry.js.map → p-a0f9b259.entry.js.map} +0 -0
  358. /package/dist/core/{p-a31031a5.entry.js.map → p-a42c2f37.entry.js.map} +0 -0
  359. /package/dist/core/{p-869954a2.entry.js.map → p-a6447b13.entry.js.map} +0 -0
  360. /package/dist/core/{p-e3997d60.entry.js.map → p-ae422058.entry.js.map} +0 -0
  361. /package/dist/core/{p-a434c3d4.entry.js.map → p-b306cbc8.entry.js.map} +0 -0
  362. /package/dist/core/{p-ac4e40a7.entry.js.map → p-c7590421.entry.js.map} +0 -0
  363. /package/dist/core/{p-f3c840cd.entry.js.map → p-c7820c23.entry.js.map} +0 -0
  364. /package/dist/core/{p-917c5721.entry.js.map → p-ca8cbd6a.entry.js.map} +0 -0
  365. /package/dist/core/{p-73be1251.entry.js.map → p-caf857de.entry.js.map} +0 -0
  366. /package/dist/core/{p-c34848da.entry.js.map → p-d3856ed3.entry.js.map} +0 -0
  367. /package/dist/core/{p-204ace96.entry.js.map → p-d4fdd8c1.entry.js.map} +0 -0
  368. /package/dist/core/{p-ba86928c.entry.js.map → p-d5c99ec3.entry.js.map} +0 -0
  369. /package/dist/core/{p-624d4f5f.entry.js.map → p-e74f1d09.entry.js.map} +0 -0
  370. /package/dist/core/{p-fc5611e2.entry.js.map → p-e84b0310.entry.js.map} +0 -0
  371. /package/dist/core/{p-169bfa51.entry.js.map → p-fbf4e9b7.entry.js.map} +0 -0
@@ -0,0 +1,1668 @@
1
+ import { h, Host, } from "@stencil/core";
2
+ import { IcInformationStatus, IcThemeForegroundEnum, IcDateInputMonths, IcDayNames, } from "../../utils/types";
3
+ import { convertToDoubleDigits, createDate, extractDateFromZuluDateTime, isDateOrEpoch, splitStringDate, } from "../../utils/date-helpers";
4
+ import { addFormResetListener, getInputDescribedByText, isEmptyString, isNumeric, onComponentRequiredPropUndefined, removeFormResetListener, renderHiddenInput, stringEnumToArray, } from "../../utils/helpers";
5
+ import Clear from "../../assets/clear-icon.svg";
6
+ import Calendar from "../../assets/calendar.svg";
7
+ let inputIds = 0;
8
+ export class DateInput {
9
+ constructor() {
10
+ this.ARIA_INVALID = "aria-invalid";
11
+ this.ARIA_LABEL = "aria-label";
12
+ this.ARIA_LABELLED_BY = "aria-labelledby";
13
+ this.EVENT_OBJECT_STRING = "[object Event]";
14
+ this.FIT_TO_VALUE = "fit-to-value";
15
+ this.initialValue = this.value;
16
+ this.INPUT_EVENT_OBJECT_STRING = "[object InputEvent]";
17
+ this.inputsInOrder = [];
18
+ this.isAfterMax = false;
19
+ this.isBeforeMin = false;
20
+ this.isDateSetFromKeyboardEvent = false;
21
+ this.isDisabledDate = false;
22
+ this.isValidDay = true;
23
+ this.isValidMonth = true;
24
+ this.isValidDate = true;
25
+ this.isZuluTime = false;
26
+ this.KEYBOARD_EVENT_OBJECT_STRING = "[object KeyboardEvent]";
27
+ this.MAX_DAY = 31;
28
+ this.MAX_MONTH = 12;
29
+ this.previousSelectedDate = null;
30
+ this.selectedDate = null;
31
+ this.setInputPasteValue = (input, pastedValue) => {
32
+ const inputEl = input;
33
+ inputEl.value = pastedValue;
34
+ inputEl.classList.add(this.FIT_TO_VALUE);
35
+ };
36
+ this.checkSingleCopiedValueIsValid = (input, pastedValue) => {
37
+ let isValid = false;
38
+ const value = Number(pastedValue);
39
+ switch (input) {
40
+ case this.dayInputEl:
41
+ isValid = value >= 1 && value <= this.MAX_DAY;
42
+ break;
43
+ case this.monthInputEl:
44
+ isValid = value >= 1 && value <= this.MAX_MONTH;
45
+ break;
46
+ case this.yearInputEl:
47
+ isValid = true;
48
+ break;
49
+ default:
50
+ isValid = false;
51
+ break;
52
+ }
53
+ return isValid;
54
+ };
55
+ /**
56
+ * Using Object.prototype.string to determine type if event from user
57
+ * @param event - event object used to differentiate keyboard, generic or input event
58
+ * @returns boolean
59
+ */
60
+ this.isKeyboardOrEvent = (event) => {
61
+ return (Object.prototype.toString.call(event) === this.EVENT_OBJECT_STRING ||
62
+ Object.prototype.toString.call(event) ===
63
+ this.KEYBOARD_EVENT_OBJECT_STRING);
64
+ };
65
+ this.setDateValidity = () => {
66
+ if (!isEmptyString(this.day)) {
67
+ this.isValidDay = +this.day > this.MAX_DAY ? false : true;
68
+ }
69
+ else {
70
+ this.isValidDay = true;
71
+ }
72
+ if (!isEmptyString(this.month)) {
73
+ this.isValidMonth = +this.month > this.MAX_MONTH ? false : true;
74
+ }
75
+ else {
76
+ this.isValidMonth = true;
77
+ }
78
+ };
79
+ this.handleInput = (event) => {
80
+ const inputEvent = event;
81
+ const input = event.target;
82
+ if (input !== this.yearInputEl) {
83
+ // Only auto-format if input event is not a character being deleted
84
+ // and not as user is changing value using up / down keys
85
+ if (inputEvent.inputType !== "deleteContentBackward" &&
86
+ !this.preventAutoFormatting) {
87
+ if (input.value.length === 1 &&
88
+ ((input === this.dayInputEl && +input.value >= 4) ||
89
+ (input === this.monthInputEl && +input.value >= 2)) &&
90
+ +input.value <= 9) {
91
+ this.setInputValue(input);
92
+ this.notifyScreenReader(input, event);
93
+ this.moveToNextInput(input);
94
+ }
95
+ if (input.value.length === 2) {
96
+ if (+input.value === 0) {
97
+ input.value = "01";
98
+ }
99
+ this.setInputValue(input);
100
+ this.setPreventInput(input, true);
101
+ this.notifyScreenReader(input, event);
102
+ this.moveToNextInput(input);
103
+ }
104
+ else {
105
+ this.setPreventInput(input, false);
106
+ }
107
+ }
108
+ else if (this.preventAutoFormatting) {
109
+ /**
110
+ * Using arrow keys prevents auto formatting so need to deal with
111
+ * switching from arrow keys to inputting numbers
112
+ **/
113
+ if (input.value.length === 2 && !this.isKeyboardOrEvent(event)) {
114
+ this.setInputValue(input);
115
+ this.setPreventInput(input, true);
116
+ this.moveToNextInput(input);
117
+ }
118
+ else {
119
+ this.setInputValue(input);
120
+ }
121
+ }
122
+ if (input.value.length !== 2) {
123
+ this.setPreventInput(input, false);
124
+ }
125
+ }
126
+ else {
127
+ if (input.value.length === 4) {
128
+ this.setInputValue(input);
129
+ if (Object.prototype.toString.call(event) !== this.EVENT_OBJECT_STRING) {
130
+ this.moveToNextInput(input);
131
+ }
132
+ this.setPreventInput(input, true);
133
+ }
134
+ else {
135
+ this.setInputValue(input, true);
136
+ this.setPreventInput(input, false);
137
+ }
138
+ }
139
+ // Add / remove class to make input width match size of value i.e. 2 digits' width for day / month, 4 for year
140
+ this.setFitToValueStyling(input);
141
+ if (input.value.length === 0) {
142
+ this.setInputValue(input, true);
143
+ this.setValidationMessage();
144
+ }
145
+ this.notifyScreenReader(input, event);
146
+ };
147
+ this.handleKeyDown = (event, isInputPrevented) => {
148
+ const input = event.target;
149
+ const eventKey = event.key.toLowerCase();
150
+ // Regex required due to FF allowing all characters as values for number text field.
151
+ const regex = /-?\d*\.?\d+(e[-+]?\d+)?|[/-]|arrowup|arrowdown|arrowleft|arrowright|shift|tab|backspace|delete/;
152
+ if (!regex.test(eventKey) &&
153
+ !((event.ctrlKey || event.metaKey) &&
154
+ (eventKey === "v" || eventKey === "c"))) {
155
+ event.preventDefault();
156
+ }
157
+ switch (eventKey) {
158
+ case "/":
159
+ case "-":
160
+ case ".":
161
+ event.preventDefault();
162
+ this.setPasteInvalidText();
163
+ this.moveToNextInput(input);
164
+ break;
165
+ case "arrowright":
166
+ case "arrowleft":
167
+ event.preventDefault();
168
+ this.handleLeftRightArrowKeyPress(input, eventKey);
169
+ break;
170
+ case "arrowup":
171
+ case "arrowdown":
172
+ this.preventAutoFormatting = true;
173
+ this.handleUpDownArrowKeyPress(input, event);
174
+ break;
175
+ default:
176
+ break;
177
+ }
178
+ this.preventInput(event, isInputPrevented);
179
+ this.isDateSetFromKeyboardEvent = true;
180
+ };
181
+ this.handleFocus = (event) => {
182
+ // Highlight / select all characters in input for easy replacement
183
+ const input = event.target;
184
+ input.select();
185
+ };
186
+ this.handleBlur = (event) => {
187
+ const input = event.target;
188
+ this.setPasteInvalidText();
189
+ this.autocompleteInput(input);
190
+ };
191
+ this.handleLeftRightArrowKeyPress = (input, key) => {
192
+ if (key === "arrowright") {
193
+ this.moveToNextInput(input);
194
+ }
195
+ else {
196
+ this.moveToPreviousInput(input);
197
+ }
198
+ this.setPasteInvalidText();
199
+ };
200
+ this.notifyScreenReaderSelectedDate = () => {
201
+ const dayNames = stringEnumToArray(IcDayNames);
202
+ const months = stringEnumToArray(IcDateInputMonths);
203
+ this.selectedDateInfoEl.textContent = `Selected date: ${dayNames[this.selectedDate.getDay()]}, ${this.selectedDate.getDate()} ${months[this.selectedDate.getMonth()]} ${this.selectedDate.getFullYear()}`;
204
+ };
205
+ this.handleUpDownArrowKeyPress = (input, event) => {
206
+ const minValue = input === this.yearInputEl ? 0 : 1;
207
+ let maxValue;
208
+ switch (input) {
209
+ case this.dayInputEl:
210
+ maxValue = this.MAX_DAY;
211
+ break;
212
+ case this.monthInputEl:
213
+ maxValue = this.MAX_MONTH;
214
+ break;
215
+ case this.yearInputEl:
216
+ maxValue = 9999;
217
+ }
218
+ // Make value loop round when min / max reached
219
+ if (input === null || input === void 0 ? void 0 : input.value) {
220
+ if (event.key === "ArrowUp") {
221
+ if (+input.value === maxValue) {
222
+ event.preventDefault();
223
+ input.value = `0${minValue}`;
224
+ }
225
+ else {
226
+ input.value =
227
+ +input.value + 1 < 10
228
+ ? `0${+input.value + 1}`
229
+ : (+input.value + 1).toString();
230
+ }
231
+ this.notifyScreenReader(input, event);
232
+ }
233
+ if (event.key === "ArrowDown") {
234
+ if (+input.value === minValue) {
235
+ event.preventDefault();
236
+ input.value = maxValue.toString();
237
+ }
238
+ else {
239
+ input.value =
240
+ +input.value - 1 < 10
241
+ ? `0${+input.value - 1}`
242
+ : (+input.value - 1).toString();
243
+ }
244
+ this.notifyScreenReader(input, event);
245
+ }
246
+ }
247
+ else {
248
+ if (event.key === "ArrowDown") {
249
+ event.preventDefault();
250
+ if (input === this.yearInputEl) {
251
+ input.value = new Date().getFullYear().toString();
252
+ }
253
+ else {
254
+ input.value = maxValue.toString();
255
+ }
256
+ this.notifyScreenReader(input, event);
257
+ }
258
+ else if (event.key === "ArrowUp") {
259
+ event.preventDefault();
260
+ if (input === this.yearInputEl) {
261
+ input.value = new Date().getFullYear().toString();
262
+ }
263
+ else {
264
+ input.value = `0${minValue}`;
265
+ }
266
+ this.notifyScreenReader(input, event);
267
+ }
268
+ }
269
+ this.setInputValue(input);
270
+ this.setFitToValueStyling(input);
271
+ };
272
+ this.handleDateChange = (force) => {
273
+ // Prevent icChange being emitted when each individual input is changed
274
+ // This method is used within componentWillUpdate instead of using @Watch('value');
275
+ if (force || this.selectedDate !== this.previousSelectedDate) {
276
+ if (this.value) {
277
+ this.inputsInOrder.forEach((input) => {
278
+ input.classList.add(this.FIT_TO_VALUE);
279
+ });
280
+ }
281
+ if (this.day && this.month && this.year && this.invalidDateText === "") {
282
+ this.setValueAndEmitChange(this.selectedDate);
283
+ this.notifyScreenReaderSelectedDate();
284
+ }
285
+ else {
286
+ this.setValueAndEmitChange(null);
287
+ this.selectedDateInfoEl.textContent = "";
288
+ }
289
+ this.previousSelectedDate = this.selectedDate;
290
+ if (!this.isDateSetFromKeyboardEvent) {
291
+ this.updateInputValues(this.day, this.month, this.year);
292
+ }
293
+ }
294
+ };
295
+ this.slicePastedDate = (valueLength, datePart) => {
296
+ return datePart.length > valueLength
297
+ ? datePart.slice(0, valueLength)
298
+ : datePart;
299
+ };
300
+ this.isPastedStringDateValid = (value) => {
301
+ if (/\d+-\d+-\d+$/.test(value) ||
302
+ /\d+\/\d+\/\d+/.test(value) ||
303
+ /\d+\.\d+\.\d+/.test(value)) {
304
+ return true;
305
+ }
306
+ if (/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}(?::[0-9]{2}(?:\.\d+)?)?Z/.test(value)) {
307
+ this.isZuluTime = true;
308
+ return true;
309
+ }
310
+ return false;
311
+ };
312
+ // Set value of each input to value of pasted date part
313
+ // Allows formats separated by '-' or '/'
314
+ this.handlePaste = (event) => {
315
+ event.preventDefault();
316
+ const pastedValue = event.clipboardData.getData("Text");
317
+ const isValidDate = this.isPastedStringDateValid(pastedValue);
318
+ this.setPastedValueAndValidation(isValidDate, pastedValue, event);
319
+ };
320
+ this.setDate = (date) => {
321
+ if (date === null || date === "" || date === undefined) {
322
+ this.day = null;
323
+ this.month = null;
324
+ this.year = null;
325
+ this.inputsInOrder.forEach((input) => {
326
+ input.classList.remove(this.FIT_TO_VALUE);
327
+ this.setPreventInput(input, false);
328
+ });
329
+ this.handleDateChange(true);
330
+ }
331
+ else {
332
+ if (isDateOrEpoch(date)) {
333
+ let newDate;
334
+ if (typeof date === "string") {
335
+ // Checking if epoch date time
336
+ newDate = new Date(+date);
337
+ }
338
+ else {
339
+ newDate = date;
340
+ }
341
+ this.day = convertToDoubleDigits(newDate.getDate());
342
+ this.month = convertToDoubleDigits(newDate.getMonth() + 1);
343
+ this.year = newDate.getFullYear().toString();
344
+ }
345
+ else if (typeof date === "string") {
346
+ const defaultDateArray = splitStringDate(date, this.dateFormat);
347
+ this.year = defaultDateArray[0];
348
+ this.month = defaultDateArray[1];
349
+ this.day = defaultDateArray[2];
350
+ }
351
+ }
352
+ this.setValidationMessage();
353
+ };
354
+ this.formatMinMax = (date) => {
355
+ let formattedDate;
356
+ const day = convertToDoubleDigits(date.getDate());
357
+ const month = convertToDoubleDigits(date.getMonth() + 1);
358
+ const year = date.getFullYear();
359
+ switch (this.dateFormat) {
360
+ case "DD/MM/YYYY":
361
+ formattedDate = `${day}/${month}/${year}`;
362
+ break;
363
+ case "MM/DD/YYYY":
364
+ formattedDate = `${month}/${day}/${year}`;
365
+ break;
366
+ case "YYYY/MM/DD":
367
+ formattedDate = `${year}/${month}/${day}`;
368
+ break;
369
+ default:
370
+ break;
371
+ }
372
+ return formattedDate;
373
+ };
374
+ this.updateInputValues = (day, month, year) => {
375
+ this.dayInputEl.value = day;
376
+ this.monthInputEl.value = month;
377
+ this.yearInputEl.value = year;
378
+ };
379
+ // Set value in state based on input
380
+ this.setInputValue = (input, clear = false) => {
381
+ const newValue = clear ? "" : input.value;
382
+ switch (input) {
383
+ case this.dayInputEl:
384
+ this.day = newValue;
385
+ break;
386
+ case this.monthInputEl:
387
+ this.month = newValue;
388
+ break;
389
+ case this.yearInputEl:
390
+ if (this.year !== newValue) {
391
+ this.year = newValue;
392
+ }
393
+ }
394
+ this.setValidationMessage();
395
+ };
396
+ this.setValidationMessage = () => {
397
+ this.setDateValidity();
398
+ if (!isEmptyString(this.day) &&
399
+ !isEmptyString(this.month) &&
400
+ !isEmptyString(this.year)) {
401
+ // Check whether date actually exists
402
+ // (used https://www.hectane.com/blog/javascript-date-validation-with-leap-year)
403
+ this.selectedDate = this.convertToDate(this.year, this.month, this.day);
404
+ this.isValidDate =
405
+ +this.selectedDate !== 0 && this.selectedDate.getDate() == +this.day;
406
+ this.isDisabledDate = this.isSelectedDateDisabled();
407
+ if (!this.isValidDate || this.isDisabledDate) {
408
+ this.inputsInOrder.forEach((input) => input.setAttribute(this.ARIA_INVALID, "true"));
409
+ }
410
+ else {
411
+ this.inputsInOrder.forEach((input) => input.removeAttribute(this.ARIA_INVALID));
412
+ }
413
+ }
414
+ else {
415
+ this.selectedDate = null;
416
+ }
417
+ if (!(this.isValidDay && this.isValidMonth && this.isValidDate)) {
418
+ this.invalidDateText = "Please enter a valid date.";
419
+ }
420
+ else if (this.isDisabledDate && this.selectedDate !== null) {
421
+ if (this.isBeforeMin) {
422
+ if (this.disablePast) {
423
+ this.invalidDateText = this.disablePastMessage;
424
+ }
425
+ else {
426
+ this.invalidDateText = `Please enter a date after ${this.formatMinMax(this.minDate)}.`;
427
+ }
428
+ }
429
+ else if (this.isAfterMax) {
430
+ if (this.disableFuture) {
431
+ this.invalidDateText = this.disableFutureMessage;
432
+ }
433
+ else {
434
+ this.invalidDateText = `Please enter a date before ${this.formatMinMax(this.maxDate)}.`;
435
+ }
436
+ }
437
+ else if (this.disableDays.length !== 0) {
438
+ this.invalidDateText = this.disableDaysMessage;
439
+ }
440
+ else {
441
+ if (this.disablePast) {
442
+ this.invalidDateText = this.disablePastMessage;
443
+ }
444
+ if (this.disableFuture) {
445
+ this.invalidDateText = this.disableFutureMessage;
446
+ }
447
+ }
448
+ }
449
+ else {
450
+ this.invalidDateText = "";
451
+ }
452
+ };
453
+ // Set refs to the input elements in the order they are displayed (based on the dateFormat)
454
+ this.setInputsInOrder = () => {
455
+ const inputs = this.el.shadowRoot.querySelectorAll("input");
456
+ inputs.forEach((input) => this.inputsInOrder.push(input));
457
+ };
458
+ // Includes text usually added using aria-describedby
459
+ // (which doesn't work on input component container)
460
+ this.setAriaLabelledBy = () => {
461
+ var _a;
462
+ if (this.disabled &&
463
+ !isEmptyString((_a = this.inputCompContainerEl) === null || _a === void 0 ? void 0 : _a.getAttribute(this.ARIA_LABELLED_BY))) {
464
+ this.removeAriaLabelledBy();
465
+ return;
466
+ }
467
+ if (this.disabled) {
468
+ return;
469
+ }
470
+ const labelEl = this.el.shadowRoot.querySelector("label");
471
+ const labelId = `${this.inputId}-label`;
472
+ if (labelEl !== null && labelEl !== undefined) {
473
+ labelEl.id = labelId;
474
+ const hasValidation = (!isEmptyString(this.validationStatus) &&
475
+ !isEmptyString(this.validationText)) ||
476
+ !isEmptyString(this.invalidDateText);
477
+ const labelledBy = `${labelId} ${this.screenReaderInfoId} ${getInputDescribedByText(this.inputId, this.helperText !== "" && this.helperText !== this.defaultHelperText, hasValidation)} ${this.selectedDate ? this.selectedDateInfoId : ""} ${this.assistiveHintId}`;
478
+ this.inputCompContainerEl.setAttribute(this.ARIA_LABELLED_BY, labelledBy);
479
+ }
480
+ };
481
+ // Sets boolean for each input, used to limit the number of characters within each field (2 for day / month, 4 for year)
482
+ this.setPreventInput = (input, isPrevented) => {
483
+ switch (input) {
484
+ case this.dayInputEl:
485
+ this.preventDayInput = isPrevented;
486
+ break;
487
+ case this.monthInputEl:
488
+ this.preventMonthInput = isPrevented;
489
+ break;
490
+ case this.yearInputEl:
491
+ this.preventYearInput = isPrevented;
492
+ }
493
+ };
494
+ // Get input based on letter representing each date part ("D", "M" or "Y")
495
+ // (retrieved from dateFormat)
496
+ this.getInputFromDatePart = (datePart) => {
497
+ const dayInput = (h("input", { class: "day-input", id: "day-input", ref: (el) => (this.dayInputEl = el), "aria-label": "day", placeholder: "DD", disabled: this.disabled, onPaste: this.handlePaste, inputmode: "number", pattern: "[0-9]*", onKeyDown: (event) => this.handleKeyDown(event, this.preventDayInput) }));
498
+ const monthInput = (h("input", { id: "month-input", class: "month-input", ref: (el) => (this.monthInputEl = el), "aria-label": "month", placeholder: "MM", disabled: this.disabled, onPaste: this.handlePaste, inputmode: "number", pattern: "[0-9]*", onKeyDown: (event) => this.handleKeyDown(event, this.preventMonthInput) }));
499
+ const yearInput = (h("input", { id: "year-input", class: "year-input", ref: (el) => (this.yearInputEl = el), "aria-label": "year", placeholder: "YYYY", maxLength: 4, disabled: this.disabled, onPaste: this.handlePaste, inputmode: "number", pattern: "[0-9]*", onKeyDown: (event) => this.handleKeyDown(event, this.preventYearInput) }));
500
+ let input;
501
+ switch (datePart) {
502
+ case "D":
503
+ input = dayInput;
504
+ break;
505
+ case "M":
506
+ input = monthInput;
507
+ break;
508
+ case "Y":
509
+ input = yearInput;
510
+ }
511
+ return input;
512
+ };
513
+ // Get input elements in order of chosen date format
514
+ this.getInputsInOrder = () => {
515
+ const dateParts = this.dateFormat.split("/");
516
+ const inputsInOrder = [];
517
+ dateParts.forEach((part) => {
518
+ inputsInOrder.push(this.getInputFromDatePart(part.substring(0, 1)));
519
+ });
520
+ return inputsInOrder;
521
+ };
522
+ // To add to the end of assistive hint to make it clearer that each date part has its own input
523
+ // that can be changed individually
524
+ this.getDescOfInputsOrder = () => {
525
+ let description;
526
+ switch (this.dateFormat) {
527
+ case "DD/MM/YYYY":
528
+ description = "day, month, and year";
529
+ break;
530
+ case "MM/DD/YYYY":
531
+ description = "month, day, and year";
532
+ break;
533
+ case "YYYY/MM/DD":
534
+ description = "year, month, and day";
535
+ }
536
+ return description;
537
+ };
538
+ // Add 'required' or 'invalid data' to span used in aria-labelledby
539
+ // Many ARIA attributes aren't read out by screen reader when on the input component container
540
+ this.getScreenReaderInfo = (validationStatus) => {
541
+ let inputDescriptors = "";
542
+ if (this.required) {
543
+ inputDescriptors += "required";
544
+ }
545
+ if (validationStatus === IcInformationStatus.Error) {
546
+ inputDescriptors += " invalid data";
547
+ }
548
+ return inputDescriptors === "" ? "" : inputDescriptors + ", ";
549
+ };
550
+ // Prevent non-number characters being entered
551
+ // ('e' or '.' - which are usually allowed in <input type="number">)
552
+ // And limit the number of characters within each field (2 for day / month, 4 for year)
553
+ // (because 'maxlength' doesn't work on <input type="number">)
554
+ this.preventInput = (event, isInputPrevented) => {
555
+ const key = event.key;
556
+ const input = event.target;
557
+ let selectedString;
558
+ if (input) {
559
+ selectedString = input.value.substring(input.selectionStart, input.selectionEnd);
560
+ }
561
+ if (key === "e" ||
562
+ key === "." ||
563
+ key === "-" ||
564
+ (event.key >= "0" &&
565
+ event.key <= "9" &&
566
+ isInputPrevented &&
567
+ !selectedString)) {
568
+ event.preventDefault();
569
+ }
570
+ };
571
+ // Get whether date has been disabled using disableFuture or disablePast prop, but always allow current day
572
+ // Consider using dateClamp and inDateRange
573
+ this.isSelectedDateDisabled = () => {
574
+ const currentDate = new Date();
575
+ this.isAfterMax = false;
576
+ this.isBeforeMin = false;
577
+ let disabled = false;
578
+ const isNotToday = this.selectedDate.toDateString() !== currentDate.toDateString();
579
+ if (this.minDate && this.selectedDate < this.minDate && isNotToday) {
580
+ this.isBeforeMin = true;
581
+ disabled = true;
582
+ }
583
+ if (this.maxDate && this.selectedDate > this.maxDate && isNotToday) {
584
+ this.isAfterMax = true;
585
+ disabled = true;
586
+ }
587
+ if (this.disableDays.includes(this.selectedDate.getDay())) {
588
+ disabled = true;
589
+ }
590
+ if (((this.disablePast && this.selectedDate < currentDate) ||
591
+ (this.disableFuture && this.selectedDate > currentDate)) &&
592
+ isNotToday) {
593
+ disabled = true;
594
+ }
595
+ return disabled;
596
+ };
597
+ this.moveToNextInput = (currentInput) => {
598
+ const currentInputPos = this.inputsInOrder.findIndex((input) => input === currentInput);
599
+ const nextInput = this.inputsInOrder[currentInputPos + 1];
600
+ this.preventAutoFormatting = false;
601
+ if (nextInput) {
602
+ nextInput.focus();
603
+ }
604
+ };
605
+ this.moveToPreviousInput = (currentInput) => {
606
+ const currentInputPos = this.inputsInOrder.findIndex((input) => input === currentInput);
607
+ this.preventAutoFormatting = false;
608
+ if (this.inputsInOrder[currentInputPos - 1]) {
609
+ this.inputsInOrder[currentInputPos - 1].focus();
610
+ }
611
+ };
612
+ this.autocompleteInput = (input) => {
613
+ if (input === this.yearInputEl) {
614
+ this.autocompleteYear();
615
+ }
616
+ else {
617
+ const inputValue = input.value;
618
+ // Autocomplete input as 2 characters (leading zero) when only 1 character entered (for day and month)
619
+ if (inputValue.length === 1) {
620
+ if (+inputValue === 0) {
621
+ input.value = "01";
622
+ }
623
+ else {
624
+ input.value = `0${inputValue}`;
625
+ }
626
+ }
627
+ }
628
+ if (input.value) {
629
+ this.setInputValue(input);
630
+ }
631
+ };
632
+ // Autocomplete year as current millennium when fewer than 4 characters entered
633
+ this.autocompleteYear = () => {
634
+ const inputValue = this.yearInputEl.value;
635
+ const yearNumbers = ["2", "0", "0"];
636
+ let autocompletedInput = "";
637
+ if (inputValue) {
638
+ yearNumbers.forEach((number, index) => {
639
+ if (inputValue.length + index <= 3) {
640
+ autocompletedInput += number;
641
+ }
642
+ });
643
+ this.yearInputEl.value = `${autocompletedInput}${inputValue}`;
644
+ }
645
+ };
646
+ this.convertToDate = (year, month, day) => {
647
+ if (!isEmptyString(year) && !isEmptyString(month) && !isEmptyString(day)) {
648
+ return new Date(+year, +month - 1, +day);
649
+ }
650
+ else {
651
+ return null;
652
+ }
653
+ };
654
+ this.handleHostBlur = () => {
655
+ this.removeLabelledBy = false;
656
+ this.icBlur.emit({ value: this.selectedDate });
657
+ };
658
+ this.handleHostFocus = () => {
659
+ if (this.el.shadowRoot.activeElement.id.match(/(day|month|year)-input$/)) {
660
+ this.removeLabelledBy = false;
661
+ }
662
+ else {
663
+ this.removeLabelledBy = true;
664
+ }
665
+ this.icFocus.emit({ value: this.selectedDate });
666
+ };
667
+ this.handleFormReset = () => {
668
+ // Get the initial value and populate day, month and year again.
669
+ this.setDate(this.initialValue);
670
+ this.setValidationMessage();
671
+ this.handleDateChange(false);
672
+ };
673
+ this.getAriaLabel = (input) => {
674
+ return input.getAttribute(this.ARIA_LABEL);
675
+ };
676
+ this.notifyScreenReaderArrowKeys = (input) => {
677
+ const liveRegion = this.el.shadowRoot.querySelector("#live-region");
678
+ let announcement = "";
679
+ const ariaLabel = this.getAriaLabel(input);
680
+ if (liveRegion && input.value) {
681
+ if (input === this.monthInputEl &&
682
+ !!IcDateInputMonths[+input.value - 1]) {
683
+ announcement = `${input.value} - ${IcDateInputMonths[+input.value - 1]}, ${ariaLabel}`;
684
+ }
685
+ if (input === this.dayInputEl || input === this.yearInputEl) {
686
+ announcement = `${input.value}, ${ariaLabel}`;
687
+ }
688
+ liveRegion.textContent = announcement;
689
+ }
690
+ };
691
+ this.notifyScreenReaderInput = (input, liveRegion) => {
692
+ let announcement = "";
693
+ const ariaLabel = this.getAriaLabel(input);
694
+ if (input === this.dayInputEl || input === this.monthInputEl) {
695
+ if (input.value.length === 2) {
696
+ if (input === this.monthInputEl &&
697
+ !!IcDateInputMonths[+input.value - 1] &&
698
+ this.isValidMonth) {
699
+ announcement = `${input.value} - ${IcDateInputMonths[+input.value - 1]}, ${ariaLabel}`;
700
+ }
701
+ if (input === this.dayInputEl && this.isValidDay) {
702
+ announcement = `${input.value}, ${ariaLabel}`;
703
+ }
704
+ }
705
+ else {
706
+ announcement = "";
707
+ }
708
+ }
709
+ else {
710
+ if (input.value.length === 4) {
711
+ announcement = `${input.value}, ${ariaLabel}`;
712
+ }
713
+ else {
714
+ announcement = "";
715
+ }
716
+ }
717
+ liveRegion.textContent = announcement;
718
+ };
719
+ this.setFitToValueStyling = (input) => {
720
+ if (input.value) {
721
+ input.classList.add(this.FIT_TO_VALUE);
722
+ }
723
+ else {
724
+ input.classList.remove(this.FIT_TO_VALUE);
725
+ }
726
+ };
727
+ this.setAriaInvalid = (validDay, validMonth, validDate, disabledDate) => {
728
+ if (this.inputsInOrder.length) {
729
+ this.inputsInOrder.forEach((input) => {
730
+ input.removeAttribute(this.ARIA_INVALID);
731
+ });
732
+ if (!validDay) {
733
+ this.dayInputEl.setAttribute(this.ARIA_INVALID, "true");
734
+ }
735
+ if (!validMonth) {
736
+ this.monthInputEl.setAttribute(this.ARIA_INVALID, "true");
737
+ }
738
+ if (!validDate || disabledDate) {
739
+ this.inputsInOrder.forEach((input) => {
740
+ input.setAttribute(this.ARIA_INVALID, "true");
741
+ });
742
+ }
743
+ }
744
+ };
745
+ this.handleClear = () => {
746
+ this.inputsInOrder.forEach((input) => {
747
+ input.classList.remove(this.FIT_TO_VALUE);
748
+ this.setInputValue(input, true);
749
+ this.setPreventInput(input, false);
750
+ });
751
+ this.isDateSetFromKeyboardEvent = false;
752
+ this.setValueAndEmitChange(null);
753
+ this.setValidationMessage();
754
+ this.handleDateChange(true);
755
+ this.inputsInOrder[0].focus();
756
+ };
757
+ this.handleCalendarOpen = (ev) => {
758
+ ev.stopImmediatePropagation();
759
+ this.calendarButtonEl.shadowRoot
760
+ .querySelector("ic-tooltip")
761
+ .displayTooltip(false);
762
+ this.calendarButtonClicked.emit({ value: this.selectedDate });
763
+ this.calendarButtonEl.shadowRoot
764
+ .querySelector("ic-tooltip")
765
+ .displayTooltip(false);
766
+ this.isDateSetFromKeyboardEvent = false;
767
+ };
768
+ this.setValueAndEmitChange = (value) => {
769
+ if (this.value !== value) {
770
+ this.icChange.emit({ value: value });
771
+ this.value = value;
772
+ }
773
+ };
774
+ this.handleCalendarFocus = () => {
775
+ this.calendarFocused = true;
776
+ };
777
+ this.handleCalendarBlur = () => {
778
+ this.calendarFocused = false;
779
+ };
780
+ this.handleClearFocus = () => {
781
+ this.removeLabelledBy = true;
782
+ this.clearButtonFocused = true;
783
+ };
784
+ this.handleClearBlur = (ev) => {
785
+ this.clearButtonFocused = false;
786
+ if (ev.relatedTarget.id.match(/(day|year)-input$/)) {
787
+ this.removeLabelledBy = false;
788
+ return;
789
+ }
790
+ this.removeLabelledBy = true;
791
+ };
792
+ this.day = "";
793
+ this.invalidDateText = undefined;
794
+ this.maxDate = undefined;
795
+ this.minDate = undefined;
796
+ this.month = "";
797
+ this.year = "";
798
+ this.calendarFocused = false;
799
+ this.clearButtonFocused = false;
800
+ this.removeLabelledBy = false;
801
+ this.dateFormat = "DD/MM/YYYY";
802
+ this.disabled = false;
803
+ this.disableDays = [];
804
+ this.disableDaysMessage = "The date you have selected is on a day of the week that is not allowed. Please select another date.";
805
+ this.disableFuture = false;
806
+ this.disableFutureMessage = "Dates in the future are not allowed. Please select a date in the past.";
807
+ this.disablePast = false;
808
+ this.disablePastMessage = "Dates in the past are not allowed. Please select a date in the future.";
809
+ this.helperText = undefined;
810
+ this.inputId = `ic-date-input-${inputIds++}`;
811
+ this.label = undefined;
812
+ this.max = "";
813
+ this.min = "";
814
+ this.name = this.inputId;
815
+ this.required = false;
816
+ this.showCalendarButton = false;
817
+ this.showClearButton = true;
818
+ this.size = "default";
819
+ this.value = "";
820
+ this.validationStatus = "";
821
+ this.validationText = "";
822
+ }
823
+ watchMaxHandler() {
824
+ if (this.disableFuture) {
825
+ this.maxDate = new Date();
826
+ }
827
+ else {
828
+ this.maxDate = createDate(this.max, this.dateFormat);
829
+ }
830
+ }
831
+ watchMinHandler() {
832
+ if (this.disablePast) {
833
+ this.minDate = new Date();
834
+ }
835
+ else {
836
+ this.minDate = createDate(this.min, this.dateFormat);
837
+ }
838
+ }
839
+ disconnectedCallback() {
840
+ removeFormResetListener(this.el, this.handleFormReset);
841
+ }
842
+ componentWillLoad() {
843
+ this.defaultHelperText = `Use format ${this.dateFormat}`;
844
+ if (isEmptyString(this.helperText)) {
845
+ this.helperText = this.defaultHelperText;
846
+ }
847
+ this.watchMinHandler();
848
+ this.watchMaxHandler();
849
+ if (this.value) {
850
+ this.setDate(this.value);
851
+ }
852
+ this.screenReaderInfoId = `${this.inputId}-screen-reader-info`;
853
+ this.assistiveHintId = `${this.inputId}-assistive-hint`;
854
+ this.selectedDateInfoId = `${this.inputId}-selected-date-info`;
855
+ addFormResetListener(this.el, this.handleFormReset);
856
+ }
857
+ componentDidLoad() {
858
+ this.setInputsInOrder();
859
+ onComponentRequiredPropUndefined([{ prop: this.label, propName: "label" }], "Date Input");
860
+ if (this.value) {
861
+ this.updateInputValues(this.day, this.month, this.year);
862
+ this.inputsInOrder.forEach((input) => {
863
+ input.classList.add(this.FIT_TO_VALUE);
864
+ });
865
+ }
866
+ this.setAriaInvalid(this.isValidDay, this.isValidMonth, this.isValidDate, this.isDisabledDate);
867
+ if (this.value) {
868
+ this.notifyScreenReaderSelectedDate();
869
+ }
870
+ this.inputsInOrder.forEach((input) => {
871
+ input.addEventListener("input", this.handleInput);
872
+ input.addEventListener("focus", this.handleFocus);
873
+ input.addEventListener("blur", this.handleBlur);
874
+ });
875
+ // Prevent asterisk being read out after the label by screen reader (by applying aria-hidden)
876
+ // Needed because label is included in 'aria-labelledby' instead of using 'aria-label'
877
+ const labelEl = this.el.shadowRoot.querySelector("label");
878
+ if (this.required) {
879
+ const asteriskSpan = document.createElement("span");
880
+ asteriskSpan.setAttribute("aria-hidden", "true");
881
+ asteriskSpan.textContent = " *";
882
+ labelEl === null || labelEl === void 0 ? void 0 : labelEl.appendChild(asteriskSpan);
883
+ }
884
+ }
885
+ componentWillUpdate() {
886
+ if (!this.isDateSetFromKeyboardEvent) {
887
+ this.setDate(this.value);
888
+ }
889
+ this.setAriaInvalid(this.isValidDay, this.isValidMonth, this.isValidDate, this.isDisabledDate);
890
+ this.handleDateChange(false);
891
+ this.isDateSetFromKeyboardEvent = false;
892
+ }
893
+ componentDidRender() {
894
+ if (this.removeLabelledBy) {
895
+ this.removeAriaLabelledBy();
896
+ return;
897
+ }
898
+ this.setAriaLabelledBy();
899
+ }
900
+ /**
901
+ * Returns the value as a Date object
902
+ * @returns Date
903
+ */
904
+ async getDate() {
905
+ return this.selectedDate;
906
+ }
907
+ /**
908
+ * @internal Sets focus on the calendar button.
909
+ */
910
+ async setCalendarFocus() {
911
+ if (this.calendarButtonEl) {
912
+ this.calendarButtonEl.focus();
913
+ }
914
+ }
915
+ /**
916
+ * @internal Used to pass disabledDays from parent component.
917
+ */
918
+ async setDisableDays(days) {
919
+ this.disableDays = days;
920
+ }
921
+ removeAriaLabelledBy() {
922
+ this.inputCompContainerEl.removeAttribute(this.ARIA_LABELLED_BY);
923
+ }
924
+ setPastedValueAndValidation(isValidDate, pastedValue, event) {
925
+ switch (true) {
926
+ case isValidDate: {
927
+ const nextParsedValue = this.isZuluTime
928
+ ? extractDateFromZuluDateTime(pastedValue)
929
+ : pastedValue;
930
+ const dateParts = nextParsedValue.split(/-|\/|\./);
931
+ this.inputsInOrder.forEach((input, index) => {
932
+ input.classList.add(this.FIT_TO_VALUE);
933
+ if (this.isZuluTime) {
934
+ this.pasteZuluDateTime(dateParts, index);
935
+ }
936
+ else {
937
+ let dateValue;
938
+ if (input === this.dayInputEl || input === this.monthInputEl) {
939
+ dateValue = this.slicePastedDate(2, dateParts[index]);
940
+ }
941
+ else {
942
+ dateValue = this.slicePastedDate(4, dateParts[index]);
943
+ }
944
+ input.value = dateValue;
945
+ this.setInputValue(input);
946
+ this.autocompleteInput(input);
947
+ }
948
+ });
949
+ this.isZuluTime = false;
950
+ break;
951
+ }
952
+ case (pastedValue.length === 1 ||
953
+ pastedValue.length === 2 ||
954
+ pastedValue.length === 4) &&
955
+ isNumeric(pastedValue):
956
+ if (this.checkSingleCopiedValueIsValid(event.target, pastedValue)) {
957
+ // Check if copied value can be pasted into input
958
+ this.setInputPasteValue(event.target, pastedValue);
959
+ this.setInputValue(event.target);
960
+ }
961
+ else {
962
+ this.displayPastedValidation(event);
963
+ }
964
+ break;
965
+ case pastedValue.length === 3 && isNumeric(pastedValue):
966
+ if (event.target !== this.yearInputEl) {
967
+ this.displayPastedValidation(event);
968
+ }
969
+ else {
970
+ this.setInputPasteValue(event.target, pastedValue);
971
+ this.setInputValue(event.target);
972
+ }
973
+ break;
974
+ case pastedValue.length >= 5 && isNumeric(pastedValue):
975
+ this.displayPastedValidation(event);
976
+ }
977
+ }
978
+ pasteZuluDateTime(dateParts, index) {
979
+ // ['YYYY', 'MM', 'DD']
980
+ if (index === 0) {
981
+ const dateValue = this.slicePastedDate(4, dateParts[index]);
982
+ this.yearInputEl.value = dateValue;
983
+ this.setInputValue(this.yearInputEl);
984
+ }
985
+ else if (index === 1) {
986
+ // The month value is the second item in the array
987
+ const dateValue = this.slicePastedDate(2, dateParts[index]);
988
+ this.monthInputEl.value = dateValue;
989
+ this.setInputValue(this.monthInputEl);
990
+ }
991
+ else {
992
+ const dateValue = this.slicePastedDate(2, dateParts[index]);
993
+ this.dayInputEl.value = dateValue;
994
+ this.setInputValue(this.dayInputEl);
995
+ }
996
+ }
997
+ displayPastedValidation(event) {
998
+ var _a;
999
+ if (((_a = this.invalidDateText) === null || _a === void 0 ? void 0 : _a.length) > 0) {
1000
+ this.previousInvalidDateTest = this.invalidDateText;
1001
+ }
1002
+ this.invalidDateText = `Please paste a valid ${this.getAriaLabel(event.target)}`;
1003
+ this.validationStatus = IcInformationStatus.Error;
1004
+ this.isPasteValidationDisplayed = true;
1005
+ }
1006
+ setPasteInvalidText() {
1007
+ var _a;
1008
+ if (this.isPasteValidationDisplayed) {
1009
+ this.invalidDateText = (_a = this.previousInvalidDateTest) !== null && _a !== void 0 ? _a : "";
1010
+ this.isPasteValidationDisplayed = false;
1011
+ // This is to prevent setDate from triggering within componentWillUpdate
1012
+ this.isDateSetFromKeyboardEvent = true;
1013
+ }
1014
+ }
1015
+ notifyScreenReader(input, event) {
1016
+ const liveRegion = this.el.shadowRoot.querySelector("#live-region");
1017
+ if (liveRegion) {
1018
+ if (this.isKeyboardOrEvent(event)) {
1019
+ this.notifyScreenReaderArrowKeys(input);
1020
+ }
1021
+ else if (Object.prototype.toString.call(event) === this.INPUT_EVENT_OBJECT_STRING) {
1022
+ this.notifyScreenReaderInput(input, liveRegion);
1023
+ }
1024
+ }
1025
+ }
1026
+ render() {
1027
+ const { inputId, label, disabled, helperText, showClearButton, showCalendarButton, size, } = this;
1028
+ const hasCustomValidation = !isEmptyString(this.validationStatus) &&
1029
+ !isEmptyString(this.validationText);
1030
+ const validationStatus = hasCustomValidation
1031
+ ? this.validationStatus
1032
+ : !isEmptyString(this.invalidDateText)
1033
+ ? IcInformationStatus.Error
1034
+ : "";
1035
+ const assistiveHint = `Type or use the up and down arrow keys to change the values for the ${this.getDescOfInputsOrder()}.`;
1036
+ renderHiddenInput(true, this.el, this.name, this.convertToDate(this.year, this.month, this.day), this.disabled);
1037
+ return (h(Host, { onBlur: this.handleHostBlur, onFocus: this.handleHostFocus }, h("ic-input-container", { disabled: disabled }, h("ic-input-label", { for: inputId, label: label, helperText: helperText, disabled: disabled }), h("span", { id: this.screenReaderInfoId, class: "sr-only", "aria-hidden": "true" }, this.getScreenReaderInfo(validationStatus), `${this.defaultHelperText}.`), h("span", { id: this.assistiveHintId, class: "sr-only", "aria-hidden": "true" }, assistiveHint), h("span", { id: "live-region", "aria-live": "assertive", class: "sr-only" }), h("ic-input-component-container", { id: inputId, ref: (el) => (this.inputCompContainerEl = el), disabled: disabled, validationStatus: validationStatus, size: size, role: "group" }, h("div", { class: "input-container" }, h("div", { class: "date-inputs" }, this.getInputsInOrder()[0], "/", this.getInputsInOrder()[1], "/", this.getInputsInOrder()[2]), h("div", { class: "action-buttons" }, showClearButton && (h("ic-button", { id: "clear-button", "aria-label": "Clear input", class: {
1038
+ ["clear-button"]: true,
1039
+ ["hidden"]: isEmptyString(this.day) &&
1040
+ isEmptyString(this.month) &&
1041
+ isEmptyString(this.year),
1042
+ }, disabled: this.disabled, innerHTML: Clear, onClick: this.handleClear, onFocus: this.handleClearFocus, onBlur: this.handleClearBlur, variant: "icon", appearance: this.clearButtonFocused
1043
+ ? IcThemeForegroundEnum.Light
1044
+ : IcThemeForegroundEnum.Dark, size: size })), showCalendarButton && (h("div", { class: "show-calendar-button-wrapper" }, h("div", { class: { divider: true, [size]: true } }), h("ic-button", { id: "calendar-button", ref: (el) => (this.calendarButtonEl = el), "aria-label": "Display calendar", "aria-haspopup": "dialog", class: "calendar-button", disabled: this.disabled, innerHTML: Calendar, onClick: this.handleCalendarOpen, variant: "icon", size: size, onFocus: this.handleCalendarFocus, onBlur: this.handleCalendarBlur, appearance: this.calendarFocused
1045
+ ? IcThemeForegroundEnum.Light
1046
+ : IcThemeForegroundEnum.Default })))))), h("span", { id: this.selectedDateInfoId, class: "sr-only", "aria-live": "polite" }, h("span", { ref: (el) => (this.selectedDateInfoEl = el), role: "status" })), (hasCustomValidation || !isEmptyString(this.invalidDateText)) && (h("ic-input-validation", { status: validationStatus, message: hasCustomValidation ? this.validationText : this.invalidDateText, for: inputId })))));
1047
+ }
1048
+ static get is() { return "ic-date-input"; }
1049
+ static get encapsulation() { return "shadow"; }
1050
+ static get delegatesFocus() { return true; }
1051
+ static get originalStyleUrls() {
1052
+ return {
1053
+ "$": ["ic-date-input.css"]
1054
+ };
1055
+ }
1056
+ static get styleUrls() {
1057
+ return {
1058
+ "$": ["ic-date-input.css"]
1059
+ };
1060
+ }
1061
+ static get properties() {
1062
+ return {
1063
+ "dateFormat": {
1064
+ "type": "string",
1065
+ "mutable": false,
1066
+ "complexType": {
1067
+ "original": "IcDateFormat",
1068
+ "resolved": "\"DD/MM/YYYY\" | \"MM/DD/YYYY\" | \"YYYY/MM/DD\"",
1069
+ "references": {
1070
+ "IcDateFormat": {
1071
+ "location": "import",
1072
+ "path": "../../utils/types",
1073
+ "id": "src/utils/types.ts::IcDateFormat"
1074
+ }
1075
+ }
1076
+ },
1077
+ "required": false,
1078
+ "optional": true,
1079
+ "docs": {
1080
+ "tags": [],
1081
+ "text": "The format in which the date will be displayed."
1082
+ },
1083
+ "attribute": "date-format",
1084
+ "reflect": false,
1085
+ "defaultValue": "\"DD/MM/YYYY\""
1086
+ },
1087
+ "disabled": {
1088
+ "type": "boolean",
1089
+ "mutable": false,
1090
+ "complexType": {
1091
+ "original": "boolean",
1092
+ "resolved": "boolean",
1093
+ "references": {}
1094
+ },
1095
+ "required": false,
1096
+ "optional": true,
1097
+ "docs": {
1098
+ "tags": [],
1099
+ "text": "If `true`, the disabled state will be set."
1100
+ },
1101
+ "attribute": "disabled",
1102
+ "reflect": false,
1103
+ "defaultValue": "false"
1104
+ },
1105
+ "disableDays": {
1106
+ "type": "unknown",
1107
+ "mutable": true,
1108
+ "complexType": {
1109
+ "original": "IcWeekDays[]",
1110
+ "resolved": "IcWeekDays[]",
1111
+ "references": {
1112
+ "IcWeekDays": {
1113
+ "location": "import",
1114
+ "path": "../../utils/types",
1115
+ "id": "src/utils/types.ts::IcWeekDays"
1116
+ }
1117
+ }
1118
+ },
1119
+ "required": false,
1120
+ "optional": true,
1121
+ "docs": {
1122
+ "tags": [],
1123
+ "text": "The days of the week to disable."
1124
+ },
1125
+ "defaultValue": "[]"
1126
+ },
1127
+ "disableDaysMessage": {
1128
+ "type": "string",
1129
+ "mutable": false,
1130
+ "complexType": {
1131
+ "original": "string",
1132
+ "resolved": "string",
1133
+ "references": {}
1134
+ },
1135
+ "required": false,
1136
+ "optional": true,
1137
+ "docs": {
1138
+ "tags": [],
1139
+ "text": "The text to display as the validation message when `disableDays` is set and a disabled date is entered."
1140
+ },
1141
+ "attribute": "disable-days-message",
1142
+ "reflect": false,
1143
+ "defaultValue": "\"The date you have selected is on a day of the week that is not allowed. Please select another date.\""
1144
+ },
1145
+ "disableFuture": {
1146
+ "type": "boolean",
1147
+ "mutable": false,
1148
+ "complexType": {
1149
+ "original": "boolean",
1150
+ "resolved": "boolean",
1151
+ "references": {}
1152
+ },
1153
+ "required": false,
1154
+ "optional": true,
1155
+ "docs": {
1156
+ "tags": [],
1157
+ "text": "If `true`, dates in the future are not allowed. A validation message will appear if a date in the future is entered."
1158
+ },
1159
+ "attribute": "disable-future",
1160
+ "reflect": false,
1161
+ "defaultValue": "false"
1162
+ },
1163
+ "disableFutureMessage": {
1164
+ "type": "string",
1165
+ "mutable": false,
1166
+ "complexType": {
1167
+ "original": "string",
1168
+ "resolved": "string",
1169
+ "references": {}
1170
+ },
1171
+ "required": false,
1172
+ "optional": true,
1173
+ "docs": {
1174
+ "tags": [],
1175
+ "text": "The text to display as the validation message when `disableFuture` is true and a date in the future is entered."
1176
+ },
1177
+ "attribute": "disable-future-message",
1178
+ "reflect": false,
1179
+ "defaultValue": "\"Dates in the future are not allowed. Please select a date in the past.\""
1180
+ },
1181
+ "disablePast": {
1182
+ "type": "boolean",
1183
+ "mutable": false,
1184
+ "complexType": {
1185
+ "original": "boolean",
1186
+ "resolved": "boolean",
1187
+ "references": {}
1188
+ },
1189
+ "required": false,
1190
+ "optional": true,
1191
+ "docs": {
1192
+ "tags": [],
1193
+ "text": "If `true`, dates in the past are not allowed. A validation message will appear if a date in the past is entered."
1194
+ },
1195
+ "attribute": "disable-past",
1196
+ "reflect": false,
1197
+ "defaultValue": "false"
1198
+ },
1199
+ "disablePastMessage": {
1200
+ "type": "string",
1201
+ "mutable": false,
1202
+ "complexType": {
1203
+ "original": "string",
1204
+ "resolved": "string",
1205
+ "references": {}
1206
+ },
1207
+ "required": false,
1208
+ "optional": true,
1209
+ "docs": {
1210
+ "tags": [],
1211
+ "text": "The text to display as the validation message when `disablePast` is true and a date in the past is entered."
1212
+ },
1213
+ "attribute": "disable-past-message",
1214
+ "reflect": false,
1215
+ "defaultValue": "\"Dates in the past are not allowed. Please select a date in the future.\""
1216
+ },
1217
+ "helperText": {
1218
+ "type": "string",
1219
+ "mutable": true,
1220
+ "complexType": {
1221
+ "original": "string",
1222
+ "resolved": "string",
1223
+ "references": {}
1224
+ },
1225
+ "required": false,
1226
+ "optional": true,
1227
+ "docs": {
1228
+ "tags": [],
1229
+ "text": "The helper text that will be displayed for additional field guidance. This will default to the text \"Use format\" along with the `dateFormat` value."
1230
+ },
1231
+ "attribute": "helper-text",
1232
+ "reflect": false
1233
+ },
1234
+ "inputId": {
1235
+ "type": "string",
1236
+ "mutable": false,
1237
+ "complexType": {
1238
+ "original": "string",
1239
+ "resolved": "string",
1240
+ "references": {}
1241
+ },
1242
+ "required": false,
1243
+ "optional": true,
1244
+ "docs": {
1245
+ "tags": [],
1246
+ "text": "The ID for the input."
1247
+ },
1248
+ "attribute": "input-id",
1249
+ "reflect": false,
1250
+ "defaultValue": "`ic-date-input-${inputIds++}`"
1251
+ },
1252
+ "label": {
1253
+ "type": "string",
1254
+ "mutable": false,
1255
+ "complexType": {
1256
+ "original": "string",
1257
+ "resolved": "string",
1258
+ "references": {}
1259
+ },
1260
+ "required": true,
1261
+ "optional": false,
1262
+ "docs": {
1263
+ "tags": [],
1264
+ "text": "The label for the date input."
1265
+ },
1266
+ "attribute": "label",
1267
+ "reflect": false
1268
+ },
1269
+ "max": {
1270
+ "type": "string",
1271
+ "mutable": false,
1272
+ "complexType": {
1273
+ "original": "string | Date",
1274
+ "resolved": "Date | string",
1275
+ "references": {
1276
+ "Date": {
1277
+ "location": "global",
1278
+ "id": "global::Date"
1279
+ }
1280
+ }
1281
+ },
1282
+ "required": false,
1283
+ "optional": true,
1284
+ "docs": {
1285
+ "tags": [],
1286
+ "text": "The latest date that will be allowed. The value can be in any format supported as `dateFormat`, in ISO 8601 date string format (`yyyy-mm-dd`) or as a JavaScript `Date` object.\nThe value of this prop is ignored if `disableFuture` is set to `true`."
1287
+ },
1288
+ "attribute": "max",
1289
+ "reflect": false,
1290
+ "defaultValue": "\"\""
1291
+ },
1292
+ "min": {
1293
+ "type": "string",
1294
+ "mutable": false,
1295
+ "complexType": {
1296
+ "original": "string | Date",
1297
+ "resolved": "Date | string",
1298
+ "references": {
1299
+ "Date": {
1300
+ "location": "global",
1301
+ "id": "global::Date"
1302
+ }
1303
+ }
1304
+ },
1305
+ "required": false,
1306
+ "optional": true,
1307
+ "docs": {
1308
+ "tags": [],
1309
+ "text": "The earliest date that will be allowed. The value can be in any format supported as `dateFormat`, in ISO 8601 date string format (`yyyy-mm-dd`) or as a JavaScript `Date` object.\nThe value of this prop is ignored if `disablePast` is set to `true`."
1310
+ },
1311
+ "attribute": "min",
1312
+ "reflect": false,
1313
+ "defaultValue": "\"\""
1314
+ },
1315
+ "name": {
1316
+ "type": "string",
1317
+ "mutable": false,
1318
+ "complexType": {
1319
+ "original": "string",
1320
+ "resolved": "string",
1321
+ "references": {}
1322
+ },
1323
+ "required": false,
1324
+ "optional": false,
1325
+ "docs": {
1326
+ "tags": [],
1327
+ "text": "The name of the control, which is submitted with the form data."
1328
+ },
1329
+ "attribute": "name",
1330
+ "reflect": false,
1331
+ "defaultValue": "this.inputId"
1332
+ },
1333
+ "required": {
1334
+ "type": "boolean",
1335
+ "mutable": false,
1336
+ "complexType": {
1337
+ "original": "boolean",
1338
+ "resolved": "boolean",
1339
+ "references": {}
1340
+ },
1341
+ "required": false,
1342
+ "optional": true,
1343
+ "docs": {
1344
+ "tags": [],
1345
+ "text": "If `true`, the input will require a value."
1346
+ },
1347
+ "attribute": "required",
1348
+ "reflect": false,
1349
+ "defaultValue": "false"
1350
+ },
1351
+ "showCalendarButton": {
1352
+ "type": "boolean",
1353
+ "mutable": false,
1354
+ "complexType": {
1355
+ "original": "boolean",
1356
+ "resolved": "boolean",
1357
+ "references": {}
1358
+ },
1359
+ "required": false,
1360
+ "optional": true,
1361
+ "docs": {
1362
+ "tags": [{
1363
+ "name": "internal",
1364
+ "text": "If `true`, a button which displays the calendar view when clicked will be displayed."
1365
+ }],
1366
+ "text": ""
1367
+ },
1368
+ "attribute": "show-calendar-button",
1369
+ "reflect": false,
1370
+ "defaultValue": "false"
1371
+ },
1372
+ "showClearButton": {
1373
+ "type": "boolean",
1374
+ "mutable": false,
1375
+ "complexType": {
1376
+ "original": "boolean",
1377
+ "resolved": "boolean",
1378
+ "references": {}
1379
+ },
1380
+ "required": false,
1381
+ "optional": true,
1382
+ "docs": {
1383
+ "tags": [],
1384
+ "text": "If `true`, a button which clears the date input when clicked will be displayed."
1385
+ },
1386
+ "attribute": "show-clear-button",
1387
+ "reflect": false,
1388
+ "defaultValue": "true"
1389
+ },
1390
+ "size": {
1391
+ "type": "string",
1392
+ "mutable": false,
1393
+ "complexType": {
1394
+ "original": "IcSizes",
1395
+ "resolved": "\"default\" | \"large\" | \"small\"",
1396
+ "references": {
1397
+ "IcSizes": {
1398
+ "location": "import",
1399
+ "path": "../../utils/types",
1400
+ "id": "src/utils/types.ts::IcSizes"
1401
+ }
1402
+ }
1403
+ },
1404
+ "required": false,
1405
+ "optional": true,
1406
+ "docs": {
1407
+ "tags": [],
1408
+ "text": "The size of the date input to be displayed."
1409
+ },
1410
+ "attribute": "size",
1411
+ "reflect": false,
1412
+ "defaultValue": "\"default\""
1413
+ },
1414
+ "value": {
1415
+ "type": "string",
1416
+ "mutable": true,
1417
+ "complexType": {
1418
+ "original": "string | Date | null | undefined",
1419
+ "resolved": "Date | string",
1420
+ "references": {
1421
+ "Date": {
1422
+ "location": "global",
1423
+ "id": "global::Date"
1424
+ }
1425
+ }
1426
+ },
1427
+ "required": false,
1428
+ "optional": true,
1429
+ "docs": {
1430
+ "tags": [],
1431
+ "text": "The value of the date input. The value can be in any format supported as `dateFormat`, in ISO 8601 date string format (`yyyy-mm-dd`) or as a JavaScript `Date` object."
1432
+ },
1433
+ "attribute": "value",
1434
+ "reflect": false,
1435
+ "defaultValue": "\"\""
1436
+ },
1437
+ "validationStatus": {
1438
+ "type": "string",
1439
+ "mutable": true,
1440
+ "complexType": {
1441
+ "original": "IcInformationStatusOrEmpty",
1442
+ "resolved": "\"\" | \"error\" | \"success\" | \"warning\"",
1443
+ "references": {
1444
+ "IcInformationStatusOrEmpty": {
1445
+ "location": "import",
1446
+ "path": "../../utils/types",
1447
+ "id": "src/utils/types.ts::IcInformationStatusOrEmpty"
1448
+ }
1449
+ }
1450
+ },
1451
+ "required": false,
1452
+ "optional": true,
1453
+ "docs": {
1454
+ "tags": [],
1455
+ "text": "The validation status - e.g. 'error' | 'warning' | 'success'. This will override the built-in date validation."
1456
+ },
1457
+ "attribute": "validation-status",
1458
+ "reflect": false,
1459
+ "defaultValue": "\"\""
1460
+ },
1461
+ "validationText": {
1462
+ "type": "string",
1463
+ "mutable": false,
1464
+ "complexType": {
1465
+ "original": "string",
1466
+ "resolved": "string",
1467
+ "references": {}
1468
+ },
1469
+ "required": false,
1470
+ "optional": true,
1471
+ "docs": {
1472
+ "tags": [],
1473
+ "text": "The text to display as the validation message. This will override the built-in date validation."
1474
+ },
1475
+ "attribute": "validation-text",
1476
+ "reflect": false,
1477
+ "defaultValue": "\"\""
1478
+ }
1479
+ };
1480
+ }
1481
+ static get states() {
1482
+ return {
1483
+ "day": {},
1484
+ "invalidDateText": {},
1485
+ "maxDate": {},
1486
+ "minDate": {},
1487
+ "month": {},
1488
+ "year": {},
1489
+ "calendarFocused": {},
1490
+ "clearButtonFocused": {},
1491
+ "removeLabelledBy": {}
1492
+ };
1493
+ }
1494
+ static get events() {
1495
+ return [{
1496
+ "method": "calendarButtonClicked",
1497
+ "name": "calendarButtonClicked",
1498
+ "bubbles": true,
1499
+ "cancelable": true,
1500
+ "composed": true,
1501
+ "docs": {
1502
+ "tags": [{
1503
+ "name": "internal",
1504
+ "text": "Emitted when the calendar is opened."
1505
+ }],
1506
+ "text": ""
1507
+ },
1508
+ "complexType": {
1509
+ "original": "{ value: Date }",
1510
+ "resolved": "{ value: Date; }",
1511
+ "references": {
1512
+ "Date": {
1513
+ "location": "global",
1514
+ "id": "global::Date"
1515
+ }
1516
+ }
1517
+ }
1518
+ }, {
1519
+ "method": "icBlur",
1520
+ "name": "icBlur",
1521
+ "bubbles": true,
1522
+ "cancelable": true,
1523
+ "composed": true,
1524
+ "docs": {
1525
+ "tags": [],
1526
+ "text": "Emitted when the input loses focus."
1527
+ },
1528
+ "complexType": {
1529
+ "original": "{ value: Date }",
1530
+ "resolved": "{ value: Date; }",
1531
+ "references": {
1532
+ "Date": {
1533
+ "location": "global",
1534
+ "id": "global::Date"
1535
+ }
1536
+ }
1537
+ }
1538
+ }, {
1539
+ "method": "icChange",
1540
+ "name": "icChange",
1541
+ "bubbles": true,
1542
+ "cancelable": true,
1543
+ "composed": true,
1544
+ "docs": {
1545
+ "tags": [],
1546
+ "text": "Emitted when the value has changed."
1547
+ },
1548
+ "complexType": {
1549
+ "original": "{ value: Date }",
1550
+ "resolved": "{ value: Date; }",
1551
+ "references": {
1552
+ "Date": {
1553
+ "location": "global",
1554
+ "id": "global::Date"
1555
+ }
1556
+ }
1557
+ }
1558
+ }, {
1559
+ "method": "icFocus",
1560
+ "name": "icFocus",
1561
+ "bubbles": true,
1562
+ "cancelable": true,
1563
+ "composed": true,
1564
+ "docs": {
1565
+ "tags": [],
1566
+ "text": "Emitted when the input gains focus."
1567
+ },
1568
+ "complexType": {
1569
+ "original": "{ value: Date }",
1570
+ "resolved": "{ value: Date; }",
1571
+ "references": {
1572
+ "Date": {
1573
+ "location": "global",
1574
+ "id": "global::Date"
1575
+ }
1576
+ }
1577
+ }
1578
+ }];
1579
+ }
1580
+ static get methods() {
1581
+ return {
1582
+ "getDate": {
1583
+ "complexType": {
1584
+ "signature": "() => Promise<Date>",
1585
+ "parameters": [],
1586
+ "references": {
1587
+ "Promise": {
1588
+ "location": "global",
1589
+ "id": "global::Promise"
1590
+ },
1591
+ "Date": {
1592
+ "location": "global",
1593
+ "id": "global::Date"
1594
+ }
1595
+ },
1596
+ "return": "Promise<Date>"
1597
+ },
1598
+ "docs": {
1599
+ "text": "Returns the value as a Date object",
1600
+ "tags": [{
1601
+ "name": "returns",
1602
+ "text": "Date"
1603
+ }]
1604
+ }
1605
+ },
1606
+ "setCalendarFocus": {
1607
+ "complexType": {
1608
+ "signature": "() => Promise<void>",
1609
+ "parameters": [],
1610
+ "references": {
1611
+ "Promise": {
1612
+ "location": "global",
1613
+ "id": "global::Promise"
1614
+ }
1615
+ },
1616
+ "return": "Promise<void>"
1617
+ },
1618
+ "docs": {
1619
+ "text": "",
1620
+ "tags": [{
1621
+ "name": "internal",
1622
+ "text": "Sets focus on the calendar button."
1623
+ }]
1624
+ }
1625
+ },
1626
+ "setDisableDays": {
1627
+ "complexType": {
1628
+ "signature": "(days: IcWeekDays[]) => Promise<void>",
1629
+ "parameters": [{
1630
+ "name": "days",
1631
+ "type": "IcWeekDays[]",
1632
+ "docs": ""
1633
+ }],
1634
+ "references": {
1635
+ "Promise": {
1636
+ "location": "global",
1637
+ "id": "global::Promise"
1638
+ },
1639
+ "IcWeekDays": {
1640
+ "location": "import",
1641
+ "path": "../../utils/types",
1642
+ "id": "src/utils/types.ts::IcWeekDays"
1643
+ }
1644
+ },
1645
+ "return": "Promise<void>"
1646
+ },
1647
+ "docs": {
1648
+ "text": "",
1649
+ "tags": [{
1650
+ "name": "internal",
1651
+ "text": "Used to pass disabledDays from parent component."
1652
+ }]
1653
+ }
1654
+ }
1655
+ };
1656
+ }
1657
+ static get elementRef() { return "el"; }
1658
+ static get watchers() {
1659
+ return [{
1660
+ "propName": "max",
1661
+ "methodName": "watchMaxHandler"
1662
+ }, {
1663
+ "propName": "min",
1664
+ "methodName": "watchMinHandler"
1665
+ }];
1666
+ }
1667
+ }
1668
+ //# sourceMappingURL=ic-date-input.js.map