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 #10532

Open
wants to merge 40 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
26dba74
WIP (button): component tokens
alisonailea Sep 16, 2024
64a3416
chore(button): remove extraneous selectors
alisonailea Sep 16, 2024
ec06957
chore(button): merge duplicate selectors
alisonailea Sep 16, 2024
83ab859
chore(button): reorder selectors
alisonailea Sep 16, 2024
a72a9a7
chore(button): rename internal variables
alisonailea Sep 16, 2024
bd23ace
chore(button): sort style props
alisonailea Sep 16, 2024
a7882a2
chore(button): sort tailwind styles
alisonailea Sep 16, 2024
946d56f
feat(button): add corner radius tokens
alisonailea Sep 16, 2024
1d0ce0c
feat(button): component tokens
alisonailea Sep 16, 2024
19ff52a
WIP: button tokens
alisonailea Sep 17, 2024
3e12f4f
feat(button): add component tokens
alisonailea Sep 19, 2024
11d4c63
chore(inline-editable): cancel-editing-button color control
alisonailea Sep 19, 2024
7f3606e
fix(button): transparent hover and focus
alisonailea Sep 25, 2024
7d8fbc1
Merge branch 'dev' of github.com:Esri/calcite-design-system into ali-…
alisonailea Oct 3, 2024
649ea0a
test(button): passing tests
alisonailea Oct 3, 2024
af110de
feat(tabs, tab-nav, tab-title, tab): add component tokens
jcfranco Oct 2, 2024
819fe71
ready to consolidate x and close buttons
jcfranco Oct 5, 2024
177aece
update component tokens
jcfranco Oct 11, 2024
90869c1
restart tab-title
jcfranco Oct 11, 2024
fa592e5
selected indicator
jcfranco Oct 11, 2024
554c287
text color
jcfranco Oct 11, 2024
e5592aa
wip
jcfranco Oct 11, 2024
9bcb7cd
Merge branch 'astump/7180-button' into jcfranco/7180-add-tabs-compone…
jcfranco Oct 11, 2024
584f70c
fix borders
jcfranco Oct 11, 2024
bcc382b
style nav buttons
jcfranco Oct 11, 2024
4eaec22
tidy up
jcfranco Oct 11, 2024
1f22e7d
update tests (tab-nav-pending)
jcfranco Oct 11, 2024
c266b6a
merge dev
jcfranco Oct 13, 2024
9242710
drop unnecessary stories
jcfranco Oct 15, 2024
3ee5419
fix tab-title text color
jcfranco Oct 15, 2024
976d792
fix combobox x-button regression
jcfranco Oct 15, 2024
9768a33
prevent x-button from becoming squished
jcfranco Oct 15, 2024
c7a358b
fix e2e tests
jcfranco Oct 18, 2024
167a3f5
fix nav button color regression
jcfranco Oct 18, 2024
35d8453
drop unused functional component
jcfranco Oct 18, 2024
8f6939d
tidy up
jcfranco Oct 18, 2024
73862c3
update demo page
jcfranco Oct 18, 2024
21a0acc
improve theming screenshot test
jcfranco Oct 18, 2024
4ad8955
tidy up
jcfranco Oct 18, 2024
5bbb6ec
fix click handler not being passed into x-button
jcfranco Oct 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion packages/calcite-components/.stylelintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
// @ts-check

// ⚠️ AUTO-GENERATED CODE - DO NOT EDIT
const customFunctions = [];
const customFunctions = [
"get-trailing-text-input-padding",
"medium-modular-scale",
"modular-scale",
"scale-duration",
"small-modular-scale"
];
// ⚠️ END OF AUTO-GENERATED CODE

const scssPatternRules = [
Expand Down
73 changes: 38 additions & 35 deletions packages/calcite-components/src/assets/styles/includes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -107,50 +107,53 @@
}
}

@mixin x-button() {
:host([scale="s"]) {
.x-button {
inline-size: theme("spacing.4");
block-size: theme("spacing.4");
}
}

:host([scale="m"]) {
.x-button {
inline-size: theme("spacing.6");
block-size: theme("spacing.6");
}
}

:host([scale="l"]) {
.x-button {
inline-size: theme("spacing.8");
block-size: theme("spacing.8");
}
}

@mixin x-button(
$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))",
$backgroundColorHover: "var(--calcite-close-background-color-hover, var(--calcite-color-transparent-hover))",
$backgroundColorPress: "var(--calcite-close-background-color-press, var(--calcite-color-transparent-press))"
) {
.x-button {
@apply appearance-none bg-transparent border-2 content-center cursor-pointer flex focus-base items-center justify-center m-0 self-center text-color-3 transition-default;
@apply border-none
cursor-pointer
focus-base
items-center
m-0
transition-default;

border-radius: 50%;
border-color: transparent;
background-color: var(--calcite-color-foreground-2);
background-color: #{$backgroundColor};
-webkit-appearance: none;
display: flex;
align-content: center;
justify-content: center;
color: #{$color};
block-size: #{$size};
inline-size: #{$size};
min-block-size: #{$size};
min-inline-size: #{$size};
padding: #{$padding};

&:active,
&:hover {
@apply text-color-1;
background-color: var(--calcite-color-foreground-3);
&:hover,
&:focus {
background-color: #{$backgroundColorHover};
}
&:focus {
@apply focus-inset;
}

&:active {
@apply border-solid;
border-color: theme("borderColor.color-brand");
background-color: #{$backgroundColorPress};
}

& calcite-icon {
calcite-icon {
color: inherit;
}
}

.x-button--round {
border-radius: 9999px;
}
}

@mixin close-button(
Expand All @@ -164,7 +167,7 @@
focus-base
items-center
m-0
rounded-half
rounded-half
transition-default;

background-color: var(--calcite-close-background-color, var(--calcite-color-transparent));
Expand Down
12 changes: 12 additions & 0 deletions packages/calcite-components/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4568,6 +4568,9 @@ export namespace Components {
*/
"contentBehind": boolean;
}
/**
* @deprecated Use the `calcite-shell-panel` component instead.
*/
interface CalciteShellCenterRow {
/**
* When `true`, the content area displays like a floating panel.
Expand Down Expand Up @@ -7553,6 +7556,9 @@ declare global {
prototype: HTMLCalciteShellElement;
new (): HTMLCalciteShellElement;
};
/**
* @deprecated Use the `calcite-shell-panel` component instead.
*/
interface HTMLCalciteShellCenterRowElement extends Components.CalciteShellCenterRow, HTMLStencilElement {
}
var HTMLCalciteShellCenterRowElement: {
Expand Down Expand Up @@ -12764,6 +12770,9 @@ declare namespace LocalJSX {
*/
"contentBehind"?: boolean;
}
/**
* @deprecated Use the `calcite-shell-panel` component instead.
*/
interface CalciteShellCenterRow {
/**
* When `true`, the content area displays like a floating panel.
Expand Down Expand Up @@ -14428,6 +14437,9 @@ declare module "@stencil/core" {
"calcite-select": LocalJSX.CalciteSelect & JSXBase.HTMLAttributes<HTMLCalciteSelectElement>;
"calcite-sheet": LocalJSX.CalciteSheet & JSXBase.HTMLAttributes<HTMLCalciteSheetElement>;
"calcite-shell": LocalJSX.CalciteShell & JSXBase.HTMLAttributes<HTMLCalciteShellElement>;
/**
* @deprecated Use the `calcite-shell-panel` component instead.
*/
"calcite-shell-center-row": LocalJSX.CalciteShellCenterRow & JSXBase.HTMLAttributes<HTMLCalciteShellCenterRowElement>;
"calcite-shell-panel": LocalJSX.CalciteShellPanel & JSXBase.HTMLAttributes<HTMLCalciteShellPanelElement>;
"calcite-slider": LocalJSX.CalciteSlider & JSXBase.HTMLAttributes<HTMLCalciteSliderElement>;
Expand Down
43 changes: 12 additions & 31 deletions packages/calcite-components/src/components/button/button.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -507,15 +507,11 @@ describe("calcite-button", () => {
Layers
</calcite-button>
`;
let page;
let buttonEl;
let buttonFocusStyle;
let buttonHoverStyle;

it("should have defined CSS custom properties", async () => {
page = await newE2EPage({ html: buttonSnippet });
const page = await newE2EPage({ html: buttonSnippet });
const buttonStyles = await page.evaluate(() => {
buttonEl = document.querySelector("calcite-button");
const buttonEl = document.querySelector("calcite-button");
buttonEl.style.setProperty("--calcite-color-transparent-hover", "rgba(34, 23, 200, 0.4)");
buttonEl.style.setProperty("--calcite-color-transparent-press", "rgba(1, 20, 44, 0.1");
return {
Expand All @@ -529,41 +525,31 @@ describe("calcite-button", () => {

describe("when mode attribute is not provided", () => {
it("should render button pseudo classes with default values tied to light mode", async () => {
page = await newE2EPage({ html: buttonSnippet });
buttonEl = await page.find("calcite-button >>> button");
await buttonEl.focus();
await page.waitForChanges();
buttonFocusStyle = await buttonEl.getComputedStyle();
expect(buttonFocusStyle.getPropertyValue("background-color")).toEqual("rgba(0, 0, 0, 0.04)");

const page = await newE2EPage({ html: buttonSnippet });
const buttonEl = await page.find("calcite-button >>> button");
await buttonEl.hover();
await page.waitForChanges();
buttonHoverStyle = await buttonEl.getComputedStyle();
const buttonHoverStyle = await buttonEl.getComputedStyle();
expect(buttonHoverStyle.getPropertyValue("background-color")).toEqual("rgba(0, 0, 0, 0.04)");
});
});

describe("when mode attribute is dark", () => {
it("should render button pseudo classes with value tied to dark mode", async () => {
page = await newE2EPage({
const page = await newE2EPage({
html: `<div class="calcite-mode-dark">${buttonSnippet}</div>`,
});
buttonEl = await page.find("calcite-button >>> button");
await buttonEl.focus();
await page.waitForChanges();
buttonFocusStyle = await buttonEl.getComputedStyle();
expect(buttonFocusStyle.getPropertyValue("background-color")).toEqual("rgba(255, 255, 255, 0.04)");

const buttonEl = await page.find("calcite-button >>> button");
await buttonEl.hover();
await page.waitForChanges();
buttonHoverStyle = await buttonEl.getComputedStyle();
const buttonHoverStyle = await buttonEl.getComputedStyle();
expect(buttonHoverStyle.getPropertyValue("background-color")).toEqual("rgba(255, 255, 255, 0.04)");
});
});

it("should allow the CSS custom property to be overridden", async () => {
const overrideStyle = "rgba(255, 255, 0, 0.9)";
page = await newE2EPage({
const page = await newE2EPage({
html: `
<style>
:root {
Expand All @@ -572,16 +558,11 @@ describe("calcite-button", () => {
</style>
<div>${buttonSnippet}</div>`,
});
buttonEl = await page.find("calcite-button >>> button");
await buttonEl.focus();
await page.waitForChanges();
buttonFocusStyle = await buttonEl.getComputedStyle();
expect(buttonFocusStyle.getPropertyValue("background-color")).toEqual(overrideStyle);

const buttonEl = await page.find("calcite-button >>> button");
await buttonEl.hover();
await page.waitForChanges();
buttonHoverStyle = await buttonEl.getComputedStyle();
expect(buttonHoverStyle.getPropertyValue("background-color")).toEqual(overrideStyle);
const buttonFocusStyle = await buttonEl.getComputedStyle();
expect(buttonFocusStyle.getPropertyValue("background-color")).toEqual(overrideStyle);
});
});

Expand Down
Loading
Loading