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

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 (121) hide show
  1. package/custom-elements.json +442 -24
  2. package/package.json +10 -6
  3. package/sp-close-button.d.ts +6 -0
  4. package/sp-close-button.js +14 -0
  5. package/sp-close-button.js.map +1 -0
  6. package/src/Button.d.ts +13 -6
  7. package/src/Button.js +57 -15
  8. package/src/Button.js.map +1 -1
  9. package/src/ClearButton.js +28 -9
  10. package/src/ClearButton.js.map +1 -1
  11. package/src/CloseButton.d.ts +26 -0
  12. package/src/CloseButton.js +72 -0
  13. package/src/CloseButton.js.map +1 -0
  14. package/src/button.css.js +560 -470
  15. package/src/button.css.js.map +1 -1
  16. package/src/index.d.ts +1 -0
  17. package/src/index.js +1 -0
  18. package/src/index.js.map +1 -1
  19. package/src/spectrum-button.css.js +560 -470
  20. package/src/spectrum-button.css.js.map +1 -1
  21. package/src/spectrum-config.js +20 -76
  22. package/stories/button-accent-fill-sizes.stories.js +28 -0
  23. package/stories/button-accent-fill-sizes.stories.js.map +1 -0
  24. package/stories/button-accent-fill.stories.js +28 -0
  25. package/stories/button-accent-fill.stories.js.map +1 -0
  26. package/stories/button-accent-outline-sizes.stories.js +28 -0
  27. package/stories/button-accent-outline-sizes.stories.js.map +1 -0
  28. package/stories/button-accent-outline.stories.js +28 -0
  29. package/stories/button-accent-outline.stories.js.map +1 -0
  30. package/stories/button-black-fill-sizes.stories.js +29 -0
  31. package/stories/button-black-fill-sizes.stories.js.map +1 -0
  32. package/stories/button-black-fill.stories.js +29 -0
  33. package/stories/button-black-fill.stories.js.map +1 -0
  34. package/stories/button-black-outline-sizes.stories.js +29 -0
  35. package/stories/button-black-outline-sizes.stories.js.map +1 -0
  36. package/stories/button-black-outline.stories.js +29 -0
  37. package/stories/button-black-outline.stories.js.map +1 -0
  38. package/stories/button-negative-fill-sizes.stories.js +28 -0
  39. package/stories/button-negative-fill-sizes.stories.js.map +1 -0
  40. package/stories/button-negative-fill.stories.js +28 -0
  41. package/stories/button-negative-fill.stories.js.map +1 -0
  42. package/stories/button-negative-outline-sizes.stories.js +28 -0
  43. package/stories/button-negative-outline-sizes.stories.js.map +1 -0
  44. package/stories/button-negative-outline.stories.js +28 -0
  45. package/stories/button-negative-outline.stories.js.map +1 -0
  46. package/stories/button-primary-fill-sizes.stories.js +28 -0
  47. package/stories/button-primary-fill-sizes.stories.js.map +1 -0
  48. package/stories/button-primary-fill.stories.js +28 -0
  49. package/stories/button-primary-fill.stories.js.map +1 -0
  50. package/stories/button-primary-outline-sizes.stories.js +28 -0
  51. package/stories/button-primary-outline-sizes.stories.js.map +1 -0
  52. package/stories/button-primary-outline.stories.js +28 -0
  53. package/stories/button-primary-outline.stories.js.map +1 -0
  54. package/stories/button-secondary-fill-sizes.stories.js +28 -0
  55. package/stories/button-secondary-fill-sizes.stories.js.map +1 -0
  56. package/stories/button-secondary-fill.stories.js +28 -0
  57. package/stories/button-secondary-fill.stories.js.map +1 -0
  58. package/stories/button-secondary-outline-sizes.stories.js +28 -0
  59. package/stories/button-secondary-outline-sizes.stories.js.map +1 -0
  60. package/stories/button-secondary-outline.stories.js +28 -0
  61. package/stories/button-secondary-outline.stories.js.map +1 -0
  62. package/stories/button-white-fill-sizes.stories.js +29 -0
  63. package/stories/button-white-fill-sizes.stories.js.map +1 -0
  64. package/stories/button-white-fill.stories.js +29 -0
  65. package/stories/button-white-fill.stories.js.map +1 -0
  66. package/stories/button-white-outline-sizes.stories.js +29 -0
  67. package/stories/button-white-outline-sizes.stories.js.map +1 -0
  68. package/stories/button-white-outline.stories.js +29 -0
  69. package/stories/button-white-outline.stories.js.map +1 -0
  70. package/stories/index.js +112 -7
  71. package/stories/index.js.map +1 -1
  72. package/test/button-accent-fill-sizes.test-vrt.js +15 -0
  73. package/test/button-accent-fill-sizes.test-vrt.js.map +1 -0
  74. package/test/button-accent-fill.test-vrt.js +15 -0
  75. package/test/button-accent-fill.test-vrt.js.map +1 -0
  76. package/test/button-accent-outline-sizes.test-vrt.js +15 -0
  77. package/test/button-accent-outline-sizes.test-vrt.js.map +1 -0
  78. package/test/button-accent-outline.test-vrt.js +15 -0
  79. package/test/button-accent-outline.test-vrt.js.map +1 -0
  80. package/test/button-black-fill-sizes.test-vrt.js +15 -0
  81. package/test/button-black-fill-sizes.test-vrt.js.map +1 -0
  82. package/test/button-black-fill.test-vrt.js +15 -0
  83. package/test/button-black-fill.test-vrt.js.map +1 -0
  84. package/test/button-black-outline-sizes.test-vrt.js +15 -0
  85. package/test/button-black-outline-sizes.test-vrt.js.map +1 -0
  86. package/test/button-black-outline.test-vrt.js +15 -0
  87. package/test/button-black-outline.test-vrt.js.map +1 -0
  88. package/test/button-negative-fill-sizes.test-vrt.js +15 -0
  89. package/test/button-negative-fill-sizes.test-vrt.js.map +1 -0
  90. package/test/button-negative-fill.test-vrt.js +15 -0
  91. package/test/button-negative-fill.test-vrt.js.map +1 -0
  92. package/test/button-negative-outline-sizes.test-vrt.js +15 -0
  93. package/test/button-negative-outline-sizes.test-vrt.js.map +1 -0
  94. package/test/button-negative-outline.test-vrt.js +15 -0
  95. package/test/button-negative-outline.test-vrt.js.map +1 -0
  96. package/test/button-primary-fill-sizes.test-vrt.js +15 -0
  97. package/test/button-primary-fill-sizes.test-vrt.js.map +1 -0
  98. package/test/button-primary-fill.test-vrt.js +15 -0
  99. package/test/button-primary-fill.test-vrt.js.map +1 -0
  100. package/test/button-primary-outline-sizes.test-vrt.js +15 -0
  101. package/test/button-primary-outline-sizes.test-vrt.js.map +1 -0
  102. package/test/button-primary-outline.test-vrt.js +15 -0
  103. package/test/button-primary-outline.test-vrt.js.map +1 -0
  104. package/test/button-secondary-fill-sizes.test-vrt.js +15 -0
  105. package/test/button-secondary-fill-sizes.test-vrt.js.map +1 -0
  106. package/test/button-secondary-fill.test-vrt.js +15 -0
  107. package/test/button-secondary-fill.test-vrt.js.map +1 -0
  108. package/test/button-secondary-outline-sizes.test-vrt.js +15 -0
  109. package/test/button-secondary-outline-sizes.test-vrt.js.map +1 -0
  110. package/test/button-secondary-outline.test-vrt.js +15 -0
  111. package/test/button-secondary-outline.test-vrt.js.map +1 -0
  112. package/test/button-white-fill-sizes.test-vrt.js +15 -0
  113. package/test/button-white-fill-sizes.test-vrt.js.map +1 -0
  114. package/test/button-white-fill.test-vrt.js +15 -0
  115. package/test/button-white-fill.test-vrt.js.map +1 -0
  116. package/test/button-white-outline-sizes.test-vrt.js +15 -0
  117. package/test/button-white-outline-sizes.test-vrt.js.map +1 -0
  118. package/test/button-white-outline.test-vrt.js +15 -0
  119. package/test/button-white-outline.test-vrt.js.map +1 -0
  120. package/test/button.test.js +390 -0
  121. package/test/button.test.js.map +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectrum-web-components/button",
3
- "version": "0.16.4",
3
+ "version": "0.16.5-express.9+abfee7409",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -26,7 +26,9 @@
26
26
  "./sp-button": "./sp-button.js",
27
27
  "./sp-button.js": "./sp-button.js",
28
28
  "./sp-clear-button": "./sp-clear-button.js",
29
- "./sp-clear-button.js": "./sp-clear-button.js"
29
+ "./sp-clear-button.js": "./sp-clear-button.js",
30
+ "./sp-close-button": "./sp-close-button.js",
31
+ "./sp-close-button.js": "./sp-close-button.js"
30
32
  },
31
33
  "scripts": {
32
34
  "test": "echo \"Error: run tests from mono-repo root.\" && exit 1"
@@ -47,18 +49,20 @@
47
49
  ],
48
50
  "dependencies": {
49
51
  "@spectrum-web-components/base": "^0.5.2",
50
- "@spectrum-web-components/icon": "^0.11.3",
51
- "@spectrum-web-components/icons-ui": "^0.8.3",
52
+ "@spectrum-web-components/clear-button": "^0.0.2-express.2380+abfee7409",
53
+ "@spectrum-web-components/close-button": "^0.0.2-express.2380+abfee7409",
54
+ "@spectrum-web-components/icon": "^0.11.4-express.9+abfee7409",
55
+ "@spectrum-web-components/icons-ui": "^0.8.4-express.9+abfee7409",
52
56
  "@spectrum-web-components/shared": "^0.13.4",
53
57
  "tslib": "^2.0.0"
54
58
  },
55
59
  "devDependencies": {
56
- "@spectrum-css/button": "^4.1.4"
60
+ "@spectrum-css/button": "^6.0.3"
57
61
  },
58
62
  "types": "./src/index.d.ts",
59
63
  "customElements": "custom-elements.json",
60
64
  "sideEffects": [
61
65
  "./sp-*.js"
62
66
  ],
63
- "gitHead": "bb5308b9be01cc7c5bbab289312042256bdcc740"
67
+ "gitHead": "abfee740957976448a3e4cf90df17d6165f857d6"
64
68
  }
@@ -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,14 @@
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 { CloseButton } from './src/CloseButton.js';
13
+ customElements.define('sp-close-button', CloseButton);
14
+ //# sourceMappingURL=sp-close-button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sp-close-button.js","sourceRoot":"","sources":["sp-close-button.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,cAAc,CAAC,MAAM,CAAC,iBAAiB,EAAE,WAAW,CAAC,CAAC","sourcesContent":["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { CloseButton } from './src/CloseButton.js';\n\ncustomElements.define('sp-close-button', CloseButton);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-close-button': CloseButton;\n }\n}\n"]}
package/src/Button.d.ts CHANGED
@@ -1,6 +1,10 @@
1
- import { CSSResultArray } from '@spectrum-web-components/base';
1
+ import { CSSResultArray, PropertyValues } from '@spectrum-web-components/base';
2
2
  import { StyledButton } from './StyledButton.js';
3
- export declare type ButtonVariants = 'cta' | 'overBackground' | 'primary' | 'secondary' | 'negative';
3
+ export declare type DeprecatedButtonVariants = 'cta' | 'overBackground';
4
+ export declare type ButtonStatics = 'white' | 'black';
5
+ export declare type ButtonVariants = 'accent' | 'primary' | 'secondary' | 'negative' | ButtonStatics | DeprecatedButtonVariants;
6
+ export declare const VALID_VARIANTS: string[];
7
+ export declare type ButtonTreatments = 'fill' | 'outline';
4
8
  declare const Button_base: typeof StyledButton & {
5
9
  new (...args: any[]): import("@spectrum-web-components/base").SizedElementInterface;
6
10
  prototype: import("@spectrum-web-components/base").SizedElementInterface;
@@ -16,14 +20,17 @@ export declare class Button extends Button_base {
16
20
  /**
17
21
  * The visual variant to apply to this button.
18
22
  */
19
- variant: ButtonVariants;
23
+ get variant(): ButtonVariants;
24
+ set variant(variant: ButtonVariants);
25
+ private _variant;
20
26
  /**
21
- * There is a warning in place for this control
27
+ * The visual variant to apply to this button.
22
28
  */
23
- warning: boolean;
29
+ treatment: ButtonTreatments;
24
30
  /**
25
31
  * Style this button to be less obvious
26
32
  */
27
- quiet: boolean;
33
+ set quiet(quiet: boolean);
34
+ protected firstUpdated(changes: PropertyValues<this>): void;
28
35
  }
29
36
  export {};
package/src/Button.js CHANGED
@@ -10,10 +10,18 @@ OF ANY KIND, either express or implied. See the License for the specific languag
10
10
  governing permissions and limitations under the License.
11
11
  */
12
12
  import { __decorate } from "tslib";
13
- import { SizedMixin } from '@spectrum-web-components/base';
13
+ import { SizedMixin, } from '@spectrum-web-components/base';
14
14
  import { property } from '@spectrum-web-components/base/src/decorators.js';
15
15
  import { StyledButton } from './StyledButton.js';
16
16
  import buttonStyles from './button.css.js';
17
+ export const VALID_VARIANTS = [
18
+ 'accent',
19
+ 'primary',
20
+ 'secondary',
21
+ 'negative',
22
+ 'white',
23
+ 'black',
24
+ ];
17
25
  /**
18
26
  * @element sp-button
19
27
  *
@@ -23,30 +31,64 @@ import buttonStyles from './button.css.js';
23
31
  export class Button extends SizedMixin(StyledButton) {
24
32
  constructor() {
25
33
  super(...arguments);
34
+ this._variant = 'accent';
26
35
  /**
27
36
  * The visual variant to apply to this button.
28
37
  */
29
- this.variant = 'cta';
30
- /**
31
- * There is a warning in place for this control
32
- */
33
- this.warning = false;
34
- /**
35
- * Style this button to be less obvious
36
- */
37
- this.quiet = false;
38
+ this.treatment = 'fill';
38
39
  }
39
40
  static get styles() {
40
41
  return [...super.styles, buttonStyles];
41
42
  }
43
+ /**
44
+ * The visual variant to apply to this button.
45
+ */
46
+ get variant() {
47
+ return this._variant;
48
+ }
49
+ set variant(variant) {
50
+ if (variant === this.variant)
51
+ return;
52
+ this.requestUpdate('variant', this.variant);
53
+ switch (variant) {
54
+ case 'cta':
55
+ this._variant = 'accent';
56
+ break;
57
+ case 'overBackground':
58
+ this._variant = 'white';
59
+ this.treatment = 'outline';
60
+ break;
61
+ default:
62
+ if (!VALID_VARIANTS.includes(variant)) {
63
+ this._variant = 'accent';
64
+ }
65
+ else {
66
+ this._variant = variant;
67
+ }
68
+ break;
69
+ }
70
+ this.setAttribute('variant', this.variant);
71
+ }
72
+ /**
73
+ * Style this button to be less obvious
74
+ */
75
+ set quiet(quiet) {
76
+ this.treatment = quiet ? 'outline' : 'fill';
77
+ }
78
+ firstUpdated(changes) {
79
+ super.firstUpdated(changes);
80
+ if (!this.hasAttribute('variant')) {
81
+ this.setAttribute('variant', this.variant);
82
+ }
83
+ }
42
84
  }
43
85
  __decorate([
44
86
  property({ reflect: true })
45
- ], Button.prototype, "variant", void 0);
87
+ ], Button.prototype, "variant", null);
46
88
  __decorate([
47
- property({ type: Boolean, reflect: true })
48
- ], Button.prototype, "warning", void 0);
89
+ property({ reflect: true })
90
+ ], Button.prototype, "treatment", void 0);
49
91
  __decorate([
50
- property({ type: Boolean, reflect: true })
51
- ], Button.prototype, "quiet", void 0);
92
+ property({ type: Boolean })
93
+ ], Button.prototype, "quiet", null);
52
94
  //# sourceMappingURL=Button.js.map
package/src/Button.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sourceRoot":"","sources":["Button.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;;AAEF,OAAO,EAAkB,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,MAAM,iDAAiD,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAS3C;;;;;GAKG;AACH,MAAM,OAAO,MAAO,SAAQ,UAAU,CAAC,YAAY,CAAC;IAApD;;QAKI;;WAEG;QAEI,YAAO,GAAmB,KAAK,CAAC;QAEvC;;WAEG;QAEI,YAAO,GAAG,KAAK,CAAC;QAEvB;;WAEG;QAEI,UAAK,GAAG,KAAK,CAAC;IACzB,CAAC;IArBU,MAAM,KAAK,MAAM;QACpB,OAAO,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAC3C,CAAC;CAmBJ;AAbG;IADC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;uCACW;AAMvC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;uCACpB;AAMvB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;qCACtB","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, SizedMixin } from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { StyledButton } from './StyledButton.js';\nimport buttonStyles from './button.css.js';\n\nexport type ButtonVariants =\n | 'cta'\n | 'overBackground'\n | 'primary'\n | 'secondary'\n | 'negative';\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(StyledButton) {\n public static get styles(): CSSResultArray {\n return [...super.styles, buttonStyles];\n }\n\n /**\n * The visual variant to apply to this button.\n */\n @property({ reflect: true })\n public variant: ButtonVariants = 'cta';\n\n /**\n * There is a warning in place for this control\n */\n @property({ type: Boolean, reflect: true })\n public warning = false;\n\n /**\n * Style this button to be less obvious\n */\n @property({ type: Boolean, reflect: true })\n public quiet = false;\n}\n"]}
1
+ {"version":3,"file":"Button.js","sourceRoot":"","sources":["Button.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;;AAEF,OAAO,EAGH,UAAU,GACb,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,iDAAiD,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAW3C,MAAM,CAAC,MAAM,cAAc,GAAG;IAC1B,QAAQ;IACR,SAAS;IACT,WAAW;IACX,UAAU;IACV,OAAO;IACP,OAAO;CACV,CAAC;AAIF;;;;;GAKG;AACH,MAAM,OAAO,MAAO,SAAQ,UAAU,CAAC,YAAY,CAAC;IAApD;;QAkCY,aAAQ,GAAmB,QAAQ,CAAC;QAE5C;;WAEG;QAEI,cAAS,GAAqB,MAAM,CAAC;IAgBhD,CAAC;IAvDU,MAAM,KAAK,MAAM;QACpB,OAAO,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAC3C,CAAC;IAED;;OAEG;IAEH,IAAW,OAAO;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IACD,IAAW,OAAO,CAAC,OAAuB;QACtC,IAAI,OAAO,KAAK,IAAI,CAAC,OAAO;YAAE,OAAO;QAErC,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC5C,QAAQ,OAAO,EAAE;YACb,KAAK,KAAK;gBACN,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;gBACzB,MAAM;YACV,KAAK,gBAAgB;gBACjB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;gBACxB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;gBAC3B,MAAM;YACV;gBACI,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;oBACnC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;iBAC5B;qBAAM;oBACH,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;iBAC3B;gBACD,MAAM;SACb;QACD,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/C,CAAC;IASD;;OAEG;IAEH,IAAW,KAAK,CAAC,KAAc;QAC3B,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;IAChD,CAAC;IAES,YAAY,CAAC,OAA6B;QAChD,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAC5B,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE;YAC/B,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;SAC9C;IACL,CAAC;CACJ;AA/CG;IADC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;qCAG3B;AA6BD;IADC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yCACgB;AAM5C;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;mCAG3B","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 PropertyValues,\n SizedMixin,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { StyledButton } from './StyledButton.js';\nimport buttonStyles from './button.css.js';\n\nexport type DeprecatedButtonVariants = 'cta' | 'overBackground';\nexport type ButtonStatics = 'white' | 'black';\nexport type ButtonVariants =\n | 'accent'\n | 'primary'\n | 'secondary'\n | 'negative'\n | ButtonStatics\n | DeprecatedButtonVariants;\nexport const VALID_VARIANTS = [\n 'accent',\n 'primary',\n 'secondary',\n 'negative',\n 'white',\n 'black',\n];\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(StyledButton) {\n public static get styles(): CSSResultArray {\n return [...super.styles, buttonStyles];\n }\n\n /**\n * The visual variant to apply to this button.\n */\n @property({ reflect: true })\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 break;\n case 'overBackground':\n this._variant = 'white';\n this.treatment = 'outline';\n break;\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 visual variant 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 protected firstUpdated(changes: PropertyValues<this>): void {\n super.firstUpdated(changes);\n if (!this.hasAttribute('variant')) {\n this.setAttribute('variant', this.variant);\n }\n }\n}\n"]}
@@ -13,9 +13,35 @@ import { __decorate } from "tslib";
13
13
  import { html, SizedMixin, } from '@spectrum-web-components/base';
14
14
  import { property } from '@spectrum-web-components/base/src/decorators.js';
15
15
  import { StyledButton } from './StyledButton.js';
16
- import buttonStyles from './clear-button.css.js';
16
+ import buttonStyles from '@spectrum-web-components/clear-button/src/clear-button.css.js';
17
17
  import '@spectrum-web-components/icons-ui/icons/sp-icon-cross75.js';
18
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
+ };
19
45
  /**
20
46
  * @element sp-clear-button
21
47
  *
@@ -34,14 +60,7 @@ export class ClearButton extends SizedMixin(StyledButton) {
34
60
  return [...super.styles, buttonStyles, crossMediumStyles];
35
61
  }
36
62
  get buttonContent() {
37
- return [
38
- html `
39
- <sp-icon-cross75
40
- slot="icon"
41
- class="icon spectrum-UIIcon-Cross75"
42
- ></sp-icon-cross75>
43
- `,
44
- ];
63
+ return [crossIcon[this.size]()];
45
64
  }
46
65
  render() {
47
66
  return html `
@@ -1 +1 @@
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,uBAAuB,CAAC;AACjD,OAAO,4DAA4D,CAAC;AACpE,OAAO,iBAAiB,MAAM,8DAA8D,CAAC;AAE7F;;;;;GAKG;AACH,MAAM,OAAO,WAAY,SAAQ,UAAU,CAAC,YAAY,CAAC;IAAzD;;QAKI;;WAEG;QAEI,YAAO,GAA0B,EAAE,CAAC;IAkB/C,CAAC;IA1BU,MAAM,KAAK,MAAM;QACpB,OAAO,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,YAAY,EAAE,iBAAiB,CAAC,CAAC;IAC9D,CAAC;IAQD,IAAc,aAAa;QACvB,OAAO;YACH,IAAI,CAAA;;;;;aAKH;SACJ,CAAC;IACN,CAAC;IAES,MAAM;QACZ,OAAO,IAAI,CAAA;gCACa,KAAK,CAAC,MAAM,EAAE;SACrC,CAAC;IACN,CAAC;CACJ;AAlBG;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 './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\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 [\n html`\n <sp-icon-cross75\n slot=\"icon\"\n class=\"icon spectrum-UIIcon-Cross75\"\n ></sp-icon-cross75>\n `,\n ];\n }\n\n protected render(): TemplateResult {\n return html`\n <div class=\"fill\">${super.render()}</div>\n `;\n }\n}\n"]}
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"]}
@@ -0,0 +1,26 @@
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 {};
@@ -0,0 +1,72 @@
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
@@ -0,0 +1 @@
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"]}