@codeforamerica/marcomms-design-system 1.19.0 → 1.19.1
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/package.json +2 -1
- package/src/components/accordion.js +141 -0
- package/src/components/accordion.stories.js +56 -0
- package/src/components/avatar.js +62 -0
- package/src/components/avatar.stories.js +27 -0
- package/src/components/bar.js +102 -0
- package/src/components/bar.stories.js +22 -0
- package/src/components/blob.js +128 -0
- package/src/components/blob.stories.js +73 -0
- package/src/components/box.js +55 -0
- package/src/components/box.stories.js +24 -0
- package/src/components/breadcrumbs.js +80 -0
- package/src/components/breadcrumbs.stories.js +27 -0
- package/src/components/button.js +163 -0
- package/src/components/button.scss +157 -0
- package/src/components/button.stories.js +49 -0
- package/src/components/callout.js +62 -0
- package/src/components/callout.stories.js +20 -0
- package/src/components/card.js +456 -0
- package/src/components/card.stories.js +227 -0
- package/src/components/carousel.js +662 -0
- package/src/components/carousel.stories.js +165 -0
- package/src/components/details.scss +71 -0
- package/src/components/details.stories.js +27 -0
- package/src/components/form-elements.scss +304 -0
- package/src/components/form-elements.stories.js +134 -0
- package/src/components/icon.js +44 -0
- package/src/components/icon.scss +32 -0
- package/src/components/icon.stories.js +38 -0
- package/src/components/label.js +63 -0
- package/src/components/label.stories.js +29 -0
- package/src/components/link-list.scss +80 -0
- package/src/components/link-list.stories.js +52 -0
- package/src/components/loader.scss +24 -0
- package/src/components/loader.stories.js +12 -0
- package/src/components/logo-card.js +93 -0
- package/src/components/logo-card.stories.js +48 -0
- package/src/components/nav.js +98 -0
- package/src/components/nav.stories.js +40 -0
- package/src/components/page-nav.js +171 -0
- package/src/components/page-nav.stories.js +112 -0
- package/src/components/pager.js +98 -0
- package/src/components/pager.stories.js +30 -0
- package/src/components/pagination.js +116 -0
- package/src/components/pagination.stories.js +30 -0
- package/src/components/person-card.js +240 -0
- package/src/components/person-card.stories.js +58 -0
- package/src/components/pill.js +33 -0
- package/src/components/pill.stories.js +25 -0
- package/src/components/placeholder.js +25 -0
- package/src/components/placeholder.stories.js +10 -0
- package/src/components/promo.js +82 -0
- package/src/components/promo.stories.js +37 -0
- package/src/components/pullquote.js +42 -0
- package/src/components/pullquote.stories.js +16 -0
- package/src/components/quote.js +111 -0
- package/src/components/quote.stories.js +23 -0
- package/src/components/reveal.js +83 -0
- package/src/components/reveal.stories.js +40 -0
- package/src/components/slide.js +122 -0
- package/src/components/slide.stories.js +49 -0
- package/src/components/social-icon.js +236 -0
- package/src/components/social-icon.stories.js +36 -0
- package/src/components/stat.js +92 -0
- package/src/components/stat.stories.js +28 -0
- package/src/components/tab-list.js +114 -0
- package/src/components/tab-list.stories.js +18 -0
- package/src/components/tab.js +95 -0
- package/src/components/tab.stories.js +29 -0
- package/src/components/tile.js +149 -0
- package/src/components/tile.stories.js +41 -0
- package/src/components/transcript.js +44 -0
- package/src/components/transcript.stories.js +103 -0
- package/src/core/base.scss +86 -0
- package/src/core/colors.mdx +100 -0
- package/src/core/grid.mdx +244 -0
- package/src/core/grid.scss +394 -0
- package/src/core/helpers.scss +111 -0
- package/src/core/layout.scss +103 -0
- package/src/core/layout.stories.js +145 -0
- package/src/core/reset.scss +53 -0
- package/src/core/shadows.mdx +108 -0
- package/src/core/tokens.scss +261 -0
- package/src/core/typography.mdx +79 -0
- package/src/core/typography.scss +411 -0
- package/src/core.js +10 -0
- package/src/index.js +43 -0
- package/src/shared/common.js +65 -0
- package/src/shared/layout.js +14 -0
- package/src/shared/typography.js +397 -0
- package/src/styles.scss +15 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codeforamerica/marcomms-design-system",
|
|
3
|
-
"version": "1.19.
|
|
3
|
+
"version": "1.19.1",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"lit": "^3.2.1",
|
|
@@ -81,6 +81,7 @@
|
|
|
81
81
|
"./components/*": "./dist/components/*.js"
|
|
82
82
|
},
|
|
83
83
|
"files": [
|
|
84
|
+
"src/",
|
|
84
85
|
"dist/",
|
|
85
86
|
"README.md"
|
|
86
87
|
]
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { html, css, LitElement } from "lit";
|
|
2
|
+
import { commonStyles } from "../shared/common";
|
|
3
|
+
|
|
4
|
+
class AccordionItem extends LitElement {
|
|
5
|
+
static properties = {
|
|
6
|
+
open: { type: Boolean },
|
|
7
|
+
};
|
|
8
|
+
static styles = [
|
|
9
|
+
commonStyles,
|
|
10
|
+
css`
|
|
11
|
+
:host {
|
|
12
|
+
--color: var(--purple-60);
|
|
13
|
+
--hover-bg-color: var(--blue-20);
|
|
14
|
+
|
|
15
|
+
display: block;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.item {
|
|
19
|
+
border-bottom: var(--thin) solid var(--black-20);
|
|
20
|
+
max-width: var(--column-span-8);
|
|
21
|
+
margin-inline: auto;
|
|
22
|
+
background-color: var(--bg-color);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.header {
|
|
26
|
+
align-items: center;
|
|
27
|
+
color: var(--color);
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
display: flex;
|
|
30
|
+
flex-direction: row;
|
|
31
|
+
padding-block: var(--spacing-component-3);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.header:hover {
|
|
35
|
+
background-color: var(--hover-bg-color);
|
|
36
|
+
box-shadow:
|
|
37
|
+
var(--spacing-component-3) 0 var(--blue-20),
|
|
38
|
+
calc(-1 * var(--spacing-component-3)) 0 var(--blue-20);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.header:focus {
|
|
42
|
+
outline: none;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.title {
|
|
46
|
+
flex: 1;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.title ::slotted(*) {
|
|
50
|
+
font-family: var(--font-family-sans-serif) !important;
|
|
51
|
+
font-size: var(--base-font-size) !important;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.icon {
|
|
55
|
+
flex: 0;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.body {
|
|
59
|
+
opacity: 0;
|
|
60
|
+
max-height: 0;
|
|
61
|
+
overflow: hidden;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.body.open {
|
|
65
|
+
max-height: unset;
|
|
66
|
+
opacity: 1;
|
|
67
|
+
padding-block: var(--spacing-layout-half) var(--spacing-layout-1);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.body ::slotted(*) {
|
|
71
|
+
margin-block-start: 0 !important;
|
|
72
|
+
}
|
|
73
|
+
`,
|
|
74
|
+
];
|
|
75
|
+
constructor() {
|
|
76
|
+
super();
|
|
77
|
+
this.open = false;
|
|
78
|
+
}
|
|
79
|
+
toggle() {
|
|
80
|
+
this.open = !this.open;
|
|
81
|
+
}
|
|
82
|
+
handleKeyPress(event) {
|
|
83
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
84
|
+
this.toggle();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
render() {
|
|
88
|
+
return html`
|
|
89
|
+
<div class="item">
|
|
90
|
+
<div
|
|
91
|
+
class="header"
|
|
92
|
+
role="button"
|
|
93
|
+
aria-expanded=${this.open ? "true" : "false"}
|
|
94
|
+
tabindex="0"
|
|
95
|
+
@click=${this.toggle}
|
|
96
|
+
@keypress=${this.handleKeyPress}
|
|
97
|
+
>
|
|
98
|
+
<div class="title">
|
|
99
|
+
<slot name="title"></slot>
|
|
100
|
+
</div>
|
|
101
|
+
<span class="icon" aria-hidden="true">
|
|
102
|
+
${this.open
|
|
103
|
+
? html`<cfa-icon>expand_less</cfa-icon>`
|
|
104
|
+
: html`<cfa-icon>expand_more</cfa-icon>`}
|
|
105
|
+
</span>
|
|
106
|
+
</div>
|
|
107
|
+
<div
|
|
108
|
+
class="body ${this.open ? "open" : ""}"
|
|
109
|
+
role="region"
|
|
110
|
+
aria-hidden=${this.open ? "false" : "true"}
|
|
111
|
+
>
|
|
112
|
+
<slot></slot>
|
|
113
|
+
</div>
|
|
114
|
+
</div>
|
|
115
|
+
`;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
class Accordion extends LitElement {
|
|
120
|
+
static styles = css`
|
|
121
|
+
:host {
|
|
122
|
+
display: block;
|
|
123
|
+
}
|
|
124
|
+
`;
|
|
125
|
+
|
|
126
|
+
render() {
|
|
127
|
+
return html`
|
|
128
|
+
<div role="tablist">
|
|
129
|
+
<slot></slot>
|
|
130
|
+
</div>
|
|
131
|
+
`;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (!customElements.get("cfa-accordion-item")) {
|
|
136
|
+
customElements.define("cfa-accordion-item", AccordionItem);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (!customElements.get("cfa-accordion")) {
|
|
140
|
+
customElements.define("cfa-accordion", Accordion);
|
|
141
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { html } from "lit-html";
|
|
2
|
+
import "./accordion";
|
|
3
|
+
import "./icon";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: "Molecules/Accordion",
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const Template = () => html`
|
|
10
|
+
<cfa-accordion>
|
|
11
|
+
<cfa-accordion-item>
|
|
12
|
+
<h3 slot="title">What is the desired skillset for these roles?</h3>
|
|
13
|
+
<div>
|
|
14
|
+
<p>
|
|
15
|
+
Even though the services being offered are tax-related, no previous
|
|
16
|
+
tax knowledge or tax preparation experience is required to volunteer.
|
|
17
|
+
</p>
|
|
18
|
+
<p>
|
|
19
|
+
Our training will give you all the info you need to succeed in
|
|
20
|
+
whichever role you choose. Much of the work is focused primarily on
|
|
21
|
+
customer service. We will provide training for any relevant tax law
|
|
22
|
+
needed to perform in your role.
|
|
23
|
+
</p>
|
|
24
|
+
</div>
|
|
25
|
+
</cfa-accordion-item>
|
|
26
|
+
<cfa-accordion-item>
|
|
27
|
+
<h3 slot="title">
|
|
28
|
+
What is the minimum number of hours a volunteer must serve?
|
|
29
|
+
</h3>
|
|
30
|
+
<div>
|
|
31
|
+
<p>
|
|
32
|
+
With customer service at the heart of our work, our volunteers are
|
|
33
|
+
asked to serve at least four to six hours per week to ensure they are
|
|
34
|
+
able to respond in a timely manner to the client they’re serving.
|
|
35
|
+
</p>
|
|
36
|
+
</div>
|
|
37
|
+
</cfa-accordion-item>
|
|
38
|
+
<cfa-accordion-item>
|
|
39
|
+
<h3 slot="title">
|
|
40
|
+
What is the Volunteer Income Tax Assistance program (VITA)?
|
|
41
|
+
</h3>
|
|
42
|
+
<div>
|
|
43
|
+
<a href="#">Volunteer Income Tax Assistance (VITA)</a> is a program that
|
|
44
|
+
came out of the IRS over 50 years ago and was designed to help taxpayers
|
|
45
|
+
with low income file their tax returns for free. The program has been
|
|
46
|
+
wildly successful and nonprofits all over the country offer VITA
|
|
47
|
+
services as a means to fight poverty and promote financial stability.
|
|
48
|
+
Since 2021, many VITA organizations across the country have begun to use
|
|
49
|
+
GetYourRefund to serve clients virtually.
|
|
50
|
+
</div>
|
|
51
|
+
</cfa-accordion-item>
|
|
52
|
+
</cfa-accordion>
|
|
53
|
+
`;
|
|
54
|
+
|
|
55
|
+
export const Default = Template.bind({});
|
|
56
|
+
Default.args = {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { LitElement, html, css, nothing } from "lit";
|
|
2
|
+
import { commonStyles } from "../shared/common";
|
|
3
|
+
|
|
4
|
+
class Avatar extends LitElement {
|
|
5
|
+
static properties = {
|
|
6
|
+
imageUrl: {},
|
|
7
|
+
altText: {},
|
|
8
|
+
size: {},
|
|
9
|
+
};
|
|
10
|
+
static styles = [
|
|
11
|
+
commonStyles,
|
|
12
|
+
css`
|
|
13
|
+
:host {
|
|
14
|
+
--bg-color: var(--blue-20);
|
|
15
|
+
|
|
16
|
+
display: inline-block;
|
|
17
|
+
max-width: 100%;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
picture {
|
|
21
|
+
aspect-ratio: 1 / 1;
|
|
22
|
+
background-color: var(--bg-color);
|
|
23
|
+
border-radius: 50%;
|
|
24
|
+
display: block;
|
|
25
|
+
max-width: 100%;
|
|
26
|
+
overflow: hidden;
|
|
27
|
+
width: var(--size);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
img {
|
|
31
|
+
display: block;
|
|
32
|
+
height: 100%;
|
|
33
|
+
object-fit: cover;
|
|
34
|
+
width: 100%;
|
|
35
|
+
}
|
|
36
|
+
`,
|
|
37
|
+
];
|
|
38
|
+
render() {
|
|
39
|
+
return html`
|
|
40
|
+
<style>
|
|
41
|
+
:host {
|
|
42
|
+
--size: var(--spacing-layout-${this.size || "4"}, 8rem);
|
|
43
|
+
}
|
|
44
|
+
</style>
|
|
45
|
+
<picture>
|
|
46
|
+
${this.imageUrl
|
|
47
|
+
? html`
|
|
48
|
+
<img
|
|
49
|
+
src="${this.imageUrl}"
|
|
50
|
+
loading="lazy"
|
|
51
|
+
alt="${this.altText}"
|
|
52
|
+
/>
|
|
53
|
+
`
|
|
54
|
+
: nothing}
|
|
55
|
+
</picture>
|
|
56
|
+
`;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (!customElements.get("cfa-avatar")) {
|
|
61
|
+
customElements.define("cfa-avatar", Avatar);
|
|
62
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { html } from "lit-html";
|
|
2
|
+
import "./avatar";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Atoms/Avatar",
|
|
6
|
+
argTypes: {
|
|
7
|
+
imageUrl: { type: "string" },
|
|
8
|
+
altText: { type: "string" },
|
|
9
|
+
size: { type: "number", control: { type: "range", min: 1, max: 8 } },
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const Template = ({ imageUrl, altText, size }) => html`
|
|
14
|
+
<cfa-avatar
|
|
15
|
+
imageUrl="${imageUrl}"
|
|
16
|
+
altText="${altText}"
|
|
17
|
+
size="${size}"
|
|
18
|
+
></cfa-avatar>
|
|
19
|
+
`;
|
|
20
|
+
|
|
21
|
+
export const Default = Template.bind({});
|
|
22
|
+
Default.args = {
|
|
23
|
+
imageUrl:
|
|
24
|
+
"https://files.codeforamerica.org/2021/02/13130320/Renteria.Turq_.Standing-scaled-e1678737908242-198x300.jpg",
|
|
25
|
+
altText: "Headshot photo of Amanda Renteria, Code for America CEO",
|
|
26
|
+
size: 4,
|
|
27
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { LitElement, html, css } from "lit";
|
|
2
|
+
import { commonStyles } from "../shared/common";
|
|
3
|
+
|
|
4
|
+
class Bar extends LitElement {
|
|
5
|
+
static properties = {
|
|
6
|
+
theme: {},
|
|
7
|
+
};
|
|
8
|
+
static styles = [
|
|
9
|
+
commonStyles,
|
|
10
|
+
css`
|
|
11
|
+
:host {
|
|
12
|
+
--bg-color: var(--purple-80);
|
|
13
|
+
--text-color: var(--white);
|
|
14
|
+
--link-color: var(--white);
|
|
15
|
+
--link-hover-color: var(--white);
|
|
16
|
+
--scrollbar-color: var(--white);
|
|
17
|
+
--spacing: var(--spacing-layout-half);
|
|
18
|
+
|
|
19
|
+
display: block;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.bar {
|
|
23
|
+
background-color: var(--bg-color);
|
|
24
|
+
color: var(--text-color);
|
|
25
|
+
|
|
26
|
+
a {
|
|
27
|
+
color: var(--link-color);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
a:hover {
|
|
31
|
+
color: var(--link-hover-color);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.content {
|
|
36
|
+
display: flex;
|
|
37
|
+
column-gap: var(--spacing);
|
|
38
|
+
justify-content: center;
|
|
39
|
+
overflow-x: auto;
|
|
40
|
+
overflow-y: hidden;
|
|
41
|
+
padding-bottom: var(--spacing-layout-half);
|
|
42
|
+
padding-top: var(--spacing-layout-half);
|
|
43
|
+
scrollbar-color: var(--scrollbar-color) var(--bg-color);
|
|
44
|
+
scrollbar-width: thin;
|
|
45
|
+
|
|
46
|
+
&::before,
|
|
47
|
+
&::after {
|
|
48
|
+
content: "";
|
|
49
|
+
flex-basis: calc(var(--outer-margin) - var(--spacing));
|
|
50
|
+
flex-shrink: 0;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.content.is-overflowing {
|
|
55
|
+
justify-content: start;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
::slotted(*) {
|
|
59
|
+
max-width: none !important;
|
|
60
|
+
white-space: nowrap !important;
|
|
61
|
+
}
|
|
62
|
+
`,
|
|
63
|
+
];
|
|
64
|
+
|
|
65
|
+
// Check if the content is overflowing and add a class
|
|
66
|
+
|
|
67
|
+
firstUpdated() {
|
|
68
|
+
const content = this.shadowRoot.querySelector('.content');
|
|
69
|
+
const toggleOverflowClass = elem => {
|
|
70
|
+
elem.classList.toggle('is-overflowing', elem.scrollWidth > elem.clientWidth);
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
if ('ResizeObserver' in window) {
|
|
74
|
+
new ResizeObserver(entries => {
|
|
75
|
+
toggleOverflowClass(entries[0].target);
|
|
76
|
+
}).observe(content);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if ('MutationObserver' in window) {
|
|
80
|
+
new MutationObserver(() => {
|
|
81
|
+
toggleOverflowClass(content);
|
|
82
|
+
}).observe(content, { childList: true });
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Initial check
|
|
86
|
+
toggleOverflowClass(content);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
render() {
|
|
90
|
+
return html`
|
|
91
|
+
<div class="bar">
|
|
92
|
+
<div class="content">
|
|
93
|
+
<slot></slot>
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
`;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (!customElements.get("cfa-bar")) {
|
|
101
|
+
customElements.define("cfa-bar", Bar);
|
|
102
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { html } from "lit-html";
|
|
2
|
+
import "./bar";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Molecules/Bar",
|
|
6
|
+
argTypes: {
|
|
7
|
+
content: { type: "string" },
|
|
8
|
+
},
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: "fullscreen",
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const Template = ({ content }) => html`
|
|
15
|
+
<cfa-bar .innerHTML="${content}"> </cfa-bar>
|
|
16
|
+
`;
|
|
17
|
+
|
|
18
|
+
export const Default = Template.bind({});
|
|
19
|
+
Default.args = {
|
|
20
|
+
content:
|
|
21
|
+
'<ul class="ul ul--inline small"><li class="strong">Find out about: </li><li><a href="#">Easy and Free State Filing for IRS Direct Filers</a></li><li><a href="#">Bloomberg: Texts can improve access to food assistance</a></li><li><a href="#">Benefits Enrollment Field Guide</a></li></ul>',
|
|
22
|
+
};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { LitElement, html, css } from "lit";
|
|
2
|
+
import { commonStyles } from "../shared/common";
|
|
3
|
+
|
|
4
|
+
class Blob extends LitElement {
|
|
5
|
+
static properties = {
|
|
6
|
+
color: {},
|
|
7
|
+
shape: {},
|
|
8
|
+
styles: {},
|
|
9
|
+
};
|
|
10
|
+
static styles = [
|
|
11
|
+
commonStyles,
|
|
12
|
+
css`
|
|
13
|
+
:host {
|
|
14
|
+
--color: var(--blue-20);
|
|
15
|
+
|
|
16
|
+
display: block;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.blob,
|
|
20
|
+
svg {
|
|
21
|
+
height: 100%;
|
|
22
|
+
width: 100%;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
svg path {
|
|
26
|
+
fill: var(--color, #fff);
|
|
27
|
+
}
|
|
28
|
+
`,
|
|
29
|
+
];
|
|
30
|
+
constructor() {
|
|
31
|
+
super();
|
|
32
|
+
this.shape = "1";
|
|
33
|
+
}
|
|
34
|
+
blobTemplate() {
|
|
35
|
+
let svg;
|
|
36
|
+
switch (this.shape) {
|
|
37
|
+
case "1":
|
|
38
|
+
svg = html`<svg
|
|
39
|
+
width="628"
|
|
40
|
+
height="577"
|
|
41
|
+
viewBox="0 0 628 577"
|
|
42
|
+
fill="none"
|
|
43
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
44
|
+
>
|
|
45
|
+
<path
|
|
46
|
+
fill-rule="evenodd"
|
|
47
|
+
clip-rule="evenodd"
|
|
48
|
+
d="M304.482 3.44206C399.413 -5.50752 504.225 1.17063 567.446 72.5295C633.526 147.115 639.549 256.491 613.992 352.793C589.57 444.814 526.084 523.087 438.164 559.679C355.477 594.092 265.039 570.416 184.315 531.621C103.504 492.784 22.0294 438.546 3.59029 350.826C-14.5863 264.355 39.2746 183.666 97.1329 116.868C151.394 54.223 221.956 11.2221 304.482 3.44206Z"
|
|
49
|
+
/>
|
|
50
|
+
</svg>`;
|
|
51
|
+
break;
|
|
52
|
+
case "2":
|
|
53
|
+
svg = html`<svg
|
|
54
|
+
width="580"
|
|
55
|
+
height="592"
|
|
56
|
+
viewBox="0 0 580 592"
|
|
57
|
+
fill="none"
|
|
58
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
59
|
+
>
|
|
60
|
+
<path
|
|
61
|
+
d="M238.814 591.215C210.461 592.077 182.849 587.767 155.66 580.979C60.4457 557.059 4.05766 489.933 0.460672 390.376C-2.50155 306.442 8.71258 223.693 37.2769 144.499C73.2468 44.6185 170.894 -12.5948 276.159 2.81295C358.996 14.9883 437.177 39.3389 499.172 100.108C588.039 187.167 604.437 293.512 544.346 402.767C514.618 456.855 477.59 505.988 426.386 541.544C369.892 580.656 304.723 587.767 238.814 591.215Z"
|
|
62
|
+
/>
|
|
63
|
+
</svg>`;
|
|
64
|
+
break;
|
|
65
|
+
case "3":
|
|
66
|
+
svg = html`<svg
|
|
67
|
+
width="620"
|
|
68
|
+
height="613"
|
|
69
|
+
viewBox="0 0 620 613"
|
|
70
|
+
fill="none"
|
|
71
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
72
|
+
>
|
|
73
|
+
<path
|
|
74
|
+
fill-rule="evenodd"
|
|
75
|
+
clip-rule="evenodd"
|
|
76
|
+
d="M619.142 301.769C615.581 212.393 536.92 153.752 466.654 98.7402C397.998 44.9883 323.934 -10.5844 236.421 2.12929C141.656 15.8965 53.9975 76.8338 15.687 164.256C-20.6955 247.277 16.2818 336.243 54.5575 417.127C92.4807 497.265 137.965 580.831 224.139 604.752C314.166 629.742 409.183 593.817 484.092 536.359C559.738 478.336 622.883 395.641 619.142 301.769Z"
|
|
77
|
+
/>
|
|
78
|
+
</svg>`;
|
|
79
|
+
break;
|
|
80
|
+
case "4":
|
|
81
|
+
svg = html`<svg
|
|
82
|
+
width="656"
|
|
83
|
+
height="566"
|
|
84
|
+
viewBox="0 0 656 566"
|
|
85
|
+
fill="none"
|
|
86
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
87
|
+
>
|
|
88
|
+
<path
|
|
89
|
+
fill-rule="evenodd"
|
|
90
|
+
clip-rule="evenodd"
|
|
91
|
+
d="M332.011 564.695C235.808 569.34 135.091 552.4 71.2946 488.381C4.66596 421.518 -10.0767 327.738 8.2158 239.764C27.3773 147.61 73.5054 52.3693 169.88 14.2546C263.181 -22.6447 364.8 21.5179 455.491 62.8734C540.631 101.698 627.337 150.367 649.771 233.088C672.265 316.032 626.78 399.503 564.43 464.569C505.684 525.875 422.382 560.331 332.011 564.695Z"
|
|
92
|
+
/>
|
|
93
|
+
</svg>`;
|
|
94
|
+
break;
|
|
95
|
+
default:
|
|
96
|
+
svg = html`<svg
|
|
97
|
+
width="628"
|
|
98
|
+
height="577"
|
|
99
|
+
viewBox="0 0 628 577"
|
|
100
|
+
fill="none"
|
|
101
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
102
|
+
>
|
|
103
|
+
<path
|
|
104
|
+
fill-rule="evenodd"
|
|
105
|
+
clip-rule="evenodd"
|
|
106
|
+
d="M304.482 3.44206C399.413 -5.50752 504.225 1.17063 567.446 72.5295C633.526 147.115 639.549 256.491 613.992 352.793C589.57 444.814 526.084 523.087 438.164 559.679C355.477 594.092 265.039 570.416 184.315 531.621C103.504 492.784 22.0294 438.546 3.59029 350.826C-14.5863 264.355 39.2746 183.666 97.1329 116.868C151.394 54.223 221.956 11.2221 304.482 3.44206Z"
|
|
107
|
+
/>
|
|
108
|
+
</svg>`;
|
|
109
|
+
}
|
|
110
|
+
return svg;
|
|
111
|
+
}
|
|
112
|
+
render() {
|
|
113
|
+
const colorVar = this.color ? `var(--${this.color})` : 'var(--blue-20)';
|
|
114
|
+
|
|
115
|
+
return html`
|
|
116
|
+
<div
|
|
117
|
+
class="blob"
|
|
118
|
+
style="--color: ${colorVar}"
|
|
119
|
+
>
|
|
120
|
+
${this.blobTemplate()}
|
|
121
|
+
</div>
|
|
122
|
+
`;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (!customElements.get("cfa-blob")) {
|
|
127
|
+
customElements.define("cfa-blob", Blob);
|
|
128
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { html } from "lit-html";
|
|
2
|
+
import "./blob";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Atoms/Blob",
|
|
6
|
+
parameters: {
|
|
7
|
+
docs: {
|
|
8
|
+
description: {
|
|
9
|
+
component: "Organic, abstract shapes that can be used as decorative elements, backgrounds, or visual accents. Available in 4 unique shapes and full color palette. Also available as CSS custom properties for background usage.",
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
argTypes: {
|
|
14
|
+
shape: {
|
|
15
|
+
options: ["1", "2", "3", "4"],
|
|
16
|
+
control: { type: "inline-radio" },
|
|
17
|
+
description: "Choose from 4 different organic blob shapes",
|
|
18
|
+
},
|
|
19
|
+
color: {
|
|
20
|
+
options: [
|
|
21
|
+
"white",
|
|
22
|
+
"gray-20",
|
|
23
|
+
"gray-40",
|
|
24
|
+
"gray-60",
|
|
25
|
+
"gray-80",
|
|
26
|
+
"sand-20",
|
|
27
|
+
"sand-40",
|
|
28
|
+
"sand-60",
|
|
29
|
+
"sand-80",
|
|
30
|
+
"purple-20",
|
|
31
|
+
"purple-40",
|
|
32
|
+
"purple-60",
|
|
33
|
+
"purple-80",
|
|
34
|
+
"red-20",
|
|
35
|
+
"red-40",
|
|
36
|
+
"red-60",
|
|
37
|
+
"red-80",
|
|
38
|
+
"green-20",
|
|
39
|
+
"green-40",
|
|
40
|
+
"green-60",
|
|
41
|
+
"green-80",
|
|
42
|
+
"blue-20",
|
|
43
|
+
"blue-40",
|
|
44
|
+
"blue-60",
|
|
45
|
+
"blue-80",
|
|
46
|
+
"yellow-20",
|
|
47
|
+
"yellow-40",
|
|
48
|
+
"yellow-60",
|
|
49
|
+
"yellow-80",
|
|
50
|
+
],
|
|
51
|
+
control: { type: "select" },
|
|
52
|
+
description: "Select a color from the design system palette",
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const Template = ({ color, shape }) => html`
|
|
58
|
+
<cfa-blob
|
|
59
|
+
color="${color}"
|
|
60
|
+
shape="${shape}"
|
|
61
|
+
style="
|
|
62
|
+
height: var(--spacing-layout-6, 10rem);
|
|
63
|
+
width: var(--spacing-layout-6, 10rem);
|
|
64
|
+
"
|
|
65
|
+
>
|
|
66
|
+
</cfa-blob>
|
|
67
|
+
`;
|
|
68
|
+
|
|
69
|
+
export const Default = Template.bind({});
|
|
70
|
+
Default.args = {
|
|
71
|
+
color: "purple-40",
|
|
72
|
+
shape: "1",
|
|
73
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { LitElement, html, css } from "lit";
|
|
2
|
+
import { commonStyles } from "../shared/common";
|
|
3
|
+
|
|
4
|
+
class Box extends LitElement {
|
|
5
|
+
static properties = {
|
|
6
|
+
theme: {},
|
|
7
|
+
};
|
|
8
|
+
static styles = [
|
|
9
|
+
commonStyles,
|
|
10
|
+
css`
|
|
11
|
+
:host {
|
|
12
|
+
--bg-color: var(--white);
|
|
13
|
+
--padding: var(--spacing-component-4);
|
|
14
|
+
--shadow: var(--shadow-small);
|
|
15
|
+
--text-color: var(--black);
|
|
16
|
+
|
|
17
|
+
display: flex;
|
|
18
|
+
flex: 1;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.box {
|
|
22
|
+
background-color: var(--bg-color);
|
|
23
|
+
box-shadow: var(--shadow);
|
|
24
|
+
color: var(--text-color, #000);
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
gap: var(--spacing-layout-half);
|
|
28
|
+
padding: var(--padding);
|
|
29
|
+
width: 100%;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.box--rounded {
|
|
33
|
+
border-radius: var(--spacing-layout-half, 0.5rem);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
::slotted(*) {
|
|
37
|
+
--spacing: var(--spacing-layout-half);
|
|
38
|
+
|
|
39
|
+
max-width: 100%;
|
|
40
|
+
}
|
|
41
|
+
`,
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
render() {
|
|
45
|
+
return html`
|
|
46
|
+
<div class="box ${this.theme ? "box--" + this.theme : ""}">
|
|
47
|
+
<slot />
|
|
48
|
+
</div>
|
|
49
|
+
`;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (!customElements.get("cfa-box")) {
|
|
54
|
+
customElements.define("cfa-box", Box);
|
|
55
|
+
}
|