diff --git a/.storybook/resources.ts b/.storybook/resources.ts index d2d4b68b632..a6422c55a77 100644 --- a/.storybook/resources.ts +++ b/.storybook/resources.ts @@ -1,4 +1,4 @@ -import { Appearance, Position, Scale, Theme } from "../src/components/interfaces"; +import { Appearance, Position, Scale, ThemeClass } from "../src/components/interfaces"; type Direction = "ltr" | "rtl"; @@ -9,14 +9,14 @@ interface AttributeMetadata { interface CommonAttributes { dir: AttributeMetadata; - theme: AttributeMetadata; + theme: AttributeMetadata; scale: AttributeMetadata; position: AttributeMetadata; appearance: AttributeMetadata; } const dirOptions: Direction[] = ["ltr", "rtl"]; -const themeOptions: Theme[] = ["light", "dark"]; +const themeOptions: ThemeClass[] = ["calcite-theme-light", "calcite-theme-dark", "calcite-theme-auto"]; const positionOptions: Position[] = ["start", "end"]; const scaleOptions: Scale[] = ["s", "m", "l"]; const appearanceOptions: Appearance[] = ["solid", "clear", "outline"]; diff --git a/src/assets/styles/global.scss b/src/assets/styles/global.scss index 0b56731cee7..40eda848454 100644 --- a/src/assets/styles/global.scss +++ b/src/assets/styles/global.scss @@ -49,13 +49,11 @@ @apply font-sans; } -.calcite-theme-dark, -[theme="dark"] { +.calcite-theme-dark { @include calcite-theme-dark-extended(); } -.calcite-theme-light, -[theme="light"] { +.calcite-theme-light { @include calcite-theme-light-extended(); } diff --git a/src/components/calcite-accordion/calcite-accordion.stories.ts b/src/components/calcite-accordion/calcite-accordion.stories.ts index ed1c173d21e..56cdf54d5b0 100644 --- a/src/components/calcite-accordion/calcite-accordion.stories.ts +++ b/src/components/calcite-accordion/calcite-accordion.stories.ts @@ -38,9 +38,9 @@ const createAccordionAttributes: (options?: { exceptions: string[] }) => Attribu } }, { - name: "theme", + name: "class", commit(): Attribute { - this.value = select("theme", theme.values, theme.defaultValue, group); + this.value = select("class", theme.values, theme.defaultValue, group); delete this.build; return this; } @@ -189,9 +189,9 @@ export const icon = (): string => export const darkThemeIcon = (): string => create( "calcite-accordion", - createAccordionAttributes({ exceptions: ["theme"] }).concat({ - name: "theme", - value: "dark" + createAccordionAttributes({ exceptions: ["class"] }).concat({ + name: "class", + value: "calcite-theme-dark" }), html` ${create( diff --git a/src/components/calcite-accordion/readme.md b/src/components/calcite-accordion/readme.md index ee0ca7a84e7..3f790158229 100644 --- a/src/components/calcite-accordion/readme.md +++ b/src/components/calcite-accordion/readme.md @@ -1,6 +1,6 @@ # calcite-accordion -`calcite-accordion` can be used to present content in collapsible sections. Configuration options exist for visual style (theme, icon-position, scale, appearance), and selection functionality. Selection modes include "multi", "single", and "single-persist". +`calcite-accordion` can be used to present content in collapsible sections. Configuration options exist for visual style (icon-position, scale, appearance), and selection functionality. Selection modes include "multi", "single", and "single-persist". diff --git a/src/components/calcite-action-bar/calcite-action-bar.stories.ts b/src/components/calcite-action-bar/calcite-action-bar.stories.ts index d5780dde090..65c60a88ee6 100644 --- a/src/components/calcite-action-bar/calcite-action-bar.stories.ts +++ b/src/components/calcite-action-bar/calcite-action-bar.stories.ts @@ -73,9 +73,9 @@ const createAttributes: (options?: { exceptions: string[] }) => Attributes = ({ } }, { - name: "theme", + name: "class", commit(): Attribute { - this.value = select("theme", theme.values, theme.defaultValue); + this.value = select("class", theme.values, theme.defaultValue); delete this.build; return this; } @@ -103,14 +103,14 @@ export const basic = (): string => export const darkThemeRTL = (): string => create( "calcite-action-bar", - createAttributes({ exceptions: ["dir", "theme"] }).concat([ + createAttributes({ exceptions: ["dir", "class"] }).concat([ { name: "dir", value: "rtl" }, { - name: "theme", - value: "dark" + name: "class", + value: "calcite-theme-dark" } ]), html` diff --git a/src/components/calcite-action-pad/calcite-action-pad.stories.ts b/src/components/calcite-action-pad/calcite-action-pad.stories.ts index 2aed399ef0c..d6c05494489 100644 --- a/src/components/calcite-action-pad/calcite-action-pad.stories.ts +++ b/src/components/calcite-action-pad/calcite-action-pad.stories.ts @@ -73,9 +73,9 @@ const createAttributes: (options?: { exceptions: string[] }) => Attributes = ({ } }, { - name: "theme", + name: "class", commit(): Attribute { - this.value = select("theme", theme.values, theme.defaultValue); + this.value = select("class", theme.values, theme.defaultValue); delete this.build; return this; } @@ -103,14 +103,14 @@ export const basic = (): string => export const darkThemeRTL = (): string => create( "calcite-action-pad", - createAttributes({ exceptions: ["dir", "theme"] }).concat([ + createAttributes({ exceptions: ["dir", "class"] }).concat([ { name: "dir", value: "rtl" }, { - name: "theme", - value: "dark" + name: "class", + value: "calcite-theme-dark" } ]), html` diff --git a/src/components/calcite-action/calcite-action.stories.ts b/src/components/calcite-action/calcite-action.stories.ts index 67179d7eed0..af08a4793a9 100644 --- a/src/components/calcite-action/calcite-action.stories.ts +++ b/src/components/calcite-action/calcite-action.stories.ts @@ -111,9 +111,9 @@ const createAttributes: (options?: { exceptions: string[] }) => Attributes = ({ } }, { - name: "theme", + name: "class", commit(): Attribute { - this.value = select("theme", theme.values, theme.defaultValue); + this.value = select("class", theme.values, theme.defaultValue); delete this.build; return this; } @@ -127,14 +127,14 @@ export const basic = (): string => create("calcite-action", createAttributes()); export const darkThemeRTL = (): string => create( "calcite-action", - createAttributes({ exceptions: ["dir", "theme"] }).concat([ + createAttributes({ exceptions: ["dir", "class"] }).concat([ { name: "dir", value: "rtl" }, { - name: "theme", - value: "dark" + name: "class", + value: "calcite-theme-dark" } ]) ); diff --git a/src/components/calcite-alert/calcite-alert.e2e.ts b/src/components/calcite-alert/calcite-alert.e2e.ts index e6b32ff0ee3..3c398f4774c 100644 --- a/src/components/calcite-alert/calcite-alert.e2e.ts +++ b/src/components/calcite-alert/calcite-alert.e2e.ts @@ -190,7 +190,7 @@ describe("calcite-alert", () => { describe("when theme attribute is dark", () => { it("should render alert dismiss progress bar with value tied to dark theme", async () => { page = await newE2EPage({ - html: `
${alertSnippet}
` + html: `
${alertSnippet}
` }); await page.waitForTimeout(animationDurationInMs); alertDismissProgressBar = await page.find("calcite-alert[active] >>> .alert-dismiss-progress"); diff --git a/src/components/calcite-alert/calcite-alert.stories.ts b/src/components/calcite-alert/calcite-alert.stories.ts index 5a7762c5c12..a0b6312f1e5 100644 --- a/src/components/calcite-alert/calcite-alert.stories.ts +++ b/src/components/calcite-alert/calcite-alert.stories.ts @@ -14,7 +14,7 @@ export default { export const TitleMessageLink = (): string => html` html` html` html` html` export const CustomIcon = (): string => html` html` Close Alert 3 - +
Your great thing happened
Successfully duplicated 2019 Sales Demographics by County layer
View layer
- +
Your great thing happened
Successfully duplicated 2019 Sales Demographics by County layer
View layer
@@ -149,7 +159,7 @@ export const Queue = (): string => html` export const DarkTheme = (): string => html` html` >
Something failed
That thing you wanted to do didn't work as expected
- My action + My action
`; @@ -170,43 +180,61 @@ DarkTheme.story = { export const DarkThemeQueue = (): string => html`
Open or add to queue
- Open Alert 1 - Open Alert 2 - Open Alert 3

Close or remove from queue
- Close Alert 1 - Close Alert 2 Close Alert 3 - +
Your great thing happened
Successfully duplicated 2019 Sales Demographics by County layer
- My action + My action
- +
Your great thing happened
Successfully duplicated 2019 Sales Demographics by County layer
- My action + My action
@@ -222,7 +250,7 @@ DarkThemeQueue.story = { export const Rtl = (): string => html`
html` Attributes } }, { - name: "theme", + name: "class", commit(): Attribute { - this.value = select("theme", theme.values, theme.defaultValue, group); + this.value = select("class", theme.values, theme.defaultValue, group); delete this.build; return this; } diff --git a/src/components/calcite-button/calcite-button.e2e.ts b/src/components/calcite-button/calcite-button.e2e.ts index dedcf717786..6e376152f12 100644 --- a/src/components/calcite-button/calcite-button.e2e.ts +++ b/src/components/calcite-button/calcite-button.e2e.ts @@ -333,7 +333,7 @@ describe("calcite-button", () => { describe("when theme attribute is dark", () => { it("should render button pseudo classes with value tied to dark theme", async () => { page = await newE2EPage({ - html: `
${buttonSnippet}
` + html: `
${buttonSnippet}
` }); buttonEl = await page.find("calcite-button >>> button"); await buttonEl.focus(); diff --git a/src/components/calcite-button/calcite-button.stories.ts b/src/components/calcite-button/calcite-button.stories.ts index f9eed943374..509afa7cd59 100644 --- a/src/components/calcite-button/calcite-button.stories.ts +++ b/src/components/calcite-button/calcite-button.stories.ts @@ -142,7 +142,7 @@ SideBySide.story = { export const DarkMode = (): string => html` html` html` A great example of a study description that might wrap to a line or two, but isn't overly verbose. - Lead footer - Trail footer + Lead footer + Trail footer
`; @@ -148,7 +148,7 @@ FooterButtonsTooltipsDropdown.story = { export const DarkThemeSimple = (): string => html`
- +

ArcGIS Online: Gallery and Organization pages

A great example of a study description that might wrap to a line or two, but isn't overly verbose. html`
- +

ArcGIS Online: Gallery and Organization pages

A great example of a study description that might wrap to a line or two, but isn't overly verbose. - Lead footer - Trail footer + Lead footer + Trail footer
`; @@ -182,11 +182,11 @@ DarkThemeSimpleWithLinks.story = { export const DarkThemeFooterButton = (): string => html`
- + ${footerThumbnail}

Untitled experience

Subtext - Go + Go
`; @@ -198,14 +198,14 @@ DarkThemeFooterButton.story = { export const DarkThemeFooterLinks = (): string => html`
- + ${footerThumbnail}

My perhaps multiline card title

A great example of a study description that might wrap to a line or two, but isn't overly verbose. - Lead footer - Trail footer + Lead footer + Trail footer
`; @@ -218,7 +218,7 @@ DarkThemeFooterLinks.story = { export const DarkThemeFooterTextButtonsTooltips = (): string => html`
- + ${footerThumbnail}

My great project that might wrap two lines

Johnathan Smith @@ -232,8 +232,12 @@ export const DarkThemeFooterTextButtonsTooltips = (): string => html`
- Configure - Delete + Configure + + Delete + `; DarkThemeFooterTextButtonsTooltips.story = { @@ -244,7 +248,7 @@ DarkThemeFooterTextButtonsTooltips.story = { export const DarkThemeFooterButtonsTooltipsDropdown = (): string => html`
- + html`

Portland Businesses

by - example_user + example_user
Created: Apr 22, 2019 @@ -272,14 +276,14 @@ export const DarkThemeFooterButtonsTooltipsDropdown = (): string => html` >
html` > html`
My great tooltip example Sharing level: 2 - More... - More options `; diff --git a/src/components/calcite-checkbox/calcite-checkbox.stories.ts b/src/components/calcite-checkbox/calcite-checkbox.stories.ts index aa049867091..d6f66e1fa1f 100644 --- a/src/components/calcite-checkbox/calcite-checkbox.stories.ts +++ b/src/components/calcite-checkbox/calcite-checkbox.stories.ts @@ -24,9 +24,8 @@ export const Simple = (): string => html` `; export const DarkMode = (): string => html` - + { describe("when theme attribute is dark", () => { it("should render button pseudo classes with value tied to dark theme", async () => { page = await newE2EPage({ - html: `
${chipSnippet}
` + html: `
${chipSnippet}
` }); chipCloseButton = await page.find("calcite-chip >>> button"); await chipCloseButton.focus(); diff --git a/src/components/calcite-chip/calcite-chip.stories.ts b/src/components/calcite-chip/calcite-chip.stories.ts index 83a517e5192..ae25ffebe51 100644 --- a/src/components/calcite-chip/calcite-chip.stories.ts +++ b/src/components/calcite-chip/calcite-chip.stories.ts @@ -78,7 +78,7 @@ export const WithAvatar = (): string => { export const DarkTheme = (): string => html`
export const DarkMode = (): string => create("calcite-color-picker", [ ...createColorAttributes(), - { name: "theme", value: "dark" }, + { name: "class", value: "calcite-theme-dark" }, { name: "value", value: text("value", "#b33f33") diff --git a/src/components/calcite-combobox/calcite-combobox.stories.ts b/src/components/calcite-combobox/calcite-combobox.stories.ts index 932e77af116..64324e80540 100644 --- a/src/components/calcite-combobox/calcite-combobox.stories.ts +++ b/src/components/calcite-combobox/calcite-combobox.stories.ts @@ -81,7 +81,7 @@ export const DarkTheme = (): string => html` html`
- + Date html` html` ${boolean("disable-close-on-select", false)} ${boolean("disabled", false)} > - Open Dropdown + Open Dropdown html` html` ${boolean("disable-close-on-select", false)} ${boolean("disabled", false)} > - Open Dropdown + Open Dropdown html` - Open Dropdown + Open Dropdown Apple Orange @@ -304,7 +304,7 @@ GroupsAndSelectionModesDarkTheme.story = { export const ItemsAsLinksDarkTheme = (): string => html` html` ${boolean("disable-close-on-select", false)} ${boolean("disabled", false)} > - Open Dropdown + Open Dropdown Throw Apples Attributes = ({ } }, { - name: "theme", + name: "class", commit(): Attribute { - this.value = select("theme", theme.values, theme.defaultValue); + this.value = select("class", theme.values, theme.defaultValue); delete this.build; return this; } @@ -111,14 +111,14 @@ export const basic = (): string => create("calcite-fab", createAttributes()); export const darkThemeRTL = (): string => create( "calcite-fab", - createAttributes({ exceptions: ["dir", "theme"] }).concat([ + createAttributes({ exceptions: ["dir", "class"] }).concat([ { name: "dir", value: "rtl" }, { - name: "theme", - value: "dark" + name: "class", + value: "calcite-theme-dark" } ]) ); diff --git a/src/components/calcite-flow/calcite-flow.stories.ts b/src/components/calcite-flow/calcite-flow.stories.ts index 576155f6a30..89a32419f3a 100644 --- a/src/components/calcite-flow/calcite-flow.stories.ts +++ b/src/components/calcite-flow/calcite-flow.stories.ts @@ -38,9 +38,9 @@ const createAttributes: (options?: { exceptions: string[] }) => Attributes = ({ } }, { - name: "theme", + name: "class", commit(): Attribute { - this.value = select("theme", theme.values, theme.defaultValue, group); + this.value = select("class", theme.values, theme.defaultValue, group); delete this.build; return this; } diff --git a/src/components/calcite-icon/calcite-icon.stories.ts b/src/components/calcite-icon/calcite-icon.stories.ts index 13eb907d54c..5c27509212c 100644 --- a/src/components/calcite-icon/calcite-icon.stories.ts +++ b/src/components/calcite-icon/calcite-icon.stories.ts @@ -29,7 +29,7 @@ export const darkMode = (): string => html` color: var(--calcite-ui-warning); } - + `; darkMode.parameters = { backgrounds: darkBackground }; diff --git a/src/components/calcite-inline-editable/calcite-inline-editable.stories.ts b/src/components/calcite-inline-editable/calcite-inline-editable.stories.ts index 04168358959..a2a2d5ec162 100644 --- a/src/components/calcite-inline-editable/calcite-inline-editable.stories.ts +++ b/src/components/calcite-inline-editable/calcite-inline-editable.stories.ts @@ -95,7 +95,7 @@ export const WithoutLabelRTL = (): string => html` export const DarkMode = (): string => html`
html` export const DarkMode = (): string => html`
- + Date html` export const SimpleDarkMode = (): string => html`
- + ${text("label text", "My great label")} - + Default label wrapping a switch - + - + Default label wrapping a radio group React @@ -98,49 +98,49 @@ export const DarkTheme = (): string => html` Angular - + Text leading inline - + - - + + Text trailing inline - + Off - + On - + Text leading inline - + - + Focus slider test - + - + Focus slider test - + - - + + Text trailing inline - + Text leading inline-space-between - + - - + + Text trailing inline-space-between - + Text leading inline-space-between - + - - + + Text trailing inline-space-between
diff --git a/src/components/calcite-link/calcite-link.e2e.ts b/src/components/calcite-link/calcite-link.e2e.ts index 9f42c383a6c..5ec5ea59602 100644 --- a/src/components/calcite-link/calcite-link.e2e.ts +++ b/src/components/calcite-link/calcite-link.e2e.ts @@ -217,7 +217,7 @@ describe("calcite-link", () => { describe("when theme attribute is dark", () => { it("should render link background with value tied to dark theme", async () => { page = await newE2EPage({ - html: `
${linkHtml}
` + html: `
${linkHtml}
` }); link = await page.find("calcite-link >>> a"); linkStyles = await link.getComputedStyle(); diff --git a/src/components/calcite-link/calcite-link.stories.ts b/src/components/calcite-link/calcite-link.stories.ts index ccd1d1324b9..87f64f86291 100644 --- a/src/components/calcite-link/calcite-link.stories.ts +++ b/src/components/calcite-link/calcite-link.stories.ts @@ -116,7 +116,7 @@ export const DarkMode = (): string => html` )}px; font-weight: ${select("containing font weight", ["300", "400", "500", "700"], "400")};" > Some wrapping text - ${text("text", "link text here")} around the link diff --git a/src/components/calcite-loader/calcite-loader.stories.ts b/src/components/calcite-loader/calcite-loader.stories.ts index 3259f269230..c9e6e4fe55c 100644 --- a/src/components/calcite-loader/calcite-loader.stories.ts +++ b/src/components/calcite-loader/calcite-loader.stories.ts @@ -39,7 +39,7 @@ export const DarkMode = (): string => html` ${boolean("no-padding", false)} value="${number("value", 0, { range: true, min: 0, max: 100, step: 1 })}" active - theme="dark" + class="calcite-theme-dark" /> `; diff --git a/src/components/calcite-modal/calcite-modal.stories.ts b/src/components/calcite-modal/calcite-modal.stories.ts index 77bf7db7635..d6854cc6729 100644 --- a/src/components/calcite-modal/calcite-modal.stories.ts +++ b/src/components/calcite-modal/calcite-modal.stories.ts @@ -56,7 +56,7 @@ export const CustomSize = (): string => html` export const DarkMode = (): string => html` html`

The small modal is perfect for short confirmation dialogs or very compact interfaces with few elements.

- Back - Cancel - Save + Cancel + Save
`; diff --git a/src/components/calcite-notice/calcite-notice.stories.ts b/src/components/calcite-notice/calcite-notice.stories.ts index 44692215264..5b04dbc2e39 100644 --- a/src/components/calcite-notice/calcite-notice.stories.ts +++ b/src/components/calcite-notice/calcite-notice.stories.ts @@ -15,7 +15,7 @@ export default { export const Simple = (): string => html`
html` export const CustomIcon = (): string => html`
html`
html`
html` total="${number("total", 128)}" num="${number("num", 20)}" dir="${select("dir", ["ltr", "rtl"], "ltr")}" - theme="light" + class="calcite-theme-light" > `; @@ -31,7 +31,7 @@ export const DarkMode = (): string => html` total="${number("total", 128)}" num="${number("num", 20)}" dir="${select("dir", ["ltr", "rtl"], "ltr")}" - theme="dark" + class="calcite-theme-dark" > `; @@ -48,7 +48,7 @@ export const RTL = (): string => html` total="${number("total", 128)}" num="${number("num", 20)}" dir="${select("dir", ["ltr", "rtl"], "ltr")}" - theme="light" + class="calcite-theme-light" > `; diff --git a/src/components/calcite-panel/calcite-panel.stories.ts b/src/components/calcite-panel/calcite-panel.stories.ts index 5b15af80e2a..9b65825bd2b 100644 --- a/src/components/calcite-panel/calcite-panel.stories.ts +++ b/src/components/calcite-panel/calcite-panel.stories.ts @@ -81,9 +81,9 @@ const createAttributes: (options?: { exceptions: string[] }) => Attributes = ({ } }, { - name: "theme", + name: "class", commit(): Attribute { - this.value = select("theme", theme.values, theme.defaultValue); + this.value = select("class", theme.values, theme.defaultValue); delete this.build; return this; } @@ -136,14 +136,14 @@ export const basic = (): string => create("calcite-panel", createAttributes(), p export const darkThemeRTL = (): string => create( "calcite-panel", - createAttributes({ exceptions: ["dir", "theme"] }).concat([ + createAttributes({ exceptions: ["dir", "class"] }).concat([ { name: "dir", value: "rtl" }, { - name: "theme", - value: "dark" + name: "class", + value: "calcite-theme-dark" } ]), panelContent diff --git a/src/components/calcite-pick-list/calcite-pick-list.stories.ts b/src/components/calcite-pick-list/calcite-pick-list.stories.ts index 2b91b2a6869..21e0b7dada5 100644 --- a/src/components/calcite-pick-list/calcite-pick-list.stories.ts +++ b/src/components/calcite-pick-list/calcite-pick-list.stories.ts @@ -64,9 +64,9 @@ const createAttributes: (options?: { exceptions: string[] }) => Attributes = ({ } }, { - name: "theme", + name: "class", commit(): Attribute { - this.value = select("theme", theme.values, theme.defaultValue); + this.value = select("class", theme.values, theme.defaultValue); delete this.build; return this; } @@ -105,14 +105,14 @@ export const basic = (): string => export const darkThemeRTL = (): string => create( "calcite-pick-list", - createAttributes({ exceptions: ["dir", "theme"] }).concat([ + createAttributes({ exceptions: ["dir", "class"] }).concat([ { name: "dir", value: "rtl" }, { - name: "theme", - value: "dark" + name: "class", + value: "calcite-theme-dark" } ]), html` diff --git a/src/components/calcite-popover/calcite-popover.stories.ts b/src/components/calcite-popover/calcite-popover.stories.ts index fb804f47ef3..ea1ca7e3799 100644 --- a/src/components/calcite-popover/calcite-popover.stories.ts +++ b/src/components/calcite-popover/calcite-popover.stories.ts @@ -61,7 +61,7 @@ export const Simple = (): string => {
${referenceElementHTML} {
${referenceElementHTML} {
${referenceElementHTML} html` export const DarkMode = (): string => html` html` export const DarkTheme = (): string => html` html` `; export const DarkTheme = (): string => html` - + html` ${boolean("focused", false)} name="dark" scale="${select("scale", ["s", "m", "l"], "m")}" - theme="dark" value="value" > diff --git a/src/components/calcite-radio-group/calcite-radio-group.stories.ts b/src/components/calcite-radio-group/calcite-radio-group.stories.ts index e92dd11a298..35faf056a5d 100644 --- a/src/components/calcite-radio-group/calcite-radio-group.stories.ts +++ b/src/components/calcite-radio-group/calcite-radio-group.stories.ts @@ -67,7 +67,7 @@ WithIcons.story = { export const DarkMode = (): string => html` html` export const DarkMode = (): string => html` { describe("when theme attribute is dark", () => { it("should render scrim background with value tied to dark theme", async () => { page = await newE2EPage({ - html: `
${scrimSnippet}
` + html: `
${scrimSnippet}
` }); scrim = await page.find("calcite-scrim >>> .scrim"); scrimStyles = await scrim.getComputedStyle(); diff --git a/src/components/calcite-scrim/calcite-scrim.stories.ts b/src/components/calcite-scrim/calcite-scrim.stories.ts index 12485010d0c..280bd64a5ab 100644 --- a/src/components/calcite-scrim/calcite-scrim.stories.ts +++ b/src/components/calcite-scrim/calcite-scrim.stories.ts @@ -43,7 +43,7 @@ export const Simple = (): string => html` export const DarkMode = (): string => html`
- +

Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor diff --git a/src/components/calcite-select/calcite-select.stories.ts b/src/components/calcite-select/calcite-select.stories.ts index af7f8a367fe..43fdf38018d 100644 --- a/src/components/calcite-select/calcite-select.stories.ts +++ b/src/components/calcite-select/calcite-select.stories.ts @@ -37,9 +37,9 @@ const createSelectAttributes: (options?: { exceptions: string[] }) => Attributes } }, { - name: "theme", + name: "class", commit(): Attribute { - this.value = select("theme", theme.values, theme.defaultValue, group); + this.value = select("class", theme.values, theme.defaultValue, group); delete this.build; return this; } diff --git a/src/components/calcite-shell/calcite-shell.stories.ts b/src/components/calcite-shell/calcite-shell.stories.ts index 5b343e6412e..6167d0dab35 100644 --- a/src/components/calcite-shell/calcite-shell.stories.ts +++ b/src/components/calcite-shell/calcite-shell.stories.ts @@ -39,9 +39,9 @@ const createAttributes: (group: string, options?: { exceptions: string[] }) => A } }, { - name: "theme", + name: "class", commit(): Attribute { - this.value = select("theme", theme.values, theme.defaultValue, group); + this.value = select("class", theme.values, theme.defaultValue, group); delete this.build; return this; } @@ -123,11 +123,13 @@ const actionBarContextualContentHTML = html` `; const actionBarPrimaryHTML = html` - ${actionBarPrimaryContentHTML} + ${actionBarPrimaryContentHTML} `; const actionBarContextualHTML = html` - ${actionBarContextualContentHTML} + + ${actionBarContextualContentHTML} + `; const leadingPanelHTML = html` diff --git a/src/components/calcite-shell/readme.md b/src/components/calcite-shell/readme.md index a45cb61e00c..33dd1a4a358 100644 --- a/src/components/calcite-shell/readme.md +++ b/src/components/calcite-shell/readme.md @@ -17,7 +17,7 @@ Renders a shell with leading and trailing floating panels, action bar/pad, block ```html - + diff --git a/src/components/calcite-shell/usage/advanced.md b/src/components/calcite-shell/usage/advanced.md index 9cbe339532b..222530d6732 100644 --- a/src/components/calcite-shell/usage/advanced.md +++ b/src/components/calcite-shell/usage/advanced.md @@ -5,7 +5,7 @@ Renders a shell with leading and trailing floating panels, action bar/pad, block ```html - + diff --git a/src/components/calcite-slider/calcite-slider.stories.ts b/src/components/calcite-slider/calcite-slider.stories.ts index c2b131e34b8..ac6952ffaca 100644 --- a/src/components/calcite-slider/calcite-slider.stories.ts +++ b/src/components/calcite-slider/calcite-slider.stories.ts @@ -72,7 +72,7 @@ export const Histogram = (): HTMLCalciteSliderElement => { }; export const DarkMode = (): string => html` - + `; DarkMode.story = { diff --git a/src/components/calcite-split-button/calcite-split-button.stories.ts b/src/components/calcite-split-button/calcite-split-button.stories.ts index eef1cf7a22c..30c89fec051 100644 --- a/src/components/calcite-split-button/calcite-split-button.stories.ts +++ b/src/components/calcite-split-button/calcite-split-button.stories.ts @@ -119,7 +119,7 @@ export const DarkMode = (): string => html` primary-text="${text("primary-text", "Primary Option")}" dropdown-label="${text("dropdown-label", "Additional Options")}" dropdown-icon-type="${select("dropdown-icon-type", ["chevron", "caret", "ellipsis", "overflow"], "chevron")}" - theme="dark" + class="calcite-theme-dark" > Option 2 diff --git a/src/components/calcite-stepper/calcite-stepper.stories.ts b/src/components/calcite-stepper/calcite-stepper.stories.ts index df915702ae6..3e955d00988 100644 --- a/src/components/calcite-stepper/calcite-stepper.stories.ts +++ b/src/components/calcite-stepper/calcite-stepper.stories.ts @@ -95,7 +95,7 @@ NoContent.story = { export const DarkMode = (): string => html` html` html` diff --git a/src/components/calcite-tile-select-group/calcite-tile-select-group.stories.ts b/src/components/calcite-tile-select-group/calcite-tile-select-group.stories.ts index 29985d2bae7..a32ca9e9f41 100644 --- a/src/components/calcite-tile-select-group/calcite-tile-select-group.stories.ts +++ b/src/components/calcite-tile-select-group/calcite-tile-select-group.stories.ts @@ -73,7 +73,7 @@ export const Dark = (): string => html` html` name="${text("name", "tile-select-demo")}" ${boolean("input-enabled", true)} input-alignment="${select("input-alignment", ["start", "end"], "end")}" - theme="dark" + class="calcite-theme-dark" type="${select("type", ["radio", "checkbox"], "radio")}" value="${text("value", "one")}" > diff --git a/src/components/calcite-tile/calcite-tile.stories.ts b/src/components/calcite-tile/calcite-tile.stories.ts index 6eec607b44c..8068957ea06 100644 --- a/src/components/calcite-tile/calcite-tile.stories.ts +++ b/src/components/calcite-tile/calcite-tile.stories.ts @@ -38,7 +38,7 @@ export const Dark = (): string => html` ${boolean("hidden", false)} href="${text("href", "#")}" icon="${select("icon", iconNames, "layer")}" - theme="dark" + class="calcite-theme-dark" > `; diff --git a/src/components/calcite-tip-manager/calcite-tip-manager.stories.ts b/src/components/calcite-tip-manager/calcite-tip-manager.stories.ts index 82e12ca2e39..953ed4dfd57 100644 --- a/src/components/calcite-tip-manager/calcite-tip-manager.stories.ts +++ b/src/components/calcite-tip-manager/calcite-tip-manager.stories.ts @@ -81,9 +81,9 @@ const createAttributes: (options?: { exceptions: string[] }) => Attributes = ({ } }, { - name: "theme", + name: "class", commit(): Attribute { - this.value = select("theme", theme.values, theme.defaultValue); + this.value = select("class", theme.values, theme.defaultValue); delete this.build; return this; } @@ -142,9 +142,9 @@ export const basic = (): string => create("calcite-tip-manager", createAttribute export const darkThemeRTL = (): string => create( "calcite-tip-manager", - createAttributes({ exceptions: ["dir", "theme"] }).concat([ + createAttributes({ exceptions: ["dir", "class"] }).concat([ { name: "dir", value: "rtl" }, - { name: "theme", value: "dark" } + { name: "class", value: "calcite-theme-dark" } ]), tipContent ); diff --git a/src/components/calcite-tip/calcite-tip.stories.ts b/src/components/calcite-tip/calcite-tip.stories.ts index b7a53dd3845..c13a6bb2b7f 100644 --- a/src/components/calcite-tip/calcite-tip.stories.ts +++ b/src/components/calcite-tip/calcite-tip.stories.ts @@ -65,9 +65,9 @@ const createAttributes: (options?: { exceptions: string[] }) => Attributes = ({ } }, { - name: "theme", + name: "class", commit(): Attribute { - this.value = select("theme", theme.values, theme.defaultValue); + this.value = select("class", theme.values, theme.defaultValue); delete this.build; return this; } @@ -86,9 +86,9 @@ export const basic = (): string => create("calcite-tip", createAttributes(), htm export const darkThemeRTL = (): string => create( "calcite-tip", - createAttributes({ exceptions: ["dir", "theme"] }).concat([ + createAttributes({ exceptions: ["dir", "class"] }).concat([ { name: "dir", value: "rtl" }, - { name: "theme", value: "dark" } + { name: "class", value: "calcite-theme-dark" } ]), html ); diff --git a/src/components/calcite-tooltip/calcite-tooltip.stories.ts b/src/components/calcite-tooltip/calcite-tooltip.stories.ts index 883714b049e..4a0fed4175d 100644 --- a/src/components/calcite-tooltip/calcite-tooltip.stories.ts +++ b/src/components/calcite-tooltip/calcite-tooltip.stories.ts @@ -42,7 +42,7 @@ export const Simple = (): string => {

${referenceElementHTML} {
${referenceElementHTML} html` export const DarkMode = (): string => html` Attributes = ({ } }, { - name: "theme", + name: "class", commit(): Attribute { - this.value = select("theme", theme.values, theme.defaultValue); + this.value = select("class", theme.values, theme.defaultValue); delete this.build; return this; } @@ -119,9 +119,9 @@ export const basic = (): string => export const darkThemeRTL = (): string => create( "calcite-value-list", - createAttributes({ exceptions: ["dir", "theme"] }).concat([ + createAttributes({ exceptions: ["dir", "class"] }).concat([ { name: "dir", value: "rtl" }, - { name: "theme", value: "dark" } + { name: "class", value: "calcite-theme-dark" } ]), html` diff --git a/src/components/interfaces.ts b/src/components/interfaces.ts index ec5afbfe5b8..5524d170fd2 100644 --- a/src/components/interfaces.ts +++ b/src/components/interfaces.ts @@ -7,5 +7,5 @@ export type Layout = "horizontal" | "vertical" | "grid"; export type Position = "start" | "end"; export type Scale = "s" | "m" | "l"; export type Status = "invalid" | "valid" | "idle"; -export type Theme = "light" | "dark"; +export type ThemeClass = "calcite-theme-light" | "calcite-theme-dark" | "calcite-theme-auto"; export type Width = "auto" | "half" | "full"; diff --git a/src/demos/_assets/toggles.template b/src/demos/_assets/toggles.template index 85bbc5e96b3..e43ad9b6798 100644 --- a/src/demos/_assets/toggles.template +++ b/src/demos/_assets/toggles.template @@ -51,7 +51,7 @@ function dragElement(elmnt) { } } -
+
Demo Toggles
diff --git a/src/demos/shell/demo-app-advanced-3.html b/src/demos/shell/demo-app-advanced-3.html index d3ff78d2213..78263b690ec 100644 --- a/src/demos/shell/demo-app-advanced-3.html +++ b/src/demos/shell/demo-app-advanced-3.html @@ -72,7 +72,12 @@ > Shell Floating Panel Content
- ({ ...acc, [name]: value }), {}); } -export function getThemeName(el: HTMLElement): Theme { - return closestElementCrossShadowBoundary(`.${CSS_UTILITY.darkTheme}, [theme=dark]`, el) ? "dark" : "light"; +export function getThemeName(el: HTMLElement): "light" | "dark" { + return closestElementCrossShadowBoundary(`.${CSS_UTILITY.darkTheme}`, el) ? "dark" : "light"; } export function getElementDir(el: HTMLElement): Direction {