Skip to content

feat(tabs, tab-nav, tab-title, tab): add component tokens#11720

Merged
aPreciado88 merged 48 commits intodevfrom
aPreciado88/7180-add-tabs-design-tokens
Apr 9, 2025
Merged

feat(tabs, tab-nav, tab-title, tab): add component tokens#11720
aPreciado88 merged 48 commits intodevfrom
aPreciado88/7180-add-tabs-design-tokens

Conversation

@aPreciado88
Copy link
Copy Markdown
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-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
import { getIconScale } from "../../utils/component";
import { IconNameOrString } from "../icon/interfaces";
import { isBrowser } from "../../utils/browser";
import { XButton } from "../functional/XButton";
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
<>
<slot name={SLOTS.titleGroup} />
<section>
<section class={CSS.section}>
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.


export const CSS = {
container: "tab-nav",
container: "container",
Copy link
Copy Markdown
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
Copy Markdown
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. 📚

Comment thread packages/calcite-components/src/components/button/button.scss Outdated
Comment thread packages/calcite-components/src/components/tab-nav/tab-nav.scss Outdated
Comment thread packages/calcite-components/src/components/tab-nav/tab-nav.scss Outdated
Comment thread packages/calcite-components/src/components/tab-title/tab-title.scss Outdated
Comment thread packages/calcite-components/src/components/tab-title/tab-title.scss Outdated
Comment thread packages/calcite-components/src/components/tab-title/tab-title.scss Outdated
Comment thread packages/calcite-components/src/components/tab-title/tab-title.scss Outdated
@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 the pr ready for visual snapshots Adding this label will run visual snapshot testing. label Apr 4, 2025
@ashetland
Copy link
Copy Markdown
Contributor

@ashetland I pushed an update with a couple of snapshot fixes. Could you please take a look?

LGTM!

Copy link
Copy Markdown
Member

@jcfranco jcfranco left a comment

Choose a reason for hiding this comment

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

Awesome stuff! 🚀 Good to merge after addressing relevant comments.

}

@mixin x-button(
$size: "var(--calcite-internal-close-size, 1.5rem /* 24px */)",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This can be done in a follow-up, but let's remove the comment. We don't need to annotate conversions.

$size: "var(--calcite-internal-close-size, 1.5rem /* 24px */)",
$padding: "0",
$color: "var(--calcite-close-icon-color, var(--calcite-color-text-1))",
$backgroundColor: "var(--calcite-close-background-color, var(--calcite-color-transparent))",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

For consistency, can you rename the arguments to be kebab-cased? This can also be done separately if desired.


// #region Private Properties

private closeButtonEl = createRef<HTMLButtonElement>();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

✨🏆🧹✨

@apply flex;
}

.cancel-editing-button[appearance="transparent"][kind="neutral"] {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Are these changes related? If not, can we submit these in a separate PR?

Copy link
Copy Markdown
Contributor Author

@aPreciado88 aPreciado88 Apr 8, 2025

Choose a reason for hiding this comment

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

This doesn't seem to be related to tabs, it was in the original tabs PR so I included it. I can take this part out and submit it separately 🐱‍👤

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I did a bit more digging, this is related to the changes in button. I'll add this back in.


describe("theme", () => {
describe("default", () => {
themed(html`<calcite-tab-nav bordered"></calcite-tab-nav>`, {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The default tests shouldn't use bordered, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I updated this, thanks for catching it!

});
});

describe("bottom position", () => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should this go into the bordered test above?

scrollButtonContainer: "scroll-button-container",
scrollBackwardContainerButton: "scroll-button-container--backward",
scrollForwardContainerButton: "scroll-button-container--forward",
tabNav: "tab-nav",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

For consistency, the root element in an element should use container as the key and value for the CSS class lookup. The previous code wasn't using the proper class, so I'll defer to you whether to fix this here or in a follow-up PR.

Copy link
Copy Markdown
Member

@jcfranco jcfranco left a comment

Choose a reason for hiding this comment

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

Awesome stuff! 🚀 Good to merge after addressing relevant comments.

@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 Apr 8, 2025
@aPreciado88
Copy link
Copy Markdown
Contributor Author

@jcfranco I updated the PR with the requested changes!

@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 Apr 9, 2025
@aPreciado88 aPreciado88 added pr ready for visual snapshots Adding this label will run visual snapshot testing. skip visual snapshots Pull requests that do not need visual regression testing. and removed pr ready for visual snapshots Adding this label will run visual snapshot testing. labels Apr 9, 2025
@aPreciado88 aPreciado88 merged commit 2d372de into dev Apr 9, 2025
17 checks passed
@aPreciado88 aPreciado88 deleted the aPreciado88/7180-add-tabs-design-tokens branch April 9, 2025 18:58
benelan pushed a commit that referenced this pull request May 14, 2025
**Related Issue:**
[#7180](#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-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.

---------

Co-authored-by: Anveshreddy mekala <anv11827@esri.com>
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. skip visual snapshots Pull requests that do not need visual regression testing.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants