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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (449) 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-00b08718.js → helpers-7a069459.js} +8 -3
  5. package/dist/cjs/helpers-7a069459.js.map +1 -0
  6. package/dist/cjs/helpers-f75cf7cf.js +280 -0
  7. package/dist/cjs/helpers-f75cf7cf.js.map +1 -0
  8. package/dist/cjs/ic-accordion-group.cjs.entry.js +6 -2
  9. package/dist/cjs/ic-accordion-group.cjs.entry.js.map +1 -1
  10. package/dist/cjs/ic-accordion.cjs.entry.js +1 -1
  11. package/dist/cjs/ic-alert.cjs.entry.js +1 -1
  12. package/dist/cjs/ic-back-to-top.cjs.entry.js +1 -1
  13. package/dist/cjs/ic-badge.cjs.entry.js +4 -3
  14. package/dist/cjs/ic-badge.cjs.entry.js.map +1 -1
  15. package/dist/cjs/ic-breadcrumb-group.cjs.entry.js +1 -1
  16. package/dist/cjs/ic-breadcrumb.cjs.entry.js +1 -1
  17. package/dist/cjs/ic-button_3.cjs.entry.js +29 -12
  18. package/dist/cjs/ic-button_3.cjs.entry.js.map +1 -1
  19. package/dist/cjs/ic-card.cjs.entry.js +5 -6
  20. package/dist/cjs/ic-card.cjs.entry.js.map +1 -1
  21. package/dist/cjs/ic-checkbox-group.cjs.entry.js +1 -1
  22. package/dist/cjs/ic-checkbox.cjs.entry.js +1 -1
  23. package/dist/cjs/ic-chip.cjs.entry.js +1 -1
  24. package/dist/cjs/ic-data-entity.cjs.entry.js +3 -6
  25. package/dist/cjs/ic-data-entity.cjs.entry.js.map +1 -1
  26. package/dist/cjs/ic-data-row.cjs.entry.js +21 -35
  27. package/dist/cjs/ic-data-row.cjs.entry.js.map +1 -1
  28. package/dist/cjs/ic-date-input.cjs.entry.js +1073 -0
  29. package/dist/cjs/ic-date-input.cjs.entry.js.map +1 -0
  30. package/dist/cjs/ic-date-picker.cjs.entry.js +1043 -0
  31. package/dist/cjs/ic-date-picker.cjs.entry.js.map +1 -0
  32. package/dist/cjs/ic-dialog.cjs.entry.js +1 -1
  33. package/dist/cjs/ic-divider.cjs.entry.js +1 -1
  34. package/dist/cjs/ic-empty-state.cjs.entry.js +1 -1
  35. package/dist/cjs/ic-footer-link-group.cjs.entry.js +1 -1
  36. package/dist/cjs/ic-footer-link.cjs.entry.js +1 -1
  37. package/dist/cjs/ic-footer.cjs.entry.js +1 -1
  38. package/dist/cjs/ic-hero.cjs.entry.js +1 -1
  39. package/dist/cjs/ic-horizontal-scroll.cjs.entry.js +1 -1
  40. package/dist/cjs/ic-input-component-container_4.cjs.entry.js +150 -0
  41. package/dist/cjs/ic-input-component-container_4.cjs.entry.js.map +1 -0
  42. package/dist/cjs/ic-link.cjs.entry.js +1 -1
  43. package/dist/cjs/ic-menu-group.cjs.entry.js +1 -1
  44. package/dist/cjs/ic-menu-item.cjs.entry.js +1 -1
  45. package/dist/cjs/ic-menu-with-multi.cjs.entry.js +2599 -0
  46. package/dist/cjs/ic-menu-with-multi.cjs.entry.js.map +1 -0
  47. package/dist/cjs/{ic-input-component-container_3.cjs.entry.js → ic-menu.cjs.entry.js} +8 -70
  48. package/dist/cjs/ic-menu.cjs.entry.js.map +1 -0
  49. package/dist/cjs/ic-navigation-button.cjs.entry.js +1 -1
  50. package/dist/cjs/ic-navigation-group.cjs.entry.js +1 -1
  51. package/dist/cjs/ic-navigation-item.cjs.entry.js +1 -1
  52. package/dist/cjs/ic-navigation-menu.cjs.entry.js +1 -1
  53. package/dist/cjs/ic-page-header.cjs.entry.js +1 -1
  54. package/dist/cjs/ic-pagination-bar.cjs.entry.js +2 -18
  55. package/dist/cjs/ic-pagination-bar.cjs.entry.js.map +1 -1
  56. package/dist/cjs/ic-pagination_4.cjs.entry.js +21 -13
  57. package/dist/cjs/ic-pagination_4.cjs.entry.js.map +1 -1
  58. package/dist/cjs/ic-popover-menu.cjs.entry.js +1 -1
  59. package/dist/cjs/ic-popover-menu.cjs.entry.js.map +1 -1
  60. package/dist/cjs/ic-radio-group.cjs.entry.js +1 -1
  61. package/dist/cjs/ic-radio-option.cjs.entry.js +1 -1
  62. package/dist/cjs/ic-search-bar.cjs.entry.js +1 -1
  63. package/dist/cjs/ic-search-bar.cjs.entry.js.map +1 -1
  64. package/dist/cjs/ic-select-with-multi.cjs.entry.js +824 -0
  65. package/dist/cjs/ic-select-with-multi.cjs.entry.js.map +1 -0
  66. package/dist/cjs/ic-side-navigation.cjs.entry.js +1 -1
  67. package/dist/cjs/ic-status-tag.cjs.entry.js +1 -1
  68. package/dist/cjs/ic-step.cjs.entry.js +1 -1
  69. package/dist/cjs/ic-stepper.cjs.entry.js +1 -1
  70. package/dist/cjs/ic-switch.cjs.entry.js +1 -1
  71. package/dist/cjs/ic-tab-group.cjs.entry.js +1 -1
  72. package/dist/cjs/ic-tab-panel.cjs.entry.js +1 -1
  73. package/dist/cjs/ic-tab.cjs.entry.js +1 -1
  74. package/dist/cjs/ic-theme.cjs.entry.js +1 -1
  75. package/dist/cjs/ic-toast.cjs.entry.js +1 -1
  76. package/dist/cjs/ic-toggle-button-group.cjs.entry.js +184 -0
  77. package/dist/cjs/ic-toggle-button-group.cjs.entry.js.map +1 -0
  78. package/dist/cjs/ic-toggle-button.cjs.entry.js +6 -3
  79. package/dist/cjs/ic-toggle-button.cjs.entry.js.map +1 -1
  80. package/dist/cjs/ic-top-navigation.cjs.entry.js +1 -1
  81. package/dist/cjs/ic-typography.cjs.entry.js +1 -1
  82. package/dist/cjs/index-4cf27b16.js +24 -4
  83. package/dist/cjs/loader.cjs.js +1 -1
  84. package/dist/collection/assets/calendar.svg +3 -0
  85. package/dist/collection/collection-manifest.json +6 -1
  86. package/dist/collection/components/ic-date-input/ic-date-input.css +560 -0
  87. package/dist/collection/components/ic-date-input/ic-date-input.js +1668 -0
  88. package/dist/collection/components/ic-date-input/ic-date-input.js.map +1 -0
  89. package/dist/collection/components/ic-date-input/story-data.js +28 -0
  90. package/dist/collection/components/ic-date-input/story-data.js.map +1 -0
  91. package/dist/collection/components/ic-date-input/test/basic/ic-date-input.spec.js +1156 -0
  92. package/dist/collection/components/ic-date-input/test/basic/ic-date-input.spec.js.map +1 -0
  93. package/dist/collection/components/ic-date-input/test/helpers/ic-date-input.js +42 -0
  94. package/dist/collection/components/ic-date-input/test/helpers/ic-date-input.js.map +1 -0
  95. package/dist/collection/components/ic-date-picker/ic-date-picker.css +878 -0
  96. package/dist/collection/components/ic-date-picker/ic-date-picker.js +1499 -0
  97. package/dist/collection/components/ic-date-picker/ic-date-picker.js.map +1 -0
  98. package/dist/collection/components/ic-date-picker/ic-day-button.js +36 -0
  99. package/dist/collection/components/ic-date-picker/ic-day-button.js.map +1 -0
  100. package/dist/collection/components/ic-date-picker/ic-month-picker.js +29 -0
  101. package/dist/collection/components/ic-date-picker/ic-month-picker.js.map +1 -0
  102. package/dist/collection/components/ic-date-picker/ic-year-picker.js +39 -0
  103. package/dist/collection/components/ic-date-picker/ic-year-picker.js.map +1 -0
  104. package/dist/collection/components/ic-date-picker/story-data.js +143 -0
  105. package/dist/collection/components/ic-date-picker/story-data.js.map +1 -0
  106. package/dist/collection/components/ic-date-picker/test/a11y/ic-date-picker.test.a11y.js +13 -0
  107. package/dist/collection/components/ic-date-picker/test/a11y/ic-date-picker.test.a11y.js.map +1 -0
  108. package/dist/collection/components/ic-date-picker/test/basic/ic-date-picker-utils.spec.js +207 -0
  109. package/dist/collection/components/ic-date-picker/test/basic/ic-date-picker-utils.spec.js.map +1 -0
  110. package/dist/collection/components/ic-date-picker/test/basic/ic-date-picker.spec.js +962 -0
  111. package/dist/collection/components/ic-date-picker/test/basic/ic-date-picker.spec.js.map +1 -0
  112. package/dist/collection/components/ic-menu-with-multi/ic-menu.css +701 -0
  113. package/dist/collection/components/ic-menu-with-multi/ic-menu.js +1458 -0
  114. package/dist/collection/components/ic-menu-with-multi/ic-menu.js.map +1 -0
  115. package/dist/collection/components/ic-menu-with-multi/test/basic/ic-menu.spec.js +880 -0
  116. package/dist/collection/components/ic-menu-with-multi/test/basic/ic-menu.spec.js.map +1 -0
  117. package/dist/collection/components/ic-select-with-multi/assets/Check.svg +3 -0
  118. package/dist/collection/components/ic-select-with-multi/assets/Clear.svg +3 -0
  119. package/dist/collection/components/ic-select-with-multi/assets/Expand.svg +3 -0
  120. package/dist/collection/components/ic-select-with-multi/ic-select.css +693 -0
  121. package/dist/collection/components/ic-select-with-multi/ic-select.js +1649 -0
  122. package/dist/collection/components/ic-select-with-multi/ic-select.js.map +1 -0
  123. package/dist/collection/components/ic-select-with-multi/story-data.js +216 -0
  124. package/dist/collection/components/ic-select-with-multi/story-data.js.map +1 -0
  125. package/dist/collection/components/ic-select-with-multi/test/a11y/ic-select.test.a11y.js +146 -0
  126. package/dist/collection/components/ic-select-with-multi/test/a11y/ic-select.test.a11y.js.map +1 -0
  127. package/dist/collection/components/ic-select-with-multi/test/basic/ic-select.e2e.js +2040 -0
  128. package/dist/collection/components/ic-select-with-multi/test/basic/ic-select.e2e.js.map +1 -0
  129. package/dist/collection/components/ic-select-with-multi/test/basic/ic-select.spec.js +1518 -0
  130. package/dist/collection/components/ic-select-with-multi/test/basic/ic-select.spec.js.map +1 -0
  131. package/dist/collection/utils/constants.js +83 -0
  132. package/dist/collection/utils/constants.js.map +1 -0
  133. package/dist/collection/utils/date-helpers.js +133 -0
  134. package/dist/collection/utils/date-helpers.js.map +1 -0
  135. package/dist/collection/utils/helpers.js +417 -5
  136. package/dist/collection/utils/helpers.js.map +1 -1
  137. package/dist/collection/utils/types.js +58 -0
  138. package/dist/collection/utils/types.js.map +1 -0
  139. package/dist/components/helpers.js +8 -3
  140. package/dist/components/helpers.js.map +1 -1
  141. package/dist/components/helpers2.js +262 -0
  142. package/dist/components/helpers2.js.map +1 -0
  143. package/dist/components/ic-accordion-group.js +7 -2
  144. package/dist/components/ic-accordion-group.js.map +1 -1
  145. package/dist/components/ic-badge.js +3 -2
  146. package/dist/components/ic-badge.js.map +1 -1
  147. package/dist/components/ic-button2.js +32 -13
  148. package/dist/components/ic-button2.js.map +1 -1
  149. package/dist/components/ic-card.js +6 -19
  150. package/dist/components/ic-card.js.map +1 -1
  151. package/dist/components/ic-checkbox-group.js +1 -1
  152. package/dist/components/ic-checkbox.js +1 -1
  153. package/dist/components/ic-chip.js +1 -1
  154. package/dist/components/ic-data-entity.js +3 -6
  155. package/dist/components/ic-data-entity.js.map +1 -1
  156. package/dist/components/ic-data-row.js +20 -34
  157. package/dist/components/ic-data-row.js.map +1 -1
  158. package/dist/components/ic-date-input.d.ts +11 -0
  159. package/dist/components/ic-date-input.js +8 -0
  160. package/dist/components/ic-date-input.js.map +1 -0
  161. package/dist/components/ic-date-input2.js +1301 -0
  162. package/dist/components/ic-date-input2.js.map +1 -0
  163. package/dist/components/ic-date-picker.d.ts +11 -0
  164. package/dist/components/ic-date-picker.js +1164 -0
  165. package/dist/components/ic-date-picker.js.map +1 -0
  166. package/dist/components/ic-input-component-container2.js +7 -6
  167. package/dist/components/ic-input-component-container2.js.map +1 -1
  168. package/dist/components/ic-link2.js +1 -1
  169. package/dist/components/ic-menu-item2.js +1 -1
  170. package/dist/components/ic-menu-with-multi.d.ts +11 -0
  171. package/dist/components/ic-menu-with-multi.js +8 -0
  172. package/dist/components/ic-menu-with-multi.js.map +1 -0
  173. package/dist/components/ic-menu2.js +5 -4
  174. package/dist/components/ic-menu2.js.map +1 -1
  175. package/dist/components/ic-menu3.js +2665 -0
  176. package/dist/components/ic-menu3.js.map +1 -0
  177. package/dist/components/ic-navigation-button.js +1 -1
  178. package/dist/components/ic-pagination-bar2.js +1 -17
  179. package/dist/components/ic-pagination-bar2.js.map +1 -1
  180. package/dist/components/ic-pagination-item2.js +1 -1
  181. package/dist/components/ic-pagination2.js +1 -1
  182. package/dist/components/ic-popover-menu.js +1 -1
  183. package/dist/components/ic-popover-menu.js.map +1 -1
  184. package/dist/components/ic-radio-group.js +1 -1
  185. package/dist/components/ic-radio-option.js +1 -1
  186. package/dist/components/ic-search-bar.js +1 -1
  187. package/dist/components/ic-search-bar.js.map +1 -1
  188. package/dist/components/ic-select-with-multi.d.ts +11 -0
  189. package/dist/components/ic-select-with-multi.js +949 -0
  190. package/dist/components/ic-select-with-multi.js.map +1 -0
  191. package/dist/components/ic-select2.js +23 -14
  192. package/dist/components/ic-select2.js.map +1 -1
  193. package/dist/components/ic-switch.js +1 -1
  194. package/dist/components/ic-tab.js +1 -1
  195. package/dist/components/ic-text-field2.js +1 -1
  196. package/dist/components/ic-toggle-button-group.js +210 -0
  197. package/dist/components/ic-toggle-button-group.js.map +1 -0
  198. package/dist/components/ic-toggle-button.js +6 -3
  199. package/dist/components/ic-toggle-button.js.map +1 -1
  200. package/dist/core/core.css +8 -5
  201. package/dist/core/core.esm.js +1 -1
  202. package/dist/core/core.esm.js.map +1 -1
  203. package/dist/core/{p-5e94fae8.entry.js → p-06ae5bec.entry.js} +2 -2
  204. package/dist/core/p-06ae5bec.entry.js.map +1 -0
  205. package/dist/core/{p-d5cc084b.entry.js → p-0939ce92.entry.js} +2 -2
  206. package/dist/core/{p-d5cc084b.entry.js.map → p-0939ce92.entry.js.map} +1 -1
  207. package/dist/core/{p-6de46cb7.entry.js → p-16f67397.entry.js} +2 -2
  208. package/dist/core/p-16f67397.entry.js.map +1 -0
  209. package/dist/core/{p-a2f366c7.entry.js → p-1832f4b5.entry.js} +2 -2
  210. package/dist/core/{p-28fb7cca.entry.js → p-1b7d426b.entry.js} +2 -2
  211. package/dist/core/p-1b7d426b.entry.js.map +1 -0
  212. package/dist/core/{p-ff1d23cd.entry.js → p-1ce75941.entry.js} +2 -2
  213. package/dist/core/{p-5746577f.entry.js → p-2e2e0099.entry.js} +2 -2
  214. package/dist/core/p-33679c06.entry.js +2 -0
  215. package/dist/core/p-33679c06.entry.js.map +1 -0
  216. package/dist/core/{p-ca262cdc.entry.js → p-36508aad.entry.js} +2 -2
  217. package/dist/core/{p-7276339a.entry.js → p-3745da83.entry.js} +2 -2
  218. package/dist/core/{p-b43bd4f3.entry.js → p-3f2e77c3.entry.js} +2 -2
  219. package/dist/core/{p-24945ee5.entry.js → p-452985d9.entry.js} +2 -2
  220. package/dist/core/p-452985d9.entry.js.map +1 -0
  221. package/dist/core/{p-3c859b9e.entry.js → p-47ac6838.entry.js} +2 -2
  222. package/dist/core/{p-3d2fcf84.entry.js → p-4f1ffa39.entry.js} +2 -2
  223. package/dist/core/{p-4df42c76.entry.js → p-5759d771.entry.js} +2 -2
  224. package/dist/core/{p-32f18701.entry.js → p-5e2e6c3b.entry.js} +2 -2
  225. package/dist/core/{p-f436630b.entry.js → p-5fe96107.entry.js} +2 -2
  226. package/dist/core/{p-7dfd61bb.entry.js → p-62e22508.entry.js} +2 -2
  227. package/dist/core/{p-d49660e0.entry.js → p-6690bc04.entry.js} +2 -2
  228. package/dist/core/{p-f827e4c0.entry.js → p-6c0e2ceb.entry.js} +2 -2
  229. package/dist/core/{p-a3ab9f4c.entry.js → p-76915584.entry.js} +2 -2
  230. package/dist/core/p-76915584.entry.js.map +1 -0
  231. package/dist/core/{p-966ab920.entry.js → p-76d26018.entry.js} +2 -2
  232. package/dist/core/{p-79b71c18.entry.js → p-776671cf.entry.js} +2 -2
  233. package/dist/core/{p-434780c8.entry.js → p-7cecf5d5.entry.js} +2 -2
  234. package/dist/core/{p-88971cea.entry.js → p-85609bdd.entry.js} +2 -2
  235. package/dist/core/{p-95d3cd52.entry.js → p-86012178.entry.js} +2 -2
  236. package/dist/core/{p-2094c844.entry.js → p-8a7e7d23.entry.js} +2 -2
  237. package/dist/core/{p-aafb2c79.entry.js → p-8c90110a.entry.js} +2 -2
  238. package/dist/core/{p-9ce5f082.entry.js → p-8ea47d42.entry.js} +2 -2
  239. package/dist/core/{p-0d181ac8.entry.js → p-982a6e88.entry.js} +2 -2
  240. package/dist/core/{p-3b9f3a07.entry.js → p-98448bdb.entry.js} +2 -2
  241. package/dist/core/{p-c263542a.entry.js → p-9d01a7ad.entry.js} +2 -2
  242. package/dist/core/{p-051b8266.entry.js → p-9d540656.entry.js} +2 -2
  243. package/dist/core/p-9e3178e8.entry.js +2 -0
  244. package/dist/core/p-9e3178e8.entry.js.map +1 -0
  245. package/dist/core/{p-9fd84c69.entry.js → p-a0f9b259.entry.js} +2 -2
  246. package/dist/core/{p-7632acc6.entry.js → p-a42c2f37.entry.js} +2 -2
  247. package/dist/core/{p-fbb1fba0.entry.js → p-a6447b13.entry.js} +2 -2
  248. package/dist/core/p-aabab75f.entry.js +2 -0
  249. package/dist/core/p-aabab75f.entry.js.map +1 -0
  250. package/dist/core/{p-116b18fe.entry.js → p-ae422058.entry.js} +2 -2
  251. package/dist/core/{p-a7d52bd1.entry.js → p-b306cbc8.entry.js} +2 -2
  252. package/dist/core/p-c7590421.entry.js +2 -0
  253. package/dist/core/p-c7590421.entry.js.map +1 -0
  254. package/dist/core/{p-a162744e.entry.js → p-c7820c23.entry.js} +2 -2
  255. package/dist/core/{p-a162744e.entry.js.map → p-c7820c23.entry.js.map} +1 -1
  256. package/dist/core/{p-d78fd9f3.entry.js → p-ca8cbd6a.entry.js} +2 -2
  257. package/dist/core/{p-da4f0a58.entry.js → p-caf857de.entry.js} +2 -2
  258. package/dist/core/p-cc7bc438.entry.js +2 -0
  259. package/dist/core/p-cc7bc438.entry.js.map +1 -0
  260. package/dist/core/p-cd799087.js +2 -0
  261. package/dist/core/p-cd799087.js.map +1 -0
  262. package/dist/core/p-d32692e2.entry.js +2 -0
  263. package/dist/core/p-d32692e2.entry.js.map +1 -0
  264. package/dist/core/p-d35c7c18.js +2 -0
  265. package/dist/core/p-d35c7c18.js.map +1 -0
  266. package/dist/core/{p-27aa95e7.entry.js → p-d3856ed3.entry.js} +2 -2
  267. package/dist/core/{p-c345a874.entry.js → p-d4fdd8c1.entry.js} +2 -2
  268. package/dist/core/{p-337b6e05.entry.js → p-d5c99ec3.entry.js} +2 -2
  269. package/dist/core/p-e473bbf8.entry.js +2 -0
  270. package/dist/core/p-e473bbf8.entry.js.map +1 -0
  271. package/dist/core/p-e74f1d09.entry.js +2 -0
  272. package/dist/core/p-e74f1d09.entry.js.map +1 -0
  273. package/dist/core/p-e79e0292.entry.js +2 -0
  274. package/dist/core/p-e79e0292.entry.js.map +1 -0
  275. package/dist/core/{p-0f0509ee.entry.js → p-e84b0310.entry.js} +2 -2
  276. package/dist/core/p-e84b0310.entry.js.map +1 -0
  277. package/dist/core/{p-93c5b849.entry.js → p-f55ad6ae.entry.js} +2 -2
  278. package/dist/core/p-f8cf2978.js +2 -0
  279. package/dist/core/p-f8cf2978.js.map +1 -0
  280. package/dist/core/p-f91527a0.entry.js +2 -0
  281. package/dist/core/p-f91527a0.entry.js.map +1 -0
  282. package/dist/core/{p-d9342548.entry.js → p-fbf4e9b7.entry.js} +2 -2
  283. package/dist/esm/core.js +1 -1
  284. package/dist/esm/date-helpers-4f432e92.js +136 -0
  285. package/dist/esm/date-helpers-4f432e92.js.map +1 -0
  286. package/dist/esm/{helpers-d06dc4ed.js → helpers-7aa21b0a.js} +8 -3
  287. package/dist/esm/helpers-7aa21b0a.js.map +1 -0
  288. package/dist/esm/helpers-f328a7b6.js +262 -0
  289. package/dist/esm/helpers-f328a7b6.js.map +1 -0
  290. package/dist/esm/ic-accordion-group.entry.js +6 -2
  291. package/dist/esm/ic-accordion-group.entry.js.map +1 -1
  292. package/dist/esm/ic-accordion.entry.js +1 -1
  293. package/dist/esm/ic-alert.entry.js +1 -1
  294. package/dist/esm/ic-back-to-top.entry.js +1 -1
  295. package/dist/esm/ic-badge.entry.js +4 -3
  296. package/dist/esm/ic-badge.entry.js.map +1 -1
  297. package/dist/esm/ic-breadcrumb-group.entry.js +1 -1
  298. package/dist/esm/ic-breadcrumb.entry.js +1 -1
  299. package/dist/esm/ic-button_3.entry.js +29 -12
  300. package/dist/esm/ic-button_3.entry.js.map +1 -1
  301. package/dist/esm/ic-card.entry.js +5 -6
  302. package/dist/esm/ic-card.entry.js.map +1 -1
  303. package/dist/esm/ic-checkbox-group.entry.js +1 -1
  304. package/dist/esm/ic-checkbox.entry.js +1 -1
  305. package/dist/esm/ic-chip.entry.js +1 -1
  306. package/dist/esm/ic-data-entity.entry.js +3 -6
  307. package/dist/esm/ic-data-entity.entry.js.map +1 -1
  308. package/dist/esm/ic-data-row.entry.js +21 -35
  309. package/dist/esm/ic-data-row.entry.js.map +1 -1
  310. package/dist/esm/ic-date-input.entry.js +1069 -0
  311. package/dist/esm/ic-date-input.entry.js.map +1 -0
  312. package/dist/esm/ic-date-picker.entry.js +1039 -0
  313. package/dist/esm/ic-date-picker.entry.js.map +1 -0
  314. package/dist/esm/ic-dialog.entry.js +1 -1
  315. package/dist/esm/ic-divider.entry.js +1 -1
  316. package/dist/esm/ic-empty-state.entry.js +1 -1
  317. package/dist/esm/ic-footer-link-group.entry.js +1 -1
  318. package/dist/esm/ic-footer-link.entry.js +1 -1
  319. package/dist/esm/ic-footer.entry.js +1 -1
  320. package/dist/esm/ic-hero.entry.js +1 -1
  321. package/dist/esm/ic-horizontal-scroll.entry.js +1 -1
  322. package/dist/esm/ic-input-component-container_4.entry.js +143 -0
  323. package/dist/esm/ic-input-component-container_4.entry.js.map +1 -0
  324. package/dist/esm/ic-link.entry.js +1 -1
  325. package/dist/esm/ic-menu-group.entry.js +1 -1
  326. package/dist/esm/ic-menu-item.entry.js +1 -1
  327. package/dist/esm/ic-menu-with-multi.entry.js +2595 -0
  328. package/dist/esm/ic-menu-with-multi.entry.js.map +1 -0
  329. package/dist/esm/{ic-input-component-container_3.entry.js → ic-menu.entry.js} +10 -70
  330. package/dist/esm/ic-menu.entry.js.map +1 -0
  331. package/dist/esm/ic-navigation-button.entry.js +1 -1
  332. package/dist/esm/ic-navigation-group.entry.js +1 -1
  333. package/dist/esm/ic-navigation-item.entry.js +1 -1
  334. package/dist/esm/ic-navigation-menu.entry.js +1 -1
  335. package/dist/esm/ic-page-header.entry.js +1 -1
  336. package/dist/esm/ic-pagination-bar.entry.js +1 -17
  337. package/dist/esm/ic-pagination-bar.entry.js.map +1 -1
  338. package/dist/esm/ic-pagination_4.entry.js +21 -13
  339. package/dist/esm/ic-pagination_4.entry.js.map +1 -1
  340. package/dist/esm/ic-popover-menu.entry.js +1 -1
  341. package/dist/esm/ic-popover-menu.entry.js.map +1 -1
  342. package/dist/esm/ic-radio-group.entry.js +1 -1
  343. package/dist/esm/ic-radio-option.entry.js +1 -1
  344. package/dist/esm/ic-search-bar.entry.js +1 -1
  345. package/dist/esm/ic-search-bar.entry.js.map +1 -1
  346. package/dist/esm/ic-select-with-multi.entry.js +820 -0
  347. package/dist/esm/ic-select-with-multi.entry.js.map +1 -0
  348. package/dist/esm/ic-side-navigation.entry.js +1 -1
  349. package/dist/esm/ic-status-tag.entry.js +1 -1
  350. package/dist/esm/ic-step.entry.js +1 -1
  351. package/dist/esm/ic-stepper.entry.js +1 -1
  352. package/dist/esm/ic-switch.entry.js +1 -1
  353. package/dist/esm/ic-tab-group.entry.js +1 -1
  354. package/dist/esm/ic-tab-panel.entry.js +1 -1
  355. package/dist/esm/ic-tab.entry.js +1 -1
  356. package/dist/esm/ic-theme.entry.js +1 -1
  357. package/dist/esm/ic-toast.entry.js +1 -1
  358. package/dist/esm/ic-toggle-button-group.entry.js +180 -0
  359. package/dist/esm/ic-toggle-button-group.entry.js.map +1 -0
  360. package/dist/esm/ic-toggle-button.entry.js +6 -3
  361. package/dist/esm/ic-toggle-button.entry.js.map +1 -1
  362. package/dist/esm/ic-top-navigation.entry.js +1 -1
  363. package/dist/esm/ic-typography.entry.js +1 -1
  364. package/dist/esm/index-93509377.js +24 -4
  365. package/dist/esm/loader.js +1 -1
  366. package/dist/types/components/ic-date-input/ic-date-input.d.ts +242 -0
  367. package/dist/types/components/ic-date-input/story-data.d.ts +1 -0
  368. package/dist/types/components/ic-date-input/test/helpers/ic-date-input.d.ts +23 -0
  369. package/dist/types/components/ic-date-picker/ic-date-picker.d.ts +251 -0
  370. package/dist/types/components/ic-date-picker/ic-day-button.d.ts +16 -0
  371. package/dist/types/components/ic-date-picker/ic-month-picker.d.ts +14 -0
  372. package/dist/types/components/ic-date-picker/ic-year-picker.d.ts +16 -0
  373. package/dist/types/components/ic-date-picker/story-data.d.ts +22 -0
  374. package/dist/types/components/ic-date-picker/test/a11y/ic-date-picker.test.a11y.d.ts +1 -0
  375. package/dist/types/components/ic-menu-with-multi/ic-menu.d.ts +208 -0
  376. package/dist/types/components/ic-select-with-multi/ic-select.d.ts +289 -0
  377. package/dist/types/components/ic-select-with-multi/story-data.d.ts +32 -0
  378. package/dist/types/components/ic-select-with-multi/test/a11y/ic-select.test.a11y.d.ts +1 -0
  379. package/dist/types/components.d.ts +966 -0
  380. package/dist/types/utils/constants.d.ts +38 -0
  381. package/dist/types/utils/date-helpers.d.ts +22 -0
  382. package/dist/types/utils/helpers.d.ts +133 -2
  383. package/dist/types/utils/types.d.ts +107 -0
  384. package/hydrate/index.js +12358 -6070
  385. package/package.json +3 -3
  386. package/dist/cjs/helpers-00b08718.js.map +0 -1
  387. package/dist/cjs/ic-input-component-container_3.cjs.entry.js.map +0 -1
  388. package/dist/cjs/ic-input-label_2.cjs.entry.js +0 -86
  389. package/dist/cjs/ic-input-label_2.cjs.entry.js.map +0 -1
  390. package/dist/core/p-0f0509ee.entry.js.map +0 -1
  391. package/dist/core/p-24945ee5.entry.js.map +0 -1
  392. package/dist/core/p-28fb7cca.entry.js.map +0 -1
  393. package/dist/core/p-2aad58b6.js +0 -2
  394. package/dist/core/p-2aad58b6.js.map +0 -1
  395. package/dist/core/p-38314d45.entry.js +0 -2
  396. package/dist/core/p-38314d45.entry.js.map +0 -1
  397. package/dist/core/p-5e94fae8.entry.js.map +0 -1
  398. package/dist/core/p-6de46cb7.entry.js.map +0 -1
  399. package/dist/core/p-7b849cb5.entry.js +0 -2
  400. package/dist/core/p-7b849cb5.entry.js.map +0 -1
  401. package/dist/core/p-9fdd7d73.entry.js +0 -2
  402. package/dist/core/p-9fdd7d73.entry.js.map +0 -1
  403. package/dist/core/p-a3ab9f4c.entry.js.map +0 -1
  404. package/dist/core/p-c9b11488.entry.js +0 -2
  405. package/dist/core/p-c9b11488.entry.js.map +0 -1
  406. package/dist/core/p-f163a406.entry.js +0 -2
  407. package/dist/core/p-f163a406.entry.js.map +0 -1
  408. package/dist/esm/helpers-d06dc4ed.js.map +0 -1
  409. package/dist/esm/ic-input-component-container_3.entry.js.map +0 -1
  410. package/dist/esm/ic-input-label_2.entry.js +0 -81
  411. package/dist/esm/ic-input-label_2.entry.js.map +0 -1
  412. /package/dist/core/{p-a2f366c7.entry.js.map → p-1832f4b5.entry.js.map} +0 -0
  413. /package/dist/core/{p-ff1d23cd.entry.js.map → p-1ce75941.entry.js.map} +0 -0
  414. /package/dist/core/{p-5746577f.entry.js.map → p-2e2e0099.entry.js.map} +0 -0
  415. /package/dist/core/{p-ca262cdc.entry.js.map → p-36508aad.entry.js.map} +0 -0
  416. /package/dist/core/{p-7276339a.entry.js.map → p-3745da83.entry.js.map} +0 -0
  417. /package/dist/core/{p-b43bd4f3.entry.js.map → p-3f2e77c3.entry.js.map} +0 -0
  418. /package/dist/core/{p-3c859b9e.entry.js.map → p-47ac6838.entry.js.map} +0 -0
  419. /package/dist/core/{p-3d2fcf84.entry.js.map → p-4f1ffa39.entry.js.map} +0 -0
  420. /package/dist/core/{p-4df42c76.entry.js.map → p-5759d771.entry.js.map} +0 -0
  421. /package/dist/core/{p-32f18701.entry.js.map → p-5e2e6c3b.entry.js.map} +0 -0
  422. /package/dist/core/{p-f436630b.entry.js.map → p-5fe96107.entry.js.map} +0 -0
  423. /package/dist/core/{p-7dfd61bb.entry.js.map → p-62e22508.entry.js.map} +0 -0
  424. /package/dist/core/{p-d49660e0.entry.js.map → p-6690bc04.entry.js.map} +0 -0
  425. /package/dist/core/{p-f827e4c0.entry.js.map → p-6c0e2ceb.entry.js.map} +0 -0
  426. /package/dist/core/{p-966ab920.entry.js.map → p-76d26018.entry.js.map} +0 -0
  427. /package/dist/core/{p-79b71c18.entry.js.map → p-776671cf.entry.js.map} +0 -0
  428. /package/dist/core/{p-434780c8.entry.js.map → p-7cecf5d5.entry.js.map} +0 -0
  429. /package/dist/core/{p-88971cea.entry.js.map → p-85609bdd.entry.js.map} +0 -0
  430. /package/dist/core/{p-95d3cd52.entry.js.map → p-86012178.entry.js.map} +0 -0
  431. /package/dist/core/{p-2094c844.entry.js.map → p-8a7e7d23.entry.js.map} +0 -0
  432. /package/dist/core/{p-aafb2c79.entry.js.map → p-8c90110a.entry.js.map} +0 -0
  433. /package/dist/core/{p-9ce5f082.entry.js.map → p-8ea47d42.entry.js.map} +0 -0
  434. /package/dist/core/{p-0d181ac8.entry.js.map → p-982a6e88.entry.js.map} +0 -0
  435. /package/dist/core/{p-3b9f3a07.entry.js.map → p-98448bdb.entry.js.map} +0 -0
  436. /package/dist/core/{p-c263542a.entry.js.map → p-9d01a7ad.entry.js.map} +0 -0
  437. /package/dist/core/{p-051b8266.entry.js.map → p-9d540656.entry.js.map} +0 -0
  438. /package/dist/core/{p-9fd84c69.entry.js.map → p-a0f9b259.entry.js.map} +0 -0
  439. /package/dist/core/{p-7632acc6.entry.js.map → p-a42c2f37.entry.js.map} +0 -0
  440. /package/dist/core/{p-fbb1fba0.entry.js.map → p-a6447b13.entry.js.map} +0 -0
  441. /package/dist/core/{p-116b18fe.entry.js.map → p-ae422058.entry.js.map} +0 -0
  442. /package/dist/core/{p-a7d52bd1.entry.js.map → p-b306cbc8.entry.js.map} +0 -0
  443. /package/dist/core/{p-d78fd9f3.entry.js.map → p-ca8cbd6a.entry.js.map} +0 -0
  444. /package/dist/core/{p-da4f0a58.entry.js.map → p-caf857de.entry.js.map} +0 -0
  445. /package/dist/core/{p-27aa95e7.entry.js.map → p-d3856ed3.entry.js.map} +0 -0
  446. /package/dist/core/{p-c345a874.entry.js.map → p-d4fdd8c1.entry.js.map} +0 -0
  447. /package/dist/core/{p-337b6e05.entry.js.map → p-d5c99ec3.entry.js.map} +0 -0
  448. /package/dist/core/{p-93c5b849.entry.js.map → p-f55ad6ae.entry.js.map} +0 -0
  449. /package/dist/core/{p-d9342548.entry.js.map → p-fbf4e9b7.entry.js.map} +0 -0
@@ -0,0 +1,1069 @@
1
+ import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-93509377.js';
2
+ import { q as isEmptyString, s as stringEnumToArray, k as getInputDescribedByText, r as removeFormResetListener, h as addFormResetListener, o as onComponentRequiredPropUndefined, t as isNumeric, p as IcInformationStatus, j as renderHiddenInput, m as IcThemeForegroundEnum, I as IcDayNames, a as IcDateInputMonths } from './helpers-f328a7b6.js';
3
+ import { i as isDateOrEpoch, j as convertToDoubleDigits, s as splitStringDate, h as createDate, k as extractDateFromZuluDateTime } from './date-helpers-4f432e92.js';
4
+
5
+ const Clear = `<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
6
+ <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"/>
7
+ </svg>
8
+ `;
9
+
10
+ const Calendar = `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
11
+ <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"/>
12
+ </svg>`;
13
+
14
+ 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)}";
15
+
16
+ let inputIds = 0;
17
+ const DateInput = class {
18
+ constructor(hostRef) {
19
+ registerInstance(this, hostRef);
20
+ this.calendarButtonClicked = createEvent(this, "calendarButtonClicked", 7);
21
+ this.icBlur = createEvent(this, "icBlur", 7);
22
+ this.icChange = createEvent(this, "icChange", 7);
23
+ this.icFocus = createEvent(this, "icFocus", 7);
24
+ this.ARIA_INVALID = "aria-invalid";
25
+ this.ARIA_LABEL = "aria-label";
26
+ this.ARIA_LABELLED_BY = "aria-labelledby";
27
+ this.EVENT_OBJECT_STRING = "[object Event]";
28
+ this.FIT_TO_VALUE = "fit-to-value";
29
+ this.initialValue = this.value;
30
+ this.INPUT_EVENT_OBJECT_STRING = "[object InputEvent]";
31
+ this.inputsInOrder = [];
32
+ this.isAfterMax = false;
33
+ this.isBeforeMin = false;
34
+ this.isDateSetFromKeyboardEvent = false;
35
+ this.isDisabledDate = false;
36
+ this.isValidDay = true;
37
+ this.isValidMonth = true;
38
+ this.isValidDate = true;
39
+ this.isZuluTime = false;
40
+ this.KEYBOARD_EVENT_OBJECT_STRING = "[object KeyboardEvent]";
41
+ this.MAX_DAY = 31;
42
+ this.MAX_MONTH = 12;
43
+ this.previousSelectedDate = null;
44
+ this.selectedDate = null;
45
+ this.setInputPasteValue = (input, pastedValue) => {
46
+ const inputEl = input;
47
+ inputEl.value = pastedValue;
48
+ inputEl.classList.add(this.FIT_TO_VALUE);
49
+ };
50
+ this.checkSingleCopiedValueIsValid = (input, pastedValue) => {
51
+ let isValid = false;
52
+ const value = Number(pastedValue);
53
+ switch (input) {
54
+ case this.dayInputEl:
55
+ isValid = value >= 1 && value <= this.MAX_DAY;
56
+ break;
57
+ case this.monthInputEl:
58
+ isValid = value >= 1 && value <= this.MAX_MONTH;
59
+ break;
60
+ case this.yearInputEl:
61
+ isValid = true;
62
+ break;
63
+ default:
64
+ isValid = false;
65
+ break;
66
+ }
67
+ return isValid;
68
+ };
69
+ /**
70
+ * Using Object.prototype.string to determine type if event from user
71
+ * @param event - event object used to differentiate keyboard, generic or input event
72
+ * @returns boolean
73
+ */
74
+ this.isKeyboardOrEvent = (event) => {
75
+ return (Object.prototype.toString.call(event) === this.EVENT_OBJECT_STRING ||
76
+ Object.prototype.toString.call(event) ===
77
+ this.KEYBOARD_EVENT_OBJECT_STRING);
78
+ };
79
+ this.setDateValidity = () => {
80
+ if (!isEmptyString(this.day)) {
81
+ this.isValidDay = +this.day > this.MAX_DAY ? false : true;
82
+ }
83
+ else {
84
+ this.isValidDay = true;
85
+ }
86
+ if (!isEmptyString(this.month)) {
87
+ this.isValidMonth = +this.month > this.MAX_MONTH ? false : true;
88
+ }
89
+ else {
90
+ this.isValidMonth = true;
91
+ }
92
+ };
93
+ this.handleInput = (event) => {
94
+ const inputEvent = event;
95
+ const input = event.target;
96
+ if (input !== this.yearInputEl) {
97
+ // Only auto-format if input event is not a character being deleted
98
+ // and not as user is changing value using up / down keys
99
+ if (inputEvent.inputType !== "deleteContentBackward" &&
100
+ !this.preventAutoFormatting) {
101
+ if (input.value.length === 1 &&
102
+ ((input === this.dayInputEl && +input.value >= 4) ||
103
+ (input === this.monthInputEl && +input.value >= 2)) &&
104
+ +input.value <= 9) {
105
+ this.setInputValue(input);
106
+ this.notifyScreenReader(input, event);
107
+ this.moveToNextInput(input);
108
+ }
109
+ if (input.value.length === 2) {
110
+ if (+input.value === 0) {
111
+ input.value = "01";
112
+ }
113
+ this.setInputValue(input);
114
+ this.setPreventInput(input, true);
115
+ this.notifyScreenReader(input, event);
116
+ this.moveToNextInput(input);
117
+ }
118
+ else {
119
+ this.setPreventInput(input, false);
120
+ }
121
+ }
122
+ else if (this.preventAutoFormatting) {
123
+ /**
124
+ * Using arrow keys prevents auto formatting so need to deal with
125
+ * switching from arrow keys to inputting numbers
126
+ **/
127
+ if (input.value.length === 2 && !this.isKeyboardOrEvent(event)) {
128
+ this.setInputValue(input);
129
+ this.setPreventInput(input, true);
130
+ this.moveToNextInput(input);
131
+ }
132
+ else {
133
+ this.setInputValue(input);
134
+ }
135
+ }
136
+ if (input.value.length !== 2) {
137
+ this.setPreventInput(input, false);
138
+ }
139
+ }
140
+ else {
141
+ if (input.value.length === 4) {
142
+ this.setInputValue(input);
143
+ if (Object.prototype.toString.call(event) !== this.EVENT_OBJECT_STRING) {
144
+ this.moveToNextInput(input);
145
+ }
146
+ this.setPreventInput(input, true);
147
+ }
148
+ else {
149
+ this.setInputValue(input, true);
150
+ this.setPreventInput(input, false);
151
+ }
152
+ }
153
+ // Add / remove class to make input width match size of value i.e. 2 digits' width for day / month, 4 for year
154
+ this.setFitToValueStyling(input);
155
+ if (input.value.length === 0) {
156
+ this.setInputValue(input, true);
157
+ this.setValidationMessage();
158
+ }
159
+ this.notifyScreenReader(input, event);
160
+ };
161
+ this.handleKeyDown = (event, isInputPrevented) => {
162
+ const input = event.target;
163
+ const eventKey = event.key.toLowerCase();
164
+ // Regex required due to FF allowing all characters as values for number text field.
165
+ const regex = /-?\d*\.?\d+(e[-+]?\d+)?|[/-]|arrowup|arrowdown|arrowleft|arrowright|shift|tab|backspace|delete/;
166
+ if (!regex.test(eventKey) &&
167
+ !((event.ctrlKey || event.metaKey) &&
168
+ (eventKey === "v" || eventKey === "c"))) {
169
+ event.preventDefault();
170
+ }
171
+ switch (eventKey) {
172
+ case "/":
173
+ case "-":
174
+ case ".":
175
+ event.preventDefault();
176
+ this.setPasteInvalidText();
177
+ this.moveToNextInput(input);
178
+ break;
179
+ case "arrowright":
180
+ case "arrowleft":
181
+ event.preventDefault();
182
+ this.handleLeftRightArrowKeyPress(input, eventKey);
183
+ break;
184
+ case "arrowup":
185
+ case "arrowdown":
186
+ this.preventAutoFormatting = true;
187
+ this.handleUpDownArrowKeyPress(input, event);
188
+ break;
189
+ }
190
+ this.preventInput(event, isInputPrevented);
191
+ this.isDateSetFromKeyboardEvent = true;
192
+ };
193
+ this.handleFocus = (event) => {
194
+ // Highlight / select all characters in input for easy replacement
195
+ const input = event.target;
196
+ input.select();
197
+ };
198
+ this.handleBlur = (event) => {
199
+ const input = event.target;
200
+ this.setPasteInvalidText();
201
+ this.autocompleteInput(input);
202
+ };
203
+ this.handleLeftRightArrowKeyPress = (input, key) => {
204
+ if (key === "arrowright") {
205
+ this.moveToNextInput(input);
206
+ }
207
+ else {
208
+ this.moveToPreviousInput(input);
209
+ }
210
+ this.setPasteInvalidText();
211
+ };
212
+ this.notifyScreenReaderSelectedDate = () => {
213
+ const dayNames = stringEnumToArray(IcDayNames);
214
+ const months = stringEnumToArray(IcDateInputMonths);
215
+ this.selectedDateInfoEl.textContent = `Selected date: ${dayNames[this.selectedDate.getDay()]}, ${this.selectedDate.getDate()} ${months[this.selectedDate.getMonth()]} ${this.selectedDate.getFullYear()}`;
216
+ };
217
+ this.handleUpDownArrowKeyPress = (input, event) => {
218
+ const minValue = input === this.yearInputEl ? 0 : 1;
219
+ let maxValue;
220
+ switch (input) {
221
+ case this.dayInputEl:
222
+ maxValue = this.MAX_DAY;
223
+ break;
224
+ case this.monthInputEl:
225
+ maxValue = this.MAX_MONTH;
226
+ break;
227
+ case this.yearInputEl:
228
+ maxValue = 9999;
229
+ }
230
+ // Make value loop round when min / max reached
231
+ if (input === null || input === void 0 ? void 0 : input.value) {
232
+ if (event.key === "ArrowUp") {
233
+ if (+input.value === maxValue) {
234
+ event.preventDefault();
235
+ input.value = `0${minValue}`;
236
+ }
237
+ else {
238
+ input.value =
239
+ +input.value + 1 < 10
240
+ ? `0${+input.value + 1}`
241
+ : (+input.value + 1).toString();
242
+ }
243
+ this.notifyScreenReader(input, event);
244
+ }
245
+ if (event.key === "ArrowDown") {
246
+ if (+input.value === minValue) {
247
+ event.preventDefault();
248
+ input.value = maxValue.toString();
249
+ }
250
+ else {
251
+ input.value =
252
+ +input.value - 1 < 10
253
+ ? `0${+input.value - 1}`
254
+ : (+input.value - 1).toString();
255
+ }
256
+ this.notifyScreenReader(input, event);
257
+ }
258
+ }
259
+ else {
260
+ if (event.key === "ArrowDown") {
261
+ event.preventDefault();
262
+ if (input === this.yearInputEl) {
263
+ input.value = new Date().getFullYear().toString();
264
+ }
265
+ else {
266
+ input.value = maxValue.toString();
267
+ }
268
+ this.notifyScreenReader(input, event);
269
+ }
270
+ else if (event.key === "ArrowUp") {
271
+ event.preventDefault();
272
+ if (input === this.yearInputEl) {
273
+ input.value = new Date().getFullYear().toString();
274
+ }
275
+ else {
276
+ input.value = `0${minValue}`;
277
+ }
278
+ this.notifyScreenReader(input, event);
279
+ }
280
+ }
281
+ this.setInputValue(input);
282
+ this.setFitToValueStyling(input);
283
+ };
284
+ this.handleDateChange = (force) => {
285
+ // Prevent icChange being emitted when each individual input is changed
286
+ // This method is used within componentWillUpdate instead of using @Watch('value');
287
+ if (force || this.selectedDate !== this.previousSelectedDate) {
288
+ if (this.value) {
289
+ this.inputsInOrder.forEach((input) => {
290
+ input.classList.add(this.FIT_TO_VALUE);
291
+ });
292
+ }
293
+ if (this.day && this.month && this.year && this.invalidDateText === "") {
294
+ this.setValueAndEmitChange(this.selectedDate);
295
+ this.notifyScreenReaderSelectedDate();
296
+ }
297
+ else {
298
+ this.setValueAndEmitChange(null);
299
+ this.selectedDateInfoEl.textContent = "";
300
+ }
301
+ this.previousSelectedDate = this.selectedDate;
302
+ if (!this.isDateSetFromKeyboardEvent) {
303
+ this.updateInputValues(this.day, this.month, this.year);
304
+ }
305
+ }
306
+ };
307
+ this.slicePastedDate = (valueLength, datePart) => {
308
+ return datePart.length > valueLength
309
+ ? datePart.slice(0, valueLength)
310
+ : datePart;
311
+ };
312
+ this.isPastedStringDateValid = (value) => {
313
+ if (/\d+-\d+-\d+$/.test(value) ||
314
+ /\d+\/\d+\/\d+/.test(value) ||
315
+ /\d+\.\d+\.\d+/.test(value)) {
316
+ return true;
317
+ }
318
+ if (/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}(?::[0-9]{2}(?:\.\d+)?)?Z/.test(value)) {
319
+ this.isZuluTime = true;
320
+ return true;
321
+ }
322
+ return false;
323
+ };
324
+ // Set value of each input to value of pasted date part
325
+ // Allows formats separated by '-' or '/'
326
+ this.handlePaste = (event) => {
327
+ event.preventDefault();
328
+ const pastedValue = event.clipboardData.getData("Text");
329
+ const isValidDate = this.isPastedStringDateValid(pastedValue);
330
+ this.setPastedValueAndValidation(isValidDate, pastedValue, event);
331
+ };
332
+ this.setDate = (date) => {
333
+ if (date === null || date === "" || date === undefined) {
334
+ this.day = null;
335
+ this.month = null;
336
+ this.year = null;
337
+ this.inputsInOrder.forEach((input) => {
338
+ input.classList.remove(this.FIT_TO_VALUE);
339
+ this.setPreventInput(input, false);
340
+ });
341
+ this.handleDateChange(true);
342
+ }
343
+ else {
344
+ if (isDateOrEpoch(date)) {
345
+ let newDate;
346
+ if (typeof date === "string") {
347
+ // Checking if epoch date time
348
+ newDate = new Date(+date);
349
+ }
350
+ else {
351
+ newDate = date;
352
+ }
353
+ this.day = convertToDoubleDigits(newDate.getDate());
354
+ this.month = convertToDoubleDigits(newDate.getMonth() + 1);
355
+ this.year = newDate.getFullYear().toString();
356
+ }
357
+ else if (typeof date === "string") {
358
+ const defaultDateArray = splitStringDate(date, this.dateFormat);
359
+ this.year = defaultDateArray[0];
360
+ this.month = defaultDateArray[1];
361
+ this.day = defaultDateArray[2];
362
+ }
363
+ }
364
+ this.setValidationMessage();
365
+ };
366
+ this.formatMinMax = (date) => {
367
+ let formattedDate;
368
+ const day = convertToDoubleDigits(date.getDate());
369
+ const month = convertToDoubleDigits(date.getMonth() + 1);
370
+ const year = date.getFullYear();
371
+ switch (this.dateFormat) {
372
+ case "DD/MM/YYYY":
373
+ formattedDate = `${day}/${month}/${year}`;
374
+ break;
375
+ case "MM/DD/YYYY":
376
+ formattedDate = `${month}/${day}/${year}`;
377
+ break;
378
+ case "YYYY/MM/DD":
379
+ formattedDate = `${year}/${month}/${day}`;
380
+ break;
381
+ }
382
+ return formattedDate;
383
+ };
384
+ this.updateInputValues = (day, month, year) => {
385
+ this.dayInputEl.value = day;
386
+ this.monthInputEl.value = month;
387
+ this.yearInputEl.value = year;
388
+ };
389
+ // Set value in state based on input
390
+ this.setInputValue = (input, clear = false) => {
391
+ const newValue = clear ? "" : input.value;
392
+ switch (input) {
393
+ case this.dayInputEl:
394
+ this.day = newValue;
395
+ break;
396
+ case this.monthInputEl:
397
+ this.month = newValue;
398
+ break;
399
+ case this.yearInputEl:
400
+ if (this.year !== newValue) {
401
+ this.year = newValue;
402
+ }
403
+ }
404
+ this.setValidationMessage();
405
+ };
406
+ this.setValidationMessage = () => {
407
+ this.setDateValidity();
408
+ if (!isEmptyString(this.day) &&
409
+ !isEmptyString(this.month) &&
410
+ !isEmptyString(this.year)) {
411
+ // Check whether date actually exists
412
+ // (used https://www.hectane.com/blog/javascript-date-validation-with-leap-year)
413
+ this.selectedDate = this.convertToDate(this.year, this.month, this.day);
414
+ this.isValidDate =
415
+ +this.selectedDate !== 0 && this.selectedDate.getDate() == +this.day;
416
+ this.isDisabledDate = this.isSelectedDateDisabled();
417
+ if (!this.isValidDate || this.isDisabledDate) {
418
+ this.inputsInOrder.forEach((input) => input.setAttribute(this.ARIA_INVALID, "true"));
419
+ }
420
+ else {
421
+ this.inputsInOrder.forEach((input) => input.removeAttribute(this.ARIA_INVALID));
422
+ }
423
+ }
424
+ else {
425
+ this.selectedDate = null;
426
+ }
427
+ if (!(this.isValidDay && this.isValidMonth && this.isValidDate)) {
428
+ this.invalidDateText = "Please enter a valid date.";
429
+ }
430
+ else if (this.isDisabledDate && this.selectedDate !== null) {
431
+ if (this.isBeforeMin) {
432
+ if (this.disablePast) {
433
+ this.invalidDateText = this.disablePastMessage;
434
+ }
435
+ else {
436
+ this.invalidDateText = `Please enter a date after ${this.formatMinMax(this.minDate)}.`;
437
+ }
438
+ }
439
+ else if (this.isAfterMax) {
440
+ if (this.disableFuture) {
441
+ this.invalidDateText = this.disableFutureMessage;
442
+ }
443
+ else {
444
+ this.invalidDateText = `Please enter a date before ${this.formatMinMax(this.maxDate)}.`;
445
+ }
446
+ }
447
+ else if (this.disableDays.length !== 0) {
448
+ this.invalidDateText = this.disableDaysMessage;
449
+ }
450
+ else {
451
+ if (this.disablePast) {
452
+ this.invalidDateText = this.disablePastMessage;
453
+ }
454
+ if (this.disableFuture) {
455
+ this.invalidDateText = this.disableFutureMessage;
456
+ }
457
+ }
458
+ }
459
+ else {
460
+ this.invalidDateText = "";
461
+ }
462
+ };
463
+ // Set refs to the input elements in the order they are displayed (based on the dateFormat)
464
+ this.setInputsInOrder = () => {
465
+ const inputs = this.el.shadowRoot.querySelectorAll("input");
466
+ inputs.forEach((input) => this.inputsInOrder.push(input));
467
+ };
468
+ // Includes text usually added using aria-describedby
469
+ // (which doesn't work on input component container)
470
+ this.setAriaLabelledBy = () => {
471
+ var _a;
472
+ if (this.disabled &&
473
+ !isEmptyString((_a = this.inputCompContainerEl) === null || _a === void 0 ? void 0 : _a.getAttribute(this.ARIA_LABELLED_BY))) {
474
+ this.removeAriaLabelledBy();
475
+ return;
476
+ }
477
+ if (this.disabled) {
478
+ return;
479
+ }
480
+ const labelEl = this.el.shadowRoot.querySelector("label");
481
+ const labelId = `${this.inputId}-label`;
482
+ if (labelEl !== null && labelEl !== undefined) {
483
+ labelEl.id = labelId;
484
+ const hasValidation = (!isEmptyString(this.validationStatus) &&
485
+ !isEmptyString(this.validationText)) ||
486
+ !isEmptyString(this.invalidDateText);
487
+ const labelledBy = `${labelId} ${this.screenReaderInfoId} ${getInputDescribedByText(this.inputId, this.helperText !== "" && this.helperText !== this.defaultHelperText, hasValidation)} ${this.selectedDate ? this.selectedDateInfoId : ""} ${this.assistiveHintId}`;
488
+ this.inputCompContainerEl.setAttribute(this.ARIA_LABELLED_BY, labelledBy);
489
+ }
490
+ };
491
+ // Sets boolean for each input, used to limit the number of characters within each field (2 for day / month, 4 for year)
492
+ this.setPreventInput = (input, isPrevented) => {
493
+ switch (input) {
494
+ case this.dayInputEl:
495
+ this.preventDayInput = isPrevented;
496
+ break;
497
+ case this.monthInputEl:
498
+ this.preventMonthInput = isPrevented;
499
+ break;
500
+ case this.yearInputEl:
501
+ this.preventYearInput = isPrevented;
502
+ }
503
+ };
504
+ // Get input based on letter representing each date part ("D", "M" or "Y")
505
+ // (retrieved from dateFormat)
506
+ this.getInputFromDatePart = (datePart) => {
507
+ 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) }));
508
+ 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) }));
509
+ 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) }));
510
+ let input;
511
+ switch (datePart) {
512
+ case "D":
513
+ input = dayInput;
514
+ break;
515
+ case "M":
516
+ input = monthInput;
517
+ break;
518
+ case "Y":
519
+ input = yearInput;
520
+ }
521
+ return input;
522
+ };
523
+ // Get input elements in order of chosen date format
524
+ this.getInputsInOrder = () => {
525
+ const dateParts = this.dateFormat.split("/");
526
+ const inputsInOrder = [];
527
+ dateParts.forEach((part) => {
528
+ inputsInOrder.push(this.getInputFromDatePart(part.substring(0, 1)));
529
+ });
530
+ return inputsInOrder;
531
+ };
532
+ // To add to the end of assistive hint to make it clearer that each date part has its own input
533
+ // that can be changed individually
534
+ this.getDescOfInputsOrder = () => {
535
+ let description;
536
+ switch (this.dateFormat) {
537
+ case "DD/MM/YYYY":
538
+ description = "day, month, and year";
539
+ break;
540
+ case "MM/DD/YYYY":
541
+ description = "month, day, and year";
542
+ break;
543
+ case "YYYY/MM/DD":
544
+ description = "year, month, and day";
545
+ }
546
+ return description;
547
+ };
548
+ // Add 'required' or 'invalid data' to span used in aria-labelledby
549
+ // Many ARIA attributes aren't read out by screen reader when on the input component container
550
+ this.getScreenReaderInfo = (validationStatus) => {
551
+ let inputDescriptors = "";
552
+ if (this.required) {
553
+ inputDescriptors += "required";
554
+ }
555
+ if (validationStatus === IcInformationStatus.Error) {
556
+ inputDescriptors += " invalid data";
557
+ }
558
+ return inputDescriptors === "" ? "" : inputDescriptors + ", ";
559
+ };
560
+ // Prevent non-number characters being entered
561
+ // ('e' or '.' - which are usually allowed in <input type="number">)
562
+ // And limit the number of characters within each field (2 for day / month, 4 for year)
563
+ // (because 'maxlength' doesn't work on <input type="number">)
564
+ this.preventInput = (event, isInputPrevented) => {
565
+ const key = event.key;
566
+ const input = event.target;
567
+ let selectedString;
568
+ if (input) {
569
+ selectedString = input.value.substring(input.selectionStart, input.selectionEnd);
570
+ }
571
+ if (key === "e" ||
572
+ key === "." ||
573
+ key === "-" ||
574
+ (event.key >= "0" &&
575
+ event.key <= "9" &&
576
+ isInputPrevented &&
577
+ !selectedString)) {
578
+ event.preventDefault();
579
+ }
580
+ };
581
+ // Get whether date has been disabled using disableFuture or disablePast prop, but always allow current day
582
+ // Consider using dateClamp and inDateRange
583
+ this.isSelectedDateDisabled = () => {
584
+ const currentDate = new Date();
585
+ this.isAfterMax = false;
586
+ this.isBeforeMin = false;
587
+ let disabled = false;
588
+ const isNotToday = this.selectedDate.toDateString() !== currentDate.toDateString();
589
+ if (this.minDate && this.selectedDate < this.minDate && isNotToday) {
590
+ this.isBeforeMin = true;
591
+ disabled = true;
592
+ }
593
+ if (this.maxDate && this.selectedDate > this.maxDate && isNotToday) {
594
+ this.isAfterMax = true;
595
+ disabled = true;
596
+ }
597
+ if (this.disableDays.includes(this.selectedDate.getDay())) {
598
+ disabled = true;
599
+ }
600
+ if (((this.disablePast && this.selectedDate < currentDate) ||
601
+ (this.disableFuture && this.selectedDate > currentDate)) &&
602
+ isNotToday) {
603
+ disabled = true;
604
+ }
605
+ return disabled;
606
+ };
607
+ this.moveToNextInput = (currentInput) => {
608
+ const currentInputPos = this.inputsInOrder.findIndex((input) => input === currentInput);
609
+ const nextInput = this.inputsInOrder[currentInputPos + 1];
610
+ this.preventAutoFormatting = false;
611
+ if (nextInput) {
612
+ nextInput.focus();
613
+ }
614
+ };
615
+ this.moveToPreviousInput = (currentInput) => {
616
+ const currentInputPos = this.inputsInOrder.findIndex((input) => input === currentInput);
617
+ this.preventAutoFormatting = false;
618
+ if (this.inputsInOrder[currentInputPos - 1]) {
619
+ this.inputsInOrder[currentInputPos - 1].focus();
620
+ }
621
+ };
622
+ this.autocompleteInput = (input) => {
623
+ if (input === this.yearInputEl) {
624
+ this.autocompleteYear();
625
+ }
626
+ else {
627
+ const inputValue = input.value;
628
+ // Autocomplete input as 2 characters (leading zero) when only 1 character entered (for day and month)
629
+ if (inputValue.length === 1) {
630
+ if (+inputValue === 0) {
631
+ input.value = "01";
632
+ }
633
+ else {
634
+ input.value = `0${inputValue}`;
635
+ }
636
+ }
637
+ }
638
+ if (input.value) {
639
+ this.setInputValue(input);
640
+ }
641
+ };
642
+ // Autocomplete year as current millennium when fewer than 4 characters entered
643
+ this.autocompleteYear = () => {
644
+ const inputValue = this.yearInputEl.value;
645
+ const yearNumbers = ["2", "0", "0"];
646
+ let autocompletedInput = "";
647
+ if (inputValue) {
648
+ yearNumbers.forEach((number, index) => {
649
+ if (inputValue.length + index <= 3) {
650
+ autocompletedInput += number;
651
+ }
652
+ });
653
+ this.yearInputEl.value = `${autocompletedInput}${inputValue}`;
654
+ }
655
+ };
656
+ this.convertToDate = (year, month, day) => {
657
+ if (!isEmptyString(year) && !isEmptyString(month) && !isEmptyString(day)) {
658
+ return new Date(+year, +month - 1, +day);
659
+ }
660
+ else {
661
+ return null;
662
+ }
663
+ };
664
+ this.handleHostBlur = () => {
665
+ this.removeLabelledBy = false;
666
+ this.icBlur.emit({ value: this.selectedDate });
667
+ };
668
+ this.handleHostFocus = () => {
669
+ if (this.el.shadowRoot.activeElement.id.match(/(day|month|year)-input$/)) {
670
+ this.removeLabelledBy = false;
671
+ }
672
+ else {
673
+ this.removeLabelledBy = true;
674
+ }
675
+ this.icFocus.emit({ value: this.selectedDate });
676
+ };
677
+ this.handleFormReset = () => {
678
+ // Get the initial value and populate day, month and year again.
679
+ this.setDate(this.initialValue);
680
+ this.setValidationMessage();
681
+ this.handleDateChange(false);
682
+ };
683
+ this.getAriaLabel = (input) => {
684
+ return input.getAttribute(this.ARIA_LABEL);
685
+ };
686
+ this.notifyScreenReaderArrowKeys = (input) => {
687
+ const liveRegion = this.el.shadowRoot.querySelector("#live-region");
688
+ let announcement = "";
689
+ const ariaLabel = this.getAriaLabel(input);
690
+ if (liveRegion && input.value) {
691
+ if (input === this.monthInputEl &&
692
+ !!IcDateInputMonths[+input.value - 1]) {
693
+ announcement = `${input.value} - ${IcDateInputMonths[+input.value - 1]}, ${ariaLabel}`;
694
+ }
695
+ if (input === this.dayInputEl || input === this.yearInputEl) {
696
+ announcement = `${input.value}, ${ariaLabel}`;
697
+ }
698
+ liveRegion.textContent = announcement;
699
+ }
700
+ };
701
+ this.notifyScreenReaderInput = (input, liveRegion) => {
702
+ let announcement = "";
703
+ const ariaLabel = this.getAriaLabel(input);
704
+ if (input === this.dayInputEl || input === this.monthInputEl) {
705
+ if (input.value.length === 2) {
706
+ if (input === this.monthInputEl &&
707
+ !!IcDateInputMonths[+input.value - 1] &&
708
+ this.isValidMonth) {
709
+ announcement = `${input.value} - ${IcDateInputMonths[+input.value - 1]}, ${ariaLabel}`;
710
+ }
711
+ if (input === this.dayInputEl && this.isValidDay) {
712
+ announcement = `${input.value}, ${ariaLabel}`;
713
+ }
714
+ }
715
+ else {
716
+ announcement = "";
717
+ }
718
+ }
719
+ else {
720
+ if (input.value.length === 4) {
721
+ announcement = `${input.value}, ${ariaLabel}`;
722
+ }
723
+ else {
724
+ announcement = "";
725
+ }
726
+ }
727
+ liveRegion.textContent = announcement;
728
+ };
729
+ this.setFitToValueStyling = (input) => {
730
+ if (input.value) {
731
+ input.classList.add(this.FIT_TO_VALUE);
732
+ }
733
+ else {
734
+ input.classList.remove(this.FIT_TO_VALUE);
735
+ }
736
+ };
737
+ this.setAriaInvalid = (validDay, validMonth, validDate, disabledDate) => {
738
+ if (this.inputsInOrder.length) {
739
+ this.inputsInOrder.forEach((input) => {
740
+ input.removeAttribute(this.ARIA_INVALID);
741
+ });
742
+ if (!validDay) {
743
+ this.dayInputEl.setAttribute(this.ARIA_INVALID, "true");
744
+ }
745
+ if (!validMonth) {
746
+ this.monthInputEl.setAttribute(this.ARIA_INVALID, "true");
747
+ }
748
+ if (!validDate || disabledDate) {
749
+ this.inputsInOrder.forEach((input) => {
750
+ input.setAttribute(this.ARIA_INVALID, "true");
751
+ });
752
+ }
753
+ }
754
+ };
755
+ this.handleClear = () => {
756
+ this.inputsInOrder.forEach((input) => {
757
+ input.classList.remove(this.FIT_TO_VALUE);
758
+ this.setInputValue(input, true);
759
+ this.setPreventInput(input, false);
760
+ });
761
+ this.isDateSetFromKeyboardEvent = false;
762
+ this.setValueAndEmitChange(null);
763
+ this.setValidationMessage();
764
+ this.handleDateChange(true);
765
+ this.inputsInOrder[0].focus();
766
+ };
767
+ this.handleCalendarOpen = (ev) => {
768
+ ev.stopImmediatePropagation();
769
+ this.calendarButtonEl.shadowRoot
770
+ .querySelector("ic-tooltip")
771
+ .displayTooltip(false);
772
+ this.calendarButtonClicked.emit({ value: this.selectedDate });
773
+ this.calendarButtonEl.shadowRoot
774
+ .querySelector("ic-tooltip")
775
+ .displayTooltip(false);
776
+ this.isDateSetFromKeyboardEvent = false;
777
+ };
778
+ this.setValueAndEmitChange = (value) => {
779
+ if (this.value !== value) {
780
+ this.icChange.emit({ value: value });
781
+ this.value = value;
782
+ }
783
+ };
784
+ this.handleCalendarFocus = () => {
785
+ this.calendarFocused = true;
786
+ };
787
+ this.handleCalendarBlur = () => {
788
+ this.calendarFocused = false;
789
+ };
790
+ this.handleClearFocus = () => {
791
+ this.removeLabelledBy = true;
792
+ this.clearButtonFocused = true;
793
+ };
794
+ this.handleClearBlur = (ev) => {
795
+ this.clearButtonFocused = false;
796
+ if (ev.relatedTarget.id.match(/(day|year)-input$/)) {
797
+ this.removeLabelledBy = false;
798
+ return;
799
+ }
800
+ this.removeLabelledBy = true;
801
+ };
802
+ this.day = "";
803
+ this.invalidDateText = undefined;
804
+ this.maxDate = undefined;
805
+ this.minDate = undefined;
806
+ this.month = "";
807
+ this.year = "";
808
+ this.calendarFocused = false;
809
+ this.clearButtonFocused = false;
810
+ this.removeLabelledBy = false;
811
+ this.dateFormat = "DD/MM/YYYY";
812
+ this.disabled = false;
813
+ this.disableDays = [];
814
+ this.disableDaysMessage = "The date you have selected is on a day of the week that is not allowed. Please select another date.";
815
+ this.disableFuture = false;
816
+ this.disableFutureMessage = "Dates in the future are not allowed. Please select a date in the past.";
817
+ this.disablePast = false;
818
+ this.disablePastMessage = "Dates in the past are not allowed. Please select a date in the future.";
819
+ this.helperText = undefined;
820
+ this.inputId = `ic-date-input-${inputIds++}`;
821
+ this.label = undefined;
822
+ this.max = "";
823
+ this.min = "";
824
+ this.name = this.inputId;
825
+ this.required = false;
826
+ this.showCalendarButton = false;
827
+ this.showClearButton = true;
828
+ this.size = "default";
829
+ this.value = "";
830
+ this.validationStatus = "";
831
+ this.validationText = "";
832
+ }
833
+ watchMaxHandler() {
834
+ if (this.disableFuture) {
835
+ this.maxDate = new Date();
836
+ }
837
+ else {
838
+ this.maxDate = createDate(this.max, this.dateFormat);
839
+ }
840
+ }
841
+ watchMinHandler() {
842
+ if (this.disablePast) {
843
+ this.minDate = new Date();
844
+ }
845
+ else {
846
+ this.minDate = createDate(this.min, this.dateFormat);
847
+ }
848
+ }
849
+ disconnectedCallback() {
850
+ removeFormResetListener(this.el, this.handleFormReset);
851
+ }
852
+ componentWillLoad() {
853
+ this.defaultHelperText = `Use format ${this.dateFormat}`;
854
+ if (isEmptyString(this.helperText)) {
855
+ this.helperText = this.defaultHelperText;
856
+ }
857
+ this.watchMinHandler();
858
+ this.watchMaxHandler();
859
+ if (this.value) {
860
+ this.setDate(this.value);
861
+ }
862
+ this.screenReaderInfoId = `${this.inputId}-screen-reader-info`;
863
+ this.assistiveHintId = `${this.inputId}-assistive-hint`;
864
+ this.selectedDateInfoId = `${this.inputId}-selected-date-info`;
865
+ addFormResetListener(this.el, this.handleFormReset);
866
+ }
867
+ componentDidLoad() {
868
+ this.setInputsInOrder();
869
+ onComponentRequiredPropUndefined([{ prop: this.label, propName: "label" }], "Date Input");
870
+ if (this.value) {
871
+ this.updateInputValues(this.day, this.month, this.year);
872
+ this.inputsInOrder.forEach((input) => {
873
+ input.classList.add(this.FIT_TO_VALUE);
874
+ });
875
+ }
876
+ this.setAriaInvalid(this.isValidDay, this.isValidMonth, this.isValidDate, this.isDisabledDate);
877
+ if (this.value) {
878
+ this.notifyScreenReaderSelectedDate();
879
+ }
880
+ this.inputsInOrder.forEach((input) => {
881
+ input.addEventListener("input", this.handleInput);
882
+ input.addEventListener("focus", this.handleFocus);
883
+ input.addEventListener("blur", this.handleBlur);
884
+ });
885
+ // Prevent asterisk being read out after the label by screen reader (by applying aria-hidden)
886
+ // Needed because label is included in 'aria-labelledby' instead of using 'aria-label'
887
+ const labelEl = this.el.shadowRoot.querySelector("label");
888
+ if (this.required) {
889
+ const asteriskSpan = document.createElement("span");
890
+ asteriskSpan.setAttribute("aria-hidden", "true");
891
+ asteriskSpan.textContent = " *";
892
+ labelEl === null || labelEl === void 0 ? void 0 : labelEl.appendChild(asteriskSpan);
893
+ }
894
+ }
895
+ componentWillUpdate() {
896
+ if (!this.isDateSetFromKeyboardEvent) {
897
+ this.setDate(this.value);
898
+ }
899
+ this.setAriaInvalid(this.isValidDay, this.isValidMonth, this.isValidDate, this.isDisabledDate);
900
+ this.handleDateChange(false);
901
+ this.isDateSetFromKeyboardEvent = false;
902
+ }
903
+ componentDidRender() {
904
+ if (this.removeLabelledBy) {
905
+ this.removeAriaLabelledBy();
906
+ return;
907
+ }
908
+ this.setAriaLabelledBy();
909
+ }
910
+ /**
911
+ * Returns the value as a Date object
912
+ * @returns Date
913
+ */
914
+ async getDate() {
915
+ return this.selectedDate;
916
+ }
917
+ /**
918
+ * @internal Sets focus on the calendar button.
919
+ */
920
+ async setCalendarFocus() {
921
+ if (this.calendarButtonEl) {
922
+ this.calendarButtonEl.focus();
923
+ }
924
+ }
925
+ /**
926
+ * @internal Used to pass disabledDays from parent component.
927
+ */
928
+ async setDisableDays(days) {
929
+ this.disableDays = days;
930
+ }
931
+ removeAriaLabelledBy() {
932
+ this.inputCompContainerEl.removeAttribute(this.ARIA_LABELLED_BY);
933
+ }
934
+ setPastedValueAndValidation(isValidDate, pastedValue, event) {
935
+ switch (true) {
936
+ case isValidDate: {
937
+ const nextParsedValue = this.isZuluTime
938
+ ? extractDateFromZuluDateTime(pastedValue)
939
+ : pastedValue;
940
+ const dateParts = nextParsedValue.split(/-|\/|\./);
941
+ this.inputsInOrder.forEach((input, index) => {
942
+ input.classList.add(this.FIT_TO_VALUE);
943
+ if (this.isZuluTime) {
944
+ this.pasteZuluDateTime(dateParts, index);
945
+ }
946
+ else {
947
+ let dateValue;
948
+ if (input === this.dayInputEl || input === this.monthInputEl) {
949
+ dateValue = this.slicePastedDate(2, dateParts[index]);
950
+ }
951
+ else {
952
+ dateValue = this.slicePastedDate(4, dateParts[index]);
953
+ }
954
+ input.value = dateValue;
955
+ this.setInputValue(input);
956
+ this.autocompleteInput(input);
957
+ }
958
+ });
959
+ this.isZuluTime = false;
960
+ break;
961
+ }
962
+ case (pastedValue.length === 1 ||
963
+ pastedValue.length === 2 ||
964
+ pastedValue.length === 4) &&
965
+ isNumeric(pastedValue):
966
+ if (this.checkSingleCopiedValueIsValid(event.target, pastedValue)) {
967
+ // Check if copied value can be pasted into input
968
+ this.setInputPasteValue(event.target, pastedValue);
969
+ this.setInputValue(event.target);
970
+ }
971
+ else {
972
+ this.displayPastedValidation(event);
973
+ }
974
+ break;
975
+ case pastedValue.length === 3 && isNumeric(pastedValue):
976
+ if (event.target !== this.yearInputEl) {
977
+ this.displayPastedValidation(event);
978
+ }
979
+ else {
980
+ this.setInputPasteValue(event.target, pastedValue);
981
+ this.setInputValue(event.target);
982
+ }
983
+ break;
984
+ case pastedValue.length >= 5 && isNumeric(pastedValue):
985
+ this.displayPastedValidation(event);
986
+ }
987
+ }
988
+ pasteZuluDateTime(dateParts, index) {
989
+ // ['YYYY', 'MM', 'DD']
990
+ if (index === 0) {
991
+ const dateValue = this.slicePastedDate(4, dateParts[index]);
992
+ this.yearInputEl.value = dateValue;
993
+ this.setInputValue(this.yearInputEl);
994
+ }
995
+ else if (index === 1) {
996
+ // The month value is the second item in the array
997
+ const dateValue = this.slicePastedDate(2, dateParts[index]);
998
+ this.monthInputEl.value = dateValue;
999
+ this.setInputValue(this.monthInputEl);
1000
+ }
1001
+ else {
1002
+ const dateValue = this.slicePastedDate(2, dateParts[index]);
1003
+ this.dayInputEl.value = dateValue;
1004
+ this.setInputValue(this.dayInputEl);
1005
+ }
1006
+ }
1007
+ displayPastedValidation(event) {
1008
+ var _a;
1009
+ if (((_a = this.invalidDateText) === null || _a === void 0 ? void 0 : _a.length) > 0) {
1010
+ this.previousInvalidDateTest = this.invalidDateText;
1011
+ }
1012
+ this.invalidDateText = `Please paste a valid ${this.getAriaLabel(event.target)}`;
1013
+ this.validationStatus = IcInformationStatus.Error;
1014
+ this.isPasteValidationDisplayed = true;
1015
+ }
1016
+ setPasteInvalidText() {
1017
+ var _a;
1018
+ if (this.isPasteValidationDisplayed) {
1019
+ this.invalidDateText = (_a = this.previousInvalidDateTest) !== null && _a !== void 0 ? _a : "";
1020
+ this.isPasteValidationDisplayed = false;
1021
+ // This is to prevent setDate from triggering within componentWillUpdate
1022
+ this.isDateSetFromKeyboardEvent = true;
1023
+ }
1024
+ }
1025
+ notifyScreenReader(input, event) {
1026
+ const liveRegion = this.el.shadowRoot.querySelector("#live-region");
1027
+ if (liveRegion) {
1028
+ if (this.isKeyboardOrEvent(event)) {
1029
+ this.notifyScreenReaderArrowKeys(input);
1030
+ }
1031
+ else if (Object.prototype.toString.call(event) === this.INPUT_EVENT_OBJECT_STRING) {
1032
+ this.notifyScreenReaderInput(input, liveRegion);
1033
+ }
1034
+ }
1035
+ }
1036
+ render() {
1037
+ const { inputId, label, disabled, helperText, showClearButton, showCalendarButton, size, } = this;
1038
+ const hasCustomValidation = !isEmptyString(this.validationStatus) &&
1039
+ !isEmptyString(this.validationText);
1040
+ const validationStatus = hasCustomValidation
1041
+ ? this.validationStatus
1042
+ : !isEmptyString(this.invalidDateText)
1043
+ ? IcInformationStatus.Error
1044
+ : "";
1045
+ const assistiveHint = `Type or use the up and down arrow keys to change the values for the ${this.getDescOfInputsOrder()}.`;
1046
+ renderHiddenInput(true, this.el, this.name, this.convertToDate(this.year, this.month, this.day), this.disabled);
1047
+ 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: {
1048
+ ["clear-button"]: true,
1049
+ ["hidden"]: isEmptyString(this.day) &&
1050
+ isEmptyString(this.month) &&
1051
+ isEmptyString(this.year),
1052
+ }, disabled: this.disabled, innerHTML: Clear, onClick: this.handleClear, onFocus: this.handleClearFocus, onBlur: this.handleClearBlur, variant: "icon", appearance: this.clearButtonFocused
1053
+ ? IcThemeForegroundEnum.Light
1054
+ : 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
1055
+ ? IcThemeForegroundEnum.Light
1056
+ : 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 })))));
1057
+ }
1058
+ static get delegatesFocus() { return true; }
1059
+ get el() { return getElement(this); }
1060
+ static get watchers() { return {
1061
+ "max": ["watchMaxHandler"],
1062
+ "min": ["watchMinHandler"]
1063
+ }; }
1064
+ };
1065
+ DateInput.style = icDateInputCss;
1066
+
1067
+ export { DateInput as ic_date_input };
1068
+
1069
+ //# sourceMappingURL=ic-date-input.entry.js.map