@swisspost/design-system-components 10.0.0-next.75 → 10.0.0

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 (333) hide show
  1. package/dist/cjs/{create-validator-decorator-Bimhl6Ib.js → create-validator-decorator-4dRrOF30.js} +1 -1
  2. package/dist/cjs/{index-CyeY2muT.js → index-BqngpwGa.js} +11 -15
  3. package/dist/cjs/loader.cjs.js +2 -2
  4. package/dist/cjs/{one-of-BVQP1dR3.js → one-of-D1veqtsm.js} +1 -1
  5. package/dist/cjs/{package-JSyXVavg.js → package-Bwdl-T-w.js} +1 -1
  6. package/dist/cjs/{pattern-BDKu8-v6.js → pattern-B7VKOu5m.js} +1 -1
  7. package/dist/cjs/post-accordion_2.cjs.entry.js +10 -12
  8. package/dist/cjs/post-autocomplete.cjs.entry.js +6 -6
  9. package/dist/cjs/post-avatar.cjs.entry.js +7 -7
  10. package/dist/cjs/post-back-to-top.cjs.entry.js +6 -6
  11. package/dist/cjs/post-banner.cjs.entry.js +5 -5
  12. package/dist/cjs/post-breadcrumb-item.cjs.entry.js +7 -7
  13. package/dist/cjs/post-breadcrumbs.cjs.entry.js +7 -7
  14. package/dist/cjs/post-closebutton_14.cjs.entry.js +41 -35
  15. package/dist/cjs/post-collapsible_2.cjs.entry.js +6 -6
  16. package/dist/cjs/post-components.cjs.js +2 -2
  17. package/dist/cjs/post-date-picker.cjs.entry.js +427 -257
  18. package/dist/cjs/post-footer.cjs.entry.js +6 -6
  19. package/dist/cjs/post-linkarea.cjs.entry.js +3 -3
  20. package/dist/cjs/post-listbox-option.cjs.entry.js +4 -4
  21. package/dist/cjs/post-listbox.cjs.entry.js +3 -3
  22. package/dist/cjs/post-number-input.cjs.entry.js +5 -4
  23. package/dist/cjs/post-pagination.cjs.entry.js +5 -5
  24. package/dist/cjs/post-popover-trigger.cjs.entry.js +5 -5
  25. package/dist/cjs/post-popover.cjs.entry.js +11 -12
  26. package/dist/cjs/post-progressbar.cjs.entry.js +4 -4
  27. package/dist/cjs/post-rating.cjs.entry.js +6 -6
  28. package/dist/cjs/post-side-navigation-trigger.cjs.entry.js +7 -7
  29. package/dist/cjs/post-side-navigation.cjs.entry.js +18 -7
  30. package/dist/cjs/post-stepper-item.cjs.entry.js +3 -3
  31. package/dist/cjs/post-stepper.cjs.entry.js +7 -7
  32. package/dist/cjs/post-tab-item.cjs.entry.js +15 -14
  33. package/dist/cjs/post-tab-panel.cjs.entry.js +6 -6
  34. package/dist/cjs/post-tabs.cjs.entry.js +196 -74
  35. package/dist/cjs/post-tooltip-trigger.cjs.entry.js +7 -9
  36. package/dist/cjs/post-tooltip.cjs.entry.js +9 -10
  37. package/dist/cjs/{required-BsZuSJAl.js → required-Bkz8MOYa.js} +1 -1
  38. package/dist/cjs/{type-DXpEWY0w.js → type-D8eD1JMd.js} +1 -1
  39. package/dist/cjs/{url-D-EbWRlF.js → url-C7MnIIZ_.js} +1 -1
  40. package/dist/collection/collection-manifest.json +1 -2
  41. package/dist/collection/components/post-accordion/post-accordion.js +1 -1
  42. package/dist/collection/components/post-accordion-item/post-accordion-item.js +4 -36
  43. package/dist/collection/components/post-autocomplete/post-autocomplete.js +1 -1
  44. package/dist/collection/components/post-avatar/post-avatar.js +1 -1
  45. package/dist/collection/components/post-back-to-top/post-back-to-top.js +1 -1
  46. package/dist/collection/components/post-banner/post-banner.js +1 -1
  47. package/dist/collection/components/post-breadcrumbs/post-breadcrumbs.js +1 -1
  48. package/dist/collection/components/post-closebutton/post-closebutton.js +1 -1
  49. package/dist/collection/components/post-collapsible/post-collapsible.js +1 -1
  50. package/dist/collection/components/post-collapsible-trigger/post-collapsible-trigger.js +1 -1
  51. package/dist/collection/components/post-date-picker/accessibility-utils.js +59 -0
  52. package/dist/collection/components/post-date-picker/date-utils.js +102 -0
  53. package/dist/collection/components/post-date-picker/native-mask-element.js +36 -0
  54. package/dist/collection/components/post-date-picker/post-date-picker.css +1 -1
  55. package/dist/collection/components/post-date-picker/post-date-picker.js +224 -301
  56. package/dist/collection/components/post-footer/post-footer.js +1 -1
  57. package/dist/collection/components/post-header/post-header.js +6 -5
  58. package/dist/collection/components/post-icon/post-icon.js +1 -1
  59. package/dist/collection/components/post-language-menu/post-language-menu.js +7 -5
  60. package/dist/collection/components/post-linkarea/post-linkarea.js +1 -1
  61. package/dist/collection/components/post-listbox/post-listbox.js +1 -1
  62. package/dist/collection/components/post-listbox-option/post-listbox-option.js +2 -2
  63. package/dist/collection/components/post-logo/post-logo.js +1 -1
  64. package/dist/collection/components/post-mainnavigation/post-mainnavigation.js +1 -1
  65. package/dist/collection/components/post-megadropdown/post-megadropdown.css +1 -1
  66. package/dist/collection/components/post-megadropdown/post-megadropdown.js +1 -1
  67. package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.js +1 -1
  68. package/dist/collection/components/post-menu/post-menu.js +9 -12
  69. package/dist/collection/components/post-menu-trigger/post-menu-trigger.js +1 -1
  70. package/dist/collection/components/post-number-input/post-number-input.js +3 -2
  71. package/dist/collection/components/post-popover/post-popover.js +12 -22
  72. package/dist/collection/components/post-popover-trigger/post-popover-trigger.js +1 -1
  73. package/dist/collection/components/post-popovercontainer/post-popovercontainer.js +13 -9
  74. package/dist/collection/components/post-progressbar/post-progressbar.js +1 -1
  75. package/dist/collection/components/post-rating/post-rating.js +1 -1
  76. package/dist/collection/components/post-side-navigation/post-side-navigation.css +1 -1
  77. package/dist/collection/components/post-side-navigation/post-side-navigation.js +38 -2
  78. package/dist/collection/components/post-side-navigation/side-navigation-styles.js +1 -0
  79. package/dist/collection/components/post-side-navigation-trigger/post-side-navigation-trigger.css +1 -1
  80. package/dist/collection/components/post-side-navigation-trigger/post-side-navigation-trigger.js +1 -1
  81. package/dist/collection/components/post-stepper/post-stepper.js +1 -1
  82. package/dist/collection/components/post-stepper-item/post-stepper-item.js +1 -1
  83. package/dist/collection/components/post-tab-item/post-tab-item.js +36 -19
  84. package/dist/collection/components/post-tab-panel/post-tab-panel.js +3 -2
  85. package/dist/collection/components/post-tabs/post-tabs.css +1 -1
  86. package/dist/collection/components/post-tabs/post-tabs.js +255 -84
  87. package/dist/collection/components/post-togglebutton/post-togglebutton.js +1 -1
  88. package/dist/collection/components/post-tooltip/post-tooltip.js +12 -22
  89. package/dist/collection/components/post-tooltip-trigger/post-tooltip-trigger.js +2 -4
  90. package/dist/collection/types/element-api.js +3 -0
  91. package/dist/component-names.json +0 -1
  92. package/dist/components/index.d.ts +0 -2
  93. package/dist/components/index.js +1 -1
  94. package/dist/components/package.js +1 -1
  95. package/dist/components/post-accordion-item2.js +1 -1
  96. package/dist/components/post-accordion2.js +1 -1
  97. package/dist/components/post-autocomplete.js +1 -1
  98. package/dist/components/post-avatar.js +1 -1
  99. package/dist/components/post-back-to-top.js +1 -1
  100. package/dist/components/post-banner.js +1 -1
  101. package/dist/components/post-breadcrumbs.js +1 -1
  102. package/dist/components/post-closebutton2.js +1 -1
  103. package/dist/components/post-collapsible-trigger2.js +1 -1
  104. package/dist/components/post-collapsible2.js +1 -1
  105. package/dist/components/post-date-picker.js +1 -1
  106. package/dist/components/post-footer.js +1 -1
  107. package/dist/components/post-header.js +1 -1
  108. package/dist/components/post-icon2.js +1 -1
  109. package/dist/components/post-language-menu.js +1 -1
  110. package/dist/components/post-linkarea.js +1 -1
  111. package/dist/components/post-listbox-option.js +1 -1
  112. package/dist/components/post-listbox.js +1 -1
  113. package/dist/components/post-logo.js +1 -1
  114. package/dist/components/post-mainnavigation.js +1 -1
  115. package/dist/components/post-megadropdown-trigger.js +1 -1
  116. package/dist/components/post-megadropdown.js +1 -1
  117. package/dist/components/post-menu-trigger2.js +1 -1
  118. package/dist/components/post-menu2.js +1 -1
  119. package/dist/components/post-number-input.js +1 -1
  120. package/dist/components/post-popover-trigger.js +1 -1
  121. package/dist/components/post-popover.js +1 -1
  122. package/dist/components/post-popovercontainer2.js +1 -1
  123. package/dist/components/post-progressbar.js +1 -1
  124. package/dist/components/post-rating.js +1 -1
  125. package/dist/components/post-side-navigation-trigger.js +1 -1
  126. package/dist/components/post-side-navigation.js +1 -1
  127. package/dist/components/post-stepper-item.js +1 -1
  128. package/dist/components/post-stepper.js +1 -1
  129. package/dist/components/post-tab-item.js +1 -1
  130. package/dist/components/post-tab-panel.js +1 -1
  131. package/dist/components/post-tabs.js +1 -1
  132. package/dist/components/post-togglebutton2.js +1 -1
  133. package/dist/components/post-tooltip-trigger.js +1 -1
  134. package/dist/components/post-tooltip.js +1 -1
  135. package/dist/components/react/index.js +1 -1
  136. package/dist/components/react/{p-DNddZV_h.js → p-Auha71WU.js} +1 -1
  137. package/dist/components/react/{p-ztiqEfbC.js → p-Bpwt-eYO.js} +1 -1
  138. package/dist/components/react/p-C6wtG9yO.js +1 -0
  139. package/dist/components/react/{p-DU4XzTGt.js → p-C7jOKUzv.js} +1 -1
  140. package/dist/components/react/{p-CbU3QFNG.js → p-Cjo8Ke7t.js} +1 -1
  141. package/dist/components/react/{p-BUAS73l8.js → p-ClF2qF9A.js} +1 -1
  142. package/dist/components/react/{p-BUSQG9af.js → p-CyNGpewj.js} +1 -1
  143. package/dist/components/react/{p-DTg2SXJj.js → p-DvVypwYO.js} +1 -1
  144. package/dist/components/react/p-SEWFpJgA.js +1 -0
  145. package/dist/components/react/p-bAeGAkWL.js +1 -0
  146. package/dist/components/react/{p-B3ZJPCU0.js → p-i1ZFHprG.js} +1 -1
  147. package/dist/components/react/p-znfTjqEZ.js +1 -0
  148. package/dist/components/react/post-accordion-item.js +1 -1
  149. package/dist/components/react/post-accordion.js +1 -1
  150. package/dist/components/react/post-autocomplete.js +1 -1
  151. package/dist/components/react/post-avatar.js +1 -1
  152. package/dist/components/react/post-back-to-top.js +1 -1
  153. package/dist/components/react/post-banner.js +1 -1
  154. package/dist/components/react/post-breadcrumb-item.js +1 -1
  155. package/dist/components/react/post-breadcrumbs.js +1 -1
  156. package/dist/components/react/post-closebutton.js +1 -1
  157. package/dist/components/react/post-collapsible-trigger.js +1 -1
  158. package/dist/components/react/post-collapsible.js +1 -1
  159. package/dist/components/react/post-date-picker.js +1 -1
  160. package/dist/components/react/post-footer.js +1 -1
  161. package/dist/components/react/post-header.js +1 -1
  162. package/dist/components/react/post-icon.js +1 -1
  163. package/dist/components/react/post-language-menu-item.js +1 -1
  164. package/dist/components/react/post-language-menu.js +1 -1
  165. package/dist/components/react/post-linkarea.js +1 -1
  166. package/dist/components/react/post-listbox-option.js +1 -1
  167. package/dist/components/react/post-listbox.js +1 -1
  168. package/dist/components/react/post-logo.js +1 -1
  169. package/dist/components/react/post-mainnavigation.js +1 -1
  170. package/dist/components/react/post-megadropdown-trigger.js +1 -1
  171. package/dist/components/react/post-megadropdown.js +1 -1
  172. package/dist/components/react/post-menu-item.js +1 -1
  173. package/dist/components/react/post-menu-trigger.js +1 -1
  174. package/dist/components/react/post-menu.js +1 -1
  175. package/dist/components/react/post-number-input.js +1 -1
  176. package/dist/components/react/post-pagination.js +1 -1
  177. package/dist/components/react/post-popover-trigger.js +1 -1
  178. package/dist/components/react/post-popover.js +1 -1
  179. package/dist/components/react/post-popovercontainer.js +1 -1
  180. package/dist/components/react/post-progressbar.js +1 -1
  181. package/dist/components/react/post-rating.js +1 -1
  182. package/dist/components/react/post-side-navigation-trigger.js +1 -1
  183. package/dist/components/react/post-side-navigation.js +1 -1
  184. package/dist/components/react/post-stepper-item.js +1 -1
  185. package/dist/components/react/post-stepper.js +1 -1
  186. package/dist/components/react/post-tab-item.js +1 -1
  187. package/dist/components/react/post-tab-panel.js +1 -1
  188. package/dist/components/react/post-tabs.js +1 -1
  189. package/dist/components/react/post-togglebutton.js +1 -1
  190. package/dist/components/react/post-tooltip-trigger.js +1 -1
  191. package/dist/components/react/post-tooltip.js +1 -1
  192. package/dist/docs.json +287 -473
  193. package/dist/esm/{create-validator-decorator-BNkS_yAb.js → create-validator-decorator-CYYTw0AS.js} +1 -1
  194. package/dist/esm/{index-BGeKgZqi.js → index-DE1aWdqx.js} +11 -15
  195. package/dist/esm/loader.js +3 -3
  196. package/dist/esm/{one-of-4BD_5pKR.js → one-of-Ug1_Xoes.js} +1 -1
  197. package/dist/esm/package-SEWFpJgA.js +3 -0
  198. package/dist/esm/{pattern-D7tnGo1u.js → pattern-WLk4tOqI.js} +1 -1
  199. package/dist/esm/post-accordion_2.entry.js +10 -12
  200. package/dist/esm/post-autocomplete.entry.js +6 -6
  201. package/dist/esm/post-avatar.entry.js +7 -7
  202. package/dist/esm/post-back-to-top.entry.js +6 -6
  203. package/dist/esm/post-banner.entry.js +5 -5
  204. package/dist/esm/post-breadcrumb-item.entry.js +7 -7
  205. package/dist/esm/post-breadcrumbs.entry.js +7 -7
  206. package/dist/esm/post-closebutton_14.entry.js +41 -35
  207. package/dist/esm/post-collapsible_2.entry.js +6 -6
  208. package/dist/esm/post-components.js +3 -3
  209. package/dist/esm/post-date-picker.entry.js +427 -257
  210. package/dist/esm/post-footer.entry.js +6 -6
  211. package/dist/esm/post-linkarea.entry.js +3 -3
  212. package/dist/esm/post-listbox-option.entry.js +4 -4
  213. package/dist/esm/post-listbox.entry.js +3 -3
  214. package/dist/esm/post-number-input.entry.js +5 -4
  215. package/dist/esm/post-pagination.entry.js +5 -5
  216. package/dist/esm/post-popover-trigger.entry.js +5 -5
  217. package/dist/esm/post-popover.entry.js +11 -12
  218. package/dist/esm/post-progressbar.entry.js +4 -4
  219. package/dist/esm/post-rating.entry.js +6 -6
  220. package/dist/esm/post-side-navigation-trigger.entry.js +7 -7
  221. package/dist/esm/post-side-navigation.entry.js +18 -7
  222. package/dist/esm/post-stepper-item.entry.js +3 -3
  223. package/dist/esm/post-stepper.entry.js +7 -7
  224. package/dist/esm/post-tab-item.entry.js +15 -14
  225. package/dist/esm/post-tab-panel.entry.js +6 -6
  226. package/dist/esm/post-tabs.entry.js +196 -74
  227. package/dist/esm/post-tooltip-trigger.entry.js +7 -9
  228. package/dist/esm/post-tooltip.entry.js +9 -10
  229. package/dist/esm/{required-DhBxDSbP.js → required-DeOhRbtk.js} +1 -1
  230. package/dist/esm/{type-icZlikjf.js → type-S-4aPMGU.js} +1 -1
  231. package/dist/esm/{url-B_2x2YCy.js → url-C8KSrmWc.js} +1 -1
  232. package/dist/post-components/{p-aff9dd5e.entry.js → p-01b5539a.entry.js} +1 -1
  233. package/dist/post-components/{p-0a08ae23.entry.js → p-04e29502.entry.js} +1 -1
  234. package/dist/post-components/p-0b7f4169.entry.js +1 -0
  235. package/dist/post-components/p-13e1fdbd.entry.js +1 -0
  236. package/dist/post-components/{p-84c8d952.entry.js → p-1edcfc9e.entry.js} +1 -1
  237. package/dist/post-components/{p-15fa7e60.entry.js → p-21c83ccd.entry.js} +1 -1
  238. package/dist/post-components/{p-9ec32e7b.entry.js → p-261e2ffa.entry.js} +1 -1
  239. package/dist/post-components/{p-fac58cbd.entry.js → p-360d6bf1.entry.js} +1 -1
  240. package/dist/post-components/{p-D2ex14Ye.js → p-4-_BhJWV.js} +1 -1
  241. package/dist/post-components/{p-eca119d2.entry.js → p-44461143.entry.js} +1 -1
  242. package/dist/post-components/p-52e7344c.entry.js +1 -0
  243. package/dist/post-components/p-6d4be9dd.entry.js +1 -0
  244. package/dist/post-components/p-6dbe7870.entry.js +1 -0
  245. package/dist/post-components/{p-97c1f070.entry.js → p-751a949d.entry.js} +1 -1
  246. package/dist/post-components/{p-e54a6be0.entry.js → p-8e2427d4.entry.js} +1 -1
  247. package/dist/post-components/{p-3e83aa1f.entry.js → p-8fbbc68f.entry.js} +1 -1
  248. package/dist/post-components/{p-41b5dbfc.entry.js → p-91948813.entry.js} +1 -1
  249. package/dist/post-components/p-94064d19.entry.js +1 -0
  250. package/dist/post-components/{p-6cbb2e7f.entry.js → p-95ad4d06.entry.js} +1 -1
  251. package/dist/post-components/p-978e4664.entry.js +1 -0
  252. package/dist/post-components/p-B6uZASBE.js +1 -0
  253. package/dist/post-components/{p-CIbyqT6u.js → p-BDW1XHCO.js} +1 -1
  254. package/dist/post-components/p-CiOyV6Mo.js +1 -0
  255. package/dist/post-components/p-DE1aWdqx.js +2 -0
  256. package/dist/post-components/{p-8SvFxSp6.js → p-DMiERazc.js} +1 -1
  257. package/dist/post-components/{p-DH5JdN6V.js → p-NPUljV0P.js} +1 -1
  258. package/dist/post-components/p-SEWFpJgA.js +1 -0
  259. package/dist/post-components/{p-923439d1.entry.js → p-b7d6c951.entry.js} +1 -1
  260. package/dist/post-components/p-c152efb7.entry.js +1 -0
  261. package/dist/post-components/p-c9461efa.entry.js +1 -0
  262. package/dist/post-components/p-ddc585e6.entry.js +1 -0
  263. package/dist/post-components/{p-7ee4b829.entry.js → p-e5172886.entry.js} +1 -1
  264. package/dist/post-components/{p-9e240299.entry.js → p-e9484492.entry.js} +1 -1
  265. package/dist/post-components/p-ee1309c9.entry.js +1 -0
  266. package/dist/post-components/p-f1602e56.entry.js +1 -0
  267. package/dist/post-components/{p-5d20cbcb.entry.js → p-f1bf80d4.entry.js} +1 -1
  268. package/dist/post-components/p-fedcbf2d.entry.js +1 -0
  269. package/dist/post-components/post-components.css +2 -2
  270. package/dist/post-components/post-components.esm.js +1 -1
  271. package/dist/types/components/post-accordion-item/post-accordion-item.d.ts +0 -8
  272. package/dist/types/components/post-date-picker/accessibility-utils.d.ts +19 -0
  273. package/dist/types/components/post-date-picker/date-utils.d.ts +48 -0
  274. package/dist/types/components/post-date-picker/native-mask-element.d.ts +12 -0
  275. package/dist/types/components/post-date-picker/post-date-picker.d.ts +23 -62
  276. package/dist/types/components/post-header/post-header.d.ts +2 -1
  277. package/dist/types/components/post-language-menu/post-language-menu.d.ts +2 -1
  278. package/dist/types/components/post-menu/post-menu.d.ts +4 -4
  279. package/dist/types/components/post-popover/post-popover.d.ts +4 -5
  280. package/dist/types/components/post-popovercontainer/post-popovercontainer.d.ts +2 -2
  281. package/dist/types/components/post-side-navigation/post-side-navigation.d.ts +6 -0
  282. package/dist/types/components/post-side-navigation/side-navigation-styles.d.ts +2 -0
  283. package/dist/types/components/post-tab-item/post-tab-item.d.ts +8 -4
  284. package/dist/types/components/post-tab-panel/post-tab-panel.d.ts +1 -1
  285. package/dist/types/components/post-tabs/post-tabs.d.ts +37 -17
  286. package/dist/types/components/post-tooltip/post-tooltip.d.ts +4 -5
  287. package/dist/types/components.d.ts +90 -164
  288. package/dist/types/types/element-api.d.ts +3 -0
  289. package/hydrate/index.js +812 -596
  290. package/hydrate/index.mjs +812 -596
  291. package/package.json +11 -12
  292. package/dist/cjs/long-press-event-Dx21Ojod.js +0 -276
  293. package/dist/cjs/post-login-widget.cjs.entry.js +0 -92
  294. package/dist/collection/components/post-accordion-item/heading-levels.js +0 -1
  295. package/dist/collection/components/post-login-widget/post-login-widget.css +0 -1
  296. package/dist/collection/components/post-login-widget/post-login-widget.js +0 -218
  297. package/dist/collection/components/post-tab-item/post-tab-item.css +0 -1
  298. package/dist/components/long-press-event.js +0 -8
  299. package/dist/components/post-avatar2.js +0 -1
  300. package/dist/components/post-login-widget.d.ts +0 -11
  301. package/dist/components/post-login-widget.js +0 -1
  302. package/dist/components/react/p-BNgqqRsB.js +0 -8
  303. package/dist/components/react/p-C7aYEQh5.js +0 -1
  304. package/dist/components/react/p-CdhbouMD.js +0 -1
  305. package/dist/components/react/p-Ci08Eesw.js +0 -1
  306. package/dist/components/react/p-DWlDkwjY.js +0 -1
  307. package/dist/components/react/p-wqJxIo5L.js +0 -1
  308. package/dist/components/react/post-login-widget.d.ts +0 -11
  309. package/dist/components/react/post-login-widget.js +0 -1
  310. package/dist/esm/long-press-event-BNgqqRsB.js +0 -274
  311. package/dist/esm/package-CdhbouMD.js +0 -3
  312. package/dist/esm/post-login-widget.entry.js +0 -90
  313. package/dist/post-components/p-001f58d8.entry.js +0 -1
  314. package/dist/post-components/p-12c8b073.entry.js +0 -1
  315. package/dist/post-components/p-1839276a.entry.js +0 -1
  316. package/dist/post-components/p-28eeb5d8.entry.js +0 -1
  317. package/dist/post-components/p-6a1c4897.entry.js +0 -1
  318. package/dist/post-components/p-6d14f78a.entry.js +0 -1
  319. package/dist/post-components/p-6e8b6249.entry.js +0 -1
  320. package/dist/post-components/p-71918d59.entry.js +0 -1
  321. package/dist/post-components/p-8139b0cc.entry.js +0 -1
  322. package/dist/post-components/p-87ebb213.entry.js +0 -1
  323. package/dist/post-components/p-89da6378.entry.js +0 -1
  324. package/dist/post-components/p-8caaa149.entry.js +0 -1
  325. package/dist/post-components/p-BGeKgZqi.js +0 -2
  326. package/dist/post-components/p-BNgqqRsB.js +0 -8
  327. package/dist/post-components/p-CdhbouMD.js +0 -1
  328. package/dist/post-components/p-DiBqDD4N.js +0 -1
  329. package/dist/post-components/p-I6rSjhbA.js +0 -1
  330. package/dist/post-components/p-c905a97c.entry.js +0 -1
  331. package/dist/post-components/p-f9529d40.entry.js +0 -1
  332. package/dist/types/components/post-accordion-item/heading-levels.d.ts +0 -2
  333. package/dist/types/components/post-login-widget/post-login-widget.d.ts +0 -45
@@ -8,13 +8,16 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
8
8
  r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
9
9
  return c > 3 && r && Object.defineProperty(target, key, r), r;
10
10
  };
11
- import { BUDDHIST_CALENDAR_LOCALES, BUDDHIST_CALENDAR_YEAR_OFFSET, DateValue, FALLBACK_LANGUAGE_CODE, getLocaleTextDirection, IsoDate, isValidLocale, Required, Type, UNICODE_BIDI, } from "../../utils/index";
11
+ import { getNativeValue, NativeInputMaskElement, } from "./native-mask-element";
12
+ import { BUDDHIST_CALENDAR_LOCALES, DateValue, FALLBACK_LANGUAGE_CODE, getLocaleTextDirection, IsoDate, isValidLocale, Required, Type, UNICODE_BIDI, } from "../../utils/index";
12
13
  import { version } from "../../../../package";
13
- import { Build, h, Host, } from "@stencil/core";
14
+ import { Build, h, Host } from "@stencil/core";
14
15
  import AirDatepicker from "air-datepicker";
15
16
  import IMask from "imask";
17
+ import { mergeRenderCellResults, renderCellAccessibility } from "./accessibility-utils";
16
18
  import { airDatepickerLocales } from "./air-locales";
17
- import { DATE_FORMAT_KEYS, DATE_FORMAT_KEYS_REGEX, DATE_FORMAT_MAP, DATE_FORMAT_RANGE_SEPARATOR, DATE_FORMAT_SEPARATOR_REGEX, DATE_FORMAT_STRING_OPTIONS, TEXT_DIRECTION_MARKERS_REGEX, } from "./constants";
19
+ import { DATE_FORMAT_MAP, DATE_FORMAT_RANGE_SEPARATOR, DATE_FORMAT_SEPARATOR_REGEX, } from "./constants";
20
+ import { dateToIso, dateToString, getDateFormat, isoToDate, isValidDate, padIsoDate, stringToDate, } from "./date-utils";
18
21
  export class PostDatePicker {
19
22
  constructor() {
20
23
  /**
@@ -35,22 +38,23 @@ export class PostDatePicker {
35
38
  this.today = new Date();
36
39
  this.startDate = new Date();
37
40
  this.currentViewType = 'days';
41
+ this._isInternalUpdate = false;
42
+ this._lastInputValue = null;
38
43
  this.skipOnSelectCount = 0;
39
44
  this.skipFocusOnNextRender = false;
40
45
  this.handleInputBlur = () => {
41
46
  if (this.range) {
42
- const dates = this.inputMask.value.split(this.dateFormatRangeSeparator);
43
- const start = this.stringToDate(dates[0]);
44
- const end = this.stringToDate(dates[1]);
45
- const startValid = this.isValidDate(start);
46
- const endValid = this.isValidDate(end);
47
+ const parts = this.inputMask.value.split(this.dateFormatRangeSeparator);
48
+ const start = this.stringToDate(parts[0]);
49
+ const end = this.stringToDate(parts[1]);
50
+ const startValid = isValidDate(start);
51
+ const endValid = isValidDate(end);
47
52
  if (startValid && endValid) {
48
53
  // Check if user entered dates in wrong order
49
54
  const reversed = start > end;
50
55
  this.skipOnSelectCount = reversed ? 0 : 2; // don't skip if reversed
51
56
  this.dpInstance.selectDate([start, end]);
52
57
  this.dpInstance.setViewDate(start);
53
- this.postUpdateDates.emit([this.dateToIso(start), this.dateToIso(end)]);
54
58
  }
55
59
  else if (startValid && !endValid) {
56
60
  this.dpInstance.clear();
@@ -63,16 +67,16 @@ export class PostDatePicker {
63
67
  }
64
68
  else {
65
69
  const date = this.stringToDate(this.inputMask.value);
66
- if (this.isValidDate(date)) {
70
+ if (isValidDate(date)) {
67
71
  this.skipOnSelectCount = 1;
68
72
  this.dpInstance.selectDate(date);
69
73
  this.dpInstance.setViewDate(date);
70
- this.postUpdateDates.emit(this.dateToIso(date));
71
74
  }
72
75
  else {
73
76
  this.resetSelection();
74
77
  }
75
78
  }
79
+ this.emitInputEvents();
76
80
  };
77
81
  this.handlePrevNextClick = () => {
78
82
  this.skipFocusOnNextRender = true;
@@ -188,6 +192,17 @@ export class PostDatePicker {
188
192
  this.setActiveCell(newDate, true);
189
193
  }
190
194
  };
195
+ // Suppress native input events fired while typing when the ISO value hasn't actually changed
196
+ this.handleInputEvent = (e) => {
197
+ if (this.maskElement.allowEvents)
198
+ return;
199
+ const currentValue = this.serializeIsoValue();
200
+ if (currentValue === this._lastInputValue) {
201
+ e.stopImmediatePropagation();
202
+ return;
203
+ }
204
+ this._lastInputValue = currentValue;
205
+ };
191
206
  // Skip the month view and go directly to year selection
192
207
  this.forceTitleClickToYear = () => {
193
208
  if (this.dpInstance) {
@@ -211,12 +226,25 @@ export class PostDatePicker {
211
226
  }
212
227
  updateRange() {
213
228
  this.dpInstance?.update({ range: this.range });
214
- this.handleSelectedDates();
215
229
  this.updateMask();
230
+ if (this.range && this.dpInstance?.selectedDates.length > 0) {
231
+ const startDate = this.dpInstance.selectedDates[0];
232
+ this.dpInstance.clear();
233
+ this.dpInstance.selectDate(startDate);
234
+ }
235
+ else {
236
+ this.syncInputToDp();
237
+ }
238
+ }
239
+ updateMin() {
240
+ this.dpInstance?.update({ minDate: this.min ? isoToDate(this.min) : false });
241
+ }
242
+ updateMax() {
243
+ this.dpInstance?.update({ maxDate: this.max ? isoToDate(this.max) : false });
216
244
  }
217
245
  validateInline() {
218
- if (!this.inline && !this.dpInput) {
219
- console.error('A non-inline date picker should contain one input');
246
+ if (!this.dpInput) {
247
+ console.error('The date picker must contain one input element');
220
248
  }
221
249
  }
222
250
  /**
@@ -224,6 +252,7 @@ export class PostDatePicker {
224
252
  */
225
253
  async show() {
226
254
  if (this.popoverRef) {
255
+ this.dpInstance?.setCurrentView('days');
227
256
  await this.popoverRef.show(this.dpInput);
228
257
  this.enhanceAccessibility();
229
258
  this.host.shadowRoot.removeEventListener('keydown', this.handleTab, true); // remove before adding
@@ -251,7 +280,8 @@ export class PostDatePicker {
251
280
  get systemLocale() {
252
281
  if (Build.isServer)
253
282
  return FALLBACK_LANGUAGE_CODE;
254
- return this.host.closest('[lang]')?.getAttribute('lang') ?? FALLBACK_LANGUAGE_CODE;
283
+ const closestLang = this.host.closest('[lang]')?.getAttribute('lang');
284
+ return closestLang ?? navigator.language ?? FALLBACK_LANGUAGE_CODE;
255
285
  }
256
286
  /**
257
287
  * Get the locale code to use for the date picker, ensuring it is valid and applying fallback if necessary.
@@ -271,17 +301,7 @@ export class PostDatePicker {
271
301
  * with format keys (y, m, d). For example, it will return "dd.mm.yyyy" for "de-CH" locale and "mm/dd/yyyy" for "en-US" locale.
272
302
  */
273
303
  get dateFormat() {
274
- const date = new Date(Object.values(DATE_FORMAT_MAP).join('-'));
275
- // get the locale date format e.g. `22.11.3333` for `de-CH` or `11/22/3333` for `en-US`
276
- let localeDateString = date.toLocaleDateString(this.localeCode, DATE_FORMAT_STRING_OPTIONS);
277
- // replace the date parts (3333, 11, 22) with the corresponding format keys (y, m, d)
278
- for (const [key, value] of Object.entries(DATE_FORMAT_MAP)) {
279
- // for Thai locale, the year is in Buddhist calendar which is 543 years ahead of Gregorian calendar, so we need to adjust the year value accordingly
280
- localeDateString = localeDateString.replace(this.isBuddhistCalendar && value.length === 4
281
- ? (Number(value) + BUDDHIST_CALENDAR_YEAR_OFFSET).toString()
282
- : value, key);
283
- }
284
- return localeDateString;
304
+ return getDateFormat(this.localeCode, this.isBuddhistCalendar);
285
305
  }
286
306
  /**
287
307
  * Determine the text direction (ltr or rtl) based on the language code, to apply the correct styles and layout to the date picker.
@@ -315,70 +335,16 @@ export class PostDatePicker {
315
335
  return module.default;
316
336
  }
317
337
  /**
318
- * Convert a date object to a localized date string and vice versa.
319
- * @param date A localtime date object.
320
- * @returns A localized date string, depending on the given `localeCode` and the given `options`.
338
+ * Convert a date object to a localized date string, bound to the current locale.
321
339
  */
322
340
  dateToString(date) {
323
- const dateString = date.toLocaleDateString(this.localeCode, DATE_FORMAT_STRING_OPTIONS);
324
- const yearString = date.getFullYear().toString();
325
- if (yearString.length < 4) {
326
- return dateString.replace(yearString, yearString.padStart(4, '0'));
327
- }
328
- return dateString;
341
+ return dateToString(date, this.localeCode);
329
342
  }
330
343
  /**
331
- * Convert a localized date string to a date object.
332
- * The date string should be in the same format as the date picker's `dateFormat`, which depends on the given `localeCode`.
333
- * @param localeDateString A localized date string.
334
- * @returns A localtime date object.
344
+ * Convert a localized date string to a date object, bound to the current locale and format.
335
345
  */
336
346
  stringToDate(localeDateString) {
337
- // Match the separator chars in the date format (e.g. "." for "dd.mm.yyyy", etc.).
338
- const dateSeparator = this.dateFormat.match(DATE_FORMAT_SEPARATOR_REGEX)[0];
339
- // Remove the text direction markers, split the date string into its parts (e.g. ["31", "01", "2026"], etc.)
340
- // and make sure its values only contains digits (e.g. for "bg-BG", etc.).
341
- const dateParts = localeDateString
342
- .replace(TEXT_DIRECTION_MARKERS_REGEX, '')
343
- .split(dateSeparator)
344
- .map(p => p.replaceAll(/[^\d]/g, ''));
345
- // Split the dateFormat into its parts to get the year, month, day order (e.g. ["d", "m", "y"], etc.).
346
- // Removing everything else but the DATE_FORMAT_KEYS is necessary to support date formats with additional chars (e.g. "d.m.y г.", etc.).
347
- const formatParts = this.dateFormat.replace(DATE_FORMAT_KEYS_REGEX, '').split('');
348
- // Map the datePart values to their corresponding keys (e.g. y, m, d),
349
- // to construct an ISO date string (e.g. "2026-01-31") that can be parsed by the Date constructor.
350
- // This is necessary because different locale date formats may have different orders (e.g. "ymd", "dmy", "mdy", etc.).
351
- const { y, m, d } = DATE_FORMAT_KEYS.reduce((parts, key) => ({
352
- ...parts,
353
- [key]: dateParts[formatParts.indexOf(key)],
354
- }), {});
355
- // Adjust for Thai Buddhist calendar
356
- const year = this.isBuddhistCalendar
357
- ? (Number(y) - BUDDHIST_CALENDAR_YEAR_OFFSET).toString()
358
- : y;
359
- return this.isoToDate([year, m, d].join('-'));
360
- }
361
- /**
362
- * Convert a date object to an ISO 8601 formatted date string (YYYY-MM-DD) and vice versa.
363
- * @param date A localtime date object.
364
- * @returns An iso formatted, localtime date string.
365
- */
366
- dateToIso(date) {
367
- // The swedish locale (`sv`) happens to format the date in the exact ISO format (YYYY-MM-DD),
368
- // so we can use it as a shortcut instead of manually constructing the string from the date parts.
369
- return date.toLocaleDateString('sv', DATE_FORMAT_STRING_OPTIONS);
370
- }
371
- /**
372
- * Convert an ISO 8601 formatted date string (YYYY-MM-DD) to a localtime date object.
373
- * @param isoDateString An iso formatted, localtime date string.
374
- * @returns A localtime date object.
375
- */
376
- isoToDate(isoDateString) {
377
- return new Date(`${this.padIsoDate(isoDateString)}T00:00`);
378
- }
379
- padIsoDate(isoDateString) {
380
- const valueParts = isoDateString.split('-');
381
- return `${valueParts[0].padStart(4, '0')}-${valueParts[1]}-${valueParts[2]}`;
347
+ return stringToDate(localeDateString, this.dateFormat, this.isBuddhistCalendar);
382
348
  }
383
349
  setupInputObserver() {
384
350
  if (typeof MutationObserver === 'undefined')
@@ -518,7 +484,9 @@ export class PostDatePicker {
518
484
  });
519
485
  body.removeEventListener('keydown', this.handleGridKeydown);
520
486
  body.addEventListener('keydown', this.handleGridKeydown);
521
- this.setActiveCell((this.selectedStartDate && this.isoToDate(this.selectedStartDate)) || this.today, focusOnDate);
487
+ const dates = this.getIsoDates();
488
+ const selectedDate = dates[0] ? isoToDate(dates[0]) : null;
489
+ this.setActiveCell(selectedDate || this.today, focusOnDate);
522
490
  }
523
491
  /**
524
492
  * Set up the masks on the inputs to reflect the date pickers
@@ -526,7 +494,7 @@ export class PostDatePicker {
526
494
  setUpMask() {
527
495
  // WARNING: using the DATE_FORMAT_SEPARATOR_REGEX is mandatory here,
528
496
  // because `this.dateFormat` can possibly contain unicode bidi characters!
529
- const maskPattern = this.dateFormat; //.replace(DATE_FORMAT_SEPARATOR_REGEX, m => `${m}\``);
497
+ const maskPattern = this.dateFormat.replace(DATE_FORMAT_SEPARATOR_REGEX, m => `${m}\``);
530
498
  const baseMaskOptions = {
531
499
  mask: Date,
532
500
  pattern: maskPattern,
@@ -535,7 +503,7 @@ export class PostDatePicker {
535
503
  blocks: {
536
504
  y: {
537
505
  mask: IMask.MaskedRange,
538
- from: 101, // dates from 0100-01-31 and earlier are causing issues in air-datepicker
506
+ from: 1000,
539
507
  to: 9999,
540
508
  maxLength: 4,
541
509
  placeholderChar: Object.keys(DATE_FORMAT_MAP)[0],
@@ -553,8 +521,10 @@ export class PostDatePicker {
553
521
  placeholderChar: Object.keys(DATE_FORMAT_MAP)[2],
554
522
  },
555
523
  },
556
- min: this.min ? new Date(`${this.padIsoDate(this.min)}T00:00`) : null,
557
- max: this.max ? new Date(`${this.padIsoDate(this.max)}T00:00`) : null,
524
+ min: this.min ? new Date(`${padIsoDate(this.min)}T00:00`) : null,
525
+ max: this.max ? new Date(`${padIsoDate(this.max)}T00:00`) : null,
526
+ autofix: true,
527
+ eager: true,
558
528
  };
559
529
  const singleMaskOptions = {
560
530
  ...baseMaskOptions,
@@ -562,7 +532,7 @@ export class PostDatePicker {
562
532
  overwrite: true,
563
533
  };
564
534
  const rangeMaskOptions = {
565
- mask: `from${this.dateFormatRangeSeparator}to`,
535
+ mask: `from\`${this.dateFormatRangeSeparator}to`,
566
536
  blocks: {
567
537
  from: { ...baseMaskOptions },
568
538
  to: { ...baseMaskOptions },
@@ -570,29 +540,109 @@ export class PostDatePicker {
570
540
  lazy: false,
571
541
  overwrite: true,
572
542
  };
573
- this.inputMask = IMask(this.dpInput, this.range ? rangeMaskOptions : singleMaskOptions);
543
+ this.maskElement = new NativeInputMaskElement(this.dpInput);
544
+ this.inputMask = IMask(this.maskElement, this.range ? rangeMaskOptions : singleMaskOptions);
574
545
  }
575
546
  updateMask() {
576
547
  if (!this.inline) {
577
548
  this.inputMask.destroy();
578
549
  this.setUpMask();
550
+ this.setupValueOverride();
579
551
  if (this.dpInstance.selectedDates.length > 0) {
580
- if (this.range) {
581
- this.inputMask.value = this.dpInstance.selectedDates
582
- .map(d => this.dateToString(d))
583
- .join(this.dateFormatRangeSeparator);
584
- }
585
- else {
586
- this.inputMask.value = this.dateToString(this.dpInstance.selectedDates[0]);
587
- }
552
+ this.inputMask.value = this.formatDatesForMask(this.dpInstance.selectedDates);
588
553
  }
589
554
  }
590
555
  }
556
+ // Override input.value so external consumers get ISO strings
557
+ // while iMask continues to work with locale-formatted display text via NativeInputMaskElement
558
+ setupValueOverride() {
559
+ if (!this.dpInput)
560
+ return;
561
+ Object.defineProperty(this.dpInput, 'value', {
562
+ get: this.getInputIsoValue.bind(this),
563
+ set: this.setInputIsoValue.bind(this),
564
+ configurable: true,
565
+ enumerable: true,
566
+ });
567
+ }
568
+ getIsoDates() {
569
+ const nativeVal = getNativeValue(this.dpInput);
570
+ const DIGITS_PER_DATE = 8; // dd(2) + mm(2) + yyyy(4)
571
+ if (!this.range) {
572
+ const digits = nativeVal?.replaceAll(/\D/g, '') ?? '';
573
+ if (digits.length < DIGITS_PER_DATE)
574
+ return [];
575
+ const date = this.stringToDate(nativeVal);
576
+ return date && isValidDate(date) ? [dateToIso(date)] : [];
577
+ }
578
+ const parts = nativeVal?.split(this.dateFormatRangeSeparator) ?? [];
579
+ const startDigits = parts[0]?.replaceAll(/\D/g, '') ?? '';
580
+ const endDigits = parts[1]?.replaceAll(/\D/g, '') ?? '';
581
+ const start = startDigits.length >= DIGITS_PER_DATE ? this.stringToDate(parts[0]) : null;
582
+ const end = endDigits.length >= DIGITS_PER_DATE ? this.stringToDate(parts[1]) : null;
583
+ const result = [];
584
+ if (start && isValidDate(start))
585
+ result.push(dateToIso(start));
586
+ if (end && isValidDate(end))
587
+ result.push(dateToIso(end));
588
+ return result;
589
+ }
590
+ getInputIsoValue() {
591
+ const dates = this.getIsoDates();
592
+ if (!this.range) {
593
+ return dates[0] ?? '';
594
+ }
595
+ return dates;
596
+ }
597
+ serializeIsoValue() {
598
+ return JSON.stringify(this.getIsoDates());
599
+ }
600
+ setInputIsoValue(val) {
601
+ if (this._isInternalUpdate)
602
+ return;
603
+ this._isInternalUpdate = true;
604
+ try {
605
+ let isoValues;
606
+ if (Array.isArray(val)) {
607
+ isoValues = val;
608
+ }
609
+ else {
610
+ isoValues = val ? val.split(',').map(s => s.trim()) : [];
611
+ }
612
+ const dates = isoValues
613
+ .filter(Boolean)
614
+ .map(iso => isoToDate(iso))
615
+ .filter(d => d && isValidDate(d));
616
+ if (dates.length === 0) {
617
+ this.inputMask.value = '';
618
+ this.dpInstance?.clear();
619
+ return;
620
+ }
621
+ this.inputMask.value = this.formatDatesForMask(dates);
622
+ this.dpInstance?.clear();
623
+ this.dpInstance?.selectDate(this.range ? dates : dates[0]);
624
+ this.dpInstance?.setViewDate(dates[0]);
625
+ }
626
+ finally {
627
+ this._isInternalUpdate = false;
628
+ }
629
+ }
591
630
  async configDatePicker() {
592
631
  const locale = await this.airLocale();
593
- if (!this.inline) {
594
- this.dpInput = this.host.querySelector('input');
595
- this.setUpMask();
632
+ this.dpInput = this.host.querySelector('input');
633
+ if (!this.dpInput) {
634
+ console.error('The post-date-picker component requires a slotted <input> element.');
635
+ return;
636
+ }
637
+ this.dpInput.type = this.inline ? 'hidden' : 'text';
638
+ // Capture and clear initial value before mask setup, since iMask would
639
+ // interpret an ISO string as locale-formatted text and garble it
640
+ const initialValue = this.dpInput.value;
641
+ this.dpInput.value = '';
642
+ this.setUpMask();
643
+ this.setupValueOverride();
644
+ if (initialValue) {
645
+ this.setInputIsoValue(initialValue);
596
646
  }
597
647
  this.dpContainer = this.host.shadowRoot.querySelector('.datepicker-container');
598
648
  if (this.dpContainer) {
@@ -611,8 +661,8 @@ export class PostDatePicker {
611
661
  showOtherMonths: false,
612
662
  moveToOtherMonthsOnSelect: true,
613
663
  startDate: this.startDate,
614
- minDate: this.min,
615
- maxDate: this.max,
664
+ minDate: this.min ? isoToDate(this.min) : undefined,
665
+ maxDate: this.max ? isoToDate(this.max) : undefined,
616
666
  locale: locale,
617
667
  dateFormat: locale.dateFormat,
618
668
  firstDay: locale.firstDay,
@@ -629,8 +679,14 @@ export class PostDatePicker {
629
679
  this.updateNavigationButtonLabels();
630
680
  },
631
681
  onSelect: ({ date }) => {
632
- if (!date || (Array.isArray(date) && date.length === 0))
682
+ // Handle deselection (clicking the same date again)
683
+ if (!date || (Array.isArray(date) && date.length === 0)) {
684
+ if (this._isInternalUpdate)
685
+ return;
686
+ this.inputMask.value = '';
687
+ this.emitInputEvents();
633
688
  return;
689
+ }
634
690
  this.getCells().forEach(c => {
635
691
  c.setAttribute('aria-selected', c.classList.contains('-selected-') ? 'true' : 'false');
636
692
  });
@@ -639,33 +695,19 @@ export class PostDatePicker {
639
695
  this.skipOnSelectCount--;
640
696
  return;
641
697
  }
642
- // update props
643
- if (Array.isArray(date) && date.length === 2) {
644
- this.selectedStartDate = this.dateToIso(date[0]);
645
- this.selectedEndDate = this.dateToIso(date[1]);
646
- }
647
- else if (!Array.isArray(date)) {
648
- this.selectedStartDate = this.dateToIso(date);
649
- this.selectedEndDate = undefined;
698
+ // If this selection was triggered by the value setter, don't re-emit
699
+ if (this._isInternalUpdate)
700
+ return;
701
+ const dates = Array.isArray(date) ? date : [date];
702
+ const isPartialRange = this.range && dates.length === 1;
703
+ // Update the input mask value and emit events
704
+ this.inputMask.value = this.formatDatesForMask(dates);
705
+ this.emitInputEvents();
706
+ // If range & only one date has been selected, user should stay in the DP
707
+ if (isPartialRange) {
708
+ return;
650
709
  }
651
- this.postUpdateDates.emit(Array.isArray(date) ? date.map(d => this.dateToIso(d)) : this.dateToIso(date));
652
- // Assign value to the input, close the popover and focus on the input
653
- if (this.dpInput) {
654
- if (Array.isArray(date)) {
655
- this.inputMask.value = date
656
- .map(d => this.dateToString(d))
657
- .join(this.dateFormatRangeSeparator);
658
- this.updateInputValue();
659
- }
660
- else if (date) {
661
- // If there is a date, set it to the input. No date = same date as before
662
- this.inputMask.value = this.dateToString(date);
663
- this.updateInputValue();
664
- }
665
- // If range & only one date has been selected, user should stay in the DP
666
- if (this.range && Array.isArray(date) && date.length === 1) {
667
- return;
668
- }
710
+ if (!this.inline) {
669
711
  this.popoverRef?.hide();
670
712
  requestAnimationFrame(() => this.dpTrigger.focus());
671
713
  }
@@ -674,41 +716,46 @@ export class PostDatePicker {
674
716
  this.enhanceAccessibility();
675
717
  },
676
718
  onRenderCell: data => {
677
- const internal = this.internalOnRenderCell(data);
678
- const custom = this.renderCellCallback?.(data);
679
- return this.mergeRenderCellResults(internal, custom);
719
+ const internal = renderCellAccessibility(data, this.localeCode);
720
+ const custom = this.cellConfig?.(data.date, data.cellType);
721
+ return mergeRenderCellResults(internal, custom);
680
722
  },
681
723
  };
682
724
  this.dpInstance = new AirDatepicker(this.dpContainer, options);
683
725
  this.reorderNavigation();
684
726
  this.prevBtn?.addEventListener('click', this.handlePrevNextClick);
685
727
  this.nextBtn?.addEventListener('click', this.handlePrevNextClick);
686
- this.handleSelectedDates();
728
+ this.syncInputToDp();
687
729
  }
688
730
  }
689
- updateInputValue() {
731
+ emitInputEvents() {
690
732
  this.inputMask.updateValue();
691
- // Emit the native input and change events
733
+ const currentValue = this.serializeIsoValue();
734
+ if (currentValue === this._lastInputValue) {
735
+ return;
736
+ }
737
+ this._lastInputValue = currentValue;
738
+ this.maskElement.allowEvents = true;
692
739
  this.dpInput.dispatchEvent(new InputEvent('input', { bubbles: true }));
693
740
  this.dpInput.dispatchEvent(new InputEvent('change', { bubbles: true }));
741
+ this.maskElement.allowEvents = false;
694
742
  }
695
- handleSelectedDates() {
743
+ formatDatesForMask(dates) {
744
+ if (dates.length === 0)
745
+ return '';
696
746
  if (this.range) {
697
- if ((this.selectedStartDate && !this.selectedEndDate) ||
698
- (!this.selectedStartDate && this.selectedEndDate)) {
699
- console.error('The range date picker expects either no selected dates or both of them defined.');
700
- }
701
- else if (this.selectedStartDate && this.selectedEndDate) {
702
- this.dpInstance.selectDate([
703
- this.isoToDate(this.selectedStartDate),
704
- this.isoToDate(this.selectedEndDate),
705
- ]);
706
- }
747
+ return dates.map(d => this.dateToString(d)).join(this.dateFormatRangeSeparator);
707
748
  }
708
- else {
709
- if (this.selectedStartDate && this.isoToDate(this.selectedStartDate)) {
710
- this.dpInstance.selectDate(this.isoToDate(this.selectedStartDate));
711
- }
749
+ return this.dateToString(dates[0]);
750
+ }
751
+ syncInputToDp() {
752
+ const isoDates = this.getIsoDates();
753
+ if (isoDates.length === 0)
754
+ return;
755
+ const dates = isoDates.map(iso => isoToDate(iso)).filter(d => d && isValidDate(d));
756
+ if (dates.length > 0) {
757
+ this.dpInstance.selectDate(this.range ? dates : dates[0]);
758
+ this.dpInstance.setViewDate(dates[0]);
712
759
  }
713
760
  }
714
761
  attachTitleBtnListener() {
@@ -720,67 +767,6 @@ export class PostDatePicker {
720
767
  this.titleBtn.addEventListener('click', this.forceTitleClickToYear, { capture: true });
721
768
  });
722
769
  }
723
- /**
724
- * Add role and aria-label to each grid cell
725
- */
726
- internalOnRenderCell({ date, cellType }) {
727
- if (cellType === 'day') {
728
- return {
729
- attrs: {
730
- 'role': 'gridcell',
731
- 'aria-label': date.toLocaleDateString(this.localeCode, {
732
- weekday: 'long',
733
- year: 'numeric',
734
- month: 'long',
735
- day: 'numeric',
736
- }),
737
- },
738
- };
739
- }
740
- else if (cellType === 'month') {
741
- return {
742
- attrs: {
743
- 'role': 'gridcell',
744
- 'aria-label': date.toLocaleDateString(this.localeCode, {
745
- year: 'numeric',
746
- month: 'long',
747
- }),
748
- },
749
- };
750
- }
751
- else if (cellType === 'year') {
752
- return {
753
- attrs: {
754
- 'role': 'gridcell',
755
- 'aria-label': date.toLocaleDateString(this.localeCode, {
756
- year: 'numeric',
757
- }),
758
- },
759
- };
760
- }
761
- }
762
- /**
763
- * Merge the internal render cell (adding of role + aria-label attributes) and the user's render cell (disabling dates, etc.)
764
- * @param base Internal render cell
765
- * @param custom User render cell
766
- * @returns Merged render cell
767
- */
768
- mergeRenderCellResults(base, custom) {
769
- if (!base)
770
- return custom;
771
- if (!custom)
772
- return base;
773
- return {
774
- ...base,
775
- ...custom,
776
- attrs: {
777
- ...(base.attrs ?? {}),
778
- ...(custom.attrs ?? {}),
779
- },
780
- classes: [base.classes, custom.classes].filter(Boolean).join(' '),
781
- disabled: base.disabled || custom.disabled,
782
- };
783
- }
784
770
  setupNavObserver() {
785
771
  if (typeof MutationObserver === 'undefined')
786
772
  return;
@@ -826,17 +812,16 @@ export class PostDatePicker {
826
812
  });
827
813
  }
828
814
  addInputListener() {
829
- this.dpInput.addEventListener('blur', this.handleInputBlur);
815
+ this._lastInputValue = this.serializeIsoValue();
816
+ if (!this.inline) {
817
+ this.dpInput.addEventListener('blur', this.handleInputBlur);
818
+ }
819
+ this.dpInput.addEventListener('input', this.handleInputEvent);
830
820
  }
831
821
  resetSelection() {
832
822
  this.skipOnSelectCount = 0;
833
823
  this.dpInstance.clear();
834
824
  this.dpInstance.setViewDate(this.today);
835
- this.selectedStartDate = undefined;
836
- this.selectedEndDate = undefined;
837
- }
838
- isValidDate(date) {
839
- return date instanceof Date && !Number.isNaN(date.getTime());
840
825
  }
841
826
  syncDatePickerState() {
842
827
  this.inputDisabled = this.dpInput.disabled;
@@ -848,15 +833,11 @@ export class PostDatePicker {
848
833
  this.setupInputObserver();
849
834
  this.validateLocale();
850
835
  this.validateInline();
836
+ this.addInputListener();
837
+ this.syncDatePickerState();
851
838
  if (this.inline) {
852
839
  requestAnimationFrame(() => this.enhanceAccessibility(false));
853
840
  }
854
- else {
855
- this.addInputListener();
856
- requestAnimationFrame(() => {
857
- this.syncDatePickerState();
858
- });
859
- }
860
841
  }
861
842
  disconnectedCallback() {
862
843
  this.host.shadowRoot?.removeEventListener('keydown', this.handleTab, true);
@@ -866,6 +847,7 @@ export class PostDatePicker {
866
847
  this.prevBtn?.removeEventListener('click', this.handlePrevNextClick);
867
848
  this.nextBtn?.removeEventListener('click', this.handlePrevNextClick);
868
849
  this.dpInput?.removeEventListener('blur', this.handleInputBlur);
850
+ this.dpInput?.removeEventListener('input', this.handleInputEvent);
869
851
  this.gridObserver?.disconnect();
870
852
  this.navObserver?.disconnect();
871
853
  this.inputObserver?.disconnect();
@@ -875,11 +857,11 @@ export class PostDatePicker {
875
857
  }
876
858
  }
877
859
  render() {
878
- return (h(Host, { key: 'c4cc0eb142d566fa9ba70272cd9ff21c433c4137', "data-version": version }, this.inline && h("div", { key: '8611e4dcfc77187799261e6187304ac1cf46b7c2', class: "datepicker-container", dir: this.textDirection }), !this.inline && (h("div", { key: '5581acfe5acf7ae1d1e445c53870b235f4b18646', dir: this.textDirection }, h("div", { key: 'e24d9772613c92916b6d38e79352fef2c81d9511', class: {
860
+ return (h(Host, { key: 'e5eeee8c1cb2cc1f63bdf74077a23410e7fdc8e9', "data-version": version }, this.inline && (h("div", { key: '9518bcce6cfd31747c03fb46f8c27ebc58f3dbfc', dir: this.textDirection }, h("slot", { key: '4cf06d1fc9ff12d8f471860166a4561218e3a8c3' }), h("div", { key: '79b7a64d5f4f0ed1ec8e484f93f985da7f060ec2', class: "datepicker-container" }))), !this.inline && (h("div", { key: '2c579c73dcbfab1fc3ba207a97638415815f317d', dir: this.textDirection }, h("div", { key: '80969517b53c43a6c94e2452220f344f3ab49e34', class: {
879
861
  'calendar-input': !this.range,
880
862
  'calendar-input-range': this.range,
881
863
  'disabled': this.inputDisabled,
882
- } }, h("slot", { key: 'c844d9615f779430969e5d794a903aa30f06f24c' }), h("button", { key: 'cae3200ceb21aa35b3dd443c19875af4cbdc82a4', onClick: () => this.show(), "aria-haspopup": "true", "aria-label": this.textToggleCalendar, disabled: this.inputDisabled, ref: e => (this.dpTrigger = e) }, h("post-icon", { key: 'c6c51b1021aee6726bb01c24ec0fd532e4a41e49', name: "calendar" }))), h("post-popovercontainer", { key: '1c4bccada0ae38c80fa20ae7602510bd0c841757', placement: "bottom-end", offset: PostDatePicker.FLYOUT_OFFSET, ref: e => (this.popoverRef = e) }, h("div", { key: '8dcf519dbf39b8312275ade1b267dc9660c0ffb4', class: "datepicker-container" }))))));
864
+ } }, h("slot", { key: 'a52d67dd7a762f7811c574c54a5e04864a6d7d66' }), h("button", { key: '68f891aa03c93ef515430cb7849184eba54bd03e', onClick: () => this.show(), "aria-haspopup": "true", "aria-label": this.textToggleCalendar, disabled: this.inputDisabled, ref: e => (this.dpTrigger = e) }, h("post-icon", { key: '5d9544388a2017906575e1dba8186641a556d09f', name: "calendar" }))), h("post-popovercontainer", { key: '646481b281bb1df3e856fab125fad3eb6bcc3f6d', placement: "bottom-end", offset: PostDatePicker.FLYOUT_OFFSET, ref: e => (this.popoverRef = e) }, h("div", { key: '3482284992582511e01ac60832ca119f54905b56', class: "datepicker-container" }))))));
883
865
  }
884
866
  static get is() { return "post-date-picker"; }
885
867
  static get encapsulation() { return "shadow"; }
@@ -935,44 +917,6 @@ export class PostDatePicker {
935
917
  "attribute": "range",
936
918
  "defaultValue": "false"
937
919
  },
938
- "selectedStartDate": {
939
- "type": "string",
940
- "mutable": true,
941
- "complexType": {
942
- "original": "string",
943
- "resolved": "string",
944
- "references": {}
945
- },
946
- "required": false,
947
- "optional": true,
948
- "docs": {
949
- "tags": [],
950
- "text": "The date picker's selected date. If in range mode, the selected start date.\nMust be a valid date in ISO 8601 format (YYYY-MM-DD)."
951
- },
952
- "getter": false,
953
- "setter": false,
954
- "reflect": false,
955
- "attribute": "selected-start-date"
956
- },
957
- "selectedEndDate": {
958
- "type": "string",
959
- "mutable": true,
960
- "complexType": {
961
- "original": "string",
962
- "resolved": "string",
963
- "references": {}
964
- },
965
- "required": false,
966
- "optional": true,
967
- "docs": {
968
- "tags": [],
969
- "text": "The date picker's selected end date (for range date picker only).\nMust be a valid date in ISO 8601 format (YYYY-MM-DD)."
970
- },
971
- "getter": false,
972
- "setter": false,
973
- "reflect": false,
974
- "attribute": "selected-end-date"
975
- },
976
920
  "min": {
977
921
  "type": "string",
978
922
  "mutable": false,
@@ -985,7 +929,7 @@ export class PostDatePicker {
985
929
  "optional": true,
986
930
  "docs": {
987
931
  "tags": [],
988
- "text": "Minimun possible date to select. Must be a valid date in ISO 8601 format (YYYY-MM-DD)."
932
+ "text": "Minimum possible date to select. Must be a valid date in ISO 8601 format (YYYY-MM-DD)."
989
933
  },
990
934
  "getter": false,
991
935
  "setter": false,
@@ -1011,17 +955,16 @@ export class PostDatePicker {
1011
955
  "reflect": false,
1012
956
  "attribute": "max"
1013
957
  },
1014
- "renderCellCallback": {
958
+ "cellConfig": {
1015
959
  "type": "unknown",
1016
960
  "mutable": false,
1017
961
  "complexType": {
1018
- "original": "AirDatepickerCustomOptions['onRenderCell']",
1019
- "resolved": "(data: { date: Date; cellType: AirDatepickerViewsSingle; datepicker: AirDatepicker<HTMLDivElement>; }) => void",
962
+ "original": "(\n date: Date,\n cellType: 'day' | 'month' | 'year',\n ) => { disabled?: boolean; classes?: string } | void",
963
+ "resolved": "(date: Date, cellType: \"day\" | \"month\" | \"year\") => void | { disabled?: boolean; classes?: string; }",
1020
964
  "references": {
1021
- "AirDatepickerCustomOptions": {
1022
- "location": "local",
1023
- "path": "/home/runner/work/design-system/design-system/packages/components/src/components/post-date-picker/post-date-picker.tsx",
1024
- "id": "src/components/post-date-picker/post-date-picker.tsx::AirDatepickerCustomOptions"
965
+ "Date": {
966
+ "location": "global",
967
+ "id": "global::Date"
1025
968
  }
1026
969
  }
1027
970
  },
@@ -1029,7 +972,7 @@ export class PostDatePicker {
1029
972
  "optional": true,
1030
973
  "docs": {
1031
974
  "tags": [],
1032
- "text": "Used to extend the existing on render cell to disable dates."
975
+ "text": "A callback to customize individual calendar cells, e.g. to disable specific dates or add CSS classes."
1033
976
  },
1034
977
  "getter": false,
1035
978
  "setter": false
@@ -1199,7 +1142,7 @@ export class PostDatePicker {
1199
1142
  "optional": true,
1200
1143
  "docs": {
1201
1144
  "tags": [],
1202
- "text": "Label for the toggle button that opens the calendar.\nIt is only needed when the calendar is connected to the input."
1145
+ "text": "Label for the toggle button that opens the calendar.\nIt is only needed when the calendar is not inline."
1203
1146
  },
1204
1147
  "getter": false,
1205
1148
  "setter": false,
@@ -1215,24 +1158,6 @@ export class PostDatePicker {
1215
1158
  "startDate": {}
1216
1159
  };
1217
1160
  }
1218
- static get events() {
1219
- return [{
1220
- "method": "postUpdateDates",
1221
- "name": "postUpdateDates",
1222
- "bubbles": true,
1223
- "cancelable": true,
1224
- "composed": true,
1225
- "docs": {
1226
- "tags": [],
1227
- "text": "An event emitted when a date or a range of dates have been selected."
1228
- },
1229
- "complexType": {
1230
- "original": "string | string[]",
1231
- "resolved": "string | string[]",
1232
- "references": {}
1233
- }
1234
- }];
1235
- }
1236
1161
  static get methods() {
1237
1162
  return {
1238
1163
  "show": {
@@ -1282,6 +1207,12 @@ export class PostDatePicker {
1282
1207
  }, {
1283
1208
  "propName": "range",
1284
1209
  "methodName": "updateRange"
1210
+ }, {
1211
+ "propName": "min",
1212
+ "methodName": "updateMin"
1213
+ }, {
1214
+ "propName": "max",
1215
+ "methodName": "updateMax"
1285
1216
  }, {
1286
1217
  "propName": "inline",
1287
1218
  "methodName": "validateInline"
@@ -1289,14 +1220,6 @@ export class PostDatePicker {
1289
1220
  }
1290
1221
  }
1291
1222
  PostDatePicker.FLYOUT_OFFSET = 4;
1292
- __decorate([
1293
- DateValue(),
1294
- IsoDate()
1295
- ], PostDatePicker.prototype, "selectedStartDate", void 0);
1296
- __decorate([
1297
- DateValue(),
1298
- IsoDate()
1299
- ], PostDatePicker.prototype, "selectedEndDate", void 0);
1300
1223
  __decorate([
1301
1224
  DateValue(),
1302
1225
  IsoDate()