-
Notifications
You must be signed in to change notification settings - Fork 79
feat(input-text): add component tokens #12242
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
Conversation
packages/calcite-components/src/components/input-text/input-text.scss
Outdated
Show resolved
Hide resolved
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 changes look good. My comments are mostly regarding naming consistency and the height var.
@@ -3,8 +3,27 @@ | |||
* | |||
* These properties can be overridden using the component's tag as selector. | |||
* | |||
* @prop --calcite-input-prefix-size: Specifies the component's prefix width. | |||
* @prop --calcite-input-suffix-size: Specifies the component's suffix width. | |||
* @prop --calcite-input-actions-background-color: Specifies the background color of the component's `clearable` element. |
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.
Not really related but should --calcite-input-actions
be --calcite-input-action
? I'm not sure why actions
is plural here since we're referencing a component. I don't think we do -icons-
in other places where more than one icon is present.
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.
Good Point. This is chosen to match existing naming patterns. Both input
& input-number
uses this pattern for tokens. Though input, input-number have multiple action elements, input-text has only one.
--calcite-input-action
makes sense here. Should this be changed in other places too?
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.
Should this be changed in other places too?
It would be nice but it would mean deprecating and then removing later if they have already been released. I'd like to hear from @jcfranco on if we should rename them. We may need to update our guidelines to not have tokens representing other components to be plural.
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.
Agreed on avoiding plurals in naming when possible. A nice side benefit is that it avoids having to rename if the prop target shifts between one and many.
In terms of this PR, input-text
can use the revised slot names. We can deprecate the existing ones in a follow-up PR aimed at 25.R3, which will be removed in 4.0 (26.R1). cc @geospatialem @DitwanP @isaacbraun
Worth noting that autocomplete
and filter
also use similarly named props.
We may need to update our guidelines to not have tokens representing other components to be plural.
Good idea. We may be able to prevent this via linting too, but we'll need to do some investigation.
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.
In terms of this PR,
input-text
can use the revised slot names. We can deprecate the existing ones in a follow-up PR aimed at 25.R3, which will be removed in 4.0 (26.R1). cc @geospatialem @DitwanP @isaacbraun
Created #12356 for tracking
* @prop --calcite-input-prefix-size: Specifies the width of the prefix element. | ||
* @prop --calcite-input-prefix-text-color: Specifies the text color of the prefix element. | ||
* @prop --calcite-input-suffix-background-color: Specifies the background color of the suffix element. | ||
* @prop --calcite-input-suffix-size: Specifies the width of the suffix element. |
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 think we've had other discussion on what to name size vars. Should this be width
or size-x
? If its just size
its not apparent it is for the width.
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.
@driskull As discussed, this should be size-x
i believe.
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.
👍
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.
Added #12394
@@ -21,7 +40,8 @@ | |||
& input, | |||
& .prefix, | |||
& .suffix { | |||
@apply text-n2h h-6; | |||
@apply text-n2h; | |||
block-size: var(--calcite-input-text-height, 1.5rem); |
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.
Why do we need to set the height? Shouldn't just font-size
and line-height
be enough?
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.
It is enough to set the height but i believe the desired height is different from what font-size & line-height.
Adding @macandcheese for more thoughts.
This PR has been automatically marked as stale because it has not had recent activity. Please close your PR if it is no longer relevant. Thank you for your contributions. |
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.
LGTM!
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.
Awesome @anveshmekal! ✨💪🏻✨ Have a few doc consistency suggestions for consideration below. 📚
* @prop --calcite-input-action-background-color: Specifies the background color of the component's `clearable` element. | ||
* @prop --calcite-input-action-background-color-hover: Specifies the background color of the component's `clearable` element when hovered. | ||
* @prop --calcite-input-action-background-color-press: Specifies the background color of the component's `clearable` element when pressed. | ||
* @prop --calcite-input-action-icon-color: Specifies the icon color of the component's `clearable` & icon elements. | ||
* @prop --calcite-input-action-icon-color-hover: Specifies the icon color of the component's `clearable` & icon elements when hovered. | ||
* @prop --calcite-input-action-icon-color-press: Specifies the icon color of the component's `clearable` & icon elements when pressed. | ||
* @prop --calcite-input-loading-background-color: Specifies the background color of the `loading` element. | ||
* @prop --calcite-input-loading-fill-color: Specifies the fill color of the `loading` element. | ||
* @prop --calcite-input-prefix-background-color: Specifies the background color of the prefix element. | ||
* @prop --calcite-input-prefix-width: Specifies the width of the prefix element. | ||
* @prop --calcite-input-prefix-text-color: Specifies the text color of the prefix element. | ||
* @prop --calcite-input-suffix-background-color: Specifies the background color of the suffix element. | ||
* @prop --calcite-input-suffix-width: Specifies the width of the suffix element. | ||
* @prop --calcite-input-suffix-text-color: Specifies the text color of the suffix element. | ||
* @prop --calcite-input-text-background-color: Specifies background color of the component. | ||
* @prop --calcite-input-text-border-color: Specifies the border color of the component. | ||
* @prop --calcite-input-text-corner-radius: Specifies the border radius of the component. | ||
* @prop --calcite-input-text-placeholder-text-color: Specifies the text color of the placeholder in the component. | ||
* @prop --calcite-input-text-text-color: Specifies the text color of the component. | ||
* @prop --calcite-input-text-text-color-focus: Specifies the text color of the component when focused. |
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.
Few doc consistency suggestions:
* @prop --calcite-input-action-background-color: Specifies the background color of the component's `clearable` element. | |
* @prop --calcite-input-action-background-color-hover: Specifies the background color of the component's `clearable` element when hovered. | |
* @prop --calcite-input-action-background-color-press: Specifies the background color of the component's `clearable` element when pressed. | |
* @prop --calcite-input-action-icon-color: Specifies the icon color of the component's `clearable` & icon elements. | |
* @prop --calcite-input-action-icon-color-hover: Specifies the icon color of the component's `clearable` & icon elements when hovered. | |
* @prop --calcite-input-action-icon-color-press: Specifies the icon color of the component's `clearable` & icon elements when pressed. | |
* @prop --calcite-input-loading-background-color: Specifies the background color of the `loading` element. | |
* @prop --calcite-input-loading-fill-color: Specifies the fill color of the `loading` element. | |
* @prop --calcite-input-prefix-background-color: Specifies the background color of the prefix element. | |
* @prop --calcite-input-prefix-width: Specifies the width of the prefix element. | |
* @prop --calcite-input-prefix-text-color: Specifies the text color of the prefix element. | |
* @prop --calcite-input-suffix-background-color: Specifies the background color of the suffix element. | |
* @prop --calcite-input-suffix-width: Specifies the width of the suffix element. | |
* @prop --calcite-input-suffix-text-color: Specifies the text color of the suffix element. | |
* @prop --calcite-input-text-background-color: Specifies background color of the component. | |
* @prop --calcite-input-text-border-color: Specifies the border color of the component. | |
* @prop --calcite-input-text-corner-radius: Specifies the border radius of the component. | |
* @prop --calcite-input-text-placeholder-text-color: Specifies the text color of the placeholder in the component. | |
* @prop --calcite-input-text-text-color: Specifies the text color of the component. | |
* @prop --calcite-input-text-text-color-focus: Specifies the text color of the component when focused. | |
* @prop --calcite-input-action-background-color: Specifies the background color of the component's `clearable` element. | |
* @prop --calcite-input-action-background-color-hover: Specifies the background color of the component's `clearable` element when hovered. | |
* @prop --calcite-input-action-background-color-press: Specifies the background color of the component's `clearable` element when pressed. | |
* @prop --calcite-input-action-icon-color: Specifies the icon color of the component's `clearable` & icon elements. | |
* @prop --calcite-input-action-icon-color-hover: Specifies the icon color of the component's `clearable` & icon elements when hovered. | |
* @prop --calcite-input-action-icon-color-press: Specifies the icon color of the component's `clearable` & icon elements when pressed. | |
* @prop --calcite-input-loading-background-color: Specifies the background color of the `loading` element. | |
* @prop --calcite-input-loading-fill-color: Specifies the fill color of the `loading` element. | |
* @prop --calcite-input-prefix-background-color: When `prefixText` is provided, specifies the background color of the component's prefix element. | |
* @prop --calcite-input-prefix-width: When `prefixText` is provided, specifies the width of the component's prefix element. | |
* @prop --calcite-input-prefix-text-color: When `prefixText` is provided, specifies the text color of the component's prefix element. | |
* @prop --calcite-input-suffix-background-color: When `suffixText` is provided, specifies the background color of the component's suffix element. | |
* @prop --calcite-input-suffix-width: When suffixText` is provided, specifies the width of the component's suffix element. | |
* @prop --calcite-input-suffix-text-color: When `suffixText` is provided, specifies the color of the component's suffix element. | |
* @prop --calcite-input-text-background-color: Specifies the component's background color. | |
* @prop --calcite-input-text-border-color: Specifies the component's border color. | |
* @prop --calcite-input-text-corner-radius: Specifies the component's border radius. | |
* @prop --calcite-input-text-placeholder-text-color: Specifies the component's `placeholder` text color. | |
* @prop --calcite-input-text-text-color: Specifies the component's text color. | |
* @prop --calcite-input-text-text-color-focus: Specifies the component's text color when focused. |
👍 |
Thinking about
|
@@ -3,8 +3,26 @@ | |||
* | |||
* These properties can be overridden using the component's tag as selector. | |||
* | |||
* @prop --calcite-input-prefix-size: Specifies the component's prefix width. | |||
* @prop --calcite-input-suffix-size: Specifies the component's suffix width. | |||
* @prop --calcite-input-action-background-color: Specifies the background color of the component's `clearable` element. |
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.
Should these all be labeled --calcite-input-text-action...
?
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.
Just realized that only these use the full "input-text". Is that intentional?
--calcite-input-text-background-color
--calcite-input-text-border-color
--calcite-input-text-corner-radius
--calcite-input-text-placeholder-text-color
--calcite-input-text-text-color
--calcite-input-text-text-color-focus
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.
Since input components share the same design pattern, we were using generic token names such as --calcite-input-action-background-color
instead of --calcite-input-text-action-background-color
.
Similar to whats discussed here #10206 (comment)
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.
Awesome!
Good Point. This made me relook and figured I missed the token for icon in input-text here . Must have slipped through in input-number too. |
@@ -20,6 +20,7 @@ | |||
* @prop --calcite-input-text-background-color: Specifies the component's background color. | |||
* @prop --calcite-input-text-border-color: Specifies the component's border color. | |||
* @prop --calcite-input-text-corner-radius: Specifies the component's border radius. | |||
* @prop --calcite-input-text-icon-color: Specifies the component's icon color. |
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 think we're missing this on Input Number.
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.
Ha! You caught that too.
Related Issue: #7180
Summary
Adds following tokens in
input-text
component--calcite-input-action-background-color
: Specifies the background color of the component'sclearable
element.--calcite-input-action-background-color-hover
: Specifies the background color of the component'sclearable
element when hovered.--calcite-input-action-background-color-press
: Specifies the background color of the component'sclearable
element when pressed.--calcite-input-action-icon-color
: Specifies the icon color of the component'sclearable
& icon elements.--calcite-input-action-icon-color-hover
: Specifies the icon color of the component'sclearable
& icon elements when hovered.--calcite-input-action-icon-color-press
: Specifies the icon color of the component'sclearable
& icon elements when pressed.--calcite-input-loading-background-color
: Specifies the background color of theloading
element.--calcite-input-loading-fill-color
: Specifies the fill color of theloading
element.--calcite-input-prefix-background-color
: WhenprefixText
is provided, specifies the background color of the component's prefix element.--calcite-input-prefix-size-x
: WhenprefixText
is provided, specifies the width of the component's prefix element.--calcite-input-prefix-text-color
: WhenprefixText
is provided, specifies the text color of the component's prefix element.--calcite-input-suffix-background-color
: WhensuffixText
is provided, specifies the background color of the component's suffix element.--calcite-input-suffix-size-x
: WhensuffixText
is provided, specifies the width of the component's suffix element.--calcite-input-suffix-text-color
: WhensuffixText
is provided, specifies the color of the component's suffix element.--calcite-input-text-background-color
: Specifies the component's background color.--calcite-input-text-border-color
: Specifies the component's border color.--calcite-input-text-corner-radius
: Specifies the component's border radius.--calcite-input-text-icon-color
: Specifies the component's icon color.--calcite-input-text-placeholder-text-color
: Specifies the component'splaceholder
text color.--calcite-input-text-text-color
: Specifies the component's text color.--calcite-input-text-text-color-focus
: Specifies the component's text color when focused.