@spectrum-web-components/switch 0.9.15-devmode.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/sp-switch.js +1 -2
- package/sp-switch.js.map +1 -1
- package/src/Switch.js +2 -46
- package/src/Switch.js.map +1 -1
- package/src/index.js +1 -1
- package/src/index.js.map +1 -1
- package/src/spectrum-switch.css.js +2 -4
- package/src/spectrum-switch.css.js.map +1 -1
- package/src/switch-legacy.css.js +2 -4
- package/src/switch-legacy.css.js.map +1 -1
- package/src/switch.css.js +2 -4
- package/src/switch.css.js.map +1 -1
- package/stories/switch.stories.js +8 -37
- package/stories/switch.stories.js.map +1 -1
- package/test/benchmark/test-basic.js +1 -4
- package/test/benchmark/test-basic.js.map +1 -1
- package/test/switch.test-vrt.js +1 -3
- package/test/switch.test-vrt.js.map +1 -1
- package/test/switch.test.js +5 -27
- package/test/switch.test.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/switch",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"lit-html"
|
|
59
59
|
],
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@spectrum-web-components/base": "^0.
|
|
62
|
-
"@spectrum-web-components/checkbox": "^0.
|
|
61
|
+
"@spectrum-web-components/base": "^0.7.0",
|
|
62
|
+
"@spectrum-web-components/checkbox": "^0.14.0",
|
|
63
63
|
"tslib": "^2.0.0"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"./sp-*.js",
|
|
72
72
|
"./**/*.dev.js"
|
|
73
73
|
],
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "05c81318844160db3f8156144106e643507fef97"
|
|
75
75
|
}
|
package/sp-switch.js
CHANGED
package/sp-switch.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["sp-switch.ts"],
|
|
4
4
|
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { Switch } from './src/Switch.js';\n\ncustomElements.define('sp-switch', Switch);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-switch': Switch;\n }\n}\n"],
|
|
5
|
-
"mappings": "AAWA
|
|
5
|
+
"mappings": "AAWA,yCAEA,eAAe,OAAO,YAAa,CAAM",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/Switch.js
CHANGED
|
@@ -1,50 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
4
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
5
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
|
-
if (decorator = decorators[i])
|
|
7
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
-
if (kind && result)
|
|
9
|
-
__defProp(target, key, result);
|
|
10
|
-
return result;
|
|
11
|
-
};
|
|
12
|
-
import {
|
|
13
|
-
html
|
|
14
|
-
} from "@spectrum-web-components/base";
|
|
15
|
-
import { property } from "@spectrum-web-components/base/src/decorators.js";
|
|
16
|
-
import { CheckboxBase } from "@spectrum-web-components/checkbox/src/CheckboxBase.js";
|
|
17
|
-
import switchStyles from "./switch.css.js";
|
|
18
|
-
import legacyStyles from "./switch-legacy.css.js";
|
|
19
|
-
export class Switch extends CheckboxBase {
|
|
20
|
-
constructor() {
|
|
21
|
-
super(...arguments);
|
|
22
|
-
this.emphasized = false;
|
|
23
|
-
}
|
|
24
|
-
static get styles() {
|
|
25
|
-
if (window.hasOwnProperty("ShadyDOM")) {
|
|
26
|
-
return [switchStyles, legacyStyles];
|
|
27
|
-
}
|
|
28
|
-
return [switchStyles];
|
|
29
|
-
}
|
|
30
|
-
render() {
|
|
31
|
-
return html`
|
|
1
|
+
var d=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var p=(s,e,i,r)=>{for(var t=r>1?void 0:r?u(e,i):e,o=s.length-1,l;o>=0;o--)(l=s[o])&&(t=(r?l(e,i,t):l(t))||t);return r&&t&&d(e,i,t),t};import{html as c}from"@spectrum-web-components/base";import{property as m}from"@spectrum-web-components/base/src/decorators.js";import{CheckboxBase as n}from"@spectrum-web-components/checkbox/src/CheckboxBase.js";import a from"./switch.css.js";import h from"./switch-legacy.css.js";export class Switch extends n{constructor(){super(...arguments);this.emphasized=!1}static get styles(){return window.hasOwnProperty("ShadyDOM")?[a,h]:[a]}render(){return c`
|
|
32
2
|
${super.render()}
|
|
33
3
|
<span id="switch"></span>
|
|
34
4
|
<label id="label" for="input"><slot></slot></label>
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
firstUpdated(changes) {
|
|
38
|
-
super.firstUpdated(changes);
|
|
39
|
-
this.inputElement.setAttribute("role", "switch");
|
|
40
|
-
}
|
|
41
|
-
updated(changes) {
|
|
42
|
-
if (changes.has("checked")) {
|
|
43
|
-
this.inputElement.setAttribute("aria-checked", this.checked ? "true" : "false");
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
__decorateClass([
|
|
48
|
-
property({ type: Boolean, reflect: true })
|
|
49
|
-
], Switch.prototype, "emphasized", 2);
|
|
5
|
+
`}firstUpdated(e){super.firstUpdated(e),this.inputElement.setAttribute("role","switch")}updated(e){e.has("checked")&&this.inputElement.setAttribute("aria-checked",this.checked?"true":"false")}}p([m({type:Boolean,reflect:!0})],Switch.prototype,"emphasized",2);
|
|
50
6
|
//# sourceMappingURL=Switch.js.map
|
package/src/Switch.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["Switch.ts"],
|
|
4
4
|
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n PropertyValues,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { CheckboxBase } from '@spectrum-web-components/checkbox/src/CheckboxBase.js';\nimport switchStyles from './switch.css.js';\nimport legacyStyles from './switch-legacy.css.js';\n\n/**\n * @element sp-switch\n *\n * @slot - text label of the Switch\n */\nexport class Switch extends CheckboxBase {\n public static override get styles(): CSSResultArray {\n /* c8 ignore next 4 */\n if (window.hasOwnProperty('ShadyDOM')) {\n // Override some styles if we are using the web component polyfill\n return [switchStyles, legacyStyles];\n }\n return [switchStyles];\n }\n\n @property({ type: Boolean, reflect: true })\n public emphasized = false;\n\n protected override render(): TemplateResult {\n return html`\n ${super.render()}\n <span id=\"switch\"></span>\n <label id=\"label\" for=\"input\"><slot></slot></label>\n `;\n }\n\n protected override firstUpdated(changes: PropertyValues): void {\n super.firstUpdated(changes);\n this.inputElement.setAttribute('role', 'switch');\n }\n\n protected override updated(changes: PropertyValues): void {\n if (changes.has('checked')) {\n this.inputElement.setAttribute(\n 'aria-checked',\n this.checked ? 'true' : 'false'\n );\n }\n }\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": "wMAYA,qDAMA,2EACA,qFACA,+BACA,sCAOO,aAAM,cAAe,EAAa,CAAlC,kCAWI,gBAAa,aAVO,SAAyB,CAEhD,MAAI,QAAO,eAAe,UAAU,EAEzB,CAAC,EAAc,CAAY,EAE/B,CAAC,CAAY,CACxB,CAKmB,QAAyB,CACxC,MAAO;AAAA,cACD,MAAM,OAAO;AAAA;AAAA;AAAA,SAIvB,CAEmB,aAAa,EAA+B,CAC3D,MAAM,aAAa,CAAO,EAC1B,KAAK,aAAa,aAAa,OAAQ,QAAQ,CACnD,CAEmB,QAAQ,EAA+B,CACtD,AAAI,EAAQ,IAAI,SAAS,GACrB,KAAK,aAAa,aACd,eACA,KAAK,QAAU,OAAS,OAC5B,CAER,CACJ,CAvBW,GADP,AAAC,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GACnC,AAXJ,OAWI",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export*from"./Switch.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["index.ts"],
|
|
4
4
|
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nexport * from './Switch.js';\n"],
|
|
5
|
-
"mappings": "AAWA
|
|
5
|
+
"mappings": "AAWA",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
const styles = css`
|
|
1
|
+
import{css as e}from"@spectrum-web-components/base";const r=e`
|
|
3
2
|
:host{--spectrum-switch-handle-size:var(
|
|
4
3
|
--spectrum-switch-m-handle-size,var(--spectrum-alias-control-two-size-m)
|
|
5
4
|
);--spectrum-switch-handle-border-size:var(
|
|
@@ -130,6 +129,5 @@ var(--spectrum-global-dimension-static-size-25)
|
|
|
130
129
|
)}:host(:hover[disabled]) #input+#switch{box-shadow:inset 0 0 0 1px var(
|
|
131
130
|
--spectrum-switch-m-handle-border-color-disabled,var(--spectrum-global-color-gray-400)
|
|
132
131
|
)}}
|
|
133
|
-
`;
|
|
134
|
-
export default styles;
|
|
132
|
+
`;export default r;
|
|
135
133
|
//# sourceMappingURL=spectrum-switch.css.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["spectrum-switch.css.ts"],
|
|
4
4
|
"sourcesContent": ["/*\nCopyright 2022 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host{--spectrum-switch-handle-size:var(\n--spectrum-switch-m-handle-size,var(--spectrum-alias-control-two-size-m)\n);--spectrum-switch-handle-border-size:var(\n--spectrum-switch-m-handle-border-size,var(--spectrum-alias-border-size-thick)\n);--spectrum-switch-handle-border-radius:var(\n--spectrum-switch-m-handle-border-radius,var(--spectrum-alias-control-two-border-radius-m)\n);--spectrum-switch-text-gap:var(\n--spectrum-switch-m-text-gap,var(--spectrum-global-dimension-size-125)\n);--spectrum-switch-text-size:var(\n--spectrum-switch-m-text-size,var(--spectrum-global-dimension-font-size-100)\n);--spectrum-switch-track-height:var(\n--spectrum-switch-m-track-height,var(--spectrum-alias-control-three-height-m)\n);--spectrum-switch-track-width:var(\n--spectrum-switch-m-track-width,var(--spectrum-alias-control-three-width-m)\n);--spectrum-switch-cursor-hit-x:var(\n--spectrum-switch-m-cursor-hit-x,var(--spectrum-global-dimension-size-100)\n);--spectrum-switch-height:var(\n--spectrum-switch-m-height,var(--spectrum-global-dimension-size-400)\n);--spectrum-switch-label-margin-top:var(\n--spectrum-global-dimension-size-65\n);--spectrum-switch-label-line-height:1.49}:host([dir=ltr]){margin-right:calc(var(--spectrum-switch-cursor-hit-x)*2)}:host([dir=rtl]){margin-left:calc(var(--spectrum-switch-cursor-hit-x)*2)}:host{align-items:flex-start;display:inline-flex;max-width:100%;min-height:var(--spectrum-switch-height);position:relative;vertical-align:top}:host([dir=ltr]) #input{left:0}:host([dir=rtl]) #input{right:0}#input{box-sizing:border-box;cursor:pointer;height:100%;margin:0;opacity:0;padding:0;position:absolute;top:0;width:100%;z-index:1}:host([dir=ltr][checked]) #input+#switch:before{transform:translateX(calc(var(--spectrum-switch-track-width) - 100%))}:host([dir=rtl][checked]) #input+#switch:before{transform:translateX(calc((var(--spectrum-switch-track-width) - 100%)*-1))}#input[disabled],:host([disabled]) #input{cursor:default}#input.focus-visible+#switch:after{margin:calc(var(\n--spectrum-alias-focus-ring-gap,\nvar(--spectrum-global-dimension-static-size-25)\n)*-1)}#input:focus-visible+#switch:after{margin:calc(var(\n--spectrum-alias-focus-ring-gap,\nvar(--spectrum-global-dimension-static-size-25)\n)*-1)}#label{font-size:var(--spectrum-switch-text-size);line-height:var(--spectrum-switch-label-line-height);margin-bottom:0;margin-left:var(--spectrum-switch-text-gap);margin-right:var(--spectrum-switch-text-gap);margin-top:var(--spectrum-switch-label-margin-top);transition:color var(--spectrum-global-animation-duration-200,.16s) ease-in-out}:host([dir=ltr]) #switch{left:0}:host([dir=rtl]) #switch{right:0}:host([dir=ltr]) #switch{right:0}:host([dir=rtl]) #switch{left:0}#switch{border-radius:calc(var(--spectrum-switch-track-height)/2);box-sizing:border-box;display:inline-block;flex-grow:0;flex-shrink:0;height:var(--spectrum-switch-track-height);margin-bottom:calc((var(--spectrum-switch-height) - var(--spectrum-switch-track-height))/2);margin-left:0;margin-right:0;margin-top:calc((var(--spectrum-switch-height) - var(--spectrum-switch-track-height))/2);position:relative;transition:background var(--spectrum-global-animation-duration-100,.13s) ease-in-out,border var(--spectrum-global-animation-duration-100,.13s) ease-in-out;vertical-align:middle;width:var(--spectrum-switch-track-width)}#switch:before{box-sizing:border-box;content:\"\";display:block;position:absolute}:host([dir=ltr]) #switch:before{left:0}:host([dir=rtl]) #switch:before{right:0}#switch:before{border-radius:var(--spectrum-switch-handle-border-radius);border-style:solid;border-width:var(--spectrum-switch-handle-border-size);height:var(--spectrum-switch-handle-size);top:0;transition:background var(--spectrum-global-animation-duration-100,.13s) ease-in-out,border var(--spectrum-global-animation-duration-100,.13s) ease-in-out,transform var(--spectrum-global-animation-duration-100,.13s) ease-in-out,box-shadow var(--spectrum-global-animation-duration-100,.13s) ease-in-out;width:var(--spectrum-switch-handle-size)}:host([dir=ltr]) #switch:after{left:0}:host([dir=rtl]) #switch:after{right:0}:host([dir=ltr]) #switch:after{right:0}:host([dir=rtl]) #switch:after{left:0}#switch:after{border-radius:calc(var(--spectrum-switch-track-height) + var(\n--spectrum-alias-focus-ring-gap,\nvar(--spectrum-global-dimension-static-size-25)\n));bottom:0;content:\"\";display:block;margin:0;position:absolute;top:0;transition:opacity var(--spectrum-global-animation-duration-100,.13s) ease-out,margin var(--spectrum-global-animation-duration-100,.13s) ease-out}#switch{background-color:var(\n--spectrum-switch-m-track-color,var(--spectrum-global-color-gray-300)\n)}#switch:before{background-color:var(\n--spectrum-switch-m-handle-background-color,var(--spectrum-global-color-gray-75)\n);border-color:var(\n--spectrum-switch-m-handle-border-color,var(--spectrum-alias-toggle-border-color-default)\n)}#input~#label{color:var(\n--spectrum-switch-m-text-color,var(--spectrum-alias-component-text-color-default)\n)}:host([checked]) #input+#switch{background-color:var(\n--spectrum-switch-m-track-color-selected,var(--spectrum-alias-toggle-background-color-default)\n)}:host([checked]) #input+#switch:before{border-color:var(\n--spectrum-switch-m-handle-border-color-selected,var(--spectrum-alias-toggle-background-color-default)\n)}:host(:hover) #input+#switch:before{border-color:var(\n--spectrum-switch-m-handle-border-color-hover,var(--spectrum-alias-toggle-border-color-hover)\n);box-shadow:none}:host(:hover) #input~#label{color:var(\n--spectrum-switch-m-text-color-hover,var(--spectrum-alias-component-text-color-hover)\n)}:host(:hover[checked]) #input:enabled+#switch{background-color:var(\n--spectrum-switch-m-track-color-selected-hover,var(--spectrum-alias-toggle-background-color-hover)\n)}:host(:hover[checked]) #input:enabled+#switch:before{border-color:var(\n--spectrum-switch-m-handle-border-color-selected-hover,var(--spectrum-alias-toggle-background-color-hover)\n)}:host(:active) #input+#switch:before{border-color:var(\n--spectrum-switch-m-handle-border-color-down,var(--spectrum-alias-toggle-border-color-down)\n)}:host(:active) #input~#label{color:var(\n--spectrum-switch-m-text-color-down,var(--spectrum-alias-component-text-color-down)\n)}:host(:active[checked]) #input:enabled+#switch{background-color:var(\n--spectrum-switch-m-track-color-selected-down,var(--spectrum-alias-toggle-background-color-down)\n)}:host(:active[checked]) #input:enabled+#switch:before{border-color:var(\n--spectrum-switch-m-handle-border-color-selected-down,var(--spectrum-alias-toggle-background-color-down)\n)}:host([disabled]) #input+#switch{background-color:var(\n--spectrum-switch-m-track-color-disabled,var(--spectrum-global-color-gray-300)\n)}:host([disabled]) #input+#switch:before{border-color:var(\n--spectrum-switch-m-handle-border-color-disabled,var(--spectrum-global-color-gray-400)\n)}:host([disabled]) #input~#label{color:var(\n--spectrum-switch-m-text-color-disabled,var(--spectrum-alias-component-text-color-disabled)\n)}:host([disabled][checked][dir]) #input+#switch{background-color:var(\n--spectrum-switch-m-track-color-selected-disabled,var(--spectrum-global-color-gray-400)\n)}:host([disabled][checked][dir]) #input+#switch:before{border-color:var(\n--spectrum-switch-m-handle-border-color-selected-disabled,var(--spectrum-global-color-gray-400)\n)}:host([disabled][checked][dir]) #input~#label{color:var(\n--spectrum-switch-m-text-color-selected-disabled,var(--spectrum-alias-component-text-color-disabled)\n)}:host([emphasized][checked]) #input+#switch{background-color:var(\n--spectrum-switch-m-emphasized-track-color-selected,var(\n--spectrum-alias-toggle-background-color-emphasized-selected-default\n)\n)}:host([emphasized][checked]) #input+#switch:before{border-color:var(\n--spectrum-switch-m-emphasized-handle-border-color-selected,var(\n--spectrum-alias-toggle-background-color-emphasized-selected-default\n)\n)}:host([emphasized][checked]:hover) #input:enabled+#switch{background-color:var(\n--spectrum-switch-m-emphasized-track-color-selected-hover,var(--spectrum-alias-toggle-background-color-emphasized-selected-hover)\n)}:host([emphasized][checked]:hover) #input:enabled+#switch:before{border-color:var(\n--spectrum-switch-m-emphasized-handle-border-color-selected-hover,var(--spectrum-alias-toggle-background-color-emphasized-selected-hover)\n)}:host([emphasized]:active[checked]) #input:enabled+#switch{background-color:var(\n--spectrum-switch-m-emphasized-track-color-selected-down,var(--spectrum-alias-toggle-background-color-emphasized-selected-down)\n)}:host([emphasized]:active[checked]) #input:enabled+#switch:before{border-color:var(\n--spectrum-switch-m-emphasized-handle-border-color-selected-down,var(--spectrum-alias-toggle-background-color-emphasized-selected-down)\n)}#input.focus-visible+#switch:after,:host(:hover) #input.focus-visible+#switch:after{box-shadow:0 0 0 var(\n--spectrum-switch-m-focus-ring-size,var(--spectrum-alias-focus-ring-size)\n) var(\n--spectrum-switch-m-focus-ring-color-key-focus,var(--spectrum-alias-focus-ring-color)\n)}#input:focus-visible+#switch:after,:host(:hover) #input:focus-visible+#switch:after{box-shadow:0 0 0 var(\n--spectrum-switch-m-focus-ring-size,var(--spectrum-alias-focus-ring-size)\n) var(\n--spectrum-switch-m-focus-ring-color-key-focus,var(--spectrum-alias-focus-ring-color)\n)}#input.focus-visible+#switch:before,:host(:hover) #input.focus-visible+#switch:before{border-color:var(\n--spectrum-switch-m-handle-border-color-key-focus,var(--spectrum-alias-toggle-border-color-key-focus)\n)}#input:focus-visible+#switch:before,:host(:hover) #input:focus-visible+#switch:before{border-color:var(\n--spectrum-switch-m-handle-border-color-key-focus,var(--spectrum-alias-toggle-border-color-key-focus)\n)}:host(:hover[checked]) #input.focus-visible+#switch,:host([checked]) #input.focus-visible+#switch{background-color:var(\n--spectrum-switch-m-track-color-selected-key-focus,var(--spectrum-alias-toggle-background-color-key-focus)\n)}:host(:hover[checked]) #input:focus-visible+#switch,:host([checked]) #input:focus-visible+#switch{background-color:var(\n--spectrum-switch-m-track-color-selected-key-focus,var(--spectrum-alias-toggle-background-color-key-focus)\n)}:host(:hover[checked]) #input.focus-visible+#switch:before,:host([checked]) #input.focus-visible+#switch:before{border-color:var(\n--spectrum-switch-m-handle-border-color-selected-key-focus,var(--spectrum-alias-toggle-background-color-key-focus)\n)}:host(:hover[checked]) #input:focus-visible+#switch:before,:host([checked]) #input:focus-visible+#switch:before{border-color:var(\n--spectrum-switch-m-handle-border-color-selected-key-focus,var(--spectrum-alias-toggle-background-color-key-focus)\n)}:host([emphasized][checked]) #input.focus-visible+#switch,:host([emphasized][checked]:hover) #input.focus-visible+#switch{background-color:var(\n--spectrum-switch-m-emphasized-track-color-selected-key-focus,var(\n--spectrum-alias-toggle-background-color-emphasized-selected-key-focus\n)\n)}:host([emphasized][checked]) #input:focus-visible+#switch,:host([emphasized][checked]:hover) #input:focus-visible+#switch{background-color:var(\n--spectrum-switch-m-emphasized-track-color-selected-key-focus,var(\n--spectrum-alias-toggle-background-color-emphasized-selected-key-focus\n)\n)}:host([emphasized][checked]) #input.focus-visible+#switch:before,:host([emphasized][checked]:hover) #input.focus-visible+#switch:before{border-color:var(\n--spectrum-switch-m-emphasized-handle-border-color-selected-key-focus,var(\n--spectrum-alias-toggle-background-color-emphasized-selected-key-focus\n)\n)}:host([emphasized][checked]) #input:focus-visible+#switch:before,:host([emphasized][checked]:hover) #input:focus-visible+#switch:before{border-color:var(\n--spectrum-switch-m-emphasized-handle-border-color-selected-key-focus,var(\n--spectrum-alias-toggle-background-color-emphasized-selected-key-focus\n)\n)}@media (forced-colors:active){:host{--spectrum-switch-m-emphasized-handle-border-color-selected:Highlight;--spectrum-switch-m-emphasized-handle-border-color-selected-down:Highlight;--spectrum-switch-m-emphasized-handle-border-color-selected-hover:Highlight;--spectrum-switch-m-emphasized-handle-border-color-selected-key-focus:Highlight;--spectrum-switch-m-emphasized-track-color-selected:Highlight;--spectrum-switch-m-emphasized-track-color-selected-down:Highlight;--spectrum-switch-m-emphasized-track-color-selected-hover:Highlight;--spectrum-switch-m-emphasized-track-color-selected-key-focus:Highlight;--spectrum-switch-m-focus-ring-color-key-focus:ButtonText;--spectrum-switch-m-handle-background-color:ButtonFace;--spectrum-switch-m-handle-border-color:ButtonText;--spectrum-switch-m-handle-border-color-disabled:GrayText;--spectrum-switch-m-handle-border-color-down:Highlight;--spectrum-switch-m-handle-border-color-hover:Highlight;--spectrum-switch-m-handle-border-color-key-focus:ButtonText;--spectrum-switch-m-handle-border-color-selected:Highlight;--spectrum-switch-m-handle-border-color-selected-disabled:GrayText;--spectrum-switch-m-handle-border-color-selected-down:Highlight;--spectrum-switch-m-handle-border-color-selected-hover:Highlight;--spectrum-switch-m-handle-border-color-selected-key-focus:Highlight;--spectrum-switch-m-text-color:CanvasText;--spectrum-switch-m-text-color-disabled:GrayText;--spectrum-switch-m-text-color-down:CanvasText;--spectrum-switch-m-text-color-hover:CanvasText;--spectrum-switch-m-text-color-selected-disabled:GrayText;--spectrum-switch-m-track-color:ButtonFace;--spectrum-switch-m-track-color-disabled:ButtonFace;--spectrum-switch-m-track-color-selected:Highlight;--spectrum-switch-m-track-color-selected-disabled:GrayText;--spectrum-switch-m-track-color-selected-down:Highlight;--spectrum-switch-m-track-color-selected-hover:Highlight;--spectrum-switch-m-track-color-selected-key-focus:Highlight;forced-color-adjust:none}#input:not([checked])+#switch{box-shadow:inset 0 0 0 1px var(\n--spectrum-switch-m-handle-border-color,var(--spectrum-alias-toggle-border-color-default)\n)}:host(:hover) #input:not([checked])+#switch{box-shadow:inset 0 0 0 1px var(\n--spectrum-switch-m-handle-border-color-hover,var(--spectrum-alias-toggle-border-color-hover)\n)}:host([disabled]) #input+#switch{box-shadow:inset 0 0 0 1px var(\n--spectrum-switch-m-handle-border-color-disabled,var(--spectrum-global-color-gray-400)\n)}:host(:hover[disabled]) #input+#switch{box-shadow:inset 0 0 0 1px var(\n--spectrum-switch-m-handle-border-color-disabled,var(--spectrum-global-color-gray-400)\n)}}\n`;\nexport default styles;"],
|
|
5
|
-
"mappings": "AAWA
|
|
5
|
+
"mappings": "AAWA,oDACA,KAAM,GAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAoIf,cAAe",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/switch-legacy.css.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
const styles = css`
|
|
1
|
+
import{css as a}from"@spectrum-web-components/base";const o=a`
|
|
3
2
|
#switch:before{transition:background var(--spectrum-global-animation-duration-100,.13s) ease-in-out,border var(--spectrum-global-animation-duration-100,.13s) ease-in-out,box-shadow var(--spectrum-global-animation-duration-100,.13s) ease-in-out}
|
|
4
|
-
`;
|
|
5
|
-
export default styles;
|
|
3
|
+
`;export default o;
|
|
6
4
|
//# sourceMappingURL=switch-legacy.css.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["switch-legacy.css.ts"],
|
|
4
4
|
"sourcesContent": ["/*\nCopyright 2022 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n#switch:before{transition:background var(--spectrum-global-animation-duration-100,.13s) ease-in-out,border var(--spectrum-global-animation-duration-100,.13s) ease-in-out,box-shadow var(--spectrum-global-animation-duration-100,.13s) ease-in-out}\n`;\nexport default styles;"],
|
|
5
|
-
"mappings": "AAWA
|
|
5
|
+
"mappings": "AAWA,oDACA,KAAM,GAAS;AAAA;AAAA,EAGf,cAAe",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/switch.css.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
const styles = css`
|
|
1
|
+
import{css as e}from"@spectrum-web-components/base";const r=e`
|
|
3
2
|
:host{--spectrum-switch-handle-size:var(
|
|
4
3
|
--spectrum-switch-m-handle-size,var(--spectrum-alias-control-two-size-m)
|
|
5
4
|
);--spectrum-switch-handle-border-size:var(
|
|
@@ -132,6 +131,5 @@ var(--spectrum-global-dimension-static-size-25)
|
|
|
132
131
|
)}}:host{--spectrum-switch-label-margin-top:var(
|
|
133
132
|
--spectrum-global-dimension-size-65,5px
|
|
134
133
|
);--spectrum-switch-track-width:var(--spectrum-global-dimension-size-325);--spectrum-switch-handle-border-radius:50%}:host([disabled]){pointer-events:none}:host([dir=ltr][checked]) #input+#switch:before{transform:translateX(calc(var(--spectrum-switch-track-width) - var(--spectrum-switch-handle-size)))}:host([dir=rtl][checked]) #input+#switch:before{transform:translateX(calc(var(--spectrum-switch-handle-size) - var(--spectrum-switch-track-width)))}
|
|
135
|
-
`;
|
|
136
|
-
export default styles;
|
|
134
|
+
`;export default r;
|
|
137
135
|
//# sourceMappingURL=switch.css.js.map
|
package/src/switch.css.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["switch.css.ts"],
|
|
4
4
|
"sourcesContent": ["/*\nCopyright 2022 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host{--spectrum-switch-handle-size:var(\n--spectrum-switch-m-handle-size,var(--spectrum-alias-control-two-size-m)\n);--spectrum-switch-handle-border-size:var(\n--spectrum-switch-m-handle-border-size,var(--spectrum-alias-border-size-thick)\n);--spectrum-switch-handle-border-radius:var(\n--spectrum-switch-m-handle-border-radius,var(--spectrum-alias-control-two-border-radius-m)\n);--spectrum-switch-text-gap:var(\n--spectrum-switch-m-text-gap,var(--spectrum-global-dimension-size-125)\n);--spectrum-switch-text-size:var(\n--spectrum-switch-m-text-size,var(--spectrum-global-dimension-font-size-100)\n);--spectrum-switch-track-height:var(\n--spectrum-switch-m-track-height,var(--spectrum-alias-control-three-height-m)\n);--spectrum-switch-track-width:var(\n--spectrum-switch-m-track-width,var(--spectrum-alias-control-three-width-m)\n);--spectrum-switch-cursor-hit-x:var(\n--spectrum-switch-m-cursor-hit-x,var(--spectrum-global-dimension-size-100)\n);--spectrum-switch-height:var(\n--spectrum-switch-m-height,var(--spectrum-global-dimension-size-400)\n);--spectrum-switch-label-margin-top:var(\n--spectrum-global-dimension-size-65\n);--spectrum-switch-label-line-height:1.49}:host([dir=ltr]){margin-right:calc(var(--spectrum-switch-cursor-hit-x)*2)}:host([dir=rtl]){margin-left:calc(var(--spectrum-switch-cursor-hit-x)*2)}:host{align-items:flex-start;display:inline-flex;max-width:100%;min-height:var(--spectrum-switch-height);position:relative;vertical-align:top}:host([dir=ltr]) #input{left:0}:host([dir=rtl]) #input{right:0}#input{box-sizing:border-box;cursor:pointer;height:100%;margin:0;opacity:0;padding:0;position:absolute;top:0;width:100%;z-index:1}:host([dir=ltr][checked]) #input+#switch:before{transform:translateX(calc(var(--spectrum-switch-track-width) - 100%))}:host([dir=rtl][checked]) #input+#switch:before{transform:translateX(calc((var(--spectrum-switch-track-width) - 100%)*-1))}#input[disabled],:host([disabled]) #input{cursor:default}#input.focus-visible+#switch:after{margin:calc(var(\n--spectrum-alias-focus-ring-gap,\nvar(--spectrum-global-dimension-static-size-25)\n)*-1)}#input:focus-visible+#switch:after{margin:calc(var(\n--spectrum-alias-focus-ring-gap,\nvar(--spectrum-global-dimension-static-size-25)\n)*-1)}#label{font-size:var(--spectrum-switch-text-size);line-height:var(--spectrum-switch-label-line-height);margin-bottom:0;margin-left:var(--spectrum-switch-text-gap);margin-right:var(--spectrum-switch-text-gap);margin-top:var(--spectrum-switch-label-margin-top);transition:color var(--spectrum-global-animation-duration-200,.16s) ease-in-out}:host([dir=ltr]) #switch{left:0}:host([dir=rtl]) #switch{right:0}:host([dir=ltr]) #switch{right:0}:host([dir=rtl]) #switch{left:0}#switch{border-radius:calc(var(--spectrum-switch-track-height)/2);box-sizing:border-box;display:inline-block;flex-grow:0;flex-shrink:0;height:var(--spectrum-switch-track-height);margin-bottom:calc((var(--spectrum-switch-height) - var(--spectrum-switch-track-height))/2);margin-left:0;margin-right:0;margin-top:calc((var(--spectrum-switch-height) - var(--spectrum-switch-track-height))/2);position:relative;transition:background var(--spectrum-global-animation-duration-100,.13s) ease-in-out,border var(--spectrum-global-animation-duration-100,.13s) ease-in-out;vertical-align:middle;width:var(--spectrum-switch-track-width)}#switch:before{box-sizing:border-box;content:\"\";display:block;position:absolute}:host([dir=ltr]) #switch:before{left:0}:host([dir=rtl]) #switch:before{right:0}#switch:before{border-radius:var(--spectrum-switch-handle-border-radius);border-style:solid;border-width:var(--spectrum-switch-handle-border-size);height:var(--spectrum-switch-handle-size);top:0;transition:background var(--spectrum-global-animation-duration-100,.13s) ease-in-out,border var(--spectrum-global-animation-duration-100,.13s) ease-in-out,transform var(--spectrum-global-animation-duration-100,.13s) ease-in-out,box-shadow var(--spectrum-global-animation-duration-100,.13s) ease-in-out;width:var(--spectrum-switch-handle-size)}:host([dir=ltr]) #switch:after{left:0}:host([dir=rtl]) #switch:after{right:0}:host([dir=ltr]) #switch:after{right:0}:host([dir=rtl]) #switch:after{left:0}#switch:after{border-radius:calc(var(--spectrum-switch-track-height) + var(\n--spectrum-alias-focus-ring-gap,\nvar(--spectrum-global-dimension-static-size-25)\n));bottom:0;content:\"\";display:block;margin:0;position:absolute;top:0;transition:opacity var(--spectrum-global-animation-duration-100,.13s) ease-out,margin var(--spectrum-global-animation-duration-100,.13s) ease-out}#switch{background-color:var(\n--spectrum-switch-m-track-color,var(--spectrum-global-color-gray-300)\n)}#switch:before{background-color:var(\n--spectrum-switch-m-handle-background-color,var(--spectrum-global-color-gray-75)\n);border-color:var(\n--spectrum-switch-m-handle-border-color,var(--spectrum-alias-toggle-border-color-default)\n)}#input~#label{color:var(\n--spectrum-switch-m-text-color,var(--spectrum-alias-component-text-color-default)\n)}:host([checked]) #input+#switch{background-color:var(\n--spectrum-switch-m-track-color-selected,var(--spectrum-alias-toggle-background-color-default)\n)}:host([checked]) #input+#switch:before{border-color:var(\n--spectrum-switch-m-handle-border-color-selected,var(--spectrum-alias-toggle-background-color-default)\n)}:host(:hover) #input+#switch:before{border-color:var(\n--spectrum-switch-m-handle-border-color-hover,var(--spectrum-alias-toggle-border-color-hover)\n);box-shadow:none}:host(:hover) #input~#label{color:var(\n--spectrum-switch-m-text-color-hover,var(--spectrum-alias-component-text-color-hover)\n)}:host(:hover[checked]) #input:enabled+#switch{background-color:var(\n--spectrum-switch-m-track-color-selected-hover,var(--spectrum-alias-toggle-background-color-hover)\n)}:host(:hover[checked]) #input:enabled+#switch:before{border-color:var(\n--spectrum-switch-m-handle-border-color-selected-hover,var(--spectrum-alias-toggle-background-color-hover)\n)}:host(:active) #input+#switch:before{border-color:var(\n--spectrum-switch-m-handle-border-color-down,var(--spectrum-alias-toggle-border-color-down)\n)}:host(:active) #input~#label{color:var(\n--spectrum-switch-m-text-color-down,var(--spectrum-alias-component-text-color-down)\n)}:host(:active[checked]) #input:enabled+#switch{background-color:var(\n--spectrum-switch-m-track-color-selected-down,var(--spectrum-alias-toggle-background-color-down)\n)}:host(:active[checked]) #input:enabled+#switch:before{border-color:var(\n--spectrum-switch-m-handle-border-color-selected-down,var(--spectrum-alias-toggle-background-color-down)\n)}:host([disabled]) #input+#switch{background-color:var(\n--spectrum-switch-m-track-color-disabled,var(--spectrum-global-color-gray-300)\n)}:host([disabled]) #input+#switch:before{border-color:var(\n--spectrum-switch-m-handle-border-color-disabled,var(--spectrum-global-color-gray-400)\n)}:host([disabled]) #input~#label{color:var(\n--spectrum-switch-m-text-color-disabled,var(--spectrum-alias-component-text-color-disabled)\n)}:host([disabled][checked][dir]) #input+#switch{background-color:var(\n--spectrum-switch-m-track-color-selected-disabled,var(--spectrum-global-color-gray-400)\n)}:host([disabled][checked][dir]) #input+#switch:before{border-color:var(\n--spectrum-switch-m-handle-border-color-selected-disabled,var(--spectrum-global-color-gray-400)\n)}:host([disabled][checked][dir]) #input~#label{color:var(\n--spectrum-switch-m-text-color-selected-disabled,var(--spectrum-alias-component-text-color-disabled)\n)}:host([emphasized][checked]) #input+#switch{background-color:var(\n--spectrum-switch-m-emphasized-track-color-selected,var(\n--spectrum-alias-toggle-background-color-emphasized-selected-default\n)\n)}:host([emphasized][checked]) #input+#switch:before{border-color:var(\n--spectrum-switch-m-emphasized-handle-border-color-selected,var(\n--spectrum-alias-toggle-background-color-emphasized-selected-default\n)\n)}:host([emphasized][checked]:hover) #input:enabled+#switch{background-color:var(\n--spectrum-switch-m-emphasized-track-color-selected-hover,var(--spectrum-alias-toggle-background-color-emphasized-selected-hover)\n)}:host([emphasized][checked]:hover) #input:enabled+#switch:before{border-color:var(\n--spectrum-switch-m-emphasized-handle-border-color-selected-hover,var(--spectrum-alias-toggle-background-color-emphasized-selected-hover)\n)}:host([emphasized]:active[checked]) #input:enabled+#switch{background-color:var(\n--spectrum-switch-m-emphasized-track-color-selected-down,var(--spectrum-alias-toggle-background-color-emphasized-selected-down)\n)}:host([emphasized]:active[checked]) #input:enabled+#switch:before{border-color:var(\n--spectrum-switch-m-emphasized-handle-border-color-selected-down,var(--spectrum-alias-toggle-background-color-emphasized-selected-down)\n)}#input.focus-visible+#switch:after,:host(:hover) #input.focus-visible+#switch:after{box-shadow:0 0 0 var(\n--spectrum-switch-m-focus-ring-size,var(--spectrum-alias-focus-ring-size)\n) var(\n--spectrum-switch-m-focus-ring-color-key-focus,var(--spectrum-alias-focus-ring-color)\n)}#input:focus-visible+#switch:after,:host(:hover) #input:focus-visible+#switch:after{box-shadow:0 0 0 var(\n--spectrum-switch-m-focus-ring-size,var(--spectrum-alias-focus-ring-size)\n) var(\n--spectrum-switch-m-focus-ring-color-key-focus,var(--spectrum-alias-focus-ring-color)\n)}#input.focus-visible+#switch:before,:host(:hover) #input.focus-visible+#switch:before{border-color:var(\n--spectrum-switch-m-handle-border-color-key-focus,var(--spectrum-alias-toggle-border-color-key-focus)\n)}#input:focus-visible+#switch:before,:host(:hover) #input:focus-visible+#switch:before{border-color:var(\n--spectrum-switch-m-handle-border-color-key-focus,var(--spectrum-alias-toggle-border-color-key-focus)\n)}:host(:hover[checked]) #input.focus-visible+#switch,:host([checked]) #input.focus-visible+#switch{background-color:var(\n--spectrum-switch-m-track-color-selected-key-focus,var(--spectrum-alias-toggle-background-color-key-focus)\n)}:host(:hover[checked]) #input:focus-visible+#switch,:host([checked]) #input:focus-visible+#switch{background-color:var(\n--spectrum-switch-m-track-color-selected-key-focus,var(--spectrum-alias-toggle-background-color-key-focus)\n)}:host(:hover[checked]) #input.focus-visible+#switch:before,:host([checked]) #input.focus-visible+#switch:before{border-color:var(\n--spectrum-switch-m-handle-border-color-selected-key-focus,var(--spectrum-alias-toggle-background-color-key-focus)\n)}:host(:hover[checked]) #input:focus-visible+#switch:before,:host([checked]) #input:focus-visible+#switch:before{border-color:var(\n--spectrum-switch-m-handle-border-color-selected-key-focus,var(--spectrum-alias-toggle-background-color-key-focus)\n)}:host([emphasized][checked]) #input.focus-visible+#switch,:host([emphasized][checked]:hover) #input.focus-visible+#switch{background-color:var(\n--spectrum-switch-m-emphasized-track-color-selected-key-focus,var(\n--spectrum-alias-toggle-background-color-emphasized-selected-key-focus\n)\n)}:host([emphasized][checked]) #input:focus-visible+#switch,:host([emphasized][checked]:hover) #input:focus-visible+#switch{background-color:var(\n--spectrum-switch-m-emphasized-track-color-selected-key-focus,var(\n--spectrum-alias-toggle-background-color-emphasized-selected-key-focus\n)\n)}:host([emphasized][checked]) #input.focus-visible+#switch:before,:host([emphasized][checked]:hover) #input.focus-visible+#switch:before{border-color:var(\n--spectrum-switch-m-emphasized-handle-border-color-selected-key-focus,var(\n--spectrum-alias-toggle-background-color-emphasized-selected-key-focus\n)\n)}:host([emphasized][checked]) #input:focus-visible+#switch:before,:host([emphasized][checked]:hover) #input:focus-visible+#switch:before{border-color:var(\n--spectrum-switch-m-emphasized-handle-border-color-selected-key-focus,var(\n--spectrum-alias-toggle-background-color-emphasized-selected-key-focus\n)\n)}@media (forced-colors:active){:host{--spectrum-switch-m-emphasized-handle-border-color-selected:Highlight;--spectrum-switch-m-emphasized-handle-border-color-selected-down:Highlight;--spectrum-switch-m-emphasized-handle-border-color-selected-hover:Highlight;--spectrum-switch-m-emphasized-handle-border-color-selected-key-focus:Highlight;--spectrum-switch-m-emphasized-track-color-selected:Highlight;--spectrum-switch-m-emphasized-track-color-selected-down:Highlight;--spectrum-switch-m-emphasized-track-color-selected-hover:Highlight;--spectrum-switch-m-emphasized-track-color-selected-key-focus:Highlight;--spectrum-switch-m-focus-ring-color-key-focus:ButtonText;--spectrum-switch-m-handle-background-color:ButtonFace;--spectrum-switch-m-handle-border-color:ButtonText;--spectrum-switch-m-handle-border-color-disabled:GrayText;--spectrum-switch-m-handle-border-color-down:Highlight;--spectrum-switch-m-handle-border-color-hover:Highlight;--spectrum-switch-m-handle-border-color-key-focus:ButtonText;--spectrum-switch-m-handle-border-color-selected:Highlight;--spectrum-switch-m-handle-border-color-selected-disabled:GrayText;--spectrum-switch-m-handle-border-color-selected-down:Highlight;--spectrum-switch-m-handle-border-color-selected-hover:Highlight;--spectrum-switch-m-handle-border-color-selected-key-focus:Highlight;--spectrum-switch-m-text-color:CanvasText;--spectrum-switch-m-text-color-disabled:GrayText;--spectrum-switch-m-text-color-down:CanvasText;--spectrum-switch-m-text-color-hover:CanvasText;--spectrum-switch-m-text-color-selected-disabled:GrayText;--spectrum-switch-m-track-color:ButtonFace;--spectrum-switch-m-track-color-disabled:ButtonFace;--spectrum-switch-m-track-color-selected:Highlight;--spectrum-switch-m-track-color-selected-disabled:GrayText;--spectrum-switch-m-track-color-selected-down:Highlight;--spectrum-switch-m-track-color-selected-hover:Highlight;--spectrum-switch-m-track-color-selected-key-focus:Highlight;forced-color-adjust:none}#input:not([checked])+#switch{box-shadow:inset 0 0 0 1px var(\n--spectrum-switch-m-handle-border-color,var(--spectrum-alias-toggle-border-color-default)\n)}:host(:hover) #input:not([checked])+#switch{box-shadow:inset 0 0 0 1px var(\n--spectrum-switch-m-handle-border-color-hover,var(--spectrum-alias-toggle-border-color-hover)\n)}:host([disabled]) #input+#switch{box-shadow:inset 0 0 0 1px var(\n--spectrum-switch-m-handle-border-color-disabled,var(--spectrum-global-color-gray-400)\n)}:host(:hover[disabled]) #input+#switch{box-shadow:inset 0 0 0 1px var(\n--spectrum-switch-m-handle-border-color-disabled,var(--spectrum-global-color-gray-400)\n)}}:host{--spectrum-switch-label-margin-top:var(\n--spectrum-global-dimension-size-65,5px\n);--spectrum-switch-track-width:var(--spectrum-global-dimension-size-325);--spectrum-switch-handle-border-radius:50%}:host([disabled]){pointer-events:none}:host([dir=ltr][checked]) #input+#switch:before{transform:translateX(calc(var(--spectrum-switch-track-width) - var(--spectrum-switch-handle-size)))}:host([dir=rtl][checked]) #input+#switch:before{transform:translateX(calc(var(--spectrum-switch-handle-size) - var(--spectrum-switch-track-width)))}\n`;\nexport default styles;"],
|
|
5
|
-
"mappings": "AAWA
|
|
5
|
+
"mappings": "AAWA,oDACA,KAAM,GAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAsIf,cAAe",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,47 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { html } from "@spectrum-web-components/base";
|
|
3
|
-
export default {
|
|
4
|
-
component: "sp-switch",
|
|
5
|
-
title: "Switch"
|
|
6
|
-
};
|
|
7
|
-
export const Default = () => {
|
|
8
|
-
return html`
|
|
1
|
+
import"@spectrum-web-components/switch/sp-switch.js";import{html as t}from"@spectrum-web-components/base";export default{component:"sp-switch",title:"Switch"};export const Default=()=>t`
|
|
9
2
|
<sp-switch>Switch</sp-switch>
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
export const Checked = () => {
|
|
13
|
-
return html`
|
|
3
|
+
`,Checked=()=>t`
|
|
14
4
|
<sp-switch checked>Switch</sp-switch>
|
|
15
|
-
|
|
16
|
-
};
|
|
17
|
-
export const readonly = () => {
|
|
18
|
-
return html`
|
|
5
|
+
`,readonly=()=>t`
|
|
19
6
|
<sp-switch checked readonly>Switch</sp-switch>
|
|
20
|
-
|
|
21
|
-
};
|
|
22
|
-
export const emphasized = () => {
|
|
23
|
-
return html`
|
|
7
|
+
`,emphasized=()=>t`
|
|
24
8
|
<sp-switch emphasized>Switch</sp-switch>
|
|
25
|
-
|
|
26
|
-
};
|
|
27
|
-
export const emphasizedChecked = () => {
|
|
28
|
-
return html`
|
|
9
|
+
`,emphasizedChecked=()=>t`
|
|
29
10
|
<sp-switch emphasized checked>Switch</sp-switch>
|
|
30
|
-
|
|
31
|
-
};
|
|
32
|
-
export const Autofocus = () => {
|
|
33
|
-
return html`
|
|
11
|
+
`,Autofocus=()=>t`
|
|
34
12
|
<sp-switch autofocus>Switch</sp-switch>
|
|
35
|
-
|
|
36
|
-
};
|
|
37
|
-
export const Disabled = () => {
|
|
38
|
-
return html`
|
|
13
|
+
`,Disabled=()=>t`
|
|
39
14
|
<sp-switch disabled>Switch</sp-switch>
|
|
40
|
-
|
|
41
|
-
};
|
|
42
|
-
export const disabledChecked = () => {
|
|
43
|
-
return html`
|
|
15
|
+
`,disabledChecked=()=>t`
|
|
44
16
|
<sp-switch disabled checked>Switch</sp-switch>
|
|
45
17
|
`;
|
|
46
|
-
};
|
|
47
18
|
//# sourceMappingURL=switch.stories.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["switch.stories.ts"],
|
|
4
4
|
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport '@spectrum-web-components/switch/sp-switch.js';\nimport { html, TemplateResult } from '@spectrum-web-components/base';\n\nexport default {\n component: 'sp-switch',\n title: 'Switch',\n};\n\nexport const Default = (): TemplateResult => {\n return html`\n <sp-switch>Switch</sp-switch>\n `;\n};\n\nexport const Checked = (): TemplateResult => {\n return html`\n <sp-switch checked>Switch</sp-switch>\n `;\n};\n\nexport const readonly = (): TemplateResult => {\n return html`\n <sp-switch checked readonly>Switch</sp-switch>\n `;\n};\n\nexport const emphasized = (): TemplateResult => {\n return html`\n <sp-switch emphasized>Switch</sp-switch>\n `;\n};\n\nexport const emphasizedChecked = (): TemplateResult => {\n return html`\n <sp-switch emphasized checked>Switch</sp-switch>\n `;\n};\n\nexport const Autofocus = (): TemplateResult => {\n return html`\n <sp-switch autofocus>Switch</sp-switch>\n `;\n};\n\nexport const Disabled = (): TemplateResult => {\n return html`\n <sp-switch disabled>Switch</sp-switch>\n `;\n};\n\nexport const disabledChecked = (): TemplateResult => {\n return html`\n <sp-switch disabled checked>Switch</sp-switch>\n `;\n};\n"],
|
|
5
|
-
"mappings": "AAWA
|
|
5
|
+
"mappings": "AAWA,qDACA,qDAEA,cAAe,CACX,UAAW,YACX,MAAO,QACX,EAEO,YAAM,SAAU,IACZ;AAAA;AAAA,MAKE,QAAU,IACZ;AAAA;AAAA,MAKE,SAAW,IACb;AAAA;AAAA,MAKE,WAAa,IACf;AAAA;AAAA,MAKE,kBAAoB,IACtB;AAAA;AAAA,MAKE,UAAY,IACd;AAAA;AAAA,MAKE,SAAW,IACb;AAAA;AAAA,MAKE,gBAAkB,IACpB;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { html } from "lit";
|
|
3
|
-
import { measureFixtureCreation } from "../../../../test/benchmark/helpers.js";
|
|
4
|
-
measureFixtureCreation(html`
|
|
1
|
+
import"@spectrum-web-components/switch/sp-switch.js";import{html as t}from"lit";import{measureFixtureCreation as i}from"../../../../test/benchmark/helpers.js";i(t`
|
|
5
2
|
<sp-switch>Switch</sp-switch>
|
|
6
3
|
`);
|
|
7
4
|
//# sourceMappingURL=test-basic.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["test-basic.ts"],
|
|
4
4
|
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport '@spectrum-web-components/switch/sp-switch.js';\nimport { html } from 'lit';\nimport { measureFixtureCreation } from '../../../../test/benchmark/helpers.js';\n\nmeasureFixtureCreation(html`\n <sp-switch>Switch</sp-switch>\n`);\n"],
|
|
5
|
-
"mappings": "AAYA
|
|
5
|
+
"mappings": "AAYA,qDACA,2BACA,+EAEA,EAAuB;AAAA;AAAA,CAEtB",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/test/switch.test-vrt.js
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { regressVisuals } from "../../../test/visual/test.js";
|
|
3
|
-
regressVisuals("SwitchStories", stories);
|
|
1
|
+
import*as r from"../stories/switch.stories.js";import{regressVisuals as s}from"../../../test/visual/test.js";s("SwitchStories",r);
|
|
4
2
|
//# sourceMappingURL=switch.test-vrt.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["switch.test-vrt.ts"],
|
|
4
4
|
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport * as stories from '../stories/switch.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\n\nregressVisuals('SwitchStories', stories);\n"],
|
|
5
|
-
"mappings": "AAYA
|
|
5
|
+
"mappings": "AAYA,+CACA,8DAEA,EAAe,gBAAiB,CAAO",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/test/switch.test.js
CHANGED
|
@@ -1,32 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { elementUpdated, expect, fixture, html } from "@open-wc/testing";
|
|
3
|
-
import { testForLitDevWarnings } from "../../../test/testing-helpers.js";
|
|
4
|
-
describe("Switch", () => {
|
|
5
|
-
testForLitDevWarnings(async () => await fixture(html`
|
|
1
|
+
import"@spectrum-web-components/switch/sp-switch.js";import{elementUpdated as s,expect as e,fixture as c,html as i}from"@open-wc/testing";import{testForLitDevWarnings as a}from"../../../test/testing-helpers.js";describe("Switch",()=>{a(async()=>await c(i`
|
|
6
2
|
<sp-switch>Not Checked</sp-switch>
|
|
7
|
-
`))
|
|
8
|
-
it("loads default switch accessibly", async () => {
|
|
9
|
-
const el = await fixture(html`
|
|
3
|
+
`)),it("loads default switch accessibly",async()=>{const t=await c(i`
|
|
10
4
|
<sp-switch>Not Checked</sp-switch>
|
|
11
|
-
`);
|
|
12
|
-
await elementUpdated(el);
|
|
13
|
-
await expect(el).to.be.accessible();
|
|
14
|
-
});
|
|
15
|
-
it("loads `checked` switch accessibly", async () => {
|
|
16
|
-
const el = await fixture(html`
|
|
5
|
+
`);await s(t),await e(t).to.be.accessible()}),it("loads `checked` switch accessibly",async()=>{const t=await c(i`
|
|
17
6
|
<sp-switch checked>Checked</sp-switch>
|
|
18
|
-
`);
|
|
19
|
-
await elementUpdated(el);
|
|
20
|
-
await expect(el).to.be.accessible();
|
|
21
|
-
});
|
|
22
|
-
it("maintains its value when [readonly]", async () => {
|
|
23
|
-
const el = await fixture(html`
|
|
7
|
+
`);await s(t),await e(t).to.be.accessible()}),it("maintains its value when [readonly]",async()=>{const t=await c(i`
|
|
24
8
|
<sp-switch checked readonly>Component</sp-switch>
|
|
25
|
-
`);
|
|
26
|
-
expect(el.checked).to.be.true;
|
|
27
|
-
el.focusElement.click();
|
|
28
|
-
await elementUpdated(el);
|
|
29
|
-
expect(el.checked).to.be.true;
|
|
30
|
-
});
|
|
31
|
-
});
|
|
9
|
+
`);e(t.checked).to.be.true,t.focusElement.click(),await s(t),e(t.checked).to.be.true})});
|
|
32
10
|
//# sourceMappingURL=switch.test.js.map
|
package/test/switch.test.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["switch.test.ts"],
|
|
4
4
|
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport '@spectrum-web-components/switch/sp-switch.js';\nimport { Switch } from '@spectrum-web-components/switch';\nimport { elementUpdated, expect, fixture, html } from '@open-wc/testing';\nimport { testForLitDevWarnings } from '../../../test/testing-helpers.js';\n\ndescribe('Switch', () => {\n testForLitDevWarnings(\n async () =>\n await fixture<Switch>(\n html`\n <sp-switch>Not Checked</sp-switch>\n `\n )\n );\n it('loads default switch accessibly', async () => {\n const el = await fixture<Switch>(\n html`\n <sp-switch>Not Checked</sp-switch>\n `\n );\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n it('loads `checked` switch accessibly', async () => {\n const el = await fixture<Switch>(\n html`\n <sp-switch checked>Checked</sp-switch>\n `\n );\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n\n it('maintains its value when [readonly]', async () => {\n const el = await fixture<Switch>(html`\n <sp-switch checked readonly>Component</sp-switch>\n `);\n expect(el.checked).to.be.true;\n\n el.focusElement.click();\n await elementUpdated(el);\n\n expect(el.checked).to.be.true;\n });\n});\n"],
|
|
5
|
-
"mappings": "AAYA
|
|
5
|
+
"mappings": "AAYA,qDAEA,qFACA,yEAEA,SAAS,SAAU,IAAM,CACrB,EACI,SACI,KAAM,GACF;AAAA;AAAA,iBAGJ,CACR,EACA,GAAG,kCAAmC,SAAY,CAC9C,KAAM,GAAK,KAAM,GACb;AAAA;AAAA,aAGJ,EAEA,KAAM,GAAe,CAAE,EAEvB,KAAM,GAAO,CAAE,EAAE,GAAG,GAAG,WAAW,CACtC,CAAC,EACD,GAAG,oCAAqC,SAAY,CAChD,KAAM,GAAK,KAAM,GACb;AAAA;AAAA,aAGJ,EAEA,KAAM,GAAe,CAAE,EAEvB,KAAM,GAAO,CAAE,EAAE,GAAG,GAAG,WAAW,CACtC,CAAC,EAED,GAAG,sCAAuC,SAAY,CAClD,KAAM,GAAK,KAAM,GAAgB;AAAA;AAAA,SAEhC,EACD,EAAO,EAAG,OAAO,EAAE,GAAG,GAAG,KAEzB,EAAG,aAAa,MAAM,EACtB,KAAM,GAAe,CAAE,EAEvB,EAAO,EAAG,OAAO,EAAE,GAAG,GAAG,IAC7B,CAAC,CACL,CAAC",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|