-
Notifications
You must be signed in to change notification settings - Fork 89
feat(dropdown): add component tokens #11465
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
Changes from all commits
b8f3693
ba0cdf8
e3cf95f
0f12334
f40a89a
9fb51de
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 |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| export const CSS = { | ||
| title: "dropdown-title", | ||
| separator: "dropdown-separator", | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,25 @@ | ||
| /** | ||
| * CSS Custom Properties | ||
| * | ||
| * These properties can be overridden using the component's tag as selector. | ||
| * | ||
| * @prop --calcite-dropdown-item-background-color-hover: Specifies the background color of the dropdown item when hovered. | ||
| * @prop --calcite-dropdown-item-background-color-press: Specifies the background color of the dropdown item when selected or active. | ||
| * @prop --calcite-dropdown-item-icon-color-hover: Specifies the color of the dropdown item icon when hovered. | ||
|
Contributor
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. Nitpick: It does seem like having a "base" for There could be a need to have those be distinct and independent from other overrides like the selection icon color, but we can add as requested!
Contributor
Author
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. I agree but I think we should wait for our customers to tell us.
Member
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. While testing the CSS variables/tokens I'm also observing the same. This seems odd, and when I read the CSS variable I assumed it was related to the |
||
| * @prop --calcite-dropdown-item-icon-color-press: Specifies the color of the dropdown item icons when selected or active. | ||
| * @prop --calcite-dropdown-item-text-color-press: Specifies the color of the dropdown item text when selected or active. | ||
|
Member
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. @alisonailea It seems this also pertains to on hover, is that expected? |
||
| * @prop --calcite-dropdown-item-text-color: Specifies the color of the dropdown item text. | ||
| */ | ||
|
|
||
| @mixin item-styling { | ||
| @apply text-color-3 | ||
| relative | ||
| @apply relative | ||
| flex | ||
| flex-grow | ||
| cursor-pointer | ||
| items-center | ||
| no-underline; | ||
|
|
||
| color: var(--calcite-dropdown-item-text-color, var(--calcite-color-text-3)); | ||
| } | ||
|
|
||
| :host { | ||
|
|
@@ -88,39 +102,48 @@ | |
| :host(:focus) { | ||
| .container { | ||
| @apply focus-inset text-color-1 no-underline; | ||
| color: var(--calcite-dropdown-item-text-color-press, var(--calcite-color-text-1)); | ||
| } | ||
| } | ||
|
|
||
| :host(:hover:not([disabled])) { | ||
| .container { | ||
| background-color: var(--calcite-dropdown-item-background-color-hover, var(--calcite-color-foreground-2)); | ||
| } | ||
| } | ||
|
|
||
| :host(:active:not([disabled])) .container { | ||
| background-color: var(--calcite-dropdown-item-background-color-press, var(--calcite-color-foreground-3)); | ||
| } | ||
|
|
||
| :host(:hover:not([disabled])), | ||
| :host(:active:not([disabled])) { | ||
| .container { | ||
| @apply bg-foreground-2 text-color-1 no-underline; | ||
| @apply no-underline; | ||
| color: var(--calcite-dropdown-item-text-color-press, var(--calcite-color-text-1)); | ||
| } | ||
|
|
||
| .dropdown-link { | ||
| @apply text-color-1; | ||
| color: var(--calcite-dropdown-item-text-color-press, var(--calcite-color-text-1)); | ||
| } | ||
| } | ||
|
|
||
| :host(:active:not([disabled])) .container { | ||
| @apply bg-foreground-3; | ||
| } | ||
|
|
||
| :host([selected]) .container:not(.container--none-selection), | ||
| :host([selected]) .dropdown-link { | ||
| @apply text-color-1 font-medium; | ||
| & calcite-icon { | ||
| color: theme("backgroundColor.brand"); | ||
| @apply font-medium; | ||
| color: var(--calcite-dropdown-item-text-color-press, var(--calcite-color-text-1)); | ||
|
|
||
| calcite-icon { | ||
| color: var(--calcite-dropdown-item-icon-color-press, var(--calcite-color-brand)); | ||
| } | ||
| } | ||
|
|
||
| :host(:hover:not([disabled])) .dropdown-item-icon { | ||
| color: theme("borderColor.color.1"); | ||
| color: var(--calcite-dropdown-item-icon-color-hover, var(--calcite-color-border-1)); | ||
| @apply opacity-100; | ||
| } | ||
|
|
||
| :host([selected]) .dropdown-item-icon { | ||
| color: theme("backgroundColor.brand"); | ||
| @apply opacity-100; | ||
| } | ||
|
|
||
|
|
||
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.
🧹