Skip to content

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

Merged
merged 16 commits into from
Jun 26, 2025

Conversation

anveshmekala
Copy link
Contributor

@anveshmekala anveshmekala commented May 28, 2025

Related Issue: #7180

Summary

Adds following tokens in input-text component

--calcite-input-action-background-color: Specifies the background color of the component's clearable element.
--calcite-input-action-background-color-hover: Specifies the background color of the component's clearable element when hovered.
--calcite-input-action-background-color-press: Specifies the background color of the component's clearable element when pressed.
--calcite-input-action-icon-color: Specifies the icon color of the component's clearable & icon elements.
--calcite-input-action-icon-color-hover: Specifies the icon color of the component's clearable & icon elements when hovered.
--calcite-input-action-icon-color-press: Specifies the icon color of the component's clearable & icon elements when pressed.
--calcite-input-loading-background-color: Specifies the background color of the loading element.
--calcite-input-loading-fill-color: Specifies the fill color of the loading element.
--calcite-input-prefix-background-color: When prefixText is provided, specifies the background color of the component's prefix element.
--calcite-input-prefix-size-x: When prefixText is provided, specifies the width of the component's prefix element.
--calcite-input-prefix-text-color: When prefixText is provided, specifies the text color of the component's prefix element.
--calcite-input-suffix-background-color: When suffixText is provided, specifies the background color of the component's suffix element.
--calcite-input-suffix-size-x: When suffixText is provided, specifies the width of the component's suffix element.
--calcite-input-suffix-text-color: When suffixText 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's placeholder 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.

@github-actions github-actions bot added the enhancement Issues tied to a new feature or request. label May 28, 2025
@anveshmekala anveshmekala marked this pull request as ready for review May 30, 2025 20:13
@anveshmekala anveshmekala added the pr ready for visual snapshots Adding this label will run visual snapshot testing. label May 30, 2025
@anveshmekala anveshmekala added pr ready for visual snapshots Adding this label will run visual snapshot testing. and removed pr ready for visual snapshots Adding this label will run visual snapshot testing. labels May 30, 2025
Copy link
Member

@driskull driskull left a 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.
Copy link
Member

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.

Copy link
Contributor Author

@anveshmekala anveshmekala Jun 2, 2025

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?

Copy link
Member

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.

Copy link
Member

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.

Copy link
Member

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.
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor Author

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);
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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.

@github-actions github-actions bot added the Stale Issues or pull requests that have not had recent activity. label Jun 13, 2025
@anveshmekala anveshmekala removed the Stale Issues or pull requests that have not had recent activity. label Jun 13, 2025
@anveshmekala anveshmekala added pr ready for visual snapshots Adding this label will run visual snapshot testing. and removed pr ready for visual snapshots Adding this label will run visual snapshot testing. labels Jun 20, 2025
Copy link
Member

@driskull driskull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Member

@geospatialem geospatialem left a 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. 📚

Comment on lines 6 to 25
* @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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few doc consistency suggestions:

Suggested change
* @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.

@anveshmekala anveshmekala added pr ready for visual snapshots Adding this label will run visual snapshot testing. and removed pr ready for visual snapshots Adding this label will run visual snapshot testing. labels Jun 23, 2025
@anveshmekala anveshmekala added pr ready for visual snapshots Adding this label will run visual snapshot testing. and removed pr ready for visual snapshots Adding this label will run visual snapshot testing. labels Jun 23, 2025
@anveshmekala anveshmekala added pr ready for visual snapshots Adding this label will run visual snapshot testing. and removed pr ready for visual snapshots Adding this label will run visual snapshot testing. labels Jun 23, 2025
@driskull
Copy link
Member

👍

@anveshmekala anveshmekala added pr ready for visual snapshots Adding this label will run visual snapshot testing. and removed pr ready for visual snapshots Adding this label will run visual snapshot testing. labels Jun 25, 2025
@anveshmekala anveshmekala requested a review from ashetland June 25, 2025 22:27
@matgalla
Copy link
Contributor

Thinking about --calcite-input-action-icon-color -

  • Currently, Action's --calcite-action-text-color changes both the text and the icon. If we want to support a new Action token, --calcite-action-icon-color then that would line up with this Input Text token.
    That said, even if we don't make any changes to Action tokens, I still think the name you have now is better than using -text from Action. Just wanted to mention this in case we want to add a new token to Action to match.

@@ -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.
Copy link
Contributor

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...?

Copy link
Contributor

@ashetland ashetland Jun 26, 2025

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

Copy link
Contributor Author

@anveshmekala anveshmekala Jun 26, 2025

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)

Copy link
Contributor

@macandcheese macandcheese left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

@anveshmekala
Copy link
Contributor Author

Thinking about --calcite-input-action-icon-color -

  • Currently, Action's --calcite-action-text-color changes both the text and the icon. If we want to support a new Action token, --calcite-action-icon-color then that would line up with this Input Text token.
    That said, even if we don't make any changes to Action tokens, I still think the name you have now is better than using -text from Action. Just wanted to mention this in case we want to add a new token to Action to match.

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.
Copy link
Contributor

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.

Copy link
Contributor

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.

@anveshmekala anveshmekala added pr ready for visual snapshots Adding this label will run visual snapshot testing. and removed pr ready for visual snapshots Adding this label will run visual snapshot testing. labels Jun 26, 2025
@anveshmekala anveshmekala merged commit b156f4e into dev Jun 26, 2025
14 checks passed
@anveshmekala anveshmekala deleted the anveshmekala/7180-input-text-tokens branch June 26, 2025 19:47
@github-actions github-actions bot added this to the 2025-07-29 - Jul Milestone milestone Jun 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Issues tied to a new feature or request. pr ready for visual snapshots Adding this label will run visual snapshot testing.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants