@ogds/elements 1.0.0-alpha.6 → 1.0.0-alpha.8
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/.storybook/{UswdsTheme.js → OgdsTheme.js} +1 -1
- package/.storybook/manager.js +2 -2
- package/.storybook/preview.js +2 -2
- package/.storybook/worker.js +5 -0
- package/README.md +39 -136
- package/dist/components/frameworks/react/{UsaLink.d.ts → OGDSAlert.d.ts} +15 -14
- package/dist/components/frameworks/react/OGDSAlert.js +23 -0
- package/dist/components/frameworks/react/OgdsAccordionToggle.d.ts +4 -6
- package/dist/components/frameworks/react/OgdsAccordionToggle.js +1 -3
- package/dist/components/frameworks/react/{UsaBanner.d.ts → OgdsBanner.d.ts} +9 -9
- package/dist/components/frameworks/react/{UsaBanner.js → OgdsBanner.js} +3 -3
- package/dist/components/frameworks/react/OgdsTaskList.d.ts +48 -0
- package/dist/components/frameworks/react/{UsaLink.js → OgdsTaskList.js} +4 -7
- package/dist/components/frameworks/react/index.d.ts +3 -2
- package/dist/components/frameworks/react/index.js +3 -2
- package/dist/components/index.cjs +15 -1
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.ts +4 -3
- package/dist/components/index.js +162 -4
- package/dist/components/index.js.map +1 -1
- package/dist/components/ogds-accordion/index.d.ts +36 -0
- package/dist/components/ogds-accordion/ogds-accordion.spec.d.ts +1 -0
- package/dist/components/ogds-accordion-toggle/index.d.ts +25 -0
- package/dist/components/ogds-accordion-toggle/ogds-accordion-toggle.spec.d.ts +1 -0
- package/dist/components/ogds-alert/index.d.ts +21 -0
- package/dist/components/{usa-banner → ogds-banner}/index.d.ts +7 -7
- package/dist/components/ogds-banner.cjs +1 -0
- package/dist/components/ogds-banner.cjs.map +1 -0
- package/dist/components/ogds-banner.js +7 -0
- package/dist/components/ogds-banner.js.map +1 -0
- package/dist/components/task-list/index.d.ts +21 -0
- package/dist/core/token-styles.d.ts +1 -0
- package/dist/index-CC1QRihN.cjs +95 -0
- package/dist/index-CC1QRihN.cjs.map +1 -0
- package/dist/{components/usa-banner.js → index-DDf2o6Dk.js} +34 -28
- package/dist/index-DDf2o6Dk.js.map +1 -0
- package/dist/types/custom-element-jsx.d.ts +32 -22
- package/dist/types/custom-element-solidjs.d.ts +39 -27
- package/dist/types/custom-element-svelte.d.ts +32 -22
- package/dist/types/custom-element-vuejs.d.ts +32 -22
- package/package.json +44 -29
- package/src/Globals.d.ts +3 -0
- package/src/components/index.ts +3 -3
- package/src/components/ogds-accordion/docs.mdx +31 -20
- package/src/components/ogds-accordion/ogds-accordion.stories.ts +12 -0
- package/src/components/ogds-accordion-toggle/docs.mdx +54 -0
- package/src/components/ogds-accordion-toggle/index.ts +38 -11
- package/src/components/ogds-accordion-toggle/ogds-accordion-toggle.css +31 -0
- package/src/components/ogds-accordion-toggle/ogds-accordion-toggle.spec.ts +227 -0
- package/src/components/ogds-accordion-toggle/ogds-accordion-toggle.stories.ts +95 -0
- package/src/components/ogds-alert/base-variables.css +496 -0
- package/src/components/ogds-alert/index.ts +78 -0
- package/src/components/ogds-alert/ogds-alert.css +119 -0
- package/src/components/ogds-alert/ogds-alert.stories.ts +75 -0
- package/src/components/{usa-banner → ogds-banner}/docs.mdx +1 -10
- package/src/components/{usa-banner → ogds-banner}/index.ts +17 -15
- package/src/components/{usa-banner/usa-banner.spec.ts → ogds-banner/ogds-banner.spec.ts} +5 -5
- package/src/components/{usa-banner/usa-banner.stories.ts → ogds-banner/ogds-banner.stories.ts} +2 -2
- package/src/components/task-list/docs.mdx +23 -0
- package/src/components/task-list/index.ts +65 -0
- package/src/components/task-list/ogds-task-list.css +34 -0
- package/src/components/task-list/ogds-task-list.stories.ts +46 -0
- package/src/core/token-styles.ts +2 -0
- package/src/declaration.d.ts +5 -0
- package/storybook/contributing.mdx +1 -110
- package/storybook/framework-guidance.mdx +5 -5
- package/storybook/readme.mdx +1 -1
- package/dist/components/usa-banner/usa-banner.stories.d.ts +0 -95
- package/dist/components/usa-banner.cjs +0 -95
- package/dist/components/usa-banner.cjs.map +0 -1
- package/dist/components/usa-banner.js.map +0 -1
- package/dist/components/usa-header/index.d.ts +0 -6
- package/dist/components/usa-link/index.d.ts +0 -30
- package/dist/components/usa-link/usa-link.spec.d.ts +0 -0
- package/dist/components/usa-link.cjs +0 -5
- package/dist/components/usa-link.cjs.map +0 -1
- package/dist/components/usa-link.js +0 -32
- package/dist/components/usa-link.js.map +0 -1
- package/dist/core/OgdsElement.d.ts +0 -3
- package/dist/index-7kIMQwBw.cjs +0 -1
- package/dist/index-7kIMQwBw.cjs.map +0 -1
- package/dist/index-BrHk1-6T.js +0 -10
- package/dist/index-BrHk1-6T.js.map +0 -1
- package/src/components/ogds-accordion/.claude/settings.local.json +0 -7
- package/src/components/usa-header/index.ts +0 -50
- package/src/components/usa-header/usa-header.css +0 -1
- package/src/components/usa-link/index.ts +0 -66
- package/src/components/usa-link/usa-link.css +0 -24
- package/src/components/usa-link/usa-link.spec.ts +0 -50
- /package/dist/components/{usa-banner/usa-banner.spec.d.ts → ogds-banner/ogds-banner.spec.d.ts} +0 -0
- /package/src/components/{usa-banner/usa-banner.css → ogds-banner/ogds-banner.css} +0 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import "./index.ts";
|
|
2
|
+
import { html, nothing } from "lit";
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: "Components/Alert",
|
|
6
|
+
component: "ogds-alert",
|
|
7
|
+
tags: ["experimental"],
|
|
8
|
+
render: ({
|
|
9
|
+
heading,
|
|
10
|
+
type,
|
|
11
|
+
body,
|
|
12
|
+
noIcon,
|
|
13
|
+
}: {
|
|
14
|
+
heading: string;
|
|
15
|
+
type: string;
|
|
16
|
+
body: string;
|
|
17
|
+
noIcon: boolean;
|
|
18
|
+
}) => {
|
|
19
|
+
return html`
|
|
20
|
+
<ogds-alert type="${type}" ?no-icon="${noIcon}">
|
|
21
|
+
${heading ? html`<h3 slot="heading">${heading}</h3>` : nothing}
|
|
22
|
+
<p slot="body" .innerHTML=${body}></p>
|
|
23
|
+
</ogds-alert>
|
|
24
|
+
`;
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default meta;
|
|
29
|
+
|
|
30
|
+
export const InformationalAlert = {
|
|
31
|
+
args: {
|
|
32
|
+
heading: "Informational Alert",
|
|
33
|
+
type: "info",
|
|
34
|
+
body: `Lorem ipsum dolor sit amet, <a href="#">consectetur adipiscing elit</a>, sed do eiusmod.`,
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const WarningAlert = {
|
|
39
|
+
args: {
|
|
40
|
+
heading: "Warning Alert",
|
|
41
|
+
type: "warning",
|
|
42
|
+
body: `Lorem ipsum dolor sit amet, <a href="#">consectetur adipiscing elit</a>, sed do eiusmod.`,
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const SuccessAlert = {
|
|
47
|
+
args: {
|
|
48
|
+
heading: "Success Alert",
|
|
49
|
+
type: "success",
|
|
50
|
+
body: `Lorem ipsum dolor sit amet, <a href="#">consectetur adipiscing elit</a>, sed do eiusmod.`,
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const ErrorAlert = {
|
|
55
|
+
args: {
|
|
56
|
+
heading: "Error Alert",
|
|
57
|
+
type: "error",
|
|
58
|
+
body: `Lorem ipsum dolor sit amet, <a href="#">consectetur adipiscing elit</a>, sed do eiusmod.`,
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const SlimAlert = {
|
|
63
|
+
args: {
|
|
64
|
+
type: "info",
|
|
65
|
+
body: `Lorem ipsum dolor sit amet, <a href="#">consectetur adipiscing elit</a>, sed do eiusmod.`,
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export const AlertWithNoIcon = {
|
|
70
|
+
args: {
|
|
71
|
+
type: "info",
|
|
72
|
+
body: `Lorem ipsum dolor sit amet, <a href="#">consectetur adipiscing elit</a>, sed do eiusmod.`,
|
|
73
|
+
noIcon: "true",
|
|
74
|
+
},
|
|
75
|
+
};
|
|
@@ -55,7 +55,7 @@ Listed below are additional variations of the component.
|
|
|
55
55
|
|
|
56
56
|
### About
|
|
57
57
|
|
|
58
|
-
This version of `
|
|
58
|
+
This version of `ogds-banner` (i.e. using web components) first became available as `usa-banner` in [USWDS v3.13.0](https://github.com/uswds/uswds/releases/tag/v3.13.0) and is part of the `@uswds/uswds-elements` package. This is a direct port/fork of that component.
|
|
59
59
|
|
|
60
60
|
### When to use the default banner
|
|
61
61
|
|
|
@@ -97,12 +97,3 @@ Some `.gov` websites don’t represent the federal level of the U.S. government.
|
|
|
97
97
|
Some `.mil` websites don’t belong to an official U.S. Department of War organization. These sites should adapt the Official websites use `.mil` section to use more technically accurate language: “A .mil website operates under the approval of the U.S. Department of War.”
|
|
98
98
|
|
|
99
99
|
The banner should directly follow the `skipnav` component.
|
|
100
|
-
|
|
101
|
-
<SiteNote>
|
|
102
|
-
<strong>Note:</strong> As this is the first Web Component shipping in USWDS,
|
|
103
|
-
we are still working on the best way to document its usage. We want to hear
|
|
104
|
-
from users about challenges with adding this component to your projects.
|
|
105
|
-
Please let us know what works, what doesn’t, and what additional documentation
|
|
106
|
-
might be helpful in this [discussion
|
|
107
|
-
thread](https://github.com/uswds/uswds/discussions/6477).
|
|
108
|
-
</SiteNote>
|
|
@@ -5,7 +5,7 @@ import { classMap } from "lit/directives/class-map.js";
|
|
|
5
5
|
import colorTokens from "@ogds/tokens/styles/css/colors.css";
|
|
6
6
|
import spacingTokens from "@ogds/tokens/styles/css/spacing.css";
|
|
7
7
|
import breakpointTokens from "@ogds/tokens/styles/css/breakpoints.css";
|
|
8
|
-
import styles from "./
|
|
8
|
+
import styles from "./ogds-banner.css";
|
|
9
9
|
|
|
10
10
|
import usFlagSmall from "@uswds/uswds/img/us_flag_small.png";
|
|
11
11
|
import iconDotGov from "@uswds/uswds/img/icon-dot-gov.svg";
|
|
@@ -15,7 +15,7 @@ import iconExpandMore from "../../shared/icons/expand_more.svg";
|
|
|
15
15
|
import iconExpandLess from "../../shared/icons/expand_less.svg";
|
|
16
16
|
import { defineCustomElement } from "../../utils";
|
|
17
17
|
|
|
18
|
-
interface
|
|
18
|
+
interface OgdsBannerTranslations {
|
|
19
19
|
banner: {
|
|
20
20
|
label: string;
|
|
21
21
|
text: string;
|
|
@@ -37,9 +37,9 @@ interface UsaBannerTranslations {
|
|
|
37
37
|
|
|
38
38
|
type SupportedLanguage = "en" | "es";
|
|
39
39
|
|
|
40
|
-
const
|
|
40
|
+
const OGDS_BANNER_TRANSLATIONS: Record<
|
|
41
41
|
SupportedLanguage,
|
|
42
|
-
|
|
42
|
+
OgdsBannerTranslations
|
|
43
43
|
> = {
|
|
44
44
|
en: {
|
|
45
45
|
banner: {
|
|
@@ -60,20 +60,20 @@ const USA_BANNER_TRANSLATIONS: Record<
|
|
|
60
60
|
text2:
|
|
61
61
|
"or <strong>https://</strong> means you’ve safely connected to the",
|
|
62
62
|
text3:
|
|
63
|
-
"website. Share sensitive information only on official, secure websites.",
|
|
63
|
+
" website. Share sensitive information only on official, secure websites.",
|
|
64
64
|
},
|
|
65
65
|
},
|
|
66
66
|
es: {
|
|
67
67
|
banner: {
|
|
68
|
-
label: "Un sitio oficial del
|
|
69
|
-
text: "Un sitio oficial del
|
|
68
|
+
label: "Un sitio oficial del gobierno de Estados Unidos",
|
|
69
|
+
text: "Un sitio oficial del gobierno de Estados Unidos",
|
|
70
70
|
action: "Así es como usted puede verificarlo",
|
|
71
71
|
},
|
|
72
72
|
domain: {
|
|
73
73
|
heading: "Los sitios web oficiales usan",
|
|
74
74
|
text1: "Un sitio web",
|
|
75
75
|
text2:
|
|
76
|
-
"pertenece a una organización oficial del
|
|
76
|
+
"pertenece a una organización oficial del gobierno de Estados Unidos.",
|
|
77
77
|
},
|
|
78
78
|
https: {
|
|
79
79
|
heading1: "Los sitios web seguros",
|
|
@@ -82,13 +82,13 @@ const USA_BANNER_TRANSLATIONS: Record<
|
|
|
82
82
|
text2:
|
|
83
83
|
"o <strong>https://</strong> significa que usted se conectó de forma segura a un sitio web",
|
|
84
84
|
text3:
|
|
85
|
-
"Comparta información sensible
|
|
85
|
+
". Comparta información sensible solo en sitios web oficiales y seguros.",
|
|
86
86
|
},
|
|
87
87
|
},
|
|
88
88
|
};
|
|
89
89
|
|
|
90
90
|
/**
|
|
91
|
-
* @summary The
|
|
91
|
+
* @summary The ogds-banner component.
|
|
92
92
|
*
|
|
93
93
|
* @attribute {string} lang - The element's language.
|
|
94
94
|
* @attribute {string} label - The custom aria label users can override.
|
|
@@ -111,9 +111,9 @@ const USA_BANNER_TRANSLATIONS: Record<
|
|
|
111
111
|
* @slot https-heading - Heading for HTTPs section.
|
|
112
112
|
* @slot https-text - Body text for HTTPs section.
|
|
113
113
|
*
|
|
114
|
-
* @element
|
|
114
|
+
* @element ogds-banner
|
|
115
115
|
*/
|
|
116
|
-
export class
|
|
116
|
+
export class OgdsBanner extends LitElement {
|
|
117
117
|
static properties = {
|
|
118
118
|
flagSrc: { type: String },
|
|
119
119
|
lang: { type: String, reflect: true },
|
|
@@ -148,7 +148,9 @@ export class UsaBanner extends LitElement {
|
|
|
148
148
|
// Get English or Spanish strings. Default to English if an unknown `lang` is passed.
|
|
149
149
|
// Ex: <usa-banner lang="zy"></usa-banner>
|
|
150
150
|
protected get _bannerText() {
|
|
151
|
-
return
|
|
151
|
+
return (
|
|
152
|
+
OGDS_BANNER_TRANSLATIONS[this.lang] || OGDS_BANNER_TRANSLATIONS["en"]
|
|
153
|
+
);
|
|
152
154
|
}
|
|
153
155
|
|
|
154
156
|
// Get the action text and use for both mobile & desktop buttons.
|
|
@@ -199,7 +201,7 @@ export class UsaBanner extends LitElement {
|
|
|
199
201
|
><br />
|
|
200
202
|
<slot name="https-text">
|
|
201
203
|
${unsafeHTML(https.text1)} (${this.lockIcon()})
|
|
202
|
-
${unsafeHTML(https.text2)} .${tld}
|
|
204
|
+
${unsafeHTML(https.text2)} .${tld}${https.text3}
|
|
203
205
|
</slot>
|
|
204
206
|
</p>
|
|
205
207
|
</div>
|
|
@@ -287,4 +289,4 @@ export class UsaBanner extends LitElement {
|
|
|
287
289
|
}
|
|
288
290
|
}
|
|
289
291
|
|
|
290
|
-
defineCustomElement("
|
|
292
|
+
defineCustomElement("ogds-banner", OgdsBanner);
|
|
@@ -3,7 +3,7 @@ import { beforeEach, describe, expect, it } from "vitest";
|
|
|
3
3
|
import "./index.js";
|
|
4
4
|
|
|
5
5
|
function getInsideBanner(): ShadowRoot {
|
|
6
|
-
const banner = document.body.querySelector("
|
|
6
|
+
const banner = document.body.querySelector("ogds-banner");
|
|
7
7
|
if (!banner) {
|
|
8
8
|
throw new Error("USA Banner element not found");
|
|
9
9
|
}
|
|
@@ -23,7 +23,7 @@ function getBannerButton(): HTMLButtonElement {
|
|
|
23
23
|
|
|
24
24
|
describe("USA Banner component", async () => {
|
|
25
25
|
beforeEach(async () => {
|
|
26
|
-
document.body.innerHTML = "<
|
|
26
|
+
document.body.innerHTML = "<ogds-banner></ogds-banner>";
|
|
27
27
|
});
|
|
28
28
|
|
|
29
29
|
it("renders correctly", () => {
|
|
@@ -53,19 +53,19 @@ describe("USA Banner component", async () => {
|
|
|
53
53
|
|
|
54
54
|
describe("Spanish variant", async () => {
|
|
55
55
|
beforeEach(async () => {
|
|
56
|
-
document.body.innerHTML = `<
|
|
56
|
+
document.body.innerHTML = `<ogds-banner lang="es"></ogds-banner>`;
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
it("renders correctly", () => {
|
|
60
60
|
expect(getInsideBanner().textContent).toContain(
|
|
61
|
-
"Un sitio oficial del
|
|
61
|
+
"Un sitio oficial del gobierno de Estados Unidos",
|
|
62
62
|
);
|
|
63
63
|
});
|
|
64
64
|
});
|
|
65
65
|
|
|
66
66
|
describe("MIL variant", async () => {
|
|
67
67
|
beforeEach(async () => {
|
|
68
|
-
document.body.innerHTML = `<
|
|
68
|
+
document.body.innerHTML = `<ogds-banner tld="mil"></ogds-banner>`;
|
|
69
69
|
});
|
|
70
70
|
|
|
71
71
|
it("renders correctly", () => {
|
package/src/components/{usa-banner/usa-banner.stories.ts → ogds-banner/ogds-banner.stories.ts}
RENAMED
|
@@ -5,7 +5,7 @@ import { within } from "shadow-dom-testing-library";
|
|
|
5
5
|
import { getStorybookHelpers } from "@wc-toolkit/storybook-helpers";
|
|
6
6
|
import type { Args, ArgTypes } from "storybook/internal/csf";
|
|
7
7
|
|
|
8
|
-
const { argTypes, args, template } = getStorybookHelpers("
|
|
8
|
+
const { argTypes, args, template } = getStorybookHelpers("ogds-banner");
|
|
9
9
|
|
|
10
10
|
const filteredArgTypes = (argTypes: ArgTypes) => {
|
|
11
11
|
const filtered: ArgTypes = {};
|
|
@@ -30,7 +30,7 @@ const filteredArgTypes = (argTypes: ArgTypes) => {
|
|
|
30
30
|
|
|
31
31
|
export default {
|
|
32
32
|
title: "Components/Banner",
|
|
33
|
-
component: "
|
|
33
|
+
component: "ogds-banner",
|
|
34
34
|
tags: ["beta"],
|
|
35
35
|
args: {
|
|
36
36
|
...args,
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Meta, Title, Primary, Stories } from "@storybook/addon-docs/blocks";
|
|
2
|
+
|
|
3
|
+
<Meta isTemplate />
|
|
4
|
+
|
|
5
|
+
<Title />
|
|
6
|
+
|
|
7
|
+
A Task List displays user tasks, their status (e.g. "not started", "completed", "in progress"), and an actionable link for each task.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Default
|
|
12
|
+
|
|
13
|
+
<Primary />
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Variations
|
|
18
|
+
|
|
19
|
+
<Stories />
|
|
20
|
+
|
|
21
|
+
## Guidance
|
|
22
|
+
|
|
23
|
+
The Task List is used primarily for lengthy or complex workflows (non-sequential), e.g. registration, rather than simple, short steps.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { LitElement, html, unsafeCSS } from "lit";
|
|
2
|
+
|
|
3
|
+
import styles from "./ogds-task-list.css";
|
|
4
|
+
import { adoptTokenStyles } from "../../core/token-styles";
|
|
5
|
+
|
|
6
|
+
import { property } from "lit/decorators.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @summary The ogds-task-list component. For now, this is intended for non-sequential task lists (order doesn't matter).
|
|
10
|
+
* @element ogds-task-list
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
interface TaskStep {
|
|
14
|
+
title: string;
|
|
15
|
+
description: string;
|
|
16
|
+
status: StepStatus;
|
|
17
|
+
url?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
type StepStatus = "not-started" | "in-progress" | "completed";
|
|
21
|
+
|
|
22
|
+
export class OgdsTaskList extends LitElement {
|
|
23
|
+
/** @ignore */
|
|
24
|
+
|
|
25
|
+
@property({ type: Array })
|
|
26
|
+
steps: TaskStep[] = [];
|
|
27
|
+
|
|
28
|
+
static styles = unsafeCSS(styles);
|
|
29
|
+
|
|
30
|
+
override connectedCallback() {
|
|
31
|
+
super.connectedCallback();
|
|
32
|
+
adoptTokenStyles();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
renderAction(step: TaskStep) {
|
|
36
|
+
switch (step.status) {
|
|
37
|
+
case "in-progress":
|
|
38
|
+
return html`<a href=${step.url}>Continue</a>`;
|
|
39
|
+
case "completed":
|
|
40
|
+
return html`
|
|
41
|
+
<span class="completed">Completed</span><a href=${step.url}>Edit</a>
|
|
42
|
+
`;
|
|
43
|
+
default:
|
|
44
|
+
return html`<a href=${step.url}>Start </a>`;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
render() {
|
|
49
|
+
return html`
|
|
50
|
+
<ul>
|
|
51
|
+
${this.steps.map(
|
|
52
|
+
(step) => html`
|
|
53
|
+
<li class="step" data-status=${step.status}>
|
|
54
|
+
<h2 class="heading">${step.title}</h2>
|
|
55
|
+
<div class="description">${step.description}</div>
|
|
56
|
+
<div class="action">${this.renderAction(step)}</div>
|
|
57
|
+
</li>
|
|
58
|
+
`,
|
|
59
|
+
)}
|
|
60
|
+
</ul>
|
|
61
|
+
`;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
customElements.define("ogds-task-list", OgdsTaskList);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
ul {
|
|
6
|
+
list-style: none;
|
|
7
|
+
padding-left: 1.5rem;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
li {
|
|
11
|
+
border-block-end: 2px solid var(--ogds-theme-color-base-lightest);
|
|
12
|
+
margin-block-end: 2rem;
|
|
13
|
+
padding-block-end: 1.25rem;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.heading {
|
|
17
|
+
margin-block-end: 0.25rem;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.description {
|
|
21
|
+
color: var(--ogds-theme-color-base);
|
|
22
|
+
margin-block-end: 0.5rem;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.action {
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.completed {
|
|
31
|
+
align-items: center;
|
|
32
|
+
display: inline-flex;
|
|
33
|
+
gap: 0.4rem;
|
|
34
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { html } from "lit";
|
|
2
|
+
import "./index";
|
|
3
|
+
import ComponentDocs from "./docs.mdx";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: "Components/TaskList",
|
|
7
|
+
component: "ogds-task-list",
|
|
8
|
+
tags: ["experimental"],
|
|
9
|
+
parameters: {
|
|
10
|
+
docs: {
|
|
11
|
+
page: ComponentDocs,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const exampleSteps = [
|
|
17
|
+
{
|
|
18
|
+
title: "Tell us about you",
|
|
19
|
+
description:
|
|
20
|
+
" Confirm the legal entity structure, your employer details, and your EIN. ",
|
|
21
|
+
status: "in-progress",
|
|
22
|
+
url: "",
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
title: "Set up your employer profile",
|
|
26
|
+
description: "Click the link we sent to your inbox.",
|
|
27
|
+
status: "completed",
|
|
28
|
+
url: "",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
title: "Enter the employer’s address",
|
|
32
|
+
description: "Tell us more about yourself.",
|
|
33
|
+
status: "completed",
|
|
34
|
+
url: "",
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
title: "Submit your Maryland Resident Agent details",
|
|
38
|
+
description: "Review and submit profile details.",
|
|
39
|
+
status: "not-started",
|
|
40
|
+
url: "",
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
export const Default = {
|
|
45
|
+
render: () => html`<ogds-task-list .steps=${exampleSteps}></ogds-task-list>`,
|
|
46
|
+
};
|
package/src/core/token-styles.ts
CHANGED
|
@@ -2,6 +2,7 @@ import colorTokens from "@ogds/tokens/styles/css/colors.css";
|
|
|
2
2
|
import spacingTokens from "@ogds/tokens/styles/css/spacing.css";
|
|
3
3
|
import typographyTokens from "@ogds/tokens/styles/css/typography.css";
|
|
4
4
|
import themeColorTokens from "@ogds/tokens/styles/css/theme-color.css";
|
|
5
|
+
import themeComponentTokens from "@ogds/tokens/styles/css/theme-components.css";
|
|
5
6
|
import themeSpacingTokens from "@ogds/tokens/styles/css/theme-spacing.css";
|
|
6
7
|
import themeTypographyTokens from "@ogds/tokens/styles/css/theme-typography.css";
|
|
7
8
|
|
|
@@ -12,6 +13,7 @@ sheet.replaceSync(
|
|
|
12
13
|
spacingTokens,
|
|
13
14
|
typographyTokens,
|
|
14
15
|
themeColorTokens,
|
|
16
|
+
themeComponentTokens,
|
|
15
17
|
themeSpacingTokens,
|
|
16
18
|
themeTypographyTokens,
|
|
17
19
|
]
|
package/src/declaration.d.ts
CHANGED
|
@@ -1,115 +1,6 @@
|
|
|
1
1
|
import { Meta, Markdown } from "@storybook/addon-docs/blocks";
|
|
2
2
|
import Contributing from "../CONTRIBUTING.md?raw";
|
|
3
3
|
|
|
4
|
-
<Meta title="Documentation/Contributing" />
|
|
4
|
+
<Meta title="Documentation/Contributing Code" />
|
|
5
5
|
|
|
6
6
|
<Markdown>{Contributing}</Markdown>
|
|
7
|
-
|
|
8
|
-
## Overview
|
|
9
|
-
|
|
10
|
-
This information is for USWDS Core team members contribute to the USWDS Elements project.
|
|
11
|
-
|
|
12
|
-
## Project setup
|
|
13
|
-
|
|
14
|
-
It is helpful to have [nvm installed](https://github.com/nvm-sh/nvm) and use the correct version of Node.js. From the project root, run the following command:
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
npm install
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
### Installing Playwright (for E2E testing)
|
|
21
|
-
|
|
22
|
-
If you plan to run or write end-to-end tests, please see the [Playwright documentation](https://playwright.dev/docs/intro) for installation instructions and the [README.md file in the `e2e` directory](https://github.com/uswds/uswds-elements/tree/develop/e2e).
|
|
23
|
-
|
|
24
|
-
## Development Workflow
|
|
25
|
-
|
|
26
|
-
The development workflow uses [Storybook](https://storybook.js.org/) and [custom elements manifest](https://github.com/webcomponents/custom-elements-manifest) to generate a custom elements manifest and watch for changes to the custom elements manifest. Storybook handles documentation of component usage, styling, and properties.
|
|
27
|
-
|
|
28
|
-
### Running StorybookJS
|
|
29
|
-
|
|
30
|
-
Start the development server with Storybook and custom elements manifest watch process:
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
npm run start
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
This runs Storybook on port 8008 at `http://localhost:8008`.
|
|
37
|
-
|
|
38
|
-
---
|
|
39
|
-
|
|
40
|
-
### Creating stories
|
|
41
|
-
|
|
42
|
-
Stories should document the following component features:
|
|
43
|
-
|
|
44
|
-
- Variants (e.g. default, primary, secondary, etc.)
|
|
45
|
-
- Properties
|
|
46
|
-
- CSS Custom Properties
|
|
47
|
-
|
|
48
|
-
### Story File Structure
|
|
49
|
-
|
|
50
|
-
Stories and functional tests should be created alongside components:
|
|
51
|
-
|
|
52
|
-
```
|
|
53
|
-
src/components/usa-example/
|
|
54
|
-
├── docs.mdx
|
|
55
|
-
├── index.ts
|
|
56
|
-
├── usa-example.css
|
|
57
|
-
├── usa-example.spec.ts
|
|
58
|
-
└── usa-example.stories.ts
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
## Project Structure
|
|
62
|
-
|
|
63
|
-
- **`src/components/`** - Web Component implementations
|
|
64
|
-
- **`src/core/`** - Core utilities and base classes
|
|
65
|
-
- **`src/shared/`** - Static asset files like fonts and icons
|
|
66
|
-
- **`e2e/`** - Playwright end-to-end tests
|
|
67
|
-
- **`storybook/`** - Storybook documentation files
|
|
68
|
-
- **`.storybook/`** - Storybook configuration
|
|
69
|
-
- **`tokens/`** - Design token definitions (Style Dictionary)
|
|
70
|
-
- **`internals/`** - Internal build scripts and utilities
|
|
71
|
-
- **`config/`** - Config files for project tooling and testing
|
|
72
|
-
|
|
73
|
-
## Component Development Checklist
|
|
74
|
-
|
|
75
|
-
When creating a new component:
|
|
76
|
-
|
|
77
|
-
- Create component files in `src/components/[component-name]/`
|
|
78
|
-
- Add JSDoc comments to component files documenting the component's API
|
|
79
|
-
- Write component implementation (TypeScript + Lit)
|
|
80
|
-
- Create component styles in an external CSS file and import it into the component
|
|
81
|
-
- Export component from `index.ts`
|
|
82
|
-
- Add component to for package exports `src/components/index.js`
|
|
83
|
-
- Create Storybook stories documenting all variants and props
|
|
84
|
-
- Write unit tests with Vitest
|
|
85
|
-
- Write E2E tests with Playwright (including visual regression tests)
|
|
86
|
-
- Build the custom elements manifest to keep it synced with JSDoc comments
|
|
87
|
-
- Test accessibility with Storybook's a11y addon
|
|
88
|
-
|
|
89
|
-
---
|
|
90
|
-
|
|
91
|
-
## Pre-commit Hooks
|
|
92
|
-
|
|
93
|
-
This project uses [Husky](https://typicode.github.io/husky/) for Git hooks. Hooks are automatically set up when you run `npm install` via the `prepare` script.
|
|
94
|
-
|
|
95
|
-
## Publishing and Releases
|
|
96
|
-
|
|
97
|
-
The package is published as `@uswds/elements` on npm. The current version can be found in `package.json`
|
|
98
|
-
|
|
99
|
-
Component maturity levels:
|
|
100
|
-
|
|
101
|
-
- **Pre-alpha**: Experimental, API may change significantly
|
|
102
|
-
- **Alpha**: Core functionality stable, refinements expected
|
|
103
|
-
- **Beta**: Feature complete, undergoing final testing
|
|
104
|
-
- **Stable**: Production ready
|
|
105
|
-
|
|
106
|
-
Check the README for current component status.
|
|
107
|
-
|
|
108
|
-
## Additional Resources
|
|
109
|
-
|
|
110
|
-
- [USWDS Design System](https://designsystem.digital.gov)
|
|
111
|
-
- [Web Components MDN Guide](https://developer.mozilla.org/en-US/docs/Web/API/Web_components)
|
|
112
|
-
- [Lit Documentation](https://lit.dev)
|
|
113
|
-
- [Storybook Documentation](https://storybook.js.org)
|
|
114
|
-
- [Playwright Documentation](https://playwright.dev)
|
|
115
|
-
- [E2E Testing Guide](https://github.com/uswds/uswds-elements/tree/develop/e2e) (detailed testing documentation)
|
|
@@ -11,24 +11,24 @@ import VueExample from "../examples/with-vue/src/App.vue?raw";
|
|
|
11
11
|
|
|
12
12
|
# Framework-specific Guidance
|
|
13
13
|
|
|
14
|
-
We've made every effort to make using
|
|
14
|
+
We've made every effort to make using OGDS Elements in your project as easy as possible. Since many projects use modern front-end libraries and frameworks, we've included an [examples directory](https://github.com/open-government-design-system/ogds-elements/tree/develop/examples) in this repository that shows how to import and use OGDS Elements with a variety of popular front-end technologies. The goal is to provide an experience that involves minimal configuration to get up and running with your framework or library of choice.
|
|
15
15
|
|
|
16
16
|
In all cases, install the project from the npm package registry.
|
|
17
17
|
|
|
18
18
|
```bash
|
|
19
|
-
$ npm install @
|
|
19
|
+
$ npm install @ogds/elements
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
## Examples
|
|
23
23
|
|
|
24
24
|
### HTML
|
|
25
25
|
|
|
26
|
-
To use a specific element directly in an HTML page, use the code snippet below. This example also applies if you're using
|
|
26
|
+
To use a specific element directly in an HTML page, use the code snippet below. This example also applies if you're using OGDS Elements in a CMS that has its own templating engine (e.g. Drupal, WordPress, etc.).
|
|
27
27
|
|
|
28
28
|
```html
|
|
29
29
|
<!-- importing directly into an HTML page -->
|
|
30
30
|
<script type="module">
|
|
31
|
-
import {
|
|
31
|
+
import { OgdsBanner } from "@ogds/elements";
|
|
32
32
|
</script>
|
|
33
33
|
<usa-banner></usa-banner>
|
|
34
34
|
```
|
|
@@ -41,7 +41,7 @@ This is a minimal example of implementation in [Astro](https://astro.build/). Th
|
|
|
41
41
|
|
|
42
42
|
### React
|
|
43
43
|
|
|
44
|
-
This is a minimal example of implementation in [React](https://react.dev/). Do note that
|
|
44
|
+
This is a minimal example of implementation in [React](https://react.dev/). Do note that OGDS Elements includes a wrapper for React components, and the `import` path is different from the other frameworks in this document.
|
|
45
45
|
|
|
46
46
|
<Source code={ReactExample} language="jsx" />
|
|
47
47
|
|