@spectrum-web-components/radio 0.9.12 → 0.9.15-devmode.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/custom-elements.json +1 -1
  2. package/package.json +33 -14
  3. package/sp-radio-group.dev.js +3 -0
  4. package/sp-radio-group.dev.js.map +7 -0
  5. package/sp-radio-group.js +3 -14
  6. package/sp-radio-group.js.map +7 -1
  7. package/sp-radio.dev.js +3 -0
  8. package/sp-radio.dev.js.map +7 -0
  9. package/sp-radio.js +3 -14
  10. package/sp-radio.js.map +7 -1
  11. package/src/Radio.dev.js +125 -0
  12. package/src/Radio.dev.js.map +7 -0
  13. package/src/Radio.js +112 -134
  14. package/src/Radio.js.map +7 -1
  15. package/src/RadioGroup.d.ts +1 -2
  16. package/src/RadioGroup.dev.js +112 -0
  17. package/src/RadioGroup.dev.js.map +7 -0
  18. package/src/RadioGroup.js +102 -116
  19. package/src/RadioGroup.js.map +7 -1
  20. package/src/index.dev.js +3 -0
  21. package/src/index.dev.js.map +7 -0
  22. package/src/index.js +3 -14
  23. package/src/index.js.map +7 -1
  24. package/src/radio.css.dev.js +118 -0
  25. package/src/radio.css.dev.js.map +7 -0
  26. package/src/radio.css.js +3 -14
  27. package/src/radio.css.js.map +7 -1
  28. package/src/spectrum-radio.css.dev.js +116 -0
  29. package/src/spectrum-radio.css.dev.js.map +7 -0
  30. package/src/spectrum-radio.css.js +3 -14
  31. package/src/spectrum-radio.css.js.map +7 -1
  32. package/stories/radio.stories.js +81 -89
  33. package/stories/radio.stories.js.map +7 -1
  34. package/test/benchmark/test-basic.js +6 -17
  35. package/test/benchmark/test-basic.js.map +7 -1
  36. package/test/radio-group.test.js +303 -308
  37. package/test/radio-group.test.js.map +7 -1
  38. package/test/radio.test-vrt.js +4 -15
  39. package/test/radio.test-vrt.js.map +7 -1
  40. package/test/radio.test.js +126 -130
  41. package/test/radio.test.js.map +7 -1
@@ -380,7 +380,7 @@
380
380
  "privacy": "private",
381
381
  "return": {
382
382
  "type": {
383
- "text": "void"
383
+ "text": "Promise<void>"
384
384
  }
385
385
  }
386
386
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectrum-web-components/radio",
3
- "version": "0.9.12",
3
+ "version": "0.9.15-devmode.0+07474d44f",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -20,13 +20,32 @@
20
20
  "module": "./src/index.js",
21
21
  "type": "module",
22
22
  "exports": {
23
- ".": "./src/index.js",
24
- "./src/*": "./src/*",
23
+ ".": {
24
+ "development": "./src/index.dev.js",
25
+ "default": "./src/index.js"
26
+ },
25
27
  "./package.json": "./package.json",
26
- "./sp-radio": "./sp-radio.js",
27
- "./sp-radio.js": "./sp-radio.js",
28
- "./sp-radio-group": "./sp-radio-group.js",
29
- "./sp-radio-group.js": "./sp-radio-group.js"
28
+ "./src/Radio.js": {
29
+ "development": "./src/Radio.dev.js",
30
+ "default": "./src/Radio.js"
31
+ },
32
+ "./src/RadioGroup.js": {
33
+ "development": "./src/RadioGroup.dev.js",
34
+ "default": "./src/RadioGroup.js"
35
+ },
36
+ "./src/index.js": {
37
+ "development": "./src/index.dev.js",
38
+ "default": "./src/index.js"
39
+ },
40
+ "./src/radio.css.js": "./src/radio.css.js",
41
+ "./sp-radio.js": {
42
+ "development": "./sp-radio.dev.js",
43
+ "default": "./sp-radio.js"
44
+ },
45
+ "./sp-radio-group.js": {
46
+ "development": "./sp-radio-group.dev.js",
47
+ "default": "./sp-radio-group.js"
48
+ }
30
49
  },
31
50
  "scripts": {
32
51
  "test": "echo \"Error: run tests from mono-repo root.\" && exit 1"
@@ -46,20 +65,20 @@
46
65
  "lit-html"
47
66
  ],
48
67
  "dependencies": {
49
- "@spectrum-web-components/base": "^0.5.7",
50
- "@spectrum-web-components/field-group": "^0.5.9",
51
- "@spectrum-web-components/help-text": "^0.1.8",
52
- "@spectrum-web-components/reactive-controllers": "^0.2.4",
53
- "@spectrum-web-components/shared": "^0.14.2",
68
+ "@spectrum-web-components/base": "^0.5.9-devmode.24+07474d44f",
69
+ "@spectrum-web-components/field-group": "^0.5.12-devmode.0+07474d44f",
70
+ "@spectrum-web-components/help-text": "^0.1.11-devmode.0+07474d44f",
71
+ "@spectrum-web-components/reactive-controllers": "^0.2.5-devmode.79+07474d44f",
72
+ "@spectrum-web-components/shared": "^0.14.5-devmode.0+07474d44f",
54
73
  "tslib": "^2.0.0"
55
74
  },
56
75
  "devDependencies": {
57
- "@spectrum-css/radio": "^3.0.22"
76
+ "@spectrum-css/radio": "^3.0.24"
58
77
  },
59
78
  "types": "./src/index.d.ts",
60
79
  "customElements": "custom-elements.json",
61
80
  "sideEffects": [
62
81
  "./sp-*.js"
63
82
  ],
64
- "gitHead": "275ee61b152ac3eed0cd1603d8eab2aec90876a0"
83
+ "gitHead": "07474d44f6cee1db241b9ccf3dc812514ffbe7fa"
65
84
  }
@@ -0,0 +1,3 @@
1
+ import { RadioGroup } from "./src/RadioGroup.dev.js";
2
+ customElements.define("sp-radio-group", RadioGroup);
3
+ //# sourceMappingURL=sp-radio-group.dev.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["sp-radio-group.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 { RadioGroup } from './src/RadioGroup.dev.js'\n\ncustomElements.define('sp-radio-group', RadioGroup);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-radio-group': RadioGroup;\n }\n}\n"],
5
+ "mappings": "AAWA;AAEA,eAAe,OAAO,kBAAkB,UAAU;",
6
+ "names": []
7
+ }
package/sp-radio-group.js CHANGED
@@ -1,14 +1,3 @@
1
- /*
2
- Copyright 2020 Adobe. All rights reserved.
3
- This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License. You may obtain a copy
5
- of the License at http://www.apache.org/licenses/LICENSE-2.0
6
-
7
- Unless required by applicable law or agreed to in writing, software distributed under
8
- the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- OF ANY KIND, either express or implied. See the License for the specific language
10
- governing permissions and limitations under the License.
11
- */
12
- import { RadioGroup } from './src/RadioGroup.js';
13
- customElements.define('sp-radio-group', RadioGroup);
14
- //# sourceMappingURL=sp-radio-group.js.map
1
+ import { RadioGroup } from "./src/RadioGroup.js";
2
+ customElements.define("sp-radio-group", RadioGroup);
3
+ //# sourceMappingURL=sp-radio-group.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"sp-radio-group.js","sourceRoot":"","sources":["sp-radio-group.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,cAAc,CAAC,MAAM,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAC","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 { RadioGroup } from './src/RadioGroup.js';\n\ncustomElements.define('sp-radio-group', RadioGroup);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-radio-group': RadioGroup;\n }\n}\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["sp-radio-group.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 { RadioGroup } from './src/RadioGroup.js';\n\ncustomElements.define('sp-radio-group', RadioGroup);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-radio-group': RadioGroup;\n }\n}\n"],
5
+ "mappings": "AAWA;AAEA,eAAe,OAAO,kBAAkB,UAAU;",
6
+ "names": []
7
+ }
@@ -0,0 +1,3 @@
1
+ import { Radio } from "./src/Radio.dev.js";
2
+ customElements.define("sp-radio", Radio);
3
+ //# sourceMappingURL=sp-radio.dev.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["sp-radio.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 { Radio } from './src/Radio.dev.js'\n\ncustomElements.define('sp-radio', Radio);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-radio': Radio;\n }\n}\n"],
5
+ "mappings": "AAWA;AAEA,eAAe,OAAO,YAAY,KAAK;",
6
+ "names": []
7
+ }
package/sp-radio.js CHANGED
@@ -1,14 +1,3 @@
1
- /*
2
- Copyright 2020 Adobe. All rights reserved.
3
- This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License. You may obtain a copy
5
- of the License at http://www.apache.org/licenses/LICENSE-2.0
6
-
7
- Unless required by applicable law or agreed to in writing, software distributed under
8
- the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- OF ANY KIND, either express or implied. See the License for the specific language
10
- governing permissions and limitations under the License.
11
- */
12
- import { Radio } from './src/Radio.js';
13
- customElements.define('sp-radio', Radio);
14
- //# sourceMappingURL=sp-radio.js.map
1
+ import { Radio } from "./src/Radio.js";
2
+ customElements.define("sp-radio", Radio);
3
+ //# sourceMappingURL=sp-radio.js.map
package/sp-radio.js.map CHANGED
@@ -1 +1,7 @@
1
- {"version":3,"file":"sp-radio.js","sourceRoot":"","sources":["sp-radio.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEvC,cAAc,CAAC,MAAM,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC","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 { Radio } from './src/Radio.js';\n\ncustomElements.define('sp-radio', Radio);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-radio': Radio;\n }\n}\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["sp-radio.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 { Radio } from './src/Radio.js';\n\ncustomElements.define('sp-radio', Radio);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-radio': Radio;\n }\n}\n"],
5
+ "mappings": "AAWA;AAEA,eAAe,OAAO,YAAY,KAAK;",
6
+ "names": []
7
+ }
@@ -0,0 +1,125 @@
1
+ var __defProp = Object.defineProperty;
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
+ SpectrumElement
15
+ } from "@spectrum-web-components/base";
16
+ import { property } from "@spectrum-web-components/base/src/decorators.js";
17
+ import { FocusVisiblePolyfillMixin } from "@spectrum-web-components/shared/src/focus-visible.js";
18
+ import radioStyles from "./radio.css.js";
19
+ export class Radio extends FocusVisiblePolyfillMixin(SpectrumElement) {
20
+ constructor() {
21
+ super(...arguments);
22
+ this.autofocus = false;
23
+ this.value = "";
24
+ this.checked = false;
25
+ this.disabled = false;
26
+ this.emphasized = false;
27
+ this.invalid = false;
28
+ this.readonly = false;
29
+ }
30
+ static get styles() {
31
+ return [radioStyles];
32
+ }
33
+ click() {
34
+ if (this.disabled) {
35
+ return;
36
+ }
37
+ this.activate();
38
+ }
39
+ manageAutoFocus() {
40
+ if (this.autofocus) {
41
+ this.dispatchEvent(new KeyboardEvent("keydown", {
42
+ code: "Tab"
43
+ }));
44
+ this.focus();
45
+ }
46
+ }
47
+ activate() {
48
+ if (this.checked) {
49
+ return;
50
+ }
51
+ this.checked = true;
52
+ this.dispatchEvent(new Event("change", {
53
+ bubbles: true,
54
+ composed: true
55
+ }));
56
+ }
57
+ handleKeyup(event) {
58
+ if (event.code === "Space") {
59
+ this.activate();
60
+ }
61
+ }
62
+ render() {
63
+ return html`
64
+ <div id="input"></div>
65
+ <span id="button"></span>
66
+ <span id="label" role="presentation"><slot></slot></span>
67
+ `;
68
+ }
69
+ firstUpdated(changes) {
70
+ super.firstUpdated(changes);
71
+ this.setAttribute("role", "radio");
72
+ if (!this.hasAttribute("tabindex")) {
73
+ this.tabIndex = 0;
74
+ }
75
+ this.manageAutoFocus();
76
+ this.addEventListener("click", this.activate);
77
+ this.addEventListener("keyup", this.handleKeyup);
78
+ }
79
+ updated(changes) {
80
+ super.updated(changes);
81
+ if (changes.has("invalid")) {
82
+ if (this.invalid) {
83
+ this.setAttribute("aria-invalid", "true");
84
+ } else {
85
+ this.removeAttribute("aria-invalid");
86
+ }
87
+ }
88
+ if (changes.has("checked")) {
89
+ if (this.checked) {
90
+ this.setAttribute("aria-checked", "true");
91
+ } else {
92
+ this.setAttribute("aria-checked", "false");
93
+ }
94
+ }
95
+ if (changes.has("disabled")) {
96
+ if (this.disabled) {
97
+ this.setAttribute("aria-disabled", "true");
98
+ } else {
99
+ this.removeAttribute("aria-disabeld");
100
+ }
101
+ }
102
+ }
103
+ }
104
+ __decorateClass([
105
+ property({ type: Boolean })
106
+ ], Radio.prototype, "autofocus", 2);
107
+ __decorateClass([
108
+ property({ type: String, reflect: true })
109
+ ], Radio.prototype, "value", 2);
110
+ __decorateClass([
111
+ property({ type: Boolean, reflect: true })
112
+ ], Radio.prototype, "checked", 2);
113
+ __decorateClass([
114
+ property({ type: Boolean, reflect: true })
115
+ ], Radio.prototype, "disabled", 2);
116
+ __decorateClass([
117
+ property({ type: Boolean, reflect: true })
118
+ ], Radio.prototype, "emphasized", 2);
119
+ __decorateClass([
120
+ property({ type: Boolean, reflect: true })
121
+ ], Radio.prototype, "invalid", 2);
122
+ __decorateClass([
123
+ property({ type: Boolean, reflect: true })
124
+ ], Radio.prototype, "readonly", 2);
125
+ //# sourceMappingURL=Radio.dev.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["Radio.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 {\n CSSResultArray,\n html,\n PropertyValues,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { FocusVisiblePolyfillMixin } from '@spectrum-web-components/shared/src/focus-visible.js';\n\nimport radioStyles from './radio.css.js';\n\n/**\n * @element sp-radio\n *\n * @slot - text label of the Radio button\n * @attr label-below - Moves the label below the radio button\n * @attr invalid - Uses the invalid style\n * @attr disabled - Uses the disabled style\n * @attr checked - Represents when the input is checked\n * @attr value - Identifies this radio button within its radio group\n *\n * @fires change - When the input is interacted with and its state is changed\n */\nexport class Radio extends FocusVisiblePolyfillMixin(SpectrumElement) {\n public static override get styles(): CSSResultArray {\n return [radioStyles];\n }\n\n /**\n * When this control is rendered, focus it automatically\n * @private\n */\n @property({ type: Boolean })\n public override autofocus = false;\n\n @property({ type: String, reflect: true })\n public value = '';\n\n @property({ type: Boolean, reflect: true })\n public checked = false;\n\n @property({ type: Boolean, reflect: true })\n public disabled = false;\n\n @property({ type: Boolean, reflect: true })\n public emphasized = false;\n\n @property({ type: Boolean, reflect: true })\n public invalid = false;\n\n @property({ type: Boolean, reflect: true })\n public readonly = false;\n\n public override click(): void {\n if (this.disabled) {\n return;\n }\n this.activate();\n }\n\n protected manageAutoFocus(): void {\n if (this.autofocus) {\n /**\n * Trick :focus-visible polyfill into thinking keyboard based focus\n *\n * @private\n **/\n this.dispatchEvent(\n new KeyboardEvent('keydown', {\n code: 'Tab',\n })\n );\n this.focus();\n }\n }\n\n protected activate(): void {\n if (this.checked) {\n return;\n }\n this.checked = true;\n this.dispatchEvent(\n new Event('change', {\n bubbles: true,\n composed: true,\n })\n );\n }\n\n protected handleKeyup(event: KeyboardEvent): void {\n if (event.code === 'Space') {\n this.activate();\n }\n }\n\n protected override render(): TemplateResult {\n return html`\n <div id=\"input\"></div>\n <span id=\"button\"></span>\n <span id=\"label\" role=\"presentation\"><slot></slot></span>\n `;\n }\n\n protected override firstUpdated(changes: PropertyValues): void {\n super.firstUpdated(changes);\n this.setAttribute('role', 'radio');\n if (!this.hasAttribute('tabindex')) {\n this.tabIndex = 0;\n }\n this.manageAutoFocus();\n this.addEventListener('click', this.activate);\n this.addEventListener('keyup', this.handleKeyup);\n }\n\n protected override updated(changes: PropertyValues): void {\n super.updated(changes);\n if (changes.has('invalid')) {\n if (this.invalid) {\n this.setAttribute('aria-invalid', 'true');\n } else {\n this.removeAttribute('aria-invalid');\n }\n }\n if (changes.has('checked')) {\n if (this.checked) {\n this.setAttribute('aria-checked', 'true');\n } else {\n this.setAttribute('aria-checked', 'false');\n }\n }\n if (changes.has('disabled')) {\n if (this.disabled) {\n this.setAttribute('aria-disabled', 'true');\n } else {\n this.removeAttribute('aria-disabeld');\n }\n }\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;AAYA;AAAA;AAAA;AAAA;AAOA;AACA;AAEA;AAcO,aAAM,cAAc,0BAA0B,eAAe,EAAE;AAAA,EAA/D;AAAA;AAUa,qBAAY;AAGrB,iBAAQ;AAGR,mBAAU;AAGV,oBAAW;AAGX,sBAAa;AAGb,mBAAU;AAGV,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gB,MAAM;AAAA,MAC5C,OAAO;AACH,aAAK,aAAa,gBAAgB,OAAO;AAAA,MAC7C;AAAA,IACJ;AACA,QAAI,QAAQ,IAAI,UAAU,GAAG;AACzB,UAAI,KAAK,UAAU;AACf,aAAK,aAAa,iBAAiB,MAAM;AAAA,MAC7C,OAAO;AACH,aAAK,gBAAgB,eAAe;AAAA,MACxC;AAAA,IACJ;AAAA,EACJ;AACJ;AAzGoB;AAAA,EADhB,AAAC,SAAS,EAAE,MAAM,QAAQ,CAAC;AAAA,GACX,AAVb,MAUa;AAGT;AAAA,EADP,AAAC,SAAS,EAAE,MAAM,QAAQ,SAAS,KAAK,CAAC;AAAA,GAClC,AAbJ,MAaI;AAGA;AAAA,EADP,AAAC,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GACnC,AAhBJ,MAgBI;AAGA;AAAA,EADP,AAAC,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GACnC,AAnBJ,MAmBI;AAGA;AAAA,EADP,AAAC,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GACnC,AAtBJ,MAsBI;AAGA;AAAA,EADP,AAAC,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GACnC,AAzBJ,MAyBI;AAGA;AAAA,EADP,AAAC,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GACnC,AA5BJ,MA4BI;",
6
+ "names": []
7
+ }
package/src/Radio.js CHANGED
@@ -1,147 +1,125 @@
1
- /*
2
- Copyright 2020 Adobe. All rights reserved.
3
- This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License. You may obtain a copy
5
- of the License at http://www.apache.org/licenses/LICENSE-2.0
6
-
7
- Unless required by applicable law or agreed to in writing, software distributed under
8
- the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- OF ANY KIND, either express or implied. See the License for the specific language
10
- governing permissions and limitations under the License.
11
- */
12
- import { __decorate } from "tslib";
13
- import { html, SpectrumElement, } from '@spectrum-web-components/base';
14
- import { property } from '@spectrum-web-components/base/src/decorators.js';
15
- import { FocusVisiblePolyfillMixin } from '@spectrum-web-components/shared/src/focus-visible.js';
16
- import radioStyles from './radio.css.js';
17
- /**
18
- * @element sp-radio
19
- *
20
- * @slot - text label of the Radio button
21
- * @attr label-below - Moves the label below the radio button
22
- * @attr invalid - Uses the invalid style
23
- * @attr disabled - Uses the disabled style
24
- * @attr checked - Represents when the input is checked
25
- * @attr value - Identifies this radio button within its radio group
26
- *
27
- * @fires change - When the input is interacted with and its state is changed
28
- */
1
+ var __defProp = Object.defineProperty;
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
+ SpectrumElement
15
+ } from "@spectrum-web-components/base";
16
+ import { property } from "@spectrum-web-components/base/src/decorators.js";
17
+ import { FocusVisiblePolyfillMixin } from "@spectrum-web-components/shared/src/focus-visible.js";
18
+ import radioStyles from "./radio.css.js";
29
19
  export class Radio extends FocusVisiblePolyfillMixin(SpectrumElement) {
30
- constructor() {
31
- super(...arguments);
32
- /**
33
- * When this control is rendered, focus it automatically
34
- * @private
35
- */
36
- this.autofocus = false;
37
- this.value = '';
38
- this.checked = false;
39
- this.disabled = false;
40
- this.emphasized = false;
41
- this.invalid = false;
42
- this.readonly = false;
20
+ constructor() {
21
+ super(...arguments);
22
+ this.autofocus = false;
23
+ this.value = "";
24
+ this.checked = false;
25
+ this.disabled = false;
26
+ this.emphasized = false;
27
+ this.invalid = false;
28
+ this.readonly = false;
29
+ }
30
+ static get styles() {
31
+ return [radioStyles];
32
+ }
33
+ click() {
34
+ if (this.disabled) {
35
+ return;
43
36
  }
44
- static get styles() {
45
- return [radioStyles];
37
+ this.activate();
38
+ }
39
+ manageAutoFocus() {
40
+ if (this.autofocus) {
41
+ this.dispatchEvent(new KeyboardEvent("keydown", {
42
+ code: "Tab"
43
+ }));
44
+ this.focus();
46
45
  }
47
- click() {
48
- if (this.disabled) {
49
- return;
50
- }
51
- this.activate();
46
+ }
47
+ activate() {
48
+ if (this.checked) {
49
+ return;
52
50
  }
53
- manageAutoFocus() {
54
- if (this.autofocus) {
55
- /**
56
- * Trick :focus-visible polyfill into thinking keyboard based focus
57
- *
58
- * @private
59
- **/
60
- this.dispatchEvent(new KeyboardEvent('keydown', {
61
- code: 'Tab',
62
- }));
63
- this.focus();
64
- }
51
+ this.checked = true;
52
+ this.dispatchEvent(new Event("change", {
53
+ bubbles: true,
54
+ composed: true
55
+ }));
56
+ }
57
+ handleKeyup(event) {
58
+ if (event.code === "Space") {
59
+ this.activate();
65
60
  }
66
- activate() {
67
- if (this.checked) {
68
- return;
69
- }
70
- this.checked = true;
71
- this.dispatchEvent(new Event('change', {
72
- bubbles: true,
73
- composed: true,
74
- }));
75
- }
76
- handleKeyup(event) {
77
- if (event.code === 'Space') {
78
- this.activate();
79
- }
80
- }
81
- render() {
82
- return html `
61
+ }
62
+ render() {
63
+ return html`
83
64
  <div id="input"></div>
84
65
  <span id="button"></span>
85
66
  <span id="label" role="presentation"><slot></slot></span>
86
67
  `;
68
+ }
69
+ firstUpdated(changes) {
70
+ super.firstUpdated(changes);
71
+ this.setAttribute("role", "radio");
72
+ if (!this.hasAttribute("tabindex")) {
73
+ this.tabIndex = 0;
74
+ }
75
+ this.manageAutoFocus();
76
+ this.addEventListener("click", this.activate);
77
+ this.addEventListener("keyup", this.handleKeyup);
78
+ }
79
+ updated(changes) {
80
+ super.updated(changes);
81
+ if (changes.has("invalid")) {
82
+ if (this.invalid) {
83
+ this.setAttribute("aria-invalid", "true");
84
+ } else {
85
+ this.removeAttribute("aria-invalid");
86
+ }
87
87
  }
88
- firstUpdated(changes) {
89
- super.firstUpdated(changes);
90
- this.setAttribute('role', 'radio');
91
- if (!this.hasAttribute('tabindex')) {
92
- this.tabIndex = 0;
93
- }
94
- this.manageAutoFocus();
95
- this.addEventListener('click', this.activate);
96
- this.addEventListener('keyup', this.handleKeyup);
88
+ if (changes.has("checked")) {
89
+ if (this.checked) {
90
+ this.setAttribute("aria-checked", "true");
91
+ } else {
92
+ this.setAttribute("aria-checked", "false");
93
+ }
97
94
  }
98
- updated(changes) {
99
- super.updated(changes);
100
- if (changes.has('invalid')) {
101
- if (this.invalid) {
102
- this.setAttribute('aria-invalid', 'true');
103
- }
104
- else {
105
- this.removeAttribute('aria-invalid');
106
- }
107
- }
108
- if (changes.has('checked')) {
109
- if (this.checked) {
110
- this.setAttribute('aria-checked', 'true');
111
- }
112
- else {
113
- this.setAttribute('aria-checked', 'false');
114
- }
115
- }
116
- if (changes.has('disabled')) {
117
- if (this.disabled) {
118
- this.setAttribute('aria-disabled', 'true');
119
- }
120
- else {
121
- this.removeAttribute('aria-disabeld');
122
- }
123
- }
95
+ if (changes.has("disabled")) {
96
+ if (this.disabled) {
97
+ this.setAttribute("aria-disabled", "true");
98
+ } else {
99
+ this.removeAttribute("aria-disabeld");
100
+ }
124
101
  }
102
+ }
125
103
  }
126
- __decorate([
127
- property({ type: Boolean })
128
- ], Radio.prototype, "autofocus", void 0);
129
- __decorate([
130
- property({ type: String, reflect: true })
131
- ], Radio.prototype, "value", void 0);
132
- __decorate([
133
- property({ type: Boolean, reflect: true })
134
- ], Radio.prototype, "checked", void 0);
135
- __decorate([
136
- property({ type: Boolean, reflect: true })
137
- ], Radio.prototype, "disabled", void 0);
138
- __decorate([
139
- property({ type: Boolean, reflect: true })
140
- ], Radio.prototype, "emphasized", void 0);
141
- __decorate([
142
- property({ type: Boolean, reflect: true })
143
- ], Radio.prototype, "invalid", void 0);
144
- __decorate([
145
- property({ type: Boolean, reflect: true })
146
- ], Radio.prototype, "readonly", void 0);
147
- //# sourceMappingURL=Radio.js.map
104
+ __decorateClass([
105
+ property({ type: Boolean })
106
+ ], Radio.prototype, "autofocus", 2);
107
+ __decorateClass([
108
+ property({ type: String, reflect: true })
109
+ ], Radio.prototype, "value", 2);
110
+ __decorateClass([
111
+ property({ type: Boolean, reflect: true })
112
+ ], Radio.prototype, "checked", 2);
113
+ __decorateClass([
114
+ property({ type: Boolean, reflect: true })
115
+ ], Radio.prototype, "disabled", 2);
116
+ __decorateClass([
117
+ property({ type: Boolean, reflect: true })
118
+ ], Radio.prototype, "emphasized", 2);
119
+ __decorateClass([
120
+ property({ type: Boolean, reflect: true })
121
+ ], Radio.prototype, "invalid", 2);
122
+ __decorateClass([
123
+ property({ type: Boolean, reflect: true })
124
+ ], Radio.prototype, "readonly", 2);
125
+ //# sourceMappingURL=Radio.js.map
package/src/Radio.js.map CHANGED
@@ -1 +1,7 @@
1
- {"version":3,"file":"Radio.js","sourceRoot":"","sources":["Radio.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;;AAEF,OAAO,EAEH,IAAI,EAEJ,eAAe,GAElB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,iDAAiD,CAAC;AAC3E,OAAO,EAAE,yBAAyB,EAAE,MAAM,sDAAsD,CAAC;AAEjG,OAAO,WAAW,MAAM,gBAAgB,CAAC;AAEzC;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,KAAM,SAAQ,yBAAyB,CAAC,eAAe,CAAC;IAArE;;QAKI;;;WAGG;QAEa,cAAS,GAAG,KAAK,CAAC;QAG3B,UAAK,GAAG,EAAE,CAAC;QAGX,YAAO,GAAG,KAAK,CAAC;QAGhB,aAAQ,GAAG,KAAK,CAAC;QAGjB,eAAU,GAAG,KAAK,CAAC;QAGnB,YAAO,GAAG,KAAK,CAAC;QAGhB,aAAQ,GAAG,KAAK,CAAC;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,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yCACjB;AAG1B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;sCACpB;AAGvB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;uCACnB","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 SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { FocusVisiblePolyfillMixin } from '@spectrum-web-components/shared/src/focus-visible.js';\n\nimport radioStyles from './radio.css.js';\n\n/**\n * @element sp-radio\n *\n * @slot - text label of the Radio button\n * @attr label-below - Moves the label below the radio button\n * @attr invalid - Uses the invalid style\n * @attr disabled - Uses the disabled style\n * @attr checked - Represents when the input is checked\n * @attr value - Identifies this radio button within its radio group\n *\n * @fires change - When the input is interacted with and its state is changed\n */\nexport class Radio extends FocusVisiblePolyfillMixin(SpectrumElement) {\n public static override get styles(): CSSResultArray {\n return [radioStyles];\n }\n\n /**\n * When this control is rendered, focus it automatically\n * @private\n */\n @property({ type: Boolean })\n public override autofocus = false;\n\n @property({ type: String, reflect: true })\n public value = '';\n\n @property({ type: Boolean, reflect: true })\n public checked = false;\n\n @property({ type: Boolean, reflect: true })\n public disabled = false;\n\n @property({ type: Boolean, reflect: true })\n public emphasized = false;\n\n @property({ type: Boolean, reflect: true })\n public invalid = false;\n\n @property({ type: Boolean, reflect: true })\n public readonly = false;\n\n public override click(): void {\n if (this.disabled) {\n return;\n }\n this.activate();\n }\n\n protected manageAutoFocus(): void {\n if (this.autofocus) {\n /**\n * Trick :focus-visible polyfill into thinking keyboard based focus\n *\n * @private\n **/\n this.dispatchEvent(\n new KeyboardEvent('keydown', {\n code: 'Tab',\n })\n );\n this.focus();\n }\n }\n\n protected activate(): void {\n if (this.checked) {\n return;\n }\n this.checked = true;\n this.dispatchEvent(\n new Event('change', {\n bubbles: true,\n composed: true,\n })\n );\n }\n\n protected handleKeyup(event: KeyboardEvent): void {\n if (event.code === 'Space') {\n this.activate();\n }\n }\n\n protected override render(): TemplateResult {\n return html`\n <div id=\"input\"></div>\n <span id=\"button\"></span>\n <span id=\"label\" role=\"presentation\"><slot></slot></span>\n `;\n }\n\n protected override firstUpdated(changes: PropertyValues): void {\n super.firstUpdated(changes);\n this.setAttribute('role', 'radio');\n if (!this.hasAttribute('tabindex')) {\n this.tabIndex = 0;\n }\n this.manageAutoFocus();\n this.addEventListener('click', this.activate);\n this.addEventListener('keyup', this.handleKeyup);\n }\n\n protected override updated(changes: PropertyValues): void {\n super.updated(changes);\n if (changes.has('invalid')) {\n if (this.invalid) {\n this.setAttribute('aria-invalid', 'true');\n } else {\n this.removeAttribute('aria-invalid');\n }\n }\n if (changes.has('checked')) {\n if (this.checked) {\n this.setAttribute('aria-checked', 'true');\n } else {\n this.setAttribute('aria-checked', 'false');\n }\n }\n if (changes.has('disabled')) {\n if (this.disabled) {\n this.setAttribute('aria-disabled', 'true');\n } else {\n this.removeAttribute('aria-disabeld');\n }\n }\n }\n}\n"]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["Radio.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 {\n CSSResultArray,\n html,\n PropertyValues,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { FocusVisiblePolyfillMixin } from '@spectrum-web-components/shared/src/focus-visible.js';\n\nimport radioStyles from './radio.css.js';\n\n/**\n * @element sp-radio\n *\n * @slot - text label of the Radio button\n * @attr label-below - Moves the label below the radio button\n * @attr invalid - Uses the invalid style\n * @attr disabled - Uses the disabled style\n * @attr checked - Represents when the input is checked\n * @attr value - Identifies this radio button within its radio group\n *\n * @fires change - When the input is interacted with and its state is changed\n */\nexport class Radio extends FocusVisiblePolyfillMixin(SpectrumElement) {\n public static override get styles(): CSSResultArray {\n return [radioStyles];\n }\n\n /**\n * When this control is rendered, focus it automatically\n * @private\n */\n @property({ type: Boolean })\n public override autofocus = false;\n\n @property({ type: String, reflect: true })\n public value = '';\n\n @property({ type: Boolean, reflect: true })\n public checked = false;\n\n @property({ type: Boolean, reflect: true })\n public disabled = false;\n\n @property({ type: Boolean, reflect: true })\n public emphasized = false;\n\n @property({ type: Boolean, reflect: true })\n public invalid = false;\n\n @property({ type: Boolean, reflect: true })\n public readonly = false;\n\n public override click(): void {\n if (this.disabled) {\n return;\n }\n this.activate();\n }\n\n protected manageAutoFocus(): void {\n if (this.autofocus) {\n /**\n * Trick :focus-visible polyfill into thinking keyboard based focus\n *\n * @private\n **/\n this.dispatchEvent(\n new KeyboardEvent('keydown', {\n code: 'Tab',\n })\n );\n this.focus();\n }\n }\n\n protected activate(): void {\n if (this.checked) {\n return;\n }\n this.checked = true;\n this.dispatchEvent(\n new Event('change', {\n bubbles: true,\n composed: true,\n })\n );\n }\n\n protected handleKeyup(event: KeyboardEvent): void {\n if (event.code === 'Space') {\n this.activate();\n }\n }\n\n protected override render(): TemplateResult {\n return html`\n <div id=\"input\"></div>\n <span id=\"button\"></span>\n <span id=\"label\" role=\"presentation\"><slot></slot></span>\n `;\n }\n\n protected override firstUpdated(changes: PropertyValues): void {\n super.firstUpdated(changes);\n this.setAttribute('role', 'radio');\n if (!this.hasAttribute('tabindex')) {\n this.tabIndex = 0;\n }\n this.manageAutoFocus();\n this.addEventListener('click', this.activate);\n this.addEventListener('keyup', this.handleKeyup);\n }\n\n protected override updated(changes: PropertyValues): void {\n super.updated(changes);\n if (changes.has('invalid')) {\n if (this.invalid) {\n this.setAttribute('aria-invalid', 'true');\n } else {\n this.removeAttribute('aria-invalid');\n }\n }\n if (changes.has('checked')) {\n if (this.checked) {\n this.setAttribute('aria-checked', 'true');\n } else {\n this.setAttribute('aria-checked', 'false');\n }\n }\n if (changes.has('disabled')) {\n if (this.disabled) {\n this.setAttribute('aria-disabled', 'true');\n } else {\n this.removeAttribute('aria-disabeld');\n }\n }\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;AAYA;AAAA;AAAA;AAAA;AAOA;AACA;AAEA;AAcO,aAAM,cAAc,0BAA0B,eAAe,EAAE;AAAA,EAA/D;AAAA;AAUa,qBAAY;AAGrB,iBAAQ;AAGR,mBAAU;AAGV,oBAAW;AAGX,sBAAa;AAGb,mBAAU;AAGV,oBAAW;AAAA;AAAA,aA3BS,SAAyB;AAChD,WAAO,CAAC,WAAW;AAAA,EACvB;AAAA,EA2BgB,QAAc;AAC1B,QAAI,KAAK,UAAU;AACf;AAAA,IACJ;AACA,SAAK,SAAS;AAAA,EAClB;AAAA,EAEU,kBAAwB;AAC9B,QAAI,KAAK,WAAW;AAMhB,WAAK,cACD,IAAI,cAAc,WAAW;AAAA,QACzB,MAAM;AAAA,MACV,CAAC,CACL;AACA,WAAK,MAAM;AAAA,IACf;AAAA,EACJ;AAAA,EAEU,WAAiB;AACvB,QAAI,KAAK,SAAS;AACd;AAAA,IACJ;AACA,SAAK,UAAU;AACf,SAAK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;AAAA,GAClC,AAbJ,MAaI;AAGA;AAAA,EADP,AAAC,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GACnC,AAhBJ,MAgBI;AAGA;AAAA,EADP,AAAC,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GACnC,AAnBJ,MAmBI;AAGA;AAAA,EADP,AAAC,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GACnC,AAtBJ,MAsBI;AAGA;AAAA,EADP,AAAC,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GACnC,AAzBJ,MAyBI;AAGA;AAAA,EADP,AAAC,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GACnC,AA5BJ,MA4BI;",
6
+ "names": []
7
+ }
@@ -20,8 +20,7 @@ export declare class RadioGroup extends RadioGroup_base {
20
20
  focus(): void;
21
21
  private _setSelected;
22
22
  selected: string;
23
- protected firstUpdated(changes: PropertyValues<this>): void;
24
- protected updated(changes: PropertyValues<this>): void;
23
+ protected willUpdate(changes: PropertyValues<this>): void;
25
24
  private validateRadios;
26
25
  protected handleSlotchange(): void;
27
26
  }