Skip to content
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(tabs, tab-nav, tab-title, tab): add component tokens #11720

Open
wants to merge 30 commits into
base: dev
Choose a base branch
from

Conversation

aPreciado88
Copy link
Contributor

@aPreciado88 aPreciado88 commented Mar 8, 2025

Related Issue: #7180

Summary

Add css tokens to the following components.

Tabs

--calcite-tab-background-color: When bordered, specifies the component's background color.
--calcite-tab-border-color: Specifies the component's border color.

Tab-nav

--calcite-tab-background-color: When calcite-tabs is bordered, specifies the component's background color.
--calcite-tab-border-color: When calcite-tabs is bordered, specifies the component's border color.
--calcite-tab-text-color: Specifies the component's iconStart, iconEnd, and text color.

Tab-title

--calcite-tab-text-color: Specifies the component's text color.
--calcite-tab-border-color: Specifies the component's border color.
--calcite-tab-background-color: Specifies the component's background color.
--calcite-tab-background-color-hover: When calcite-tabs is bordered, specifies the component's background color when hovered.
--calcite-tab-accent-color: Specifies the component's accent color.
--calcite-tab-accent-color-hover: Specifies the component's accent color when hovered.
--calcite-tab-accent-color-press: Specifies the component's accent color when selected or active.
--calcite-tab-close-icon-color: Specifies the component's close element icon color.
--calcite-tab-close-icon-color-press: Specifies the component's close element icon color when hovered, focused, and active.
--calcite-tab-close-icon-background-color: Specifies the component's close element icon background color.
--calcite-tab-close-icon-background-color-press: Specifies the component's close element icon background color when hovered, focused, and active.

Tab

--calcite-tab-content-space-y: Specifies the vertical space between the component's content in the default slot.

@github-actions github-actions bot added the enhancement Issues tied to a new feature or request. label Mar 8, 2025
@aPreciado88 aPreciado88 requested a review from jcfranco March 12, 2025 22:10
@@ -25,10 +25,11 @@ import { TabID, TabLayout, TabPosition } from "../tabs/interfaces";
import { getIconScale } from "../../utils/component";
import { IconNameOrString } from "../icon/interfaces";
import { isBrowser } from "../../utils/browser";
import { XButton } from "../functional/XButton";
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to separate this x button refactor into a separate PR (applies to changes to other components like Button, Combobox)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jcfranco Should we split this up?

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 it's fine, but I'll defer to you. IIRC, the ✖️ button needed to be adjusted for the tabs tokens work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can install this as is 🚀


padding-block: var(
--calcite-tab-content-space-y,
var(--calcite-tab-content-block-padding, var(--calcite-internal-tabs-content-space-y-fallback))
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this -fallback portion needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can take the -fallback bit out

@aPreciado88 aPreciado88 added the pr ready for visual snapshots Adding this label will run visual snapshot testing. label Mar 19, 2025
@@ -195,7 +195,7 @@ export class Tabs extends LitElement {
return (
<>
<slot name={SLOTS.titleGroup} />
<section>
<section class={CSS.section}>
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't think this is required. We can leverage tag selector in theme tests.

Copy link
Contributor

Choose a reason for hiding this comment

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

Applies to resource & e2e files.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@anveshmekala I tried using tag selection but the test won't pass. I looked at other themed tests and couldn't find a tag selection example setup that works, other than using the section class as a selector.

Copy link
Contributor

Choose a reason for hiding this comment

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

Interesting, it is working for me as expected. I might be missing something here. Attached ref #11778

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 works using your setup, I'll update the PR with your update. Thank you!

@aPreciado88 aPreciado88 marked this pull request as ready for review March 19, 2025 21:58
}

&:host(:hover) .container::after {
background-color: var(--calcite-tab-background-color, var(--calcite-color-foreground-2));
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 this should be --calcite-tab-background-color-hover to customize the hover background-color which has a different default value.

Applies to other places in this file.

@@ -4,12 +4,13 @@ export const ICON = {
} as const;

export const CSS = {
container: "tab-nav",
container: "container",
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: No longer required.

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.

Great stuff! Have a few doc-consistency suggestions for consideration. 📚

@aPreciado88 aPreciado88 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 Mar 21, 2025
@aPreciado88 aPreciado88 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 Mar 25, 2025
@aPreciado88 aPreciado88 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 Mar 25, 2025
@aPreciado88 aPreciado88 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 Mar 28, 2025
@aPreciado88
Copy link
Contributor Author

@ashetland @SkyeSeitz Can you please take a look?

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.

5 participants