@spectrum-web-components/button 1.1.0 → 1.1.2

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 (229) hide show
  1. package/package.json +10 -10
  2. package/sp-button.d.ts +6 -0
  3. package/sp-button.dev.js +5 -0
  4. package/sp-button.dev.js.map +7 -0
  5. package/sp-button.js +2 -0
  6. package/sp-button.js.map +7 -0
  7. package/sp-clear-button.d.ts +6 -0
  8. package/sp-clear-button.dev.js +5 -0
  9. package/sp-clear-button.dev.js.map +7 -0
  10. package/sp-clear-button.js +2 -0
  11. package/sp-clear-button.js.map +7 -0
  12. package/sp-close-button.d.ts +6 -0
  13. package/sp-close-button.dev.js +5 -0
  14. package/sp-close-button.dev.js.map +7 -0
  15. package/sp-close-button.js +2 -0
  16. package/sp-close-button.js.map +7 -0
  17. package/src/Button.d.ts +60 -0
  18. package/src/Button.dev.js +162 -0
  19. package/src/Button.dev.js.map +7 -0
  20. package/src/Button.js +5 -0
  21. package/src/Button.js.map +7 -0
  22. package/src/ButtonBase.d.ts +44 -0
  23. package/src/ButtonBase.dev.js +198 -0
  24. package/src/ButtonBase.dev.js.map +7 -0
  25. package/src/ButtonBase.js +13 -0
  26. package/src/ButtonBase.js.map +7 -0
  27. package/src/ClearButton.d.ts +26 -0
  28. package/src/ClearButton.dev.js +78 -0
  29. package/src/ClearButton.dev.js.map +7 -0
  30. package/src/ClearButton.js +24 -0
  31. package/src/ClearButton.js.map +7 -0
  32. package/src/CloseButton.d.ts +27 -0
  33. package/src/CloseButton.dev.js +76 -0
  34. package/src/CloseButton.dev.js.map +7 -0
  35. package/src/CloseButton.js +22 -0
  36. package/src/CloseButton.js.map +7 -0
  37. package/src/StyledButton.d.ts +3 -0
  38. package/src/StyledButton.dev.js +5 -0
  39. package/src/StyledButton.dev.js.map +7 -0
  40. package/src/StyledButton.js +2 -0
  41. package/src/StyledButton.js.map +7 -0
  42. package/src/button-base.css.d.ts +2 -0
  43. package/src/button-base.css.dev.js +7 -0
  44. package/src/button-base.css.dev.js.map +7 -0
  45. package/src/button-base.css.js +4 -0
  46. package/src/button-base.css.js.map +7 -0
  47. package/src/button-overrides.css.d.ts +2 -0
  48. package/src/button-overrides.css.dev.js +7 -0
  49. package/src/button-overrides.css.dev.js.map +7 -0
  50. package/src/button-overrides.css.js +4 -0
  51. package/src/button-overrides.css.js.map +7 -0
  52. package/src/button.css.d.ts +2 -0
  53. package/src/button.css.dev.js +7 -0
  54. package/src/button.css.dev.js.map +7 -0
  55. package/src/button.css.js +4 -0
  56. package/src/button.css.js.map +7 -0
  57. package/src/index.d.ts +5 -0
  58. package/src/index.dev.js +7 -0
  59. package/src/index.dev.js.map +7 -0
  60. package/src/index.js +2 -0
  61. package/src/index.js.map +7 -0
  62. package/src/spectrum-button-base.css.d.ts +2 -0
  63. package/src/spectrum-button-base.css.dev.js +7 -0
  64. package/src/spectrum-button-base.css.dev.js.map +7 -0
  65. package/src/spectrum-button-base.css.js +4 -0
  66. package/src/spectrum-button-base.css.js.map +7 -0
  67. package/src/spectrum-button.css.d.ts +2 -0
  68. package/src/spectrum-button.css.dev.js +7 -0
  69. package/src/spectrum-button.css.dev.js.map +7 -0
  70. package/src/spectrum-button.css.js +4 -0
  71. package/src/spectrum-button.css.js.map +7 -0
  72. package/stories/button-accent-fill-pending.stories.js +34 -0
  73. package/stories/button-accent-fill-pending.stories.js.map +7 -0
  74. package/stories/button-accent-fill-sizes.stories.js +32 -0
  75. package/stories/button-accent-fill-sizes.stories.js.map +7 -0
  76. package/stories/button-accent-fill.stories.js +33 -0
  77. package/stories/button-accent-fill.stories.js.map +7 -0
  78. package/stories/button-accent-outline-pending.stories.js +34 -0
  79. package/stories/button-accent-outline-pending.stories.js.map +7 -0
  80. package/stories/button-accent-outline-sizes.stories.js +32 -0
  81. package/stories/button-accent-outline-sizes.stories.js.map +7 -0
  82. package/stories/button-accent-outline.stories.js +33 -0
  83. package/stories/button-accent-outline.stories.js.map +7 -0
  84. package/stories/button-black-fill-pending.stories.js +34 -0
  85. package/stories/button-black-fill-pending.stories.js.map +7 -0
  86. package/stories/button-black-fill-sizes.stories.js +33 -0
  87. package/stories/button-black-fill-sizes.stories.js.map +7 -0
  88. package/stories/button-black-fill.stories.js +35 -0
  89. package/stories/button-black-fill.stories.js.map +7 -0
  90. package/stories/button-black-outline-pending.stories.js +34 -0
  91. package/stories/button-black-outline-pending.stories.js.map +7 -0
  92. package/stories/button-black-outline-sizes.stories.js +33 -0
  93. package/stories/button-black-outline-sizes.stories.js.map +7 -0
  94. package/stories/button-black-outline.stories.js +35 -0
  95. package/stories/button-black-outline.stories.js.map +7 -0
  96. package/stories/button-negative-fill-pending.stories.js +34 -0
  97. package/stories/button-negative-fill-pending.stories.js.map +7 -0
  98. package/stories/button-negative-fill-sizes.stories.js +32 -0
  99. package/stories/button-negative-fill-sizes.stories.js.map +7 -0
  100. package/stories/button-negative-fill.stories.js +33 -0
  101. package/stories/button-negative-fill.stories.js.map +7 -0
  102. package/stories/button-negative-outline-pending.stories.js +34 -0
  103. package/stories/button-negative-outline-pending.stories.js.map +7 -0
  104. package/stories/button-negative-outline-sizes.stories.js +32 -0
  105. package/stories/button-negative-outline-sizes.stories.js.map +7 -0
  106. package/stories/button-negative-outline.stories.js +33 -0
  107. package/stories/button-negative-outline.stories.js.map +7 -0
  108. package/stories/button-primary-fill-pending.stories.js +34 -0
  109. package/stories/button-primary-fill-pending.stories.js.map +7 -0
  110. package/stories/button-primary-fill-sizes.stories.js +32 -0
  111. package/stories/button-primary-fill-sizes.stories.js.map +7 -0
  112. package/stories/button-primary-fill.stories.js +46 -0
  113. package/stories/button-primary-fill.stories.js.map +7 -0
  114. package/stories/button-primary-outline-pending.stories.js +34 -0
  115. package/stories/button-primary-outline-pending.stories.js.map +7 -0
  116. package/stories/button-primary-outline-sizes.stories.js +32 -0
  117. package/stories/button-primary-outline-sizes.stories.js.map +7 -0
  118. package/stories/button-primary-outline.stories.js +33 -0
  119. package/stories/button-primary-outline.stories.js.map +7 -0
  120. package/stories/button-secondary-fill-pending.stories.js +34 -0
  121. package/stories/button-secondary-fill-pending.stories.js.map +7 -0
  122. package/stories/button-secondary-fill-sizes.stories.js +32 -0
  123. package/stories/button-secondary-fill-sizes.stories.js.map +7 -0
  124. package/stories/button-secondary-fill.stories.js +33 -0
  125. package/stories/button-secondary-fill.stories.js.map +7 -0
  126. package/stories/button-secondary-outline-pending.stories.js +34 -0
  127. package/stories/button-secondary-outline-pending.stories.js.map +7 -0
  128. package/stories/button-secondary-outline-sizes.stories.js +32 -0
  129. package/stories/button-secondary-outline-sizes.stories.js.map +7 -0
  130. package/stories/button-secondary-outline.stories.js +33 -0
  131. package/stories/button-secondary-outline.stories.js.map +7 -0
  132. package/stories/button-white-fill-pending.stories.js +34 -0
  133. package/stories/button-white-fill-pending.stories.js.map +7 -0
  134. package/stories/button-white-fill-sizes.stories.js +33 -0
  135. package/stories/button-white-fill-sizes.stories.js.map +7 -0
  136. package/stories/button-white-fill.stories.js +35 -0
  137. package/stories/button-white-fill.stories.js.map +7 -0
  138. package/stories/button-white-outline-pending.stories.js +34 -0
  139. package/stories/button-white-outline-pending.stories.js.map +7 -0
  140. package/stories/button-white-outline-sizes.stories.js +33 -0
  141. package/stories/button-white-outline-sizes.stories.js.map +7 -0
  142. package/stories/button-white-outline.stories.js +35 -0
  143. package/stories/button-white-outline.stories.js.map +7 -0
  144. package/stories/index.js +198 -0
  145. package/stories/index.js.map +7 -0
  146. package/stories/template.js +21 -0
  147. package/stories/template.js.map +7 -0
  148. package/test/benchmark/test-basic.js +14 -0
  149. package/test/benchmark/test-basic.js.map +7 -0
  150. package/test/button-accent-fill-pending.test-vrt.js +5 -0
  151. package/test/button-accent-fill-pending.test-vrt.js.map +7 -0
  152. package/test/button-accent-fill-sizes.test-vrt.js +5 -0
  153. package/test/button-accent-fill-sizes.test-vrt.js.map +7 -0
  154. package/test/button-accent-fill.test-vrt.js +5 -0
  155. package/test/button-accent-fill.test-vrt.js.map +7 -0
  156. package/test/button-accent-outline-pending.test-vrt.js +5 -0
  157. package/test/button-accent-outline-pending.test-vrt.js.map +7 -0
  158. package/test/button-accent-outline-sizes.test-vrt.js +5 -0
  159. package/test/button-accent-outline-sizes.test-vrt.js.map +7 -0
  160. package/test/button-accent-outline.test-vrt.js +5 -0
  161. package/test/button-accent-outline.test-vrt.js.map +7 -0
  162. package/test/button-black-fill-pending.test-vrt.js +5 -0
  163. package/test/button-black-fill-pending.test-vrt.js.map +7 -0
  164. package/test/button-black-fill-sizes.test-vrt.js +5 -0
  165. package/test/button-black-fill-sizes.test-vrt.js.map +7 -0
  166. package/test/button-black-fill.test-vrt.js +5 -0
  167. package/test/button-black-fill.test-vrt.js.map +7 -0
  168. package/test/button-black-outline-pending.test-vrt.js +5 -0
  169. package/test/button-black-outline-pending.test-vrt.js.map +7 -0
  170. package/test/button-black-outline-sizes.test-vrt.js +5 -0
  171. package/test/button-black-outline-sizes.test-vrt.js.map +7 -0
  172. package/test/button-black-outline.test-vrt.js +5 -0
  173. package/test/button-black-outline.test-vrt.js.map +7 -0
  174. package/test/button-memory.test.js +5 -0
  175. package/test/button-memory.test.js.map +7 -0
  176. package/test/button-negative-fill-pending.test-vrt.js +5 -0
  177. package/test/button-negative-fill-pending.test-vrt.js.map +7 -0
  178. package/test/button-negative-fill-sizes.test-vrt.js +5 -0
  179. package/test/button-negative-fill-sizes.test-vrt.js.map +7 -0
  180. package/test/button-negative-fill.test-vrt.js +5 -0
  181. package/test/button-negative-fill.test-vrt.js.map +7 -0
  182. package/test/button-negative-outline-pending.test-vrt.js +5 -0
  183. package/test/button-negative-outline-pending.test-vrt.js.map +7 -0
  184. package/test/button-negative-outline-sizes.test-vrt.js +5 -0
  185. package/test/button-negative-outline-sizes.test-vrt.js.map +7 -0
  186. package/test/button-negative-outline.test-vrt.js +5 -0
  187. package/test/button-negative-outline.test-vrt.js.map +7 -0
  188. package/test/button-primary-fill-pending.test-vrt.js +5 -0
  189. package/test/button-primary-fill-pending.test-vrt.js.map +7 -0
  190. package/test/button-primary-fill-sizes.test-vrt.js +5 -0
  191. package/test/button-primary-fill-sizes.test-vrt.js.map +7 -0
  192. package/test/button-primary-fill.test-vrt.js +5 -0
  193. package/test/button-primary-fill.test-vrt.js.map +7 -0
  194. package/test/button-primary-outline-pending.test-vrt.js +5 -0
  195. package/test/button-primary-outline-pending.test-vrt.js.map +7 -0
  196. package/test/button-primary-outline-sizes.test-vrt.js +5 -0
  197. package/test/button-primary-outline-sizes.test-vrt.js.map +7 -0
  198. package/test/button-primary-outline.test-vrt.js +5 -0
  199. package/test/button-primary-outline.test-vrt.js.map +7 -0
  200. package/test/button-secondary-fill-pending.test-vrt.js +5 -0
  201. package/test/button-secondary-fill-pending.test-vrt.js.map +7 -0
  202. package/test/button-secondary-fill-sizes.test-vrt.js +5 -0
  203. package/test/button-secondary-fill-sizes.test-vrt.js.map +7 -0
  204. package/test/button-secondary-fill.test-vrt.js +5 -0
  205. package/test/button-secondary-fill.test-vrt.js.map +7 -0
  206. package/test/button-secondary-outline-pending.test-vrt.js +5 -0
  207. package/test/button-secondary-outline-pending.test-vrt.js.map +7 -0
  208. package/test/button-secondary-outline-sizes.test-vrt.js +5 -0
  209. package/test/button-secondary-outline-sizes.test-vrt.js.map +7 -0
  210. package/test/button-secondary-outline.test-vrt.js +5 -0
  211. package/test/button-secondary-outline.test-vrt.js.map +7 -0
  212. package/test/button-white-fill-pending.test-vrt.js +5 -0
  213. package/test/button-white-fill-pending.test-vrt.js.map +7 -0
  214. package/test/button-white-fill-sizes.test-vrt.js +5 -0
  215. package/test/button-white-fill-sizes.test-vrt.js.map +7 -0
  216. package/test/button-white-fill.test-vrt.js +5 -0
  217. package/test/button-white-fill.test-vrt.js.map +7 -0
  218. package/test/button-white-outline-pending.test-vrt.js +5 -0
  219. package/test/button-white-outline-pending.test-vrt.js.map +7 -0
  220. package/test/button-white-outline-sizes.test-vrt.js +5 -0
  221. package/test/button-white-outline-sizes.test-vrt.js.map +7 -0
  222. package/test/button-white-outline.test-vrt.js +5 -0
  223. package/test/button-white-outline.test-vrt.js.map +7 -0
  224. package/test/button.test.js +659 -0
  225. package/test/button.test.js.map +7 -0
  226. package/test/clear-button.test.js +27 -0
  227. package/test/clear-button.test.js.map +7 -0
  228. package/test/close-button.test.js +27 -0
  229. package/test/close-button.test.js.map +7 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectrum-web-components/button",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -83,14 +83,14 @@
83
83
  "lit-html"
84
84
  ],
85
85
  "dependencies": {
86
- "@spectrum-web-components/base": "^1.1.0",
87
- "@spectrum-web-components/clear-button": "^1.1.0",
88
- "@spectrum-web-components/close-button": "^1.1.0",
89
- "@spectrum-web-components/icon": "^1.1.0",
90
- "@spectrum-web-components/icons-ui": "^1.1.0",
91
- "@spectrum-web-components/progress-circle": "^1.1.0",
92
- "@spectrum-web-components/reactive-controllers": "^1.1.0",
93
- "@spectrum-web-components/shared": "^1.1.0"
86
+ "@spectrum-web-components/base": "^1.1.2",
87
+ "@spectrum-web-components/clear-button": "^1.1.2",
88
+ "@spectrum-web-components/close-button": "^1.1.2",
89
+ "@spectrum-web-components/icon": "^1.1.2",
90
+ "@spectrum-web-components/icons-ui": "^1.1.2",
91
+ "@spectrum-web-components/progress-circle": "^1.1.2",
92
+ "@spectrum-web-components/reactive-controllers": "^1.1.2",
93
+ "@spectrum-web-components/shared": "^1.1.2"
94
94
  },
95
95
  "devDependencies": {
96
96
  "@spectrum-css/button": "14.0.0-s2-foundations.18"
@@ -101,5 +101,5 @@
101
101
  "./sp-*.js",
102
102
  "./**/*.dev.js"
103
103
  ],
104
- "gitHead": "e3c6e52501451acc6fa85b10dd718267b80a01ab"
104
+ "gitHead": "9ee45f2dfd3ac1939072726d00195c6c05d9a562"
105
105
  }
package/sp-button.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ import { Button } from './src/Button.js';
2
+ declare global {
3
+ interface HTMLElementTagNameMap {
4
+ 'sp-button': Button;
5
+ }
6
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ import { Button } from "./src/Button.dev.js";
3
+ import { defineElement } from "@spectrum-web-components/base/src/define-element.js";
4
+ defineElement("sp-button", Button);
5
+ //# sourceMappingURL=sp-button.dev.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["sp-button.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 { Button } from './src/Button.dev.js'\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-button', Button);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-button': Button;\n }\n}\n"],
5
+ "mappings": ";AAWA,SAAS,cAAc;AACvB,SAAS,qBAAqB;AAE9B,cAAc,aAAa,MAAM;",
6
+ "names": []
7
+ }
package/sp-button.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";import{Button as t}from"./src/Button.js";import{defineElement as e}from"@spectrum-web-components/base/src/define-element.js";e("sp-button",t);
2
+ //# sourceMappingURL=sp-button.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["sp-button.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 { Button } from './src/Button.js';\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-button', Button);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-button': Button;\n }\n}\n"],
5
+ "mappings": "aAWA,OAAS,UAAAA,MAAc,kBACvB,OAAS,iBAAAC,MAAqB,sDAE9BA,EAAc,YAAaD,CAAM",
6
+ "names": ["Button", "defineElement"]
7
+ }
@@ -0,0 +1,6 @@
1
+ import { ClearButton } from './src/ClearButton.js';
2
+ declare global {
3
+ interface HTMLElementTagNameMap {
4
+ 'sp-clear-button': ClearButton;
5
+ }
6
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ import { ClearButton } from "./src/ClearButton.dev.js";
3
+ import { defineElement } from "@spectrum-web-components/base/src/define-element.js";
4
+ defineElement("sp-clear-button", ClearButton);
5
+ //# sourceMappingURL=sp-clear-button.dev.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["sp-clear-button.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 { ClearButton } from './src/ClearButton.dev.js'\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-clear-button', ClearButton);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-clear-button': ClearButton;\n }\n}\n"],
5
+ "mappings": ";AAWA,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAE9B,cAAc,mBAAmB,WAAW;",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";import{ClearButton as e}from"./src/ClearButton.js";import{defineElement as t}from"@spectrum-web-components/base/src/define-element.js";t("sp-clear-button",e);
2
+ //# sourceMappingURL=sp-clear-button.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["sp-clear-button.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 { ClearButton } from './src/ClearButton.js';\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-clear-button', ClearButton);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-clear-button': ClearButton;\n }\n}\n"],
5
+ "mappings": "aAWA,OAAS,eAAAA,MAAmB,uBAC5B,OAAS,iBAAAC,MAAqB,sDAE9BA,EAAc,kBAAmBD,CAAW",
6
+ "names": ["ClearButton", "defineElement"]
7
+ }
@@ -0,0 +1,6 @@
1
+ import { CloseButton } from './src/CloseButton.js';
2
+ declare global {
3
+ interface HTMLElementTagNameMap {
4
+ 'sp-close-button': CloseButton;
5
+ }
6
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ import { CloseButton } from "./src/CloseButton.dev.js";
3
+ import { defineElement } from "@spectrum-web-components/base/src/define-element.js";
4
+ defineElement("sp-close-button", CloseButton);
5
+ //# sourceMappingURL=sp-close-button.dev.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["sp-close-button.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 { CloseButton } from './src/CloseButton.dev.js'\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-close-button', CloseButton);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-close-button': CloseButton;\n }\n}\n"],
5
+ "mappings": ";AAYA,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAE9B,cAAc,mBAAmB,WAAW;",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";import{CloseButton as e}from"./src/CloseButton.js";import{defineElement as o}from"@spectrum-web-components/base/src/define-element.js";o("sp-close-button",e);
2
+ //# sourceMappingURL=sp-close-button.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["sp-close-button.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 { CloseButton } from './src/CloseButton.js';\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-close-button', CloseButton);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-close-button': CloseButton;\n }\n}\n"],
5
+ "mappings": "aAYA,OAAS,eAAAA,MAAmB,uBAC5B,OAAS,iBAAAC,MAAqB,sDAE9BA,EAAc,kBAAmBD,CAAW",
6
+ "names": ["CloseButton", "defineElement"]
7
+ }
@@ -0,0 +1,60 @@
1
+ import { CSSResultArray, PropertyValues, TemplateResult } from '@spectrum-web-components/base';
2
+ import { ButtonBase } from './ButtonBase.js';
3
+ import { PendingStateController } from '@spectrum-web-components/reactive-controllers/src/PendingState.js';
4
+ export type DeprecatedButtonVariants = 'cta' | 'overBackground';
5
+ export type ButtonStaticColors = 'white' | 'black';
6
+ export type ButtonVariants = 'accent' | 'primary' | 'secondary' | 'negative' | ButtonStaticColors | DeprecatedButtonVariants;
7
+ export declare const VALID_VARIANTS: string[];
8
+ export declare const VALID_STATIC_COLORS: string[];
9
+ export type ButtonTreatments = 'fill' | 'outline';
10
+ declare const Button_base: typeof ButtonBase & {
11
+ new (...args: any[]): import("@spectrum-web-components/base").SizedElementInterface;
12
+ prototype: import("@spectrum-web-components/base").SizedElementInterface;
13
+ };
14
+ /**
15
+ * @element sp-button
16
+ *
17
+ * @slot - text label of the Button
18
+ * @slot icon - The icon to use for Button
19
+ */
20
+ export declare class Button extends Button_base {
21
+ static get styles(): CSSResultArray;
22
+ pendingLabel: string;
23
+ pending: boolean;
24
+ pendingStateController: PendingStateController<this>;
25
+ /**
26
+ * Initializes the `PendingStateController` for the Button component.
27
+ * The `PendingStateController` manages the pending state of the Button.
28
+ */
29
+ constructor();
30
+ click(): void;
31
+ /**
32
+ * The visual variant to apply to this button.
33
+ */
34
+ get variant(): ButtonVariants;
35
+ set variant(variant: ButtonVariants);
36
+ private _variant;
37
+ /**
38
+ * The static color variant to use for this button.
39
+ */
40
+ staticColor?: 'black' | 'white';
41
+ /**
42
+ * The visual treatment to apply to this button.
43
+ */
44
+ treatment: ButtonTreatments;
45
+ /**
46
+ * Style this button to be less obvious
47
+ */
48
+ set quiet(quiet: boolean);
49
+ /**
50
+ * Disables text wrapping within the button component's label.
51
+ * Please note that this option is not a part of the design specification
52
+ * and should be used carefully, with consideration of this overflow behavior
53
+ * and the readability of the button's content.
54
+ */
55
+ noWrap: boolean;
56
+ get quiet(): boolean;
57
+ protected firstUpdated(changes: PropertyValues<this>): void;
58
+ protected renderButton(): TemplateResult;
59
+ }
60
+ export {};
@@ -0,0 +1,162 @@
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
+ } from "@spectrum-web-components/base";
16
+ import { property } from "@spectrum-web-components/base/src/decorators.js";
17
+ import { ButtonBase } from "./ButtonBase.dev.js";
18
+ import buttonStyles from "./button.css.js";
19
+ import { PendingStateController } from "@spectrum-web-components/reactive-controllers/src/PendingState.js";
20
+ export const VALID_VARIANTS = [
21
+ "accent",
22
+ "primary",
23
+ "secondary",
24
+ "negative",
25
+ "white",
26
+ "black"
27
+ ];
28
+ export const VALID_STATIC_COLORS = ["white", "black"];
29
+ export class Button extends SizedMixin(ButtonBase, { noDefaultSize: true }) {
30
+ /**
31
+ * Initializes the `PendingStateController` for the Button component.
32
+ * The `PendingStateController` manages the pending state of the Button.
33
+ */
34
+ constructor() {
35
+ super();
36
+ this.pendingLabel = "Pending";
37
+ this.pending = false;
38
+ this._variant = "accent";
39
+ this.treatment = "fill";
40
+ this.noWrap = false;
41
+ this.pendingStateController = new PendingStateController(this);
42
+ }
43
+ static get styles() {
44
+ return [...super.styles, buttonStyles];
45
+ }
46
+ click() {
47
+ if (this.pending) {
48
+ return;
49
+ }
50
+ super.click();
51
+ }
52
+ get variant() {
53
+ return this._variant;
54
+ }
55
+ set variant(variant) {
56
+ if (variant === this.variant) return;
57
+ this.requestUpdate("variant", this.variant);
58
+ switch (variant) {
59
+ case "cta":
60
+ this._variant = "accent";
61
+ if (true) {
62
+ window.__swc.warn(
63
+ this,
64
+ `The "cta" value of the "variant" attribute on <${this.localName}> has been deprecated and will be removed in a future release. Use "variant='accent'" instead.`,
65
+ "https://opensource.adobe.com/spectrum-web-components/components/button/#variants",
66
+ { level: "deprecation" }
67
+ );
68
+ }
69
+ break;
70
+ case "overBackground":
71
+ this.removeAttribute("variant");
72
+ this.staticColor = "white";
73
+ this.treatment = "outline";
74
+ if (true) {
75
+ window.__swc.warn(
76
+ this,
77
+ `The "overBackground" value of the "variant" attribute on <${this.localName}> has been deprecated and will be removed in a future release. Use "staticColor='white'" with "treatment='outline'" instead.`,
78
+ "https://opensource.adobe.com/spectrum-web-components/components/button",
79
+ { level: "deprecation" }
80
+ );
81
+ }
82
+ return;
83
+ case "white":
84
+ this.staticColor = variant;
85
+ this.removeAttribute("variant");
86
+ if (true) {
87
+ window.__swc.warn(
88
+ this,
89
+ `The "black" and "white" values of the "variant" attribute on <${this.localName}> have been deprecated and will be removed in a future release. Use "static-color='black'" or "static-color='white'" instead.`,
90
+ "https://opensource.adobe.com/spectrum-web-components/components/button/api",
91
+ { level: "deprecation" }
92
+ );
93
+ }
94
+ return;
95
+ case "black":
96
+ this.staticColor = variant;
97
+ this.removeAttribute("variant");
98
+ if (true) {
99
+ window.__swc.warn(
100
+ this,
101
+ `The "black" and "white" values of the "variant" attribute on <${this.localName}> have been deprecated and will be removed in a future release. Use "static-color='black'" or "static-color='white'" instead.`,
102
+ "https://opensource.adobe.com/spectrum-web-components/components/button/api",
103
+ { level: "deprecation" }
104
+ );
105
+ }
106
+ return;
107
+ case null:
108
+ return;
109
+ default:
110
+ if (!VALID_VARIANTS.includes(variant)) {
111
+ this._variant = "accent";
112
+ } else {
113
+ this._variant = variant;
114
+ }
115
+ break;
116
+ }
117
+ this.setAttribute("variant", this.variant);
118
+ }
119
+ set quiet(quiet) {
120
+ this.treatment = quiet ? "outline" : "fill";
121
+ }
122
+ get quiet() {
123
+ return this.treatment === "outline";
124
+ }
125
+ firstUpdated(changes) {
126
+ super.firstUpdated(changes);
127
+ if (!this.hasAttribute("variant")) {
128
+ this.setAttribute("variant", this.variant);
129
+ }
130
+ if (this.pending) {
131
+ this.pendingStateController.hostUpdated();
132
+ }
133
+ }
134
+ renderButton() {
135
+ return html`
136
+ ${this.buttonContent}
137
+ ${this.pendingStateController.renderPendingState()}
138
+ `;
139
+ }
140
+ }
141
+ __decorateClass([
142
+ property({ type: String, attribute: "pending-label" })
143
+ ], Button.prototype, "pendingLabel", 2);
144
+ __decorateClass([
145
+ property({ type: Boolean, reflect: true, attribute: true })
146
+ ], Button.prototype, "pending", 2);
147
+ __decorateClass([
148
+ property()
149
+ ], Button.prototype, "variant", 1);
150
+ __decorateClass([
151
+ property({ reflect: true, attribute: "static-color" })
152
+ ], Button.prototype, "staticColor", 2);
153
+ __decorateClass([
154
+ property({ reflect: true })
155
+ ], Button.prototype, "treatment", 2);
156
+ __decorateClass([
157
+ property({ type: Boolean })
158
+ ], Button.prototype, "quiet", 1);
159
+ __decorateClass([
160
+ property({ type: Boolean, attribute: "no-wrap", reflect: true })
161
+ ], Button.prototype, "noWrap", 2);
162
+ //# sourceMappingURL=Button.dev.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["Button.ts"],
4
+ "sourcesContent": ["/*\nCopyright 2024 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 {\n CSSResultArray,\n html,\n PropertyValues,\n SizedMixin,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { ButtonBase } from './ButtonBase.dev.js'\nimport buttonStyles from './button.css.js';\nimport { PendingStateController } from '@spectrum-web-components/reactive-controllers/src/PendingState.js';\n\nexport type DeprecatedButtonVariants = 'cta' | 'overBackground';\nexport type ButtonStaticColors = 'white' | 'black';\nexport type ButtonVariants =\n | 'accent'\n | 'primary'\n | 'secondary'\n | 'negative'\n | ButtonStaticColors\n | DeprecatedButtonVariants;\nexport const VALID_VARIANTS = [\n 'accent',\n 'primary',\n 'secondary',\n 'negative',\n 'white',\n 'black',\n];\nexport const VALID_STATIC_COLORS = ['white', 'black'];\n\nexport type ButtonTreatments = 'fill' | 'outline';\n\n/**\n * @element sp-button\n *\n * @slot - text label of the Button\n * @slot icon - The icon to use for Button\n */\nexport class Button extends SizedMixin(ButtonBase, { noDefaultSize: true }) {\n public static override get styles(): CSSResultArray {\n return [...super.styles, buttonStyles];\n }\n\n @property({ type: String, attribute: 'pending-label' })\n public pendingLabel = 'Pending';\n\n // Use this property to set the button into a pending state\n @property({ type: Boolean, reflect: true, attribute: true })\n public pending = false;\n\n public pendingStateController: PendingStateController<this>;\n\n /**\n * Initializes the `PendingStateController` for the Button component.\n * The `PendingStateController` manages the pending state of the Button.\n */\n constructor() {\n super();\n this.pendingStateController = new PendingStateController(this);\n }\n\n public override click(): void {\n if (this.pending) {\n return;\n }\n super.click();\n }\n\n /**\n * The visual variant to apply to this button.\n */\n @property()\n public get variant(): ButtonVariants {\n return this._variant;\n }\n public set variant(variant: ButtonVariants) {\n if (variant === this.variant) return;\n\n this.requestUpdate('variant', this.variant);\n switch (variant) {\n case 'cta':\n this._variant = 'accent';\n if (window.__swc.DEBUG) {\n window.__swc.warn(\n this,\n `The \"cta\" value of the \"variant\" attribute on <${this.localName}> has been deprecated and will be removed in a future release. Use \"variant='accent'\" instead.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/button/#variants',\n { level: 'deprecation' }\n );\n }\n break;\n case 'overBackground':\n this.removeAttribute('variant');\n this.staticColor = 'white';\n this.treatment = 'outline';\n if (window.__swc.DEBUG) {\n window.__swc.warn(\n this,\n `The \"overBackground\" value of the \"variant\" attribute on <${this.localName}> has been deprecated and will be removed in a future release. Use \"staticColor='white'\" with \"treatment='outline'\" instead.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/button',\n { level: 'deprecation' }\n );\n }\n return;\n case 'white':\n this.staticColor = variant;\n this.removeAttribute('variant');\n if (window.__swc.DEBUG) {\n window.__swc.warn(\n this,\n `The \"black\" and \"white\" values of the \"variant\" attribute on <${this.localName}> have been deprecated and will be removed in a future release. Use \"static-color='black'\" or \"static-color='white'\" instead.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/button/api',\n { level: 'deprecation' }\n );\n }\n return;\n case 'black':\n this.staticColor = variant;\n this.removeAttribute('variant');\n if (window.__swc.DEBUG) {\n window.__swc.warn(\n this,\n `The \"black\" and \"white\" values of the \"variant\" attribute on <${this.localName}> have been deprecated and will be removed in a future release. Use \"static-color='black'\" or \"static-color='white'\" instead.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/button/api',\n { level: 'deprecation' }\n );\n }\n return;\n case null:\n return;\n default:\n if (!VALID_VARIANTS.includes(variant)) {\n this._variant = 'accent';\n } else {\n this._variant = variant;\n }\n break;\n }\n this.setAttribute('variant', this.variant);\n }\n private _variant: ButtonVariants = 'accent';\n\n /**\n * The static color variant to use for this button.\n */\n @property({ reflect: true, attribute: 'static-color' })\n public staticColor?: 'black' | 'white';\n\n /**\n * The visual treatment to apply to this button.\n */\n @property({ reflect: true })\n public treatment: ButtonTreatments = 'fill';\n\n /**\n * Style this button to be less obvious\n */\n @property({ type: Boolean })\n public set quiet(quiet: boolean) {\n this.treatment = quiet ? 'outline' : 'fill';\n }\n\n /**\n * Disables text wrapping within the button component's label.\n * Please note that this option is not a part of the design specification\n * and should be used carefully, with consideration of this overflow behavior\n * and the readability of the button's content.\n */\n @property({ type: Boolean, attribute: 'no-wrap', reflect: true })\n public noWrap = false;\n\n public get quiet(): boolean {\n return this.treatment === 'outline';\n }\n\n protected override firstUpdated(changes: PropertyValues<this>): void {\n super.firstUpdated(changes);\n // There is no Spectrum design context for an `<sp-button>` without a variant\n // apply one manually when a consumer has not applied one themselves.\n\n if (!this.hasAttribute('variant')) {\n this.setAttribute('variant', this.variant);\n }\n if (this.pending) {\n this.pendingStateController.hostUpdated();\n }\n }\n\n protected override renderButton(): TemplateResult {\n return html`\n ${this.buttonContent}\n ${this.pendingStateController.renderPendingState()}\n `;\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;AAWA;AAAA,EAEI;AAAA,EAEA;AAAA,OAEG;AACP,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAC3B,OAAO,kBAAkB;AACzB,SAAS,8BAA8B;AAWhC,aAAM,iBAAiB;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;AACO,aAAM,sBAAsB,CAAC,SAAS,OAAO;AAU7C,aAAM,eAAe,WAAW,YAAY,EAAE,eAAe,KAAK,CAAC,EAAE;AAAA;AAAA;AAAA;AAAA;AAAA,EAkBxE,cAAc;AACV,UAAM;AAbV,SAAO,eAAe;AAItB,SAAO,UAAU;AA4FjB,SAAQ,WAA2B;AAYnC,SAAO,YAA8B;AAiBrC,SAAO,SAAS;AA/GZ,SAAK,yBAAyB,IAAI,uBAAuB,IAAI;AAAA,EACjE;AAAA,EApBA,WAA2B,SAAyB;AAChD,WAAO,CAAC,GAAG,MAAM,QAAQ,YAAY;AAAA,EACzC;AAAA,EAoBgB,QAAc;AAC1B,QAAI,KAAK,SAAS;AACd;AAAA,IACJ;AACA,UAAM,MAAM;AAAA,EAChB;AAAA,EAMA,IAAW,UAA0B;AACjC,WAAO,KAAK;AAAA,EAChB;AAAA,EACA,IAAW,QAAQ,SAAyB;AACxC,QAAI,YAAY,KAAK,QAAS;AAE9B,SAAK,cAAc,WAAW,KAAK,OAAO;AAC1C,YAAQ,SAAS;AAAA,MACb,KAAK;AACD,aAAK,WAAW;AAChB,YAAI,MAAoB;AACpB,iBAAO,MAAM;AAAA,YACT;AAAA,YACA,kDAAkD,KAAK,SAAS;AAAA,YAChE;AAAA,YACA,EAAE,OAAO,cAAc;AAAA,UAC3B;AAAA,QACJ;AACA;AAAA,MACJ,KAAK;AACD,aAAK,gBAAgB,SAAS;AAC9B,aAAK,cAAc;AACnB,aAAK,YAAY;AACjB,YAAI,MAAoB;AACpB,iBAAO,MAAM;AAAA,YACT;AAAA,YACA,6DAA6D,KAAK,SAAS;AAAA,YAC3E;AAAA,YACA,EAAE,OAAO,cAAc;AAAA,UAC3B;AAAA,QACJ;AACA;AAAA,MACJ,KAAK;AACD,aAAK,cAAc;AACnB,aAAK,gBAAgB,SAAS;AAC9B,YAAI,MAAoB;AACpB,iBAAO,MAAM;AAAA,YACT;AAAA,YACA,iEAAiE,KAAK,SAAS;AAAA,YAC/E;AAAA,YACA,EAAE,OAAO,cAAc;AAAA,UAC3B;AAAA,QACJ;AACA;AAAA,MACJ,KAAK;AACD,aAAK,cAAc;AACnB,aAAK,gBAAgB,SAAS;AAC9B,YAAI,MAAoB;AACpB,iBAAO,MAAM;AAAA,YACT;AAAA,YACA,iEAAiE,KAAK,SAAS;AAAA,YAC/E;AAAA,YACA,EAAE,OAAO,cAAc;AAAA,UAC3B;AAAA,QACJ;AACA;AAAA,MACJ,KAAK;AACD;AAAA,MACJ;AACI,YAAI,CAAC,eAAe,SAAS,OAAO,GAAG;AACnC,eAAK,WAAW;AAAA,QACpB,OAAO;AACH,eAAK,WAAW;AAAA,QACpB;AACA;AAAA,IACR;AACA,SAAK,aAAa,WAAW,KAAK,OAAO;AAAA,EAC7C;AAAA,EAmBA,IAAW,MAAM,OAAgB;AAC7B,SAAK,YAAY,QAAQ,YAAY;AAAA,EACzC;AAAA,EAWA,IAAW,QAAiB;AACxB,WAAO,KAAK,cAAc;AAAA,EAC9B;AAAA,EAEmB,aAAa,SAAqC;AACjE,UAAM,aAAa,OAAO;AAI1B,QAAI,CAAC,KAAK,aAAa,SAAS,GAAG;AAC/B,WAAK,aAAa,WAAW,KAAK,OAAO;AAAA,IAC7C;AACA,QAAI,KAAK,SAAS;AACd,WAAK,uBAAuB,YAAY;AAAA,IAC5C;AAAA,EACJ;AAAA,EAEmB,eAA+B;AAC9C,WAAO;AAAA,cACD,KAAK,aAAa;AAAA,cAClB,KAAK,uBAAuB,mBAAmB,CAAC;AAAA;AAAA,EAE1D;AACJ;AAtJW;AAAA,EADN,SAAS,EAAE,MAAM,QAAQ,WAAW,gBAAgB,CAAC;AAAA,GAL7C,OAMF;AAIA;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,MAAM,WAAW,KAAK,CAAC;AAAA,GATlD,OAUF;AAwBI;AAAA,EADV,SAAS;AAAA,GAjCD,OAkCE;AA0EJ;AAAA,EADN,SAAS,EAAE,SAAS,MAAM,WAAW,eAAe,CAAC;AAAA,GA3G7C,OA4GF;AAMA;AAAA,EADN,SAAS,EAAE,SAAS,KAAK,CAAC;AAAA,GAjHlB,OAkHF;AAMI;AAAA,EADV,SAAS,EAAE,MAAM,QAAQ,CAAC;AAAA,GAvHlB,OAwHE;AAWJ;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,WAAW,WAAW,SAAS,KAAK,CAAC;AAAA,GAlIvD,OAmIF;",
6
+ "names": []
7
+ }
package/src/Button.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";var l=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var e=(o,i,t,n)=>{for(var r=n>1?void 0:n?u(i,t):i,s=o.length-1,c;s>=0;s--)(c=o[s])&&(r=(n?c(i,t,r):c(r))||r);return n&&r&&l(i,t,r),r};import{html as p,SizedMixin as d}from"@spectrum-web-components/base";import{property as a}from"@spectrum-web-components/base/src/decorators.js";import{ButtonBase as h}from"./ButtonBase.js";import b from"./button.css.js";import{PendingStateController as w}from"@spectrum-web-components/reactive-controllers/src/PendingState.js";export const VALID_VARIANTS=["accent","primary","secondary","negative","white","black"],VALID_STATIC_COLORS=["white","black"];export class Button extends d(h,{noDefaultSize:!0}){constructor(){super();this.pendingLabel="Pending";this.pending=!1;this._variant="accent";this.treatment="fill";this.noWrap=!1;this.pendingStateController=new w(this)}static get styles(){return[...super.styles,b]}click(){this.pending||super.click()}get variant(){return this._variant}set variant(t){if(t!==this.variant){switch(this.requestUpdate("variant",this.variant),t){case"cta":this._variant="accent";break;case"overBackground":this.removeAttribute("variant"),this.staticColor="white",this.treatment="outline";return;case"white":this.staticColor=t,this.removeAttribute("variant");return;case"black":this.staticColor=t,this.removeAttribute("variant");return;case null:return;default:VALID_VARIANTS.includes(t)?this._variant=t:this._variant="accent";break}this.setAttribute("variant",this.variant)}}set quiet(t){this.treatment=t?"outline":"fill"}get quiet(){return this.treatment==="outline"}firstUpdated(t){super.firstUpdated(t),this.hasAttribute("variant")||this.setAttribute("variant",this.variant),this.pending&&this.pendingStateController.hostUpdated()}renderButton(){return p`
2
+ ${this.buttonContent}
3
+ ${this.pendingStateController.renderPendingState()}
4
+ `}}e([a({type:String,attribute:"pending-label"})],Button.prototype,"pendingLabel",2),e([a({type:Boolean,reflect:!0,attribute:!0})],Button.prototype,"pending",2),e([a()],Button.prototype,"variant",1),e([a({reflect:!0,attribute:"static-color"})],Button.prototype,"staticColor",2),e([a({reflect:!0})],Button.prototype,"treatment",2),e([a({type:Boolean})],Button.prototype,"quiet",1),e([a({type:Boolean,attribute:"no-wrap",reflect:!0})],Button.prototype,"noWrap",2);
5
+ //# sourceMappingURL=Button.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["Button.ts"],
4
+ "sourcesContent": ["/*\nCopyright 2024 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 {\n CSSResultArray,\n html,\n PropertyValues,\n SizedMixin,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { ButtonBase } from './ButtonBase.js';\nimport buttonStyles from './button.css.js';\nimport { PendingStateController } from '@spectrum-web-components/reactive-controllers/src/PendingState.js';\n\nexport type DeprecatedButtonVariants = 'cta' | 'overBackground';\nexport type ButtonStaticColors = 'white' | 'black';\nexport type ButtonVariants =\n | 'accent'\n | 'primary'\n | 'secondary'\n | 'negative'\n | ButtonStaticColors\n | DeprecatedButtonVariants;\nexport const VALID_VARIANTS = [\n 'accent',\n 'primary',\n 'secondary',\n 'negative',\n 'white',\n 'black',\n];\nexport const VALID_STATIC_COLORS = ['white', 'black'];\n\nexport type ButtonTreatments = 'fill' | 'outline';\n\n/**\n * @element sp-button\n *\n * @slot - text label of the Button\n * @slot icon - The icon to use for Button\n */\nexport class Button extends SizedMixin(ButtonBase, { noDefaultSize: true }) {\n public static override get styles(): CSSResultArray {\n return [...super.styles, buttonStyles];\n }\n\n @property({ type: String, attribute: 'pending-label' })\n public pendingLabel = 'Pending';\n\n // Use this property to set the button into a pending state\n @property({ type: Boolean, reflect: true, attribute: true })\n public pending = false;\n\n public pendingStateController: PendingStateController<this>;\n\n /**\n * Initializes the `PendingStateController` for the Button component.\n * The `PendingStateController` manages the pending state of the Button.\n */\n constructor() {\n super();\n this.pendingStateController = new PendingStateController(this);\n }\n\n public override click(): void {\n if (this.pending) {\n return;\n }\n super.click();\n }\n\n /**\n * The visual variant to apply to this button.\n */\n @property()\n public get variant(): ButtonVariants {\n return this._variant;\n }\n public set variant(variant: ButtonVariants) {\n if (variant === this.variant) return;\n\n this.requestUpdate('variant', this.variant);\n switch (variant) {\n case 'cta':\n this._variant = 'accent';\n if (window.__swc.DEBUG) {\n window.__swc.warn(\n this,\n `The \"cta\" value of the \"variant\" attribute on <${this.localName}> has been deprecated and will be removed in a future release. Use \"variant='accent'\" instead.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/button/#variants',\n { level: 'deprecation' }\n );\n }\n break;\n case 'overBackground':\n this.removeAttribute('variant');\n this.staticColor = 'white';\n this.treatment = 'outline';\n if (window.__swc.DEBUG) {\n window.__swc.warn(\n this,\n `The \"overBackground\" value of the \"variant\" attribute on <${this.localName}> has been deprecated and will be removed in a future release. Use \"staticColor='white'\" with \"treatment='outline'\" instead.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/button',\n { level: 'deprecation' }\n );\n }\n return;\n case 'white':\n this.staticColor = variant;\n this.removeAttribute('variant');\n if (window.__swc.DEBUG) {\n window.__swc.warn(\n this,\n `The \"black\" and \"white\" values of the \"variant\" attribute on <${this.localName}> have been deprecated and will be removed in a future release. Use \"static-color='black'\" or \"static-color='white'\" instead.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/button/api',\n { level: 'deprecation' }\n );\n }\n return;\n case 'black':\n this.staticColor = variant;\n this.removeAttribute('variant');\n if (window.__swc.DEBUG) {\n window.__swc.warn(\n this,\n `The \"black\" and \"white\" values of the \"variant\" attribute on <${this.localName}> have been deprecated and will be removed in a future release. Use \"static-color='black'\" or \"static-color='white'\" instead.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/button/api',\n { level: 'deprecation' }\n );\n }\n return;\n case null:\n return;\n default:\n if (!VALID_VARIANTS.includes(variant)) {\n this._variant = 'accent';\n } else {\n this._variant = variant;\n }\n break;\n }\n this.setAttribute('variant', this.variant);\n }\n private _variant: ButtonVariants = 'accent';\n\n /**\n * The static color variant to use for this button.\n */\n @property({ reflect: true, attribute: 'static-color' })\n public staticColor?: 'black' | 'white';\n\n /**\n * The visual treatment to apply to this button.\n */\n @property({ reflect: true })\n public treatment: ButtonTreatments = 'fill';\n\n /**\n * Style this button to be less obvious\n */\n @property({ type: Boolean })\n public set quiet(quiet: boolean) {\n this.treatment = quiet ? 'outline' : 'fill';\n }\n\n /**\n * Disables text wrapping within the button component's label.\n * Please note that this option is not a part of the design specification\n * and should be used carefully, with consideration of this overflow behavior\n * and the readability of the button's content.\n */\n @property({ type: Boolean, attribute: 'no-wrap', reflect: true })\n public noWrap = false;\n\n public get quiet(): boolean {\n return this.treatment === 'outline';\n }\n\n protected override firstUpdated(changes: PropertyValues<this>): void {\n super.firstUpdated(changes);\n // There is no Spectrum design context for an `<sp-button>` without a variant\n // apply one manually when a consumer has not applied one themselves.\n\n if (!this.hasAttribute('variant')) {\n this.setAttribute('variant', this.variant);\n }\n if (this.pending) {\n this.pendingStateController.hostUpdated();\n }\n }\n\n protected override renderButton(): TemplateResult {\n return html`\n ${this.buttonContent}\n ${this.pendingStateController.renderPendingState()}\n `;\n }\n}\n"],
5
+ "mappings": "qNAWA,OAEI,QAAAA,EAEA,cAAAC,MAEG,gCACP,OAAS,YAAAC,MAAgB,kDACzB,OAAS,cAAAC,MAAkB,kBAC3B,OAAOC,MAAkB,kBACzB,OAAS,0BAAAC,MAA8B,oEAWhC,aAAM,eAAiB,CAC1B,SACA,UACA,YACA,WACA,QACA,OACJ,EACa,oBAAsB,CAAC,QAAS,OAAO,EAU7C,aAAM,eAAeJ,EAAWE,EAAY,CAAE,cAAe,EAAK,CAAC,CAAE,CAkBxE,aAAc,CACV,MAAM,EAbV,KAAO,aAAe,UAItB,KAAO,QAAU,GA4FjB,KAAQ,SAA2B,SAYnC,KAAO,UAA8B,OAiBrC,KAAO,OAAS,GA/GZ,KAAK,uBAAyB,IAAIE,EAAuB,IAAI,CACjE,CApBA,WAA2B,QAAyB,CAChD,MAAO,CAAC,GAAG,MAAM,OAAQD,CAAY,CACzC,CAoBgB,OAAc,CACtB,KAAK,SAGT,MAAM,MAAM,CAChB,CAMA,IAAW,SAA0B,CACjC,OAAO,KAAK,QAChB,CACA,IAAW,QAAQE,EAAyB,CACxC,GAAIA,IAAY,KAAK,QAGrB,QADA,KAAK,cAAc,UAAW,KAAK,OAAO,EAClCA,EAAS,CACb,IAAK,MACD,KAAK,SAAW,SAShB,MACJ,IAAK,iBACD,KAAK,gBAAgB,SAAS,EAC9B,KAAK,YAAc,QACnB,KAAK,UAAY,UASjB,OACJ,IAAK,QACD,KAAK,YAAcA,EACnB,KAAK,gBAAgB,SAAS,EAS9B,OACJ,IAAK,QACD,KAAK,YAAcA,EACnB,KAAK,gBAAgB,SAAS,EAS9B,OACJ,KAAK,KACD,OACJ,QACS,eAAe,SAASA,CAAO,EAGhC,KAAK,SAAWA,EAFhB,KAAK,SAAW,SAIpB,KACR,CACA,KAAK,aAAa,UAAW,KAAK,OAAO,EAC7C,CAmBA,IAAW,MAAMC,EAAgB,CAC7B,KAAK,UAAYA,EAAQ,UAAY,MACzC,CAWA,IAAW,OAAiB,CACxB,OAAO,KAAK,YAAc,SAC9B,CAEmB,aAAaC,EAAqC,CACjE,MAAM,aAAaA,CAAO,EAIrB,KAAK,aAAa,SAAS,GAC5B,KAAK,aAAa,UAAW,KAAK,OAAO,EAEzC,KAAK,SACL,KAAK,uBAAuB,YAAY,CAEhD,CAEmB,cAA+B,CAC9C,OAAOR;AAAA,cACD,KAAK,aAAa;AAAA,cAClB,KAAK,uBAAuB,mBAAmB,CAAC;AAAA,SAE1D,CACJ,CAtJWS,EAAA,CADNP,EAAS,CAAE,KAAM,OAAQ,UAAW,eAAgB,CAAC,GAL7C,OAMF,4BAIAO,EAAA,CADNP,EAAS,CAAE,KAAM,QAAS,QAAS,GAAM,UAAW,EAAK,CAAC,GATlD,OAUF,uBAwBIO,EAAA,CADVP,EAAS,GAjCD,OAkCE,uBA0EJO,EAAA,CADNP,EAAS,CAAE,QAAS,GAAM,UAAW,cAAe,CAAC,GA3G7C,OA4GF,2BAMAO,EAAA,CADNP,EAAS,CAAE,QAAS,EAAK,CAAC,GAjHlB,OAkHF,yBAMIO,EAAA,CADVP,EAAS,CAAE,KAAM,OAAQ,CAAC,GAvHlB,OAwHE,qBAWJO,EAAA,CADNP,EAAS,CAAE,KAAM,QAAS,UAAW,UAAW,QAAS,EAAK,CAAC,GAlIvD,OAmIF",
6
+ "names": ["html", "SizedMixin", "property", "ButtonBase", "buttonStyles", "PendingStateController", "variant", "quiet", "changes", "__decorateClass"]
7
+ }
@@ -0,0 +1,44 @@
1
+ import { CSSResultArray, PropertyValues, TemplateResult } from '@spectrum-web-components/base';
2
+ import { Focusable } from '@spectrum-web-components/shared/src/focusable.js';
3
+ declare const ButtonBase_base: typeof Focusable & {
4
+ new (...args: any[]): import("@spectrum-web-components/shared/src/like-anchor.js").LikeAnchorInterface;
5
+ prototype: import("@spectrum-web-components/shared/src/like-anchor.js").LikeAnchorInterface;
6
+ } & {
7
+ new (...args: any[]): import("@spectrum-web-components/shared/src/observe-slot-text.js").SlotTextObservingInterface;
8
+ prototype: import("@spectrum-web-components/shared/src/observe-slot-text.js").SlotTextObservingInterface;
9
+ };
10
+ /**
11
+ * @slot - text content to be displayed in the Button element
12
+ * @slot icon - icon element(s) to display at the start of the button
13
+ */
14
+ export declare class ButtonBase extends ButtonBase_base {
15
+ static get styles(): CSSResultArray;
16
+ active: boolean;
17
+ /**
18
+ * The default behavior of the button.
19
+ * Possible values are: `button` (default), `submit`, and `reset`.
20
+ */
21
+ type: 'button' | 'submit' | 'reset';
22
+ /**
23
+ * HTML anchor element that component clicks by proxy
24
+ */
25
+ private anchorElement;
26
+ get focusElement(): HTMLElement;
27
+ protected get hasLabel(): boolean;
28
+ protected get buttonContent(): TemplateResult[];
29
+ constructor();
30
+ private handleClickCapture;
31
+ private proxyFocus;
32
+ private shouldProxyClick;
33
+ renderAnchor(): TemplateResult;
34
+ protected renderButton(): TemplateResult;
35
+ protected render(): TemplateResult;
36
+ protected handleKeydown(event: KeyboardEvent): void;
37
+ private handleKeypress;
38
+ protected handleKeyup(event: KeyboardEvent): void;
39
+ private manageAnchor;
40
+ protected firstUpdated(changed: PropertyValues): void;
41
+ protected updated(changed: PropertyValues): void;
42
+ protected update(changes: PropertyValues): void;
43
+ }
44
+ export {};