@spectrum-web-components/button 0.18.0 → 0.18.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/README.md +193 -34
- package/custom-elements.json +90 -90
- package/package.json +50 -16
- package/sp-button.dev.js +3 -0
- package/sp-button.dev.js.map +7 -0
- package/sp-button.js +3 -14
- package/sp-button.js.map +7 -1
- package/sp-clear-button.dev.js +3 -0
- package/sp-clear-button.dev.js.map +7 -0
- package/sp-clear-button.js +3 -14
- package/sp-clear-button.js.map +7 -1
- package/sp-close-button.dev.js +3 -0
- package/sp-close-button.dev.js.map +7 -0
- package/sp-close-button.js +3 -14
- package/sp-close-button.js.map +7 -1
- package/src/Button.dev.js +79 -0
- package/src/Button.dev.js.map +7 -0
- package/src/Button.js +72 -87
- package/src/Button.js.map +7 -1
- package/src/ButtonBase.dev.js +215 -0
- package/src/ButtonBase.dev.js.map +7 -0
- package/src/ButtonBase.js +198 -201
- package/src/ButtonBase.js.map +7 -1
- package/src/ClearButton.dev.js +70 -0
- package/src/ClearButton.dev.js.map +7 -0
- package/src/ClearButton.js +45 -52
- package/src/ClearButton.js.map +7 -1
- package/src/CloseButton.dev.js +65 -0
- package/src/CloseButton.dev.js.map +7 -0
- package/src/CloseButton.js +42 -49
- package/src/CloseButton.js.map +7 -1
- package/src/StyledButton.dev.js +8 -0
- package/src/StyledButton.dev.js.map +7 -0
- package/src/StyledButton.js +6 -17
- package/src/StyledButton.js.map +7 -1
- package/src/button-base.css.dev.js +10 -0
- package/src/button-base.css.dev.js.map +7 -0
- package/src/button-base.css.js +4 -15
- package/src/button-base.css.js.map +7 -1
- package/src/button.css.dev.js +619 -0
- package/src/button.css.dev.js.map +7 -0
- package/src/button.css.js +4 -15
- package/src/button.css.js.map +7 -1
- package/src/index.dev.js +6 -0
- package/src/index.dev.js.map +7 -0
- package/src/index.js +6 -17
- package/src/index.js.map +7 -1
- package/src/spectrum-button-base.css.dev.js +6 -0
- package/src/spectrum-button-base.css.dev.js.map +7 -0
- package/src/spectrum-button-base.css.js +3 -14
- package/src/spectrum-button-base.css.js.map +7 -1
- package/src/spectrum-button.css.dev.js +587 -0
- package/src/spectrum-button.css.dev.js.map +7 -0
- package/src/spectrum-button.css.js +4 -15
- package/src/spectrum-button.css.js.map +7 -1
- package/stories/button-accent-fill-sizes.stories.js +21 -18
- package/stories/button-accent-fill-sizes.stories.js.map +7 -1
- package/stories/button-accent-fill.stories.js +24 -20
- package/stories/button-accent-fill.stories.js.map +7 -1
- package/stories/button-accent-outline-sizes.stories.js +21 -18
- package/stories/button-accent-outline-sizes.stories.js.map +7 -1
- package/stories/button-accent-outline.stories.js +24 -20
- package/stories/button-accent-outline.stories.js.map +7 -1
- package/stories/button-black-fill-sizes.stories.js +22 -19
- package/stories/button-black-fill-sizes.stories.js.map +7 -1
- package/stories/button-black-fill.stories.js +26 -21
- package/stories/button-black-fill.stories.js.map +7 -1
- package/stories/button-black-outline-sizes.stories.js +22 -19
- package/stories/button-black-outline-sizes.stories.js.map +7 -1
- package/stories/button-black-outline.stories.js +26 -21
- package/stories/button-black-outline.stories.js.map +7 -1
- package/stories/button-negative-fill-sizes.stories.js +21 -18
- package/stories/button-negative-fill-sizes.stories.js.map +7 -1
- package/stories/button-negative-fill.stories.js +24 -20
- package/stories/button-negative-fill.stories.js.map +7 -1
- package/stories/button-negative-outline-sizes.stories.js +21 -18
- package/stories/button-negative-outline-sizes.stories.js.map +7 -1
- package/stories/button-negative-outline.stories.js +24 -20
- package/stories/button-negative-outline.stories.js.map +7 -1
- package/stories/button-primary-fill-sizes.stories.js +21 -18
- package/stories/button-primary-fill-sizes.stories.js.map +7 -1
- package/stories/button-primary-fill.stories.js +24 -20
- package/stories/button-primary-fill.stories.js.map +7 -1
- package/stories/button-primary-outline-sizes.stories.js +21 -18
- package/stories/button-primary-outline-sizes.stories.js.map +7 -1
- package/stories/button-primary-outline.stories.js +24 -20
- package/stories/button-primary-outline.stories.js.map +7 -1
- package/stories/button-secondary-fill-sizes.stories.js +21 -18
- package/stories/button-secondary-fill-sizes.stories.js.map +7 -1
- package/stories/button-secondary-fill.stories.js +24 -20
- package/stories/button-secondary-fill.stories.js.map +7 -1
- package/stories/button-secondary-outline-sizes.stories.js +21 -18
- package/stories/button-secondary-outline-sizes.stories.js.map +7 -1
- package/stories/button-secondary-outline.stories.js +24 -20
- package/stories/button-secondary-outline.stories.js.map +7 -1
- package/stories/button-white-fill-sizes.stories.js +22 -19
- package/stories/button-white-fill-sizes.stories.js.map +7 -1
- package/stories/button-white-fill.stories.js +26 -21
- package/stories/button-white-fill.stories.js.map +7 -1
- package/stories/button-white-outline-sizes.stories.js +22 -19
- package/stories/button-white-outline-sizes.stories.js.map +7 -1
- package/stories/button-white-outline.stories.js +26 -21
- package/stories/button-white-outline.stories.js.map +7 -1
- package/stories/index.js +92 -93
- package/stories/index.js.map +7 -1
- package/test/benchmark/test-basic.js +5 -16
- package/test/benchmark/test-basic.js.map +7 -1
- package/test/button-accent-fill-sizes.test-vrt.js +4 -15
- package/test/button-accent-fill-sizes.test-vrt.js.map +7 -1
- package/test/button-accent-fill.test-vrt.js +4 -15
- package/test/button-accent-fill.test-vrt.js.map +7 -1
- package/test/button-accent-outline-sizes.test-vrt.js +4 -15
- package/test/button-accent-outline-sizes.test-vrt.js.map +7 -1
- package/test/button-accent-outline.test-vrt.js +4 -15
- package/test/button-accent-outline.test-vrt.js.map +7 -1
- package/test/button-black-fill-sizes.test-vrt.js +4 -15
- package/test/button-black-fill-sizes.test-vrt.js.map +7 -1
- package/test/button-black-fill.test-vrt.js +4 -15
- package/test/button-black-fill.test-vrt.js.map +7 -1
- package/test/button-black-outline-sizes.test-vrt.js +4 -15
- package/test/button-black-outline-sizes.test-vrt.js.map +7 -1
- package/test/button-black-outline.test-vrt.js +4 -15
- package/test/button-black-outline.test-vrt.js.map +7 -1
- package/test/button-negative-fill-sizes.test-vrt.js +4 -15
- package/test/button-negative-fill-sizes.test-vrt.js.map +7 -1
- package/test/button-negative-fill.test-vrt.js +4 -15
- package/test/button-negative-fill.test-vrt.js.map +7 -1
- package/test/button-negative-outline-sizes.test-vrt.js +4 -15
- package/test/button-negative-outline-sizes.test-vrt.js.map +7 -1
- package/test/button-negative-outline.test-vrt.js +4 -15
- package/test/button-negative-outline.test-vrt.js.map +7 -1
- package/test/button-primary-fill-sizes.test-vrt.js +4 -15
- package/test/button-primary-fill-sizes.test-vrt.js.map +7 -1
- package/test/button-primary-fill.test-vrt.js +4 -15
- package/test/button-primary-fill.test-vrt.js.map +7 -1
- package/test/button-primary-outline-sizes.test-vrt.js +4 -15
- package/test/button-primary-outline-sizes.test-vrt.js.map +7 -1
- package/test/button-primary-outline.test-vrt.js +4 -15
- package/test/button-primary-outline.test-vrt.js.map +7 -1
- package/test/button-secondary-fill-sizes.test-vrt.js +4 -15
- package/test/button-secondary-fill-sizes.test-vrt.js.map +7 -1
- package/test/button-secondary-fill.test-vrt.js +4 -15
- package/test/button-secondary-fill.test-vrt.js.map +7 -1
- package/test/button-secondary-outline-sizes.test-vrt.js +4 -15
- package/test/button-secondary-outline-sizes.test-vrt.js.map +7 -1
- package/test/button-secondary-outline.test-vrt.js +4 -15
- package/test/button-secondary-outline.test-vrt.js.map +7 -1
- package/test/button-white-fill-sizes.test-vrt.js +4 -15
- package/test/button-white-fill-sizes.test-vrt.js.map +7 -1
- package/test/button-white-fill.test-vrt.js +4 -15
- package/test/button-white-fill.test-vrt.js.map +7 -1
- package/test/button-white-outline-sizes.test-vrt.js +4 -15
- package/test/button-white-outline-sizes.test-vrt.js.map +7 -1
- package/test/button-white-outline.test-vrt.js +4 -15
- package/test/button-white-outline.test-vrt.js.map +7 -1
- package/test/button.test.js +321 -320
- package/test/button.test.js.map +7 -1
- package/test/clear-button.test.js +13 -20
- package/test/clear-button.test.js.map +7 -1
- package/test/close-button.test.js +13 -20
- package/test/close-button.test.js.map +7 -1
|
@@ -0,0 +1,215 @@
|
|
|
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
|
+
} from "@spectrum-web-components/base";
|
|
15
|
+
import {
|
|
16
|
+
property,
|
|
17
|
+
query
|
|
18
|
+
} from "@spectrum-web-components/base/src/decorators.js";
|
|
19
|
+
import { LikeAnchor } from "@spectrum-web-components/shared/src/like-anchor.js";
|
|
20
|
+
import { Focusable } from "@spectrum-web-components/shared/src/focusable.js";
|
|
21
|
+
import {
|
|
22
|
+
ObserveSlotPresence,
|
|
23
|
+
ObserveSlotText
|
|
24
|
+
} from "@spectrum-web-components/shared";
|
|
25
|
+
export class ButtonBase extends LikeAnchor(ObserveSlotText(ObserveSlotPresence(Focusable, '[slot="icon"]'))) {
|
|
26
|
+
constructor() {
|
|
27
|
+
super();
|
|
28
|
+
this.active = false;
|
|
29
|
+
this.type = "button";
|
|
30
|
+
this.proxyFocus = this.proxyFocus.bind(this);
|
|
31
|
+
this.addEventListener("click", this.handleClickCapture, {
|
|
32
|
+
capture: true
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
get hasIcon() {
|
|
36
|
+
return this.slotContentIsPresent;
|
|
37
|
+
}
|
|
38
|
+
get hasLabel() {
|
|
39
|
+
return this.slotHasContent;
|
|
40
|
+
}
|
|
41
|
+
get focusElement() {
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
get buttonContent() {
|
|
45
|
+
const content = [
|
|
46
|
+
html`
|
|
47
|
+
<div id="label" ?hidden=${!this.hasLabel}>
|
|
48
|
+
<slot
|
|
49
|
+
id="slot"
|
|
50
|
+
@slotchange=${this.manageTextObservedSlot}
|
|
51
|
+
></slot>
|
|
52
|
+
</div>
|
|
53
|
+
`
|
|
54
|
+
];
|
|
55
|
+
if (this.hasIcon) {
|
|
56
|
+
content.unshift(html`
|
|
57
|
+
<slot name="icon" ?icon-only=${!this.hasLabel}></slot>
|
|
58
|
+
`);
|
|
59
|
+
}
|
|
60
|
+
return content;
|
|
61
|
+
}
|
|
62
|
+
click() {
|
|
63
|
+
if (this.disabled) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (this.shouldProxyClick()) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
super.click();
|
|
70
|
+
}
|
|
71
|
+
handleClickCapture(event) {
|
|
72
|
+
if (this.disabled) {
|
|
73
|
+
event.preventDefault();
|
|
74
|
+
event.stopImmediatePropagation();
|
|
75
|
+
event.stopPropagation();
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
proxyFocus() {
|
|
80
|
+
this.focus();
|
|
81
|
+
}
|
|
82
|
+
shouldProxyClick() {
|
|
83
|
+
let handled = false;
|
|
84
|
+
if (this.anchorElement) {
|
|
85
|
+
this.anchorElement.click();
|
|
86
|
+
handled = true;
|
|
87
|
+
} else if (this.type !== "button") {
|
|
88
|
+
const proxy = document.createElement("button");
|
|
89
|
+
proxy.type = this.type;
|
|
90
|
+
this.insertAdjacentElement("afterend", proxy);
|
|
91
|
+
proxy.click();
|
|
92
|
+
proxy.remove();
|
|
93
|
+
handled = true;
|
|
94
|
+
}
|
|
95
|
+
return handled;
|
|
96
|
+
}
|
|
97
|
+
renderAnchor() {
|
|
98
|
+
return html`
|
|
99
|
+
${this.buttonContent}
|
|
100
|
+
${super.renderAnchor({
|
|
101
|
+
id: "button",
|
|
102
|
+
ariaHidden: true,
|
|
103
|
+
className: "button anchor hidden"
|
|
104
|
+
})}
|
|
105
|
+
`;
|
|
106
|
+
}
|
|
107
|
+
renderButton() {
|
|
108
|
+
return html`
|
|
109
|
+
${this.buttonContent}
|
|
110
|
+
`;
|
|
111
|
+
}
|
|
112
|
+
render() {
|
|
113
|
+
return this.href && this.href.length > 0 ? this.renderAnchor() : this.renderButton();
|
|
114
|
+
}
|
|
115
|
+
handleKeydown(event) {
|
|
116
|
+
const { code } = event;
|
|
117
|
+
switch (code) {
|
|
118
|
+
case "Space":
|
|
119
|
+
event.preventDefault();
|
|
120
|
+
if (typeof this.href === "undefined") {
|
|
121
|
+
this.addEventListener("keyup", this.handleKeyup);
|
|
122
|
+
this.active = true;
|
|
123
|
+
}
|
|
124
|
+
break;
|
|
125
|
+
default:
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
handleKeypress(event) {
|
|
130
|
+
const { code } = event;
|
|
131
|
+
switch (code) {
|
|
132
|
+
case "Enter":
|
|
133
|
+
case "NumpadEnter":
|
|
134
|
+
this.click();
|
|
135
|
+
break;
|
|
136
|
+
default:
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
handleKeyup(event) {
|
|
141
|
+
const { code } = event;
|
|
142
|
+
switch (code) {
|
|
143
|
+
case "Space":
|
|
144
|
+
this.removeEventListener("keyup", this.handleKeyup);
|
|
145
|
+
this.active = false;
|
|
146
|
+
this.click();
|
|
147
|
+
break;
|
|
148
|
+
default:
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
handleRemoveActive() {
|
|
153
|
+
this.active = false;
|
|
154
|
+
}
|
|
155
|
+
handlePointerdown() {
|
|
156
|
+
this.active = true;
|
|
157
|
+
}
|
|
158
|
+
manageAnchor() {
|
|
159
|
+
if (this.href && this.href.length > 0) {
|
|
160
|
+
if (this.getAttribute("role") === "button") {
|
|
161
|
+
this.setAttribute("role", "link");
|
|
162
|
+
}
|
|
163
|
+
this.removeEventListener("click", this.shouldProxyClick);
|
|
164
|
+
} else {
|
|
165
|
+
if (!this.hasAttribute("role") || this.getAttribute("role") === "link") {
|
|
166
|
+
this.setAttribute("role", "button");
|
|
167
|
+
}
|
|
168
|
+
this.addEventListener("click", this.shouldProxyClick);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
firstUpdated(changed) {
|
|
172
|
+
super.firstUpdated(changed);
|
|
173
|
+
if (!this.hasAttribute("tabindex")) {
|
|
174
|
+
this.tabIndex = 0;
|
|
175
|
+
}
|
|
176
|
+
this.manageAnchor();
|
|
177
|
+
this.addEventListener("keydown", this.handleKeydown);
|
|
178
|
+
this.addEventListener("keypress", this.handleKeypress);
|
|
179
|
+
this.addEventListener("pointerdown", this.handlePointerdown);
|
|
180
|
+
}
|
|
181
|
+
updated(changed) {
|
|
182
|
+
super.updated(changed);
|
|
183
|
+
if (changed.has("href")) {
|
|
184
|
+
this.manageAnchor();
|
|
185
|
+
}
|
|
186
|
+
if (changed.has("label")) {
|
|
187
|
+
this.setAttribute("aria-label", this.label || "");
|
|
188
|
+
}
|
|
189
|
+
if (changed.has("active")) {
|
|
190
|
+
if (this.active) {
|
|
191
|
+
this.addEventListener("focusout", this.handleRemoveActive);
|
|
192
|
+
this.addEventListener("pointerup", this.handleRemoveActive);
|
|
193
|
+
this.addEventListener("pointerleave", this.handleRemoveActive);
|
|
194
|
+
} else {
|
|
195
|
+
this.removeEventListener("focusout", this.handleRemoveActive);
|
|
196
|
+
this.removeEventListener("pointerup", this.handleRemoveActive);
|
|
197
|
+
this.removeEventListener("pointerleave", this.handleRemoveActive);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
if (this.anchorElement) {
|
|
201
|
+
this.anchorElement.addEventListener("focus", this.proxyFocus);
|
|
202
|
+
this.anchorElement.tabIndex = -1;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
__decorateClass([
|
|
207
|
+
property({ type: Boolean, reflect: true })
|
|
208
|
+
], ButtonBase.prototype, "active", 2);
|
|
209
|
+
__decorateClass([
|
|
210
|
+
property({ type: String })
|
|
211
|
+
], ButtonBase.prototype, "type", 2);
|
|
212
|
+
__decorateClass([
|
|
213
|
+
query(".anchor")
|
|
214
|
+
], ButtonBase.prototype, "anchorElement", 2);
|
|
215
|
+
//# sourceMappingURL=ButtonBase.dev.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["ButtonBase.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 html,\n PropertyValues,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n property,\n query,\n} from '@spectrum-web-components/base/src/decorators.js';\nimport { LikeAnchor } from '@spectrum-web-components/shared/src/like-anchor.js';\nimport { Focusable } from '@spectrum-web-components/shared/src/focusable.js';\nimport {\n ObserveSlotPresence,\n ObserveSlotText,\n} from '@spectrum-web-components/shared';\n\n/**\n * @slot - text content to be displayed in the Button element\n * @slot icon - icon element(s) to display at the start of the button\n */\nexport class ButtonBase extends LikeAnchor(\n ObserveSlotText(ObserveSlotPresence(Focusable, '[slot=\"icon\"]'))\n) {\n protected get hasIcon(): boolean {\n return this.slotContentIsPresent;\n }\n\n @property({ type: Boolean, reflect: true })\n public active = false;\n\n @property({ type: String })\n public type: 'button' | 'submit' | 'reset' = 'button';\n\n protected get hasLabel(): boolean {\n return this.slotHasContent;\n }\n\n @query('.anchor')\n private anchorElement!: HTMLButtonElement;\n\n public override get focusElement(): HTMLElement {\n return this;\n }\n\n protected get buttonContent(): TemplateResult[] {\n const content = [\n html`\n <div id=\"label\" ?hidden=${!this.hasLabel}>\n <slot\n id=\"slot\"\n @slotchange=${this.manageTextObservedSlot}\n ></slot>\n </div>\n `,\n ];\n if (this.hasIcon) {\n content.unshift(html`\n <slot name=\"icon\" ?icon-only=${!this.hasLabel}></slot>\n `);\n }\n return content;\n }\n\n constructor() {\n super();\n this.proxyFocus = this.proxyFocus.bind(this);\n\n this.addEventListener('click', this.handleClickCapture, {\n capture: true,\n });\n }\n\n public override click(): void {\n if (this.disabled) {\n return;\n }\n\n if (this.shouldProxyClick()) {\n return;\n }\n\n super.click();\n }\n\n private handleClickCapture(event: Event): void | boolean {\n if (this.disabled) {\n event.preventDefault();\n event.stopImmediatePropagation();\n event.stopPropagation();\n return false;\n }\n }\n\n private proxyFocus(): void {\n this.focus();\n }\n\n private shouldProxyClick(): boolean {\n let handled = false;\n if (this.anchorElement) {\n this.anchorElement.click();\n handled = true;\n } else if (this.type !== 'button') {\n const proxy = document.createElement('button');\n proxy.type = this.type;\n this.insertAdjacentElement('afterend', proxy);\n proxy.click();\n proxy.remove();\n handled = true;\n }\n return handled;\n }\n\n public override renderAnchor(): TemplateResult {\n return html`\n ${this.buttonContent}\n ${super.renderAnchor({\n id: 'button',\n ariaHidden: true,\n className: 'button anchor hidden',\n })}\n `;\n }\n\n protected renderButton(): TemplateResult {\n return html`\n ${this.buttonContent}\n `;\n }\n\n protected override render(): TemplateResult {\n return this.href && this.href.length > 0\n ? this.renderAnchor()\n : this.renderButton();\n }\n\n protected handleKeydown(event: KeyboardEvent): void {\n const { code } = event;\n switch (code) {\n case 'Space':\n event.preventDefault();\n if (typeof this.href === 'undefined') {\n this.addEventListener('keyup', this.handleKeyup);\n this.active = true;\n }\n break;\n default:\n break;\n }\n }\n\n private handleKeypress(event: KeyboardEvent): void {\n const { code } = event;\n switch (code) {\n case 'Enter':\n case 'NumpadEnter':\n this.click();\n break;\n default:\n break;\n }\n }\n\n protected handleKeyup(event: KeyboardEvent): void {\n const { code } = event;\n switch (code) {\n case 'Space':\n this.removeEventListener('keyup', this.handleKeyup);\n this.active = false;\n this.click();\n break;\n default:\n break;\n }\n }\n\n private handleRemoveActive(): void {\n this.active = false;\n }\n\n private handlePointerdown(): void {\n this.active = true;\n }\n\n private manageAnchor(): void {\n if (this.href && this.href.length > 0) {\n if (this.getAttribute('role') === 'button') {\n this.setAttribute('role', 'link');\n }\n this.removeEventListener('click', this.shouldProxyClick);\n } else {\n if (\n !this.hasAttribute('role') ||\n this.getAttribute('role') === 'link'\n ) {\n this.setAttribute('role', 'button');\n }\n this.addEventListener('click', this.shouldProxyClick);\n }\n }\n\n protected override firstUpdated(changed: PropertyValues): void {\n super.firstUpdated(changed);\n if (!this.hasAttribute('tabindex')) {\n this.tabIndex = 0;\n }\n this.manageAnchor();\n this.addEventListener('keydown', this.handleKeydown);\n this.addEventListener('keypress', this.handleKeypress);\n this.addEventListener('pointerdown', this.handlePointerdown);\n }\n\n protected override updated(changed: PropertyValues): void {\n super.updated(changed);\n if (changed.has('href')) {\n this.manageAnchor();\n }\n if (changed.has('label')) {\n this.setAttribute('aria-label', this.label || '');\n }\n if (changed.has('active')) {\n if (this.active) {\n this.addEventListener('focusout', this.handleRemoveActive);\n this.addEventListener('pointerup', this.handleRemoveActive);\n this.addEventListener('pointerleave', this.handleRemoveActive);\n } else {\n this.removeEventListener('focusout', this.handleRemoveActive);\n this.removeEventListener('pointerup', this.handleRemoveActive);\n this.removeEventListener(\n 'pointerleave',\n this.handleRemoveActive\n );\n }\n }\n if (this.anchorElement) {\n this.anchorElement.addEventListener('focus', this.proxyFocus);\n this.anchorElement.tabIndex = -1;\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;AAYA;AAAA;AAAA;AAKA;AAAA;AAAA;AAAA;AAIA;AACA;AACA;AAAA;AAAA;AAAA;AASO,aAAM,mBAAmB,WAC5B,gBAAgB,oBAAoB,WAAW,eAAe,CAAC,CACnE,EAAE;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AAAC,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GACnB,AAXJ,WAWI;AAOC;AAAA,EADR,AAAC,MAAM,SAAS;AAAA,GACR,AAlBL,WAkBK;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/src/ButtonBase.js
CHANGED
|
@@ -1,218 +1,215 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
+
} from "@spectrum-web-components/base";
|
|
15
|
+
import {
|
|
16
|
+
property,
|
|
17
|
+
query
|
|
18
|
+
} from "@spectrum-web-components/base/src/decorators.js";
|
|
19
|
+
import { LikeAnchor } from "@spectrum-web-components/shared/src/like-anchor.js";
|
|
20
|
+
import { Focusable } from "@spectrum-web-components/shared/src/focusable.js";
|
|
21
|
+
import {
|
|
22
|
+
ObserveSlotPresence,
|
|
23
|
+
ObserveSlotText
|
|
24
|
+
} from "@spectrum-web-components/shared";
|
|
22
25
|
export class ButtonBase extends LikeAnchor(ObserveSlotText(ObserveSlotPresence(Focusable, '[slot="icon"]'))) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
26
|
+
constructor() {
|
|
27
|
+
super();
|
|
28
|
+
this.active = false;
|
|
29
|
+
this.type = "button";
|
|
30
|
+
this.proxyFocus = this.proxyFocus.bind(this);
|
|
31
|
+
this.addEventListener("click", this.handleClickCapture, {
|
|
32
|
+
capture: true
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
get hasIcon() {
|
|
36
|
+
return this.slotContentIsPresent;
|
|
37
|
+
}
|
|
38
|
+
get hasLabel() {
|
|
39
|
+
return this.slotHasContent;
|
|
40
|
+
}
|
|
41
|
+
get focusElement() {
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
get buttonContent() {
|
|
45
|
+
const content = [
|
|
46
|
+
html`
|
|
44
47
|
<div id="label" ?hidden=${!this.hasLabel}>
|
|
45
48
|
<slot
|
|
46
49
|
id="slot"
|
|
47
50
|
@slotchange=${this.manageTextObservedSlot}
|
|
48
51
|
></slot>
|
|
49
52
|
</div>
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
`
|
|
54
|
+
];
|
|
55
|
+
if (this.hasIcon) {
|
|
56
|
+
content.unshift(html`
|
|
54
57
|
<slot name="icon" ?icon-only=${!this.hasLabel}></slot>
|
|
55
58
|
`);
|
|
56
|
-
}
|
|
57
|
-
return content;
|
|
58
|
-
}
|
|
59
|
-
click() {
|
|
60
|
-
if (this.disabled) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
if (this.shouldProxyClick()) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
super.click();
|
|
67
59
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
60
|
+
return content;
|
|
61
|
+
}
|
|
62
|
+
click() {
|
|
63
|
+
if (this.disabled) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (this.shouldProxyClick()) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
super.click();
|
|
70
|
+
}
|
|
71
|
+
handleClickCapture(event) {
|
|
72
|
+
if (this.disabled) {
|
|
73
|
+
event.preventDefault();
|
|
74
|
+
event.stopImmediatePropagation();
|
|
75
|
+
event.stopPropagation();
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
proxyFocus() {
|
|
80
|
+
this.focus();
|
|
81
|
+
}
|
|
82
|
+
shouldProxyClick() {
|
|
83
|
+
let handled = false;
|
|
84
|
+
if (this.anchorElement) {
|
|
85
|
+
this.anchorElement.click();
|
|
86
|
+
handled = true;
|
|
87
|
+
} else if (this.type !== "button") {
|
|
88
|
+
const proxy = document.createElement("button");
|
|
89
|
+
proxy.type = this.type;
|
|
90
|
+
this.insertAdjacentElement("afterend", proxy);
|
|
91
|
+
proxy.click();
|
|
92
|
+
proxy.remove();
|
|
93
|
+
handled = true;
|
|
94
|
+
}
|
|
95
|
+
return handled;
|
|
96
|
+
}
|
|
97
|
+
renderAnchor() {
|
|
98
|
+
return html`
|
|
97
99
|
${this.buttonContent}
|
|
98
100
|
${super.renderAnchor({
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
id: "button",
|
|
102
|
+
ariaHidden: true,
|
|
103
|
+
className: "button anchor hidden"
|
|
104
|
+
})}
|
|
103
105
|
`;
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
}
|
|
107
|
+
renderButton() {
|
|
108
|
+
return html`
|
|
107
109
|
${this.buttonContent}
|
|
108
110
|
`;
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
case 'Space':
|
|
144
|
-
this.removeEventListener('keyup', this.handleKeyup);
|
|
145
|
-
this.active = false;
|
|
146
|
-
this.click();
|
|
147
|
-
break;
|
|
148
|
-
default:
|
|
149
|
-
break;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
handleRemoveActive() {
|
|
111
|
+
}
|
|
112
|
+
render() {
|
|
113
|
+
return this.href && this.href.length > 0 ? this.renderAnchor() : this.renderButton();
|
|
114
|
+
}
|
|
115
|
+
handleKeydown(event) {
|
|
116
|
+
const { code } = event;
|
|
117
|
+
switch (code) {
|
|
118
|
+
case "Space":
|
|
119
|
+
event.preventDefault();
|
|
120
|
+
if (typeof this.href === "undefined") {
|
|
121
|
+
this.addEventListener("keyup", this.handleKeyup);
|
|
122
|
+
this.active = true;
|
|
123
|
+
}
|
|
124
|
+
break;
|
|
125
|
+
default:
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
handleKeypress(event) {
|
|
130
|
+
const { code } = event;
|
|
131
|
+
switch (code) {
|
|
132
|
+
case "Enter":
|
|
133
|
+
case "NumpadEnter":
|
|
134
|
+
this.click();
|
|
135
|
+
break;
|
|
136
|
+
default:
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
handleKeyup(event) {
|
|
141
|
+
const { code } = event;
|
|
142
|
+
switch (code) {
|
|
143
|
+
case "Space":
|
|
144
|
+
this.removeEventListener("keyup", this.handleKeyup);
|
|
153
145
|
this.active = false;
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
}
|
|
146
|
+
this.click();
|
|
147
|
+
break;
|
|
148
|
+
default:
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
handleRemoveActive() {
|
|
153
|
+
this.active = false;
|
|
154
|
+
}
|
|
155
|
+
handlePointerdown() {
|
|
156
|
+
this.active = true;
|
|
157
|
+
}
|
|
158
|
+
manageAnchor() {
|
|
159
|
+
if (this.href && this.href.length > 0) {
|
|
160
|
+
if (this.getAttribute("role") === "button") {
|
|
161
|
+
this.setAttribute("role", "link");
|
|
162
|
+
}
|
|
163
|
+
this.removeEventListener("click", this.shouldProxyClick);
|
|
164
|
+
} else {
|
|
165
|
+
if (!this.hasAttribute("role") || this.getAttribute("role") === "link") {
|
|
166
|
+
this.setAttribute("role", "button");
|
|
167
|
+
}
|
|
168
|
+
this.addEventListener("click", this.shouldProxyClick);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
firstUpdated(changed) {
|
|
172
|
+
super.firstUpdated(changed);
|
|
173
|
+
if (!this.hasAttribute("tabindex")) {
|
|
174
|
+
this.tabIndex = 0;
|
|
175
|
+
}
|
|
176
|
+
this.manageAnchor();
|
|
177
|
+
this.addEventListener("keydown", this.handleKeydown);
|
|
178
|
+
this.addEventListener("keypress", this.handleKeypress);
|
|
179
|
+
this.addEventListener("pointerdown", this.handlePointerdown);
|
|
180
|
+
}
|
|
181
|
+
updated(changed) {
|
|
182
|
+
super.updated(changed);
|
|
183
|
+
if (changed.has("href")) {
|
|
184
|
+
this.manageAnchor();
|
|
185
|
+
}
|
|
186
|
+
if (changed.has("label")) {
|
|
187
|
+
this.setAttribute("aria-label", this.label || "");
|
|
188
|
+
}
|
|
189
|
+
if (changed.has("active")) {
|
|
190
|
+
if (this.active) {
|
|
191
|
+
this.addEventListener("focusout", this.handleRemoveActive);
|
|
192
|
+
this.addEventListener("pointerup", this.handleRemoveActive);
|
|
193
|
+
this.addEventListener("pointerleave", this.handleRemoveActive);
|
|
194
|
+
} else {
|
|
195
|
+
this.removeEventListener("focusout", this.handleRemoveActive);
|
|
196
|
+
this.removeEventListener("pointerup", this.handleRemoveActive);
|
|
197
|
+
this.removeEventListener("pointerleave", this.handleRemoveActive);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
if (this.anchorElement) {
|
|
201
|
+
this.anchorElement.addEventListener("focus", this.proxyFocus);
|
|
202
|
+
this.anchorElement.tabIndex = -1;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
208
205
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
], ButtonBase.prototype, "active",
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
], ButtonBase.prototype, "type",
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
], ButtonBase.prototype, "anchorElement",
|
|
218
|
-
//# sourceMappingURL=ButtonBase.js.map
|
|
206
|
+
__decorateClass([
|
|
207
|
+
property({ type: Boolean, reflect: true })
|
|
208
|
+
], ButtonBase.prototype, "active", 2);
|
|
209
|
+
__decorateClass([
|
|
210
|
+
property({ type: String })
|
|
211
|
+
], ButtonBase.prototype, "type", 2);
|
|
212
|
+
__decorateClass([
|
|
213
|
+
query(".anchor")
|
|
214
|
+
], ButtonBase.prototype, "anchorElement", 2);
|
|
215
|
+
//# sourceMappingURL=ButtonBase.js.map
|