diff --git a/packages/calcite-components/.storybook/placeholderImage.ts b/packages/calcite-components/.storybook/placeholder-image.ts
similarity index 100%
rename from packages/calcite-components/.storybook/placeholderImage.ts
rename to packages/calcite-components/.storybook/placeholder-image.ts
diff --git a/packages/calcite-components/src/components/avatar/avatar.e2e.ts b/packages/calcite-components/src/components/avatar/avatar.e2e.ts
index f42dcbf6e4f..6e6dda32bae 100644
--- a/packages/calcite-components/src/components/avatar/avatar.e2e.ts
+++ b/packages/calcite-components/src/components/avatar/avatar.e2e.ts
@@ -1,6 +1,6 @@
import { newE2EPage } from "@stencil/core/testing";
import { accessible, defaults, hidden, renders } from "../../tests/commonTests";
-import { placeholderImage } from "../../../.storybook/placeholderImage";
+import { placeholderImage } from "../../../.storybook/placeholder-image";
import { html } from "../../../support/formatting";
import { CSS } from "./resources";
diff --git a/packages/calcite-components/src/components/card/card.e2e.ts b/packages/calcite-components/src/components/card/card.e2e.ts
index 52d736c0fef..080994a0aff 100644
--- a/packages/calcite-components/src/components/card/card.e2e.ts
+++ b/packages/calcite-components/src/components/card/card.e2e.ts
@@ -1,6 +1,6 @@
import { newE2EPage } from "@stencil/core/testing";
import { accessible, renders, slots, hidden, t9n } from "../../tests/commonTests";
-import { placeholderImage } from "../../../.storybook/placeholderImage";
+import { placeholderImage } from "../../../.storybook/placeholder-image";
import { html } from "../../../support/formatting";
import { CSS, SLOTS } from "./resources";
diff --git a/packages/calcite-components/src/components/list/list.e2e.ts b/packages/calcite-components/src/components/list/list.e2e.ts
index 18d0953e8ec..dd1597dbefa 100755
--- a/packages/calcite-components/src/components/list/list.e2e.ts
+++ b/packages/calcite-components/src/components/list/list.e2e.ts
@@ -1,6 +1,6 @@
import { E2EPage, newE2EPage } from "@stencil/core/testing";
import { accessible, hidden, renders, focusable, disabled, defaults, t9n } from "../../tests/commonTests";
-import { placeholderImage } from "../../../.storybook/placeholderImage";
+import { placeholderImage } from "../../../.storybook/placeholder-image";
import { html } from "../../../support/formatting";
import { CSS as ListItemCSS, activeCellTestAttribute } from "../list-item/resources";
import { GlobalTestProps, dragAndDrop, isElementFocused, getFocusedElementProp } from "../../tests/utils";
diff --git a/packages/calcite-components/src/custom-theme.stories.ts b/packages/calcite-components/src/custom-theme.stories.ts
index b8a1af288d8..61c486e2bf8 100644
--- a/packages/calcite-components/src/custom-theme.stories.ts
+++ b/packages/calcite-components/src/custom-theme.stories.ts
@@ -1,88 +1,65 @@
-import { placeholderImage } from "../.storybook/placeholderImage";
+import { accordion } from "./custom-theme/accordion";
+import { buttons } from "./custom-theme/button";
+import { card, cardTokens } from "./custom-theme/card";
+import { checkbox } from "./custom-theme/checkbox";
+import { chips } from "./custom-theme/chips";
+import { datePicker } from "./custom-theme/date-picker";
+import { dropdown } from "./custom-theme/dropdown";
+import { icon } from "./custom-theme/icon";
+import { loader } from "./custom-theme/loader";
+import { notices } from "./custom-theme/notice";
+import { pagination } from "./custom-theme/pagination";
+import { segmentedControl } from "./custom-theme/segmented-control";
+import { slider } from "./custom-theme/slider";
+import { calciteSwitch } from "./custom-theme/switch";
+import { tabs } from "./custom-theme/tabs";
-interface CustomThemeArgs {
- calciteColorBrand: string;
- calciteColorBrandHover: string;
- calciteColorBrandPress: string;
- calciteColorStatusInfo: string;
- calciteColorStatusSuccess: string;
- calciteColorStatusWarning: string;
- calciteColorStatusDanger: string;
- calciteColorStatusDangerHover: string;
- calciteColorStatusDangerPress: string;
- calciteColorBackground: string;
- calciteColorForeground1: string;
- calciteColorForeground2: string;
- calciteColorForeground3: string;
- calciteColorText1: string;
- calciteColorText2: string;
- calciteColorText3: string;
- calciteColorTextInverse: string;
- calciteColorTextLink: string;
- calciteColorBorder1: string;
- calciteColorBorder2: string;
- calciteColorBorder3: string;
- calciteColorBorderInput: string;
- calciteUiIconColor: string;
+const globalTokens = {
+ calciteColorBrand: "#007ac2",
+ calciteColorBrandHover: "#00619b",
+ calciteColorBrandPress: "#004874",
+ calciteColorStatusInfo: "#00619b",
+ calciteColorStatusSuccess: "#35ac46",
+ calciteColorStatusWarning: "#edd317",
+ calciteColorStatusDanger: "#d83020",
+ calciteColorStatusDangerHover: "#a82b1e",
+ calciteColorStatusDangerPress: "#7c1d13",
+ calciteColorBackground: "#f8f8f8",
+ calciteColorForeground1: "#ffffff",
+ calciteColorForeground2: "#f3f3f3",
+ calciteColorForeground3: "#eaeaea",
+ calciteColorText1: "#151515",
+ calciteColorText2: "#4a4a4a",
+ calciteColorText3: "#6a6a6a",
+ calciteColorTextInverse: "#ffffff",
+ calciteColorTextLink: "#00619b",
+ calciteColorBorder1: "#cacaca",
+ calciteColorBorder2: "#d4d4d4",
+ calciteColorBorder3: "#dfdfdf",
+ calciteColorBorderInput: "#949494",
+ calciteUiIconColor: "currentColor",
+};
+
+function convertToParamCase(str) {
+ return str.replace(/([A-Z])/g, "-$1").toLowerCase();
+}
+
+function addTokens(args) {
+ return Object.entries(args)
+ .map(([tokenName, tokenValue]) =>
+ !!tokenValue && tokenValue !== "" ? `--${convertToParamCase(tokenName)}: ${tokenValue};` : null,
+ )
+ .filter((token) => token)
+ .join("");
}
export default {
title: "Theming/Custom Theme",
- args: {
- calciteColorBrand: "#007ac2",
- calciteColorBrandHover: "#00619b",
- calciteColorBrandPress: "#004874",
- calciteColorStatusInfo: "#00619b",
- calciteColorStatusSuccess: "#35ac46",
- calciteColorStatusWarning: "#edd317",
- calciteColorStatusDanger: "#d83020",
- calciteColorStatusDangerHover: "#a82b1e",
- calciteColorStatusDangerPress: "#7c1d13",
- calciteColorBackground: "#f8f8f8",
- calciteColorForeground1: "#ffffff",
- calciteColorForeground2: "#f3f3f3",
- calciteColorForeground3: "#eaeaea",
- calciteColorText1: "#151515",
- calciteColorText2: "#4a4a4a",
- calciteColorText3: "#6a6a6a",
- calciteColorTextInverse: "#ffffff",
- calciteColorTextLink: "#00619b",
- calciteColorBorder1: "#cacaca",
- calciteColorBorder2: "#d4d4d4",
- calciteColorBorder3: "#dfdfdf",
- calciteColorBorderInput: "#949494",
- calciteUiIconColor: "currentColor",
- },
+ args: { ...globalTokens, ...cardTokens },
};
-export const themingInteractive = (args: CustomThemeArgs): string => {
- return `
+export const themingInteractive = (args: Record
): string => {
+ return `
-
-
-
-
-
-
-
-
-
-
-
-
- Child 1
-
-
- Child 2
-
-
- Grandchild 1
-
-
- Grandchild 2
-
-
- Great-Grandchild 1
-
-
- Great-Grandchild 2
-
-
-
-
-
-
- Child 3
-
-
-
-
-
- Something failed
-
- There was an error while performing the task.
-
- Retry
-
-
- Something worked
-
- That thing you wanted to do worked as expected
-
-
-
- Segmented Control
-
- React
- Ember
- Angular
- Vue
-
-
-
+ ${accordion}
+ ${notices}
+ ${segmentedControl}
+ ${icon}
-
-
- Selectable card
- Lead füt
- Trail füt
-
-
-
-
- Primary
-
- List
- Grid
- Table
-
-
- Outline
- Red
-
-
-
+ ${card}
- Neutral
- Inverse
- Brand
+ ${dropdown}
+ ${buttons}
- Neutral
- Inverse
- Brand
+ ${checkbox}
-
-
+ ${chips}
+ ${pagination}
+ ${slider}
-
-
-
- Tab 1 Title
- Tab 2 Title
- Tab 3 Title
- Tab 4 Title
-
-
-
-
+ ${datePicker}
+ ${tabs}
+ ${loader}
+ ${calciteSwitch}
`;
diff --git a/packages/calcite-components/src/custom-theme/accordion-item.ts b/packages/calcite-components/src/custom-theme/accordion-item.ts
new file mode 100644
index 00000000000..e58ecb4f60b
--- /dev/null
+++ b/packages/calcite-components/src/custom-theme/accordion-item.ts
@@ -0,0 +1,7 @@
+import { placeholderImage } from "../../.storybook/placeholder-image";
+import { html } from "../../support/formatting";
+
+export const accordionItem = (idx: number): string =>
+ html`
+ `;
diff --git a/packages/calcite-components/src/custom-theme/accordion.ts b/packages/calcite-components/src/custom-theme/accordion.ts
new file mode 100644
index 00000000000..f3af009055a
--- /dev/null
+++ b/packages/calcite-components/src/custom-theme/accordion.ts
@@ -0,0 +1,8 @@
+import { html } from "../../support/formatting";
+import { accordionItem } from "./accordion-item";
+import { tree } from "./tree";
+
+export const accordion = html`
+ ${[0, 1, 2, 3, 4].map((idx) => accordionItem(idx))}
+ ${tree}
+`;
diff --git a/packages/calcite-components/src/custom-theme/button.ts b/packages/calcite-components/src/custom-theme/button.ts
new file mode 100644
index 00000000000..d31a667698e
--- /dev/null
+++ b/packages/calcite-components/src/custom-theme/button.ts
@@ -0,0 +1,17 @@
+import { html } from "../../support/formatting";
+
+const buttonProps: [args: string, content: string] = ["", ""];
+
+export const button = (props: { kind?: string; appearance?: string }): string => {
+ const [buttonArgs, content] = Object.entries(props)
+ .filter(([key, value]) => key && value && value !== "")
+ .reduce(([args, content], [key, value]) => {
+ args += `${key}="${value}" `;
+ content += `${value} `;
+ return [args, content];
+ }, buttonProps);
+
+ return html`${content.trim()}`;
+};
+
+export const buttons = html`${button({ appearance: "outline" })} ${button({ kind: "danger" })}`;
diff --git a/packages/calcite-components/src/custom-theme/card.ts b/packages/calcite-components/src/custom-theme/card.ts
new file mode 100644
index 00000000000..5f7b9fa0e99
--- /dev/null
+++ b/packages/calcite-components/src/custom-theme/card.ts
@@ -0,0 +1,19 @@
+import { placeholderImage } from "../../.storybook/placeholder-image";
+import { html } from "../../support/formatting";
+
+export const cardTokens = {
+ calciteCardAccentColorSelected: "",
+ calciteCardBackgroundColor: "",
+ calciteCardBorderColor: "",
+ calciteCardSelectIndicatorColorHover: "",
+ calciteCardSelectIndicatorColor: "",
+ calciteCardCornerRadius: "",
+ calciteCardShadow: "",
+};
+
+export const card = html`
+
+ Selectable card
+ Lead füt
+ Trail füt
+`;
diff --git a/packages/calcite-components/src/custom-theme/checkbox.ts b/packages/calcite-components/src/custom-theme/checkbox.ts
new file mode 100644
index 00000000000..80443bf2afd
--- /dev/null
+++ b/packages/calcite-components/src/custom-theme/checkbox.ts
@@ -0,0 +1,6 @@
+import { html } from "../../support/formatting";
+
+export const checkbox = html``;
diff --git a/packages/calcite-components/src/custom-theme/chips.ts b/packages/calcite-components/src/custom-theme/chips.ts
new file mode 100644
index 00000000000..d51857fc62e
--- /dev/null
+++ b/packages/calcite-components/src/custom-theme/chips.ts
@@ -0,0 +1,12 @@
+import { html } from "../../support/formatting";
+
+export const chips = html`
+ Neutral
+ Inverse
+ Brand
+
+
+ Neutral
+ Inverse
+ Brand
+
`;
diff --git a/packages/calcite-components/src/custom-theme/date-picker.ts b/packages/calcite-components/src/custom-theme/date-picker.ts
new file mode 100644
index 00000000000..8cdcb71fe2f
--- /dev/null
+++ b/packages/calcite-components/src/custom-theme/date-picker.ts
@@ -0,0 +1,3 @@
+import { html } from "../../support/formatting";
+
+export const datePicker = html``;
diff --git a/packages/calcite-components/src/custom-theme/dropdown.ts b/packages/calcite-components/src/custom-theme/dropdown.ts
new file mode 100644
index 00000000000..b1321acf630
--- /dev/null
+++ b/packages/calcite-components/src/custom-theme/dropdown.ts
@@ -0,0 +1,10 @@
+import { html } from "../../support/formatting";
+
+export const dropdown = html`
+ Primary
+
+ List
+ Grid
+ Table
+
+`;
diff --git a/packages/calcite-components/src/custom-theme/icon.ts b/packages/calcite-components/src/custom-theme/icon.ts
new file mode 100644
index 00000000000..67e6de07a12
--- /dev/null
+++ b/packages/calcite-components/src/custom-theme/icon.ts
@@ -0,0 +1,3 @@
+import { html } from "../../support/formatting";
+
+export const icon = html``;
diff --git a/packages/calcite-components/src/custom-theme/loader.ts b/packages/calcite-components/src/custom-theme/loader.ts
new file mode 100644
index 00000000000..8daef2b4f96
--- /dev/null
+++ b/packages/calcite-components/src/custom-theme/loader.ts
@@ -0,0 +1,3 @@
+import { html } from "../../support/formatting";
+
+export const loader = html``;
diff --git a/packages/calcite-components/src/custom-theme/notice.ts b/packages/calcite-components/src/custom-theme/notice.ts
new file mode 100644
index 00000000000..e59eb3f3810
--- /dev/null
+++ b/packages/calcite-components/src/custom-theme/notice.ts
@@ -0,0 +1,19 @@
+import { html } from "../../support/formatting";
+
+export const notice = ({ kind, message, title }: { kind: string; message: string; title: string }): string =>
+ html`
+ ${title}
+ ${message}
+ ${kind === "danger" ? html`Retry` : null}
+ `;
+
+export const notices = html`${notice({
+ kind: "danger",
+ message: "There was an error while performing the task.",
+ title: "Something failed",
+})}
+${notice({
+ kind: "success",
+ message: "That thing you wanted to do worked as expected",
+ title: "Something worked",
+})}`;
diff --git a/packages/calcite-components/src/custom-theme/pagination.ts b/packages/calcite-components/src/custom-theme/pagination.ts
new file mode 100644
index 00000000000..4b147c9e794
--- /dev/null
+++ b/packages/calcite-components/src/custom-theme/pagination.ts
@@ -0,0 +1,7 @@
+import { html } from "../../support/formatting";
+
+export const pagination = html``;
diff --git a/packages/calcite-components/src/custom-theme/segmented-control.ts b/packages/calcite-components/src/custom-theme/segmented-control.ts
new file mode 100644
index 00000000000..72aa38b76e6
--- /dev/null
+++ b/packages/calcite-components/src/custom-theme/segmented-control.ts
@@ -0,0 +1,11 @@
+import { html } from "../../support/formatting";
+
+export const segmentedControl = html`
+ Segmented Control
+
+ React
+ Ember
+ Angular
+ Vue `;
diff --git a/packages/calcite-components/src/custom-theme/slider.ts b/packages/calcite-components/src/custom-theme/slider.ts
new file mode 100644
index 00000000000..20c4636141a
--- /dev/null
+++ b/packages/calcite-components/src/custom-theme/slider.ts
@@ -0,0 +1,11 @@
+import { html } from "../../support/formatting";
+
+export const slider = html``;
diff --git a/packages/calcite-components/src/custom-theme/switch.ts b/packages/calcite-components/src/custom-theme/switch.ts
new file mode 100644
index 00000000000..2293379f7ef
--- /dev/null
+++ b/packages/calcite-components/src/custom-theme/switch.ts
@@ -0,0 +1,6 @@
+import { html } from "../../support/formatting";
+
+export const calciteSwitch = html``;
diff --git a/packages/calcite-components/src/custom-theme/tabs.ts b/packages/calcite-components/src/custom-theme/tabs.ts
new file mode 100644
index 00000000000..ff61b2d6c1e
--- /dev/null
+++ b/packages/calcite-components/src/custom-theme/tabs.ts
@@ -0,0 +1,10 @@
+import { html } from "../../support/formatting";
+
+export const tabs = html`
+
+ Tab 1 Title
+ Tab 2 Title
+ Tab 3 Title
+ Tab 4 Title
+
+`;
diff --git a/packages/calcite-components/src/custom-theme/tree.ts b/packages/calcite-components/src/custom-theme/tree.ts
new file mode 100644
index 00000000000..bd9e4d8f9e6
--- /dev/null
+++ b/packages/calcite-components/src/custom-theme/tree.ts
@@ -0,0 +1,19 @@
+import { html } from "../../support/formatting";
+
+export const tree = html`
+ Child 1
+
+ Child 2
+
+ Grandchild 1
+
+ Grandchild 2
+
+ Great-Grandchild 1
+ Great-Grandchild 2
+
+
+
+
+ Child 3
+`;