@carbon/ibmdotcom-web-components 2.20.0 → 2.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/dotcom-shell.js +6 -6
  2. package/dist/dotcom-shell.min.js +5 -5
  3. package/dist/ibmdotcom-web-components-dotcom-shell.js +6 -6
  4. package/dist/ibmdotcom-web-components-dotcom-shell.min.js +5 -5
  5. package/dist/{index-ca29a51a.js → index-d1d84c2f.js} +185 -167
  6. package/dist/{index-da32acc5.js → index-fe85c5e6.js} +320 -320
  7. package/dist/{left-nav-menu-73c960db.js → left-nav-menu-497c9169.js} +6 -6
  8. package/dist/{left-nav-menu-category-heading-be0319c6.js → left-nav-menu-category-heading-14bacdd1.js} +6 -6
  9. package/dist/{left-nav-menu-category-heading-cefcd3f0.js → left-nav-menu-category-heading-8ccb4ce7.js} +5 -5
  10. package/dist/{left-nav-menu-03ca4e6e.js → left-nav-menu-cd889d8d.js} +5 -5
  11. package/dist/{left-nav-menu-item-83f4767e.js → left-nav-menu-item-2a3c9eb0.js} +6 -6
  12. package/dist/{left-nav-menu-item-a2a18a4a.js → left-nav-menu-item-803e8924.js} +5 -5
  13. package/dist/{left-nav-menu-section-91e5a492.js → left-nav-menu-section-024ec574.js} +6 -6
  14. package/dist/{left-nav-menu-section-47c67bd8.js → left-nav-menu-section-462064ef.js} +5 -5
  15. package/dist/{left-nav-overlay-8d2ad9f9.js → left-nav-overlay-38b81f2f.js} +6 -6
  16. package/dist/{left-nav-overlay-ad684e9d.js → left-nav-overlay-9ec9772c.js} +5 -5
  17. package/dist/{megamenu-category-group-5e6c9054.js → megamenu-category-group-4229cc92.js} +6 -6
  18. package/dist/{megamenu-category-group-copy-cc99c2a6.js → megamenu-category-group-copy-18d5977c.js} +5 -5
  19. package/dist/{megamenu-category-group-copy-85fc4ede.js → megamenu-category-group-copy-7525e13d.js} +6 -6
  20. package/dist/{megamenu-category-group-103d2863.js → megamenu-category-group-f874016c.js} +5 -5
  21. package/dist/{megamenu-category-heading-4a2cb054.js → megamenu-category-heading-05c91ceb.js} +5 -5
  22. package/dist/{megamenu-category-heading-7de1ccc9.js → megamenu-category-heading-6c437eed.js} +6 -6
  23. package/dist/{megamenu-category-link-e61ee8d2.js → megamenu-category-link-09ed50a1.js} +9 -9
  24. package/dist/{megamenu-category-link-94a3a869.js → megamenu-category-link-8d5476f0.js} +6 -6
  25. package/dist/{megamenu-category-link-group-58ddce41.js → megamenu-category-link-group-a1418c5c.js} +6 -6
  26. package/dist/{megamenu-category-link-group-99a611b4.js → megamenu-category-link-group-fc4af18d.js} +5 -5
  27. package/dist/{megamenu-left-navigation-d61da700.js → megamenu-left-navigation-cb55e7c7.js} +6 -6
  28. package/dist/{megamenu-left-navigation-15fbe30b.js → megamenu-left-navigation-f972fc38.js} +5 -5
  29. package/dist/{megamenu-overlay-3455b503.js → megamenu-overlay-6e2c8d97.js} +6 -6
  30. package/dist/{megamenu-overlay-7809b18f.js → megamenu-overlay-720be39f.js} +5 -5
  31. package/dist/{megamenu-tab-bb86ecbf.js → megamenu-tab-d96128cd.js} +6 -6
  32. package/dist/{megamenu-tab-7cfc65ba.js → megamenu-tab-de78d556.js} +5 -5
  33. package/es/components/background-media/background-media.css.js +1 -1
  34. package/es/components/carousel/carousel.js +3 -2
  35. package/es/components/carousel/carousel.js.map +1 -1
  36. package/es/components/content-item-row/content-item-row-media.css.js +1 -1
  37. package/es/components/content-item-row/content-item-row-media.d.ts +5 -1
  38. package/es/components/content-item-row/content-item-row-media.js +26 -15
  39. package/es/components/content-item-row/content-item-row-media.js.map +1 -1
  40. package/es/components/masthead/masthead-menu-button.d.ts +3 -1
  41. package/es/components/masthead/masthead-menu-button.js +25 -1
  42. package/es/components/masthead/masthead-menu-button.js.map +1 -1
  43. package/es/components/pricing-table/pricing-table.css.js +1 -1
  44. package/es/internal/vendor/@carbon/ibmdotcom-utilities/utilities/settings/settings.js +2 -2
  45. package/lib/internal/vendor/@carbon/ibmdotcom-utilities/utilities/settings/settings.js +2 -2
  46. package/package.json +5 -5
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @license
3
3
  *
4
- * Copyright IBM Corp. 2020, 2024
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.
@@ -373,6 +373,10 @@ declare class C4DContentItemRowMedia extends C4DContentItemRowMedia_base {
373
373
  * @returns The text column content.
374
374
  */
375
375
  protected _renderTextCol(): TemplateResult | string | void;
376
+ /**
377
+ * @returns The media column content.
378
+ */
379
+ protected _renderMediaCol(): TemplateResult | string | void;
376
380
  /**
377
381
  * @returns The component content in the appropriate tabbing order.
378
382
  */
@@ -3,11 +3,13 @@ let _ = t => t,
3
3
  _t,
4
4
  _t2,
5
5
  _t3,
6
- _t4;
6
+ _t4,
7
+ _t5,
8
+ _t6;
7
9
  /**
8
10
  * @license
9
11
  *
10
- * Copyright IBM Corp. 2020, 2024
12
+ * Copyright IBM Corp. 2020, 2025
11
13
  *
12
14
  * This source code is licensed under the Apache-2.0 license found in the
13
15
  * LICENSE file in the root directory of this source tree.
@@ -97,6 +99,20 @@ let C4DContentItemRowMedia = _decorate([customElement(`${c4dPrefix}-content-item
97
99
  `), prefix, this._handleSlotChange, this._renderBody(), this._renderFooter());
98
100
  }
99
101
 
102
+ /**
103
+ * @returns The media column content.
104
+ */
105
+ }, {
106
+ kind: "method",
107
+ key: "_renderMediaCol",
108
+ value: function _renderMediaCol() {
109
+ return html(_t2 || (_t2 = _`
110
+ <div class="${0}--content-item-row__col" part="col col--media">
111
+ <slot name="media" @slotchange="${0}"></slot>
112
+ </div>
113
+ `), prefix, this._handleSlotChange);
114
+ }
115
+
100
116
  /**
101
117
  * @returns The component content in the appropriate tabbing order.
102
118
  */
@@ -104,24 +120,19 @@ let C4DContentItemRowMedia = _decorate([customElement(`${c4dPrefix}-content-item
104
120
  kind: "method",
105
121
  key: "_renderContent",
106
122
  value: function _renderContent() {
107
- const alignedRight = this._isOneColumn || this.align === MEDIA_ALIGN.RIGHT;
108
- return alignedRight ? html(_t2 || (_t2 = _`
109
- ${0}
110
- <div class="${0}--content-item-row__col" part="col col--media">
111
- <slot name="media" @slotchange="${0}"></slot>
112
- </div>
113
- `), this._renderTextCol(), prefix, this._handleSlotChange) : html(_t3 || (_t3 = _`
114
- <div class="${0}--content-item-row__col" part="col col--media">
115
- <slot name="media" @slotchange="${0}"></slot>
116
- </div>
117
- ${0}
118
- `), prefix, this._handleSlotChange, this._renderTextCol());
123
+ const alignedRight = this.align === MEDIA_ALIGN.RIGHT;
124
+
125
+ // Always return image first when stacked on mobile
126
+ if (this._isOneColumn) {
127
+ return html(_t3 || (_t3 = _` ${0} ${0} `), this._renderMediaCol(), this._renderTextCol());
128
+ }
129
+ return alignedRight ? html(_t4 || (_t4 = _` ${0} ${0} `), this._renderTextCol(), this._renderMediaCol()) : html(_t5 || (_t5 = _` ${0} ${0} `), this._renderMediaCol(), this._renderTextCol());
119
130
  }
120
131
  }, {
121
132
  kind: "method",
122
133
  key: "render",
123
134
  value: function render() {
124
- return html(_t4 || (_t4 = _`
135
+ return html(_t6 || (_t6 = _`
125
136
  <div
126
137
  class="${0}--content-item-row__row ${0}--content-item-row-media__align-${0}"
127
138
  part="row row--media">
@@ -1 +1 @@
1
- {"version":3,"file":"content-item-row-media.js","names":["html","property","state","baseFontSize","breakpoints","HostListener","HostListenerMixin","settings","C4DContentItem","styles","MEDIA_ALIGN","carbonElement","customElement","prefix","stablePrefix","c4dPrefix","breakpoint","parseFloat","lg","width","C4DContentItemRowMedia","_decorate","_initialize","_HostListenerMixin","constructor","args","F","d","kind","decorators","reflect","key","value","RIGHT","window","innerWidth","_isOneColumn","_renderTextCol","_t","_","_handleSlotChange","_renderBody","_renderFooter","_renderContent","alignedRight","align","_t2","_t3","render","_t4","static"],"sources":["components/content-item-row/content-item-row-media.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 { TemplateResult, html } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { baseFontSize, breakpoints } from '@carbon/layout';\nimport HostListener from '@carbon/web-components/es/globals/decorators/host-listener.js';\nimport HostListenerMixin from '@carbon/web-components/es/globals/mixins/host-listener.js';\nimport settings from '@carbon/ibmdotcom-utilities/es/utilities/settings/settings.js';\nimport C4DContentItem from '../content-item/content-item';\nimport styles from './content-item-row-media.scss';\n\nimport { MEDIA_ALIGN } from './defs';\nimport { carbonElement as customElement } from '@carbon/web-components/es/globals/decorators/carbon-element.js';\n\nconst { prefix, stablePrefix: c4dPrefix } = settings;\n\nconst breakpoint = parseFloat(breakpoints.lg.width) * baseFontSize;\n\n/**\n * A component to present content in a row orientation with media.\n *\n * @element c4d-content-item-row-media\n * @csspart col--eyebrow - the column eyebrow. Usage. `c4d-content-item-row-media::part(col--eyebrow)`\n * @csspart col--media - thecontent column media. Usage. `c4d-content-item-row-media::part(col--media)`\n * @csspart row--media - the content row media. Usage. `c4d-content-item-row-media::part(row--media)`\n * @csspart\n */\n@customElement(`${c4dPrefix}-content-item-row-media`)\nclass C4DContentItemRowMedia extends HostListenerMixin(C4DContentItem) {\n /**\n * Defines the alignment of the media: `left` or `right`\n */\n @property({ reflect: true })\n align = MEDIA_ALIGN.RIGHT;\n\n /**\n * Identifies whether the window width is below the breakpoint or not.\n */\n @state()\n _isOneColumn: boolean = window.innerWidth < breakpoint;\n\n @HostListener('window:resize')\n // @ts-ignore: The decorator refers to this method but TS thinks this method is not referred to\n private _handleWindowResize = (): void => {\n this._isOneColumn = window.innerWidth < breakpoint;\n };\n\n /**\n * @returns The text column content.\n */\n protected _renderTextCol(): TemplateResult | string | void {\n return html`\n <div class=\"${prefix}--content-item-row__col\" part=\"col col--eyebrow\">\n <slot name=\"eyebrow\" @slotchange=\"${this._handleSlotChange}\"></slot>\n <slot name=\"heading\"></slot>\n ${this._renderBody()} ${this._renderFooter()}\n </div>\n `;\n }\n\n /**\n * @returns The component content in the appropriate tabbing order.\n */\n protected _renderContent(): TemplateResult | string | void {\n const alignedRight = this._isOneColumn || this.align === MEDIA_ALIGN.RIGHT;\n\n return alignedRight\n ? html`\n ${this._renderTextCol()}\n <div class=\"${prefix}--content-item-row__col\" part=\"col col--media\">\n <slot name=\"media\" @slotchange=\"${this._handleSlotChange}\"></slot>\n </div>\n `\n : html`\n <div class=\"${prefix}--content-item-row__col\" part=\"col col--media\">\n <slot name=\"media\" @slotchange=\"${this._handleSlotChange}\"></slot>\n </div>\n ${this._renderTextCol()}\n `;\n }\n\n render() {\n return html`\n <div\n class=\"${prefix}--content-item-row__row ${prefix}--content-item-row-media__align-${this\n .align}\"\n part=\"row row--media\">\n ${this._renderContent()}\n </div>\n `;\n }\n\n static get stableSelector() {\n return `${c4dPrefix}--content-item-row-media`;\n }\n\n static styles = styles;\n}\n\n/* @__GENERATE_REACT_CUSTOM_ELEMENT_TYPE__ */\nexport default C4DContentItemRowMedia;\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAyBA,IAAI,QAAQ,KAAK;AAC1C,SAASC,QAAQ,EAAEC,KAAK,QAAQ,mBAAmB;AACnD,SAASC,YAAY,EAAEC,WAAW,QAAQ,gBAAgB;AAC1D,OAAOC,YAAY,MAAM,+DAA+D;AACxF,OAAOC,iBAAiB,MAAM,2DAA2D;AACzF,OAAOC,QAAQ,MAAM,+DAA+D;AACpF,OAAOC,cAAc,MAAM,iCAA8B;AACzD,OAAOC,MAAM,MAAM,mCAA+B;AAElD,SAASC,WAAW,QAAQ,WAAQ;AACpC,SAASC,aAAa,IAAIC,aAAa,QAAQ,gEAAgE;AAE/G,MAAM;EAAEC,MAAM;EAAEC,YAAY,EAAEC;AAAU,CAAC,GAAGR,QAAQ;AAEpD,MAAMS,UAAU,GAAGC,UAAU,CAACb,WAAW,CA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FE;MAAAd,IAAA;MAAAG,GAAA;MAAAC,KAAA,EAGA,SAAUW,cAAcA,CAAA,EAAmC;QACzD,MAAMC,YAAY,GAAG,IAAI,CAACR,YAAY,IAAI,IAAI,CAACS,KAAK,KAAKnC,WAAW,CAACuB,KAAK;QAE1E,OAAOW,YAAY,GACf5C,IAAI,CAAA8C,GAAA,KAAAA,GAAA,GAAAP,CAAA;AACZ,YADY;AACZ,wBADY;AACZ,8CADY;AACZ;AACA,SAFY,GACA,IAAI,CAACF,cAAc,CAAC,CAAC,EACTxB,MAAM,EACgB,IAAI,CAAC2B,iBAAiB,IAG5DxC,IAAI,CAAA+C,GAAA,KAAAA,GAAA,GAAAR,CAAA;AACZ,wBADY;AACZ,8CADY;AACZ;AACA,YAFY;AACZ,SADY,GACY1B,MAAM,EACgB,IAAI,CAAC2B,iBAAiB,EAExD,IAAI,CAACH,cAAc,CAAC,CAAC,CACxB;MACP;IAAC;MAAAT,IAAA;MAAAG,GAAA;MAAAC,KAAA,EAED,SAAAgB,MAAMA,CAAA,EAAG;QACP,OAAOhD,IAAI,CAAAiD,GAAA,KAAAA,GAAA,GAAAV,CAAA;AACf;AACA,iBAFe;AACf;AACA,UAFe;AACf;AACA,KAFe,GAEE1B,MAAM,EAA2BA,MAAM,EAAmC,IAAI,CACpFgC,KAAK,EAEN,IAAI,CAACF,cAAc,CAAC,CAAC;MAG7B;IAAC;MAAAf,IAAA;MAAAsB,MAAA;MAAAnB,GAAA;MAAAC,KAAA,EAED,SAAAA,CAAA,EAA4B;QAC1B,OAAO,GAAGjB,SAAS,0BAA0B;MAC/C;IAAC;MAAAa,IAAA;MAAAsB,MAAA;MAAAnB,GAAA;MAAAC,MAAA;QAAA,OAEevB,MAAM;MAAA;IAAA;EAAA;AAAA,GApEaH,iBAAiB,CAACE,cAAc,CAAC;AAuEtE;AACA,eAAeY,sBAAsB","ignoreList":[]}
1
+ {"version":3,"file":"content-item-row-media.js","names":["html","property","state","baseFontSize","breakpoints","HostListener","HostListenerMixin","settings","C4DContentItem","styles","MEDIA_ALIGN","carbonElement","customElement","prefix","stablePrefix","c4dPrefix","breakpoint","parseFloat","lg","width","C4DContentItemRowMedia","_decorate","_initialize","_HostListenerMixin","constructor","args","F","d","kind","decorators","reflect","key","value","RIGHT","window","innerWidth","_isOneColumn","_renderTextCol","_t","_","_handleSlotChange","_renderBody","_renderFooter","_renderMediaCol","_t2","_renderContent","alignedRight","align","_t3","_t4","_t5","render","_t6","static"],"sources":["components/content-item-row/content-item-row-media.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 { TemplateResult, html } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { baseFontSize, breakpoints } from '@carbon/layout';\nimport HostListener from '@carbon/web-components/es/globals/decorators/host-listener.js';\nimport HostListenerMixin from '@carbon/web-components/es/globals/mixins/host-listener.js';\nimport settings from '@carbon/ibmdotcom-utilities/es/utilities/settings/settings.js';\nimport C4DContentItem from '../content-item/content-item';\nimport styles from './content-item-row-media.scss';\n\nimport { MEDIA_ALIGN } from './defs';\nimport { carbonElement as customElement } from '@carbon/web-components/es/globals/decorators/carbon-element.js';\n\nconst { prefix, stablePrefix: c4dPrefix } = settings;\n\nconst breakpoint = parseFloat(breakpoints.lg.width) * baseFontSize;\n\n/**\n * A component to present content in a row orientation with media.\n *\n * @element c4d-content-item-row-media\n * @csspart col--eyebrow - the column eyebrow. Usage. `c4d-content-item-row-media::part(col--eyebrow)`\n * @csspart col--media - thecontent column media. Usage. `c4d-content-item-row-media::part(col--media)`\n * @csspart row--media - the content row media. Usage. `c4d-content-item-row-media::part(row--media)`\n * @csspart\n */\n@customElement(`${c4dPrefix}-content-item-row-media`)\nclass C4DContentItemRowMedia extends HostListenerMixin(C4DContentItem) {\n /**\n * Defines the alignment of the media: `left` or `right`\n */\n @property({ reflect: true })\n align = MEDIA_ALIGN.RIGHT;\n\n /**\n * Identifies whether the window width is below the breakpoint or not.\n */\n @state()\n _isOneColumn: boolean = window.innerWidth < breakpoint;\n\n @HostListener('window:resize')\n // @ts-ignore: The decorator refers to this method but TS thinks this method is not referred to\n private _handleWindowResize = (): void => {\n this._isOneColumn = window.innerWidth < breakpoint;\n };\n\n /**\n * @returns The text column content.\n */\n protected _renderTextCol(): TemplateResult | string | void {\n return html`\n <div class=\"${prefix}--content-item-row__col\" part=\"col col--eyebrow\">\n <slot name=\"eyebrow\" @slotchange=\"${this._handleSlotChange}\"></slot>\n <slot name=\"heading\"></slot>\n ${this._renderBody()} ${this._renderFooter()}\n </div>\n `;\n }\n\n /**\n * @returns The media column content.\n */\n protected _renderMediaCol(): TemplateResult | string | void {\n return html`\n <div class=\"${prefix}--content-item-row__col\" part=\"col col--media\">\n <slot name=\"media\" @slotchange=\"${this._handleSlotChange}\"></slot>\n </div>\n `;\n }\n\n /**\n * @returns The component content in the appropriate tabbing order.\n */\n protected _renderContent(): TemplateResult | string | void {\n const alignedRight = this.align === MEDIA_ALIGN.RIGHT;\n\n // Always return image first when stacked on mobile\n if (this._isOneColumn) {\n return html` ${this._renderMediaCol()} ${this._renderTextCol()} `;\n }\n return alignedRight\n ? html` ${this._renderTextCol()} ${this._renderMediaCol()} `\n : html` ${this._renderMediaCol()} ${this._renderTextCol()} `;\n }\n\n render() {\n return html`\n <div\n class=\"${prefix}--content-item-row__row ${prefix}--content-item-row-media__align-${this\n .align}\"\n part=\"row row--media\">\n ${this._renderContent()}\n </div>\n `;\n }\n\n static get stableSelector() {\n return `${c4dPrefix}--content-item-row-media`;\n }\n\n static styles = styles;\n}\n\n/* @__GENERATE_REACT_CUSTOM_ELEMENT_TYPE__ */\nexport default C4DContentItemRowMedia;\n"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAyBA,IAAI,QAAQ,KAAK;AAC1C,SAASC,QAAQ,EAAEC,KAAK,QAAQ,mBAAmB;A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AAC,EAAI,IAAI,CAACN,cAAc,CAAC,CAAC,CAAG;MAChE;IAAC;MAAAT,IAAA;MAAAG,GAAA;MAAAC,KAAA,EAED,SAAAmB,MAAMA,CAAA,EAAG;QACP,OAAOnD,IAAI,CAAAoD,GAAA,KAAAA,GAAA,GAAAb,CAAA;AACf;AACA,iBAFe;AACf;AACA,UAFe;AACf;AACA,KAFe,GAEE1B,MAAM,EAA2BA,MAAM,EAAmC,IAAI,CACpFkC,KAAK,EAEN,IAAI,CAACF,cAAc,CAAC,CAAC;MAG7B;IAAC;MAAAjB,IAAA;MAAAyB,MAAA;MAAAtB,GAAA;MAAAC,KAAA,EAED,SAAAA,CAAA,EAA4B;QAC1B,OAAO,GAAGjB,SAAS,0BAA0B;MAC/C;IAAC;MAAAa,IAAA;MAAAyB,MAAA;MAAAtB,GAAA;MAAAC,MAAA;QAAA,OAEevB,MAAM;MAAA;IAAA;EAAA;AAAA,GAzEaH,iBAAiB,CAACE,cAAc,CAAC;AA4EtE;AACA,eAAeY,sBAAsB","ignoreList":[]}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @license
3
3
  *
4
- * Copyright IBM Corp. 2020, 2024
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.
@@ -393,7 +393,9 @@ declare class C4DMastheadMenuButton extends C4DMastheadMenuButton_base {
393
393
  */
394
394
  hideMenuButton: boolean;
395
395
  focus(): void;
396
+ firstUpdated(): void;
396
397
  updated(changedProperties: any): void;
398
+ hideButtonIfNoNavItemsFound(): void;
397
399
  private _renderSentinel;
398
400
  render(): import("lit-html").TemplateResult<1>;
399
401
  /**
@@ -8,7 +8,7 @@ function _superPropGet(t, e, r, o) { var p = _get(_getPrototypeOf(1 & o ? t.prot
8
8
  /**
9
9
  * @license
10
10
  *
11
- * Copyright IBM Corp. 2020, 2024
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.
@@ -153,6 +153,15 @@ let C4DMastheadMenuButton = _decorate([customElement(`${c4dPrefix}-masthead-menu
153
153
  buttonNode.focus();
154
154
  }
155
155
  }
156
+ }, {
157
+ kind: "method",
158
+ key: "firstUpdated",
159
+ value: function firstUpdated() {
160
+ const boundHideButton = this.hideButtonIfNoNavItemsFound.bind(this);
161
+ window.addEventListener(`load`, () => {
162
+ boundHideButton();
163
+ });
164
+ }
156
165
  }, {
157
166
  kind: "method",
158
167
  key: "updated",
@@ -172,6 +181,21 @@ let C4DMastheadMenuButton = _decorate([customElement(`${c4dPrefix}-masthead-menu
172
181
  if (changedProperties.has('hideMenuButton')) {
173
182
  this._hasSearchActive = this.hideMenuButton;
174
183
  }
184
+ this.hideButtonIfNoNavItemsFound();
185
+ }
186
+ }, {
187
+ kind: "method",
188
+ key: "hideButtonIfNoNavItemsFound",
189
+ value: function hideButtonIfNoNavItemsFound() {
190
+ var _this$closest;
191
+ const NavMenuItems = (_this$closest = this.closest(`${c4dPrefix}-masthead-container`)) === null || _this$closest === void 0 ? void 0 : _this$closest.querySelectorAll(`${c4dPrefix}-left-nav-menu`);
192
+ if (!(NavMenuItems !== null && NavMenuItems !== void 0 && NavMenuItems.length)) {
193
+ this.hideMenuButton = true;
194
+ this.style.display = 'none';
195
+ } else if (this.style.display == 'none') {
196
+ this.hideMenuButton = false;
197
+ this.style.display = '';
198
+ }
175
199
  }
176
200
  }, {
177
201
  kind: "field",
@@ -1 +1 @@
1
- {"version":3,"file":"masthead-menu-button.js","names":["classMap","html","property","query","state","HostListener","HostListenerMixin","CDSHeaderMenuButton","settings","focuswrap","styles","carbonElement","customElement","prefix","stablePrefix","c4dPrefix","C4DMastheadMenuButton","_decorate","_initialize","_HostListenerMixin","constructor","args","F","d","kind","key","value","decorators","event","detail","active","undefined","_hasSearchActive","hideMenuButton","reflect","type","Boolean","attribute","focus","_buttonNode","buttonNode","updated","changedProperties","has","_startSentinelNode","startSentinelNode","_endSentinelNode","endSentinelNode","_hFocusWrap","shadowRoot","release","side","_t","_","render","hasSearchActive","_renderSentinel","renderSentinel","classes","startSentinel","endSentinel","_t2","_superPropGet","static"],"sources":["components/masthead/masthead-menu-button.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 { classMap } from 'lit/directives/class-map.js';\nimport { html } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport HostListener from '@carbon/web-components/es/globals/decorators/host-listener.js';\nimport HostListenerMixin from '@carbon/web-components/es/globals/mixins/host-listener.js';\nimport CDSHeaderMenuButton from '@carbon/web-components/es/components/ui-shell/header-menu-button.js';\nimport settings from '@carbon/ibmdotcom-utilities/es/utilities/settings/settings.js';\nimport focuswrap from '@carbon/ibmdotcom-utilities/es/utilities/focuswrap/focuswrap.js';\nimport Handle from '../../globals/internal/handle';\nimport styles from './masthead.scss';\nimport { carbonElement as customElement } from '@carbon/web-components/es/globals/decorators/carbon-element.js';\n\nconst { prefix, stablePrefix: c4dPrefix } = settings;\n\n/**\n * Toggle button for masthead left nav.\n *\n * @element c4d-masthead-menu-button\n * @csspart sentinel-button - The sentinel button for managing focus.\n * @csspart ce-header-menu-trigger-container - Container for the menu trigger button.\n * @csspart sentinel-button--start - The start sentinel button for managing focus. Usage: `c4d-masthead-menu-button::part(sentinel-button--start)`\n * @csspart sentinel-button--end - The end sentinel button for managing focus. Usage: `c4d-masthead-menu-button::part(sentinel-button--end)`\n */\n@customElement(`${c4dPrefix}-masthead-menu-button`)\nclass C4DMastheadMenuButton extends HostListenerMixin(CDSHeaderMenuButton) {\n /**\n * The handle for focus wrapping.\n */\n private _hFocusWrap: Handle | null = null;\n\n /**\n * Search bar opened flag.\n */\n @state()\n private _hasSearchActive = false;\n\n /**\n * Handles toggle event from the search component.\n *\n * @param event The event.\n */\n @HostListener('parentRoot:eventToggleSearch')\n // @ts-ignore: The decorator refers to this method but TS thinks this method is not referred to\n private _handleSearchToggle = (event: Event) => {\n if ((event as CustomEvent).detail.active !== undefined) {\n this._hasSearchActive = (event as CustomEvent).detail.active;\n this.hideMenuButton = (event as CustomEvent).detail.active;\n }\n };\n\n /**\n * Node to track focus going outside of modal content.\n */\n @query('#start-sentinel')\n private _startSentinelNode!: HTMLAnchorElement;\n\n /**\n * Node to track focus going outside of modal content.\n */\n @query('#end-sentinel')\n private _endSentinelNode!: HTMLAnchorElement;\n\n /**\n * The `<button>`.\n */\n @query(`.${prefix}--header__menu-trigger`)\n private _buttonNode!: HTMLButtonElement;\n\n /**\n * The shadow slot this toggle button should be in.\n */\n @property({ reflect: true })\n slot = 'brand';\n\n /**\n * `true` to hide the logo at render\n */\n @property({ type: Boolean, reflect: true, attribute: 'hide-menu-button' })\n hideMenuButton = false;\n\n focus() {\n const { _buttonNode: buttonNode } = this;\n if (buttonNode) {\n buttonNode.focus();\n }\n }\n\n updated(changedProperties) {\n if (changedProperties.has('active')) {\n const {\n active,\n _startSentinelNode: startSentinelNode,\n _endSentinelNode: endSentinelNode,\n } = this;\n if (active) {\n this._hFocusWrap = focuswrap(this.shadowRoot!, [\n startSentinelNode,\n endSentinelNode,\n ]);\n } else if (this._hFocusWrap) {\n this._hFocusWrap = this._hFocusWrap.release();\n }\n }\n\n if (changedProperties.has('hideMenuButton')) {\n this._hasSearchActive = this.hideMenuButton;\n }\n }\n\n private _renderSentinel = (side: String) => {\n return html`\n <button\n part=\"sentinel-button sentinel-button--${side}\"\n id=\"${side}-sentinel\"\n type=\"button\"\n class=\"${prefix}--visually-hidden\"></button>\n `;\n };\n\n render() {\n const {\n active,\n _hasSearchActive: hasSearchActive,\n _renderSentinel: renderSentinel,\n } = this;\n const classes = classMap({\n [`${c4dPrefix}-ce--header__menu-trigger__container`]: true,\n [`${c4dPrefix}-ce--header__menu-trigger__container--has-search-active`]:\n hasSearchActive,\n });\n const startSentinel = active ? renderSentinel('start') : '';\n const endSentinel = active ? renderSentinel('end') : '';\n return html`\n <div part=\"ce-header-menu-trigger-container\" class=\"${classes}\">\n ${startSentinel}${super.render()}${endSentinel}\n </div>\n `;\n }\n\n /**\n * The name of the custom event fired after the seach is toggled.\n */\n static get eventToggleSearch() {\n return `${c4dPrefix}-search-with-typeahead-toggled`;\n }\n\n static styles = styles; // `styles` here is a `CSSResult` generated by custom WebPack loader\n}\n\nexport default C4DMastheadMenuButton;\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,QAAQ,6BAA6B;AACtD,SAASC,IAAI,QAAQ,KAAK;AAC1B,SAASC,QAAQ,EAAEC,KAAK,EAAEC,KAAK,QAAQ,mBAAmB;AAC1D,OAAOC,YAAY,MAAM,+DAA+D;AACxF,OAAOC,iBAAiB,MAAM,2DAA2D;AACzF,OAAOC,mBAAmB,MAAM,qEAAqE;AACrG,OAAOC,QAAQ,MAAM,+DAA+D;AACpF,OAAOC,SAAS,MAAM,iEAAiE;AAEvF,OAAOC,MAAM,MAAM,qBAAiB;AACpC,SAASC,aAAa,IAAIC,aAAa,QAAQ,gEAAgE;AAE/G,MAAM;EAAEC,MAAM;EAAEC,YAAY,EAAEC;AAAU,CAAC,GAAGP,QAAQ;;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AARA,IAUMQ,qBAAqB,GAAAC,SAAA,EAD1BL,aAAa,CAAC,GAAGG,SAAS,uBAAuB,CAAC,aAAAG,WAAA,EAAAC,kBAAA;EAAnD,MACMH,qBAAqB,SAAAG,kBAAA,CAAgD;IAAAC,YAAA,GAAAC,IAAA;MAAA,SAAAA,IAAA;MAAAH,WAAA;IAAA;EA2H3E;EAAC;IAAAI,CAAA,EA3HKN,qBAAqB;IAAAO,CAAA;MAAAC,IAAA;MAAAC,GAAA;MAAAC,MAAA;QAAA,OAIY,IAAI;MAAA;IAAA;MAAAF,IAAA;MAAAG,U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B,CAAC,GAAG,IAAI;QACR,MAAMC,OAAO,GAAG1D,QAAQ,CAAC;UACvB,CAAC,GAAGe,SAAS,sCAAsC,GAAG,IAAI;UAC1D,CAAC,GAAGA,SAAS,yDAAyD,GACpEwC;QACJ,CAAC,CAAC;QACF,MAAMI,aAAa,GAAG7B,MAAM,GAAG2B,cAAc,CAAC,OAAO,CAAC,GAAG,EAAE;QAC3D,MAAMG,WAAW,GAAG9B,MAAM,GAAG2B,cAAc,CAAC,KAAK,CAAC,GAAG,EAAE;QACvD,OAAOxD,IAAI,CAAA4D,GAAA,KAAAA,GAAA,GAAAR,CAAA;AACf,4DADe;AACf,UADe;AACf;AACA,KAFe,GAC6CK,OAAO,EACzDC,aAAa,EAAAG,aAAA,CA9GjB9C,qBAAqB,0BA8GgB4C,WAAW;MAGpD;;MAEA;AACF;AACA;IAFE;MAAApC,IAAA;MAAAuC,MAAA;MAAAtC,GAAA;MAAAC,KAAA,EAGA,SAAAA,CAAA,EAA+B;QAC7B,OAAO,GAAGX,SAAS,gCAAgC;MACrD;IAAC;MAAAS,IAAA;MAAAuC,MAAA;MAAAtC,GAAA;MAAAC,MAAA;QAAA,OAEehB,MAAM;MAAA;IAAA;EAAA;AAAA,GA1HYJ,iBAAiB,CAACC,mBAAmB,CAAC;AA6H1E,eAAeS,qBAAqB","ignoreList":[]}
1
+ {"version":3,"file":"masthead-menu-button.js","names":["classMap","html","property","query","state","HostListener","HostListenerMixin","CDSHeaderMenuButton","settings","focuswrap","styles","carbonElement","customElement","prefix","stablePrefix","c4dPrefix","C4DMastheadMenuButton","_decorate","_initialize","_HostListenerMixin","constructor","args","F","d","kind","key","value","decorators","event","detail","active","undefined","_hasSearchActive","hideMenuButton","reflect","type","Boolean","attribute","focus","_buttonNode","buttonNode","firstUpdated","boundHideButton","hideButtonIfNoNavItemsFound","bind","window","addEventListener","updated","changedProperties","has","_startSentinelNode","startSentinelNode","_endSentinelNode","endSentinelNode","_hFocusWrap","shadowRoot","release","_this$closest","NavMenuItems","closest","querySelectorAll","length","style","display","side","_t","_","render","hasSearchActive","_renderSentinel","renderSentinel","classes","startSentinel","endSentinel","_t2","_superPropGet","static"],"sources":["components/masthead/masthead-menu-button.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 { classMap } from 'lit/directives/class-map.js';\nimport { html } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport HostListener from '@carbon/web-components/es/globals/decorators/host-listener.js';\nimport HostListenerMixin from '@carbon/web-components/es/globals/mixins/host-listener.js';\nimport CDSHeaderMenuButton from '@carbon/web-components/es/components/ui-shell/header-menu-button.js';\nimport settings from '@carbon/ibmdotcom-utilities/es/utilities/settings/settings.js';\nimport focuswrap from '@carbon/ibmdotcom-utilities/es/utilities/focuswrap/focuswrap.js';\nimport Handle from '../../globals/internal/handle';\nimport styles from './masthead.scss';\nimport { carbonElement as customElement } from '@carbon/web-components/es/globals/decorators/carbon-element.js';\n\nconst { prefix, stablePrefix: c4dPrefix } = settings;\n\n/**\n * Toggle button for masthead left nav.\n *\n * @element c4d-masthead-menu-button\n * @csspart sentinel-button - The sentinel button for managing focus.\n * @csspart ce-header-menu-trigger-container - Container for the menu trigger button.\n * @csspart sentinel-button--start - The start sentinel button for managing focus. Usage: `c4d-masthead-menu-button::part(sentinel-button--start)`\n * @csspart sentinel-button--end - The end sentinel button for managing focus. Usage: `c4d-masthead-menu-button::part(sentinel-button--end)`\n */\n@customElement(`${c4dPrefix}-masthead-menu-button`)\nclass C4DMastheadMenuButton extends HostListenerMixin(CDSHeaderMenuButton) {\n /**\n * The handle for focus wrapping.\n */\n private _hFocusWrap: Handle | null = null;\n\n /**\n * Search bar opened flag.\n */\n @state()\n private _hasSearchActive = false;\n\n /**\n * Handles toggle event from the search component.\n *\n * @param event The event.\n */\n @HostListener('parentRoot:eventToggleSearch')\n // @ts-ignore: The decorator refers to this method but TS thinks this method is not referred to\n private _handleSearchToggle = (event: Event) => {\n if ((event as CustomEvent).detail.active !== undefined) {\n this._hasSearchActive = (event as CustomEvent).detail.active;\n this.hideMenuButton = (event as CustomEvent).detail.active;\n }\n };\n\n /**\n * Node to track focus going outside of modal content.\n */\n @query('#start-sentinel')\n private _startSentinelNode!: HTMLAnchorElement;\n\n /**\n * Node to track focus going outside of modal content.\n */\n @query('#end-sentinel')\n private _endSentinelNode!: HTMLAnchorElement;\n\n /**\n * The `<button>`.\n */\n @query(`.${prefix}--header__menu-trigger`)\n private _buttonNode!: HTMLButtonElement;\n\n /**\n * The shadow slot this toggle button should be in.\n */\n @property({ reflect: true })\n slot = 'brand';\n\n /**\n * `true` to hide the logo at render\n */\n @property({ type: Boolean, reflect: true, attribute: 'hide-menu-button' })\n hideMenuButton = false;\n\n focus() {\n const { _buttonNode: buttonNode } = this;\n if (buttonNode) {\n buttonNode.focus();\n }\n }\n firstUpdated() {\n const boundHideButton = this.hideButtonIfNoNavItemsFound.bind(this);\n window.addEventListener(`load`, () => {\n boundHideButton();\n });\n }\n updated(changedProperties) {\n if (changedProperties.has('active')) {\n const {\n active,\n _startSentinelNode: startSentinelNode,\n _endSentinelNode: endSentinelNode,\n } = this;\n if (active) {\n this._hFocusWrap = focuswrap(this.shadowRoot!, [\n startSentinelNode,\n endSentinelNode,\n ]);\n } else if (this._hFocusWrap) {\n this._hFocusWrap = this._hFocusWrap.release();\n }\n }\n\n if (changedProperties.has('hideMenuButton')) {\n this._hasSearchActive = this.hideMenuButton;\n }\n this.hideButtonIfNoNavItemsFound();\n }\n\n hideButtonIfNoNavItemsFound() {\n const NavMenuItems = this.closest(\n `${c4dPrefix}-masthead-container`\n )?.querySelectorAll(`${c4dPrefix}-left-nav-menu`);\n if (!NavMenuItems?.length) {\n this.hideMenuButton = true;\n this.style.display = 'none';\n } else if (this.style.display == 'none') {\n this.hideMenuButton = false;\n this.style.display = '';\n }\n }\n\n private _renderSentinel = (side: String) => {\n return html`\n <button\n part=\"sentinel-button sentinel-button--${side}\"\n id=\"${side}-sentinel\"\n type=\"button\"\n class=\"${prefix}--visually-hidden\"></button>\n `;\n };\n\n render() {\n const {\n active,\n _hasSearchActive: hasSearchActive,\n _renderSentinel: renderSentinel,\n } = this;\n const classes = classMap({\n [`${c4dPrefix}-ce--header__menu-trigger__container`]: true,\n [`${c4dPrefix}-ce--header__menu-trigger__container--has-search-active`]:\n hasSearchActive,\n });\n const startSentinel = active ? renderSentinel('start') : '';\n const endSentinel = active ? renderSentinel('end') : '';\n return html`\n <div part=\"ce-header-menu-trigger-container\" class=\"${classes}\">\n ${startSentinel}${super.render()}${endSentinel}\n </div>\n `;\n }\n\n /**\n * The name of the custom event fired after the seach is toggled.\n */\n static get eventToggleSearch() {\n return `${c4dPrefix}-search-with-typeahead-toggled`;\n }\n\n static styles = styles; // `styles` here is a `CSSResult` generated by custom WebPack loader\n}\n\nexport default C4DMastheadMenuButton;\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,QAAQ,6BAA6B;AACtD,SAASC,IAAI,QAAQ,KAAK;AAC1B,SAASC,QAAQ,EAAEC,KAAK,EAAEC,KAAK,QAAQ,mBAAmB;AAC1D,OAAOC,YAAY,MAAM,+DAA+D;AACxF,OAAOC,iBAAiB,MAAM,2DAA2D;AACzF,OAAOC,mBAAmB,MAAM,qEAAqE;AACrG,OAAOC,QAAQ,MAAM,+DAA+D;AACpF,OAAOC,SAAS,MAAM,iEAAiE;AAEvF,OAAOC,MAAM,MAAM,qBAAiB;AACpC,SAASC,aAAa,IAAIC,aAAa,QAAQ,gEAAgE;AAE/G,MAAM;EAAEC,MAAM;EAAEC,YAAY,EAAEC;AAAU,CAAC,GAAGP,QAAQ;;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AARA,IAUMQ,qBAAqB,GAAAC,SAAA,EAD1BL,aAAa,CAAC,GAAGG,SAAS,uBAAuB,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