@spectrum-web-components/switch 0.10.0-devmode.0 → 0.11.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.
Files changed (41) hide show
  1. package/README.md +38 -1
  2. package/custom-elements.json +6 -0
  3. package/package.json +5 -5
  4. package/sp-switch.dev.js +1 -0
  5. package/sp-switch.dev.js.map +1 -1
  6. package/sp-switch.js +1 -2
  7. package/sp-switch.js.map +2 -2
  8. package/src/Switch.d.ts +6 -1
  9. package/src/Switch.dev.js +8 -3
  10. package/src/Switch.dev.js.map +2 -2
  11. package/src/Switch.js +2 -46
  12. package/src/Switch.js.map +3 -3
  13. package/src/index.dev.js +1 -0
  14. package/src/index.dev.js.map +1 -1
  15. package/src/index.js +1 -1
  16. package/src/index.js.map +1 -1
  17. package/src/spectrum-config.js +23 -0
  18. package/src/spectrum-switch.css.dev.js +270 -110
  19. package/src/spectrum-switch.css.dev.js.map +2 -2
  20. package/src/spectrum-switch.css.js +271 -114
  21. package/src/spectrum-switch.css.js.map +3 -3
  22. package/src/switch-legacy.css.dev.js +1 -0
  23. package/src/switch-legacy.css.dev.js.map +1 -1
  24. package/src/switch-legacy.css.js +2 -4
  25. package/src/switch-legacy.css.js.map +2 -2
  26. package/src/switch.css.dev.js +270 -112
  27. package/src/switch.css.dev.js.map +2 -2
  28. package/src/switch.css.js +271 -116
  29. package/src/switch.css.js.map +3 -3
  30. package/stories/switch-sizes.stories.js +23 -0
  31. package/stories/switch-sizes.stories.js.map +7 -0
  32. package/stories/switch.stories.js +34 -4
  33. package/stories/switch.stories.js.map +2 -2
  34. package/test/benchmark/test-basic.js +1 -0
  35. package/test/benchmark/test-basic.js.map +1 -1
  36. package/test/switch-sizes.test-vrt.js +5 -0
  37. package/test/switch-sizes.test-vrt.js.map +7 -0
  38. package/test/switch.test-vrt.js +1 -0
  39. package/test/switch.test-vrt.js.map +1 -1
  40. package/test/switch.test.js +15 -6
  41. package/test/switch.test.js.map +1 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["switch.stories.ts"],
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;AACA;AAEA,eAAe;AAAA,EACX,WAAW;AAAA,EACX,OAAO;AACX;AAEO,aAAM,UAAU,MAAsB;AACzC,SAAO;AAAA;AAAA;AAGX;AAEO,aAAM,UAAU,MAAsB;AACzC,SAAO;AAAA;AAAA;AAGX;AAEO,aAAM,WAAW,MAAsB;AAC1C,SAAO;AAAA;AAAA;AAGX;AAEO,aAAM,aAAa,MAAsB;AAC5C,SAAO;AAAA;AAAA;AAGX;AAEO,aAAM,oBAAoB,MAAsB;AACnD,SAAO;AAAA;AAAA;AAGX;AAEO,aAAM,YAAY,MAAsB;AAC3C,SAAO;AAAA;AAAA;AAGX;AAEO,aAAM,WAAW,MAAsB;AAC1C,SAAO;AAAA;AAAA;AAGX;AAEO,aAAM,kBAAkB,MAAsB;AACjD,SAAO;AAAA;AAAA;AAGX;",
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';\nimport { spreadProps } from '../../../test/lit-helpers.js';\n\nexport default {\n component: 'sp-switch',\n title: 'Switch',\n\n argTypes: {\n size: {\n name: 'size',\n type: { name: 'string', required: false },\n description: 'The size at which to display the Switch element',\n table: {\n type: { summary: '\"s\" | \"m\" | \"l\" | \"xl\"' },\n defaultValue: { summary: 'm' },\n },\n control: {\n type: 'text',\n },\n },\n },\n args: {\n size: 'm',\n },\n};\n\nexport interface StoryArgs {\n Autofocus?: boolean;\n checked?: boolean;\n Disabled?: boolean;\n disabledChecked?: boolean;\n emphasized?: boolean;\n readonly?: boolean;\n size?: 's' | 'm' | 'l' | 'xl';\n [prop: string]: unknown;\n}\n\nfunction renderSwitch(args: StoryArgs): TemplateResult {\n return html`\n <sp-switch ${spreadProps(args)}>Switch</sp-switch>\n `;\n}\n\nexport const Default = (args: StoryArgs): TemplateResult => renderSwitch(args);\n\nexport const Checked = (): TemplateResult => {\n return html`\n <sp-switch checked>Switch</sp-switch>\n `;\n};\n\nexport const Sizes = (): TemplateResult => {\n return html`\n <div style=\"display: flex; align-items: center; gap: 8px;\">\n <sp-switch size=\"s\">Small</sp-switch>\n <sp-switch size=\"m\">Medium</sp-switch>\n <sp-switch size=\"l\">Large</sp-switch>\n <sp-switch size=\"xl\">Extra-Large</sp-switch>\n </div>\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,OAAO;AACP,SAAS,YAA4B;AACrC,SAAS,mBAAmB;AAE5B,eAAe;AAAA,EACX,WAAW;AAAA,EACX,OAAO;AAAA,EAEP,UAAU;AAAA,IACN,MAAM;AAAA,MACF,MAAM;AAAA,MACN,MAAM,EAAE,MAAM,UAAU,UAAU,MAAM;AAAA,MACxC,aAAa;AAAA,MACb,OAAO;AAAA,QACH,MAAM,EAAE,SAAS,yBAAyB;AAAA,QAC1C,cAAc,EAAE,SAAS,IAAI;AAAA,MACjC;AAAA,MACA,SAAS;AAAA,QACL,MAAM;AAAA,MACV;AAAA,IACJ;AAAA,EACJ;AAAA,EACA,MAAM;AAAA,IACF,MAAM;AAAA,EACV;AACJ;AAaA,SAAS,aAAa,MAAiC;AACnD,SAAO;AAAA,qBACU,YAAY,IAAI;AAAA;AAErC;AAEO,aAAM,UAAU,CAAC,SAAoC,aAAa,IAAI;AAEtE,aAAM,UAAU,MAAsB;AACzC,SAAO;AAAA;AAAA;AAGX;AAEO,aAAM,QAAQ,MAAsB;AACvC,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQX;AAEO,aAAM,WAAW,MAAsB;AAC1C,SAAO;AAAA;AAAA;AAGX;AAEO,aAAM,aAAa,MAAsB;AAC5C,SAAO;AAAA;AAAA;AAGX;AAEO,aAAM,oBAAoB,MAAsB;AACnD,SAAO;AAAA;AAAA;AAGX;AAEO,aAAM,YAAY,MAAsB;AAC3C,SAAO;AAAA;AAAA;AAGX;AAEO,aAAM,WAAW,MAAsB;AAC1C,SAAO;AAAA;AAAA;AAGX;AAEO,aAAM,kBAAkB,MAAsB;AACjD,SAAO;AAAA;AAAA;AAGX;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  import "@spectrum-web-components/switch/sp-switch.js";
2
3
  import { html } from "lit";
3
4
  import { measureFixtureCreation } from "../../../../test/benchmark/helpers.js";
@@ -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;AACA;AACA;AAEA,uBAAuB;AAAA;AAAA,CAEtB;",
5
+ "mappings": ";AAYA,OAAO;AACP,SAAS,YAAY;AACrB,SAAS,8BAA8B;AAEvC,uBAAuB;AAAA;AAAA,CAEtB;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ import * as stories from "../stories/switch-sizes.stories.js";
3
+ import { regressVisuals } from "../../../test/visual/test.js";
4
+ regressVisuals("SwitchSizesStories", stories);
5
+ //# sourceMappingURL=switch-sizes.test-vrt.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["switch-sizes.test-vrt.ts"],
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-sizes.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\n\nregressVisuals('SwitchSizesStories', stories);\n"],
5
+ "mappings": ";AAYA,YAAY,aAAa;AACzB,SAAS,sBAAsB;AAE/B,eAAe,sBAAsB,OAAO;",
6
+ "names": []
7
+ }
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  import * as stories from "../stories/switch.stories.js";
2
3
  import { regressVisuals } from "../../../test/visual/test.js";
3
4
  regressVisuals("SwitchStories", stories);
@@ -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;AACA;AAEA,eAAe,iBAAiB,OAAO;",
5
+ "mappings": ";AAYA,YAAY,aAAa;AACzB,SAAS,sBAAsB;AAE/B,eAAe,iBAAiB,OAAO;",
6
6
  "names": []
7
7
  }
@@ -1,21 +1,30 @@
1
+ "use strict";
1
2
  import "@spectrum-web-components/switch/sp-switch.js";
2
3
  import { elementUpdated, expect, fixture, html } from "@open-wc/testing";
3
4
  import { testForLitDevWarnings } from "../../../test/testing-helpers.js";
4
5
  describe("Switch", () => {
5
- testForLitDevWarnings(async () => await fixture(html`
6
+ testForLitDevWarnings(
7
+ async () => await fixture(
8
+ html`
6
9
  <sp-switch>Not Checked</sp-switch>
7
- `));
10
+ `
11
+ )
12
+ );
8
13
  it("loads default switch accessibly", async () => {
9
- const el = await fixture(html`
14
+ const el = await fixture(
15
+ html`
10
16
  <sp-switch>Not Checked</sp-switch>
11
- `);
17
+ `
18
+ );
12
19
  await elementUpdated(el);
13
20
  await expect(el).to.be.accessible();
14
21
  });
15
22
  it("loads `checked` switch accessibly", async () => {
16
- const el = await fixture(html`
23
+ const el = await fixture(
24
+ html`
17
25
  <sp-switch checked>Checked</sp-switch>
18
- `);
26
+ `
27
+ );
19
28
  await elementUpdated(el);
20
29
  await expect(el).to.be.accessible();
21
30
  });
@@ -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;AAEA;AACA;AAEA,SAAS,UAAU,MAAM;AACrB,wBACI,YACI,MAAM,QACF;AAAA;AAAA,iBAGJ,CACR;AACA,KAAG,mCAAmC,YAAY;AAC9C,UAAM,KAAK,MAAM,QACb;AAAA;AAAA,aAGJ;AAEA,UAAM,eAAe,EAAE;AAEvB,UAAM,OAAO,EAAE,EAAE,GAAG,GAAG,WAAW;AAAA,EACtC,CAAC;AACD,KAAG,qCAAqC,YAAY;AAChD,UAAM,KAAK,MAAM,QACb;AAAA;AAAA,aAGJ;AAEA,UAAM,eAAe,EAAE;AAEvB,UAAM,OAAO,EAAE,EAAE,GAAG,GAAG,WAAW;AAAA,EACtC,CAAC;AAED,KAAG,uCAAuC,YAAY;AAClD,UAAM,KAAK,MAAM,QAAgB;AAAA;AAAA,SAEhC;AACD,WAAO,GAAG,OAAO,EAAE,GAAG,GAAG;AAEzB,OAAG,aAAa,MAAM;AACtB,UAAM,eAAe,EAAE;AAEvB,WAAO,GAAG,OAAO,EAAE,GAAG,GAAG;AAAA,EAC7B,CAAC;AACL,CAAC;",
5
+ "mappings": ";AAYA,OAAO;AAEP,SAAS,gBAAgB,QAAQ,SAAS,YAAY;AACtD,SAAS,6BAA6B;AAEtC,SAAS,UAAU,MAAM;AACrB;AAAA,IACI,YACI,MAAM;AAAA,MACF;AAAA;AAAA;AAAA,IAGJ;AAAA,EACR;AACA,KAAG,mCAAmC,YAAY;AAC9C,UAAM,KAAK,MAAM;AAAA,MACb;AAAA;AAAA;AAAA,IAGJ;AAEA,UAAM,eAAe,EAAE;AAEvB,UAAM,OAAO,EAAE,EAAE,GAAG,GAAG,WAAW;AAAA,EACtC,CAAC;AACD,KAAG,qCAAqC,YAAY;AAChD,UAAM,KAAK,MAAM;AAAA,MACb;AAAA;AAAA;AAAA,IAGJ;AAEA,UAAM,eAAe,EAAE;AAEvB,UAAM,OAAO,EAAE,EAAE,GAAG,GAAG,WAAW;AAAA,EACtC,CAAC;AAED,KAAG,uCAAuC,YAAY;AAClD,UAAM,KAAK,MAAM,QAAgB;AAAA;AAAA,SAEhC;AACD,WAAO,GAAG,OAAO,EAAE,GAAG,GAAG;AAEzB,OAAG,aAAa,MAAM;AACtB,UAAM,eAAe,EAAE;AAEvB,WAAO,GAAG,OAAO,EAAE,GAAG,GAAG;AAAA,EAC7B,CAAC;AACL,CAAC;",
6
6
  "names": []
7
7
  }