@ukic/canary-web-components 3.0.0-canary.30 → 3.0.0-canary.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (494) hide show
  1. package/dist/cjs/core.cjs.js +1 -1
  2. package/dist/cjs/date-helpers-d7ee7b45.js.map +1 -1
  3. package/dist/cjs/{helpers-da852478.js → helpers-6f4b406b.js} +20 -20
  4. package/dist/cjs/helpers-6f4b406b.js.map +1 -0
  5. package/dist/cjs/ic-button_3.cjs.entry.js +5 -5
  6. package/dist/cjs/ic-button_3.cjs.entry.js.map +1 -1
  7. package/dist/cjs/ic-calendar_2.cjs.entry.js +2354 -0
  8. package/dist/cjs/ic-calendar_2.cjs.entry.js.map +1 -0
  9. package/dist/cjs/ic-card-horizontal.cjs.entry.js +6 -6
  10. package/dist/cjs/ic-card-horizontal.cjs.entry.js.map +1 -1
  11. package/dist/cjs/ic-checkbox-group.cjs.entry.js +2 -2
  12. package/dist/cjs/ic-checkbox-group.cjs.entry.js.map +1 -1
  13. package/dist/cjs/ic-checkbox_3.cjs.entry.js +39 -16
  14. package/dist/cjs/ic-checkbox_3.cjs.entry.js.map +1 -1
  15. package/dist/cjs/ic-data-list.cjs.entry.js +2 -2
  16. package/dist/cjs/ic-data-list.cjs.entry.js.map +1 -1
  17. package/dist/cjs/ic-data-row.cjs.entry.js +2 -2
  18. package/dist/cjs/ic-data-row.cjs.entry.js.map +1 -1
  19. package/dist/cjs/ic-data-table-title-bar.cjs.entry.js +4 -4
  20. package/dist/cjs/ic-data-table.cjs.entry.js +8 -8
  21. package/dist/cjs/ic-date-picker.cjs.entry.js +98 -854
  22. package/dist/cjs/ic-date-picker.cjs.entry.js.map +1 -1
  23. package/dist/cjs/ic-dialog.cjs.entry.js +1 -1
  24. package/dist/cjs/ic-dialog.cjs.entry.js.map +1 -1
  25. package/dist/cjs/ic-footer-link.cjs.entry.js +2 -2
  26. package/dist/cjs/ic-footer-link.cjs.entry.js.map +1 -1
  27. package/dist/cjs/ic-hero.cjs.entry.js +11 -6
  28. package/dist/cjs/ic-hero.cjs.entry.js.map +1 -1
  29. package/dist/cjs/ic-horizontal-scroll.cjs.entry.js +5 -5
  30. package/dist/cjs/ic-horizontal-scroll.cjs.entry.js.map +1 -1
  31. package/dist/cjs/ic-input-component-container_4.cjs.entry.js +10 -10
  32. package/dist/cjs/ic-input-component-container_4.cjs.entry.js.map +1 -1
  33. package/dist/cjs/ic-layout-grid-item.cjs.entry.js +2 -2
  34. package/dist/cjs/ic-layout-grid-item.cjs.entry.js.map +1 -1
  35. package/dist/cjs/ic-layout-grid.cjs.entry.js +2 -2
  36. package/dist/cjs/ic-layout-grid.cjs.entry.js.map +1 -1
  37. package/dist/cjs/ic-link.cjs.entry.js +1 -1
  38. package/dist/cjs/ic-link.cjs.entry.js.map +1 -1
  39. package/dist/cjs/ic-menu-group.cjs.entry.js +1 -1
  40. package/dist/cjs/ic-menu-group.cjs.entry.js.map +1 -1
  41. package/dist/cjs/ic-menu.cjs.entry.js +3 -3
  42. package/dist/cjs/ic-menu.cjs.entry.js.map +1 -1
  43. package/dist/cjs/ic-navigation-group.cjs.entry.js +1 -1
  44. package/dist/cjs/ic-navigation-group.cjs.entry.js.map +1 -1
  45. package/dist/cjs/ic-navigation-menu.cjs.entry.js +4 -4
  46. package/dist/cjs/ic-navigation-menu.cjs.entry.js.map +1 -1
  47. package/dist/cjs/ic-page-header.cjs.entry.js +6 -6
  48. package/dist/cjs/ic-page-header.cjs.entry.js.map +1 -1
  49. package/dist/cjs/ic-pagination_4.cjs.entry.js +18 -18
  50. package/dist/cjs/ic-pagination_4.cjs.entry.js.map +1 -1
  51. package/dist/cjs/ic-popover-menu.cjs.entry.js +4 -4
  52. package/dist/cjs/ic-popover-menu.cjs.entry.js.map +1 -1
  53. package/dist/cjs/ic-radio-group.cjs.entry.js +4 -4
  54. package/dist/cjs/ic-radio-group.cjs.entry.js.map +1 -1
  55. package/dist/cjs/ic-radio-option.cjs.entry.js +4 -4
  56. package/dist/cjs/ic-radio-option.cjs.entry.js.map +1 -1
  57. package/dist/cjs/ic-search-bar.cjs.entry.js +9 -9
  58. package/dist/cjs/ic-search-bar.cjs.entry.js.map +1 -1
  59. package/dist/cjs/ic-section-container.cjs.entry.js +2 -2
  60. package/dist/cjs/ic-section-container.cjs.entry.js.map +1 -1
  61. package/dist/cjs/ic-side-navigation.cjs.entry.js +4 -4
  62. package/dist/cjs/ic-side-navigation.cjs.entry.js.map +1 -1
  63. package/dist/cjs/ic-skeleton.cjs.entry.js +2 -2
  64. package/dist/cjs/ic-skeleton.cjs.entry.js.map +1 -1
  65. package/dist/cjs/ic-skip-link.cjs.entry.js +2 -2
  66. package/dist/cjs/ic-skip-link.cjs.entry.js.map +1 -1
  67. package/dist/cjs/ic-status-tag.cjs.entry.js +2 -2
  68. package/dist/cjs/ic-status-tag.cjs.entry.js.map +1 -1
  69. package/dist/cjs/ic-step.cjs.entry.js +13 -13
  70. package/dist/cjs/ic-step.cjs.entry.js.map +1 -1
  71. package/dist/cjs/ic-stepper.cjs.entry.js +2 -2
  72. package/dist/cjs/ic-stepper.cjs.entry.js.map +1 -1
  73. package/dist/cjs/ic-switch.cjs.entry.js +4 -4
  74. package/dist/cjs/ic-switch.cjs.entry.js.map +1 -1
  75. package/dist/cjs/ic-tab-context.cjs.entry.js +1 -1
  76. package/dist/cjs/ic-tab-context.cjs.entry.js.map +1 -1
  77. package/dist/cjs/ic-tab-group.cjs.entry.js +2 -2
  78. package/dist/cjs/ic-tab-group.cjs.entry.js.map +1 -1
  79. package/dist/cjs/ic-tab-panel.cjs.entry.js +2 -2
  80. package/dist/cjs/ic-tab-panel.cjs.entry.js.map +1 -1
  81. package/dist/cjs/ic-table-of-contents.cjs.entry.js +4 -4
  82. package/dist/cjs/ic-theme.cjs.entry.js +1 -1
  83. package/dist/cjs/ic-theme.cjs.entry.js.map +1 -1
  84. package/dist/cjs/ic-time-input.cjs.entry.js +5 -5
  85. package/dist/cjs/ic-time-input.cjs.entry.js.map +1 -1
  86. package/dist/cjs/ic-toast-region.cjs.entry.js +1 -1
  87. package/dist/cjs/ic-toast-region.cjs.entry.js.map +1 -1
  88. package/dist/cjs/ic-toast.cjs.entry.js +4 -4
  89. package/dist/cjs/ic-toast.cjs.entry.js.map +1 -1
  90. package/dist/cjs/ic-toggle-button-group.cjs.entry.js +2 -2
  91. package/dist/cjs/ic-toggle-button-group.cjs.entry.js.map +1 -1
  92. package/dist/cjs/ic-toggle-button.cjs.entry.js +2 -2
  93. package/dist/cjs/ic-toggle-button.cjs.entry.js.map +1 -1
  94. package/dist/cjs/ic-tree-item.cjs.entry.js +3 -3
  95. package/dist/cjs/ic-tree-view.cjs.entry.js +4 -4
  96. package/dist/cjs/index-d337cd8a.js +4 -4
  97. package/dist/cjs/loader.cjs.js +1 -1
  98. package/dist/collection/collection-manifest.json +1 -0
  99. package/dist/collection/components/ic-calendar/ic-calendar.css +910 -0
  100. package/dist/collection/components/ic-calendar/ic-calendar.js +1542 -0
  101. package/dist/collection/components/ic-calendar/ic-calendar.js.map +1 -0
  102. package/dist/collection/components/ic-calendar/ic-calendar.stories.js +295 -0
  103. package/dist/collection/components/ic-calendar/ic-calendar.stories.js.map +1 -0
  104. package/dist/collection/components/ic-calendar/ic-day-button.js.map +1 -0
  105. package/dist/collection/components/ic-calendar/ic-month-picker.js +35 -0
  106. package/dist/collection/components/ic-calendar/ic-month-picker.js.map +1 -0
  107. package/dist/collection/components/ic-calendar/ic-year-picker.js +57 -0
  108. package/dist/collection/components/ic-calendar/ic-year-picker.js.map +1 -0
  109. package/dist/collection/components/ic-calendar/test/a11y/ic-calendar.test.a11y.js +13 -0
  110. package/dist/collection/components/ic-calendar/test/a11y/ic-calendar.test.a11y.js.map +1 -0
  111. package/dist/collection/components/ic-card-horizontal/ic-card-horizontal.js +6 -6
  112. package/dist/collection/components/ic-card-horizontal/ic-card-horizontal.js.map +1 -1
  113. package/dist/collection/components/ic-data-table/ic-data-table.js +7 -7
  114. package/dist/collection/components/ic-data-table-title-bar/ic-data-table-title-bar.js +3 -3
  115. package/dist/collection/components/ic-date-input/ic-date-input.js +8 -7
  116. package/dist/collection/components/ic-date-input/ic-date-input.js.map +1 -1
  117. package/dist/collection/components/ic-date-picker/ic-date-picker.css +7 -405
  118. package/dist/collection/components/ic-date-picker/ic-date-picker.js +145 -802
  119. package/dist/collection/components/ic-date-picker/ic-date-picker.js.map +1 -1
  120. package/dist/collection/components/ic-date-picker/ic-date-picker.stories.js +110 -0
  121. package/dist/collection/components/ic-date-picker/ic-date-picker.stories.js.map +1 -1
  122. package/dist/collection/components/ic-date-picker/story-data.js +5 -1
  123. package/dist/collection/components/ic-date-picker/story-data.js.map +1 -1
  124. package/dist/collection/components/ic-pagination-bar/ic-pagination-bar.js +7 -7
  125. package/dist/collection/components/ic-pagination-bar/ic-pagination-bar.js.map +1 -1
  126. package/dist/collection/components/ic-table-of-contents/ic-table-of-contents.js +3 -3
  127. package/dist/collection/components/ic-time-input/ic-time-input.js +9 -8
  128. package/dist/collection/components/ic-time-input/ic-time-input.js.map +1 -1
  129. package/dist/collection/components/ic-tree-item/ic-tree-item.js +2 -2
  130. package/dist/collection/components/ic-tree-view/ic-tree-view.js +3 -3
  131. package/dist/collection/utils/date-helpers.js +3 -0
  132. package/dist/collection/utils/date-helpers.js.map +1 -1
  133. package/dist/collection/utils/types.js.map +1 -1
  134. package/dist/{esm/date-helpers-2b531c8c.js → components/date-helpers.js} +2 -2
  135. package/dist/components/date-helpers.js.map +1 -0
  136. package/dist/components/helpers2.js +20 -20
  137. package/dist/components/helpers2.js.map +1 -1
  138. package/dist/components/ic-calendar.d.ts +11 -0
  139. package/dist/components/ic-calendar.js +8 -0
  140. package/dist/components/ic-calendar.js.map +1 -0
  141. package/dist/components/ic-calendar2.js +1235 -0
  142. package/dist/components/ic-calendar2.js.map +1 -0
  143. package/dist/components/ic-card-horizontal.js +6 -6
  144. package/dist/components/ic-card-horizontal.js.map +1 -1
  145. package/dist/components/ic-checkbox-group.js +2 -2
  146. package/dist/components/ic-checkbox-group.js.map +1 -1
  147. package/dist/components/ic-checkbox2.js +31 -8
  148. package/dist/components/ic-checkbox2.js.map +1 -1
  149. package/dist/components/ic-data-list.js +2 -2
  150. package/dist/components/ic-data-list.js.map +1 -1
  151. package/dist/components/ic-data-row.js +2 -2
  152. package/dist/components/ic-data-row.js.map +1 -1
  153. package/dist/components/ic-data-table-title-bar.js +3 -3
  154. package/dist/components/ic-data-table.js +8 -8
  155. package/dist/components/ic-date-input2.js +6 -88
  156. package/dist/components/ic-date-input2.js.map +1 -1
  157. package/dist/components/ic-date-picker.js +113 -880
  158. package/dist/components/ic-date-picker.js.map +1 -1
  159. package/dist/components/ic-dialog.js +1 -1
  160. package/dist/components/ic-dialog.js.map +1 -1
  161. package/dist/components/ic-empty-state2.js +2 -2
  162. package/dist/components/ic-empty-state2.js.map +1 -1
  163. package/dist/components/ic-footer-link.js +2 -2
  164. package/dist/components/ic-footer-link.js.map +1 -1
  165. package/dist/components/ic-hero.js +12 -6
  166. package/dist/components/ic-hero.js.map +1 -1
  167. package/dist/components/ic-horizontal-scroll2.js +5 -5
  168. package/dist/components/ic-horizontal-scroll2.js.map +1 -1
  169. package/dist/components/ic-input-component-container2.js +3 -3
  170. package/dist/components/ic-input-component-container2.js.map +1 -1
  171. package/dist/components/ic-input-container2.js +2 -2
  172. package/dist/components/ic-input-container2.js.map +1 -1
  173. package/dist/components/ic-input-label2.js +2 -2
  174. package/dist/components/ic-input-label2.js.map +1 -1
  175. package/dist/components/ic-input-validation2.js +3 -3
  176. package/dist/components/ic-input-validation2.js.map +1 -1
  177. package/dist/components/ic-layout-grid-item.js +2 -2
  178. package/dist/components/ic-layout-grid-item.js.map +1 -1
  179. package/dist/components/ic-layout-grid.js +2 -2
  180. package/dist/components/ic-layout-grid.js.map +1 -1
  181. package/dist/components/ic-link2.js +1 -1
  182. package/dist/components/ic-link2.js.map +1 -1
  183. package/dist/components/ic-loading-indicator2.js +5 -5
  184. package/dist/components/ic-loading-indicator2.js.map +1 -1
  185. package/dist/components/ic-menu-group.js +1 -1
  186. package/dist/components/ic-menu-group.js.map +1 -1
  187. package/dist/components/ic-menu2.js +3 -3
  188. package/dist/components/ic-menu2.js.map +1 -1
  189. package/dist/components/ic-navigation-group.js +1 -1
  190. package/dist/components/ic-navigation-group.js.map +1 -1
  191. package/dist/components/ic-navigation-menu2.js +4 -4
  192. package/dist/components/ic-navigation-menu2.js.map +1 -1
  193. package/dist/components/ic-page-header.js +6 -6
  194. package/dist/components/ic-page-header.js.map +1 -1
  195. package/dist/components/ic-pagination-bar2.js +6 -6
  196. package/dist/components/ic-pagination-bar2.js.map +1 -1
  197. package/dist/components/ic-pagination-item2.js +1 -1
  198. package/dist/components/ic-pagination-item2.js.map +1 -1
  199. package/dist/components/ic-pagination2.js +4 -4
  200. package/dist/components/ic-pagination2.js.map +1 -1
  201. package/dist/components/ic-popover-menu.js +4 -4
  202. package/dist/components/ic-popover-menu.js.map +1 -1
  203. package/dist/components/ic-radio-group.js +4 -4
  204. package/dist/components/ic-radio-group.js.map +1 -1
  205. package/dist/components/ic-radio-option.js +4 -4
  206. package/dist/components/ic-radio-option.js.map +1 -1
  207. package/dist/components/ic-search-bar.js +9 -9
  208. package/dist/components/ic-search-bar.js.map +1 -1
  209. package/dist/components/ic-section-container2.js +2 -2
  210. package/dist/components/ic-section-container2.js.map +1 -1
  211. package/dist/components/ic-select2.js +7 -7
  212. package/dist/components/ic-select2.js.map +1 -1
  213. package/dist/components/ic-side-navigation.js +4 -4
  214. package/dist/components/ic-side-navigation.js.map +1 -1
  215. package/dist/components/ic-skeleton.js +2 -2
  216. package/dist/components/ic-skeleton.js.map +1 -1
  217. package/dist/components/ic-skip-link.js +2 -2
  218. package/dist/components/ic-skip-link.js.map +1 -1
  219. package/dist/components/ic-status-tag.js +2 -2
  220. package/dist/components/ic-status-tag.js.map +1 -1
  221. package/dist/components/ic-step.js +13 -13
  222. package/dist/components/ic-step.js.map +1 -1
  223. package/dist/components/ic-stepper.js +2 -2
  224. package/dist/components/ic-stepper.js.map +1 -1
  225. package/dist/components/ic-switch.js +4 -4
  226. package/dist/components/ic-switch.js.map +1 -1
  227. package/dist/components/ic-tab-context.js +1 -1
  228. package/dist/components/ic-tab-context.js.map +1 -1
  229. package/dist/components/ic-tab-group.js +2 -2
  230. package/dist/components/ic-tab-group.js.map +1 -1
  231. package/dist/components/ic-tab-panel.js +2 -2
  232. package/dist/components/ic-tab-panel.js.map +1 -1
  233. package/dist/components/ic-table-of-contents.js +3 -3
  234. package/dist/components/ic-text-field2.js +6 -6
  235. package/dist/components/ic-text-field2.js.map +1 -1
  236. package/dist/components/ic-theme.js +1 -1
  237. package/dist/components/ic-theme.js.map +1 -1
  238. package/dist/components/ic-time-input.js +5 -5
  239. package/dist/components/ic-time-input.js.map +1 -1
  240. package/dist/components/ic-toast-region.js +1 -1
  241. package/dist/components/ic-toast-region.js.map +1 -1
  242. package/dist/components/ic-toast.js +4 -4
  243. package/dist/components/ic-toast.js.map +1 -1
  244. package/dist/components/ic-toggle-button-group.js +2 -2
  245. package/dist/components/ic-toggle-button-group.js.map +1 -1
  246. package/dist/components/ic-toggle-button.js +2 -2
  247. package/dist/components/ic-toggle-button.js.map +1 -1
  248. package/dist/components/ic-tree-item.js +3 -3
  249. package/dist/components/ic-tree-view.js +4 -4
  250. package/dist/core/core.css +21 -9
  251. package/dist/core/core.esm.js +1 -1
  252. package/dist/core/core.esm.js.map +1 -1
  253. package/dist/core/{p-9fade6ad.entry.js → p-0043b019.entry.js} +2 -2
  254. package/dist/core/{p-9fade6ad.entry.js.map → p-0043b019.entry.js.map} +1 -1
  255. package/dist/core/{p-889bb8db.entry.js → p-04cb17d7.entry.js} +2 -2
  256. package/dist/core/{p-889bb8db.entry.js.map → p-04cb17d7.entry.js.map} +1 -1
  257. package/dist/core/{p-5ef453b6.entry.js → p-15c05eb8.entry.js} +2 -2
  258. package/dist/core/{p-5ef453b6.entry.js.map → p-15c05eb8.entry.js.map} +1 -1
  259. package/dist/core/p-1a976789.entry.js +2 -0
  260. package/dist/core/p-1a976789.entry.js.map +1 -0
  261. package/dist/core/{p-1be092cc.entry.js → p-2188b483.entry.js} +2 -2
  262. package/dist/core/{p-1be092cc.entry.js.map → p-2188b483.entry.js.map} +1 -1
  263. package/dist/core/{p-8c94541e.entry.js → p-24bac55f.entry.js} +2 -2
  264. package/dist/core/{p-8c94541e.entry.js.map → p-24bac55f.entry.js.map} +1 -1
  265. package/dist/core/{p-7f304d85.entry.js → p-2646a629.entry.js} +2 -2
  266. package/dist/core/{p-7f304d85.entry.js.map → p-2646a629.entry.js.map} +1 -1
  267. package/dist/core/{p-5cf704e3.entry.js → p-319e3d5b.entry.js} +2 -2
  268. package/dist/core/{p-5cf704e3.entry.js.map → p-319e3d5b.entry.js.map} +1 -1
  269. package/dist/core/{p-9e200827.entry.js → p-31f3fb15.entry.js} +2 -2
  270. package/dist/core/{p-9e200827.entry.js.map → p-31f3fb15.entry.js.map} +1 -1
  271. package/dist/core/{p-fd64c0e5.entry.js → p-3891ce53.entry.js} +2 -2
  272. package/dist/core/{p-fd64c0e5.entry.js.map → p-3891ce53.entry.js.map} +1 -1
  273. package/dist/core/{p-fad44bc8.entry.js → p-3ba2b455.entry.js} +2 -2
  274. package/dist/core/{p-fad44bc8.entry.js.map → p-3ba2b455.entry.js.map} +1 -1
  275. package/dist/core/{p-df220b91.entry.js → p-3ef2e98d.entry.js} +2 -2
  276. package/dist/core/{p-03ae0bc3.entry.js → p-41def410.entry.js} +2 -2
  277. package/dist/core/{p-03ae0bc3.entry.js.map → p-41def410.entry.js.map} +1 -1
  278. package/dist/core/p-4b188516.entry.js +2 -0
  279. package/dist/core/p-4b188516.entry.js.map +1 -0
  280. package/dist/core/{p-93e1ba0a.entry.js → p-5254a078.entry.js} +2 -2
  281. package/dist/core/{p-93e1ba0a.entry.js.map → p-5254a078.entry.js.map} +1 -1
  282. package/dist/core/{p-9c2e9189.entry.js → p-53740194.entry.js} +2 -2
  283. package/dist/core/{p-9c2e9189.entry.js.map → p-53740194.entry.js.map} +1 -1
  284. package/dist/core/{p-e380a54e.entry.js → p-5a4344cb.entry.js} +2 -2
  285. package/dist/core/{p-e380a54e.entry.js.map → p-5a4344cb.entry.js.map} +1 -1
  286. package/dist/core/p-5b32aaf3.entry.js +2 -0
  287. package/dist/core/p-5b32aaf3.entry.js.map +1 -0
  288. package/dist/core/{p-d8200098.entry.js → p-67c3985d.entry.js} +2 -2
  289. package/dist/core/{p-d8200098.entry.js.map → p-67c3985d.entry.js.map} +1 -1
  290. package/dist/core/{p-982a173d.entry.js → p-7332320d.entry.js} +2 -2
  291. package/dist/core/{p-982a173d.entry.js.map → p-7332320d.entry.js.map} +1 -1
  292. package/dist/core/{p-bc441e4c.js → p-75c3b882.js} +2 -2
  293. package/dist/core/{p-bc441e4c.js.map → p-75c3b882.js.map} +1 -1
  294. package/dist/core/{p-b88db5e3.entry.js → p-7a0f62c2.entry.js} +2 -2
  295. package/dist/core/{p-b88db5e3.entry.js.map → p-7a0f62c2.entry.js.map} +1 -1
  296. package/dist/core/p-81f12581.entry.js +2 -0
  297. package/dist/core/p-81f12581.entry.js.map +1 -0
  298. package/dist/core/{p-193afb53.entry.js → p-847cbb16.entry.js} +2 -2
  299. package/dist/core/{p-193afb53.entry.js.map → p-847cbb16.entry.js.map} +1 -1
  300. package/dist/core/{p-f3ccaa0b.entry.js → p-8e592393.entry.js} +2 -2
  301. package/dist/core/{p-f3ccaa0b.entry.js.map → p-8e592393.entry.js.map} +1 -1
  302. package/dist/core/p-9044539c.entry.js +2 -0
  303. package/dist/core/p-9044539c.entry.js.map +1 -0
  304. package/dist/core/{p-f4e7cae6.entry.js → p-90611726.entry.js} +2 -2
  305. package/dist/core/{p-f4e7cae6.entry.js.map → p-90611726.entry.js.map} +1 -1
  306. package/dist/core/{p-b00efb15.entry.js → p-9674b63f.entry.js} +2 -2
  307. package/dist/core/{p-b00efb15.entry.js.map → p-9674b63f.entry.js.map} +1 -1
  308. package/dist/core/{p-a27e1cee.entry.js → p-9a95f428.entry.js} +2 -2
  309. package/dist/core/{p-a27e1cee.entry.js.map → p-9a95f428.entry.js.map} +1 -1
  310. package/dist/core/{p-fb43abd6.entry.js → p-9ca147f3.entry.js} +2 -2
  311. package/dist/core/{p-fb43abd6.entry.js.map → p-9ca147f3.entry.js.map} +1 -1
  312. package/dist/core/{p-a8cc28a6.entry.js → p-9f76eed6.entry.js} +2 -2
  313. package/dist/core/{p-035dbee0.entry.js → p-a1448064.entry.js} +2 -2
  314. package/dist/core/{p-035dbee0.entry.js.map → p-a1448064.entry.js.map} +1 -1
  315. package/dist/core/{p-9ce9d39a.entry.js → p-a237af88.entry.js} +2 -2
  316. package/dist/core/{p-9ce9d39a.entry.js.map → p-a237af88.entry.js.map} +1 -1
  317. package/dist/core/{p-09c31ac6.entry.js → p-adde6c66.entry.js} +2 -2
  318. package/dist/core/{p-09c31ac6.entry.js.map → p-adde6c66.entry.js.map} +1 -1
  319. package/dist/core/{p-72b7051a.entry.js → p-af821831.entry.js} +2 -2
  320. package/dist/core/{p-72b7051a.entry.js.map → p-af821831.entry.js.map} +1 -1
  321. package/dist/core/{p-12e8dcdd.entry.js → p-afedcfdb.entry.js} +2 -2
  322. package/dist/core/{p-12e8dcdd.entry.js.map → p-afedcfdb.entry.js.map} +1 -1
  323. package/dist/core/{p-f098e531.entry.js → p-b4a2f6fa.entry.js} +2 -2
  324. package/dist/core/{p-f098e531.entry.js.map → p-b4a2f6fa.entry.js.map} +1 -1
  325. package/dist/core/p-b4bfaf8f.entry.js +2 -0
  326. package/dist/core/p-b4bfaf8f.entry.js.map +1 -0
  327. package/dist/core/{p-ea1de762.entry.js → p-b80b08ae.entry.js} +2 -2
  328. package/dist/core/p-b80b08ae.entry.js.map +1 -0
  329. package/dist/core/{p-7bf9bbde.entry.js → p-ba21f477.entry.js} +2 -2
  330. package/dist/core/{p-7bf9bbde.entry.js.map → p-ba21f477.entry.js.map} +1 -1
  331. package/dist/core/{p-63203e59.entry.js → p-ba75ed34.entry.js} +2 -2
  332. package/dist/core/{p-63203e59.entry.js.map → p-ba75ed34.entry.js.map} +1 -1
  333. package/dist/core/{p-15a81f32.entry.js → p-bd9a76d8.entry.js} +2 -2
  334. package/dist/core/{p-15a81f32.entry.js.map → p-bd9a76d8.entry.js.map} +1 -1
  335. package/dist/core/{p-10950727.entry.js → p-c3eddb99.entry.js} +2 -2
  336. package/dist/core/{p-10950727.entry.js.map → p-c3eddb99.entry.js.map} +1 -1
  337. package/dist/core/{p-a99ad459.entry.js → p-c5d65718.entry.js} +2 -2
  338. package/dist/core/{p-a99ad459.entry.js.map → p-c5d65718.entry.js.map} +1 -1
  339. package/dist/core/{p-eb958cc8.entry.js → p-c6c87e58.entry.js} +2 -2
  340. package/dist/core/{p-eb958cc8.entry.js.map → p-c6c87e58.entry.js.map} +1 -1
  341. package/dist/core/{p-c8ce7d60.entry.js → p-e00e67ff.entry.js} +2 -2
  342. package/dist/core/{p-c8ce7d60.entry.js.map → p-e00e67ff.entry.js.map} +1 -1
  343. package/dist/core/{p-069e758b.entry.js → p-e1920777.entry.js} +2 -2
  344. package/dist/core/{p-92936b49.entry.js → p-ef5b6622.entry.js} +2 -2
  345. package/dist/core/{p-0f22f41e.js → p-f48ce5f6.js} +2 -2
  346. package/dist/core/p-f48ce5f6.js.map +1 -0
  347. package/dist/core/{p-1ca62941.entry.js → p-f5cea10d.entry.js} +2 -2
  348. package/dist/esm/core.js +1 -1
  349. package/dist/esm/date-helpers-5723de08.js +86 -0
  350. package/dist/esm/{date-helpers-2b531c8c.js.map → date-helpers-5723de08.js.map} +1 -1
  351. package/dist/esm/{helpers-89cb996d.js → helpers-9f228880.js} +21 -21
  352. package/dist/esm/helpers-9f228880.js.map +1 -0
  353. package/dist/esm/ic-button_3.entry.js +5 -5
  354. package/dist/esm/ic-button_3.entry.js.map +1 -1
  355. package/dist/esm/ic-calendar_2.entry.js +2349 -0
  356. package/dist/esm/ic-calendar_2.entry.js.map +1 -0
  357. package/dist/esm/ic-card-horizontal.entry.js +6 -6
  358. package/dist/esm/ic-card-horizontal.entry.js.map +1 -1
  359. package/dist/esm/ic-checkbox-group.entry.js +2 -2
  360. package/dist/esm/ic-checkbox-group.entry.js.map +1 -1
  361. package/dist/esm/ic-checkbox_3.entry.js +39 -16
  362. package/dist/esm/ic-checkbox_3.entry.js.map +1 -1
  363. package/dist/esm/ic-data-list.entry.js +2 -2
  364. package/dist/esm/ic-data-list.entry.js.map +1 -1
  365. package/dist/esm/ic-data-row.entry.js +2 -2
  366. package/dist/esm/ic-data-row.entry.js.map +1 -1
  367. package/dist/esm/ic-data-table-title-bar.entry.js +4 -4
  368. package/dist/esm/ic-data-table.entry.js +8 -8
  369. package/dist/esm/ic-date-picker.entry.js +100 -856
  370. package/dist/esm/ic-date-picker.entry.js.map +1 -1
  371. package/dist/esm/ic-dialog.entry.js +1 -1
  372. package/dist/esm/ic-dialog.entry.js.map +1 -1
  373. package/dist/esm/ic-footer-link.entry.js +2 -2
  374. package/dist/esm/ic-footer-link.entry.js.map +1 -1
  375. package/dist/esm/ic-hero.entry.js +11 -6
  376. package/dist/esm/ic-hero.entry.js.map +1 -1
  377. package/dist/esm/ic-horizontal-scroll.entry.js +5 -5
  378. package/dist/esm/ic-horizontal-scroll.entry.js.map +1 -1
  379. package/dist/esm/ic-input-component-container_4.entry.js +10 -10
  380. package/dist/esm/ic-input-component-container_4.entry.js.map +1 -1
  381. package/dist/esm/ic-layout-grid-item.entry.js +2 -2
  382. package/dist/esm/ic-layout-grid-item.entry.js.map +1 -1
  383. package/dist/esm/ic-layout-grid.entry.js +2 -2
  384. package/dist/esm/ic-layout-grid.entry.js.map +1 -1
  385. package/dist/esm/ic-link.entry.js +1 -1
  386. package/dist/esm/ic-link.entry.js.map +1 -1
  387. package/dist/esm/ic-menu-group.entry.js +1 -1
  388. package/dist/esm/ic-menu-group.entry.js.map +1 -1
  389. package/dist/esm/ic-menu.entry.js +3 -3
  390. package/dist/esm/ic-menu.entry.js.map +1 -1
  391. package/dist/esm/ic-navigation-group.entry.js +1 -1
  392. package/dist/esm/ic-navigation-group.entry.js.map +1 -1
  393. package/dist/esm/ic-navigation-menu.entry.js +4 -4
  394. package/dist/esm/ic-navigation-menu.entry.js.map +1 -1
  395. package/dist/esm/ic-page-header.entry.js +6 -6
  396. package/dist/esm/ic-page-header.entry.js.map +1 -1
  397. package/dist/esm/ic-pagination_4.entry.js +18 -18
  398. package/dist/esm/ic-pagination_4.entry.js.map +1 -1
  399. package/dist/esm/ic-popover-menu.entry.js +4 -4
  400. package/dist/esm/ic-popover-menu.entry.js.map +1 -1
  401. package/dist/esm/ic-radio-group.entry.js +4 -4
  402. package/dist/esm/ic-radio-group.entry.js.map +1 -1
  403. package/dist/esm/ic-radio-option.entry.js +4 -4
  404. package/dist/esm/ic-radio-option.entry.js.map +1 -1
  405. package/dist/esm/ic-search-bar.entry.js +9 -9
  406. package/dist/esm/ic-search-bar.entry.js.map +1 -1
  407. package/dist/esm/ic-section-container.entry.js +2 -2
  408. package/dist/esm/ic-section-container.entry.js.map +1 -1
  409. package/dist/esm/ic-side-navigation.entry.js +4 -4
  410. package/dist/esm/ic-side-navigation.entry.js.map +1 -1
  411. package/dist/esm/ic-skeleton.entry.js +2 -2
  412. package/dist/esm/ic-skeleton.entry.js.map +1 -1
  413. package/dist/esm/ic-skip-link.entry.js +2 -2
  414. package/dist/esm/ic-skip-link.entry.js.map +1 -1
  415. package/dist/esm/ic-status-tag.entry.js +2 -2
  416. package/dist/esm/ic-status-tag.entry.js.map +1 -1
  417. package/dist/esm/ic-step.entry.js +13 -13
  418. package/dist/esm/ic-step.entry.js.map +1 -1
  419. package/dist/esm/ic-stepper.entry.js +2 -2
  420. package/dist/esm/ic-stepper.entry.js.map +1 -1
  421. package/dist/esm/ic-switch.entry.js +4 -4
  422. package/dist/esm/ic-switch.entry.js.map +1 -1
  423. package/dist/esm/ic-tab-context.entry.js +1 -1
  424. package/dist/esm/ic-tab-context.entry.js.map +1 -1
  425. package/dist/esm/ic-tab-group.entry.js +2 -2
  426. package/dist/esm/ic-tab-group.entry.js.map +1 -1
  427. package/dist/esm/ic-tab-panel.entry.js +2 -2
  428. package/dist/esm/ic-tab-panel.entry.js.map +1 -1
  429. package/dist/esm/ic-table-of-contents.entry.js +4 -4
  430. package/dist/esm/ic-theme.entry.js +1 -1
  431. package/dist/esm/ic-theme.entry.js.map +1 -1
  432. package/dist/esm/ic-time-input.entry.js +5 -5
  433. package/dist/esm/ic-time-input.entry.js.map +1 -1
  434. package/dist/esm/ic-toast-region.entry.js +1 -1
  435. package/dist/esm/ic-toast-region.entry.js.map +1 -1
  436. package/dist/esm/ic-toast.entry.js +4 -4
  437. package/dist/esm/ic-toast.entry.js.map +1 -1
  438. package/dist/esm/ic-toggle-button-group.entry.js +2 -2
  439. package/dist/esm/ic-toggle-button-group.entry.js.map +1 -1
  440. package/dist/esm/ic-toggle-button.entry.js +2 -2
  441. package/dist/esm/ic-toggle-button.entry.js.map +1 -1
  442. package/dist/esm/ic-tree-item.entry.js +3 -3
  443. package/dist/esm/ic-tree-view.entry.js +4 -4
  444. package/dist/esm/index-a7a720e7.js +4 -4
  445. package/dist/esm/loader.js +1 -1
  446. package/dist/types/components/ic-calendar/ic-calendar.d.ts +216 -0
  447. package/dist/types/components/ic-calendar/ic-calendar.stories.d.ts +151 -0
  448. package/dist/types/components/ic-calendar/test/a11y/ic-calendar.test.a11y.d.ts +1 -0
  449. package/dist/types/components/ic-card-horizontal/ic-card-horizontal.d.ts +1 -2
  450. package/dist/types/components/ic-date-input/ic-date-input.d.ts +2 -2
  451. package/dist/types/components/ic-date-picker/ic-date-picker.d.ts +22 -105
  452. package/dist/types/components/ic-date-picker/ic-date-picker.stories.d.ts +81 -0
  453. package/dist/types/components/ic-pagination-bar/ic-pagination-bar.d.ts +1 -1
  454. package/dist/types/components/ic-time-input/ic-time-input.d.ts +2 -2
  455. package/dist/types/components.d.ts +213 -14
  456. package/dist/types/utils/date-helpers.d.ts +1 -0
  457. package/dist/types/utils/types.d.ts +1 -0
  458. package/hydrate/index.js +2085 -1639
  459. package/hydrate/index.mjs +2085 -1639
  460. package/package.json +3 -3
  461. package/dist/cjs/helpers-da852478.js.map +0 -1
  462. package/dist/cjs/ic-date-input.cjs.entry.js +0 -1214
  463. package/dist/cjs/ic-date-input.cjs.entry.js.map +0 -1
  464. package/dist/collection/components/ic-date-picker/ic-day-button.js.map +0 -1
  465. package/dist/collection/components/ic-date-picker/ic-month-picker.js +0 -29
  466. package/dist/collection/components/ic-date-picker/ic-month-picker.js.map +0 -1
  467. package/dist/collection/components/ic-date-picker/ic-year-picker.js +0 -39
  468. package/dist/collection/components/ic-date-picker/ic-year-picker.js.map +0 -1
  469. package/dist/core/p-0f22f41e.js.map +0 -1
  470. package/dist/core/p-13c8859b.entry.js +0 -2
  471. package/dist/core/p-13c8859b.entry.js.map +0 -1
  472. package/dist/core/p-2528ecec.entry.js +0 -2
  473. package/dist/core/p-2528ecec.entry.js.map +0 -1
  474. package/dist/core/p-402870f7.entry.js +0 -2
  475. package/dist/core/p-402870f7.entry.js.map +0 -1
  476. package/dist/core/p-bd8c2e24.entry.js +0 -2
  477. package/dist/core/p-bd8c2e24.entry.js.map +0 -1
  478. package/dist/core/p-c0d4db72.entry.js +0 -2
  479. package/dist/core/p-c0d4db72.entry.js.map +0 -1
  480. package/dist/core/p-ea1de762.entry.js.map +0 -1
  481. package/dist/core/p-f16c4210.entry.js +0 -2
  482. package/dist/core/p-f16c4210.entry.js.map +0 -1
  483. package/dist/esm/helpers-89cb996d.js.map +0 -1
  484. package/dist/esm/ic-date-input.entry.js +0 -1210
  485. package/dist/esm/ic-date-input.entry.js.map +0 -1
  486. /package/dist/collection/components/{ic-date-picker → ic-calendar}/ic-day-button.js +0 -0
  487. /package/dist/core/{p-df220b91.entry.js.map → p-3ef2e98d.entry.js.map} +0 -0
  488. /package/dist/core/{p-a8cc28a6.entry.js.map → p-9f76eed6.entry.js.map} +0 -0
  489. /package/dist/core/{p-069e758b.entry.js.map → p-e1920777.entry.js.map} +0 -0
  490. /package/dist/core/{p-92936b49.entry.js.map → p-ef5b6622.entry.js.map} +0 -0
  491. /package/dist/core/{p-1ca62941.entry.js.map → p-f5cea10d.entry.js.map} +0 -0
  492. /package/dist/types/components/{ic-date-picker → ic-calendar}/ic-day-button.d.ts +0 -0
  493. /package/dist/types/components/{ic-date-picker → ic-calendar}/ic-month-picker.d.ts +0 -0
  494. /package/dist/types/components/{ic-date-picker → ic-calendar}/ic-year-picker.d.ts +0 -0
@@ -0,0 +1,2354 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-d337cd8a.js');
6
+ const helpers = require('./helpers-6f4b406b.js');
7
+ const dateHelpers = require('./date-helpers-d7ee7b45.js');
8
+ const clearIcon = require('./clear-icon-547aa9b9.js');
9
+
10
+ const chevron = `<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
11
+ <path d="M9.70687 6L8.29688 7.41L12.8769 12L8.29688 16.59L9.70687 18L15.7069 12L9.70687 6Z" fill="currentColor"/>
12
+ </svg>
13
+ `;
14
+
15
+ const DayButton = ({ focussed, today, day, monthInView, onFocusDay, onBlurDay, onSelectDay, selected, focussedDayRef, inRange, showDaysOutsideMonth, disableDay, }) => {
16
+ const handleDayClick = () => {
17
+ onSelectDay(day);
18
+ };
19
+ const handleDayFocus = () => {
20
+ onFocusDay();
21
+ };
22
+ const handleDayBlur = () => {
23
+ onBlurDay();
24
+ };
25
+ const dayNames = helpers.stringEnumToArray(helpers.IcDayNames);
26
+ const months = helpers.stringEnumToArray(helpers.IcDateInputMonths);
27
+ const outsideRange = !inRange || disableDay;
28
+ const outsideMonth = monthInView !== day.getMonth();
29
+ const disabled = outsideRange || (outsideMonth && !showDaysOutsideMonth);
30
+ return (index.h("div", { class: "day-button-container" },
31
+ index.h("button", { class: {
32
+ "day-button": true,
33
+ "outside-month": outsideMonth,
34
+ "outside-range": !!outsideRange,
35
+ hidden: outsideMonth && !showDaysOutsideMonth,
36
+ disabled: disabled,
37
+ today: today,
38
+ selected: selected,
39
+ focussed: focussed,
40
+ }, tabIndex: focussed ? 0 : -1, "aria-hidden": outsideMonth ? "true" : "false", "aria-disabled": disabled ? "true" : "false", "aria-current": today ? "date" : undefined, "aria-label": disabled || outsideMonth || outsideRange
41
+ ? undefined
42
+ : `Choose ${dayNames[day.getDay()]}, ${day.getDate()} ${months[day.getMonth()]} ${day.getFullYear()}`, disabled: disabled, onClick: handleDayClick, onBlur: handleDayBlur, onFocus: handleDayFocus, ref: (el) => {
43
+ if (focussed && el && focussedDayRef) {
44
+ focussedDayRef(el);
45
+ }
46
+ } }, (!outsideMonth || (outsideMonth && showDaysOutsideMonth)) && (index.h("ic-typography", { variant: "subtitle-small", italic: outsideMonth }, day.getDate())))));
47
+ };
48
+
49
+ const MonthPicker = ({ size, focussedMonth, monthInView, onSelectMonth, onKeyDown, focussedMonthRef, minDate, maxDate, yearInView, }) => {
50
+ const handleMonthClick = (ev) => {
51
+ const button = ev.target;
52
+ onSelectMonth(Number(button.getAttribute("data-month")));
53
+ };
54
+ const monthNames = helpers.stringEnumToArray(helpers.IcDateInputMonths);
55
+ const cols = size === "small" ? 2 : 3;
56
+ const months = [];
57
+ for (let i = 0; i < monthNames.length; i += cols) {
58
+ months.push(monthNames.slice(i, i + cols));
59
+ }
60
+ return (index.h("div", { class: {
61
+ "month-picker": true,
62
+ }, role: "grid" }, months.map((month, monthIdx) => (index.h("div", { class: "month-picker-row", key: monthIdx, role: "row" }, month.map((mon, index$1) => {
63
+ const correctedIndex = monthIdx * cols + index$1;
64
+ const current = monthInView === correctedIndex;
65
+ const focussed = focussedMonth === correctedIndex;
66
+ const outsideRange = !dateHelpers.dateInRange(new Date(yearInView, correctedIndex, 1), minDate ? dateHelpers.getMonthStart(minDate) : null, maxDate ? dateHelpers.getMonthEnd(maxDate) : null);
67
+ return (index.h("ic-button", { role: "gridcell", class: {
68
+ "month-button": true,
69
+ selected: current,
70
+ focussed: focussed,
71
+ disabled: outsideRange,
72
+ }, "full-width": true, disabled: outsideRange, variant: current ? "primary" : "tertiary", "data-month": correctedIndex, size: size, tabIndex: focussed ? 0 : -1, "aria-current": current ? "true" : "false", "aria-label": current ? "" : `select ${mon}`, onClick: handleMonthClick, onKeyDown: onKeyDown, ref: (el) => {
73
+ if (focussed && el) {
74
+ focussedMonthRef(el);
75
+ }
76
+ } }, mon));
77
+ }))))));
78
+ };
79
+
80
+ const YearPicker = ({ decadeView, size, focussedYear, yearInView, onSelectYear, onFocusYear, onBlurYear, onKeyDown, minDate, maxDate, focussedYearRef, }) => {
81
+ const handleYearClick = (ev) => {
82
+ const button = ev.target;
83
+ onSelectYear(Number(button.getAttribute("data-year")));
84
+ };
85
+ const handleYearFocus = () => {
86
+ onFocusYear();
87
+ };
88
+ const handleYearBlur = () => {
89
+ onBlurYear();
90
+ };
91
+ const navButtonMouseDownHandler = (ev) => {
92
+ ev.preventDefault();
93
+ };
94
+ const cols = size === "small" ? 2 : 3;
95
+ const rows = size === "small" ? 6 : 4;
96
+ const thisDecade = [];
97
+ for (let i = 0; i < decadeView.length; i += cols) {
98
+ thisDecade.push(decadeView.slice(i, i + cols));
99
+ }
100
+ const renderYearButton = (yr, yearIdx, idx) => {
101
+ const isPrevDecade = yearIdx === 0 && idx === 0;
102
+ const isNextDecade = yearIdx === rows - 1 && idx === cols - 1;
103
+ const isCurrent = yearInView === yr;
104
+ const isFocussed = focussedYear === yr;
105
+ return (index.h("ic-button", { key: yr, role: "gridcell", id: isPrevDecade
106
+ ? "prev-decade-button"
107
+ : isNextDecade
108
+ ? "next-decade-button"
109
+ : undefined, class: {
110
+ "prev-decade": isPrevDecade,
111
+ "next-decade": isNextDecade,
112
+ "year-button": true,
113
+ selected: !isPrevDecade && !isNextDecade ? isCurrent : false,
114
+ focussed: !isPrevDecade && !isNextDecade ? isFocussed : false,
115
+ flip: isNextDecade,
116
+ }, "full-width": true, disabled: !dateHelpers.yearInRange(yr, minDate, maxDate), "data-year": yr, tabIndex: isPrevDecade || isNextDecade ? -1 : isFocussed ? 0 : -1, variant: isPrevDecade || isNextDecade
117
+ ? "tertiary"
118
+ : isCurrent
119
+ ? "primary"
120
+ : "tertiary", onClick: handleYearClick, onMouseDown: isPrevDecade || isNextDecade ? navButtonMouseDownHandler : undefined, size: size, "aria-label": !isPrevDecade && !isNextDecade
121
+ ? isCurrent
122
+ ? ""
123
+ : `select ${yr}`
124
+ : undefined, "aria-current": !isPrevDecade && !isNextDecade
125
+ ? isCurrent
126
+ ? "true"
127
+ : "false"
128
+ : undefined, onKeyDown: !isPrevDecade && !isNextDecade ? onKeyDown : undefined, onFocus: !isPrevDecade && !isNextDecade ? handleYearFocus : undefined, onBlur: !isPrevDecade && !isNextDecade ? handleYearBlur : undefined, ref: !isPrevDecade && !isNextDecade && isFocussed
129
+ ? (el) => el && focussedYearRef(el)
130
+ : undefined },
131
+ isPrevDecade ? `${yr - 9}s` : isNextDecade ? `${yr}s` : yr,
132
+ (isPrevDecade || isNextDecade) && (index.h("svg", { slot: isPrevDecade ? "left-icon" : "right-icon", width: "12", height: "12", fill: "none", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" },
133
+ index.h("path", { d: "M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z", fill: "currentColor" })))));
134
+ };
135
+ return (index.h("div", { class: "year-picker", role: "grid" }, thisDecade.map((years, yearIdx) => (index.h("div", { class: "year-picker-row", role: "row", key: yearIdx }, years.map((yr, idx) => renderYearButton(yr, yearIdx, idx)))))));
136
+ };
137
+
138
+ const icCalendarCss = "/*! 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}:host(.ic-date-picker-above) .calendar-container{bottom:calc(var(--ic-space-xxl) - var(--ic-space-xxs))}:host(.ic-date-picker-calendar) .calendar-container{box-shadow:var(--ic-calendar-elevation)}:host .calendar-container{min-width:19rem;max-width:23.5rem;width:var(--input-width);display:flex;flex-direction:column;gap:var(--ic-space-xs);position:absolute;border:var(--ic-border-default);border-color:var(--ic-calendar-border);border-radius:var(--ic-border-radius);align-items:center;background-color:var(--ic-calendar-bg);z-index:var(--ic-z-index-calendar);box-sizing:border-box;margin-top:var(--ic-space-xxxs);padding:var(--ic-space-xs);animation:fade-in-calendar var(--ic-transition-duration-slow)}:host(.ic-calendar-small) .calendar-container{min-width:17rem;max-width:21.5rem}:host(.ic-calendar-large) .calendar-container{min-width:21rem;max-width:25.5rem}:host(.ic-calendar-large){--month-button-width:6.3125rem}:host(.ic-calendar-small){--month-button-width:6.25rem}:host .month-year-nav-container{display:flex;justify-content:space-between;align-items:center;align-self:stretch}:host .month-year-nav-container.hidden{display:none}:host .month-year-nav{display:flex;justify-content:space-between;align-items:center;flex:1 0 0}:host .month-picker,:host .year-picker{display:flex;flex-direction:column;align-items:center;width:17.5rem;-moz-column-gap:var(--ic-space-xs);column-gap:var(--ic-space-xs);row-gap:var(--ic-space-xxs)}:host(.ic-calendar-small) .month-picker,:host(.ic-calendar-small) .year-picker{width:13.125rem}:host(.ic-calendar-large) .month-picker,:host(.ic-calendar-large) .year-picker{width:20rem}:host .month-picker .month-picker-row,:host .year-picker .year-picker-row{display:inline-grid;grid-template-columns:repeat(3, minmax(0px, 1fr));width:100%;gap:var(--ic-space-xs)}:host(.ic-calendar-small) .month-picker .month-picker-row,:host(.ic-calendar-small) .year-picker .year-picker-row{grid-template-columns:repeat(2, minmax(0, 1fr))}:host .month-picker-button,:host .year-picker-button{width:5rem;--min-width:5rem}:host .month-button,:host .year-button{width:var(--month-button-width)}:host .month-button.focussed,:host .year-button.focussed{z-index:1}:host .month-button::part(button),:host .year-button::part(button){min-width:var(--month-button-width);padding:var(--ic-space-xs) auto}:host .prev-decade.year-button svg{margin-right:calc(-1 * var(--ic-space-xs));--icon-width:var(--ic-space-md);--icon-height:var(--ic-space-md)}:host(.ic-calendar-small) .prev-decade.year-button svg{margin-right:calc(-1 * calc(var(--ic-space-md) + var(--ic-space-1px)))}:host(.ic-calendar-large) .prev-decade.year-button svg{margin-right:calc(-1 * calc(var(--ic-space-md) + var(--ic-space-xxs)))}:host .prev-decade.year-button::part(button){padding-left:0;padding-right:var(--ic-space-lg);gap:var(--ic-space-xxxs);display:inline-grid;grid-template-columns:1.5rem 1fr}:host(.ic-calendar-small) .prev-decade.year-button::part(button){padding-left:0;padding-right:calc(var(--ic-space-lg) + var(--ic-space-xxs))}:host .next-decade.year-button svg{margin-left:calc(-1 * var(--ic-space-lg));--icon-width:var(--ic-space-md);--icon-height:var(--ic-space-md)}:host(.ic-calendar-small) .next-decade.year-button svg,:host(.ic-calendar-large) .next-decade.year-button svg{margin-left:calc(\n -1 * (var(--ic-space-lg) + var(--ic-space-xs) + var(--ic-space-1px))\n )}:host .next-decade.year-button::part(button){padding-right:0;padding-left:var(--ic-space-lg);gap:var(--ic-space-xxxs);display:inline-grid;grid-template-columns:1fr 1.5rem}:host(.ic-calendar-small) .next-decade.year-button::part(button),:host(.ic-calendar-large) .next-decade.year-button::part(button){padding-left:calc(var(--ic-space-xl) - var(--ic-space-xxs))}:host .bottom-buttons{display:flex;justify-content:space-between;align-items:center;align-self:stretch;animation:fade-in-buttons var(--ic-transition-duration-slow)}:host .bottom-buttons.no-today{align-items:flex-end;flex-direction:column}:host .bottom-buttons.hidden{display:none}:host .calendar{display:flex;flex-direction:column;align-items:flex-start;width:15.75rem;animation:fade-in-buttons var(--ic-transition-duration-slow)}:host(.ic-calendar-large) .calendar{width:19.25rem}:host(.ic-calendar-small) .calendar{padding-bottom:var(--ic-space-xxs);width:14rem}:host .hidden{display:none}:host .weekdays-container{display:flex;align-self:stretch}:host .weekdays{display:flex;flex-grow:1;justify-content:space-between;align-items:flex-start;padding-bottom:var(--ic-space-xs)}:host .calendar-days-container{display:flex;flex-wrap:wrap;justify-content:space-between;row-gap:var(--ic-space-xs);padding:var(--ic-space-xxs) 0;min-height:16rem;align-content:flex-start}:host(.ic-calendar-small) .calendar-days-container{padding:var(--ic-space-xxxs) 0;min-height:14.5rem}:host(.ic-calendar-large) .calendar-days-container{padding:var(--ic-space-xs) 0;min-height:17.5rem}:host .calendar-days-container tr{display:flex;flex-grow:1;justify-content:space-between;border-spacing:0}:host .calendar-day-header{display:flex;width:2rem;padding:var(--ic-space-xxs) 0;justify-content:center;align-items:center;color:var(--ic-typography-color, var(--ic-color-text-primary));--ic-typography-color:var(--ic-calendar-label);text-align:center;font:var(--ic-font-caption);letter-spacing:var(--ic-font-letter-spacing-0pt0025)}:host(.ic-calendar-large) .calendar-day-header{padding:var(--ic-space-xxs)}:host .day-button-container{display:flex;justify-content:center;align-items:center;width:2.25rem;height:2.25rem}:host(.ic-calendar-small) .day-button-container{width:2rem;height:2rem}:host(.ic-calendar-large) .day-button-container{width:2.5rem;height:2.5rem}:host .day-button{display:flex;position:relative;justify-content:center;align-items:center;border:0;border-radius:2rem;background-color:var(--ic-calendar-bg);width:2rem;height:2rem;cursor:pointer;transition:var(--ic-easing-transition-fast);z-index:0}:host .day-button.disabled{cursor:default}:host(.ic-calendar-large) .day-button{width:2.25rem;height:2.25rem}:host(.ic-calendar-small) .day-button{width:1.75rem;height:1.75rem}:host .day-button ic-typography{width:1.75rem;--ic-typography-color:var(--ic-calendar-date-label-default)}:host .day-button.outside-range ic-typography{--ic-typography-color:var(--ic-calendar-date-label-disabled)}:host .day-button.outside-month ic-typography{font-weight:var(--ic-font-weight-regular) !important}:host .day-button.outside-month:not(.outside-range):not(.selected) ic-typography{--ic-typography-color:var(--ic-calendar-date-label-default)}:host .day-button:hover:not(.disabled){background-color:var(--ic-calendar-date-default-bg-hover)}:host .day-button:active:not(.disabled){background-color:var(--ic-calendar-date-default-bg-pressed)}@media (prefers-reduced-motion: no-preference){:host .day-button:hover:not(.disabled):not(.focussed),:host .day-button:active:not(.disabled):not(.focussed){transition:background-color var(--ic-transition-duration-slow) ease-in-out}}:host .day-button.selected:not(.hidden){background-color:var(--ic-calendar-date-active-bg-default)}:host .day-button.selected ic-typography{--ic-typography-color:var(--ic-calendar-date-label-selected)}:host .day-button.selected:not(.hidden):hover{background-color:var(--ic-calendar-date-active-bg-hover)}:host .day-button.selected:not(.hidden):active{background-color:var(--ic-calendar-date-active-bg-pressed)}:host .day-button.focussed{z-index:1}:host .day-button:focus{outline:none}:host .day-button.focussed:focus{box-shadow:var(--ic-border-focus)}:host .day-button.today:not(.hidden)::after{content:\"\";position:absolute;width:0.875rem;height:0.125rem;bottom:0.4rem;border-radius:var(--ic-border-radius);background-color:var(--ic-calendar-default-underline)}:host(.ic-calendar-small) .day-button.today::after{bottom:0.35rem}:host(.ic-calendar-large) .day-button.today::after{width:1rem}:host .day-button.today.selected::after{background-color:var(--ic-calendar-selected-underline)}:host #select-month-hint,:host #select-year-hint{display:none}.sr-only{position:absolute;left:-9999px}@media (prefers-reduced-motion: reduce){:host .calendar-container,:host .calendar,:host .bottom-buttons{animation:none}}@keyframes fade-in-buttons{0%{opacity:0}50%{opacity:0}100%{opacity:1}}@keyframes fade-in-calendar{0%{display:flex;max-height:0}100%{display:flex;max-height:600px}}@media (forced-colors: active){:host .day-button.today:not(.hidden)::after{background-color:highlight}:host .day-button.selected:not(.hidden){background-color:highlight}:host .day-button.focussed:focus{border:var(--ic-border-hc)}:host .month-button.selected::part(button),:host .year-button.selected::part(button){background-color:highlight}}";
139
+ const IcCalendarStyle0 = icCalendarCss;
140
+
141
+ const FOCUS_TIMER = 100;
142
+ const Calendar$1 = class {
143
+ constructor(hostRef) {
144
+ index.registerInstance(this, hostRef);
145
+ this.icChange = index.createEvent(this, "icChange", 7);
146
+ this.icCalendarClearButtonClick = index.createEvent(this, "icCalendarClearButtonClick", 7);
147
+ this.icCalendarDaySelect = index.createEvent(this, "icCalendarDaySelect", 7);
148
+ this.icCalendarMonthSelect = index.createEvent(this, "icCalendarMonthSelect", 7);
149
+ this.icCalendarYearSelect = index.createEvent(this, "icCalendarYearSelect", 7);
150
+ this.daysOfWeek = [];
151
+ this.dayButtonFocussed = false;
152
+ this.dayPickerKeyboardNav = false;
153
+ this.dialogDescription = "";
154
+ this.focusDay = true;
155
+ this.liveRegionEl = undefined;
156
+ this.monthNames = [];
157
+ this.monthInViewUpdateHandled = false;
158
+ this.parentIsDatePicker = false;
159
+ this.today = new Date();
160
+ this.yearButtonFocussed = false;
161
+ this.clearButtonClicked = false;
162
+ this.currMonthView = [];
163
+ this.currYearPickerView = [];
164
+ this.decadeView = [];
165
+ this.focussedDate = null;
166
+ this.maxDate = null;
167
+ this.minDate = null;
168
+ this.monthPickerVisible = false;
169
+ this.orderedDaysOfWeek = [];
170
+ this.selectedDate = null;
171
+ this.yearPickerVisible = false;
172
+ /**
173
+ * The format in which the date will be displayed.
174
+ */
175
+ this.dateFormat = "DD/MM/YYYY";
176
+ /**
177
+ * If `true`, the disabled state will be set.
178
+ */
179
+ this.disabled = false;
180
+ /**
181
+ * The days of the week to disable.
182
+ */
183
+ this.disableDays = [];
184
+ /**
185
+ * If `true`, dates in the future are not allowed.
186
+ */
187
+ this.disableFuture = false;
188
+ /**
189
+ * If `true`, dates in the past are not allowed.
190
+ */
191
+ this.disablePast = false;
192
+ /**
193
+ * The latest date that will be allowed. The value can be in any format supported as `dateFormat`, in ISO 8601 date string format (`yyyy-mm-dd`) or as a JavaScript `Date` object.
194
+ * The value of this prop is ignored if `disableFuture` is set to `true`.
195
+ */
196
+ this.max = "";
197
+ /**
198
+ * The earliest date that will be allowed. The value can be in any format supported as `dateFormat`, in ISO 8601 date string format (`yyyy-mm-dd`) or as a JavaScript `Date` object.
199
+ * The value of this prop is ignored if `disablePast` is set to `true`.
200
+ */
201
+ this.min = "";
202
+ /**
203
+ * The date visible when the calendar opens. Used if no date is currently selected.
204
+ * The value can be in any format supported as `dateFormat`, in ISO 8601 date string format (`yyyy-mm-dd`) or as a JavaScript `Date` object.
205
+ */
206
+ this.openAtDate = "";
207
+ /**
208
+ * If `true`, the `Clear` button on the calendar will be visible.
209
+ */
210
+ this.showClearButton = true;
211
+ /**
212
+ * If `true`, days outside the current month will be visible in the calendar.
213
+ */
214
+ this.showDaysOutsideMonth = true;
215
+ /**
216
+ * If `true`, the `Go to today` button on the calendar will be visible.
217
+ */
218
+ this.showTodayButton = true;
219
+ /**
220
+ * The size of the calendar to be displayed.
221
+ */
222
+ this.size = "medium";
223
+ /**
224
+ * The first day of the week. `0` for Sunday, `1` for Monday, etc.
225
+ * Default is Monday.
226
+ */
227
+ this.startOfWeek = helpers.IcWeekDays.Monday;
228
+ /**
229
+ * Sets the calendar to the dark or light theme colors. "inherit" will set the color based on the system settings or ic-theme component.
230
+ */
231
+ this.theme = "inherit";
232
+ /**
233
+ * The value of the calendar and the date visible when the calendar opens.
234
+ * The value can be in any format supported as `dateFormat`, in ISO 8601 date string format (`yyyy-mm-dd`) or as a JavaScript `Date` object.
235
+ */
236
+ this.value = "";
237
+ this.isValidDateValue = (value) => {
238
+ if (value == null)
239
+ return true;
240
+ if (value instanceof Date) {
241
+ return !isNaN(value.getTime());
242
+ }
243
+ if (typeof value !== "string")
244
+ return false;
245
+ const iso8601Regex = /^\d{4}-\d{2}-\d{2}(?:[T\s]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:?\d{2})?)?$/;
246
+ if (iso8601Regex.test(value)) {
247
+ return !isNaN(Date.parse(value));
248
+ }
249
+ const [a, b, c] = value.split("/").map(Number);
250
+ if ([a, b, c].some(isNaN))
251
+ return false;
252
+ let day, month, year;
253
+ switch (this.dateFormat) {
254
+ case "DD/MM/YYYY":
255
+ [day, month, year] = [a, b, c];
256
+ break;
257
+ case "MM/DD/YYYY":
258
+ [month, day, year] = [a, b, c];
259
+ break;
260
+ case "YYYY/MM/DD":
261
+ [year, month, day] = [a, b, c];
262
+ break;
263
+ default:
264
+ return false;
265
+ }
266
+ if (month < 1 || month > 12 || day < 1 || day > 31)
267
+ return false;
268
+ const date = new Date(year, month - 1, day);
269
+ return (date.getFullYear() === year &&
270
+ date.getMonth() === month - 1 &&
271
+ date.getDate() === day);
272
+ };
273
+ this.isPresent = (prop) => prop !== "" && prop !== undefined && prop !== null;
274
+ this.setOpenAtDate = () => {
275
+ var _a;
276
+ let openAt = null;
277
+ if (this.disabled) {
278
+ openAt = new Date();
279
+ }
280
+ else {
281
+ if (this.clearButtonClicked) {
282
+ openAt = this.focussedDate ? this.focussedDate : new Date();
283
+ this.clearButtonClicked = false;
284
+ }
285
+ else {
286
+ if (!this.disabled &&
287
+ this.value != null &&
288
+ this.isValidDateValue(this.value)) {
289
+ openAt = dateHelpers.createDate(this.value, this.dateFormat);
290
+ }
291
+ if (!!openAt && dateHelpers.dateInRange(openAt, this.minDate, this.maxDate)) {
292
+ const selectedDay = openAt.getDay();
293
+ if (!!this.disableDays &&
294
+ this.disableDays.length > 0 &&
295
+ typeof selectedDay == "number" &&
296
+ this.disableDays.includes(selectedDay)) {
297
+ openAt = dateHelpers.createDate((_a = this.value) !== null && _a !== void 0 ? _a : new Date(), this.dateFormat);
298
+ this.setSelectedDate(null);
299
+ }
300
+ else {
301
+ this.setSelectedDate(openAt);
302
+ }
303
+ }
304
+ else if (this.isPresent(this.openAtDate)) {
305
+ openAt = dateHelpers.createDate(this.openAtDate, this.dateFormat);
306
+ }
307
+ else {
308
+ openAt = new Date();
309
+ }
310
+ }
311
+ }
312
+ this.setFocussedDate(openAt);
313
+ this.updateMonthInView();
314
+ let dialogDesc = this.getMonthInViewText();
315
+ if (this.selectedDate === null) {
316
+ dialogDesc += " No date selected.";
317
+ }
318
+ dialogDesc += ` Use arrow keys to change day. Press enter or space to select a date${this.parentIsDatePicker ? " or press escape to close the picker" : ""}.`;
319
+ this.dialogDescription = dialogDesc;
320
+ setTimeout(() => this.focusFocussedDay(), FOCUS_TIMER);
321
+ };
322
+ /* Refs & setters */
323
+ this.setFocussedDayEl = (element) => {
324
+ this.focussedDayEl = element;
325
+ };
326
+ this.setFocussedMonthEl = (element) => {
327
+ this.focussedMonthEl = element;
328
+ };
329
+ this.setFocussedYearEl = (element) => {
330
+ this.focussedYearEl = element;
331
+ };
332
+ this.setFocussedYear = (newYear, focus = true) => {
333
+ const prevYear = this.focussedYear;
334
+ this.focussedYear = newYear;
335
+ if (this.yearPickerVisible) {
336
+ const newDecade = Math.floor(newYear / 10) * 10;
337
+ const oldDecade = Math.floor(prevYear / 10) * 10;
338
+ if (newDecade !== oldDecade) {
339
+ this.setDecadeView(newDecade);
340
+ this.setAriaLiveRegionText(this.getDecadeInViewText());
341
+ }
342
+ if (focus) {
343
+ setTimeout(() => {
344
+ if (this.focussedYearEl !== null)
345
+ this.focussedYearEl.setFocus();
346
+ }, FOCUS_TIMER);
347
+ }
348
+ }
349
+ else {
350
+ this.setDecadeView(Math.floor(newYear / 10) * 10);
351
+ }
352
+ };
353
+ this.setFocussedDate = (d) => {
354
+ this.focussedDate = dateHelpers.clampDate(d, this.minDate, this.maxDate);
355
+ };
356
+ this.setSelectedDate = (d, emit = true) => {
357
+ if (d === null || !dateHelpers.dateMatches(d, this.selectedDate)) {
358
+ this.selectedDate = d;
359
+ this.value = d;
360
+ if (emit) {
361
+ this.icChange.emit(this.setDateChangeEventDetail(d));
362
+ }
363
+ }
364
+ };
365
+ this.setDateChangeEventDetail = (d) => {
366
+ let UTCDate = null;
367
+ let day = null;
368
+ let month = null;
369
+ let year = null;
370
+ if (d !== null) {
371
+ UTCDate = new Date(Date.UTC(d.getFullYear(), d.getMonth(), d.getDate()));
372
+ day = dateHelpers.convertToDoubleDigits(d.getDate());
373
+ month = dateHelpers.convertToDoubleDigits(d.getMonth() + 1);
374
+ year = d.getFullYear().toString();
375
+ }
376
+ return {
377
+ value: d,
378
+ dateObject: {
379
+ day: day === "" ? null : day,
380
+ month: month === "" ? null : month,
381
+ year: year === "" ? null : year,
382
+ },
383
+ utcValue: UTCDate,
384
+ };
385
+ };
386
+ this.setAriaLiveRegionText = (text) => {
387
+ this.liveRegionEl && (this.liveRegionEl.innerText = text);
388
+ };
389
+ /* Navigation helpers */
390
+ this.goToPreviousMonth = (focusDay = false) => {
391
+ this.focusDay = focusDay;
392
+ this.moveMonths(-1);
393
+ };
394
+ this.goToNextMonth = (focusDay = false) => {
395
+ this.focusDay = focusDay;
396
+ this.moveMonths(1);
397
+ };
398
+ this.goToPreviousYear = (focusDay = false) => {
399
+ if (this.isPrevYearAllowed()) {
400
+ this.focusDay = focusDay;
401
+ this.moveYears(-1);
402
+ }
403
+ };
404
+ this.goToNextYear = (focusDay = false) => {
405
+ if (this.isNextYearAllowed()) {
406
+ this.focusDay = focusDay;
407
+ this.moveYears(1);
408
+ }
409
+ };
410
+ this.moveDays = (numDays) => {
411
+ if (this.focussedDate) {
412
+ const d = new Date(this.focussedDate);
413
+ d.setDate(d.getDate() + numDays);
414
+ this.setFocussedDate(d);
415
+ }
416
+ };
417
+ this.moveMonths = (numMonths) => {
418
+ if (this.focussedDate) {
419
+ const newMonth = this.focussedDate.getMonth() + numMonths;
420
+ const min = new Date(new Date(dateHelpers.getMonthStart(this.focussedDate)).setMonth(newMonth));
421
+ const max = dateHelpers.getMonthEnd(min);
422
+ const newDate = new Date(new Date(this.focussedDate).setMonth(newMonth));
423
+ this.setFocussedDate(dateHelpers.clampDate(newDate, min, max));
424
+ if (this.monthPickerVisible === false &&
425
+ this.yearPickerVisible === false &&
426
+ this.monthInViewUpdateHandled === false) {
427
+ this.setAriaLiveRegionText(this.getMonthInViewText());
428
+ }
429
+ this.monthInViewUpdateHandled = false;
430
+ }
431
+ };
432
+ this.moveYears = (numYears) => {
433
+ if (this.focussedDate) {
434
+ const newYear = this.focussedDate.getFullYear() + numYears;
435
+ const min = new Date(new Date(dateHelpers.getMonthStart(this.focussedDate)).setFullYear(newYear));
436
+ const max = dateHelpers.getMonthEnd(min);
437
+ const newDate = new Date(new Date(this.focussedDate).setFullYear(newYear));
438
+ this.setFocussedDate(dateHelpers.clampDate(newDate, min, max));
439
+ if (this.monthPickerVisible === false &&
440
+ this.yearPickerVisible === false &&
441
+ this.monthInViewUpdateHandled === false) {
442
+ this.setAriaLiveRegionText(this.getMonthInViewText());
443
+ }
444
+ this.monthInViewUpdateHandled = false;
445
+ }
446
+ };
447
+ this.updateFocussedMonth = (adjust) => {
448
+ const d = new Date(this.focussedYear, this.focussedMonth, 1);
449
+ d.setMonth(this.focussedMonth + adjust);
450
+ const newDate = dateHelpers.clampDate(d, this.minDate, this.maxDate);
451
+ this.focussedMonth = newDate.getMonth();
452
+ setTimeout(() => this.focussedMonthEl.setFocus(), FOCUS_TIMER);
453
+ };
454
+ this.updateFocussedYear = (adjust, focusYear = true) => {
455
+ const d = new Date(new Date().setFullYear(this.focussedYear + adjust));
456
+ const newDate = dateHelpers.clampDate(d, this.minDate, this.maxDate);
457
+ this.setFocussedYear(newDate.getFullYear(), focusYear);
458
+ };
459
+ this.getNextDayToFocus = (currDay, forward, level = 1) => {
460
+ var _a;
461
+ const move = forward ? 1 : -1;
462
+ const nextDay = new Date(currDay);
463
+ nextDay.setDate(nextDay.getDate() + move);
464
+ return ((_a = this.disableDays) === null || _a === void 0 ? void 0 : _a.includes(Number(nextDay.getDay())))
465
+ ? this.getNextDayToFocus(nextDay, forward, level + 1)
466
+ : level;
467
+ };
468
+ /* Focus helpers */
469
+ this.focusFirstElement = () => {
470
+ var _a;
471
+ (_a = this.monthButtonEl) === null || _a === void 0 ? void 0 : _a.setFocus();
472
+ };
473
+ this.focusLastElement = () => {
474
+ if (this.showClearButton &&
475
+ this.clearButtonEl &&
476
+ !this.clearButtonEl.disabled) {
477
+ this.clearButtonEl.setFocus();
478
+ }
479
+ else if (this.showTodayButton &&
480
+ this.todayButtonEl &&
481
+ !this.todayButtonEl.disabled) {
482
+ this.todayButtonEl.setFocus();
483
+ }
484
+ else if (this.monthPickerVisible) {
485
+ this.focussedMonthEl.setFocus();
486
+ }
487
+ else if (this.yearPickerVisible) {
488
+ this.focussedYearEl.setFocus();
489
+ }
490
+ else {
491
+ this.focussedDayEl.focus();
492
+ }
493
+ };
494
+ this.focusFocussedDay = () => {
495
+ this.focussedDayEl.focus();
496
+ };
497
+ /* Click handlers */
498
+ this.monthButtonClickHandler = () => {
499
+ this.yearPickerVisible = false;
500
+ this.focusDay = false;
501
+ this.monthPickerVisible = !this.monthPickerVisible;
502
+ if (this.monthPickerVisible) {
503
+ this.setAriaLiveRegionText("Month picker view open");
504
+ }
505
+ else {
506
+ this.setMonthSelectedLiveRegionText();
507
+ this.icCalendarMonthSelect.emit();
508
+ }
509
+ };
510
+ this.yearButtonClickHandler = () => {
511
+ this.monthPickerVisible = false;
512
+ this.focusDay = false;
513
+ this.yearPickerVisible = !this.yearPickerVisible;
514
+ if (this.yearPickerVisible) {
515
+ this.setAriaLiveRegionText(`Year picker view open. ${this.getDecadeInViewText()}`);
516
+ }
517
+ else {
518
+ this.setYearSelectedLiveRegionText();
519
+ this.icCalendarYearSelect.emit();
520
+ }
521
+ };
522
+ this.todayButtonClickHandler = () => {
523
+ this.yearPickerVisible = false;
524
+ this.monthPickerVisible = false;
525
+ this.setFocussedDate(new Date());
526
+ this.setAriaLiveRegionText(this.getMonthInViewText());
527
+ setTimeout(() => this.focusFocussedDay(), FOCUS_TIMER);
528
+ };
529
+ this.clearButtonClickHandler = () => {
530
+ this.clearButtonClicked = true;
531
+ this.selectedDate && this.setFocussedDate(this.selectedDate);
532
+ this.setSelectedDate(null);
533
+ this.icChange.emit(this.setDateChangeEventDetail(this.selectedDate));
534
+ let text = "Selected date cleared.";
535
+ if (!this.monthPickerVisible && !this.yearPickerVisible) {
536
+ text += ` ${this.getMonthInViewText()}`;
537
+ }
538
+ if (this.monthPickerVisible) {
539
+ this.focussedMonthEl.setFocus();
540
+ }
541
+ else if (this.yearPickerVisible) {
542
+ this.focussedYearEl.setFocus();
543
+ }
544
+ else {
545
+ this.focusFocussedDay();
546
+ }
547
+ this.setAriaLiveRegionText(text);
548
+ };
549
+ this.monthYearNavClickHandler = (ev) => {
550
+ const target = ev.target;
551
+ switch (target.id) {
552
+ case "previous-month-button":
553
+ this.goToPreviousMonth(this.dayButtonFocussed);
554
+ break;
555
+ case "next-month-button":
556
+ this.goToNextMonth(this.dayButtonFocussed);
557
+ break;
558
+ case "previous-year-button":
559
+ this.goToPreviousYear(this.dayButtonFocussed);
560
+ break;
561
+ case "next-year-button":
562
+ this.goToNextYear(this.dayButtonFocussed);
563
+ break;
564
+ }
565
+ };
566
+ this.handleCalendarClick = (event) => {
567
+ this.clearDialogDescription();
568
+ event.stopImmediatePropagation();
569
+ };
570
+ /* Keyboard handlers */
571
+ this.handleCalendarKeyDown = (ev) => {
572
+ let handled = true;
573
+ switch (ev.key) {
574
+ case "ArrowDown":
575
+ this.dayPickerKeyboardNav = true;
576
+ this.moveDays(7);
577
+ break;
578
+ case "ArrowUp":
579
+ this.dayPickerKeyboardNav = true;
580
+ this.moveDays(-7);
581
+ break;
582
+ case "ArrowLeft":
583
+ this.dayPickerKeyboardNav = true;
584
+ if (this.focussedDate)
585
+ this.moveDays(-1 * this.getNextDayToFocus(this.focussedDate, false));
586
+ break;
587
+ case "ArrowRight":
588
+ this.dayPickerKeyboardNav = true;
589
+ if (this.focussedDate)
590
+ this.moveDays(this.getNextDayToFocus(this.focussedDate, true));
591
+ break;
592
+ case "PageUp":
593
+ this.dayPickerKeyboardNav = true;
594
+ ev.shiftKey ? this.moveYears(-1) : this.moveMonths(-1);
595
+ break;
596
+ case "PageDown":
597
+ this.dayPickerKeyboardNav = true;
598
+ ev.shiftKey ? this.moveYears(1) : this.moveMonths(1);
599
+ break;
600
+ case "Home":
601
+ this.dayPickerKeyboardNav = true;
602
+ this.setFocussedDate(new Date(this.focussedYear, this.focussedMonth, 1));
603
+ break;
604
+ case "End":
605
+ this.dayPickerKeyboardNav = true;
606
+ this.setFocussedDate(new Date(this.focussedYear, this.focussedMonth + 1, 0));
607
+ break;
608
+ case "Tab":
609
+ handled = this.calendarTabHandler(ev);
610
+ break;
611
+ default:
612
+ handled = false;
613
+ break;
614
+ }
615
+ if (handled) {
616
+ ev.preventDefault();
617
+ }
618
+ };
619
+ this.monthPickerKeyDownHandler = (ev) => {
620
+ let handled = true;
621
+ switch (ev.key) {
622
+ case "ArrowUp":
623
+ case "ArrowLeft":
624
+ this.updateFocussedMonth(-1);
625
+ break;
626
+ case "ArrowDown":
627
+ case "ArrowRight":
628
+ this.updateFocussedMonth(1);
629
+ break;
630
+ case "Home":
631
+ this.updateFocussedMonth(-this.focussedMonth);
632
+ break;
633
+ case "End":
634
+ this.updateFocussedMonth(11 - this.focussedMonth);
635
+ break;
636
+ case "Tab":
637
+ handled = this.calendarTabHandler(ev);
638
+ break;
639
+ case "Escape":
640
+ ev.stopImmediatePropagation();
641
+ this.monthPickerVisible = false;
642
+ setTimeout(() => this.focusFocussedDay(), FOCUS_TIMER);
643
+ break;
644
+ default:
645
+ handled = false;
646
+ }
647
+ if (handled) {
648
+ ev.preventDefault();
649
+ }
650
+ };
651
+ this.yearPickerKeyDownHandler = (ev) => {
652
+ let handled = true;
653
+ switch (ev.key) {
654
+ case "ArrowUp":
655
+ case "ArrowLeft":
656
+ this.updateFocussedYear(-1);
657
+ break;
658
+ case "ArrowDown":
659
+ case "ArrowRight":
660
+ this.updateFocussedYear(1);
661
+ break;
662
+ case "Home":
663
+ if (this.focussedYear > this.decadeStart) {
664
+ this.updateFocussedYear(this.decadeStart - this.focussedYear);
665
+ }
666
+ break;
667
+ case "End":
668
+ if (this.focussedYear < this.decadeEnd) {
669
+ this.updateFocussedYear(this.decadeEnd - this.focussedYear);
670
+ }
671
+ break;
672
+ case "PageUp":
673
+ this.updateFocussedYear(-10);
674
+ break;
675
+ case "PageDown":
676
+ this.updateFocussedYear(10);
677
+ break;
678
+ case "Tab":
679
+ handled = this.calendarTabHandler(ev);
680
+ break;
681
+ case "Escape":
682
+ ev.stopImmediatePropagation();
683
+ this.yearPickerVisible = false;
684
+ setTimeout(() => this.focusFocussedDay(), FOCUS_TIMER);
685
+ break;
686
+ default:
687
+ handled = false;
688
+ }
689
+ if (handled) {
690
+ ev.preventDefault();
691
+ }
692
+ };
693
+ this.monthButtonKeyDownHandler = (ev) => {
694
+ let handled = false;
695
+ switch (ev.key) {
696
+ case "ArrowLeft":
697
+ case "ArrowUp":
698
+ handled = true;
699
+ this.goToPreviousMonth();
700
+ break;
701
+ case "ArrowRight":
702
+ case "ArrowDown":
703
+ handled = true;
704
+ this.goToNextMonth();
705
+ break;
706
+ case "Home":
707
+ handled = true;
708
+ this.focusDay = false;
709
+ this.moveMonths(-this.monthInView);
710
+ break;
711
+ case "End":
712
+ handled = true;
713
+ this.focusDay = false;
714
+ this.moveMonths(11 - this.monthInView);
715
+ break;
716
+ case "Tab":
717
+ if (ev.shiftKey) {
718
+ handled = true;
719
+ this.focusLastElement();
720
+ }
721
+ break;
722
+ case "Escape":
723
+ if (this.monthPickerVisible) {
724
+ this.monthPickerVisible = false;
725
+ ev.stopImmediatePropagation();
726
+ }
727
+ break;
728
+ }
729
+ if (handled) {
730
+ ev.preventDefault();
731
+ }
732
+ };
733
+ this.yearButtonKeyDownHandler = (ev) => {
734
+ let handled = false;
735
+ switch (ev.key) {
736
+ case "ArrowLeft":
737
+ case "ArrowUp":
738
+ handled = true;
739
+ this.goToPreviousYear();
740
+ break;
741
+ case "ArrowRight":
742
+ case "ArrowDown":
743
+ handled = true;
744
+ this.goToNextYear();
745
+ break;
746
+ case "Home":
747
+ if (this.yearPickerVisible && this.yearInView > this.decadeStart) {
748
+ handled = true;
749
+ this.moveYears(this.decadeStart - this.yearInView);
750
+ }
751
+ break;
752
+ case "End":
753
+ if (this.yearPickerVisible && this.yearInView < this.decadeEnd) {
754
+ handled = true;
755
+ this.moveYears(this.decadeEnd - this.focussedYear);
756
+ }
757
+ break;
758
+ case "PageUp":
759
+ handled = true;
760
+ this.focusDay = false;
761
+ this.moveYears(-10);
762
+ break;
763
+ case "PageDown":
764
+ handled = true;
765
+ this.focusDay = false;
766
+ this.moveYears(10);
767
+ break;
768
+ case "Escape":
769
+ if (this.yearPickerVisible) {
770
+ this.yearPickerVisible = false;
771
+ ev.stopImmediatePropagation();
772
+ }
773
+ break;
774
+ }
775
+ if (handled) {
776
+ ev.preventDefault();
777
+ }
778
+ };
779
+ this.todayButtonKeyDownHandler = (ev) => {
780
+ var _a;
781
+ if (ev.key === "Tab" &&
782
+ !ev.shiftKey &&
783
+ ((_a = this.clearButtonEl) === null || _a === void 0 ? void 0 : _a.disabled) &&
784
+ this.parentIsDatePicker) {
785
+ this.focusFirstElement();
786
+ ev.preventDefault();
787
+ }
788
+ };
789
+ this.clearButtonKeyDownHandler = (ev) => {
790
+ if (ev.key === "Tab" && !ev.shiftKey && this.parentIsDatePicker) {
791
+ this.focusFirstElement();
792
+ ev.preventDefault();
793
+ }
794
+ };
795
+ this.calendarTabHandler = (ev) => {
796
+ var _a, _b;
797
+ let handled = false;
798
+ if (!ev.shiftKey &&
799
+ (!this.showTodayButton || this.isCurrentMonth()) &&
800
+ (!this.showClearButton || ((_a = this.clearButtonEl) === null || _a === void 0 ? void 0 : _a.disabled)) &&
801
+ this.parentIsDatePicker) {
802
+ this.focusFirstElement();
803
+ handled = true;
804
+ }
805
+ else if (ev.shiftKey) {
806
+ (_b = this.yearButtonEl) === null || _b === void 0 ? void 0 : _b.setFocus();
807
+ handled = true;
808
+ }
809
+ return handled;
810
+ };
811
+ /* Utility functions */
812
+ this.setMonthSelectedLiveRegionText = () => {
813
+ this.setAriaLiveRegionText(`${this.monthNames[this.monthInView]} selected. ${this.getMonthInViewText()}`);
814
+ };
815
+ this.setYearSelectedLiveRegionText = () => {
816
+ this.setAriaLiveRegionText(`${this.yearInView} selected. ${this.getMonthInViewText()}`);
817
+ };
818
+ this.setDecadeView = (start) => {
819
+ let currYear = start - 1;
820
+ const decadeArr = [];
821
+ while (currYear <= start + 10) {
822
+ decadeArr.push(currYear);
823
+ currYear++;
824
+ }
825
+ this.decadeView = decadeArr;
826
+ this.decadeStart = decadeArr[1];
827
+ this.decadeEnd = decadeArr[10];
828
+ };
829
+ this.getMonthInViewText = () => {
830
+ return `${this.monthNames[this.monthInView]} ${this.yearInView} currently in view.`;
831
+ };
832
+ this.getDecadeInViewText = () => {
833
+ return `${this.decadeStart} to ${this.decadeEnd} currently in view.`;
834
+ };
835
+ this.isPrevYearAllowed = () => {
836
+ return this.isYearAllowed(this.yearInView - 1);
837
+ };
838
+ this.isNextYearAllowed = () => {
839
+ return this.isYearAllowed(this.yearInView + 1);
840
+ };
841
+ this.isYearAllowed = (yr) => dateHelpers.yearInRange(yr, this.minDate, this.maxDate);
842
+ this.getMonthView = (date) => {
843
+ const start = dateHelpers.getWeekStart(dateHelpers.getMonthStart(date), this.startOfWeek);
844
+ const end = dateHelpers.addSixWeeks(start);
845
+ const days = [];
846
+ let current = start;
847
+ while (!dateHelpers.dateMatches(current, end)) {
848
+ days.push(current);
849
+ current = new Date(current);
850
+ current.setDate(current.getDate() + 1);
851
+ }
852
+ days.push(current);
853
+ return days;
854
+ };
855
+ this.isCurrentMonth = () => {
856
+ const d = new Date();
857
+ return (d.getFullYear() === this.yearInView && d.getMonth() === this.monthInView);
858
+ };
859
+ this.updateMonthInView = () => {
860
+ if (this.focussedDate) {
861
+ this.currMonthView = this.getMonthView(this.focussedDate);
862
+ this.focussedDay = this.focussedDate.getDate();
863
+ this.monthInView = this.focussedDate.getMonth();
864
+ this.yearInView = this.focussedDate.getFullYear();
865
+ if (this.dayPickerKeyboardNav) {
866
+ this.monthInViewUpdateHandled = true;
867
+ this.setAriaLiveRegionText(this.getMonthInViewText());
868
+ this.dayPickerKeyboardNav = false;
869
+ }
870
+ }
871
+ };
872
+ /* Mouse handlers */
873
+ this.navButtonMouseDownHandler = (ev) => {
874
+ ev.preventDefault();
875
+ };
876
+ this.handleCalendarMouseDown = (event) => {
877
+ const target = event.target;
878
+ if (target.tagName !== "IC-BUTTON") {
879
+ event.preventDefault();
880
+ }
881
+ };
882
+ this.handleSelectDay = (day) => {
883
+ this.setSelectedDate(day);
884
+ this.setFocussedDate(day);
885
+ this.icCalendarDaySelect.emit();
886
+ };
887
+ this.handleSelectMonth = (month) => {
888
+ this.moveMonths(month - this.monthInView);
889
+ setTimeout(() => {
890
+ var _a;
891
+ (_a = this.monthButtonEl) === null || _a === void 0 ? void 0 : _a.setFocus();
892
+ this.monthPickerVisible = false;
893
+ this.setMonthSelectedLiveRegionText();
894
+ this.icCalendarMonthSelect.emit();
895
+ }, FOCUS_TIMER);
896
+ };
897
+ this.handleSelectYear = (year) => {
898
+ const yrPos = this.decadeView.indexOf(year);
899
+ if (yrPos > 0 && yrPos < this.decadeView.length - 1) {
900
+ this.moveYears(year - this.yearInView);
901
+ this.focusDay = false;
902
+ const monthName = this.monthNames[this.monthInView];
903
+ this.setAriaLiveRegionText(`${year} selected. ${monthName} ${year} currently in view.`);
904
+ setTimeout(() => {
905
+ var _a;
906
+ (_a = this.yearButtonEl) === null || _a === void 0 ? void 0 : _a.setFocus();
907
+ this.yearPickerVisible = false;
908
+ this.icCalendarYearSelect.emit();
909
+ }, FOCUS_TIMER);
910
+ }
911
+ else {
912
+ const moveYears = year - this.focussedYear > 0 ? 10 : -10;
913
+ this.updateFocussedYear(moveYears, this.yearButtonFocussed);
914
+ this.setAriaLiveRegionText(this.getDecadeInViewText());
915
+ }
916
+ };
917
+ this.onDayButtonFocusHandler = () => {
918
+ this.dayButtonFocussed = true;
919
+ };
920
+ this.onDayButtonBlurHandler = () => {
921
+ this.dayButtonFocussed = false;
922
+ };
923
+ this.onYearButtonFocusHandler = () => {
924
+ this.yearButtonFocussed = true;
925
+ };
926
+ this.onYearButtonBlurHandler = () => {
927
+ this.yearButtonFocussed = false;
928
+ };
929
+ /* Render helpers */
930
+ this.renderMonthYearNavButton = (id, flip, disabled) => {
931
+ const buttonSize = this.size;
932
+ return (index.h("ic-button", { id: id, disableTooltip: true, disabled: disabled, onClick: this.monthYearNavClickHandler, class: { flip: flip }, variant: "icon-tertiary", innerHTML: chevron, size: buttonSize, tabIndex: -1, "aria-label": `Go to ${id.slice(0, -7).replace("-", " ")}`, onMouseDown: this.navButtonMouseDownHandler }));
933
+ };
934
+ this.previousMonthButton = () => {
935
+ let disabled = false;
936
+ if (this.disabled) {
937
+ disabled = true;
938
+ }
939
+ else {
940
+ if (this.focussedDate !== null && this.minDate !== null) {
941
+ const yearMatch = this.focussedDate.getFullYear() === this.minDate.getFullYear();
942
+ if (yearMatch) {
943
+ disabled = this.monthInView - 1 < this.minDate.getMonth();
944
+ }
945
+ }
946
+ }
947
+ return this.renderMonthYearNavButton("previous-month-button", true, disabled);
948
+ };
949
+ this.nextMonthButton = () => {
950
+ let disabled = false;
951
+ if (this.disabled) {
952
+ disabled = true;
953
+ }
954
+ else {
955
+ if (this.focussedDate !== null && this.maxDate !== null) {
956
+ const yearMatch = this.focussedDate.getFullYear() === this.maxDate.getFullYear();
957
+ if (yearMatch) {
958
+ disabled = this.monthInView + 1 > this.maxDate.getMonth();
959
+ }
960
+ }
961
+ }
962
+ return this.renderMonthYearNavButton("next-month-button", false, disabled);
963
+ };
964
+ this.previousYearButton = () => {
965
+ return this.renderMonthYearNavButton("previous-year-button", true, this.disabled || !this.isPrevYearAllowed());
966
+ };
967
+ this.nextYearButton = () => {
968
+ return this.renderMonthYearNavButton("next-year-button", false, this.disabled || !this.isNextYearAllowed());
969
+ };
970
+ }
971
+ watchDisabledHandler() {
972
+ helpers.removeDisabledFalse(this.disabled, this.el);
973
+ if (this.disabled) {
974
+ this.setSelectedDate(null);
975
+ }
976
+ else {
977
+ this.setOpenAtDate();
978
+ }
979
+ }
980
+ watchDisableFutureHandler() {
981
+ this.watchMaxHandler();
982
+ }
983
+ watchDisablePastHandler() {
984
+ this.watchMinHandler();
985
+ }
986
+ watchMaxHandler() {
987
+ if (this.disableFuture) {
988
+ this.maxDate = new Date();
989
+ }
990
+ else {
991
+ this.maxDate = dateHelpers.createDate(this.max, this.dateFormat);
992
+ }
993
+ }
994
+ watchMinHandler() {
995
+ if (this.disablePast) {
996
+ this.minDate = new Date();
997
+ }
998
+ else {
999
+ this.minDate = dateHelpers.createDate(this.min, this.dateFormat);
1000
+ }
1001
+ }
1002
+ watchStartOfWeekHandler() {
1003
+ this.orderedDaysOfWeek = this.daysOfWeek
1004
+ .slice(this.startOfWeek)
1005
+ .concat(this.daysOfWeek.slice(0, this.startOfWeek));
1006
+ this.updateMonthInView();
1007
+ }
1008
+ valueChanged(newValue, oldValue, propName) {
1009
+ if (newValue !== oldValue && this.isValidDateValue(newValue)) {
1010
+ if (propName === "value") {
1011
+ this.value = newValue;
1012
+ }
1013
+ this.setOpenAtDate();
1014
+ }
1015
+ }
1016
+ watchFocussedDateHandler(current, previous) {
1017
+ if (previous === null ||
1018
+ !(previous.getFullYear() === current.getFullYear() &&
1019
+ previous.getMonth() === current.getMonth())) {
1020
+ this.updateMonthInView();
1021
+ }
1022
+ }
1023
+ watchMonthInViewHandler() {
1024
+ this.focussedMonth = this.monthInView;
1025
+ }
1026
+ watchYearInViewHandler() {
1027
+ this.setFocussedYear(this.yearInView, false);
1028
+ }
1029
+ watchYearPickerVisibleHandler() {
1030
+ if (!this.yearPickerVisible) {
1031
+ this.setFocussedYear(this.yearInView);
1032
+ }
1033
+ }
1034
+ watchMonthPickerVisibleHandler() {
1035
+ if (!this.monthPickerVisible) {
1036
+ this.focussedMonth = this.monthInView;
1037
+ }
1038
+ }
1039
+ watchFocussedDayEl() {
1040
+ if (this.focusDay) {
1041
+ setTimeout(() => this.focusFocussedDay(), FOCUS_TIMER);
1042
+ }
1043
+ this.focusDay = true;
1044
+ }
1045
+ componentWillLoad() {
1046
+ var _a;
1047
+ const root = this.el.getRootNode();
1048
+ this.parentIsDatePicker =
1049
+ root instanceof ShadowRoot && ((_a = root.host) === null || _a === void 0 ? void 0 : _a.tagName) === "IC-DATE-PICKER";
1050
+ this.monthNames = helpers.stringEnumToArray(helpers.IcDateInputMonths);
1051
+ this.daysOfWeek = helpers.stringEnumToArray(helpers.IcShortDayNames);
1052
+ this.watchStartOfWeekHandler();
1053
+ this.watchMaxHandler();
1054
+ this.watchMinHandler();
1055
+ this.setOpenAtDate();
1056
+ helpers.removeDisabledFalse(this.disabled, this.el);
1057
+ }
1058
+ /**
1059
+ * @internal Clears the dialog description used to provide more context for screen readers.
1060
+ */
1061
+ async clearDialogDescription() {
1062
+ this.dialogDescription = "";
1063
+ }
1064
+ render() {
1065
+ const { dialogDescription, monthNames, focussedMonth, focussedYear, monthInView, yearInView, monthPickerVisible, yearPickerVisible, decadeView, minDate, maxDate, orderedDaysOfWeek, parentIsDatePicker, showClearButton, showTodayButton, size, theme, } = this;
1066
+ let monthButtonText = "";
1067
+ if (monthPickerVisible) {
1068
+ monthButtonText = `Use the arrow keys to change the selected month. To return to day picker view, press Enter or Space to select a month, or press Escape.`;
1069
+ }
1070
+ else {
1071
+ monthButtonText = `Press Enter or Space to open month picker view or use the arrow keys to change month.`;
1072
+ }
1073
+ let yearButtonText = "";
1074
+ if (yearPickerVisible) {
1075
+ yearButtonText = `Use the arrow keys to change the selected year. To return to day picker view, press Enter or Space to select a year, or press Escape.`;
1076
+ }
1077
+ else {
1078
+ yearButtonText = `Press Enter or Space to open year picker view or use the arrow keys to change the selected year.`;
1079
+ }
1080
+ const dialogLabel = "choose date";
1081
+ const monthLabel = monthNames && monthNames[monthInView]
1082
+ ? monthNames[monthInView]
1083
+ : "Open month picker";
1084
+ const yearLabel = this.yearInView ? this.yearInView : "Open year picker";
1085
+ let minDay = minDate;
1086
+ if (minDate && this.disablePast) {
1087
+ const yesterday = new Date(minDate);
1088
+ yesterday.setDate(minDate.getDate() - 1);
1089
+ minDay = yesterday;
1090
+ }
1091
+ const weeks = [];
1092
+ for (let i = 0; i < this.currMonthView.length; i += 7) {
1093
+ weeks.push(this.currMonthView.slice(i, i + 7));
1094
+ }
1095
+ return (index.h(index.Host, { key: '5811c7e3bf515643f11c4ecd66e166ab672a15ab', class: {
1096
+ [`ic-calendar-${size}`]: true,
1097
+ [`ic-theme-${theme}`]: theme !== "inherit",
1098
+ } }, index.h("div", { key: '56f6fbfa98519f60e040d524f19d52bb2449e96d' }, index.h("span", { key: 'a52cc22ba545f12ccde1541b84bddbedc1a88734', id: "dialog-description", class: "sr-only" }, dialogDescription), index.h("div", Object.assign({ key: 'a4f6a18f109f7c55c5ba9a369dbc47352d215517' }, (parentIsDatePicker && {
1099
+ role: "dialog",
1100
+ "aria-modal": "true",
1101
+ }), { "aria-label": dialogLabel, "aria-describedBy": "dialog-description", class: {
1102
+ "calendar-container": true,
1103
+ }, onMouseDown: this.handleCalendarMouseDown, onClick: this.handleCalendarClick }), index.h("span", { key: '63a3c2c916c905efce47669886edff51422fd755', ref: (el) => (this.liveRegionEl = el), id: "live-region", "aria-live": "assertive", class: "sr-only" }), index.h("div", { key: 'd553857fb83f497d666355b283391530a94c09a9', class: {
1104
+ "month-year-nav-container": true,
1105
+ } }, index.h("div", { key: 'aff93454cc4f27db3e8464ac4289471c353f0086', class: "month-year-nav" }, this.previousMonthButton(), index.h("span", { key: 'a4771ae4d86e75fbf80134a4a53190a9d9402297', id: "select-month-hint", "aria-hidden": "true" }, monthButtonText), index.h("ic-button", { key: '325ed5a8bb306b318c2fa471de7ac82ac0e98e2e', ref: (el) => (this.monthButtonEl = el), size: size, class: "month-picker-button", disabled: this.disabled, "aria-haspopup": "menu", "aria-expanded": monthPickerVisible ? "true" : "false", "full-width": "true", variant: "tertiary", "aria-label": monthLabel, "aria-describedby": "select-month-hint", onKeyDown: this.monthButtonKeyDownHandler, onClick: this.monthButtonClickHandler }, monthNames[monthInView]), this.nextMonthButton()), index.h("div", { key: '91adac1ecbcccbab1b1c76c741ea64b2d7efe818', class: "month-year-nav" }, this.previousYearButton(), index.h("span", { key: '2ccac8cb808bfd951f36e5f371c128ff9e1bf84e', id: "select-year-hint", "aria-hidden": "true" }, yearButtonText), index.h("ic-button", { key: '289835494a1015ec0ea67e8885c627ad1436b404', ref: (el) => (this.yearButtonEl = el), size: size, class: "year-picker-button", disabled: this.disabled, "aria-haspopup": "menu", "aria-expanded": yearPickerVisible ? "true" : "false", "full-width": "true", variant: "tertiary", "aria-label": yearLabel, "aria-describedby": "select-year-hint", onKeyDown: this.yearButtonKeyDownHandler, onClick: this.yearButtonClickHandler }, this.yearInView), this.nextYearButton())), !(monthPickerVisible || yearPickerVisible) && (index.h("table", { key: 'd1bff2567dee5787f0ccd9ba2c0c40aa2c5e671a', role: "grid", class: {
1106
+ calendar: true,
1107
+ hidden: monthPickerVisible || yearPickerVisible,
1108
+ }, onKeyDown: this.handleCalendarKeyDown }, index.h("thead", { key: '9dccafd91918a15ec52fd641991e0803ccb65468', class: "weekdays-container" }, index.h("tr", { key: '2ecccfb88a4220bec5ed80b4819651f57a819909', class: "weekdays" }, orderedDaysOfWeek.map((dayName) => {
1109
+ const header = size === "small" ? dayName.charAt(0) : dayName;
1110
+ return (index.h("th", { scope: "col", class: "calendar-day-header" }, header));
1111
+ }))), index.h("tbody", { key: '9c676dff19754d06310e626c8aba69e05ca8a71e', class: "calendar-days-container" }, weeks.map((week, weekIdx) => (index.h("tr", { key: weekIdx }, week.map((day) => {
1112
+ var _a;
1113
+ return (index.h("td", { key: day.toISOString() }, index.h(DayButton, { day: day, disableDay: this.disabled ||
1114
+ ((_a = this.disableDays) === null || _a === void 0 ? void 0 : _a.includes(Number(day.getDay()))), today: dateHelpers.dateMatches(day, this.today), selected: dateHelpers.dateMatches(day, this.selectedDate), focussed: dateHelpers.dateMatches(day, this.focussedDate), inRange: dateHelpers.dateInRange(day, minDay, maxDate), monthInView: monthInView, onSelectDay: this.handleSelectDay, focussedDayRef: this.setFocussedDayEl, onFocusDay: this.onDayButtonFocusHandler, onBlurDay: this.onDayButtonBlurHandler, showDaysOutsideMonth: this.showDaysOutsideMonth })));
1115
+ }))))))), index.h("div", { key: '5137281599f0ad0c3d1658448b740d1192073ad2', class: {
1116
+ "month-picker-container": true,
1117
+ hidden: !monthPickerVisible,
1118
+ } }, monthPickerVisible && (index.h(MonthPicker, { key: '460809cfbfb7db2aacd28470220863769c884651', size: size, onSelectMonth: this.handleSelectMonth, monthInView: monthInView, focussedMonth: focussedMonth, onKeyDown: this.monthPickerKeyDownHandler, focussedMonthRef: this.setFocussedMonthEl, minDate: minDate, maxDate: maxDate, yearInView: yearInView }))), index.h("div", { key: 'af3eb48f6bbeaf1a1ccdbb7a5f941241d10e6c4f', class: {
1119
+ "year-picker-container": true,
1120
+ hidden: !yearPickerVisible,
1121
+ } }, yearPickerVisible && (index.h(YearPicker, { key: '4de6dd0c0563a6519b39f0fdf58a329a7bba450c', decadeView: decadeView, size: size, focussedYear: focussedYear, onSelectYear: this.handleSelectYear, onKeyDown: this.yearPickerKeyDownHandler, onFocusYear: this.onYearButtonFocusHandler, onBlurYear: this.onYearButtonBlurHandler, yearInView: yearInView, minDate: minDate, maxDate: maxDate, focussedYearRef: this.setFocussedYearEl }))), index.h("div", { key: '18495cc7c4150208bb64a0a222a7e233ea3a93d7', class: {
1122
+ "bottom-buttons": true,
1123
+ "no-today": !showTodayButton,
1124
+ } }, showTodayButton && (index.h("ic-button", { key: 'd8623ea2ecc501dc77ad3fd47cd9f41b8e104c86', id: "today-button", variant: "tertiary", ref: (el) => (this.todayButtonEl = el), size: size, "aria-label": "Navigate to current date", onClick: this.todayButtonClickHandler, onKeyDown: this.todayButtonKeyDownHandler, disabled: this.isCurrentMonth() }, "Go to today")), showClearButton && (index.h("ic-button", { key: '40df11d2d3b36a505bab8c60acbbfb1eed03eddb', id: "clear-button", "aria-label": "clear selected date", ref: (el) => (this.clearButtonEl = el), variant: "tertiary", size: size, onClick: this.clearButtonClickHandler, onKeyDown: this.clearButtonKeyDownHandler, disabled: this.value === "" ||
1125
+ this.value === null ||
1126
+ this.value === undefined }, "Clear")))))));
1127
+ }
1128
+ static get delegatesFocus() { return true; }
1129
+ get el() { return index.getElement(this); }
1130
+ static get watchers() { return {
1131
+ "disabled": ["watchDisabledHandler"],
1132
+ "disableFuture": ["watchDisableFutureHandler"],
1133
+ "disablePast": ["watchDisablePastHandler"],
1134
+ "max": ["watchMaxHandler"],
1135
+ "min": ["watchMinHandler"],
1136
+ "startOfWeek": ["watchStartOfWeekHandler"],
1137
+ "value": ["valueChanged"],
1138
+ "openAtDate": ["valueChanged"],
1139
+ "focussedDate": ["watchFocussedDateHandler"],
1140
+ "monthInView": ["watchMonthInViewHandler"],
1141
+ "yearInView": ["watchYearInViewHandler"],
1142
+ "yearPickerVisible": ["watchYearPickerVisibleHandler"],
1143
+ "monthPickerVisible": ["watchMonthPickerVisibleHandler"],
1144
+ "focussedDayEl": ["watchFocussedDayEl"]
1145
+ }; }
1146
+ };
1147
+ Calendar$1.style = IcCalendarStyle0;
1148
+
1149
+ const Calendar = `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
1150
+ <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"/>
1151
+ </svg>`;
1152
+
1153
+ 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}:host{--ic-input-label-helpertext-padding:var(--ic-space-xs);--input-bg-color:var(--ic-date-input-bg);--ic-input-label-text-color:var(--ic-date-input-label);--ic-input-label-helper-text-color:var(--ic-date-input-subtitle);--border-color:var(--ic-date-input-border);--border-color-disabled:var(--ic-date-input-border-disabled);--border-color-hover:var(--ic-date-input-border-default-hover);--border-color-pressed:var(--ic-date-input-border-default-pressed);--border-error-color:var(--ic-date-input-border-error);--border-error-color-hover:var(--ic-date-input-border-error-hover);--border-error-color-pressed:var(--ic-date-input-border-error-pressed);--border-success-color:var(--ic-date-input-border-success);--border-success-color-hover:var(--ic-date-input-border-success-hover);--border-success-color-pressed:var(--ic-date-input-border-success-pressed);--border-warning-color:var(--ic-date-input-border-warning);--border-warning-color-hover:var(--ic-date-input-border-warning-hover);--border-warning-color-pressed:var(--ic-date-input-border-warning-pressed)}:host(.ic-date-input-disabled){--ic-input-label-text-color:var(--ic-date-input-label-disabled);--ic-input-label-helper-text-color:var(--ic-date-input-subtitle-disabled)}input{border:0;height:100%;padding:0;outline:none;background:none;-moz-appearance:textfield;-webkit-appearance:textfield;appearance:textfield;color:var(--ic-date-input-text-filled);caret-color:var(--ic-date-input-typing-cursor)}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{-webkit-appearance:none}input:-webkit-autofill{box-shadow:0 0 0 var(--ic-space-sm) var(--ic-color-background-primary) inset;-webkit-text-fill-color:var(--ic-date-input-text-filled) !important}input::-moz-placeholder{color:var(--ic-date-input-text-placeholder)}input::placeholder{color:var(--ic-date-input-text-placeholder)}ic-input-component-container{cursor:text}ic-input-component-container .focus-indicator{padding:var(--ic-space-xxxs) var(--ic-space-xs);align-items:center}.date-inputs{color:var(--ic-date-input-text-placeholder)}.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-color-focus-inner) !important;box-shadow:inset 0 0 0 0.125rem var(--ic-color-focus-outer) !important;border-radius:0.25rem}.calendar-button:focus,.calendar-button:active{--ic-button-tertiary-text-active:var(--ic-atoms-input-clear-button-focus);--ic-button-tertiary-text-hover-active:var(\n --ic-atoms-input-clear-button-focus\n );--ic-button-tertiary-text-pressed-active:var(\n --ic-atoms-input-clear-button-focus\n )}.clear-button:focus,.calendar-button:focus,.clear-button:active *,.calendar-button:active *{fill:var(--ic-atoms-input-clear-button-focus)}.clear-button svg{color:var(--ic-date-input-clear-icon)}.clear-button:focus svg{color:var(--ic-atoms-input-clear-button-focus)}.divider{margin:0 var(--ic-space-xxs);width:var(--ic-space-1px);background-color:var(--ic-atoms-input-divider);border-radius:var(--ic-space-1px)}.divider.small{height:var(--ic-space-md)}.divider.medium{height:calc(var(--ic-space-sm) + var(--ic-space-xs))}.divider.large{height:var(--ic-space-lg)}ic-input-validation{--ic-input-validation-status-text-color:var(--ic-date-input-status-text);--ic-input-validation-error:var(--ic-date-input-icon-error);--ic-input-validation-warning-icon-color:var(--ic-date-input-icon-warning);--ic-input-validation-success-icon-color:var(--ic-date-input-icon-success)}@media (forced-colors: active){.clear-button svg{color:currentcolor}}";
1154
+ const IcDateInputStyle0 = icDateInputCss;
1155
+
1156
+ let inputIds = 0;
1157
+ const DateInput = class {
1158
+ constructor(hostRef) {
1159
+ index.registerInstance(this, hostRef);
1160
+ this.calendarButtonClicked = index.createEvent(this, "calendarButtonClicked", 7);
1161
+ this.icBlur = index.createEvent(this, "icBlur", 7);
1162
+ this.icChange = index.createEvent(this, "icChange", 7);
1163
+ this.icFocus = index.createEvent(this, "icFocus", 7);
1164
+ this.DEFAULT_DATE_FORMAT = "DD/MM/YYYY";
1165
+ this.ARIA_INVALID = "aria-invalid";
1166
+ this.ARIA_LABEL = "aria-label";
1167
+ this.ARIA_LABELLED_BY = "aria-labelledby";
1168
+ this.EVENT_OBJECT_STRING = "[object Event]";
1169
+ this.FIT_TO_VALUE = "fit-to-value";
1170
+ this.initialValue = this.value;
1171
+ this.INPUT_EVENT_OBJECT_STRING = "[object InputEvent]";
1172
+ this.inputsInOrder = [];
1173
+ this.isAfterMax = false;
1174
+ this.isBeforeMin = false;
1175
+ this.preventInputsUpdating = false;
1176
+ this.isDisabledDate = false;
1177
+ this.isValidDay = true;
1178
+ this.isValidMonth = true;
1179
+ this.isValidDate = true;
1180
+ this.isZuluTime = false;
1181
+ this.KEYBOARD_EVENT_OBJECT_STRING = "[object KeyboardEvent]";
1182
+ this.MAX_DAY = 31;
1183
+ this.MAX_MONTH = 12;
1184
+ this.previousSelectedDate = null;
1185
+ this.selectedDate = null;
1186
+ this.externalSetDate = false;
1187
+ this.clearInput = false;
1188
+ this.calendarIsOpen = false;
1189
+ this.calendarFocused = false;
1190
+ this.clearButtonFocused = false;
1191
+ this.removeLabelledBy = false;
1192
+ this.day = "";
1193
+ this.month = "";
1194
+ this.year = "";
1195
+ /**
1196
+ * The format in which the date will be displayed.
1197
+ */
1198
+ this.dateFormat = this.DEFAULT_DATE_FORMAT;
1199
+ /**
1200
+ * If `true`, every individual input field completed will emit an icChange event.
1201
+ */
1202
+ this.emitDatePartChange = false;
1203
+ /**
1204
+ * If `true`, the disabled state will be set.
1205
+ */
1206
+ this.disabled = false;
1207
+ /**
1208
+ * The days of the week to disable.
1209
+ */
1210
+ this.disableDays = [];
1211
+ /**
1212
+ * The text to display as the validation message when `disableDays` is set and a disabled date is entered.
1213
+ */
1214
+ this.disableDaysMessage = "The date you have selected is on a day of the week that is not allowed. Please select another date.";
1215
+ /**
1216
+ * If `true`, dates in the future are not allowed. A validation message will appear if a date in the future is entered.
1217
+ */
1218
+ this.disableFuture = false;
1219
+ /**
1220
+ * The text to display as the validation message when `disableFuture` is true and a date in the future is entered.
1221
+ */
1222
+ this.disableFutureMessage = "Dates in the future are not allowed. Please select a date in the past.";
1223
+ /**
1224
+ * If `true`, dates in the past are not allowed. A validation message will appear if a date in the past is entered.
1225
+ */
1226
+ this.disablePast = false;
1227
+ /**
1228
+ * The text to display as the validation message when `disablePast` is true and a date in the past is entered.
1229
+ */
1230
+ this.disablePastMessage = "Dates in the past are not allowed. Please select a date in the future.";
1231
+ /**
1232
+ * If `true`, the helper text will be visually hidden, but still read out by screenreaders.
1233
+ */
1234
+ this.hideHelperText = false;
1235
+ /**
1236
+ * If `true`, the label will be visually hidden, but will still be read out by screen readers.
1237
+ */
1238
+ this.hideLabel = false;
1239
+ /**
1240
+ * The ID for the input.
1241
+ */
1242
+ this.inputId = `ic-date-input-${inputIds++}`;
1243
+ /**
1244
+ * The text to display as the validation message when an invalid date is entered.
1245
+ */
1246
+ this.invalidDateMessage = "Please enter a valid date.";
1247
+ /**
1248
+ * The latest date that will be allowed. The value can be in any format supported as `dateFormat`, in ISO 8601 date string format (`yyyy-mm-dd`) or as a JavaScript `Date` object.
1249
+ * The value of this prop is ignored if `disableFuture` is set to `true`.
1250
+ */
1251
+ this.max = "";
1252
+ /**
1253
+ * The earliest date that will be allowed. The value can be in any format supported as `dateFormat`, in ISO 8601 date string format (`yyyy-mm-dd`) or as a JavaScript `Date` object.
1254
+ * The value of this prop is ignored if `disablePast` is set to `true`.
1255
+ */
1256
+ this.min = "";
1257
+ /**
1258
+ * The name of the control, which is submitted with the form data.
1259
+ */
1260
+ this.name = this.inputId;
1261
+ /**
1262
+ * If `true`, the input will require a value.
1263
+ */
1264
+ this.required = false;
1265
+ /**
1266
+ * @internal If `true`, a button which displays the calendar view when clicked will be displayed.
1267
+ */
1268
+ this.showCalendarButton = false;
1269
+ /**
1270
+ * If `true`, a button which clears the date input when clicked will be displayed.
1271
+ */
1272
+ this.showClearButton = true;
1273
+ /**
1274
+ * The size of the date input to be displayed.
1275
+ */
1276
+ this.size = "medium";
1277
+ /**
1278
+ * Sets the date picker to the dark or light theme colors. "inherit" will set the color based on the system settings or ic-theme component.
1279
+ */
1280
+ this.theme = "inherit";
1281
+ /**
1282
+ * The value of the date input. The value can be in any format supported as `dateFormat`, in ISO 8601 date string format (`yyyy-mm-dd`) or as a JavaScript `Date` object.
1283
+ */
1284
+ this.value = "";
1285
+ /**
1286
+ * The value of the `aria-live` attribute on the validation message.
1287
+ */
1288
+ this.validationAriaLive = "polite";
1289
+ /**
1290
+ * The validation status - e.g. 'error' | 'warning' | 'success'. This will override the built-in date validation.
1291
+ */
1292
+ this.validationStatus = "";
1293
+ /**
1294
+ * The text to display as the validation message. This will override the built-in date validation.
1295
+ */
1296
+ this.validationText = "";
1297
+ this.setInputPasteValue = (input, pastedValue) => {
1298
+ if (input) {
1299
+ const inputEl = input;
1300
+ inputEl.value = pastedValue;
1301
+ inputEl.classList.add(this.FIT_TO_VALUE);
1302
+ }
1303
+ };
1304
+ this.checkSingleCopiedValueIsValid = (input, pastedValue) => {
1305
+ let isValid = false;
1306
+ const value = Number(pastedValue);
1307
+ switch (input) {
1308
+ case this.dayInputEl:
1309
+ isValid = value >= 1 && value <= this.MAX_DAY;
1310
+ break;
1311
+ case this.monthInputEl:
1312
+ isValid = value >= 1 && value <= this.MAX_MONTH;
1313
+ break;
1314
+ case this.yearInputEl:
1315
+ isValid = true;
1316
+ break;
1317
+ }
1318
+ return isValid;
1319
+ };
1320
+ /**
1321
+ * Using Object.prototype.string to determine type if event from user
1322
+ * @param event - event object used to differentiate keyboard, generic or input event
1323
+ * @returns boolean
1324
+ */
1325
+ this.isKeyboardOrEvent = (event) => {
1326
+ return (Object.prototype.toString.call(event) === this.EVENT_OBJECT_STRING ||
1327
+ Object.prototype.toString.call(event) ===
1328
+ this.KEYBOARD_EVENT_OBJECT_STRING);
1329
+ };
1330
+ this.setDateValidity = () => {
1331
+ if (!helpers.isEmptyString(this.day)) {
1332
+ this.isValidDay = +this.day > this.MAX_DAY ? false : true;
1333
+ }
1334
+ else {
1335
+ this.isValidDay = true;
1336
+ }
1337
+ if (!helpers.isEmptyString(this.month)) {
1338
+ this.isValidMonth = +this.month > this.MAX_MONTH ? false : true;
1339
+ }
1340
+ else {
1341
+ this.isValidMonth = true;
1342
+ }
1343
+ };
1344
+ this.handleInput = (event) => {
1345
+ const inputEvent = event;
1346
+ const input = event.target;
1347
+ if (input !== this.yearInputEl) {
1348
+ // Only auto-format if input event is not a character being deleted
1349
+ // and not as user is changing value using up / down keys
1350
+ if (inputEvent.inputType !== "deleteContentBackward" &&
1351
+ !this.preventAutoFormatting) {
1352
+ if (input.value.length === 1 &&
1353
+ ((input === this.dayInputEl && +input.value >= 4) ||
1354
+ (input === this.monthInputEl && +input.value >= 2)) &&
1355
+ +input.value <= 9) {
1356
+ this.setInputValue(input);
1357
+ this.notifyScreenReader(input, event);
1358
+ this.moveToNextInput(input);
1359
+ }
1360
+ if (input.value.length === 2) {
1361
+ if (+input.value === 0) {
1362
+ input.value = "01";
1363
+ }
1364
+ this.setInputValue(input);
1365
+ this.setPreventInput(input, true);
1366
+ this.notifyScreenReader(input, event);
1367
+ this.moveToNextInput(input);
1368
+ }
1369
+ else {
1370
+ this.setPreventInput(input, false);
1371
+ }
1372
+ }
1373
+ else if (this.preventAutoFormatting) {
1374
+ /**
1375
+ * Using arrow keys prevents auto formatting so need to deal with
1376
+ * switching from arrow keys to inputting numbers
1377
+ **/
1378
+ if (input.value.length === 2 && !this.isKeyboardOrEvent(event)) {
1379
+ this.setInputValue(input);
1380
+ this.setPreventInput(input, true);
1381
+ this.moveToNextInput(input);
1382
+ }
1383
+ else {
1384
+ this.setInputValue(input);
1385
+ }
1386
+ }
1387
+ if (input.value.length !== 2) {
1388
+ this.setPreventInput(input, false);
1389
+ }
1390
+ }
1391
+ else {
1392
+ if (input.value.length === 4) {
1393
+ this.setInputValue(input);
1394
+ if (Object.prototype.toString.call(event) !== this.EVENT_OBJECT_STRING) {
1395
+ this.moveToNextInput(input);
1396
+ }
1397
+ this.setPreventInput(input, true);
1398
+ }
1399
+ else {
1400
+ this.setPreventInput(input, false);
1401
+ }
1402
+ }
1403
+ // Add / remove class to make input width match size of value i.e. 2 digits' width for day / month, 4 for year
1404
+ this.setFitToValueStyling(input);
1405
+ if (input.value.length === 0) {
1406
+ this.setInputValue(input, true);
1407
+ this.setValidationMessage();
1408
+ }
1409
+ this.notifyScreenReader(input, event);
1410
+ };
1411
+ this.handleKeyDown = (event, isInputPrevented) => {
1412
+ var _a;
1413
+ const input = event.target;
1414
+ const eventKey = (_a = event.key) === null || _a === void 0 ? void 0 : _a.toLowerCase();
1415
+ // Regex required due to FF allowing all characters as values for number text field.
1416
+ const regex = /-?\d*\.?\d+(e[-+]?\d+)?|[/-]|arrowup|arrowdown|arrowleft|arrowright|shift|tab|backspace|delete/;
1417
+ if (!regex.test(eventKey) &&
1418
+ !((event.ctrlKey || event.metaKey) &&
1419
+ (eventKey === "v" || eventKey === "c"))) {
1420
+ event.preventDefault();
1421
+ }
1422
+ switch (eventKey) {
1423
+ case "/":
1424
+ case "-":
1425
+ case ".":
1426
+ event.preventDefault();
1427
+ this.setPasteInvalidText();
1428
+ this.moveToNextInput(input);
1429
+ break;
1430
+ case "arrowright":
1431
+ case "arrowleft":
1432
+ event.preventDefault();
1433
+ this.handleLeftRightArrowKeyPress(input, eventKey);
1434
+ break;
1435
+ case "arrowup":
1436
+ case "arrowdown":
1437
+ this.preventAutoFormatting = true;
1438
+ this.handleUpDownArrowKeyPress(input, event);
1439
+ break;
1440
+ case "backspace":
1441
+ if (input.value.length === 0) {
1442
+ event.preventDefault();
1443
+ this.moveToPreviousInput(input);
1444
+ }
1445
+ break;
1446
+ }
1447
+ this.preventInput(event, isInputPrevented);
1448
+ this.preventInputsUpdating = true;
1449
+ };
1450
+ this.handleFocus = (event) => {
1451
+ // Highlight / select all characters in input for easy replacement
1452
+ const input = event.target;
1453
+ input.select();
1454
+ };
1455
+ this.handleBlur = (event) => {
1456
+ const input = event.target;
1457
+ if (input) {
1458
+ this.setPasteInvalidText();
1459
+ this.autocompleteInput(input);
1460
+ }
1461
+ };
1462
+ this.handleLeftRightArrowKeyPress = (input, key) => {
1463
+ if (key === "arrowright") {
1464
+ this.moveToNextInput(input);
1465
+ }
1466
+ else {
1467
+ this.moveToPreviousInput(input);
1468
+ }
1469
+ this.setPasteInvalidText();
1470
+ };
1471
+ this.notifyScreenReaderSelectedDate = () => {
1472
+ if (this.selectedDate && this.selectedDateInfoEl) {
1473
+ const dayNames = helpers.stringEnumToArray(helpers.IcDayNames);
1474
+ const months = helpers.stringEnumToArray(helpers.IcDateInputMonths);
1475
+ this.selectedDateInfoEl.textContent = `Selected date: ${dayNames[this.selectedDate.getDay()]}, ${this.selectedDate.getDate()} ${months[this.selectedDate.getMonth()]} ${this.selectedDate.getFullYear()}`;
1476
+ }
1477
+ };
1478
+ this.handleUpDownArrowKeyPress = (input, event) => {
1479
+ const minValue = input === this.yearInputEl ? 0 : 1;
1480
+ let maxValue = 9999;
1481
+ switch (input) {
1482
+ case this.dayInputEl:
1483
+ maxValue = this.MAX_DAY;
1484
+ break;
1485
+ case this.monthInputEl:
1486
+ maxValue = this.MAX_MONTH;
1487
+ break;
1488
+ case this.yearInputEl:
1489
+ maxValue = 9999;
1490
+ }
1491
+ // Make value loop round when min / max reached
1492
+ if (input === null || input === void 0 ? void 0 : input.value) {
1493
+ if (event.key === "ArrowUp") {
1494
+ if (+input.value === maxValue) {
1495
+ event.preventDefault();
1496
+ input.value = `0${minValue}`;
1497
+ }
1498
+ else {
1499
+ input.value =
1500
+ +input.value + 1 < 10
1501
+ ? `0${+input.value + 1}`
1502
+ : (+input.value + 1).toString();
1503
+ }
1504
+ this.notifyScreenReader(input, event);
1505
+ }
1506
+ if (event.key === "ArrowDown") {
1507
+ if (+input.value === minValue) {
1508
+ event.preventDefault();
1509
+ input.value = maxValue.toString();
1510
+ }
1511
+ else {
1512
+ input.value =
1513
+ +input.value - 1 < 10
1514
+ ? `0${+input.value - 1}`
1515
+ : (+input.value - 1).toString();
1516
+ }
1517
+ this.notifyScreenReader(input, event);
1518
+ }
1519
+ }
1520
+ else {
1521
+ if (event.key === "ArrowDown") {
1522
+ event.preventDefault();
1523
+ input.value =
1524
+ input === this.yearInputEl
1525
+ ? new Date().getFullYear().toString()
1526
+ : maxValue.toString();
1527
+ this.notifyScreenReader(input, event);
1528
+ }
1529
+ else if (event.key === "ArrowUp") {
1530
+ event.preventDefault();
1531
+ input.value =
1532
+ input === this.yearInputEl
1533
+ ? new Date().getFullYear().toString()
1534
+ : `0${minValue}`;
1535
+ this.notifyScreenReader(input, event);
1536
+ }
1537
+ }
1538
+ this.setInputValue(input);
1539
+ this.setFitToValueStyling(input);
1540
+ };
1541
+ this.handleDateChange = (force) => {
1542
+ // Prevent icChange being emitted when each individual input is changed
1543
+ // This method is used within componentWillUpdate instead of using @Watch('value');
1544
+ if (force || !dateHelpers.dateMatches(this.selectedDate, this.previousSelectedDate)) {
1545
+ if (this.value) {
1546
+ this.inputsInOrder.forEach((input) => {
1547
+ input.classList.add(this.FIT_TO_VALUE);
1548
+ });
1549
+ }
1550
+ if (this.day && this.month && this.year && this.invalidDateText === "") {
1551
+ this.setValueAndEmitChange(this.selectedDate);
1552
+ this.notifyScreenReaderSelectedDate();
1553
+ }
1554
+ else if (!(this.selectedDate === null && this.previousSelectedDate === null) &&
1555
+ this.selectedDateInfoEl) {
1556
+ this.setValueAndEmitChange(null);
1557
+ this.selectedDateInfoEl.textContent = "";
1558
+ }
1559
+ this.previousSelectedDate = this.selectedDate;
1560
+ if (!this.preventInputsUpdating) {
1561
+ this.updateInputValues(this.day, this.month, this.year);
1562
+ }
1563
+ }
1564
+ };
1565
+ this.slicePastedDate = (valueLength, datePart) => {
1566
+ return datePart.length > valueLength
1567
+ ? datePart.slice(0, valueLength)
1568
+ : datePart;
1569
+ };
1570
+ this.isPastedStringDateValid = (value) => {
1571
+ if (/\d+-\d+-\d+$/.test(value) ||
1572
+ /\d+\/\d+\/\d+/.test(value) ||
1573
+ /\d+\.\d+\.\d+/.test(value)) {
1574
+ return true;
1575
+ }
1576
+ if (/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}(?::[0-9]{2}(?:\.\d+)?)?Z/.test(value)) {
1577
+ this.isZuluTime = true;
1578
+ return true;
1579
+ }
1580
+ return false;
1581
+ };
1582
+ // Set value of each input to value of pasted date part
1583
+ // Allows formats separated by '-' or '/'
1584
+ this.handlePaste = (event) => {
1585
+ var _a;
1586
+ event.preventDefault();
1587
+ const pastedValue = ((_a = event.clipboardData) === null || _a === void 0 ? void 0 : _a.getData("Text")) || "";
1588
+ const isValidDate = this.isPastedStringDateValid(pastedValue);
1589
+ this.setPastedValueAndValidation(isValidDate, pastedValue, event);
1590
+ };
1591
+ this.setDate = (date) => {
1592
+ if (date === null || date === "" || date === undefined) {
1593
+ if (this.day)
1594
+ this.day = "";
1595
+ if (this.month)
1596
+ this.month = "";
1597
+ if (this.year)
1598
+ this.year = "";
1599
+ this.inputsInOrder.forEach((input) => {
1600
+ input.classList.remove(this.FIT_TO_VALUE);
1601
+ this.setPreventInput(input, false);
1602
+ });
1603
+ this.handleDateChange(true);
1604
+ }
1605
+ else {
1606
+ if (dateHelpers.isDateOrEpoch(date)) {
1607
+ let newDate;
1608
+ if (typeof date === "string") {
1609
+ // Checking if epoch date time
1610
+ newDate = new Date(+date);
1611
+ }
1612
+ else {
1613
+ newDate = date;
1614
+ }
1615
+ this.day = dateHelpers.convertToDoubleDigits(newDate.getDate());
1616
+ this.month = dateHelpers.convertToDoubleDigits(newDate.getMonth() + 1);
1617
+ this.year = newDate.getFullYear().toString();
1618
+ }
1619
+ else if (typeof date === "string") {
1620
+ const defaultDateArray = dateHelpers.splitStringDate(date, this.dateFormat);
1621
+ this.selectedDate = new Date(Number(defaultDateArray[0]), Number(defaultDateArray[1]) - 1, Number(defaultDateArray[2]));
1622
+ this.year = defaultDateArray[0];
1623
+ this.month = defaultDateArray[1];
1624
+ this.day = defaultDateArray[2];
1625
+ this.setValueAndEmitChange(this.selectedDate);
1626
+ }
1627
+ }
1628
+ this.setValidationMessage();
1629
+ };
1630
+ this.formatMinMax = (date) => {
1631
+ let formattedDate;
1632
+ const day = dateHelpers.convertToDoubleDigits(date.getDate());
1633
+ const month = dateHelpers.convertToDoubleDigits(date.getMonth() + 1);
1634
+ const year = date.getFullYear();
1635
+ switch (this.dateFormat) {
1636
+ case this.DEFAULT_DATE_FORMAT:
1637
+ formattedDate = `${day}/${month}/${year}`;
1638
+ break;
1639
+ case "MM/DD/YYYY":
1640
+ formattedDate = `${month}/${day}/${year}`;
1641
+ break;
1642
+ case "YYYY/MM/DD":
1643
+ formattedDate = `${year}/${month}/${day}`;
1644
+ break;
1645
+ }
1646
+ return formattedDate;
1647
+ };
1648
+ this.updateInputValues = (day, month, year) => {
1649
+ if (this.dayInputEl && this.monthInputEl && this.yearInputEl) {
1650
+ this.dayInputEl.value = day;
1651
+ this.monthInputEl.value = month;
1652
+ this.yearInputEl.value = year;
1653
+ }
1654
+ };
1655
+ // Set value in state based on input
1656
+ this.setInputValue = (input, clear = false) => {
1657
+ const newValue = clear ? "" : input.value;
1658
+ switch (input) {
1659
+ case this.dayInputEl:
1660
+ this.day = newValue;
1661
+ break;
1662
+ case this.monthInputEl:
1663
+ this.month = newValue;
1664
+ break;
1665
+ case this.yearInputEl:
1666
+ if (this.year !== newValue) {
1667
+ this.year = newValue;
1668
+ }
1669
+ }
1670
+ this.setValidationMessage();
1671
+ };
1672
+ this.setValidationMessage = () => {
1673
+ this.setDateValidity();
1674
+ if (!helpers.isEmptyString(this.day) &&
1675
+ !helpers.isEmptyString(this.month) &&
1676
+ !helpers.isEmptyString(this.year)) {
1677
+ // Check whether date actually exists
1678
+ // (used https://www.hectane.com/blog/javascript-date-validation-with-leap-year)
1679
+ this.selectedDate = this.convertToDate(this.year, this.month, this.day);
1680
+ this.isValidDate =
1681
+ !!this.selectedDate && this.selectedDate.getDate() == +this.day;
1682
+ this.isDisabledDate = this.isSelectedDateDisabled();
1683
+ if (!this.isValidDate || this.isDisabledDate) {
1684
+ this.inputsInOrder.forEach((input) => input.setAttribute(this.ARIA_INVALID, "true"));
1685
+ }
1686
+ else {
1687
+ this.inputsInOrder.forEach((input) => input.removeAttribute(this.ARIA_INVALID));
1688
+ }
1689
+ }
1690
+ else {
1691
+ this.selectedDate = null;
1692
+ }
1693
+ if (!(this.isValidDay && this.isValidMonth && this.isValidDate)) {
1694
+ this.invalidDateText = this.invalidDateMessage;
1695
+ }
1696
+ else if (this.isDisabledDate && this.selectedDate !== null) {
1697
+ if (this.isBeforeMin) {
1698
+ if (this.disablePast) {
1699
+ this.invalidDateText = this.disablePastMessage;
1700
+ }
1701
+ else {
1702
+ this.invalidDateText = `Please enter a date after ${this.formatMinMax(this.minDate)}.`;
1703
+ }
1704
+ }
1705
+ else if (this.isAfterMax) {
1706
+ if (this.disableFuture) {
1707
+ this.invalidDateText = this.disableFutureMessage;
1708
+ }
1709
+ else {
1710
+ this.invalidDateText = `Please enter a date before ${this.formatMinMax(this.maxDate)}.`;
1711
+ }
1712
+ }
1713
+ else if (this.disableDays.length !== 0) {
1714
+ this.invalidDateText = this.disableDaysMessage;
1715
+ }
1716
+ else {
1717
+ if (this.disablePast) {
1718
+ this.invalidDateText = this.disablePastMessage;
1719
+ }
1720
+ if (this.disableFuture) {
1721
+ this.invalidDateText = this.disableFutureMessage;
1722
+ }
1723
+ }
1724
+ }
1725
+ else {
1726
+ this.invalidDateText = "";
1727
+ }
1728
+ };
1729
+ // Set refs to the input elements in the order they are displayed (based on the dateFormat)
1730
+ this.setInputsInOrder = () => {
1731
+ var _a;
1732
+ (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll("input").forEach((input) => this.inputsInOrder.push(input));
1733
+ };
1734
+ // Includes text usually added using aria-describedby
1735
+ // (which doesn't work on input component container)
1736
+ this.setAriaLabelledBy = () => {
1737
+ var _a, _b, _c;
1738
+ if (this.disabled &&
1739
+ !helpers.isEmptyString((_a = this.inputCompContainerEl) === null || _a === void 0 ? void 0 : _a.getAttribute(this.ARIA_LABELLED_BY))) {
1740
+ this.removeAriaLabelledBy();
1741
+ return;
1742
+ }
1743
+ if (this.disabled) {
1744
+ return;
1745
+ }
1746
+ const labelEl = (_b = this.el.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector("label");
1747
+ const labelId = `${this.inputId}-label`;
1748
+ if (labelEl !== null && labelEl !== undefined) {
1749
+ labelEl.id = labelId;
1750
+ }
1751
+ const hasValidation = !helpers.isEmptyString(this.validationStatus) ||
1752
+ !helpers.isEmptyString(this.invalidDateText);
1753
+ const labelledBy = `${(_c = labelEl === null || labelEl === void 0 ? void 0 : labelEl.id) !== null && _c !== void 0 ? _c : ""} ${this.screenReaderInfoId} ${helpers.getInputDescribedByText(this.el, this.inputId, this.helperText !== "" && this.helperText !== this.defaultHelperText, hasValidation)} ${this.selectedDate ? this.selectedDateInfoId : ""} ${this.assistiveHintId}`;
1754
+ this.inputCompContainerEl.setAttribute(this.ARIA_LABELLED_BY, labelledBy);
1755
+ };
1756
+ // Sets boolean for each input, used to limit the number of characters within each field (2 for day / month, 4 for year)
1757
+ this.setPreventInput = (input, isPrevented) => {
1758
+ switch (input) {
1759
+ case this.dayInputEl:
1760
+ this.preventDayInput = isPrevented;
1761
+ break;
1762
+ case this.monthInputEl:
1763
+ this.preventMonthInput = isPrevented;
1764
+ break;
1765
+ case this.yearInputEl:
1766
+ this.preventYearInput = isPrevented;
1767
+ }
1768
+ };
1769
+ // Get input based on letter representing each date part ("D", "M" or "Y")
1770
+ // (retrieved from dateFormat)
1771
+ this.getInputFromDatePart = (datePart) => {
1772
+ const dayInput = (index.h("input", { class: "day-input", id: "day-input", ref: (el) => (this.dayInputEl = el), "aria-label": "day", placeholder: "DD", disabled: this.disabled, "aria-required": `${this.required}`, onPaste: this.handlePaste, inputmode: "number", pattern: "[0-9]*", onKeyDown: (event) => this.handleKeyDown(event, this.preventDayInput) }));
1773
+ const monthInput = (index.h("input", { id: "month-input", class: "month-input", ref: (el) => (this.monthInputEl = el), "aria-label": "month", placeholder: "MM", disabled: this.disabled, "aria-required": `${this.required}`, onPaste: this.handlePaste, inputmode: "number", pattern: "[0-9]*", onKeyDown: (event) => this.handleKeyDown(event, this.preventMonthInput) }));
1774
+ 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, "aria-required": `${this.required}`, onPaste: this.handlePaste, inputmode: "number", pattern: "[0-9]*", onKeyDown: (event) => this.handleKeyDown(event, this.preventYearInput) }));
1775
+ let input;
1776
+ switch (datePart) {
1777
+ case "D":
1778
+ input = dayInput;
1779
+ break;
1780
+ case "M":
1781
+ input = monthInput;
1782
+ break;
1783
+ case "Y":
1784
+ input = yearInput;
1785
+ }
1786
+ return input;
1787
+ };
1788
+ // Get input elements in order of chosen date format
1789
+ this.getInputsInOrder = () => {
1790
+ const dateParts = this.dateFormat.split("/");
1791
+ const inputsInOrder = [];
1792
+ dateParts.forEach((part) => {
1793
+ inputsInOrder.push(this.getInputFromDatePart(part.substring(0, 1)));
1794
+ });
1795
+ return inputsInOrder;
1796
+ };
1797
+ // To add to the end of assistive hint to make it clearer that each date part has its own input
1798
+ // that can be changed individually
1799
+ this.getDescOfInputsOrder = () => {
1800
+ let description;
1801
+ switch (this.dateFormat) {
1802
+ case this.DEFAULT_DATE_FORMAT:
1803
+ description = "day, month, and year";
1804
+ break;
1805
+ case "MM/DD/YYYY":
1806
+ description = "month, day, and year";
1807
+ break;
1808
+ case "YYYY/MM/DD":
1809
+ description = "year, month, and day";
1810
+ }
1811
+ return description;
1812
+ };
1813
+ // Add 'required' or 'invalid data' to span used in aria-labelledby
1814
+ // Many ARIA attributes aren't read out by screen reader when on the input component container
1815
+ this.getScreenReaderInfo = (validationStatus) => {
1816
+ let inputDescriptors = "";
1817
+ if (this.required) {
1818
+ inputDescriptors += "required";
1819
+ }
1820
+ if (validationStatus === helpers.IcInformationStatus.Error) {
1821
+ inputDescriptors += " invalid data";
1822
+ }
1823
+ return inputDescriptors === "" ? "" : inputDescriptors + ", ";
1824
+ };
1825
+ // Prevent non-number characters being entered
1826
+ // ('e' or '.' - which are usually allowed in <input type="number">)
1827
+ // And limit the number of characters within each field (2 for day / month, 4 for year)
1828
+ // (because 'maxlength' doesn't work on <input type="number">)
1829
+ this.preventInput = (event, isInputPrevented) => {
1830
+ const key = event.key;
1831
+ const input = event.target;
1832
+ let selectedString;
1833
+ if (input) {
1834
+ selectedString = input.value.substring(input.selectionStart || 0, input.selectionEnd || undefined);
1835
+ }
1836
+ if (key === "e" ||
1837
+ key === "." ||
1838
+ key === "-" ||
1839
+ (event.key >= "0" &&
1840
+ event.key <= "9" &&
1841
+ isInputPrevented &&
1842
+ !selectedString)) {
1843
+ event.preventDefault();
1844
+ }
1845
+ };
1846
+ /**
1847
+ * Get whether date has been disabled using disableFuture or disablePast prop, but always allow current day
1848
+ * Consider using dateClamp and inDateRange
1849
+ * @returns `boolean`
1850
+ */
1851
+ this.isSelectedDateDisabled = () => {
1852
+ if (!this.selectedDate)
1853
+ return false;
1854
+ const currentDate = new Date();
1855
+ const isNotToday = this.selectedDate.toDateString() !== currentDate.toDateString();
1856
+ this.isAfterMax =
1857
+ this.maxDate && this.selectedDate > this.maxDate && isNotToday;
1858
+ this.isBeforeMin =
1859
+ this.minDate && this.selectedDate < this.minDate && isNotToday;
1860
+ return (this.isAfterMax ||
1861
+ this.isBeforeMin ||
1862
+ this.disableDays.includes(this.selectedDate.getDay()) ||
1863
+ (((!!this.disablePast && this.selectedDate < currentDate) ||
1864
+ (!!this.disableFuture && this.selectedDate > currentDate)) &&
1865
+ isNotToday));
1866
+ };
1867
+ this.moveToNextInput = (currentInput) => {
1868
+ var _a;
1869
+ this.preventAutoFormatting = false;
1870
+ (_a = this.inputsInOrder[this.inputsInOrder.findIndex((input) => input === currentInput) + 1]) === null || _a === void 0 ? void 0 : _a.focus();
1871
+ };
1872
+ this.moveToPreviousInput = (currentInput) => {
1873
+ var _a;
1874
+ this.preventAutoFormatting = false;
1875
+ (_a = this.inputsInOrder[this.inputsInOrder.findIndex((input) => input === currentInput) - 1]) === null || _a === void 0 ? void 0 : _a.focus();
1876
+ };
1877
+ this.autocompleteInput = (input) => {
1878
+ const inputValue = input.value;
1879
+ if (this.yearInputEl && input === this.yearInputEl) {
1880
+ // Autocomplete year as current millennium when fewer than 4 characters entered
1881
+ const yearNumbers = ["2", "0", "0"];
1882
+ let autocompletedInput = "";
1883
+ if (inputValue) {
1884
+ yearNumbers.forEach((number, index) => {
1885
+ if (inputValue.length + index <= 3) {
1886
+ autocompletedInput += number;
1887
+ }
1888
+ });
1889
+ this.yearInputEl.value = `${autocompletedInput}${inputValue}`;
1890
+ }
1891
+ }
1892
+ else if (inputValue.length === 1) {
1893
+ // Autocomplete input as 2 characters (leading zero) when only 1 character entered (for day and month)
1894
+ input.value = +inputValue === 0 ? "01" : `0${inputValue}`;
1895
+ }
1896
+ if (input.value) {
1897
+ this.setInputValue(input);
1898
+ }
1899
+ };
1900
+ this.convertToDate = (year, month, day) => {
1901
+ if (!helpers.isEmptyString(year) && !helpers.isEmptyString(month) && !helpers.isEmptyString(day)) {
1902
+ return new Date(+year, +month - 1, +day);
1903
+ }
1904
+ else {
1905
+ return null;
1906
+ }
1907
+ };
1908
+ this.handleHostBlur = () => {
1909
+ this.removeLabelledBy = false;
1910
+ this.icBlur.emit({ value: this.selectedDate });
1911
+ };
1912
+ this.handleHostFocus = () => {
1913
+ var _a, _b;
1914
+ if ((_b = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.activeElement) === null || _b === void 0 ? void 0 : _b.id.match(/(day|month|year)-input$/)) {
1915
+ this.removeLabelledBy = false;
1916
+ }
1917
+ else {
1918
+ this.removeLabelledBy = true;
1919
+ }
1920
+ this.icFocus.emit({ value: this.selectedDate });
1921
+ };
1922
+ this.handleFormReset = () => {
1923
+ // Get the initial value and populate day, month and year again.
1924
+ this.setDate(this.initialValue);
1925
+ this.setValidationMessage();
1926
+ this.handleDateChange(false);
1927
+ };
1928
+ this.getAriaLabel = (input) => input.getAttribute(this.ARIA_LABEL);
1929
+ this.notifyScreenReaderArrowKeys = (input) => {
1930
+ var _a;
1931
+ const liveRegion = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector("#live-region");
1932
+ const ariaLabel = this.getAriaLabel(input);
1933
+ if (liveRegion && input.value && ariaLabel) {
1934
+ let announcement = "";
1935
+ if (input === this.monthInputEl &&
1936
+ !!helpers.IcDateInputMonths[+input.value - 1]) {
1937
+ announcement = `${input.value} - ${helpers.IcDateInputMonths[+input.value - 1]}, ${ariaLabel}`;
1938
+ }
1939
+ if (input === this.dayInputEl || input === this.yearInputEl) {
1940
+ announcement = `${input.value}, ${ariaLabel}`;
1941
+ }
1942
+ liveRegion.textContent = announcement;
1943
+ }
1944
+ };
1945
+ this.notifyScreenReaderInput = (input, liveRegion) => {
1946
+ const ariaLabel = this.getAriaLabel(input);
1947
+ const value = input.value;
1948
+ if (ariaLabel && value) {
1949
+ let announcement = "";
1950
+ const monthValue = helpers.IcDateInputMonths[+value - 1];
1951
+ if (input === this.monthInputEl &&
1952
+ !!monthValue &&
1953
+ this.isValidMonth &&
1954
+ value.length === 2) {
1955
+ announcement = `${value} - ${monthValue}`;
1956
+ }
1957
+ else if ((input === this.dayInputEl && this.isValidDay && value.length === 2) ||
1958
+ (input === this.yearInputEl && value.length === 4)) {
1959
+ announcement = value;
1960
+ }
1961
+ liveRegion.textContent = `${announcement}, ${ariaLabel}`;
1962
+ }
1963
+ };
1964
+ this.setFitToValueStyling = (input) => {
1965
+ if (input.value) {
1966
+ input.classList.add(this.FIT_TO_VALUE);
1967
+ }
1968
+ else {
1969
+ input.classList.remove(this.FIT_TO_VALUE);
1970
+ }
1971
+ };
1972
+ this.setAriaInvalid = (validDay, validMonth, validDate, disabledDate) => {
1973
+ var _a, _b;
1974
+ if (this.inputsInOrder.length) {
1975
+ this.inputsInOrder.forEach((input) => {
1976
+ input.removeAttribute(this.ARIA_INVALID);
1977
+ });
1978
+ if (!validDay) {
1979
+ (_a = this.dayInputEl) === null || _a === void 0 ? void 0 : _a.setAttribute(this.ARIA_INVALID, "true");
1980
+ }
1981
+ if (!validMonth) {
1982
+ (_b = this.monthInputEl) === null || _b === void 0 ? void 0 : _b.setAttribute(this.ARIA_INVALID, "true");
1983
+ }
1984
+ if (!validDate || disabledDate) {
1985
+ this.inputsInOrder.forEach((input) => {
1986
+ input.setAttribute(this.ARIA_INVALID, "true");
1987
+ });
1988
+ }
1989
+ }
1990
+ };
1991
+ this.handleClear = () => {
1992
+ this.clearInput = true;
1993
+ this.inputsInOrder.forEach((input) => {
1994
+ input.classList.remove(this.FIT_TO_VALUE);
1995
+ this.setInputValue(input, true);
1996
+ this.setPreventInput(input, false);
1997
+ });
1998
+ this.clearInput = false;
1999
+ this.preventInputsUpdating = false;
2000
+ this.setValidationMessage();
2001
+ this.handleDateChange(true);
2002
+ this.inputsInOrder[0].focus();
2003
+ };
2004
+ this.handleCalendarOpen = (ev) => {
2005
+ var _a, _b, _c, _d, _e, _f;
2006
+ ev.stopImmediatePropagation();
2007
+ (_c = (_b = (_a = this.calendarButtonEl) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector("ic-tooltip")) === null || _c === void 0 ? void 0 : _c.displayTooltip(false);
2008
+ this.calendarButtonClicked.emit({ value: this.selectedDate });
2009
+ (_f = (_e = (_d = this.calendarButtonEl) === null || _d === void 0 ? void 0 : _d.shadowRoot) === null || _e === void 0 ? void 0 : _e.querySelector("ic-tooltip")) === null || _f === void 0 ? void 0 : _f.displayTooltip(false);
2010
+ this.preventInputsUpdating = false;
2011
+ this.calendarIsOpen = true;
2012
+ };
2013
+ this.setValueAndEmitChange = (value) => {
2014
+ if (!dateHelpers.dateMatches(this.value ? new Date(this.value) : null, value)) {
2015
+ this.emitIcChange(value);
2016
+ this.value = value;
2017
+ }
2018
+ };
2019
+ this.handleCalendarFocus = () => {
2020
+ this.calendarFocused = true;
2021
+ if (this.calendarIsOpen) {
2022
+ // focus event triggered by closing calendar dialog so inputs should update
2023
+ this.preventInputsUpdating = false;
2024
+ this.calendarIsOpen = false;
2025
+ }
2026
+ else {
2027
+ this.preventInputsUpdating = true;
2028
+ }
2029
+ };
2030
+ this.handleCalendarBlur = () => {
2031
+ this.calendarFocused = false;
2032
+ this.preventInputsUpdating = true;
2033
+ };
2034
+ this.handleClearFocus = () => {
2035
+ this.removeLabelledBy = true;
2036
+ this.preventInputsUpdating = true;
2037
+ this.clearButtonFocused = true;
2038
+ };
2039
+ this.handleClearBlur = (ev) => {
2040
+ var _a;
2041
+ this.clearButtonFocused = false;
2042
+ this.preventInputsUpdating = true;
2043
+ if ((_a = ev.relatedTarget) === null || _a === void 0 ? void 0 : _a.id.match(/(day|year)-input$/)) {
2044
+ this.removeLabelledBy = false;
2045
+ return;
2046
+ }
2047
+ this.removeLabelledBy = true;
2048
+ };
2049
+ this.emitIcChange = (d) => {
2050
+ this.selectedDate = d;
2051
+ if (!dateHelpers.dateMatches(this.selectedDate, d) ||
2052
+ this.day !== null ||
2053
+ this.month !== null ||
2054
+ this.year !== null) {
2055
+ let UTCDate = null;
2056
+ if (d !== null) {
2057
+ UTCDate = new Date(Date.UTC(d.getFullYear(), d.getMonth(), d.getDate()));
2058
+ }
2059
+ this.icChange.emit({
2060
+ value: d,
2061
+ dateObject: {
2062
+ day: this.day === "" ? null : this.day,
2063
+ month: this.month === "" ? null : this.month,
2064
+ year: this.year === "" ? null : this.year,
2065
+ },
2066
+ utcValue: UTCDate,
2067
+ });
2068
+ }
2069
+ };
2070
+ }
2071
+ watchInputHandler() {
2072
+ if (this.emitDatePartChange &&
2073
+ !this.externalSetDate &&
2074
+ !this.clearInput &&
2075
+ !(this.day && this.month && this.year) &&
2076
+ this.selectedDate === null) {
2077
+ this.emitIcChange(this.selectedDate);
2078
+ }
2079
+ }
2080
+ watchDisabledHandler() {
2081
+ helpers.removeDisabledFalse(this.disabled, this.el);
2082
+ }
2083
+ watchDisableFutureHandler() {
2084
+ this.watchMaxHandler();
2085
+ }
2086
+ watchDisablePastHandler() {
2087
+ this.watchMinHandler();
2088
+ }
2089
+ watchMaxHandler() {
2090
+ if (this.disableFuture) {
2091
+ this.maxDate = new Date();
2092
+ }
2093
+ else {
2094
+ this.maxDate = dateHelpers.createDate(this.max, this.dateFormat);
2095
+ }
2096
+ }
2097
+ watchMinHandler() {
2098
+ if (this.disablePast) {
2099
+ this.minDate = new Date();
2100
+ }
2101
+ else {
2102
+ this.minDate = dateHelpers.createDate(this.min, this.dateFormat);
2103
+ }
2104
+ }
2105
+ watchRequiredHandler() {
2106
+ var _a, _b;
2107
+ // Prevent asterisk being read out after the label by screen reader (by applying aria-hidden)
2108
+ // Needed because label is included in 'aria-labelledby' instead of using 'aria-label'
2109
+ const labelEl = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector("label");
2110
+ if (this.required) {
2111
+ const asteriskSpan = document.createElement("span");
2112
+ asteriskSpan.setAttribute("id", "asterisk-span");
2113
+ asteriskSpan.setAttribute("aria-hidden", "true");
2114
+ asteriskSpan.textContent = " *";
2115
+ labelEl === null || labelEl === void 0 ? void 0 : labelEl.appendChild(asteriskSpan);
2116
+ }
2117
+ else {
2118
+ const asteriskSpan = (_b = this.el.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector("#asterisk-span");
2119
+ if (asteriskSpan) {
2120
+ asteriskSpan.remove();
2121
+ }
2122
+ }
2123
+ }
2124
+ disconnectedCallback() {
2125
+ helpers.removeFormResetListener(this.el, this.handleFormReset);
2126
+ }
2127
+ componentWillLoad() {
2128
+ this.defaultHelperText = `Use format ${this.dateFormat}`;
2129
+ if (helpers.isEmptyString(this.helperText))
2130
+ this.helperText = this.defaultHelperText;
2131
+ this.watchMinHandler();
2132
+ this.watchMaxHandler();
2133
+ if (this.value) {
2134
+ this.externalSetDate = true;
2135
+ this.setDate(this.value);
2136
+ }
2137
+ this.screenReaderInfoId = `${this.inputId}-screen-reader-info`;
2138
+ this.assistiveHintId = `${this.inputId}-assistive-hint`;
2139
+ this.selectedDateInfoId = `${this.inputId}-selected-date-info`;
2140
+ helpers.addFormResetListener(this.el, this.handleFormReset);
2141
+ helpers.removeDisabledFalse(this.disabled, this.el);
2142
+ }
2143
+ componentDidLoad() {
2144
+ this.setInputsInOrder();
2145
+ helpers.onComponentRequiredPropUndefined([{ prop: this.label, propName: "label" }], "Date Input");
2146
+ if (this.value) {
2147
+ this.updateInputValues(this.day, this.month, this.year);
2148
+ this.inputsInOrder.forEach((input) => {
2149
+ input.classList.add(this.FIT_TO_VALUE);
2150
+ });
2151
+ }
2152
+ this.setAriaInvalid(this.isValidDay, this.isValidMonth, this.isValidDate, this.isDisabledDate);
2153
+ if (this.value) {
2154
+ this.notifyScreenReaderSelectedDate();
2155
+ }
2156
+ this.inputsInOrder.forEach((input) => {
2157
+ input.addEventListener("input", this.handleInput);
2158
+ input.addEventListener("focus", this.handleFocus);
2159
+ input.addEventListener("blur", this.handleBlur);
2160
+ });
2161
+ this.watchRequiredHandler();
2162
+ }
2163
+ componentWillUpdate() {
2164
+ if (helpers.isEmptyString(this.helperText))
2165
+ this.helperText = this.defaultHelperText;
2166
+ if (!this.preventInputsUpdating)
2167
+ this.setDate(this.value);
2168
+ this.setAriaInvalid(this.isValidDay, this.isValidMonth, this.isValidDate, this.isDisabledDate);
2169
+ this.handleDateChange(false);
2170
+ this.preventInputsUpdating = false;
2171
+ }
2172
+ componentDidRender() {
2173
+ if (this.removeLabelledBy) {
2174
+ this.removeAriaLabelledBy();
2175
+ return;
2176
+ }
2177
+ this.setAriaLabelledBy();
2178
+ }
2179
+ /**
2180
+ * Returns the value as a Date object
2181
+ * @returns Date
2182
+ */
2183
+ async getDate() {
2184
+ return this.selectedDate;
2185
+ }
2186
+ /**
2187
+ * @internal Sets focus on the calendar button.
2188
+ */
2189
+ async setCalendarFocus() {
2190
+ if (this.calendarButtonEl) {
2191
+ this.calendarButtonEl.focus();
2192
+ }
2193
+ }
2194
+ /**
2195
+ * @internal Used to pass disabledDays from parent component.
2196
+ */
2197
+ async setDisableDays(days) {
2198
+ this.disableDays = days;
2199
+ }
2200
+ /**
2201
+ * @internal Used to enable other components to invoke an IcChange event from the input.
2202
+ */
2203
+ async triggerIcChange(d) {
2204
+ this.externalSetDate = true;
2205
+ this.setDate(d);
2206
+ this.emitIcChange(d);
2207
+ this.externalSetDate = false;
2208
+ }
2209
+ removeAriaLabelledBy() {
2210
+ this.inputCompContainerEl.removeAttribute(this.ARIA_LABELLED_BY);
2211
+ }
2212
+ setPastedValueAndValidation(isValidDate, pastedValue, event) {
2213
+ switch (true) {
2214
+ case isValidDate: {
2215
+ const nextParsedValue = this.isZuluTime
2216
+ ? dateHelpers.extractDateFromZuluDateTime(pastedValue)
2217
+ : pastedValue;
2218
+ const dateParts = nextParsedValue.split(/-|\/|\./);
2219
+ this.inputsInOrder.forEach((input, index) => {
2220
+ input.classList.add(this.FIT_TO_VALUE);
2221
+ if (this.isZuluTime) {
2222
+ this.pasteZuluDateTime(dateParts, index);
2223
+ }
2224
+ else {
2225
+ let dateValue;
2226
+ if (input === this.dayInputEl || input === this.monthInputEl) {
2227
+ dateValue = this.slicePastedDate(2, dateParts[index]);
2228
+ }
2229
+ else {
2230
+ dateValue = this.slicePastedDate(4, dateParts[index]);
2231
+ }
2232
+ input.value = dateValue;
2233
+ this.setInputValue(input);
2234
+ this.autocompleteInput(input);
2235
+ }
2236
+ });
2237
+ this.isZuluTime = false;
2238
+ break;
2239
+ }
2240
+ case (pastedValue.length === 1 ||
2241
+ pastedValue.length === 2 ||
2242
+ pastedValue.length === 4) &&
2243
+ helpers.isNumeric(pastedValue):
2244
+ if (this.checkSingleCopiedValueIsValid(event.target, pastedValue)) {
2245
+ // Check if copied value can be pasted into input
2246
+ this.setInputPasteValue(event.target, pastedValue);
2247
+ this.setInputValue(event.target);
2248
+ }
2249
+ else {
2250
+ this.displayPastedValidation(event);
2251
+ }
2252
+ break;
2253
+ case pastedValue.length === 3 && helpers.isNumeric(pastedValue):
2254
+ if (event.target !== this.yearInputEl) {
2255
+ this.displayPastedValidation(event);
2256
+ }
2257
+ else {
2258
+ this.setInputPasteValue(event.target, pastedValue);
2259
+ this.setInputValue(event.target);
2260
+ }
2261
+ break;
2262
+ case pastedValue.length >= 5 && helpers.isNumeric(pastedValue):
2263
+ this.displayPastedValidation(event);
2264
+ }
2265
+ }
2266
+ pasteZuluDateTime(dateParts, index) {
2267
+ // ['YYYY', 'MM', 'DD']
2268
+ if (index === 0 && this.yearInputEl) {
2269
+ const dateValue = this.slicePastedDate(4, dateParts[index]);
2270
+ this.yearInputEl.value = dateValue;
2271
+ this.setInputValue(this.yearInputEl);
2272
+ }
2273
+ else if (index === 1 && this.monthInputEl) {
2274
+ // The month value is the second item in the array
2275
+ const dateValue = this.slicePastedDate(2, dateParts[index]);
2276
+ this.monthInputEl.value = dateValue;
2277
+ this.setInputValue(this.monthInputEl);
2278
+ }
2279
+ else if (this.dayInputEl) {
2280
+ const dateValue = this.slicePastedDate(2, dateParts[index]);
2281
+ this.dayInputEl.value = dateValue;
2282
+ this.setInputValue(this.dayInputEl);
2283
+ }
2284
+ }
2285
+ displayPastedValidation(event) {
2286
+ var _a;
2287
+ if (((_a = this.invalidDateText) === null || _a === void 0 ? void 0 : _a.length) > 0) {
2288
+ this.previousInvalidDateTest = this.invalidDateText;
2289
+ }
2290
+ this.invalidDateText = `Please paste a valid ${this.getAriaLabel(event.target)}`;
2291
+ this.validationStatus = helpers.IcInformationStatus.Error;
2292
+ this.isPasteValidationDisplayed = true;
2293
+ }
2294
+ setPasteInvalidText() {
2295
+ var _a;
2296
+ if (this.isPasteValidationDisplayed) {
2297
+ this.invalidDateText = (_a = this.previousInvalidDateTest) !== null && _a !== void 0 ? _a : "";
2298
+ this.isPasteValidationDisplayed = false;
2299
+ // This is to prevent setDate from triggering within componentWillUpdate
2300
+ this.preventInputsUpdating = true;
2301
+ }
2302
+ }
2303
+ notifyScreenReader(input, event) {
2304
+ var _a;
2305
+ const liveRegion = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector("#live-region");
2306
+ if (liveRegion) {
2307
+ if (this.isKeyboardOrEvent(event)) {
2308
+ this.notifyScreenReaderArrowKeys(input);
2309
+ }
2310
+ else if (Object.prototype.toString.call(event) === this.INPUT_EVENT_OBJECT_STRING) {
2311
+ this.notifyScreenReaderInput(input, liveRegion);
2312
+ }
2313
+ }
2314
+ }
2315
+ render() {
2316
+ const { inputId, label, disabled, helperText, hideHelperText, hideLabel, showClearButton, showCalendarButton, size, theme, validationAriaLive, } = this;
2317
+ const hasCustomValidation = !helpers.isEmptyString(this.validationStatus);
2318
+ const validationStatus = hasCustomValidation
2319
+ ? this.validationStatus
2320
+ : !helpers.isEmptyString(this.invalidDateText)
2321
+ ? helpers.IcInformationStatus.Error
2322
+ : "";
2323
+ const assistiveHint = `Type or use the up and down arrow keys to change the values for the ${this.getDescOfInputsOrder()}.`;
2324
+ helpers.renderHiddenInput(true, this.el, this.name, this.convertToDate(this.year, this.month, this.day), this.disabled);
2325
+ return (index.h(index.Host, { key: '0b677de27ad0835484eb7a68e6bc52cddb13b975', class: {
2326
+ [`ic-theme-${theme}`]: theme !== "inherit",
2327
+ [`ic-date-input-disabled`]: disabled,
2328
+ }, onBlur: this.handleHostBlur, onFocus: this.handleHostFocus }, index.h("ic-input-container", { key: '8b440f9db75cf42c81163a8fc3fc927bddf061e7', disabled: disabled }, !(hideLabel && hideHelperText) && (index.h("ic-input-label", { key: '459c0ccececeddf034ee64775c41bea6e2c57b29', for: inputId, label: label, hideLabel: hideLabel, helperText: !hideHelperText ? helperText : "", disabled: disabled }, index.h("slot", { key: 'd051f25b9e91432752719c4c3e7511242697f93b', name: "helper-text", slot: "helper-text" }))), index.h("span", { key: 'bf2072a9a7482fa73ad3d4f178eadf3a39ea38d4', id: this.screenReaderInfoId, class: "sr-only", "aria-hidden": "true" }, this.getScreenReaderInfo(validationStatus), hideLabel && `${label}\n`, hideHelperText && `${helperText}\n`, `${this.defaultHelperText}.`), index.h("span", { key: 'ddae7fb05d3ff797eb08207dd12b3d98f0f3aa05', id: this.assistiveHintId, class: "sr-only", "aria-hidden": "true" }, assistiveHint), index.h("span", { key: 'bbd17aaf26b098379f436a6fc59fdcee52c52b64', id: "live-region", "aria-live": "assertive", class: "sr-only" }), index.h("ic-input-component-container", { key: 'c602e815b61b7c7bbd31390f47116f58b21852d4', id: inputId, ref: (el) => (this.inputCompContainerEl = el), disabled: disabled, validationStatus: validationStatus, size: size, role: "group", class: { [`ic-theme-${theme}`]: theme !== "inherit" } }, index.h("div", { key: '131868d25ab4297d80efec74f893552817f17186', class: "input-container" }, index.h("div", { key: 'c7184bd4b046ffd309fb20ee8fc90033d33e05fc', class: "date-inputs" }, this.getInputsInOrder()[0], "/", this.getInputsInOrder()[1], "/", this.getInputsInOrder()[2]), index.h("div", { key: '09009c954f7f4d0771553fdc13bfe2cc25cbf74a', class: "action-buttons" }, showClearButton && (index.h("ic-button", { key: '7a1878087c6b6091a7ef27c4cac6ac145ca09ae9', id: "clear-button", "aria-label": "Clear input", class: {
2329
+ ["clear-button"]: true,
2330
+ ["hidden"]: helpers.isEmptyString(this.day) &&
2331
+ helpers.isEmptyString(this.month) &&
2332
+ helpers.isEmptyString(this.year),
2333
+ }, disabled: this.disabled, innerHTML: clearIcon.Clear, onClick: this.handleClear, onFocus: this.handleClearFocus, onBlur: this.handleClearBlur, variant: "icon-tertiary", theme: this.clearButtonFocused ? "light" : "dark", size: size })), showCalendarButton && (index.h("div", { key: 'ec2f995db607ae5d575ddd7994e85f4b883ce2bb', class: "show-calendar-button-wrapper" }, index.h("div", { key: '74e895071ab608fcccc0a3e2b2ec368511efe4d3', class: { divider: true, [size]: true } }), index.h("ic-button", { key: '51e8939da851ae18809840d22492f3b5be958b26', 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-tertiary", size: size, onFocus: this.handleCalendarFocus, onBlur: this.handleCalendarBlur, theme: this.calendarFocused ? "light" : "dark" })))))), index.h("span", { key: '77d360d10492577650304e7914021ad40bb8b281', id: this.selectedDateInfoId, class: "sr-only", "aria-live": "polite" }, index.h("span", { key: '1c285045fb1b18bca93c9e32956e93b8d400b0a1', ref: (el) => (this.selectedDateInfoEl = el), role: "status" })), index.h("ic-input-validation", { key: '7f02c2d9ec754c92dec3156339e6ea6b504b8d74', status: validationStatus, message: hasCustomValidation ? this.validationText : this.invalidDateText, for: inputId, ariaLiveMode: validationAriaLive }))));
2334
+ }
2335
+ static get delegatesFocus() { return true; }
2336
+ get el() { return index.getElement(this); }
2337
+ static get watchers() { return {
2338
+ "day": ["watchInputHandler"],
2339
+ "month": ["watchInputHandler"],
2340
+ "year": ["watchInputHandler"],
2341
+ "disabled": ["watchDisabledHandler"],
2342
+ "disableFuture": ["watchDisableFutureHandler"],
2343
+ "disablePast": ["watchDisablePastHandler"],
2344
+ "max": ["watchMaxHandler"],
2345
+ "min": ["watchMinHandler"],
2346
+ "required": ["watchRequiredHandler"]
2347
+ }; }
2348
+ };
2349
+ DateInput.style = IcDateInputStyle0;
2350
+
2351
+ exports.ic_calendar = Calendar$1;
2352
+ exports.ic_date_input = DateInput;
2353
+
2354
+ //# sourceMappingURL=ic-calendar_2.cjs.entry.js.map