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