@spectrum-web-components/radio 1.1.0 → 1.1.1
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 +7 -7
- package/sp-radio-group.d.ts +6 -0
- package/sp-radio-group.dev.js +5 -0
- package/sp-radio-group.dev.js.map +7 -0
- package/sp-radio-group.js +2 -0
- package/sp-radio-group.js.map +7 -0
- package/sp-radio.d.ts +6 -0
- package/sp-radio.dev.js +5 -0
- package/sp-radio.dev.js.map +7 -0
- package/sp-radio.js +2 -0
- package/sp-radio.js.map +7 -0
- package/src/Radio.d.ts +38 -0
- package/src/Radio.dev.js +133 -0
- package/src/Radio.dev.js.map +7 -0
- package/src/Radio.js +6 -0
- package/src/Radio.js.map +7 -0
- package/src/RadioGroup.d.ts +27 -0
- package/src/RadioGroup.dev.js +118 -0
- package/src/RadioGroup.dev.js.map +7 -0
- package/src/RadioGroup.js +2 -0
- package/src/RadioGroup.js.map +7 -0
- package/src/index.d.ts +2 -0
- package/src/index.dev.js +4 -0
- package/src/index.dev.js.map +7 -0
- package/src/index.js +2 -0
- package/src/index.js.map +7 -0
- package/src/radio-overrides.css.d.ts +2 -0
- package/src/radio-overrides.css.dev.js +7 -0
- package/src/radio-overrides.css.dev.js.map +7 -0
- package/src/radio-overrides.css.js +4 -0
- package/src/radio-overrides.css.js.map +7 -0
- package/src/radio.css.d.ts +2 -0
- package/src/radio.css.dev.js +7 -0
- package/src/radio.css.dev.js.map +7 -0
- package/src/radio.css.js +4 -0
- package/src/radio.css.js.map +7 -0
- package/src/spectrum-radio.css.d.ts +2 -0
- package/src/spectrum-radio.css.dev.js +7 -0
- package/src/spectrum-radio.css.dev.js.map +7 -0
- package/src/spectrum-radio.css.js +4 -0
- package/src/spectrum-radio.css.js.map +7 -0
- package/stories/radio-sizes.stories.js +76 -0
- package/stories/radio-sizes.stories.js.map +7 -0
- package/stories/radio.stories.js +147 -0
- package/stories/radio.stories.js.map +7 -0
- package/test/benchmark/test-basic.js +13 -0
- package/test/benchmark/test-basic.js.map +7 -0
- package/test/radio-group.test.js +560 -0
- package/test/radio-group.test.js.map +7 -0
- package/test/radio-memory.test.js +8 -0
- package/test/radio-memory.test.js.map +7 -0
- package/test/radio-sizes.test-vrt.js +5 -0
- package/test/radio-sizes.test-vrt.js.map +7 -0
- package/test/radio.test-vrt.js +5 -0
- package/test/radio.test-vrt.js.map +7 -0
- package/test/radio.test.js +151 -0
- package/test/radio.test.js.map +7 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/radio",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -66,11 +66,11 @@
|
|
|
66
66
|
"lit-html"
|
|
67
67
|
],
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@spectrum-web-components/base": "^1.1.
|
|
70
|
-
"@spectrum-web-components/field-group": "^1.1.
|
|
71
|
-
"@spectrum-web-components/help-text": "^1.1.
|
|
72
|
-
"@spectrum-web-components/reactive-controllers": "^1.1.
|
|
73
|
-
"@spectrum-web-components/shared": "^1.1.
|
|
69
|
+
"@spectrum-web-components/base": "^1.1.1",
|
|
70
|
+
"@spectrum-web-components/field-group": "^1.1.1",
|
|
71
|
+
"@spectrum-web-components/help-text": "^1.1.1",
|
|
72
|
+
"@spectrum-web-components/reactive-controllers": "^1.1.1",
|
|
73
|
+
"@spectrum-web-components/shared": "^1.1.1"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"@spectrum-css/radio": "10.0.0-s2-foundations.17"
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"./sp-*.js",
|
|
82
82
|
"./**/*.dev.js"
|
|
83
83
|
],
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "44870aa95001c1b995456d994ae31bbe7277fac9"
|
|
85
85
|
}
|
|
@@ -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'\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-radio-group', RadioGroup);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-radio-group': RadioGroup;\n }\n}\n"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,kBAAkB;AAC3B,SAAS,qBAAqB;AAE9B,cAAc,kBAAkB,UAAU;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -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.js';\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-radio-group', RadioGroup);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-radio-group': RadioGroup;\n }\n}\n"],
|
|
5
|
+
"mappings": "aAWA,OAAS,cAAAA,MAAkB,sBAC3B,OAAS,iBAAAC,MAAqB,sDAE9BA,EAAc,iBAAkBD,CAAU",
|
|
6
|
+
"names": ["RadioGroup", "defineElement"]
|
|
7
|
+
}
|
package/sp-radio.d.ts
ADDED
package/sp-radio.dev.js
ADDED
|
@@ -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'\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-radio', Radio);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-radio': Radio;\n }\n}\n"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,aAAa;AACtB,SAAS,qBAAqB;AAE9B,cAAc,YAAY,KAAK;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/sp-radio.js
ADDED
package/sp-radio.js.map
ADDED
|
@@ -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.js';\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-radio', Radio);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-radio': Radio;\n }\n}\n"],
|
|
5
|
+
"mappings": "aAWA,OAAS,SAAAA,MAAa,iBACtB,OAAS,iBAAAC,MAAqB,sDAE9BA,EAAc,WAAYD,CAAK",
|
|
6
|
+
"names": ["Radio", "defineElement"]
|
|
7
|
+
}
|
package/src/Radio.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { CSSResultArray, PropertyValues, SpectrumElement, TemplateResult } from '@spectrum-web-components/base';
|
|
2
|
+
declare const Radio_base: typeof SpectrumElement & {
|
|
3
|
+
new (...args: any[]): import("@spectrum-web-components/base").SizedElementInterface;
|
|
4
|
+
prototype: import("@spectrum-web-components/base").SizedElementInterface;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* @element sp-radio
|
|
8
|
+
*
|
|
9
|
+
* @slot - text label of the Radio button
|
|
10
|
+
* @attr invalid - Uses the invalid style
|
|
11
|
+
* @attr disabled - Uses the disabled style
|
|
12
|
+
* @attr checked - Represents when the input is checked
|
|
13
|
+
* @attr value - Identifies this radio button within its radio group
|
|
14
|
+
*
|
|
15
|
+
* @fires change - When the input is interacted with and its state is changed
|
|
16
|
+
*/
|
|
17
|
+
export declare class Radio extends Radio_base {
|
|
18
|
+
static get styles(): CSSResultArray;
|
|
19
|
+
/**
|
|
20
|
+
* When this control is rendered, focus it automatically
|
|
21
|
+
* @private
|
|
22
|
+
*/
|
|
23
|
+
autofocus: boolean;
|
|
24
|
+
value: string;
|
|
25
|
+
checked: boolean;
|
|
26
|
+
disabled: boolean;
|
|
27
|
+
emphasized: boolean;
|
|
28
|
+
invalid: boolean;
|
|
29
|
+
readonly: boolean;
|
|
30
|
+
click(): void;
|
|
31
|
+
protected manageAutoFocus(): void;
|
|
32
|
+
protected activate(): void;
|
|
33
|
+
protected handleKeyup(event: KeyboardEvent): void;
|
|
34
|
+
protected render(): TemplateResult;
|
|
35
|
+
protected firstUpdated(changes: PropertyValues): void;
|
|
36
|
+
protected updated(changes: PropertyValues): void;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
package/src/Radio.dev.js
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
5
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
6
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7
|
+
if (decorator = decorators[i])
|
|
8
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
9
|
+
if (kind && result) __defProp(target, key, result);
|
|
10
|
+
return result;
|
|
11
|
+
};
|
|
12
|
+
import {
|
|
13
|
+
html,
|
|
14
|
+
SizedMixin,
|
|
15
|
+
SpectrumElement
|
|
16
|
+
} from "@spectrum-web-components/base";
|
|
17
|
+
import { property } from "@spectrum-web-components/base/src/decorators.js";
|
|
18
|
+
import { FocusVisiblePolyfillMixin } from "@spectrum-web-components/shared/src/focus-visible.js";
|
|
19
|
+
import radioStyles from "./radio.css.js";
|
|
20
|
+
export class Radio extends SizedMixin(
|
|
21
|
+
FocusVisiblePolyfillMixin(SpectrumElement),
|
|
22
|
+
{ noDefaultSize: true }
|
|
23
|
+
) {
|
|
24
|
+
constructor() {
|
|
25
|
+
super(...arguments);
|
|
26
|
+
this.autofocus = false;
|
|
27
|
+
this.value = "";
|
|
28
|
+
this.checked = false;
|
|
29
|
+
this.disabled = false;
|
|
30
|
+
this.emphasized = false;
|
|
31
|
+
this.invalid = false;
|
|
32
|
+
this.readonly = false;
|
|
33
|
+
}
|
|
34
|
+
static get styles() {
|
|
35
|
+
return [radioStyles];
|
|
36
|
+
}
|
|
37
|
+
click() {
|
|
38
|
+
if (this.disabled) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
this.activate();
|
|
42
|
+
}
|
|
43
|
+
manageAutoFocus() {
|
|
44
|
+
if (this.autofocus) {
|
|
45
|
+
this.dispatchEvent(
|
|
46
|
+
new KeyboardEvent("keydown", {
|
|
47
|
+
code: "Tab"
|
|
48
|
+
})
|
|
49
|
+
);
|
|
50
|
+
this.focus();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
activate() {
|
|
54
|
+
if (this.checked) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
this.checked = true;
|
|
58
|
+
this.dispatchEvent(
|
|
59
|
+
new Event("change", {
|
|
60
|
+
bubbles: true,
|
|
61
|
+
composed: true
|
|
62
|
+
})
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
handleKeyup(event) {
|
|
66
|
+
if (event.code === "Space") {
|
|
67
|
+
this.activate();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
render() {
|
|
71
|
+
return html`
|
|
72
|
+
<div id="input"></div>
|
|
73
|
+
<span id="button"></span>
|
|
74
|
+
<span id="label" role="presentation"><slot></slot></span>
|
|
75
|
+
`;
|
|
76
|
+
}
|
|
77
|
+
firstUpdated(changes) {
|
|
78
|
+
super.firstUpdated(changes);
|
|
79
|
+
this.setAttribute("role", "radio");
|
|
80
|
+
if (!this.hasAttribute("tabindex")) {
|
|
81
|
+
this.tabIndex = 0;
|
|
82
|
+
}
|
|
83
|
+
this.manageAutoFocus();
|
|
84
|
+
this.addEventListener("click", this.activate);
|
|
85
|
+
this.addEventListener("keyup", this.handleKeyup);
|
|
86
|
+
}
|
|
87
|
+
updated(changes) {
|
|
88
|
+
super.updated(changes);
|
|
89
|
+
if (changes.has("invalid")) {
|
|
90
|
+
if (this.invalid) {
|
|
91
|
+
this.setAttribute("aria-invalid", "true");
|
|
92
|
+
} else {
|
|
93
|
+
this.removeAttribute("aria-invalid");
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (changes.has("checked")) {
|
|
97
|
+
if (this.checked) {
|
|
98
|
+
this.setAttribute("aria-checked", "true");
|
|
99
|
+
} else {
|
|
100
|
+
this.setAttribute("aria-checked", "false");
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
if (changes.has("disabled")) {
|
|
104
|
+
if (this.disabled) {
|
|
105
|
+
this.setAttribute("aria-disabled", "true");
|
|
106
|
+
} else {
|
|
107
|
+
this.removeAttribute("aria-disabled");
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
__decorateClass([
|
|
113
|
+
property({ type: Boolean })
|
|
114
|
+
], Radio.prototype, "autofocus", 2);
|
|
115
|
+
__decorateClass([
|
|
116
|
+
property({ type: String, reflect: true })
|
|
117
|
+
], Radio.prototype, "value", 2);
|
|
118
|
+
__decorateClass([
|
|
119
|
+
property({ type: Boolean, reflect: true })
|
|
120
|
+
], Radio.prototype, "checked", 2);
|
|
121
|
+
__decorateClass([
|
|
122
|
+
property({ type: Boolean, reflect: true })
|
|
123
|
+
], Radio.prototype, "disabled", 2);
|
|
124
|
+
__decorateClass([
|
|
125
|
+
property({ type: Boolean, reflect: true })
|
|
126
|
+
], Radio.prototype, "emphasized", 2);
|
|
127
|
+
__decorateClass([
|
|
128
|
+
property({ type: Boolean, reflect: true })
|
|
129
|
+
], Radio.prototype, "invalid", 2);
|
|
130
|
+
__decorateClass([
|
|
131
|
+
property({ type: Boolean, reflect: true })
|
|
132
|
+
], Radio.prototype, "readonly", 2);
|
|
133
|
+
//# 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 SizedMixin,\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 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 SizedMixin(\n FocusVisiblePolyfillMixin(SpectrumElement),\n { noDefaultSize: true }\n) {\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-disabled');\n }\n }\n }\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/src/Radio.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";var u=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var t=(l,s,e,a)=>{for(var i=a>1?void 0:a?c(s,e):s,d=l.length-1,o;d>=0;d--)(o=l[d])&&(i=(a?o(s,e,i):o(i))||i);return a&&i&&u(s,e,i),i};import{html as p,SizedMixin as n,SpectrumElement as h}from"@spectrum-web-components/base";import{property as r}from"@spectrum-web-components/base/src/decorators.js";import{FocusVisiblePolyfillMixin as f}from"@spectrum-web-components/shared/src/focus-visible.js";import b from"./radio.css.js";export class Radio extends n(f(h),{noDefaultSize:!0}){constructor(){super(...arguments);this.autofocus=!1;this.value="";this.checked=!1;this.disabled=!1;this.emphasized=!1;this.invalid=!1;this.readonly=!1}static get styles(){return[b]}click(){this.disabled||this.activate()}manageAutoFocus(){this.autofocus&&(this.dispatchEvent(new KeyboardEvent("keydown",{code:"Tab"})),this.focus())}activate(){this.checked||(this.checked=!0,this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})))}handleKeyup(e){e.code==="Space"&&this.activate()}render(){return p`
|
|
2
|
+
<div id="input"></div>
|
|
3
|
+
<span id="button"></span>
|
|
4
|
+
<span id="label" role="presentation"><slot></slot></span>
|
|
5
|
+
`}firstUpdated(e){super.firstUpdated(e),this.setAttribute("role","radio"),this.hasAttribute("tabindex")||(this.tabIndex=0),this.manageAutoFocus(),this.addEventListener("click",this.activate),this.addEventListener("keyup",this.handleKeyup)}updated(e){super.updated(e),e.has("invalid")&&(this.invalid?this.setAttribute("aria-invalid","true"):this.removeAttribute("aria-invalid")),e.has("checked")&&(this.checked?this.setAttribute("aria-checked","true"):this.setAttribute("aria-checked","false")),e.has("disabled")&&(this.disabled?this.setAttribute("aria-disabled","true"):this.removeAttribute("aria-disabled"))}}t([r({type:Boolean})],Radio.prototype,"autofocus",2),t([r({type:String,reflect:!0})],Radio.prototype,"value",2),t([r({type:Boolean,reflect:!0})],Radio.prototype,"checked",2),t([r({type:Boolean,reflect:!0})],Radio.prototype,"disabled",2),t([r({type:Boolean,reflect:!0})],Radio.prototype,"emphasized",2),t([r({type:Boolean,reflect:!0})],Radio.prototype,"invalid",2),t([r({type:Boolean,reflect:!0})],Radio.prototype,"readonly",2);
|
|
6
|
+
//# sourceMappingURL=Radio.js.map
|
package/src/Radio.js.map
ADDED
|
@@ -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 SizedMixin,\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 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 SizedMixin(\n FocusVisiblePolyfillMixin(SpectrumElement),\n { noDefaultSize: true }\n) {\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-disabled');\n }\n }\n }\n}\n"],
|
|
5
|
+
"mappings": "qNAYA,OAEI,QAAAA,EAEA,cAAAC,EACA,mBAAAC,MAEG,gCACP,OAAS,YAAAC,MAAgB,kDACzB,OAAS,6BAAAC,MAAiC,uDAE1C,OAAOC,MAAiB,iBAajB,aAAM,cAAcJ,EACvBG,EAA0BF,CAAe,EACzC,CAAE,cAAe,EAAK,CAC1B,CAAE,CAHK,kCAaH,KAAgB,UAAY,GAG5B,KAAO,MAAQ,GAGf,KAAO,QAAU,GAGjB,KAAO,SAAW,GAGlB,KAAO,WAAa,GAGpB,KAAO,QAAU,GAGjB,KAAO,SAAW,GA3BlB,WAA2B,QAAyB,CAChD,MAAO,CAACG,CAAW,CACvB,CA2BgB,OAAc,CACtB,KAAK,UAGT,KAAK,SAAS,CAClB,CAEU,iBAAwB,CAC1B,KAAK,YAML,KAAK,cACD,IAAI,cAAc,UAAW,CACzB,KAAM,KACV,CAAC,CACL,EACA,KAAK,MAAM,EAEnB,CAEU,UAAiB,CACnB,KAAK,UAGT,KAAK,QAAU,GACf,KAAK,cACD,IAAI,MAAM,SAAU,CAChB,QAAS,GACT,SAAU,EACd,CAAC,CACL,EACJ,CAEU,YAAYC,EAA4B,CAC1CA,EAAM,OAAS,SACf,KAAK,SAAS,CAEtB,CAEmB,QAAyB,CACxC,OAAON;AAAA;AAAA;AAAA;AAAA,SAKX,CAEmB,aAAaO,EAA+B,CAC3D,MAAM,aAAaA,CAAO,EAC1B,KAAK,aAAa,OAAQ,OAAO,EAC5B,KAAK,aAAa,UAAU,IAC7B,KAAK,SAAW,GAEpB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,QAAS,KAAK,QAAQ,EAC5C,KAAK,iBAAiB,QAAS,KAAK,WAAW,CACnD,CAEmB,QAAQA,EAA+B,CACtD,MAAM,QAAQA,CAAO,EACjBA,EAAQ,IAAI,SAAS,IACjB,KAAK,QACL,KAAK,aAAa,eAAgB,MAAM,EAExC,KAAK,gBAAgB,cAAc,GAGvCA,EAAQ,IAAI,SAAS,IACjB,KAAK,QACL,KAAK,aAAa,eAAgB,MAAM,EAExC,KAAK,aAAa,eAAgB,OAAO,GAG7CA,EAAQ,IAAI,UAAU,IAClB,KAAK,SACL,KAAK,aAAa,gBAAiB,MAAM,EAEzC,KAAK,gBAAgB,eAAe,EAGhD,CACJ,CAzGoBC,EAAA,CADfL,EAAS,CAAE,KAAM,OAAQ,CAAC,GAZlB,MAaO,yBAGTK,EAAA,CADNL,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,GAfhC,MAgBF,qBAGAK,EAAA,CADNL,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GAlBjC,MAmBF,uBAGAK,EAAA,CADNL,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GArBjC,MAsBF,wBAGAK,EAAA,CADNL,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GAxBjC,MAyBF,0BAGAK,EAAA,CADNL,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GA3BjC,MA4BF,uBAGAK,EAAA,CADNL,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GA9BjC,MA+BF",
|
|
6
|
+
"names": ["html", "SizedMixin", "SpectrumElement", "property", "FocusVisiblePolyfillMixin", "radioStyles", "event", "changes", "__decorateClass"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { PropertyValues } from '@spectrum-web-components/base';
|
|
2
|
+
import { FieldGroup } from '@spectrum-web-components/field-group';
|
|
3
|
+
import { Radio } from './Radio.js';
|
|
4
|
+
import { RovingTabindexController } from '@spectrum-web-components/reactive-controllers/src/RovingTabindex.js';
|
|
5
|
+
declare const RadioGroup_base: typeof FieldGroup;
|
|
6
|
+
/**
|
|
7
|
+
* @element sp-radio-group
|
|
8
|
+
*
|
|
9
|
+
* @slot - The `sp-radio` elements to display/manage in the group.
|
|
10
|
+
* @slot help-text - default or non-negative help text to associate to your form element
|
|
11
|
+
* @slot negative-help-text - negative help text to associate to your form element when `invalid`
|
|
12
|
+
*
|
|
13
|
+
* @fires change - An alteration to the value of the element has been committed by the user.
|
|
14
|
+
*/
|
|
15
|
+
export declare class RadioGroup extends RadioGroup_base {
|
|
16
|
+
name: string;
|
|
17
|
+
defaultNodes: Node[];
|
|
18
|
+
get buttons(): Radio[];
|
|
19
|
+
rovingTabindexController: RovingTabindexController<Radio>;
|
|
20
|
+
focus(): void;
|
|
21
|
+
private _setSelected;
|
|
22
|
+
selected: string;
|
|
23
|
+
protected willUpdate(changes: PropertyValues<this>): void;
|
|
24
|
+
private validateRadios;
|
|
25
|
+
protected handleSlotchange(): void;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
5
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
6
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7
|
+
if (decorator = decorators[i])
|
|
8
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
9
|
+
if (kind && result) __defProp(target, key, result);
|
|
10
|
+
return result;
|
|
11
|
+
};
|
|
12
|
+
import {
|
|
13
|
+
property,
|
|
14
|
+
queryAssignedNodes
|
|
15
|
+
} from "@spectrum-web-components/base/src/decorators.js";
|
|
16
|
+
import { FocusVisiblePolyfillMixin } from "@spectrum-web-components/shared/src/focus-visible.js";
|
|
17
|
+
import { FieldGroup } from "@spectrum-web-components/field-group";
|
|
18
|
+
import { Radio } from "./Radio.dev.js";
|
|
19
|
+
import { RovingTabindexController } from "@spectrum-web-components/reactive-controllers/src/RovingTabindex.js";
|
|
20
|
+
export class RadioGroup extends FocusVisiblePolyfillMixin(FieldGroup) {
|
|
21
|
+
constructor() {
|
|
22
|
+
super(...arguments);
|
|
23
|
+
this.name = "";
|
|
24
|
+
this.rovingTabindexController = new RovingTabindexController(this, {
|
|
25
|
+
focusInIndex: (elements) => {
|
|
26
|
+
return elements.findIndex((el) => {
|
|
27
|
+
return this.selected ? !el.disabled && el.value === this.selected : !el.disabled;
|
|
28
|
+
});
|
|
29
|
+
},
|
|
30
|
+
elementEnterAction: (el) => {
|
|
31
|
+
this._setSelected(el.value);
|
|
32
|
+
},
|
|
33
|
+
elements: () => this.buttons,
|
|
34
|
+
isFocusableElement: (el) => !el.disabled
|
|
35
|
+
});
|
|
36
|
+
this.selected = "";
|
|
37
|
+
}
|
|
38
|
+
get buttons() {
|
|
39
|
+
return this.defaultNodes.filter(
|
|
40
|
+
(node) => node instanceof Radio
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
focus() {
|
|
44
|
+
this.rovingTabindexController.focus();
|
|
45
|
+
}
|
|
46
|
+
_setSelected(value) {
|
|
47
|
+
if (value === this.selected) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const oldValue = this.selected;
|
|
51
|
+
const radio = value ? this.querySelector(`sp-radio[value="${value}"]`) : void 0;
|
|
52
|
+
this.selected = radio ? value : "";
|
|
53
|
+
const applyDefault = this.dispatchEvent(
|
|
54
|
+
new Event("change", {
|
|
55
|
+
cancelable: true,
|
|
56
|
+
bubbles: true,
|
|
57
|
+
composed: true
|
|
58
|
+
})
|
|
59
|
+
);
|
|
60
|
+
if (!applyDefault) {
|
|
61
|
+
this.selected = oldValue;
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
this.validateRadios();
|
|
65
|
+
}
|
|
66
|
+
willUpdate(changes) {
|
|
67
|
+
if (!this.hasUpdated) {
|
|
68
|
+
this.setAttribute("role", "radiogroup");
|
|
69
|
+
const checkedRadio = this.querySelector(
|
|
70
|
+
"sp-radio[checked]"
|
|
71
|
+
);
|
|
72
|
+
const checkedRadioValue = checkedRadio ? checkedRadio.value : "";
|
|
73
|
+
this.selected = checkedRadioValue || this.selected;
|
|
74
|
+
if (this.selected && this.selected !== checkedRadioValue) {
|
|
75
|
+
const selectedRadio = this.querySelector(
|
|
76
|
+
`sp-radio[value="${this.selected}"]`
|
|
77
|
+
);
|
|
78
|
+
if (selectedRadio) {
|
|
79
|
+
selectedRadio.checked = true;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
this.shadowRoot.addEventListener("change", (event) => {
|
|
83
|
+
event.stopPropagation();
|
|
84
|
+
const target = event.target;
|
|
85
|
+
this._setSelected(target.value);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
if (changes.has("selected")) {
|
|
89
|
+
this.validateRadios();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
async validateRadios() {
|
|
93
|
+
let validSelection = false;
|
|
94
|
+
if (!this.hasUpdated) {
|
|
95
|
+
await this.updateComplete;
|
|
96
|
+
}
|
|
97
|
+
this.buttons.map((button) => {
|
|
98
|
+
button.checked = this.selected === button.value;
|
|
99
|
+
validSelection = validSelection || button.checked;
|
|
100
|
+
});
|
|
101
|
+
if (!validSelection) {
|
|
102
|
+
this.selected = "";
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
handleSlotchange() {
|
|
106
|
+
this.rovingTabindexController.clearElementCache();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
__decorateClass([
|
|
110
|
+
property({ type: String })
|
|
111
|
+
], RadioGroup.prototype, "name", 2);
|
|
112
|
+
__decorateClass([
|
|
113
|
+
queryAssignedNodes()
|
|
114
|
+
], RadioGroup.prototype, "defaultNodes", 2);
|
|
115
|
+
__decorateClass([
|
|
116
|
+
property({ reflect: true })
|
|
117
|
+
], RadioGroup.prototype, "selected", 2);
|
|
118
|
+
//# sourceMappingURL=RadioGroup.dev.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["RadioGroup.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 { PropertyValues } from '@spectrum-web-components/base';\nimport {\n property,\n queryAssignedNodes,\n} from '@spectrum-web-components/base/src/decorators.js';\nimport { FocusVisiblePolyfillMixin } from '@spectrum-web-components/shared/src/focus-visible.js';\nimport { FieldGroup } from '@spectrum-web-components/field-group';\n\nimport { Radio } from './Radio.dev.js'\nimport { RovingTabindexController } from '@spectrum-web-components/reactive-controllers/src/RovingTabindex.js';\n\n/**\n * @element sp-radio-group\n *\n * @slot - The `sp-radio` elements to display/manage in the group.\n * @slot help-text - default or non-negative help text to associate to your form element\n * @slot negative-help-text - negative help text to associate to your form element when `invalid`\n *\n * @fires change - An alteration to the value of the element has been committed by the user.\n */\nexport class RadioGroup extends FocusVisiblePolyfillMixin(FieldGroup) {\n @property({ type: String })\n public name = '';\n\n @queryAssignedNodes()\n public defaultNodes!: Node[];\n\n public get buttons(): Radio[] {\n return this.defaultNodes.filter(\n (node) => (node as HTMLElement) instanceof Radio\n ) as Radio[];\n }\n\n rovingTabindexController = new RovingTabindexController<Radio>(this, {\n focusInIndex: (elements: Radio[]) => {\n return elements.findIndex((el) => {\n return this.selected\n ? !el.disabled && el.value === this.selected\n : !el.disabled;\n });\n },\n elementEnterAction: (el: Radio) => {\n this._setSelected(el.value);\n },\n elements: () => this.buttons,\n isFocusableElement: (el: Radio) => !el.disabled,\n });\n\n public override focus(): void {\n this.rovingTabindexController.focus();\n }\n\n private _setSelected(value: string): void {\n if (value === this.selected) {\n return;\n }\n const oldValue = this.selected;\n const radio = value\n ? (this.querySelector(`sp-radio[value=\"${value}\"]`) as Radio)\n : undefined;\n\n // If no matching radio, selected is reset to empty string\n this.selected = radio ? value : '';\n const applyDefault = this.dispatchEvent(\n new Event('change', {\n cancelable: true,\n bubbles: true,\n composed: true,\n })\n );\n if (!applyDefault) {\n this.selected = oldValue;\n return;\n }\n this.validateRadios();\n }\n\n @property({ reflect: true })\n public selected = '';\n\n protected override willUpdate(changes: PropertyValues<this>): void {\n if (!this.hasUpdated) {\n this.setAttribute('role', 'radiogroup');\n const checkedRadio = this.querySelector(\n 'sp-radio[checked]'\n ) as Radio;\n const checkedRadioValue = checkedRadio ? checkedRadio.value : '';\n // Prefer the checked item over the selected value\n this.selected = checkedRadioValue || this.selected;\n // Validate the selected value is actual a radio option\n if (this.selected && this.selected !== checkedRadioValue) {\n const selectedRadio = this.querySelector(\n `sp-radio[value=\"${this.selected}\"]`\n ) as Radio;\n if (selectedRadio) {\n selectedRadio.checked = true;\n }\n }\n\n this.shadowRoot.addEventListener('change', (event: Event) => {\n event.stopPropagation();\n const target = event.target as Radio;\n this._setSelected(target.value);\n });\n }\n\n if (changes.has('selected')) {\n this.validateRadios();\n }\n }\n\n private async validateRadios(): Promise<void> {\n let validSelection = false;\n if (!this.hasUpdated) {\n // Initial validation has to happen after the initial render to allow\n // the buttons to be queries from the rendered <slot> element\n await this.updateComplete;\n }\n this.buttons.map((button) => {\n button.checked = this.selected === button.value;\n validSelection = validSelection || button.checked;\n });\n if (!validSelection) {\n this.selected = '';\n }\n }\n\n protected override handleSlotchange(): void {\n this.rovingTabindexController.clearElementCache();\n }\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var c=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var a=(l,d,e,t)=>{for(var i=t>1?void 0:t?n(d,e):d,s=l.length-1,o;s>=0;s--)(o=l[s])&&(i=(t?o(d,e,i):o(i))||i);return t&&i&&c(d,e,i),i};import{property as r,queryAssignedNodes as h}from"@spectrum-web-components/base/src/decorators.js";import{FocusVisiblePolyfillMixin as u}from"@spectrum-web-components/shared/src/focus-visible.js";import{FieldGroup as p}from"@spectrum-web-components/field-group";import{Radio as f}from"./Radio.js";import{RovingTabindexController as v}from"@spectrum-web-components/reactive-controllers/src/RovingTabindex.js";export class RadioGroup extends u(p){constructor(){super(...arguments);this.name="";this.rovingTabindexController=new v(this,{focusInIndex:e=>e.findIndex(t=>this.selected?!t.disabled&&t.value===this.selected:!t.disabled),elementEnterAction:e=>{this._setSelected(e.value)},elements:()=>this.buttons,isFocusableElement:e=>!e.disabled});this.selected=""}get buttons(){return this.defaultNodes.filter(e=>e instanceof f)}focus(){this.rovingTabindexController.focus()}_setSelected(e){if(e===this.selected)return;const t=this.selected,i=e?this.querySelector(`sp-radio[value="${e}"]`):void 0;if(this.selected=i?e:"",!this.dispatchEvent(new Event("change",{cancelable:!0,bubbles:!0,composed:!0}))){this.selected=t;return}this.validateRadios()}willUpdate(e){if(!this.hasUpdated){this.setAttribute("role","radiogroup");const t=this.querySelector("sp-radio[checked]"),i=t?t.value:"";if(this.selected=i||this.selected,this.selected&&this.selected!==i){const s=this.querySelector(`sp-radio[value="${this.selected}"]`);s&&(s.checked=!0)}this.shadowRoot.addEventListener("change",s=>{s.stopPropagation();const o=s.target;this._setSelected(o.value)})}e.has("selected")&&this.validateRadios()}async validateRadios(){let e=!1;this.hasUpdated||await this.updateComplete,this.buttons.map(t=>{t.checked=this.selected===t.value,e=e||t.checked}),e||(this.selected="")}handleSlotchange(){this.rovingTabindexController.clearElementCache()}}a([r({type:String})],RadioGroup.prototype,"name",2),a([h()],RadioGroup.prototype,"defaultNodes",2),a([r({reflect:!0})],RadioGroup.prototype,"selected",2);
|
|
2
|
+
//# sourceMappingURL=RadioGroup.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["RadioGroup.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 { PropertyValues } from '@spectrum-web-components/base';\nimport {\n property,\n queryAssignedNodes,\n} from '@spectrum-web-components/base/src/decorators.js';\nimport { FocusVisiblePolyfillMixin } from '@spectrum-web-components/shared/src/focus-visible.js';\nimport { FieldGroup } from '@spectrum-web-components/field-group';\n\nimport { Radio } from './Radio.js';\nimport { RovingTabindexController } from '@spectrum-web-components/reactive-controllers/src/RovingTabindex.js';\n\n/**\n * @element sp-radio-group\n *\n * @slot - The `sp-radio` elements to display/manage in the group.\n * @slot help-text - default or non-negative help text to associate to your form element\n * @slot negative-help-text - negative help text to associate to your form element when `invalid`\n *\n * @fires change - An alteration to the value of the element has been committed by the user.\n */\nexport class RadioGroup extends FocusVisiblePolyfillMixin(FieldGroup) {\n @property({ type: String })\n public name = '';\n\n @queryAssignedNodes()\n public defaultNodes!: Node[];\n\n public get buttons(): Radio[] {\n return this.defaultNodes.filter(\n (node) => (node as HTMLElement) instanceof Radio\n ) as Radio[];\n }\n\n rovingTabindexController = new RovingTabindexController<Radio>(this, {\n focusInIndex: (elements: Radio[]) => {\n return elements.findIndex((el) => {\n return this.selected\n ? !el.disabled && el.value === this.selected\n : !el.disabled;\n });\n },\n elementEnterAction: (el: Radio) => {\n this._setSelected(el.value);\n },\n elements: () => this.buttons,\n isFocusableElement: (el: Radio) => !el.disabled,\n });\n\n public override focus(): void {\n this.rovingTabindexController.focus();\n }\n\n private _setSelected(value: string): void {\n if (value === this.selected) {\n return;\n }\n const oldValue = this.selected;\n const radio = value\n ? (this.querySelector(`sp-radio[value=\"${value}\"]`) as Radio)\n : undefined;\n\n // If no matching radio, selected is reset to empty string\n this.selected = radio ? value : '';\n const applyDefault = this.dispatchEvent(\n new Event('change', {\n cancelable: true,\n bubbles: true,\n composed: true,\n })\n );\n if (!applyDefault) {\n this.selected = oldValue;\n return;\n }\n this.validateRadios();\n }\n\n @property({ reflect: true })\n public selected = '';\n\n protected override willUpdate(changes: PropertyValues<this>): void {\n if (!this.hasUpdated) {\n this.setAttribute('role', 'radiogroup');\n const checkedRadio = this.querySelector(\n 'sp-radio[checked]'\n ) as Radio;\n const checkedRadioValue = checkedRadio ? checkedRadio.value : '';\n // Prefer the checked item over the selected value\n this.selected = checkedRadioValue || this.selected;\n // Validate the selected value is actual a radio option\n if (this.selected && this.selected !== checkedRadioValue) {\n const selectedRadio = this.querySelector(\n `sp-radio[value=\"${this.selected}\"]`\n ) as Radio;\n if (selectedRadio) {\n selectedRadio.checked = true;\n }\n }\n\n this.shadowRoot.addEventListener('change', (event: Event) => {\n event.stopPropagation();\n const target = event.target as Radio;\n this._setSelected(target.value);\n });\n }\n\n if (changes.has('selected')) {\n this.validateRadios();\n }\n }\n\n private async validateRadios(): Promise<void> {\n let validSelection = false;\n if (!this.hasUpdated) {\n // Initial validation has to happen after the initial render to allow\n // the buttons to be queries from the rendered <slot> element\n await this.updateComplete;\n }\n this.buttons.map((button) => {\n button.checked = this.selected === button.value;\n validSelection = validSelection || button.checked;\n });\n if (!validSelection) {\n this.selected = '';\n }\n }\n\n protected override handleSlotchange(): void {\n this.rovingTabindexController.clearElementCache();\n }\n}\n"],
|
|
5
|
+
"mappings": "qNAaA,OACI,YAAAA,EACA,sBAAAC,MACG,kDACP,OAAS,6BAAAC,MAAiC,uDAC1C,OAAS,cAAAC,MAAkB,uCAE3B,OAAS,SAAAC,MAAa,aACtB,OAAS,4BAAAC,MAAgC,sEAWlC,aAAM,mBAAmBH,EAA0BC,CAAU,CAAE,CAA/D,kCAEH,KAAO,KAAO,GAWd,8BAA2B,IAAIE,EAAgC,KAAM,CACjE,aAAeC,GACJA,EAAS,UAAWC,GAChB,KAAK,SACN,CAACA,EAAG,UAAYA,EAAG,QAAU,KAAK,SAClC,CAACA,EAAG,QACb,EAEL,mBAAqBA,GAAc,CAC/B,KAAK,aAAaA,EAAG,KAAK,CAC9B,EACA,SAAU,IAAM,KAAK,QACrB,mBAAqBA,GAAc,CAACA,EAAG,QAC3C,CAAC,EAgCD,KAAO,SAAW,GAnDlB,IAAW,SAAmB,CAC1B,OAAO,KAAK,aAAa,OACpBC,GAAUA,aAAgCJ,CAC/C,CACJ,CAiBgB,OAAc,CAC1B,KAAK,yBAAyB,MAAM,CACxC,CAEQ,aAAaK,EAAqB,CACtC,GAAIA,IAAU,KAAK,SACf,OAEJ,MAAMC,EAAW,KAAK,SAChBC,EAAQF,EACP,KAAK,cAAc,mBAAmBA,CAAK,IAAI,EAChD,OAWN,GARA,KAAK,SAAWE,EAAQF,EAAQ,GAQ5B,CAPiB,KAAK,cACtB,IAAI,MAAM,SAAU,CAChB,WAAY,GACZ,QAAS,GACT,SAAU,EACd,CAAC,CACL,EACmB,CACf,KAAK,SAAWC,EAChB,MACJ,CACA,KAAK,eAAe,CACxB,CAKmB,WAAWE,EAAqC,CAC/D,GAAI,CAAC,KAAK,WAAY,CAClB,KAAK,aAAa,OAAQ,YAAY,EACtC,MAAMC,EAAe,KAAK,cACtB,mBACJ,EACMC,EAAoBD,EAAeA,EAAa,MAAQ,GAI9D,GAFA,KAAK,SAAWC,GAAqB,KAAK,SAEtC,KAAK,UAAY,KAAK,WAAaA,EAAmB,CACtD,MAAMC,EAAgB,KAAK,cACvB,mBAAmB,KAAK,QAAQ,IACpC,EACIA,IACAA,EAAc,QAAU,GAEhC,CAEA,KAAK,WAAW,iBAAiB,SAAWC,GAAiB,CACzDA,EAAM,gBAAgB,EACtB,MAAMC,EAASD,EAAM,OACrB,KAAK,aAAaC,EAAO,KAAK,CAClC,CAAC,CACL,CAEIL,EAAQ,IAAI,UAAU,GACtB,KAAK,eAAe,CAE5B,CAEA,MAAc,gBAAgC,CAC1C,IAAIM,EAAiB,GAChB,KAAK,YAGN,MAAM,KAAK,eAEf,KAAK,QAAQ,IAAKC,GAAW,CACzBA,EAAO,QAAU,KAAK,WAAaA,EAAO,MAC1CD,EAAiBA,GAAkBC,EAAO,OAC9C,CAAC,EACID,IACD,KAAK,SAAW,GAExB,CAEmB,kBAAyB,CACxC,KAAK,yBAAyB,kBAAkB,CACpD,CACJ,CA5GWE,EAAA,CADNpB,EAAS,CAAE,KAAM,MAAO,CAAC,GADjB,WAEF,oBAGAoB,EAAA,CADNnB,EAAmB,GAJX,WAKF,4BAqDAmB,EAAA,CADNpB,EAAS,CAAE,QAAS,EAAK,CAAC,GAzDlB,WA0DF",
|
|
6
|
+
"names": ["property", "queryAssignedNodes", "FocusVisiblePolyfillMixin", "FieldGroup", "Radio", "RovingTabindexController", "elements", "el", "node", "value", "oldValue", "radio", "changes", "checkedRadio", "checkedRadioValue", "selectedRadio", "event", "target", "validSelection", "button", "__decorateClass"]
|
|
7
|
+
}
|
package/src/index.d.ts
ADDED
package/src/index.dev.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["index.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*/\nexport * from './Radio.dev.js'\nexport * from './RadioGroup.dev.js'\n"],
|
|
5
|
+
"mappings": ";AAWA,cAAc;AACd,cAAc;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/src/index.js
ADDED
package/src/index.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["index.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*/\nexport * from './Radio.js';\nexport * from './RadioGroup.js';\n"],
|
|
5
|
+
"mappings": "aAWA,WAAc,aACd,WAAc",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { css } from "@spectrum-web-components/base";
|
|
3
|
+
const styles = css`
|
|
4
|
+
:host{--spectrum-radio-button-border-color-default:var(--system-radio-button-border-color-default);--spectrum-radio-button-border-color-hover:var(--system-radio-button-border-color-hover);--spectrum-radio-button-border-color-down:var(--system-radio-button-border-color-down);--spectrum-radio-button-border-color-focus:var(--system-radio-button-border-color-focus);--spectrum-radio-neutral-content-color:var(--system-radio-neutral-content-color);--spectrum-radio-neutral-content-color-hover:var(--system-radio-neutral-content-color-hover);--spectrum-radio-neutral-content-color-down:var(--system-radio-neutral-content-color-down);--spectrum-radio-neutral-content-color-focus:var(--system-radio-neutral-content-color-focus);--spectrum-radio-focus-indicator-thickness:var(--system-radio-focus-indicator-thickness);--spectrum-radio-focus-indicator-gap:var(--system-radio-focus-indicator-gap);--spectrum-radio-focus-indicator-color:var(--system-radio-focus-indicator-color);--spectrum-radio-disabled-content-color:var(--system-radio-disabled-content-color);--spectrum-radio-disabled-border-color:var(--system-radio-disabled-border-color);--spectrum-radio-emphasized-accent-color:var(--system-radio-emphasized-accent-color);--spectrum-radio-emphasized-accent-color-hover:var(--system-radio-emphasized-accent-color-hover);--spectrum-radio-emphasized-accent-color-down:var(--system-radio-emphasized-accent-color-down);--spectrum-radio-emphasized-accent-color-focus:var(--system-radio-emphasized-accent-color-focus);--spectrum-radio-border-width:var(--system-radio-border-width);--spectrum-radio-button-background-color:var(--system-radio-button-background-color);--spectrum-radio-button-checked-border-color-default:var(--system-radio-button-checked-border-color-default);--spectrum-radio-button-checked-border-color-hover:var(--system-radio-button-checked-border-color-hover);--spectrum-radio-button-checked-border-color-down:var(--system-radio-button-checked-border-color-down);--spectrum-radio-button-checked-border-color-focus:var(--system-radio-button-checked-border-color-focus);--spectrum-radio-line-height:var(--system-radio-line-height);--spectrum-radio-animation-duration:var(--system-radio-animation-duration);--spectrum-radio-height:var(--system-radio-height);--spectrum-radio-button-control-size:var(--system-radio-button-control-size);--spectrum-radio-text-to-control:var(--system-radio-text-to-control);--spectrum-radio-label-top-to-text:var(--system-radio-label-top-to-text);--spectrum-radio-label-bottom-to-text:var(--system-radio-label-bottom-to-text);--spectrum-radio-button-top-to-control:var(--system-radio-button-top-to-control);--spectrum-radio-font-size:var(--system-radio-font-size)}:host(:lang(ja)){--spectrum-radio-line-height-cjk:var(--system-radio-lang-ja-line-height-cjk)}:host(:lang(zh)){--spectrum-radio-line-height-cjk:var(--system-radio-lang-zh-line-height-cjk)}:host(:lang(ko)){--spectrum-radio-line-height-cjk:var(--system-radio-lang-ko-line-height-cjk)}:host{--spectrum-radio-height:var(--system-radio-size-m-height);--spectrum-radio-button-control-size:var(--system-radio-size-m-button-control-size);--spectrum-radio-text-to-control:var(--system-radio-size-m-text-to-control);--spectrum-radio-label-top-to-text:var(--system-radio-size-m-label-top-to-text);--spectrum-radio-label-bottom-to-text:var(--system-radio-size-m-label-bottom-to-text);--spectrum-radio-button-top-to-control:var(--system-radio-size-m-button-top-to-control);--spectrum-radio-font-size:var(--system-radio-size-m-font-size)}:host([size=s]){--spectrum-radio-height:var(--system-radio-size-s-height);--spectrum-radio-button-control-size:var(--system-radio-size-s-button-control-size);--spectrum-radio-text-to-control:var(--system-radio-size-s-text-to-control);--spectrum-radio-label-top-to-text:var(--system-radio-size-s-label-top-to-text);--spectrum-radio-label-bottom-to-text:var(--system-radio-size-s-label-bottom-to-text);--spectrum-radio-button-top-to-control:var(--system-radio-size-s-button-top-to-control);--spectrum-radio-font-size:var(--system-radio-size-s-font-size)}:host([size=l]){--spectrum-radio-height:var(--system-radio-size-l-height);--spectrum-radio-button-control-size:var(--system-radio-size-l-button-control-size);--spectrum-radio-text-to-control:var(--system-radio-size-l-text-to-control);--spectrum-radio-label-top-to-text:var(--system-radio-size-l-label-top-to-text);--spectrum-radio-label-bottom-to-text:var(--system-radio-size-l-label-bottom-to-text);--spectrum-radio-button-top-to-control:var(--system-radio-size-l-button-top-to-control);--spectrum-radio-font-size:var(--system-radio-size-l-font-size)}:host([size=xl]){--spectrum-radio-height:var(--system-radio-size-xl-height);--spectrum-radio-button-control-size:var(--system-radio-size-xl-button-control-size);--spectrum-radio-text-to-control:var(--system-radio-size-xl-text-to-control);--spectrum-radio-label-top-to-text:var(--system-radio-size-xl-label-top-to-text);--spectrum-radio-label-bottom-to-text:var(--system-radio-size-xl-label-bottom-to-text);--spectrum-radio-button-top-to-control:var(--system-radio-size-xl-button-top-to-control);--spectrum-radio-font-size:var(--system-radio-size-xl-font-size)}:host([emphasized]){--spectrum-radio-button-checked-border-color-default:var(--system-radio-emphasized-button-checked-border-color-default);--spectrum-radio-button-checked-border-color-hover:var(--system-radio-emphasized-button-checked-border-color-hover);--spectrum-radio-button-checked-border-color-down:var(--system-radio-emphasized-button-checked-border-color-down);--spectrum-radio-button-checked-border-color-focus:var(--system-radio-emphasized-button-checked-border-color-focus)}
|
|
5
|
+
`;
|
|
6
|
+
export default styles;
|
|
7
|
+
//# sourceMappingURL=radio-overrides.css.dev.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["radio-overrides.css.ts"],
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2025 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-radio-button-border-color-default:var(--system-radio-button-border-color-default);--spectrum-radio-button-border-color-hover:var(--system-radio-button-border-color-hover);--spectrum-radio-button-border-color-down:var(--system-radio-button-border-color-down);--spectrum-radio-button-border-color-focus:var(--system-radio-button-border-color-focus);--spectrum-radio-neutral-content-color:var(--system-radio-neutral-content-color);--spectrum-radio-neutral-content-color-hover:var(--system-radio-neutral-content-color-hover);--spectrum-radio-neutral-content-color-down:var(--system-radio-neutral-content-color-down);--spectrum-radio-neutral-content-color-focus:var(--system-radio-neutral-content-color-focus);--spectrum-radio-focus-indicator-thickness:var(--system-radio-focus-indicator-thickness);--spectrum-radio-focus-indicator-gap:var(--system-radio-focus-indicator-gap);--spectrum-radio-focus-indicator-color:var(--system-radio-focus-indicator-color);--spectrum-radio-disabled-content-color:var(--system-radio-disabled-content-color);--spectrum-radio-disabled-border-color:var(--system-radio-disabled-border-color);--spectrum-radio-emphasized-accent-color:var(--system-radio-emphasized-accent-color);--spectrum-radio-emphasized-accent-color-hover:var(--system-radio-emphasized-accent-color-hover);--spectrum-radio-emphasized-accent-color-down:var(--system-radio-emphasized-accent-color-down);--spectrum-radio-emphasized-accent-color-focus:var(--system-radio-emphasized-accent-color-focus);--spectrum-radio-border-width:var(--system-radio-border-width);--spectrum-radio-button-background-color:var(--system-radio-button-background-color);--spectrum-radio-button-checked-border-color-default:var(--system-radio-button-checked-border-color-default);--spectrum-radio-button-checked-border-color-hover:var(--system-radio-button-checked-border-color-hover);--spectrum-radio-button-checked-border-color-down:var(--system-radio-button-checked-border-color-down);--spectrum-radio-button-checked-border-color-focus:var(--system-radio-button-checked-border-color-focus);--spectrum-radio-line-height:var(--system-radio-line-height);--spectrum-radio-animation-duration:var(--system-radio-animation-duration);--spectrum-radio-height:var(--system-radio-height);--spectrum-radio-button-control-size:var(--system-radio-button-control-size);--spectrum-radio-text-to-control:var(--system-radio-text-to-control);--spectrum-radio-label-top-to-text:var(--system-radio-label-top-to-text);--spectrum-radio-label-bottom-to-text:var(--system-radio-label-bottom-to-text);--spectrum-radio-button-top-to-control:var(--system-radio-button-top-to-control);--spectrum-radio-font-size:var(--system-radio-font-size)}:host(:lang(ja)){--spectrum-radio-line-height-cjk:var(--system-radio-lang-ja-line-height-cjk)}:host(:lang(zh)){--spectrum-radio-line-height-cjk:var(--system-radio-lang-zh-line-height-cjk)}:host(:lang(ko)){--spectrum-radio-line-height-cjk:var(--system-radio-lang-ko-line-height-cjk)}:host{--spectrum-radio-height:var(--system-radio-size-m-height);--spectrum-radio-button-control-size:var(--system-radio-size-m-button-control-size);--spectrum-radio-text-to-control:var(--system-radio-size-m-text-to-control);--spectrum-radio-label-top-to-text:var(--system-radio-size-m-label-top-to-text);--spectrum-radio-label-bottom-to-text:var(--system-radio-size-m-label-bottom-to-text);--spectrum-radio-button-top-to-control:var(--system-radio-size-m-button-top-to-control);--spectrum-radio-font-size:var(--system-radio-size-m-font-size)}:host([size=s]){--spectrum-radio-height:var(--system-radio-size-s-height);--spectrum-radio-button-control-size:var(--system-radio-size-s-button-control-size);--spectrum-radio-text-to-control:var(--system-radio-size-s-text-to-control);--spectrum-radio-label-top-to-text:var(--system-radio-size-s-label-top-to-text);--spectrum-radio-label-bottom-to-text:var(--system-radio-size-s-label-bottom-to-text);--spectrum-radio-button-top-to-control:var(--system-radio-size-s-button-top-to-control);--spectrum-radio-font-size:var(--system-radio-size-s-font-size)}:host([size=l]){--spectrum-radio-height:var(--system-radio-size-l-height);--spectrum-radio-button-control-size:var(--system-radio-size-l-button-control-size);--spectrum-radio-text-to-control:var(--system-radio-size-l-text-to-control);--spectrum-radio-label-top-to-text:var(--system-radio-size-l-label-top-to-text);--spectrum-radio-label-bottom-to-text:var(--system-radio-size-l-label-bottom-to-text);--spectrum-radio-button-top-to-control:var(--system-radio-size-l-button-top-to-control);--spectrum-radio-font-size:var(--system-radio-size-l-font-size)}:host([size=xl]){--spectrum-radio-height:var(--system-radio-size-xl-height);--spectrum-radio-button-control-size:var(--system-radio-size-xl-button-control-size);--spectrum-radio-text-to-control:var(--system-radio-size-xl-text-to-control);--spectrum-radio-label-top-to-text:var(--system-radio-size-xl-label-top-to-text);--spectrum-radio-label-bottom-to-text:var(--system-radio-size-xl-label-bottom-to-text);--spectrum-radio-button-top-to-control:var(--system-radio-size-xl-button-top-to-control);--spectrum-radio-font-size:var(--system-radio-size-xl-font-size)}:host([emphasized]){--spectrum-radio-button-checked-border-color-default:var(--system-radio-emphasized-button-checked-border-color-default);--spectrum-radio-button-checked-border-color-hover:var(--system-radio-emphasized-button-checked-border-color-hover);--spectrum-radio-button-checked-border-color-down:var(--system-radio-emphasized-button-checked-border-color-down);--spectrum-radio-button-checked-border-color-focus:var(--system-radio-emphasized-button-checked-border-color-focus)}\n`;\nexport default styles;"],
|
|
5
|
+
"mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAGf,eAAe;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|