Skip to content

chore: update dependency @spectrum-css/switch to v6.1.0 #5346

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

Merged
merged 3 commits into from
Apr 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .changeset/stale-candies-camp.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
'@spectrum-web-components/styles': patch
'@spectrum-web-components/switch': patch
'@spectrum-web-components/tabs': patch
'@spectrum-web-components/toast': patch
'@spectrum-web-components/tooltip': patch
Expand Down
2 changes: 1 addition & 1 deletion packages/switch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"@spectrum-web-components/checkbox": "1.5.0"
},
"devDependencies": {
"@spectrum-css/switch": "6.0.0-s2-foundations.16"
"@spectrum-css/switch": "6.1.0"
},
"types": "./src/index.d.ts",
"customElements": "custom-elements.json",
Expand Down
91 changes: 81 additions & 10 deletions packages/switch/src/spectrum-switch.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,78 @@ governing permissions and limitations under the License.

/* THIS FILE IS MACHINE GENERATED. DO NOT EDIT */
:host {
--spectrum-switch-label-color-default: var(--spectrum-neutral-content-color-default);
--spectrum-switch-label-color-hover: var(--spectrum-neutral-content-color-hover);
--spectrum-switch-label-color-down: var(--spectrum-neutral-content-color-down);
--spectrum-switch-label-color-focus: var(--spectrum-neutral-content-color-key-focus);
--spectrum-switch-label-color-disabled: var(--spectrum-disabled-content-color);
--spectrum-switch-background-color-selected-default: var(--spectrum-neutral-background-color-selected-default);
--spectrum-switch-background-color-selected-hover: var(--spectrum-neutral-background-color-selected-hover);
--spectrum-switch-background-color-selected-down: var(--spectrum-neutral-background-color-selected-down);
--spectrum-switch-background-color-selected-focus: var(--spectrum-neutral-background-color-selected-key-focus);
--spectrum-switch-background-color-selected-disabled: var(--spectrum-disabled-content-color);
--spectrum-switch-focus-indicator-thickness: var(--mod-focus-indicator-thickness, var(--spectrum-focus-indicator-thickness));
--spectrum-switch-focus-indicator-color: var(--spectrum-focus-indicator-color);
--spectrum-switch-handle-border-color-disabled: var(--spectrum-disabled-content-color);
}

:host([disabled]) {
--spectrum-switch-label-color-default: var(--spectrum-disabled-content-color);
}

:host([emphasized]) {
--spectrum-switch-background-color-selected-default: var(--spectrum-accent-color-900);
--spectrum-switch-background-color-selected-hover: var(--spectrum-accent-color-1000);
--spectrum-switch-background-color-selected-down: var(--spectrum-accent-color-1100);
--spectrum-switch-background-color-selected-focus: var(--spectrum-accent-color-1000);
--spectrum-switch-handle-border-color-selected-default: var(--spectrum-accent-color-900);
--spectrum-switch-handle-border-color-selected-hover: var(--spectrum-accent-color-1000);
--spectrum-switch-handle-border-color-selected-down: var(--spectrum-accent-color-1100);
--spectrum-switch-handle-border-color-selected-focus: var(--spectrum-accent-color-1000);
}

:host,
:host {
--spectrum-switch-min-height: var(--spectrum-component-height-100);
--spectrum-switch-control-width: var(--spectrum-switch-control-width-medium);
--spectrum-switch-control-height: var(--spectrum-switch-control-height-medium);
--spectrum-switch-control-label-spacing: var(--spectrum-text-to-control-100);
--spectrum-switch-spacing-top-to-control: var(--spectrum-switch-top-to-control-medium);
--spectrum-switch-spacing-top-to-label: var(--spectrum-component-top-to-text-100);
--spectrum-switch-font-size: var(--spectrum-font-size-100);
}

:host([size='s']) {
--spectrum-switch-min-height: var(--spectrum-component-height-75);
--spectrum-switch-control-width: var(--spectrum-switch-control-width-small);
--spectrum-switch-control-height: var(--spectrum-switch-control-height-small);
--spectrum-switch-control-label-spacing: var(--spectrum-text-to-control-75);
--spectrum-switch-spacing-top-to-control: var(--spectrum-switch-top-to-control-small);
--spectrum-switch-spacing-top-to-label: var(--spectrum-component-top-to-text-75);
--spectrum-switch-font-size: var(--spectrum-font-size-75);
}

:host([size='l']) {
--spectrum-switch-min-height: var(--spectrum-component-height-200);
--spectrum-switch-control-width: var(--spectrum-switch-control-width-large);
--spectrum-switch-control-height: var(--spectrum-switch-control-height-large);
--spectrum-switch-control-label-spacing: var(--spectrum-text-to-control-200);
--spectrum-switch-spacing-top-to-control: var(--spectrum-switch-top-to-control-large);
--spectrum-switch-spacing-top-to-label: var(--spectrum-component-top-to-text-200);
--spectrum-switch-font-size: var(--spectrum-font-size-200);
}

:host([size='xl']) {
--spectrum-switch-min-height: var(--spectrum-component-height-300);
--spectrum-switch-control-width: var(--spectrum-switch-control-width-extra-large);
--spectrum-switch-control-height: var(--spectrum-switch-control-height-extra-large);
--spectrum-switch-control-label-spacing: var(--spectrum-text-to-control-300);
--spectrum-switch-spacing-top-to-control: var(--spectrum-switch-top-to-control-extra-large);
--spectrum-switch-spacing-top-to-label: var(--spectrum-component-top-to-text-300);
--spectrum-switch-font-size: var(--spectrum-font-size-300);
}

:host {
min-block-size: var(--mod-switch-height, var(--spectrum-switch-min-height));
max-inline-size: 100%;
vertical-align: top;
Expand Down Expand Up @@ -140,7 +211,7 @@ governing permissions and limitations under the License.
}

#input:focus-visible + #switch:after {
box-shadow: 0 0 0 var(--mod-switch-focus-indicator-thickness, var(--mod-focus-indicator-thickness, var(--spectrum-switch-focus-indicator-thickness))) var(--highcontrast-switch-focus-indicator-color, var(--mod-switch-focus-indicator-color, var(--spectrum-switch-focus-indicator-color)));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just want to note here that --mod-focus-indicator-thickness is not removed, it's referenced on line 25 which results in the same modifier rendering order as the previous stack supported here.

box-shadow: 0 0 0 var(--mod-switch-focus-indicator-thickness, var(--spectrum-switch-focus-indicator-thickness)) var(--highcontrast-switch-focus-indicator-color, var(--mod-switch-focus-indicator-color, var(--spectrum-switch-focus-indicator-color)));
}

#input:focus-visible + #switch:before {
Expand Down Expand Up @@ -179,7 +250,7 @@ governing permissions and limitations under the License.

:host([disabled]:hover) #input + #switch,
:host([disabled]:hover) #input + #switch {
background-color: var(--highcontrast-switch-background-color-disabled, var(--mod-switch-background-color-disabled, var(--spectrum-switch-background-color-disabled)));
background-color: var(--mod-switch-background-color-disabled, var(--spectrum-switch-background-color-disabled));
}

:host([disabled]:hover) #input + #switch:before,
Expand Down Expand Up @@ -208,7 +279,7 @@ governing permissions and limitations under the License.
}

:host(:hover) #input:focus-visible + #switch:after {
box-shadow: 0 0 0 var(--mod-switch-focus-indicator-thickness, var(--mod-focus-indicator-thickness, var(--spectrum-switch-focus-indicator-thickness))) var(--highcontrast-switch-focus-indicator-color, var(--mod-switch-focus-indicator-color, var(--spectrum-switch-focus-indicator-color)));
box-shadow: 0 0 0 var(--mod-switch-focus-indicator-thickness, var(--spectrum-switch-focus-indicator-thickness)) var(--highcontrast-switch-focus-indicator-color, var(--mod-switch-focus-indicator-color, var(--spectrum-switch-focus-indicator-color)));
}

:host(:hover) #input:focus-visible + #switch:before {
Expand Down Expand Up @@ -238,7 +309,7 @@ governing permissions and limitations under the License.

:host([disabled]) #input + #switch,
:host([disabled]) #input + #switch {
background-color: var(--highcontrast-switch-background-color-disabled, var(--mod-switch-background-color-disabled, var(--spectrum-switch-background-color-disabled)));
background-color: var(--mod-switch-background-color-disabled, var(--spectrum-switch-background-color-disabled));
}

:host([disabled]) #input + #switch:before,
Expand Down Expand Up @@ -299,39 +370,39 @@ governing permissions and limitations under the License.

:host([disabled][checked]:hover) #input + #switch,
:host([disabled][checked]:hover) #input + #switch {
background-color: GrayText;
box-shadow: inset 0 0 0 1px GrayText;
background-color: GrayText;
}

:host([disabled][checked]:hover) #input + #switch:before,
:host([disabled][checked]:hover) #input + #switch:before {
background-color: ButtonFace;
border-color: GrayText;
background-color: ButtonFace;
}
}

:host([disabled]) #input:not(:checked) + #switch,
:host([disabled]) #input:not(:checked) + #switch {
background-color: ButtonFace;
box-shadow: inset 0 0 0 1px GrayText;
background-color: ButtonFace;
}

:host([disabled]) #input:not(:checked) + #switch:before,
:host([disabled]) #input:not(:checked) + #switch:before {
background-color: ButtonFace;
border-color: GrayText;
background-color: ButtonFace;
}

:host([disabled][checked]) #input + #switch,
:host([disabled][checked]) #input + #switch {
background-color: GrayText;
box-shadow: inset 0 0 0 1px GrayText;
background-color: GrayText;
}

:host([disabled][checked]) #input + #switch:before,
:host([disabled][checked]) #input + #switch:before {
background-color: ButtonFace;
border-color: GrayText;
background-color: ButtonFace;
}

:host([disabled]) #input ~ #label,
Expand Down
138 changes: 0 additions & 138 deletions packages/switch/src/switch-overrides.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,149 +36,11 @@ governing permissions and limitations under the License.
--spectrum-switch-handle-border-color-selected-focus: var(
--system-switch-handle-border-color-selected-focus
);
--spectrum-switch-label-color-default: var(
--system-switch-label-color-default
);
--spectrum-switch-label-color-hover: var(--system-switch-label-color-hover);
--spectrum-switch-label-color-down: var(--system-switch-label-color-down);
--spectrum-switch-label-color-focus: var(--system-switch-label-color-focus);
--spectrum-switch-label-color-disabled: var(
--system-switch-label-color-disabled
);
--spectrum-switch-background-color: var(--system-switch-background-color);
--spectrum-switch-background-color-disabled: var(
--system-switch-background-color-disabled
);
--spectrum-switch-background-color-selected-disabled: var(
--system-switch-background-color-selected-disabled
);
--spectrum-switch-background-color-selected-default: var(
--system-switch-background-color-selected-default
);
--spectrum-switch-background-color-selected-hover: var(
--system-switch-background-color-selected-hover
);
--spectrum-switch-background-color-selected-down: var(
--system-switch-background-color-selected-down
);
--spectrum-switch-background-color-selected-focus: var(
--system-switch-background-color-selected-focus
);
--spectrum-switch-focus-indicator-thickness: var(
--system-switch-focus-indicator-thickness
);
--spectrum-switch-focus-indicator-color: var(
--system-switch-focus-indicator-color
);
--spectrum-switch-handle-background-color: var(
--system-switch-handle-background-color
);
--spectrum-switch-handle-border-color-disabled: var(
--system-switch-handle-border-color-disabled
);
}

:host([disabled]) {
--spectrum-switch-label-color-default: var(
--system-switch-disabled-label-color-default
);
}

:host([emphasized]) {
--spectrum-switch-background-color-selected-default: var(
--system-switch-emphasized-background-color-selected-default
);
--spectrum-switch-background-color-selected-hover: var(
--system-switch-emphasized-background-color-selected-hover
);
--spectrum-switch-background-color-selected-down: var(
--system-switch-emphasized-background-color-selected-down
);
--spectrum-switch-background-color-selected-focus: var(
--system-switch-emphasized-background-color-selected-focus
);
--spectrum-switch-handle-border-color-selected-default: var(
--system-switch-emphasized-handle-border-color-selected-default
);
--spectrum-switch-handle-border-color-selected-hover: var(
--system-switch-emphasized-handle-border-color-selected-hover
);
--spectrum-switch-handle-border-color-selected-down: var(
--system-switch-emphasized-handle-border-color-selected-down
);
--spectrum-switch-handle-border-color-selected-focus: var(
--system-switch-emphasized-handle-border-color-selected-focus
);
}

:host([size='s']) {
--spectrum-switch-min-height: var(--system-switch-size-s-min-height);
--spectrum-switch-control-width: var(--system-switch-size-s-control-width);
--spectrum-switch-control-height: var(
--system-switch-size-s-control-height
);
--spectrum-switch-control-label-spacing: var(
--system-switch-size-s-control-label-spacing
);
--spectrum-switch-spacing-top-to-control: var(
--system-switch-size-s-spacing-top-to-control
);
--spectrum-switch-spacing-top-to-label: var(
--system-switch-size-s-spacing-top-to-label
);
--spectrum-switch-font-size: var(--system-switch-size-s-font-size);
}

:host {
--spectrum-switch-min-height: var(--system-switch-size-m-min-height);
--spectrum-switch-control-width: var(--system-switch-size-m-control-width);
--spectrum-switch-control-height: var(
--system-switch-size-m-control-height
);
--spectrum-switch-control-label-spacing: var(
--system-switch-size-m-control-label-spacing
);
--spectrum-switch-spacing-top-to-control: var(
--system-switch-size-m-spacing-top-to-control
);
--spectrum-switch-spacing-top-to-label: var(
--system-switch-size-m-spacing-top-to-label
);
--spectrum-switch-font-size: var(--system-switch-size-m-font-size);
}

:host([size='l']) {
--spectrum-switch-min-height: var(--system-switch-size-l-min-height);
--spectrum-switch-control-width: var(--system-switch-size-l-control-width);
--spectrum-switch-control-height: var(
--system-switch-size-l-control-height
);
--spectrum-switch-control-label-spacing: var(
--system-switch-size-l-control-label-spacing
);
--spectrum-switch-spacing-top-to-control: var(
--system-switch-size-l-spacing-top-to-control
);
--spectrum-switch-spacing-top-to-label: var(
--system-switch-size-l-spacing-top-to-label
);
--spectrum-switch-font-size: var(--system-switch-size-l-font-size);
}

:host([size='xl']) {
--spectrum-switch-min-height: var(--system-switch-size-xl-min-height);
--spectrum-switch-control-width: var(--system-switch-size-xl-control-width);
--spectrum-switch-control-height: var(
--system-switch-size-xl-control-height
);
--spectrum-switch-control-label-spacing: var(
--system-switch-size-xl-control-label-spacing
);
--spectrum-switch-spacing-top-to-control: var(
--system-switch-size-xl-spacing-top-to-control
);
--spectrum-switch-spacing-top-to-label: var(
--system-switch-size-xl-spacing-top-to-label
);
--spectrum-switch-font-size: var(--system-switch-size-xl-font-size);
}
Loading
Loading