Skip to content

Commit 1ce3148

Browse files
committed
Merge branch 'epic/7180-component-tokens' of github.com:Esri/calcite-components into epic/7180-component-tokens
2 parents d275331 + df6bf86 commit 1ce3148

File tree

4 files changed

+117
-3
lines changed

4 files changed

+117
-3
lines changed

packages/calcite-components/src/components/stepper-item/stepper-item.e2e.ts

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { newE2EPage } from "@stencil/core/testing";
2-
import { disabled, renders, hidden, t9n } from "../../tests/commonTests";
2+
import { disabled, renders, hidden, t9n, themed } from "../../tests/commonTests";
33
import { html } from "../../../support/formatting";
4+
import { ComponentTestTokens } from "../../tests/commonTests/themed";
5+
import { CSS } from "./resources";
46

57
describe("calcite-stepper-item", () => {
68
describe("renders", () => {
@@ -36,4 +38,39 @@ describe("calcite-stepper-item", () => {
3638
await stepperItem.click();
3739
expect(stepperItemSelect).toHaveReceivedEventTimes(1);
3840
});
41+
42+
describe("theme", () => {
43+
describe("default", () => {
44+
const tokens: ComponentTestTokens = {
45+
"--calcite-stepper-item-description-text-color": {
46+
shadowSelector: `.${CSS.stepperItemDescription}`,
47+
targetProp: "color",
48+
},
49+
"--calcite-stepper-item-heading-text-color": {
50+
shadowSelector: `.${CSS.stepperItemHeading}`,
51+
targetProp: "color",
52+
},
53+
"--calcite-stepper-item-icon-color": {
54+
shadowSelector: `calcite-icon`,
55+
targetProp: "--calcite-icon-color",
56+
},
57+
"--calcite-stepper-item-number-text-color": {
58+
shadowSelector: `.${CSS.stepperItemNumber}`,
59+
targetProp: "color",
60+
},
61+
"--calcite-stepper-item-text-color": {
62+
shadowSelector: `.${CSS.container}`,
63+
targetProp: "color",
64+
},
65+
};
66+
themed(
67+
html`
68+
<calcite-stepper-item heading="Confirm and complete" icon numbered description="Some subtext">
69+
<div>Step 1 Content Goes Here</div>
70+
</calcite-stepper-item>
71+
`,
72+
tokens,
73+
);
74+
});
75+
});
3976
});

packages/calcite-components/src/components/stepper-item/stepper-item.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
h-3
114114
flex-shrink-0
115115
self-start;
116-
color: var(
116+
--calcite-icon-color: var(
117117
--calcite-stepper-item-icon-color,
118118
var(--calcite-internal-stepper-item-icon-color, var(--calcite-color-text-3))
119119
);

packages/calcite-components/src/components/stepper/resources.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ export const CSS = {
33
actionIconStart: "action-icon--start",
44
actionIconEnd: "action-icon--end",
55
actionContainer: "action-container",
6+
rect: "rect",
7+
stepBar: "step-bar",
8+
stepBarComplete: "step-bar--complete",
9+
stepBarError: "step-bar--error",
10+
stepBarSelected: "step-bar--selected",
611
stepBarContainer: "step-bar-container",
712
singleView: "single-view",
813
};

packages/calcite-components/src/components/stepper/stepper.e2e.ts

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import { E2EPage, newE2EPage } from "@stencil/core/testing";
2-
import { defaults, hidden, reflects, renders, t9n } from "../../tests/commonTests";
2+
import { defaults, hidden, reflects, renders, t9n, themed } from "../../tests/commonTests";
33
import { html } from "../../../support/formatting";
44
import { NumberStringFormatOptions } from "../../utils/locale";
55
import { isElementFocused } from "../../tests/utils";
6+
import { ComponentTestTokens } from "../../tests/commonTests/themed";
7+
import { CSS } from "./resources";
68

79
// we use browser-context function to click on items to workaround `E2EElement#click` error
810
async function itemClicker(item: HTMLCalciteStepperItemElement) {
@@ -899,4 +901,74 @@ describe("calcite-stepper", () => {
899901
expect(displayedItems.length).toBe(1);
900902
});
901903
});
904+
905+
describe("theme", () => {
906+
describe("default", () => {
907+
const tokens: ComponentTestTokens = {
908+
"--calcite-stepper-action-background-color": {
909+
shadowSelector: `calcite-action`,
910+
targetProp: "--calcite-action-background-color",
911+
},
912+
"--calcite-stepper-action-background-color-hover": {
913+
shadowSelector: `calcite-action`,
914+
targetProp: "--calcite-action-background-color",
915+
state: { hover: { attribute: "class", value: CSS.actionIcon } },
916+
},
917+
"--calcite-stepper-action-background-color-active": {
918+
shadowSelector: `calcite-action`,
919+
targetProp: "--calcite-action-background-color",
920+
state: { press: { attribute: "class", value: CSS.actionIcon } },
921+
},
922+
"--calcite-stepper-step-bar-fill-color": {
923+
shadowSelector: `.${CSS.stepBar} ${CSS.rect}`,
924+
targetProp: "fill",
925+
},
926+
"--calcite-stepper-step-bar-fill-color-hover": {
927+
shadowSelector: `.${CSS.stepBar} ${CSS.rect}`,
928+
targetProp: "fill",
929+
state: "hover",
930+
},
931+
"--calcite-stepper-step-bar-selected-fill-color": {
932+
shadowSelector: `.${CSS.stepBarSelected}`,
933+
targetProp: "fill",
934+
},
935+
"--calcite-stepper-step-bar-complete-fill-color": {
936+
shadowSelector: `.${CSS.stepBarComplete}`,
937+
targetProp: "fill",
938+
},
939+
"--calcite-stepper-step-bar-completed-fill-color-hover": {
940+
shadowSelector: `.${CSS.stepBarComplete}`,
941+
targetProp: "fill",
942+
state: "hover",
943+
},
944+
"--calcite-stepper-step-bar-error-fill-color": {
945+
shadowSelector: `.${CSS.stepBarError}`,
946+
targetProp: "fill",
947+
},
948+
"--calcite-stepper-step-bar-error-fill-color-hover": {
949+
shadowSelector: `.${CSS.stepBarError}`,
950+
targetProp: "fill",
951+
},
952+
};
953+
themed(
954+
html`
955+
<calcite-stepper layout="horizontal-single" numbered icon scale="s">
956+
<calcite-stepper-item heading="Confirm and complete">
957+
<div>Step 4 Content Goes Here</div>
958+
</calcite-stepper-item>
959+
<calcite-stepper-item heading="Choose method" selected>
960+
<div>Step 1 Content Goes Here</div>
961+
</calcite-stepper-item>
962+
<calcite-stepper-item heading="Compile member list" complete>
963+
<div>Step 2 Content Goes Here</div>
964+
</calcite-stepper-item>
965+
<calcite-stepper-item heading="Set member properties" description="Some subtext" error>
966+
<div>Step 3 Content Goes Here</div>
967+
</calcite-stepper-item>
968+
</calcite-stepper>
969+
`,
970+
tokens,
971+
);
972+
});
973+
});
902974
});

0 commit comments

Comments
 (0)