@ukic/canary-web-components 2.0.0-canary.12 → 2.0.0-canary.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (542) 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-6d736902.js} +27 -4
  5. package/dist/cjs/helpers-6d736902.js.map +1 -0
  6. package/dist/cjs/{helpers-c4444a7e.js → helpers-f75cf7cf.js} +94 -48
  7. package/dist/cjs/helpers-f75cf7cf.js.map +1 -0
  8. package/dist/cjs/ic-accordion-group.cjs.entry.js +11 -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 +18 -17
  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 +41 -86
  18. package/dist/cjs/ic-button_3.cjs.entry.js.map +1 -1
  19. package/dist/cjs/ic-card.cjs.entry.js +1 -1
  20. package/dist/cjs/ic-checkbox-group.cjs.entry.js +1 -1
  21. package/dist/cjs/ic-checkbox.cjs.entry.js +1 -1
  22. package/dist/cjs/ic-chip.cjs.entry.js +25 -2
  23. package/dist/cjs/ic-chip.cjs.entry.js.map +1 -1
  24. package/dist/cjs/ic-data-row.cjs.entry.js +1 -1
  25. package/dist/cjs/ic-data-table.cjs.entry.js +43 -308
  26. package/dist/cjs/ic-data-table.cjs.entry.js.map +1 -1
  27. package/dist/cjs/ic-date-input.cjs.entry.js +1108 -0
  28. package/dist/cjs/ic-date-input.cjs.entry.js.map +1 -0
  29. package/dist/cjs/ic-date-picker.cjs.entry.js +1053 -0
  30. package/dist/cjs/ic-date-picker.cjs.entry.js.map +1 -0
  31. package/dist/cjs/ic-dialog.cjs.entry.js +14 -4
  32. package/dist/cjs/ic-dialog.cjs.entry.js.map +1 -1
  33. package/dist/cjs/ic-divider.cjs.entry.js +1 -1
  34. package/dist/cjs/ic-empty-state.cjs.entry.js +38 -0
  35. package/dist/cjs/ic-empty-state.cjs.entry.js.map +1 -0
  36. package/dist/cjs/ic-footer-link-group.cjs.entry.js +1 -1
  37. package/dist/cjs/ic-footer-link.cjs.entry.js +1 -1
  38. package/dist/cjs/ic-footer.cjs.entry.js +1 -1
  39. package/dist/cjs/ic-hero.cjs.entry.js +1 -1
  40. package/dist/cjs/ic-horizontal-scroll.cjs.entry.js +1 -1
  41. package/dist/cjs/ic-input-component-container_4.cjs.entry.js +150 -0
  42. package/dist/cjs/ic-input-component-container_4.cjs.entry.js.map +1 -0
  43. package/dist/cjs/ic-link.cjs.entry.js +33 -15
  44. package/dist/cjs/ic-link.cjs.entry.js.map +1 -1
  45. package/dist/cjs/ic-menu-group.cjs.entry.js +1 -1
  46. package/dist/cjs/ic-menu-item.cjs.entry.js +1 -1
  47. package/dist/cjs/ic-menu-with-multi.cjs.entry.js +1 -1
  48. package/dist/cjs/ic-menu-with-multi.cjs.entry.js.map +1 -1
  49. package/dist/cjs/{ic-input-component-container_3.cjs.entry.js → ic-menu.cjs.entry.js} +5 -69
  50. package/dist/cjs/ic-menu.cjs.entry.js.map +1 -0
  51. package/dist/cjs/ic-navigation-button.cjs.entry.js +26 -5
  52. package/dist/cjs/ic-navigation-button.cjs.entry.js.map +1 -1
  53. package/dist/cjs/ic-navigation-group.cjs.entry.js +16 -13
  54. package/dist/cjs/ic-navigation-group.cjs.entry.js.map +1 -1
  55. package/dist/cjs/ic-navigation-item.cjs.entry.js +29 -33
  56. package/dist/cjs/ic-navigation-item.cjs.entry.js.map +1 -1
  57. package/dist/cjs/ic-navigation-menu.cjs.entry.js +1 -1
  58. package/dist/cjs/ic-page-header.cjs.entry.js +1 -1
  59. package/dist/cjs/{ic-empty-state_2.cjs.entry.js → ic-pagination-bar.cjs.entry.js} +4 -34
  60. package/dist/cjs/ic-pagination-bar.cjs.entry.js.map +1 -0
  61. package/dist/cjs/ic-pagination_4.cjs.entry.js +53 -16
  62. package/dist/cjs/ic-pagination_4.cjs.entry.js.map +1 -1
  63. package/dist/cjs/ic-popover-menu.cjs.entry.js +1 -1
  64. package/dist/cjs/ic-radio-group.cjs.entry.js +40 -26
  65. package/dist/cjs/ic-radio-group.cjs.entry.js.map +1 -1
  66. package/dist/cjs/ic-radio-option.cjs.entry.js +9 -4
  67. package/dist/cjs/ic-radio-option.cjs.entry.js.map +1 -1
  68. package/dist/cjs/ic-search-bar.cjs.entry.js +1 -1
  69. package/dist/cjs/ic-select-with-multi.cjs.entry.js +6 -19
  70. package/dist/cjs/ic-select-with-multi.cjs.entry.js.map +1 -1
  71. package/dist/cjs/ic-side-navigation.cjs.entry.js +2 -2
  72. package/dist/cjs/ic-side-navigation.cjs.entry.js.map +1 -1
  73. package/dist/cjs/ic-status-tag.cjs.entry.js +1 -1
  74. package/dist/cjs/ic-step.cjs.entry.js +5 -2
  75. package/dist/cjs/ic-step.cjs.entry.js.map +1 -1
  76. package/dist/cjs/ic-stepper.cjs.entry.js +2 -1
  77. package/dist/cjs/ic-stepper.cjs.entry.js.map +1 -1
  78. package/dist/cjs/ic-switch.cjs.entry.js +1 -1
  79. package/dist/cjs/ic-tab-context.cjs.entry.js +18 -2
  80. package/dist/cjs/ic-tab-context.cjs.entry.js.map +1 -1
  81. package/dist/cjs/ic-tab-group.cjs.entry.js +1 -1
  82. package/dist/cjs/ic-tab-panel.cjs.entry.js +1 -1
  83. package/dist/cjs/ic-tab.cjs.entry.js +1 -1
  84. package/dist/cjs/ic-theme.cjs.entry.js +3 -10
  85. package/dist/cjs/ic-theme.cjs.entry.js.map +1 -1
  86. package/dist/cjs/ic-toast.cjs.entry.js +1 -1
  87. package/dist/cjs/ic-toggle-button.cjs.entry.js +1 -1
  88. package/dist/cjs/ic-top-navigation.cjs.entry.js +46 -60
  89. package/dist/cjs/ic-top-navigation.cjs.entry.js.map +1 -1
  90. package/dist/cjs/ic-typography.cjs.entry.js +11 -35
  91. package/dist/cjs/ic-typography.cjs.entry.js.map +1 -1
  92. package/dist/cjs/index-4cf27b16.js +18 -10
  93. package/dist/cjs/loader.cjs.js +1 -1
  94. package/dist/collection/assets/calendar.svg +3 -0
  95. package/dist/collection/collection-manifest.json +2 -1
  96. package/dist/collection/components/ic-data-table/ic-data-table.css +7 -82
  97. package/dist/collection/components/ic-data-table/ic-data-table.js +44 -535
  98. package/dist/collection/components/ic-data-table/ic-data-table.js.map +1 -1
  99. package/dist/collection/components/ic-data-table/ic-data-table.types.js.map +1 -1
  100. package/dist/collection/components/ic-data-table/story-data.js +11 -386
  101. package/dist/collection/components/ic-data-table/story-data.js.map +1 -1
  102. package/dist/collection/components/ic-data-table/test/basic/ic-data-table.spec.js +0 -319
  103. package/dist/collection/components/ic-data-table/test/basic/ic-data-table.spec.js.map +1 -1
  104. package/dist/collection/components/ic-date-input/ic-date-input.css +560 -0
  105. package/dist/collection/components/ic-date-input/ic-date-input.js +1737 -0
  106. package/dist/collection/components/ic-date-input/ic-date-input.js.map +1 -0
  107. package/dist/collection/components/ic-date-input/story-data.js +28 -0
  108. package/dist/collection/components/ic-date-input/story-data.js.map +1 -0
  109. package/dist/collection/components/ic-date-input/test/basic/ic-date-input.spec.js +1142 -0
  110. package/dist/collection/components/ic-date-input/test/basic/ic-date-input.spec.js.map +1 -0
  111. package/dist/collection/components/ic-date-input/test/helpers/ic-date-input.js +42 -0
  112. package/dist/collection/components/ic-date-input/test/helpers/ic-date-input.js.map +1 -0
  113. package/dist/collection/components/ic-date-picker/ic-date-picker.css +878 -0
  114. package/dist/collection/components/ic-date-picker/ic-date-picker.js +1512 -0
  115. package/dist/collection/components/ic-date-picker/ic-date-picker.js.map +1 -0
  116. package/dist/collection/components/ic-date-picker/ic-day-button.js +36 -0
  117. package/dist/collection/components/ic-date-picker/ic-day-button.js.map +1 -0
  118. package/dist/collection/components/ic-date-picker/ic-month-picker.js +29 -0
  119. package/dist/collection/components/ic-date-picker/ic-month-picker.js.map +1 -0
  120. package/dist/collection/components/ic-date-picker/ic-year-picker.js +39 -0
  121. package/dist/collection/components/ic-date-picker/ic-year-picker.js.map +1 -0
  122. package/dist/collection/components/ic-date-picker/story-data.js +148 -0
  123. package/dist/collection/components/ic-date-picker/story-data.js.map +1 -0
  124. package/dist/collection/components/{ic-data-table-title-bar/test/a11y/ic-data-table-title-bar.test.a11y.js → ic-date-picker/test/a11y/ic-date-picker.test.a11y.js} +5 -3
  125. package/dist/collection/components/ic-date-picker/test/a11y/ic-date-picker.test.a11y.js.map +1 -0
  126. package/dist/collection/components/ic-date-picker/test/basic/ic-date-picker-utils.spec.js +207 -0
  127. package/dist/collection/components/ic-date-picker/test/basic/ic-date-picker-utils.spec.js.map +1 -0
  128. package/dist/collection/components/ic-date-picker/test/basic/ic-date-picker.spec.js +991 -0
  129. package/dist/collection/components/ic-date-picker/test/basic/ic-date-picker.spec.js.map +1 -0
  130. package/dist/collection/components/ic-menu-with-multi/ic-menu.js +2 -2
  131. package/dist/collection/components/ic-menu-with-multi/ic-menu.js.map +1 -1
  132. package/dist/collection/components/ic-pagination-bar/ic-pagination-bar.js +1 -1
  133. package/dist/collection/components/ic-pagination-bar/ic-pagination-bar.js.map +1 -1
  134. package/dist/collection/components/ic-select-with-multi/ic-select.js +2 -2
  135. package/dist/collection/components/ic-select-with-multi/ic-select.js.map +1 -1
  136. package/dist/collection/utils/constants.js +55 -0
  137. package/dist/collection/utils/constants.js.map +1 -1
  138. package/dist/collection/utils/date-helpers.js +133 -0
  139. package/dist/collection/utils/date-helpers.js.map +1 -0
  140. package/dist/collection/utils/helpers.js +272 -42
  141. package/dist/collection/utils/helpers.js.map +1 -1
  142. package/dist/collection/utils/types.js +45 -0
  143. package/dist/collection/utils/types.js.map +1 -1
  144. package/dist/components/helpers.js +26 -3
  145. package/dist/components/helpers.js.map +1 -1
  146. package/dist/components/helpers2.js +91 -45
  147. package/dist/components/helpers2.js.map +1 -1
  148. package/dist/components/ic-accordion-group.js +14 -4
  149. package/dist/components/ic-accordion-group.js.map +1 -1
  150. package/dist/components/ic-badge.js +18 -17
  151. package/dist/components/ic-badge.js.map +1 -1
  152. package/dist/components/ic-button2.js +43 -86
  153. package/dist/components/ic-button2.js.map +1 -1
  154. package/dist/components/ic-card.js +1 -1
  155. package/dist/components/ic-checkbox-group.js +1 -1
  156. package/dist/components/ic-checkbox.js +1 -1
  157. package/dist/components/ic-chip.js +29 -3
  158. package/dist/components/ic-chip.js.map +1 -1
  159. package/dist/components/ic-data-table.js +49 -334
  160. package/dist/components/ic-data-table.js.map +1 -1
  161. package/dist/components/{ic-data-table-title-bar.d.ts → ic-date-input.d.ts} +4 -4
  162. package/dist/components/ic-date-input.js +8 -0
  163. package/dist/components/ic-date-input.js.map +1 -0
  164. package/dist/components/ic-date-input2.js +1340 -0
  165. package/dist/components/ic-date-input2.js.map +1 -0
  166. package/dist/components/ic-date-picker.d.ts +11 -0
  167. package/dist/components/ic-date-picker.js +1175 -0
  168. package/dist/components/ic-date-picker.js.map +1 -0
  169. package/dist/components/ic-dialog.js +13 -3
  170. package/dist/components/ic-dialog.js.map +1 -1
  171. package/dist/components/ic-empty-state.js +57 -1
  172. package/dist/components/ic-empty-state.js.map +1 -1
  173. package/dist/components/ic-input-component-container2.js +1 -1
  174. package/dist/components/ic-input-component-container2.js.map +1 -1
  175. package/dist/components/ic-link2.js +34 -16
  176. package/dist/components/ic-link2.js.map +1 -1
  177. package/dist/components/ic-loading-indicator2.js +1 -1
  178. package/dist/components/ic-loading-indicator2.js.map +1 -1
  179. package/dist/components/ic-menu-item2.js +1 -1
  180. package/dist/components/ic-menu2.js +2 -2
  181. package/dist/components/ic-menu2.js.map +1 -1
  182. package/dist/components/ic-menu3.js +1 -1
  183. package/dist/components/ic-menu3.js.map +1 -1
  184. package/dist/components/ic-navigation-button.js +26 -5
  185. package/dist/components/ic-navigation-button.js.map +1 -1
  186. package/dist/components/ic-navigation-group.js +15 -12
  187. package/dist/components/ic-navigation-group.js.map +1 -1
  188. package/dist/components/ic-navigation-item.js +29 -33
  189. package/dist/components/ic-navigation-item.js.map +1 -1
  190. package/dist/components/ic-pagination-bar2.js +1 -1
  191. package/dist/components/ic-pagination-bar2.js.map +1 -1
  192. package/dist/components/ic-pagination-item2.js +1 -1
  193. package/dist/components/ic-pagination2.js +5 -5
  194. package/dist/components/ic-pagination2.js.map +1 -1
  195. package/dist/components/ic-radio-group.js +40 -26
  196. package/dist/components/ic-radio-group.js.map +1 -1
  197. package/dist/components/ic-radio-option.js +11 -5
  198. package/dist/components/ic-radio-option.js.map +1 -1
  199. package/dist/components/ic-search-bar.js +1 -1
  200. package/dist/components/ic-select-with-multi.js +1 -14
  201. package/dist/components/ic-select-with-multi.js.map +1 -1
  202. package/dist/components/ic-select2.js +25 -7
  203. package/dist/components/ic-select2.js.map +1 -1
  204. package/dist/components/ic-side-navigation.js +1 -1
  205. package/dist/components/ic-side-navigation.js.map +1 -1
  206. package/dist/components/ic-step.js +4 -1
  207. package/dist/components/ic-step.js.map +1 -1
  208. package/dist/components/ic-stepper.js +2 -0
  209. package/dist/components/ic-stepper.js.map +1 -1
  210. package/dist/components/ic-switch.js +1 -1
  211. package/dist/components/ic-tab-context.js +18 -2
  212. package/dist/components/ic-tab-context.js.map +1 -1
  213. package/dist/components/ic-tab.js +1 -1
  214. package/dist/components/ic-text-field2.js +27 -8
  215. package/dist/components/ic-text-field2.js.map +1 -1
  216. package/dist/components/ic-theme.js +3 -10
  217. package/dist/components/ic-theme.js.map +1 -1
  218. package/dist/components/ic-toggle-button.js +1 -1
  219. package/dist/components/ic-top-navigation.js +47 -61
  220. package/dist/components/ic-top-navigation.js.map +1 -1
  221. package/dist/components/ic-typography2.js +12 -38
  222. package/dist/components/ic-typography2.js.map +1 -1
  223. package/dist/core/core.css +1 -1
  224. package/dist/core/core.esm.js +1 -1
  225. package/dist/core/core.esm.js.map +1 -1
  226. package/dist/core/{p-869954a2.entry.js → p-00bd7919.entry.js} +2 -2
  227. package/dist/core/p-00c5639e.entry.js +2 -0
  228. package/dist/core/{p-db9c03c0.entry.js.map → p-00c5639e.entry.js.map} +1 -1
  229. package/dist/core/p-06c27edb.entry.js +2 -0
  230. package/dist/core/p-06c27edb.entry.js.map +1 -0
  231. package/dist/core/{p-a0f8efb2.entry.js → p-0af27517.entry.js} +2 -2
  232. package/dist/core/p-0af27517.entry.js.map +1 -0
  233. package/dist/core/p-162f3e36.entry.js +2 -0
  234. package/dist/core/{p-624d4f5f.entry.js.map → p-162f3e36.entry.js.map} +1 -1
  235. package/dist/core/p-19c1e271.entry.js +2 -0
  236. package/dist/core/p-19c1e271.entry.js.map +1 -0
  237. package/dist/core/{p-a50c3b9e.entry.js → p-1a91e842.entry.js} +2 -2
  238. package/dist/core/{p-76915584.entry.js → p-1c3bd46d.entry.js} +2 -2
  239. package/dist/core/p-1c3bd46d.entry.js.map +1 -0
  240. package/dist/core/p-2c9d6334.entry.js +2 -0
  241. package/dist/core/p-2c9d6334.entry.js.map +1 -0
  242. package/dist/core/p-33dd24eb.js +2 -0
  243. package/dist/core/p-33dd24eb.js.map +1 -0
  244. package/dist/core/p-3dcc61cc.entry.js +2 -0
  245. package/dist/core/p-3dcc61cc.entry.js.map +1 -0
  246. package/dist/core/p-3e9a8977.entry.js +2 -0
  247. package/dist/core/{p-595be57d.entry.js.map → p-3e9a8977.entry.js.map} +1 -1
  248. package/dist/core/{p-f3c840cd.entry.js → p-41b682dc.entry.js} +2 -2
  249. package/dist/core/p-494c3cbe.entry.js +2 -0
  250. package/dist/core/p-494c3cbe.entry.js.map +1 -0
  251. package/dist/core/p-4ad3012a.entry.js +2 -0
  252. package/dist/core/p-4ad3012a.entry.js.map +1 -0
  253. package/dist/core/p-4bd13376.entry.js +2 -0
  254. package/dist/core/p-4bd13376.entry.js.map +1 -0
  255. package/dist/core/p-4fd58768.entry.js +2 -0
  256. package/dist/core/p-4fd58768.entry.js.map +1 -0
  257. package/dist/core/{p-8b08d8fe.entry.js → p-6dce8e88.entry.js} +2 -2
  258. package/dist/core/{p-1ca332ca.entry.js → p-6eb58b0a.entry.js} +2 -2
  259. package/dist/core/p-730f058b.entry.js +2 -0
  260. package/dist/core/p-730f058b.entry.js.map +1 -0
  261. package/dist/core/p-7f53d1be.entry.js +2 -0
  262. package/dist/core/p-7f53d1be.entry.js.map +1 -0
  263. package/dist/core/{p-5ae93c16.entry.js → p-7fda2f94.entry.js} +2 -2
  264. package/dist/core/p-843bdaae.entry.js +2 -0
  265. package/dist/core/p-843bdaae.entry.js.map +1 -0
  266. package/dist/core/p-849f43c3.entry.js +2 -0
  267. package/dist/core/p-849f43c3.entry.js.map +1 -0
  268. package/dist/core/{p-c34848da.entry.js → p-8b1f9648.entry.js} +2 -2
  269. package/dist/core/{p-a434c3d4.entry.js → p-8b820365.entry.js} +2 -2
  270. package/dist/core/p-940de102.entry.js +2 -0
  271. package/dist/core/p-940de102.entry.js.map +1 -0
  272. package/dist/core/{p-2eac7dcc.entry.js → p-946625a3.entry.js} +2 -2
  273. package/dist/core/{p-7ef8d616.entry.js → p-9528b29e.entry.js} +2 -2
  274. package/dist/core/{p-a43c12cd.entry.js → p-9567c117.entry.js} +2 -2
  275. package/dist/core/{p-b82dcc29.entry.js → p-957de939.entry.js} +2 -2
  276. package/dist/core/{p-045359e1.entry.js → p-99bf38e3.entry.js} +2 -2
  277. package/dist/core/{p-81ddc39d.entry.js → p-9d8883d7.entry.js} +2 -2
  278. package/dist/core/{p-b6639e4a.entry.js → p-9e3178e8.entry.js} +2 -2
  279. package/dist/core/{p-b6639e4a.entry.js.map → p-9e3178e8.entry.js.map} +1 -1
  280. package/dist/core/p-a05755b1.entry.js +2 -0
  281. package/dist/core/p-a05755b1.entry.js.map +1 -0
  282. package/dist/core/{p-e834344e.entry.js → p-a1556d97.entry.js} +2 -2
  283. package/dist/core/{p-f843da01.entry.js → p-a2dc10d8.entry.js} +2 -2
  284. package/dist/core/{p-ab09986c.entry.js → p-a8c15117.entry.js} +2 -2
  285. package/dist/core/p-aabab75f.entry.js +2 -0
  286. package/dist/core/p-aabab75f.entry.js.map +1 -0
  287. package/dist/core/{p-f7a14c01.entry.js → p-c14a897d.entry.js} +2 -2
  288. package/dist/core/p-c621d6b0.entry.js +2 -0
  289. package/dist/core/p-c621d6b0.entry.js.map +1 -0
  290. package/dist/core/p-c7590421.entry.js +2 -0
  291. package/dist/core/p-c7590421.entry.js.map +1 -0
  292. package/dist/core/p-c953edb9.entry.js +2 -0
  293. package/dist/core/p-c953edb9.entry.js.map +1 -0
  294. package/dist/core/p-cca482e2.entry.js +2 -0
  295. package/dist/core/p-cca482e2.entry.js.map +1 -0
  296. package/dist/core/p-cd799087.js +2 -0
  297. package/dist/core/p-cd799087.js.map +1 -0
  298. package/dist/core/{p-e3997d60.entry.js → p-d2d63a61.entry.js} +2 -2
  299. package/dist/core/p-d32d331b.entry.js +2 -0
  300. package/dist/core/p-d32d331b.entry.js.map +1 -0
  301. package/dist/core/{p-4f413fc0.entry.js → p-db3a35fb.entry.js} +2 -2
  302. package/dist/core/p-dc5e1f8f.entry.js +2 -0
  303. package/dist/core/{p-6933f8e9.entry.js.map → p-dc5e1f8f.entry.js.map} +1 -1
  304. package/dist/core/{p-204ace96.entry.js → p-e16f73ba.entry.js} +2 -2
  305. package/dist/core/p-e189f1d0.entry.js +2 -0
  306. package/dist/core/p-e189f1d0.entry.js.map +1 -0
  307. package/dist/core/{p-917c5721.entry.js → p-e1963c78.entry.js} +2 -2
  308. package/dist/core/p-e1963c78.entry.js.map +1 -0
  309. package/dist/core/{p-f14454b1.entry.js → p-e8151d13.entry.js} +2 -2
  310. package/dist/core/p-ee765ad5.js +2 -0
  311. package/dist/core/p-ee765ad5.js.map +1 -0
  312. package/dist/core/{p-fc5611e2.entry.js → p-f2147136.entry.js} +2 -2
  313. package/dist/core/p-f2147136.entry.js.map +1 -0
  314. package/dist/core/{p-5e0c830b.entry.js → p-f8f36680.entry.js} +2 -2
  315. package/dist/core/{p-5e0c830b.entry.js.map → p-f8f36680.entry.js.map} +1 -1
  316. package/dist/core/p-fca46bd9.entry.js +2 -0
  317. package/dist/core/p-fca46bd9.entry.js.map +1 -0
  318. package/dist/core/{p-a31031a5.entry.js → p-ff3a01f3.entry.js} +2 -2
  319. package/dist/core/{p-75dac3d1.entry.js → p-ff6f1e3a.entry.js} +2 -2
  320. package/dist/esm/core.js +1 -1
  321. package/dist/esm/date-helpers-0e5e32a7.js +136 -0
  322. package/dist/esm/date-helpers-0e5e32a7.js.map +1 -0
  323. package/dist/esm/{helpers-12b4266a.js → helpers-c34e4042.js} +27 -4
  324. package/dist/esm/helpers-c34e4042.js.map +1 -0
  325. package/dist/esm/{helpers-1f07eb61.js → helpers-f328a7b6.js} +92 -46
  326. package/dist/esm/helpers-f328a7b6.js.map +1 -0
  327. package/dist/esm/ic-accordion-group.entry.js +11 -2
  328. package/dist/esm/ic-accordion-group.entry.js.map +1 -1
  329. package/dist/esm/ic-accordion.entry.js +1 -1
  330. package/dist/esm/ic-alert.entry.js +1 -1
  331. package/dist/esm/ic-back-to-top.entry.js +1 -1
  332. package/dist/esm/ic-badge.entry.js +18 -17
  333. package/dist/esm/ic-badge.entry.js.map +1 -1
  334. package/dist/esm/ic-breadcrumb-group.entry.js +1 -1
  335. package/dist/esm/ic-breadcrumb.entry.js +1 -1
  336. package/dist/esm/ic-button_3.entry.js +41 -86
  337. package/dist/esm/ic-button_3.entry.js.map +1 -1
  338. package/dist/esm/ic-card.entry.js +1 -1
  339. package/dist/esm/ic-checkbox-group.entry.js +1 -1
  340. package/dist/esm/ic-checkbox.entry.js +1 -1
  341. package/dist/esm/ic-chip.entry.js +25 -2
  342. package/dist/esm/ic-chip.entry.js.map +1 -1
  343. package/dist/esm/ic-data-row.entry.js +1 -1
  344. package/dist/esm/ic-data-table.entry.js +44 -309
  345. package/dist/esm/ic-data-table.entry.js.map +1 -1
  346. package/dist/esm/ic-date-input.entry.js +1104 -0
  347. package/dist/esm/ic-date-input.entry.js.map +1 -0
  348. package/dist/esm/ic-date-picker.entry.js +1049 -0
  349. package/dist/esm/ic-date-picker.entry.js.map +1 -0
  350. package/dist/esm/ic-dialog.entry.js +14 -4
  351. package/dist/esm/ic-dialog.entry.js.map +1 -1
  352. package/dist/esm/ic-divider.entry.js +1 -1
  353. package/dist/{components/ic-empty-state2.js → esm/ic-empty-state.entry.js} +11 -38
  354. package/dist/esm/ic-empty-state.entry.js.map +1 -0
  355. package/dist/esm/ic-footer-link-group.entry.js +1 -1
  356. package/dist/esm/ic-footer-link.entry.js +1 -1
  357. package/dist/esm/ic-footer.entry.js +1 -1
  358. package/dist/esm/ic-hero.entry.js +1 -1
  359. package/dist/esm/ic-horizontal-scroll.entry.js +1 -1
  360. package/dist/esm/ic-input-component-container_4.entry.js +143 -0
  361. package/dist/esm/ic-input-component-container_4.entry.js.map +1 -0
  362. package/dist/esm/ic-link.entry.js +34 -16
  363. package/dist/esm/ic-link.entry.js.map +1 -1
  364. package/dist/esm/ic-menu-group.entry.js +1 -1
  365. package/dist/esm/ic-menu-item.entry.js +1 -1
  366. package/dist/esm/ic-menu-with-multi.entry.js +1 -1
  367. package/dist/esm/ic-menu-with-multi.entry.js.map +1 -1
  368. package/dist/esm/{ic-input-component-container_3.entry.js → ic-menu.entry.js} +7 -69
  369. package/dist/esm/ic-menu.entry.js.map +1 -0
  370. package/dist/esm/ic-navigation-button.entry.js +27 -6
  371. package/dist/esm/ic-navigation-button.entry.js.map +1 -1
  372. package/dist/esm/ic-navigation-group.entry.js +16 -13
  373. package/dist/esm/ic-navigation-group.entry.js.map +1 -1
  374. package/dist/esm/ic-navigation-item.entry.js +29 -33
  375. package/dist/esm/ic-navigation-item.entry.js.map +1 -1
  376. package/dist/esm/ic-navigation-menu.entry.js +1 -1
  377. package/dist/esm/ic-page-header.entry.js +1 -1
  378. package/dist/esm/{ic-empty-state_2.entry.js → ic-pagination-bar.entry.js} +5 -34
  379. package/dist/esm/ic-pagination-bar.entry.js.map +1 -0
  380. package/dist/esm/ic-pagination_4.entry.js +54 -17
  381. package/dist/esm/ic-pagination_4.entry.js.map +1 -1
  382. package/dist/esm/ic-popover-menu.entry.js +1 -1
  383. package/dist/esm/ic-radio-group.entry.js +40 -26
  384. package/dist/esm/ic-radio-group.entry.js.map +1 -1
  385. package/dist/esm/ic-radio-option.entry.js +9 -4
  386. package/dist/esm/ic-radio-option.entry.js.map +1 -1
  387. package/dist/esm/ic-search-bar.entry.js +1 -1
  388. package/dist/esm/ic-select-with-multi.entry.js +1 -14
  389. package/dist/esm/ic-select-with-multi.entry.js.map +1 -1
  390. package/dist/esm/ic-side-navigation.entry.js +2 -2
  391. package/dist/esm/ic-side-navigation.entry.js.map +1 -1
  392. package/dist/esm/ic-status-tag.entry.js +1 -1
  393. package/dist/esm/ic-step.entry.js +5 -2
  394. package/dist/esm/ic-step.entry.js.map +1 -1
  395. package/dist/esm/ic-stepper.entry.js +2 -1
  396. package/dist/esm/ic-stepper.entry.js.map +1 -1
  397. package/dist/esm/ic-switch.entry.js +1 -1
  398. package/dist/esm/ic-tab-context.entry.js +18 -2
  399. package/dist/esm/ic-tab-context.entry.js.map +1 -1
  400. package/dist/esm/ic-tab-group.entry.js +1 -1
  401. package/dist/esm/ic-tab-panel.entry.js +1 -1
  402. package/dist/esm/ic-tab.entry.js +1 -1
  403. package/dist/esm/ic-theme.entry.js +3 -10
  404. package/dist/esm/ic-theme.entry.js.map +1 -1
  405. package/dist/esm/ic-toast.entry.js +1 -1
  406. package/dist/esm/ic-toggle-button.entry.js +1 -1
  407. package/dist/esm/ic-top-navigation.entry.js +46 -60
  408. package/dist/esm/ic-top-navigation.entry.js.map +1 -1
  409. package/dist/esm/ic-typography.entry.js +12 -36
  410. package/dist/esm/ic-typography.entry.js.map +1 -1
  411. package/dist/esm/index-93509377.js +18 -10
  412. package/dist/esm/loader.js +1 -1
  413. package/dist/esm/polyfills/core-js.js +0 -0
  414. package/dist/esm/polyfills/dom.js +0 -0
  415. package/dist/esm/polyfills/es5-html-element.js +0 -0
  416. package/dist/esm/polyfills/index.js +0 -0
  417. package/dist/esm/polyfills/system.js +0 -0
  418. package/dist/types/components/ic-data-table/ic-data-table.d.ts +1 -96
  419. package/dist/types/components/ic-data-table/ic-data-table.types.d.ts +0 -11
  420. package/dist/types/components/ic-data-table/story-data.d.ts +0 -99
  421. package/dist/types/components/ic-date-input/ic-date-input.d.ts +251 -0
  422. package/dist/types/components/ic-date-input/story-data.d.ts +1 -0
  423. package/dist/types/components/ic-date-input/test/helpers/ic-date-input.d.ts +23 -0
  424. package/dist/types/components/ic-date-picker/ic-date-picker.d.ts +231 -0
  425. package/dist/types/components/ic-date-picker/ic-day-button.d.ts +16 -0
  426. package/dist/types/components/ic-date-picker/ic-month-picker.d.ts +14 -0
  427. package/dist/types/components/ic-date-picker/ic-year-picker.d.ts +16 -0
  428. package/dist/types/components/ic-date-picker/story-data.d.ts +22 -0
  429. package/dist/types/components/ic-menu-with-multi/ic-menu.d.ts +2 -2
  430. package/dist/types/components/ic-select-with-multi/ic-select.d.ts +2 -2
  431. package/dist/types/components.d.ts +390 -141
  432. package/dist/types/utils/constants.d.ts +37 -0
  433. package/dist/types/utils/date-helpers.d.ts +22 -0
  434. package/dist/types/utils/helpers.d.ts +84 -16
  435. package/dist/types/utils/types.d.ts +92 -1
  436. package/hydrate/index.js +3275 -1148
  437. package/package.json +4 -3
  438. package/dist/cjs/helpers-b525d45a.js.map +0 -1
  439. package/dist/cjs/helpers-c4444a7e.js.map +0 -1
  440. package/dist/cjs/ic-data-table-title-bar.cjs.entry.js +0 -57
  441. package/dist/cjs/ic-data-table-title-bar.cjs.entry.js.map +0 -1
  442. package/dist/cjs/ic-empty-state_2.cjs.entry.js.map +0 -1
  443. package/dist/cjs/ic-input-component-container_3.cjs.entry.js.map +0 -1
  444. package/dist/cjs/ic-input-label_2.cjs.entry.js +0 -86
  445. package/dist/cjs/ic-input-label_2.cjs.entry.js.map +0 -1
  446. package/dist/collection/components/ic-data-table/test/basic/ic-data-table.e2e.js +0 -217
  447. package/dist/collection/components/ic-data-table/test/basic/ic-data-table.e2e.js.map +0 -1
  448. package/dist/collection/components/ic-data-table-title-bar/ic-data-table-title-bar.css +0 -87
  449. package/dist/collection/components/ic-data-table-title-bar/ic-data-table-title-bar.js +0 -160
  450. package/dist/collection/components/ic-data-table-title-bar/ic-data-table-title-bar.js.map +0 -1
  451. package/dist/collection/components/ic-data-table-title-bar/test/a11y/ic-data-table-title-bar.test.a11y.js.map +0 -1
  452. package/dist/collection/components/ic-data-table-title-bar/test/basic/ic-data-table-title-bar.spec.js +0 -70
  453. package/dist/collection/components/ic-data-table-title-bar/test/basic/ic-data-table-title-bar.spec.js.map +0 -1
  454. package/dist/components/ic-data-table-title-bar.js +0 -136
  455. package/dist/components/ic-data-table-title-bar.js.map +0 -1
  456. package/dist/components/ic-empty-state2.js.map +0 -1
  457. package/dist/core/p-10fb4c46.entry.js +0 -2
  458. package/dist/core/p-10fb4c46.entry.js.map +0 -1
  459. package/dist/core/p-169bfa51.entry.js +0 -2
  460. package/dist/core/p-169bfa51.entry.js.map +0 -1
  461. package/dist/core/p-1e91f540.entry.js +0 -2
  462. package/dist/core/p-1e91f540.entry.js.map +0 -1
  463. package/dist/core/p-347e8dab.entry.js +0 -2
  464. package/dist/core/p-347e8dab.entry.js.map +0 -1
  465. package/dist/core/p-3803a5b5.entry.js +0 -2
  466. package/dist/core/p-3803a5b5.entry.js.map +0 -1
  467. package/dist/core/p-4753bac8.entry.js +0 -2
  468. package/dist/core/p-4753bac8.entry.js.map +0 -1
  469. package/dist/core/p-4baa0916.entry.js +0 -2
  470. package/dist/core/p-4baa0916.entry.js.map +0 -1
  471. package/dist/core/p-5171169f.entry.js +0 -2
  472. package/dist/core/p-5171169f.entry.js.map +0 -1
  473. package/dist/core/p-595be57d.entry.js +0 -2
  474. package/dist/core/p-5ee4319c.entry.js +0 -2
  475. package/dist/core/p-5ee4319c.entry.js.map +0 -1
  476. package/dist/core/p-5f4e96ec.entry.js +0 -2
  477. package/dist/core/p-5f4e96ec.entry.js.map +0 -1
  478. package/dist/core/p-624d4f5f.entry.js +0 -2
  479. package/dist/core/p-6933f8e9.entry.js +0 -2
  480. package/dist/core/p-6c3044b6.entry.js +0 -2
  481. package/dist/core/p-6c3044b6.entry.js.map +0 -1
  482. package/dist/core/p-7267fe19.entry.js +0 -2
  483. package/dist/core/p-7267fe19.entry.js.map +0 -1
  484. package/dist/core/p-76915584.entry.js.map +0 -1
  485. package/dist/core/p-88d54b72.entry.js +0 -2
  486. package/dist/core/p-88d54b72.entry.js.map +0 -1
  487. package/dist/core/p-917c5721.entry.js.map +0 -1
  488. package/dist/core/p-942282cd.entry.js +0 -2
  489. package/dist/core/p-942282cd.entry.js.map +0 -1
  490. package/dist/core/p-96b3e7e2.js +0 -2
  491. package/dist/core/p-96b3e7e2.js.map +0 -1
  492. package/dist/core/p-9caf19eb.js +0 -2
  493. package/dist/core/p-9caf19eb.js.map +0 -1
  494. package/dist/core/p-a0f8efb2.entry.js.map +0 -1
  495. package/dist/core/p-aac4185b.entry.js +0 -2
  496. package/dist/core/p-aac4185b.entry.js.map +0 -1
  497. package/dist/core/p-b2aa3d7c.entry.js +0 -2
  498. package/dist/core/p-b2aa3d7c.entry.js.map +0 -1
  499. package/dist/core/p-ba86928c.entry.js +0 -2
  500. package/dist/core/p-ba86928c.entry.js.map +0 -1
  501. package/dist/core/p-d8469ac0.entry.js +0 -2
  502. package/dist/core/p-d8469ac0.entry.js.map +0 -1
  503. package/dist/core/p-db9c03c0.entry.js +0 -2
  504. package/dist/core/p-f6888309.entry.js +0 -2
  505. package/dist/core/p-f6888309.entry.js.map +0 -1
  506. package/dist/core/p-f74a8752.entry.js +0 -2
  507. package/dist/core/p-f74a8752.entry.js.map +0 -1
  508. package/dist/core/p-fc5611e2.entry.js.map +0 -1
  509. package/dist/esm/helpers-12b4266a.js.map +0 -1
  510. package/dist/esm/helpers-1f07eb61.js.map +0 -1
  511. package/dist/esm/ic-data-table-title-bar.entry.js +0 -53
  512. package/dist/esm/ic-data-table-title-bar.entry.js.map +0 -1
  513. package/dist/esm/ic-empty-state_2.entry.js.map +0 -1
  514. package/dist/esm/ic-input-component-container_3.entry.js.map +0 -1
  515. package/dist/esm/ic-input-label_2.entry.js +0 -81
  516. package/dist/esm/ic-input-label_2.entry.js.map +0 -1
  517. package/dist/types/components/ic-data-table-title-bar/ic-data-table-title-bar.d.ts +0 -36
  518. /package/dist/core/{p-869954a2.entry.js.map → p-00bd7919.entry.js.map} +0 -0
  519. /package/dist/core/{p-a50c3b9e.entry.js.map → p-1a91e842.entry.js.map} +0 -0
  520. /package/dist/core/{p-f3c840cd.entry.js.map → p-41b682dc.entry.js.map} +0 -0
  521. /package/dist/core/{p-8b08d8fe.entry.js.map → p-6dce8e88.entry.js.map} +0 -0
  522. /package/dist/core/{p-1ca332ca.entry.js.map → p-6eb58b0a.entry.js.map} +0 -0
  523. /package/dist/core/{p-5ae93c16.entry.js.map → p-7fda2f94.entry.js.map} +0 -0
  524. /package/dist/core/{p-c34848da.entry.js.map → p-8b1f9648.entry.js.map} +0 -0
  525. /package/dist/core/{p-a434c3d4.entry.js.map → p-8b820365.entry.js.map} +0 -0
  526. /package/dist/core/{p-2eac7dcc.entry.js.map → p-946625a3.entry.js.map} +0 -0
  527. /package/dist/core/{p-7ef8d616.entry.js.map → p-9528b29e.entry.js.map} +0 -0
  528. /package/dist/core/{p-a43c12cd.entry.js.map → p-9567c117.entry.js.map} +0 -0
  529. /package/dist/core/{p-b82dcc29.entry.js.map → p-957de939.entry.js.map} +0 -0
  530. /package/dist/core/{p-045359e1.entry.js.map → p-99bf38e3.entry.js.map} +0 -0
  531. /package/dist/core/{p-81ddc39d.entry.js.map → p-9d8883d7.entry.js.map} +0 -0
  532. /package/dist/core/{p-e834344e.entry.js.map → p-a1556d97.entry.js.map} +0 -0
  533. /package/dist/core/{p-f843da01.entry.js.map → p-a2dc10d8.entry.js.map} +0 -0
  534. /package/dist/core/{p-ab09986c.entry.js.map → p-a8c15117.entry.js.map} +0 -0
  535. /package/dist/core/{p-f7a14c01.entry.js.map → p-c14a897d.entry.js.map} +0 -0
  536. /package/dist/core/{p-e3997d60.entry.js.map → p-d2d63a61.entry.js.map} +0 -0
  537. /package/dist/core/{p-4f413fc0.entry.js.map → p-db3a35fb.entry.js.map} +0 -0
  538. /package/dist/core/{p-204ace96.entry.js.map → p-e16f73ba.entry.js.map} +0 -0
  539. /package/dist/core/{p-f14454b1.entry.js.map → p-e8151d13.entry.js.map} +0 -0
  540. /package/dist/core/{p-a31031a5.entry.js.map → p-ff3a01f3.entry.js.map} +0 -0
  541. /package/dist/core/{p-75dac3d1.entry.js.map → p-ff6f1e3a.entry.js.map} +0 -0
  542. /package/dist/types/components/{ic-data-table-title-bar/test/a11y/ic-data-table-title-bar.test.a11y.d.ts → ic-date-picker/test/a11y/ic-date-picker.test.a11y.d.ts} +0 -0
@@ -0,0 +1,1340 @@
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)}ic-input-component-container .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.previousEmittedDate = undefined;
186
+ this.previousSelectedDate = null;
187
+ this.selectedDate = null;
188
+ this.setInputPasteValue = (input, pastedValue) => {
189
+ const inputEl = input;
190
+ inputEl.value = pastedValue;
191
+ inputEl.classList.add(this.FIT_TO_VALUE);
192
+ };
193
+ this.checkSingleCopiedValueIsValid = (input, pastedValue) => {
194
+ let isValid = false;
195
+ const value = Number(pastedValue);
196
+ switch (input) {
197
+ case this.dayInputEl:
198
+ isValid = value >= 1 && value <= this.MAX_DAY;
199
+ break;
200
+ case this.monthInputEl:
201
+ isValid = value >= 1 && value <= this.MAX_MONTH;
202
+ break;
203
+ case this.yearInputEl:
204
+ isValid = true;
205
+ break;
206
+ default:
207
+ isValid = false;
208
+ break;
209
+ }
210
+ return isValid;
211
+ };
212
+ /**
213
+ * Using Object.prototype.string to determine type if event from user
214
+ * @param event - event object used to differentiate keyboard, generic or input event
215
+ * @returns boolean
216
+ */
217
+ this.isKeyboardOrEvent = (event) => {
218
+ return (Object.prototype.toString.call(event) === this.EVENT_OBJECT_STRING ||
219
+ Object.prototype.toString.call(event) ===
220
+ this.KEYBOARD_EVENT_OBJECT_STRING);
221
+ };
222
+ this.setDateValidity = () => {
223
+ if (!isEmptyString(this.day)) {
224
+ this.isValidDay = +this.day > this.MAX_DAY ? false : true;
225
+ }
226
+ else {
227
+ this.isValidDay = true;
228
+ }
229
+ if (!isEmptyString(this.month)) {
230
+ this.isValidMonth = +this.month > this.MAX_MONTH ? false : true;
231
+ }
232
+ else {
233
+ this.isValidMonth = true;
234
+ }
235
+ };
236
+ this.handleInput = (event) => {
237
+ const inputEvent = event;
238
+ const input = event.target;
239
+ if (input !== this.yearInputEl) {
240
+ // Only auto-format if input event is not a character being deleted
241
+ // and not as user is changing value using up / down keys
242
+ if (inputEvent.inputType !== "deleteContentBackward" &&
243
+ !this.preventAutoFormatting) {
244
+ if (input.value.length === 1 &&
245
+ ((input === this.dayInputEl && +input.value >= 4) ||
246
+ (input === this.monthInputEl && +input.value >= 2)) &&
247
+ +input.value <= 9) {
248
+ this.setInputValue(input);
249
+ this.notifyScreenReader(input, event);
250
+ this.moveToNextInput(input);
251
+ }
252
+ if (input.value.length === 2) {
253
+ if (+input.value === 0) {
254
+ input.value = "01";
255
+ }
256
+ this.setInputValue(input);
257
+ this.setPreventInput(input, true);
258
+ this.notifyScreenReader(input, event);
259
+ this.moveToNextInput(input);
260
+ }
261
+ else {
262
+ this.setPreventInput(input, false);
263
+ }
264
+ }
265
+ else if (this.preventAutoFormatting) {
266
+ /**
267
+ * Using arrow keys prevents auto formatting so need to deal with
268
+ * switching from arrow keys to inputting numbers
269
+ **/
270
+ if (input.value.length === 2 && !this.isKeyboardOrEvent(event)) {
271
+ this.setInputValue(input);
272
+ this.setPreventInput(input, true);
273
+ this.moveToNextInput(input);
274
+ }
275
+ else {
276
+ this.setInputValue(input);
277
+ }
278
+ }
279
+ if (input.value.length !== 2) {
280
+ this.setPreventInput(input, false);
281
+ }
282
+ }
283
+ else {
284
+ if (input.value.length === 4) {
285
+ this.setInputValue(input);
286
+ if (Object.prototype.toString.call(event) !== this.EVENT_OBJECT_STRING) {
287
+ this.moveToNextInput(input);
288
+ }
289
+ this.setPreventInput(input, true);
290
+ }
291
+ else {
292
+ this.setInputValue(input, true);
293
+ this.setPreventInput(input, false);
294
+ }
295
+ }
296
+ // Add / remove class to make input width match size of value i.e. 2 digits' width for day / month, 4 for year
297
+ this.setFitToValueStyling(input);
298
+ if (input.value.length === 0) {
299
+ this.setInputValue(input, true);
300
+ this.setValidationMessage();
301
+ }
302
+ this.notifyScreenReader(input, event);
303
+ };
304
+ this.handleKeyDown = (event, isInputPrevented) => {
305
+ const input = event.target;
306
+ const eventKey = event.key.toLowerCase();
307
+ // Regex required due to FF allowing all characters as values for number text field.
308
+ const regex = /-?\d*\.?\d+(e[-+]?\d+)?|[/-]|arrowup|arrowdown|arrowleft|arrowright|shift|tab|backspace|delete/;
309
+ if (!regex.test(eventKey) &&
310
+ !((event.ctrlKey || event.metaKey) &&
311
+ (eventKey === "v" || eventKey === "c"))) {
312
+ event.preventDefault();
313
+ }
314
+ switch (eventKey) {
315
+ case "/":
316
+ case "-":
317
+ case ".":
318
+ event.preventDefault();
319
+ this.setPasteInvalidText();
320
+ this.moveToNextInput(input);
321
+ break;
322
+ case "arrowright":
323
+ case "arrowleft":
324
+ event.preventDefault();
325
+ this.handleLeftRightArrowKeyPress(input, eventKey);
326
+ break;
327
+ case "arrowup":
328
+ case "arrowdown":
329
+ this.preventAutoFormatting = true;
330
+ this.handleUpDownArrowKeyPress(input, event);
331
+ break;
332
+ }
333
+ this.preventInput(event, isInputPrevented);
334
+ this.isDateSetFromKeyboardEvent = true;
335
+ };
336
+ this.handleFocus = (event) => {
337
+ // Highlight / select all characters in input for easy replacement
338
+ const input = event.target;
339
+ input.select();
340
+ };
341
+ this.handleBlur = (event) => {
342
+ const input = event.target;
343
+ this.setPasteInvalidText();
344
+ this.autocompleteInput(input);
345
+ };
346
+ this.handleLeftRightArrowKeyPress = (input, key) => {
347
+ if (key === "arrowright") {
348
+ this.moveToNextInput(input);
349
+ }
350
+ else {
351
+ this.moveToPreviousInput(input);
352
+ }
353
+ this.setPasteInvalidText();
354
+ };
355
+ this.notifyScreenReaderSelectedDate = () => {
356
+ const dayNames = stringEnumToArray(IcDayNames);
357
+ const months = stringEnumToArray(IcDateInputMonths);
358
+ this.selectedDateInfoEl.textContent = `Selected date: ${dayNames[this.selectedDate.getDay()]}, ${this.selectedDate.getDate()} ${months[this.selectedDate.getMonth()]} ${this.selectedDate.getFullYear()}`;
359
+ };
360
+ this.handleUpDownArrowKeyPress = (input, event) => {
361
+ const minValue = input === this.yearInputEl ? 0 : 1;
362
+ let maxValue;
363
+ switch (input) {
364
+ case this.dayInputEl:
365
+ maxValue = this.MAX_DAY;
366
+ break;
367
+ case this.monthInputEl:
368
+ maxValue = this.MAX_MONTH;
369
+ break;
370
+ case this.yearInputEl:
371
+ maxValue = 9999;
372
+ }
373
+ // Make value loop round when min / max reached
374
+ if (input === null || input === void 0 ? void 0 : input.value) {
375
+ if (event.key === "ArrowUp") {
376
+ if (+input.value === maxValue) {
377
+ event.preventDefault();
378
+ input.value = `0${minValue}`;
379
+ }
380
+ else {
381
+ input.value =
382
+ +input.value + 1 < 10
383
+ ? `0${+input.value + 1}`
384
+ : (+input.value + 1).toString();
385
+ }
386
+ this.notifyScreenReader(input, event);
387
+ }
388
+ if (event.key === "ArrowDown") {
389
+ if (+input.value === minValue) {
390
+ event.preventDefault();
391
+ input.value = maxValue.toString();
392
+ }
393
+ else {
394
+ input.value =
395
+ +input.value - 1 < 10
396
+ ? `0${+input.value - 1}`
397
+ : (+input.value - 1).toString();
398
+ }
399
+ this.notifyScreenReader(input, event);
400
+ }
401
+ }
402
+ else {
403
+ if (event.key === "ArrowDown") {
404
+ event.preventDefault();
405
+ if (input === this.yearInputEl) {
406
+ input.value = new Date().getFullYear().toString();
407
+ }
408
+ else {
409
+ input.value = maxValue.toString();
410
+ }
411
+ this.notifyScreenReader(input, event);
412
+ }
413
+ else if (event.key === "ArrowUp") {
414
+ event.preventDefault();
415
+ if (input === this.yearInputEl) {
416
+ input.value = new Date().getFullYear().toString();
417
+ }
418
+ else {
419
+ input.value = `0${minValue}`;
420
+ }
421
+ this.notifyScreenReader(input, event);
422
+ }
423
+ }
424
+ this.setInputValue(input);
425
+ this.setFitToValueStyling(input);
426
+ };
427
+ this.handleDateChange = (force) => {
428
+ // Prevent icChange being emitted when each individual input is changed
429
+ // This method is used within componentWillUpdate instead of using @Watch('value');
430
+ if (force || !dateMatches(this.selectedDate, this.previousSelectedDate)) {
431
+ if (this.value) {
432
+ this.inputsInOrder.forEach((input) => {
433
+ input.classList.add(this.FIT_TO_VALUE);
434
+ });
435
+ }
436
+ if (this.day && this.month && this.year && this.invalidDateText === "") {
437
+ this.setValueAndEmitChange(this.selectedDate);
438
+ this.notifyScreenReaderSelectedDate();
439
+ }
440
+ else if (!(this.selectedDate === null && this.previousSelectedDate === null)) {
441
+ this.setValueAndEmitChange(null);
442
+ this.selectedDateInfoEl.textContent = "";
443
+ }
444
+ this.previousSelectedDate = this.selectedDate;
445
+ if (!this.isDateSetFromKeyboardEvent) {
446
+ this.updateInputValues(this.day, this.month, this.year);
447
+ }
448
+ }
449
+ };
450
+ this.slicePastedDate = (valueLength, datePart) => {
451
+ return datePart.length > valueLength
452
+ ? datePart.slice(0, valueLength)
453
+ : datePart;
454
+ };
455
+ this.isPastedStringDateValid = (value) => {
456
+ if (/\d+-\d+-\d+$/.test(value) ||
457
+ /\d+\/\d+\/\d+/.test(value) ||
458
+ /\d+\.\d+\.\d+/.test(value)) {
459
+ return true;
460
+ }
461
+ if (/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}(?::[0-9]{2}(?:\.\d+)?)?Z/.test(value)) {
462
+ this.isZuluTime = true;
463
+ return true;
464
+ }
465
+ return false;
466
+ };
467
+ // Set value of each input to value of pasted date part
468
+ // Allows formats separated by '-' or '/'
469
+ this.handlePaste = (event) => {
470
+ event.preventDefault();
471
+ const pastedValue = event.clipboardData.getData("Text");
472
+ const isValidDate = this.isPastedStringDateValid(pastedValue);
473
+ this.setPastedValueAndValidation(isValidDate, pastedValue, event);
474
+ };
475
+ this.setDate = (date) => {
476
+ if (date === null || date === "" || date === undefined) {
477
+ this.day = null;
478
+ this.month = null;
479
+ this.year = null;
480
+ this.inputsInOrder.forEach((input) => {
481
+ input.classList.remove(this.FIT_TO_VALUE);
482
+ this.setPreventInput(input, false);
483
+ });
484
+ this.handleDateChange(true);
485
+ }
486
+ else {
487
+ if (isDateOrEpoch(date)) {
488
+ let newDate;
489
+ if (typeof date === "string") {
490
+ // Checking if epoch date time
491
+ newDate = new Date(+date);
492
+ }
493
+ else {
494
+ newDate = date;
495
+ }
496
+ this.day = convertToDoubleDigits(newDate.getDate());
497
+ this.month = convertToDoubleDigits(newDate.getMonth() + 1);
498
+ this.year = newDate.getFullYear().toString();
499
+ }
500
+ else if (typeof date === "string") {
501
+ const defaultDateArray = splitStringDate(date, this.dateFormat);
502
+ this.year = defaultDateArray[0];
503
+ this.month = defaultDateArray[1];
504
+ this.day = defaultDateArray[2];
505
+ }
506
+ }
507
+ this.setValidationMessage();
508
+ };
509
+ this.formatMinMax = (date) => {
510
+ let formattedDate;
511
+ const day = convertToDoubleDigits(date.getDate());
512
+ const month = convertToDoubleDigits(date.getMonth() + 1);
513
+ const year = date.getFullYear();
514
+ switch (this.dateFormat) {
515
+ case "DD/MM/YYYY":
516
+ formattedDate = `${day}/${month}/${year}`;
517
+ break;
518
+ case "MM/DD/YYYY":
519
+ formattedDate = `${month}/${day}/${year}`;
520
+ break;
521
+ case "YYYY/MM/DD":
522
+ formattedDate = `${year}/${month}/${day}`;
523
+ break;
524
+ }
525
+ return formattedDate;
526
+ };
527
+ this.updateInputValues = (day, month, year) => {
528
+ this.dayInputEl.value = day;
529
+ this.monthInputEl.value = month;
530
+ this.yearInputEl.value = year;
531
+ };
532
+ // Set value in state based on input
533
+ this.setInputValue = (input, clear = false) => {
534
+ const newValue = clear ? "" : input.value;
535
+ switch (input) {
536
+ case this.dayInputEl:
537
+ this.day = newValue;
538
+ break;
539
+ case this.monthInputEl:
540
+ this.month = newValue;
541
+ break;
542
+ case this.yearInputEl:
543
+ if (this.year !== newValue) {
544
+ this.year = newValue;
545
+ }
546
+ }
547
+ this.setValidationMessage();
548
+ };
549
+ this.setValidationMessage = () => {
550
+ this.setDateValidity();
551
+ if (!isEmptyString(this.day) &&
552
+ !isEmptyString(this.month) &&
553
+ !isEmptyString(this.year)) {
554
+ // Check whether date actually exists
555
+ // (used https://www.hectane.com/blog/javascript-date-validation-with-leap-year)
556
+ this.selectedDate = this.convertToDate(this.year, this.month, this.day);
557
+ this.isValidDate =
558
+ +this.selectedDate !== 0 && this.selectedDate.getDate() == +this.day;
559
+ this.isDisabledDate = this.isSelectedDateDisabled();
560
+ if (!this.isValidDate || this.isDisabledDate) {
561
+ this.inputsInOrder.forEach((input) => input.setAttribute(this.ARIA_INVALID, "true"));
562
+ }
563
+ else {
564
+ this.inputsInOrder.forEach((input) => input.removeAttribute(this.ARIA_INVALID));
565
+ }
566
+ }
567
+ else {
568
+ this.selectedDate = null;
569
+ }
570
+ if (!(this.isValidDay && this.isValidMonth && this.isValidDate)) {
571
+ this.invalidDateText = "Please enter a valid date.";
572
+ }
573
+ else if (this.isDisabledDate && this.selectedDate !== null) {
574
+ if (this.isBeforeMin) {
575
+ if (this.disablePast) {
576
+ this.invalidDateText = this.disablePastMessage;
577
+ }
578
+ else {
579
+ this.invalidDateText = `Please enter a date after ${this.formatMinMax(this.minDate)}.`;
580
+ }
581
+ }
582
+ else if (this.isAfterMax) {
583
+ if (this.disableFuture) {
584
+ this.invalidDateText = this.disableFutureMessage;
585
+ }
586
+ else {
587
+ this.invalidDateText = `Please enter a date before ${this.formatMinMax(this.maxDate)}.`;
588
+ }
589
+ }
590
+ else if (this.disableDays.length !== 0) {
591
+ this.invalidDateText = this.disableDaysMessage;
592
+ }
593
+ else {
594
+ if (this.disablePast) {
595
+ this.invalidDateText = this.disablePastMessage;
596
+ }
597
+ if (this.disableFuture) {
598
+ this.invalidDateText = this.disableFutureMessage;
599
+ }
600
+ }
601
+ }
602
+ else {
603
+ this.invalidDateText = "";
604
+ }
605
+ };
606
+ // Set refs to the input elements in the order they are displayed (based on the dateFormat)
607
+ this.setInputsInOrder = () => {
608
+ const inputs = this.el.shadowRoot.querySelectorAll("input");
609
+ inputs.forEach((input) => this.inputsInOrder.push(input));
610
+ };
611
+ // Includes text usually added using aria-describedby
612
+ // (which doesn't work on input component container)
613
+ this.setAriaLabelledBy = () => {
614
+ var _a;
615
+ if (this.disabled &&
616
+ !isEmptyString((_a = this.inputCompContainerEl) === null || _a === void 0 ? void 0 : _a.getAttribute(this.ARIA_LABELLED_BY))) {
617
+ this.removeAriaLabelledBy();
618
+ return;
619
+ }
620
+ if (this.disabled) {
621
+ return;
622
+ }
623
+ const labelEl = this.el.shadowRoot.querySelector("label");
624
+ const labelId = `${this.inputId}-label`;
625
+ if (labelEl !== null && labelEl !== undefined) {
626
+ labelEl.id = labelId;
627
+ const hasValidation = (!isEmptyString(this.validationStatus) &&
628
+ !isEmptyString(this.validationText)) ||
629
+ !isEmptyString(this.invalidDateText);
630
+ const labelledBy = `${labelId} ${this.screenReaderInfoId} ${getInputDescribedByText(this.inputId, this.helperText !== "" && this.helperText !== this.defaultHelperText, hasValidation)} ${this.selectedDate ? this.selectedDateInfoId : ""} ${this.assistiveHintId}`;
631
+ this.inputCompContainerEl.setAttribute(this.ARIA_LABELLED_BY, labelledBy);
632
+ }
633
+ };
634
+ // Sets boolean for each input, used to limit the number of characters within each field (2 for day / month, 4 for year)
635
+ this.setPreventInput = (input, isPrevented) => {
636
+ switch (input) {
637
+ case this.dayInputEl:
638
+ this.preventDayInput = isPrevented;
639
+ break;
640
+ case this.monthInputEl:
641
+ this.preventMonthInput = isPrevented;
642
+ break;
643
+ case this.yearInputEl:
644
+ this.preventYearInput = isPrevented;
645
+ }
646
+ };
647
+ // Get input based on letter representing each date part ("D", "M" or "Y")
648
+ // (retrieved from dateFormat)
649
+ this.getInputFromDatePart = (datePart) => {
650
+ 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) }));
651
+ 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) }));
652
+ 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) }));
653
+ let input;
654
+ switch (datePart) {
655
+ case "D":
656
+ input = dayInput;
657
+ break;
658
+ case "M":
659
+ input = monthInput;
660
+ break;
661
+ case "Y":
662
+ input = yearInput;
663
+ }
664
+ return input;
665
+ };
666
+ // Get input elements in order of chosen date format
667
+ this.getInputsInOrder = () => {
668
+ const dateParts = this.dateFormat.split("/");
669
+ const inputsInOrder = [];
670
+ dateParts.forEach((part) => {
671
+ inputsInOrder.push(this.getInputFromDatePart(part.substring(0, 1)));
672
+ });
673
+ return inputsInOrder;
674
+ };
675
+ // To add to the end of assistive hint to make it clearer that each date part has its own input
676
+ // that can be changed individually
677
+ this.getDescOfInputsOrder = () => {
678
+ let description;
679
+ switch (this.dateFormat) {
680
+ case "DD/MM/YYYY":
681
+ description = "day, month, and year";
682
+ break;
683
+ case "MM/DD/YYYY":
684
+ description = "month, day, and year";
685
+ break;
686
+ case "YYYY/MM/DD":
687
+ description = "year, month, and day";
688
+ }
689
+ return description;
690
+ };
691
+ // Add 'required' or 'invalid data' to span used in aria-labelledby
692
+ // Many ARIA attributes aren't read out by screen reader when on the input component container
693
+ this.getScreenReaderInfo = (validationStatus) => {
694
+ let inputDescriptors = "";
695
+ if (this.required) {
696
+ inputDescriptors += "required";
697
+ }
698
+ if (validationStatus === IcInformationStatus.Error) {
699
+ inputDescriptors += " invalid data";
700
+ }
701
+ return inputDescriptors === "" ? "" : inputDescriptors + ", ";
702
+ };
703
+ // Prevent non-number characters being entered
704
+ // ('e' or '.' - which are usually allowed in <input type="number">)
705
+ // And limit the number of characters within each field (2 for day / month, 4 for year)
706
+ // (because 'maxlength' doesn't work on <input type="number">)
707
+ this.preventInput = (event, isInputPrevented) => {
708
+ const key = event.key;
709
+ const input = event.target;
710
+ let selectedString;
711
+ if (input) {
712
+ selectedString = input.value.substring(input.selectionStart, input.selectionEnd);
713
+ }
714
+ if (key === "e" ||
715
+ key === "." ||
716
+ key === "-" ||
717
+ (event.key >= "0" &&
718
+ event.key <= "9" &&
719
+ isInputPrevented &&
720
+ !selectedString)) {
721
+ event.preventDefault();
722
+ }
723
+ };
724
+ // Get whether date has been disabled using disableFuture or disablePast prop, but always allow current day
725
+ // Consider using dateClamp and inDateRange
726
+ this.isSelectedDateDisabled = () => {
727
+ const currentDate = new Date();
728
+ this.isAfterMax = false;
729
+ this.isBeforeMin = false;
730
+ let disabled = false;
731
+ const isNotToday = this.selectedDate.toDateString() !== currentDate.toDateString();
732
+ if (this.minDate && this.selectedDate < this.minDate && isNotToday) {
733
+ this.isBeforeMin = true;
734
+ disabled = true;
735
+ }
736
+ if (this.maxDate && this.selectedDate > this.maxDate && isNotToday) {
737
+ this.isAfterMax = true;
738
+ disabled = true;
739
+ }
740
+ if (this.disableDays.includes(this.selectedDate.getDay())) {
741
+ disabled = true;
742
+ }
743
+ if (((this.disablePast && this.selectedDate < currentDate) ||
744
+ (this.disableFuture && this.selectedDate > currentDate)) &&
745
+ isNotToday) {
746
+ disabled = true;
747
+ }
748
+ return disabled;
749
+ };
750
+ this.moveToNextInput = (currentInput) => {
751
+ const currentInputPos = this.inputsInOrder.findIndex((input) => input === currentInput);
752
+ const nextInput = this.inputsInOrder[currentInputPos + 1];
753
+ this.preventAutoFormatting = false;
754
+ if (nextInput) {
755
+ nextInput.focus();
756
+ }
757
+ };
758
+ this.moveToPreviousInput = (currentInput) => {
759
+ const currentInputPos = this.inputsInOrder.findIndex((input) => input === currentInput);
760
+ this.preventAutoFormatting = false;
761
+ if (this.inputsInOrder[currentInputPos - 1]) {
762
+ this.inputsInOrder[currentInputPos - 1].focus();
763
+ }
764
+ };
765
+ this.autocompleteInput = (input) => {
766
+ if (input === this.yearInputEl) {
767
+ this.autocompleteYear();
768
+ }
769
+ else {
770
+ const inputValue = input.value;
771
+ // Autocomplete input as 2 characters (leading zero) when only 1 character entered (for day and month)
772
+ if (inputValue.length === 1) {
773
+ if (+inputValue === 0) {
774
+ input.value = "01";
775
+ }
776
+ else {
777
+ input.value = `0${inputValue}`;
778
+ }
779
+ }
780
+ }
781
+ if (input.value) {
782
+ this.setInputValue(input);
783
+ }
784
+ };
785
+ // Autocomplete year as current millennium when fewer than 4 characters entered
786
+ this.autocompleteYear = () => {
787
+ const inputValue = this.yearInputEl.value;
788
+ const yearNumbers = ["2", "0", "0"];
789
+ let autocompletedInput = "";
790
+ if (inputValue) {
791
+ yearNumbers.forEach((number, index) => {
792
+ if (inputValue.length + index <= 3) {
793
+ autocompletedInput += number;
794
+ }
795
+ });
796
+ this.yearInputEl.value = `${autocompletedInput}${inputValue}`;
797
+ }
798
+ };
799
+ this.convertToDate = (year, month, day) => {
800
+ if (!isEmptyString(year) && !isEmptyString(month) && !isEmptyString(day)) {
801
+ return new Date(+year, +month - 1, +day);
802
+ }
803
+ else {
804
+ return null;
805
+ }
806
+ };
807
+ this.handleHostBlur = () => {
808
+ this.removeLabelledBy = false;
809
+ this.icBlur.emit({ value: this.selectedDate });
810
+ };
811
+ this.handleHostFocus = () => {
812
+ var _a;
813
+ if ((_a = this.el.shadowRoot.activeElement) === null || _a === void 0 ? void 0 : _a.id.match(/(day|month|year)-input$/)) {
814
+ this.removeLabelledBy = false;
815
+ }
816
+ else {
817
+ this.removeLabelledBy = true;
818
+ }
819
+ this.icFocus.emit({ value: this.selectedDate });
820
+ };
821
+ this.handleFormReset = () => {
822
+ // Get the initial value and populate day, month and year again.
823
+ this.setDate(this.initialValue);
824
+ this.setValidationMessage();
825
+ this.handleDateChange(false);
826
+ };
827
+ this.getAriaLabel = (input) => {
828
+ return input.getAttribute(this.ARIA_LABEL);
829
+ };
830
+ this.notifyScreenReaderArrowKeys = (input) => {
831
+ const liveRegion = this.el.shadowRoot.querySelector("#live-region");
832
+ let announcement = "";
833
+ const ariaLabel = this.getAriaLabel(input);
834
+ if (liveRegion && input.value) {
835
+ if (input === this.monthInputEl &&
836
+ !!IcDateInputMonths[+input.value - 1]) {
837
+ announcement = `${input.value} - ${IcDateInputMonths[+input.value - 1]}, ${ariaLabel}`;
838
+ }
839
+ if (input === this.dayInputEl || input === this.yearInputEl) {
840
+ announcement = `${input.value}, ${ariaLabel}`;
841
+ }
842
+ liveRegion.textContent = announcement;
843
+ }
844
+ };
845
+ this.notifyScreenReaderInput = (input, liveRegion) => {
846
+ let announcement = "";
847
+ const ariaLabel = this.getAriaLabel(input);
848
+ if (input === this.dayInputEl || input === this.monthInputEl) {
849
+ if (input.value.length === 2) {
850
+ if (input === this.monthInputEl &&
851
+ !!IcDateInputMonths[+input.value - 1] &&
852
+ this.isValidMonth) {
853
+ announcement = `${input.value} - ${IcDateInputMonths[+input.value - 1]}, ${ariaLabel}`;
854
+ }
855
+ if (input === this.dayInputEl && this.isValidDay) {
856
+ announcement = `${input.value}, ${ariaLabel}`;
857
+ }
858
+ }
859
+ else {
860
+ announcement = "";
861
+ }
862
+ }
863
+ else {
864
+ if (input.value.length === 4) {
865
+ announcement = `${input.value}, ${ariaLabel}`;
866
+ }
867
+ else {
868
+ announcement = "";
869
+ }
870
+ }
871
+ liveRegion.textContent = announcement;
872
+ };
873
+ this.setFitToValueStyling = (input) => {
874
+ if (input.value) {
875
+ input.classList.add(this.FIT_TO_VALUE);
876
+ }
877
+ else {
878
+ input.classList.remove(this.FIT_TO_VALUE);
879
+ }
880
+ };
881
+ this.setAriaInvalid = (validDay, validMonth, validDate, disabledDate) => {
882
+ if (this.inputsInOrder.length) {
883
+ this.inputsInOrder.forEach((input) => {
884
+ input.removeAttribute(this.ARIA_INVALID);
885
+ });
886
+ if (!validDay) {
887
+ this.dayInputEl.setAttribute(this.ARIA_INVALID, "true");
888
+ }
889
+ if (!validMonth) {
890
+ this.monthInputEl.setAttribute(this.ARIA_INVALID, "true");
891
+ }
892
+ if (!validDate || disabledDate) {
893
+ this.inputsInOrder.forEach((input) => {
894
+ input.setAttribute(this.ARIA_INVALID, "true");
895
+ });
896
+ }
897
+ }
898
+ };
899
+ this.handleClear = () => {
900
+ this.inputsInOrder.forEach((input) => {
901
+ input.classList.remove(this.FIT_TO_VALUE);
902
+ this.setInputValue(input, true);
903
+ this.setPreventInput(input, false);
904
+ });
905
+ this.isDateSetFromKeyboardEvent = false;
906
+ this.setValidationMessage();
907
+ this.handleDateChange(true);
908
+ this.inputsInOrder[0].focus();
909
+ };
910
+ this.handleCalendarOpen = (ev) => {
911
+ var _a, _b;
912
+ ev.stopImmediatePropagation();
913
+ (_a = this.calendarButtonEl) === null || _a === void 0 ? void 0 : _a.shadowRoot.querySelector("ic-tooltip").displayTooltip(false);
914
+ this.calendarButtonClicked.emit({ value: this.selectedDate });
915
+ (_b = this.calendarButtonEl) === null || _b === void 0 ? void 0 : _b.shadowRoot.querySelector("ic-tooltip").displayTooltip(false);
916
+ this.isDateSetFromKeyboardEvent = false;
917
+ };
918
+ this.setValueAndEmitChange = (value) => {
919
+ if (!dateMatches(new Date(this.value), value)) {
920
+ this.emitIcChange(value);
921
+ this.value = value;
922
+ }
923
+ };
924
+ this.handleCalendarFocus = () => {
925
+ this.calendarFocused = true;
926
+ };
927
+ this.handleCalendarBlur = () => {
928
+ this.calendarFocused = false;
929
+ };
930
+ this.handleClearFocus = () => {
931
+ this.removeLabelledBy = true;
932
+ this.clearButtonFocused = true;
933
+ };
934
+ this.handleClearBlur = (ev) => {
935
+ var _a;
936
+ this.clearButtonFocused = false;
937
+ if ((_a = ev.relatedTarget) === null || _a === void 0 ? void 0 : _a.id.match(/(day|year)-input$/)) {
938
+ this.removeLabelledBy = false;
939
+ return;
940
+ }
941
+ this.removeLabelledBy = true;
942
+ };
943
+ this.emitIcChange = (d) => {
944
+ if (!(d === null && this.previousEmittedDate === null) &&
945
+ !dateMatches(d, this.previousEmittedDate)) {
946
+ this.previousEmittedDate = d;
947
+ this.icChange.emit({ value: d });
948
+ }
949
+ };
950
+ this.day = "";
951
+ this.invalidDateText = undefined;
952
+ this.maxDate = undefined;
953
+ this.minDate = undefined;
954
+ this.month = "";
955
+ this.year = "";
956
+ this.calendarFocused = false;
957
+ this.clearButtonFocused = false;
958
+ this.removeLabelledBy = false;
959
+ this.dateFormat = "DD/MM/YYYY";
960
+ this.disabled = false;
961
+ this.disableDays = [];
962
+ this.disableDaysMessage = "The date you have selected is on a day of the week that is not allowed. Please select another date.";
963
+ this.disableFuture = false;
964
+ this.disableFutureMessage = "Dates in the future are not allowed. Please select a date in the past.";
965
+ this.disablePast = false;
966
+ this.disablePastMessage = "Dates in the past are not allowed. Please select a date in the future.";
967
+ this.helperText = undefined;
968
+ this.inputId = `ic-date-input-${inputIds++}`;
969
+ this.label = undefined;
970
+ this.max = "";
971
+ this.min = "";
972
+ this.name = this.inputId;
973
+ this.required = false;
974
+ this.showCalendarButton = false;
975
+ this.showClearButton = true;
976
+ this.size = "default";
977
+ this.value = "";
978
+ this.validationStatus = "";
979
+ this.validationText = "";
980
+ }
981
+ watchDisableFutureHandler() {
982
+ this.watchMaxHandler();
983
+ }
984
+ watchDisablePastHandler() {
985
+ this.watchMinHandler();
986
+ }
987
+ watchMaxHandler() {
988
+ if (this.disableFuture) {
989
+ this.maxDate = new Date();
990
+ }
991
+ else {
992
+ this.maxDate = createDate(this.max, this.dateFormat);
993
+ }
994
+ }
995
+ watchMinHandler() {
996
+ if (this.disablePast) {
997
+ this.minDate = new Date();
998
+ }
999
+ else {
1000
+ this.minDate = createDate(this.min, this.dateFormat);
1001
+ }
1002
+ }
1003
+ watchRequiredHandler() {
1004
+ // Prevent asterisk being read out after the label by screen reader (by applying aria-hidden)
1005
+ // Needed because label is included in 'aria-labelledby' instead of using 'aria-label'
1006
+ const labelEl = this.el.shadowRoot.querySelector("label");
1007
+ if (this.required) {
1008
+ const asteriskSpan = document.createElement("span");
1009
+ asteriskSpan.setAttribute("id", "asterisk-span");
1010
+ asteriskSpan.setAttribute("aria-hidden", "true");
1011
+ asteriskSpan.textContent = " *";
1012
+ labelEl === null || labelEl === void 0 ? void 0 : labelEl.appendChild(asteriskSpan);
1013
+ }
1014
+ else {
1015
+ const asteriskSpan = this.el.shadowRoot.querySelector("#asterisk-span");
1016
+ if (asteriskSpan) {
1017
+ asteriskSpan.remove();
1018
+ }
1019
+ }
1020
+ }
1021
+ disconnectedCallback() {
1022
+ removeFormResetListener(this.el, this.handleFormReset);
1023
+ }
1024
+ componentWillLoad() {
1025
+ this.defaultHelperText = `Use format ${this.dateFormat}`;
1026
+ if (isEmptyString(this.helperText))
1027
+ this.helperText = this.defaultHelperText;
1028
+ this.watchMinHandler();
1029
+ this.watchMaxHandler();
1030
+ if (this.value) {
1031
+ this.setDate(this.value);
1032
+ this.previousEmittedDate = this.selectedDate;
1033
+ }
1034
+ else {
1035
+ this.previousEmittedDate = null;
1036
+ }
1037
+ this.screenReaderInfoId = `${this.inputId}-screen-reader-info`;
1038
+ this.assistiveHintId = `${this.inputId}-assistive-hint`;
1039
+ this.selectedDateInfoId = `${this.inputId}-selected-date-info`;
1040
+ addFormResetListener(this.el, this.handleFormReset);
1041
+ }
1042
+ componentDidLoad() {
1043
+ this.setInputsInOrder();
1044
+ onComponentRequiredPropUndefined([{ prop: this.label, propName: "label" }], "Date Input");
1045
+ if (this.value) {
1046
+ this.updateInputValues(this.day, this.month, this.year);
1047
+ this.inputsInOrder.forEach((input) => {
1048
+ input.classList.add(this.FIT_TO_VALUE);
1049
+ });
1050
+ }
1051
+ this.setAriaInvalid(this.isValidDay, this.isValidMonth, this.isValidDate, this.isDisabledDate);
1052
+ if (this.value) {
1053
+ this.notifyScreenReaderSelectedDate();
1054
+ }
1055
+ this.inputsInOrder.forEach((input) => {
1056
+ input.addEventListener("input", this.handleInput);
1057
+ input.addEventListener("focus", this.handleFocus);
1058
+ input.addEventListener("blur", this.handleBlur);
1059
+ });
1060
+ this.watchRequiredHandler();
1061
+ }
1062
+ componentWillUpdate() {
1063
+ if (isEmptyString(this.helperText))
1064
+ this.helperText = this.defaultHelperText;
1065
+ if (!this.isDateSetFromKeyboardEvent)
1066
+ this.setDate(this.value);
1067
+ this.setAriaInvalid(this.isValidDay, this.isValidMonth, this.isValidDate, this.isDisabledDate);
1068
+ this.handleDateChange(false);
1069
+ this.isDateSetFromKeyboardEvent = false;
1070
+ }
1071
+ componentDidRender() {
1072
+ if (this.removeLabelledBy) {
1073
+ this.removeAriaLabelledBy();
1074
+ return;
1075
+ }
1076
+ this.setAriaLabelledBy();
1077
+ }
1078
+ /**
1079
+ * Returns the value as a Date object
1080
+ * @returns Date
1081
+ */
1082
+ async getDate() {
1083
+ return this.selectedDate;
1084
+ }
1085
+ /**
1086
+ * @internal Sets focus on the calendar button.
1087
+ */
1088
+ async setCalendarFocus() {
1089
+ if (this.calendarButtonEl) {
1090
+ this.calendarButtonEl.focus();
1091
+ }
1092
+ }
1093
+ /**
1094
+ * @internal Used to pass disabledDays from parent component.
1095
+ */
1096
+ async setDisableDays(days) {
1097
+ this.disableDays = days;
1098
+ }
1099
+ /**
1100
+ * @internal Used to enable other components to invoke an IcChange event from the input.
1101
+ */
1102
+ async triggerIcChange(d) {
1103
+ this.emitIcChange(d);
1104
+ }
1105
+ removeAriaLabelledBy() {
1106
+ this.inputCompContainerEl.removeAttribute(this.ARIA_LABELLED_BY);
1107
+ }
1108
+ setPastedValueAndValidation(isValidDate, pastedValue, event) {
1109
+ switch (true) {
1110
+ case isValidDate: {
1111
+ const nextParsedValue = this.isZuluTime
1112
+ ? extractDateFromZuluDateTime(pastedValue)
1113
+ : pastedValue;
1114
+ const dateParts = nextParsedValue.split(/-|\/|\./);
1115
+ this.inputsInOrder.forEach((input, index) => {
1116
+ input.classList.add(this.FIT_TO_VALUE);
1117
+ if (this.isZuluTime) {
1118
+ this.pasteZuluDateTime(dateParts, index);
1119
+ }
1120
+ else {
1121
+ let dateValue;
1122
+ if (input === this.dayInputEl || input === this.monthInputEl) {
1123
+ dateValue = this.slicePastedDate(2, dateParts[index]);
1124
+ }
1125
+ else {
1126
+ dateValue = this.slicePastedDate(4, dateParts[index]);
1127
+ }
1128
+ input.value = dateValue;
1129
+ this.setInputValue(input);
1130
+ this.autocompleteInput(input);
1131
+ }
1132
+ });
1133
+ this.isZuluTime = false;
1134
+ break;
1135
+ }
1136
+ case (pastedValue.length === 1 ||
1137
+ pastedValue.length === 2 ||
1138
+ pastedValue.length === 4) &&
1139
+ isNumeric(pastedValue):
1140
+ if (this.checkSingleCopiedValueIsValid(event.target, pastedValue)) {
1141
+ // Check if copied value can be pasted into input
1142
+ this.setInputPasteValue(event.target, pastedValue);
1143
+ this.setInputValue(event.target);
1144
+ }
1145
+ else {
1146
+ this.displayPastedValidation(event);
1147
+ }
1148
+ break;
1149
+ case pastedValue.length === 3 && isNumeric(pastedValue):
1150
+ if (event.target !== this.yearInputEl) {
1151
+ this.displayPastedValidation(event);
1152
+ }
1153
+ else {
1154
+ this.setInputPasteValue(event.target, pastedValue);
1155
+ this.setInputValue(event.target);
1156
+ }
1157
+ break;
1158
+ case pastedValue.length >= 5 && isNumeric(pastedValue):
1159
+ this.displayPastedValidation(event);
1160
+ }
1161
+ }
1162
+ pasteZuluDateTime(dateParts, index) {
1163
+ // ['YYYY', 'MM', 'DD']
1164
+ if (index === 0) {
1165
+ const dateValue = this.slicePastedDate(4, dateParts[index]);
1166
+ this.yearInputEl.value = dateValue;
1167
+ this.setInputValue(this.yearInputEl);
1168
+ }
1169
+ else if (index === 1) {
1170
+ // The month value is the second item in the array
1171
+ const dateValue = this.slicePastedDate(2, dateParts[index]);
1172
+ this.monthInputEl.value = dateValue;
1173
+ this.setInputValue(this.monthInputEl);
1174
+ }
1175
+ else {
1176
+ const dateValue = this.slicePastedDate(2, dateParts[index]);
1177
+ this.dayInputEl.value = dateValue;
1178
+ this.setInputValue(this.dayInputEl);
1179
+ }
1180
+ }
1181
+ displayPastedValidation(event) {
1182
+ var _a;
1183
+ if (((_a = this.invalidDateText) === null || _a === void 0 ? void 0 : _a.length) > 0) {
1184
+ this.previousInvalidDateTest = this.invalidDateText;
1185
+ }
1186
+ this.invalidDateText = `Please paste a valid ${this.getAriaLabel(event.target)}`;
1187
+ this.validationStatus = IcInformationStatus.Error;
1188
+ this.isPasteValidationDisplayed = true;
1189
+ }
1190
+ setPasteInvalidText() {
1191
+ var _a;
1192
+ if (this.isPasteValidationDisplayed) {
1193
+ this.invalidDateText = (_a = this.previousInvalidDateTest) !== null && _a !== void 0 ? _a : "";
1194
+ this.isPasteValidationDisplayed = false;
1195
+ // This is to prevent setDate from triggering within componentWillUpdate
1196
+ this.isDateSetFromKeyboardEvent = true;
1197
+ }
1198
+ }
1199
+ notifyScreenReader(input, event) {
1200
+ const liveRegion = this.el.shadowRoot.querySelector("#live-region");
1201
+ if (liveRegion) {
1202
+ if (this.isKeyboardOrEvent(event)) {
1203
+ this.notifyScreenReaderArrowKeys(input);
1204
+ }
1205
+ else if (Object.prototype.toString.call(event) === this.INPUT_EVENT_OBJECT_STRING) {
1206
+ this.notifyScreenReaderInput(input, liveRegion);
1207
+ }
1208
+ }
1209
+ }
1210
+ render() {
1211
+ const { inputId, label, disabled, helperText, showClearButton, showCalendarButton, size, } = this;
1212
+ const hasCustomValidation = !isEmptyString(this.validationStatus) &&
1213
+ !isEmptyString(this.validationText);
1214
+ const validationStatus = hasCustomValidation
1215
+ ? this.validationStatus
1216
+ : !isEmptyString(this.invalidDateText)
1217
+ ? IcInformationStatus.Error
1218
+ : "";
1219
+ const assistiveHint = `Type or use the up and down arrow keys to change the values for the ${this.getDescOfInputsOrder()}.`;
1220
+ renderHiddenInput(true, this.el, this.name, this.convertToDate(this.year, this.month, this.day), this.disabled);
1221
+ 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: {
1222
+ ["clear-button"]: true,
1223
+ ["hidden"]: isEmptyString(this.day) &&
1224
+ isEmptyString(this.month) &&
1225
+ isEmptyString(this.year),
1226
+ }, disabled: this.disabled, innerHTML: Clear, onClick: this.handleClear, onFocus: this.handleClearFocus, onBlur: this.handleClearBlur, variant: "icon", appearance: this.clearButtonFocused
1227
+ ? IcThemeForegroundEnum.Light
1228
+ : 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
1229
+ ? IcThemeForegroundEnum.Light
1230
+ : 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 })))));
1231
+ }
1232
+ static get delegatesFocus() { return true; }
1233
+ get el() { return this; }
1234
+ static get watchers() { return {
1235
+ "disableFuture": ["watchDisableFutureHandler"],
1236
+ "disablePast": ["watchDisablePastHandler"],
1237
+ "max": ["watchMaxHandler"],
1238
+ "min": ["watchMinHandler"],
1239
+ "required": ["watchRequiredHandler"]
1240
+ }; }
1241
+ static get style() { return icDateInputCss; }
1242
+ }, [17, "ic-date-input", {
1243
+ "dateFormat": [1, "date-format"],
1244
+ "disabled": [4],
1245
+ "disableDays": [1040],
1246
+ "disableDaysMessage": [1, "disable-days-message"],
1247
+ "disableFuture": [4, "disable-future"],
1248
+ "disableFutureMessage": [1, "disable-future-message"],
1249
+ "disablePast": [4, "disable-past"],
1250
+ "disablePastMessage": [1, "disable-past-message"],
1251
+ "helperText": [1025, "helper-text"],
1252
+ "inputId": [1, "input-id"],
1253
+ "label": [1],
1254
+ "max": [1],
1255
+ "min": [1],
1256
+ "name": [1],
1257
+ "required": [4],
1258
+ "showCalendarButton": [4, "show-calendar-button"],
1259
+ "showClearButton": [4, "show-clear-button"],
1260
+ "size": [1],
1261
+ "value": [1025],
1262
+ "validationStatus": [1025, "validation-status"],
1263
+ "validationText": [1, "validation-text"],
1264
+ "day": [32],
1265
+ "invalidDateText": [32],
1266
+ "maxDate": [32],
1267
+ "minDate": [32],
1268
+ "month": [32],
1269
+ "year": [32],
1270
+ "calendarFocused": [32],
1271
+ "clearButtonFocused": [32],
1272
+ "removeLabelledBy": [32],
1273
+ "getDate": [64],
1274
+ "setCalendarFocus": [64],
1275
+ "setDisableDays": [64],
1276
+ "triggerIcChange": [64]
1277
+ }, undefined, {
1278
+ "disableFuture": ["watchDisableFutureHandler"],
1279
+ "disablePast": ["watchDisablePastHandler"],
1280
+ "max": ["watchMaxHandler"],
1281
+ "min": ["watchMinHandler"],
1282
+ "required": ["watchRequiredHandler"]
1283
+ }]);
1284
+ function defineCustomElement() {
1285
+ if (typeof customElements === "undefined") {
1286
+ return;
1287
+ }
1288
+ 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"];
1289
+ components.forEach(tagName => { switch (tagName) {
1290
+ case "ic-date-input":
1291
+ if (!customElements.get(tagName)) {
1292
+ customElements.define(tagName, DateInput);
1293
+ }
1294
+ break;
1295
+ case "ic-button":
1296
+ if (!customElements.get(tagName)) {
1297
+ defineCustomElement$8();
1298
+ }
1299
+ break;
1300
+ case "ic-input-component-container":
1301
+ if (!customElements.get(tagName)) {
1302
+ defineCustomElement$7();
1303
+ }
1304
+ break;
1305
+ case "ic-input-container":
1306
+ if (!customElements.get(tagName)) {
1307
+ defineCustomElement$6();
1308
+ }
1309
+ break;
1310
+ case "ic-input-label":
1311
+ if (!customElements.get(tagName)) {
1312
+ defineCustomElement$5();
1313
+ }
1314
+ break;
1315
+ case "ic-input-validation":
1316
+ if (!customElements.get(tagName)) {
1317
+ defineCustomElement$4();
1318
+ }
1319
+ break;
1320
+ case "ic-loading-indicator":
1321
+ if (!customElements.get(tagName)) {
1322
+ defineCustomElement$3();
1323
+ }
1324
+ break;
1325
+ case "ic-tooltip":
1326
+ if (!customElements.get(tagName)) {
1327
+ defineCustomElement$2();
1328
+ }
1329
+ break;
1330
+ case "ic-typography":
1331
+ if (!customElements.get(tagName)) {
1332
+ defineCustomElement$1();
1333
+ }
1334
+ break;
1335
+ } });
1336
+ }
1337
+
1338
+ export { DateInput as D, dateInRange as a, getMonthStart as b, dateMatches as c, defineCustomElement as d, getWeekStart as e, getWeekEnd as f, getMonthEnd as g, clampDate as h, createDate as i, yearInRange as y };
1339
+
1340
+ //# sourceMappingURL=ic-date-input2.js.map