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

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