@ogds/elements 1.0.0-alpha.6 → 1.0.0-alpha.7
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 +24 -53
- 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/{UsaLink.d.ts → UsaHeader.d.ts} +5 -17
- package/dist/components/frameworks/react/{UsaLink.js → UsaHeader.js} +4 -7
- package/dist/components/frameworks/react/index.d.ts +2 -2
- package/dist/components/frameworks/react/index.js +2 -2
- package/dist/components/index.cjs +8 -1
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.ts +3 -3
- package/dist/components/index.js +95 -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 +22 -0
- package/dist/components/{usa-banner → ogds-banner}/index.d.ts +6 -6
- 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/usa-header/index.d.ts +2 -2
- package/dist/core/token-styles.d.ts +1 -0
- package/dist/{components/usa-banner.js → index-Bl2KLDbH.js} +29 -23
- package/dist/index-Bl2KLDbH.js.map +1 -0
- package/dist/index-DTiLuJoA.cjs +95 -0
- package/dist/index-DTiLuJoA.cjs.map +1 -0
- package/dist/types/custom-element-jsx.d.ts +3 -24
- package/dist/types/custom-element-solidjs.d.ts +6 -29
- package/dist/types/custom-element-svelte.d.ts +3 -24
- package/dist/types/custom-element-vuejs.d.ts +3 -24
- package/package.json +16 -16
- package/src/components/index.ts +2 -3
- package/src/components/{usa-banner → ogds-banner}/docs.mdx +1 -10
- package/src/components/{usa-banner → ogds-banner}/index.ts +11 -9
- package/src/components/{usa-banner/usa-banner.spec.ts → ogds-banner/ogds-banner.spec.ts} +4 -4
- package/src/components/{usa-banner/usa-banner.stories.ts → ogds-banner/ogds-banner.stories.ts} +2 -2
- package/src/components/usa-header/index.ts +2 -3
- package/src/declaration.d.ts +5 -0
- package/storybook/contributing.mdx +4 -4
- package/storybook/framework-guidance.mdx +5 -5
- 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-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-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
|
@@ -80,7 +80,7 @@ export type OgdsAccordionToggleProps = {
|
|
|
80
80
|
"collapse-label"?: string;
|
|
81
81
|
};
|
|
82
82
|
|
|
83
|
-
export type
|
|
83
|
+
export type OgdsBannerProps = {
|
|
84
84
|
/** The element's language. */
|
|
85
85
|
lang?: "en" | "es";
|
|
86
86
|
/** The custom aria label users can override. */
|
|
@@ -93,11 +93,6 @@ export type UsaBannerProps = {
|
|
|
93
93
|
isOpen?: boolean;
|
|
94
94
|
};
|
|
95
95
|
|
|
96
|
-
export type UsaLinkProps = {
|
|
97
|
-
/** The url for the link */
|
|
98
|
-
href?: string | undefined;
|
|
99
|
-
};
|
|
100
|
-
|
|
101
96
|
export type CustomElements = {
|
|
102
97
|
/**
|
|
103
98
|
* The ogds-accordion component.
|
|
@@ -132,7 +127,7 @@ export type CustomElements = {
|
|
|
132
127
|
"ogds-accordion-toggle": Partial<OgdsAccordionToggleProps & BaseProps & BaseEvents>;
|
|
133
128
|
|
|
134
129
|
/**
|
|
135
|
-
* The
|
|
130
|
+
* The ogds-banner component.
|
|
136
131
|
* ---
|
|
137
132
|
*
|
|
138
133
|
*
|
|
@@ -155,21 +150,5 @@ export type CustomElements = {
|
|
|
155
150
|
* - **--ogds-banner-link-hover-color** - Sets the default link color. _(default: undefined)_
|
|
156
151
|
* - **--ogds-banner-text-color** - Sets the default text color. _(default: undefined)_
|
|
157
152
|
*/
|
|
158
|
-
"
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* The usa-link component.
|
|
162
|
-
* ---
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
* ### **Slots:**
|
|
166
|
-
* - _default_ - This element has a slot
|
|
167
|
-
*
|
|
168
|
-
* ### **CSS Properties:**
|
|
169
|
-
* - **--theme-link-color** - Sets the link color _(default: undefined)_
|
|
170
|
-
* - **--theme-link-visited-color** - Sets the color for visited links _(default: undefined)_
|
|
171
|
-
* - **--theme-link-hover-color** - Sets the hover state link color _(default: undefined)_
|
|
172
|
-
* - **--theme-link-active-color** - Sets the active state link color _(default: undefined)_
|
|
173
|
-
*/
|
|
174
|
-
"usa-link": Partial<UsaLinkProps & BaseProps & BaseEvents>;
|
|
153
|
+
"ogds-banner": Partial<OgdsBannerProps & BaseProps & BaseEvents>;
|
|
175
154
|
};
|
|
@@ -86,7 +86,7 @@ type OgdsAccordionToggleProps = {
|
|
|
86
86
|
JSX.OnAttributes<OgdsAccordionToggle> &
|
|
87
87
|
JSX.OnCaptureAttributes<OgdsAccordionToggle>;
|
|
88
88
|
|
|
89
|
-
type
|
|
89
|
+
type OgdsBannerProps = {
|
|
90
90
|
/** The element's language. */
|
|
91
91
|
lang?: "en" | "es";
|
|
92
92
|
/** The custom aria label users can override. */
|
|
@@ -97,16 +97,9 @@ type UsaBannerProps = {
|
|
|
97
97
|
flagSrc?: string;
|
|
98
98
|
/** */
|
|
99
99
|
isOpen?: boolean;
|
|
100
|
-
} & JSX.DirectiveFunctionAttributes<
|
|
101
|
-
JSX.OnAttributes<
|
|
102
|
-
JSX.OnCaptureAttributes<
|
|
103
|
-
|
|
104
|
-
type UsaLinkProps = {
|
|
105
|
-
/** The url for the link */
|
|
106
|
-
href?: string | undefined;
|
|
107
|
-
} & JSX.DirectiveFunctionAttributes<UsaLink> &
|
|
108
|
-
JSX.OnAttributes<UsaLink> &
|
|
109
|
-
JSX.OnCaptureAttributes<UsaLink>;
|
|
100
|
+
} & JSX.DirectiveFunctionAttributes<OgdsBanner> &
|
|
101
|
+
JSX.OnAttributes<OgdsBanner> &
|
|
102
|
+
JSX.OnCaptureAttributes<OgdsBanner>;
|
|
110
103
|
|
|
111
104
|
export type CustomElements = {
|
|
112
105
|
/**
|
|
@@ -142,7 +135,7 @@ export type CustomElements = {
|
|
|
142
135
|
"ogds-accordion-toggle": Partial<OgdsAccordionToggleProps & BaseProps & BaseEvents>;
|
|
143
136
|
|
|
144
137
|
/**
|
|
145
|
-
* The
|
|
138
|
+
* The ogds-banner component.
|
|
146
139
|
* ---
|
|
147
140
|
*
|
|
148
141
|
*
|
|
@@ -165,21 +158,5 @@ export type CustomElements = {
|
|
|
165
158
|
* - **--ogds-banner-link-hover-color** - Sets the default link color. _(default: undefined)_
|
|
166
159
|
* - **--ogds-banner-text-color** - Sets the default text color. _(default: undefined)_
|
|
167
160
|
*/
|
|
168
|
-
"
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* The usa-link component.
|
|
172
|
-
* ---
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
* ### **Slots:**
|
|
176
|
-
* - _default_ - This element has a slot
|
|
177
|
-
*
|
|
178
|
-
* ### **CSS Properties:**
|
|
179
|
-
* - **--theme-link-color** - Sets the link color _(default: undefined)_
|
|
180
|
-
* - **--theme-link-visited-color** - Sets the color for visited links _(default: undefined)_
|
|
181
|
-
* - **--theme-link-hover-color** - Sets the hover state link color _(default: undefined)_
|
|
182
|
-
* - **--theme-link-active-color** - Sets the active state link color _(default: undefined)_
|
|
183
|
-
*/
|
|
184
|
-
"usa-link": Partial<UsaLinkProps & BaseProps & BaseEvents>;
|
|
161
|
+
"ogds-banner": Partial<OgdsBannerProps & BaseProps & BaseEvents>;
|
|
185
162
|
};
|
|
@@ -57,7 +57,7 @@ type OgdsAccordionToggleProps = {
|
|
|
57
57
|
"collapse-label"?: string;
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
-
type
|
|
60
|
+
type OgdsBannerProps = {
|
|
61
61
|
/** The element's language. */
|
|
62
62
|
lang?: "en" | "es";
|
|
63
63
|
/** The custom aria label users can override. */
|
|
@@ -70,11 +70,6 @@ type UsaBannerProps = {
|
|
|
70
70
|
isOpen?: boolean;
|
|
71
71
|
};
|
|
72
72
|
|
|
73
|
-
type UsaLinkProps = {
|
|
74
|
-
/** The url for the link */
|
|
75
|
-
href?: string | undefined;
|
|
76
|
-
};
|
|
77
|
-
|
|
78
73
|
export type CustomElements = {
|
|
79
74
|
/**
|
|
80
75
|
* The ogds-accordion component.
|
|
@@ -109,7 +104,7 @@ export type CustomElements = {
|
|
|
109
104
|
"ogds-accordion-toggle": Partial<OgdsAccordionToggleProps & BaseProps & BaseEvents>;
|
|
110
105
|
|
|
111
106
|
/**
|
|
112
|
-
* The
|
|
107
|
+
* The ogds-banner component.
|
|
113
108
|
* ---
|
|
114
109
|
*
|
|
115
110
|
*
|
|
@@ -132,23 +127,7 @@ export type CustomElements = {
|
|
|
132
127
|
* - **--ogds-banner-link-hover-color** - Sets the default link color. _(default: undefined)_
|
|
133
128
|
* - **--ogds-banner-text-color** - Sets the default text color. _(default: undefined)_
|
|
134
129
|
*/
|
|
135
|
-
"
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* The usa-link component.
|
|
139
|
-
* ---
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
* ### **Slots:**
|
|
143
|
-
* - _default_ - This element has a slot
|
|
144
|
-
*
|
|
145
|
-
* ### **CSS Properties:**
|
|
146
|
-
* - **--theme-link-color** - Sets the link color _(default: undefined)_
|
|
147
|
-
* - **--theme-link-visited-color** - Sets the color for visited links _(default: undefined)_
|
|
148
|
-
* - **--theme-link-hover-color** - Sets the hover state link color _(default: undefined)_
|
|
149
|
-
* - **--theme-link-active-color** - Sets the active state link color _(default: undefined)_
|
|
150
|
-
*/
|
|
151
|
-
"usa-link": Partial<UsaLinkProps & BaseProps & BaseEvents>;
|
|
130
|
+
"ogds-banner": Partial<OgdsBannerProps & BaseProps & BaseEvents>;
|
|
152
131
|
};
|
|
153
132
|
|
|
154
133
|
declare namespace svelteHTML {
|
|
@@ -20,7 +20,7 @@ type OgdsAccordionToggleProps = {
|
|
|
20
20
|
"collapse-label"?: string;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
type
|
|
23
|
+
type OgdsBannerProps = {
|
|
24
24
|
/** The element's language. */
|
|
25
25
|
lang?: "en" | "es";
|
|
26
26
|
/** The custom aria label users can override. */
|
|
@@ -33,11 +33,6 @@ type UsaBannerProps = {
|
|
|
33
33
|
isOpen?: boolean;
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
type UsaLinkProps = {
|
|
37
|
-
/** The url for the link */
|
|
38
|
-
href?: string | undefined;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
36
|
export type CustomElements = {
|
|
42
37
|
/**
|
|
43
38
|
* The ogds-accordion component.
|
|
@@ -72,7 +67,7 @@ export type CustomElements = {
|
|
|
72
67
|
"ogds-accordion-toggle": DefineComponent<OgdsAccordionToggleProps>;
|
|
73
68
|
|
|
74
69
|
/**
|
|
75
|
-
* The
|
|
70
|
+
* The ogds-banner component.
|
|
76
71
|
* ---
|
|
77
72
|
*
|
|
78
73
|
*
|
|
@@ -95,23 +90,7 @@ export type CustomElements = {
|
|
|
95
90
|
* - **--ogds-banner-link-hover-color** - Sets the default link color. _(default: undefined)_
|
|
96
91
|
* - **--ogds-banner-text-color** - Sets the default text color. _(default: undefined)_
|
|
97
92
|
*/
|
|
98
|
-
"
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* The usa-link component.
|
|
102
|
-
* ---
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* ### **Slots:**
|
|
106
|
-
* - _default_ - This element has a slot
|
|
107
|
-
*
|
|
108
|
-
* ### **CSS Properties:**
|
|
109
|
-
* - **--theme-link-color** - Sets the link color _(default: undefined)_
|
|
110
|
-
* - **--theme-link-visited-color** - Sets the color for visited links _(default: undefined)_
|
|
111
|
-
* - **--theme-link-hover-color** - Sets the hover state link color _(default: undefined)_
|
|
112
|
-
* - **--theme-link-active-color** - Sets the active state link color _(default: undefined)_
|
|
113
|
-
*/
|
|
114
|
-
"usa-link": DefineComponent<UsaLinkProps>;
|
|
93
|
+
"ogds-banner": DefineComponent<OgdsBannerProps>;
|
|
115
94
|
};
|
|
116
95
|
|
|
117
96
|
declare module "vue" {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ogds/elements",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"customElements": "custom-elements.json",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -69,17 +69,17 @@
|
|
|
69
69
|
"@eslint/css": "^1.1.0",
|
|
70
70
|
"@eslint/js": "^10.0.1",
|
|
71
71
|
"@playwright/test": "^1.58.2",
|
|
72
|
-
"@storybook/addon-a11y": "^10.
|
|
73
|
-
"@storybook/addon-docs": "^10.
|
|
74
|
-
"@storybook/addon-links": "^10.
|
|
75
|
-
"@storybook/test-runner": "^0.24.
|
|
76
|
-
"@storybook/web-components-vite": "^10.
|
|
72
|
+
"@storybook/addon-a11y": "^10.3.5",
|
|
73
|
+
"@storybook/addon-docs": "^10.3.5",
|
|
74
|
+
"@storybook/addon-links": "^10.3.5",
|
|
75
|
+
"@storybook/test-runner": "^0.24.3",
|
|
76
|
+
"@storybook/web-components-vite": "^10.3.5",
|
|
77
77
|
"@types/express": "^5.0.6",
|
|
78
|
-
"@types/node": "^25.
|
|
78
|
+
"@types/node": "^25.6.0",
|
|
79
79
|
"@types/serve-static": "^2.2.0",
|
|
80
|
-
"@vitest/eslint-plugin": "^1.6.
|
|
80
|
+
"@vitest/eslint-plugin": "^1.6.16",
|
|
81
81
|
"@vitest/ui": "^4.0.18",
|
|
82
|
-
"@wc-toolkit/storybook-helpers": "^10.
|
|
82
|
+
"@wc-toolkit/storybook-helpers": "^10.3.0",
|
|
83
83
|
"axe-playwright": "^2.2.2",
|
|
84
84
|
"browserslist": "^4.28.1",
|
|
85
85
|
"concurrently": "^9.2.1",
|
|
@@ -89,22 +89,22 @@
|
|
|
89
89
|
"custom-element-svelte-integration": "^1.2.0",
|
|
90
90
|
"custom-element-vuejs-integration": "^1.4.0",
|
|
91
91
|
"custom-elements-manifest": "^2.1.0",
|
|
92
|
-
"eslint": "^10.
|
|
92
|
+
"eslint": "^10.2.1",
|
|
93
93
|
"eslint-config-prettier": "^10.1.8",
|
|
94
|
-
"eslint-plugin-storybook": "10.
|
|
94
|
+
"eslint-plugin-storybook": "10.3.5",
|
|
95
95
|
"express": "^5.2.1",
|
|
96
96
|
"husky": "^9.1.7",
|
|
97
97
|
"jsdom": "^28.1.0",
|
|
98
98
|
"lightningcss": "^1.31.1",
|
|
99
|
-
"prettier": "^3.8.
|
|
99
|
+
"prettier": "^3.8.3",
|
|
100
100
|
"serve-static": "^2.2.1",
|
|
101
101
|
"shadow-dom-testing-library": "^1.13.1",
|
|
102
102
|
"storybook": "^10.0.7",
|
|
103
|
-
"storybook-addon-tag-badges": "^3.0
|
|
104
|
-
"stylelint": "^17.
|
|
103
|
+
"storybook-addon-tag-badges": "^3.1.0",
|
|
104
|
+
"stylelint": "^17.8.0",
|
|
105
105
|
"stylelint-config-standard": "^40.0.0",
|
|
106
|
-
"stylelint-order": "^8.
|
|
107
|
-
"typescript": "^
|
|
106
|
+
"stylelint-order": "^8.1.1",
|
|
107
|
+
"typescript": "^6.0.3",
|
|
108
108
|
"vite": "^7.3.1",
|
|
109
109
|
"vite-plugin-bundlesize": "^0.3.0",
|
|
110
110
|
"vite-plugin-dts": "^4.5.4",
|
package/src/components/index.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { UsaBanner } from "./usa-banner";
|
|
1
|
+
import { OgdsBanner } from "./ogds-banner";
|
|
3
2
|
import { OgdsAccordion } from "./ogds-accordion";
|
|
4
3
|
|
|
5
|
-
export {
|
|
4
|
+
export { OgdsBanner, OgdsAccordion };
|
|
@@ -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: {
|
|
@@ -88,7 +88,7 @@ const USA_BANNER_TRANSLATIONS: Record<
|
|
|
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.
|
|
@@ -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,7 +53,7 @@ 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", () => {
|
|
@@ -65,7 +65,7 @@ describe("Spanish variant", async () => {
|
|
|
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,
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { html } from "lit";
|
|
2
|
-
import { OgdsElement } from "../../core/OgdsElement";
|
|
1
|
+
import { LitElement, html } from "lit";
|
|
3
2
|
import { defineCustomElement } from "../../utils";
|
|
4
3
|
|
|
5
4
|
import styles from "./usa-header.css";
|
|
6
5
|
|
|
7
|
-
export class UsaHeader extends
|
|
6
|
+
export class UsaHeader extends LitElement {
|
|
8
7
|
constructor() {
|
|
9
8
|
super();
|
|
10
9
|
}
|
package/src/declaration.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import Contributing from "../CONTRIBUTING.md?raw";
|
|
|
7
7
|
|
|
8
8
|
## Overview
|
|
9
9
|
|
|
10
|
-
This information is for
|
|
10
|
+
This information is for OGDS Core team members contribute to the OGDS Elements project.
|
|
11
11
|
|
|
12
12
|
## Project setup
|
|
13
13
|
|
|
@@ -19,7 +19,7 @@ npm install
|
|
|
19
19
|
|
|
20
20
|
### Installing Playwright (for E2E testing)
|
|
21
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/
|
|
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
23
|
|
|
24
24
|
## Development Workflow
|
|
25
25
|
|
|
@@ -94,7 +94,7 @@ This project uses [Husky](https://typicode.github.io/husky/) for Git hooks. Hook
|
|
|
94
94
|
|
|
95
95
|
## Publishing and Releases
|
|
96
96
|
|
|
97
|
-
The package is published as `@
|
|
97
|
+
The package is published as `@ogds/elements` on npm. The current version can be found in `package.json`
|
|
98
98
|
|
|
99
99
|
Component maturity levels:
|
|
100
100
|
|
|
@@ -112,4 +112,4 @@ Check the README for current component status.
|
|
|
112
112
|
- [Lit Documentation](https://lit.dev)
|
|
113
113
|
- [Storybook Documentation](https://storybook.js.org)
|
|
114
114
|
- [Playwright Documentation](https://playwright.dev)
|
|
115
|
-
- [E2E Testing Guide](https://github.com/
|
|
115
|
+
- [E2E Testing Guide](https://github.com/open-government-design-system/ogds-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
|
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { default as ComponentDocs } from './docs.mdx';
|
|
2
|
-
import { Args, ArgTypes } from 'storybook/internal/csf';
|
|
3
|
-
declare const _default: {
|
|
4
|
-
title: string;
|
|
5
|
-
component: string;
|
|
6
|
-
tags: string[];
|
|
7
|
-
args: {
|
|
8
|
-
label: string;
|
|
9
|
-
tld: string;
|
|
10
|
-
lang: string;
|
|
11
|
-
};
|
|
12
|
-
parameters: {
|
|
13
|
-
docs: {
|
|
14
|
-
page: typeof ComponentDocs;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
argTypes: ArgTypes<Args>;
|
|
18
|
-
render: (args: Args) => import('lit-html').TemplateResult;
|
|
19
|
-
};
|
|
20
|
-
export default _default;
|
|
21
|
-
export declare const Default: {};
|
|
22
|
-
export declare const CustomContent: {
|
|
23
|
-
argTypes: {
|
|
24
|
-
tld: {
|
|
25
|
-
table: {
|
|
26
|
-
disable: boolean;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
lang: {
|
|
30
|
-
table: {
|
|
31
|
-
disable: boolean;
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
args: {
|
|
36
|
-
label: string;
|
|
37
|
-
/**
|
|
38
|
-
* The `getStorybookHelpers` function from @wc-toolkit/storybook-helpers`
|
|
39
|
-
* automatically appends the `slot` attribute to avoid collisions with other props.
|
|
40
|
-
*
|
|
41
|
-
* To set the content for this story, the key should have the suffix `-slot`,
|
|
42
|
-
* even though the slot name in the component is `banner-text`, `banner-action`, etc.
|
|
43
|
-
*/
|
|
44
|
-
"banner-text-slot": string;
|
|
45
|
-
"banner-action-slot": string;
|
|
46
|
-
"domain-heading-slot": string;
|
|
47
|
-
"domain-text-slot": string;
|
|
48
|
-
"https-heading-slot": string;
|
|
49
|
-
"https-text-slot": string;
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
export declare const Mil: {
|
|
53
|
-
args: {
|
|
54
|
-
tld: string;
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
export declare const EspañolGov: {
|
|
58
|
-
args: {
|
|
59
|
-
lang: string;
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
export declare const EspañolMil: {
|
|
63
|
-
args: {
|
|
64
|
-
lang: string;
|
|
65
|
-
tld: string;
|
|
66
|
-
};
|
|
67
|
-
};
|
|
68
|
-
export declare const CustomThemeExample: {
|
|
69
|
-
parameters: {
|
|
70
|
-
docs: {
|
|
71
|
-
disable: boolean;
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
args: {
|
|
75
|
-
"--ogds-banner-background-color": string;
|
|
76
|
-
"--ogds-banner-button-close-background-color": string;
|
|
77
|
-
"--ogds-banner-focus-outline-color": string;
|
|
78
|
-
"--ogds-banner-font-family": string;
|
|
79
|
-
"--ogds-banner-link-hover-color": string;
|
|
80
|
-
"--ogds-banner-text-color": string;
|
|
81
|
-
"--ogds-banner-link-color": string;
|
|
82
|
-
"--ogds-banner-icon-gov-color": string;
|
|
83
|
-
"--ogds-banner-icon-https-color": string;
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
|
-
export declare const ToggleBannerTest: {
|
|
87
|
-
parameters: {
|
|
88
|
-
docs: {
|
|
89
|
-
disable: boolean;
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
|
-
play: ({ canvasElement }: {
|
|
93
|
-
canvasElement: HTMLElement;
|
|
94
|
-
}) => Promise<void>;
|
|
95
|
-
};
|