@carbon/ibmdotcom-web-components 2.22.0 → 2.24.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/custom-elements.json +28 -0
- package/dist/dotcom-shell.js +2 -2
- package/dist/dotcom-shell.min.js +2 -2
- package/dist/ibmdotcom-web-components-dotcom-shell.js +2 -2
- package/dist/ibmdotcom-web-components-dotcom-shell.min.js +2 -2
- package/dist/{index-d1d84c2f.js → index-e763be5b.js} +525 -703
- package/dist/{index-fe85c5e6.js → index-e9e0dc0d.js} +7 -7
- package/dist/{left-nav-menu-497c9169.js → left-nav-menu-353311b3.js} +2 -2
- package/dist/{left-nav-menu-cd889d8d.js → left-nav-menu-a2e98b5a.js} +2 -2
- package/dist/{left-nav-menu-category-heading-8ccb4ce7.js → left-nav-menu-category-heading-404801f6.js} +2 -2
- package/dist/{left-nav-menu-category-heading-14bacdd1.js → left-nav-menu-category-heading-70403118.js} +2 -2
- package/dist/{left-nav-menu-item-803e8924.js → left-nav-menu-item-1930f6e3.js} +2 -2
- package/dist/{left-nav-menu-item-2a3c9eb0.js → left-nav-menu-item-1c788c22.js} +2 -2
- package/dist/{left-nav-menu-section-462064ef.js → left-nav-menu-section-a5aacf10.js} +2 -2
- package/dist/{left-nav-menu-section-024ec574.js → left-nav-menu-section-ce8644e6.js} +2 -2
- package/dist/{left-nav-overlay-9ec9772c.js → left-nav-overlay-5abc69f8.js} +2 -2
- package/dist/{left-nav-overlay-38b81f2f.js → left-nav-overlay-5e37dc8f.js} +2 -2
- package/dist/{megamenu-category-group-4229cc92.js → megamenu-category-group-921d7e31.js} +2 -2
- package/dist/{megamenu-category-group-f874016c.js → megamenu-category-group-a9045c01.js} +2 -2
- package/dist/{megamenu-category-group-copy-7525e13d.js → megamenu-category-group-copy-d173c916.js} +2 -2
- package/dist/{megamenu-category-group-copy-18d5977c.js → megamenu-category-group-copy-dc085be6.js} +2 -2
- package/dist/{megamenu-category-heading-6c437eed.js → megamenu-category-heading-90e67482.js} +2 -2
- package/dist/{megamenu-category-heading-05c91ceb.js → megamenu-category-heading-f07f73c0.js} +2 -2
- package/dist/{megamenu-category-link-8d5476f0.js → megamenu-category-link-dcd41f45.js} +2 -2
- package/dist/{megamenu-category-link-09ed50a1.js → megamenu-category-link-e0c9fc7a.js} +6 -6
- package/dist/{megamenu-category-link-group-fc4af18d.js → megamenu-category-link-group-1a30ccc7.js} +2 -2
- package/dist/{megamenu-category-link-group-a1418c5c.js → megamenu-category-link-group-6ff3a30d.js} +2 -2
- package/dist/{megamenu-left-navigation-cb55e7c7.js → megamenu-left-navigation-4b810f29.js} +2 -2
- package/dist/{megamenu-left-navigation-f972fc38.js → megamenu-left-navigation-fcd7c3f0.js} +2 -2
- package/dist/{megamenu-overlay-720be39f.js → megamenu-overlay-69613b97.js} +2 -2
- package/dist/{megamenu-overlay-6e2c8d97.js → megamenu-overlay-e179976a.js} +2 -2
- package/dist/{megamenu-tab-d96128cd.js → megamenu-tab-4e651fc9.js} +2 -2
- package/dist/{megamenu-tab-de78d556.js → megamenu-tab-fa23e87d.js} +2 -2
- package/es/components/callout-quote/callout-quote.css.js +1 -1
- package/es/components/card-group/card-group.css.js +1 -1
- package/es/components/card-group/card-group.d.ts +689 -2
- package/es/components/card-group/card-group.js +53 -13
- package/es/components/card-group/card-group.js.map +1 -1
- package/es/components/content-block/content-block.css.js +1 -1
- package/es/components/content-block-cards/content-block-cards.d.ts +2 -1
- package/es/components/content-block-cards/content-block-cards.js +17 -1
- package/es/components/content-block-cards/content-block-cards.js.map +1 -1
- package/es/components/content-item/content-item.d.ts +6 -2
- package/es/components/content-item/content-item.js +16 -1
- package/es/components/content-item/content-item.js.map +1 -1
- package/es/components/cta-block/cta-block-item-row.d.ts +3 -1
- package/es/components/cta-block/cta-block-item-row.js +38 -6
- package/es/components/cta-block/cta-block-item-row.js.map +1 -1
- package/es/components/cta-block/cta-block-item.d.ts +2 -2
- package/es/components/cta-block/cta-block-item.js +5 -1
- package/es/components/cta-block/cta-block-item.js.map +1 -1
- package/es/components/cta-block/cta-block.css.js +1 -1
- package/es/components/dotcom-shell/dotcom-shell.css.js +1 -1
- package/es/components/masthead/left-nav.d.ts +2 -1
- package/es/components/masthead/left-nav.js +23 -6
- package/es/components/masthead/left-nav.js.map +1 -1
- package/es/components/masthead/masthead-l1.css.js +1 -1
- package/es/components/masthead/masthead.css.js +1 -1
- package/es/components/pricing-table/pricing-table.css.js +1 -1
- package/es/components/quote/defs.d.ts +6 -2
- package/es/components/quote/defs.js +2 -1
- package/es/components/quote/defs.js.map +1 -1
- package/es/components/quote/quote.css.js +1 -1
- package/es/components/quote/quote.d.ts +4 -1
- package/es/components/quote/quote.js +45 -6
- package/es/components/quote/quote.js.map +1 -1
- package/es/components/structured-list/structured-list.css.js +1 -1
- package/es/components/table-of-contents/table-of-contents.js +2 -2
- package/es/components/table-of-contents/table-of-contents.js.map +1 -1
- package/es/components/video-player/video-player.d.ts +2 -1
- package/es/components/video-player/video-player.js +5 -3
- package/es/components/video-player/video-player.js.map +1 -1
- package/es/components-react/quote/quote.d.ts +3 -0
- package/es/components-react/video-player/video-player.d.ts +1 -0
- package/es/internal/vendor/@carbon/ibmdotcom-utilities/utilities/settings/settings.js +2 -2
- package/lib/components/quote/defs.js +2 -1
- package/lib/components/quote/defs.js.map +1 -1
- package/lib/internal/vendor/@carbon/ibmdotcom-utilities/utilities/settings/settings.js +2 -2
- package/package.json +6 -6
- package/scss/components/cta-block/cta-block.scss +37 -2
- package/scss/components/masthead/masthead-l1.scss +3 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
*
|
|
4
|
-
* Copyright IBM Corp. 2020,
|
|
4
|
+
* Copyright IBM Corp. 2020, 2025
|
|
5
5
|
*
|
|
6
6
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -360,6 +360,7 @@ declare class C4DContentBlockCards extends C4DContentBlockCards_base {
|
|
|
360
360
|
*/
|
|
361
361
|
protected _getContainerClasses(): string | ((part: Part) => void);
|
|
362
362
|
static get stableSelector(): string;
|
|
363
|
+
connectedCallback(): void;
|
|
363
364
|
static get styles(): import("lit").CSSResult;
|
|
364
365
|
}
|
|
365
366
|
export default C4DContentBlockCards;
|
|
@@ -7,7 +7,7 @@ function _superPropGet(t, e, r, o) { var p = _get(_getPrototypeOf(1 & o ? t.prot
|
|
|
7
7
|
/**
|
|
8
8
|
* @license
|
|
9
9
|
*
|
|
10
|
-
* Copyright IBM Corp. 2020,
|
|
10
|
+
* Copyright IBM Corp. 2020, 2025
|
|
11
11
|
*
|
|
12
12
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
13
13
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -56,6 +56,22 @@ let C4DContentBlockCards = _decorate([customElement(`${c4dPrefix}-content-block-
|
|
|
56
56
|
value: function () {
|
|
57
57
|
return `${c4dPrefix}--content-block-cards`;
|
|
58
58
|
}
|
|
59
|
+
}, {
|
|
60
|
+
kind: "method",
|
|
61
|
+
key: "connectedCallback",
|
|
62
|
+
value: function connectedCallback() {
|
|
63
|
+
_superPropGet(C4DContentBlockCards, "connectedCallback", this, 3)([]);
|
|
64
|
+
window.onload = () => {
|
|
65
|
+
var _this$shadowRoot;
|
|
66
|
+
const hasLogoClass = this.classList.contains('media-type__logo');
|
|
67
|
+
const slot = (_this$shadowRoot = this.shadowRoot) === null || _this$shadowRoot === void 0 ? void 0 : _this$shadowRoot.querySelector('slot:not([name])');
|
|
68
|
+
if (slot && hasLogoClass) {
|
|
69
|
+
slot === null || slot === void 0 || slot.assignedElements().forEach(element => {
|
|
70
|
+
element.classList.add('media-type-block-cards__logo');
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
}
|
|
59
75
|
|
|
60
76
|
// `styles` here is a `CSSResult` generated by custom WebPack loader
|
|
61
77
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-block-cards.js","names":["css","settings","StableSelectorMixin","C4DContentBlock","styles","carbonElement","customElement","prefix","stablePrefix","c4dPrefix","C4DContentBlockCards","_decorate","_initialize","_StableSelectorMixin","constructor","args","F","d","kind","key","value","_getContainerClasses","static","
|
|
1
|
+
{"version":3,"file":"content-block-cards.js","names":["css","settings","StableSelectorMixin","C4DContentBlock","styles","carbonElement","customElement","prefix","stablePrefix","c4dPrefix","C4DContentBlockCards","_decorate","_initialize","_StableSelectorMixin","constructor","args","F","d","kind","key","value","_getContainerClasses","static","connectedCallback","_superPropGet","window","onload","_this$shadowRoot","hasLogoClass","classList","contains","slot","shadowRoot","querySelector","assignedElements","forEach","element","add","_t","_","console","warn"],"sources":["components/content-block-cards/content-block-cards.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2020, 2025\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { css, Part } from 'lit';\nimport settings from '@carbon/ibmdotcom-utilities/es/utilities/settings/settings.js';\nimport StableSelectorMixin from '../../globals/mixins/stable-selector';\nimport C4DContentBlock from '../content-block/content-block';\nimport styles from './content-block-cards.scss';\nimport { carbonElement as customElement } from '@carbon/web-components/es/globals/decorators/carbon-element.js';\n\nconst { prefix, stablePrefix: c4dPrefix } = settings;\n\n/**\n * Content block cards.\n *\n * @element c4d-content-block-cards\n */\n@customElement(`${c4dPrefix}-content-block-cards`)\nclass C4DContentBlockCards extends StableSelectorMixin(C4DContentBlock) {\n /**\n * The CSS class list for the container (grid) node.\n */\n // eslint-disable-next-line class-methods-use-this\n protected _getContainerClasses(): string | ((part: Part) => void) {\n return `${prefix}--content-layout ${prefix}--content-layout--card-group`;\n }\n\n static get stableSelector() {\n return `${c4dPrefix}--content-block-cards`;\n }\n\n connectedCallback() {\n super.connectedCallback();\n\n window.onload = () => {\n const hasLogoClass = this.classList.contains('media-type__logo');\n const slot = this.shadowRoot?.querySelector('slot:not([name])');\n\n if (slot && hasLogoClass) {\n (slot as HTMLSlotElement)?.assignedElements().forEach((element) => {\n element.classList.add('media-type-block-cards__logo');\n });\n }\n };\n }\n\n // `styles` here is a `CSSResult` generated by custom WebPack loader\n static get styles() {\n return css`\n ${super.styles}${styles}\n `;\n }\n}\n\nconsole.warn(\n 'The content-block-cards component has been deprecated in favor of the content-section/block and card-group component. ' +\n 'See content-section/block and card-group documentation for more information.'\n);\n\n/* @__GENERATE_REACT_CUSTOM_ELEMENT_TYPE__ */\nexport default C4DContentBlockCards;\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,GAAG,QAAc,KAAK;AAC/B,OAAOC,QAAQ,MAAM,+DAA+D;AACpF,OAAOC,mBAAmB,MAAM,yCAAsC;AACtE,OAAOC,eAAe,MAAM,mCAAgC;AAC5D,OAAOC,MAAM,MAAM,gCAA4B;AAC/C,SAASC,aAAa,IAAIC,aAAa,QAAQ,gEAAgE;AAE/G,MAAM;EAAEC,MAAM;EAAEC,YAAY,EAAEC;AAAU,CAAC,GAAGR,QAAQ;;AAEpD;AACA;AACA;AACA;AACA;AAJA,IAMMS,oBAAoB,GAAAC,SAAA,EADzBL,aAAa,CAAC,GAAGG,SAAS,sBAAsB,CAAC,aAAAG,WAAA,EAAAC,oBAAA;EAAlD,MACMH,oBAAoB,SAAAG,oBAAA,CAA8C;IAAAC,YAAA,GAAAC,IAAA;MAAA,SAAAA,IAAA;MAAAH,WAAA;IAAA;EAkCxE;EAAC;IAAAI,CAAA,EAlCKN,oBAAoB;IAAAO,CAAA;MAAAC,IAAA;MAAAC,GAAA;MAAAC,KAAA;MACxB;AACF;AACA;MACE;MACA,SAAUC,oBAAoBA,CAAA,EAAoC;QAChE,OAAO,GAAGd,MAAM,oBAAoBA,MAAM,8BAA8B;MAC1E;IAAC;MAAAW,IAAA;MAAAI,MAAA;MAAAH,GAAA;MAAAC,KAAA,EAED,SAAAA,CAAA,EAA4B;QAC1B,OAAO,GAAGX,SAAS,uBAAuB;MAC5C;IAAC;MAAAS,IAAA;MAAAC,GAAA;MAAAC,KAAA,EAED,SAAAG,iBAAiBA,CAAA,EAAG;QAClBC,aAAA,CAdEd,oBAAoB;QAgBtBe,MAAM,CAACC,MAAM,GAAG,MAAM;UAAA,IAAAC,gBAAA;UACpB,MAAMC,YAAY,GAAG,IAAI,CAACC,SAAS,CAACC,QAAQ,CAAC,kBAAkB,CAAC;UAChE,MAAMC,IAAI,IAAAJ,gBAAA,GAAG,IAAI,CAACK,UAAU,cAAAL,gBAAA,uBAAfA,gBAAA,CAAiBM,aAAa,CAAC,kBAAkB,CAAC;UAE/D,IAAIF,IAAI,IAAIH,YAAY,EAAE;YACvBG,IAAI,aAAJA,IAAI,eAAJA,IAAI,CAAsBG,gBAAgB,CAAC,CAAC,CAACC,OAAO,CAAEC,OAAO,IAAK;cACjEA,OAAO,CAACP,SAAS,CAACQ,GAAG,CAAC,8BAA8B,CAAC;YACvD,CAAC,CAAC;UACJ;QACF,CAAC;MACH;;MAEA;IAAA;MAAAnB,IAAA;MAAAI,MAAA;MAAAH,GAAA;MAAAC,KAAA,EACA,SAAAA,CAAA,EAAoB;QAClB,OAAOpB,GAAG,CAAAsC,EAAA,KAAAA,EAAA,GAAAC,CAAA;AACd,QADc;AACd,KADc,GAAAf,aAAA,CA9BRd,oBAAoB,mBA+BHN,MAAM;MAE3B;IAAC;EAAA;AAAA,GAjCgCF,mBAAmB,CAACC,eAAe,CAAC;AAoCvEqC,OAAO,CAACC,IAAI,CACV,wHAAwH,GACtH,8EACJ,CAAC;;AAED;AACA,eAAe/B,oBAAoB","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
*
|
|
4
|
-
* Copyright IBM Corp. 2020,
|
|
4
|
+
* Copyright IBM Corp. 2020, 2025
|
|
5
5
|
*
|
|
6
6
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -369,7 +369,11 @@ declare class C4DContentItem extends C4DContentItem_base {
|
|
|
369
369
|
/**
|
|
370
370
|
* `true` if there are CTA media in the content item area.
|
|
371
371
|
*/
|
|
372
|
-
|
|
372
|
+
_hasMedia: boolean;
|
|
373
|
+
/**
|
|
374
|
+
* `true` if there is a pictogram in the content
|
|
375
|
+
*/
|
|
376
|
+
_hasPictogram: boolean;
|
|
373
377
|
/**
|
|
374
378
|
* `true` if there are CTA statistic in the content item area.
|
|
375
379
|
*/
|
|
@@ -8,7 +8,7 @@ let _ = t => t,
|
|
|
8
8
|
/**
|
|
9
9
|
* @license
|
|
10
10
|
*
|
|
11
|
-
* Copyright IBM Corp. 2020,
|
|
11
|
+
* Copyright IBM Corp. 2020, 2025
|
|
12
12
|
*
|
|
13
13
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
14
14
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -71,6 +71,13 @@ let C4DContentItem = _decorate([customElement(`${c4dPrefix}-content-item`)], fun
|
|
|
71
71
|
value() {
|
|
72
72
|
return false;
|
|
73
73
|
}
|
|
74
|
+
}, {
|
|
75
|
+
kind: "field",
|
|
76
|
+
decorators: [state()],
|
|
77
|
+
key: "_hasPictogram",
|
|
78
|
+
value() {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
74
81
|
}, {
|
|
75
82
|
kind: "field",
|
|
76
83
|
decorators: [state()],
|
|
@@ -106,6 +113,10 @@ let C4DContentItem = _decorate([customElement(`${c4dPrefix}-content-item`)], fun
|
|
|
106
113
|
* `true` if there are CTA media in the content item area.
|
|
107
114
|
*/
|
|
108
115
|
|
|
116
|
+
/**
|
|
117
|
+
* `true` if there is a pictogram in the content
|
|
118
|
+
*/
|
|
119
|
+
|
|
109
120
|
/**
|
|
110
121
|
* `true` if there are CTA statistic in the content item area.
|
|
111
122
|
*/
|
|
@@ -134,6 +145,10 @@ let C4DContentItem = _decorate([customElement(`${c4dPrefix}-content-item`)], fun
|
|
|
134
145
|
} else {
|
|
135
146
|
this._hasLogo = false;
|
|
136
147
|
}
|
|
148
|
+
if (target.getAttribute('name') == 'media') {
|
|
149
|
+
const hasPictogram = target.assignedNodes().some(node => node.tagName.toLowerCase() == 'svg');
|
|
150
|
+
this._hasPictogram = hasPictogram;
|
|
151
|
+
}
|
|
137
152
|
}
|
|
138
153
|
|
|
139
154
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-item.js","names":["html","LitElement","classMap","property","state","settings","StableSelectorMixin","styles","carbonElement","customElement","prefix","stablePrefix","c4dPrefix","slotExistencePropertyNames","media","statistic","footer","C4DContentItem","_decorate","_initialize","_StableSelectorMixin","constructor","args","F","d","kind","decorators","key","value","type","Boolean","_handleSlotChange","target","_assignedNodes$","_assignedNodes$$match","name","hasContent","assignedNodes","some","node","nodeType","Node","TEXT_NODE","textContent","trim","matches","call","selectorImageLogo","_hasLogo","_renderStatistic","_hasStatistic","hasStatistic","handleSlotChange","_t","_","_renderMedia","_hasMedia","hasMedia","_t2","_renderBody","_t3","_renderFooter","_hasFooter","hasFooter","_t4","updated","_this$querySelector","querySelector","setAttribute","_this$querySelector2","removeAttribute","render","horizontal","hasLogo","horizontalClass","_t5","static"],"sources":["components/content-item/content-item.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2020, 2024\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { html, LitElement, TemplateResult } from 'lit';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { property, state } from 'lit/decorators.js';\nimport settings from '@carbon/ibmdotcom-utilities/es/utilities/settings/settings.js';\nimport StableSelectorMixin from '../../globals/mixins/stable-selector';\nimport styles from './content-item.scss';\nimport { carbonElement as customElement } from '@carbon/web-components/es/globals/decorators/carbon-element.js';\n\nconst { prefix, stablePrefix: c4dPrefix } = settings;\n\n/**\n * The table mapping slot name with the private property name that indicates the existence of the slot content.\n */\nconst slotExistencePropertyNames = {\n media: '_hasMedia',\n statistic: '_hasStatistic',\n footer: '_hasFooter',\n};\n\n/**\n * Content item.\n *\n * @element c4d-content-item\n * @slot media - The media content.\n * @slot heading - The heading content.\n * @slot footer - The footer (CTA) content.\n * @csspart statistics - The element. Usage: `c4d-content-item::part(statistics)`\n * @csspart media - The media content. Usage: `c4d-content-item::part(media)`\n * @csspart cta - The footer CTA. Usage: `c4d-content-item::part(cta)`\n * @csspart heading - The heading content. Usage: `c4d-content-item::part(heading)`\n * @csspart body - The body content. Usage: `c4d-content-item::part(body)`\n */\n@customElement(`${c4dPrefix}-content-item`)\nclass C4DContentItem extends StableSelectorMixin(LitElement) {\n /**\n * `true` if there are CTA statistic in the content item area.\n */\n @state()\n protected _hasLogo = false;\n /**\n * `true` if there are CTA media in the content item area.\n */\n @state()\n protected _hasMedia = false;\n\n /**\n * `true` if there are CTA statistic in the content item area.\n */\n @state()\n protected _hasStatistic = false;\n\n /**\n * `true` if there is a footer content.\n */\n @state()\n _hasFooter = false;\n\n @property({ type: Boolean })\n horizontal = false;\n\n /**\n * Handles `slotchange` event.\n *\n * @param event The event.\n * @param event.target The event target.\n */\n protected _handleSlotChange({ target }: Event) {\n const { name } = target as HTMLSlotElement;\n const hasContent = (target as HTMLSlotElement)\n .assignedNodes()\n .some(\n (node) => node.nodeType !== Node.TEXT_NODE || node!.textContent!.trim()\n );\n this[slotExistencePropertyNames[name] || '_hasStatistic'] = hasContent;\n if (\n (\n (target as HTMLSlotElement).assignedNodes()[0] as HTMLElement\n )?.matches?.(\n (this.constructor as typeof C4DContentItem).selectorImageLogo\n )\n ) {\n this._hasLogo = true;\n } else {\n this._hasLogo = false;\n }\n }\n\n /**\n * @returns The statistic content items\n */\n protected _renderStatistic(): TemplateResult | string | void {\n const { _hasStatistic: hasStatistic, _handleSlotChange: handleSlotChange } =\n this;\n return html`\n <div\n ?hidden=\"${!hasStatistic}\"\n class=\"${c4dPrefix}--content-item__statitics\"\n part=\"statistics\">\n <slot name=\"statistics\" @slotchange=\"${handleSlotChange}\"></slot>\n </div>\n `;\n }\n\n /**\n * @returns The media content items\n */\n protected _renderMedia(): TemplateResult | string | void {\n const { _hasMedia: hasMedia, _handleSlotChange: handleSlotChange } = this;\n\n return html`\n <div\n ?hidden=\"${!hasMedia}\"\n class=\"${c4dPrefix}--content-item__media\"\n part=\"media\">\n <slot name=\"media\" @slotchange=\"${handleSlotChange}\"></slot>\n </div>\n `;\n }\n\n /**\n * @returns The body content.\n */\n // eslint-disable-next-line class-methods-use-this\n protected _renderBody(): TemplateResult | string | void {\n return html` <slot></slot> `;\n }\n\n /**\n * @returns The footer content.\n */\n protected _renderFooter(): TemplateResult | string | void {\n const { _hasFooter: hasFooter } = this;\n return html`\n <div\n ?hidden=\"${!hasFooter}\"\n class=\"${prefix}--content-item__cta\"\n part=\"cta\">\n <slot name=\"footer\" @slotchange=\"${this._handleSlotChange}\"></slot>\n </div>\n `;\n }\n\n updated() {\n if (this._hasFooter) {\n this.querySelector(`${c4dPrefix}-content-item-copy`)?.setAttribute(\n 'has-cta',\n ''\n );\n } else {\n this.querySelector(`${c4dPrefix}-content-item-copy`)?.removeAttribute(\n 'has-cta'\n );\n }\n }\n\n render() {\n const { horizontal, _hasStatistic: hasStatistic, _hasLogo: hasLogo } = this;\n const horizontalClass = classMap({\n [`${c4dPrefix}--content-item__horizontal`]:\n horizontal && !hasStatistic && !hasLogo,\n });\n\n return html`\n <div class=\"${horizontalClass}\" part=\"heading\">\n ${this._renderStatistic()} ${this._renderMedia()}\n <div part=\"body\">\n <slot name=\"heading\"></slot>\n ${this._renderBody()}${this._renderFooter()}\n </div>\n </div>\n `;\n }\n\n static get stableSelector() {\n return `${c4dPrefix}--content-item`;\n }\n\n static get selectorImageLogo() {\n return `${c4dPrefix}-image-logo`;\n }\n\n static styles = styles; // `styles` here is a `CSSResult` generated by custom WebPack loader\n}\n\n/* @__GENERATE_REACT_CUSTOM_ELEMENT_TYPE__ */\nexport default C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;MAClC;IAAC;MAAAa,IAAA;MAAAmD,MAAA;MAAAjD,GAAA;MAAAC,MAAA;QAAA,OAEerB,MAAM;MAAA;IAAA;EAAA;AAAA,GApJKD,mBAAmB,CAACL,UAAU,CAAC;AAuJ5D;AACA,eAAegB,cAAc","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"content-item.js","names":["html","LitElement","classMap","property","state","settings","StableSelectorMixin","styles","carbonElement","customElement","prefix","stablePrefix","c4dPrefix","slotExistencePropertyNames","media","statistic","footer","C4DContentItem","_decorate","_initialize","_StableSelectorMixin","constructor","args","F","d","kind","decorators","key","value","type","Boolean","_handleSlotChange","target","_assignedNodes$","_assignedNodes$$match","name","hasContent","assignedNodes","some","node","nodeType","Node","TEXT_NODE","textContent","trim","matches","call","selectorImageLogo","_hasLogo","getAttribute","hasPictogram","tagName","toLowerCase","_hasPictogram","_renderStatistic","_hasStatistic","hasStatistic","handleSlotChange","_t","_","_renderMedia","_hasMedia","hasMedia","_t2","_renderBody","_t3","_renderFooter","_hasFooter","hasFooter","_t4","updated","_this$querySelector","querySelector","setAttribute","_this$querySelector2","removeAttribute","render","horizontal","hasLogo","horizontalClass","_t5","static"],"sources":["components/content-item/content-item.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2020, 2025\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { html, LitElement, TemplateResult } from 'lit';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { property, state } from 'lit/decorators.js';\nimport settings from '@carbon/ibmdotcom-utilities/es/utilities/settings/settings.js';\nimport StableSelectorMixin from '../../globals/mixins/stable-selector';\nimport styles from './content-item.scss';\nimport { carbonElement as customElement } from '@carbon/web-components/es/globals/decorators/carbon-element.js';\n\nconst { prefix, stablePrefix: c4dPrefix } = settings;\n\n/**\n * The table mapping slot name with the private property name that indicates the existence of the slot content.\n */\nconst slotExistencePropertyNames = {\n media: '_hasMedia',\n statistic: '_hasStatistic',\n footer: '_hasFooter',\n};\n\n/**\n * Content item.\n *\n * @element c4d-content-item\n * @slot media - The media content.\n * @slot heading - The heading content.\n * @slot footer - The footer (CTA) content.\n * @csspart statistics - The element. Usage: `c4d-content-item::part(statistics)`\n * @csspart media - The media content. Usage: `c4d-content-item::part(media)`\n * @csspart cta - The footer CTA. Usage: `c4d-content-item::part(cta)`\n * @csspart heading - The heading content. Usage: `c4d-content-item::part(heading)`\n * @csspart body - The body content. Usage: `c4d-content-item::part(body)`\n */\n@customElement(`${c4dPrefix}-content-item`)\nclass C4DContentItem extends StableSelectorMixin(LitElement) {\n /**\n * `true` if there are CTA statistic in the content item area.\n */\n @state()\n protected _hasLogo = false;\n /**\n * `true` if there are CTA media in the content item area.\n */\n @state()\n _hasMedia = false;\n /**\n * `true` if there is a pictogram in the content\n */\n @state()\n _hasPictogram = false;\n /**\n * `true` if there are CTA statistic in the content item area.\n */\n @state()\n protected _hasStatistic = false;\n\n /**\n * `true` if there is a footer content.\n */\n @state()\n _hasFooter = false;\n\n @property({ type: Boolean })\n horizontal = false;\n\n /**\n * Handles `slotchange` event.\n *\n * @param event The event.\n * @param event.target The event target.\n */\n protected _handleSlotChange({ target }: Event) {\n const { name } = target as HTMLSlotElement;\n const hasContent = (target as HTMLSlotElement)\n .assignedNodes()\n .some(\n (node) => node.nodeType !== Node.TEXT_NODE || node!.textContent!.trim()\n );\n this[slotExistencePropertyNames[name] || '_hasStatistic'] = hasContent;\n if (\n (\n (target as HTMLSlotElement).assignedNodes()[0] as HTMLElement\n )?.matches?.(\n (this.constructor as typeof C4DContentItem).selectorImageLogo\n )\n ) {\n this._hasLogo = true;\n } else {\n this._hasLogo = false;\n }\n if ((target as HTMLElement).getAttribute('name') == 'media') {\n const hasPictogram = (target as HTMLSlotElement)\n .assignedNodes()\n .some((node) => (node as HTMLElement).tagName.toLowerCase() == 'svg');\n this._hasPictogram = hasPictogram;\n }\n }\n\n /**\n * @returns The statistic content items\n */\n protected _renderStatistic(): TemplateResult | string | void {\n const { _hasStatistic: hasStatistic, _handleSlotChange: handleSlotChange } =\n this;\n return html`\n <div\n ?hidden=\"${!hasStatistic}\"\n class=\"${c4dPrefix}--content-item__statitics\"\n part=\"statistics\">\n <slot name=\"statistics\" @slotchange=\"${handleSlotChange}\"></slot>\n </div>\n `;\n }\n\n /**\n * @returns The media content items\n */\n protected _renderMedia(): TemplateResult | string | void {\n const { _hasMedia: hasMedia, _handleSlotChange: handleSlotChange } = this;\n\n return html`\n <div\n ?hidden=\"${!hasMedia}\"\n class=\"${c4dPrefix}--content-item__media\"\n part=\"media\">\n <slot name=\"media\" @slotchange=\"${handleSlotChange}\"></slot>\n </div>\n `;\n }\n\n /**\n * @returns The body content.\n */\n // eslint-disable-next-line class-methods-use-this\n protected _renderBody(): TemplateResult | string | void {\n return html` <slot></slot> `;\n }\n\n /**\n * @returns The footer content.\n */\n protected _renderFooter(): TemplateResult | string | void {\n const { _hasFooter: hasFooter } = this;\n return html`\n <div\n ?hidden=\"${!hasFooter}\"\n class=\"${prefix}--content-item__cta\"\n part=\"cta\">\n <slot name=\"footer\" @slotchange=\"${this._handleSlotChange}\"></slot>\n </div>\n `;\n }\n\n updated() {\n if (this._hasFooter) {\n this.querySelector(`${c4dPrefix}-content-item-copy`)?.setAttribute(\n 'has-cta',\n ''\n );\n } else {\n this.querySelector(`${c4dPrefix}-content-item-copy`)?.removeAttribute(\n 'has-cta'\n );\n }\n }\n\n render() {\n const { horizontal, _hasStatistic: hasStatistic, _hasLogo: hasLogo } = this;\n const horizontalClass = classMap({\n [`${c4dPrefix}--content-item__horizontal`]:\n horizontal && !hasStatistic && !hasLogo,\n });\n\n return html`\n <div class=\"${horizontalClass}\" part=\"heading\">\n ${this._renderStatistic()} ${this._renderMedia()}\n <div part=\"body\">\n <slot name=\"heading\"></slot>\n ${this._renderBody()}${this._renderFooter()}\n </div>\n </div>\n `;\n }\n\n static get stableSelector() {\n return `${c4dPrefix}--content-item`;\n }\n\n static get selectorImageLogo() {\n return `${c4dPrefix}-image-logo`;\n }\n\n static styles = styles; // `styles` here is a `CSSResult` generated by custom WebPack loader\n}\n\n/* @__GENERATE_REACT_CUSTOM_ELEMENT_TYPE__ */\nexport default C4DContentItem;\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,EAAEC,UAAU,QAAwB,KAAK;AACtD,SAASC,QAAQ,QAAQ,6BAA6B;AACtD,SAASC,QAAQ,EAAEC,KAAK,QAAQ,mBAAmB;AACnD,OAAOC,QAAQ,MAAM,+DAA+D;AACpF,OAAOC,mBAAmB,MAAM,yCAAsC;AACtE,OAAOC,MAAM,MAAM,yBAAqB;AACxC,SAASC,aAAa,IAAIC,aAAa,QAAQ,gEAAgE;AAE/G,MAAM;EAAEC,MAAM;EAAEC,YAAY,EAAEC;AAAU,CAAC,GAAGP,QAAQ;;AAEpD;AACA;AACA;AACA,MAAMQ,0BAA0B,GAAG;EACjCC,KAAK,EAAE,WAAW;EAClBC,SAAS,EAAE,eAAe;EAC1BC,MAAM,EAAE;AACV,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAZA,IAcMC,cAAc,GAAAC,SAAA,EADnBT,aAAa,CAAC,GAAGG,SAAS,eAAe,CAAC,aAAAO,WAAA,EAAAC,oBAAA;EAA3C,MACMH,cAAc,SAAAG,oBAAA,CAAyC;IAAAC,YAAA,GAAAC,IAAA;MAAA,SAAAA,IAAA;MAAAH,WAAA;IAAA;EA+J7D;EAAC;IAAAI,CAAA,EA/JKN,cAAc;IAAAO,CAAA;MAAAC,IAAA;MAAAC,UAAA,GAIjBtB,KAAK,CAAC,CAAC;MAAAuB,GAAA;MAAAC,MAAA;QAAA,OACa,KAAK;MAAA;IAAA;MAAAH,IAAA;MAAAC,UAAA,GAIzBtB,KAAK,CAAC,CAAC;MAAAuB,GAAA;MAAAC,MAAA;QAAA,OACI,KAAK;MAAA;IAAA;MAA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E,IAAI,CAAAgF,GAAA,KAAAA,GAAA,GAAArB,CAAA;AACf,oBADe;AACf,UADe;AACf;AACA;AACA,YAHe;AACf;AACA;AACA,KAHe,GACKoB,eAAe,EACzB,IAAI,CAACzB,gBAAgB,CAAC,CAAC,EAAI,IAAI,CAACM,YAAY,CAAC,CAAC,EAG5C,IAAI,CAACI,WAAW,CAAC,CAAC,EAAG,IAAI,CAACE,aAAa,CAAC,CAAC;MAInD;IAAC;MAAAzC,IAAA;MAAAwD,MAAA;MAAAtD,GAAA;MAAAC,KAAA,EAED,SAAAA,CAAA,EAA4B;QAC1B,OAAO,GAAGhB,SAAS,gBAAgB;MACrC;IAAC;MAAAa,IAAA;MAAAwD,MAAA;MAAAtD,GAAA;MAAAC,KAAA,EAED,SAAAA,CAAA,EAA+B;QAC7B,OAAO,GAAGhB,SAAS,aAAa;MAClC;IAAC;MAAAa,IAAA;MAAAwD,MAAA;MAAAtD,GAAA;MAAAC,MAAA;QAAA,OAEerB,MAAM;MAAA;IAAA;EAAA;AAAA,GA9JKD,mBAAmB,CAACL,UAAU,CAAC;AAiK5D;AACA,eAAegB,cAAc","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
*
|
|
4
|
-
* Copyright IBM Corp. 2020,
|
|
4
|
+
* Copyright IBM Corp. 2020, 2025
|
|
5
5
|
*
|
|
6
6
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -357,6 +357,8 @@ declare const C4DCTABlockItemRow_base: {
|
|
|
357
357
|
declare class C4DCTABlockItemRow extends C4DCTABlockItemRow_base {
|
|
358
358
|
/** Defines if the bottom border is rendered */
|
|
359
359
|
_noBorder: boolean;
|
|
360
|
+
_hasChildWithMedia: boolean;
|
|
361
|
+
checkForMedia(): void;
|
|
360
362
|
render(): import("lit-html").TemplateResult<1>;
|
|
361
363
|
/**
|
|
362
364
|
* Checks if the no-border attribute has changed and applies the border class accordingly
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import _decorate from "@babel/runtime/helpers/esm/decorate";
|
|
2
2
|
let _ = t => t,
|
|
3
|
-
_t
|
|
3
|
+
_t,
|
|
4
|
+
_t2;
|
|
4
5
|
/**
|
|
5
6
|
* @license
|
|
6
7
|
*
|
|
7
|
-
* Copyright IBM Corp. 2020,
|
|
8
|
+
* Copyright IBM Corp. 2020, 2025
|
|
8
9
|
*
|
|
9
10
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
10
11
|
* LICENSE file in the root directory of this source tree.
|
|
11
12
|
*/
|
|
12
13
|
|
|
13
14
|
import { LitElement, html } from 'lit';
|
|
14
|
-
import { property } from 'lit/decorators.js';
|
|
15
|
+
import { property, state } from 'lit/decorators.js';
|
|
15
16
|
import settings from '@carbon/ibmdotcom-utilities/es/utilities/settings/settings.js';
|
|
16
17
|
import StableSelectorMixin from "../../globals/mixins/stable-selector.js";
|
|
17
18
|
import styles from "././cta-block.css.js";
|
|
18
19
|
import { carbonElement as customElement } from '@carbon/web-components/es/globals/decorators/carbon-element.js';
|
|
20
|
+
import C4DContentItem from "../content-item/content-item.js";
|
|
19
21
|
const {
|
|
20
22
|
prefix,
|
|
21
23
|
stablePrefix: c4dPrefix
|
|
@@ -47,13 +49,40 @@ let C4DCTABlockItemRow = _decorate([customElement(`${c4dPrefix}-cta-block-item-r
|
|
|
47
49
|
value() {
|
|
48
50
|
return false;
|
|
49
51
|
}
|
|
52
|
+
}, {
|
|
53
|
+
kind: "field",
|
|
54
|
+
decorators: [state()],
|
|
55
|
+
key: "_hasChildWithMedia",
|
|
56
|
+
value() {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
50
59
|
}, {
|
|
51
60
|
kind: "method",
|
|
52
|
-
key: "
|
|
61
|
+
key: "checkForMedia",
|
|
53
62
|
value: /** Defines if the bottom border is rendered */
|
|
54
63
|
|
|
55
|
-
function
|
|
56
|
-
|
|
64
|
+
function checkForMedia() {
|
|
65
|
+
const childrenWithMedia = Array.from(this.children).filter(elem => {
|
|
66
|
+
if (elem instanceof C4DContentItem) {
|
|
67
|
+
return (elem === null || elem === void 0 ? void 0 : elem._hasMedia) && !(elem !== null && elem !== void 0 && elem._hasPictogram);
|
|
68
|
+
}
|
|
69
|
+
return false;
|
|
70
|
+
});
|
|
71
|
+
this._hasChildWithMedia = childrenWithMedia.length > 0;
|
|
72
|
+
this.render();
|
|
73
|
+
}
|
|
74
|
+
}, {
|
|
75
|
+
kind: "method",
|
|
76
|
+
key: "render",
|
|
77
|
+
value: function render() {
|
|
78
|
+
const {
|
|
79
|
+
_hasChildWithMedia: hasChildWithMedia
|
|
80
|
+
} = this;
|
|
81
|
+
if (hasChildWithMedia) {
|
|
82
|
+
return html(_t || (_t = _`<div class="scroll-container"><slot></slot></div>`));
|
|
83
|
+
} else {
|
|
84
|
+
return html(_t2 || (_t2 = _`<slot></slot>`));
|
|
85
|
+
}
|
|
57
86
|
}
|
|
58
87
|
|
|
59
88
|
/**
|
|
@@ -66,6 +95,9 @@ let C4DCTABlockItemRow = _decorate([customElement(`${c4dPrefix}-cta-block-item-r
|
|
|
66
95
|
if (changedProperties.has('_noBorder')) {
|
|
67
96
|
this.classList.toggle(`${prefix}--cta-block-item-row__border`, !this._noBorder);
|
|
68
97
|
}
|
|
98
|
+
this.updateComplete.then(() => {
|
|
99
|
+
this.checkForMedia();
|
|
100
|
+
});
|
|
69
101
|
}
|
|
70
102
|
}, {
|
|
71
103
|
kind: "get",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cta-block-item-row.js","names":["LitElement","html","property","settings","StableSelectorMixin","styles","carbonElement","customElement","prefix","stablePrefix","c4dPrefix","C4DCTABlockItemRow","_decorate","_initialize","_StableSelectorMixin","constructor","args","F","d","kind","decorators","type","Boolean","reflect","attribute","key","value","render","_t","_","updated","changedProperties","has","classList","toggle","_noBorder","static","console","warn"],"sources":["components/cta-block/cta-block-item-row.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2020,
|
|
1
|
+
{"version":3,"file":"cta-block-item-row.js","names":["LitElement","html","property","state","settings","StableSelectorMixin","styles","carbonElement","customElement","C4DContentItem","prefix","stablePrefix","c4dPrefix","C4DCTABlockItemRow","_decorate","_initialize","_StableSelectorMixin","constructor","args","F","d","kind","decorators","type","Boolean","reflect","attribute","key","value","checkForMedia","childrenWithMedia","Array","from","children","filter","elem","_hasMedia","_hasPictogram","_hasChildWithMedia","length","render","hasChildWithMedia","_t","_","_t2","updated","changedProperties","has","classList","toggle","_noBorder","updateComplete","then","static","console","warn"],"sources":["components/cta-block/cta-block-item-row.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2020, 2025\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { LitElement, html } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport settings from '@carbon/ibmdotcom-utilities/es/utilities/settings/settings.js';\nimport StableSelectorMixin from '../../globals/mixins/stable-selector';\nimport styles from './cta-block.scss';\nimport { carbonElement as customElement } from '@carbon/web-components/es/globals/decorators/carbon-element.js';\nimport C4DContentItem from '../content-item/content-item';\n\nconst { prefix, stablePrefix: c4dPrefix } = settings;\n\n/**\n * The CTA BLOCK ITEM ROW component\n *\n * @element c4d-cta-block-item-row\n * @slot .\n */\n@customElement(`${c4dPrefix}-cta-block-item-row`)\nclass C4DCTABlockItemRow extends StableSelectorMixin(LitElement) {\n /** Defines if the bottom border is rendered */\n @property({ type: Boolean, reflect: true, attribute: 'no-border' })\n _noBorder = false;\n @state()\n _hasChildWithMedia = false;\n checkForMedia() {\n const childrenWithMedia = Array.from(this.children).filter((elem) => {\n if (elem instanceof C4DContentItem) {\n return (\n (elem as C4DContentItem)?._hasMedia &&\n !(elem as C4DContentItem)?._hasPictogram\n );\n }\n return false;\n });\n this._hasChildWithMedia = childrenWithMedia.length > 0;\n this.render();\n }\n\n render() {\n const { _hasChildWithMedia: hasChildWithMedia } = this;\n if (hasChildWithMedia) {\n return html`<div class=\"scroll-container\"><slot></slot></div>`;\n } else {\n return html`<slot></slot>`;\n }\n }\n\n /**\n * Checks if the no-border attribute has changed and applies the border class accordingly\n */\n updated(changedProperties) {\n if (changedProperties.has('_noBorder')) {\n this.classList.toggle(\n `${prefix}--cta-block-item-row__border`,\n !this._noBorder\n );\n }\n this.updateComplete.then(() => {\n this.checkForMedia();\n });\n }\n\n static get stableSelector() {\n return `${c4dPrefix}--cta-block-item-row`;\n }\n\n static styles = styles; // `styles` here is a `CSSResult` generated by custom WebPack loader\n}\n\nconsole.warn(\n 'The cta-block-item-row component has been deprecated in favor of the content-section/block and content-item components. ' +\n 'See content-section/block and content-items documentation for more information.'\n);\n\n/* @__GENERATE_REACT_CUSTOM_ELEMENT_TYPE__ */\nexport default C4DCTABlockItemRow;\n"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,UAAU,EAAEC,IAAI,QAAQ,KAAK;AACtC,SAASC,QAAQ,EAAEC,KAAK,QAAQ,mBAAmB;AACnD,OAAOC,QAAQ,MAAM,+DAA+D;AACpF,OAAOC,mBAAmB,MAAM,yCAAsC;AACtE,OAAOC,MAAM,MAAM,sBAAkB;AACrC,SAASC,aAAa,IAAIC,aAAa,QAAQ,gEAAgE;AAC/G,OAAOC,cAAc,MAAM,iCAA8B;AAEzD,MAAM;EAAEC,MAAM;EAAEC,YAAY,EAAEC;AAAU,CAAC,GAAGR,QAAQ;;AAEpD;AACA;AACA;AACA;AACA;AACA;AALA,IAOMS,kBAAkB,GAAAC,SAAA,EADvBN,aAAa,CAAC,GAAGI,SAAS,qBAAqB,CAAC,aAAAG,WAAA,EAAAC,oBAAA;EAAjD,MACMH,kBAAkB,SAAAG,oBAAA,CAAyC;IAAAC,YAAA,GAAAC,IAAA;MAAA,SAAAA,IAAA;MAAAH,WAAA;IAAA;EAiDjE;EAAC;IAAAI,CAAA,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OA,CAACC,iBAAiB,EAAE;QACzB,IAAIA,iBAAiB,CAACC,GAAG,CAAC,WAAW,CAAC,EAAE;UACtC,IAAI,CAACC,SAAS,CAACC,MAAM,CACnB,GAAGvC,MAAM,8BAA8B,EACvC,CAAC,IAAI,CAACwC,SACR,CAAC;QACH;QACA,IAAI,CAACC,cAAc,CAACC,IAAI,CAAC,MAAM;UAC7B,IAAI,CAACvB,aAAa,CAAC,CAAC;QACtB,CAAC,CAAC;MACJ;IAAC;MAAAR,IAAA;MAAAgC,MAAA;MAAA1B,GAAA;MAAAC,KAAA,EAED,SAAAA,CAAA,EAA4B;QAC1B,OAAO,GAAGhB,SAAS,sBAAsB;MAC3C;IAAC;MAAAS,IAAA;MAAAgC,MAAA;MAAA1B,GAAA;MAAAC,MAAA;QAAA,OAEetB,MAAM;MAAA;IAAA;EAAA;AAAA,GAhDSD,mBAAmB,CAACL,UAAU,CAAC;AAmDhEsD,OAAO,CAACC,IAAI,CACV,0HAA0H,GACxH,iFACJ,CAAC;;AAED;AACA,eAAe1C,kBAAkB","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
*
|
|
4
|
-
* Copyright IBM Corp. 2020,
|
|
4
|
+
* Copyright IBM Corp. 2020, 2025
|
|
5
5
|
*
|
|
6
6
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
7
7
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -365,7 +365,7 @@ declare class C4DCTABlockItem extends C4DCTABlockItem_base {
|
|
|
365
365
|
/**
|
|
366
366
|
* `true` if there are CTA media in the content item area.
|
|
367
367
|
*/
|
|
368
|
-
|
|
368
|
+
_hasMedia: boolean;
|
|
369
369
|
/**
|
|
370
370
|
* `true` if there are CTA statistic in the content item area.
|
|
371
371
|
*/
|
|
@@ -10,7 +10,7 @@ function _superPropGet(t, e, r, o) { var p = _get(_getPrototypeOf(1 & o ? t.prot
|
|
|
10
10
|
/**
|
|
11
11
|
* @license
|
|
12
12
|
*
|
|
13
|
-
* Copyright IBM Corp. 2020,
|
|
13
|
+
* Copyright IBM Corp. 2020, 2025
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
@@ -98,6 +98,10 @@ let C4DCTABlockItem = _decorate([customElement(`${c4dPrefix}-cta-block-item`)],
|
|
|
98
98
|
} = target;
|
|
99
99
|
const hasContent = target.assignedNodes().some(node => node.nodeType !== Node.TEXT_NODE || node.textContent.trim());
|
|
100
100
|
this[slotExistencePropertyNames[name] || '_hasStatistic'] = hasContent;
|
|
101
|
+
if (target.getAttribute('name') == 'media') {
|
|
102
|
+
const hasPictogram = target.assignedNodes().some(node => node.tagName.toLowerCase() == 'svg');
|
|
103
|
+
this._hasPictogram = hasPictogram;
|
|
104
|
+
}
|
|
101
105
|
}
|
|
102
106
|
|
|
103
107
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cta-block-item.js","names":["css","html","state","settings","StableSelectorMixin","C4DContentItem","styles","carbonElement","customElement","prefix","stablePrefix","c4dPrefix","slotExistencePropertyNames","media","statistic","footer","C4DCTABlockItem","_decorate","_initialize","_StableSelectorMixin","constructor","args","F","d","kind","decorators","key","value","_handleSlotChange","target","name","hasContent","assignedNodes","some","node","nodeType","Node","TEXT_NODE","textContent","trim","_renderStatistic","_hasStatistic","hasStatistic","handleSlotChange","_t","_","_renderMedia","_hasMedia","hasMedia","_t2","render","_t3","_superPropGet","static","_t4","console","warn"],"sources":["components/cta-block/cta-block-item.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2020,
|
|
1
|
+
{"version":3,"file":"cta-block-item.js","names":["css","html","state","settings","StableSelectorMixin","C4DContentItem","styles","carbonElement","customElement","prefix","stablePrefix","c4dPrefix","slotExistencePropertyNames","media","statistic","footer","C4DCTABlockItem","_decorate","_initialize","_StableSelectorMixin","constructor","args","F","d","kind","decorators","key","value","_handleSlotChange","target","name","hasContent","assignedNodes","some","node","nodeType","Node","TEXT_NODE","textContent","trim","getAttribute","hasPictogram","tagName","toLowerCase","_hasPictogram","_renderStatistic","_hasStatistic","hasStatistic","handleSlotChange","_t","_","_renderMedia","_hasMedia","hasMedia","_t2","render","_t3","_superPropGet","static","_t4","console","warn"],"sources":["components/cta-block/cta-block-item.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2020, 2025\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { css, html, TemplateResult } from 'lit';\nimport { state } from 'lit/decorators.js';\nimport settings from '@carbon/ibmdotcom-utilities/es/utilities/settings/settings.js';\nimport StableSelectorMixin from '../../globals/mixins/stable-selector';\nimport C4DContentItem from '../content-item/content-item';\n\nimport styles from './cta-block.scss';\nimport { carbonElement as customElement } from '@carbon/web-components/es/globals/decorators/carbon-element.js';\n\nconst { prefix, stablePrefix: c4dPrefix } = settings;\n\n/**\n * The table mapping slot name with the private property name that indicates the existence of the slot content.\n */\nconst slotExistencePropertyNames = {\n media: '_hasMedia',\n statistic: '_hasStatistic',\n footer: '_hasFooter',\n};\n\n/**\n * The CTA BLOCK ITEM component\n *\n * @element c4d-cta-block-item\n * @slot statistics\n * @slot media\n * @slot heading\n * @slot .\n * @slot footer\n * @csspart statistics - The statistics. Usage: `c4d-cta-block-item::part(statistics)`\n * @csspart media - The media. Usage: `c4d-cta-block-item::part(media)`\n */\n@customElement(`${c4dPrefix}-cta-block-item`)\nclass C4DCTABlockItem extends StableSelectorMixin(C4DContentItem) {\n /**\n * `true` if there are CTA media in the content item area.\n */\n @state()\n _hasMedia = false;\n\n /**\n * `true` if there are CTA statistic in the content item area.\n */\n @state()\n protected _hasStatistic = false;\n\n /**\n * Handles `slotchange` event.\n *\n * @param event The event.\n * @param event.target The event target.\n */\n protected _handleSlotChange({ target }: Event) {\n const { name } = target as HTMLSlotElement;\n const hasContent = (target as HTMLSlotElement)\n .assignedNodes()\n .some(\n (node) => node.nodeType !== Node.TEXT_NODE || node!.textContent!.trim()\n );\n this[slotExistencePropertyNames[name] || '_hasStatistic'] = hasContent;\n if ((target as HTMLElement).getAttribute('name') == 'media') {\n const hasPictogram = (target as HTMLSlotElement)\n .assignedNodes()\n .some((node) => (node as HTMLElement).tagName.toLowerCase() == 'svg');\n this._hasPictogram = hasPictogram;\n }\n }\n\n /**\n * @returns The statistic content items\n */\n protected _renderStatistic(): TemplateResult | string | void {\n const { _hasStatistic: hasStatistic, _handleSlotChange: handleSlotChange } =\n this;\n return html`\n <div\n ?hidden=\"${!hasStatistic}\"\n class=\"${prefix}--cta-block-item__statitics\"\n part=\"statistics\">\n <slot name=\"statistics\" @slotchange=\"${handleSlotChange}\"></slot>\n </div>\n `;\n }\n\n /**\n * @returns The media content items\n */\n protected _renderMedia(): TemplateResult | string | void {\n const { _hasMedia: hasMedia, _handleSlotChange: handleSlotChange } = this;\n\n return html`\n <div\n ?hidden=\"${!hasMedia}\"\n class=\"${prefix}--cta-block-item__media\"\n part=\"media\">\n <slot name=\"media\" @slotchange=\"${handleSlotChange}\"></slot>\n </div>\n `;\n }\n\n render() {\n return html`\n ${this._renderStatistic()} ${this._renderMedia()}\n <slot name=\"heading\"></slot>\n ${super._renderBody()}${super._renderFooter()}\n `;\n }\n\n static get stableSelector() {\n return `${c4dPrefix}--cta-block-item`;\n }\n\n // `styles` here is a `CSSResult` generated by custom WebPack loader\n static get styles() {\n return css`\n ${super.styles}${styles}\n `;\n }\n}\n\nconsole.warn(\n 'The cta-block-item component has been deprecated in favor of the content-section/block and content-item components. ' +\n 'See content-section/block and content-items documentation for more information.'\n);\n\n/* @__GENERATE_REACT_CUSTOM_ELEMENT_TYPE__ */\nexport default C4DCTABlockItem;\n"],"mappings":";;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,GAAG,EAAEC,IAAI,QAAwB,KAAK;AAC/C,SAASC,KAA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