Skip to content
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
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ executors:
parameters:
current_golden_images_hash:
type: string
default: 5ae06cffc6f04da1e1a85f10b668a0073b8dbe90
default: 0272c0954bcca37a0a48daa736d881172ac244b3
commands:
downstream:
steps:
Expand Down
37 changes: 37 additions & 0 deletions packages/styles/tokens/express/global-vars.css
Original file line number Diff line number Diff line change
Expand Up @@ -315,3 +315,40 @@ governing permissions and limitations under the License.
--spectrum-accent-color-1000
);
}
:host,
:root {
--system-spectrum-switch-background-color-selected-default: var(
--spectrum-gray-800
);
--system-spectrum-switch-background-color-selected-hover: var(
--spectrum-gray-900
);
--system-spectrum-switch-background-color-selected-down: var(
--spectrum-gray-900
);
--system-spectrum-switch-background-color-selected-focus: var(
--spectrum-gray-900
);
--system-spectrum-switch-handle-border-color-default: var(
--spectrum-gray-800
);
--system-spectrum-switch-handle-border-color-hover: var(
--spectrum-gray-900
);
--system-spectrum-switch-handle-border-color-down: var(--spectrum-gray-900);
--system-spectrum-switch-handle-border-color-focus: var(
--spectrum-gray-900
);
--system-spectrum-switch-handle-border-color-selected-default: var(
--spectrum-gray-800
);
--system-spectrum-switch-handle-border-color-selected-hover: var(
--spectrum-gray-900
);
--system-spectrum-switch-handle-border-color-selected-down: var(
--spectrum-gray-900
);
--system-spectrum-switch-handle-border-color-selected-focus: var(
--spectrum-gray-900
);
}
37 changes: 37 additions & 0 deletions packages/styles/tokens/spectrum/global-vars.css
Original file line number Diff line number Diff line change
Expand Up @@ -329,3 +329,40 @@ governing permissions and limitations under the License.
--spectrum-accent-color-1000
);
}
:host,
:root {
--system-spectrum-switch-background-color-selected-default: var(
--spectrum-gray-700
);
--system-spectrum-switch-background-color-selected-hover: var(
--spectrum-gray-800
);
--system-spectrum-switch-background-color-selected-down: var(
--spectrum-gray-900
);
--system-spectrum-switch-background-color-selected-focus: var(
--spectrum-gray-800
);
--system-spectrum-switch-handle-border-color-default: var(
--spectrum-gray-600
);
--system-spectrum-switch-handle-border-color-hover: var(
--spectrum-gray-700
);
--system-spectrum-switch-handle-border-color-down: var(--spectrum-gray-800);
--system-spectrum-switch-handle-border-color-focus: var(
--spectrum-gray-700
);
--system-spectrum-switch-handle-border-color-selected-default: var(
--spectrum-gray-700
);
--system-spectrum-switch-handle-border-color-selected-hover: var(
--spectrum-gray-800
);
--system-spectrum-switch-handle-border-color-selected-down: var(
--spectrum-gray-900
);
--system-spectrum-switch-handle-border-color-selected-focus: var(
--spectrum-gray-800
);
}
39 changes: 38 additions & 1 deletion packages/switch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { Switch } from '@spectrum-web-components/switch';
</sp-switch>
```

### Standard radio buttons
### Standard switch buttons

Standard switches are the default style for switches. They are optimal for
application panels where all visual elements are monochrome in order to direct
Expand All @@ -58,6 +58,43 @@ focus to the content.
</div>
```

## Sizes

<sp-tabs selected="m" auto label="Size Attribute Options">
<sp-tab value="s">Small</sp-tab>
<sp-tab-panel value="s">

```html
<sp-switch size="s">Small</sp-switch>
```

</sp-tab-panel>
<sp-tab value="m">Medium</sp-tab>
<sp-tab-panel value="m">

```html
<sp-switch size="m">Medium</sp-switch>
```

</sp-tab-panel>
<sp-tab value="l">Large</sp-tab>
<sp-tab-panel value="l">

```html
<sp-switch size="l">Large</sp-switch>
```

</sp-tab-panel>
<sp-tab value="xl">Extra Large</sp-tab>
<sp-tab-panel value="xl">

```html
<sp-switch size="xl">Extra Large</sp-switch>
```

</sp-tab-panel>
</sp-tabs>

### Emphasized radio buttons

Emphasized switches are a secondary style for switches. The blue color provides a
Expand Down
2 changes: 1 addition & 1 deletion packages/switch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"tslib": "^2.0.0"
},
"devDependencies": {
"@spectrum-css/switch": "^1.0.23"
"@spectrum-css/switch": "^2.0.0"
},
"types": "./src/index.d.ts",
"customElements": "custom-elements.json",
Expand Down
3 changes: 2 additions & 1 deletion packages/switch/src/Switch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
CSSResultArray,
html,
PropertyValues,
SizedMixin,
TemplateResult,
} from '@spectrum-web-components/base';
import { property } from '@spectrum-web-components/base/src/decorators.js';
Expand All @@ -26,7 +27,7 @@ import legacyStyles from './switch-legacy.css.js';
*
* @slot - text label of the Switch
*/
export class Switch extends CheckboxBase {
export class Switch extends SizedMixin(CheckboxBase) {
public static override get styles(): CSSResultArray {
/* c8 ignore next 4 */
if (window.hasOwnProperty('ShadyDOM')) {
Expand Down
23 changes: 23 additions & 0 deletions packages/switch/src/spectrum-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,29 @@ const config = {
host: '.spectrum-Switch',
focus: '#input',
attributes: [
{
type: 'enum',
name: 'size',
forceOntoHost: true,
values: [
{
name: 's',
selector: '.spectrum-Switch--sizeS',
},
{
name: 'm',
selector: '.spectrum-Switch--sizeM',
},
{
name: 'l',
selector: '.spectrum-Switch--sizeL',
},
{
name: 'xl',
selector: '.spectrum-Switch--sizeXL',
},
],
},
{
type: 'boolean',
selector: ':disabled',
Expand Down
Loading