-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(panel): apply custom styles correctly to header actions #11495
Changes from all commits
2b314be
1af7a1c
ca25807
9e588ac
b6da073
68b10a9
f9ba8db
b2bfdc8
268be2b
dd6a471
dd25cc8
c9510fc
5a4b35d
fe9aecd
e4f8ad1
b208eeb
4047849
a8d3351
6b2862d
6c543b2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,31 +9,26 @@ | |
* @prop --calcite-panel-border-color: Specifies the component's border color. | ||
* @prop --calcite-panel-background-color: Specifies the component's background color. | ||
* @prop --calcite-panel-header-background-color: Specifies the background color of the component's header. | ||
* @prop --calcite-panel-header-action-background-color: Specifies the background color of Panel's `closable`, `collapsible`, and elements slotted in `header-menu-actions`. | ||
* @prop --calcite-panel-header-action-background-color-hover: Specifies the background color of Panel's `closable`, `collapsible`, and elements slotted in `header-menu-actions` when hovered. | ||
* @prop --calcite-panel-header-action-background-color-press: Specifies the background color of Panel's `closable`, `collapsible`, and elements slotted in `header-menu-actions` when pressed. | ||
* @prop --calcite-panel-header-action-text-color: Specifies the text color of Panel's `closable`, `collapsible`, and elements slotted in `header-menu-actions`. | ||
* @prop --calcite-panel-header-action-text-color-press: Specifies the text color of Panel's `closable`, `collapsible`, and elements slotted in `header-menu-actions` when pressed. | ||
* @prop --calcite-panel-footer-background-color: Specifies the background color of the component's footer. | ||
* @prop --calcite-panel-space: Specifies the padding of the component's `"unnamed (default)"` slot. | ||
* @prop --calcite-panel-header-content-space: Specifies the padding of the `"header-content"` slot. | ||
* @prop --calcite-panel-footer-space: Specifies the padding of the component's footer. | ||
* @prop --calcite-action-background-color: Specifies the background color of the component's `closable`, `collapsible`, and `back` `calcite-action`s. Applies to any slotted `calcite-action`s. | ||
* @prop --calcite-action-background-color-hover: Specifies the background color of the component's `closable`, `collapsible`, and `back` `calcite-action`s when hovered. Applies to any slotted `calcite-action`s. | ||
* @prop --calcite-action-background-color-pressed: Specifies the background color of the component's `closable`, `collapsible`, and `back` `calcite-action`s when pressed. Applies to any slotted `calcite-action`s. | ||
* @prop --calcite-action-text-color-hover: Specifies the text and icon color of the component's `closable`, `collapsible`, and `back` `calcite-action`s when hovered. Applies to any slotted `calcite-action`s. | ||
* @prop --calcite-action-text-color-pressed: Specifies the text and icon color of the component's `closable`, `collapsible`, and `back` `calcite-action`s when pressed. Applies to any slotted `calcite-action`s. | ||
* @prop --calcite-popover-border-color: Specifies the border color of the component's internally rendered `calcite-popover`, which is rendered within a `calcite-action` menu when slotted `calcite-action`s are present in the `header-actions-end` slot. Applies to any slotted `calcite-popover`s. | ||
* @prop --calcite-panel-content-space: [Deprecated] Use `--calcite-panel-space` instead. Specifies the padding of the component's content. | ||
* @prop --calcite-panel-footer-padding: [Deprecated] Use `--calcite-panel-footer-space` instead. Specifies the padding of the component's footer. | ||
* @prop --calcite-panel-header-border-block-end: [Deprecated] Use `--calcite-panel-border-color` instead. Specifies the component header's block end border. | ||
* @prop --calcite-panel-header-action-background-color-hover: Specifies the background color of the component's `calcite-action` items in the panel header when hovered. | ||
alisonailea marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* @prop --calcite-panel-header-action-background-color-press: Specifies the background color of the component's `calcite-action` items in the panel header when pressed. | ||
* @prop --calcite-panel-header-action-background-color: Specifies the background color of the component's `calcite-action` items in the panel header. | ||
* @prop --calcite-panel-header-action-indicator-color: Specifies the color of the component's `calcite-action` items' indicator in the panel header. | ||
* @prop --calcite-panel-header-action-text-color-press: Specifies the text color of the component's `calcite-action` items in the panel header when pressed. | ||
* @prop --calcite-panel-header-action-text-color: Specifies the text color of the component's `calcite-action` items in the panel header. | ||
*/ | ||
|
||
:host { | ||
@apply relative flex w-full h-full flex-auto overflow-hidden box-border; | ||
|
||
--calcite-min-header-height: calc(var(--calcite-icon-size) * 3); | ||
border-radius: var(--calcite-panel-corner-radius, var(--calcite-corner-radius-sharp)); | ||
} | ||
|
||
@include disabled(); | ||
|
@@ -98,7 +93,6 @@ | |
transition: | ||
max-block-size var(--calcite-animation-timing), | ||
inline-size var(--calcite-animation-timing); | ||
border-radius: var(--calcite-panel-corner-radius, var(--calcite-corner-radius-none)); | ||
box-sizing: border-box; | ||
font-size: var(--calcite-font-size--1); | ||
} | ||
|
@@ -113,8 +107,7 @@ | |
|
||
.header { | ||
@apply flex flex-col z-header; | ||
border-radius: var(--calcite-panel-corner-radius, var(--calcite-corner-radius-none)) | ||
var(--calcite-panel-corner-radius, var(--calcite-corner-radius-none)) 0 0; | ||
|
||
background-color: var(--calcite-panel-header-background-color, var(--calcite-color-foreground-1)); | ||
border-block-end: 1px solid | ||
var(--calcite-panel-border-color, var(--calcite-panel-header-border-block-end, var(--calcite-color-border-3))); | ||
|
@@ -149,15 +142,6 @@ | |
margin-inline-end: auto; | ||
justify-content: center; | ||
|
||
.header-actions { | ||
--calcite-action-background-color-hover: var(--calcite-panel-header-action-background-color-hover); | ||
--calcite-action-background-color-press: var(--calcite-panel-header-action-background-color-press); | ||
--calcite-action-background-color: var(--calcite-panel-header-action-background-color); | ||
--calcite-action-indicator-color: var(--calcite-panel-header-action-indicator-color); | ||
--calcite-action-text-color-press: var(--calcite-panel-header-action-text-color-press); | ||
--calcite-action-text-color: var(--calcite-panel-header-action-text-color); | ||
} | ||
|
||
.heading, | ||
.description { | ||
@apply block | ||
|
@@ -181,6 +165,17 @@ | |
} | ||
} | ||
|
||
#close, | ||
#collapse, | ||
.back-button, | ||
calcite-action-menu { | ||
--calcite-action-background-color: var(--calcite-panel-header-action-background-color); | ||
--calcite-action-background-color-hover: var(--calcite-panel-header-action-background-color-hover); | ||
--calcite-action-background-color-press: var(--calcite-panel-header-action-background-color-press); | ||
--calcite-action-text-color: var(--calcite-panel-header-action-text-color); | ||
--calcite-action-text-color-pressed: var(--calcite-panel-header-action-text-color-pressed); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No this is covered by the corner radius of the action containers. |
||
|
||
alisonailea marked this conversation as resolved.
Show resolved
Hide resolved
|
||
.back-button { | ||
@apply border-0 | ||
border-solid; | ||
|
@@ -199,24 +194,6 @@ | |
margin-inline-start: theme("margin.auto"); | ||
} | ||
|
||
#close, | ||
#collapse, | ||
.back-button, | ||
calcite-action-menu { | ||
} | ||
|
||
#close, | ||
#collapse, | ||
calcite-action-menu { | ||
&:last-child { | ||
--calcite-action-corner-radius-start-end: var(--calcite-panel-corner-radius); | ||
} | ||
} | ||
|
||
.back-button { | ||
--calcite-action-corner-radius-start-start: var(--calcite-panel-corner-radius); | ||
} | ||
|
||
.content-wrapper { | ||
@apply flex | ||
flex-auto | ||
|
@@ -257,8 +234,6 @@ calcite-action-menu { | |
var(--calcite-panel-footer-padding, var(--calcite-internal-panel-default-space)) | ||
); | ||
background-color: var(--calcite-panel-footer-background-color, var(--calcite-color-foreground-1)); | ||
border-radius: 0 0 var(--calcite-panel-corner-radius, var(--calcite-corner-radius-none)) | ||
var(--calcite-panel-corner-radius, var(--calcite-corner-radius-none)); | ||
} | ||
|
||
.footer-content { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { html } from "../../support/formatting"; | ||
|
||
export const panelTokens = { | ||
calcitePanelBackgroundColor: "", | ||
calcitePanelBorderColor: "", | ||
calcitePanelContentSpace: "", | ||
calcitePanelCornerRadius: "", | ||
calcitePanelDescriptionTextColor: "", | ||
calcitePanelFooterBackgroundColor: "", | ||
calcitePanelFooterSpace: "", | ||
calcitePanelHeaderActionBackgroundColorHover: "", | ||
calcitePanelHeaderActionBackgroundColorPress: "", | ||
calcitePanelHeaderActionBackgroundColor: "", | ||
calcitePanelHeaderActionTextColorPress: "", | ||
calcitePanelHeaderActionTextColor: "", | ||
calcitePanelHeaderBackgroundColor: "", | ||
calcitePanelHeaderContentSpace: "", | ||
calcitePanelHeadingTextColor: "", | ||
calcitePanelSpace: "", | ||
}; | ||
|
||
export const panel = html` | ||
<calcite-panel heading="Panel Heading" description="Panel description" closable collapsible> | ||
<calcite-action text="Action 1" text-enabled icon="icon1" slot="header-menu-actions"></calcite-action> | ||
<calcite-action text="Action 2" text-enabled icon="icon2" slot="header-menu-actions"></calcite-action> | ||
<calcite-action text="Action 3" icon="icon3" slot="header-actions-end"></calcite-action> | ||
<div slot="content-top">Content at the top</div> | ||
<calcite-label slot="content-bottom" layout="inline-space-between" style="--calcite-label-margin-bottom: 0"> | ||
<calcite-checkbox></calcite-checkbox>Agree to terms | ||
</calcite-label> | ||
<p> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante | ||
dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. | ||
</p> | ||
<calcite-button slot="footer-end">Done</calcite-button> | ||
</calcite-panel> | ||
`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't needed since
interaction-container
usesdisplay: contents
and doesn't produce a box.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For posterity: I restored this override as I was completely wrong on this one.
display: contents
doesn't have any effect on inheritance, so my suggestion broke styling.