@spectrum-web-components/button 0.16.5-express.9 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/README.md +3 -2
  2. package/custom-elements.json +1 -44
  3. package/package.json +9 -9
  4. package/sp-button.d.ts +0 -6
  5. package/sp-button.js +0 -14
  6. package/sp-button.js.map +0 -1
  7. package/sp-clear-button.d.ts +0 -6
  8. package/sp-clear-button.js +0 -14
  9. package/sp-clear-button.js.map +0 -1
  10. package/sp-close-button.d.ts +0 -6
  11. package/sp-close-button.js +0 -14
  12. package/sp-close-button.js.map +0 -1
  13. package/src/Button.d.ts +0 -36
  14. package/src/Button.js +0 -94
  15. package/src/Button.js.map +0 -1
  16. package/src/ButtonBase.d.ts +0 -42
  17. package/src/ButtonBase.js +0 -218
  18. package/src/ButtonBase.js.map +0 -1
  19. package/src/ClearButton.d.ts +0 -23
  20. package/src/ClearButton.js +0 -74
  21. package/src/ClearButton.js.map +0 -1
  22. package/src/CloseButton.d.ts +0 -26
  23. package/src/CloseButton.js +0 -72
  24. package/src/CloseButton.js.map +0 -1
  25. package/src/StyledButton.d.ts +0 -5
  26. package/src/StyledButton.js +0 -19
  27. package/src/StyledButton.js.map +0 -1
  28. package/src/button-base.css.d.ts +0 -2
  29. package/src/button-base.css.js +0 -21
  30. package/src/button-base.css.js.map +0 -1
  31. package/src/button.css.d.ts +0 -2
  32. package/src/button.css.js +0 -630
  33. package/src/button.css.js.map +0 -1
  34. package/src/clear-button.css.d.ts +0 -2
  35. package/src/clear-button.css.js +0 -229
  36. package/src/clear-button.css.js.map +0 -1
  37. package/src/index.d.ts +0 -5
  38. package/src/index.js +0 -17
  39. package/src/index.js.map +0 -1
  40. package/src/spectrum-button-base.css.d.ts +0 -2
  41. package/src/spectrum-button-base.css.js +0 -17
  42. package/src/spectrum-button-base.css.js.map +0 -1
  43. package/src/spectrum-button.css.d.ts +0 -2
  44. package/src/spectrum-button.css.js +0 -598
  45. package/src/spectrum-button.css.js.map +0 -1
  46. package/src/spectrum-clear-button.css.d.ts +0 -2
  47. package/src/spectrum-clear-button.css.js +0 -229
  48. package/src/spectrum-clear-button.css.js.map +0 -1
  49. package/stories/button-accent-fill-sizes.stories.js +0 -28
  50. package/stories/button-accent-fill-sizes.stories.js.map +0 -1
  51. package/stories/button-accent-fill.stories.js +0 -28
  52. package/stories/button-accent-fill.stories.js.map +0 -1
  53. package/stories/button-accent-outline-sizes.stories.js +0 -28
  54. package/stories/button-accent-outline-sizes.stories.js.map +0 -1
  55. package/stories/button-accent-outline.stories.js +0 -28
  56. package/stories/button-accent-outline.stories.js.map +0 -1
  57. package/stories/button-black-fill-sizes.stories.js +0 -29
  58. package/stories/button-black-fill-sizes.stories.js.map +0 -1
  59. package/stories/button-black-fill.stories.js +0 -29
  60. package/stories/button-black-fill.stories.js.map +0 -1
  61. package/stories/button-black-outline-sizes.stories.js +0 -29
  62. package/stories/button-black-outline-sizes.stories.js.map +0 -1
  63. package/stories/button-black-outline.stories.js +0 -29
  64. package/stories/button-black-outline.stories.js.map +0 -1
  65. package/stories/button-cta-sizes.stories.js +0 -11
  66. package/stories/button-cta-sizes.stories.js.map +0 -1
  67. package/stories/button-cta.stories.js +0 -115
  68. package/stories/button-cta.stories.js.map +0 -1
  69. package/stories/button-negative-fill-sizes.stories.js +0 -28
  70. package/stories/button-negative-fill-sizes.stories.js.map +0 -1
  71. package/stories/button-negative-fill.stories.js +0 -28
  72. package/stories/button-negative-fill.stories.js.map +0 -1
  73. package/stories/button-negative-outline-sizes.stories.js +0 -28
  74. package/stories/button-negative-outline-sizes.stories.js.map +0 -1
  75. package/stories/button-negative-outline.stories.js +0 -28
  76. package/stories/button-negative-outline.stories.js.map +0 -1
  77. package/stories/button-overBackground-sizes.stories.js +0 -12
  78. package/stories/button-overBackground-sizes.stories.js.map +0 -1
  79. package/stories/button-overBackground.stories.js +0 -132
  80. package/stories/button-overBackground.stories.js.map +0 -1
  81. package/stories/button-primary-fill-sizes.stories.js +0 -28
  82. package/stories/button-primary-fill-sizes.stories.js.map +0 -1
  83. package/stories/button-primary-fill.stories.js +0 -28
  84. package/stories/button-primary-fill.stories.js.map +0 -1
  85. package/stories/button-primary-outline-sizes.stories.js +0 -28
  86. package/stories/button-primary-outline-sizes.stories.js.map +0 -1
  87. package/stories/button-primary-outline.stories.js +0 -28
  88. package/stories/button-primary-outline.stories.js.map +0 -1
  89. package/stories/button-primary-sizes.stories.js +0 -11
  90. package/stories/button-primary-sizes.stories.js.map +0 -1
  91. package/stories/button-primary.stories.js +0 -129
  92. package/stories/button-primary.stories.js.map +0 -1
  93. package/stories/button-secondary-fill-sizes.stories.js +0 -28
  94. package/stories/button-secondary-fill-sizes.stories.js.map +0 -1
  95. package/stories/button-secondary-fill.stories.js +0 -28
  96. package/stories/button-secondary-fill.stories.js.map +0 -1
  97. package/stories/button-secondary-outline-sizes.stories.js +0 -28
  98. package/stories/button-secondary-outline-sizes.stories.js.map +0 -1
  99. package/stories/button-secondary-outline.stories.js +0 -28
  100. package/stories/button-secondary-outline.stories.js.map +0 -1
  101. package/stories/button-secondary-sizes.stories.js +0 -11
  102. package/stories/button-secondary-sizes.stories.js.map +0 -1
  103. package/stories/button-secondary.stories.js +0 -129
  104. package/stories/button-secondary.stories.js.map +0 -1
  105. package/stories/button-warning-sizes.stories.js +0 -11
  106. package/stories/button-warning-sizes.stories.js.map +0 -1
  107. package/stories/button-warning.stories.js +0 -129
  108. package/stories/button-warning.stories.js.map +0 -1
  109. package/stories/button-white-fill-sizes.stories.js +0 -29
  110. package/stories/button-white-fill-sizes.stories.js.map +0 -1
  111. package/stories/button-white-fill.stories.js +0 -29
  112. package/stories/button-white-fill.stories.js.map +0 -1
  113. package/stories/button-white-outline-sizes.stories.js +0 -29
  114. package/stories/button-white-outline-sizes.stories.js.map +0 -1
  115. package/stories/button-white-outline.stories.js +0 -29
  116. package/stories/button-white-outline.stories.js.map +0 -1
  117. package/stories/index.js +0 -177
  118. package/stories/index.js.map +0 -1
  119. package/test/button-accent-fill-sizes.test-vrt.js +0 -15
  120. package/test/button-accent-fill-sizes.test-vrt.js.map +0 -1
  121. package/test/button-accent-fill.test-vrt.js +0 -15
  122. package/test/button-accent-fill.test-vrt.js.map +0 -1
  123. package/test/button-accent-outline-sizes.test-vrt.js +0 -15
  124. package/test/button-accent-outline-sizes.test-vrt.js.map +0 -1
  125. package/test/button-accent-outline.test-vrt.js +0 -15
  126. package/test/button-accent-outline.test-vrt.js.map +0 -1
  127. package/test/button-black-fill-sizes.test-vrt.js +0 -15
  128. package/test/button-black-fill-sizes.test-vrt.js.map +0 -1
  129. package/test/button-black-fill.test-vrt.js +0 -15
  130. package/test/button-black-fill.test-vrt.js.map +0 -1
  131. package/test/button-black-outline-sizes.test-vrt.js +0 -15
  132. package/test/button-black-outline-sizes.test-vrt.js.map +0 -1
  133. package/test/button-black-outline.test-vrt.js +0 -15
  134. package/test/button-black-outline.test-vrt.js.map +0 -1
  135. package/test/button-negative-fill-sizes.test-vrt.js +0 -15
  136. package/test/button-negative-fill-sizes.test-vrt.js.map +0 -1
  137. package/test/button-negative-fill.test-vrt.js +0 -15
  138. package/test/button-negative-fill.test-vrt.js.map +0 -1
  139. package/test/button-negative-outline-sizes.test-vrt.js +0 -15
  140. package/test/button-negative-outline-sizes.test-vrt.js.map +0 -1
  141. package/test/button-negative-outline.test-vrt.js +0 -15
  142. package/test/button-negative-outline.test-vrt.js.map +0 -1
  143. package/test/button-primary-fill-sizes.test-vrt.js +0 -15
  144. package/test/button-primary-fill-sizes.test-vrt.js.map +0 -1
  145. package/test/button-primary-fill.test-vrt.js +0 -15
  146. package/test/button-primary-fill.test-vrt.js.map +0 -1
  147. package/test/button-primary-outline-sizes.test-vrt.js +0 -15
  148. package/test/button-primary-outline-sizes.test-vrt.js.map +0 -1
  149. package/test/button-primary-outline.test-vrt.js +0 -15
  150. package/test/button-primary-outline.test-vrt.js.map +0 -1
  151. package/test/button-secondary-fill-sizes.test-vrt.js +0 -15
  152. package/test/button-secondary-fill-sizes.test-vrt.js.map +0 -1
  153. package/test/button-secondary-fill.test-vrt.js +0 -15
  154. package/test/button-secondary-fill.test-vrt.js.map +0 -1
  155. package/test/button-secondary-outline-sizes.test-vrt.js +0 -15
  156. package/test/button-secondary-outline-sizes.test-vrt.js.map +0 -1
  157. package/test/button-secondary-outline.test-vrt.js +0 -15
  158. package/test/button-secondary-outline.test-vrt.js.map +0 -1
  159. package/test/button-white-fill-sizes.test-vrt.js +0 -15
  160. package/test/button-white-fill-sizes.test-vrt.js.map +0 -1
  161. package/test/button-white-fill.test-vrt.js +0 -15
  162. package/test/button-white-fill.test-vrt.js.map +0 -1
  163. package/test/button-white-outline-sizes.test-vrt.js +0 -15
  164. package/test/button-white-outline-sizes.test-vrt.js.map +0 -1
  165. package/test/button-white-outline.test-vrt.js +0 -15
  166. package/test/button-white-outline.test-vrt.js.map +0 -1
  167. package/test/button.test.js +0 -390
  168. package/test/button.test.js.map +0 -1
package/src/ButtonBase.js DELETED
@@ -1,218 +0,0 @@
1
- /*
2
- Copyright 2020 Adobe. All rights reserved.
3
- This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License. You may obtain a copy
5
- of the License at http://www.apache.org/licenses/LICENSE-2.0
6
-
7
- Unless required by applicable law or agreed to in writing, software distributed under
8
- the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- OF ANY KIND, either express or implied. See the License for the specific language
10
- governing permissions and limitations under the License.
11
- */
12
- import { __decorate } from "tslib";
13
- import { html, } from '@spectrum-web-components/base';
14
- import { property, query, } from '@spectrum-web-components/base/src/decorators.js';
15
- import { LikeAnchor } from '@spectrum-web-components/shared/src/like-anchor.js';
16
- import { Focusable } from '@spectrum-web-components/shared/src/focusable.js';
17
- import { ObserveSlotPresence, ObserveSlotText, } from '@spectrum-web-components/shared';
18
- /**
19
- * @slot - text content to be displayed in the Button element
20
- * @slot icon - icon element(s) to display at the start of the button
21
- */
22
- export class ButtonBase extends LikeAnchor(ObserveSlotText(ObserveSlotPresence(Focusable, '[slot="icon"]'))) {
23
- constructor() {
24
- super();
25
- this.active = false;
26
- this.type = 'button';
27
- this.proxyFocus = this.proxyFocus.bind(this);
28
- this.addEventListener('click', this.handleClickCapture, {
29
- capture: true,
30
- });
31
- }
32
- get hasIcon() {
33
- return this.slotContentIsPresent;
34
- }
35
- get hasLabel() {
36
- return this.slotHasContent;
37
- }
38
- get focusElement() {
39
- return this;
40
- }
41
- get buttonContent() {
42
- const content = [
43
- html `
44
- <div id="label" ?hidden=${!this.hasLabel}>
45
- <slot
46
- id="slot"
47
- @slotchange=${this.manageTextObservedSlot}
48
- ></slot>
49
- </div>
50
- `,
51
- ];
52
- if (this.hasIcon) {
53
- content.unshift(html `
54
- <slot name="icon" ?icon-only=${!this.hasLabel}></slot>
55
- `);
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
- }
68
- handleClickCapture(event) {
69
- if (this.disabled) {
70
- event.preventDefault();
71
- event.stopImmediatePropagation();
72
- event.stopPropagation();
73
- return false;
74
- }
75
- }
76
- proxyFocus() {
77
- this.focus();
78
- }
79
- shouldProxyClick() {
80
- let handled = false;
81
- if (this.anchorElement) {
82
- this.anchorElement.click();
83
- handled = true;
84
- }
85
- else if (this.type !== 'button') {
86
- const proxy = document.createElement('button');
87
- proxy.type = this.type;
88
- this.insertAdjacentElement('afterend', proxy);
89
- proxy.click();
90
- proxy.remove();
91
- handled = true;
92
- }
93
- return handled;
94
- }
95
- renderAnchor() {
96
- return html `
97
- ${this.buttonContent}
98
- ${super.renderAnchor({
99
- id: 'button',
100
- ariaHidden: true,
101
- className: 'button anchor hidden',
102
- })}
103
- `;
104
- }
105
- renderButton() {
106
- return html `
107
- ${this.buttonContent}
108
- `;
109
- }
110
- render() {
111
- return this.href && this.href.length > 0
112
- ? this.renderAnchor()
113
- : 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
- }
165
- else {
166
- if (!this.hasAttribute('role') ||
167
- this.getAttribute('role') === 'link') {
168
- this.setAttribute('role', 'button');
169
- }
170
- this.addEventListener('click', this.shouldProxyClick);
171
- }
172
- }
173
- firstUpdated(changed) {
174
- super.firstUpdated(changed);
175
- if (!this.hasAttribute('tabindex')) {
176
- this.tabIndex = 0;
177
- }
178
- this.manageAnchor();
179
- this.addEventListener('keydown', this.handleKeydown);
180
- this.addEventListener('keypress', this.handleKeypress);
181
- this.addEventListener('pointerdown', this.handlePointerdown);
182
- }
183
- updated(changed) {
184
- super.updated(changed);
185
- if (changed.has('href')) {
186
- this.manageAnchor();
187
- }
188
- if (changed.has('label')) {
189
- this.setAttribute('aria-label', this.label || '');
190
- }
191
- if (changed.has('active')) {
192
- if (this.active) {
193
- this.addEventListener('focusout', this.handleRemoveActive);
194
- this.addEventListener('pointerup', this.handleRemoveActive);
195
- this.addEventListener('pointerleave', this.handleRemoveActive);
196
- }
197
- else {
198
- this.removeEventListener('focusout', this.handleRemoveActive);
199
- this.removeEventListener('pointerup', this.handleRemoveActive);
200
- this.removeEventListener('pointerleave', this.handleRemoveActive);
201
- }
202
- }
203
- if (this.anchorElement) {
204
- this.anchorElement.addEventListener('focus', this.proxyFocus);
205
- this.anchorElement.tabIndex = -1;
206
- }
207
- }
208
- }
209
- __decorate([
210
- property({ type: Boolean, reflect: true })
211
- ], ButtonBase.prototype, "active", void 0);
212
- __decorate([
213
- property({ type: String })
214
- ], ButtonBase.prototype, "type", void 0);
215
- __decorate([
216
- query('.anchor')
217
- ], ButtonBase.prototype, "anchorElement", void 0);
218
- //# sourceMappingURL=ButtonBase.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ButtonBase.js","sourceRoot":"","sources":["ButtonBase.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;;AAEF,OAAO,EACH,IAAI,GAGP,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACH,QAAQ,EACR,KAAK,GACR,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,oDAAoD,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,kDAAkD,CAAC;AAC7E,OAAO,EACH,mBAAmB,EACnB,eAAe,GAClB,MAAM,iCAAiC,CAAC;AAEzC;;;GAGG;AACH,MAAM,OAAO,UAAW,SAAQ,UAAU,CACtC,eAAe,CAAC,mBAAmB,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC,CACnE;IAyCG;QACI,KAAK,EAAE,CAAC;QApCL,WAAM,GAAG,KAAK,CAAC;QAGf,SAAI,GAAkC,QAAQ,CAAC;QAkClD,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE7C,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,kBAAkB,EAAE;YACpD,OAAO,EAAE,IAAI;SAChB,CAA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cAAc,EACd,IAAI,CAAC,kBAAkB,CAC1B,CAAC;aACL;SACJ;QACD,IAAI,IAAI,CAAC,aAAa,EAAE;YACpB,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;YAC9D,IAAI,CAAC,aAAa,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC;SACpC;IACL,CAAC;CACJ;AAnNG;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;0CACrB;AAGtB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCAC2B;AAOtD;IADC,KAAK,CAAC,SAAS,CAAC;iDACyB","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 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 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 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 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 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 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"]}
@@ -1,23 +0,0 @@
1
- import { CSSResultArray, TemplateResult } from '@spectrum-web-components/base';
2
- import { StyledButton } from './StyledButton.js';
3
- import '@spectrum-web-components/icons-ui/icons/sp-icon-cross75.js';
4
- declare const ClearButton_base: typeof StyledButton & {
5
- new (...args: any[]): import("@spectrum-web-components/base").SizedElementInterface;
6
- prototype: import("@spectrum-web-components/base").SizedElementInterface;
7
- };
8
- /**
9
- * @element sp-clear-button
10
- *
11
- * @slot - text label of the Clear Button
12
- * @slot icon - The icon to use for Clear Button
13
- */
14
- export declare class ClearButton extends ClearButton_base {
15
- static get styles(): CSSResultArray;
16
- /**
17
- * The visual variant to apply to this button.
18
- */
19
- variant: 'overBackground' | '';
20
- protected get buttonContent(): TemplateResult[];
21
- protected render(): TemplateResult;
22
- }
23
- export {};
@@ -1,74 +0,0 @@
1
- /*
2
- Copyright 2020 Adobe. All rights reserved.
3
- This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License. You may obtain a copy
5
- of the License at http://www.apache.org/licenses/LICENSE-2.0
6
-
7
- Unless required by applicable law or agreed to in writing, software distributed under
8
- the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- OF ANY KIND, either express or implied. See the License for the specific language
10
- governing permissions and limitations under the License.
11
- */
12
- import { __decorate } from "tslib";
13
- import { html, SizedMixin, } from '@spectrum-web-components/base';
14
- import { property } from '@spectrum-web-components/base/src/decorators.js';
15
- import { StyledButton } from './StyledButton.js';
16
- import buttonStyles from '@spectrum-web-components/clear-button/src/clear-button.css.js';
17
- import '@spectrum-web-components/icons-ui/icons/sp-icon-cross75.js';
18
- import crossMediumStyles from '@spectrum-web-components/icon/src/spectrum-icon-cross.css.js';
19
- const crossIcon = {
20
- s: () => html `
21
- <sp-icon-cross75
22
- slot="icon"
23
- class="icon spectrum-UIIcon-Cross75"
24
- ></sp-icon-cross75>
25
- `,
26
- m: () => html `
27
- <sp-icon-cross100
28
- slot="icon"
29
- class="icon spectrum-UIIcon-Cross100"
30
- ></sp-icon-cross100>
31
- `,
32
- l: () => html `
33
- <sp-icon-cross200
34
- slot="icon"
35
- class="icon spectrum-UIIcon-Cross200"
36
- ></sp-icon-cross200>
37
- `,
38
- xl: () => html `
39
- <sp-icon-cross300
40
- slot="icon"
41
- class="icon spectrum-UIIcon-Cross300"
42
- ></sp-icon-cross300>
43
- `,
44
- };
45
- /**
46
- * @element sp-clear-button
47
- *
48
- * @slot - text label of the Clear Button
49
- * @slot icon - The icon to use for Clear Button
50
- */
51
- export class ClearButton extends SizedMixin(StyledButton) {
52
- constructor() {
53
- super(...arguments);
54
- /**
55
- * The visual variant to apply to this button.
56
- */
57
- this.variant = '';
58
- }
59
- static get styles() {
60
- return [...super.styles, buttonStyles, crossMediumStyles];
61
- }
62
- get buttonContent() {
63
- return [crossIcon[this.size]()];
64
- }
65
- render() {
66
- return html `
67
- <div class="fill">${super.render()}</div>
68
- `;
69
- }
70
- }
71
- __decorate([
72
- property({ reflect: true })
73
- ], ClearButton.prototype, "variant", void 0);
74
- //# sourceMappingURL=ClearButton.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ClearButton.js","sourceRoot":"","sources":["ClearButton.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;;AAEF,OAAO,EAEH,IAAI,EACJ,UAAU,GAEb,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,iDAAiD,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,YAAY,MAAM,+DAA+D,CAAC;AACzF,OAAO,4DAA4D,CAAC;AACpE,OAAO,iBAAiB,MAAM,8DAA8D,CAAC;AAE7F,MAAM,SAAS,GAAyC;IACpD,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,CAAA;;;;;KAKZ;IACD,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,CAAA;;;;;KAKZ;IACD,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,CAAA;;;;;KAKZ;IACD,EAAE,EAAE,GAAG,EAAE,CAAC,IAAI,CAAA;;;;;KAKb;CACJ,CAAC;AAEF;;;;;GAKG;AACH,MAAM,OAAO,WAAY,SAAQ,UAAU,CAAC,YAAY,CAAC;IAAzD;;QAKI;;WAEG;QAEI,YAAO,GAA0B,EAAE,CAAC;IAW/C,CAAC;IAnBU,MAAM,KAAK,MAAM;QACpB,OAAO,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,YAAY,EAAE,iBAAiB,CAAC,CAAC;IAC9D,CAAC;IAQD,IAAc,aAAa;QACvB,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpC,CAAC;IAES,MAAM;QACZ,OAAO,IAAI,CAAA;gCACa,KAAK,CAAC,MAAM,EAAE;SACrC,CAAC;IACN,CAAC;CACJ;AAXG;IADC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;4CACe","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 SizedMixin,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { StyledButton } from './StyledButton.js';\nimport buttonStyles from '@spectrum-web-components/clear-button/src/clear-button.css.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-cross75.js';\nimport crossMediumStyles from '@spectrum-web-components/icon/src/spectrum-icon-cross.css.js';\n\nconst crossIcon: Record<string, () => TemplateResult> = {\n s: () => html`\n <sp-icon-cross75\n slot=\"icon\"\n class=\"icon spectrum-UIIcon-Cross75\"\n ></sp-icon-cross75>\n `,\n m: () => html`\n <sp-icon-cross100\n slot=\"icon\"\n class=\"icon spectrum-UIIcon-Cross100\"\n ></sp-icon-cross100>\n `,\n l: () => html`\n <sp-icon-cross200\n slot=\"icon\"\n class=\"icon spectrum-UIIcon-Cross200\"\n ></sp-icon-cross200>\n `,\n xl: () => html`\n <sp-icon-cross300\n slot=\"icon\"\n class=\"icon spectrum-UIIcon-Cross300\"\n ></sp-icon-cross300>\n `,\n};\n\n/**\n * @element sp-clear-button\n *\n * @slot - text label of the Clear Button\n * @slot icon - The icon to use for Clear Button\n */\nexport class ClearButton extends SizedMixin(StyledButton) {\n public static get styles(): CSSResultArray {\n return [...super.styles, buttonStyles, crossMediumStyles];\n }\n\n /**\n * The visual variant to apply to this button.\n */\n @property({ reflect: true })\n public variant: 'overBackground' | '' = '';\n\n protected get buttonContent(): TemplateResult[] {\n return [crossIcon[this.size]()];\n }\n\n protected render(): TemplateResult {\n return html`\n <div class=\"fill\">${super.render()}</div>\n `;\n }\n}\n"]}
@@ -1,26 +0,0 @@
1
- import { CSSResultArray, TemplateResult } from '@spectrum-web-components/base';
2
- import { StyledButton } from './StyledButton.js';
3
- import '@spectrum-web-components/icons-ui/icons/sp-icon-cross75.js';
4
- import '@spectrum-web-components/icons-ui/icons/sp-icon-cross100.js';
5
- import '@spectrum-web-components/icons-ui/icons/sp-icon-cross200.js';
6
- import '@spectrum-web-components/icons-ui/icons/sp-icon-cross300.js';
7
- import type { ButtonStatics } from './Button.js';
8
- declare const CloseButton_base: typeof StyledButton & {
9
- new (...args: any[]): import("@spectrum-web-components/base").SizedElementInterface;
10
- prototype: import("@spectrum-web-components/base").SizedElementInterface;
11
- };
12
- /**
13
- * @element sp-close-button
14
- *
15
- * @slot - text label of the Close Button
16
- * @slot icon - The icon to use for Close Button
17
- */
18
- export declare class CloseButton extends CloseButton_base {
19
- static get styles(): CSSResultArray;
20
- /**
21
- * The visual variant to apply to this button.
22
- */
23
- variant: ButtonStatics | '';
24
- protected get buttonContent(): TemplateResult[];
25
- }
26
- export {};
@@ -1,72 +0,0 @@
1
- /*
2
- Copyright 2020 Adobe. All rights reserved.
3
- This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License. You may obtain a copy
5
- of the License at http://www.apache.org/licenses/LICENSE-2.0
6
-
7
- Unless required by applicable law or agreed to in writing, software distributed under
8
- the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- OF ANY KIND, either express or implied. See the License for the specific language
10
- governing permissions and limitations under the License.
11
- */
12
- import { __decorate } from "tslib";
13
- import { html, SizedMixin, } from '@spectrum-web-components/base';
14
- import { property } from '@spectrum-web-components/base/src/decorators.js';
15
- import { StyledButton } from './StyledButton.js';
16
- import buttonStyles from '@spectrum-web-components/close-button/src/close-button.css.js';
17
- import '@spectrum-web-components/icons-ui/icons/sp-icon-cross75.js';
18
- import '@spectrum-web-components/icons-ui/icons/sp-icon-cross100.js';
19
- import '@spectrum-web-components/icons-ui/icons/sp-icon-cross200.js';
20
- import '@spectrum-web-components/icons-ui/icons/sp-icon-cross300.js';
21
- import crossMediumStyles from '@spectrum-web-components/icon/src/spectrum-icon-cross.css.js';
22
- const crossIcon = {
23
- s: () => html `
24
- <sp-icon-cross75
25
- slot="icon"
26
- class="icon spectrum-UIIcon-Cross75"
27
- ></sp-icon-cross75>
28
- `,
29
- m: () => html `
30
- <sp-icon-cross100
31
- slot="icon"
32
- class="icon spectrum-UIIcon-Cross100"
33
- ></sp-icon-cross100>
34
- `,
35
- l: () => html `
36
- <sp-icon-cross200
37
- slot="icon"
38
- class="icon spectrum-UIIcon-Cross200"
39
- ></sp-icon-cross200>
40
- `,
41
- xl: () => html `
42
- <sp-icon-cross300
43
- slot="icon"
44
- class="icon spectrum-UIIcon-Cross300"
45
- ></sp-icon-cross300>
46
- `,
47
- };
48
- /**
49
- * @element sp-close-button
50
- *
51
- * @slot - text label of the Close Button
52
- * @slot icon - The icon to use for Close Button
53
- */
54
- export class CloseButton extends SizedMixin(StyledButton) {
55
- constructor() {
56
- super(...arguments);
57
- /**
58
- * The visual variant to apply to this button.
59
- */
60
- this.variant = '';
61
- }
62
- static get styles() {
63
- return [...super.styles, buttonStyles, crossMediumStyles];
64
- }
65
- get buttonContent() {
66
- return [crossIcon[this.size]()];
67
- }
68
- }
69
- __decorate([
70
- property({ reflect: true })
71
- ], CloseButton.prototype, "variant", void 0);
72
- //# sourceMappingURL=CloseButton.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CloseButton.js","sourceRoot":"","sources":["CloseButton.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;;AAEF,OAAO,EAEH,IAAI,EACJ,UAAU,GAEb,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,iDAAiD,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,YAAY,MAAM,+DAA+D,CAAC;AACzF,OAAO,4DAA4D,CAAC;AACpE,OAAO,6DAA6D,CAAC;AACrE,OAAO,6DAA6D,CAAC;AACrE,OAAO,6DAA6D,CAAC;AACrE,OAAO,iBAAiB,MAAM,8DAA8D,CAAC;AAG7F,MAAM,SAAS,GAAyC;IACpD,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,CAAA;;;;;KAKZ;IACD,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,CAAA;;;;;KAKZ;IACD,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,CAAA;;;;;KAKZ;IACD,EAAE,EAAE,GAAG,EAAE,CAAC,IAAI,CAAA;;;;;KAKb;CACJ,CAAC;AAEF;;;;;GAKG;AACH,MAAM,OAAO,WAAY,SAAQ,UAAU,CAAC,YAAY,CAAC;IAAzD;;QAKI;;WAEG;QAEI,YAAO,GAAuB,EAAE,CAAC;IAK5C,CAAC;IAbU,MAAM,KAAK,MAAM;QACpB,OAAO,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,YAAY,EAAE,iBAAiB,CAAC,CAAC;IAC9D,CAAC;IAQD,IAAc,aAAa;QACvB,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpC,CAAC;CACJ;AALG;IADC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;4CACY","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 SizedMixin,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { StyledButton } from './StyledButton.js';\nimport buttonStyles from '@spectrum-web-components/close-button/src/close-button.css.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-cross75.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-cross100.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-cross200.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-cross300.js';\nimport crossMediumStyles from '@spectrum-web-components/icon/src/spectrum-icon-cross.css.js';\nimport type { ButtonStatics } from './Button.js';\n\nconst crossIcon: Record<string, () => TemplateResult> = {\n s: () => html`\n <sp-icon-cross75\n slot=\"icon\"\n class=\"icon spectrum-UIIcon-Cross75\"\n ></sp-icon-cross75>\n `,\n m: () => html`\n <sp-icon-cross100\n slot=\"icon\"\n class=\"icon spectrum-UIIcon-Cross100\"\n ></sp-icon-cross100>\n `,\n l: () => html`\n <sp-icon-cross200\n slot=\"icon\"\n class=\"icon spectrum-UIIcon-Cross200\"\n ></sp-icon-cross200>\n `,\n xl: () => html`\n <sp-icon-cross300\n slot=\"icon\"\n class=\"icon spectrum-UIIcon-Cross300\"\n ></sp-icon-cross300>\n `,\n};\n\n/**\n * @element sp-close-button\n *\n * @slot - text label of the Close Button\n * @slot icon - The icon to use for Close Button\n */\nexport class CloseButton extends SizedMixin(StyledButton) {\n public static get styles(): CSSResultArray {\n return [...super.styles, buttonStyles, crossMediumStyles];\n }\n\n /**\n * The visual variant to apply to this button.\n */\n @property({ reflect: true })\n public variant: ButtonStatics | '' = '';\n\n protected get buttonContent(): TemplateResult[] {\n return [crossIcon[this.size]()];\n }\n}\n"]}
@@ -1,5 +0,0 @@
1
- import { CSSResultArray } from '@spectrum-web-components/base';
2
- import { ButtonBase } from './ButtonBase.js';
3
- export declare class StyledButton extends ButtonBase {
4
- static get styles(): CSSResultArray;
5
- }
@@ -1,19 +0,0 @@
1
- /*
2
- Copyright 2020 Adobe. All rights reserved.
3
- This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License. You may obtain a copy
5
- of the License at http://www.apache.org/licenses/LICENSE-2.0
6
-
7
- Unless required by applicable law or agreed to in writing, software distributed under
8
- the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- OF ANY KIND, either express or implied. See the License for the specific language
10
- governing permissions and limitations under the License.
11
- */
12
- import { ButtonBase } from './ButtonBase.js';
13
- import buttonStyles from './button-base.css.js';
14
- export class StyledButton extends ButtonBase {
15
- static get styles() {
16
- return [buttonStyles];
17
- }
18
- }
19
- //# sourceMappingURL=StyledButton.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"StyledButton.js","sourceRoot":"","sources":["StyledButton.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAGF,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,YAAY,MAAM,sBAAsB,CAAC;AAEhD,MAAM,OAAO,YAAa,SAAQ,UAAU;IACjC,MAAM,KAAK,MAAM;QACpB,OAAO,CAAC,YAAY,CAAC,CAAC;IAC1B,CAAC;CACJ","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 { CSSResultArray } from '@spectrum-web-components/base';\nimport { ButtonBase } from './ButtonBase.js';\nimport buttonStyles from './button-base.css.js';\n\nexport class StyledButton extends ButtonBase {\n public static get styles(): CSSResultArray {\n return [buttonStyles];\n }\n}\n"]}
@@ -1,2 +0,0 @@
1
- declare const styles: import("@spectrum-web-components/base").CSSResult;
2
- export default styles;
@@ -1,21 +0,0 @@
1
- /*
2
- Copyright 2020 Adobe. All rights reserved.
3
- This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License. You may obtain a copy
5
- of the License at http://www.apache.org/licenses/LICENSE-2.0
6
-
7
- Unless required by applicable law or agreed to in writing, software distributed under
8
- the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
- OF ANY KIND, either express or implied. See the License for the specific language
10
- governing permissions and limitations under the License.
11
- */
12
- import { css } from '@spectrum-web-components/base';
13
- const styles = css `
14
- :host{display:inline-flex;vertical-align:top}:host([dir]){-webkit-appearance:none}:host([disabled]){cursor:auto;pointer-events:none}#button{inset:0;position:absolute}:host:after{pointer-events:none}slot[name=icon]::slotted(img),slot[name=icon]::slotted(svg){fill:currentColor;stroke:currentColor;height:var(
15
- --spectrum-alias-workflow-icon-size-m,var(--spectrum-global-dimension-size-225)
16
- );width:var(
17
- --spectrum-alias-workflow-icon-size-m,var(--spectrum-global-dimension-size-225)
18
- )}
19
- `;
20
- export default styles;
21
- //# sourceMappingURL=button-base.css.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"button-base.css.js","sourceRoot":"","sources":["button-base.css.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,EAAE,GAAG,EAAE,MAAM,+BAA+B,CAAC;AACpD,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;CAMjB,CAAC;AACF,eAAe,MAAM,CAAC","sourcesContent":["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host{display:inline-flex;vertical-align:top}:host([dir]){-webkit-appearance:none}:host([disabled]){cursor:auto;pointer-events:none}#button{inset:0;position:absolute}:host:after{pointer-events:none}slot[name=icon]::slotted(img),slot[name=icon]::slotted(svg){fill:currentColor;stroke:currentColor;height:var(\n--spectrum-alias-workflow-icon-size-m,var(--spectrum-global-dimension-size-225)\n);width:var(\n--spectrum-alias-workflow-icon-size-m,var(--spectrum-global-dimension-size-225)\n)}\n`;\nexport default styles;"]}
@@ -1,2 +0,0 @@
1
- declare const styles: import("@spectrum-web-components/base").CSSResult;
2
- export default styles;