@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,1301 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
+ import { i as isEmptyString, s as stringEnumToArray, g as getInputDescribedByText, r as removeFormResetListener, a as addFormResetListener, o as onComponentRequiredPropUndefined, b as isNumeric, I as IcInformationStatus, d as renderHiddenInput, e as IcThemeForegroundEnum, f as IcDayNames, h as IcDateInputMonths } from './helpers2.js';
3
+ import { d as defineCustomElement$8 } from './ic-button2.js';
4
+ import { d as defineCustomElement$7 } from './ic-input-component-container2.js';
5
+ import { d as defineCustomElement$6 } from './ic-input-container2.js';
6
+ import { d as defineCustomElement$5 } from './ic-input-label2.js';
7
+ import { d as defineCustomElement$4 } from './ic-input-validation2.js';
8
+ import { d as defineCustomElement$3 } from './ic-loading-indicator2.js';
9
+ import { d as defineCustomElement$2 } from './ic-tooltip2.js';
10
+ import { d as defineCustomElement$1 } from './ic-typography2.js';
11
+
12
+ const isMonthFirstFormat = (dateString) => {
13
+ const monthFirstFormat = /^(0[1-9]|1[0-2])(\/|-)(0[1-9]|[12][0-9]|3[01])(\/|-)\d{4}$/;
14
+ return monthFirstFormat.test(dateString);
15
+ };
16
+ const isDayFirstFormat = (dateString) => {
17
+ const dayFirstFormat = /^(0[1-9]|[12][0-9]|3[01])(\/|-)(0[1-9]|1[0-2])(\/|-)\d{4}$/;
18
+ return dayFirstFormat.test(dateString);
19
+ };
20
+ const createDate = (date, dateFormat) => {
21
+ let newDate;
22
+ if (isDateOrEpoch(date)) {
23
+ newDate = typeof date === "string" ? new Date(date) : date;
24
+ }
25
+ else if (typeof date === "string") {
26
+ const dateArray = splitStringDate(date, dateFormat);
27
+ const year = Number(dateArray[0]);
28
+ const month = Number(dateArray[1]) - 1;
29
+ const day = Number(dateArray[2]);
30
+ newDate = new Date(year, month, day);
31
+ }
32
+ return newDate;
33
+ };
34
+ const isDateOrEpoch = (date) => {
35
+ return date instanceof Date || !isNaN(+new Date(+date));
36
+ };
37
+ const extractDateFromZuluDateTime = (zuluDateTime) => zuluDateTime.slice(0, zuluDateTime.indexOf("T"));
38
+ const splitStringDate = (date, dateFormat) => {
39
+ // returns an array where item 1 is year, item 2 is month, item 3 is day
40
+ if (date.includes("T") && date.includes("Z")) {
41
+ const nextDate = extractDateFromZuluDateTime(date);
42
+ return nextDate.split("-");
43
+ }
44
+ let newDate = [];
45
+ const dateWithSlashes = date.replace(/-/g, "/");
46
+ if (dateWithSlashes.split("/").length > 1) {
47
+ const dateParts = dateWithSlashes.split("/");
48
+ // pad any values to 2 characters
49
+ dateParts.forEach((d, i) => {
50
+ if (d.length === 1) {
51
+ dateParts[i] = convertToDoubleDigits(d);
52
+ }
53
+ });
54
+ if (dateParts[0].length === 4) {
55
+ newDate = [dateParts[0], dateParts[1], dateParts[2]];
56
+ }
57
+ else {
58
+ const newDateStr = dateParts.join("/");
59
+ const validDayFirst = isDayFirstFormat(newDateStr);
60
+ const validMonthFirst = isMonthFirstFormat(newDateStr);
61
+ if (validDayFirst && validMonthFirst) {
62
+ if (dateFormat.charAt(0) === "M") {
63
+ newDate = [dateParts[2], dateParts[0], dateParts[1]];
64
+ }
65
+ else {
66
+ newDate = [dateParts[2], dateParts[1], dateParts[0]];
67
+ }
68
+ }
69
+ else if (validMonthFirst) {
70
+ newDate = [dateParts[2], dateParts[0], dateParts[1]];
71
+ }
72
+ else {
73
+ newDate = [dateParts[2], dateParts[1], dateParts[0]];
74
+ }
75
+ }
76
+ }
77
+ return newDate;
78
+ };
79
+ const convertToDoubleDigits = (value) => {
80
+ if (+value < 10) {
81
+ return `0${value}`;
82
+ }
83
+ return value.toString();
84
+ };
85
+ const getWeekStart = (date, startDay) => {
86
+ const tmpDate = new Date(date);
87
+ const day = tmpDate.getDay();
88
+ const diff = (day < startDay ? 7 : 0) + day - startDay;
89
+ tmpDate.setDate(tmpDate.getDate() - diff);
90
+ return tmpDate;
91
+ };
92
+ const getWeekEnd = (date, startDay) => {
93
+ const d = new Date(date);
94
+ const day = d.getDay();
95
+ const diff = (day < startDay ? -7 : 0) + 6 - (day - startDay);
96
+ d.setDate(d.getDate() + diff);
97
+ return d;
98
+ };
99
+ const getMonthStart = (date) => {
100
+ return new Date(date.getFullYear(), date.getMonth(), 1);
101
+ };
102
+ const getMonthEnd = (date) => {
103
+ return new Date(date.getFullYear(), date.getMonth() + 1, 0);
104
+ };
105
+ /**
106
+ * Compare if two dates are equal exactly equal
107
+ */
108
+ const dateMatches = (a, b) => {
109
+ if (a === null || b === null) {
110
+ return false;
111
+ }
112
+ return (a.getFullYear() === b.getFullYear() &&
113
+ a.getMonth() === b.getMonth() &&
114
+ a.getDate() === b.getDate());
115
+ };
116
+ const clampDate = (date, min, max) => {
117
+ const time = date.getTime();
118
+ if (min !== null && time < min.getTime()) {
119
+ return min;
120
+ }
121
+ if (max !== null && time > max.getTime()) {
122
+ return max;
123
+ }
124
+ return date;
125
+ };
126
+ /**
127
+ * Compare if date is within specified range
128
+ */
129
+ const dateInRange = (date, min, max) => {
130
+ return clampDate(date, min, max) === date;
131
+ };
132
+ const yearInRange = (year, min, max) => {
133
+ let allowed = true;
134
+ if (year !== null) {
135
+ if (min !== null && year < min.getFullYear()) {
136
+ allowed = false;
137
+ }
138
+ if (allowed && max !== null && year > max.getFullYear()) {
139
+ allowed = false;
140
+ }
141
+ }
142
+ return allowed;
143
+ };
144
+
145
+ const Clear = `<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
146
+ <path d="M15.8327 5.34199L14.6577 4.16699L9.99935 8.82533L5.34102 4.16699L4.16602 5.34199L8.82435 10.0003L4.16602 14.6587L5.34102 15.8337L9.99935 11.1753L14.6577 15.8337L15.8327 14.6587L11.1743 10.0003L15.8327 5.34199Z" fill="currentColor"/>
147
+ </svg>
148
+ `;
149
+
150
+ const Calendar = `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
151
+ <path d="M16.6667 2.50004H15.8334V0.833374H14.1667V2.50004H5.83342V0.833374H4.16675V2.50004H3.33341C2.41675 2.50004 1.66675 3.25004 1.66675 4.16671V17.5C1.66675 18.4167 2.41675 19.1667 3.33341 19.1667H16.6667C17.5834 19.1667 18.3334 18.4167 18.3334 17.5V4.16671C18.3334 3.25004 17.5834 2.50004 16.6667 2.50004ZM16.6667 17.5H3.33341V6.66671H16.6667V17.5Z" fill="currentColor"/>
152
+ </svg>`;
153
+
154
+ const icDateInputCss = "/*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-webkit-text-size-adjust:100%;}body{margin:0}main{display:block}h1{font-size:2em;margin:0.67em 0}hr{box-sizing:content-box;height:0;overflow:visible;}pre{font-family:monospace, monospace;font-size:1em;}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted;}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace, monospace;font-size:1em;}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-0.25em}sup{top:-0.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0;}button,input{overflow:visible}button,select{text-transform:none}button,[type=\"button\"],[type=\"reset\"],[type=\"submit\"]{-webkit-appearance:button}button::-moz-focus-inner,[type=\"button\"]::-moz-focus-inner,[type=\"reset\"]::-moz-focus-inner,[type=\"submit\"]::-moz-focus-inner{border-style:none;padding:0}button:-moz-focusring,[type=\"button\"]:-moz-focusring,[type=\"reset\"]:-moz-focusring,[type=\"submit\"]:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:0.35em 0.75em 0.625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal;}progress{vertical-align:baseline}textarea{overflow:auto}[type=\"checkbox\"],[type=\"radio\"]{box-sizing:border-box;padding:0;}[type=\"number\"]::-webkit-inner-spin-button,[type=\"number\"]::-webkit-outer-spin-button{height:auto}[type=\"search\"]{-webkit-appearance:textfield;outline-offset:-2px;}[type=\"search\"]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit;}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font-style:inherit;vertical-align:baseline}input{border:0;height:100%;padding:0;outline:none;background:none;-moz-appearance:textfield;-webkit-appearance:textfield;appearance:textfield}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance:none}ic-input-component-container{cursor:text}ic-input-component-container,ic-input-component-container:hover{color:var(--ic-color-tertiary-text)}.focus-indicator{padding:var(--ic-space-xxxs) var(--ic-space-xs);align-items:center}.day-input{width:1.438rem}.month-input{width:1.813rem}.year-input,.year-input.fit-to-value{width:2.313rem}.fit-to-value{width:1.25rem}.sr-only{position:absolute;left:-9999px}.input-container{width:100%;display:flex;justify-content:space-between;align-items:center;position:relative}.action-buttons{display:flex;align-items:center}.show-calendar-button-wrapper{display:flex;justify-content:center;align-items:center}.clear-button,.calendar-button{border-radius:var(--ic-border-radius);transition:box-shadow var(--ic-easing-transition),\n border-radius var(--ic-easing-transition);margin:0}.clear-button.hidden{display:none}.clear-button:focus,.calendar-button:focus,.clear-button:active,.calendar-button:active{background-color:var(--ic-focus-blue) !important;box-shadow:inset 0 0 0 0.125rem var(--ic-focus-glow) !important;border-radius:0.25rem}.clear-button:focus,.calendar-button:focus,.clear-button:active *,.calendar-button:active *{fill:var(--ic-architectural-white)}.divider{margin:0 var(--ic-space-xxs);width:var(--ic-space-1px);background-color:var(--ic-architectural-400);border-radius:var(--ic-space-1px)}.divider.small{height:var(--ic-space-md)}.divider.default{height:calc(var(--ic-space-sm) + var(--ic-space-xs))}.divider.large{height:var(--ic-space-lg)}";
155
+
156
+ let inputIds = 0;
157
+ const DateInput = /*@__PURE__*/ proxyCustomElement(class DateInput extends HTMLElement {
158
+ constructor() {
159
+ super();
160
+ this.__registerHost();
161
+ this.__attachShadow();
162
+ this.calendarButtonClicked = createEvent(this, "calendarButtonClicked", 7);
163
+ this.icBlur = createEvent(this, "icBlur", 7);
164
+ this.icChange = createEvent(this, "icChange", 7);
165
+ this.icFocus = createEvent(this, "icFocus", 7);
166
+ this.ARIA_INVALID = "aria-invalid";
167
+ this.ARIA_LABEL = "aria-label";
168
+ this.ARIA_LABELLED_BY = "aria-labelledby";
169
+ this.EVENT_OBJECT_STRING = "[object Event]";
170
+ this.FIT_TO_VALUE = "fit-to-value";
171
+ this.initialValue = this.value;
172
+ this.INPUT_EVENT_OBJECT_STRING = "[object InputEvent]";
173
+ this.inputsInOrder = [];
174
+ this.isAfterMax = false;
175
+ this.isBeforeMin = false;
176
+ this.isDateSetFromKeyboardEvent = false;
177
+ this.isDisabledDate = false;
178
+ this.isValidDay = true;
179
+ this.isValidMonth = true;
180
+ this.isValidDate = true;
181
+ this.isZuluTime = false;
182
+ this.KEYBOARD_EVENT_OBJECT_STRING = "[object KeyboardEvent]";
183
+ this.MAX_DAY = 31;
184
+ this.MAX_MONTH = 12;
185
+ this.previousSelectedDate = null;
186
+ this.selectedDate = null;
187
+ this.setInputPasteValue = (input, pastedValue) => {
188
+ const inputEl = input;
189
+ inputEl.value = pastedValue;
190
+ inputEl.classList.add(this.FIT_TO_VALUE);
191
+ };
192
+ this.checkSingleCopiedValueIsValid = (input, pastedValue) => {
193
+ let isValid = false;
194
+ const value = Number(pastedValue);
195
+ switch (input) {
196
+ case this.dayInputEl:
197
+ isValid = value >= 1 && value <= this.MAX_DAY;
198
+ break;
199
+ case this.monthInputEl:
200
+ isValid = value >= 1 && value <= this.MAX_MONTH;
201
+ break;
202
+ case this.yearInputEl:
203
+ isValid = true;
204
+ break;
205
+ default:
206
+ isValid = false;
207
+ break;
208
+ }
209
+ return isValid;
210
+ };
211
+ /**
212
+ * Using Object.prototype.string to determine type if event from user
213
+ * @param event - event object used to differentiate keyboard, generic or input event
214
+ * @returns boolean
215
+ */
216
+ this.isKeyboardOrEvent = (event) => {
217
+ return (Object.prototype.toString.call(event) === this.EVENT_OBJECT_STRING ||
218
+ Object.prototype.toString.call(event) ===
219
+ this.KEYBOARD_EVENT_OBJECT_STRING);
220
+ };
221
+ this.setDateValidity = () => {
222
+ if (!isEmptyString(this.day)) {
223
+ this.isValidDay = +this.day > this.MAX_DAY ? false : true;
224
+ }
225
+ else {
226
+ this.isValidDay = true;
227
+ }
228
+ if (!isEmptyString(this.month)) {
229
+ this.isValidMonth = +this.month > this.MAX_MONTH ? false : true;
230
+ }
231
+ else {
232
+ this.isValidMonth = true;
233
+ }
234
+ };
235
+ this.handleInput = (event) => {
236
+ const inputEvent = event;
237
+ const input = event.target;
238
+ if (input !== this.yearInputEl) {
239
+ // Only auto-format if input event is not a character being deleted
240
+ // and not as user is changing value using up / down keys
241
+ if (inputEvent.inputType !== "deleteContentBackward" &&
242
+ !this.preventAutoFormatting) {
243
+ if (input.value.length === 1 &&
244
+ ((input === this.dayInputEl && +input.value >= 4) ||
245
+ (input === this.monthInputEl && +input.value >= 2)) &&
246
+ +input.value <= 9) {
247
+ this.setInputValue(input);
248
+ this.notifyScreenReader(input, event);
249
+ this.moveToNextInput(input);
250
+ }
251
+ if (input.value.length === 2) {
252
+ if (+input.value === 0) {
253
+ input.value = "01";
254
+ }
255
+ this.setInputValue(input);
256
+ this.setPreventInput(input, true);
257
+ this.notifyScreenReader(input, event);
258
+ this.moveToNextInput(input);
259
+ }
260
+ else {
261
+ this.setPreventInput(input, false);
262
+ }
263
+ }
264
+ else if (this.preventAutoFormatting) {
265
+ /**
266
+ * Using arrow keys prevents auto formatting so need to deal with
267
+ * switching from arrow keys to inputting numbers
268
+ **/
269
+ if (input.value.length === 2 && !this.isKeyboardOrEvent(event)) {
270
+ this.setInputValue(input);
271
+ this.setPreventInput(input, true);
272
+ this.moveToNextInput(input);
273
+ }
274
+ else {
275
+ this.setInputValue(input);
276
+ }
277
+ }
278
+ if (input.value.length !== 2) {
279
+ this.setPreventInput(input, false);
280
+ }
281
+ }
282
+ else {
283
+ if (input.value.length === 4) {
284
+ this.setInputValue(input);
285
+ if (Object.prototype.toString.call(event) !== this.EVENT_OBJECT_STRING) {
286
+ this.moveToNextInput(input);
287
+ }
288
+ this.setPreventInput(input, true);
289
+ }
290
+ else {
291
+ this.setInputValue(input, true);
292
+ this.setPreventInput(input, false);
293
+ }
294
+ }
295
+ // Add / remove class to make input width match size of value i.e. 2 digits' width for day / month, 4 for year
296
+ this.setFitToValueStyling(input);
297
+ if (input.value.length === 0) {
298
+ this.setInputValue(input, true);
299
+ this.setValidationMessage();
300
+ }
301
+ this.notifyScreenReader(input, event);
302
+ };
303
+ this.handleKeyDown = (event, isInputPrevented) => {
304
+ const input = event.target;
305
+ const eventKey = event.key.toLowerCase();
306
+ // Regex required due to FF allowing all characters as values for number text field.
307
+ const regex = /-?\d*\.?\d+(e[-+]?\d+)?|[/-]|arrowup|arrowdown|arrowleft|arrowright|shift|tab|backspace|delete/;
308
+ if (!regex.test(eventKey) &&
309
+ !((event.ctrlKey || event.metaKey) &&
310
+ (eventKey === "v" || eventKey === "c"))) {
311
+ event.preventDefault();
312
+ }
313
+ switch (eventKey) {
314
+ case "/":
315
+ case "-":
316
+ case ".":
317
+ event.preventDefault();
318
+ this.setPasteInvalidText();
319
+ this.moveToNextInput(input);
320
+ break;
321
+ case "arrowright":
322
+ case "arrowleft":
323
+ event.preventDefault();
324
+ this.handleLeftRightArrowKeyPress(input, eventKey);
325
+ break;
326
+ case "arrowup":
327
+ case "arrowdown":
328
+ this.preventAutoFormatting = true;
329
+ this.handleUpDownArrowKeyPress(input, event);
330
+ break;
331
+ }
332
+ this.preventInput(event, isInputPrevented);
333
+ this.isDateSetFromKeyboardEvent = true;
334
+ };
335
+ this.handleFocus = (event) => {
336
+ // Highlight / select all characters in input for easy replacement
337
+ const input = event.target;
338
+ input.select();
339
+ };
340
+ this.handleBlur = (event) => {
341
+ const input = event.target;
342
+ this.setPasteInvalidText();
343
+ this.autocompleteInput(input);
344
+ };
345
+ this.handleLeftRightArrowKeyPress = (input, key) => {
346
+ if (key === "arrowright") {
347
+ this.moveToNextInput(input);
348
+ }
349
+ else {
350
+ this.moveToPreviousInput(input);
351
+ }
352
+ this.setPasteInvalidText();
353
+ };
354
+ this.notifyScreenReaderSelectedDate = () => {
355
+ const dayNames = stringEnumToArray(IcDayNames);
356
+ const months = stringEnumToArray(IcDateInputMonths);
357
+ this.selectedDateInfoEl.textContent = `Selected date: ${dayNames[this.selectedDate.getDay()]}, ${this.selectedDate.getDate()} ${months[this.selectedDate.getMonth()]} ${this.selectedDate.getFullYear()}`;
358
+ };
359
+ this.handleUpDownArrowKeyPress = (input, event) => {
360
+ const minValue = input === this.yearInputEl ? 0 : 1;
361
+ let maxValue;
362
+ switch (input) {
363
+ case this.dayInputEl:
364
+ maxValue = this.MAX_DAY;
365
+ break;
366
+ case this.monthInputEl:
367
+ maxValue = this.MAX_MONTH;
368
+ break;
369
+ case this.yearInputEl:
370
+ maxValue = 9999;
371
+ }
372
+ // Make value loop round when min / max reached
373
+ if (input === null || input === void 0 ? void 0 : input.value) {
374
+ if (event.key === "ArrowUp") {
375
+ if (+input.value === maxValue) {
376
+ event.preventDefault();
377
+ input.value = `0${minValue}`;
378
+ }
379
+ else {
380
+ input.value =
381
+ +input.value + 1 < 10
382
+ ? `0${+input.value + 1}`
383
+ : (+input.value + 1).toString();
384
+ }
385
+ this.notifyScreenReader(input, event);
386
+ }
387
+ if (event.key === "ArrowDown") {
388
+ if (+input.value === minValue) {
389
+ event.preventDefault();
390
+ input.value = maxValue.toString();
391
+ }
392
+ else {
393
+ input.value =
394
+ +input.value - 1 < 10
395
+ ? `0${+input.value - 1}`
396
+ : (+input.value - 1).toString();
397
+ }
398
+ this.notifyScreenReader(input, event);
399
+ }
400
+ }
401
+ else {
402
+ if (event.key === "ArrowDown") {
403
+ event.preventDefault();
404
+ if (input === this.yearInputEl) {
405
+ input.value = new Date().getFullYear().toString();
406
+ }
407
+ else {
408
+ input.value = maxValue.toString();
409
+ }
410
+ this.notifyScreenReader(input, event);
411
+ }
412
+ else if (event.key === "ArrowUp") {
413
+ event.preventDefault();
414
+ if (input === this.yearInputEl) {
415
+ input.value = new Date().getFullYear().toString();
416
+ }
417
+ else {
418
+ input.value = `0${minValue}`;
419
+ }
420
+ this.notifyScreenReader(input, event);
421
+ }
422
+ }
423
+ this.setInputValue(input);
424
+ this.setFitToValueStyling(input);
425
+ };
426
+ this.handleDateChange = (force) => {
427
+ // Prevent icChange being emitted when each individual input is changed
428
+ // This method is used within componentWillUpdate instead of using @Watch('value');
429
+ if (force || this.selectedDate !== this.previousSelectedDate) {
430
+ if (this.value) {
431
+ this.inputsInOrder.forEach((input) => {
432
+ input.classList.add(this.FIT_TO_VALUE);
433
+ });
434
+ }
435
+ if (this.day && this.month && this.year && this.invalidDateText === "") {
436
+ this.setValueAndEmitChange(this.selectedDate);
437
+ this.notifyScreenReaderSelectedDate();
438
+ }
439
+ else {
440
+ this.setValueAndEmitChange(null);
441
+ this.selectedDateInfoEl.textContent = "";
442
+ }
443
+ this.previousSelectedDate = this.selectedDate;
444
+ if (!this.isDateSetFromKeyboardEvent) {
445
+ this.updateInputValues(this.day, this.month, this.year);
446
+ }
447
+ }
448
+ };
449
+ this.slicePastedDate = (valueLength, datePart) => {
450
+ return datePart.length > valueLength
451
+ ? datePart.slice(0, valueLength)
452
+ : datePart;
453
+ };
454
+ this.isPastedStringDateValid = (value) => {
455
+ if (/\d+-\d+-\d+$/.test(value) ||
456
+ /\d+\/\d+\/\d+/.test(value) ||
457
+ /\d+\.\d+\.\d+/.test(value)) {
458
+ return true;
459
+ }
460
+ if (/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}(?::[0-9]{2}(?:\.\d+)?)?Z/.test(value)) {
461
+ this.isZuluTime = true;
462
+ return true;
463
+ }
464
+ return false;
465
+ };
466
+ // Set value of each input to value of pasted date part
467
+ // Allows formats separated by '-' or '/'
468
+ this.handlePaste = (event) => {
469
+ event.preventDefault();
470
+ const pastedValue = event.clipboardData.getData("Text");
471
+ const isValidDate = this.isPastedStringDateValid(pastedValue);
472
+ this.setPastedValueAndValidation(isValidDate, pastedValue, event);
473
+ };
474
+ this.setDate = (date) => {
475
+ if (date === null || date === "" || date === undefined) {
476
+ this.day = null;
477
+ this.month = null;
478
+ this.year = null;
479
+ this.inputsInOrder.forEach((input) => {
480
+ input.classList.remove(this.FIT_TO_VALUE);
481
+ this.setPreventInput(input, false);
482
+ });
483
+ this.handleDateChange(true);
484
+ }
485
+ else {
486
+ if (isDateOrEpoch(date)) {
487
+ let newDate;
488
+ if (typeof date === "string") {
489
+ // Checking if epoch date time
490
+ newDate = new Date(+date);
491
+ }
492
+ else {
493
+ newDate = date;
494
+ }
495
+ this.day = convertToDoubleDigits(newDate.getDate());
496
+ this.month = convertToDoubleDigits(newDate.getMonth() + 1);
497
+ this.year = newDate.getFullYear().toString();
498
+ }
499
+ else if (typeof date === "string") {
500
+ const defaultDateArray = splitStringDate(date, this.dateFormat);
501
+ this.year = defaultDateArray[0];
502
+ this.month = defaultDateArray[1];
503
+ this.day = defaultDateArray[2];
504
+ }
505
+ }
506
+ this.setValidationMessage();
507
+ };
508
+ this.formatMinMax = (date) => {
509
+ let formattedDate;
510
+ const day = convertToDoubleDigits(date.getDate());
511
+ const month = convertToDoubleDigits(date.getMonth() + 1);
512
+ const year = date.getFullYear();
513
+ switch (this.dateFormat) {
514
+ case "DD/MM/YYYY":
515
+ formattedDate = `${day}/${month}/${year}`;
516
+ break;
517
+ case "MM/DD/YYYY":
518
+ formattedDate = `${month}/${day}/${year}`;
519
+ break;
520
+ case "YYYY/MM/DD":
521
+ formattedDate = `${year}/${month}/${day}`;
522
+ break;
523
+ }
524
+ return formattedDate;
525
+ };
526
+ this.updateInputValues = (day, month, year) => {
527
+ this.dayInputEl.value = day;
528
+ this.monthInputEl.value = month;
529
+ this.yearInputEl.value = year;
530
+ };
531
+ // Set value in state based on input
532
+ this.setInputValue = (input, clear = false) => {
533
+ const newValue = clear ? "" : input.value;
534
+ switch (input) {
535
+ case this.dayInputEl:
536
+ this.day = newValue;
537
+ break;
538
+ case this.monthInputEl:
539
+ this.month = newValue;
540
+ break;
541
+ case this.yearInputEl:
542
+ if (this.year !== newValue) {
543
+ this.year = newValue;
544
+ }
545
+ }
546
+ this.setValidationMessage();
547
+ };
548
+ this.setValidationMessage = () => {
549
+ this.setDateValidity();
550
+ if (!isEmptyString(this.day) &&
551
+ !isEmptyString(this.month) &&
552
+ !isEmptyString(this.year)) {
553
+ // Check whether date actually exists
554
+ // (used https://www.hectane.com/blog/javascript-date-validation-with-leap-year)
555
+ this.selectedDate = this.convertToDate(this.year, this.month, this.day);
556
+ this.isValidDate =
557
+ +this.selectedDate !== 0 && this.selectedDate.getDate() == +this.day;
558
+ this.isDisabledDate = this.isSelectedDateDisabled();
559
+ if (!this.isValidDate || this.isDisabledDate) {
560
+ this.inputsInOrder.forEach((input) => input.setAttribute(this.ARIA_INVALID, "true"));
561
+ }
562
+ else {
563
+ this.inputsInOrder.forEach((input) => input.removeAttribute(this.ARIA_INVALID));
564
+ }
565
+ }
566
+ else {
567
+ this.selectedDate = null;
568
+ }
569
+ if (!(this.isValidDay && this.isValidMonth && this.isValidDate)) {
570
+ this.invalidDateText = "Please enter a valid date.";
571
+ }
572
+ else if (this.isDisabledDate && this.selectedDate !== null) {
573
+ if (this.isBeforeMin) {
574
+ if (this.disablePast) {
575
+ this.invalidDateText = this.disablePastMessage;
576
+ }
577
+ else {
578
+ this.invalidDateText = `Please enter a date after ${this.formatMinMax(this.minDate)}.`;
579
+ }
580
+ }
581
+ else if (this.isAfterMax) {
582
+ if (this.disableFuture) {
583
+ this.invalidDateText = this.disableFutureMessage;
584
+ }
585
+ else {
586
+ this.invalidDateText = `Please enter a date before ${this.formatMinMax(this.maxDate)}.`;
587
+ }
588
+ }
589
+ else if (this.disableDays.length !== 0) {
590
+ this.invalidDateText = this.disableDaysMessage;
591
+ }
592
+ else {
593
+ if (this.disablePast) {
594
+ this.invalidDateText = this.disablePastMessage;
595
+ }
596
+ if (this.disableFuture) {
597
+ this.invalidDateText = this.disableFutureMessage;
598
+ }
599
+ }
600
+ }
601
+ else {
602
+ this.invalidDateText = "";
603
+ }
604
+ };
605
+ // Set refs to the input elements in the order they are displayed (based on the dateFormat)
606
+ this.setInputsInOrder = () => {
607
+ const inputs = this.el.shadowRoot.querySelectorAll("input");
608
+ inputs.forEach((input) => this.inputsInOrder.push(input));
609
+ };
610
+ // Includes text usually added using aria-describedby
611
+ // (which doesn't work on input component container)
612
+ this.setAriaLabelledBy = () => {
613
+ var _a;
614
+ if (this.disabled &&
615
+ !isEmptyString((_a = this.inputCompContainerEl) === null || _a === void 0 ? void 0 : _a.getAttribute(this.ARIA_LABELLED_BY))) {
616
+ this.removeAriaLabelledBy();
617
+ return;
618
+ }
619
+ if (this.disabled) {
620
+ return;
621
+ }
622
+ const labelEl = this.el.shadowRoot.querySelector("label");
623
+ const labelId = `${this.inputId}-label`;
624
+ if (labelEl !== null && labelEl !== undefined) {
625
+ labelEl.id = labelId;
626
+ const hasValidation = (!isEmptyString(this.validationStatus) &&
627
+ !isEmptyString(this.validationText)) ||
628
+ !isEmptyString(this.invalidDateText);
629
+ const labelledBy = `${labelId} ${this.screenReaderInfoId} ${getInputDescribedByText(this.inputId, this.helperText !== "" && this.helperText !== this.defaultHelperText, hasValidation)} ${this.selectedDate ? this.selectedDateInfoId : ""} ${this.assistiveHintId}`;
630
+ this.inputCompContainerEl.setAttribute(this.ARIA_LABELLED_BY, labelledBy);
631
+ }
632
+ };
633
+ // Sets boolean for each input, used to limit the number of characters within each field (2 for day / month, 4 for year)
634
+ this.setPreventInput = (input, isPrevented) => {
635
+ switch (input) {
636
+ case this.dayInputEl:
637
+ this.preventDayInput = isPrevented;
638
+ break;
639
+ case this.monthInputEl:
640
+ this.preventMonthInput = isPrevented;
641
+ break;
642
+ case this.yearInputEl:
643
+ this.preventYearInput = isPrevented;
644
+ }
645
+ };
646
+ // Get input based on letter representing each date part ("D", "M" or "Y")
647
+ // (retrieved from dateFormat)
648
+ this.getInputFromDatePart = (datePart) => {
649
+ 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) }));
650
+ 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) }));
651
+ 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) }));
652
+ let input;
653
+ switch (datePart) {
654
+ case "D":
655
+ input = dayInput;
656
+ break;
657
+ case "M":
658
+ input = monthInput;
659
+ break;
660
+ case "Y":
661
+ input = yearInput;
662
+ }
663
+ return input;
664
+ };
665
+ // Get input elements in order of chosen date format
666
+ this.getInputsInOrder = () => {
667
+ const dateParts = this.dateFormat.split("/");
668
+ const inputsInOrder = [];
669
+ dateParts.forEach((part) => {
670
+ inputsInOrder.push(this.getInputFromDatePart(part.substring(0, 1)));
671
+ });
672
+ return inputsInOrder;
673
+ };
674
+ // To add to the end of assistive hint to make it clearer that each date part has its own input
675
+ // that can be changed individually
676
+ this.getDescOfInputsOrder = () => {
677
+ let description;
678
+ switch (this.dateFormat) {
679
+ case "DD/MM/YYYY":
680
+ description = "day, month, and year";
681
+ break;
682
+ case "MM/DD/YYYY":
683
+ description = "month, day, and year";
684
+ break;
685
+ case "YYYY/MM/DD":
686
+ description = "year, month, and day";
687
+ }
688
+ return description;
689
+ };
690
+ // Add 'required' or 'invalid data' to span used in aria-labelledby
691
+ // Many ARIA attributes aren't read out by screen reader when on the input component container
692
+ this.getScreenReaderInfo = (validationStatus) => {
693
+ let inputDescriptors = "";
694
+ if (this.required) {
695
+ inputDescriptors += "required";
696
+ }
697
+ if (validationStatus === IcInformationStatus.Error) {
698
+ inputDescriptors += " invalid data";
699
+ }
700
+ return inputDescriptors === "" ? "" : inputDescriptors + ", ";
701
+ };
702
+ // Prevent non-number characters being entered
703
+ // ('e' or '.' - which are usually allowed in <input type="number">)
704
+ // And limit the number of characters within each field (2 for day / month, 4 for year)
705
+ // (because 'maxlength' doesn't work on <input type="number">)
706
+ this.preventInput = (event, isInputPrevented) => {
707
+ const key = event.key;
708
+ const input = event.target;
709
+ let selectedString;
710
+ if (input) {
711
+ selectedString = input.value.substring(input.selectionStart, input.selectionEnd);
712
+ }
713
+ if (key === "e" ||
714
+ key === "." ||
715
+ key === "-" ||
716
+ (event.key >= "0" &&
717
+ event.key <= "9" &&
718
+ isInputPrevented &&
719
+ !selectedString)) {
720
+ event.preventDefault();
721
+ }
722
+ };
723
+ // Get whether date has been disabled using disableFuture or disablePast prop, but always allow current day
724
+ // Consider using dateClamp and inDateRange
725
+ this.isSelectedDateDisabled = () => {
726
+ const currentDate = new Date();
727
+ this.isAfterMax = false;
728
+ this.isBeforeMin = false;
729
+ let disabled = false;
730
+ const isNotToday = this.selectedDate.toDateString() !== currentDate.toDateString();
731
+ if (this.minDate && this.selectedDate < this.minDate && isNotToday) {
732
+ this.isBeforeMin = true;
733
+ disabled = true;
734
+ }
735
+ if (this.maxDate && this.selectedDate > this.maxDate && isNotToday) {
736
+ this.isAfterMax = true;
737
+ disabled = true;
738
+ }
739
+ if (this.disableDays.includes(this.selectedDate.getDay())) {
740
+ disabled = true;
741
+ }
742
+ if (((this.disablePast && this.selectedDate < currentDate) ||
743
+ (this.disableFuture && this.selectedDate > currentDate)) &&
744
+ isNotToday) {
745
+ disabled = true;
746
+ }
747
+ return disabled;
748
+ };
749
+ this.moveToNextInput = (currentInput) => {
750
+ const currentInputPos = this.inputsInOrder.findIndex((input) => input === currentInput);
751
+ const nextInput = this.inputsInOrder[currentInputPos + 1];
752
+ this.preventAutoFormatting = false;
753
+ if (nextInput) {
754
+ nextInput.focus();
755
+ }
756
+ };
757
+ this.moveToPreviousInput = (currentInput) => {
758
+ const currentInputPos = this.inputsInOrder.findIndex((input) => input === currentInput);
759
+ this.preventAutoFormatting = false;
760
+ if (this.inputsInOrder[currentInputPos - 1]) {
761
+ this.inputsInOrder[currentInputPos - 1].focus();
762
+ }
763
+ };
764
+ this.autocompleteInput = (input) => {
765
+ if (input === this.yearInputEl) {
766
+ this.autocompleteYear();
767
+ }
768
+ else {
769
+ const inputValue = input.value;
770
+ // Autocomplete input as 2 characters (leading zero) when only 1 character entered (for day and month)
771
+ if (inputValue.length === 1) {
772
+ if (+inputValue === 0) {
773
+ input.value = "01";
774
+ }
775
+ else {
776
+ input.value = `0${inputValue}`;
777
+ }
778
+ }
779
+ }
780
+ if (input.value) {
781
+ this.setInputValue(input);
782
+ }
783
+ };
784
+ // Autocomplete year as current millennium when fewer than 4 characters entered
785
+ this.autocompleteYear = () => {
786
+ const inputValue = this.yearInputEl.value;
787
+ const yearNumbers = ["2", "0", "0"];
788
+ let autocompletedInput = "";
789
+ if (inputValue) {
790
+ yearNumbers.forEach((number, index) => {
791
+ if (inputValue.length + index <= 3) {
792
+ autocompletedInput += number;
793
+ }
794
+ });
795
+ this.yearInputEl.value = `${autocompletedInput}${inputValue}`;
796
+ }
797
+ };
798
+ this.convertToDate = (year, month, day) => {
799
+ if (!isEmptyString(year) && !isEmptyString(month) && !isEmptyString(day)) {
800
+ return new Date(+year, +month - 1, +day);
801
+ }
802
+ else {
803
+ return null;
804
+ }
805
+ };
806
+ this.handleHostBlur = () => {
807
+ this.removeLabelledBy = false;
808
+ this.icBlur.emit({ value: this.selectedDate });
809
+ };
810
+ this.handleHostFocus = () => {
811
+ if (this.el.shadowRoot.activeElement.id.match(/(day|month|year)-input$/)) {
812
+ this.removeLabelledBy = false;
813
+ }
814
+ else {
815
+ this.removeLabelledBy = true;
816
+ }
817
+ this.icFocus.emit({ value: this.selectedDate });
818
+ };
819
+ this.handleFormReset = () => {
820
+ // Get the initial value and populate day, month and year again.
821
+ this.setDate(this.initialValue);
822
+ this.setValidationMessage();
823
+ this.handleDateChange(false);
824
+ };
825
+ this.getAriaLabel = (input) => {
826
+ return input.getAttribute(this.ARIA_LABEL);
827
+ };
828
+ this.notifyScreenReaderArrowKeys = (input) => {
829
+ const liveRegion = this.el.shadowRoot.querySelector("#live-region");
830
+ let announcement = "";
831
+ const ariaLabel = this.getAriaLabel(input);
832
+ if (liveRegion && input.value) {
833
+ if (input === this.monthInputEl &&
834
+ !!IcDateInputMonths[+input.value - 1]) {
835
+ announcement = `${input.value} - ${IcDateInputMonths[+input.value - 1]}, ${ariaLabel}`;
836
+ }
837
+ if (input === this.dayInputEl || input === this.yearInputEl) {
838
+ announcement = `${input.value}, ${ariaLabel}`;
839
+ }
840
+ liveRegion.textContent = announcement;
841
+ }
842
+ };
843
+ this.notifyScreenReaderInput = (input, liveRegion) => {
844
+ let announcement = "";
845
+ const ariaLabel = this.getAriaLabel(input);
846
+ if (input === this.dayInputEl || input === this.monthInputEl) {
847
+ if (input.value.length === 2) {
848
+ if (input === this.monthInputEl &&
849
+ !!IcDateInputMonths[+input.value - 1] &&
850
+ this.isValidMonth) {
851
+ announcement = `${input.value} - ${IcDateInputMonths[+input.value - 1]}, ${ariaLabel}`;
852
+ }
853
+ if (input === this.dayInputEl && this.isValidDay) {
854
+ announcement = `${input.value}, ${ariaLabel}`;
855
+ }
856
+ }
857
+ else {
858
+ announcement = "";
859
+ }
860
+ }
861
+ else {
862
+ if (input.value.length === 4) {
863
+ announcement = `${input.value}, ${ariaLabel}`;
864
+ }
865
+ else {
866
+ announcement = "";
867
+ }
868
+ }
869
+ liveRegion.textContent = announcement;
870
+ };
871
+ this.setFitToValueStyling = (input) => {
872
+ if (input.value) {
873
+ input.classList.add(this.FIT_TO_VALUE);
874
+ }
875
+ else {
876
+ input.classList.remove(this.FIT_TO_VALUE);
877
+ }
878
+ };
879
+ this.setAriaInvalid = (validDay, validMonth, validDate, disabledDate) => {
880
+ if (this.inputsInOrder.length) {
881
+ this.inputsInOrder.forEach((input) => {
882
+ input.removeAttribute(this.ARIA_INVALID);
883
+ });
884
+ if (!validDay) {
885
+ this.dayInputEl.setAttribute(this.ARIA_INVALID, "true");
886
+ }
887
+ if (!validMonth) {
888
+ this.monthInputEl.setAttribute(this.ARIA_INVALID, "true");
889
+ }
890
+ if (!validDate || disabledDate) {
891
+ this.inputsInOrder.forEach((input) => {
892
+ input.setAttribute(this.ARIA_INVALID, "true");
893
+ });
894
+ }
895
+ }
896
+ };
897
+ this.handleClear = () => {
898
+ this.inputsInOrder.forEach((input) => {
899
+ input.classList.remove(this.FIT_TO_VALUE);
900
+ this.setInputValue(input, true);
901
+ this.setPreventInput(input, false);
902
+ });
903
+ this.isDateSetFromKeyboardEvent = false;
904
+ this.setValueAndEmitChange(null);
905
+ this.setValidationMessage();
906
+ this.handleDateChange(true);
907
+ this.inputsInOrder[0].focus();
908
+ };
909
+ this.handleCalendarOpen = (ev) => {
910
+ ev.stopImmediatePropagation();
911
+ this.calendarButtonEl.shadowRoot
912
+ .querySelector("ic-tooltip")
913
+ .displayTooltip(false);
914
+ this.calendarButtonClicked.emit({ value: this.selectedDate });
915
+ this.calendarButtonEl.shadowRoot
916
+ .querySelector("ic-tooltip")
917
+ .displayTooltip(false);
918
+ this.isDateSetFromKeyboardEvent = false;
919
+ };
920
+ this.setValueAndEmitChange = (value) => {
921
+ if (this.value !== value) {
922
+ this.icChange.emit({ value: value });
923
+ this.value = value;
924
+ }
925
+ };
926
+ this.handleCalendarFocus = () => {
927
+ this.calendarFocused = true;
928
+ };
929
+ this.handleCalendarBlur = () => {
930
+ this.calendarFocused = false;
931
+ };
932
+ this.handleClearFocus = () => {
933
+ this.removeLabelledBy = true;
934
+ this.clearButtonFocused = true;
935
+ };
936
+ this.handleClearBlur = (ev) => {
937
+ this.clearButtonFocused = false;
938
+ if (ev.relatedTarget.id.match(/(day|year)-input$/)) {
939
+ this.removeLabelledBy = false;
940
+ return;
941
+ }
942
+ this.removeLabelledBy = true;
943
+ };
944
+ this.day = "";
945
+ this.invalidDateText = undefined;
946
+ this.maxDate = undefined;
947
+ this.minDate = undefined;
948
+ this.month = "";
949
+ this.year = "";
950
+ this.calendarFocused = false;
951
+ this.clearButtonFocused = false;
952
+ this.removeLabelledBy = false;
953
+ this.dateFormat = "DD/MM/YYYY";
954
+ this.disabled = false;
955
+ this.disableDays = [];
956
+ this.disableDaysMessage = "The date you have selected is on a day of the week that is not allowed. Please select another date.";
957
+ this.disableFuture = false;
958
+ this.disableFutureMessage = "Dates in the future are not allowed. Please select a date in the past.";
959
+ this.disablePast = false;
960
+ this.disablePastMessage = "Dates in the past are not allowed. Please select a date in the future.";
961
+ this.helperText = undefined;
962
+ this.inputId = `ic-date-input-${inputIds++}`;
963
+ this.label = undefined;
964
+ this.max = "";
965
+ this.min = "";
966
+ this.name = this.inputId;
967
+ this.required = false;
968
+ this.showCalendarButton = false;
969
+ this.showClearButton = true;
970
+ this.size = "default";
971
+ this.value = "";
972
+ this.validationStatus = "";
973
+ this.validationText = "";
974
+ }
975
+ watchMaxHandler() {
976
+ if (this.disableFuture) {
977
+ this.maxDate = new Date();
978
+ }
979
+ else {
980
+ this.maxDate = createDate(this.max, this.dateFormat);
981
+ }
982
+ }
983
+ watchMinHandler() {
984
+ if (this.disablePast) {
985
+ this.minDate = new Date();
986
+ }
987
+ else {
988
+ this.minDate = createDate(this.min, this.dateFormat);
989
+ }
990
+ }
991
+ disconnectedCallback() {
992
+ removeFormResetListener(this.el, this.handleFormReset);
993
+ }
994
+ componentWillLoad() {
995
+ this.defaultHelperText = `Use format ${this.dateFormat}`;
996
+ if (isEmptyString(this.helperText)) {
997
+ this.helperText = this.defaultHelperText;
998
+ }
999
+ this.watchMinHandler();
1000
+ this.watchMaxHandler();
1001
+ if (this.value) {
1002
+ this.setDate(this.value);
1003
+ }
1004
+ this.screenReaderInfoId = `${this.inputId}-screen-reader-info`;
1005
+ this.assistiveHintId = `${this.inputId}-assistive-hint`;
1006
+ this.selectedDateInfoId = `${this.inputId}-selected-date-info`;
1007
+ addFormResetListener(this.el, this.handleFormReset);
1008
+ }
1009
+ componentDidLoad() {
1010
+ this.setInputsInOrder();
1011
+ onComponentRequiredPropUndefined([{ prop: this.label, propName: "label" }], "Date Input");
1012
+ if (this.value) {
1013
+ this.updateInputValues(this.day, this.month, this.year);
1014
+ this.inputsInOrder.forEach((input) => {
1015
+ input.classList.add(this.FIT_TO_VALUE);
1016
+ });
1017
+ }
1018
+ this.setAriaInvalid(this.isValidDay, this.isValidMonth, this.isValidDate, this.isDisabledDate);
1019
+ if (this.value) {
1020
+ this.notifyScreenReaderSelectedDate();
1021
+ }
1022
+ this.inputsInOrder.forEach((input) => {
1023
+ input.addEventListener("input", this.handleInput);
1024
+ input.addEventListener("focus", this.handleFocus);
1025
+ input.addEventListener("blur", this.handleBlur);
1026
+ });
1027
+ // Prevent asterisk being read out after the label by screen reader (by applying aria-hidden)
1028
+ // Needed because label is included in 'aria-labelledby' instead of using 'aria-label'
1029
+ const labelEl = this.el.shadowRoot.querySelector("label");
1030
+ if (this.required) {
1031
+ const asteriskSpan = document.createElement("span");
1032
+ asteriskSpan.setAttribute("aria-hidden", "true");
1033
+ asteriskSpan.textContent = " *";
1034
+ labelEl === null || labelEl === void 0 ? void 0 : labelEl.appendChild(asteriskSpan);
1035
+ }
1036
+ }
1037
+ componentWillUpdate() {
1038
+ if (!this.isDateSetFromKeyboardEvent) {
1039
+ this.setDate(this.value);
1040
+ }
1041
+ this.setAriaInvalid(this.isValidDay, this.isValidMonth, this.isValidDate, this.isDisabledDate);
1042
+ this.handleDateChange(false);
1043
+ this.isDateSetFromKeyboardEvent = false;
1044
+ }
1045
+ componentDidRender() {
1046
+ if (this.removeLabelledBy) {
1047
+ this.removeAriaLabelledBy();
1048
+ return;
1049
+ }
1050
+ this.setAriaLabelledBy();
1051
+ }
1052
+ /**
1053
+ * Returns the value as a Date object
1054
+ * @returns Date
1055
+ */
1056
+ async getDate() {
1057
+ return this.selectedDate;
1058
+ }
1059
+ /**
1060
+ * @internal Sets focus on the calendar button.
1061
+ */
1062
+ async setCalendarFocus() {
1063
+ if (this.calendarButtonEl) {
1064
+ this.calendarButtonEl.focus();
1065
+ }
1066
+ }
1067
+ /**
1068
+ * @internal Used to pass disabledDays from parent component.
1069
+ */
1070
+ async setDisableDays(days) {
1071
+ this.disableDays = days;
1072
+ }
1073
+ removeAriaLabelledBy() {
1074
+ this.inputCompContainerEl.removeAttribute(this.ARIA_LABELLED_BY);
1075
+ }
1076
+ setPastedValueAndValidation(isValidDate, pastedValue, event) {
1077
+ switch (true) {
1078
+ case isValidDate: {
1079
+ const nextParsedValue = this.isZuluTime
1080
+ ? extractDateFromZuluDateTime(pastedValue)
1081
+ : pastedValue;
1082
+ const dateParts = nextParsedValue.split(/-|\/|\./);
1083
+ this.inputsInOrder.forEach((input, index) => {
1084
+ input.classList.add(this.FIT_TO_VALUE);
1085
+ if (this.isZuluTime) {
1086
+ this.pasteZuluDateTime(dateParts, index);
1087
+ }
1088
+ else {
1089
+ let dateValue;
1090
+ if (input === this.dayInputEl || input === this.monthInputEl) {
1091
+ dateValue = this.slicePastedDate(2, dateParts[index]);
1092
+ }
1093
+ else {
1094
+ dateValue = this.slicePastedDate(4, dateParts[index]);
1095
+ }
1096
+ input.value = dateValue;
1097
+ this.setInputValue(input);
1098
+ this.autocompleteInput(input);
1099
+ }
1100
+ });
1101
+ this.isZuluTime = false;
1102
+ break;
1103
+ }
1104
+ case (pastedValue.length === 1 ||
1105
+ pastedValue.length === 2 ||
1106
+ pastedValue.length === 4) &&
1107
+ isNumeric(pastedValue):
1108
+ if (this.checkSingleCopiedValueIsValid(event.target, pastedValue)) {
1109
+ // Check if copied value can be pasted into input
1110
+ this.setInputPasteValue(event.target, pastedValue);
1111
+ this.setInputValue(event.target);
1112
+ }
1113
+ else {
1114
+ this.displayPastedValidation(event);
1115
+ }
1116
+ break;
1117
+ case pastedValue.length === 3 && isNumeric(pastedValue):
1118
+ if (event.target !== this.yearInputEl) {
1119
+ this.displayPastedValidation(event);
1120
+ }
1121
+ else {
1122
+ this.setInputPasteValue(event.target, pastedValue);
1123
+ this.setInputValue(event.target);
1124
+ }
1125
+ break;
1126
+ case pastedValue.length >= 5 && isNumeric(pastedValue):
1127
+ this.displayPastedValidation(event);
1128
+ }
1129
+ }
1130
+ pasteZuluDateTime(dateParts, index) {
1131
+ // ['YYYY', 'MM', 'DD']
1132
+ if (index === 0) {
1133
+ const dateValue = this.slicePastedDate(4, dateParts[index]);
1134
+ this.yearInputEl.value = dateValue;
1135
+ this.setInputValue(this.yearInputEl);
1136
+ }
1137
+ else if (index === 1) {
1138
+ // The month value is the second item in the array
1139
+ const dateValue = this.slicePastedDate(2, dateParts[index]);
1140
+ this.monthInputEl.value = dateValue;
1141
+ this.setInputValue(this.monthInputEl);
1142
+ }
1143
+ else {
1144
+ const dateValue = this.slicePastedDate(2, dateParts[index]);
1145
+ this.dayInputEl.value = dateValue;
1146
+ this.setInputValue(this.dayInputEl);
1147
+ }
1148
+ }
1149
+ displayPastedValidation(event) {
1150
+ var _a;
1151
+ if (((_a = this.invalidDateText) === null || _a === void 0 ? void 0 : _a.length) > 0) {
1152
+ this.previousInvalidDateTest = this.invalidDateText;
1153
+ }
1154
+ this.invalidDateText = `Please paste a valid ${this.getAriaLabel(event.target)}`;
1155
+ this.validationStatus = IcInformationStatus.Error;
1156
+ this.isPasteValidationDisplayed = true;
1157
+ }
1158
+ setPasteInvalidText() {
1159
+ var _a;
1160
+ if (this.isPasteValidationDisplayed) {
1161
+ this.invalidDateText = (_a = this.previousInvalidDateTest) !== null && _a !== void 0 ? _a : "";
1162
+ this.isPasteValidationDisplayed = false;
1163
+ // This is to prevent setDate from triggering within componentWillUpdate
1164
+ this.isDateSetFromKeyboardEvent = true;
1165
+ }
1166
+ }
1167
+ notifyScreenReader(input, event) {
1168
+ const liveRegion = this.el.shadowRoot.querySelector("#live-region");
1169
+ if (liveRegion) {
1170
+ if (this.isKeyboardOrEvent(event)) {
1171
+ this.notifyScreenReaderArrowKeys(input);
1172
+ }
1173
+ else if (Object.prototype.toString.call(event) === this.INPUT_EVENT_OBJECT_STRING) {
1174
+ this.notifyScreenReaderInput(input, liveRegion);
1175
+ }
1176
+ }
1177
+ }
1178
+ render() {
1179
+ const { inputId, label, disabled, helperText, showClearButton, showCalendarButton, size, } = this;
1180
+ const hasCustomValidation = !isEmptyString(this.validationStatus) &&
1181
+ !isEmptyString(this.validationText);
1182
+ const validationStatus = hasCustomValidation
1183
+ ? this.validationStatus
1184
+ : !isEmptyString(this.invalidDateText)
1185
+ ? IcInformationStatus.Error
1186
+ : "";
1187
+ const assistiveHint = `Type or use the up and down arrow keys to change the values for the ${this.getDescOfInputsOrder()}.`;
1188
+ renderHiddenInput(true, this.el, this.name, this.convertToDate(this.year, this.month, this.day), this.disabled);
1189
+ 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: {
1190
+ ["clear-button"]: true,
1191
+ ["hidden"]: isEmptyString(this.day) &&
1192
+ isEmptyString(this.month) &&
1193
+ isEmptyString(this.year),
1194
+ }, disabled: this.disabled, innerHTML: Clear, onClick: this.handleClear, onFocus: this.handleClearFocus, onBlur: this.handleClearBlur, variant: "icon", appearance: this.clearButtonFocused
1195
+ ? IcThemeForegroundEnum.Light
1196
+ : 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
1197
+ ? IcThemeForegroundEnum.Light
1198
+ : 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 })))));
1199
+ }
1200
+ static get delegatesFocus() { return true; }
1201
+ get el() { return this; }
1202
+ static get watchers() { return {
1203
+ "max": ["watchMaxHandler"],
1204
+ "min": ["watchMinHandler"]
1205
+ }; }
1206
+ static get style() { return icDateInputCss; }
1207
+ }, [17, "ic-date-input", {
1208
+ "dateFormat": [1, "date-format"],
1209
+ "disabled": [4],
1210
+ "disableDays": [1040],
1211
+ "disableDaysMessage": [1, "disable-days-message"],
1212
+ "disableFuture": [4, "disable-future"],
1213
+ "disableFutureMessage": [1, "disable-future-message"],
1214
+ "disablePast": [4, "disable-past"],
1215
+ "disablePastMessage": [1, "disable-past-message"],
1216
+ "helperText": [1025, "helper-text"],
1217
+ "inputId": [1, "input-id"],
1218
+ "label": [1],
1219
+ "max": [1],
1220
+ "min": [1],
1221
+ "name": [1],
1222
+ "required": [4],
1223
+ "showCalendarButton": [4, "show-calendar-button"],
1224
+ "showClearButton": [4, "show-clear-button"],
1225
+ "size": [1],
1226
+ "value": [1025],
1227
+ "validationStatus": [1025, "validation-status"],
1228
+ "validationText": [1, "validation-text"],
1229
+ "day": [32],
1230
+ "invalidDateText": [32],
1231
+ "maxDate": [32],
1232
+ "minDate": [32],
1233
+ "month": [32],
1234
+ "year": [32],
1235
+ "calendarFocused": [32],
1236
+ "clearButtonFocused": [32],
1237
+ "removeLabelledBy": [32],
1238
+ "getDate": [64],
1239
+ "setCalendarFocus": [64],
1240
+ "setDisableDays": [64]
1241
+ }, undefined, {
1242
+ "max": ["watchMaxHandler"],
1243
+ "min": ["watchMinHandler"]
1244
+ }]);
1245
+ function defineCustomElement() {
1246
+ if (typeof customElements === "undefined") {
1247
+ return;
1248
+ }
1249
+ const components = ["ic-date-input", "ic-button", "ic-input-component-container", "ic-input-container", "ic-input-label", "ic-input-validation", "ic-loading-indicator", "ic-tooltip", "ic-typography"];
1250
+ components.forEach(tagName => { switch (tagName) {
1251
+ case "ic-date-input":
1252
+ if (!customElements.get(tagName)) {
1253
+ customElements.define(tagName, DateInput);
1254
+ }
1255
+ break;
1256
+ case "ic-button":
1257
+ if (!customElements.get(tagName)) {
1258
+ defineCustomElement$8();
1259
+ }
1260
+ break;
1261
+ case "ic-input-component-container":
1262
+ if (!customElements.get(tagName)) {
1263
+ defineCustomElement$7();
1264
+ }
1265
+ break;
1266
+ case "ic-input-container":
1267
+ if (!customElements.get(tagName)) {
1268
+ defineCustomElement$6();
1269
+ }
1270
+ break;
1271
+ case "ic-input-label":
1272
+ if (!customElements.get(tagName)) {
1273
+ defineCustomElement$5();
1274
+ }
1275
+ break;
1276
+ case "ic-input-validation":
1277
+ if (!customElements.get(tagName)) {
1278
+ defineCustomElement$4();
1279
+ }
1280
+ break;
1281
+ case "ic-loading-indicator":
1282
+ if (!customElements.get(tagName)) {
1283
+ defineCustomElement$3();
1284
+ }
1285
+ break;
1286
+ case "ic-tooltip":
1287
+ if (!customElements.get(tagName)) {
1288
+ defineCustomElement$2();
1289
+ }
1290
+ break;
1291
+ case "ic-typography":
1292
+ if (!customElements.get(tagName)) {
1293
+ defineCustomElement$1();
1294
+ }
1295
+ break;
1296
+ } });
1297
+ }
1298
+
1299
+ export { DateInput as D, dateInRange as a, getMonthStart as b, getWeekStart as c, defineCustomElement as d, getWeekEnd as e, dateMatches as f, getMonthEnd as g, clampDate as h, createDate as i, yearInRange as y };
1300
+
1301
+ //# sourceMappingURL=ic-date-input2.js.map