@spectrum-web-components/badge 0.1.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.
@@ -0,0 +1,138 @@
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 '../sp-badge.js';
13
+ import { html } from '@spectrum-web-components/base';
14
+ import '@spectrum-web-components/icons-workflow/icons/sp-icon-checkmark-circle.js';
15
+ export default {
16
+ title: 'Badge',
17
+ component: 'sp-badge',
18
+ };
19
+ export const Default = () => {
20
+ return html `
21
+ <sp-badge>Badge</sp-badge>
22
+ `;
23
+ };
24
+ export const Icons = () => {
25
+ return html `
26
+ <sp-badge>No icon</sp-badge>
27
+
28
+ <sp-badge>
29
+ <sp-icon-checkmark-circle slot="icon"></sp-icon-checkmark-circle>
30
+ Icon and label
31
+ </sp-badge>
32
+
33
+ <sp-badge>
34
+ <sp-icon-checkmark-circle slot="icon"></sp-icon-checkmark-circle>
35
+ </sp-badge>
36
+ `;
37
+ };
38
+ export const Sizes = () => {
39
+ return html `
40
+ <div style="display: flex; align-items: center; gap: 8px;">
41
+ <sp-badge size="s">
42
+ <sp-icon-checkmark-circle
43
+ slot="icon"
44
+ ></sp-icon-checkmark-circle>
45
+ Small
46
+ </sp-badge>
47
+ <sp-badge size="m">
48
+ <sp-icon-checkmark-circle
49
+ slot="icon"
50
+ ></sp-icon-checkmark-circle>
51
+ Medium
52
+ </sp-badge>
53
+ <sp-badge size="l">
54
+ <sp-icon-checkmark-circle
55
+ slot="icon"
56
+ ></sp-icon-checkmark-circle>
57
+ Large
58
+ </sp-badge>
59
+ <sp-badge size="xl">
60
+ <sp-icon-checkmark-circle
61
+ slot="icon"
62
+ ></sp-icon-checkmark-circle>
63
+ Extra-large
64
+ </sp-badge>
65
+ <sp-badge style="max-width: 180px">
66
+ <sp-icon-checkmark-circle
67
+ slot="icon"
68
+ ></sp-icon-checkmark-circle>
69
+ This long content automatically wraps, but shows no more than
70
+ two lines
71
+ </sp-badge>
72
+ </div>
73
+ `;
74
+ };
75
+ export const Semantic = () => {
76
+ return html `
77
+ <sp-badge variant="positive">Positive</sp-badge>
78
+ <sp-badge variant="informative">Informative</sp-badge>
79
+ <sp-badge variant="negative">Negative</sp-badge>
80
+ <sp-badge variant="neutral">Neutral</sp-badge>
81
+ `;
82
+ };
83
+ export const NonSemantic = () => {
84
+ return html `
85
+ <sp-badge variant="seafoam">Seafoam</sp-badge>
86
+ <sp-badge variant="indigo">Indigo</sp-badge>
87
+ <sp-badge variant="purple">Purple</sp-badge>
88
+ <sp-badge variant="fuchsia">Fuchsia</sp-badge>
89
+ <sp-badge variant="magenta">Magenta</sp-badge>
90
+ <sp-badge variant="yellow">Yellow</sp-badge>
91
+ `;
92
+ };
93
+ export const Inline = () => {
94
+ return html `
95
+ Badge is a simple
96
+ <sp-badge variant="positive" size="s">inline</sp-badge>
97
+ element that should
98
+ <sp-badge variant="magenta" size="s">flow</sp-badge>
99
+ with the rest of the page:
100
+ <sp-badge variant="negative">Missing</sp-badge>
101
+ <sp-badge variant="positive">Successful</sp-badge>
102
+ <sp-badge variant="purple">Purple</sp-badge>
103
+ `;
104
+ };
105
+ export const Fixed = () => {
106
+ return html `
107
+ <div
108
+ style="position: relative; width: 400px; height: 200px; background: #eee"
109
+ >
110
+ <sp-badge>None</sp-badge>
111
+ <sp-badge
112
+ fixed="top"
113
+ style="position: absolute; top: 0; left: 200px;"
114
+ >
115
+ Top
116
+ </sp-badge>
117
+ <sp-badge
118
+ fixed="right"
119
+ style="position: absolute; right: 0; top: 100px;"
120
+ >
121
+ Right
122
+ </sp-badge>
123
+ <sp-badge
124
+ fixed="bottom"
125
+ style="position: absolute; bottom: 0; left: 200px;"
126
+ >
127
+ Bottom
128
+ </sp-badge>
129
+ <sp-badge
130
+ fixed="left"
131
+ style="position: absolute; left: 0; top: 100px;"
132
+ >
133
+ Left
134
+ </sp-badge>
135
+ </div>
136
+ `;
137
+ };
138
+ //# sourceMappingURL=badge.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"badge.stories.js","sourceRoot":"","sources":["badge.stories.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,gBAAgB,CAAC;AACxB,OAAO,EAAE,IAAI,EAAkB,MAAM,+BAA+B,CAAC;AACrE,OAAO,2EAA2E,CAAC;AAEnF,eAAe;IACX,KAAK,EAAE,OAAO;IACd,SAAS,EAAE,UAAU;CACxB,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,GAAmB,EAAE;IACxC,OAAO,IAAI,CAAA;;KAEV,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,GAAG,GAAmB,EAAE;IACtC,OAAO,IAAI,CAAA;;;;;;;;;;;KAWV,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,GAAG,GAAmB,EAAE;IACtC,OAAO,IAAI,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAkCV,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAmB,EAAE;IACzC,OAAO,IAAI,CAAA;;;;;KAKV,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,GAAmB,EAAE;IAC5C,OAAO,IAAI,CAAA;;;;;;;KAOV,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG,GAAmB,EAAE;IACvC,OAAO,IAAI,CAAA;;;;;;;;;KASV,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,GAAG,GAAmB,EAAE;IACtC,OAAO,IAAI,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA8BV,CAAC;AACN,CAAC,CAAC","sourcesContent":["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport '../sp-badge.js';\nimport { html, TemplateResult } from '@spectrum-web-components/base';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-checkmark-circle.js';\n\nexport default {\n title: 'Badge',\n component: 'sp-badge',\n};\n\nexport const Default = (): TemplateResult => {\n return html`\n <sp-badge>Badge</sp-badge>\n `;\n};\n\nexport const Icons = (): TemplateResult => {\n return html`\n <sp-badge>No icon</sp-badge>\n\n <sp-badge>\n <sp-icon-checkmark-circle slot=\"icon\"></sp-icon-checkmark-circle>\n Icon and label\n </sp-badge>\n\n <sp-badge>\n <sp-icon-checkmark-circle slot=\"icon\"></sp-icon-checkmark-circle>\n </sp-badge>\n `;\n};\n\nexport const Sizes = (): TemplateResult => {\n return html`\n <div style=\"display: flex; align-items: center; gap: 8px;\">\n <sp-badge size=\"s\">\n <sp-icon-checkmark-circle\n slot=\"icon\"\n ></sp-icon-checkmark-circle>\n Small\n </sp-badge>\n <sp-badge size=\"m\">\n <sp-icon-checkmark-circle\n slot=\"icon\"\n ></sp-icon-checkmark-circle>\n Medium\n </sp-badge>\n <sp-badge size=\"l\">\n <sp-icon-checkmark-circle\n slot=\"icon\"\n ></sp-icon-checkmark-circle>\n Large\n </sp-badge>\n <sp-badge size=\"xl\">\n <sp-icon-checkmark-circle\n slot=\"icon\"\n ></sp-icon-checkmark-circle>\n Extra-large\n </sp-badge>\n <sp-badge style=\"max-width: 180px\">\n <sp-icon-checkmark-circle\n slot=\"icon\"\n ></sp-icon-checkmark-circle>\n This long content automatically wraps, but shows no more than\n two lines\n </sp-badge>\n </div>\n `;\n};\n\nexport const Semantic = (): TemplateResult => {\n return html`\n <sp-badge variant=\"positive\">Positive</sp-badge>\n <sp-badge variant=\"informative\">Informative</sp-badge>\n <sp-badge variant=\"negative\">Negative</sp-badge>\n <sp-badge variant=\"neutral\">Neutral</sp-badge>\n `;\n};\n\nexport const NonSemantic = (): TemplateResult => {\n return html`\n <sp-badge variant=\"seafoam\">Seafoam</sp-badge>\n <sp-badge variant=\"indigo\">Indigo</sp-badge>\n <sp-badge variant=\"purple\">Purple</sp-badge>\n <sp-badge variant=\"fuchsia\">Fuchsia</sp-badge>\n <sp-badge variant=\"magenta\">Magenta</sp-badge>\n <sp-badge variant=\"yellow\">Yellow</sp-badge>\n `;\n};\n\nexport const Inline = (): TemplateResult => {\n return html`\n Badge is a simple\n <sp-badge variant=\"positive\" size=\"s\">inline</sp-badge>\n element that should\n <sp-badge variant=\"magenta\" size=\"s\">flow</sp-badge>\n with the rest of the page:\n <sp-badge variant=\"negative\">Missing</sp-badge>\n <sp-badge variant=\"positive\">Successful</sp-badge>\n <sp-badge variant=\"purple\">Purple</sp-badge>\n `;\n};\n\nexport const Fixed = (): TemplateResult => {\n return html`\n <div\n style=\"position: relative; width: 400px; height: 200px; background: #eee\"\n >\n <sp-badge>None</sp-badge>\n <sp-badge\n fixed=\"top\"\n style=\"position: absolute; top: 0; left: 200px;\"\n >\n Top\n </sp-badge>\n <sp-badge\n fixed=\"right\"\n style=\"position: absolute; right: 0; top: 100px;\"\n >\n Right\n </sp-badge>\n <sp-badge\n fixed=\"bottom\"\n style=\"position: absolute; bottom: 0; left: 200px;\"\n >\n Bottom\n </sp-badge>\n <sp-badge\n fixed=\"left\"\n style=\"position: absolute; left: 0; top: 100px;\"\n >\n Left\n </sp-badge>\n </div>\n `;\n};\n"]}
@@ -0,0 +1,15 @@
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 * as stories from '../stories/badge.stories.js';
13
+ import { regressVisuals } from '../../../test/visual/test.js';
14
+ regressVisuals('BadgeStories', stories);
15
+ //# sourceMappingURL=badge.test-vrt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"badge.test-vrt.js","sourceRoot":"","sources":["badge.test-vrt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,KAAK,OAAO,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,cAAc,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC","sourcesContent":["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport * as stories from '../stories/badge.stories.js';\nimport { regressVisuals } from '../../../test/visual/test.js';\n\nregressVisuals('BadgeStories', stories);\n"]}
@@ -0,0 +1,29 @@
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 { elementUpdated, expect, fixture, html } from '@open-wc/testing';
13
+ import '../sp-badge.js';
14
+ import '../../icons-workflow/icons/sp-icon-checkmark-circle.js';
15
+ describe('Badge', () => {
16
+ it('loads default badge accessibly', async () => {
17
+ const el = await fixture(html `
18
+ <sp-badge>
19
+ <sp-icon-checkmark-circle
20
+ slot="icon"
21
+ ></sp-icon-checkmark-circle>
22
+ Icon and label
23
+ </sp-badge>
24
+ `);
25
+ await elementUpdated(el);
26
+ await expect(el).to.be.accessible();
27
+ });
28
+ });
29
+ //# sourceMappingURL=badge.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"badge.test.js","sourceRoot":"","sources":["badge.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAEzE,OAAO,gBAAgB,CAAC;AACxB,OAAO,wDAAwD,CAAC;AAGhE,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;IACnB,EAAE,CAAC,gCAAgC,EAAE,KAAK,IAAI,EAAE;QAC5C,MAAM,EAAE,GAAG,MAAM,OAAO,CACpB,IAAI,CAAA;;;;;;;aAOH,CACJ,CAAC;QAEF,MAAM,cAAc,CAAC,EAAE,CAAC,CAAC;QAEzB,MAAM,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC;IACxC,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC","sourcesContent":["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport { elementUpdated, expect, fixture, html } from '@open-wc/testing';\n\nimport '../sp-badge.js';\nimport '../../icons-workflow/icons/sp-icon-checkmark-circle.js';\nimport { Badge } from '../src/Badge.js';\n\ndescribe('Badge', () => {\n it('loads default badge accessibly', async () => {\n const el = await fixture<Badge>(\n html`\n <sp-badge>\n <sp-icon-checkmark-circle\n slot=\"icon\"\n ></sp-icon-checkmark-circle>\n Icon and label\n </sp-badge>\n `\n );\n\n await elementUpdated(el);\n\n await expect(el).to.be.accessible();\n });\n});\n"]}
@@ -0,0 +1,22 @@
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 '@spectrum-web-components/badge/sp-badge.js';
13
+ import '@spectrum-web-components/icons-workflow/icons/sp-icon-checkmark-circle.js';
14
+ import { html } from '@spectrum-web-components/base';
15
+ import { measureFixtureCreation } from '../../../../test/benchmark/helpers.js';
16
+ measureFixtureCreation(html `
17
+ <sp-badge>
18
+ <sp-icon-checkmark-circle slot="icon"></sp-icon-checkmark-circle>
19
+ Icon and label
20
+ </sp-badge>
21
+ `);
22
+ //# sourceMappingURL=basic-test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"basic-test.js","sourceRoot":"","sources":["basic-test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;EAUE;AAEF,OAAO,4CAA4C,CAAC;AACpD,OAAO,2EAA2E,CAAC;AACnF,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAE/E,sBAAsB,CAAC,IAAI,CAAA;;;;;CAK1B,CAAC,CAAC","sourcesContent":["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport '@spectrum-web-components/badge/sp-badge.js';\nimport '@spectrum-web-components/icons-workflow/icons/sp-icon-checkmark-circle.js';\nimport { html } from '@spectrum-web-components/base';\nimport { measureFixtureCreation } from '../../../../test/benchmark/helpers.js';\n\nmeasureFixtureCreation(html`\n <sp-badge>\n <sp-icon-checkmark-circle slot=\"icon\"></sp-icon-checkmark-circle>\n Icon and label\n </sp-badge>\n`);\n"]}