Skip to content

Commit f3a26b6

Browse files
authored
fix(panel, flow-item): prevent footer slots from conflicting with each other (#9856)
**Related Issue:** #9855 ## Summary - prevent footer slots from conflicting - modify stories - add doc
1 parent 14f8cff commit f3a26b6

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

packages/calcite-components/src/components/flow-item/flow-item.stories.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,8 @@ export const footerPaddingAndContentBottom = (): string =>
234234
<div slot="header-content">Header!</div>
235235
<p>Slotted content!</p>
236236
<div slot="content-bottom">Content bottom!</div>
237-
<div slot="footer">Footer!</div>
237+
<calcite-button slot="footer" width="half" appearance="outline">Footer 1</calcite-button>
238+
<calcite-button slot="footer" width="half">Footer 2</calcite-button>
238239
</calcite-flow-item>
239240
</div>`;
240241

@@ -248,13 +249,14 @@ export const footerStartEndAndContentBottom = (): string =>
248249
</calcite-flow-item>
249250
</div>`;
250251

251-
export const footerSlotPrecedence = (): string =>
252+
export const footerSlotCoexistence = (): string =>
252253
html`<div style="width: 300px;">
253254
<calcite-flow-item height-scale="s" style="--calcite-flow-item-footer-padding: 20px;">
254255
<div slot="header-content">Header!</div>
255256
<p>Slotted content!</p>
256257
<div slot="content-bottom">Content bottom!</div>
257-
<div slot="footer">Footer!</div>
258+
<calcite-button slot="footer" width="half" appearance="outline">Footer 1</calcite-button>
259+
<calcite-button slot="footer" width="half">Footer 2</calcite-button>
258260
${footerHTML}
259261
</calcite-flow-item>
260262
</div>`;

packages/calcite-components/src/components/flow-item/flow-item.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ import { CSS, ICONS, SLOTS } from "./resources";
5252
* @slot header-content - A slot for adding custom content to the component's header.
5353
* @slot header-menu-actions - A slot for adding an overflow menu with `calcite-action`s inside a `calcite-dropdown`.
5454
* @slot fab - A slot for adding a `calcite-fab` (floating action button) to perform an action.
55-
* @slot footer - A slot for adding custom content to the component's footer.
55+
* @slot footer - A slot for adding custom content to the component's footer. Should not be used with the `"footer-start"` or `"footer-end"` slots.
5656
* @slot footer-actions - [Deprecated] Use the `"footer"` slot instead. A slot for adding `calcite-button`s to the component's footer.
57-
* @slot footer-end - A slot for adding a trailing footer custom content.
58-
* @slot footer-start - A slot for adding a leading footer custom content.
57+
* @slot footer-end - A slot for adding a trailing footer custom content. Should not be used with the `"footer"` slot.
58+
* @slot footer-start - A slot for adding a leading footer custom content. Should not be used with the `"footer"` slot.
5959
*/
6060
@Component({
6161
tag: "calcite-flow-item",
@@ -405,10 +405,9 @@ export class FlowItem
405405
<slot name={SLOTS.fab} slot={PANEL_SLOTS.fab} />
406406
<slot name={SLOTS.contentTop} slot={PANEL_SLOTS.contentTop} />
407407
<slot name={SLOTS.contentBottom} slot={PANEL_SLOTS.contentBottom} />
408-
<slot name={SLOTS.footer} slot={PANEL_SLOTS.footer}>
409-
<slot name={SLOTS.footerStart} slot={PANEL_SLOTS.footerStart} />
410-
<slot name={SLOTS.footerEnd} slot={PANEL_SLOTS.footerEnd} />
411-
</slot>
408+
<slot name={SLOTS.footerStart} slot={PANEL_SLOTS.footerStart} />
409+
<slot name={SLOTS.footer} slot={PANEL_SLOTS.footer} />
410+
<slot name={SLOTS.footerEnd} slot={PANEL_SLOTS.footerEnd} />
412411
<slot name={SLOTS.footerActions} slot={PANEL_SLOTS.footerActions} />
413412
<slot />
414413
</calcite-panel>

packages/calcite-components/src/components/panel/panel.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ import { CSS, ICONS, SLOTS } from "./resources";
5858
* @slot header-content - A slot for adding custom content to the header.
5959
* @slot header-menu-actions - A slot for adding an overflow menu with actions inside a `calcite-dropdown`.
6060
* @slot fab - A slot for adding a `calcite-fab` (floating action button) to perform an action.
61-
* @slot footer - A slot for adding custom content to the component's footer.
61+
* @slot footer - A slot for adding custom content to the component's footer. Should not be used with the `"footer-start"` or `"footer-end"` slots.
6262
* @slot footer-actions - [Deprecated] Use the `footer-start` and `footer-end` slots instead. A slot for adding `calcite-button`s to the component's footer.
63-
* @slot footer-end - A slot for adding a trailing footer custom content.
64-
* @slot footer-start - A slot for adding a leading footer custom content.
63+
* @slot footer-end - A slot for adding a trailing footer custom content. Should not be used with the `"footer"` slot.
64+
* @slot footer-start - A slot for adding a leading footer custom content. Should not be used with the `"footer"` slot.
6565
*/
6666
@Component({
6767
tag: "calcite-panel",
@@ -620,10 +620,9 @@ export class Panel
620620

621621
return (
622622
<footer class={CSS.footer} hidden={!showFooter}>
623-
<slot name={SLOTS.footer} onSlotchange={this.handleFooterSlotChange}>
624-
<slot name={SLOTS.footerStart} onSlotchange={this.handleFooterStartSlotChange} />
625-
<slot name={SLOTS.footerEnd} onSlotchange={this.handleFooterEndSlotChange} />
626-
</slot>
623+
<slot name={SLOTS.footerStart} onSlotchange={this.handleFooterStartSlotChange} />
624+
<slot name={SLOTS.footer} onSlotchange={this.handleFooterSlotChange} />
625+
<slot name={SLOTS.footerEnd} onSlotchange={this.handleFooterEndSlotChange} />
627626
<slot
628627
key="footer-actions-slot"
629628
name={SLOTS.footerActions}

0 commit comments

Comments
 (0)