Skip to content

Commit

Permalink
feat(panel): add '--calcite-panel-content-space' style (#10117)
Browse files Browse the repository at this point in the history
**Related Issue:** #10119

## Summary

- add `--calcite-panel-content-space` style.
- adds `relative` positioning to content so that absolutely positioned
elements are contained within the panel content. (shell use case)
- add e2e test

This will allow the dialog component to set padding on the content of
the internal panel without having to surround the content with a div
which messes up the placement of the FAB within panel.
  • Loading branch information
driskull authored Aug 21, 2024
1 parent 142e519 commit 0e3ebcb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
10 changes: 10 additions & 0 deletions packages/calcite-components/src/components/panel/panel.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
renders,
slots,
t9n,
themed,
} from "../../tests/commonTests";
import { GlobalTestProps } from "../../tests/utils";
import { CSS, SLOTS } from "./resources";
Expand Down Expand Up @@ -501,4 +502,13 @@ describe("calcite-panel", () => {
expect(await container.isVisible()).toBe(true);
expect(calcitePanelClose).toHaveReceivedEventTimes(0);
});

describe("theme", () => {
themed(html`<calcite-panel collapsible closable>scrolling content</calcite-panel>`, {
"--calcite-panel-content-space": {
shadowSelector: `.${CSS.contentWrapper}`,
targetProp: "padding",
},
});
});
});
5 changes: 4 additions & 1 deletion packages/calcite-components/src/components/panel/panel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*
* These properties can be overridden using the component's tag as selector.
*
* @prop --calcite-panel-content-space: Specifies the padding of the component's content.
* @prop --calcite-panel-footer-padding: Specifies the padding of the component's footer.
* @prop --calcite-panel-header-border-block-end: Specifies the component header's block end border.
*/
Expand Down Expand Up @@ -167,7 +168,9 @@
bg-background
overflow-auto
h-full
focus-base;
focus-base
relative;
padding: var(--calcite-panel-content-space, 0);
}

.content-wrapper:focus {
Expand Down

0 comments on commit 0e3ebcb

Please sign in to comment.