-
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
feat(list, list-item, list-item-group): add component tokens #10669
Changes from 9 commits
d7d1467
fee41eb
e8410b9
d678ee7
7f8c748
429b7b3
b528880
a753361
36c10cb
6a6ab2d
3effa15
4b18fee
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 |
---|---|---|
@@ -1,6 +1,21 @@ | ||
/** | ||
* CSS Custom Properties | ||
* | ||
* These properties can be overridden using the component's tag as selector. | ||
* | ||
* @prop --calcite-list-background-color-hover: Specifies the component's background color when hovered. | ||
* @prop --calcite-list-background-color-press: Specifies the component's background color when 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. Similar to above, does this need to be “list-item” - what hover would we actually be theming here on the parent? 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. we are limiting tokens when shared between grouped components. This is documented in the wiki. 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. Yeah it is a bit weird to be targeting the parent hovering when its really the items being hovered. |
||
* @prop --calcite-list-background-color: Specifies the component's background color. | ||
* @prop --calcite-list-item-border-color: Specifies the component's border color. | ||
* @prop --calcite-list-item-content-text-color: Specifies the content color. | ||
* @prop --calcite-list-item-description-text-color: Specifies the description color. | ||
* @prop --calcite-list-item-icon-color: Specifies the component's icon color. | ||
* @prop --calcite-list-item-label-text-color: Specifies the label color. | ||
* @prop --calcite-list-item-selection-border-color: Specifies the component's selection border color. | ||
*/ | ||
|
||
:host { | ||
@apply flex flex-col bg-foreground-1; | ||
--calcite-list-item-icon-color: theme("colors.brand"); | ||
@apply flex flex-col; | ||
} | ||
|
||
:host([filter-hidden]), | ||
|
@@ -9,28 +24,29 @@ | |
} | ||
|
||
.wrapper--bordered { | ||
border-block-end: 1px solid var(--calcite-color-border-3); | ||
border-block-end: 1px solid var(--calcite-list-item-border-color, var(--calcite-color-border-3)); | ||
} | ||
|
||
@include disabled(); | ||
|
||
.container { | ||
@apply bg-foreground-1 | ||
box-border | ||
@apply box-border | ||
flex | ||
flex-1 | ||
overflow-hidden; | ||
background-color: var(--calcite-list-background-color, var(--calcite-color-foreground-1)); | ||
* { | ||
@apply box-border; | ||
} | ||
} | ||
|
||
.container--hover:hover { | ||
@apply bg-foreground-2 cursor-pointer; | ||
@apply cursor-pointer; | ||
background-color: var(--calcite-list-background-color-hover, var(--calcite-color-foreground-2)); | ||
} | ||
|
||
.container:active { | ||
@apply bg-foreground-1; | ||
background-color: var(--calcite-list-background-color-press, var(--calcite-color-foreground-1)); | ||
} | ||
|
||
.container--border { | ||
|
@@ -39,7 +55,7 @@ | |
} | ||
|
||
.container--border-selected { | ||
border-inline-start-color: theme("colors.brand"); | ||
border-inline-start-color: var(--calcite-list-item-selection-border-color, var(--calcite-color-brand)); | ||
} | ||
|
||
.container--border-unselected { | ||
|
@@ -48,16 +64,15 @@ | |
|
||
.container:hover { | ||
&.container--border-unselected { | ||
@apply border-color-1; | ||
border-inline-start-color: var(--calcite-list-item-selection-border-color, var(--calcite-color-border-1)); | ||
} | ||
} | ||
|
||
.nested-container { | ||
@apply hidden flex-col | ||
border-solid | ||
border-0 | ||
border-color-3; | ||
|
||
border-0; | ||
border-color: 1px solid var(--calcite-list-item-border-color, var(--calcite-color-border-3)); | ||
margin-inline-start: var(--calcite-list-item-spacing-indent, theme("spacing.6")); | ||
} | ||
|
||
|
@@ -66,13 +81,13 @@ | |
} | ||
|
||
.content-container { | ||
@apply text-color-2 | ||
select-none | ||
@apply select-none | ||
flex | ||
flex-auto | ||
font-normal | ||
items-stretch | ||
p-0; | ||
color: var(--calcite-list-item-content-text-color, var(--calcite-color-text-2)); | ||
} | ||
|
||
.content-container--unavailable { | ||
|
@@ -114,19 +129,20 @@ | |
} | ||
|
||
.label { | ||
@apply text-color-1; | ||
color: var(--calcite-list-item-label-text-color, var(--calcite-color-text-1)); | ||
} | ||
|
||
:host([selected]) .label { | ||
@apply font-medium; | ||
} | ||
|
||
.description { | ||
@apply text-color-3 mt-0.5; | ||
@apply mt-0.5; | ||
color: var(--calcite-list-item-description-text-color, var(--calcite-color-text-3)); | ||
} | ||
|
||
:host([selected]) .description { | ||
@apply text-color-2; | ||
color: var(--calcite-list-item-description-text-color, var(--calcite-color-text-2)); | ||
} | ||
|
||
.content-start { | ||
|
@@ -157,7 +173,7 @@ | |
|
||
.selection-container { | ||
@apply flex py-0; | ||
color: theme("borderColor.color.input"); | ||
color: var(--calcite-list-item-icon-color, var(--calcite-color-border-input)); | ||
padding-inline: var(--calcite-spacing-md) var(--calcite-spacing-xxs); | ||
} | ||
|
||
|
@@ -166,21 +182,21 @@ | |
} | ||
|
||
:host(:not([disabled]):not([selected])) .container:hover .selection-container--single { | ||
color: theme("borderColor.color.1"); | ||
color: var(--calcite-list-item-icon-color, var(--calcite-color-border-1)); | ||
} | ||
|
||
:host([selected]:hover) .selection-container, | ||
:host([selected]:hover) .selection-container--single, | ||
:host([selected]) .selection-container { | ||
color: var(--calcite-list-item-icon-color); | ||
color: var(--calcite-list-item-icon-color, var(--calcite-color-brand)); | ||
} | ||
|
||
.open-container { | ||
color: theme("textColor.color.3"); | ||
color: var(--calcite-list-item-icon-color, var(--calcite-color-text-3)); | ||
} | ||
|
||
:host(:not([disabled])) .container:hover .open-container { | ||
color: theme("textColor.color.1"); | ||
color: var(--calcite-list-item-icon-color, var(--calcite-color-text-1)); | ||
} | ||
|
||
.actions-start, | ||
|
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.
I’d expect to support “—calcite-list-item-background-color” as well.
Consider this use case which is representative of how most of our users want to theme: https://community.esri.com/t5/calcite-design-system-questions/change-listitem-background-color-in-code/m-p/1557125#M767
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.
We are limiting tokens when shared between grouped components. This is documented in the wiki.
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.
How is this different than Accordion Item / Accordion - where we have
-item-background-color
? #10181There 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.
Yeah I was wondering this as well. There are some inconsistencies here
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.
@alisonailea can you comment on the above? Currently, it seems like parent/child tokens are inconsistent.
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.
The “item tokens” path seems the easiest to follow both as a maintainer (IMO) and as someone who uses these theming options frequently day to day.
Using the Community post as just one example, it also seems to align with expectations from external folks - theming the element you want to adjust with component-specific nomenclature / rules.
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.
Need direction on this one. @alisonailea