@spectrum-web-components/button 0.16.4-express.12 → 0.16.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +66 -38
- package/package.json +7 -8
- package/src/Button.d.ts +6 -13
- package/src/Button.js +15 -57
- package/src/Button.js.map +1 -1
- package/src/ClearButton.js +1 -1
- package/src/ClearButton.js.map +1 -1
- package/src/button.css.js +469 -588
- package/src/button.css.js.map +1 -1
- package/src/clear-button.css.d.ts +2 -0
- package/src/clear-button.css.js +229 -0
- package/src/clear-button.css.js.map +1 -0
- package/src/spectrum-button.css.js +469 -588
- package/src/spectrum-button.css.js.map +1 -1
- package/src/spectrum-clear-button.css.d.ts +2 -0
- package/src/spectrum-clear-button.css.js +229 -0
- package/src/spectrum-clear-button.css.js.map +1 -0
- package/src/spectrum-config.js +76 -20
- package/stories/button-cta-sizes.stories.js +11 -0
- package/stories/button-cta-sizes.stories.js.map +1 -0
- package/stories/button-cta.stories.js +115 -0
- package/stories/button-cta.stories.js.map +1 -0
- package/stories/button-overBackground-sizes.stories.js +12 -0
- package/stories/button-overBackground-sizes.stories.js.map +1 -0
- package/stories/button-overBackground.stories.js +132 -0
- package/stories/button-overBackground.stories.js.map +1 -0
- package/stories/button-primary-sizes.stories.js +11 -0
- package/stories/button-primary-sizes.stories.js.map +1 -0
- package/stories/button-primary.stories.js +129 -0
- package/stories/button-primary.stories.js.map +1 -0
- package/stories/button-secondary-sizes.stories.js +11 -0
- package/stories/button-secondary-sizes.stories.js.map +1 -0
- package/stories/button-secondary.stories.js +129 -0
- package/stories/button-secondary.stories.js.map +1 -0
- package/stories/button-warning-sizes.stories.js +11 -0
- package/stories/button-warning-sizes.stories.js.map +1 -0
- package/stories/button-warning.stories.js +129 -0
- package/stories/button-warning.stories.js.map +1 -0
- package/stories/index.js +7 -112
- package/stories/index.js.map +1 -1
- package/stories/button-accent-fill-sizes.stories.js +0 -28
- package/stories/button-accent-fill-sizes.stories.js.map +0 -1
- package/stories/button-accent-fill.stories.js +0 -28
- package/stories/button-accent-fill.stories.js.map +0 -1
- package/stories/button-accent-outline-sizes.stories.js +0 -28
- package/stories/button-accent-outline-sizes.stories.js.map +0 -1
- package/stories/button-accent-outline.stories.js +0 -28
- package/stories/button-accent-outline.stories.js.map +0 -1
- package/stories/button-black-fill-sizes.stories.js +0 -29
- package/stories/button-black-fill-sizes.stories.js.map +0 -1
- package/stories/button-black-fill.stories.js +0 -29
- package/stories/button-black-fill.stories.js.map +0 -1
- package/stories/button-black-outline-sizes.stories.js +0 -29
- package/stories/button-black-outline-sizes.stories.js.map +0 -1
- package/stories/button-black-outline.stories.js +0 -29
- package/stories/button-black-outline.stories.js.map +0 -1
- package/stories/button-negative-fill-sizes.stories.js +0 -28
- package/stories/button-negative-fill-sizes.stories.js.map +0 -1
- package/stories/button-negative-fill.stories.js +0 -28
- package/stories/button-negative-fill.stories.js.map +0 -1
- package/stories/button-negative-outline-sizes.stories.js +0 -28
- package/stories/button-negative-outline-sizes.stories.js.map +0 -1
- package/stories/button-negative-outline.stories.js +0 -28
- package/stories/button-negative-outline.stories.js.map +0 -1
- package/stories/button-primary-fill-sizes.stories.js +0 -28
- package/stories/button-primary-fill-sizes.stories.js.map +0 -1
- package/stories/button-primary-fill.stories.js +0 -28
- package/stories/button-primary-fill.stories.js.map +0 -1
- package/stories/button-primary-outline-sizes.stories.js +0 -28
- package/stories/button-primary-outline-sizes.stories.js.map +0 -1
- package/stories/button-primary-outline.stories.js +0 -28
- package/stories/button-primary-outline.stories.js.map +0 -1
- package/stories/button-secondary-fill-sizes.stories.js +0 -28
- package/stories/button-secondary-fill-sizes.stories.js.map +0 -1
- package/stories/button-secondary-fill.stories.js +0 -28
- package/stories/button-secondary-fill.stories.js.map +0 -1
- package/stories/button-secondary-outline-sizes.stories.js +0 -28
- package/stories/button-secondary-outline-sizes.stories.js.map +0 -1
- package/stories/button-secondary-outline.stories.js +0 -28
- package/stories/button-secondary-outline.stories.js.map +0 -1
- package/stories/button-white-fill-sizes.stories.js +0 -29
- package/stories/button-white-fill-sizes.stories.js.map +0 -1
- package/stories/button-white-fill.stories.js +0 -29
- package/stories/button-white-fill.stories.js.map +0 -1
- package/stories/button-white-outline-sizes.stories.js +0 -29
- package/stories/button-white-outline-sizes.stories.js.map +0 -1
- package/stories/button-white-outline.stories.js +0 -29
- package/stories/button-white-outline.stories.js.map +0 -1
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.4",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -46,20 +46,19 @@
|
|
|
46
46
|
"lit-html"
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@spectrum-web-components/base": "^0.5.
|
|
50
|
-
"@spectrum-web-components/
|
|
51
|
-
"@spectrum-web-components/
|
|
52
|
-
"@spectrum-web-components/
|
|
53
|
-
"@spectrum-web-components/shared": "^0.13.3",
|
|
49
|
+
"@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/shared": "^0.13.4",
|
|
54
53
|
"tslib": "^2.0.0"
|
|
55
54
|
},
|
|
56
55
|
"devDependencies": {
|
|
57
|
-
"@spectrum-css/button": "^
|
|
56
|
+
"@spectrum-css/button": "^4.1.4"
|
|
58
57
|
},
|
|
59
58
|
"types": "./src/index.d.ts",
|
|
60
59
|
"customElements": "custom-elements.json",
|
|
61
60
|
"sideEffects": [
|
|
62
61
|
"./sp-*.js"
|
|
63
62
|
],
|
|
64
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "bb5308b9be01cc7c5bbab289312042256bdcc740"
|
|
65
64
|
}
|
package/src/Button.d.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { CSSResultArray
|
|
1
|
+
import { CSSResultArray } from '@spectrum-web-components/base';
|
|
2
2
|
import { StyledButton } from './StyledButton.js';
|
|
3
|
-
export declare type
|
|
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';
|
|
3
|
+
export declare type ButtonVariants = 'cta' | 'overBackground' | 'primary' | 'secondary' | 'negative';
|
|
8
4
|
declare const Button_base: typeof StyledButton & {
|
|
9
5
|
new (...args: any[]): import("@spectrum-web-components/base").SizedElementInterface;
|
|
10
6
|
prototype: import("@spectrum-web-components/base").SizedElementInterface;
|
|
@@ -20,17 +16,14 @@ export declare class Button extends Button_base {
|
|
|
20
16
|
/**
|
|
21
17
|
* The visual variant to apply to this button.
|
|
22
18
|
*/
|
|
23
|
-
|
|
24
|
-
set variant(variant: ButtonVariants);
|
|
25
|
-
private _variant;
|
|
19
|
+
variant: ButtonVariants;
|
|
26
20
|
/**
|
|
27
|
-
*
|
|
21
|
+
* There is a warning in place for this control
|
|
28
22
|
*/
|
|
29
|
-
|
|
23
|
+
warning: boolean;
|
|
30
24
|
/**
|
|
31
25
|
* Style this button to be less obvious
|
|
32
26
|
*/
|
|
33
|
-
|
|
34
|
-
protected firstUpdated(changes: PropertyValues<this>): void;
|
|
27
|
+
quiet: boolean;
|
|
35
28
|
}
|
|
36
29
|
export {};
|
package/src/Button.js
CHANGED
|
@@ -10,18 +10,10 @@ 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
|
|
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
|
-
];
|
|
25
17
|
/**
|
|
26
18
|
* @element sp-button
|
|
27
19
|
*
|
|
@@ -31,64 +23,30 @@ export const VALID_VARIANTS = [
|
|
|
31
23
|
export class Button extends SizedMixin(StyledButton) {
|
|
32
24
|
constructor() {
|
|
33
25
|
super(...arguments);
|
|
34
|
-
this._variant = 'accent';
|
|
35
26
|
/**
|
|
36
27
|
* The visual variant to apply to this button.
|
|
37
28
|
*/
|
|
38
|
-
this.
|
|
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;
|
|
39
38
|
}
|
|
40
39
|
static get styles() {
|
|
41
40
|
return [...super.styles, buttonStyles];
|
|
42
41
|
}
|
|
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
|
-
}
|
|
84
42
|
}
|
|
85
43
|
__decorate([
|
|
86
44
|
property({ reflect: true })
|
|
87
|
-
], Button.prototype, "variant",
|
|
45
|
+
], Button.prototype, "variant", void 0);
|
|
88
46
|
__decorate([
|
|
89
|
-
property({ reflect: true })
|
|
90
|
-
], Button.prototype, "
|
|
47
|
+
property({ type: Boolean, reflect: true })
|
|
48
|
+
], Button.prototype, "warning", void 0);
|
|
91
49
|
__decorate([
|
|
92
|
-
property({ type: Boolean })
|
|
93
|
-
], Button.prototype, "quiet",
|
|
50
|
+
property({ type: Boolean, reflect: true })
|
|
51
|
+
], Button.prototype, "quiet", void 0);
|
|
94
52
|
//# 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,
|
|
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"]}
|
package/src/ClearButton.js
CHANGED
|
@@ -13,7 +13,7 @@ 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 '
|
|
16
|
+
import buttonStyles from './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
19
|
/**
|
package/src/ClearButton.js.map
CHANGED
|
@@ -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
|
|
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"]}
|