-
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(select): add component tokens #11178
Changes from 4 commits
6f54e5a
41b200a
6b09078
66f7da5
4e50a5f
e98c980
6f6414c
2ea35f7
d59c12e
7220966
86f12ea
d327a85
265739a
129c50a
e40c178
9e36943
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 |
---|---|---|
|
@@ -3,49 +3,54 @@ | |
* | ||
* These properties can be overridden using the component's tag as selector. | ||
* | ||
* @prop --calcite-select-font-size: The font size of `calcite-option`s in the component. | ||
* @prop --calcite-select-spacing: The padding around the selected option text. | ||
* @prop --calcite-select-text-color: The text color of the component. | ||
* @prop --calcite-select-font-size: Specifies the font size of `calcite-option`s in the component. | ||
* @prop --calcite-select-text-weight: Specifies the font weight of `calcite-option`s in the component. | ||
* @prop --calcite-select-spacing-inline: Specifies the inline padding of `calcite-option`s in the component. | ||
* @prop --calcite-select-text-color: Specifies the text color of `calcite-option`s in the component. | ||
* @prop --calcite-select-size: Specifies the component's width. | ||
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 don't think we need this one, as the user can specify this on the element itself. |
||
* @prop --calcite-select-block-size: Specifies the component's height. | ||
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 don't think we need this one, as the user can specify this on the element itself. |
||
* @prop --calcite-select-border-color: Specifies the component's border color. | ||
* @prop --calcite-select-icon-color: Specifies the component's icon color. | ||
* @prop --calcite-select-icon-color-hover: Specifies the component's icon color when hovered or active. | ||
*/ | ||
|
||
:host { | ||
@extend %component-spacing; | ||
@apply flex flex-col; | ||
font-size: var(--calcite-select-font-size); | ||
font-weight: var(--calcite-internal-select-font-weight, var(--calcite-font-weight-regular)); | ||
} | ||
|
||
.wrapper { | ||
@apply relative flex items-stretch; | ||
inline-size: var(--select-width); | ||
block-size: var(--calcite-internal-select-block-size, #{$calcite-size-32}); | ||
inline-size: var(--calcite-select-size); | ||
block-size: var(--calcite-select-block-size, var(--calcite-internal-select-block-size)); | ||
&:focus-within, | ||
&:active, | ||
&:hover { | ||
.icon { | ||
color: var(--calcite-color-text-1); | ||
color: var(--calcite-select-icon-color-hover, var(--calcite-color-text-1)); | ||
} | ||
} | ||
} | ||
|
||
@include disabled(); | ||
|
||
:host([scale="s"]) { | ||
--calcite-select-font-size: theme("fontSize.n2h"); | ||
--calcite-select-spacing-inline: theme("spacing.2") theme("spacing.8"); | ||
--calcite-internal-font-size: theme("fontSize.n2h"); | ||
--calcite-internal-spacing-inline: theme("spacing.2") theme("spacing.8"); | ||
--calcite-internal-select-icon-container-padding-inline: var(--calcite-spacing-sm); | ||
--calcite-internal-select-block-size: #{$calcite-size-24}; | ||
} | ||
|
||
:host([scale="m"]) { | ||
--calcite-select-font-size: theme("fontSize.n1h"); | ||
--calcite-select-spacing-inline: theme("spacing.3") theme("spacing.10"); | ||
--calcite-internal-font-size: theme("fontSize.n1h"); | ||
--calcite-internal-spacing-inline: theme("spacing.3") theme("spacing.10"); | ||
--calcite-internal-select-icon-container-padding-inline: var(--calcite-spacing-md); | ||
--calcite-internal-select-block-size: #{$calcite-size-32}; | ||
} | ||
|
||
:host([scale="l"]) { | ||
--calcite-select-font-size: theme("fontSize.0h"); | ||
--calcite-select-spacing-inline: theme("spacing.4") theme("spacing.12"); | ||
--calcite-internal-font-size: theme("fontSize.0h"); | ||
--calcite-internal-spacing-inline: theme("spacing.4") theme("spacing.12"); | ||
--calcite-internal-select-icon-container-padding-inline: var(--calcite-spacing-lg); | ||
--calcite-internal-select-block-size: #{$calcite-size-44}; | ||
} | ||
|
@@ -64,8 +69,6 @@ | |
|
||
.select { | ||
@apply bg-foreground-1 | ||
border-color-input | ||
text-color-2 | ||
font-inherit | ||
focus-base | ||
m-0 | ||
|
@@ -76,11 +79,12 @@ | |
truncate | ||
rounded-none | ||
border-solid; | ||
font-size: inherit; | ||
font-weight: inherit; | ||
font-size: var(--calcite-select-font-size, var(--calcite-internal-font-size)); | ||
font-weight: var(--calcite-select-text-weight, var(--calcite-font-weight-regular)); | ||
color: var(--calcite-select-text-color, var(--calcite-color-text-2)); | ||
border-color: var(--calcite-select-border-color, var(--calcite-color-border-input)); | ||
border-width: var(--calcite-select-internal-border-width, var(--calcite-border-width-sm)); | ||
padding-inline: var(--calcite-select-spacing-inline); | ||
padding-inline: var(--calcite-select-spacing-inline, var(--calcite-internal-spacing-inline)); | ||
padding-block: var(--calcite-internal-select-spacing-block); | ||
border-inline-end-width: theme("borderWidth.0"); | ||
line-height: var(--calcite-select-line-height, normal); | ||
|
@@ -97,11 +101,12 @@ select:disabled { | |
.icon-container { | ||
@apply border-color-input text-color-2 pointer-events-none absolute inset-y-0 flex items-center border-0 border-solid bg-transparent; | ||
inset-inline-end: theme("inset.0"); | ||
border-color: var(--calcite-select-border-color, var(--calcite-color-border-input)); | ||
border-inline-width: theme("borderWidth.0") | ||
var(--calcite-select-internal-icon-border-inline-end-width, theme("borderWidth.DEFAULT")); | ||
padding-inline: var(--calcite-internal-select-icon-container-padding-inline); | ||
.icon { | ||
color: var(--calcite-color-text-3); | ||
color: var(--calcite-select-icon-color, var(--calcite-color-text-3)); | ||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { html } from "../../support/formatting"; | ||
|
||
export const selectTokens = { | ||
calciteSelectFontSize: "", | ||
calciteSelectTextWeight: "", | ||
calciteSelectSpacingInline: "", | ||
calciteSelectTextColor: "", | ||
calciteSelectSelectSize: "", | ||
calciteSelectBlockSize: "", | ||
calciteSelectBorderColor: "", | ||
calciteSelectIconColor: "", | ||
calciteSelectIconColorHover: "", | ||
}; | ||
|
||
export const select = html`<calcite-select> | ||
<calcite-option>uno</calcite-option> | ||
<calcite-option>dos</calcite-option> | ||
<calcite-option>tres</calcite-option> | ||
</calcite-select>`; |
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 one shouldn't be exposed.