Skip to content

Commit d436514

Browse files
Elijbetbenelan
authored andcommitted
feat(fab): add component tokens (#11723)
**Related Issue:** #7180 Adds the following tokens for `fab` component. `--calcite-fab-background-color`: Specifies the component's background color. `--calcite-fab-shadow`: Specifies the component's shadow.
1 parent d68096d commit d436514

File tree

4 files changed

+43
-3
lines changed

4 files changed

+43
-3
lines changed

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

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { newE2EPage } from "@arcgis/lumina-compiler/puppeteerTesting";
22
import { describe, expect, it } from "vitest";
3-
import { accessible, defaults, disabled, hidden, renders } from "../../tests/commonTests";
3+
import { accessible, defaults, disabled, hidden, renders, themed } from "../../tests/commonTests";
44
import { findAll } from "../../tests/utils";
5+
import { html } from "../../../support/formatting";
56
import { CSS } from "./resources";
67

78
describe("calcite-fab", () => {
@@ -148,4 +149,17 @@ describe("calcite-fab", () => {
148149
});
149150
});
150151
});
152+
153+
describe("theme", () => {
154+
describe("default", () => {
155+
themed(html`<calcite-fab></calcite-fab>`, {
156+
"--calcite-fab-background-color": {
157+
targetProp: "--calcite-fab-background-color",
158+
},
159+
"--calcite-fab-shadow": {
160+
targetProp: "--calcite-fab-shadow",
161+
},
162+
});
163+
});
164+
});
151165
});

packages/calcite-components/src/components/fab/fab.scss

+15-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
1+
/**
2+
* CSS Custom Properties
3+
*
4+
* These properties can be overridden using the component's tag as selector.
5+
*
6+
* @prop --calcite-fab-background-color: Specifies the component's background color.
7+
* @prop --calcite-fab-shadow: Specifies the component's shadow.
8+
*/
9+
110
:host {
2-
@apply flex bg-transparent;
11+
@apply flex;
12+
13+
background-color: var(--calcite-fab-background-color, transparent);
314
}
415

516
@include disabled();
617

718
calcite-button {
8-
@apply shadow-2;
19+
--calcite-fab-shadow-internal: 0 6px 20px -4px rgba(0, 0, 0, 0.1), 0 4px 12px -2px rgba(0, 0, 0, 0.08);
20+
box-shadow: var(--calcite-fab-shadow, var(--calcite-fab-shadow-internal));
21+
922
&:hover {
1023
@apply shadow-2-lg;
1124
}

packages/calcite-components/src/custom-theme.stories.ts

+5
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { chips, chipTokens } from "./custom-theme/chips";
2424
import { comboboxItem, comboboxItemTokens, selectedComboboxItem } from "./custom-theme/combobox-item";
2525
import { datePicker, datePickerRange, datePickerTokens } from "./custom-theme/date-picker";
2626
import { dropdown, DropdownGroupTokens, DropdownItemTokens, DropdownTokens } from "./custom-theme/dropdown";
27+
import { fab, fabTokens } from "./custom-theme/fab";
2728
import { flow, flowTokens } from "./custom-theme/flow";
2829
import { graph, graphTokens } from "./custom-theme/graph";
2930
import { handle, handleTokens } from "./custom-theme/handle";
@@ -165,6 +166,9 @@ const kitchenSink = (args: Record<string, string>, useTestValues = false) =>
165166
<div class="demo-column">${datePicker}</div>
166167
<div class="demo-column">${datePickerRange}</div>
167168
</div>
169+
<div class="demo-row">
170+
<div class="demo-column">${fab}</div>
171+
</div>
168172
</div>`;
169173

170174
const componentTokens = {
@@ -190,6 +194,7 @@ const componentTokens = {
190194
...DropdownTokens,
191195
...DropdownItemTokens,
192196
...DropdownGroupTokens,
197+
...fabTokens,
193198
...flowTokens,
194199
...handleTokens,
195200
...inlineEditableTokens,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { html } from "../../support/formatting";
2+
3+
export const fabTokens = {
4+
calciteFabBackgroundColor: "",
5+
calciteFabShadow: "",
6+
};
7+
8+
export const fab = html` <calcite-fab></calcite-fab> `;

0 commit comments

Comments
 (0)