@spectrum-web-components/action-button 0.7.2 → 0.7.3-express.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +19 -2
- package/package.json +7 -7
- package/src/ActionButton.d.ts +1 -0
- package/src/ActionButton.js +3 -0
- package/src/ActionButton.js.map +1 -1
- package/src/action-button.css.js +95 -95
- package/src/action-button.css.js.map +1 -1
- package/src/spectrum-action-button.css.js +95 -95
- package/src/spectrum-action-button.css.js.map +1 -1
- package/src/spectrum-config.js +29 -0
- package/stories/action-button-black-quiet.stories.js +34 -0
- package/stories/action-button-black-quiet.stories.js.map +1 -0
- package/stories/action-button-black.stories.js +29 -0
- package/stories/action-button-black.stories.js.map +1 -0
- package/stories/action-button-emphasized-quiet.stories.js +32 -0
- package/stories/action-button-emphasized-quiet.stories.js.map +1 -0
- package/stories/action-button-emphasized.stories.js +27 -0
- package/stories/action-button-emphasized.stories.js.map +1 -0
- package/stories/action-button-quiet.stories.js +27 -0
- package/stories/action-button-quiet.stories.js.map +1 -0
- package/stories/action-button-standard.stories.js +22 -0
- package/stories/action-button-standard.stories.js.map +1 -0
- package/stories/action-button-white-quiet.stories.js +34 -0
- package/stories/action-button-white-quiet.stories.js.map +1 -0
- package/stories/action-button-white.stories.js +29 -0
- package/stories/action-button-white.stories.js.map +1 -0
- package/stories/action-button.stories.js +17 -74
- package/stories/action-button.stories.js.map +1 -1
- package/stories/{action-button-sizes.stories.js → index.js} +26 -44
- package/stories/index.js.map +1 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { makeOverBackground } from '../../button/stories/index.js';
|
|
2
|
+
import { renderButtons } from './index.js';
|
|
3
|
+
export default {
|
|
4
|
+
component: 'sp-action-button',
|
|
5
|
+
title: 'Action Button/Static White Quiet',
|
|
6
|
+
decorators: [makeOverBackground()],
|
|
7
|
+
};
|
|
8
|
+
const variant = 'white';
|
|
9
|
+
const quiet = true;
|
|
10
|
+
export const s = (args) => renderButtons(args);
|
|
11
|
+
s.args = {
|
|
12
|
+
size: 's',
|
|
13
|
+
quiet,
|
|
14
|
+
variant,
|
|
15
|
+
};
|
|
16
|
+
export const m = (args) => renderButtons(args);
|
|
17
|
+
m.args = {
|
|
18
|
+
size: 'm',
|
|
19
|
+
quiet,
|
|
20
|
+
variant,
|
|
21
|
+
};
|
|
22
|
+
export const l = (args) => renderButtons(args);
|
|
23
|
+
l.args = {
|
|
24
|
+
size: 'l',
|
|
25
|
+
quiet,
|
|
26
|
+
variant,
|
|
27
|
+
};
|
|
28
|
+
export const XL = (args) => renderButtons(args);
|
|
29
|
+
XL.args = {
|
|
30
|
+
size: 'xl',
|
|
31
|
+
quiet,
|
|
32
|
+
variant,
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=action-button-white-quiet.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-button-white-quiet.stories.js","sourceRoot":"","sources":["action-button-white-quiet.stories.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,eAAe;IACX,SAAS,EAAE,kBAAkB;IAC7B,KAAK,EAAE,kCAAkC;IACzC,UAAU,EAAE,CAAC,kBAAkB,EAAE,CAAC;CACrC,CAAC;AAEF,MAAM,OAAO,GAAG,OAAO,CAAC;AACxB,MAAM,KAAK,GAAG,IAAI,CAAC;AAEnB,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,IAAgB,EAAkB,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;AAC3E,CAAC,CAAC,IAAI,GAAG;IACL,IAAI,EAAE,GAAG;IACT,KAAK;IACL,OAAO;CACV,CAAC;AAEF,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,IAAgB,EAAkB,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;AAC3E,CAAC,CAAC,IAAI,GAAG;IACL,IAAI,EAAE,GAAG;IACT,KAAK;IACL,OAAO;CACV,CAAC;AAEF,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,IAAgB,EAAkB,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;AAC3E,CAAC,CAAC,IAAI,GAAG;IACL,IAAI,EAAE,GAAG;IACT,KAAK;IACL,OAAO;CACV,CAAC;AAEF,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IAAgB,EAAkB,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;AAC5E,EAAE,CAAC,IAAI,GAAG;IACN,IAAI,EAAE,IAAI;IACV,KAAK;IACL,OAAO;CACV,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 { makeOverBackground } from '../../button/stories/index.js';\nimport type { Properties } from './index.js';\nimport { renderButtons } from './index.js';\n\nexport default {\n component: 'sp-action-button',\n title: 'Action Button/Static White Quiet',\n decorators: [makeOverBackground()],\n};\n\nconst variant = 'white';\nconst quiet = true;\n\nexport const s = (args: Properties): TemplateResult => renderButtons(args);\ns.args = {\n size: 's',\n quiet,\n variant,\n};\n\nexport const m = (args: Properties): TemplateResult => renderButtons(args);\nm.args = {\n size: 'm',\n quiet,\n variant,\n};\n\nexport const l = (args: Properties): TemplateResult => renderButtons(args);\nl.args = {\n size: 'l',\n quiet,\n variant,\n};\n\nexport const XL = (args: Properties): TemplateResult => renderButtons(args);\nXL.args = {\n size: 'xl',\n quiet,\n variant,\n};\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { makeOverBackground } from '../../button/stories/index.js';
|
|
2
|
+
import { renderButtons } from './index.js';
|
|
3
|
+
export default {
|
|
4
|
+
component: 'sp-action-button',
|
|
5
|
+
title: 'Action Button/Static White',
|
|
6
|
+
decorators: [makeOverBackground()],
|
|
7
|
+
};
|
|
8
|
+
const variant = 'white';
|
|
9
|
+
export const s = (args) => renderButtons(args);
|
|
10
|
+
s.args = {
|
|
11
|
+
size: 's',
|
|
12
|
+
variant,
|
|
13
|
+
};
|
|
14
|
+
export const m = (args) => renderButtons(args);
|
|
15
|
+
m.args = {
|
|
16
|
+
size: 'm',
|
|
17
|
+
variant,
|
|
18
|
+
};
|
|
19
|
+
export const l = (args) => renderButtons(args);
|
|
20
|
+
l.args = {
|
|
21
|
+
size: 'l',
|
|
22
|
+
variant,
|
|
23
|
+
};
|
|
24
|
+
export const XL = (args) => renderButtons(args);
|
|
25
|
+
XL.args = {
|
|
26
|
+
size: 'xl',
|
|
27
|
+
variant,
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=action-button-white.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-button-white.stories.js","sourceRoot":"","sources":["action-button-white.stories.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,eAAe;IACX,SAAS,EAAE,kBAAkB;IAC7B,KAAK,EAAE,4BAA4B;IACnC,UAAU,EAAE,CAAC,kBAAkB,EAAE,CAAC;CACrC,CAAC;AAEF,MAAM,OAAO,GAAG,OAAO,CAAC;AAExB,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,IAAgB,EAAkB,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;AAC3E,CAAC,CAAC,IAAI,GAAG;IACL,IAAI,EAAE,GAAG;IACT,OAAO;CACV,CAAC;AAEF,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,IAAgB,EAAkB,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;AAC3E,CAAC,CAAC,IAAI,GAAG;IACL,IAAI,EAAE,GAAG;IACT,OAAO;CACV,CAAC;AAEF,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,IAAgB,EAAkB,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;AAC3E,CAAC,CAAC,IAAI,GAAG;IACL,IAAI,EAAE,GAAG;IACT,OAAO;CACV,CAAC;AAEF,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IAAgB,EAAkB,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;AAC5E,EAAE,CAAC,IAAI,GAAG;IACN,IAAI,EAAE,IAAI;IACV,OAAO;CACV,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 { makeOverBackground } from '../../button/stories/index.js';\nimport type { Properties } from './index.js';\nimport { renderButtons } from './index.js';\n\nexport default {\n component: 'sp-action-button',\n title: 'Action Button/Static White',\n decorators: [makeOverBackground()],\n};\n\nconst variant = 'white';\n\nexport const s = (args: Properties): TemplateResult => renderButtons(args);\ns.args = {\n size: 's',\n variant,\n};\n\nexport const m = (args: Properties): TemplateResult => renderButtons(args);\nm.args = {\n size: 'm',\n variant,\n};\n\nexport const l = (args: Properties): TemplateResult => renderButtons(args);\nl.args = {\n size: 'l',\n variant,\n};\n\nexport const XL = (args: Properties): TemplateResult => renderButtons(args);\nXL.args = {\n size: 'xl',\n variant,\n};\n"]}
|
|
@@ -10,28 +10,11 @@ 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 { html } from '@spectrum-web-components/base';
|
|
13
|
-
import
|
|
14
|
-
import '@spectrum-web-components/action-group';
|
|
15
|
-
import '@spectrum-web-components/icon/sp-icon.js';
|
|
13
|
+
import '@spectrum-web-components/action-group/sp-action-group.js';
|
|
16
14
|
import '@spectrum-web-components/icons-workflow/icons/sp-icon-edit.js';
|
|
17
|
-
import '
|
|
18
|
-
import '@spectrum-web-components/icons-workflow/icons/sp-icon-settings.js';
|
|
15
|
+
import { renderButton } from './index.js';
|
|
19
16
|
import '../src';
|
|
20
17
|
import '../sp-action-button.js';
|
|
21
|
-
function renderButton(args) {
|
|
22
|
-
return html `
|
|
23
|
-
<sp-action-button
|
|
24
|
-
?quiet="${!!args.quiet}"
|
|
25
|
-
?emphasized="${!!args.emphasized}"
|
|
26
|
-
?disabled=${!!args.disabled}
|
|
27
|
-
?selected=${!!args.selected}
|
|
28
|
-
?toggles=${!!args.toggles}
|
|
29
|
-
size=${args.size || 'm'}
|
|
30
|
-
>
|
|
31
|
-
Action
|
|
32
|
-
</sp-action-button>
|
|
33
|
-
`;
|
|
34
|
-
}
|
|
35
18
|
export default {
|
|
36
19
|
component: 'sp-action-button',
|
|
37
20
|
title: 'Action Button',
|
|
@@ -40,52 +23,25 @@ function renderButtonsSelected(args) {
|
|
|
40
23
|
const disabled = Object.assign({}, args, { disabled: true });
|
|
41
24
|
const selected = Object.assign({}, args, { selected: true });
|
|
42
25
|
return html `
|
|
43
|
-
<sp-action-group
|
|
26
|
+
<sp-action-group
|
|
27
|
+
?emphasized="${!!args.emphasized}"
|
|
28
|
+
?quiet="${!!args.quiet}"
|
|
29
|
+
>
|
|
44
30
|
${renderButton(args)} ${renderButton(selected)}
|
|
45
31
|
${renderButton(disabled)}
|
|
46
32
|
</sp-action-group>
|
|
47
33
|
`;
|
|
48
34
|
}
|
|
49
|
-
export const emphasized = (args) => renderButtonsSelected(args);
|
|
50
|
-
emphasized.args = {
|
|
51
|
-
emphasized: true,
|
|
52
|
-
};
|
|
53
|
-
export const emphasizedAndQuiet = (args) => renderButtonsSelected(args);
|
|
54
|
-
emphasizedAndQuiet.args = {
|
|
55
|
-
emphasized: true,
|
|
56
|
-
quiet: true,
|
|
57
|
-
};
|
|
58
|
-
export const quiet = (args) => renderButtonsSelected(args);
|
|
59
|
-
quiet.args = {
|
|
60
|
-
quiet: true,
|
|
61
|
-
};
|
|
62
35
|
export const toggles = (args) => renderButtonsSelected(args);
|
|
63
36
|
toggles.args = {
|
|
64
37
|
toggles: true,
|
|
38
|
+
icon: html `
|
|
39
|
+
<sp-icon-edit hidden slot="icon"></sp-icon-edit>
|
|
40
|
+
`,
|
|
65
41
|
};
|
|
66
|
-
export const
|
|
42
|
+
export const iconSizeOverridden = (args) => {
|
|
67
43
|
return html `
|
|
68
|
-
|
|
69
|
-
<sp-icon-edit slot="icon"></sp-icon-edit>
|
|
70
|
-
This is an action button
|
|
71
|
-
</sp-action-button>
|
|
72
|
-
`;
|
|
73
|
-
};
|
|
74
|
-
wIconButton.story = {
|
|
75
|
-
name: 'w/ Icon button',
|
|
76
|
-
};
|
|
77
|
-
export const iconOnlyButton = (args) => {
|
|
78
|
-
return html `
|
|
79
|
-
<sp-action-button label="Edit" ${spreadProps(args)}>
|
|
80
|
-
<sp-icon-edit slot="icon"></sp-icon-edit>
|
|
81
|
-
</sp-action-button>
|
|
82
|
-
`;
|
|
83
|
-
};
|
|
84
|
-
export const iconSizeOverridden = () => {
|
|
85
|
-
return html `
|
|
86
|
-
<sp-action-button label="Edit" size="xl">
|
|
87
|
-
<sp-icon-edit slot="icon" size="s"></sp-icon-edit>
|
|
88
|
-
</sp-action-button>
|
|
44
|
+
${renderButton(args)}
|
|
89
45
|
<h1>For testing purposes only</h1>
|
|
90
46
|
<p>
|
|
91
47
|
This is a test to ensure that sizing the icon will still work when
|
|
@@ -94,24 +50,11 @@ export const iconSizeOverridden = () => {
|
|
|
94
50
|
</p>
|
|
95
51
|
`;
|
|
96
52
|
};
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
<sp-action-button ?hold-affordance=${holdAffordance} quiet>
|
|
105
|
-
<sp-icon-settings slot="icon"></sp-icon-settings>
|
|
106
|
-
</sp-action-button>
|
|
107
|
-
|
|
108
|
-
<sp-action-button ?hold-affordance=${holdAffordance} selected>
|
|
109
|
-
<sp-icon-more slot="icon"></sp-icon-more>
|
|
110
|
-
</sp-action-button>
|
|
111
|
-
</sp-action-group>
|
|
112
|
-
`;
|
|
113
|
-
};
|
|
114
|
-
holdAffordance.args = {
|
|
115
|
-
holdAffordance: true,
|
|
53
|
+
iconSizeOverridden.args = {
|
|
54
|
+
label: '',
|
|
55
|
+
size: 'xl',
|
|
56
|
+
icon: html `
|
|
57
|
+
<sp-icon-edit slot="icon" size="s"></sp-icon-edit>
|
|
58
|
+
`,
|
|
116
59
|
};
|
|
117
60
|
//# sourceMappingURL=action-button.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-button.stories.js","sourceRoot":"","sources":["action-button.stories.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,EAAE,IAAI,EAAkB,MAAM,+BAA+B,CAAC;AACrE,OAAO,
|
|
1
|
+
{"version":3,"file":"action-button.stories.js","sourceRoot":"","sources":["action-button.stories.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AACF,OAAO,EAAE,IAAI,EAAkB,MAAM,+BAA+B,CAAC;AACrE,OAAO,0DAA0D,CAAC;AAClE,OAAO,+DAA+D,CAAC;AAEvE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,OAAO,QAAQ,CAAC;AAChB,OAAO,wBAAwB,CAAC;AAEhC,eAAe;IACX,SAAS,EAAE,kBAAkB;IAC7B,KAAK,EAAE,eAAe;CACzB,CAAC;AAEF,SAAS,qBAAqB,CAAC,IAAgB;IAC3C,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7D,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7D,OAAO,IAAI,CAAA;;2BAEY,CAAC,CAAC,IAAI,CAAC,UAAU;sBACtB,CAAC,CAAC,IAAI,CAAC,KAAK;;cAEpB,YAAY,CAAC,IAAI,CAAC,IAAI,YAAY,CAAC,QAAQ,CAAC;cAC5C,YAAY,CAAC,QAAQ,CAAC;;KAE/B,CAAC;AACN,CAAC;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAAgB,EAAkB,EAAE,CACxD,qBAAqB,CAAC,IAAI,CAAC,CAAC;AAChC,OAAO,CAAC,IAAI,GAAG;IACX,OAAO,EAAE,IAAI;IACb,IAAI,EAAE,IAAI,CAAA;;KAET;CACJ,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,IAAgB,EAAkB,EAAE;IACnE,OAAO,IAAI,CAAA;UACL,YAAY,CAAC,IAAI,CAAC;;;;;;;KAOvB,CAAC;AACN,CAAC,CAAC;AACF,kBAAkB,CAAC,IAAI,GAAG;IACtB,KAAK,EAAE,EAAE;IACT,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,IAAI,CAAA;;KAET;CACJ,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 '@spectrum-web-components/action-group/sp-action-group.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-edit.js';\nimport type { Properties } from './index.js';\nimport { renderButton } from './index.js';\n\nimport '../src';\nimport '../sp-action-button.js';\n\nexport default {\n component: 'sp-action-button',\n title: 'Action Button',\n};\n\nfunction renderButtonsSelected(args: Properties): TemplateResult {\n const disabled = Object.assign({}, args, { disabled: true });\n const selected = Object.assign({}, args, { selected: true });\n return html`\n <sp-action-group\n ?emphasized=\"${!!args.emphasized}\"\n ?quiet=\"${!!args.quiet}\"\n >\n ${renderButton(args)} ${renderButton(selected)}\n ${renderButton(disabled)}\n </sp-action-group>\n `;\n}\n\nexport const toggles = (args: Properties): TemplateResult =>\n renderButtonsSelected(args);\ntoggles.args = {\n toggles: true,\n icon: html`\n <sp-icon-edit hidden slot=\"icon\"></sp-icon-edit>\n `,\n};\n\nexport const iconSizeOverridden = (args: Properties): TemplateResult => {\n return html`\n ${renderButton(args)}\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};\niconSizeOverridden.args = {\n label: '',\n size: 'xl',\n icon: html`\n <sp-icon-edit slot=\"icon\" size=\"s\"></sp-icon-edit>\n `,\n};\n"]}
|
|
@@ -10,15 +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 { html } from '@spectrum-web-components/base';
|
|
13
|
+
import { ifDefined } from '@spectrum-web-components/base/src/directives.js';
|
|
14
|
+
import '@spectrum-web-components/action-group/sp-action-group.js';
|
|
13
15
|
import '@spectrum-web-components/icon/sp-icon.js';
|
|
14
16
|
import '@spectrum-web-components/icons-workflow/icons/sp-icon-edit.js';
|
|
15
17
|
import '../src';
|
|
16
18
|
import '../sp-action-button.js';
|
|
17
|
-
function renderButton(properties) {
|
|
19
|
+
export function renderButton(properties) {
|
|
18
20
|
return html `
|
|
19
21
|
<sp-action-button
|
|
20
22
|
?quiet="${!!properties.quiet}"
|
|
21
23
|
?emphasized="${!!properties.emphasized}"
|
|
24
|
+
variant="${ifDefined(properties.variant)}"
|
|
22
25
|
?disabled=${!!properties.disabled}
|
|
23
26
|
?selected=${!!properties.selected}
|
|
24
27
|
?toggles=${!!properties.toggles}
|
|
@@ -30,60 +33,39 @@ function renderButton(properties) {
|
|
|
30
33
|
</sp-action-button>
|
|
31
34
|
`;
|
|
32
35
|
}
|
|
33
|
-
function
|
|
36
|
+
function renderGroup(properties) {
|
|
37
|
+
const label = 'Edit';
|
|
38
|
+
const holdAffordance = true;
|
|
34
39
|
const icon = html `
|
|
35
40
|
<sp-icon-edit hidden slot="icon"></sp-icon-edit>
|
|
36
41
|
`;
|
|
37
|
-
const label = 'Edit';
|
|
38
|
-
const emphasized = true;
|
|
39
|
-
const holdAffordance = true;
|
|
40
|
-
const quiet = true;
|
|
41
|
-
const selected = true;
|
|
42
|
-
const disabled = true;
|
|
43
|
-
const disabledArgs = Object.assign({}, properties, { disabled: true });
|
|
44
|
-
const selectedArgs = Object.assign({}, properties, { selected: true });
|
|
45
42
|
return html `
|
|
46
|
-
<
|
|
43
|
+
<sp-action-group
|
|
44
|
+
?quiet="${!!properties.quiet}"
|
|
45
|
+
?emphasized="${!!properties.emphasized}"
|
|
46
|
+
>
|
|
47
47
|
${renderButton(Object.assign(Object.assign({}, properties), { label }))}
|
|
48
48
|
${renderButton(Object.assign(Object.assign({}, properties), { label,
|
|
49
49
|
icon }))}
|
|
50
50
|
${renderButton(Object.assign(Object.assign({}, properties), { icon }))}
|
|
51
51
|
${renderButton(Object.assign(Object.assign({}, properties), { icon,
|
|
52
52
|
holdAffordance }))}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
53
|
+
</sp-action-group>
|
|
54
|
+
`;
|
|
55
|
+
}
|
|
56
|
+
export function renderButtons(properties) {
|
|
57
|
+
const selected = true;
|
|
58
|
+
const disabled = true;
|
|
59
|
+
return html `
|
|
60
|
+
<div
|
|
61
|
+
style="display: flex; flex-direction: column; gap: var(--spectrum-global-dimension-size-100);"
|
|
62
|
+
>
|
|
63
|
+
${renderGroup(Object.assign({}, properties))}
|
|
64
|
+
${renderGroup(Object.assign(Object.assign({}, properties), { selected }))}
|
|
65
|
+
${renderGroup(Object.assign(Object.assign({}, properties), { disabled }))}
|
|
66
|
+
${renderGroup(Object.assign(Object.assign({}, properties), { disabled,
|
|
61
67
|
selected }))}
|
|
62
|
-
${renderButton(Object.assign(Object.assign({}, selectedArgs), { icon }))}
|
|
63
|
-
${renderButton(Object.assign(Object.assign({}, selectedArgs), { emphasized,
|
|
64
|
-
icon }))}
|
|
65
|
-
${renderButton(Object.assign(Object.assign({}, disabledArgs), { icon }))}
|
|
66
68
|
</div>
|
|
67
69
|
`;
|
|
68
70
|
}
|
|
69
|
-
|
|
70
|
-
component: 'sp-action-button',
|
|
71
|
-
title: 'Action Button/Sizes',
|
|
72
|
-
};
|
|
73
|
-
export const s = (args) => renderButtonsSelected(args);
|
|
74
|
-
s.args = {
|
|
75
|
-
size: 's',
|
|
76
|
-
};
|
|
77
|
-
export const m = (args) => renderButtonsSelected(args);
|
|
78
|
-
m.args = {
|
|
79
|
-
size: 'm',
|
|
80
|
-
};
|
|
81
|
-
export const l = (args) => renderButtonsSelected(args);
|
|
82
|
-
l.args = {
|
|
83
|
-
size: 'l',
|
|
84
|
-
};
|
|
85
|
-
export const XL = (args) => renderButtonsSelected(args);
|
|
86
|
-
XL.args = {
|
|
87
|
-
size: 'xl',
|
|
88
|
-
};
|
|
89
|
-
//# sourceMappingURL=action-button-sizes.stories.js.map
|
|
71
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,EAAE,IAAI,EAAkB,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,iDAAiD,CAAC;AAC5E,OAAO,0DAA0D,CAAC;AAClE,OAAO,0CAA0C,CAAC;AAClD,OAAO,+DAA+D,CAAC;AAEvE,OAAO,QAAQ,CAAC;AAChB,OAAO,wBAAwB,CAAC;AAiBhC,MAAM,UAAU,YAAY,CAAC,UAAsB;IAC/C,OAAO,IAAI,CAAA;;sBAEO,CAAC,CAAC,UAAU,CAAC,KAAK;2BACb,CAAC,CAAC,UAAU,CAAC,UAAU;uBAC3B,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC;wBAC5B,CAAC,CAAC,UAAU,CAAC,QAAQ;wBACrB,CAAC,CAAC,UAAU,CAAC,QAAQ;uBACtB,CAAC,CAAC,UAAU,CAAC,OAAO;mBACxB,UAAU,CAAC,IAAI,IAAI,GAAG;+BACV,CAAC,CAAC,UAAU,CAAC,cAAc;sBACpC,CAAC,CAAC,UAAU,CAAC,MAAM;;cAE3B,UAAU,CAAC,IAAI,GAAG,UAAU,CAAC,KAAK;;KAE3C,CAAC;AACN,CAAC;AAED,SAAS,WAAW,CAAC,UAAsB;IACvC,MAAM,KAAK,GAAG,MAAM,CAAC;IACrB,MAAM,cAAc,GAAG,IAAI,CAAC;IAC5B,MAAM,IAAI,GAAG,IAAI,CAAA;;KAEhB,CAAC;IACF,OAAO,IAAI,CAAA;;sBAEO,CAAC,CAAC,UAAU,CAAC,KAAK;2BACb,CAAC,CAAC,UAAU,CAAC,UAAU;;cAEpC,YAAY,iCACP,UAAU,KACb,KAAK,IACP;cACA,YAAY,iCACP,UAAU,KACb,KAAK;QACL,IAAI,IACN;cACA,YAAY,iCACP,UAAU,KACb,IAAI,IACN;cACA,YAAY,iCACP,UAAU,KACb,IAAI;QACJ,cAAc,IAChB;;KAET,CAAC;AACN,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,UAAsB;IAChD,MAAM,QAAQ,GAAG,IAAI,CAAC;IACtB,MAAM,QAAQ,GAAG,IAAI,CAAC;IACtB,OAAO,IAAI,CAAA;;;;cAID,WAAW,mBACN,UAAU,EACf;cACA,WAAW,iCACN,UAAU,KACb,QAAQ,IACV;cACA,WAAW,iCACN,UAAU,KACb,QAAQ,IACV;cACA,WAAW,iCACN,UAAU,KACb,QAAQ;QACR,QAAQ,IACV;;KAET,CAAC;AACN,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 { html, TemplateResult } from '@spectrum-web-components/base';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\nimport '@spectrum-web-components/action-group/sp-action-group.js';\nimport '@spectrum-web-components/icon/sp-icon.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-edit.js';\n\nimport '../src';\nimport '../sp-action-button.js';\n\nexport interface Properties {\n active?: boolean;\n quiet?: boolean;\n disabled?: boolean;\n selected?: boolean;\n toggles?: boolean;\n emphasized?: boolean;\n size?: 's' | 'm' | 'l' | 'xl';\n variant?: 'white' | 'black';\n holdAffordance?: boolean;\n icon?: TemplateResult;\n label?: string;\n [prop: string]: unknown;\n}\n\nexport function renderButton(properties: Properties): TemplateResult {\n return html`\n <sp-action-button\n ?quiet=\"${!!properties.quiet}\"\n ?emphasized=\"${!!properties.emphasized}\"\n variant=\"${ifDefined(properties.variant)}\"\n ?disabled=${!!properties.disabled}\n ?selected=${!!properties.selected}\n ?toggles=${!!properties.toggles}\n size=${properties.size || 'm'}\n ?hold-affordance=${!!properties.holdAffordance}\n ?active=${!!properties.active}\n >\n ${properties.icon}${properties.label}\n </sp-action-button>\n `;\n}\n\nfunction renderGroup(properties: Properties): TemplateResult {\n const label = 'Edit';\n const holdAffordance = true;\n const icon = html`\n <sp-icon-edit hidden slot=\"icon\"></sp-icon-edit>\n `;\n return html`\n <sp-action-group\n ?quiet=\"${!!properties.quiet}\"\n ?emphasized=\"${!!properties.emphasized}\"\n >\n ${renderButton({\n ...properties,\n label,\n })}\n ${renderButton({\n ...properties,\n label,\n icon,\n })}\n ${renderButton({\n ...properties,\n icon,\n })}\n ${renderButton({\n ...properties,\n icon,\n holdAffordance,\n })}\n </sp-action-group>\n `;\n}\n\nexport function renderButtons(properties: Properties): TemplateResult {\n const selected = true;\n const disabled = true;\n return html`\n <div\n style=\"display: flex; flex-direction: column; gap: var(--spectrum-global-dimension-size-100);\"\n >\n ${renderGroup({\n ...properties,\n })}\n ${renderGroup({\n ...properties,\n selected,\n })}\n ${renderGroup({\n ...properties,\n disabled,\n })}\n ${renderGroup({\n ...properties,\n disabled,\n selected,\n })}\n </div>\n `;\n}\n"]}
|