@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
|
@@ -0,0 +1,129 @@
|
|
|
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 { html } from '@spectrum-web-components/base';
|
|
13
|
+
import { bellIcon, renderButtonSet } from './index.js';
|
|
14
|
+
import '@spectrum-web-components/icons-workflow/icons/sp-icon-help.js';
|
|
15
|
+
export default {
|
|
16
|
+
component: 'sp-button',
|
|
17
|
+
title: 'Button/Secondary',
|
|
18
|
+
args: {
|
|
19
|
+
disabled: false,
|
|
20
|
+
quiet: false,
|
|
21
|
+
variant: 'secondary',
|
|
22
|
+
},
|
|
23
|
+
argTypes: {
|
|
24
|
+
disabled: {
|
|
25
|
+
name: 'disabled',
|
|
26
|
+
type: { name: 'boolean', required: false },
|
|
27
|
+
description: 'Disable this control. It will not receive focus or events.',
|
|
28
|
+
table: {
|
|
29
|
+
type: { summary: 'boolean' },
|
|
30
|
+
defaultValue: { summary: false },
|
|
31
|
+
},
|
|
32
|
+
control: {
|
|
33
|
+
type: 'boolean',
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
quiet: {
|
|
37
|
+
name: 'quiet',
|
|
38
|
+
type: { name: 'boolean', required: false },
|
|
39
|
+
table: {
|
|
40
|
+
type: { summary: 'boolean' },
|
|
41
|
+
defaultValue: { summary: false },
|
|
42
|
+
},
|
|
43
|
+
control: {
|
|
44
|
+
type: 'boolean',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
variant: {
|
|
48
|
+
name: 'variant',
|
|
49
|
+
type: { name: 'string', required: false },
|
|
50
|
+
description: 'The visual variant to apply to the button.',
|
|
51
|
+
table: {
|
|
52
|
+
type: { summary: 'string' },
|
|
53
|
+
defaultValue: { summary: 'cta' },
|
|
54
|
+
},
|
|
55
|
+
control: {
|
|
56
|
+
type: 'inline-radio',
|
|
57
|
+
options: [
|
|
58
|
+
'cta',
|
|
59
|
+
'primary',
|
|
60
|
+
'secondary',
|
|
61
|
+
'negative',
|
|
62
|
+
'overBackground',
|
|
63
|
+
],
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
const variant = 'secondary';
|
|
69
|
+
export const Default = (props) => renderButtonSet(props);
|
|
70
|
+
export const quiet = (props) => renderButtonSet(props);
|
|
71
|
+
quiet.args = {
|
|
72
|
+
quiet: true,
|
|
73
|
+
};
|
|
74
|
+
export const withIcon = (props) => {
|
|
75
|
+
return html `
|
|
76
|
+
<style>
|
|
77
|
+
.row {
|
|
78
|
+
padding: 10px;
|
|
79
|
+
}
|
|
80
|
+
</style>
|
|
81
|
+
<div class="row">
|
|
82
|
+
${renderButtonSet(Object.assign(Object.assign({}, props), { content: html `
|
|
83
|
+
<sp-icon-help slot="icon"></sp-icon-help>
|
|
84
|
+
Help
|
|
85
|
+
` }))}
|
|
86
|
+
</div>
|
|
87
|
+
<div class="row">
|
|
88
|
+
${renderButtonSet(Object.assign(Object.assign({}, props), { content: html `
|
|
89
|
+
${bellIcon} Custom SVG
|
|
90
|
+
` }))}
|
|
91
|
+
</div>
|
|
92
|
+
`;
|
|
93
|
+
};
|
|
94
|
+
export const iconSizeOverridden = () => {
|
|
95
|
+
return html `
|
|
96
|
+
<sp-button label="Edit" size="xl" variant=${variant}>
|
|
97
|
+
<sp-icon-help slot="icon" size="s">Testing</sp-icon-help>
|
|
98
|
+
</sp-button>
|
|
99
|
+
<h1>For testing purposes only</h1>
|
|
100
|
+
<p>
|
|
101
|
+
This is a test to ensure that sizing the icon will still work when
|
|
102
|
+
it's in the scope of a parent element. You shouldn't normally do
|
|
103
|
+
this as it deviates from the Spectrum design specification.
|
|
104
|
+
</p>
|
|
105
|
+
`;
|
|
106
|
+
};
|
|
107
|
+
export const minWidthButton = (props) => {
|
|
108
|
+
return html `
|
|
109
|
+
<style>
|
|
110
|
+
sp-button {
|
|
111
|
+
min-width: 300px;
|
|
112
|
+
}
|
|
113
|
+
</style>
|
|
114
|
+
${renderButtonSet(props)}
|
|
115
|
+
`;
|
|
116
|
+
};
|
|
117
|
+
minWidthButton.story = {
|
|
118
|
+
name: 'min-width',
|
|
119
|
+
};
|
|
120
|
+
const href = 'https://github.com/adobe/spectrum-web-components';
|
|
121
|
+
export const link = (props) => renderButtonSet(Object.assign(Object.assign({}, props), { href }));
|
|
122
|
+
link.story = {
|
|
123
|
+
name: 'href',
|
|
124
|
+
};
|
|
125
|
+
export const linkWithTarget = (props) => renderButtonSet(Object.assign(Object.assign({}, props), { href, target: '_blank' }));
|
|
126
|
+
linkWithTarget.story = {
|
|
127
|
+
name: 'href with target="_blank"',
|
|
128
|
+
};
|
|
129
|
+
//# sourceMappingURL=button-secondary.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button-secondary.stories.js","sourceRoot":"","sources":["button-secondary.stories.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,EAAE,IAAI,EAAkB,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,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AAI,EACJ,MAAM,EAAE,QAAQ,IAClB,CAAC;AACP,cAAc,CAAC,KAAK,GAAG;IACnB,IAAI,EAAE,2BAA2B;CACpC,CAAC","sourcesContent":["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { html, TemplateResult } from '@spectrum-web-components/base';\nimport { bellIcon, renderButtonSet } from './index.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-help.js';\n\nexport default {\n component: 'sp-button',\n title: 'Button/Secondary',\n args: {\n disabled: false,\n quiet: false,\n variant: 'secondary',\n },\n argTypes: {\n disabled: {\n name: 'disabled',\n type: { name: 'boolean', required: false },\n description:\n 'Disable this control. It will not receive focus or events.',\n table: {\n type: { summary: 'boolean' },\n defaultValue: { summary: false },\n },\n control: {\n type: 'boolean',\n },\n },\n quiet: {\n name: 'quiet',\n type: { name: 'boolean', required: false },\n table: {\n type: { summary: 'boolean' },\n defaultValue: { summary: false },\n },\n control: {\n type: 'boolean',\n },\n },\n variant: {\n name: 'variant',\n type: { name: 'string', required: false },\n description: 'The visual variant to apply to the button.',\n table: {\n type: { summary: 'string' },\n defaultValue: { summary: 'cta' },\n },\n control: {\n type: 'inline-radio',\n options: [\n 'cta',\n 'primary',\n 'secondary',\n 'negative',\n 'overBackground',\n ],\n },\n },\n },\n};\n\nconst variant = 'secondary';\n\ninterface Properties {\n content?: TemplateResult;\n disabled?: boolean;\n quiet?: boolean;\n variant?: 'cta' | 'overBackground' | 'primary' | 'secondary' | 'negative';\n}\n\nexport const Default = (props: Properties): TemplateResult =>\n renderButtonSet(props);\n\nexport const quiet = (props: Properties): TemplateResult =>\n renderButtonSet(props);\nquiet.args = {\n quiet: true,\n};\n\nexport const withIcon = (props: Properties): TemplateResult => {\n return html`\n <style>\n .row {\n padding: 10px;\n }\n </style>\n <div class=\"row\">\n ${renderButtonSet({\n ...props,\n content: html`\n <sp-icon-help slot=\"icon\"></sp-icon-help>\n Help\n `,\n })}\n </div>\n <div class=\"row\">\n ${renderButtonSet({\n ...props,\n content: html`\n ${bellIcon} Custom SVG\n `,\n })}\n </div>\n `;\n};\n\nexport const iconSizeOverridden = (): TemplateResult => {\n return html`\n <sp-button label=\"Edit\" size=\"xl\" variant=${variant}>\n <sp-icon-help slot=\"icon\" size=\"s\">Testing</sp-icon-help>\n </sp-button>\n <h1>For testing purposes only</h1>\n <p>\n This is a test to ensure that sizing the icon will still work when\n it's in the scope of a parent element. You shouldn't normally do\n this as it deviates from the Spectrum design specification.\n </p>\n `;\n};\n\nexport const minWidthButton = (props: Properties): TemplateResult => {\n return html`\n <style>\n sp-button {\n min-width: 300px;\n }\n </style>\n ${renderButtonSet(props)}\n `;\n};\nminWidthButton.story = {\n name: 'min-width',\n};\n\nconst href = 'https://github.com/adobe/spectrum-web-components';\n\nexport const link = (props: Properties): TemplateResult =>\n renderButtonSet({\n ...props,\n href,\n });\nlink.story = {\n name: 'href',\n};\n\nexport const linkWithTarget = (props: Properties): TemplateResult =>\n renderButtonSet({\n ...props,\n href,\n target: '_blank',\n });\nlinkWithTarget.story = {\n name: 'href with target=\"_blank\"',\n};\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { renderButtonSet } from './index.js';
|
|
2
|
+
export default {
|
|
3
|
+
component: 'sp-button',
|
|
4
|
+
title: 'Button/Warning/Sizes',
|
|
5
|
+
};
|
|
6
|
+
const variant = 'negative';
|
|
7
|
+
export const s = () => renderButtonSet({ size: 's', variant });
|
|
8
|
+
export const m = () => renderButtonSet({ size: 'm', variant });
|
|
9
|
+
export const l = () => renderButtonSet({ size: 'l', variant });
|
|
10
|
+
export const XL = () => renderButtonSet({ size: 'xl', variant });
|
|
11
|
+
//# sourceMappingURL=button-warning-sizes.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button-warning-sizes.stories.js","sourceRoot":"","sources":["button-warning-sizes.stories.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,eAAe;IACX,SAAS,EAAE,WAAW;IACtB,KAAK,EAAE,sBAAsB;CAChC,CAAC;AAEF,MAAM,OAAO,GAAG,UAAU,CAAC;AAE3B,MAAM,CAAC,MAAM,CAAC,GAAG,GAAmB,EAAE,CAAC,eAAe,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC;AAE/E,MAAM,CAAC,MAAM,CAAC,GAAG,GAAmB,EAAE,CAAC,eAAe,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC;AAE/E,MAAM,CAAC,MAAM,CAAC,GAAG,GAAmB,EAAE,CAAC,eAAe,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC;AAE/E,MAAM,CAAC,MAAM,EAAE,GAAG,GAAmB,EAAE,CACnC,eAAe,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,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*/\nimport { TemplateResult } from '@spectrum-web-components/base';\nimport { renderButtonSet } from './index.js';\n\nexport default {\n component: 'sp-button',\n title: 'Button/Warning/Sizes',\n};\n\nconst variant = 'negative';\n\nexport const s = (): TemplateResult => renderButtonSet({ size: 's', variant });\n\nexport const m = (): TemplateResult => renderButtonSet({ size: 'm', variant });\n\nexport const l = (): TemplateResult => renderButtonSet({ size: 'l', variant });\n\nexport const XL = (): TemplateResult =>\n renderButtonSet({ size: 'xl', variant });\n"]}
|
|
@@ -0,0 +1,129 @@
|
|
|
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 { html } from '@spectrum-web-components/base';
|
|
13
|
+
import { bellIcon, renderButtonSet } from './index.js';
|
|
14
|
+
import '@spectrum-web-components/icons-workflow/icons/sp-icon-help.js';
|
|
15
|
+
export default {
|
|
16
|
+
component: 'sp-button',
|
|
17
|
+
title: 'Button/Warning',
|
|
18
|
+
args: {
|
|
19
|
+
disabled: false,
|
|
20
|
+
quiet: false,
|
|
21
|
+
variant: 'negative',
|
|
22
|
+
},
|
|
23
|
+
argTypes: {
|
|
24
|
+
disabled: {
|
|
25
|
+
name: 'disabled',
|
|
26
|
+
type: { name: 'boolean', required: false },
|
|
27
|
+
description: 'Disable this control. It will not receive focus or events.',
|
|
28
|
+
table: {
|
|
29
|
+
type: { summary: 'boolean' },
|
|
30
|
+
defaultValue: { summary: false },
|
|
31
|
+
},
|
|
32
|
+
control: {
|
|
33
|
+
type: 'boolean',
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
quiet: {
|
|
37
|
+
name: 'quiet',
|
|
38
|
+
type: { name: 'boolean', required: false },
|
|
39
|
+
table: {
|
|
40
|
+
type: { summary: 'boolean' },
|
|
41
|
+
defaultValue: { summary: false },
|
|
42
|
+
},
|
|
43
|
+
control: {
|
|
44
|
+
type: 'boolean',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
variant: {
|
|
48
|
+
name: 'variant',
|
|
49
|
+
type: { name: 'string', required: false },
|
|
50
|
+
description: 'The visual variant to apply to the button.',
|
|
51
|
+
table: {
|
|
52
|
+
type: { summary: 'string' },
|
|
53
|
+
defaultValue: { summary: 'cta' },
|
|
54
|
+
},
|
|
55
|
+
control: {
|
|
56
|
+
type: 'inline-radio',
|
|
57
|
+
options: [
|
|
58
|
+
'cta',
|
|
59
|
+
'primary',
|
|
60
|
+
'secondary',
|
|
61
|
+
'negative',
|
|
62
|
+
'overBackground',
|
|
63
|
+
],
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
const variant = 'negative';
|
|
69
|
+
export const Default = (props) => renderButtonSet(props);
|
|
70
|
+
export const quiet = (props) => renderButtonSet(props);
|
|
71
|
+
quiet.args = {
|
|
72
|
+
quiet: true,
|
|
73
|
+
};
|
|
74
|
+
export const withIcon = (props) => {
|
|
75
|
+
return html `
|
|
76
|
+
<style>
|
|
77
|
+
.row {
|
|
78
|
+
padding: 10px;
|
|
79
|
+
}
|
|
80
|
+
</style>
|
|
81
|
+
<div class="row">
|
|
82
|
+
${renderButtonSet(Object.assign(Object.assign({}, props), { content: html `
|
|
83
|
+
<sp-icon-help slot="icon"></sp-icon-help>
|
|
84
|
+
Help
|
|
85
|
+
` }))}
|
|
86
|
+
</div>
|
|
87
|
+
<div class="row">
|
|
88
|
+
${renderButtonSet(Object.assign(Object.assign({}, props), { content: html `
|
|
89
|
+
${bellIcon} Custom SVG
|
|
90
|
+
` }))}
|
|
91
|
+
</div>
|
|
92
|
+
`;
|
|
93
|
+
};
|
|
94
|
+
export const iconSizeOverridden = () => {
|
|
95
|
+
return html `
|
|
96
|
+
<sp-button label="Edit" size="xl" variant=${variant}>
|
|
97
|
+
<sp-icon-help slot="icon" size="s">Testing</sp-icon-help>
|
|
98
|
+
</sp-button>
|
|
99
|
+
<h1>For testing purposes only</h1>
|
|
100
|
+
<p>
|
|
101
|
+
This is a test to ensure that sizing the icon will still work when
|
|
102
|
+
it's in the scope of a parent element. You shouldn't normally do
|
|
103
|
+
this as it deviates from the Spectrum design specification.
|
|
104
|
+
</p>
|
|
105
|
+
`;
|
|
106
|
+
};
|
|
107
|
+
export const minWidthButton = (props) => {
|
|
108
|
+
return html `
|
|
109
|
+
<style>
|
|
110
|
+
sp-button {
|
|
111
|
+
min-width: 300px;
|
|
112
|
+
}
|
|
113
|
+
</style>
|
|
114
|
+
${renderButtonSet(props)}
|
|
115
|
+
`;
|
|
116
|
+
};
|
|
117
|
+
minWidthButton.story = {
|
|
118
|
+
name: 'min-width',
|
|
119
|
+
};
|
|
120
|
+
const href = 'https://github.com/adobe/spectrum-web-components';
|
|
121
|
+
export const link = (props) => renderButtonSet(Object.assign(Object.assign({}, props), { href }));
|
|
122
|
+
link.story = {
|
|
123
|
+
name: 'href',
|
|
124
|
+
};
|
|
125
|
+
export const linkWithTarget = (props) => renderButtonSet(Object.assign(Object.assign({}, props), { href, target: '_blank' }));
|
|
126
|
+
linkWithTarget.story = {
|
|
127
|
+
name: 'href with target="_blank"',
|
|
128
|
+
};
|
|
129
|
+
//# sourceMappingURL=button-warning.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button-warning.stories.js","sourceRoot":"","sources":["button-warning.stories.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,EAAE,IAAI,EAAkB,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,+DAA+D,CAAC;AAEvE,eAAe;IACX,SAAS,EA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GAAG;IACnB,IAAI,EAAE,2BAA2B;CACpC,CAAC","sourcesContent":["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { html, TemplateResult } from '@spectrum-web-components/base';\nimport { bellIcon, renderButtonSet } from './index.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-help.js';\n\nexport default {\n component: 'sp-button',\n title: 'Button/Warning',\n args: {\n disabled: false,\n quiet: false,\n variant: 'negative',\n },\n argTypes: {\n disabled: {\n name: 'disabled',\n type: { name: 'boolean', required: false },\n description:\n 'Disable this control. It will not receive focus or events.',\n table: {\n type: { summary: 'boolean' },\n defaultValue: { summary: false },\n },\n control: {\n type: 'boolean',\n },\n },\n quiet: {\n name: 'quiet',\n type: { name: 'boolean', required: false },\n table: {\n type: { summary: 'boolean' },\n defaultValue: { summary: false },\n },\n control: {\n type: 'boolean',\n },\n },\n variant: {\n name: 'variant',\n type: { name: 'string', required: false },\n description: 'The visual variant to apply to the button.',\n table: {\n type: { summary: 'string' },\n defaultValue: { summary: 'cta' },\n },\n control: {\n type: 'inline-radio',\n options: [\n 'cta',\n 'primary',\n 'secondary',\n 'negative',\n 'overBackground',\n ],\n },\n },\n },\n};\n\nconst variant = 'negative';\n\ninterface Properties {\n content?: TemplateResult;\n disabled?: boolean;\n quiet?: boolean;\n variant?: 'cta' | 'overBackground' | 'primary' | 'secondary' | 'negative';\n}\n\nexport const Default = (props: Properties): TemplateResult =>\n renderButtonSet(props);\n\nexport const quiet = (props: Properties): TemplateResult =>\n renderButtonSet(props);\nquiet.args = {\n quiet: true,\n};\n\nexport const withIcon = (props: Properties): TemplateResult => {\n return html`\n <style>\n .row {\n padding: 10px;\n }\n </style>\n <div class=\"row\">\n ${renderButtonSet({\n ...props,\n content: html`\n <sp-icon-help slot=\"icon\"></sp-icon-help>\n Help\n `,\n })}\n </div>\n <div class=\"row\">\n ${renderButtonSet({\n ...props,\n content: html`\n ${bellIcon} Custom SVG\n `,\n })}\n </div>\n `;\n};\n\nexport const iconSizeOverridden = (): TemplateResult => {\n return html`\n <sp-button label=\"Edit\" size=\"xl\" variant=${variant}>\n <sp-icon-help slot=\"icon\" size=\"s\">Testing</sp-icon-help>\n </sp-button>\n <h1>For testing purposes only</h1>\n <p>\n This is a test to ensure that sizing the icon will still work when\n it's in the scope of a parent element. You shouldn't normally do\n this as it deviates from the Spectrum design specification.\n </p>\n `;\n};\n\nexport const minWidthButton = (props: Properties): TemplateResult => {\n return html`\n <style>\n sp-button {\n min-width: 300px;\n }\n </style>\n ${renderButtonSet(props)}\n `;\n};\nminWidthButton.story = {\n name: 'min-width',\n};\n\nconst href = 'https://github.com/adobe/spectrum-web-components';\n\nexport const link = (props: Properties): TemplateResult =>\n renderButtonSet({\n ...props,\n href,\n });\nlink.story = {\n name: 'href',\n};\n\nexport const linkWithTarget = (props: Properties): TemplateResult =>\n renderButtonSet({\n ...props,\n href,\n target: '_blank',\n });\nlinkWithTarget.story = {\n name: 'href with target=\"_blank\"',\n};\n"]}
|
package/stories/index.js
CHANGED
|
@@ -14,77 +14,18 @@ import { ifDefined } from '@spectrum-web-components/base/src/directives.js';
|
|
|
14
14
|
import '../sp-button.js';
|
|
15
15
|
import '@spectrum-web-components/icon/sp-icon.js';
|
|
16
16
|
import '@spectrum-web-components/icons-workflow/icons/sp-icon-help.js';
|
|
17
|
-
export const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
type: { name: 'boolean', required: false },
|
|
25
|
-
description: 'Disable this control. It will not receive focus or events.',
|
|
26
|
-
table: {
|
|
27
|
-
type: { summary: 'boolean' },
|
|
28
|
-
defaultValue: { summary: false },
|
|
29
|
-
},
|
|
30
|
-
control: {
|
|
31
|
-
type: 'boolean',
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
variant: {
|
|
35
|
-
name: 'variant',
|
|
36
|
-
type: { name: 'string', required: false },
|
|
37
|
-
description: 'The visual variant to apply to the button.',
|
|
38
|
-
table: {
|
|
39
|
-
type: { summary: 'string' },
|
|
40
|
-
defaultValue: { summary: 'cta' },
|
|
41
|
-
},
|
|
42
|
-
control: {
|
|
43
|
-
type: 'inline-radio',
|
|
44
|
-
options: [
|
|
45
|
-
'cta',
|
|
46
|
-
'accent',
|
|
47
|
-
'primary',
|
|
48
|
-
'secondary',
|
|
49
|
-
'negative',
|
|
50
|
-
'overBackground',
|
|
51
|
-
'black',
|
|
52
|
-
'white',
|
|
53
|
-
],
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
treatment: {
|
|
57
|
-
name: 'tratment',
|
|
58
|
-
type: { name: 'string', required: false },
|
|
59
|
-
description: 'The visual treatment to apply to the button.',
|
|
60
|
-
table: {
|
|
61
|
-
type: { summary: 'string' },
|
|
62
|
-
defaultValue: { summary: 'fill' },
|
|
63
|
-
},
|
|
64
|
-
control: {
|
|
65
|
-
type: 'inline-radio',
|
|
66
|
-
options: ['fill', 'outline'],
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
};
|
|
70
|
-
export const makeOverBackground = (variant) => (story) => {
|
|
71
|
-
const color = variant === 'black'
|
|
72
|
-
? 'rgb(181, 209, 211)'
|
|
73
|
-
: 'var(--spectrum-global-color-seafoam-600)';
|
|
74
|
-
return html `
|
|
75
|
-
<div
|
|
76
|
-
style="background-color: ${color}; color: ${color}; padding: var(--spectrum-global-dimension-size-175) var(--spectrum-global-dimension-size-250); display: inline-block;"
|
|
77
|
-
>
|
|
78
|
-
${story()}
|
|
79
|
-
</div>
|
|
80
|
-
`;
|
|
81
|
-
};
|
|
17
|
+
export const makeOverBackground = (story) => html `
|
|
18
|
+
<div
|
|
19
|
+
style="background-color: var(--spectrum-global-color-seafoam-600); color: var(--spectrum-global-color-seafoam-600); padding: var(--spectrum-global-dimension-size-175) var(--spectrum-global-dimension-size-250); display: inline-block"
|
|
20
|
+
>
|
|
21
|
+
${story()}
|
|
22
|
+
</div>
|
|
23
|
+
`;
|
|
82
24
|
export function renderButton(properties) {
|
|
83
25
|
if (properties.variant) {
|
|
84
26
|
return html `
|
|
85
27
|
<sp-button
|
|
86
28
|
variant="${properties.variant}"
|
|
87
|
-
treatment="${properties.treatment}"
|
|
88
29
|
?quiet="${!!properties.quiet}"
|
|
89
30
|
?disabled=${!!properties.disabled}
|
|
90
31
|
size=${properties.size || 'm'}
|
|
@@ -128,50 +69,4 @@ export const bellIcon = html `
|
|
|
128
69
|
></path>
|
|
129
70
|
</svg>
|
|
130
71
|
`;
|
|
131
|
-
export const renderWithIcon = (props) => {
|
|
132
|
-
return html `
|
|
133
|
-
<style>
|
|
134
|
-
.row {
|
|
135
|
-
padding: 10px;
|
|
136
|
-
}
|
|
137
|
-
</style>
|
|
138
|
-
<div class="row">
|
|
139
|
-
${renderButtonSet(Object.assign(Object.assign({}, props), { content: html `
|
|
140
|
-
<sp-icon-help slot="icon"></sp-icon-help>
|
|
141
|
-
Help
|
|
142
|
-
` }))}
|
|
143
|
-
</div>
|
|
144
|
-
<div class="row">
|
|
145
|
-
${renderButtonSet(Object.assign(Object.assign({}, props), { content: html `
|
|
146
|
-
${bellIcon} Custom SVG
|
|
147
|
-
` }))}
|
|
148
|
-
</div>
|
|
149
|
-
`;
|
|
150
|
-
};
|
|
151
|
-
export const renderIconSizeOverridden = (variant) => {
|
|
152
|
-
return html `
|
|
153
|
-
<sp-button label="Edit" size="xl" variant=${variant}>
|
|
154
|
-
<sp-icon-help slot="icon" size="s">Testing</sp-icon-help>
|
|
155
|
-
</sp-button>
|
|
156
|
-
<h1>For testing purposes only</h1>
|
|
157
|
-
<p>
|
|
158
|
-
This is a test to ensure that sizing the icon will still work when
|
|
159
|
-
it's in the scope of a parent element. You shouldn't normally do
|
|
160
|
-
this as it deviates from the Spectrum design specification.
|
|
161
|
-
</p>
|
|
162
|
-
`;
|
|
163
|
-
};
|
|
164
|
-
export const renderMinWidthButton = (props) => {
|
|
165
|
-
return html `
|
|
166
|
-
<style>
|
|
167
|
-
sp-button {
|
|
168
|
-
min-width: 300px;
|
|
169
|
-
}
|
|
170
|
-
</style>
|
|
171
|
-
${renderButtonSet(props)}
|
|
172
|
-
`;
|
|
173
|
-
};
|
|
174
|
-
const href = 'https://github.com/adobe/spectrum-web-components';
|
|
175
|
-
export const renderLink = (props) => renderButtonSet(Object.assign(Object.assign({}, props), { href }));
|
|
176
|
-
export const renderLinkWithTarget = (props) => renderButtonSet(Object.assign(Object.assign({}, props), { href, target: '_blank' }));
|
|
177
72
|
//# sourceMappingURL=index.js.map
|
package/stories/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,EAAE,IAAI,EAAkB,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,iDAAiD,CAAC;AAE5E,OAAO,iBAAiB,CAAC;AACzB,OAAO,0CAA0C,CAAC;AAClD,OAAO,+DAA+D,CAAC;AAGvE,MAAM,CAAC,MAAM,IAAI,GAAG;IAChB,QAAQ,EAAE,KAAK;IACf,OAAO,EAAE,KAAK;CACjB,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG;IACpB,QAAQ,EAAE;QACN,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE;QAC1C,WAAW,EACP,4DAA4D;QAChE,KAAK,EAAE;YACH,IAAI,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE;YAC5B,YAAY,EAAE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,IAAI,CAAA;;;iBAGZ,IACH;;;cAGA,eAAe,iCACV,KAAK,KACR,OAAO,EAAE,IAAI,CAAA;sBACP,QAAQ;iBACb,IACH;;KAET,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACpC,OAAuB,EACT,EAAE;IAChB,OAAO,IAAI,CAAA;oDACqC,OAAO;;;;;;;;;KAStD,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAiB,EAAkB,EAAE;IACtE,OAAO,IAAI,CAAA;;;;;;UAML,eAAe,CAAC,KAAK,CAAC;KAC3B,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,IAAI,GAAG,kDAAkD,CAAC;AAEhE,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAiB,EAAkB,EAAE,CAC5D,eAAe,iCACR,KAAK,KACR,IAAI,IACN,CAAC;AAEP,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAiB,EAAkB,EAAE,CACtE,eAAe,iCACR,KAAK,KACR,IAAI,EACJ,MAAM,EAAE,QAAQ,IAClB,CAAC","sourcesContent":["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { html, TemplateResult } from '@spectrum-web-components/base';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\n\nimport '../sp-button.js';\nimport '@spectrum-web-components/icon/sp-icon.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-help.js';\nimport { ButtonTreatments, ButtonVariants } from '../src/Button.js';\n\nexport const args = {\n disabled: false,\n variant: 'cta',\n};\n\nexport const argTypes = {\n disabled: {\n name: 'disabled',\n type: { name: 'boolean', required: false },\n description:\n 'Disable this control. It will not receive focus or events.',\n table: {\n type: { summary: 'boolean' },\n defaultValue: { summary: false },\n },\n control: {\n type: 'boolean',\n },\n },\n variant: {\n name: 'variant',\n type: { name: 'string', required: false },\n description: 'The visual variant to apply to the button.',\n table: {\n type: { summary: 'string' },\n defaultValue: { summary: 'cta' },\n },\n control: {\n type: 'inline-radio',\n options: [\n 'cta',\n 'accent',\n 'primary',\n 'secondary',\n 'negative',\n 'overBackground',\n 'black',\n 'white',\n ],\n },\n },\n treatment: {\n name: 'tratment',\n type: { name: 'string', required: false },\n description: 'The visual treatment to apply to the button.',\n table: {\n type: { summary: 'string' },\n defaultValue: { summary: 'fill' },\n },\n control: {\n type: 'inline-radio',\n options: ['fill', 'outline'],\n },\n },\n};\n\nexport interface Properties {\n variant?: ButtonVariants;\n treatment?: ButtonTreatments;\n quiet?: boolean;\n content?: TemplateResult;\n disabled?: boolean;\n size?: 's' | 'm' | 'l' | 'xl';\n href?: string;\n target?: '_blank' | '_parent' | '_self' | '_top';\n warning?: boolean;\n}\n\nexport const makeOverBackground =\n (variant?: 'white' | 'black') =>\n (story: () => TemplateResult): TemplateResult => {\n const color =\n variant === 'black'\n ? 'rgb(181, 209, 211)'\n : 'var(--spectrum-global-color-seafoam-600)';\n return html`\n <div\n style=\"background-color: ${color}; color: ${color}; padding: var(--spectrum-global-dimension-size-175) var(--spectrum-global-dimension-size-250); display: inline-block;\"\n >\n ${story()}\n </div>\n `;\n };\n\nexport function renderButton(properties: Properties): TemplateResult {\n if (properties.variant) {\n return html`\n <sp-button\n variant=\"${properties.variant}\"\n treatment=\"${properties.treatment}\"\n ?quiet=\"${!!properties.quiet}\"\n ?disabled=${!!properties.disabled}\n size=${properties.size || 'm'}\n href=${ifDefined(properties.href)}\n target=${ifDefined(properties.target)}\n ?warning=${properties.warning}\n >\n ${properties.content || 'Click Me'}\n </sp-button>\n `;\n } else {\n return html`\n <sp-button\n ?quiet=\"${!!properties.quiet}\"\n ?disabled=${!!properties.disabled}\n size=${properties.size}\n >\n ${properties.content || 'Click Me'}\n </sp-button>\n `;\n }\n}\n\nexport function renderButtonSet(properties: Properties): TemplateResult {\n const disabled = Object.assign({}, properties, { disabled: true });\n const icon = Object.assign({}, properties, {\n content: html`\n <sp-icon-help slot=\"icon\"></sp-icon-help>\n Click Me\n `,\n });\n return html`\n ${renderButton(properties)} ${renderButton(disabled)}\n ${renderButton(icon)}\n `;\n}\n\nexport const bellIcon = html`\n <svg slot=\"icon\" viewBox=\"0 0 36 36\" focusable=\"false\" aria-hidden=\"true\">\n <path\n d=\"M16 36a4.407 4.407 0 0 0 4-4h-8a4.407 4.407 0 0 0 4 4zm9.143-24.615c0-3.437-3.206-4.891-7.143-5.268V3a1.079 1.079 0 0 0-1.143-1h-1.714A1.079 1.079 0 0 0 14 3v3.117c-3.937.377-7.143 1.831-7.143 5.268C6.857 26.8 2 26.111 2 28.154V30h28v-1.846C30 26 25.143 26.8 25.143 11.385z\"\n ></path>\n </svg>\n`;\n\nexport const renderWithIcon = (props: Properties): TemplateResult => {\n return html`\n <style>\n .row {\n padding: 10px;\n }\n </style>\n <div class=\"row\">\n ${renderButtonSet({\n ...props,\n content: html`\n <sp-icon-help slot=\"icon\"></sp-icon-help>\n Help\n `,\n })}\n </div>\n <div class=\"row\">\n ${renderButtonSet({\n ...props,\n content: html`\n ${bellIcon} Custom SVG\n `,\n })}\n </div>\n `;\n};\n\nexport const renderIconSizeOverridden = (\n variant: ButtonVariants\n): TemplateResult => {\n return html`\n <sp-button label=\"Edit\" size=\"xl\" variant=${variant}>\n <sp-icon-help slot=\"icon\" size=\"s\">Testing</sp-icon-help>\n </sp-button>\n <h1>For testing purposes only</h1>\n <p>\n This is a test to ensure that sizing the icon will still work when\n it's in the scope of a parent element. You shouldn't normally do\n this as it deviates from the Spectrum design specification.\n </p>\n `;\n};\n\nexport const renderMinWidthButton = (props: Properties): TemplateResult => {\n return html`\n <style>\n sp-button {\n min-width: 300px;\n }\n </style>\n ${renderButtonSet(props)}\n `;\n};\n\nconst href = 'https://github.com/adobe/spectrum-web-components';\n\nexport const renderLink = (props: Properties): TemplateResult =>\n renderButtonSet({\n ...props,\n href,\n });\n\nexport const renderLinkWithTarget = (props: Properties): TemplateResult =>\n renderButtonSet({\n ...props,\n href,\n target: '_blank',\n });\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,EAAE,IAAI,EAAkB,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,iDAAiD,CAAC;AAE5E,OAAO,iBAAiB,CAAC;AACzB,OAAO,0CAA0C,CAAC;AAClD,OAAO,+DAA+D,CAAC;AAavE,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAC9B,KAA2B,EACb,EAAE,CAAC,IAAI,CAAA;;;;UAIf,KAAK,EAAE;;CAEhB,CAAC;AAEF,MAAM,UAAU,YAAY,CAAC,UAAsB;IAC/C,IAAI,UAAU,CAAC,OAAO,EAAE;QACpB,OAAO,IAAI,CAAA;;2BAEQ,UAAU,CAAC,OAAO;0BACnB,CAAC,CAAC,UAAU,CAAC,KAAK;4BAChB,CAAC,CAAC,UAAU,CAAC,QAAQ;uBAC1B,UAAU,CAAC,IAAI,IAAI,GAAG;uBACtB,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC;yBACxB,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC;2BAC1B,UAAU,CAAC,OAAO;;kBAE3B,UAAU,CAAC,OAAO,IAAI,UAAU;;SAEzC,CAAC;KACL;SAAM;QACH,OAAO,IAAI,CAAA;;0BAEO,CAAC,CAAC,UAAU,CAAC,KAAK;4BAChB,CAAC,CAAC,UAAU,CAAC,QAAQ;uBAC1B,UAAU,CAAC,IAAI;;kBAEpB,UAAU,CAAC,OAAO,IAAI,UAAU;;SAEzC,CAAC;KACL;AACL,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,UAAsB;IAClD,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IACnE,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,UAAU,EAAE;QACvC,OAAO,EAAE,IAAI,CAAA;;;SAGZ;KACJ,CAAC,CAAC;IACH,OAAO,IAAI,CAAA;UACL,YAAY,CAAC,UAAU,CAAC,IAAI,YAAY,CAAC,QAAQ,CAAC;UAClD,YAAY,CAAC,IAAI,CAAC;KACvB,CAAC;AACN,CAAC;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAA;;;;;;CAM3B,CAAC","sourcesContent":["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { html, TemplateResult } from '@spectrum-web-components/base';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\n\nimport '../sp-button.js';\nimport '@spectrum-web-components/icon/sp-icon.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-help.js';\n\ninterface Properties {\n variant?: 'cta' | 'overBackground' | 'primary' | 'secondary' | 'negative';\n quiet?: boolean;\n content?: TemplateResult;\n disabled?: boolean;\n size?: 's' | 'm' | 'l' | 'xl';\n href?: string;\n target?: '_blank' | '_parent' | '_self' | '_top';\n warning?: boolean;\n}\n\nexport const makeOverBackground = (\n story: () => TemplateResult\n): TemplateResult => html`\n <div\n style=\"background-color: var(--spectrum-global-color-seafoam-600); color: var(--spectrum-global-color-seafoam-600); padding: var(--spectrum-global-dimension-size-175) var(--spectrum-global-dimension-size-250); display: inline-block\"\n >\n ${story()}\n </div>\n`;\n\nexport function renderButton(properties: Properties): TemplateResult {\n if (properties.variant) {\n return html`\n <sp-button\n variant=\"${properties.variant}\"\n ?quiet=\"${!!properties.quiet}\"\n ?disabled=${!!properties.disabled}\n size=${properties.size || 'm'}\n href=${ifDefined(properties.href)}\n target=${ifDefined(properties.target)}\n ?warning=${properties.warning}\n >\n ${properties.content || 'Click Me'}\n </sp-button>\n `;\n } else {\n return html`\n <sp-button\n ?quiet=\"${!!properties.quiet}\"\n ?disabled=${!!properties.disabled}\n size=${properties.size}\n >\n ${properties.content || 'Click Me'}\n </sp-button>\n `;\n }\n}\n\nexport function renderButtonSet(properties: Properties): TemplateResult {\n const disabled = Object.assign({}, properties, { disabled: true });\n const icon = Object.assign({}, properties, {\n content: html`\n <sp-icon-help slot=\"icon\"></sp-icon-help>\n Click Me\n `,\n });\n return html`\n ${renderButton(properties)} ${renderButton(disabled)}\n ${renderButton(icon)}\n `;\n}\n\nexport const bellIcon = html`\n <svg slot=\"icon\" viewBox=\"0 0 36 36\" focusable=\"false\" aria-hidden=\"true\">\n <path\n d=\"M16 36a4.407 4.407 0 0 0 4-4h-8a4.407 4.407 0 0 0 4 4zm9.143-24.615c0-3.437-3.206-4.891-7.143-5.268V3a1.079 1.079 0 0 0-1.143-1h-1.714A1.079 1.079 0 0 0 14 3v3.117c-3.937.377-7.143 1.831-7.143 5.268C6.857 26.8 2 26.111 2 28.154V30h28v-1.846C30 26 25.143 26.8 25.143 11.385z\"\n ></path>\n </svg>\n`;\n"]}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { renderButtonSet } from './index.js';
|
|
2
|
-
import { args, argTypes } from './index.js';
|
|
3
|
-
const variant = 'accent';
|
|
4
|
-
const treatment = 'fill';
|
|
5
|
-
export default {
|
|
6
|
-
component: 'sp-button',
|
|
7
|
-
title: 'Button/Accent/Fill/Sizes',
|
|
8
|
-
args: Object.assign(Object.assign({}, args), { variant,
|
|
9
|
-
treatment }),
|
|
10
|
-
argTypes,
|
|
11
|
-
};
|
|
12
|
-
export const s = (args) => renderButtonSet(args);
|
|
13
|
-
s.args = {
|
|
14
|
-
size: 's',
|
|
15
|
-
};
|
|
16
|
-
export const m = (args) => renderButtonSet(args);
|
|
17
|
-
m.args = {
|
|
18
|
-
size: 'm',
|
|
19
|
-
};
|
|
20
|
-
export const l = (args) => renderButtonSet(args);
|
|
21
|
-
l.args = {
|
|
22
|
-
size: 'l',
|
|
23
|
-
};
|
|
24
|
-
export const XL = (args) => renderButtonSet(args);
|
|
25
|
-
XL.args = {
|
|
26
|
-
size: 'xl',
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=button-accent-fill-sizes.stories.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"button-accent-fill-sizes.stories.js","sourceRoot":"","sources":["button-accent-fill-sizes.stories.ts"],"names":[],"mappings":"AAYA,OAAO,EAAc,eAAe,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,OAAO,GAAG,QAAQ,CAAC;AACzB,MAAM,SAAS,GAAG,MAAM,CAAC;AAEzB,eAAe;IACX,SAAS,EAAE,WAAW;IACtB,KAAK,EAAE,0BAA0B;IACjC,IAAI,kCACG,IAAI,KACP,OAAO;QACP,SAAS,GACZ;IACD,QAAQ;CACX,CAAC;AAEF,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,IAAgB,EAAkB,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;AAC7E,CAAC,CAAC,IAAI,GAAG;IACL,IAAI,EAAE,GAAG;CACZ,CAAC;AAEF,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,IAAgB,EAAkB,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;AAC7E,CAAC,CAAC,IAAI,GAAG;IACL,IAAI,EAAE,GAAG;CACZ,CAAC;AAEF,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,IAAgB,EAAkB,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;AAC7E,CAAC,CAAC,IAAI,GAAG;IACL,IAAI,EAAE,GAAG;CACZ,CAAC;AAEF,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IAAgB,EAAkB,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;AAC9E,EAAE,CAAC,IAAI,GAAG;IACN,IAAI,EAAE,IAAI;CACb,CAAC","sourcesContent":["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { TemplateResult } from '@spectrum-web-components/base';\nimport { Properties, renderButtonSet } from './index.js';\nimport { args, argTypes } from './index.js';\n\nconst variant = 'accent';\nconst treatment = 'fill';\n\nexport default {\n component: 'sp-button',\n title: 'Button/Accent/Fill/Sizes',\n args: {\n ...args,\n variant,\n treatment,\n },\n argTypes,\n};\n\nexport const s = (args: Properties): TemplateResult => renderButtonSet(args);\ns.args = {\n size: 's',\n};\n\nexport const m = (args: Properties): TemplateResult => renderButtonSet(args);\nm.args = {\n size: 'm',\n};\n\nexport const l = (args: Properties): TemplateResult => renderButtonSet(args);\nl.args = {\n size: 'l',\n};\n\nexport const XL = (args: Properties): TemplateResult => renderButtonSet(args);\nXL.args = {\n size: 'xl',\n};\n"]}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { renderButtonSet, renderIconSizeOverridden, renderLink, renderLinkWithTarget, renderMinWidthButton, renderWithIcon, } from './index.js';
|
|
2
|
-
import '@spectrum-web-components/icons-workflow/icons/sp-icon-help.js';
|
|
3
|
-
import { args, argTypes } from './index.js';
|
|
4
|
-
const variant = 'accent';
|
|
5
|
-
const treatment = 'fill';
|
|
6
|
-
export default {
|
|
7
|
-
component: 'sp-button',
|
|
8
|
-
title: 'Button/Accent/Fill',
|
|
9
|
-
args: Object.assign(Object.assign({}, args), { variant,
|
|
10
|
-
treatment }),
|
|
11
|
-
argTypes,
|
|
12
|
-
};
|
|
13
|
-
export const Default = (props) => renderButtonSet(props);
|
|
14
|
-
export const withIcon = (props) => renderWithIcon(props);
|
|
15
|
-
export const iconSizeOverridden = () => renderIconSizeOverridden(variant);
|
|
16
|
-
export const minWidthButton = (props) => renderMinWidthButton(props);
|
|
17
|
-
minWidthButton.story = {
|
|
18
|
-
name: 'min-width',
|
|
19
|
-
};
|
|
20
|
-
export const link = (props) => renderLink(props);
|
|
21
|
-
link.story = {
|
|
22
|
-
name: 'href',
|
|
23
|
-
};
|
|
24
|
-
export const linkWithTarget = (props) => renderLinkWithTarget(props);
|
|
25
|
-
linkWithTarget.story = {
|
|
26
|
-
name: 'href with target="_blank"',
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=button-accent-fill.stories.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"button-accent-fill.stories.js","sourceRoot":"","sources":["button-accent-fill.stories.ts"],"names":[],"mappings":"AAYA,OAAO,EACH,eAAe,EACf,wBAAwB,EACxB,UAAU,EACV,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,GACjB,MAAM,YAAY,CAAC;AACpB,OAAO,+DAA+D,CAAC;AAEvE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,OAAO,GAAG,QAAQ,CAAC;AACzB,MAAM,SAAS,GAAG,MAAM,CAAC;AAEzB,eAAe;IACX,SAAS,EAAE,WAAW;IACtB,KAAK,EAAE,oBAAoB;IAC3B,IAAI,kCACG,IAAI,KACP,OAAO;QACP,SAAS,GACZ;IACD,QAAQ;CACX,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,KAAiB,EAAkB,EAAE,CACzD,eAAe,CAAC,KAAK,CAAC,CAAC;AAE3B,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAAiB,EAAkB,EAAE,CAC1D,cAAc,CAAC,KAAK,CAAC,CAAC;AAE1B,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAmB,EAAE,CACnD,wBAAwB,CAAC,OAAO,CAAC,CAAC;AAEtC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAiB,EAAkB,EAAE,CAChE,oBAAoB,CAAC,KAAK,CAAC,CAAC;AAEhC,cAAc,CAAC,KAAK,GAAG;IACnB,IAAI,EAAE,WAAW;CACpB,CAAC;AAEF,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,KAAiB,EAAkB,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;AAE7E,IAAI,CAAC,KAAK,GAAG;IACT,IAAI,EAAE,MAAM;CACf,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAiB,EAAkB,EAAE,CAChE,oBAAoB,CAAC,KAAK,CAAC,CAAC;AAEhC,cAAc,CAAC,KAAK,GAAG;IACnB,IAAI,EAAE,2BAA2B;CACpC,CAAC","sourcesContent":["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { TemplateResult } from '@spectrum-web-components/base';\nimport {\n renderButtonSet,\n renderIconSizeOverridden,\n renderLink,\n renderLinkWithTarget,\n renderMinWidthButton,\n renderWithIcon,\n} from './index.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-help.js';\nimport type { Properties } from './index.js';\nimport { args, argTypes } from './index.js';\n\nconst variant = 'accent';\nconst treatment = 'fill';\n\nexport default {\n component: 'sp-button',\n title: 'Button/Accent/Fill',\n args: {\n ...args,\n variant,\n treatment,\n },\n argTypes,\n};\n\nexport const Default = (props: Properties): TemplateResult =>\n renderButtonSet(props);\n\nexport const withIcon = (props: Properties): TemplateResult =>\n renderWithIcon(props);\n\nexport const iconSizeOverridden = (): TemplateResult =>\n renderIconSizeOverridden(variant);\n\nexport const minWidthButton = (props: Properties): TemplateResult =>\n renderMinWidthButton(props);\n\nminWidthButton.story = {\n name: 'min-width',\n};\n\nexport const link = (props: Properties): TemplateResult => renderLink(props);\n\nlink.story = {\n name: 'href',\n};\n\nexport const linkWithTarget = (props: Properties): TemplateResult =>\n renderLinkWithTarget(props);\n\nlinkWithTarget.story = {\n name: 'href with target=\"_blank\"',\n};\n"]}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { renderButtonSet } from './index.js';
|
|
2
|
-
import { args, argTypes } from './index.js';
|
|
3
|
-
const variant = 'accent';
|
|
4
|
-
const treatment = 'outline';
|
|
5
|
-
export default {
|
|
6
|
-
component: 'sp-button',
|
|
7
|
-
title: 'Button/Accent/Outline/Sizes',
|
|
8
|
-
args: Object.assign(Object.assign({}, args), { variant,
|
|
9
|
-
treatment }),
|
|
10
|
-
argTypes,
|
|
11
|
-
};
|
|
12
|
-
export const s = (args) => renderButtonSet(args);
|
|
13
|
-
s.args = {
|
|
14
|
-
size: 's',
|
|
15
|
-
};
|
|
16
|
-
export const m = (args) => renderButtonSet(args);
|
|
17
|
-
m.args = {
|
|
18
|
-
size: 'm',
|
|
19
|
-
};
|
|
20
|
-
export const l = (args) => renderButtonSet(args);
|
|
21
|
-
l.args = {
|
|
22
|
-
size: 'l',
|
|
23
|
-
};
|
|
24
|
-
export const XL = (args) => renderButtonSet(args);
|
|
25
|
-
XL.args = {
|
|
26
|
-
size: 'xl',
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=button-accent-outline-sizes.stories.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"button-accent-outline-sizes.stories.js","sourceRoot":"","sources":["button-accent-outline-sizes.stories.ts"],"names":[],"mappings":"AAYA,OAAO,EAAc,eAAe,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,OAAO,GAAG,QAAQ,CAAC;AACzB,MAAM,SAAS,GAAG,SAAS,CAAC;AAE5B,eAAe;IACX,SAAS,EAAE,WAAW;IACtB,KAAK,EAAE,6BAA6B;IACpC,IAAI,kCACG,IAAI,KACP,OAAO;QACP,SAAS,GACZ;IACD,QAAQ;CACX,CAAC;AAEF,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,IAAgB,EAAkB,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;AAC7E,CAAC,CAAC,IAAI,GAAG;IACL,IAAI,EAAE,GAAG;CACZ,CAAC;AAEF,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,IAAgB,EAAkB,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;AAC7E,CAAC,CAAC,IAAI,GAAG;IACL,IAAI,EAAE,GAAG;CACZ,CAAC;AAEF,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,IAAgB,EAAkB,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;AAC7E,CAAC,CAAC,IAAI,GAAG;IACL,IAAI,EAAE,GAAG;CACZ,CAAC;AAEF,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IAAgB,EAAkB,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;AAC9E,EAAE,CAAC,IAAI,GAAG;IACN,IAAI,EAAE,IAAI;CACb,CAAC","sourcesContent":["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { TemplateResult } from '@spectrum-web-components/base';\nimport { Properties, renderButtonSet } from './index.js';\nimport { args, argTypes } from './index.js';\n\nconst variant = 'accent';\nconst treatment = 'outline';\n\nexport default {\n component: 'sp-button',\n title: 'Button/Accent/Outline/Sizes',\n args: {\n ...args,\n variant,\n treatment,\n },\n argTypes,\n};\n\nexport const s = (args: Properties): TemplateResult => renderButtonSet(args);\ns.args = {\n size: 's',\n};\n\nexport const m = (args: Properties): TemplateResult => renderButtonSet(args);\nm.args = {\n size: 'm',\n};\n\nexport const l = (args: Properties): TemplateResult => renderButtonSet(args);\nl.args = {\n size: 'l',\n};\n\nexport const XL = (args: Properties): TemplateResult => renderButtonSet(args);\nXL.args = {\n size: 'xl',\n};\n"]}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { renderButtonSet, renderIconSizeOverridden, renderLink, renderLinkWithTarget, renderMinWidthButton, renderWithIcon, } from './index.js';
|
|
2
|
-
import '@spectrum-web-components/icons-workflow/icons/sp-icon-help.js';
|
|
3
|
-
import { args, argTypes } from './index.js';
|
|
4
|
-
const variant = 'accent';
|
|
5
|
-
const treatment = 'outline';
|
|
6
|
-
export default {
|
|
7
|
-
component: 'sp-button',
|
|
8
|
-
title: 'Button/Accent/Outline',
|
|
9
|
-
args: Object.assign(Object.assign({}, args), { variant,
|
|
10
|
-
treatment }),
|
|
11
|
-
argTypes,
|
|
12
|
-
};
|
|
13
|
-
export const Default = (props) => renderButtonSet(props);
|
|
14
|
-
export const withIcon = (props) => renderWithIcon(props);
|
|
15
|
-
export const iconSizeOverridden = () => renderIconSizeOverridden(variant);
|
|
16
|
-
export const minWidthButton = (props) => renderMinWidthButton(props);
|
|
17
|
-
minWidthButton.story = {
|
|
18
|
-
name: 'min-width',
|
|
19
|
-
};
|
|
20
|
-
export const link = (props) => renderLink(props);
|
|
21
|
-
link.story = {
|
|
22
|
-
name: 'href',
|
|
23
|
-
};
|
|
24
|
-
export const linkWithTarget = (props) => renderLinkWithTarget(props);
|
|
25
|
-
linkWithTarget.story = {
|
|
26
|
-
name: 'href with target="_blank"',
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=button-accent-outline.stories.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"button-accent-outline.stories.js","sourceRoot":"","sources":["button-accent-outline.stories.ts"],"names":[],"mappings":"AAYA,OAAO,EACH,eAAe,EACf,wBAAwB,EACxB,UAAU,EACV,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,GACjB,MAAM,YAAY,CAAC;AACpB,OAAO,+DAA+D,CAAC;AAEvE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,OAAO,GAAG,QAAQ,CAAC;AACzB,MAAM,SAAS,GAAG,SAAS,CAAC;AAE5B,eAAe;IACX,SAAS,EAAE,WAAW;IACtB,KAAK,EAAE,uBAAuB;IAC9B,IAAI,kCACG,IAAI,KACP,OAAO;QACP,SAAS,GACZ;IACD,QAAQ;CACX,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,KAAiB,EAAkB,EAAE,CACzD,eAAe,CAAC,KAAK,CAAC,CAAC;AAE3B,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAAiB,EAAkB,EAAE,CAC1D,cAAc,CAAC,KAAK,CAAC,CAAC;AAE1B,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAmB,EAAE,CACnD,wBAAwB,CAAC,OAAO,CAAC,CAAC;AAEtC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAiB,EAAkB,EAAE,CAChE,oBAAoB,CAAC,KAAK,CAAC,CAAC;AAEhC,cAAc,CAAC,KAAK,GAAG;IACnB,IAAI,EAAE,WAAW;CACpB,CAAC;AAEF,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,KAAiB,EAAkB,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;AAE7E,IAAI,CAAC,KAAK,GAAG;IACT,IAAI,EAAE,MAAM;CACf,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAiB,EAAkB,EAAE,CAChE,oBAAoB,CAAC,KAAK,CAAC,CAAC;AAEhC,cAAc,CAAC,KAAK,GAAG;IACnB,IAAI,EAAE,2BAA2B;CACpC,CAAC","sourcesContent":["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { TemplateResult } from '@spectrum-web-components/base';\nimport {\n renderButtonSet,\n renderIconSizeOverridden,\n renderLink,\n renderLinkWithTarget,\n renderMinWidthButton,\n renderWithIcon,\n} from './index.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-help.js';\nimport type { Properties } from './index.js';\nimport { args, argTypes } from './index.js';\n\nconst variant = 'accent';\nconst treatment = 'outline';\n\nexport default {\n component: 'sp-button',\n title: 'Button/Accent/Outline',\n args: {\n ...args,\n variant,\n treatment,\n },\n argTypes,\n};\n\nexport const Default = (props: Properties): TemplateResult =>\n renderButtonSet(props);\n\nexport const withIcon = (props: Properties): TemplateResult =>\n renderWithIcon(props);\n\nexport const iconSizeOverridden = (): TemplateResult =>\n renderIconSizeOverridden(variant);\n\nexport const minWidthButton = (props: Properties): TemplateResult =>\n renderMinWidthButton(props);\n\nminWidthButton.story = {\n name: 'min-width',\n};\n\nexport const link = (props: Properties): TemplateResult => renderLink(props);\n\nlink.story = {\n name: 'href',\n};\n\nexport const linkWithTarget = (props: Properties): TemplateResult =>\n renderLinkWithTarget(props);\n\nlinkWithTarget.story = {\n name: 'href with target=\"_blank\"',\n};\n"]}
|