@ogds/elements 1.0.0-alpha.7 → 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.
Files changed (57) hide show
  1. package/README.md +28 -96
  2. package/dist/components/frameworks/react/OGDSAlert.d.ts +61 -0
  3. package/dist/components/frameworks/react/OGDSAlert.js +23 -0
  4. package/dist/components/frameworks/react/OgdsAccordionToggle.d.ts +4 -6
  5. package/dist/components/frameworks/react/OgdsAccordionToggle.js +1 -3
  6. package/dist/components/frameworks/react/{UsaHeader.d.ts → OgdsTaskList.d.ts} +4 -4
  7. package/dist/components/frameworks/react/{UsaHeader.js → OgdsTaskList.js} +3 -3
  8. package/dist/components/frameworks/react/index.d.ts +2 -1
  9. package/dist/components/frameworks/react/index.js +2 -1
  10. package/dist/components/index.cjs +14 -7
  11. package/dist/components/index.cjs.map +1 -1
  12. package/dist/components/index.d.ts +2 -1
  13. package/dist/components/index.js +112 -45
  14. package/dist/components/index.js.map +1 -1
  15. package/dist/components/ogds-accordion-toggle/index.d.ts +7 -4
  16. package/dist/components/ogds-accordion-toggle/ogds-accordion-toggle.spec.d.ts +1 -0
  17. package/dist/components/ogds-alert/index.d.ts +21 -0
  18. package/dist/components/ogds-banner/index.d.ts +1 -1
  19. package/dist/components/ogds-banner.cjs +1 -1
  20. package/dist/components/ogds-banner.js +1 -1
  21. package/dist/components/task-list/index.d.ts +21 -0
  22. package/dist/{index-DTiLuJoA.cjs → index-CC1QRihN.cjs} +2 -2
  23. package/dist/index-CC1QRihN.cjs.map +1 -0
  24. package/dist/{index-Bl2KLDbH.js → index-DDf2o6Dk.js} +6 -6
  25. package/dist/index-DDf2o6Dk.js.map +1 -0
  26. package/dist/types/custom-element-jsx.d.ts +35 -4
  27. package/dist/types/custom-element-solidjs.d.ts +39 -4
  28. package/dist/types/custom-element-svelte.d.ts +35 -4
  29. package/dist/types/custom-element-vuejs.d.ts +35 -4
  30. package/package.json +36 -21
  31. package/src/Globals.d.ts +3 -0
  32. package/src/components/index.ts +2 -1
  33. package/src/components/ogds-accordion/docs.mdx +31 -20
  34. package/src/components/ogds-accordion/ogds-accordion.stories.ts +12 -0
  35. package/src/components/ogds-accordion-toggle/docs.mdx +54 -0
  36. package/src/components/ogds-accordion-toggle/index.ts +38 -11
  37. package/src/components/ogds-accordion-toggle/ogds-accordion-toggle.css +31 -0
  38. package/src/components/ogds-accordion-toggle/ogds-accordion-toggle.spec.ts +227 -0
  39. package/src/components/ogds-accordion-toggle/ogds-accordion-toggle.stories.ts +95 -0
  40. package/src/components/ogds-alert/base-variables.css +496 -0
  41. package/src/components/ogds-alert/index.ts +78 -0
  42. package/src/components/ogds-alert/ogds-alert.css +119 -0
  43. package/src/components/ogds-alert/ogds-alert.stories.ts +75 -0
  44. package/src/components/ogds-banner/index.ts +6 -6
  45. package/src/components/ogds-banner/ogds-banner.spec.ts +1 -1
  46. package/src/components/task-list/docs.mdx +23 -0
  47. package/src/components/task-list/index.ts +65 -0
  48. package/src/components/task-list/ogds-task-list.css +34 -0
  49. package/src/components/task-list/ogds-task-list.stories.ts +46 -0
  50. package/src/core/token-styles.ts +2 -0
  51. package/storybook/contributing.mdx +1 -110
  52. package/storybook/readme.mdx +1 -1
  53. package/dist/components/usa-header/index.d.ts +0 -6
  54. package/dist/index-Bl2KLDbH.js.map +0 -1
  55. package/dist/index-DTiLuJoA.cjs.map +0 -1
  56. package/src/components/usa-header/index.ts +0 -49
  57. package/src/components/usa-header/usa-header.css +0 -1
@@ -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
+ };
@@ -60,20 +60,20 @@ const OGDS_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 Gobierno de Estados Unidos",
69
- text: "Un sitio oficial del Gobierno de Estados Unidos",
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 Gobierno de Estados Unidos.",
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,7 +82,7 @@ const OGDS_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 sólo en sitios web oficiales y seguros.",
85
+ ". Comparta información sensible solo en sitios web oficiales y seguros.",
86
86
  },
87
87
  },
88
88
  };
@@ -201,7 +201,7 @@ export class OgdsBanner extends LitElement {
201
201
  ><br />
202
202
  <slot name="https-text">
203
203
  ${unsafeHTML(https.text1)} (${this.lockIcon()})
204
- ${unsafeHTML(https.text2)} .${tld} ${https.text3}
204
+ ${unsafeHTML(https.text2)} .${tld}${https.text3}
205
205
  </slot>
206
206
  </p>
207
207
  </div>
@@ -58,7 +58,7 @@ describe("Spanish variant", async () => {
58
58
 
59
59
  it("renders correctly", () => {
60
60
  expect(getInsideBanner().textContent).toContain(
61
- "Un sitio oficial del Gobierno de Estados Unidos",
61
+ "Un sitio oficial del gobierno de Estados Unidos",
62
62
  );
63
63
  });
64
64
  });
@@ -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
+ };
@@ -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
  ]
@@ -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 OGDS Core team members contribute to the OGDS 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/open-government-design-system/ogds-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 `@ogds/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/open-government-design-system/ogds-elements/tree/develop/e2e) (detailed testing documentation)
@@ -1,6 +1,6 @@
1
1
  import { Meta, Markdown } from "@storybook/addon-docs/blocks";
2
2
  import Readme from "../README.md?raw";
3
3
 
4
- <Meta title="README" />
4
+ <Meta title="OGDS Elements (README)" />
5
5
 
6
6
  <Markdown>{Readme}</Markdown>
@@ -1,6 +0,0 @@
1
- import { LitElement } from 'lit';
2
- export declare class UsaHeader extends LitElement {
3
- constructor();
4
- static styles: import('lit').CSSResult[];
5
- render(): import('lit-html').TemplateResult<1>;
6
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-Bl2KLDbH.js","sources":["../node_modules/@uswds/uswds/dist/img/us_flag_small.png","../node_modules/@uswds/uswds/dist/img/icon-dot-gov.svg","../node_modules/@uswds/uswds/dist/img/icon-https.svg","../src/shared/icons/close.svg","../src/shared/icons/expand_more.svg","../src/shared/icons/expand_less.svg","../src/utils/index.ts","../src/components/ogds-banner/index.ts"],"sourcesContent":["export default \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAAsBAMAAAAncaPMAAAAAXNSR0IArs4c6QAAABtQTFRF////4EAg2z8g2z8f2z4f2j4fHjSyHjOxHTOxQEYPwgAAAIdJREFUeNrNkUENxDAMBEOhFJaCKZiCKZhCKBj2ebV3rdR71+pIq+Qxj1GyqjJ3U8VlHkc07hFm0awBYe91juq6MSI0yhSAEgkzJ4TMKiXyzFw3pgR9lmIBJlqj2AmBedf+IycExmlKZVzvZEJ4A0oBrjBl/m6PCy95B3fFAN6YuQPxhbcB4QMkEj04wQXD5wAAAABJRU5ErkJggg==\"","export default \"data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='64'%20height='64'%20viewBox='0%200%2064%2064'%3e%3ctitle%3eicon-dot-gov%3c/title%3e%3cpath%20fill='%232378C3'%20fill-rule='evenodd'%20d='m32%200c17.7%200%2032%2014.3%2032%2032s-14.3%2032-32%2032-32-14.3-32-32%2014.3-32%2032-32zm0%201.2c-17%200-30.8%2013.8-30.8%2030.8s13.8%2030.8%2030.8%2030.8%2030.8-13.8%2030.8-30.8-13.8-30.8-30.8-30.8zm11.4%2038.9c.5%200%20.9.4.9.8v1.6h-24.6v-1.6c0-.5.4-.8.9-.8zm-17.1-12.3v9.8h1.6v-9.8h3.3v9.8h1.6v-9.8h3.3v9.8h1.6v-9.8h3.3v9.8h.8c.5%200%20.9.4.9.8v.8h-21.4v-.8c0-.5.4-.8.9-.8h.8v-9.8zm5.7-8.2%2012.3%204.9v1.6h-1.6c0%20.5-.4.8-.9.8h-19.6c-.5%200-.9-.4-.9-.8h-1.6v-1.6s12.3-4.9%2012.3-4.9z'/%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='64'%20height='64'%20viewBox='0%200%2064%2064'%3e%3ctitle%3eicon-https%3c/title%3e%3cpath%20fill='%23719F2A'%20fill-rule='evenodd'%20d='M32%200c17.673%200%2032%2014.327%2032%2032%200%2017.673-14.327%2032-32%2032C14.327%2064%200%2049.673%200%2032%200%2014.327%2014.327%200%2032%200zm0%201.208C14.994%201.208%201.208%2014.994%201.208%2032S14.994%2062.792%2032%2062.792%2062.792%2049.006%2062.792%2032%2049.006%201.208%2032%201.208zm0%2018.886a7.245%207.245%200%200%201%207.245%207.245v3.103h.52c.86%200%201.557.698%201.557%201.558v9.322c0%20.86-.697%201.558-1.557%201.558h-15.53c-.86%200-1.557-.697-1.557-1.558V32c0-.86.697-1.558%201.557-1.558h.52V27.34A7.245%207.245%200%200%201%2032%2020.094zm0%203.103a4.142%204.142%200%200%200-4.142%204.142v3.103h8.284V27.34A4.142%204.142%200%200%200%2032%2023.197z'/%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%3e%3cpath%20d='M19%206.41%2017.59%205%2012%2010.59%206.41%205%205%206.41%2010.59%2012%205%2017.59%206.41%2019%2012%2013.41%2017.59%2019%2019%2017.59%2013.41%2012z'/%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%3e%3cpath%20d='M16.59%208.59%2012%2013.17%207.41%208.59%206%2010l6%206%206-6z'/%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%3e%3cpath%20d='m12%208-6%206%201.41%201.41L12%2010.83l4.59%204.58L18%2014z'/%3e%3c/svg%3e\"","export const defineCustomElement = (\n tag: string,\n className: CustomElementConstructor,\n) => {\n if (!customElements || customElements.get(tag)) return;\n\n customElements.define(tag, className);\n};\n","import { LitElement, html, css, unsafeCSS } from \"lit\";\nimport { unsafeHTML } from \"lit/directives/unsafe-html.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\n\nimport colorTokens from \"@ogds/tokens/styles/css/colors.css\";\nimport spacingTokens from \"@ogds/tokens/styles/css/spacing.css\";\nimport breakpointTokens from \"@ogds/tokens/styles/css/breakpoints.css\";\nimport styles from \"./ogds-banner.css\";\n\nimport usFlagSmall from \"@uswds/uswds/img/us_flag_small.png\";\nimport iconDotGov from \"@uswds/uswds/img/icon-dot-gov.svg\";\nimport iconHttps from \"@uswds/uswds/img/icon-https.svg\";\nimport iconClose from \"../../shared/icons/close.svg\";\nimport iconExpandMore from \"../../shared/icons/expand_more.svg\";\nimport iconExpandLess from \"../../shared/icons/expand_less.svg\";\nimport { defineCustomElement } from \"../../utils\";\n\ninterface OgdsBannerTranslations {\n banner: {\n label: string;\n text: string;\n action: string;\n };\n domain: {\n heading: string;\n text1: string;\n text2: string;\n };\n https: {\n heading1: string;\n heading2: string;\n text1: string;\n text2: string;\n text3: string;\n };\n}\n\ntype SupportedLanguage = \"en\" | \"es\";\n\nconst OGDS_BANNER_TRANSLATIONS: Record<\n SupportedLanguage,\n OgdsBannerTranslations\n> = {\n en: {\n banner: {\n label: \"Official website of the United States government\",\n text: \"An official website of the United States government\",\n action: \"Here’s how you know\",\n },\n domain: {\n heading: \"Official websites use\",\n text1: \"A\",\n text2:\n \"website belongs to an official government organization in the United States.\",\n },\n https: {\n heading1: \"Secure\",\n heading2: \"websites use HTTPS\",\n text1: \"A <strong>lock</strong>\",\n text2:\n \"or <strong>https://</strong> means you’ve safely connected to the\",\n text3:\n \"website. Share sensitive information only on official, secure websites.\",\n },\n },\n es: {\n banner: {\n label: \"Un sitio oficial del Gobierno de Estados Unidos\",\n text: \"Un sitio oficial del Gobierno de Estados Unidos\",\n action: \"Así es como usted puede verificarlo\",\n },\n domain: {\n heading: \"Los sitios web oficiales usan\",\n text1: \"Un sitio web\",\n text2:\n \"pertenece a una organización oficial del Gobierno de Estados Unidos.\",\n },\n https: {\n heading1: \"Los sitios web seguros\",\n heading2: \"usan HTTPS\",\n text1: \"Un <strong>candado</strong>\",\n text2:\n \"o <strong>https://</strong> significa que usted se conectó de forma segura a un sitio web\",\n text3:\n \"Comparta información sensible sólo en sitios web oficiales y seguros.\",\n },\n },\n};\n\n/**\n * @summary The ogds-banner component.\n *\n * @attribute {string} lang - The element's language.\n * @attribute {string} label - The custom aria label users can override.\n * @attribute {string} tld - The top level domain for the site.\n *\n * @cssprop --ogds-banner-background-color - Sets banner background color.\n * @cssprop --ogds-banner-button-close-background-color - Sets the background color for the close control on smaller viewports.\n * @cssprop --ogds-banner-focus-outline-color - Sets banner focus outline color.\n * @cssprop --ogds-banner-font-family - Sets banner font family.\n * @cssprop --ogds-banner-icon-gov-color - Sets the color for the official government domain icon in the expanded state of the banner.\n * @cssprop --ogds-banner-icon-https-color - Sets the color for the https icon in the expanded state of the banner.\n * @cssprop --ogds-banner-link-color - Sets the default link color.\n * @cssprop --ogds-banner-link-hover-color - Sets the default link color.\n * @cssprop --ogds-banner-text-color - Sets the default text color.\n *\n * @slot banner-text - The text for official government website text.\n * @slot banner-action - Action text label \"Here's how you know.\"\n * @slot domain-heading - Heading text for the domain section.\n * @slot domain-text - Body text for domain section.\n * @slot https-heading - Heading for HTTPs section.\n * @slot https-text - Body text for HTTPs section.\n *\n * @element ogds-banner\n */\nexport class OgdsBanner extends LitElement {\n static properties = {\n flagSrc: { type: String },\n lang: { type: String, reflect: true },\n isOpen: { state: true },\n label: { type: String },\n tld: { type: String, reflect: true },\n };\n\n // Property declarations\n flagSrc!: string;\n lang!: \"en\" | \"es\";\n isOpen!: boolean;\n label!: string;\n tld!: \"gov\" | \"mil\";\n\n toggle() {\n this.isOpen = !this.isOpen;\n const contentElement = this.shadowRoot?.querySelector(\".content\");\n if (contentElement) {\n contentElement.toggleAttribute(\"hidden\");\n }\n }\n\n constructor() {\n super();\n this.flagSrc = usFlagSmall;\n this.lang = \"en\";\n this.isOpen = false;\n this.tld = \"gov\";\n }\n\n // Get English or Spanish strings. Default to English if an unknown `lang` is passed.\n // Ex: <usa-banner lang=\"zy\"></usa-banner>\n protected get _bannerText() {\n return (\n OGDS_BANNER_TRANSLATIONS[this.lang] || OGDS_BANNER_TRANSLATIONS[\"en\"]\n );\n }\n\n // Get the action text and use for both mobile & desktop buttons.\n protected get _actionText() {\n const bannerActionText = this.querySelector('[slot=\"banner-action\"]');\n\n return bannerActionText?.textContent;\n }\n\n domainTemplate(tld: string) {\n const { domain } = this._bannerText;\n\n return html`\n <div class=\"icon-gov\">\n <p>\n <strong>\n <slot name=\"domain-heading\"> ${domain.heading} .${tld} </slot>\n </strong>\n <br />\n <slot name=\"domain-text\">\n ${domain.text1} <strong>.${tld}</strong> ${domain.text2}\n </slot>\n </p>\n </div>\n `;\n }\n\n lockIcon() {\n return html`\n <span\n class=\"icon-lock\"\n role=\"img\"\n aria-label=\"Locked padlock icon\"\n ></span>\n `;\n }\n\n httpsTemplate(tld: string) {\n const { https } = this._bannerText;\n\n return html`\n <div class=\"icon-https\">\n <p>\n <strong>\n <slot name=\"https-heading\">\n ${https.heading1} .${tld} ${https.heading2}\n </slot> </strong\n ><br />\n <slot name=\"https-text\">\n ${unsafeHTML(https.text1)} (${this.lockIcon()})\n ${unsafeHTML(https.text2)} .${tld} ${https.text3}\n </slot>\n </p>\n </div>\n `;\n }\n\n static styles = [\n css`\n :host {\n /** Icons */\n --ogds-icon-close: url(\"${unsafeCSS(iconClose)}\");\n --ogds-icon-expand-less: url(\"${unsafeCSS(iconExpandLess)}\");\n --ogds-icon-expand-more: url(\"${unsafeCSS(iconExpandMore)}\");\n --ogds-icon-gov: url(\"${unsafeCSS(iconDotGov)}\");\n --ogds-icon-https: url(\"${unsafeCSS(iconHttps)}\");\n }\n `,\n breakpointTokens,\n colorTokens,\n spacingTokens,\n styles,\n ];\n\n render() {\n const classes = { [\"expanded\"]: this.isOpen };\n // ? Is there a better way to fallback to a default value is passed value doesn't match?\n // Example: User passes `tld=\"zzz\"` --> uses \"gov\" domain instead of `zzz`.\n const tld = this.tld === \"mil\" ? \"mil\" : \"gov\";\n const { banner } = this._bannerText;\n\n return html`\n <section aria-label=${this.label || banner.label}>\n <div class=\"usa-accordion\">\n <header class=\"${classMap(classes)}\">\n <div class=\"inner\">\n <div class=\"grid-col-auto\">\n <img\n aria-hidden=\"true\"\n class=\"header-flag\"\n src=${this.flagSrc}\n alt=\"\"\n />\n </div>\n <div\n class=\"grid-col-fill tablet:grid-col-auto\"\n aria-hidden=\"true\"\n >\n <p class=\"header-text\">\n <slot name=\"banner-text\">${banner.text}</slot>\n </p>\n <!-- \n Since the header-action text below is underlined, the slot and p \n need to be on the same line to avoid one extra space of underline \n before the expand icon.\n -->\n <!-- prettier-ignore -->\n <p class=\"header-action\"><slot name=\"banner-action\">${banner.action}</slot></p>\n </div>\n <button\n type=\"button\"\n class=\"usa-accordion__button\"\n aria-expanded=\"${this.isOpen}\"\n aria-controls=\"gov-banner-default\"\n @click=\"${this.toggle}\"\n >\n <span class=\"button-text\">\n ${this._actionText || banner.action}\n </span>\n </button>\n </div>\n </header>\n <div class=\"content usa-accordion__content\" hidden>\n <div class=\"grid-row grid-gap-lg\">\n <div class=\"guidance tablet:grid-col-6\">\n ${this.domainTemplate(tld)}\n </div>\n <div class=\"guidance tablet:grid-col-6\">\n ${this.httpsTemplate(tld)}\n </div>\n </div>\n </div>\n </div>\n </section>\n `;\n }\n}\n\ndefineCustomElement(\"ogds-banner\", OgdsBanner);\n"],"names":["usFlagSmall","iconDotGov","iconHttps","iconClose","iconChevronDown","iconChevronUp","defineCustomElement","tag","className","OGDS_BANNER_TRANSLATIONS","_OgdsBanner","LitElement","contentElement","tld","domain","html","https","unsafeHTML","classes","banner","classMap","css","unsafeCSS","iconExpandLess","iconExpandMore","breakpointTokens","colorTokens","spacingTokens","styles","OgdsBanner"],"mappings":";;;w02BAAAA,IAAe,kWCAfC,IAAe,4vBCAfC,IAAe,y6BCAfC,IAAe,2SCAfC,IAAe,sNCAfC,IAAe,mNCAFC,IAAsB,CACjCC,GACAC,MACG;AACH,EAAI,CAAC,kBAAkB,eAAe,IAAID,CAAG,KAE7C,eAAe,OAAOA,GAAKC,CAAS;AACtC,GCgCMC,IAGF;AAAA,EACF,IAAI;AAAA,IACF,QAAQ;AAAA,MACN,OAAO;AAAA,MACP,MAAM;AAAA,MACN,QAAQ;AAAA,IAAA;AAAA,IAEV,QAAQ;AAAA,MACN,SAAS;AAAA,MACT,OAAO;AAAA,MACP,OACE;AAAA,IAAA;AAAA,IAEJ,OAAO;AAAA,MACL,UAAU;AAAA,MACV,UAAU;AAAA,MACV,OAAO;AAAA,MACP,OACE;AAAA,MACF,OACE;AAAA,IAAA;AAAA,EACJ;AAAA,EAEF,IAAI;AAAA,IACF,QAAQ;AAAA,MACN,OAAO;AAAA,MACP,MAAM;AAAA,MACN,QAAQ;AAAA,IAAA;AAAA,IAEV,QAAQ;AAAA,MACN,SAAS;AAAA,MACT,OAAO;AAAA,MACP,OAC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AA,kCACnBqB,EAAUpB,CAAS,CAAC;AAAA;AAAA;AAAA,EAGlDuB;AAAA,EACAC;AAAA,EACAC;AAAA,EACAC;AAAA;AA7GG,IAAMC,IAANnB;AAgLPJ,EAAoB,eAAeuB,CAAU;","x_google_ignoreList":[0,1,2]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-DTiLuJoA.cjs","sources":["../node_modules/@uswds/uswds/dist/img/us_flag_small.png","../node_modules/@uswds/uswds/dist/img/icon-dot-gov.svg","../node_modules/@uswds/uswds/dist/img/icon-https.svg","../src/shared/icons/close.svg","../src/shared/icons/expand_more.svg","../src/shared/icons/expand_less.svg","../src/utils/index.ts","../src/components/ogds-banner/index.ts"],"sourcesContent":["export default \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAAsBAMAAAAncaPMAAAAAXNSR0IArs4c6QAAABtQTFRF////4EAg2z8g2z8f2z4f2j4fHjSyHjOxHTOxQEYPwgAAAIdJREFUeNrNkUENxDAMBEOhFJaCKZiCKZhCKBj2ebV3rdR71+pIq+Qxj1GyqjJ3U8VlHkc07hFm0awBYe91juq6MSI0yhSAEgkzJ4TMKiXyzFw3pgR9lmIBJlqj2AmBedf+IycExmlKZVzvZEJ4A0oBrjBl/m6PCy95B3fFAN6YuQPxhbcB4QMkEj04wQXD5wAAAABJRU5ErkJggg==\"","export default \"data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='64'%20height='64'%20viewBox='0%200%2064%2064'%3e%3ctitle%3eicon-dot-gov%3c/title%3e%3cpath%20fill='%232378C3'%20fill-rule='evenodd'%20d='m32%200c17.7%200%2032%2014.3%2032%2032s-14.3%2032-32%2032-32-14.3-32-32%2014.3-32%2032-32zm0%201.2c-17%200-30.8%2013.8-30.8%2030.8s13.8%2030.8%2030.8%2030.8%2030.8-13.8%2030.8-30.8-13.8-30.8-30.8-30.8zm11.4%2038.9c.5%200%20.9.4.9.8v1.6h-24.6v-1.6c0-.5.4-.8.9-.8zm-17.1-12.3v9.8h1.6v-9.8h3.3v9.8h1.6v-9.8h3.3v9.8h1.6v-9.8h3.3v9.8h.8c.5%200%20.9.4.9.8v.8h-21.4v-.8c0-.5.4-.8.9-.8h.8v-9.8zm5.7-8.2%2012.3%204.9v1.6h-1.6c0%20.5-.4.8-.9.8h-19.6c-.5%200-.9-.4-.9-.8h-1.6v-1.6s12.3-4.9%2012.3-4.9z'/%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='64'%20height='64'%20viewBox='0%200%2064%2064'%3e%3ctitle%3eicon-https%3c/title%3e%3cpath%20fill='%23719F2A'%20fill-rule='evenodd'%20d='M32%200c17.673%200%2032%2014.327%2032%2032%200%2017.673-14.327%2032-32%2032C14.327%2064%200%2049.673%200%2032%200%2014.327%2014.327%200%2032%200zm0%201.208C14.994%201.208%201.208%2014.994%201.208%2032S14.994%2062.792%2032%2062.792%2062.792%2049.006%2062.792%2032%2049.006%201.208%2032%201.208zm0%2018.886a7.245%207.245%200%200%201%207.245%207.245v3.103h.52c.86%200%201.557.698%201.557%201.558v9.322c0%20.86-.697%201.558-1.557%201.558h-15.53c-.86%200-1.557-.697-1.557-1.558V32c0-.86.697-1.558%201.557-1.558h.52V27.34A7.245%207.245%200%200%201%2032%2020.094zm0%203.103a4.142%204.142%200%200%200-4.142%204.142v3.103h8.284V27.34A4.142%204.142%200%200%200%2032%2023.197z'/%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%3e%3cpath%20d='M19%206.41%2017.59%205%2012%2010.59%206.41%205%205%206.41%2010.59%2012%205%2017.59%206.41%2019%2012%2013.41%2017.59%2019%2019%2017.59%2013.41%2012z'/%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%3e%3cpath%20d='M16.59%208.59%2012%2013.17%207.41%208.59%206%2010l6%206%206-6z'/%3e%3c/svg%3e\"","export default \"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%3e%3cpath%20d='m12%208-6%206%201.41%201.41L12%2010.83l4.59%204.58L18%2014z'/%3e%3c/svg%3e\"","export const defineCustomElement = (\n tag: string,\n className: CustomElementConstructor,\n) => {\n if (!customElements || customElements.get(tag)) return;\n\n customElements.define(tag, className);\n};\n","import { LitElement, html, css, unsafeCSS } from \"lit\";\nimport { unsafeHTML } from \"lit/directives/unsafe-html.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\n\nimport colorTokens from \"@ogds/tokens/styles/css/colors.css\";\nimport spacingTokens from \"@ogds/tokens/styles/css/spacing.css\";\nimport breakpointTokens from \"@ogds/tokens/styles/css/breakpoints.css\";\nimport styles from \"./ogds-banner.css\";\n\nimport usFlagSmall from \"@uswds/uswds/img/us_flag_small.png\";\nimport iconDotGov from \"@uswds/uswds/img/icon-dot-gov.svg\";\nimport iconHttps from \"@uswds/uswds/img/icon-https.svg\";\nimport iconClose from \"../../shared/icons/close.svg\";\nimport iconExpandMore from \"../../shared/icons/expand_more.svg\";\nimport iconExpandLess from \"../../shared/icons/expand_less.svg\";\nimport { defineCustomElement } from \"../../utils\";\n\ninterface OgdsBannerTranslations {\n banner: {\n label: string;\n text: string;\n action: string;\n };\n domain: {\n heading: string;\n text1: string;\n text2: string;\n };\n https: {\n heading1: string;\n heading2: string;\n text1: string;\n text2: string;\n text3: string;\n };\n}\n\ntype SupportedLanguage = \"en\" | \"es\";\n\nconst OGDS_BANNER_TRANSLATIONS: Record<\n SupportedLanguage,\n OgdsBannerTranslations\n> = {\n en: {\n banner: {\n label: \"Official website of the United States government\",\n text: \"An official website of the United States government\",\n action: \"Here’s how you know\",\n },\n domain: {\n heading: \"Official websites use\",\n text1: \"A\",\n text2:\n \"website belongs to an official government organization in the United States.\",\n },\n https: {\n heading1: \"Secure\",\n heading2: \"websites use HTTPS\",\n text1: \"A <strong>lock</strong>\",\n text2:\n \"or <strong>https://</strong> means you’ve safely connected to the\",\n text3:\n \"website. Share sensitive information only on official, secure websites.\",\n },\n },\n es: {\n banner: {\n label: \"Un sitio oficial del Gobierno de Estados Unidos\",\n text: \"Un sitio oficial del Gobierno de Estados Unidos\",\n action: \"Así es como usted puede verificarlo\",\n },\n domain: {\n heading: \"Los sitios web oficiales usan\",\n text1: \"Un sitio web\",\n text2:\n \"pertenece a una organización oficial del Gobierno de Estados Unidos.\",\n },\n https: {\n heading1: \"Los sitios web seguros\",\n heading2: \"usan HTTPS\",\n text1: \"Un <strong>candado</strong>\",\n text2:\n \"o <strong>https://</strong> significa que usted se conectó de forma segura a un sitio web\",\n text3:\n \"Comparta información sensible sólo en sitios web oficiales y seguros.\",\n },\n },\n};\n\n/**\n * @summary The ogds-banner component.\n *\n * @attribute {string} lang - The element's language.\n * @attribute {string} label - The custom aria label users can override.\n * @attribute {string} tld - The top level domain for the site.\n *\n * @cssprop --ogds-banner-background-color - Sets banner background color.\n * @cssprop --ogds-banner-button-close-background-color - Sets the background color for the close control on smaller viewports.\n * @cssprop --ogds-banner-focus-outline-color - Sets banner focus outline color.\n * @cssprop --ogds-banner-font-family - Sets banner font family.\n * @cssprop --ogds-banner-icon-gov-color - Sets the color for the official government domain icon in the expanded state of the banner.\n * @cssprop --ogds-banner-icon-https-color - Sets the color for the https icon in the expanded state of the banner.\n * @cssprop --ogds-banner-link-color - Sets the default link color.\n * @cssprop --ogds-banner-link-hover-color - Sets the default link color.\n * @cssprop --ogds-banner-text-color - Sets the default text color.\n *\n * @slot banner-text - The text for official government website text.\n * @slot banner-action - Action text label \"Here's how you know.\"\n * @slot domain-heading - Heading text for the domain section.\n * @slot domain-text - Body text for domain section.\n * @slot https-heading - Heading for HTTPs section.\n * @slot https-text - Body text for HTTPs section.\n *\n * @element ogds-banner\n */\nexport class OgdsBanner extends LitElement {\n static properties = {\n flagSrc: { type: String },\n lang: { type: String, reflect: true },\n isOpen: { state: true },\n label: { type: String },\n tld: { type: String, reflect: true },\n };\n\n // Property declarations\n flagSrc!: string;\n lang!: \"en\" | \"es\";\n isOpen!: boolean;\n label!: string;\n tld!: \"gov\" | \"mil\";\n\n toggle() {\n this.isOpen = !this.isOpen;\n const contentElement = this.shadowRoot?.querySelector(\".content\");\n if (contentElement) {\n contentElement.toggleAttribute(\"hidden\");\n }\n }\n\n constructor() {\n super();\n this.flagSrc = usFlagSmall;\n this.lang = \"en\";\n this.isOpen = false;\n this.tld = \"gov\";\n }\n\n // Get English or Spanish strings. Default to English if an unknown `lang` is passed.\n // Ex: <usa-banner lang=\"zy\"></usa-banner>\n protected get _bannerText() {\n return (\n OGDS_BANNER_TRANSLATIONS[this.lang] || OGDS_BANNER_TRANSLATIONS[\"en\"]\n );\n }\n\n // Get the action text and use for both mobile & desktop buttons.\n protected get _actionText() {\n const bannerActionText = this.querySelector('[slot=\"banner-action\"]');\n\n return bannerActionText?.textContent;\n }\n\n domainTemplate(tld: string) {\n const { domain } = this._bannerText;\n\n return html`\n <div class=\"icon-gov\">\n <p>\n <strong>\n <slot name=\"domain-heading\"> ${domain.heading} .${tld} </slot>\n </strong>\n <br />\n <slot name=\"domain-text\">\n ${domain.text1} <strong>.${tld}</strong> ${domain.text2}\n </slot>\n </p>\n </div>\n `;\n }\n\n lockIcon() {\n return html`\n <span\n class=\"icon-lock\"\n role=\"img\"\n aria-label=\"Locked padlock icon\"\n ></span>\n `;\n }\n\n httpsTemplate(tld: string) {\n const { https } = this._bannerText;\n\n return html`\n <div class=\"icon-https\">\n <p>\n <strong>\n <slot name=\"https-heading\">\n ${https.heading1} .${tld} ${https.heading2}\n </slot> </strong\n ><br />\n <slot name=\"https-text\">\n ${unsafeHTML(https.text1)} (${this.lockIcon()})\n ${unsafeHTML(https.text2)} .${tld} ${https.text3}\n </slot>\n </p>\n </div>\n `;\n }\n\n static styles = [\n css`\n :host {\n /** Icons */\n --ogds-icon-close: url(\"${unsafeCSS(iconClose)}\");\n --ogds-icon-expand-less: url(\"${unsafeCSS(iconExpandLess)}\");\n --ogds-icon-expand-more: url(\"${unsafeCSS(iconExpandMore)}\");\n --ogds-icon-gov: url(\"${unsafeCSS(iconDotGov)}\");\n --ogds-icon-https: url(\"${unsafeCSS(iconHttps)}\");\n }\n `,\n breakpointTokens,\n colorTokens,\n spacingTokens,\n styles,\n ];\n\n render() {\n const classes = { [\"expanded\"]: this.isOpen };\n // ? Is there a better way to fallback to a default value is passed value doesn't match?\n // Example: User passes `tld=\"zzz\"` --> uses \"gov\" domain instead of `zzz`.\n const tld = this.tld === \"mil\" ? \"mil\" : \"gov\";\n const { banner } = this._bannerText;\n\n return html`\n <section aria-label=${this.label || banner.label}>\n <div class=\"usa-accordion\">\n <header class=\"${classMap(classes)}\">\n <div class=\"inner\">\n <div class=\"grid-col-auto\">\n <img\n aria-hidden=\"true\"\n class=\"header-flag\"\n src=${this.flagSrc}\n alt=\"\"\n />\n </div>\n <div\n class=\"grid-col-fill tablet:grid-col-auto\"\n aria-hidden=\"true\"\n >\n <p class=\"header-text\">\n <slot name=\"banner-text\">${banner.text}</slot>\n </p>\n <!-- \n Since the header-action text below is underlined, the slot and p \n need to be on the same line to avoid one extra space of underline \n before the expand icon.\n -->\n <!-- prettier-ignore -->\n <p class=\"header-action\"><slot name=\"banner-action\">${banner.action}</slot></p>\n </div>\n <button\n type=\"button\"\n class=\"usa-accordion__button\"\n aria-expanded=\"${this.isOpen}\"\n aria-controls=\"gov-banner-default\"\n @click=\"${this.toggle}\"\n >\n <span class=\"button-text\">\n ${this._actionText || banner.action}\n </span>\n </button>\n </div>\n </header>\n <div class=\"content usa-accordion__content\" hidden>\n <div class=\"grid-row grid-gap-lg\">\n <div class=\"guidance tablet:grid-col-6\">\n ${this.domainTemplate(tld)}\n </div>\n <div class=\"guidance tablet:grid-col-6\">\n ${this.httpsTemplate(tld)}\n </div>\n </div>\n </div>\n </div>\n </section>\n `;\n }\n}\n\ndefineCustomElement(\"ogds-banner\", OgdsBanner);\n"],"names":["usFlagSmall","iconDotGov","iconHttps","iconClose","iconChevronDown","iconChevronUp","defineCustomElement","tag","className","OGDS_BANNER_TRANSLATIONS","_OgdsBanner","LitElement","contentElement","tld","domain","html","https","unsafeHTML","classes","banner","classMap","css","unsafeCSS","iconExpandLess","iconExpandMore","breakpointTokens","colorTokens","spacingTokens","styles","OgdsBanner"],"mappings":"872BAAAA,EAAe,iWCAfC,EAAe,2vBCAfC,EAAe,w6BCAfC,EAAe,0SCAfC,EAAe,qNCAfC,EAAe,kNCAFC,EAAsB,CACjCC,EACAC,IACG,CACC,CAAC,gBAAkB,eAAe,IAAID,CAAG,GAE7C,eAAe,OAAOA,EAAKC,CAAS,CACtC,ECgCMC,EAGF,CACF,GAAI,CACF,OAAQ,CACN,MAAO,mDACP,KAAM,sDACN,OAAQ,qBAAA,EAEV,OAAQ,CACN,QAAS,wBACT,MAAO,IACP,MACE,8EAAA,EAEJ,MAAO,CACL,SAAU,SACV,SAAU,qBACV,MAAO,0BACP,MACE,oEACF,MACE,yEAAA,CACJ,EAEF,GAAI,CACF,OAAQ,CACN,MAAO,kDACP,KAAM,kDACN,OAAQ,qCAAA,EAEV,OAAQ,CACN,QAAS,gCACT,MAAO,eACP,MACE,sEAAA,EAEJ,MAAO,CACL,SAAU,yBACV,SAAU,aACV,MAAO,8BACP,MACE,4FACF,MACE,uEAAA,CACJ,CAEJ,EA4BaC,EAAN,MAAMA,UAAmBC,EAAAA,UAAW,CAgBzC,QAAS,CACP,KAAK,OAAS,CAAC,KAAK,OACpB,MAAMC,EAAiB,KAAK,YAAY,cAAc,UAAU,EAC5DA,GACFA,EAAe,gBAAgB,QAAQ,CAE3C,CAEA,aAAc,CACZ,MAAA,EACA,KAAK,QAAUZ,EACf,KAAK,KAAO,KACZ,KAAK,OAAS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AAA;AAAA;AAAA;AAAA;AAAA;AAAA,sEAQcA,EAAO,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,iCAKlD,KAAK,MAAM;AAAA;AAAA,0BAElB,KAAK,MAAM;AAAA;AAAA;AAAA,oBAGjB,KAAK,aAAeA,EAAO,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAQnC,KAAK,eAAeN,CAAG,CAAC;AAAA;AAAA;AAAA,kBAGxB,KAAK,cAAcA,CAAG,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,KAOvC,CACF,EA7KEH,EAAO,WAAa,CAClB,QAAS,CAAE,KAAM,MAAA,EACjB,KAAM,CAAE,KAAM,OAAQ,QAAS,EAAA,EAC/B,OAAQ,CAAE,MAAO,EAAA,EACjB,MAAO,CAAE,KAAM,MAAA,EACf,IAAK,CAAE,KAAM,OAAQ,QAAS,EAAA,CAAK,EAyFrCA,EAAO,OAAS,CACdW,EAAAA;AAAAA;AAAAA;AAAAA,kCAG8BC,EAAAA,UAAUnB,CAAS,CAAC;AAAA,wCACdmB,EAAAA,UAAUC,CAAc,CAAC;AAAA,wCACzBD,EAAAA,UAAUE,CAAc,CAAC;AAAA,gCACjCF,EAAAA,UAAUrB,CAAU,CAAC;AAAA,kCACnBqB,EAAAA,UAAUpB,CAAS,CAAC;AAAA;AAAA,MAGlDuB,EACAC,EACAC,EACAC,CAAA,EA7GG,IAAMC,EAANnB,EAgLPJ,EAAoB,cAAeuB,CAAU","x_google_ignoreList":[0,1,2]}
@@ -1,49 +0,0 @@
1
- import { LitElement, html } from "lit";
2
- import { defineCustomElement } from "../../utils";
3
-
4
- import styles from "./usa-header.css";
5
-
6
- export class UsaHeader extends LitElement {
7
- constructor() {
8
- super();
9
- }
10
-
11
- static styles = [styles];
12
-
13
- render() {
14
- return html`
15
- <div class="header__logo">LOGO</div>
16
- <nav aria-label="Primary navigation">
17
- <ul>
18
- <li>
19
- <a href="#">A link</a>
20
- </li>
21
- <li>
22
- <button popovertarget="primary-nav-1">
23
- First item with dropdown
24
- </button>
25
- <ul popover id="primary-nav-1">
26
- <li><a href="#">Subnav 1</a></li>
27
- <li><a href="#">Subnav 2</a></li>
28
- <li><a href="#">Subnav 3</a></li>
29
- <li><a href="#">Subnav 4</a></li>
30
- </ul>
31
- </li>
32
- <li>
33
- <button popovertarget="primary-nav-2">
34
- Second item with dropdown
35
- </button>
36
- <ul popover id="primary-nav-2">
37
- <li><a href="#">Second Subnav 1</a></li>
38
- <li><a href="#">Subnav 2</a></li>
39
- <li><a href="#">Subnav 3</a></li>
40
- <li><a href="#">Subnav 4</a></li>
41
- </ul>
42
- </li>
43
- </ul>
44
- </nav>
45
- `;
46
- }
47
- }
48
-
49
- defineCustomElement("usa-header", UsaHeader);
@@ -1 +0,0 @@
1
- /* Hi */