@swisspost/design-system-components 9.0.0-next.23 → 9.0.0-next.24
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/{index-5acef487.js → index-d6bf2c66.js} +1 -5
- package/dist/cjs/index.cjs.js +21 -21
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{package-fdebc7ce.js → package-be30a2ae.js} +1 -1
- package/dist/cjs/{post-accordion-d6ddb379.js → post-accordion-980e3707.js} +2 -2
- package/dist/cjs/{post-accordion-item-61aed72f.js → post-accordion-item-34526ddd.js} +2 -2
- package/dist/cjs/post-accordion-item.cjs.entry.js +3 -3
- package/dist/cjs/post-accordion.cjs.entry.js +3 -3
- package/dist/cjs/{post-avatar-b5d6aaa9.js → post-avatar-ed964ac4.js} +2 -2
- package/dist/cjs/post-avatar.cjs.entry.js +3 -3
- package/dist/cjs/{post-back-to-top-80cbf486.js → post-back-to-top-12ee9182.js} +2 -2
- package/dist/cjs/post-back-to-top.cjs.entry.js +3 -3
- package/dist/cjs/{post-banner-72f433b1.js → post-banner-13755850.js} +2 -2
- package/dist/cjs/post-banner.cjs.entry.js +3 -3
- package/dist/cjs/{post-breadcrumb-63107527.js → post-breadcrumb-d6d9f5a4.js} +2 -2
- package/dist/cjs/post-breadcrumb-item_2.cjs.entry.js +3 -3
- package/dist/cjs/post-breadcrumb.cjs.entry.js +3 -3
- package/dist/cjs/{post-card-control-dfb221d5.js → post-card-control-4a6fbf19.js} +2 -2
- package/dist/cjs/post-card-control.cjs.entry.js +3 -3
- package/dist/cjs/post-closebutton_15.cjs.entry.js +3 -3
- package/dist/cjs/{post-collapsible-trigger-e24eae7e.js → post-collapsible-trigger-5bdd97f1.js} +2 -2
- package/dist/cjs/post-collapsible_2.cjs.entry.js +3 -3
- package/dist/cjs/post-components.cjs.js +2 -2
- package/dist/cjs/{post-footer-cfa3cc4c.js → post-footer-f2217a34.js} +2 -2
- package/dist/cjs/post-footer.cjs.entry.js +3 -3
- package/dist/cjs/{post-linkarea-9e808259.js → post-linkarea-ced4f6ad.js} +2 -2
- package/dist/cjs/post-linkarea.cjs.entry.js +3 -3
- package/dist/cjs/{post-menu-item-0e147e2c.js → post-menu-item-4ef32029.js} +2 -2
- package/dist/cjs/{post-popover-bddabf57.js → post-popover-1a5b1f4c.js} +2 -2
- package/dist/cjs/post-popover.cjs.entry.js +3 -3
- package/dist/cjs/{post-rating-f4c48349.js → post-rating-9a9ce431.js} +2 -2
- package/dist/cjs/post-rating.cjs.entry.js +3 -3
- package/dist/cjs/{post-tab-header-246cd064.js → post-tab-header-43c52a57.js} +2 -2
- package/dist/cjs/post-tab-header.cjs.entry.js +3 -3
- package/dist/cjs/{post-tab-panel-0e494e5c.js → post-tab-panel-16064007.js} +2 -2
- package/dist/cjs/post-tab-panel.cjs.entry.js +3 -3
- package/dist/cjs/{post-tabs-3ead6ac7.js → post-tabs-e4739459.js} +2 -2
- package/dist/cjs/post-tabs.cjs.entry.js +3 -3
- package/dist/cjs/{post-tag-f62abd13.js → post-tag-e1ed422b.js} +2 -2
- package/dist/cjs/post-tag.cjs.entry.js +3 -3
- package/dist/cjs/{post-togglebutton-63708f9f.js → post-togglebutton-38ec151e.js} +58 -37
- package/dist/cjs/{post-tooltip-2f80afc8.js → post-tooltip-463eaaf6.js} +2 -2
- package/dist/cjs/post-tooltip.cjs.entry.js +3 -3
- package/dist/collection/components/post-language-option/post-language-option.js +23 -1
- package/dist/collection/components/post-language-switch/post-language-switch.css +1 -1
- package/dist/collection/components/post-language-switch/post-language-switch.js +61 -33
- package/dist/components/package.js +1 -1
- package/dist/components/post-language-option2.js +9 -1
- package/dist/components/post-language-switch2.js +48 -35
- package/dist/docs.json +27 -2
- package/dist/esm/{index-40846676.js → index-3419e46d.js} +1 -5
- package/dist/esm/index.js +21 -21
- package/dist/esm/loader.js +3 -3
- package/dist/esm/package-7deeece6.js +3 -0
- package/dist/esm/{post-accordion-72896a6b.js → post-accordion-7f239aa6.js} +2 -2
- package/dist/esm/{post-accordion-item-42446f00.js → post-accordion-item-bac98792.js} +2 -2
- package/dist/esm/post-accordion-item.entry.js +3 -3
- package/dist/esm/post-accordion.entry.js +3 -3
- package/dist/esm/{post-avatar-3d552832.js → post-avatar-f74f6de0.js} +2 -2
- package/dist/esm/post-avatar.entry.js +3 -3
- package/dist/esm/{post-back-to-top-dbfe00b0.js → post-back-to-top-6fdad155.js} +2 -2
- package/dist/esm/post-back-to-top.entry.js +3 -3
- package/dist/esm/{post-banner-3ec35c25.js → post-banner-8448d770.js} +2 -2
- package/dist/esm/post-banner.entry.js +3 -3
- package/dist/esm/{post-breadcrumb-640a1b7a.js → post-breadcrumb-d35e27a0.js} +2 -2
- package/dist/esm/post-breadcrumb-item_2.entry.js +3 -3
- package/dist/esm/post-breadcrumb.entry.js +3 -3
- package/dist/esm/{post-card-control-549f9ac0.js → post-card-control-9233ca52.js} +2 -2
- package/dist/esm/post-card-control.entry.js +3 -3
- package/dist/esm/post-closebutton_15.entry.js +3 -3
- package/dist/esm/{post-collapsible-trigger-76749a79.js → post-collapsible-trigger-f98e1f9a.js} +2 -2
- package/dist/esm/post-collapsible_2.entry.js +3 -3
- package/dist/esm/post-components.js +3 -3
- package/dist/esm/{post-footer-2fb4d20e.js → post-footer-f4be2a31.js} +2 -2
- package/dist/esm/post-footer.entry.js +3 -3
- package/dist/esm/{post-linkarea-d7dbf30c.js → post-linkarea-c9d8d2be.js} +2 -2
- package/dist/esm/post-linkarea.entry.js +3 -3
- package/dist/esm/{post-menu-item-80d44823.js → post-menu-item-1ea9397a.js} +2 -2
- package/dist/esm/{post-popover-1fb2446b.js → post-popover-aa961cc7.js} +2 -2
- package/dist/esm/post-popover.entry.js +3 -3
- package/dist/esm/{post-rating-e9a95e85.js → post-rating-17ecd4f4.js} +2 -2
- package/dist/esm/post-rating.entry.js +3 -3
- package/dist/esm/{post-tab-header-aa2be14d.js → post-tab-header-6f9449f1.js} +2 -2
- package/dist/esm/post-tab-header.entry.js +3 -3
- package/dist/esm/{post-tab-panel-15f4254a.js → post-tab-panel-fcecd935.js} +2 -2
- package/dist/esm/post-tab-panel.entry.js +3 -3
- package/dist/esm/{post-tabs-07612298.js → post-tabs-008c118d.js} +2 -2
- package/dist/esm/post-tabs.entry.js +3 -3
- package/dist/esm/{post-tag-b9d3bb0f.js → post-tag-1e709fe5.js} +2 -2
- package/dist/esm/post-tag.entry.js +3 -3
- package/dist/esm/{post-togglebutton-5f0e2508.js → post-togglebutton-a932d770.js} +58 -37
- package/dist/esm/{post-tooltip-b1309328.js → post-tooltip-ad5b722d.js} +2 -2
- package/dist/esm/post-tooltip.entry.js +3 -3
- package/dist/post-components/index.esm.js +1 -1
- package/dist/post-components/p-0e6ce700.entry.js +1 -0
- package/dist/post-components/{p-e2da4e76.entry.js → p-12d7344a.entry.js} +1 -1
- package/dist/post-components/{p-d993dd37.js → p-1382d4c9.js} +1 -1
- package/dist/post-components/p-20e07b4f.entry.js +1 -0
- package/dist/post-components/{p-9f986e3d.js → p-23c2b420.js} +1 -1
- package/dist/post-components/p-3b7f8717.entry.js +1 -0
- package/dist/post-components/{p-75627a39.js → p-43b10fa7.js} +1 -1
- package/dist/post-components/p-453aa3c8.js +1 -0
- package/dist/post-components/{p-b1b5248c.js → p-53dd7a51.js} +1 -1
- package/dist/post-components/{p-ff95dcd3.js → p-5c758f41.js} +2 -2
- package/dist/post-components/{p-b6e041ee.js → p-5e4d5df5.js} +1 -1
- package/dist/post-components/p-6239b8f8.entry.js +1 -0
- package/dist/post-components/{p-eba6a679.js → p-637b619c.js} +1 -1
- package/dist/post-components/p-64ba9026.entry.js +1 -0
- package/dist/post-components/{p-7b526da4.js → p-6545ed83.js} +1 -1
- package/dist/post-components/p-6a79800f.entry.js +1 -0
- package/dist/post-components/p-6eaba4b6.entry.js +1 -0
- package/dist/post-components/p-73acda40.entry.js +1 -0
- package/dist/post-components/p-7796d5c5.entry.js +1 -0
- package/dist/post-components/{p-b5f43c76.entry.js → p-78d9d13e.entry.js} +1 -1
- package/dist/post-components/{p-33963539.js → p-7daa1a9c.js} +1 -1
- package/dist/post-components/p-87c82919.entry.js +1 -0
- package/dist/post-components/p-8f80c6f8.entry.js +1 -0
- package/dist/post-components/p-9184781c.entry.js +1 -0
- package/dist/post-components/{p-bbf9ba02.js → p-923793ff.js} +1 -1
- package/dist/post-components/p-96e3823e.entry.js +1 -0
- package/dist/post-components/p-9b4b416c.entry.js +1 -0
- package/dist/post-components/{p-530bedb1.js → p-a0345520.js} +1 -1
- package/dist/post-components/p-a5682a18.entry.js +1 -0
- package/dist/post-components/p-ac46ccd1.entry.js +1 -0
- package/dist/post-components/{p-88b5add2.js → p-bd957c85.js} +1 -1
- package/dist/post-components/{p-f1995b47.js → p-c1307879.js} +1 -1
- package/dist/post-components/p-c8bfefed.js +1 -0
- package/dist/post-components/{p-534ca692.js → p-cfe29403.js} +1 -1
- package/dist/post-components/p-d6757696.entry.js +1 -0
- package/dist/post-components/{p-745ce238.js → p-e47d9a2b.js} +1 -1
- package/dist/post-components/{p-4f6694d4.js → p-edcc075c.js} +1 -1
- package/dist/post-components/{p-819f6f7e.js → p-f0719685.js} +1 -1
- package/dist/post-components/{p-b559d89c.js → p-f4c60bbb.js} +1 -1
- package/dist/post-components/p-fbe84d70.js +1 -0
- package/dist/post-components/post-components.esm.js +1 -1
- package/dist/types/components/post-language-option/post-language-option.d.ts +4 -0
- package/dist/types/components/post-language-switch/post-language-switch.d.ts +11 -3
- package/dist/types/components.d.ts +5 -0
- package/loaders/package.js +1 -1
- package/loaders/post-language-option.js +9 -1
- package/loaders/post-language-switch.js +48 -35
- package/package.json +3 -3
- package/dist/esm/package-30b5445a.js +0 -3
- package/dist/post-components/p-32caa5d5.entry.js +0 -1
- package/dist/post-components/p-3994c72c.entry.js +0 -1
- package/dist/post-components/p-442957b7.entry.js +0 -1
- package/dist/post-components/p-449caeba.entry.js +0 -1
- package/dist/post-components/p-513e4b41.entry.js +0 -1
- package/dist/post-components/p-5556960c.entry.js +0 -1
- package/dist/post-components/p-590c8681.entry.js +0 -1
- package/dist/post-components/p-68e0803e.entry.js +0 -1
- package/dist/post-components/p-6be78a63.entry.js +0 -1
- package/dist/post-components/p-7c08cad2.js +0 -1
- package/dist/post-components/p-8891c692.entry.js +0 -1
- package/dist/post-components/p-a1cbef0b.entry.js +0 -1
- package/dist/post-components/p-b54c207a.js +0 -1
- package/dist/post-components/p-ca01c184.js +0 -1
- package/dist/post-components/p-d9e7aec4.entry.js +0 -1
- package/dist/post-components/p-da18066a.entry.js +0 -1
- package/dist/post-components/p-e3d794b1.entry.js +0 -1
- package/dist/post-components/p-f175148d.entry.js +0 -1
- package/dist/post-components/p-f5a940f4.entry.js +0 -1
- package/dist/post-components/p-fcb60a95.entry.js +0 -1
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const postPopover = require('./post-popover-
|
|
6
|
-
require('./index-
|
|
7
|
-
require('./package-
|
|
5
|
+
const postPopover = require('./post-popover-1a5b1f4c.js');
|
|
6
|
+
require('./index-d6bf2c66.js');
|
|
7
|
+
require('./package-be30a2ae.js');
|
|
8
8
|
require('./attribute-observer-6d8b886b.js');
|
|
9
9
|
|
|
10
10
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const index = require('./index-
|
|
4
|
-
const _package = require('./package-
|
|
3
|
+
const index = require('./index-d6bf2c66.js');
|
|
4
|
+
const _package = require('./package-be30a2ae.js');
|
|
5
5
|
|
|
6
6
|
const postRatingCss = "/*!\n * Copyright 2021 by Swiss Post, Information Technology\n */:host{display:inline-block}.rating{display:flex;flex-wrap:wrap;overflow:hidden;margin:0 calc(var(--post-core-dimension-4)*-1);border-radius:4px}.rating .star{--post-rating-star-stroke:hsl(0, 0%, 40%);--post-rating-star-fill:#fff;position:relative;width:2rem;height:2rem;cursor:pointer}.rating .star .stroke,.rating .star .fill{display:block;width:100%;height:100%;transition:all ease 100ms}.rating .star .stroke{position:absolute;inset:auto;z-index:1;color:var(--post-rating-star-stroke)}.rating .star .fill{margin:1px;width:calc(100% - 2px);height:calc(100% - 2px);color:var(--post-rating-star-fill)}.rating .star.before-hover{--post-rating-star-stroke:hsl(0, 0%, 40%);--post-rating-star-fill:#fc0}.rating .star.active{--post-rating-star-stroke:hsl(0, 0%, 20%);--post-rating-star-fill:#fc0}.rating .star.hover{--post-rating-star-stroke:hsl(0, 0%, 40%);--post-rating-star-fill:#fc0}.rating .star.after-active{--post-rating-star-stroke:hsl(0, 0%, 40%);--post-rating-star-fill:hsl(0, 0%, 80%)}.rating :focus{outline:none}.rating:focus-visible{outline-offset:var(--post-core-dimension-2);outline:var(--post-core-dimension-2) solid #1976c8}.rating[aria-readonly=true] .star,.rating[aria-disabled=true] .star{cursor:default}.rating[aria-disabled=true] .star{--post-rating-star-stroke:hsl(0, 0%, 60%);--post-rating-star-fill:#fff}.rating[aria-disabled=true] .star.active{cursor:default;--post-rating-star-stroke:hsl(0, 0%, 60%);--post-rating-star-fill:hsl(0, 0%, 90%)}";
|
|
7
7
|
const PostRatingStyle0 = postRatingCss;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const postRating = require('./post-rating-
|
|
6
|
-
require('./index-
|
|
7
|
-
require('./package-
|
|
5
|
+
const postRating = require('./post-rating-9a9ce431.js');
|
|
6
|
+
require('./index-d6bf2c66.js');
|
|
7
|
+
require('./package-be30a2ae.js');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const index = require('./index-
|
|
4
|
-
const _package = require('./package-
|
|
3
|
+
const index = require('./index-d6bf2c66.js');
|
|
4
|
+
const _package = require('./package-be30a2ae.js');
|
|
5
5
|
const checkNonEmpty = require('./check-non-empty-bd99d236.js');
|
|
6
6
|
const index_browser = require('./index.browser-2f65f583.js');
|
|
7
7
|
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const postTabHeader = require('./post-tab-header-
|
|
6
|
-
require('./index-
|
|
7
|
-
require('./package-
|
|
5
|
+
const postTabHeader = require('./post-tab-header-43c52a57.js');
|
|
6
|
+
require('./index-d6bf2c66.js');
|
|
7
|
+
require('./package-be30a2ae.js');
|
|
8
8
|
require('./check-non-empty-bd99d236.js');
|
|
9
9
|
require('./constants-238701d3.js');
|
|
10
10
|
require('./index.browser-2f65f583.js');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const index = require('./index-
|
|
4
|
-
const _package = require('./package-
|
|
3
|
+
const index = require('./index-d6bf2c66.js');
|
|
4
|
+
const _package = require('./package-be30a2ae.js');
|
|
5
5
|
const index_browser = require('./index.browser-2f65f583.js');
|
|
6
6
|
|
|
7
7
|
const postTabPanelCss = ":host{display:none}";
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const postTabPanel = require('./post-tab-panel-
|
|
6
|
-
require('./index-
|
|
7
|
-
require('./package-
|
|
5
|
+
const postTabPanel = require('./post-tab-panel-16064007.js');
|
|
6
|
+
require('./index-d6bf2c66.js');
|
|
7
|
+
require('./package-be30a2ae.js');
|
|
8
8
|
require('./index.browser-2f65f583.js');
|
|
9
9
|
|
|
10
10
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const index = require('./index-
|
|
4
|
-
const _package = require('./package-
|
|
3
|
+
const index = require('./index-d6bf2c66.js');
|
|
4
|
+
const _package = require('./package-be30a2ae.js');
|
|
5
5
|
const fade = require('./fade-72d5ef55.js');
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const postTabs = require('./post-tabs-
|
|
6
|
-
require('./index-
|
|
7
|
-
require('./package-
|
|
5
|
+
const postTabs = require('./post-tabs-e4739459.js');
|
|
6
|
+
require('./index-d6bf2c66.js');
|
|
7
|
+
require('./package-be30a2ae.js');
|
|
8
8
|
require('./fade-72d5ef55.js');
|
|
9
9
|
|
|
10
10
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const index = require('./index-
|
|
4
|
-
const _package = require('./package-
|
|
3
|
+
const index = require('./index-d6bf2c66.js');
|
|
4
|
+
const _package = require('./package-be30a2ae.js');
|
|
5
5
|
|
|
6
6
|
const postTagCss = "/*!\n * Copyright 2021 by Swiss Post, Information Technology\n */.tag,.tag:where(:has(:not(pre))){--post-tag-bg:hsl(0, 0%, 90%);--post-tag-fg:#000;display:inline-flex;align-items:center;gap:var(--post-core-dimension-4);padding:0 var(--post-core-dimension-8);max-width:100%;background-color:var(--post-tag-bg);border:var(--post-core-dimension-1) solid rgba(0,0,0,0);border-radius:var(--post-core-dimension-4);font-size:1rem;line-height:calc(var(--post-core-dimension-32) - var(--post-core-dimension-1)*2);white-space:nowrap;color:var(--post-tag-fg)}.tag post-icon,.tag:where(:has(:not(pre))) post-icon{flex:0 0 auto;width:1.25rem;height:1.25rem}.tag .tag-text,.tag:where(:has(:not(pre))) .tag-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tag .tag-text svg,.tag .tag-text img,.tag:where(:has(:not(pre))) .tag-text svg,.tag:where(:has(:not(pre))) .tag-text img{display:inline-block;height:1.25rem !important;vertical-align:text-top}.tag.tag-sm,.tag:where(:has(:not(pre))).tag-sm{line-height:var(--post-core-dimension-24)}.tag.tag-sm .tag-icon,.tag:where(:has(:not(pre))).tag-sm .tag-icon{width:1rem;height:1rem}.tag.tag-white,.tag:where(:has(:not(pre))).tag-white{--post-tag-bg:#fff;--post-tag-fg:#000}.tag.tag-yellow,.tag:where(:has(:not(pre))).tag-yellow{--post-tag-bg:#fc0;--post-tag-fg:#000}.tag.tag-success,.tag:where(:has(:not(pre))).tag-success{--post-tag-bg:#2c871d;--post-tag-fg:#fff}.tag.tag-warning,.tag:where(:has(:not(pre))).tag-warning{--post-tag-bg:#f49e00;--post-tag-fg:#000}.tag.tag-danger,.tag:where(:has(:not(pre))).tag-danger{--post-tag-bg:#a51728;--post-tag-fg:#fff}.tag.tag-info,.tag:where(:has(:not(pre))).tag-info{--post-tag-bg:#cce4ee;--post-tag-fg:#000}.tag.tag-white,.tag:where(:has(:not(pre))).tag-white{border-color:#000}pre .tag,pre .tag:where(:has(:not(pre))){display:inline;padding:initial;max-width:initial;background:initial;border:initial;border-radius:initial;font-size:inherit;line-height:inherit;white-space:unset}*,*:before,*:after{box-sizing:border-box}.tag-text ::slotted(svg),.tag-text ::slotted(img){display:inline-block !important;height:1.25rem !important;vertical-align:text-top !important}";
|
|
7
7
|
const PostTagStyle0 = postTagCss;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const postTag = require('./post-tag-
|
|
6
|
-
require('./index-
|
|
7
|
-
require('./package-
|
|
5
|
+
const postTag = require('./post-tag-e1ed422b.js');
|
|
6
|
+
require('./index-d6bf2c66.js');
|
|
7
|
+
require('./package-be30a2ae.js');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const index = require('./index-
|
|
4
|
-
const _package = require('./package-
|
|
3
|
+
const index = require('./index-d6bf2c66.js');
|
|
4
|
+
const _package = require('./package-be30a2ae.js');
|
|
5
5
|
const slide = require('./slide-8ae17ee4.js');
|
|
6
6
|
const index$1 = require('./index-23e36ff7.js');
|
|
7
7
|
const checkNonEmpty = require('./check-non-empty-bd99d236.js');
|
|
@@ -534,6 +534,7 @@ const PostLanguageOption = class {
|
|
|
534
534
|
constructor(hostRef) {
|
|
535
535
|
index.registerInstance(this, hostRef);
|
|
536
536
|
this.postChange = index.createEvent(this, "postChange", 7);
|
|
537
|
+
this.postLanguageOptionInitiallyActive = index.createEvent(this, "postLanguageOptionInitiallyActive", 7);
|
|
537
538
|
this.code = undefined;
|
|
538
539
|
this.active = undefined;
|
|
539
540
|
this.variant = undefined;
|
|
@@ -561,11 +562,18 @@ const PostLanguageOption = class {
|
|
|
561
562
|
if (!this.name && this.isNameRequired()) {
|
|
562
563
|
throw new Error('The "name" property of the post-language-option component is required when the full language name is not displayed.');
|
|
563
564
|
}
|
|
565
|
+
if (this.active) {
|
|
566
|
+
this.postLanguageOptionInitiallyActive.emit(this.code);
|
|
567
|
+
}
|
|
564
568
|
}
|
|
565
569
|
/**
|
|
566
570
|
* An event emitted when the language option is clicked. The payload is the ISO 639 code of the language.
|
|
567
571
|
*/
|
|
568
572
|
postChange;
|
|
573
|
+
/**
|
|
574
|
+
* An event emitted when the language option is initially active. The payload is the ISO 639 code of the language.
|
|
575
|
+
*/
|
|
576
|
+
postLanguageOptionInitiallyActive;
|
|
569
577
|
/**
|
|
570
578
|
* Selects the language option programmatically.
|
|
571
579
|
*/
|
|
@@ -586,7 +594,7 @@ const PostLanguageOption = class {
|
|
|
586
594
|
this.emitChange();
|
|
587
595
|
}
|
|
588
596
|
};
|
|
589
|
-
return (index.h(index.Host, { key: '
|
|
597
|
+
return (index.h(index.Host, { key: '23bf186d9cc718b2697cbc5bc54b44f6c9ead54f', "data-version": _package.version, role: this.variant ? `${this.variant}item` : null }, this.url ? (index.h("a", { "aria-current": this.active ? 'page' : undefined, "aria-label": this.name, href: this.url, hrefLang: lang, lang: lang, onClick: () => this.emitChange(), onKeyDown: emitOnKeyDown }, index.h("slot", null))) : (index.h("button", { "aria-current": this.active ? 'true' : undefined, "aria-label": this.name, lang: lang, onClick: () => this.emitChange(), onKeyDown: emitOnKeyDown }, index.h("slot", null)))));
|
|
590
598
|
}
|
|
591
599
|
static get watchers() { return {
|
|
592
600
|
"code": ["validateCode"],
|
|
@@ -599,7 +607,7 @@ PostLanguageOption.style = PostLanguageOptionStyle0;
|
|
|
599
607
|
|
|
600
608
|
const SWITCH_VARIANTS = ['list', 'menu'];
|
|
601
609
|
|
|
602
|
-
const postLanguageSwitchCss = ":host{display:flex !important;flex-wrap:wrap;gap:.5rem}.post-language-switch-dropdown-container{display:flex;flex-direction:column}.post-language-switch-dropdown-container>*{width:100%}.post-language-switch-trigger{cursor:pointer;text-transform:uppercase;padding:0;overflow:visible;border:0;background:none;color:var(--post-scheme-color-interactive-button-secondary-enabled-fg);font:inherit;-webkit-user-select:none;user-select:none;appearance:button;text-decoration:none;display:inline-flex;align-items:center;gap:6px;border-radius:24px;font-size:16px;padding:3px 10px}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.post-language-switch-trigger{background-color:ButtonFace !important}.post-language-switch-trigger:hover{background-color:Highlight !important}}.post-language-switch-trigger{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}.post-language-switch-trigger: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){.post-language-switch-trigger:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){.post-language-switch-trigger: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){.post-language-switch-trigger:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}.post-language-switch-trigger:not(:disabled):hover,.post-language-switch-trigger.pretend-hover{border-color:var(--post-scheme-color-interactive-button-tertiary-hover-stroke);background-color:var(--post-scheme-color-interactive-button-tertiary-hover-bg);color:var(--post-scheme-color-interactive-button-tertiary-hover-fg)}.post-language-switch-trigger post-icon{height:
|
|
610
|
+
const postLanguageSwitchCss = ":host{display:flex !important;flex-wrap:wrap;gap:.5rem}.post-language-switch-dropdown-container{display:flex;flex-direction:column}.post-language-switch-dropdown-container>*{width:100%}.post-language-switch-trigger{cursor:pointer;text-transform:uppercase;padding:0;overflow:visible;border:0;background:none;color:var(--post-scheme-color-interactive-button-secondary-enabled-fg);font:inherit;-webkit-user-select:none;user-select:none;appearance:button;text-decoration:none;display:inline-flex;align-items:center;gap:6px;border-radius:24px;font-size:16px;padding:3px 10px}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.post-language-switch-trigger{background-color:ButtonFace !important}.post-language-switch-trigger:hover{background-color:Highlight !important}}.post-language-switch-trigger{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}.post-language-switch-trigger: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){.post-language-switch-trigger:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){.post-language-switch-trigger: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){.post-language-switch-trigger:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}.post-language-switch-trigger:not(:disabled):hover,.post-language-switch-trigger.pretend-hover{border-color:var(--post-scheme-color-interactive-button-tertiary-hover-stroke);background-color:var(--post-scheme-color-interactive-button-tertiary-hover-bg);color:var(--post-scheme-color-interactive-button-tertiary-hover-fg)}.post-language-switch-trigger post-icon{height:24px;width:24px}.post-language-switch-trigger[aria-expanded=true]{background-color:#050400;color:#fff}.post-language-switch-trigger[aria-expanded=true] post-icon{transform:rotate(180deg)}.post-language-switch-trigger[aria-expanded=true]:hover{background-color:#504f4b;color:#fff}";
|
|
603
611
|
const PostLanguageSwitchStyle0 = postLanguageSwitchCss;
|
|
604
612
|
|
|
605
613
|
const PostLanguageSwitch = class {
|
|
@@ -619,52 +627,65 @@ const PostLanguageSwitch = class {
|
|
|
619
627
|
}
|
|
620
628
|
validateVariant() {
|
|
621
629
|
index$1.checkEmptyOrOneOf(this, 'variant', SWITCH_VARIANTS);
|
|
622
|
-
}
|
|
623
|
-
connectedCallback() {
|
|
624
|
-
this.updateChildrenVariant();
|
|
625
|
-
// Get the active language based on children's active state
|
|
626
|
-
const activeLanguageOption = this.host.querySelector('post-language-option[active]:not([active="false"])');
|
|
627
|
-
if (activeLanguageOption)
|
|
628
|
-
this.activeLang = activeLanguageOption.getAttribute('code');
|
|
629
|
-
}
|
|
630
|
-
// Update post-language-option variant to have the correct style
|
|
631
|
-
updateChildrenVariant() {
|
|
632
|
-
this.host.querySelectorAll('post-language-option').forEach(el => {
|
|
633
|
-
el.setAttribute('variant', this.variant);
|
|
634
|
-
});
|
|
635
|
-
}
|
|
636
|
-
componentWillUpdate() {
|
|
637
630
|
this.updateChildrenVariant();
|
|
638
631
|
}
|
|
639
632
|
componentDidLoad() {
|
|
640
633
|
this.validateCaption();
|
|
641
634
|
this.validateDescription();
|
|
642
635
|
this.validateVariant();
|
|
643
|
-
//
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
});
|
|
655
|
-
// Hides the dropdown when an option has been clicked
|
|
656
|
-
if (this.variant === 'menu') {
|
|
657
|
-
const menu = this.host.shadowRoot.querySelector('post-menu');
|
|
658
|
-
menu.hide();
|
|
636
|
+
// Initially set variants and active language
|
|
637
|
+
// Handles cases where the language-switch is rendered after the language-options have been rendered
|
|
638
|
+
this.updateChildrenVariant();
|
|
639
|
+
this.updateActiveLanguage();
|
|
640
|
+
}
|
|
641
|
+
handlePostChange(event) {
|
|
642
|
+
this.activeLang = event.detail;
|
|
643
|
+
// Update the active state in the children post-language-option components
|
|
644
|
+
this.languageOptions.forEach(lang => {
|
|
645
|
+
if (lang.code && lang.code === this.activeLang) {
|
|
646
|
+
lang.setAttribute('active', '');
|
|
659
647
|
}
|
|
648
|
+
else {
|
|
649
|
+
lang.removeAttribute('active');
|
|
650
|
+
}
|
|
651
|
+
});
|
|
652
|
+
// Hides the dropdown when an option has been clicked
|
|
653
|
+
if (this.variant === 'menu') {
|
|
654
|
+
const menu = this.host.shadowRoot.querySelector('post-menu');
|
|
655
|
+
menu.hide();
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
/**
|
|
659
|
+
* Handles cases where the language switch is being rendered before options are available
|
|
660
|
+
* @param event Initially emitted by <post-langauge-option>
|
|
661
|
+
*/
|
|
662
|
+
handleInitiallyActive(event) {
|
|
663
|
+
this.activeLang = event.detail;
|
|
664
|
+
}
|
|
665
|
+
get languageOptions() {
|
|
666
|
+
return this.host.querySelectorAll('post-language-option');
|
|
667
|
+
}
|
|
668
|
+
get activeLanguageOption() {
|
|
669
|
+
return this.host.querySelector('post-language-option[active]:not([active="false"])');
|
|
670
|
+
}
|
|
671
|
+
handleSlotChange() {
|
|
672
|
+
this.updateActiveLanguage();
|
|
673
|
+
}
|
|
674
|
+
updateActiveLanguage() {
|
|
675
|
+
this.activeLang = this.activeLanguageOption.getAttribute('code');
|
|
676
|
+
}
|
|
677
|
+
// Update post-language-option variant to have the correct style
|
|
678
|
+
updateChildrenVariant() {
|
|
679
|
+
this.languageOptions.forEach(el => {
|
|
680
|
+
el.setAttribute('variant', this.variant);
|
|
660
681
|
});
|
|
661
682
|
}
|
|
662
683
|
menuId = `p${index_browser.nanoid(11)}`;
|
|
663
684
|
renderList() {
|
|
664
|
-
return (index.h(index.Host, { "data-version": _package.version, role: "list", "aria-label": this.caption }, index.h("div", { class: "post-language-switch-list", role: "group", "aria-label": this.description }, index.h("slot",
|
|
685
|
+
return (index.h(index.Host, { "data-version": _package.version, role: "list", "aria-label": this.caption }, index.h("div", { class: "post-language-switch-list", role: "group", "aria-label": this.description }, index.h("slot", { onSlotchange: () => this.handleSlotChange() }))));
|
|
665
686
|
}
|
|
666
687
|
renderDropdown() {
|
|
667
|
-
return (index.h(index.Host, { "data-version": _package.version }, index.h("post-menu-trigger", { for: this.menuId }, index.h("button", { class: "post-language-switch-trigger", "aria-label": this.description }, this.activeLang, index.h("post-icon", { "aria-hidden": "true", name: "chevrondown" }))), index.h("post-menu", { id: this.menuId, class: "post-language-switch-dropdown-container", "aria-label": this.caption }, index.h("slot",
|
|
688
|
+
return (index.h(index.Host, { "data-version": _package.version }, index.h("post-menu-trigger", { for: this.menuId }, index.h("button", { class: "post-language-switch-trigger", "aria-label": this.description }, this.activeLang, index.h("post-icon", { "aria-hidden": "true", name: "chevrondown" }))), index.h("post-menu", { id: this.menuId, class: "post-language-switch-dropdown-container", "aria-label": this.caption }, index.h("slot", { onSlotchange: () => this.handleSlotChange() }))));
|
|
668
689
|
}
|
|
669
690
|
render() {
|
|
670
691
|
return this.variant === 'list' ? this.renderList() : this.renderDropdown();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const index = require('./index-
|
|
4
|
-
const _package = require('./package-
|
|
3
|
+
const index = require('./index-d6bf2c66.js');
|
|
4
|
+
const _package = require('./package-be30a2ae.js');
|
|
5
5
|
const attributeObserver = require('./attribute-observer-6d8b886b.js');
|
|
6
6
|
const index$1 = require('./index-23e36ff7.js');
|
|
7
7
|
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const postTooltip = require('./post-tooltip-
|
|
6
|
-
require('./index-
|
|
7
|
-
require('./package-
|
|
5
|
+
const postTooltip = require('./post-tooltip-463eaaf6.js');
|
|
6
|
+
require('./index-d6bf2c66.js');
|
|
7
|
+
require('./package-be30a2ae.js');
|
|
8
8
|
require('./attribute-observer-6d8b886b.js');
|
|
9
9
|
require('./index-23e36ff7.js');
|
|
10
10
|
require('./constants-238701d3.js');
|
|
@@ -33,11 +33,18 @@ export class PostLanguageOption {
|
|
|
33
33
|
if (!this.name && this.isNameRequired()) {
|
|
34
34
|
throw new Error('The "name" property of the post-language-option component is required when the full language name is not displayed.');
|
|
35
35
|
}
|
|
36
|
+
if (this.active) {
|
|
37
|
+
this.postLanguageOptionInitiallyActive.emit(this.code);
|
|
38
|
+
}
|
|
36
39
|
}
|
|
37
40
|
/**
|
|
38
41
|
* An event emitted when the language option is clicked. The payload is the ISO 639 code of the language.
|
|
39
42
|
*/
|
|
40
43
|
postChange;
|
|
44
|
+
/**
|
|
45
|
+
* An event emitted when the language option is initially active. The payload is the ISO 639 code of the language.
|
|
46
|
+
*/
|
|
47
|
+
postLanguageOptionInitiallyActive;
|
|
41
48
|
/**
|
|
42
49
|
* Selects the language option programmatically.
|
|
43
50
|
*/
|
|
@@ -58,7 +65,7 @@ export class PostLanguageOption {
|
|
|
58
65
|
this.emitChange();
|
|
59
66
|
}
|
|
60
67
|
};
|
|
61
|
-
return (h(Host, { key: '
|
|
68
|
+
return (h(Host, { key: '23bf186d9cc718b2697cbc5bc54b44f6c9ead54f', "data-version": version, role: this.variant ? `${this.variant}item` : null }, this.url ? (h("a", { "aria-current": this.active ? 'page' : undefined, "aria-label": this.name, href: this.url, hrefLang: lang, lang: lang, onClick: () => this.emitChange(), onKeyDown: emitOnKeyDown }, h("slot", null))) : (h("button", { "aria-current": this.active ? 'true' : undefined, "aria-label": this.name, lang: lang, onClick: () => this.emitChange(), onKeyDown: emitOnKeyDown }, h("slot", null)))));
|
|
62
69
|
}
|
|
63
70
|
static get is() { return "post-language-option"; }
|
|
64
71
|
static get originalStyleUrls() {
|
|
@@ -182,6 +189,21 @@ export class PostLanguageOption {
|
|
|
182
189
|
"resolved": "string",
|
|
183
190
|
"references": {}
|
|
184
191
|
}
|
|
192
|
+
}, {
|
|
193
|
+
"method": "postLanguageOptionInitiallyActive",
|
|
194
|
+
"name": "postLanguageOptionInitiallyActive",
|
|
195
|
+
"bubbles": true,
|
|
196
|
+
"cancelable": true,
|
|
197
|
+
"composed": true,
|
|
198
|
+
"docs": {
|
|
199
|
+
"tags": [],
|
|
200
|
+
"text": "An event emitted when the language option is initially active. The payload is the ISO 639 code of the language."
|
|
201
|
+
},
|
|
202
|
+
"complexType": {
|
|
203
|
+
"original": "string",
|
|
204
|
+
"resolved": "string",
|
|
205
|
+
"references": {}
|
|
206
|
+
}
|
|
185
207
|
}];
|
|
186
208
|
}
|
|
187
209
|
static get methods() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
:host{display:flex !important;flex-wrap:wrap;gap:.5rem}.post-language-switch-dropdown-container{display:flex;flex-direction:column}.post-language-switch-dropdown-container>*{width:100%}.post-language-switch-trigger{cursor:pointer;text-transform:uppercase;padding:0;overflow:visible;border:0;background:none;color:var(--post-scheme-color-interactive-button-secondary-enabled-fg);font:inherit;-webkit-user-select:none;user-select:none;appearance:button;text-decoration:none;display:inline-flex;align-items:center;gap:6px;border-radius:24px;font-size:16px;padding:3px 10px}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.post-language-switch-trigger{background-color:ButtonFace !important}.post-language-switch-trigger:hover{background-color:Highlight !important}}.post-language-switch-trigger{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}.post-language-switch-trigger: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){.post-language-switch-trigger:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){.post-language-switch-trigger: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){.post-language-switch-trigger:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}.post-language-switch-trigger:not(:disabled):hover,.post-language-switch-trigger.pretend-hover{border-color:var(--post-scheme-color-interactive-button-tertiary-hover-stroke);background-color:var(--post-scheme-color-interactive-button-tertiary-hover-bg);color:var(--post-scheme-color-interactive-button-tertiary-hover-fg)}.post-language-switch-trigger post-icon{height:
|
|
1
|
+
:host{display:flex !important;flex-wrap:wrap;gap:.5rem}.post-language-switch-dropdown-container{display:flex;flex-direction:column}.post-language-switch-dropdown-container>*{width:100%}.post-language-switch-trigger{cursor:pointer;text-transform:uppercase;padding:0;overflow:visible;border:0;background:none;color:var(--post-scheme-color-interactive-button-secondary-enabled-fg);font:inherit;-webkit-user-select:none;user-select:none;appearance:button;text-decoration:none;display:inline-flex;align-items:center;gap:6px;border-radius:24px;font-size:16px;padding:3px 10px}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.post-language-switch-trigger{background-color:ButtonFace !important}.post-language-switch-trigger:hover{background-color:Highlight !important}}.post-language-switch-trigger{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}.post-language-switch-trigger: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){.post-language-switch-trigger:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){.post-language-switch-trigger: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){.post-language-switch-trigger:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}.post-language-switch-trigger:not(:disabled):hover,.post-language-switch-trigger.pretend-hover{border-color:var(--post-scheme-color-interactive-button-tertiary-hover-stroke);background-color:var(--post-scheme-color-interactive-button-tertiary-hover-bg);color:var(--post-scheme-color-interactive-button-tertiary-hover-fg)}.post-language-switch-trigger post-icon{height:24px;width:24px}.post-language-switch-trigger[aria-expanded=true]{background-color:#050400;color:#fff}.post-language-switch-trigger[aria-expanded=true] post-icon{transform:rotate(180deg)}.post-language-switch-trigger[aria-expanded=true]:hover{background-color:#504f4b;color:#fff}
|
|
@@ -19,52 +19,65 @@ export class PostLanguageSwitch {
|
|
|
19
19
|
}
|
|
20
20
|
validateVariant() {
|
|
21
21
|
checkEmptyOrOneOf(this, 'variant', SWITCH_VARIANTS);
|
|
22
|
-
}
|
|
23
|
-
connectedCallback() {
|
|
24
|
-
this.updateChildrenVariant();
|
|
25
|
-
// Get the active language based on children's active state
|
|
26
|
-
const activeLanguageOption = this.host.querySelector('post-language-option[active]:not([active="false"])');
|
|
27
|
-
if (activeLanguageOption)
|
|
28
|
-
this.activeLang = activeLanguageOption.getAttribute('code');
|
|
29
|
-
}
|
|
30
|
-
// Update post-language-option variant to have the correct style
|
|
31
|
-
updateChildrenVariant() {
|
|
32
|
-
this.host.querySelectorAll('post-language-option').forEach(el => {
|
|
33
|
-
el.setAttribute('variant', this.variant);
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
componentWillUpdate() {
|
|
37
22
|
this.updateChildrenVariant();
|
|
38
23
|
}
|
|
39
24
|
componentDidLoad() {
|
|
40
25
|
this.validateCaption();
|
|
41
26
|
this.validateDescription();
|
|
42
27
|
this.validateVariant();
|
|
43
|
-
//
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
});
|
|
55
|
-
// Hides the dropdown when an option has been clicked
|
|
56
|
-
if (this.variant === 'menu') {
|
|
57
|
-
const menu = this.host.shadowRoot.querySelector('post-menu');
|
|
58
|
-
menu.hide();
|
|
28
|
+
// Initially set variants and active language
|
|
29
|
+
// Handles cases where the language-switch is rendered after the language-options have been rendered
|
|
30
|
+
this.updateChildrenVariant();
|
|
31
|
+
this.updateActiveLanguage();
|
|
32
|
+
}
|
|
33
|
+
handlePostChange(event) {
|
|
34
|
+
this.activeLang = event.detail;
|
|
35
|
+
// Update the active state in the children post-language-option components
|
|
36
|
+
this.languageOptions.forEach(lang => {
|
|
37
|
+
if (lang.code && lang.code === this.activeLang) {
|
|
38
|
+
lang.setAttribute('active', '');
|
|
59
39
|
}
|
|
40
|
+
else {
|
|
41
|
+
lang.removeAttribute('active');
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
// Hides the dropdown when an option has been clicked
|
|
45
|
+
if (this.variant === 'menu') {
|
|
46
|
+
const menu = this.host.shadowRoot.querySelector('post-menu');
|
|
47
|
+
menu.hide();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Handles cases where the language switch is being rendered before options are available
|
|
52
|
+
* @param event Initially emitted by <post-langauge-option>
|
|
53
|
+
*/
|
|
54
|
+
handleInitiallyActive(event) {
|
|
55
|
+
this.activeLang = event.detail;
|
|
56
|
+
}
|
|
57
|
+
get languageOptions() {
|
|
58
|
+
return this.host.querySelectorAll('post-language-option');
|
|
59
|
+
}
|
|
60
|
+
get activeLanguageOption() {
|
|
61
|
+
return this.host.querySelector('post-language-option[active]:not([active="false"])');
|
|
62
|
+
}
|
|
63
|
+
handleSlotChange() {
|
|
64
|
+
this.updateActiveLanguage();
|
|
65
|
+
}
|
|
66
|
+
updateActiveLanguage() {
|
|
67
|
+
this.activeLang = this.activeLanguageOption.getAttribute('code');
|
|
68
|
+
}
|
|
69
|
+
// Update post-language-option variant to have the correct style
|
|
70
|
+
updateChildrenVariant() {
|
|
71
|
+
this.languageOptions.forEach(el => {
|
|
72
|
+
el.setAttribute('variant', this.variant);
|
|
60
73
|
});
|
|
61
74
|
}
|
|
62
75
|
menuId = `p${nanoid(11)}`;
|
|
63
76
|
renderList() {
|
|
64
|
-
return (h(Host, { "data-version": version, role: "list", "aria-label": this.caption }, h("div", { class: "post-language-switch-list", role: "group", "aria-label": this.description }, h("slot",
|
|
77
|
+
return (h(Host, { "data-version": version, role: "list", "aria-label": this.caption }, h("div", { class: "post-language-switch-list", role: "group", "aria-label": this.description }, h("slot", { onSlotchange: () => this.handleSlotChange() }))));
|
|
65
78
|
}
|
|
66
79
|
renderDropdown() {
|
|
67
|
-
return (h(Host, { "data-version": version }, h("post-menu-trigger", { for: this.menuId }, h("button", { class: "post-language-switch-trigger", "aria-label": this.description }, this.activeLang, h("post-icon", { "aria-hidden": "true", name: "chevrondown" }))), h("post-menu", { id: this.menuId, class: "post-language-switch-dropdown-container", "aria-label": this.caption }, h("slot",
|
|
80
|
+
return (h(Host, { "data-version": version }, h("post-menu-trigger", { for: this.menuId }, h("button", { class: "post-language-switch-trigger", "aria-label": this.description }, this.activeLang, h("post-icon", { "aria-hidden": "true", name: "chevrondown" }))), h("post-menu", { id: this.menuId, class: "post-language-switch-dropdown-container", "aria-label": this.caption }, h("slot", { onSlotchange: () => this.handleSlotChange() }))));
|
|
68
81
|
}
|
|
69
82
|
render() {
|
|
70
83
|
return this.variant === 'list' ? this.renderList() : this.renderDropdown();
|
|
@@ -161,4 +174,19 @@ export class PostLanguageSwitch {
|
|
|
161
174
|
"methodName": "validateVariant"
|
|
162
175
|
}];
|
|
163
176
|
}
|
|
177
|
+
static get listeners() {
|
|
178
|
+
return [{
|
|
179
|
+
"name": "postChange",
|
|
180
|
+
"method": "handlePostChange",
|
|
181
|
+
"target": undefined,
|
|
182
|
+
"capture": false,
|
|
183
|
+
"passive": false
|
|
184
|
+
}, {
|
|
185
|
+
"name": "postLanguageOptionInitiallyActive",
|
|
186
|
+
"method": "handleInitiallyActive",
|
|
187
|
+
"target": undefined,
|
|
188
|
+
"capture": false,
|
|
189
|
+
"passive": false
|
|
190
|
+
}];
|
|
191
|
+
}
|
|
164
192
|
}
|
|
@@ -11,6 +11,7 @@ const PostLanguageOption = /*@__PURE__*/ proxyCustomElement(class PostLanguageOp
|
|
|
11
11
|
super();
|
|
12
12
|
this.__registerHost();
|
|
13
13
|
this.postChange = createEvent(this, "postChange", 7);
|
|
14
|
+
this.postLanguageOptionInitiallyActive = createEvent(this, "postLanguageOptionInitiallyActive", 7);
|
|
14
15
|
this.code = undefined;
|
|
15
16
|
this.active = undefined;
|
|
16
17
|
this.variant = undefined;
|
|
@@ -38,11 +39,18 @@ const PostLanguageOption = /*@__PURE__*/ proxyCustomElement(class PostLanguageOp
|
|
|
38
39
|
if (!this.name && this.isNameRequired()) {
|
|
39
40
|
throw new Error('The "name" property of the post-language-option component is required when the full language name is not displayed.');
|
|
40
41
|
}
|
|
42
|
+
if (this.active) {
|
|
43
|
+
this.postLanguageOptionInitiallyActive.emit(this.code);
|
|
44
|
+
}
|
|
41
45
|
}
|
|
42
46
|
/**
|
|
43
47
|
* An event emitted when the language option is clicked. The payload is the ISO 639 code of the language.
|
|
44
48
|
*/
|
|
45
49
|
postChange;
|
|
50
|
+
/**
|
|
51
|
+
* An event emitted when the language option is initially active. The payload is the ISO 639 code of the language.
|
|
52
|
+
*/
|
|
53
|
+
postLanguageOptionInitiallyActive;
|
|
46
54
|
/**
|
|
47
55
|
* Selects the language option programmatically.
|
|
48
56
|
*/
|
|
@@ -63,7 +71,7 @@ const PostLanguageOption = /*@__PURE__*/ proxyCustomElement(class PostLanguageOp
|
|
|
63
71
|
this.emitChange();
|
|
64
72
|
}
|
|
65
73
|
};
|
|
66
|
-
return (h(Host, { key: '
|
|
74
|
+
return (h(Host, { key: '23bf186d9cc718b2697cbc5bc54b44f6c9ead54f', "data-version": version, role: this.variant ? `${this.variant}item` : null }, this.url ? (h("a", { "aria-current": this.active ? 'page' : undefined, "aria-label": this.name, href: this.url, hrefLang: lang, lang: lang, onClick: () => this.emitChange(), onKeyDown: emitOnKeyDown }, h("slot", null))) : (h("button", { "aria-current": this.active ? 'true' : undefined, "aria-label": this.name, lang: lang, onClick: () => this.emitChange(), onKeyDown: emitOnKeyDown }, h("slot", null)))));
|
|
67
75
|
}
|
|
68
76
|
static get watchers() { return {
|
|
69
77
|
"code": ["validateCode"],
|