@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.
- package/dist/cjs/{create-validator-decorator-4dRrOF30.js → create-validator-decorator-BchTP-YG.js} +1 -1
- package/dist/cjs/{index-BqngpwGa.js → index-BDBlw92l.js} +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{one-of-D1veqtsm.js → one-of-IgKJFMA_.js} +1 -1
- package/dist/cjs/{package-BfNFDLlB.js → package-2syswPDO.js} +1 -1
- package/dist/cjs/{pattern-B7VKOu5m.js → pattern-BCnL1qK3.js} +1 -1
- package/dist/cjs/post-accordion_2.cjs.entry.js +5 -5
- package/dist/cjs/post-autocomplete.cjs.entry.js +15 -6
- package/dist/cjs/post-avatar.cjs.entry.js +6 -6
- package/dist/cjs/post-back-to-top.cjs.entry.js +5 -5
- package/dist/cjs/post-banner.cjs.entry.js +4 -4
- package/dist/cjs/post-breadcrumb-item.cjs.entry.js +7 -7
- package/dist/cjs/post-breadcrumbs.cjs.entry.js +6 -6
- package/dist/cjs/post-closebutton_14.cjs.entry.js +20 -21
- package/dist/cjs/post-collapsible_2.cjs.entry.js +4 -4
- package/dist/cjs/post-components.cjs.js +2 -2
- package/dist/cjs/post-date-picker.cjs.entry.js +62 -15
- package/dist/cjs/post-footer.cjs.entry.js +35 -17
- package/dist/cjs/post-linkarea.cjs.entry.js +53 -48
- package/dist/cjs/post-listbox-option.cjs.entry.js +2 -2
- package/dist/cjs/post-listbox.cjs.entry.js +4 -4
- package/dist/cjs/post-number-input.cjs.entry.js +2 -2
- package/dist/cjs/post-pagination.cjs.entry.js +20 -16
- package/dist/cjs/post-popover-trigger.cjs.entry.js +4 -4
- package/dist/cjs/post-popover.cjs.entry.js +33 -8
- package/dist/cjs/post-progressbar.cjs.entry.js +3 -3
- package/dist/cjs/post-rating.cjs.entry.js +5 -5
- package/dist/cjs/post-side-navigation-trigger.cjs.entry.js +5 -5
- package/dist/cjs/post-side-navigation.cjs.entry.js +14 -8
- package/dist/cjs/post-stepper-item.cjs.entry.js +3 -3
- package/dist/cjs/post-stepper.cjs.entry.js +6 -6
- package/dist/cjs/post-tab-item.cjs.entry.js +5 -5
- package/dist/cjs/post-tab-panel.cjs.entry.js +5 -5
- package/dist/cjs/post-tabs.cjs.entry.js +6 -6
- package/dist/cjs/post-tooltip-trigger.cjs.entry.js +5 -5
- package/dist/cjs/post-tooltip.cjs.entry.js +4 -4
- package/dist/cjs/{required-Bkz8MOYa.js → required-BXiinq5t.js} +1 -1
- package/dist/cjs/{type-D8eD1JMd.js → type-l3fnHs_E.js} +1 -1
- package/dist/cjs/{url-C7MnIIZ_.js → url-Dmn5zP5b.js} +1 -1
- package/dist/collection/components/post-autocomplete/post-autocomplete.js +10 -1
- package/dist/collection/components/post-date-picker/native-mask-element.js +12 -5
- package/dist/collection/components/post-date-picker/post-date-picker.css +2 -2
- package/dist/collection/components/post-date-picker/post-date-picker.js +45 -5
- package/dist/collection/components/post-footer/post-footer.css +1 -1
- package/dist/collection/components/post-footer/post-footer.js +32 -14
- package/dist/collection/components/post-header/post-header.js +4 -5
- package/dist/collection/components/post-icon/post-icon.js +1 -1
- package/dist/collection/components/post-linkarea/post-linkarea.js +51 -46
- package/dist/collection/components/post-listbox/post-listbox.css +1 -1
- package/dist/collection/components/post-listbox/post-listbox.js +1 -1
- package/dist/collection/components/post-megadropdown/post-megadropdown.js +7 -7
- package/dist/collection/components/post-pagination/post-pagination.css +1 -1
- package/dist/collection/components/post-pagination/post-pagination.js +14 -10
- package/dist/collection/components/post-popover/post-popover.js +32 -2
- package/dist/collection/components/post-side-navigation/post-side-navigation.css +1 -1
- package/dist/collection/components/post-side-navigation/post-side-navigation.js +7 -1
- package/dist/collection/components/post-stepper-item/post-stepper-item.css +1 -1
- package/dist/collection/components/post-tabs/post-tabs.css +1 -1
- package/dist/components/package.js +1 -1
- package/dist/components/post-autocomplete.js +1 -1
- package/dist/components/post-date-picker.js +1 -1
- package/dist/components/post-footer.js +1 -1
- package/dist/components/post-header.js +1 -1
- package/dist/components/post-icon2.js +1 -1
- package/dist/components/post-linkarea.js +1 -1
- package/dist/components/post-listbox.js +1 -1
- package/dist/components/post-megadropdown.js +1 -1
- package/dist/components/post-pagination.js +1 -1
- package/dist/components/post-popover.js +1 -1
- package/dist/components/post-side-navigation.js +1 -1
- package/dist/components/post-stepper-item.js +1 -1
- package/dist/components/post-tabs.js +1 -1
- package/dist/components/react/index.js +1 -1
- package/dist/components/react/{p-BJXXw0kF.js → p-BBldpA5o.js} +1 -1
- package/dist/components/react/{p-Bscvx_1t.js → p-BLxhbOxJ.js} +1 -1
- package/dist/components/react/{p-DlA_Y5Qr.js → p-BVwVxBtC.js} +1 -1
- package/dist/components/react/{p-B4CPJq4-.js → p-CNhNLSwV.js} +1 -1
- package/dist/components/react/{p-BKQu2M0N.js → p-CTdS2ONV.js} +1 -1
- package/dist/components/react/{p-DQDv_V13.js → p-CzqW5_YD.js} +1 -1
- package/dist/components/react/{p-CT6x8DLu.js → p-DEmm6Dal.js} +1 -1
- package/dist/components/react/{p-D1M4lTJg.js → p-DG11ySYQ.js} +1 -1
- package/dist/components/react/{p-Du33y-6X.js → p-DUMQ0Em_.js} +1 -1
- package/dist/components/react/p-YQBh4peU.js +1 -0
- package/dist/components/react/{p-_nnVhpIK.js → p-pPs8_sxf.js} +1 -1
- package/dist/components/react/{p-BJJd4LvT.js → p-qL_Kd0ZG.js} +1 -1
- package/dist/components/react/post-accordion-item.js +1 -1
- package/dist/components/react/post-accordion.js +1 -1
- package/dist/components/react/post-autocomplete.js +1 -1
- package/dist/components/react/post-avatar.js +1 -1
- package/dist/components/react/post-back-to-top.js +1 -1
- package/dist/components/react/post-banner.js +1 -1
- package/dist/components/react/post-breadcrumb-item.js +1 -1
- package/dist/components/react/post-breadcrumbs.js +1 -1
- package/dist/components/react/post-closebutton.js +1 -1
- package/dist/components/react/post-collapsible-trigger.js +1 -1
- package/dist/components/react/post-collapsible.js +1 -1
- package/dist/components/react/post-date-picker.js +1 -1
- package/dist/components/react/post-footer.js +1 -1
- package/dist/components/react/post-header.js +1 -1
- package/dist/components/react/post-icon.js +1 -1
- package/dist/components/react/post-language-menu-item.js +1 -1
- package/dist/components/react/post-language-menu.js +1 -1
- package/dist/components/react/post-linkarea.js +1 -1
- package/dist/components/react/post-listbox-option.js +1 -1
- package/dist/components/react/post-listbox.js +1 -1
- package/dist/components/react/post-logo.js +1 -1
- package/dist/components/react/post-mainnavigation.js +1 -1
- package/dist/components/react/post-megadropdown-trigger.js +1 -1
- package/dist/components/react/post-megadropdown.js +1 -1
- package/dist/components/react/post-menu-item.js +1 -1
- package/dist/components/react/post-menu-trigger.js +1 -1
- package/dist/components/react/post-menu.js +1 -1
- package/dist/components/react/post-number-input.js +1 -1
- package/dist/components/react/post-pagination.js +1 -1
- package/dist/components/react/post-popover-trigger.js +1 -1
- package/dist/components/react/post-popover.js +1 -1
- package/dist/components/react/post-popovercontainer.js +1 -1
- package/dist/components/react/post-rating.js +1 -1
- package/dist/components/react/post-side-navigation-trigger.js +1 -1
- package/dist/components/react/post-side-navigation.js +1 -1
- package/dist/components/react/post-stepper-item.js +1 -1
- package/dist/components/react/post-stepper.js +1 -1
- package/dist/components/react/post-tab-item.js +1 -1
- package/dist/components/react/post-tab-panel.js +1 -1
- package/dist/components/react/post-tabs.js +1 -1
- package/dist/components/react/post-togglebutton.js +1 -1
- package/dist/components/react/post-tooltip-trigger.js +1 -1
- package/dist/components/react/post-tooltip.js +1 -1
- package/dist/docs.json +5 -5
- package/dist/esm/{create-validator-decorator-CYYTw0AS.js → create-validator-decorator-BzX_jW0Z.js} +1 -1
- package/dist/esm/{index-DE1aWdqx.js → index-BAtz9iuv.js} +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{one-of-Ug1_Xoes.js → one-of-D5QwMlvb.js} +1 -1
- package/dist/esm/{package-Y58zWPwj.js → package-YQBh4peU.js} +1 -1
- package/dist/esm/{pattern-WLk4tOqI.js → pattern-CrL4IkfA.js} +1 -1
- package/dist/esm/post-accordion_2.entry.js +5 -5
- package/dist/esm/post-autocomplete.entry.js +15 -6
- package/dist/esm/post-avatar.entry.js +6 -6
- package/dist/esm/post-back-to-top.entry.js +5 -5
- package/dist/esm/post-banner.entry.js +4 -4
- package/dist/esm/post-breadcrumb-item.entry.js +7 -7
- package/dist/esm/post-breadcrumbs.entry.js +6 -6
- package/dist/esm/post-closebutton_14.entry.js +20 -21
- package/dist/esm/post-collapsible_2.entry.js +4 -4
- package/dist/esm/post-components.js +3 -3
- package/dist/esm/post-date-picker.entry.js +62 -15
- package/dist/esm/post-footer.entry.js +35 -17
- package/dist/esm/post-linkarea.entry.js +53 -48
- package/dist/esm/post-listbox-option.entry.js +2 -2
- package/dist/esm/post-listbox.entry.js +4 -4
- package/dist/esm/post-number-input.entry.js +2 -2
- package/dist/esm/post-pagination.entry.js +20 -16
- package/dist/esm/post-popover-trigger.entry.js +4 -4
- package/dist/esm/post-popover.entry.js +33 -8
- package/dist/esm/post-progressbar.entry.js +3 -3
- package/dist/esm/post-rating.entry.js +5 -5
- package/dist/esm/post-side-navigation-trigger.entry.js +5 -5
- package/dist/esm/post-side-navigation.entry.js +14 -8
- package/dist/esm/post-stepper-item.entry.js +3 -3
- package/dist/esm/post-stepper.entry.js +6 -6
- package/dist/esm/post-tab-item.entry.js +5 -5
- package/dist/esm/post-tab-panel.entry.js +5 -5
- package/dist/esm/post-tabs.entry.js +6 -6
- package/dist/esm/post-tooltip-trigger.entry.js +5 -5
- package/dist/esm/post-tooltip.entry.js +4 -4
- package/dist/esm/{required-DeOhRbtk.js → required-BX_AhSO0.js} +1 -1
- package/dist/esm/{type-S-4aPMGU.js → type-BYIjiHKr.js} +1 -1
- package/dist/esm/{url-C8KSrmWc.js → url-CZMYpchD.js} +1 -1
- package/dist/post-components/p-0cceee23.entry.js +1 -0
- package/dist/post-components/{p-4-_BhJWV.js → p-0sQVSOjO.js} +1 -1
- package/dist/post-components/{p-842df510.entry.js → p-22a30622.entry.js} +1 -1
- package/dist/post-components/{p-b0099d75.entry.js → p-22b1df28.entry.js} +1 -1
- package/dist/post-components/{p-a779195c.entry.js → p-24d208eb.entry.js} +1 -1
- package/dist/post-components/p-3dc7e1b4.entry.js +1 -0
- package/dist/post-components/{p-ccaf42c3.entry.js → p-4cf66554.entry.js} +1 -1
- package/dist/post-components/{p-57da1762.entry.js → p-52cf29ae.entry.js} +1 -1
- package/dist/post-components/{p-e35e4e1c.entry.js → p-542c9c58.entry.js} +1 -1
- package/dist/post-components/{p-4f8cc9a6.entry.js → p-593c14a2.entry.js} +1 -1
- package/dist/post-components/p-5a9ba878.entry.js +1 -0
- package/dist/post-components/{p-3cf1db19.entry.js → p-5ac593dd.entry.js} +1 -1
- package/dist/post-components/{p-95ad4d06.entry.js → p-675f62bc.entry.js} +1 -1
- package/dist/post-components/p-7a9b5fc3.entry.js +1 -0
- package/dist/post-components/{p-d91b8c5d.entry.js → p-81e4e124.entry.js} +1 -1
- package/dist/post-components/p-85b497d7.entry.js +1 -0
- package/dist/post-components/{p-94a8cb5a.entry.js → p-8c76ce4d.entry.js} +1 -1
- package/dist/post-components/{p-1f8cf0ac.entry.js → p-8e0da839.entry.js} +1 -1
- package/dist/post-components/{p-cef3c15c.entry.js → p-8ea92775.entry.js} +1 -1
- package/dist/post-components/{p-178a7687.entry.js → p-94f76989.entry.js} +1 -1
- package/dist/post-components/{p-c05ae467.entry.js → p-9e9de801.entry.js} +1 -1
- package/dist/post-components/p-BAtz9iuv.js +2 -0
- package/dist/post-components/{p-NPUljV0P.js → p-BzmELz-M.js} +1 -1
- package/dist/post-components/{p-DMiERazc.js → p-C0Z-E_YL.js} +1 -1
- package/dist/post-components/p-CveORA5D.js +1 -0
- package/dist/post-components/p-DsgIP6Dq.js +1 -0
- package/dist/post-components/p-YQBh4peU.js +1 -0
- package/dist/post-components/{p-79ebeea6.entry.js → p-a342b434.entry.js} +1 -1
- package/dist/post-components/p-ac83c46d.entry.js +1 -0
- package/dist/post-components/p-c06f6719.entry.js +1 -0
- package/dist/post-components/{p-95986a4b.entry.js → p-cf891de3.entry.js} +1 -1
- package/dist/post-components/{p-8632e72c.entry.js → p-ef71ff85.entry.js} +1 -1
- package/dist/post-components/p-f9673487.entry.js +1 -0
- package/dist/post-components/{p-BDW1XHCO.js → p-fOjbWhb_.js} +1 -1
- package/dist/post-components/p-fb899183.entry.js +1 -0
- package/dist/post-components/{p-04357da9.entry.js → p-fb9eba9c.entry.js} +1 -1
- package/dist/post-components/p-ffb2fae3.entry.js +1 -0
- package/dist/post-components/post-components.css +1 -1
- package/dist/post-components/post-components.esm.js +1 -1
- package/dist/types/components/post-autocomplete/post-autocomplete.d.ts +1 -0
- package/dist/types/components/post-date-picker/post-date-picker.d.ts +3 -0
- package/dist/types/components/post-footer/post-footer.d.ts +5 -4
- package/dist/types/components/post-linkarea/post-linkarea.d.ts +2 -2
- package/dist/types/components/post-megadropdown/post-megadropdown.d.ts +1 -1
- package/dist/types/components/post-pagination/post-pagination.d.ts +1 -1
- package/dist/types/components/post-popover/post-popover.d.ts +5 -0
- package/hydrate/index.js +220 -106
- package/hydrate/index.mjs +220 -106
- package/package.json +6 -6
- package/dist/components/react/p-Y58zWPwj.js +0 -1
- package/dist/post-components/p-0489b4d4.entry.js +0 -1
- package/dist/post-components/p-0d26c355.entry.js +0 -1
- package/dist/post-components/p-2c57ea8a.entry.js +0 -1
- package/dist/post-components/p-56f74289.entry.js +0 -1
- package/dist/post-components/p-7f07eee6.entry.js +0 -1
- package/dist/post-components/p-8adf13de.entry.js +0 -1
- package/dist/post-components/p-8f70afc9.entry.js +0 -1
- package/dist/post-components/p-9ff63d4c.entry.js +0 -1
- package/dist/post-components/p-B6uZASBE.js +0 -1
- package/dist/post-components/p-CiOyV6Mo.js +0 -1
- package/dist/post-components/p-DE1aWdqx.js +0 -2
- package/dist/post-components/p-Y58zWPwj.js +0 -1
- package/dist/post-components/p-c25b6da1.entry.js +0 -1
- 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
|
-
|
|
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
|
|
658
|
-
months: `<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: '
|
|
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: '
|
|
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
|
|
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.
|
|
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
|
|
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.
|
|
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.
|
|
52
|
+
this.updateSlotDisplay(e.target.name, e.target.assignedElements().length > 0);
|
|
51
53
|
}
|
|
52
54
|
};
|
|
53
55
|
}
|
|
54
|
-
|
|
55
|
-
if (
|
|
56
|
-
this.
|
|
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.
|
|
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.
|
|
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
|
-
|
|
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
|
-
"
|
|
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: '
|
|
315
|
-
h("slot", { key:
|
|
316
|
-
h("slot", { key:
|
|
317
|
-
], h("slot", { key: '
|
|
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: '
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
12
|
-
|
|
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
|
-
|
|
15
|
-
|
|
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(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if (!
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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: '
|
|
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}
|
|
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: '
|
|
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
|
|
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
|
|
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: '
|
|
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
|
|
114
|
-
const widthForPages = netWidth - controlButtonsWidth
|
|
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) =>
|
|
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() {
|