diff --git a/packages/calcite-components/src/components.d.ts b/packages/calcite-components/src/components.d.ts index 7945bf6f34b..20763a2c1a0 100644 --- a/packages/calcite-components/src/components.d.ts +++ b/packages/calcite-components/src/components.d.ts @@ -5255,7 +5255,7 @@ export namespace Components { } interface CalciteTileGroup { /** - * Specifies the alignment of each Tile's content. + * Specifies the alignment of each `calcite-tile`'s content. */ "alignment": Exclude; /** @@ -13155,7 +13155,7 @@ declare namespace LocalJSX { } interface CalciteTileGroup { /** - * Specifies the alignment of each Tile's content. + * Specifies the alignment of each `calcite-tile`'s content. */ "alignment"?: Exclude; /** diff --git a/packages/calcite-components/src/components/panel/panel.scss b/packages/calcite-components/src/components/panel/panel.scss index b7bdfc5d1b1..10426a64731 100644 --- a/packages/calcite-components/src/components/panel/panel.scss +++ b/packages/calcite-components/src/components/panel/panel.scss @@ -18,6 +18,25 @@ @import "../../assets/styles/header"; +:host([scale="s"]) .content-top { + padding: var(--calcite-spacing-sm); +} + +:host([scale="m"]) .content-top { + padding: var(--calcite-spacing-md); +} + +:host([scale="l"]) .content-top { + padding: var(--calcite-spacing-xl); +} + +.content-top { + @apply flex items-start self-stretch; + + padding: var(--calcite-spacing-md); + border-block-start: 1px solid var(--calcite-color-border-3); +} + .container { @apply bg-background m-0 flex w-full flex-auto flex-col items-stretch p-0; @@ -31,8 +50,7 @@ } .header { - @apply bg-foreground-1 flex flex-col - z-header; + @apply bg-foreground-1 flex flex-col z-header; border-block-end: var(--calcite-panel-header-border-block-end, 1px solid var(--calcite-color-border-3)); } diff --git a/packages/calcite-components/src/components/panel/panel.stories.ts b/packages/calcite-components/src/components/panel/panel.stories.ts index 504a4ba9dd5..b7ff09275df 100644 --- a/packages/calcite-components/src/components/panel/panel.stories.ts +++ b/packages/calcite-components/src/components/panel/panel.stories.ts @@ -440,3 +440,22 @@ export const withNoHeaderBorderBlockEnd_TestOnly = (): string => html`Slotted content!`; + +export const contentTopSlot = (): string => html` +
+ + + + + + +
Slot for a content-top.
+
Header!
+

Slotted content!

+

Hello world!

+

Hello world!

+

Hello world!

+

Slotted content!

+
+
+`; diff --git a/packages/calcite-components/src/components/panel/panel.tsx b/packages/calcite-components/src/components/panel/panel.tsx index 5256b4bad6d..6e2bb402e2b 100644 --- a/packages/calcite-components/src/components/panel/panel.tsx +++ b/packages/calcite-components/src/components/panel/panel.tsx @@ -48,6 +48,7 @@ import { CSS, ICONS, SLOTS } from "./resources"; /** * @slot - A slot for adding custom content. * @slot action-bar - A slot for adding a `calcite-action-bar` to the component. + * @slot content-top - A slot for adding content above the unnamed (default) slot and below the action-bar slot (if populated). * @slot header-actions-start - A slot for adding actions or content to the start side of the header. * @slot header-actions-end - A slot for adding actions or content to the end side of the header. * @slot header-content - A slot for adding custom content to the header. @@ -207,6 +208,8 @@ export class Panel @State() hasActionBar = false; + @State() hasContentTop = false; + @State() hasFooterContent = false; @State() hasFooterActions = false; @@ -328,6 +331,10 @@ export class Panel this.hasFab = slotChangeHasAssignedElement(event); }; + private contentTopSlotChangeHandler = (event: Event): void => { + this.hasContentTop = slotChangeHasAssignedElement(event); + }; + // -------------------------------------------------------------------------- // // Methods @@ -540,6 +547,7 @@ export class Panel {this.renderHeaderActionsEnd()} {this.renderActionBar()} + {this.renderContentTop()} ); } @@ -585,6 +593,14 @@ export class Panel ); } + renderContentTop(): VNode { + return ( + + ); + } + renderFab(): VNode { return ( - +
-
Slotted Action Bar
+
Slotted Action Bar + Slotted Content Top
-
+
@@ -74,6 +74,7 @@ +
Slot for a content-top.
Header!

Slotted content!

Hello world!