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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (460) hide show
  1. package/dist/cjs/core.cjs.js +1 -1
  2. package/dist/cjs/{helpers-7a069459.js → helpers-b525d45a.js} +2 -7
  3. package/dist/cjs/helpers-b525d45a.js.map +1 -0
  4. package/dist/cjs/{helpers-f75cf7cf.js → helpers-c4444a7e.js} +48 -94
  5. package/dist/cjs/helpers-c4444a7e.js.map +1 -0
  6. package/dist/cjs/ic-accordion.cjs.entry.js +1 -1
  7. package/dist/cjs/ic-alert.cjs.entry.js +1 -1
  8. package/dist/cjs/ic-back-to-top.cjs.entry.js +1 -1
  9. package/dist/cjs/ic-badge.cjs.entry.js +1 -1
  10. package/dist/cjs/ic-breadcrumb-group.cjs.entry.js +1 -1
  11. package/dist/cjs/ic-breadcrumb.cjs.entry.js +1 -1
  12. package/dist/cjs/ic-button_3.cjs.entry.js +2 -8
  13. package/dist/cjs/ic-button_3.cjs.entry.js.map +1 -1
  14. package/dist/cjs/ic-card.cjs.entry.js +1 -1
  15. package/dist/cjs/ic-checkbox-group.cjs.entry.js +1 -1
  16. package/dist/cjs/ic-checkbox.cjs.entry.js +1 -1
  17. package/dist/cjs/ic-chip.cjs.entry.js +1 -1
  18. package/dist/cjs/ic-data-row.cjs.entry.js +1 -1
  19. package/dist/cjs/ic-data-table-title-bar.cjs.entry.js +57 -0
  20. package/dist/cjs/ic-data-table-title-bar.cjs.entry.js.map +1 -0
  21. package/dist/cjs/ic-data-table.cjs.entry.js +308 -43
  22. package/dist/cjs/ic-data-table.cjs.entry.js.map +1 -1
  23. package/dist/cjs/ic-dialog.cjs.entry.js +1 -1
  24. package/dist/cjs/ic-divider.cjs.entry.js +1 -1
  25. package/dist/cjs/{ic-pagination-bar.cjs.entry.js → ic-empty-state_2.cjs.entry.js} +34 -4
  26. package/dist/cjs/ic-empty-state_2.cjs.entry.js.map +1 -0
  27. package/dist/cjs/ic-footer-link-group.cjs.entry.js +1 -1
  28. package/dist/cjs/ic-footer-link.cjs.entry.js +1 -1
  29. package/dist/cjs/ic-footer.cjs.entry.js +1 -1
  30. package/dist/cjs/ic-hero.cjs.entry.js +1 -1
  31. package/dist/cjs/ic-horizontal-scroll.cjs.entry.js +1 -1
  32. package/dist/cjs/{ic-menu.cjs.entry.js → ic-input-component-container_3.cjs.entry.js} +69 -5
  33. package/dist/cjs/ic-input-component-container_3.cjs.entry.js.map +1 -0
  34. package/dist/cjs/ic-input-label_2.cjs.entry.js +86 -0
  35. package/dist/cjs/ic-input-label_2.cjs.entry.js.map +1 -0
  36. package/dist/cjs/ic-link.cjs.entry.js +1 -1
  37. package/dist/cjs/ic-menu-group.cjs.entry.js +1 -1
  38. package/dist/cjs/ic-menu-item.cjs.entry.js +1 -1
  39. package/dist/cjs/ic-menu-with-multi.cjs.entry.js +1 -1
  40. package/dist/cjs/ic-menu-with-multi.cjs.entry.js.map +1 -1
  41. package/dist/cjs/ic-navigation-button.cjs.entry.js +1 -1
  42. package/dist/cjs/ic-navigation-group.cjs.entry.js +13 -16
  43. package/dist/cjs/ic-navigation-group.cjs.entry.js.map +1 -1
  44. package/dist/cjs/ic-navigation-item.cjs.entry.js +32 -28
  45. package/dist/cjs/ic-navigation-item.cjs.entry.js.map +1 -1
  46. package/dist/cjs/ic-navigation-menu.cjs.entry.js +1 -1
  47. package/dist/cjs/ic-page-header.cjs.entry.js +1 -1
  48. package/dist/cjs/ic-pagination_4.cjs.entry.js +5 -5
  49. package/dist/cjs/ic-pagination_4.cjs.entry.js.map +1 -1
  50. package/dist/cjs/ic-popover-menu.cjs.entry.js +1 -1
  51. package/dist/cjs/ic-radio-group.cjs.entry.js +1 -1
  52. package/dist/cjs/ic-radio-option.cjs.entry.js +1 -1
  53. package/dist/cjs/ic-search-bar.cjs.entry.js +1 -1
  54. package/dist/cjs/ic-select-with-multi.cjs.entry.js +19 -6
  55. package/dist/cjs/ic-select-with-multi.cjs.entry.js.map +1 -1
  56. package/dist/cjs/ic-side-navigation.cjs.entry.js +1 -1
  57. package/dist/cjs/ic-status-tag.cjs.entry.js +1 -1
  58. package/dist/cjs/ic-step.cjs.entry.js +1 -1
  59. package/dist/cjs/ic-stepper.cjs.entry.js +1 -1
  60. package/dist/cjs/ic-switch.cjs.entry.js +1 -1
  61. package/dist/cjs/ic-tab-group.cjs.entry.js +1 -1
  62. package/dist/cjs/ic-tab-panel.cjs.entry.js +1 -1
  63. package/dist/cjs/ic-tab.cjs.entry.js +1 -1
  64. package/dist/cjs/ic-theme.cjs.entry.js +1 -1
  65. package/dist/cjs/ic-toast.cjs.entry.js +1 -1
  66. package/dist/cjs/ic-toggle-button.cjs.entry.js +1 -1
  67. package/dist/cjs/ic-top-navigation.cjs.entry.js +60 -46
  68. package/dist/cjs/ic-top-navigation.cjs.entry.js.map +1 -1
  69. package/dist/cjs/ic-typography.cjs.entry.js +35 -11
  70. package/dist/cjs/ic-typography.cjs.entry.js.map +1 -1
  71. package/dist/cjs/index-4cf27b16.js +10 -18
  72. package/dist/cjs/loader.cjs.js +1 -1
  73. package/dist/collection/collection-manifest.json +1 -2
  74. package/dist/collection/components/ic-data-table/ic-data-table.css +82 -7
  75. package/dist/collection/components/ic-data-table/ic-data-table.js +535 -44
  76. package/dist/collection/components/ic-data-table/ic-data-table.js.map +1 -1
  77. package/dist/collection/components/ic-data-table/ic-data-table.types.js.map +1 -1
  78. package/dist/collection/components/ic-data-table/story-data.js +386 -11
  79. package/dist/collection/components/ic-data-table/story-data.js.map +1 -1
  80. package/dist/collection/components/ic-data-table/test/basic/ic-data-table.e2e.js +217 -0
  81. package/dist/collection/components/ic-data-table/test/basic/ic-data-table.e2e.js.map +1 -0
  82. package/dist/collection/components/ic-data-table/test/basic/ic-data-table.spec.js +319 -0
  83. package/dist/collection/components/ic-data-table/test/basic/ic-data-table.spec.js.map +1 -1
  84. package/dist/collection/components/ic-data-table-title-bar/ic-data-table-title-bar.css +87 -0
  85. package/dist/collection/components/ic-data-table-title-bar/ic-data-table-title-bar.js +160 -0
  86. package/dist/collection/components/ic-data-table-title-bar/ic-data-table-title-bar.js.map +1 -0
  87. package/dist/collection/components/{ic-date-picker/test/a11y/ic-date-picker.test.a11y.js → ic-data-table-title-bar/test/a11y/ic-data-table-title-bar.test.a11y.js} +3 -5
  88. package/dist/collection/components/ic-data-table-title-bar/test/a11y/ic-data-table-title-bar.test.a11y.js.map +1 -0
  89. package/dist/collection/components/ic-data-table-title-bar/test/basic/ic-data-table-title-bar.spec.js +70 -0
  90. package/dist/collection/components/ic-data-table-title-bar/test/basic/ic-data-table-title-bar.spec.js.map +1 -0
  91. package/dist/collection/components/ic-menu-with-multi/ic-menu.js +2 -2
  92. package/dist/collection/components/ic-menu-with-multi/ic-menu.js.map +1 -1
  93. package/dist/collection/components/ic-pagination-bar/ic-pagination-bar.js +1 -1
  94. package/dist/collection/components/ic-pagination-bar/ic-pagination-bar.js.map +1 -1
  95. package/dist/collection/components/ic-select-with-multi/ic-select.js +2 -2
  96. package/dist/collection/components/ic-select-with-multi/ic-select.js.map +1 -1
  97. package/dist/collection/utils/constants.js +0 -55
  98. package/dist/collection/utils/constants.js.map +1 -1
  99. package/dist/collection/utils/helpers.js +43 -259
  100. package/dist/collection/utils/helpers.js.map +1 -1
  101. package/dist/collection/utils/types.js +0 -45
  102. package/dist/collection/utils/types.js.map +1 -1
  103. package/dist/components/helpers.js +2 -7
  104. package/dist/components/helpers.js.map +1 -1
  105. package/dist/components/helpers2.js +45 -91
  106. package/dist/components/helpers2.js.map +1 -1
  107. package/dist/components/ic-button2.js +3 -11
  108. package/dist/components/ic-button2.js.map +1 -1
  109. package/dist/components/ic-card.js +1 -1
  110. package/dist/components/ic-checkbox-group.js +1 -1
  111. package/dist/components/ic-checkbox.js +1 -1
  112. package/dist/components/ic-chip.js +1 -1
  113. package/dist/components/{ic-date-input.d.ts → ic-data-table-title-bar.d.ts} +4 -4
  114. package/dist/components/ic-data-table-title-bar.js +136 -0
  115. package/dist/components/ic-data-table-title-bar.js.map +1 -0
  116. package/dist/components/ic-data-table.js +334 -49
  117. package/dist/components/ic-data-table.js.map +1 -1
  118. package/dist/components/ic-empty-state.js +1 -57
  119. package/dist/components/ic-empty-state.js.map +1 -1
  120. package/dist/{esm/ic-empty-state.entry.js → components/ic-empty-state2.js} +38 -11
  121. package/dist/components/ic-empty-state2.js.map +1 -0
  122. package/dist/components/ic-input-component-container2.js +1 -1
  123. package/dist/components/ic-input-component-container2.js.map +1 -1
  124. package/dist/components/ic-link2.js +1 -1
  125. package/dist/components/ic-menu-item2.js +1 -1
  126. package/dist/components/ic-menu2.js +2 -2
  127. package/dist/components/ic-menu2.js.map +1 -1
  128. package/dist/components/ic-menu3.js +1 -1
  129. package/dist/components/ic-menu3.js.map +1 -1
  130. package/dist/components/ic-navigation-button.js +1 -1
  131. package/dist/components/ic-navigation-group.js +12 -15
  132. package/dist/components/ic-navigation-group.js.map +1 -1
  133. package/dist/components/ic-navigation-item.js +32 -28
  134. package/dist/components/ic-navigation-item.js.map +1 -1
  135. package/dist/components/ic-pagination-bar2.js +1 -1
  136. package/dist/components/ic-pagination-bar2.js.map +1 -1
  137. package/dist/components/ic-pagination-item2.js +1 -1
  138. package/dist/components/ic-pagination2.js +5 -5
  139. package/dist/components/ic-pagination2.js.map +1 -1
  140. package/dist/components/ic-radio-group.js +1 -1
  141. package/dist/components/ic-radio-option.js +1 -1
  142. package/dist/components/ic-search-bar.js +1 -1
  143. package/dist/components/ic-select-with-multi.js +14 -1
  144. package/dist/components/ic-select-with-multi.js.map +1 -1
  145. package/dist/components/ic-select2.js +1 -1
  146. package/dist/components/ic-switch.js +1 -1
  147. package/dist/components/ic-tab.js +1 -1
  148. package/dist/components/ic-text-field2.js +1 -1
  149. package/dist/components/ic-toggle-button.js +1 -1
  150. package/dist/components/ic-top-navigation.js +61 -47
  151. package/dist/components/ic-top-navigation.js.map +1 -1
  152. package/dist/components/ic-typography2.js +38 -12
  153. package/dist/components/ic-typography2.js.map +1 -1
  154. package/dist/core/core.css +1 -1
  155. package/dist/core/core.esm.js +1 -1
  156. package/dist/core/core.esm.js.map +1 -1
  157. package/dist/core/{p-8ea47d42.entry.js → p-045359e1.entry.js} +2 -2
  158. package/dist/core/{p-3745da83.entry.js → p-10fb4c46.entry.js} +2 -2
  159. package/dist/core/p-169bfa51.entry.js +2 -0
  160. package/dist/core/p-169bfa51.entry.js.map +1 -0
  161. package/dist/core/{p-2e2e0099.entry.js → p-1ca332ca.entry.js} +2 -2
  162. package/dist/core/p-1e91f540.entry.js +2 -0
  163. package/dist/core/p-1e91f540.entry.js.map +1 -0
  164. package/dist/core/{p-d4fdd8c1.entry.js → p-204ace96.entry.js} +2 -2
  165. package/dist/core/{p-5fe96107.entry.js → p-2eac7dcc.entry.js} +2 -2
  166. package/dist/core/p-347e8dab.entry.js +2 -0
  167. package/dist/core/p-347e8dab.entry.js.map +1 -0
  168. package/dist/core/p-3803a5b5.entry.js +2 -0
  169. package/dist/core/p-3803a5b5.entry.js.map +1 -0
  170. package/dist/core/{p-36508aad.entry.js → p-4753bac8.entry.js} +2 -2
  171. package/dist/core/{p-4f1ffa39.entry.js → p-4baa0916.entry.js} +2 -2
  172. package/dist/core/{p-776671cf.entry.js → p-4f413fc0.entry.js} +2 -2
  173. package/dist/core/p-5171169f.entry.js +2 -0
  174. package/dist/core/p-5171169f.entry.js.map +1 -0
  175. package/dist/core/{p-9d540656.entry.js → p-595be57d.entry.js} +2 -2
  176. package/dist/core/{p-7cecf5d5.entry.js → p-5ae93c16.entry.js} +2 -2
  177. package/dist/core/{p-1ce75941.entry.js → p-5e0c830b.entry.js} +2 -2
  178. package/dist/core/p-5ee4319c.entry.js +2 -0
  179. package/dist/core/p-5ee4319c.entry.js.map +1 -0
  180. package/dist/core/p-5f4e96ec.entry.js +2 -0
  181. package/dist/core/p-5f4e96ec.entry.js.map +1 -0
  182. package/dist/core/{p-e74f1d09.entry.js → p-624d4f5f.entry.js} +2 -2
  183. package/dist/core/{p-9d01a7ad.entry.js → p-6933f8e9.entry.js} +2 -2
  184. package/dist/core/{p-5e2e6c3b.entry.js → p-6c3044b6.entry.js} +2 -2
  185. package/dist/core/p-7267fe19.entry.js +2 -0
  186. package/dist/core/p-7267fe19.entry.js.map +1 -0
  187. package/dist/core/{p-6690bc04.entry.js → p-75dac3d1.entry.js} +2 -2
  188. package/dist/core/{p-85609bdd.entry.js → p-7ef8d616.entry.js} +2 -2
  189. package/dist/core/{p-a0f9b259.entry.js → p-81ddc39d.entry.js} +2 -2
  190. package/dist/core/{p-a6447b13.entry.js → p-869954a2.entry.js} +2 -2
  191. package/dist/core/{p-47ac6838.entry.js → p-88d54b72.entry.js} +2 -2
  192. package/dist/core/{p-06ae5bec.entry.js → p-8b08d8fe.entry.js} +2 -2
  193. package/dist/core/{p-ca8cbd6a.entry.js → p-917c5721.entry.js} +2 -2
  194. package/dist/core/p-942282cd.entry.js +2 -0
  195. package/dist/core/p-942282cd.entry.js.map +1 -0
  196. package/dist/core/p-96b3e7e2.js +2 -0
  197. package/dist/core/p-96b3e7e2.js.map +1 -0
  198. package/dist/core/p-9caf19eb.js +2 -0
  199. package/dist/core/p-9caf19eb.js.map +1 -0
  200. package/dist/core/{p-76d26018.entry.js → p-a0f8efb2.entry.js} +2 -2
  201. package/dist/core/{p-a42c2f37.entry.js → p-a31031a5.entry.js} +2 -2
  202. package/dist/core/{p-b306cbc8.entry.js → p-a434c3d4.entry.js} +2 -2
  203. package/dist/core/{p-86012178.entry.js → p-a43c12cd.entry.js} +2 -2
  204. package/dist/core/{p-8c90110a.entry.js → p-a50c3b9e.entry.js} +2 -2
  205. package/dist/core/p-aac4185b.entry.js +2 -0
  206. package/dist/core/p-aac4185b.entry.js.map +1 -0
  207. package/dist/core/{p-1b7d426b.entry.js → p-ab09986c.entry.js} +2 -2
  208. package/dist/core/{p-9e3178e8.entry.js → p-b6639e4a.entry.js} +2 -2
  209. package/dist/core/{p-9e3178e8.entry.js.map → p-b6639e4a.entry.js.map} +1 -1
  210. package/dist/core/{p-62e22508.entry.js → p-b82dcc29.entry.js} +2 -2
  211. package/dist/core/{p-d5c99ec3.entry.js → p-ba86928c.entry.js} +2 -2
  212. package/dist/core/{p-d3856ed3.entry.js → p-c34848da.entry.js} +2 -2
  213. package/dist/core/{p-98448bdb.entry.js → p-d8469ac0.entry.js} +2 -2
  214. package/dist/core/{p-1832f4b5.entry.js → p-db9c03c0.entry.js} +2 -2
  215. package/dist/core/{p-ae422058.entry.js → p-e3997d60.entry.js} +2 -2
  216. package/dist/core/{p-982a6e88.entry.js → p-e834344e.entry.js} +2 -2
  217. package/dist/core/p-f14454b1.entry.js +2 -0
  218. package/dist/core/{p-f55ad6ae.entry.js.map → p-f14454b1.entry.js.map} +1 -1
  219. package/dist/core/{p-c7820c23.entry.js → p-f3c840cd.entry.js} +2 -2
  220. package/dist/core/p-f6888309.entry.js +2 -0
  221. package/dist/core/p-f6888309.entry.js.map +1 -0
  222. package/dist/core/p-f74a8752.entry.js +2 -0
  223. package/dist/core/p-f74a8752.entry.js.map +1 -0
  224. package/dist/core/{p-5759d771.entry.js → p-f7a14c01.entry.js} +2 -2
  225. package/dist/core/{p-0939ce92.entry.js → p-f843da01.entry.js} +2 -2
  226. package/dist/core/{p-e84b0310.entry.js → p-fc5611e2.entry.js} +2 -2
  227. package/dist/esm/core.js +1 -1
  228. package/dist/esm/{helpers-7aa21b0a.js → helpers-12b4266a.js} +2 -7
  229. package/dist/esm/helpers-12b4266a.js.map +1 -0
  230. package/dist/esm/{helpers-f328a7b6.js → helpers-1f07eb61.js} +46 -92
  231. package/dist/esm/helpers-1f07eb61.js.map +1 -0
  232. package/dist/esm/ic-accordion.entry.js +1 -1
  233. package/dist/esm/ic-alert.entry.js +1 -1
  234. package/dist/esm/ic-back-to-top.entry.js +1 -1
  235. package/dist/esm/ic-badge.entry.js +1 -1
  236. package/dist/esm/ic-breadcrumb-group.entry.js +1 -1
  237. package/dist/esm/ic-breadcrumb.entry.js +1 -1
  238. package/dist/esm/ic-button_3.entry.js +2 -8
  239. package/dist/esm/ic-button_3.entry.js.map +1 -1
  240. package/dist/esm/ic-card.entry.js +1 -1
  241. package/dist/esm/ic-checkbox-group.entry.js +1 -1
  242. package/dist/esm/ic-checkbox.entry.js +1 -1
  243. package/dist/esm/ic-chip.entry.js +1 -1
  244. package/dist/esm/ic-data-row.entry.js +1 -1
  245. package/dist/esm/ic-data-table-title-bar.entry.js +53 -0
  246. package/dist/esm/ic-data-table-title-bar.entry.js.map +1 -0
  247. package/dist/esm/ic-data-table.entry.js +309 -44
  248. package/dist/esm/ic-data-table.entry.js.map +1 -1
  249. package/dist/esm/ic-dialog.entry.js +1 -1
  250. package/dist/esm/ic-divider.entry.js +1 -1
  251. package/dist/esm/{ic-pagination-bar.entry.js → ic-empty-state_2.entry.js} +34 -5
  252. package/dist/esm/ic-empty-state_2.entry.js.map +1 -0
  253. package/dist/esm/ic-footer-link-group.entry.js +1 -1
  254. package/dist/esm/ic-footer-link.entry.js +1 -1
  255. package/dist/esm/ic-footer.entry.js +1 -1
  256. package/dist/esm/ic-hero.entry.js +1 -1
  257. package/dist/esm/ic-horizontal-scroll.entry.js +1 -1
  258. package/dist/esm/{ic-menu.entry.js → ic-input-component-container_3.entry.js} +69 -7
  259. package/dist/esm/ic-input-component-container_3.entry.js.map +1 -0
  260. package/dist/esm/ic-input-label_2.entry.js +81 -0
  261. package/dist/esm/ic-input-label_2.entry.js.map +1 -0
  262. package/dist/esm/ic-link.entry.js +1 -1
  263. package/dist/esm/ic-menu-group.entry.js +1 -1
  264. package/dist/esm/ic-menu-item.entry.js +1 -1
  265. package/dist/esm/ic-menu-with-multi.entry.js +1 -1
  266. package/dist/esm/ic-menu-with-multi.entry.js.map +1 -1
  267. package/dist/esm/ic-navigation-button.entry.js +1 -1
  268. package/dist/esm/ic-navigation-group.entry.js +13 -16
  269. package/dist/esm/ic-navigation-group.entry.js.map +1 -1
  270. package/dist/esm/ic-navigation-item.entry.js +32 -28
  271. package/dist/esm/ic-navigation-item.entry.js.map +1 -1
  272. package/dist/esm/ic-navigation-menu.entry.js +1 -1
  273. package/dist/esm/ic-page-header.entry.js +1 -1
  274. package/dist/esm/ic-pagination_4.entry.js +5 -5
  275. package/dist/esm/ic-pagination_4.entry.js.map +1 -1
  276. package/dist/esm/ic-popover-menu.entry.js +1 -1
  277. package/dist/esm/ic-radio-group.entry.js +1 -1
  278. package/dist/esm/ic-radio-option.entry.js +1 -1
  279. package/dist/esm/ic-search-bar.entry.js +1 -1
  280. package/dist/esm/ic-select-with-multi.entry.js +14 -1
  281. package/dist/esm/ic-select-with-multi.entry.js.map +1 -1
  282. package/dist/esm/ic-side-navigation.entry.js +1 -1
  283. package/dist/esm/ic-status-tag.entry.js +1 -1
  284. package/dist/esm/ic-step.entry.js +1 -1
  285. package/dist/esm/ic-stepper.entry.js +1 -1
  286. package/dist/esm/ic-switch.entry.js +1 -1
  287. package/dist/esm/ic-tab-group.entry.js +1 -1
  288. package/dist/esm/ic-tab-panel.entry.js +1 -1
  289. package/dist/esm/ic-tab.entry.js +1 -1
  290. package/dist/esm/ic-theme.entry.js +1 -1
  291. package/dist/esm/ic-toast.entry.js +1 -1
  292. package/dist/esm/ic-toggle-button.entry.js +1 -1
  293. package/dist/esm/ic-top-navigation.entry.js +60 -46
  294. package/dist/esm/ic-top-navigation.entry.js.map +1 -1
  295. package/dist/esm/ic-typography.entry.js +36 -12
  296. package/dist/esm/ic-typography.entry.js.map +1 -1
  297. package/dist/esm/index-93509377.js +10 -18
  298. package/dist/esm/loader.js +1 -1
  299. package/dist/esm/polyfills/core-js.js +0 -0
  300. package/dist/esm/polyfills/dom.js +0 -0
  301. package/dist/esm/polyfills/es5-html-element.js +0 -0
  302. package/dist/esm/polyfills/index.js +0 -0
  303. package/dist/esm/polyfills/system.js +0 -0
  304. package/dist/types/components/ic-data-table/ic-data-table.d.ts +96 -1
  305. package/dist/types/components/ic-data-table/ic-data-table.types.d.ts +11 -0
  306. package/dist/types/components/ic-data-table/story-data.d.ts +99 -0
  307. package/dist/types/components/ic-data-table-title-bar/ic-data-table-title-bar.d.ts +36 -0
  308. package/dist/types/components/ic-menu-with-multi/ic-menu.d.ts +2 -2
  309. package/dist/types/components/ic-select-with-multi/ic-select.d.ts +2 -2
  310. package/dist/types/components.d.ts +141 -389
  311. package/dist/types/utils/constants.d.ts +0 -37
  312. package/dist/types/utils/helpers.d.ts +16 -83
  313. package/dist/types/utils/types.d.ts +1 -92
  314. package/hydrate/index.js +945 -2932
  315. package/package.json +3 -4
  316. package/dist/cjs/date-helpers-c9551119.js +0 -150
  317. package/dist/cjs/date-helpers-c9551119.js.map +0 -1
  318. package/dist/cjs/helpers-7a069459.js.map +0 -1
  319. package/dist/cjs/helpers-f75cf7cf.js.map +0 -1
  320. package/dist/cjs/ic-date-input.cjs.entry.js +0 -1073
  321. package/dist/cjs/ic-date-input.cjs.entry.js.map +0 -1
  322. package/dist/cjs/ic-date-picker.cjs.entry.js +0 -1050
  323. package/dist/cjs/ic-date-picker.cjs.entry.js.map +0 -1
  324. package/dist/cjs/ic-empty-state.cjs.entry.js +0 -38
  325. package/dist/cjs/ic-empty-state.cjs.entry.js.map +0 -1
  326. package/dist/cjs/ic-input-component-container_4.cjs.entry.js +0 -150
  327. package/dist/cjs/ic-input-component-container_4.cjs.entry.js.map +0 -1
  328. package/dist/cjs/ic-menu.cjs.entry.js.map +0 -1
  329. package/dist/cjs/ic-pagination-bar.cjs.entry.js.map +0 -1
  330. package/dist/collection/assets/calendar.svg +0 -3
  331. package/dist/collection/components/ic-date-input/ic-date-input.css +0 -560
  332. package/dist/collection/components/ic-date-input/ic-date-input.js +0 -1668
  333. package/dist/collection/components/ic-date-input/ic-date-input.js.map +0 -1
  334. package/dist/collection/components/ic-date-input/story-data.js +0 -28
  335. package/dist/collection/components/ic-date-input/story-data.js.map +0 -1
  336. package/dist/collection/components/ic-date-input/test/basic/ic-date-input.spec.js +0 -1156
  337. package/dist/collection/components/ic-date-input/test/basic/ic-date-input.spec.js.map +0 -1
  338. package/dist/collection/components/ic-date-input/test/helpers/ic-date-input.js +0 -42
  339. package/dist/collection/components/ic-date-input/test/helpers/ic-date-input.js.map +0 -1
  340. package/dist/collection/components/ic-date-picker/ic-date-picker.css +0 -878
  341. package/dist/collection/components/ic-date-picker/ic-date-picker.js +0 -1506
  342. package/dist/collection/components/ic-date-picker/ic-date-picker.js.map +0 -1
  343. package/dist/collection/components/ic-date-picker/ic-day-button.js +0 -36
  344. package/dist/collection/components/ic-date-picker/ic-day-button.js.map +0 -1
  345. package/dist/collection/components/ic-date-picker/ic-month-picker.js +0 -29
  346. package/dist/collection/components/ic-date-picker/ic-month-picker.js.map +0 -1
  347. package/dist/collection/components/ic-date-picker/ic-year-picker.js +0 -39
  348. package/dist/collection/components/ic-date-picker/ic-year-picker.js.map +0 -1
  349. package/dist/collection/components/ic-date-picker/story-data.js +0 -147
  350. package/dist/collection/components/ic-date-picker/story-data.js.map +0 -1
  351. package/dist/collection/components/ic-date-picker/test/a11y/ic-date-picker.test.a11y.js.map +0 -1
  352. package/dist/collection/components/ic-date-picker/test/basic/ic-date-picker-utils.spec.js +0 -207
  353. package/dist/collection/components/ic-date-picker/test/basic/ic-date-picker-utils.spec.js.map +0 -1
  354. package/dist/collection/components/ic-date-picker/test/basic/ic-date-picker.spec.js +0 -962
  355. package/dist/collection/components/ic-date-picker/test/basic/ic-date-picker.spec.js.map +0 -1
  356. package/dist/collection/utils/date-helpers.js +0 -133
  357. package/dist/collection/utils/date-helpers.js.map +0 -1
  358. package/dist/components/ic-date-input.js +0 -8
  359. package/dist/components/ic-date-input.js.map +0 -1
  360. package/dist/components/ic-date-input2.js +0 -1301
  361. package/dist/components/ic-date-input2.js.map +0 -1
  362. package/dist/components/ic-date-picker.d.ts +0 -11
  363. package/dist/components/ic-date-picker.js +0 -1171
  364. package/dist/components/ic-date-picker.js.map +0 -1
  365. package/dist/core/p-16f67397.entry.js +0 -2
  366. package/dist/core/p-16f67397.entry.js.map +0 -1
  367. package/dist/core/p-2c1fecb9.entry.js +0 -2
  368. package/dist/core/p-2c1fecb9.entry.js.map +0 -1
  369. package/dist/core/p-33679c06.entry.js +0 -2
  370. package/dist/core/p-33679c06.entry.js.map +0 -1
  371. package/dist/core/p-33dd24eb.js +0 -2
  372. package/dist/core/p-33dd24eb.js.map +0 -1
  373. package/dist/core/p-5392bca0.entry.js +0 -2
  374. package/dist/core/p-5392bca0.entry.js.map +0 -1
  375. package/dist/core/p-550a5674.entry.js +0 -2
  376. package/dist/core/p-550a5674.entry.js.map +0 -1
  377. package/dist/core/p-6c0e2ceb.entry.js +0 -2
  378. package/dist/core/p-6c0e2ceb.entry.js.map +0 -1
  379. package/dist/core/p-8ab12a15.entry.js +0 -2
  380. package/dist/core/p-8ab12a15.entry.js.map +0 -1
  381. package/dist/core/p-aabab75f.entry.js +0 -2
  382. package/dist/core/p-aabab75f.entry.js.map +0 -1
  383. package/dist/core/p-c7590421.entry.js +0 -2
  384. package/dist/core/p-c7590421.entry.js.map +0 -1
  385. package/dist/core/p-caf857de.entry.js +0 -2
  386. package/dist/core/p-caf857de.entry.js.map +0 -1
  387. package/dist/core/p-cd799087.js +0 -2
  388. package/dist/core/p-cd799087.js.map +0 -1
  389. package/dist/core/p-d32692e2.entry.js +0 -2
  390. package/dist/core/p-d32692e2.entry.js.map +0 -1
  391. package/dist/core/p-d35c7c18.js +0 -2
  392. package/dist/core/p-d35c7c18.js.map +0 -1
  393. package/dist/core/p-e189f1d0.entry.js +0 -2
  394. package/dist/core/p-e189f1d0.entry.js.map +0 -1
  395. package/dist/core/p-e5d76564.entry.js +0 -2
  396. package/dist/core/p-e5d76564.entry.js.map +0 -1
  397. package/dist/core/p-f55ad6ae.entry.js +0 -2
  398. package/dist/core/p-f91527a0.entry.js +0 -2
  399. package/dist/core/p-f91527a0.entry.js.map +0 -1
  400. package/dist/esm/date-helpers-0e5e32a7.js +0 -136
  401. package/dist/esm/date-helpers-0e5e32a7.js.map +0 -1
  402. package/dist/esm/helpers-7aa21b0a.js.map +0 -1
  403. package/dist/esm/helpers-f328a7b6.js.map +0 -1
  404. package/dist/esm/ic-date-input.entry.js +0 -1069
  405. package/dist/esm/ic-date-input.entry.js.map +0 -1
  406. package/dist/esm/ic-date-picker.entry.js +0 -1046
  407. package/dist/esm/ic-date-picker.entry.js.map +0 -1
  408. package/dist/esm/ic-empty-state.entry.js.map +0 -1
  409. package/dist/esm/ic-input-component-container_4.entry.js +0 -143
  410. package/dist/esm/ic-input-component-container_4.entry.js.map +0 -1
  411. package/dist/esm/ic-menu.entry.js.map +0 -1
  412. package/dist/esm/ic-pagination-bar.entry.js.map +0 -1
  413. package/dist/types/components/ic-date-input/ic-date-input.d.ts +0 -242
  414. package/dist/types/components/ic-date-input/story-data.d.ts +0 -1
  415. package/dist/types/components/ic-date-input/test/helpers/ic-date-input.d.ts +0 -23
  416. package/dist/types/components/ic-date-picker/ic-date-picker.d.ts +0 -251
  417. package/dist/types/components/ic-date-picker/ic-day-button.d.ts +0 -16
  418. package/dist/types/components/ic-date-picker/ic-month-picker.d.ts +0 -14
  419. package/dist/types/components/ic-date-picker/ic-year-picker.d.ts +0 -16
  420. package/dist/types/components/ic-date-picker/story-data.d.ts +0 -22
  421. package/dist/types/utils/date-helpers.d.ts +0 -22
  422. /package/dist/core/{p-8ea47d42.entry.js.map → p-045359e1.entry.js.map} +0 -0
  423. /package/dist/core/{p-3745da83.entry.js.map → p-10fb4c46.entry.js.map} +0 -0
  424. /package/dist/core/{p-2e2e0099.entry.js.map → p-1ca332ca.entry.js.map} +0 -0
  425. /package/dist/core/{p-d4fdd8c1.entry.js.map → p-204ace96.entry.js.map} +0 -0
  426. /package/dist/core/{p-5fe96107.entry.js.map → p-2eac7dcc.entry.js.map} +0 -0
  427. /package/dist/core/{p-36508aad.entry.js.map → p-4753bac8.entry.js.map} +0 -0
  428. /package/dist/core/{p-4f1ffa39.entry.js.map → p-4baa0916.entry.js.map} +0 -0
  429. /package/dist/core/{p-776671cf.entry.js.map → p-4f413fc0.entry.js.map} +0 -0
  430. /package/dist/core/{p-9d540656.entry.js.map → p-595be57d.entry.js.map} +0 -0
  431. /package/dist/core/{p-7cecf5d5.entry.js.map → p-5ae93c16.entry.js.map} +0 -0
  432. /package/dist/core/{p-1ce75941.entry.js.map → p-5e0c830b.entry.js.map} +0 -0
  433. /package/dist/core/{p-e74f1d09.entry.js.map → p-624d4f5f.entry.js.map} +0 -0
  434. /package/dist/core/{p-9d01a7ad.entry.js.map → p-6933f8e9.entry.js.map} +0 -0
  435. /package/dist/core/{p-5e2e6c3b.entry.js.map → p-6c3044b6.entry.js.map} +0 -0
  436. /package/dist/core/{p-6690bc04.entry.js.map → p-75dac3d1.entry.js.map} +0 -0
  437. /package/dist/core/{p-85609bdd.entry.js.map → p-7ef8d616.entry.js.map} +0 -0
  438. /package/dist/core/{p-a0f9b259.entry.js.map → p-81ddc39d.entry.js.map} +0 -0
  439. /package/dist/core/{p-a6447b13.entry.js.map → p-869954a2.entry.js.map} +0 -0
  440. /package/dist/core/{p-47ac6838.entry.js.map → p-88d54b72.entry.js.map} +0 -0
  441. /package/dist/core/{p-06ae5bec.entry.js.map → p-8b08d8fe.entry.js.map} +0 -0
  442. /package/dist/core/{p-ca8cbd6a.entry.js.map → p-917c5721.entry.js.map} +0 -0
  443. /package/dist/core/{p-76d26018.entry.js.map → p-a0f8efb2.entry.js.map} +0 -0
  444. /package/dist/core/{p-a42c2f37.entry.js.map → p-a31031a5.entry.js.map} +0 -0
  445. /package/dist/core/{p-b306cbc8.entry.js.map → p-a434c3d4.entry.js.map} +0 -0
  446. /package/dist/core/{p-86012178.entry.js.map → p-a43c12cd.entry.js.map} +0 -0
  447. /package/dist/core/{p-8c90110a.entry.js.map → p-a50c3b9e.entry.js.map} +0 -0
  448. /package/dist/core/{p-1b7d426b.entry.js.map → p-ab09986c.entry.js.map} +0 -0
  449. /package/dist/core/{p-62e22508.entry.js.map → p-b82dcc29.entry.js.map} +0 -0
  450. /package/dist/core/{p-d5c99ec3.entry.js.map → p-ba86928c.entry.js.map} +0 -0
  451. /package/dist/core/{p-d3856ed3.entry.js.map → p-c34848da.entry.js.map} +0 -0
  452. /package/dist/core/{p-98448bdb.entry.js.map → p-d8469ac0.entry.js.map} +0 -0
  453. /package/dist/core/{p-1832f4b5.entry.js.map → p-db9c03c0.entry.js.map} +0 -0
  454. /package/dist/core/{p-ae422058.entry.js.map → p-e3997d60.entry.js.map} +0 -0
  455. /package/dist/core/{p-982a6e88.entry.js.map → p-e834344e.entry.js.map} +0 -0
  456. /package/dist/core/{p-c7820c23.entry.js.map → p-f3c840cd.entry.js.map} +0 -0
  457. /package/dist/core/{p-5759d771.entry.js.map → p-f7a14c01.entry.js.map} +0 -0
  458. /package/dist/core/{p-0939ce92.entry.js.map → p-f843da01.entry.js.map} +0 -0
  459. /package/dist/core/{p-e84b0310.entry.js.map → p-fc5611e2.entry.js.map} +0 -0
  460. /package/dist/types/components/{ic-date-picker/test/a11y/ic-date-picker.test.a11y.d.ts → ic-data-table-title-bar/test/a11y/ic-data-table-title-bar.test.a11y.d.ts} +0 -0
@@ -1,1069 +0,0 @@
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 { b as dateMatches, i as isDateOrEpoch, j as convertToDoubleDigits, s as splitStringDate, h as createDate, k as extractDateFromZuluDateTime } from './date-helpers-0e5e32a7.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 || !dateMatches(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 if (!(this.selectedDate === null && this.previousSelectedDate === null)) {
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.setValidationMessage();
763
- this.handleDateChange(true);
764
- this.inputsInOrder[0].focus();
765
- };
766
- this.handleCalendarOpen = (ev) => {
767
- ev.stopImmediatePropagation();
768
- this.calendarButtonEl.shadowRoot
769
- .querySelector("ic-tooltip")
770
- .displayTooltip(false);
771
- this.calendarButtonClicked.emit({ value: this.selectedDate });
772
- this.calendarButtonEl.shadowRoot
773
- .querySelector("ic-tooltip")
774
- .displayTooltip(false);
775
- this.isDateSetFromKeyboardEvent = false;
776
- };
777
- this.setValueAndEmitChange = (value) => {
778
- if (!dateMatches(new Date(this.value), value)) {
779
- this.icChange.emit({ value: value });
780
- this.value = value;
781
- }
782
- };
783
- this.handleCalendarFocus = () => {
784
- this.calendarFocused = true;
785
- };
786
- this.handleCalendarBlur = () => {
787
- this.calendarFocused = false;
788
- };
789
- this.handleClearFocus = () => {
790
- this.removeLabelledBy = true;
791
- this.clearButtonFocused = true;
792
- };
793
- this.handleClearBlur = (ev) => {
794
- var _a;
795
- this.clearButtonFocused = false;
796
- if ((_a = ev.relatedTarget) === null || _a === void 0 ? void 0 : _a.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