@govtechsg/sgds-web-component 3.3.2 → 3.3.3-rc.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/Masthead/index.js +2 -2
- package/base/card.js +1 -1
- package/base/sgds-element2.js +1 -1
- package/components/Accordion/index.umd.js +1 -1
- package/components/Alert/index.umd.js +2 -2
- package/components/Badge/index.umd.js +1 -1
- package/components/Breadcrumb/index.umd.js +36 -11
- package/components/Breadcrumb/index.umd.js.map +1 -1
- package/components/Button/button.js +1 -1
- package/components/Button/index.umd.js +61 -54
- package/components/Button/index.umd.js.map +1 -1
- package/components/Button/sgds-button.d.ts +1 -6
- package/components/Button/sgds-button.js +11 -27
- package/components/Button/sgds-button.js.map +1 -1
- package/components/Card/index.umd.js +3330 -3251
- package/components/Card/index.umd.js.map +1 -1
- package/components/Card/sgds-card.d.ts +1 -0
- package/components/Card/sgds-card.js +9 -3
- package/components/Card/sgds-card.js.map +1 -1
- package/components/Checkbox/index.umd.js +1 -1
- package/components/ComboBox/index.umd.js +2 -2
- package/components/Datepicker/index.umd.js +62 -29
- package/components/Datepicker/index.umd.js.map +1 -1
- package/components/DescriptionList/index.umd.js +1 -1
- package/components/Divider/index.umd.js +1 -1
- package/components/Drawer/index.umd.js +1 -1
- package/components/Dropdown/index.umd.js +2 -2
- package/components/FileUpload/index.umd.js +62 -29
- package/components/FileUpload/index.umd.js.map +1 -1
- package/components/Footer/footer-item.js +1 -1
- package/components/Footer/index.umd.js +89 -45
- package/components/Footer/index.umd.js.map +1 -1
- package/components/Footer/sgds-footer.d.ts +1 -1
- package/components/Footer/sgds-footer.js +39 -44
- package/components/Footer/sgds-footer.js.map +1 -1
- package/components/Icon/icon.js +1 -1
- package/components/Icon/index.umd.js +2 -2
- package/components/IconButton/index.umd.js +2 -2
- package/components/IconCard/index.umd.js +93 -14
- package/components/IconCard/index.umd.js.map +1 -1
- package/components/IconCard/sgds-icon-card.d.ts +1 -0
- package/components/IconCard/sgds-icon-card.js +8 -3
- package/components/IconCard/sgds-icon-card.js.map +1 -1
- package/components/IconList/index.umd.js +1 -1
- package/components/ImageCard/index.umd.js +93 -14
- package/components/ImageCard/index.umd.js.map +1 -1
- package/components/ImageCard/sgds-image-card.d.ts +1 -0
- package/components/ImageCard/sgds-image-card.js +8 -3
- package/components/ImageCard/sgds-image-card.js.map +1 -1
- package/components/Input/index.umd.js +2 -2
- package/components/Link/index.umd.js +35 -10
- package/components/Link/index.umd.js.map +1 -1
- package/components/Link/link.js +1 -1
- package/components/Link/sgds-link.d.ts +3 -0
- package/components/Link/sgds-link.js +33 -8
- package/components/Link/sgds-link.js.map +1 -1
- package/components/Mainnav/index.umd.js +2 -2
- package/components/Masthead/index.umd.js +2 -2
- package/components/Masthead/masthead.js +1 -1
- package/components/Modal/index.umd.js +1 -1
- package/components/OverflowMenu/index.umd.js +2 -2
- package/components/Pagination/index.umd.js +62 -29
- package/components/Pagination/index.umd.js.map +1 -1
- package/components/ProgressBar/index.umd.js +1 -1
- package/components/QuantityToggle/index.umd.js +2 -2
- package/components/Radio/index.umd.js +1 -1
- package/components/Select/index.umd.js +2 -2
- package/components/Sidenav/index.umd.js +2 -2
- package/components/Skeleton/index.umd.js +1 -1
- package/components/Spinner/index.umd.js +1 -1
- package/components/Stepper/index.umd.js +2 -2
- package/components/Subnav/index.umd.js +3 -3
- package/components/Subnav/subnav-item.js +1 -1
- package/components/Switch/index.umd.js +1 -1
- package/components/Tab/index.umd.js +1 -1
- package/components/Table/index.umd.js +1 -1
- package/components/TableOfContents/index.umd.js +1 -1
- package/components/Textarea/index.umd.js +1 -1
- package/components/ThumbnailCard/index.umd.js +93 -14
- package/components/ThumbnailCard/index.umd.js.map +1 -1
- package/components/ThumbnailCard/sgds-thumbnail-card.d.ts +1 -0
- package/components/ThumbnailCard/sgds-thumbnail-card.js +8 -3
- package/components/ThumbnailCard/sgds-thumbnail-card.js.map +1 -1
- package/components/Toast/index.umd.js +1 -1
- package/components/Tooltip/index.umd.js +1 -1
- package/components/index.umd.js +113 -95
- package/components/index.umd.js.map +1 -1
- package/index.umd.js +115 -97
- package/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/react/base/card.cjs.js +1 -1
- package/react/base/card.js +1 -1
- package/react/base/sgds-element.cjs2.js +1 -1
- package/react/base/sgds-element2.js +1 -1
- package/react/components/Button/button.cjs.js +1 -1
- package/react/components/Button/button.js +1 -1
- package/react/components/Button/sgds-button.cjs.js +10 -26
- package/react/components/Button/sgds-button.cjs.js.map +1 -1
- package/react/components/Button/sgds-button.js +11 -27
- package/react/components/Button/sgds-button.js.map +1 -1
- package/react/components/Card/sgds-card.cjs.js +9 -3
- package/react/components/Card/sgds-card.cjs.js.map +1 -1
- package/react/components/Card/sgds-card.js +9 -3
- package/react/components/Card/sgds-card.js.map +1 -1
- package/react/components/Footer/footer-item.cjs.js +1 -1
- package/react/components/Footer/footer-item.js +1 -1
- package/react/components/Footer/sgds-footer.cjs.js +38 -43
- package/react/components/Footer/sgds-footer.cjs.js.map +1 -1
- package/react/components/Footer/sgds-footer.js +39 -44
- package/react/components/Footer/sgds-footer.js.map +1 -1
- package/react/components/Icon/icon.cjs.js +1 -1
- package/react/components/Icon/icon.js +1 -1
- package/react/components/IconCard/sgds-icon-card.cjs.js +8 -3
- package/react/components/IconCard/sgds-icon-card.cjs.js.map +1 -1
- package/react/components/IconCard/sgds-icon-card.js +8 -3
- package/react/components/IconCard/sgds-icon-card.js.map +1 -1
- package/react/components/ImageCard/sgds-image-card.cjs.js +8 -3
- package/react/components/ImageCard/sgds-image-card.cjs.js.map +1 -1
- package/react/components/ImageCard/sgds-image-card.js +8 -3
- package/react/components/ImageCard/sgds-image-card.js.map +1 -1
- package/react/components/Link/link.cjs.js +1 -1
- package/react/components/Link/link.js +1 -1
- package/react/components/Link/sgds-link.cjs.js +33 -8
- package/react/components/Link/sgds-link.cjs.js.map +1 -1
- package/react/components/Link/sgds-link.js +33 -8
- package/react/components/Link/sgds-link.js.map +1 -1
- package/react/components/Masthead/masthead.cjs.js +1 -1
- package/react/components/Masthead/masthead.js +1 -1
- package/react/components/Subnav/subnav-item.cjs.js +1 -1
- package/react/components/Subnav/subnav-item.js +1 -1
- package/react/components/ThumbnailCard/sgds-thumbnail-card.cjs.js +8 -3
- package/react/components/ThumbnailCard/sgds-thumbnail-card.cjs.js.map +1 -1
- package/react/components/ThumbnailCard/sgds-thumbnail-card.js +8 -3
- package/react/components/ThumbnailCard/sgds-thumbnail-card.js.map +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { css } from 'lit';
|
|
3
3
|
|
|
4
|
-
var css_248z = css`.footer-item{margin-bottom:var(--sgds-margin-3-xs)}.footer-item,.links{display:flex;flex-direction:column;gap:var(--sgds-gap-xs)}slot[name=title]::slotted(*){--sgds-paragraph-spacing-xl:var(--sgds-margin-none);--sgds-font-weight-regular:var(--sgds-font-weight-semibold);color:var(--sgds-color-fixed-light);font-weight:var(--sgds-font-weight-regular,--sgds-font-weight-semibold);margin:var(--sgds-paragraph-spacing-xl,--sgds-margin-none)}.links{margin:0;padding:0}.links slot::slotted(a){--sgds-link-color-default:var(--sgds-color-fixed-light);color:var(--sgds-link-color-default,--sgds-fixed-light);text-decoration:none!important;width:fit-content}.links slot::slotted(a
|
|
4
|
+
var css_248z = css`.footer-item{margin-bottom:var(--sgds-margin-3-xs)}.footer-item,.links{display:flex;flex-direction:column;gap:var(--sgds-gap-xs)}slot[name=title]::slotted(*){--sgds-paragraph-spacing-xl:var(--sgds-margin-none);--sgds-font-weight-regular:var(--sgds-font-weight-semibold);color:var(--sgds-color-fixed-light);font-weight:var(--sgds-font-weight-regular,--sgds-font-weight-semibold);margin:var(--sgds-paragraph-spacing-xl,--sgds-margin-none)}.links{margin:0;padding:0}.links slot::slotted(a){--sgds-link-color-default:var(--sgds-color-fixed-light);color:var(--sgds-link-color-default,--sgds-fixed-light);text-decoration:none!important;width:fit-content}.links slot::slotted(a:focus),.links slot::slotted(a:focus-visible),slot::slotted(a:hover){--sgds-link-color-emphasis:var(--sgds-color-fixed-light);color:var(--sgds-link-color-emphasis,--sgds-color-fixed-light)}.links slot::slotted(a:focus),.links slot::slotted(a:focus-visible){outline:0}.links slot::slotted(a:focus-visible){box-shadow:var(--sgds-box-shadow-focus)}`;
|
|
5
5
|
|
|
6
6
|
export { css_248z as default };
|
|
7
7
|
//# sourceMappingURL=footer-item.js.map
|
|
@@ -7,6 +7,7 @@ var tslib = require('tslib');
|
|
|
7
7
|
var lit = require('lit');
|
|
8
8
|
var decorators_js = require('lit/decorators.js');
|
|
9
9
|
var sgdsElement = require('../../base/sgds-element.cjs.js');
|
|
10
|
+
var slot = require('../../utils/slot.cjs.js');
|
|
10
11
|
var footer = require('./footer.cjs.js');
|
|
11
12
|
|
|
12
13
|
/**
|
|
@@ -45,60 +46,54 @@ class SgdsFooter extends sgdsElement["default"] {
|
|
|
45
46
|
* href link for terms of use
|
|
46
47
|
*/
|
|
47
48
|
this.termsOfUseHref = "#";
|
|
48
|
-
|
|
49
|
-
firstUpdated() {
|
|
50
|
-
const socialMediaSlot = this.shadowRoot.querySelector("slot[name='social-media']");
|
|
51
|
-
const footerTitleSlot = this.shadowRoot.querySelector("slot[name='title']");
|
|
52
|
-
const footerDescriptionSlot = this.shadowRoot.querySelector("slot[name='description']");
|
|
53
|
-
const footerItemsSlot = this.shadowRoot.querySelector("slot[name='items']");
|
|
54
|
-
const socialMediaChildNodes = socialMediaSlot.assignedNodes({ flatten: true });
|
|
55
|
-
const footerTitleChildNodes = footerTitleSlot.assignedNodes({ flatten: true });
|
|
56
|
-
const footerDescriptionChildNodes = footerDescriptionSlot.assignedNodes({ flatten: true });
|
|
57
|
-
const footerItemsChildNodes = footerItemsSlot.assignedNodes({ flatten: true });
|
|
58
|
-
if (socialMediaChildNodes.length === 0) {
|
|
59
|
-
const socialMediaContainer = this.shadowRoot.querySelector(".social-media");
|
|
60
|
-
socialMediaContainer.style.display = "none";
|
|
61
|
-
}
|
|
62
|
-
if (footerTitleChildNodes.length === 0 && footerDescriptionChildNodes.length === 0) {
|
|
63
|
-
const footerHeaderContainer = this.shadowRoot.querySelector(".footer-header");
|
|
64
|
-
footerHeaderContainer.style.display = "none";
|
|
65
|
-
}
|
|
66
|
-
if (footerItemsChildNodes.length === 0) {
|
|
67
|
-
const footerItemsContainer = this.shadowRoot.querySelector(".footer-items");
|
|
68
|
-
footerItemsContainer.style.display = "none";
|
|
69
|
-
}
|
|
70
|
-
if (footerTitleChildNodes.length === 0 &&
|
|
71
|
-
footerDescriptionChildNodes.length === 0 &&
|
|
72
|
-
footerItemsChildNodes.length === 0) {
|
|
73
|
-
const footerTopContainer = this.shadowRoot.querySelector(".footer-top");
|
|
74
|
-
footerTopContainer.style.display = "none";
|
|
75
|
-
}
|
|
49
|
+
this.hasSlotController = new slot.HasSlotController(this, "social-media", "title", "description", "items");
|
|
76
50
|
}
|
|
77
51
|
render() {
|
|
52
|
+
const hasSocialMediaSlot = this.hasSlotController.test("social-media");
|
|
53
|
+
const hasTitleSlot = this.hasSlotController.test("title");
|
|
54
|
+
const hasDescriptionSlot = this.hasSlotController.test("description");
|
|
55
|
+
const hasItemsSlot = this.hasSlotController.test("items");
|
|
56
|
+
const displayFooterHeader = hasTitleSlot || hasDescriptionSlot;
|
|
57
|
+
const displayFooterItems = hasItemsSlot;
|
|
58
|
+
const displaySocialMedia = hasSocialMediaSlot;
|
|
59
|
+
const displayFooterTop = displayFooterHeader || displayFooterItems;
|
|
78
60
|
return lit.html `
|
|
79
61
|
<footer class="footer">
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
62
|
+
${displayFooterTop
|
|
63
|
+
? lit.html ` <section class="footer-top">
|
|
64
|
+
${displayFooterHeader
|
|
65
|
+
? lit.html `
|
|
66
|
+
<div class="footer-header">
|
|
67
|
+
<slot name="title"></slot>
|
|
68
|
+
<slot name="description"></slot>
|
|
69
|
+
</div>
|
|
70
|
+
`
|
|
71
|
+
: lit.nothing}
|
|
72
|
+
${displayFooterItems
|
|
73
|
+
? lit.html ` <div class="footer-items">
|
|
74
|
+
<slot name="items"></slot>
|
|
75
|
+
</div>`
|
|
76
|
+
: lit.nothing}
|
|
77
|
+
</section>`
|
|
78
|
+
: lit.nothing}
|
|
79
|
+
|
|
89
80
|
<section class="footer-bottom">
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
81
|
+
${displaySocialMedia
|
|
82
|
+
? lit.html `
|
|
83
|
+
<div class="social-media">
|
|
84
|
+
<slot name="social-media"></slot>
|
|
85
|
+
</div>
|
|
86
|
+
`
|
|
87
|
+
: lit.nothing}
|
|
93
88
|
<div class="footer-mandatory-links">
|
|
94
89
|
<ul>
|
|
95
90
|
<li><a href=${this.contactHref}>Contact</a></li>
|
|
96
91
|
<li><a href=${this.feedbackHref}>Feedback</a></li>
|
|
97
92
|
<li><a href=${this.faqHref}>FAQ</a></li>
|
|
98
93
|
<li>
|
|
99
|
-
<a href="https://tech.gov.sg/report_vulnerability" target="_blank" rel="noopener noreferrer"
|
|
100
|
-
Report Vulnerability
|
|
101
|
-
|
|
94
|
+
<a href="https://tech.gov.sg/report_vulnerability" target="_blank" rel="noopener noreferrer"
|
|
95
|
+
>Report Vulnerability</a
|
|
96
|
+
>
|
|
102
97
|
</li>
|
|
103
98
|
<li><a href=${this.privacyHref}>Privacy Statement</a></li>
|
|
104
99
|
<li><a href=${this.termsOfUseHref}>Terms of use</a></li>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sgds-footer.cjs.js","sources":["../../../../src/components/Footer/sgds-footer.ts"],"sourcesContent":["import { html } from \"lit\";\nimport { property } from \"lit/decorators.js\";\nimport SgdsElement from \"../../base/sgds-element\";\nimport footerStyle from \"./footer.css\";\n\n/**\n * @summary The footer contains supporting information for your service at the bottom of your website. All .gov.sg digital services shall contain a Global Footer Bar across all pages. The Global Footer Bar should include the name of the digital service, contact information, a privacy statement and the terms of use.\n *\n * @slot title - The slot for title\n * @slot description - The slot for description\n * @slot items - The slot for the list of footer items\n * @slot social-media - The slot for the list of social media with icons\n *\n */\nexport class SgdsFooter extends SgdsElement {\n static styles = [...SgdsElement.styles, footerStyle];\n\n /**\n * \tSets copyrightLiner of SgdsFooter\n */\n @property({ type: String })\n copyrightLiner = \"Government of Singapore\";\n\n /**\n * \thref link for contacts\n */\n @property({ type: String })\n contactHref = \"#\";\n\n /**\n * \thref link for feedback\n */\n @property({ type: String })\n feedbackHref = \"#\";\n\n /**\n * \thref link for faq\n */\n @property({ type: String })\n faqHref = \"#\";\n\n /**\n * \thref link for privacy statement\n */\n @property({ type: String })\n privacyHref = \"#\";\n\n /**\n * \thref link for terms of use\n */\n @property({ type: String })\n termsOfUseHref = \"#\";\n\n
|
|
1
|
+
{"version":3,"file":"sgds-footer.cjs.js","sources":["../../../../src/components/Footer/sgds-footer.ts"],"sourcesContent":["import { html, nothing } from \"lit\";\nimport { property } from \"lit/decorators.js\";\nimport SgdsElement from \"../../base/sgds-element\";\nimport { HasSlotController } from \"../../utils/slot\";\nimport footerStyle from \"./footer.css\";\n\n/**\n * @summary The footer contains supporting information for your service at the bottom of your website. All .gov.sg digital services shall contain a Global Footer Bar across all pages. The Global Footer Bar should include the name of the digital service, contact information, a privacy statement and the terms of use.\n *\n * @slot title - The slot for title\n * @slot description - The slot for description\n * @slot items - The slot for the list of footer items\n * @slot social-media - The slot for the list of social media with icons\n *\n */\nexport class SgdsFooter extends SgdsElement {\n static styles = [...SgdsElement.styles, footerStyle];\n\n /**\n * \tSets copyrightLiner of SgdsFooter\n */\n @property({ type: String })\n copyrightLiner = \"Government of Singapore\";\n\n /**\n * \thref link for contacts\n */\n @property({ type: String })\n contactHref = \"#\";\n\n /**\n * \thref link for feedback\n */\n @property({ type: String })\n feedbackHref = \"#\";\n\n /**\n * \thref link for faq\n */\n @property({ type: String })\n faqHref = \"#\";\n\n /**\n * \thref link for privacy statement\n */\n @property({ type: String })\n privacyHref = \"#\";\n\n /**\n * \thref link for terms of use\n */\n @property({ type: String })\n termsOfUseHref = \"#\";\n\n private readonly hasSlotController = new HasSlotController(this, \"social-media\", \"title\", \"description\", \"items\");\n\n render() {\n const hasSocialMediaSlot = this.hasSlotController.test(\"social-media\");\n const hasTitleSlot = this.hasSlotController.test(\"title\");\n const hasDescriptionSlot = this.hasSlotController.test(\"description\");\n const hasItemsSlot = this.hasSlotController.test(\"items\");\n\n const displayFooterHeader = hasTitleSlot || hasDescriptionSlot;\n const displayFooterItems = hasItemsSlot;\n const displaySocialMedia = hasSocialMediaSlot;\n const displayFooterTop = displayFooterHeader || displayFooterItems;\n\n return html`\n <footer class=\"footer\">\n ${displayFooterTop\n ? html` <section class=\"footer-top\">\n ${displayFooterHeader\n ? html`\n <div class=\"footer-header\">\n <slot name=\"title\"></slot>\n <slot name=\"description\"></slot>\n </div>\n `\n : nothing}\n ${displayFooterItems\n ? html` <div class=\"footer-items\">\n <slot name=\"items\"></slot>\n </div>`\n : nothing}\n </section>`\n : nothing}\n\n <section class=\"footer-bottom\">\n ${displaySocialMedia\n ? html`\n <div class=\"social-media\">\n <slot name=\"social-media\"></slot>\n </div>\n `\n : nothing}\n <div class=\"footer-mandatory-links\">\n <ul>\n <li><a href=${this.contactHref}>Contact</a></li>\n <li><a href=${this.feedbackHref}>Feedback</a></li>\n <li><a href=${this.faqHref}>FAQ</a></li>\n <li>\n <a href=\"https://tech.gov.sg/report_vulnerability\" target=\"_blank\" rel=\"noopener noreferrer\"\n >Report Vulnerability</a\n >\n </li>\n <li><a href=${this.privacyHref}>Privacy Statement</a></li>\n <li><a href=${this.termsOfUseHref}>Terms of use</a></li>\n </ul>\n <div class=\"footer-copyrights\">© ${new Date().getFullYear()}, ${this.copyrightLiner}</div>\n </div>\n </section>\n </footer>\n `;\n }\n}\n\nexport default SgdsFooter;\n"],"names":["SgdsElement","HasSlotController","html","nothing","footerStyle","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IAAAC,sBAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AACb,CAAA,EAAA,UAAA,CAAA,SAAA,EAAA,SAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAMdD,gBAAA,CAAA;AADC,IAAAC,sBAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AACT,CAAA,EAAA,UAAA,CAAA,SAAA,EAAA,aAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAMlBD,gBAAA,CAAA;AADC,IAAAC,sBAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AACN,CAAA,EAAA,UAAA,CAAA,SAAA,EAAA,gBAAA,EAAA,KAAA,CAAA,CAAA;;;;;"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { __decorate } from 'tslib';
|
|
3
|
-
import { html } from 'lit';
|
|
3
|
+
import { html, nothing } from 'lit';
|
|
4
4
|
import { property } from 'lit/decorators.js';
|
|
5
5
|
import SgdsElement from '../../base/sgds-element.js';
|
|
6
|
+
import { HasSlotController } from '../../utils/slot.js';
|
|
6
7
|
import css_248z from './footer.js';
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -41,60 +42,54 @@ class SgdsFooter extends SgdsElement {
|
|
|
41
42
|
* href link for terms of use
|
|
42
43
|
*/
|
|
43
44
|
this.termsOfUseHref = "#";
|
|
44
|
-
|
|
45
|
-
firstUpdated() {
|
|
46
|
-
const socialMediaSlot = this.shadowRoot.querySelector("slot[name='social-media']");
|
|
47
|
-
const footerTitleSlot = this.shadowRoot.querySelector("slot[name='title']");
|
|
48
|
-
const footerDescriptionSlot = this.shadowRoot.querySelector("slot[name='description']");
|
|
49
|
-
const footerItemsSlot = this.shadowRoot.querySelector("slot[name='items']");
|
|
50
|
-
const socialMediaChildNodes = socialMediaSlot.assignedNodes({ flatten: true });
|
|
51
|
-
const footerTitleChildNodes = footerTitleSlot.assignedNodes({ flatten: true });
|
|
52
|
-
const footerDescriptionChildNodes = footerDescriptionSlot.assignedNodes({ flatten: true });
|
|
53
|
-
const footerItemsChildNodes = footerItemsSlot.assignedNodes({ flatten: true });
|
|
54
|
-
if (socialMediaChildNodes.length === 0) {
|
|
55
|
-
const socialMediaContainer = this.shadowRoot.querySelector(".social-media");
|
|
56
|
-
socialMediaContainer.style.display = "none";
|
|
57
|
-
}
|
|
58
|
-
if (footerTitleChildNodes.length === 0 && footerDescriptionChildNodes.length === 0) {
|
|
59
|
-
const footerHeaderContainer = this.shadowRoot.querySelector(".footer-header");
|
|
60
|
-
footerHeaderContainer.style.display = "none";
|
|
61
|
-
}
|
|
62
|
-
if (footerItemsChildNodes.length === 0) {
|
|
63
|
-
const footerItemsContainer = this.shadowRoot.querySelector(".footer-items");
|
|
64
|
-
footerItemsContainer.style.display = "none";
|
|
65
|
-
}
|
|
66
|
-
if (footerTitleChildNodes.length === 0 &&
|
|
67
|
-
footerDescriptionChildNodes.length === 0 &&
|
|
68
|
-
footerItemsChildNodes.length === 0) {
|
|
69
|
-
const footerTopContainer = this.shadowRoot.querySelector(".footer-top");
|
|
70
|
-
footerTopContainer.style.display = "none";
|
|
71
|
-
}
|
|
45
|
+
this.hasSlotController = new HasSlotController(this, "social-media", "title", "description", "items");
|
|
72
46
|
}
|
|
73
47
|
render() {
|
|
48
|
+
const hasSocialMediaSlot = this.hasSlotController.test("social-media");
|
|
49
|
+
const hasTitleSlot = this.hasSlotController.test("title");
|
|
50
|
+
const hasDescriptionSlot = this.hasSlotController.test("description");
|
|
51
|
+
const hasItemsSlot = this.hasSlotController.test("items");
|
|
52
|
+
const displayFooterHeader = hasTitleSlot || hasDescriptionSlot;
|
|
53
|
+
const displayFooterItems = hasItemsSlot;
|
|
54
|
+
const displaySocialMedia = hasSocialMediaSlot;
|
|
55
|
+
const displayFooterTop = displayFooterHeader || displayFooterItems;
|
|
74
56
|
return html `
|
|
75
57
|
<footer class="footer">
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
58
|
+
${displayFooterTop
|
|
59
|
+
? html ` <section class="footer-top">
|
|
60
|
+
${displayFooterHeader
|
|
61
|
+
? html `
|
|
62
|
+
<div class="footer-header">
|
|
63
|
+
<slot name="title"></slot>
|
|
64
|
+
<slot name="description"></slot>
|
|
65
|
+
</div>
|
|
66
|
+
`
|
|
67
|
+
: nothing}
|
|
68
|
+
${displayFooterItems
|
|
69
|
+
? html ` <div class="footer-items">
|
|
70
|
+
<slot name="items"></slot>
|
|
71
|
+
</div>`
|
|
72
|
+
: nothing}
|
|
73
|
+
</section>`
|
|
74
|
+
: nothing}
|
|
75
|
+
|
|
85
76
|
<section class="footer-bottom">
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
77
|
+
${displaySocialMedia
|
|
78
|
+
? html `
|
|
79
|
+
<div class="social-media">
|
|
80
|
+
<slot name="social-media"></slot>
|
|
81
|
+
</div>
|
|
82
|
+
`
|
|
83
|
+
: nothing}
|
|
89
84
|
<div class="footer-mandatory-links">
|
|
90
85
|
<ul>
|
|
91
86
|
<li><a href=${this.contactHref}>Contact</a></li>
|
|
92
87
|
<li><a href=${this.feedbackHref}>Feedback</a></li>
|
|
93
88
|
<li><a href=${this.faqHref}>FAQ</a></li>
|
|
94
89
|
<li>
|
|
95
|
-
<a href="https://tech.gov.sg/report_vulnerability" target="_blank" rel="noopener noreferrer"
|
|
96
|
-
Report Vulnerability
|
|
97
|
-
|
|
90
|
+
<a href="https://tech.gov.sg/report_vulnerability" target="_blank" rel="noopener noreferrer"
|
|
91
|
+
>Report Vulnerability</a
|
|
92
|
+
>
|
|
98
93
|
</li>
|
|
99
94
|
<li><a href=${this.privacyHref}>Privacy Statement</a></li>
|
|
100
95
|
<li><a href=${this.termsOfUseHref}>Terms of use</a></li>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sgds-footer.js","sources":["../../../../src/components/Footer/sgds-footer.ts"],"sourcesContent":["import { html } from \"lit\";\nimport { property } from \"lit/decorators.js\";\nimport SgdsElement from \"../../base/sgds-element\";\nimport footerStyle from \"./footer.css\";\n\n/**\n * @summary The footer contains supporting information for your service at the bottom of your website. All .gov.sg digital services shall contain a Global Footer Bar across all pages. The Global Footer Bar should include the name of the digital service, contact information, a privacy statement and the terms of use.\n *\n * @slot title - The slot for title\n * @slot description - The slot for description\n * @slot items - The slot for the list of footer items\n * @slot social-media - The slot for the list of social media with icons\n *\n */\nexport class SgdsFooter extends SgdsElement {\n static styles = [...SgdsElement.styles, footerStyle];\n\n /**\n * \tSets copyrightLiner of SgdsFooter\n */\n @property({ type: String })\n copyrightLiner = \"Government of Singapore\";\n\n /**\n * \thref link for contacts\n */\n @property({ type: String })\n contactHref = \"#\";\n\n /**\n * \thref link for feedback\n */\n @property({ type: String })\n feedbackHref = \"#\";\n\n /**\n * \thref link for faq\n */\n @property({ type: String })\n faqHref = \"#\";\n\n /**\n * \thref link for privacy statement\n */\n @property({ type: String })\n privacyHref = \"#\";\n\n /**\n * \thref link for terms of use\n */\n @property({ type: String })\n termsOfUseHref = \"#\";\n\n
|
|
1
|
+
{"version":3,"file":"sgds-footer.js","sources":["../../../../src/components/Footer/sgds-footer.ts"],"sourcesContent":["import { html, nothing } from \"lit\";\nimport { property } from \"lit/decorators.js\";\nimport SgdsElement from \"../../base/sgds-element\";\nimport { HasSlotController } from \"../../utils/slot\";\nimport footerStyle from \"./footer.css\";\n\n/**\n * @summary The footer contains supporting information for your service at the bottom of your website. All .gov.sg digital services shall contain a Global Footer Bar across all pages. The Global Footer Bar should include the name of the digital service, contact information, a privacy statement and the terms of use.\n *\n * @slot title - The slot for title\n * @slot description - The slot for description\n * @slot items - The slot for the list of footer items\n * @slot social-media - The slot for the list of social media with icons\n *\n */\nexport class SgdsFooter extends SgdsElement {\n static styles = [...SgdsElement.styles, footerStyle];\n\n /**\n * \tSets copyrightLiner of SgdsFooter\n */\n @property({ type: String })\n copyrightLiner = \"Government of Singapore\";\n\n /**\n * \thref link for contacts\n */\n @property({ type: String })\n contactHref = \"#\";\n\n /**\n * \thref link for feedback\n */\n @property({ type: String })\n feedbackHref = \"#\";\n\n /**\n * \thref link for faq\n */\n @property({ type: String })\n faqHref = \"#\";\n\n /**\n * \thref link for privacy statement\n */\n @property({ type: String })\n privacyHref = \"#\";\n\n /**\n * \thref link for terms of use\n */\n @property({ type: String })\n termsOfUseHref = \"#\";\n\n private readonly hasSlotController = new HasSlotController(this, \"social-media\", \"title\", \"description\", \"items\");\n\n render() {\n const hasSocialMediaSlot = this.hasSlotController.test(\"social-media\");\n const hasTitleSlot = this.hasSlotController.test(\"title\");\n const hasDescriptionSlot = this.hasSlotController.test(\"description\");\n const hasItemsSlot = this.hasSlotController.test(\"items\");\n\n const displayFooterHeader = hasTitleSlot || hasDescriptionSlot;\n const displayFooterItems = hasItemsSlot;\n const displaySocialMedia = hasSocialMediaSlot;\n const displayFooterTop = displayFooterHeader || displayFooterItems;\n\n return html`\n <footer class=\"footer\">\n ${displayFooterTop\n ? html` <section class=\"footer-top\">\n ${displayFooterHeader\n ? html`\n <div class=\"footer-header\">\n <slot name=\"title\"></slot>\n <slot name=\"description\"></slot>\n </div>\n `\n : nothing}\n ${displayFooterItems\n ? html` <div class=\"footer-items\">\n <slot name=\"items\"></slot>\n </div>`\n : nothing}\n </section>`\n : nothing}\n\n <section class=\"footer-bottom\">\n ${displaySocialMedia\n ? html`\n <div class=\"social-media\">\n <slot name=\"social-media\"></slot>\n </div>\n `\n : nothing}\n <div class=\"footer-mandatory-links\">\n <ul>\n <li><a href=${this.contactHref}>Contact</a></li>\n <li><a href=${this.feedbackHref}>Feedback</a></li>\n <li><a href=${this.faqHref}>FAQ</a></li>\n <li>\n <a href=\"https://tech.gov.sg/report_vulnerability\" target=\"_blank\" rel=\"noopener noreferrer\"\n >Report Vulnerability</a\n >\n </li>\n <li><a href=${this.privacyHref}>Privacy Statement</a></li>\n <li><a href=${this.termsOfUseHref}>Terms of use</a></li>\n </ul>\n <div class=\"footer-copyrights\">© ${new Date().getFullYear()}, ${this.copyrightLiner}</div>\n </div>\n </section>\n </footer>\n `;\n }\n}\n\nexport default SgdsFooter;\n"],"names":["footerStyle"],"mappings":";;;;;;;;AAMA;;;;;;;;AAQG;AACG,MAAO,UAAW,SAAQ,WAAW,CAAA;AAA3C,IAAA,WAAA,GAAA;;AAGE;;AAEG;QAEH,IAAc,CAAA,cAAA,GAAG,yBAAyB,CAAC;AAE3C;;AAEG;QAEH,IAAW,CAAA,WAAA,GAAG,GAAG,CAAC;AAElB;;AAEG;QAEH,IAAY,CAAA,YAAA,GAAG,GAAG,CAAC;AAEnB;;AAEG;QAEH,IAAO,CAAA,OAAA,GAAG,GAAG,CAAC;AAEd;;AAEG;QAEH,IAAW,CAAA,WAAA,GAAG,GAAG,CAAC;AAElB;;AAEG;QAEH,IAAc,CAAA,cAAA,GAAG,GAAG,CAAC;AAEJ,QAAA,IAAA,CAAA,iBAAiB,GAAG,IAAI,iBAAiB,CAAC,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;KA4DnH;IA1DC,MAAM,GAAA;QACJ,MAAM,kBAAkB,GAAG,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QACvE,MAAM,YAAY,GAAG,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC1D,MAAM,kBAAkB,GAAG,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACtE,MAAM,YAAY,GAAG,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAE1D,QAAA,MAAM,mBAAmB,GAAG,YAAY,IAAI,kBAAkB,CAAC;QAC/D,MAAM,kBAAkB,GAAG,YAAY,CAAC;QACxC,MAAM,kBAAkB,GAAG,kBAAkB,CAAC;AAC9C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MAAM,EAAE,CAAC;AACR,CAAA,EAAA,UAAA,CAAA,SAAA,EAAA,cAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAMnB,UAAA,CAAA;AADC,IAAA,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AACb,CAAA,EAAA,UAAA,CAAA,SAAA,EAAA,SAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAMd,UAAA,CAAA;AADC,IAAA,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AACT,CAAA,EAAA,UAAA,CAAA,SAAA,EAAA,aAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAMlB,UAAA,CAAA;AADC,IAAA,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AACN,CAAA,EAAA,UAAA,CAAA,SAAA,EAAA,gBAAA,EAAA,KAAA,CAAA,CAAA;;;;"}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var lit = require('lit');
|
|
7
7
|
|
|
8
|
-
var css_248z = lit.css`:host{color:inherit;display:inline-flex}:host([size=sm]) svg{height:var(--sgds-icon-size-sm);width:var(--sgds-icon-size-sm)}:host([size=md]) svg{height:var(--sgds-icon-size-md);width:var(--sgds-icon-size-md)}:host([size=xl]) svg{height:var(--sgds-icon-size-xl);width:var(--sgds-icon-size-xl)}:host([size="2-xl"]) svg{height:var(--sgds-icon-size-2-xl);width:var(--sgds-icon-size-2-xl)}:host([size="3-xl"]) svg{height:var(--sgds-icon-size-3-xl);width:var(--sgds-icon-size-3-xl)}svg{display:inline-block;height:var(--sgds-icon-size-lg);width:var(--sgds-icon-size-lg)}`;
|
|
8
|
+
var css_248z = lit.css`:host{color:inherit;display:inline-flex;vertical-align:bottom}:host(.icon-left){margin-right:.25rem}:host(.icon-right){margin-left:.25rem}:host([size=sm]) svg{height:var(--sgds-icon-size-sm);width:var(--sgds-icon-size-sm)}:host([size=md]) svg{height:var(--sgds-icon-size-md);width:var(--sgds-icon-size-md)}:host([size=xl]) svg{height:var(--sgds-icon-size-xl);width:var(--sgds-icon-size-xl)}:host([size="2-xl"]) svg{height:var(--sgds-icon-size-2-xl);width:var(--sgds-icon-size-2-xl)}:host([size="3-xl"]) svg{height:var(--sgds-icon-size-3-xl);width:var(--sgds-icon-size-3-xl)}svg{display:inline-block;height:var(--sgds-icon-size-lg);width:var(--sgds-icon-size-lg)}`;
|
|
9
9
|
|
|
10
10
|
exports["default"] = css_248z;
|
|
11
11
|
//# sourceMappingURL=icon.cjs.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { css } from 'lit';
|
|
3
3
|
|
|
4
|
-
var css_248z = css`:host{color:inherit;display:inline-flex}:host([size=sm]) svg{height:var(--sgds-icon-size-sm);width:var(--sgds-icon-size-sm)}:host([size=md]) svg{height:var(--sgds-icon-size-md);width:var(--sgds-icon-size-md)}:host([size=xl]) svg{height:var(--sgds-icon-size-xl);width:var(--sgds-icon-size-xl)}:host([size="2-xl"]) svg{height:var(--sgds-icon-size-2-xl);width:var(--sgds-icon-size-2-xl)}:host([size="3-xl"]) svg{height:var(--sgds-icon-size-3-xl);width:var(--sgds-icon-size-3-xl)}svg{display:inline-block;height:var(--sgds-icon-size-lg);width:var(--sgds-icon-size-lg)}`;
|
|
4
|
+
var css_248z = css`:host{color:inherit;display:inline-flex;vertical-align:bottom}:host(.icon-left){margin-right:.25rem}:host(.icon-right){margin-left:.25rem}:host([size=sm]) svg{height:var(--sgds-icon-size-sm);width:var(--sgds-icon-size-sm)}:host([size=md]) svg{height:var(--sgds-icon-size-md);width:var(--sgds-icon-size-md)}:host([size=xl]) svg{height:var(--sgds-icon-size-xl);width:var(--sgds-icon-size-xl)}:host([size="2-xl"]) svg{height:var(--sgds-icon-size-2-xl);width:var(--sgds-icon-size-2-xl)}:host([size="3-xl"]) svg{height:var(--sgds-icon-size-3-xl);width:var(--sgds-icon-size-3-xl)}svg{display:inline-block;height:var(--sgds-icon-size-lg);width:var(--sgds-icon-size-lg)}`;
|
|
5
5
|
|
|
6
6
|
export { css_248z as default };
|
|
7
7
|
//# sourceMappingURL=icon.js.map
|
|
@@ -9,6 +9,7 @@ var staticHtml_js = require('lit/static-html.js');
|
|
|
9
9
|
var decorators_js = require('lit/decorators.js');
|
|
10
10
|
var classMap_js = require('lit/directives/class-map.js');
|
|
11
11
|
var cardElement = require('../../base/card-element.cjs.js');
|
|
12
|
+
var slot = require('../../utils/slot.cjs.js');
|
|
12
13
|
var iconCard = require('./icon-card.cjs.js');
|
|
13
14
|
|
|
14
15
|
/**
|
|
@@ -27,6 +28,7 @@ class SgdsIconCard extends cardElement.CardElement {
|
|
|
27
28
|
super(...arguments);
|
|
28
29
|
/** Removes the card's internal padding when set to true. */
|
|
29
30
|
this.noPadding = false;
|
|
31
|
+
this.hasSlotController = new slot.HasSlotController(this, "description");
|
|
30
32
|
}
|
|
31
33
|
firstUpdated() {
|
|
32
34
|
if (this._iconNode.length === 0) {
|
|
@@ -42,6 +44,7 @@ class SgdsIconCard extends cardElement.CardElement {
|
|
|
42
44
|
render() {
|
|
43
45
|
const tag = this.stretchedLink ? staticHtml_js.literal `a` : staticHtml_js.literal `div`;
|
|
44
46
|
const cardTabIndex = !this.stretchedLink || this.disabled ? -1 : 0;
|
|
47
|
+
const hasDescriptionSlot = this.hasSlotController.test("description");
|
|
45
48
|
return staticHtml_js.html `
|
|
46
49
|
<${tag}
|
|
47
50
|
class="card ${classMap_js.classMap({
|
|
@@ -63,9 +66,11 @@ class SgdsIconCard extends cardElement.CardElement {
|
|
|
63
66
|
</div>
|
|
64
67
|
<slot></slot>
|
|
65
68
|
</div>
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
${hasDescriptionSlot
|
|
70
|
+
? staticHtml_js.html `<p class="card-text">
|
|
71
|
+
<slot name="description"></slot>
|
|
72
|
+
</p>`
|
|
73
|
+
: lit.nothing}
|
|
69
74
|
<slot name="lower"></slot>
|
|
70
75
|
<slot name="link" @slotchange=${this.handleLinkSlotChange}></slot>
|
|
71
76
|
</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sgds-icon-card.cjs.js","sources":["../../../../src/components/IconCard/sgds-icon-card.ts"],"sourcesContent":["import { nothing } from \"lit\";\nimport { html, literal } from \"lit/static-html.js\";\nimport { property, queryAssignedNodes } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { CardElement } from \"../../base/card-element\";\nimport IconCardStyle from \"./icon-card.css\";\n\n/**\n * @summary Icon cards can be used for headers and footers, a wide variety of content, contain contextual background colors and images.\n * @slot default - The content area of the card, placed directly under the title. Accepts any HTML or custom elements.\n * @slot icon - Accepts an icon element to visually represent the card. Only a single element is allowed to be passed in.\n * @slot upper - Accepts any content to be displayed at the top of the subtitle. Commonly used for badges, status indicators, or decorative elements.\n * @slot subtitle - The subtitle of the card\n * @slot title - The title of the card\n * @slot description - The paragrapher text of the card\n * @slot lower - Accepts any additional content to be displayed below the card description, such as badges, metadata, or supplementary information.\n * @slot link - Accepts an anchor element. Only a single element is allowed to be passed in.\n */\nexport class SgdsIconCard extends CardElement {\n static styles = [...CardElement.styles, IconCardStyle];\n\n /** @internal */\n @queryAssignedNodes({ slot: \"icon\", flatten: true })\n _iconNode!: Array<Node>;\n /** @internal */\n @queryAssignedNodes({ slot: \"upper\", flatten: true })\n _upperNode!: Array<Node>;\n\n /** Removes the card's internal padding when set to true. */\n @property({ type: Boolean, reflect: true }) noPadding = false;\n\n protected firstUpdated() {\n if (this._iconNode.length === 0) {\n if ((this.orientation === \"vertical\" && this._upperNode.length === 0) || this.orientation === \"horizontal\") {\n const media = this.shadowRoot.querySelector(\".card-media\") as HTMLDivElement;\n media.style.display = \"none\";\n\n const body = this.shadowRoot.querySelector(\".card-body\") as HTMLDivElement;\n if (this.noPadding) body.style.padding = \"0px\";\n }\n }\n }\n\n render() {\n const tag = this.stretchedLink ? literal`a` : literal`div`;\n const cardTabIndex = !this.stretchedLink || this.disabled ? -1 : 0;\n\n return html`\n <${tag} \n class=\"card ${classMap({\n disabled: this.disabled\n })}\"\n tabindex=${cardTabIndex}\n >\n ${this.tinted && !this.noPadding ? html`<div class=\"card-tinted-bg\"></div>` : nothing}\n <div class=\"card-media\">\n <slot name=\"icon\"></slot>\n ${this.orientation === \"vertical\" ? html`<slot name=\"upper\"></slot>` : nothing}\n </div>\n <div class=\"card-body\">\n ${this.orientation === \"horizontal\" ? html`<slot name=\"upper\"></slot>` : nothing}\n <div class=\"card-header-container\">\n <div class=\"card-header\">\n <slot name=\"subtitle\"></slot>\n <h3 class=\"card-title\"><slot name=\"title\" @slotchange=${this.handleTitleSlotChange}></slot></h3>\n </div>\n <slot></slot>\n </div>\n
|
|
1
|
+
{"version":3,"file":"sgds-icon-card.cjs.js","sources":["../../../../src/components/IconCard/sgds-icon-card.ts"],"sourcesContent":["import { nothing } from \"lit\";\nimport { html, literal } from \"lit/static-html.js\";\nimport { property, queryAssignedNodes } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { CardElement } from \"../../base/card-element\";\nimport { HasSlotController } from \"../../utils/slot\";\nimport IconCardStyle from \"./icon-card.css\";\n\n/**\n * @summary Icon cards can be used for headers and footers, a wide variety of content, contain contextual background colors and images.\n * @slot default - The content area of the card, placed directly under the title. Accepts any HTML or custom elements.\n * @slot icon - Accepts an icon element to visually represent the card. Only a single element is allowed to be passed in.\n * @slot upper - Accepts any content to be displayed at the top of the subtitle. Commonly used for badges, status indicators, or decorative elements.\n * @slot subtitle - The subtitle of the card\n * @slot title - The title of the card\n * @slot description - The paragrapher text of the card\n * @slot lower - Accepts any additional content to be displayed below the card description, such as badges, metadata, or supplementary information.\n * @slot link - Accepts an anchor element. Only a single element is allowed to be passed in.\n */\nexport class SgdsIconCard extends CardElement {\n static styles = [...CardElement.styles, IconCardStyle];\n\n /** @internal */\n @queryAssignedNodes({ slot: \"icon\", flatten: true })\n _iconNode!: Array<Node>;\n /** @internal */\n @queryAssignedNodes({ slot: \"upper\", flatten: true })\n _upperNode!: Array<Node>;\n\n /** Removes the card's internal padding when set to true. */\n @property({ type: Boolean, reflect: true }) noPadding = false;\n\n private readonly hasSlotController = new HasSlotController(this, \"description\");\n\n protected firstUpdated() {\n if (this._iconNode.length === 0) {\n if ((this.orientation === \"vertical\" && this._upperNode.length === 0) || this.orientation === \"horizontal\") {\n const media = this.shadowRoot.querySelector(\".card-media\") as HTMLDivElement;\n media.style.display = \"none\";\n\n const body = this.shadowRoot.querySelector(\".card-body\") as HTMLDivElement;\n if (this.noPadding) body.style.padding = \"0px\";\n }\n }\n }\n\n render() {\n const tag = this.stretchedLink ? literal`a` : literal`div`;\n const cardTabIndex = !this.stretchedLink || this.disabled ? -1 : 0;\n const hasDescriptionSlot = this.hasSlotController.test(\"description\");\n\n return html`\n <${tag} \n class=\"card ${classMap({\n disabled: this.disabled\n })}\"\n tabindex=${cardTabIndex}\n >\n ${this.tinted && !this.noPadding ? html`<div class=\"card-tinted-bg\"></div>` : nothing}\n <div class=\"card-media\">\n <slot name=\"icon\"></slot>\n ${this.orientation === \"vertical\" ? html`<slot name=\"upper\"></slot>` : nothing}\n </div>\n <div class=\"card-body\">\n ${this.orientation === \"horizontal\" ? html`<slot name=\"upper\"></slot>` : nothing}\n <div class=\"card-header-container\">\n <div class=\"card-header\">\n <slot name=\"subtitle\"></slot>\n <h3 class=\"card-title\"><slot name=\"title\" @slotchange=${this.handleTitleSlotChange}></slot></h3>\n </div>\n <slot></slot>\n </div>\n ${\n hasDescriptionSlot\n ? html`<p class=\"card-text\">\n <slot name=\"description\"></slot>\n </p>`\n : nothing\n }\n <slot name=\"lower\"></slot>\n <slot name=\"link\" @slotchange=${this.handleLinkSlotChange}></slot>\n </div>\n </${tag}>\n `;\n }\n}\n\nexport default SgdsIconCard;\n"],"names":["CardElement","HasSlotController","literal","html","classMap","nothing","IconCardStyle","__decorate","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AA,CAAA,SAAA,EAAA,WAAA,EAAA,KAAA,CAAA,CAAA;;;;;"}
|
|
@@ -5,6 +5,7 @@ import { literal, html } from 'lit/static-html.js';
|
|
|
5
5
|
import { queryAssignedNodes, property } from 'lit/decorators.js';
|
|
6
6
|
import { classMap } from 'lit/directives/class-map.js';
|
|
7
7
|
import { CardElement } from '../../base/card-element.js';
|
|
8
|
+
import { HasSlotController } from '../../utils/slot.js';
|
|
8
9
|
import css_248z from './icon-card.js';
|
|
9
10
|
|
|
10
11
|
/**
|
|
@@ -23,6 +24,7 @@ class SgdsIconCard extends CardElement {
|
|
|
23
24
|
super(...arguments);
|
|
24
25
|
/** Removes the card's internal padding when set to true. */
|
|
25
26
|
this.noPadding = false;
|
|
27
|
+
this.hasSlotController = new HasSlotController(this, "description");
|
|
26
28
|
}
|
|
27
29
|
firstUpdated() {
|
|
28
30
|
if (this._iconNode.length === 0) {
|
|
@@ -38,6 +40,7 @@ class SgdsIconCard extends CardElement {
|
|
|
38
40
|
render() {
|
|
39
41
|
const tag = this.stretchedLink ? literal `a` : literal `div`;
|
|
40
42
|
const cardTabIndex = !this.stretchedLink || this.disabled ? -1 : 0;
|
|
43
|
+
const hasDescriptionSlot = this.hasSlotController.test("description");
|
|
41
44
|
return html `
|
|
42
45
|
<${tag}
|
|
43
46
|
class="card ${classMap({
|
|
@@ -59,9 +62,11 @@ class SgdsIconCard extends CardElement {
|
|
|
59
62
|
</div>
|
|
60
63
|
<slot></slot>
|
|
61
64
|
</div>
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
${hasDescriptionSlot
|
|
66
|
+
? html `<p class="card-text">
|
|
67
|
+
<slot name="description"></slot>
|
|
68
|
+
</p>`
|
|
69
|
+
: nothing}
|
|
65
70
|
<slot name="lower"></slot>
|
|
66
71
|
<slot name="link" @slotchange=${this.handleLinkSlotChange}></slot>
|
|
67
72
|
</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sgds-icon-card.js","sources":["../../../../src/components/IconCard/sgds-icon-card.ts"],"sourcesContent":["import { nothing } from \"lit\";\nimport { html, literal } from \"lit/static-html.js\";\nimport { property, queryAssignedNodes } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { CardElement } from \"../../base/card-element\";\nimport IconCardStyle from \"./icon-card.css\";\n\n/**\n * @summary Icon cards can be used for headers and footers, a wide variety of content, contain contextual background colors and images.\n * @slot default - The content area of the card, placed directly under the title. Accepts any HTML or custom elements.\n * @slot icon - Accepts an icon element to visually represent the card. Only a single element is allowed to be passed in.\n * @slot upper - Accepts any content to be displayed at the top of the subtitle. Commonly used for badges, status indicators, or decorative elements.\n * @slot subtitle - The subtitle of the card\n * @slot title - The title of the card\n * @slot description - The paragrapher text of the card\n * @slot lower - Accepts any additional content to be displayed below the card description, such as badges, metadata, or supplementary information.\n * @slot link - Accepts an anchor element. Only a single element is allowed to be passed in.\n */\nexport class SgdsIconCard extends CardElement {\n static styles = [...CardElement.styles, IconCardStyle];\n\n /** @internal */\n @queryAssignedNodes({ slot: \"icon\", flatten: true })\n _iconNode!: Array<Node>;\n /** @internal */\n @queryAssignedNodes({ slot: \"upper\", flatten: true })\n _upperNode!: Array<Node>;\n\n /** Removes the card's internal padding when set to true. */\n @property({ type: Boolean, reflect: true }) noPadding = false;\n\n protected firstUpdated() {\n if (this._iconNode.length === 0) {\n if ((this.orientation === \"vertical\" && this._upperNode.length === 0) || this.orientation === \"horizontal\") {\n const media = this.shadowRoot.querySelector(\".card-media\") as HTMLDivElement;\n media.style.display = \"none\";\n\n const body = this.shadowRoot.querySelector(\".card-body\") as HTMLDivElement;\n if (this.noPadding) body.style.padding = \"0px\";\n }\n }\n }\n\n render() {\n const tag = this.stretchedLink ? literal`a` : literal`div`;\n const cardTabIndex = !this.stretchedLink || this.disabled ? -1 : 0;\n\n return html`\n <${tag} \n class=\"card ${classMap({\n disabled: this.disabled\n })}\"\n tabindex=${cardTabIndex}\n >\n ${this.tinted && !this.noPadding ? html`<div class=\"card-tinted-bg\"></div>` : nothing}\n <div class=\"card-media\">\n <slot name=\"icon\"></slot>\n ${this.orientation === \"vertical\" ? html`<slot name=\"upper\"></slot>` : nothing}\n </div>\n <div class=\"card-body\">\n ${this.orientation === \"horizontal\" ? html`<slot name=\"upper\"></slot>` : nothing}\n <div class=\"card-header-container\">\n <div class=\"card-header\">\n <slot name=\"subtitle\"></slot>\n <h3 class=\"card-title\"><slot name=\"title\" @slotchange=${this.handleTitleSlotChange}></slot></h3>\n </div>\n <slot></slot>\n </div>\n
|
|
1
|
+
{"version":3,"file":"sgds-icon-card.js","sources":["../../../../src/components/IconCard/sgds-icon-card.ts"],"sourcesContent":["import { nothing } from \"lit\";\nimport { html, literal } from \"lit/static-html.js\";\nimport { property, queryAssignedNodes } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { CardElement } from \"../../base/card-element\";\nimport { HasSlotController } from \"../../utils/slot\";\nimport IconCardStyle from \"./icon-card.css\";\n\n/**\n * @summary Icon cards can be used for headers and footers, a wide variety of content, contain contextual background colors and images.\n * @slot default - The content area of the card, placed directly under the title. Accepts any HTML or custom elements.\n * @slot icon - Accepts an icon element to visually represent the card. Only a single element is allowed to be passed in.\n * @slot upper - Accepts any content to be displayed at the top of the subtitle. Commonly used for badges, status indicators, or decorative elements.\n * @slot subtitle - The subtitle of the card\n * @slot title - The title of the card\n * @slot description - The paragrapher text of the card\n * @slot lower - Accepts any additional content to be displayed below the card description, such as badges, metadata, or supplementary information.\n * @slot link - Accepts an anchor element. Only a single element is allowed to be passed in.\n */\nexport class SgdsIconCard extends CardElement {\n static styles = [...CardElement.styles, IconCardStyle];\n\n /** @internal */\n @queryAssignedNodes({ slot: \"icon\", flatten: true })\n _iconNode!: Array<Node>;\n /** @internal */\n @queryAssignedNodes({ slot: \"upper\", flatten: true })\n _upperNode!: Array<Node>;\n\n /** Removes the card's internal padding when set to true. */\n @property({ type: Boolean, reflect: true }) noPadding = false;\n\n private readonly hasSlotController = new HasSlotController(this, \"description\");\n\n protected firstUpdated() {\n if (this._iconNode.length === 0) {\n if ((this.orientation === \"vertical\" && this._upperNode.length === 0) || this.orientation === \"horizontal\") {\n const media = this.shadowRoot.querySelector(\".card-media\") as HTMLDivElement;\n media.style.display = \"none\";\n\n const body = this.shadowRoot.querySelector(\".card-body\") as HTMLDivElement;\n if (this.noPadding) body.style.padding = \"0px\";\n }\n }\n }\n\n render() {\n const tag = this.stretchedLink ? literal`a` : literal`div`;\n const cardTabIndex = !this.stretchedLink || this.disabled ? -1 : 0;\n const hasDescriptionSlot = this.hasSlotController.test(\"description\");\n\n return html`\n <${tag} \n class=\"card ${classMap({\n disabled: this.disabled\n })}\"\n tabindex=${cardTabIndex}\n >\n ${this.tinted && !this.noPadding ? html`<div class=\"card-tinted-bg\"></div>` : nothing}\n <div class=\"card-media\">\n <slot name=\"icon\"></slot>\n ${this.orientation === \"vertical\" ? html`<slot name=\"upper\"></slot>` : nothing}\n </div>\n <div class=\"card-body\">\n ${this.orientation === \"horizontal\" ? html`<slot name=\"upper\"></slot>` : nothing}\n <div class=\"card-header-container\">\n <div class=\"card-header\">\n <slot name=\"subtitle\"></slot>\n <h3 class=\"card-title\"><slot name=\"title\" @slotchange=${this.handleTitleSlotChange}></slot></h3>\n </div>\n <slot></slot>\n </div>\n ${\n hasDescriptionSlot\n ? html`<p class=\"card-text\">\n <slot name=\"description\"></slot>\n </p>`\n : nothing\n }\n <slot name=\"lower\"></slot>\n <slot name=\"link\" @slotchange=${this.handleLinkSlotChange}></slot>\n </div>\n </${tag}>\n `;\n }\n}\n\nexport default SgdsIconCard;\n"],"names":["IconCardStyle"],"mappings":";;;;;;;;;;AAQA;;;;;;;;;;AAUG;AACG,MAAO,YAAa,SAAQ,WAAW,CAAA;AAA7C,IAAA,WAAA,GAAA;;;QAW8C,IAAS,CAAA,SAAA,GAAG,KAAK,CAAC;QAE7C,IAAiB,CAAA,iBAAA,GAAG,IAAI,iBAAiB,C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C,WAAW,KAAK,UAAU,GAAG,IAAI,CAAA,CAAA,0BAAA,CAA4B,GAAG,OAAO,CAAA;;;AAG5E,UAAA,EAAA,IAAI,CAAC,WAAW,KAAK,YAAY,GAAG,IAAI,CAAA,CAAA,0BAAA,CAA4B,GAAG,OAAO,CAAA;;;;AAIpB,oEAAA,EAAA,IAAI,CAAC,qBAAqB,CAAA;;;;YAKpF,kBAAkB;cACd,IAAI,CAAA,CAAA;;AAEC,oBAAA,CAAA;AACP,cAAE,OACN,CAAA;;AAEgC,wCAAA,EAAA,IAAI,CAAC,oBAAoB,CAAA;;UAEzD,GAAG,CAAA;KACR,CAAC;KACH;;AAhEM,YAAM,CAAA,MAAA,GAAG,CAAC,GAAG,WAAW,CAAC,MAAM,EAAEA,QAAa,CAAxC,CAA0C;AAIvD,UAAA,CAAA;IADC,kBAAkB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC5B,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,WAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAGxB,UAAA,CAAA;IADC,kBAAkB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC5B,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,YAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAGmB,UAAA,CAAA;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAAmB,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,WAAA,EAAA,KAAA,CAAA,CAAA;;;;"}
|
|
@@ -9,6 +9,7 @@ var staticHtml_js = require('lit/static-html.js');
|
|
|
9
9
|
var decorators_js = require('lit/decorators.js');
|
|
10
10
|
var classMap_js = require('lit/directives/class-map.js');
|
|
11
11
|
var cardElement = require('../../base/card-element.cjs.js');
|
|
12
|
+
var slot = require('../../utils/slot.cjs.js');
|
|
12
13
|
var imageCard = require('./image-card.cjs.js');
|
|
13
14
|
|
|
14
15
|
/**
|
|
@@ -33,6 +34,7 @@ class SgdsImageCard extends cardElement.CardElement {
|
|
|
33
34
|
this.imagePosition = "before";
|
|
34
35
|
/** Controls how the image is sized and aligned within the card. Available options: `default`, `padding around`, `aspect ratio` */
|
|
35
36
|
this.imageAdjustment = "default";
|
|
37
|
+
this.hasSlotController = new slot.HasSlotController(this, "description");
|
|
36
38
|
}
|
|
37
39
|
firstUpdated() {
|
|
38
40
|
if (this._imageNode.length === 0) {
|
|
@@ -52,6 +54,7 @@ class SgdsImageCard extends cardElement.CardElement {
|
|
|
52
54
|
render() {
|
|
53
55
|
const tag = this.stretchedLink ? staticHtml_js.literal `a` : staticHtml_js.literal `div`;
|
|
54
56
|
const cardTabIndex = !this.stretchedLink || this.disabled ? -1 : 0;
|
|
57
|
+
const hasDescriptionSlot = this.hasSlotController.test("description");
|
|
55
58
|
return staticHtml_js.html `
|
|
56
59
|
<${tag}
|
|
57
60
|
class="card ${classMap_js.classMap({
|
|
@@ -74,9 +77,11 @@ class SgdsImageCard extends cardElement.CardElement {
|
|
|
74
77
|
</div>
|
|
75
78
|
<slot></slot>
|
|
76
79
|
</div>
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
+
${hasDescriptionSlot
|
|
81
|
+
? staticHtml_js.html `<p class="card-text">
|
|
82
|
+
<slot name="description"></slot>
|
|
83
|
+
</p>`
|
|
84
|
+
: lit.nothing}
|
|
80
85
|
<slot name="lower"></slot>
|
|
81
86
|
<slot name="link" @slotchange=${this.handleLinkSlotChange}></slot>
|
|
82
87
|
</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sgds-image-card.cjs.js","sources":["../../../../src/components/ImageCard/sgds-image-card.ts"],"sourcesContent":["import { nothing } from \"lit\";\nimport { html, literal } from \"lit/static-html.js\";\nimport { property, queryAssignedNodes } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { CardElement } from \"../../base/card-element\";\nimport { CardImageAdjustment, CardImagePosition } from \"../Card/types\";\nimport imageCardStyle from \"./image-card.css\";\n\n/**\n * @summary Image cards can be used for headers and footers, a wide variety of content, contain contextual background colors and images.\n * @slot default - The content area of the card, placed directly under the title. Accepts any HTML or custom elements.\n * @slot image - Accepts an image or svg element of the card. Only a single element is allowed to be passed in.\n * @slot image-badge - Accepts an element for a badge, positioned at the top-left corner of the image.\n * @slot image-action - Accepts an element for an overflow or contextual menu, positioned at the top-right corner of the image. Typically used for action menu.\n * @slot upper - Accepts any content to be displayed at the top of the subtitle. Commonly used for badges, status indicators, or decorative elements.\n * @slot subtitle - The subtitle of the card\n * @slot title - The title of the card\n * @slot description - The paragrapher text of the card\n * @slot lower - Accepts any additional content to be displayed below the card description, such as badges, metadata, or supplementary information.\n * @slot link - Accepts an anchor element. Only a single element is allowed to be passed in.\n */\nexport class SgdsImageCard extends CardElement {\n static styles = [...CardElement.styles, imageCardStyle];\n\n /** @internal */\n @queryAssignedNodes({ slot: \"image\", flatten: true })\n _imageNode!: Array<Node>;\n\n /** Removes the card's internal padding when set to true. */\n @property({ type: Boolean, reflect: true }) noPadding = false;\n\n /** Sets the image position of the card. Available options: `before`, `after` */\n @property({ type: String, reflect: true }) imagePosition: CardImagePosition = \"before\";\n\n /** Controls how the image is sized and aligned within the card. Available options: `default`, `padding around`, `aspect ratio` */\n @property({ type: String, reflect: true }) imageAdjustment: CardImageAdjustment = \"default\";\n\n protected firstUpdated() {\n if (this._imageNode.length === 0) {\n const image = this.shadowRoot.querySelector(\".card-image\") as HTMLDivElement;\n const body = this.shadowRoot.querySelector(\".card-body\") as HTMLDivElement;\n image.style.display = \"none\";\n if (this.noPadding) body.style.padding = \"0px\";\n }\n }\n\n handleImgSlotChange(e: Event) {\n const childNodes = (e.target as HTMLSlotElement).assignedNodes({ flatten: true }) as Array<HTMLOrSVGImageElement>;\n\n if (childNodes.length > 1) {\n return console.error(\"Multiple elements passed into SgdsCard's image slot\");\n }\n }\n\n render() {\n const tag = this.stretchedLink ? literal`a` : literal`div`;\n const cardTabIndex = !this.stretchedLink || this.disabled ? -1 : 0;\n\n return html`\n <${tag} \n class=\"card ${classMap({\n disabled: this.disabled\n })}\"\n tabindex=${cardTabIndex}\n >\n ${this.tinted && !this.noPadding ? html`<div class=\"card-tinted-bg\"></div>` : nothing}\n <div class=\"card-image\">\n\t\t\t\t\t<slot name=\"image\" @slotchange=${this.handleImgSlotChange}></slot>\n\t\t\t\t\t<slot name=\"image-badge\"></slot>\n\t\t\t\t\t<slot name=\"image-action\"></slot>\n </div>\n <div class=\"card-body\">\n\t\t\t\t\t<slot name=\"upper\"></slot>\n <div class=\"card-header-container\">\n <div class=\"card-header\">\n <slot name=\"subtitle\"></slot>\n <h3 class=\"card-title\"><slot name=\"title\" @slotchange=${this.handleTitleSlotChange}></slot></h3>\n </div>\n <slot></slot>\n </div>\n
|
|
1
|
+
{"version":3,"file":"sgds-image-card.cjs.js","sources":["../../../../src/components/ImageCard/sgds-image-card.ts"],"sourcesContent":["import { nothing } from \"lit\";\nimport { html, literal } from \"lit/static-html.js\";\nimport { property, queryAssignedNodes } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { CardElement } from \"../../base/card-element\";\nimport { HasSlotController } from \"../../utils/slot\";\nimport { CardImageAdjustment, CardImagePosition } from \"../Card/types\";\nimport imageCardStyle from \"./image-card.css\";\n\n/**\n * @summary Image cards can be used for headers and footers, a wide variety of content, contain contextual background colors and images.\n * @slot default - The content area of the card, placed directly under the title. Accepts any HTML or custom elements.\n * @slot image - Accepts an image or svg element of the card. Only a single element is allowed to be passed in.\n * @slot image-badge - Accepts an element for a badge, positioned at the top-left corner of the image.\n * @slot image-action - Accepts an element for an overflow or contextual menu, positioned at the top-right corner of the image. Typically used for action menu.\n * @slot upper - Accepts any content to be displayed at the top of the subtitle. Commonly used for badges, status indicators, or decorative elements.\n * @slot subtitle - The subtitle of the card\n * @slot title - The title of the card\n * @slot description - The paragrapher text of the card\n * @slot lower - Accepts any additional content to be displayed below the card description, such as badges, metadata, or supplementary information.\n * @slot link - Accepts an anchor element. Only a single element is allowed to be passed in.\n */\nexport class SgdsImageCard extends CardElement {\n static styles = [...CardElement.styles, imageCardStyle];\n\n /** @internal */\n @queryAssignedNodes({ slot: \"image\", flatten: true })\n _imageNode!: Array<Node>;\n\n /** Removes the card's internal padding when set to true. */\n @property({ type: Boolean, reflect: true }) noPadding = false;\n\n /** Sets the image position of the card. Available options: `before`, `after` */\n @property({ type: String, reflect: true }) imagePosition: CardImagePosition = \"before\";\n\n /** Controls how the image is sized and aligned within the card. Available options: `default`, `padding around`, `aspect ratio` */\n @property({ type: String, reflect: true }) imageAdjustment: CardImageAdjustment = \"default\";\n\n private readonly hasSlotController = new HasSlotController(this, \"description\");\n\n protected firstUpdated() {\n if (this._imageNode.length === 0) {\n const image = this.shadowRoot.querySelector(\".card-image\") as HTMLDivElement;\n const body = this.shadowRoot.querySelector(\".card-body\") as HTMLDivElement;\n image.style.display = \"none\";\n if (this.noPadding) body.style.padding = \"0px\";\n }\n }\n\n handleImgSlotChange(e: Event) {\n const childNodes = (e.target as HTMLSlotElement).assignedNodes({ flatten: true }) as Array<HTMLOrSVGImageElement>;\n\n if (childNodes.length > 1) {\n return console.error(\"Multiple elements passed into SgdsCard's image slot\");\n }\n }\n\n render() {\n const tag = this.stretchedLink ? literal`a` : literal`div`;\n const cardTabIndex = !this.stretchedLink || this.disabled ? -1 : 0;\n const hasDescriptionSlot = this.hasSlotController.test(\"description\");\n\n return html`\n <${tag} \n class=\"card ${classMap({\n disabled: this.disabled\n })}\"\n tabindex=${cardTabIndex}\n >\n ${this.tinted && !this.noPadding ? html`<div class=\"card-tinted-bg\"></div>` : nothing}\n <div class=\"card-image\">\n\t\t\t\t\t<slot name=\"image\" @slotchange=${this.handleImgSlotChange}></slot>\n\t\t\t\t\t<slot name=\"image-badge\"></slot>\n\t\t\t\t\t<slot name=\"image-action\"></slot>\n </div>\n <div class=\"card-body\">\n\t\t\t\t\t<slot name=\"upper\"></slot>\n <div class=\"card-header-container\">\n <div class=\"card-header\">\n <slot name=\"subtitle\"></slot>\n <h3 class=\"card-title\"><slot name=\"title\" @slotchange=${this.handleTitleSlotChange}></slot></h3>\n </div>\n <slot></slot>\n </div>\n ${\n hasDescriptionSlot\n ? html`<p class=\"card-text\">\n <slot name=\"description\"></slot>\n </p>`\n : nothing\n }\n <slot name=\"lower\"></slot>\n <slot name=\"link\" @slotchange=${this.handleLinkSlotChange}></slot>\n </div>\n </${tag}>\n `;\n }\n}\n\nexport default SgdsImageCard;\n"],"names":["CardElement","HasSlotController","literal","html","classMap","nothing","imageCardStyle","__decorate","queryAssignedNodes","property"],"mappings":";;;;;;;;;;;;;;AASA;;;;;;;;;;;;AAYG;AACG,MAAO,aAAc,SAAQA,uBAAW,CAAA;AAA9C,IAAA,WAAA,GAAA;;;QAQ8C,IAAS,CAAA,SAAA,GAAG,KAAK,CAAC;;QAGnB,IAAa,CAAA,aAAA,GAAsB,QAAQ,CAAC;;QAG5C,IAAe,CAAA,eAAA,GAAwB,SAAS,CAAC;QAE3E,IAAiB,CAAA,iBAAA,GAAG,IAAIC,sBAAiB,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;KA2DjF;IAzDW,YAAY,GAAA;QACpB,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;YAChC,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,aAAa,CAAmB,CAAC;YAC7E,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,YAAY,CAAmB,CAAC;AAC3E,YAAA,KAAK,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;YAC7B,IAAI,IAAI,CAAC,SAAS;AAAE,gBAAA,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC;SAChD;KACF;AAED,IAAA,mBAA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c,CAAzC,CAA2C;AAIxDC,gBAAA,CAAA;IADCC,gCAAkB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC5B,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,YAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAGmBD,gBAAA,CAAA;IAA3CE,sBAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAAmB,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,WAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAGnBF,gBAAA,CAAA;IAA1CE,sBAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAA6C,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,eAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAG5CF,gBAAA,CAAA;IAA1CE,sBAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAAkD,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,iBAAA,EAAA,KAAA,CAAA,CAAA;;;;;"}
|
|
@@ -5,6 +5,7 @@ import { literal, html } from 'lit/static-html.js';
|
|
|
5
5
|
import { queryAssignedNodes, property } from 'lit/decorators.js';
|
|
6
6
|
import { classMap } from 'lit/directives/class-map.js';
|
|
7
7
|
import { CardElement } from '../../base/card-element.js';
|
|
8
|
+
import { HasSlotController } from '../../utils/slot.js';
|
|
8
9
|
import css_248z from './image-card.js';
|
|
9
10
|
|
|
10
11
|
/**
|
|
@@ -29,6 +30,7 @@ class SgdsImageCard extends CardElement {
|
|
|
29
30
|
this.imagePosition = "before";
|
|
30
31
|
/** Controls how the image is sized and aligned within the card. Available options: `default`, `padding around`, `aspect ratio` */
|
|
31
32
|
this.imageAdjustment = "default";
|
|
33
|
+
this.hasSlotController = new HasSlotController(this, "description");
|
|
32
34
|
}
|
|
33
35
|
firstUpdated() {
|
|
34
36
|
if (this._imageNode.length === 0) {
|
|
@@ -48,6 +50,7 @@ class SgdsImageCard extends CardElement {
|
|
|
48
50
|
render() {
|
|
49
51
|
const tag = this.stretchedLink ? literal `a` : literal `div`;
|
|
50
52
|
const cardTabIndex = !this.stretchedLink || this.disabled ? -1 : 0;
|
|
53
|
+
const hasDescriptionSlot = this.hasSlotController.test("description");
|
|
51
54
|
return html `
|
|
52
55
|
<${tag}
|
|
53
56
|
class="card ${classMap({
|
|
@@ -70,9 +73,11 @@ class SgdsImageCard extends CardElement {
|
|
|
70
73
|
</div>
|
|
71
74
|
<slot></slot>
|
|
72
75
|
</div>
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
${hasDescriptionSlot
|
|
77
|
+
? html `<p class="card-text">
|
|
78
|
+
<slot name="description"></slot>
|
|
79
|
+
</p>`
|
|
80
|
+
: nothing}
|
|
76
81
|
<slot name="lower"></slot>
|
|
77
82
|
<slot name="link" @slotchange=${this.handleLinkSlotChange}></slot>
|
|
78
83
|
</div>
|