@swisspost/design-system-components 10.0.1 → 10.2.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 (232) hide show
  1. package/dist/cjs/{create-validator-decorator-4dRrOF30.js → create-validator-decorator-BchTP-YG.js} +1 -1
  2. package/dist/cjs/{index-BqngpwGa.js → index-BDBlw92l.js} +1 -1
  3. package/dist/cjs/loader.cjs.js +2 -2
  4. package/dist/cjs/{one-of-D1veqtsm.js → one-of-IgKJFMA_.js} +1 -1
  5. package/dist/cjs/{package-BfNFDLlB.js → package-2syswPDO.js} +1 -1
  6. package/dist/cjs/{pattern-B7VKOu5m.js → pattern-BCnL1qK3.js} +1 -1
  7. package/dist/cjs/post-accordion_2.cjs.entry.js +5 -5
  8. package/dist/cjs/post-autocomplete.cjs.entry.js +15 -6
  9. package/dist/cjs/post-avatar.cjs.entry.js +6 -6
  10. package/dist/cjs/post-back-to-top.cjs.entry.js +5 -5
  11. package/dist/cjs/post-banner.cjs.entry.js +4 -4
  12. package/dist/cjs/post-breadcrumb-item.cjs.entry.js +7 -7
  13. package/dist/cjs/post-breadcrumbs.cjs.entry.js +6 -6
  14. package/dist/cjs/post-closebutton_14.cjs.entry.js +20 -21
  15. package/dist/cjs/post-collapsible_2.cjs.entry.js +4 -4
  16. package/dist/cjs/post-components.cjs.js +2 -2
  17. package/dist/cjs/post-date-picker.cjs.entry.js +62 -15
  18. package/dist/cjs/post-footer.cjs.entry.js +35 -17
  19. package/dist/cjs/post-linkarea.cjs.entry.js +53 -48
  20. package/dist/cjs/post-listbox-option.cjs.entry.js +2 -2
  21. package/dist/cjs/post-listbox.cjs.entry.js +4 -4
  22. package/dist/cjs/post-number-input.cjs.entry.js +2 -2
  23. package/dist/cjs/post-pagination.cjs.entry.js +20 -16
  24. package/dist/cjs/post-popover-trigger.cjs.entry.js +4 -4
  25. package/dist/cjs/post-popover.cjs.entry.js +33 -8
  26. package/dist/cjs/post-progressbar.cjs.entry.js +3 -3
  27. package/dist/cjs/post-rating.cjs.entry.js +5 -5
  28. package/dist/cjs/post-side-navigation-trigger.cjs.entry.js +5 -5
  29. package/dist/cjs/post-side-navigation.cjs.entry.js +14 -8
  30. package/dist/cjs/post-stepper-item.cjs.entry.js +3 -3
  31. package/dist/cjs/post-stepper.cjs.entry.js +6 -6
  32. package/dist/cjs/post-tab-item.cjs.entry.js +5 -5
  33. package/dist/cjs/post-tab-panel.cjs.entry.js +5 -5
  34. package/dist/cjs/post-tabs.cjs.entry.js +6 -6
  35. package/dist/cjs/post-tooltip-trigger.cjs.entry.js +5 -5
  36. package/dist/cjs/post-tooltip.cjs.entry.js +4 -4
  37. package/dist/cjs/{required-Bkz8MOYa.js → required-BXiinq5t.js} +1 -1
  38. package/dist/cjs/{type-D8eD1JMd.js → type-l3fnHs_E.js} +1 -1
  39. package/dist/cjs/{url-C7MnIIZ_.js → url-Dmn5zP5b.js} +1 -1
  40. package/dist/collection/components/post-autocomplete/post-autocomplete.js +10 -1
  41. package/dist/collection/components/post-date-picker/native-mask-element.js +12 -5
  42. package/dist/collection/components/post-date-picker/post-date-picker.css +2 -2
  43. package/dist/collection/components/post-date-picker/post-date-picker.js +45 -5
  44. package/dist/collection/components/post-footer/post-footer.css +1 -1
  45. package/dist/collection/components/post-footer/post-footer.js +32 -14
  46. package/dist/collection/components/post-header/post-header.js +4 -5
  47. package/dist/collection/components/post-icon/post-icon.js +1 -1
  48. package/dist/collection/components/post-linkarea/post-linkarea.js +51 -46
  49. package/dist/collection/components/post-listbox/post-listbox.css +1 -1
  50. package/dist/collection/components/post-listbox/post-listbox.js +1 -1
  51. package/dist/collection/components/post-megadropdown/post-megadropdown.js +7 -7
  52. package/dist/collection/components/post-pagination/post-pagination.css +1 -1
  53. package/dist/collection/components/post-pagination/post-pagination.js +14 -10
  54. package/dist/collection/components/post-popover/post-popover.js +32 -2
  55. package/dist/collection/components/post-side-navigation/post-side-navigation.css +1 -1
  56. package/dist/collection/components/post-side-navigation/post-side-navigation.js +7 -1
  57. package/dist/collection/components/post-stepper-item/post-stepper-item.css +1 -1
  58. package/dist/collection/components/post-tabs/post-tabs.css +1 -1
  59. package/dist/components/package.js +1 -1
  60. package/dist/components/post-autocomplete.js +1 -1
  61. package/dist/components/post-date-picker.js +1 -1
  62. package/dist/components/post-footer.js +1 -1
  63. package/dist/components/post-header.js +1 -1
  64. package/dist/components/post-icon2.js +1 -1
  65. package/dist/components/post-linkarea.js +1 -1
  66. package/dist/components/post-listbox.js +1 -1
  67. package/dist/components/post-megadropdown.js +1 -1
  68. package/dist/components/post-pagination.js +1 -1
  69. package/dist/components/post-popover.js +1 -1
  70. package/dist/components/post-side-navigation.js +1 -1
  71. package/dist/components/post-stepper-item.js +1 -1
  72. package/dist/components/post-tabs.js +1 -1
  73. package/dist/components/react/index.js +1 -1
  74. package/dist/components/react/{p-BJXXw0kF.js → p-BBldpA5o.js} +1 -1
  75. package/dist/components/react/{p-Bscvx_1t.js → p-BLxhbOxJ.js} +1 -1
  76. package/dist/components/react/{p-DlA_Y5Qr.js → p-BVwVxBtC.js} +1 -1
  77. package/dist/components/react/{p-B4CPJq4-.js → p-CNhNLSwV.js} +1 -1
  78. package/dist/components/react/{p-BKQu2M0N.js → p-CTdS2ONV.js} +1 -1
  79. package/dist/components/react/{p-DQDv_V13.js → p-CzqW5_YD.js} +1 -1
  80. package/dist/components/react/{p-CT6x8DLu.js → p-DEmm6Dal.js} +1 -1
  81. package/dist/components/react/{p-D1M4lTJg.js → p-DG11ySYQ.js} +1 -1
  82. package/dist/components/react/{p-Du33y-6X.js → p-DUMQ0Em_.js} +1 -1
  83. package/dist/components/react/p-YQBh4peU.js +1 -0
  84. package/dist/components/react/{p-_nnVhpIK.js → p-pPs8_sxf.js} +1 -1
  85. package/dist/components/react/{p-BJJd4LvT.js → p-qL_Kd0ZG.js} +1 -1
  86. package/dist/components/react/post-accordion-item.js +1 -1
  87. package/dist/components/react/post-accordion.js +1 -1
  88. package/dist/components/react/post-autocomplete.js +1 -1
  89. package/dist/components/react/post-avatar.js +1 -1
  90. package/dist/components/react/post-back-to-top.js +1 -1
  91. package/dist/components/react/post-banner.js +1 -1
  92. package/dist/components/react/post-breadcrumb-item.js +1 -1
  93. package/dist/components/react/post-breadcrumbs.js +1 -1
  94. package/dist/components/react/post-closebutton.js +1 -1
  95. package/dist/components/react/post-collapsible-trigger.js +1 -1
  96. package/dist/components/react/post-collapsible.js +1 -1
  97. package/dist/components/react/post-date-picker.js +1 -1
  98. package/dist/components/react/post-footer.js +1 -1
  99. package/dist/components/react/post-header.js +1 -1
  100. package/dist/components/react/post-icon.js +1 -1
  101. package/dist/components/react/post-language-menu-item.js +1 -1
  102. package/dist/components/react/post-language-menu.js +1 -1
  103. package/dist/components/react/post-linkarea.js +1 -1
  104. package/dist/components/react/post-listbox-option.js +1 -1
  105. package/dist/components/react/post-listbox.js +1 -1
  106. package/dist/components/react/post-logo.js +1 -1
  107. package/dist/components/react/post-mainnavigation.js +1 -1
  108. package/dist/components/react/post-megadropdown-trigger.js +1 -1
  109. package/dist/components/react/post-megadropdown.js +1 -1
  110. package/dist/components/react/post-menu-item.js +1 -1
  111. package/dist/components/react/post-menu-trigger.js +1 -1
  112. package/dist/components/react/post-menu.js +1 -1
  113. package/dist/components/react/post-number-input.js +1 -1
  114. package/dist/components/react/post-pagination.js +1 -1
  115. package/dist/components/react/post-popover-trigger.js +1 -1
  116. package/dist/components/react/post-popover.js +1 -1
  117. package/dist/components/react/post-popovercontainer.js +1 -1
  118. package/dist/components/react/post-rating.js +1 -1
  119. package/dist/components/react/post-side-navigation-trigger.js +1 -1
  120. package/dist/components/react/post-side-navigation.js +1 -1
  121. package/dist/components/react/post-stepper-item.js +1 -1
  122. package/dist/components/react/post-stepper.js +1 -1
  123. package/dist/components/react/post-tab-item.js +1 -1
  124. package/dist/components/react/post-tab-panel.js +1 -1
  125. package/dist/components/react/post-tabs.js +1 -1
  126. package/dist/components/react/post-togglebutton.js +1 -1
  127. package/dist/components/react/post-tooltip-trigger.js +1 -1
  128. package/dist/components/react/post-tooltip.js +1 -1
  129. package/dist/docs.json +5 -5
  130. package/dist/esm/{create-validator-decorator-CYYTw0AS.js → create-validator-decorator-BzX_jW0Z.js} +1 -1
  131. package/dist/esm/{index-DE1aWdqx.js → index-BAtz9iuv.js} +1 -1
  132. package/dist/esm/loader.js +3 -3
  133. package/dist/esm/{one-of-Ug1_Xoes.js → one-of-D5QwMlvb.js} +1 -1
  134. package/dist/esm/{package-Y58zWPwj.js → package-YQBh4peU.js} +1 -1
  135. package/dist/esm/{pattern-WLk4tOqI.js → pattern-CrL4IkfA.js} +1 -1
  136. package/dist/esm/post-accordion_2.entry.js +5 -5
  137. package/dist/esm/post-autocomplete.entry.js +15 -6
  138. package/dist/esm/post-avatar.entry.js +6 -6
  139. package/dist/esm/post-back-to-top.entry.js +5 -5
  140. package/dist/esm/post-banner.entry.js +4 -4
  141. package/dist/esm/post-breadcrumb-item.entry.js +7 -7
  142. package/dist/esm/post-breadcrumbs.entry.js +6 -6
  143. package/dist/esm/post-closebutton_14.entry.js +20 -21
  144. package/dist/esm/post-collapsible_2.entry.js +4 -4
  145. package/dist/esm/post-components.js +3 -3
  146. package/dist/esm/post-date-picker.entry.js +62 -15
  147. package/dist/esm/post-footer.entry.js +35 -17
  148. package/dist/esm/post-linkarea.entry.js +53 -48
  149. package/dist/esm/post-listbox-option.entry.js +2 -2
  150. package/dist/esm/post-listbox.entry.js +4 -4
  151. package/dist/esm/post-number-input.entry.js +2 -2
  152. package/dist/esm/post-pagination.entry.js +20 -16
  153. package/dist/esm/post-popover-trigger.entry.js +4 -4
  154. package/dist/esm/post-popover.entry.js +33 -8
  155. package/dist/esm/post-progressbar.entry.js +3 -3
  156. package/dist/esm/post-rating.entry.js +5 -5
  157. package/dist/esm/post-side-navigation-trigger.entry.js +5 -5
  158. package/dist/esm/post-side-navigation.entry.js +14 -8
  159. package/dist/esm/post-stepper-item.entry.js +3 -3
  160. package/dist/esm/post-stepper.entry.js +6 -6
  161. package/dist/esm/post-tab-item.entry.js +5 -5
  162. package/dist/esm/post-tab-panel.entry.js +5 -5
  163. package/dist/esm/post-tabs.entry.js +6 -6
  164. package/dist/esm/post-tooltip-trigger.entry.js +5 -5
  165. package/dist/esm/post-tooltip.entry.js +4 -4
  166. package/dist/esm/{required-DeOhRbtk.js → required-BX_AhSO0.js} +1 -1
  167. package/dist/esm/{type-S-4aPMGU.js → type-BYIjiHKr.js} +1 -1
  168. package/dist/esm/{url-C8KSrmWc.js → url-CZMYpchD.js} +1 -1
  169. package/dist/post-components/p-0cceee23.entry.js +1 -0
  170. package/dist/post-components/{p-4-_BhJWV.js → p-0sQVSOjO.js} +1 -1
  171. package/dist/post-components/{p-842df510.entry.js → p-22a30622.entry.js} +1 -1
  172. package/dist/post-components/{p-b0099d75.entry.js → p-22b1df28.entry.js} +1 -1
  173. package/dist/post-components/{p-a779195c.entry.js → p-24d208eb.entry.js} +1 -1
  174. package/dist/post-components/p-3dc7e1b4.entry.js +1 -0
  175. package/dist/post-components/{p-ccaf42c3.entry.js → p-4cf66554.entry.js} +1 -1
  176. package/dist/post-components/{p-57da1762.entry.js → p-52cf29ae.entry.js} +1 -1
  177. package/dist/post-components/{p-e35e4e1c.entry.js → p-542c9c58.entry.js} +1 -1
  178. package/dist/post-components/{p-4f8cc9a6.entry.js → p-593c14a2.entry.js} +1 -1
  179. package/dist/post-components/p-5a9ba878.entry.js +1 -0
  180. package/dist/post-components/{p-3cf1db19.entry.js → p-5ac593dd.entry.js} +1 -1
  181. package/dist/post-components/{p-95ad4d06.entry.js → p-675f62bc.entry.js} +1 -1
  182. package/dist/post-components/p-7a9b5fc3.entry.js +1 -0
  183. package/dist/post-components/{p-d91b8c5d.entry.js → p-81e4e124.entry.js} +1 -1
  184. package/dist/post-components/p-85b497d7.entry.js +1 -0
  185. package/dist/post-components/{p-94a8cb5a.entry.js → p-8c76ce4d.entry.js} +1 -1
  186. package/dist/post-components/{p-1f8cf0ac.entry.js → p-8e0da839.entry.js} +1 -1
  187. package/dist/post-components/{p-cef3c15c.entry.js → p-8ea92775.entry.js} +1 -1
  188. package/dist/post-components/{p-178a7687.entry.js → p-94f76989.entry.js} +1 -1
  189. package/dist/post-components/{p-c05ae467.entry.js → p-9e9de801.entry.js} +1 -1
  190. package/dist/post-components/p-BAtz9iuv.js +2 -0
  191. package/dist/post-components/{p-NPUljV0P.js → p-BzmELz-M.js} +1 -1
  192. package/dist/post-components/{p-DMiERazc.js → p-C0Z-E_YL.js} +1 -1
  193. package/dist/post-components/p-CveORA5D.js +1 -0
  194. package/dist/post-components/p-DsgIP6Dq.js +1 -0
  195. package/dist/post-components/p-YQBh4peU.js +1 -0
  196. package/dist/post-components/{p-79ebeea6.entry.js → p-a342b434.entry.js} +1 -1
  197. package/dist/post-components/p-ac83c46d.entry.js +1 -0
  198. package/dist/post-components/p-c06f6719.entry.js +1 -0
  199. package/dist/post-components/{p-95986a4b.entry.js → p-cf891de3.entry.js} +1 -1
  200. package/dist/post-components/{p-8632e72c.entry.js → p-ef71ff85.entry.js} +1 -1
  201. package/dist/post-components/p-f9673487.entry.js +1 -0
  202. package/dist/post-components/{p-BDW1XHCO.js → p-fOjbWhb_.js} +1 -1
  203. package/dist/post-components/p-fb899183.entry.js +1 -0
  204. package/dist/post-components/{p-04357da9.entry.js → p-fb9eba9c.entry.js} +1 -1
  205. package/dist/post-components/p-ffb2fae3.entry.js +1 -0
  206. package/dist/post-components/post-components.css +1 -1
  207. package/dist/post-components/post-components.esm.js +1 -1
  208. package/dist/types/components/post-autocomplete/post-autocomplete.d.ts +1 -0
  209. package/dist/types/components/post-date-picker/post-date-picker.d.ts +3 -0
  210. package/dist/types/components/post-footer/post-footer.d.ts +5 -4
  211. package/dist/types/components/post-linkarea/post-linkarea.d.ts +2 -2
  212. package/dist/types/components/post-megadropdown/post-megadropdown.d.ts +1 -1
  213. package/dist/types/components/post-pagination/post-pagination.d.ts +1 -1
  214. package/dist/types/components/post-popover/post-popover.d.ts +5 -0
  215. package/hydrate/index.js +220 -106
  216. package/hydrate/index.mjs +220 -106
  217. package/package.json +6 -6
  218. package/dist/components/react/p-Y58zWPwj.js +0 -1
  219. package/dist/post-components/p-0489b4d4.entry.js +0 -1
  220. package/dist/post-components/p-0d26c355.entry.js +0 -1
  221. package/dist/post-components/p-2c57ea8a.entry.js +0 -1
  222. package/dist/post-components/p-56f74289.entry.js +0 -1
  223. package/dist/post-components/p-7f07eee6.entry.js +0 -1
  224. package/dist/post-components/p-8adf13de.entry.js +0 -1
  225. package/dist/post-components/p-8f70afc9.entry.js +0 -1
  226. package/dist/post-components/p-9ff63d4c.entry.js +0 -1
  227. package/dist/post-components/p-B6uZASBE.js +0 -1
  228. package/dist/post-components/p-CiOyV6Mo.js +0 -1
  229. package/dist/post-components/p-DE1aWdqx.js +0 -2
  230. package/dist/post-components/p-Y58zWPwj.js +0 -1
  231. package/dist/post-components/p-c25b6da1.entry.js +0 -1
  232. package/dist/post-components/p-f2d92ace.entry.js +0 -1
@@ -42,6 +42,8 @@ export class PostDatePicker {
42
42
  this._lastInputValue = null;
43
43
  this.skipOnSelectCount = 0;
44
44
  this.skipFocusOnNextRender = false;
45
+ // Date the keyboard is navigating to, used to keep focus correct when the grid redraws
46
+ this.pendingFocusDate = null;
45
47
  this.handleInputBlur = () => {
46
48
  if (this.range) {
47
49
  const parts = this.inputMask.value.split(this.dateFormatRangeSeparator);
@@ -182,10 +184,17 @@ export class PostDatePicker {
182
184
  // If month has changed, update view date
183
185
  const monthChanged = current.getMonth() !== newDate.getMonth() || current.getFullYear() !== newDate.getFullYear();
184
186
  if (monthChanged) {
187
+ this.pendingFocusDate = newDate;
185
188
  this.skipFocusOnNextRender = false;
186
189
  this.dpInstance.setViewDate(newDate);
187
190
  requestAnimationFrame(() => {
188
191
  this.setActiveCell(newDate, true);
192
+ // Clear it a frame later, in case the grid redraws itself twice
193
+ requestAnimationFrame(() => {
194
+ if (this.pendingFocusDate === newDate) {
195
+ this.pendingFocusDate = null;
196
+ }
197
+ });
189
198
  });
190
199
  }
191
200
  else {
@@ -465,6 +474,28 @@ export class PostDatePicker {
465
474
  this.nextBtn?.setAttribute('aria-label', this.textNextMonth);
466
475
  }
467
476
  }
477
+ // ARIA requires role="grid" to own role="row", and role="row" to own role="gridcell"
478
+ // AirDatepicker renders cells flat, so we wrap them in row divs to satisfy that
479
+ wrapCellsInRows(body) {
480
+ this.gridObserver?.disconnect();
481
+ body.querySelectorAll(':scope > [role="row"]').forEach(row => {
482
+ while (row.firstChild)
483
+ body.insertBefore(row.firstChild, row);
484
+ row.remove();
485
+ });
486
+ const cells = Array.from(body.children).filter(el => el.classList.contains('air-datepicker-cell'));
487
+ const columns = PostDatePicker.COLUMNS_BY_VIEW[this.currentViewType];
488
+ for (let i = 0; i < cells.length; i += columns) {
489
+ const row = document.createElement('div');
490
+ row.setAttribute('role', 'row');
491
+ row.classList.add('a11y-row');
492
+ body.insertBefore(row, cells[i]);
493
+ for (let j = i; j < i + columns && j < cells.length; j++) {
494
+ row.append(cells[j]);
495
+ }
496
+ }
497
+ this.gridObserver.observe(body, { childList: true, subtree: false });
498
+ }
468
499
  enhanceAccessibility(focusOnDate = true) {
469
500
  let body = this.dpContainer.querySelector('.air-datepicker-body--cells');
470
501
  if (this.currentViewType === 'months') {
@@ -476,6 +507,7 @@ export class PostDatePicker {
476
507
  if (!body)
477
508
  return;
478
509
  body.setAttribute('role', 'grid');
510
+ this.wrapCellsInRows(body);
479
511
  this.getCells().forEach(c => {
480
512
  c.setAttribute('aria-selected', c.classList.contains('-selected-') ? 'true' : 'false');
481
513
  if (c.classList.contains('-current-')) {
@@ -486,7 +518,9 @@ export class PostDatePicker {
486
518
  body.addEventListener('keydown', this.handleGridKeydown);
487
519
  const dates = this.getIsoDates();
488
520
  const selectedDate = dates[0] ? isoToDate(dates[0]) : null;
489
- this.setActiveCell(selectedDate || this.today, focusOnDate);
521
+ // Focus the keyboard's target date if there is one, else the selected date, else today
522
+ const dateToFocus = this.pendingFocusDate || selectedDate || this.today;
523
+ this.setActiveCell(dateToFocus, focusOnDate);
490
524
  }
491
525
  /**
492
526
  * Set up the masks on the inputs to reflect the date pickers
@@ -654,8 +688,8 @@ export class PostDatePicker {
654
688
  if (this.dpContainer) {
655
689
  const options = {
656
690
  navTitles: {
657
- days: `<button aria-label="${this.textSwitchYear}"><strong>MMMM yyyy</strong><post-icon name="chevrondown"></post-icon></button>`,
658
- months: `<button aria-label="${this.textSwitchYear}"><strong>yyyy</strong><post-icon name="chevrondown"></post-icon></button>`,
691
+ days: `<button><strong>MMMM yyyy</strong><span class="visually-hidden">, ${this.textSwitchYear}</span><post-icon name="chevrondown"></post-icon></button>`,
692
+ months: `<button><strong>yyyy</strong><span class="visually-hidden">, ${this.textSwitchYear}</span><post-icon name="chevrondown"></post-icon></button>`,
659
693
  },
660
694
  prevHtml: '<button><post-icon name="chevronleft" ></post-icon></button>',
661
695
  nextHtml: '<button><post-icon name="chevronright" ></post-icon></button>',
@@ -863,11 +897,11 @@ export class PostDatePicker {
863
897
  }
864
898
  }
865
899
  render() {
866
- return (h(Host, { key: '81640c91615041d9f52f58395ac3a6a23ba9bad2', "data-version": version }, this.inline && (h("div", { key: 'e405be301af265906fb6ba5f966810a99a15cc21', dir: this.textDirection }, h("slot", { key: '0072a973e6f6e52bedf330c382a88c4c7f7a1ab6' }), h("div", { key: '8f57e51e54188bfdb3fad31d40c528885a4109a2', class: "datepicker-container" }))), !this.inline && (h("div", { key: 'e36a35c4125942422e803a9751fa8b9842edf472', dir: this.textDirection }, h("div", { key: '8cc9e3bb801cfb6b999a473462bf2072bbc57426', class: {
900
+ return (h(Host, { key: '231026bbf4e2ea6e12abc613f5a44ad1df7a1c88', "data-version": version }, this.inline && (h("div", { key: '69f1343a088c986e28aa2648eeb389432353e1eb', dir: this.textDirection }, h("slot", { key: 'f2c0bc1c1f5a6b716f421301418e0fcf11cbc774' }), h("div", { key: '17e7f3f6be51ed283ab80adcfb182ad36ac14b17', class: "datepicker-container" }))), !this.inline && (h("div", { key: '8cc1938f558f764cc3a02351e4470b4bdde54210', dir: this.textDirection }, h("div", { key: 'e2a241a226e4817e17d3ffb96ac0f8ccbc1e9e5f', class: {
867
901
  'calendar-input': !this.range,
868
902
  'calendar-input-range': this.range,
869
903
  'disabled': this.inputDisabled,
870
- } }, h("slot", { key: '3d4efd053a72c1e5d5622889eefe4cb9745ef148' }), h("button", { key: '8d27e799e2dda60207e6fbf3923ceb2d12b1ea00', onClick: () => this.show(), "aria-haspopup": "true", "aria-label": this.textToggleCalendar, disabled: this.inputDisabled, ref: e => (this.dpTrigger = e) }, h("post-icon", { key: 'b8faa8720d9a8fe7043392ba3a20de168841f5d8', name: "calendar" }))), h("post-popovercontainer", { key: '9999a1bb1272c1b2a51715363f89afafcc6de33f', placement: "bottom-end", offset: PostDatePicker.FLYOUT_OFFSET, ref: e => (this.popoverRef = e) }, h("div", { key: '8950128377fdc625a2da501c609dd25b0993b12e', class: "datepicker-container" }))))));
904
+ } }, h("slot", { key: '90a42ee8a1f9df6a541c0573ec6ea5b872abf6b6' }), h("button", { key: '04e02dce4a4c35681f7db41b1b222a24716f7ebc', onClick: () => this.show(), "aria-haspopup": "true", "aria-label": this.textToggleCalendar, disabled: this.inputDisabled, ref: e => (this.dpTrigger = e) }, h("post-icon", { key: 'd325b4589e1cbd237207fe1b6bc9af7bd8907e7c', name: "calendar" }))), h("post-popovercontainer", { key: '5616c7c6c3db35838de04ecbdadd0ba398e8cb37', placement: "bottom-end", offset: PostDatePicker.FLYOUT_OFFSET, ref: e => (this.popoverRef = e) }, h("div", { key: '1df05f1c4e855ffc3549f48073ae28ef87067007', class: "datepicker-container" }))))));
871
905
  }
872
906
  static get is() { return "post-date-picker"; }
873
907
  static get encapsulation() { return "shadow"; }
@@ -1226,6 +1260,12 @@ export class PostDatePicker {
1226
1260
  }
1227
1261
  }
1228
1262
  PostDatePicker.FLYOUT_OFFSET = 4;
1263
+ // Cells per row for each view
1264
+ PostDatePicker.COLUMNS_BY_VIEW = {
1265
+ days: 7,
1266
+ months: 4,
1267
+ years: 4,
1268
+ };
1229
1269
  __decorate([
1230
1270
  DateValue(),
1231
1271
  IsoDate()
@@ -1 +1 @@
1
- :host{display:block}footer{border-block-start:1px solid #373632;--post-footer-container-padding-block: 32px;--post-footer-container-padding-inline: 16px;--post-footer-container-max-width: 1200px;--post-footer-prefooter-padding-block: 16px;--post-footer-grid-template: auto / auto;--post-footer-grid-row-gap: 0;--post-footer-grid-column-gap: 0;--post-footer-grid-margin-block-end: 24px;--post-footer-grid-padding-block-end: 0;--post-footer-column-flex-direction: column;--post-footer-column-align-items: start;--post-footer-column-gap: 0;--post-footer-list-flex-direction: column;--post-footer-list-gap: 8px;--post-footer-list-align-items: start;--post-footer-socialmedia-margin-block-end: var(--post-footer-grid-margin-block-end);--post-footer-app-margin-block-end: var(--post-footer-grid-margin-block-end);--post-footer-businesssectors-margin-block-end: var(--post-footer-grid-margin-block-end);--post-footer-meta-margin-block-end: 16px;--post-footer-meta-font-size: inherit;--post-footer-copyright-font-size: var(--post-footer-meta-font-size)}@media screen and (min-width: 600px){footer{--post-footer-container-padding-block: 40px;--post-footer-prefooter-padding-block: 32px;--post-footer-grid-template: repeat(2, auto) / repeat(2, auto);--post-footer-grid-row-gap: 32px;--post-footer-grid-column-gap: 16px;--post-footer-grid-margin-block-end: 32px;--post-footer-grid-padding-block-end: 32px;--post-footer-list-flex-direction: row;--post-footer-list-gap: 16px;--post-footer-list-align-items: center;--post-footer-meta-margin-block-end: 8px}}@media screen and (min-width: 780px){footer{--post-footer-container-padding-inline: 40px}}@media screen and (min-width: 1024px){footer{--post-footer-container-padding-block: 56px;--post-footer-grid-template: auto / repeat(4, auto);--post-footer-grid-row-gap: 0;--post-footer-grid-column-gap: 24px;--post-footer-grid-margin-block-end: 40px;--post-footer-column-flex-direction: row;--post-footer-column-align-items: center;--post-footer-column-gap: 32px;--post-footer-list-gap: 24px;--post-footer-businesssectors-margin-block-end: 24px;--post-footer-meta-font-size: 16px}}:is(h3,.h3){margin:0;font-size:var(--post-device-font-size-6);line-height:var(--post-device-line-height-heading);font-weight:var(--post-device-font-weight-extra-black);text-wrap:balance}::slotted(ul){list-style:none;padding:0;margin:0}.visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}.footer-container{box-sizing:content-box;margin:0 auto;padding:var(--post-footer-container-padding-block) var(--post-footer-container-padding-inline);max-width:var(--post-footer-container-max-width)}.prefooter{background-color:#fafafa}.prefooter .footer-container{padding-block:0}.prefooter ::slotted([slot=prefooter]){padding-block:var(--post-footer-prefooter-padding-block)}.footer-main{background-color:#fc0}.footer-grid{display:grid;grid-template:var(--post-footer-grid-template);row-gap:var(--post-footer-grid-row-gap);column-gap:var(--post-footer-grid-column-gap);margin-block-end:var(--post-footer-grid-margin-block-end);padding-block-end:var(--post-footer-grid-padding-block-end)}.footer-grid:has(>.d-none+.d-none+.d-none+.d-none){margin-block-end:0;padding-block-end:0;row-gap:0;column-gap:0}.footer-grid post-accordion:has(>.d-none+.d-none+.d-none+.d-none){display:none}.footer-grid ::part(button),.footer-grid ::part(body){padding-inline:0}.footer-column{display:flex;flex-direction:var(--post-footer-column-flex-direction);flex-wrap:wrap;justify-content:space-between;align-items:var(--post-footer-column-align-items);column-gap:var(--post-footer-column-gap)}.footer-socialmedia ::slotted(div),.footer-app ::slotted(div),.footer-meta ::slotted(div){display:flex !important;flex-direction:var(--post-footer-list-flex-direction) !important;gap:var(--post-footer-list-gap) !important;align-items:var(--post-footer-list-align-items) !important}.footer-socialmedia{margin-block-end:var(--post-footer-socialmedia-margin-block-end)}.footer-app{margin-block-end:var(--post-footer-app-margin-block-end)}.prefooter ::slotted(div),.footer-businesssectors ::slotted(div){display:flex;flex-wrap:wrap;align-items:center;gap:var(--post-footer-list-gap) !important}.footer-businesssectors{margin-block-end:var(--post-footer-businesssectors-margin-block-end)}.footer-meta{margin-block-end:var(--post-footer-meta-margin-block-end);font-size:var(--post-footer-meta-font-size)}.footer-copyright{display:flex;flex-wrap:wrap;column-gap:.5rem;font-size:var(--post-footer-copyright-font-size)}.d-none{display:none}
1
+ :host{display:block}footer{border-block-start:1px solid #373632;--post-footer-container-padding-block: 32px;--post-footer-container-padding-inline: 16px;--post-footer-container-max-width: 1200px;--post-footer-prefooter-padding-block: 16px;--post-footer-grid-template: auto / auto;--post-footer-grid-row-gap: 0;--post-footer-grid-column-gap: 0;--post-footer-grid-margin-block-end: 24px;--post-footer-grid-padding-block-end: 0;--post-footer-column-flex-direction: column;--post-footer-column-align-items: start;--post-footer-column-gap: 0;--post-footer-list-flex-direction: column;--post-footer-list-gap: 8px;--post-footer-list-align-items: start;--post-footer-socialmedia-margin-block-end: var(--post-footer-grid-margin-block-end);--post-footer-app-margin-block-end: var(--post-footer-grid-margin-block-end);--post-footer-businesssectors-margin-block-end: var(--post-footer-grid-margin-block-end);--post-footer-meta-margin-block-end: 16px;--post-footer-meta-font-size: inherit;--post-footer-copyright-font-size: var(--post-footer-meta-font-size)}@media screen and (min-width: 600px){footer{--post-footer-container-padding-block: 40px;--post-footer-prefooter-padding-block: 32px;--post-footer-grid-template: repeat(2, auto) / repeat(2, auto);--post-footer-grid-row-gap: 32px;--post-footer-grid-column-gap: 16px;--post-footer-grid-margin-block-end: 32px;--post-footer-grid-padding-block-end: 32px;--post-footer-list-flex-direction: row;--post-footer-list-gap: 16px;--post-footer-list-align-items: center;--post-footer-meta-margin-block-end: 8px}}@media screen and (min-width: 780px){footer{--post-footer-container-padding-inline: 40px}}@media screen and (min-width: 1024px){footer{--post-footer-container-padding-block: 56px;--post-footer-grid-template: auto / repeat(4, auto);--post-footer-grid-row-gap: 0;--post-footer-grid-column-gap: 24px;--post-footer-grid-margin-block-end: 40px;--post-footer-column-flex-direction: row;--post-footer-column-align-items: center;--post-footer-column-gap: 32px;--post-footer-list-gap: 24px;--post-footer-businesssectors-margin-block-end: 24px;--post-footer-meta-font-size: 16px}}:is(h3,.h3){margin:0;font-size:var(--post-device-font-size-6);line-height:var(--post-device-line-height-heading);font-weight:var(--post-device-font-weight-extra-black);text-wrap:balance}::slotted(ul){list-style:none;padding:0;margin:0}.visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}.footer-container{box-sizing:content-box;margin:0 auto;padding:var(--post-footer-container-padding-block) var(--post-footer-container-padding-inline);max-width:var(--post-footer-container-max-width)}.prefooter{background-color:#fafafa}.prefooter .footer-container{padding-block:0}.prefooter ::slotted([slot=prefooter]){padding-block:var(--post-footer-prefooter-padding-block)}.footer-main{background-color:#fc0}.footer-grid{display:grid;grid-template:var(--post-footer-grid-template);row-gap:var(--post-footer-grid-row-gap);column-gap:var(--post-footer-grid-column-gap);margin-block-end:var(--post-footer-grid-margin-block-end);padding-block-end:var(--post-footer-grid-padding-block-end)}.footer-grid ::part(button),.footer-grid ::part(body){padding-inline:0}.footer-column{display:flex;flex-direction:var(--post-footer-column-flex-direction);flex-wrap:wrap;justify-content:space-between;align-items:var(--post-footer-column-align-items);column-gap:var(--post-footer-column-gap)}.footer-socialmedia ::slotted(div),.footer-app ::slotted(div),.footer-meta ::slotted(div){display:flex !important;flex-direction:var(--post-footer-list-flex-direction) !important;gap:var(--post-footer-list-gap) !important;align-items:var(--post-footer-list-align-items) !important}.footer-socialmedia{margin-block-end:var(--post-footer-socialmedia-margin-block-end)}.footer-app{margin-block-end:var(--post-footer-app-margin-block-end)}.prefooter ::slotted(div),.footer-businesssectors ::slotted(div){display:flex;flex-wrap:wrap;align-items:center;gap:var(--post-footer-list-gap) !important}.footer-businesssectors{margin-block-end:var(--post-footer-businesssectors-margin-block-end)}.footer-meta{margin-block-end:var(--post-footer-meta-margin-block-end);font-size:var(--post-footer-meta-font-size)}.footer-copyright{display:flex;flex-wrap:wrap;column-gap:.5rem;font-size:var(--post-footer-copyright-font-size)}.d-none{display:none}
@@ -12,6 +12,7 @@ import { breakpoint, Required, Type } from "../../utils/index";
12
12
  import { version } from "../../../../package";
13
13
  import { h, Host } from "@stencil/core";
14
14
  const GRID_SLOTS = ['grid-1', 'grid-2', 'grid-3', 'grid-4'];
15
+ const SECTION_SLOTS = ['socialmedia', 'app', 'businesssectors', 'meta', 'copyright'];
15
16
  /**
16
17
  * @slot prefooter - Slot for the pre-footer.
17
18
  * @slot grid-{1|2|3|4}-title - Slot for the accordion headers (mobile).
@@ -19,26 +20,27 @@ const GRID_SLOTS = ['grid-1', 'grid-2', 'grid-3', 'grid-4'];
19
20
  * @slot socialmedia - Slot for the social media links.
20
21
  * @slot app - Slot for the app links.
21
22
  * @slot businesssectors - Slot for the business sectors links.
22
- * @slot meta - Slot for the meta links.
23
- * @slot copyright - Slot for the copyright text.
23
+ * @slot meta - **Required.** Slot for the meta links.
24
+ * @slot copyright - **Required.** Slot for the copyright text.
24
25
  */
25
26
  export class PostFooter {
26
27
  constructor() {
27
28
  this.device = breakpoint.get('device');
28
- this.gridSlotDisplayed = {};
29
+ this.slotDisplayed = {};
29
30
  this.breakpointChange = (e) => {
30
31
  this.device = e.detail;
31
32
  };
32
33
  this.handleGridSlotChange = this.handleGridSlotChange.bind(this);
34
+ this.handleSlotChange = this.handleSlotChange.bind(this);
33
35
  }
34
36
  connectedCallback() {
35
37
  globalThis.addEventListener('postBreakpoint:device', this.breakpointChange);
36
38
  }
37
39
  componentWillLoad() {
38
- // initialize grid visibility by checking the content of each slot
39
- GRID_SLOTS.forEach(slotName => {
40
+ // initialize slot visibility by checking the content of each slot
41
+ [...GRID_SLOTS, ...SECTION_SLOTS].forEach(slotName => {
40
42
  const assignedElements = this.host.querySelectorAll(`[slot="${slotName}"]`);
41
- this.updateGridSlotDisplay(slotName, assignedElements.length > 0);
43
+ this.updateSlotDisplay(slotName, assignedElements.length > 0);
42
44
  });
43
45
  }
44
46
  disconnectedCallback() {
@@ -47,23 +49,39 @@ export class PostFooter {
47
49
  handleGridSlotChange(...devices) {
48
50
  return (e) => {
49
51
  if (devices.includes(this.device) && e.target instanceof HTMLSlotElement) {
50
- this.updateGridSlotDisplay(e.target.name, e.target.assignedElements().length > 0);
52
+ this.updateSlotDisplay(e.target.name, e.target.assignedElements().length > 0);
51
53
  }
52
54
  };
53
55
  }
54
- updateGridSlotDisplay(slotName, hasContent) {
55
- if (this.gridSlotDisplayed[slotName] !== hasContent) {
56
- this.gridSlotDisplayed = { ...this.gridSlotDisplayed, [slotName]: hasContent };
56
+ handleSlotChange(e) {
57
+ if (e.target instanceof HTMLSlotElement) {
58
+ this.updateSlotDisplay(e.target.name, e.target.assignedElements().length > 0);
59
+ }
60
+ }
61
+ updateSlotDisplay(slotName, hasContent) {
62
+ if (this.slotDisplayed[slotName] !== hasContent) {
63
+ // @State only re-renders when this.slotDisplayed itself is replaced,
64
+ // not when one of its properties is changed directly
65
+ this.slotDisplayed = { ...this.slotDisplayed, [slotName]: hasContent };
57
66
  }
58
67
  }
59
68
  renderAccordion() {
60
- return (h("post-accordion", { headingLevel: 3, multiple: true }, GRID_SLOTS.map(slotName => (h("post-accordion-item", { class: { 'd-none': !this.gridSlotDisplayed[slotName] }, collapsed: true }, h("span", { slot: "header" }, h("slot", { name: slotName + '-title' })), h("slot", { onSlotchange: this.handleGridSlotChange('mobile'), name: slotName }))))));
69
+ return (h("post-accordion", { headingLevel: 3, multiple: true }, GRID_SLOTS.map(slotName => (h("post-accordion-item", { key: slotName, class: { 'd-none': !this.slotDisplayed[slotName] }, collapsed: true }, h("span", { slot: "header" }, h("slot", { name: slotName + '-title' })), h("slot", { onSlotchange: this.handleGridSlotChange('mobile'), name: slotName }))))));
61
70
  }
62
71
  renderColumns() {
63
- return GRID_SLOTS.map(slotName => (h("div", { class: { 'd-none': !this.gridSlotDisplayed[slotName] } }, h("h3", null, h("slot", { name: slotName + '-title' })), h("slot", { onSlotchange: this.handleGridSlotChange('tablet', 'desktop'), name: slotName }))));
72
+ return GRID_SLOTS.map(slotName => (h("div", { key: slotName, class: { 'd-none': !this.slotDisplayed[slotName] } }, h("h3", null, h("slot", { name: slotName + '-title' })), h("slot", { onSlotchange: this.handleGridSlotChange('tablet', 'desktop'), name: slotName }))));
64
73
  }
65
74
  render() {
66
- return (h(Host, { key: '87cf55de334d5e0f43bf466185d78c4786d49492', "data-version": version, "data-color-scheme": "light" }, h("footer", { key: '01820a64befabb4b96c731daaef91cada24b59dc' }, h("h2", { key: '1b7b0177206199fe9eb1a16877002718225c5b0f', class: "visually-hidden" }, this.textFooter), h("div", { key: '3252249313ad2ab7059d37ea62f3d0daefb64049', class: "prefooter" }, h("div", { key: 'b3e48c915c0589a6d48da769a23370bff625075d', class: "footer-container" }, h("slot", { key: 'c77d6704a11bb26f2b65824840409c5be1088360', name: "prefooter" }))), h("div", { key: 'c68e4b4ed01a70af29415eca329e026a0428c0be', class: "footer-main" }, h("div", { key: '7996bca4f2d84268dca0bbde8bc4df35eaaa7710', class: "footer-container" }, h("div", { key: '3300d3fbcdffa533f91393a076d04e3fd03ead21', class: "footer-grid" }, this.device === 'mobile' ? this.renderAccordion() : this.renderColumns()), h("div", { key: '03c147ac0aa74c63defdf3d8e8a73b11826f4130', class: "footer-column" }, h("div", { key: '3e90fd4ba3de91a5f93bf18b4ce35bc1fc2533d3', class: "footer-socialmedia" }, h("slot", { key: 'eb0cdffde42c3e3583526480a435ef4f43e85395', name: "socialmedia" })), h("div", { key: '2a861100a8e6421c246a6c1a1ba0270c35941789', class: "footer-app" }, h("slot", { key: 'fc851920dfe073739792ae575d4d7c991d3687a5', name: "app" }))), h("div", { key: '9f849af988b281c3951f5a59d350cba3145fb1fb', class: "footer-businesssectors" }, h("slot", { key: '49afff2a24d9b27afedf2b8a3702209725648ba4', name: "businesssectors" })), h("div", { key: 'e213b2b70acf362f6e5070d256f00a833c4ba09b', class: "footer-meta" }, h("slot", { key: '064b8f8c7b66f23186d9e18e4ae1768ff117eaa0', name: "meta" })), h("div", { key: 'f4ebcebe64a68b504840c7ed6e1e449def977956', class: "footer-copyright" }, h("slot", { key: 'e91e587a3c3babb8e350fbf540c892d2659b6c50', name: "copyright" })))))));
75
+ const renderSocialmedia = this.slotDisplayed['socialmedia'];
76
+ const renderApp = this.slotDisplayed['app'];
77
+ const renderBusinesssectors = this.slotDisplayed['businesssectors'];
78
+ const renderMeta = this.slotDisplayed['meta'];
79
+ const renderCopyright = this.slotDisplayed['copyright'];
80
+ const allGridSlotsEmpty = GRID_SLOTS.every(slotName => !this.slotDisplayed[slotName]);
81
+ return (h(Host, { key: 'd34606bcddf871bcf82c64dd710a1e7d1d1dcbb5', "data-version": version, "data-color-scheme": "light" }, h("footer", { key: 'a82c77c34e1308ed02445a221776f37ebe26d7f9' }, h("h2", { key: '3d6bd7b10494661506a1bd60323e3e3205b1a400', class: "visually-hidden" }, this.textFooter), h("div", { key: '6497d40d70757426194142d8b597101d4f0f5ce6', class: "prefooter" }, h("div", { key: '7d352f9029fe397f0ada15de8dacb9d8a0b2a831', class: "footer-container" }, h("slot", { key: 'bbe3c744a1ea06544ccfda3b1f9a7e52666b69c3', name: "prefooter" }))), h("div", { key: '4bdd7e6f0507bbbc9ccb7a9b3a5f1dad2f1c6936', class: "footer-main" }, h("div", { key: '3b141f824900b9dccb6746bb4b11678f2b90ef53', class: "footer-container" }, h("div", { key: '46ef9417bb0aced5506e8adbeb6001dbcfe119a5', class: { 'footer-grid': true, 'd-none': allGridSlotsEmpty } }, this.device === 'mobile' ? this.renderAccordion() : this.renderColumns()), h("div", { key: 'd25f9b4b8e8bf8ce7d090c41c8b9de0c1454c566', class: {
82
+ 'footer-column': true,
83
+ 'd-none': !renderSocialmedia && !renderApp,
84
+ } }, h("div", { key: '43888182ec9db5d001ff724648f02a43acddb198', class: { 'footer-socialmedia': true, 'd-none': !renderSocialmedia } }, h("slot", { key: 'd96fe2e61b69ead95ba6235bdd63951ff177377a', onSlotchange: this.handleSlotChange, name: "socialmedia" })), h("div", { key: '0eb5c0c55f6d86ef4a179fa55bfb2b37311e1563', class: { 'footer-app': true, 'd-none': !renderApp } }, h("slot", { key: 'dcc9d0121b0febc2b2d4d183ca0aa979dd27b35c', onSlotchange: this.handleSlotChange, name: "app" }))), h("div", { key: '85a47b73374144b13fd40d3f25582e4375873647', class: { 'footer-businesssectors': true, 'd-none': !renderBusinesssectors } }, h("slot", { key: '1cbd28be1c5b8d52df6139db49e1e3b31db03a5a', onSlotchange: this.handleSlotChange, name: "businesssectors" })), h("div", { key: '1877c5230c17196d647f9ed145a21bcfed36321a', class: { 'footer-meta': true, 'd-none': !renderMeta } }, h("slot", { key: '12ca6c0a79db19365daddf3c14b4a395f664d3e1', onSlotchange: this.handleSlotChange, name: "meta" })), h("div", { key: '3dd50edca20df5bd258b1b01da2a88d556d5ea04', class: { 'footer-copyright': true, 'd-none': !renderCopyright } }, h("slot", { key: '058326a07ee00caea0cbac3843ba8190cf68abde', onSlotchange: this.handleSlotChange, name: "copyright" })))))));
67
85
  }
68
86
  static get is() { return "post-footer"; }
69
87
  static get encapsulation() { return "shadow"; }
@@ -103,7 +121,7 @@ export class PostFooter {
103
121
  static get states() {
104
122
  return {
105
123
  "device": {},
106
- "gridSlotDisplayed": {}
124
+ "slotDisplayed": {}
107
125
  };
108
126
  }
109
127
  static get elementRef() { return "host"; }
@@ -93,7 +93,6 @@ export class PostHeader {
93
93
  this.updateLocalHeaderHeight = this.updateLocalHeaderHeight.bind(this);
94
94
  this.keyboardHandler = this.keyboardHandler.bind(this);
95
95
  this.handleLinkClick = this.handleLinkClick.bind(this);
96
- this.megadropdownStateHandler = this.megadropdownStateHandler.bind(this);
97
96
  this.checkSlottedContent = this.checkSlottedContent.bind(this);
98
97
  this.megadropdownStateHandler = this.megadropdownStateHandler.bind(this);
99
98
  }
@@ -311,10 +310,10 @@ export class PostHeader {
311
310
  render() {
312
311
  const onDesktop = Build.isServer || this.device === 'desktop';
313
312
  const onTabletAndMobile = Build.isServer || this.device !== 'desktop';
314
- return (h(Host, { key: '3a016b6739ecd18aa06908b9afad8687d4a712c1', "data-version": version, "data-color-scheme": "light", "data-burger-menu": this.hasBurgerMenu, "data-menu-extended": this.burgerMenuExtended }, h("header", { key: '7066f5c25151411f0278fd533b94f58c33639734' }, h("div", { key: '983c81fbf93d290ea922ef096cd3975dbe50f2cf', class: "global-header" }, h("div", { key: '544c383fdaa252e7830ad516817f76c078b5f470', class: "section" }, h("div", { key: 'c40d977c47523dd9e77189e6cdc6bd2244efd494', class: "logo" }, h("slot", { key: 'bbf8224f6175164fcfdbd2a3ff82e716e95f2625', name: "post-logo" })), h("div", { key: '12b86a5d0a1e699bea709843dcc1fc5c337c0f5f', class: "sliding-controls" }, onDesktop && (h("div", { key: 'e61e9dd6d8b71c2dc85585474cd8c706298134f7', class: "audience" }, h("slot", { key: 'cda29d61263c8db64871bbdd024082e7fe85e981', name: "audience" }))), h("slot", { key: '003dcc8c02571ae211ae5533bbf497294742b72d', name: "global-nav-primary" }), (onDesktop || !this.hasMainNav) && [
315
- h("slot", { key: 'b29102d85a0f072f0180fc31a98926e65e8f5787', name: "global-nav-secondary" }),
316
- h("slot", { key: '5b026ad48db5d9cd1965d2fe3738a76643221ae9', name: "language-menu" }),
317
- ], h("slot", { key: '689a024322afc2104e904692653aaa29a58f37cb', name: "post-login" }), onTabletAndMobile && this.hasMainNav && (h("post-togglebutton", { key: '3abdb29b313a7f87d7a5db4016dbca6c2db245ab', class: "burger-button", ref: el => (this.burgerMenuButton = el), onClick: () => this.toggleBurgerMenu() }, h("span", { key: 'dbc87e156c0517bbb248a4a64722a390a80fce4f' }, this.textMenu), h("post-icon", { key: 'da8b9e64e10d99a2d6f9228fb2646c03392468e2', "aria-hidden": "true", name: "burger", "data-showwhen": "untoggled" }), h("post-icon", { key: '3122703175ff68eed014a025939a1021fcb39343', "aria-hidden": "true", name: "closex", "data-showwhen": "toggled" })))))), h("div", { key: 'ce46d99d627c827a19b173a566c6000b708c8fc3', ref: el => (this.localHeader = el), class: { 'local-header': true, 'megadropdown-open': this.megadropdownOpen } }, h("div", { key: 'e11916e8674ca5154b3d2926f68f38760ae0a8ed', class: "section" }, h("slot", { key: '001da677105c63d3e491af0ce96d9cb44073addd', name: "side-nav" }), h("slot", { key: '1dd01962688baba6001bb1b0d2e6f12a1bd9ecee', name: "title" }), this.hasTitle && h("slot", { key: 'bf80e01e8559b857a86b6c4a47f890c75881c1ac', name: "local-nav" }), onDesktop && h("slot", { key: '9a23f56489ec5183a30db3556a2dc643681ab6d5', name: "main-nav" }), onDesktop && !this.hasTitle && h("slot", { key: '730782e3a41cb80427ef97a1c452f0de588c62e2', name: "local-nav" }))), this.hasBurgerMenu && this.renderBurgerMenu())));
313
+ return (h(Host, { key: '27f2b45fb1462bab63be02bbdcb57ad9a2598bde', "data-version": version, "data-color-scheme": "light", "data-burger-menu": this.hasBurgerMenu, "data-menu-extended": this.burgerMenuExtended }, h("header", { key: '294bef701f378a96b06379806edae087d9211270' }, h("div", { key: '2df4d34bd7d5b714cac70b7201f2a17f7bf64517', class: "global-header" }, h("div", { key: 'd7902c1b10177b3790fb61035c527acf36fc0c3d', class: "section" }, h("div", { key: '952fed12ff5c717750a50ac32872f728ddabb113', class: "logo" }, h("slot", { key: 'a0a824677325c8a68fe483c8f6f7ef49378d5f4e', name: "post-logo" })), h("div", { key: '0dd5218658a03ebfcf049f47a1efa7197ca4e8cc', class: "sliding-controls" }, onDesktop && (h("div", { key: '9911f969b099b26d5e84d37d36aa7fd0ba44969f', class: "audience" }, h("slot", { key: '57b09b2030b7812990a915691fad10fb6d5bb474', name: "audience" }))), h("slot", { key: 'b6ba1ee1d5371504d3b4b9f12ca6d8ff2b5c36fa', name: "global-nav-primary" }), (onDesktop || !this.hasMainNav) && [
314
+ h("slot", { key: "global-nav-secondary", name: "global-nav-secondary" }),
315
+ h("slot", { key: "language-menu", name: "language-menu" }),
316
+ ], h("slot", { key: '669cebef2ce5905fee07abec99b0acced7ef42e5', name: "post-login" }), onTabletAndMobile && this.hasMainNav && (h("post-togglebutton", { key: '9268220b8e838053d86abacc9e8334463a23350c', class: "burger-button", ref: el => (this.burgerMenuButton = el), onClick: () => this.toggleBurgerMenu() }, h("span", { key: '6706c34956268e049dd35fe12992b7b746aa394a' }, this.textMenu), h("post-icon", { key: '6578bc195b018c1202bda1732253f71e27df6244', "aria-hidden": "true", name: "burger", "data-showwhen": "untoggled" }), h("post-icon", { key: '506087286c148dbb55b963288add6935001c1feb', "aria-hidden": "true", name: "closex", "data-showwhen": "toggled" })))))), h("div", { key: 'c645c82f3a71151a16bda3802a69228c1be048e9', ref: el => (this.localHeader = el), class: { 'local-header': true, 'megadropdown-open': this.megadropdownOpen } }, h("div", { key: 'ae30584b05570d62323a2d32f90653b38297b869', class: "section" }, h("slot", { key: '70b60e0d71a2f9c1e6a48d664ceb3778f5a3067a', name: "side-nav" }), h("slot", { key: 'cc356649c53e46b758916a44d4d7fb889e031172', name: "title" }), this.hasTitle && h("slot", { key: 'fbbd76c5c2cce8991c0cfcc740fe9231c1677f79', name: "local-nav" }), onDesktop && h("slot", { key: 'fd7e94fac20a263960e7ebbc66ddfac23bd954e8', name: "main-nav" }), onDesktop && !this.hasTitle && h("slot", { key: '38ac26fb18f85f1c42b4a7bdd97dc0e1b25ca940', name: "local-nav" }))), this.hasBurgerMenu && this.renderBurgerMenu())));
318
317
  }
319
318
  static get is() { return "post-header"; }
320
319
  static get encapsulation() { return "shadow"; }
@@ -102,7 +102,7 @@ export class PostIcon {
102
102
  }).filter(([_key, value]) => value !== null));
103
103
  }
104
104
  render() {
105
- return (h(Host, { key: 'ce81db69bf77d09a0a331bac48cdaede7ff3cb8e', "data-version": version }, h("span", { key: '211f999da845687289fd991421f4315a090a67ba', style: this.getStyles() })));
105
+ return (h(Host, { key: '9d7b98a18fa098702c0fe1bd06544f605801db6a', "data-version": version }, h("span", { key: '847682d63ce72e26a541f40b29255e81febaf79e', style: this.getStyles() })));
106
106
  }
107
107
  static get is() { return "post-icon"; }
108
108
  static get encapsulation() { return "shadow"; }
@@ -1,61 +1,66 @@
1
1
  import { version } from "../../../../package";
2
2
  import { h, Host } from "@stencil/core";
3
- const INTERACTIVE_ELEMENTS = [
3
+ const INTERACTIVE_ELEMENT_SELECTOR = [
4
+ 'a',
5
+ 'button',
6
+ 'input',
7
+ 'select',
8
+ 'textarea',
9
+ 'label',
10
+ 'fieldset',
11
+ 'optgroup',
12
+ 'option',
13
+ ].join(',');
14
+ const LINKAREA_TARGET_SELECTOR = [
4
15
  'a',
5
16
  'label[for]',
6
17
  'input[type="checkbox"]',
7
18
  'input[type="radio"]',
8
19
  ].join(',');
9
- const INTERACTIVE_ELEMENTS_SELECTOR = `:where(${INTERACTIVE_ELEMENTS})`;
20
+ function isDisabled(element) {
21
+ const fieldset = element.closest('fieldset');
22
+ if (fieldset && fieldset.disabled)
23
+ return true;
24
+ return 'disabled' in element && Boolean(element.disabled);
25
+ }
10
26
  export class PostLinkarea {
11
- get interactiveElement() {
12
- return this.host.querySelector(INTERACTIVE_ELEMENTS_SELECTOR);
27
+ getDirectTarget(event) {
28
+ for (const element of event.composedPath()) {
29
+ if (element instanceof HTMLSlotElement)
30
+ break;
31
+ if (element === this.host)
32
+ break;
33
+ if (element instanceof HTMLElement && element.matches(INTERACTIVE_ELEMENT_SELECTOR)) {
34
+ return element;
35
+ }
36
+ }
37
+ return null;
13
38
  }
14
- isDisabledElement(element) {
15
- // check if the element is an interactive, deactivatable element (button, fieldset, optgroup, option, select, textarea, input) and is disabled
16
- const isDeactivatableElement = [
17
- HTMLButtonElement,
18
- HTMLFieldSetElement,
19
- HTMLOptGroupElement,
20
- HTMLOptionElement,
21
- HTMLSelectElement,
22
- HTMLTextAreaElement,
23
- HTMLInputElement,
24
- ].some(instance => element instanceof instance);
25
- const isDisabled = element.disabled;
26
- const isFieldsetDisabled = element.closest('fieldset')?.hasAttribute('disabled');
27
- return isDeactivatableElement && (isDisabled || isFieldsetDisabled);
39
+ getDelegateTarget() {
40
+ return this.host.querySelector(LINKAREA_TARGET_SELECTOR);
28
41
  }
29
- dispatchClick({ target, ctrlKey, shiftKey, altKey, metaKey }) {
30
- const interactiveElement = target.closest(INTERACTIVE_ELEMENTS_SELECTOR);
31
- let dispatchEvent;
32
- if (!this.interactiveElement) {
33
- // do NOT dispatch event, if there is no interactive element inside the host,
34
- // as there is no element to dispatch the event to
35
- dispatchEvent = false;
36
- }
37
- else if (this.isDisabledElement(this.interactiveElement)) {
38
- // do NOT dispatch event, if the interactive element is disabled,
39
- // as disabled elements do not trigger events
40
- // in this case, it's not important if the interactive element has been clicked directly or not, as the event will not be dispatched in either case
41
- dispatchEvent = false;
42
- }
43
- else if (interactiveElement instanceof HTMLLabelElement) {
44
- // do NOT dispatch event, if the label (or a descendant) is associated with an input element inside the host,
45
- // as the label will trigger a click on the associated input element anyway
46
- dispatchEvent = this.host.querySelector(`#${interactiveElement.htmlFor}`) === null;
47
- }
48
- else {
49
- // do NOT dispatch event, if the interactive element (or a descendant) has been clicked directly,
50
- // as the event will be dispatched by the interactive element itself
51
- dispatchEvent = !interactiveElement;
52
- }
53
- if (dispatchEvent) {
54
- this.interactiveElement.dispatchEvent(new MouseEvent('click', { ctrlKey, shiftKey, altKey, metaKey }));
55
- }
42
+ dispatchClick(event) {
43
+ // If a non-disabled interactive element was clicked directly, let the browser handle it
44
+ const directTarget = this.getDirectTarget(event);
45
+ if (directTarget && !isDisabled(directTarget))
46
+ return;
47
+ // No delegate target or delegate target is disabled nothing to forward
48
+ const delegateTarget = this.getDelegateTarget();
49
+ if (!delegateTarget || isDisabled(delegateTarget))
50
+ return;
51
+ const { ctrlKey, shiftKey, altKey, metaKey, button } = event;
52
+ delegateTarget.dispatchEvent(new MouseEvent('click', {
53
+ cancelable: true,
54
+ bubbles: true,
55
+ ctrlKey,
56
+ shiftKey,
57
+ altKey,
58
+ metaKey,
59
+ button,
60
+ }));
56
61
  }
57
62
  render() {
58
- return (h(Host, { key: 'cb2563465ebe024e8e98539c27c7a8d7084229d3', "data-version": version, onClick: (e) => this.dispatchClick(e) }, h("slot", { key: '68fc1468da418e4ed38e89cbf7ef932f819993dd' })));
63
+ return (h(Host, { key: 'aa721ba7506fefd66348e09fd17ce828dec89050', "data-version": version, onClick: (e) => this.dispatchClick(e) }, h("slot", { key: '1ad85663662fc0f6c877ff88a6570ff4d4b1fa33' })));
59
64
  }
60
65
  static get is() { return "post-linkarea"; }
61
66
  static get encapsulation() { return "shadow"; }
@@ -1 +1 @@
1
- post-popovercontainer{border-radius:4px;overflow:hidden;box-shadow:var(--post-device-elevation-300)}div[role=listbox]{max-height:384px;overflow:auto;display:flex;flex-direction:column}::slotted([slot=blank-slate]){display:block;padding:.75rem;color:#666}
1
+ post-popovercontainer{border-radius:4px;overflow:hidden;box-shadow:var(--post-device-elevation-300)}div[role=listbox]{max-height:384px;overflow:auto;display:flex;flex-direction:column}
@@ -129,7 +129,7 @@ export class PostListbox {
129
129
  this.updateSelection(event.detail);
130
130
  }
131
131
  render() {
132
- return (h(Host, { key: '55f1f7335a5eed38163aa58a43f091f130a9a2ff', "data-version": version, role: "listbox" }, h("post-popovercontainer", { key: '303a6b38d8c5e5fae7b295dd0a58008c7b39a23f', placement: "bottom-start", ref: el => (this.popoverContainer = el) }, this.visibleOptions.length === 0 ? h("slot", { name: "blank-slate" }) : h("slot", null))));
132
+ return (h(Host, { key: 'd9008aa55aca4e0a65fdffd67485d74ddc4069f6', "data-version": version, role: "listbox" }, h("post-popovercontainer", { key: '5ba4d68483581101ca4bf6fea04102fa883b71d1', placement: "bottom-start", ref: el => (this.popoverContainer = el) }, h("slot", { key: '286a31eff1b70ec35efcfa745103933598589f2a', name: "blank-slate" }), h("slot", { key: '4cebce7de3143c3eb1deafa57209f7295aa6ec44' }))));
133
133
  }
134
134
  static get is() { return "post-listbox"; }
135
135
  static get encapsulation() { return "shadow"; }
@@ -38,6 +38,10 @@ export class PostMegadropdown {
38
38
  this.trigger = false;
39
39
  /** Holds the current animation class. */
40
40
  this.animationClass = null;
41
+ this.breakpointChange = (e) => {
42
+ this.device = e.detail;
43
+ this.cancelAnimation();
44
+ };
41
45
  this.handleClickOutside = async (event) => {
42
46
  if (this.device !== 'desktop')
43
47
  return;
@@ -65,7 +69,7 @@ export class PostMegadropdown {
65
69
  this.handleClickOutside = this.handleClickOutside.bind(this);
66
70
  }
67
71
  connectedCallback() {
68
- globalThis.addEventListener('postBreakpoint:device', this.breakpointChange.bind(this));
72
+ globalThis.addEventListener('postBreakpoint:device', this.breakpointChange);
69
73
  }
70
74
  componentDidRender() {
71
75
  this.getFocusableElements();
@@ -76,7 +80,7 @@ export class PostMegadropdown {
76
80
  this.handleAriaCurrentChange([]);
77
81
  }
78
82
  disconnectedCallback() {
79
- globalThis.removeEventListener('postBreakpoint:device', this.breakpointChange.bind(this));
83
+ globalThis.removeEventListener('postBreakpoint:device', this.breakpointChange);
80
84
  if (PostMegadropdown.activeDropdown === this)
81
85
  PostMegadropdown.activeDropdown = null;
82
86
  this.removeListeners();
@@ -204,10 +208,6 @@ export class PostMegadropdown {
204
208
  this.currentAnimation?.cancel();
205
209
  this.currentAnimation = null;
206
210
  }
207
- breakpointChange(e) {
208
- this.device = e.detail;
209
- this.cancelAnimation();
210
- }
211
211
  addListeners() {
212
212
  this.host.addEventListener('keydown', this.keyboardHandler);
213
213
  document.addEventListener('keyup', this.handleTabOutside);
@@ -295,7 +295,7 @@ export class PostMegadropdown {
295
295
  }
296
296
  render() {
297
297
  const containerStyle = this.isVisible ? {} : { display: 'none' };
298
- return (h(Host, { key: 'e2f7cac1fd168c54334a7c2584ce07f387457c77', version: version }, h("div", { key: '5bd9e9d856c3038d30246e913b51348097507f21', ref: el => (this.animatedContainer = el), class: "megadropdown", style: containerStyle }, h("div", { key: '13bf455331b1921f5e12fa0ebac27261bc608e89', class: "section" }, this.device !== 'desktop' && this.megadropdownTitle && (h("p", { key: '75985254f1217f0f6d138fa14aa6af228ee1d0f5', class: "megadropdown-title" }, this.megadropdownTitle)), h("div", { key: '2bb4219a62f7de1236f8208bdd01f22fd00dab00', class: "megadropdown-content" }, h("slot", { key: 'ad3c1b6e6ad5bc07e64f829a68fb933db1fc5016' })), this.device === 'desktop' ? (h("post-closebutton", { onClick: () => this.hide(true), class: "close-button", size: "small", placement: "manual" }, this.textClose)) : (h("button", { onClick: () => this.hide(true), class: "back-button" }, h("post-icon", { name: "arrowleft" }), this.textBack))))));
298
+ return (h(Host, { key: '355f69ea10cd4c3c058e4c1e6818f1c9da7d4102', version: version }, h("div", { key: '9c2b9b31aa450c1e1b4257066a38bd3660e834ef', ref: el => (this.animatedContainer = el), class: "megadropdown", style: containerStyle }, h("div", { key: '7fe7f257bb41b43b72cda39f1614c5ba4726b940', class: "section" }, this.device !== 'desktop' && this.megadropdownTitle && (h("p", { key: '09ffb0ce4a56453d33d4366ce30c0bce09395f93', class: "megadropdown-title" }, this.megadropdownTitle)), h("div", { key: 'd88fb0218c8788981dd7f3213979eba5ab7ff333', class: "megadropdown-content" }, h("slot", { key: 'ab64e771770bd42c4f077ebe5e05685cb285134f' })), this.device === 'desktop' ? (h("post-closebutton", { onClick: () => this.hide(true), class: "close-button", size: "small", placement: "manual" }, this.textClose)) : (h("button", { onClick: () => this.hide(true), class: "back-button" }, h("post-icon", { name: "arrowleft" }), this.textBack))))));
299
299
  }
300
300
  static get is() { return "post-megadropdown"; }
301
301
  static get encapsulation() { return "shadow"; }
@@ -1 +1 @@
1
- .btn{display:inline-flex;position:relative;align-items:center;justify-content:center;max-width:100%;overflow:hidden;transition:opacity 250ms,border-color 250ms,background-color 250ms,color 250ms;border-width:var(--post-device-border-width-default);border-style:solid;border-color:rgba(0,0,0,0);border-radius:var(--post-device-border-radius-round);background-color:rgba(0,0,0,0);box-shadow:none;font-family:inherit;font-size:var(--post-device-font-size-6);font-weight:var(--post-device-font-weight-bold);text-decoration:none;white-space:nowrap;cursor:pointer;min-height:var(--post-device-sizing-interactive-button-height-1);gap:var(--post-device-spacing-gap-inline-10);padding:0 var(--post-device-spacing-padding-inline-6)}.btn:not(:disabled):hover{text-decoration:none}.btn:disabled{border-style:var(--post-core-border-style-dash);cursor:unset}.btn{outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}.btn:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.btn:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){.btn:is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.btn:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.btn:is(button){background-color:ButtonFace !important;border:1px solid ButtonBorder !important}.btn:not(:disabled,.disabled):is(button):hover{background-color:Highlight !important}.btn:not(:disabled,.disabled):is(button):hover>post-icon{color:HighlightText !important}}.btn>post-icon{width:var(--post-device-sizing-interactive-button-icon-4);height:var(--post-device-sizing-interactive-button-icon-4)}.btn-primary{box-shadow:var(--post-device-elevation-100);border-color:var(--post-scheme-color-interactive-button-primary-enabled-stroke);color:var(--post-scheme-color-interactive-button-primary-enabled-fg);background-color:var(--post-scheme-color-interactive-button-primary-enabled-bg)}.btn-primary:disabled{border-color:var(--post-scheme-color-interactive-button-primary-disabled-stroke);color:var(--post-scheme-color-interactive-button-primary-disabled-fg);background-color:var(--post-scheme-color-interactive-button-primary-disabled-bg)}.btn-primary:not(:disabled):hover,.btn-primary.pretend-hover{border-color:var(--post-scheme-color-interactive-button-primary-hover-stroke);color:var(--post-scheme-color-interactive-button-primary-hover-fg);background-color:var(--post-scheme-color-interactive-button-primary-hover-bg)}.btn-default{box-shadow:var(--post-device-elevation-100);border-color:var(--post-scheme-color-interactive-button-secondary-enabled-stroke);color:var(--post-scheme-color-interactive-button-secondary-enabled-fg);background-color:var(--post-scheme-color-interactive-button-secondary-enabled-bg)}.btn-default:disabled{border-color:var(--post-scheme-color-interactive-button-secondary-disabled-stroke);color:var(--post-scheme-color-interactive-button-secondary-disabled-fg);background-color:var(--post-scheme-color-interactive-button-secondary-disabled-bg)}.btn-default:not(:disabled):hover,.btn-default.pretend-hover{border-color:var(--post-scheme-color-interactive-button-secondary-hover-stroke);color:var(--post-scheme-color-interactive-button-secondary-hover-fg);background-color:var(--post-scheme-color-interactive-button-secondary-hover-bg)}.btn-secondary{box-shadow:var(--post-device-elevation-100);border-color:var(--post-scheme-color-interactive-button-secondary-enabled-stroke);color:var(--post-scheme-color-interactive-button-secondary-enabled-fg);background-color:var(--post-scheme-color-interactive-button-secondary-enabled-bg)}.btn-secondary:disabled{border-color:var(--post-scheme-color-interactive-button-secondary-disabled-stroke);color:var(--post-scheme-color-interactive-button-secondary-disabled-fg);background-color:var(--post-scheme-color-interactive-button-secondary-disabled-bg)}.btn-secondary:not(:disabled):hover,.btn-secondary.pretend-hover{border-color:var(--post-scheme-color-interactive-button-secondary-hover-stroke);color:var(--post-scheme-color-interactive-button-secondary-hover-fg);background-color:var(--post-scheme-color-interactive-button-secondary-hover-bg)}.btn-tertiary{border-color:var(--post-scheme-color-interactive-button-tertiary-enabled-stroke);color:var(--post-scheme-color-interactive-button-tertiary-enabled-fg);background-color:var(--post-scheme-color-interactive-button-tertiary-enabled-bg)}.btn-tertiary:disabled{border-color:var(--post-scheme-color-interactive-button-tertiary-disabled-stroke);color:var(--post-scheme-color-interactive-button-tertiary-disabled-fg);background-color:var(--post-scheme-color-interactive-button-tertiary-disabled-bg)}.btn-tertiary:not(:disabled):hover,.btn-tertiary.pretend-hover{border-color:var(--post-scheme-color-interactive-button-tertiary-hover-stroke);color:var(--post-scheme-color-interactive-button-tertiary-hover-fg);background-color:var(--post-scheme-color-interactive-button-tertiary-hover-bg)}.btn-link{border-color:var(--post-scheme-color-interactive-button-tertiary-enabled-stroke);color:var(--post-scheme-color-interactive-button-tertiary-enabled-fg)}.btn-link:disabled{border-color:var(--post-scheme-color-interactive-button-tertiary-disabled-stroke);color:var(--post-scheme-color-interactive-button-tertiary-disabled-fg)}.btn-link:not(:disabled):hover,.btn-link.pretend-hover{border-color:var(--post-scheme-color-interactive-button-tertiary-hover-stroke);color:var(--post-scheme-color-interactive-button-tertiary-hover-fg)}.btn-sm{min-height:var(--post-device-sizing-interactive-button-height-4);gap:var(--post-device-spacing-gap-inline-11);padding:0 var(--post-device-spacing-padding-inline-7)}.btn-sm>post-icon{width:var(--post-device-sizing-interactive-button-icon-5);height:var(--post-device-sizing-interactive-button-icon-5)}.btn-lg{min-height:var(--post-device-sizing-interactive-button-height-2);gap:var(--post-device-spacing-gap-inline-1);padding:0 var(--post-device-spacing-padding-inline-5)}.btn-lg>post-icon{width:var(--post-device-sizing-interactive-button-icon-3);height:var(--post-device-sizing-interactive-button-icon-3)}.btn-link{-webkit-text-decoration:var(--post-core-text-decoration-underline);text-decoration:var(--post-core-text-decoration-underline);border:0 none;border-radius:0;min-height:0;font-size:inherit;font-weight:inherit;padding:0}.btn-link:is(:focus-visible,:has(:focus-visible),.pretend-focus){border-radius:var(--post-device-border-radius-focus)}@supports not selector(:has(:focus-visible)){.btn-link:is(:focus-visible,:focus-within,.pretend-focus){border-radius:var(--post-device-border-radius-focus)}}.btn-link:hover{color:var(--post-scheme-color-interactive-primary-hover-fg1)}.btn-icon{padding:0;width:var(--post-device-sizing-interactive-button-height-1);height:var(--post-device-sizing-interactive-button-height-1);min-height:0;vertical-align:text-bottom}.btn-icon.btn-link{width:var(--post-device-sizing-interactive-button-icon-4);height:var(--post-device-sizing-interactive-button-icon-4)}.btn-icon>post-icon{display:block;width:var(--post-device-sizing-interactive-button-icon-4);height:var(--post-device-sizing-interactive-button-icon-4)}.btn-icon.btn-sm{padding:0;width:var(--post-device-sizing-interactive-button-height-4);height:var(--post-device-sizing-interactive-button-height-4);min-height:0;vertical-align:text-bottom}.btn-icon.btn-sm.btn-link{width:var(--post-device-sizing-interactive-button-icon-5);height:var(--post-device-sizing-interactive-button-icon-5)}.btn-icon.btn-sm>post-icon{display:block;width:var(--post-device-sizing-interactive-button-icon-5);height:var(--post-device-sizing-interactive-button-icon-5)}.btn-icon.btn-lg{padding:0;width:var(--post-device-sizing-interactive-button-height-2);height:var(--post-device-sizing-interactive-button-height-2);min-height:0;vertical-align:text-bottom}.btn-icon.btn-lg.btn-link{width:var(--post-device-sizing-interactive-button-icon-3);height:var(--post-device-sizing-interactive-button-icon-3)}.btn-icon.btn-lg>post-icon{display:block;width:var(--post-device-sizing-interactive-button-icon-3);height:var(--post-device-sizing-interactive-button-icon-3)}.pagination{position:relative;display:flex;align-items:center;justify-content:center;width:100%;max-width:100%;padding:var(--post-device-spacing-padding-15);overflow:hidden}.pagination-list{display:flex;align-items:center;gap:var(--post-device-spacing-gap-inline-4);min-width:0;max-width:100%;margin:0;padding:0;list-style:none;flex-wrap:nowrap}.pagination-list .pagination-control:first-child{margin-inline-end:calc(var(--post-device-spacing-gap-11) - var(--post-device-spacing-gap-inline-4))}.pagination-list .pagination-control:last-child{margin-inline-start:calc(var(--post-device-spacing-gap-11) - var(--post-device-spacing-gap-inline-4))}.pagination-item{display:flex;align-items:center;margin:0;padding:0;flex-shrink:0;flex-grow:0}.pagination-ellipsis,.pagination-link,.pagination-ellipsis-content{display:flex;align-items:center;justify-content:center}.pagination-link,.pagination-ellipsis-content{width:var(--post-device-sizing-interactive-button-height-1);height:var(--post-device-sizing-interactive-button-height-1);min-width:var(--post-device-sizing-interactive-button-height-1);font-size:var(--post-device-font-size-6);color:var(--post-scheme-color-interactive-primary-enabled-fg1);font-weight:var(--post-device-font-weight-bold)}.pagination-link{box-sizing:border-box;padding:0;margin:0;font-weight:var(--post-device-font-weight-bold);text-decoration:none;background-color:var(--post-scheme-color-interactive-primary-enabled-bg4);border:var(--post-device-border-width-default) solid var(--post-scheme-color-interactive-primary-enabled-stroke5);border-radius:var(--post-device-border-radius-round);cursor:pointer;appearance:none;outline:none;transition:opacity 250ms,border-color 250ms,background-color 250ms,color 250ms}.pagination-link{outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}.pagination-link:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.pagination-link:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){.pagination-link:is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.pagination-link:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}.pagination-link:active:not(.pagination-link-active),.pagination-link:hover{color:var(--post-scheme-color-interactive-primary-hover-fg1);background-color:var(--post-scheme-color-interactive-primary-hover-bg5);border-color:var(--post-scheme-color-interactive-primary-hover-stroke)}.pagination-link.pagination-link-active{color:var(--post-scheme-color-interactive-primary-selected-fg3);background-color:var(--post-scheme-color-interactive-primary-selected-bg4);border-color:var(--post-scheme-color-interactive-primary-selected-stroke1);cursor:default}.pagination-ellipsis{flex-shrink:0;flex-grow:0}.pagination-ellipsis-content{user-select:none}.hidden-items{position:absolute;display:flex;gap:var(--post-device-spacing-gap-11);height:0;overflow:hidden;white-space:nowrap;visibility:hidden;pointer-events:none}.visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}
1
+ .btn{display:inline-flex;position:relative;align-items:center;justify-content:center;max-width:100%;overflow:hidden;transition:opacity 250ms,border-color 250ms,background-color 250ms,color 250ms;border-width:var(--post-device-border-width-default);border-style:solid;border-color:rgba(0,0,0,0);border-radius:var(--post-device-border-radius-round);background-color:rgba(0,0,0,0);box-shadow:none;font-family:inherit;font-size:var(--post-device-font-size-6);font-weight:var(--post-device-font-weight-bold);text-decoration:none;white-space:nowrap;cursor:pointer;min-height:var(--post-device-sizing-interactive-button-height-1);gap:var(--post-device-spacing-gap-inline-10);padding:0 var(--post-device-spacing-padding-inline-6)}.btn:not(:disabled):hover{text-decoration:none}.btn:disabled{border-style:var(--post-core-border-style-dash);cursor:unset}.btn{outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}.btn:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.btn:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){.btn:is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.btn:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.btn:is(button){background-color:ButtonFace !important;border:1px solid ButtonBorder !important}.btn:not(:disabled,.disabled):is(button):hover{background-color:Highlight !important}.btn:not(:disabled,.disabled):is(button):hover>post-icon{color:HighlightText !important}}.btn>post-icon{width:var(--post-device-sizing-interactive-button-icon-4);height:var(--post-device-sizing-interactive-button-icon-4)}.btn-primary{box-shadow:var(--post-device-elevation-100);border-color:var(--post-scheme-color-interactive-button-primary-enabled-stroke);color:var(--post-scheme-color-interactive-button-primary-enabled-fg);background-color:var(--post-scheme-color-interactive-button-primary-enabled-bg)}.btn-primary:disabled{border-color:var(--post-scheme-color-interactive-button-primary-disabled-stroke);color:var(--post-scheme-color-interactive-button-primary-disabled-fg);background-color:var(--post-scheme-color-interactive-button-primary-disabled-bg)}.btn-primary:not(:disabled):hover,.btn-primary.pretend-hover{border-color:var(--post-scheme-color-interactive-button-primary-hover-stroke);color:var(--post-scheme-color-interactive-button-primary-hover-fg);background-color:var(--post-scheme-color-interactive-button-primary-hover-bg)}.btn-default{box-shadow:var(--post-device-elevation-100);border-color:var(--post-scheme-color-interactive-button-secondary-enabled-stroke);color:var(--post-scheme-color-interactive-button-secondary-enabled-fg);background-color:var(--post-scheme-color-interactive-button-secondary-enabled-bg)}.btn-default:disabled{border-color:var(--post-scheme-color-interactive-button-secondary-disabled-stroke);color:var(--post-scheme-color-interactive-button-secondary-disabled-fg);background-color:var(--post-scheme-color-interactive-button-secondary-disabled-bg)}.btn-default:not(:disabled):hover,.btn-default.pretend-hover{border-color:var(--post-scheme-color-interactive-button-secondary-hover-stroke);color:var(--post-scheme-color-interactive-button-secondary-hover-fg);background-color:var(--post-scheme-color-interactive-button-secondary-hover-bg)}.btn-secondary{box-shadow:var(--post-device-elevation-100);border-color:var(--post-scheme-color-interactive-button-secondary-enabled-stroke);color:var(--post-scheme-color-interactive-button-secondary-enabled-fg);background-color:var(--post-scheme-color-interactive-button-secondary-enabled-bg)}.btn-secondary:disabled{border-color:var(--post-scheme-color-interactive-button-secondary-disabled-stroke);color:var(--post-scheme-color-interactive-button-secondary-disabled-fg);background-color:var(--post-scheme-color-interactive-button-secondary-disabled-bg)}.btn-secondary:not(:disabled):hover,.btn-secondary.pretend-hover{border-color:var(--post-scheme-color-interactive-button-secondary-hover-stroke);color:var(--post-scheme-color-interactive-button-secondary-hover-fg);background-color:var(--post-scheme-color-interactive-button-secondary-hover-bg)}.btn-tertiary{border-color:var(--post-scheme-color-interactive-button-tertiary-enabled-stroke);color:var(--post-scheme-color-interactive-button-tertiary-enabled-fg);background-color:var(--post-scheme-color-interactive-button-tertiary-enabled-bg)}.btn-tertiary:disabled{border-color:var(--post-scheme-color-interactive-button-tertiary-disabled-stroke);color:var(--post-scheme-color-interactive-button-tertiary-disabled-fg);background-color:var(--post-scheme-color-interactive-button-tertiary-disabled-bg)}.btn-tertiary:not(:disabled):hover,.btn-tertiary.pretend-hover{border-color:var(--post-scheme-color-interactive-button-tertiary-hover-stroke);color:var(--post-scheme-color-interactive-button-tertiary-hover-fg);background-color:var(--post-scheme-color-interactive-button-tertiary-hover-bg)}.btn-link{border-color:var(--post-scheme-color-interactive-button-tertiary-enabled-stroke);color:var(--post-scheme-color-interactive-button-tertiary-enabled-fg)}.btn-link:disabled{border-color:var(--post-scheme-color-interactive-button-tertiary-disabled-stroke);color:var(--post-scheme-color-interactive-button-tertiary-disabled-fg)}.btn-link:not(:disabled):hover,.btn-link.pretend-hover{border-color:var(--post-scheme-color-interactive-button-tertiary-hover-stroke);color:var(--post-scheme-color-interactive-button-tertiary-hover-fg)}.btn-sm{min-height:var(--post-device-sizing-interactive-button-height-4);gap:var(--post-device-spacing-gap-inline-11);padding:0 var(--post-device-spacing-padding-inline-7)}.btn-sm>post-icon{width:var(--post-device-sizing-interactive-button-icon-5);height:var(--post-device-sizing-interactive-button-icon-5)}.btn-lg{min-height:var(--post-device-sizing-interactive-button-height-2);gap:var(--post-device-spacing-gap-inline-1);padding:0 var(--post-device-spacing-padding-inline-5)}.btn-lg>post-icon{width:var(--post-device-sizing-interactive-button-icon-3);height:var(--post-device-sizing-interactive-button-icon-3)}.btn-link{-webkit-text-decoration:var(--post-core-text-decoration-underline);text-decoration:var(--post-core-text-decoration-underline);border:0 none;border-radius:0;min-height:0;font-size:inherit;font-weight:inherit;padding:0}.btn-link:is(:focus-visible,:has(:focus-visible),.pretend-focus){border-radius:var(--post-device-border-radius-focus)}@supports not selector(:has(:focus-visible)){.btn-link:is(:focus-visible,:focus-within,.pretend-focus){border-radius:var(--post-device-border-radius-focus)}}.btn-link:hover{color:var(--post-scheme-color-interactive-primary-hover-fg1)}.btn-icon{padding:0;width:var(--post-device-sizing-interactive-button-height-1);height:var(--post-device-sizing-interactive-button-height-1);min-height:0;vertical-align:text-bottom}.btn-icon.btn-link{width:var(--post-device-sizing-interactive-button-icon-4);height:var(--post-device-sizing-interactive-button-icon-4)}.btn-icon>post-icon{display:block;width:var(--post-device-sizing-interactive-button-icon-4);height:var(--post-device-sizing-interactive-button-icon-4)}.btn-icon.btn-sm{padding:0;width:var(--post-device-sizing-interactive-button-height-4);height:var(--post-device-sizing-interactive-button-height-4);min-height:0;vertical-align:text-bottom}.btn-icon.btn-sm.btn-link{width:var(--post-device-sizing-interactive-button-icon-5);height:var(--post-device-sizing-interactive-button-icon-5)}.btn-icon.btn-sm>post-icon{display:block;width:var(--post-device-sizing-interactive-button-icon-5);height:var(--post-device-sizing-interactive-button-icon-5)}.btn-icon.btn-lg{padding:0;width:var(--post-device-sizing-interactive-button-height-2);height:var(--post-device-sizing-interactive-button-height-2);min-height:0;vertical-align:text-bottom}.btn-icon.btn-lg.btn-link{width:var(--post-device-sizing-interactive-button-icon-3);height:var(--post-device-sizing-interactive-button-icon-3)}.btn-icon.btn-lg>post-icon{display:block;width:var(--post-device-sizing-interactive-button-icon-3);height:var(--post-device-sizing-interactive-button-icon-3)}.pagination{position:relative;display:flex;align-items:center;justify-content:center;width:100%;max-width:100%;padding:var(--post-device-spacing-padding-15);overflow:hidden;box-sizing:border-box}.pagination-list{display:flex;align-items:center;gap:var(--post-device-spacing-gap-inline-4);min-width:0;max-width:100%;margin:0;padding:0;list-style:none;flex-wrap:nowrap}.pagination-list .pagination-control:first-child{margin-inline-end:calc(var(--post-device-spacing-gap-11) - var(--post-device-spacing-gap-inline-4))}.pagination-list .pagination-control:last-child{margin-inline-start:calc(var(--post-device-spacing-gap-11) - var(--post-device-spacing-gap-inline-4))}.pagination-item{display:flex;align-items:center;margin:0;padding:0;flex-shrink:0;flex-grow:0}.pagination-ellipsis,.pagination-link,.pagination-ellipsis-content{display:flex;align-items:center;justify-content:center}.pagination-link,.pagination-ellipsis-content{width:var(--post-device-sizing-interactive-button-height-1);height:var(--post-device-sizing-interactive-button-height-1);min-width:var(--post-device-sizing-interactive-button-height-1);font-size:var(--post-device-font-size-6);color:var(--post-scheme-color-interactive-primary-enabled-fg1);font-weight:var(--post-device-font-weight-bold)}.pagination-link{box-sizing:border-box;padding:0;margin:0;font-weight:var(--post-device-font-weight-bold);text-decoration:none;background-color:var(--post-scheme-color-interactive-primary-enabled-bg4);border:var(--post-device-border-width-default) solid var(--post-scheme-color-interactive-primary-enabled-stroke5);border-radius:var(--post-device-border-radius-round);cursor:pointer;appearance:none;outline:none;transition:opacity 250ms,border-color 250ms,background-color 250ms,color 250ms}.pagination-link{outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}.pagination-link:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.pagination-link:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){.pagination-link:is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.pagination-link:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}.pagination-link:active:not(.pagination-link-active),.pagination-link:hover{color:var(--post-scheme-color-interactive-primary-hover-fg1);background-color:var(--post-scheme-color-interactive-primary-hover-bg5);border-color:var(--post-scheme-color-interactive-primary-hover-stroke)}.pagination-link.pagination-link-active{color:var(--post-scheme-color-interactive-primary-selected-fg3);background-color:var(--post-scheme-color-interactive-primary-selected-bg4);border-color:var(--post-scheme-color-interactive-primary-selected-stroke1);cursor:default}.pagination-ellipsis{flex-shrink:0;flex-grow:0}.pagination-ellipsis-content{user-select:none}.hidden-items{position:absolute;display:flex;gap:var(--post-device-spacing-gap-inline-4);height:0;overflow:hidden;white-space:nowrap;visibility:hidden;pointer-events:none}.hidden-items .pagination-control-button:not(.hidden-page-button):first-child{margin-inline-end:calc(var(--post-device-spacing-gap-11) - var(--post-device-spacing-gap-inline-4))}.hidden-items .pagination-control-button:not(.hidden-page-button):last-child{margin-inline-start:calc(var(--post-device-spacing-gap-11) - var(--post-device-spacing-gap-inline-4))}.visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}
@@ -103,15 +103,14 @@ export class PostPagination {
103
103
  const paginationPadding = this.getPaginationPadding();
104
104
  const availableWidth = this.getAvailableWidth();
105
105
  const netWidth = availableWidth - paginationPadding;
106
- const controlButtonsWidth = this.getControlButtonsWidth();
107
106
  const pageButton = this.hiddenItemsRef.querySelector('.hidden-page-button');
108
107
  const ellipsis = this.hiddenItemsRef.querySelector('.hidden-ellipsis');
109
108
  if (!pageButton)
110
109
  return;
111
110
  const singleButtonWidth = pageButton.getBoundingClientRect().width;
112
111
  const gap = pageButton && ellipsis ? this.calculateGap(pageButton, ellipsis) : 0;
113
- const controlButtonGaps = gap * 2; // Gap after prev and before next
114
- const widthForPages = netWidth - controlButtonsWidth - controlButtonGaps;
112
+ const controlButtonsWidth = this.getControlButtonsWidth(gap);
113
+ const widthForPages = netWidth - controlButtonsWidth;
115
114
  // Calculate how many page buttons can fit
116
115
  const maxPages = Math.floor((widthForPages + gap) / (singleButtonWidth + gap));
117
116
  const clampedMaxPages = Math.max(MIN_VISIBLE_PAGES, Math.min(maxPages, totalPages));
@@ -119,13 +118,17 @@ export class PostPagination {
119
118
  this.updatePagesWithValidation();
120
119
  }
121
120
  /**
122
- * Gets total width of control buttons (prev/next)
121
+ * Gets total width of control buttons (prev/next) with their respective margins and gaps
123
122
  */
124
- getControlButtonsWidth() {
123
+ getControlButtonsWidth(gap) {
125
124
  if (!this.hiddenItemsRef)
126
125
  return 0;
127
126
  const controlButtons = Array.from(this.hiddenItemsRef.querySelectorAll('.hidden-control-button'));
128
- const totalWidth = controlButtons.reduce((sum, el) => sum + el.getBoundingClientRect().width, 0);
127
+ const totalWidth = controlButtons.reduce((sum, el) => {
128
+ const mStart = Number.parseFloat(globalThis.getComputedStyle(el).marginInlineStart);
129
+ const mEnd = Number.parseFloat(globalThis.getComputedStyle(el).marginInlineEnd);
130
+ return sum + el.getBoundingClientRect().width + mStart + mEnd + gap;
131
+ }, 0);
129
132
  return totalWidth;
130
133
  }
131
134
  /**
@@ -415,6 +418,7 @@ export class PostPagination {
415
418
  */
416
419
  emitPageChange(newPage) {
417
420
  this.page = newPage;
421
+ requestAnimationFrame(() => this.measureAndCalculateVisiblePages());
418
422
  this.postChange.emit(newPage);
419
423
  }
420
424
  /**
@@ -499,10 +503,10 @@ export class PostPagination {
499
503
  */
500
504
  renderHiddenItems(totalPages, isPrevHidden, isNextHidden) {
501
505
  return [
502
- !isPrevHidden && (h("button", { class: "pagination-link pagination-control-button hidden-control-button", disabled: true }, h("post-icon", { name: "chevronleftwide", "aria-hidden": "true" }))),
503
- h("button", { class: "pagination-link pagination-control-button hidden-page-button", "aria-label": this.buildPageLabel(totalPages), disabled: true }, h("span", { "aria-hidden": "true" }, totalPages)),
504
- h("span", { class: "pagination-ellipsis-content hidden-ellipsis", "aria-hidden": "true" }, ELLIPSIS),
505
- !isNextHidden && (h("button", { class: "pagination-link pagination-control-button hidden-control-button", disabled: true }, h("post-icon", { name: "chevronrightwide", "aria-hidden": "true" }))),
506
+ !isPrevHidden && (h("button", { key: "hidden-prev", class: "pagination-link pagination-control-button hidden-control-button", disabled: true }, h("post-icon", { name: "chevronleftwide", "aria-hidden": "true" }))),
507
+ h("button", { key: "hidden-page", class: "pagination-link pagination-control-button hidden-page-button", "aria-label": this.buildPageLabel(totalPages), disabled: true }, h("span", { "aria-hidden": "true" }, totalPages)),
508
+ h("span", { key: "hidden-ellipsis", class: "pagination-ellipsis-content hidden-ellipsis", "aria-hidden": "true" }, ELLIPSIS),
509
+ !isNextHidden && (h("button", { key: "hidden-next", class: "pagination-link pagination-control-button hidden-control-button", disabled: true }, h("post-icon", { name: "chevronrightwide", "aria-hidden": "true" }))),
506
510
  ];
507
511
  }
508
512
  render() {