@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
|
@@ -2,7 +2,7 @@ import { create } from "storybook/theming/create";
|
|
|
2
2
|
|
|
3
3
|
export default create({
|
|
4
4
|
base: "light",
|
|
5
|
-
brandTitle: "
|
|
5
|
+
brandTitle: "OGDS Elements",
|
|
6
6
|
fontBase:
|
|
7
7
|
'"Public Sans Web", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',
|
|
8
8
|
colorPrimary: "#0050d8",
|
package/.storybook/manager.js
CHANGED
package/.storybook/preview.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { setCustomElementsManifest } from "@storybook/web-components-vite";
|
|
5
5
|
import { setStorybookHelpersConfig } from "@wc-toolkit/storybook-helpers";
|
|
6
6
|
import customElements from "../custom-elements.json";
|
|
7
|
-
import
|
|
7
|
+
import OgdsTheme from "./OgdsTheme";
|
|
8
8
|
import "../storybook/index.css";
|
|
9
9
|
import "../src/core/index.css";
|
|
10
10
|
|
|
@@ -24,7 +24,7 @@ const preview = {
|
|
|
24
24
|
},
|
|
25
25
|
docs: {
|
|
26
26
|
toc: true, // Autogenerate table of contents.
|
|
27
|
-
theme:
|
|
27
|
+
theme: OgdsTheme,
|
|
28
28
|
codePanel: true,
|
|
29
29
|
canvas: {
|
|
30
30
|
sourceState: "shown",
|
package/README.md
CHANGED
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
> This is a work-in-progress fork of USWDS Elements, hence the README saying what it says. Updated docs coming soon!
|
|
1
|
+
# OGDS Elements
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
The Open Government Design System (OGDS) is a complement to and reimagining of the [United States Web Design System](https://designsystem.digital.gov) (USWDS). OGDS aims to ship components and styles that will feel at home in any site using USWDS. This project leverages the modern web platform to deliver the same level of reliability and accessibility as USWDS with less code.
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
You can (and should!) use both OGDS components and traditional USWDS components in your project. Some of our OGDS components are **enhanced** versions of USWDS components, such as the accordion and banner components. Some of our components are entirely **new**, such as the Task List component.
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
The components developed in OGDS Elements use [the same design tokens as USWDS](https://designsystem.digital.gov/design-tokens/), such as colors and spacing values. These are imported from the [OGDS Tokens project](https://github.com/open-government-design-system/ogds-tokens), which makes the USWDS design tokens available in multiple formats. In this project, we use [CSS Custom Properties (CSS Variables)](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_cascading_variables/Using_CSS_custom_properties), which means we can benefit from this feature of modern browsers. CSS Custom Properties have been [widely available in all major browsers since 2017](https://caniuse.com/css-variables)). This approach helps us to avoid a css compiler (like SASS), it helps us to manage themes and overrides, and it helps us style components in a simpler way.
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
## Component Documentation on Storybook
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
Where can I see exapmles of the OGDS Elements components? How do I set this up?
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
For more detailed documentation, see the [OGDS Elements Storybook](https://ogds-elements.jbhutch01.workers.dev/).
|
|
15
14
|
|
|
16
|
-
|
|
15
|
+
## Using OGDS Elements
|
|
17
16
|
|
|
18
|
-
|
|
17
|
+
### Installation using node and npm
|
|
19
18
|
|
|
20
19
|
1. Install `node/npm`. In the link below you can find the install method that coincides with your operating system:
|
|
21
|
-
- Node (see [.nvmrc](https://github.com/
|
|
20
|
+
- Node (see [.nvmrc](https://github.com/open-government-design-system/ogds-elements/blob/develop/.nvmrc) for version number), [Installation guides](https://nodejs.org/en/download)
|
|
22
21
|
|
|
23
22
|
**Note for Windows users:** If you are using Windows and are unfamiliar with Node or npm, we recommend following [Team Treehouse's tutorial](http://blog.teamtreehouse.com/install-node-js-npm-windows) for more information or [installing and running your project from Windows Subsystem for Linux (WSL)](https://learn.microsoft.com/en-us/windows/dev-environment/javascript/nodejs-on-wsl#install-nvm-nodejs-and-npm).
|
|
24
23
|
|
|
@@ -31,171 +30,75 @@ We're releasing these Web Components (USWDS Elements) incrementally with the int
|
|
|
31
30
|
|
|
32
31
|
3. Create a `package.json` file. You can do this manually, but an easier method is to use the `npm init` command. This command will prompt you with a few questions to create your `package.json` file.
|
|
33
32
|
|
|
34
|
-
4. Add `@
|
|
33
|
+
4. Add `@ogds/elements` to your project’s `package.json`:
|
|
35
34
|
|
|
36
35
|
```shell
|
|
37
|
-
npm install -S @
|
|
36
|
+
npm install -S @ogds/elements
|
|
38
37
|
```
|
|
39
38
|
|
|
40
|
-
The `@
|
|
39
|
+
The `@ogds/elements` module is now installed as a dependency.
|
|
41
40
|
|
|
42
41
|
**Note:** We do _not_ recommend directly editing the design system files in `node_modules`. One of the benefits of using a package manager is its ease of upgrade and installation. If you make customizations to the files in the package, any upgrade or re-installation will wipe them out.
|
|
43
42
|
|
|
44
|
-
|
|
43
|
+
### Using OGDS Elements in your project
|
|
45
44
|
|
|
46
|
-
How you add a
|
|
45
|
+
How you add a OGDS Elements component to a page might vary depending on your tools. If you use Vite, you can add components by importing them into a script that's imported elsewhere into a page:
|
|
47
46
|
|
|
48
47
|
```js
|
|
49
48
|
// Importing into a javascript file, like index.js
|
|
50
|
-
import {
|
|
49
|
+
import { OgdsAccordion } from "@ogds/elements";
|
|
51
50
|
```
|
|
52
51
|
|
|
53
52
|
```html
|
|
54
53
|
<!-- importing directly into an HTML page -->
|
|
55
54
|
<script type="module">
|
|
56
|
-
import {
|
|
55
|
+
import { OgdsAccordion } from "@ogds/elements";
|
|
57
56
|
</script>
|
|
58
|
-
<
|
|
57
|
+
<ogds-accordion>
|
|
58
|
+
<!--Refer to the accordion documentation for the code that actually goes in here -->
|
|
59
|
+
</ogds-accordion>
|
|
59
60
|
```
|
|
60
61
|
|
|
61
|
-
|
|
62
|
+
### Style theming and tokens
|
|
62
63
|
|
|
63
|
-
Each
|
|
64
|
+
Each OGDS Element provides support for theming by exposing CSS custom properties (CSS variables) that can be used to control the appearance of the component.
|
|
64
65
|
|
|
65
66
|
Interactive form controls in our Storybook instance can demonstrate how to use the theming variables, provide custom text, and otherwise customize the components.
|
|
66
67
|
|
|
67
|
-
For example, the `
|
|
68
|
+
For example, the `ogds-banner` component can be customized by setting the `--ogds-banner-background-color` CSS variable to a color of your choosing:
|
|
68
69
|
|
|
69
70
|
```html
|
|
70
71
|
<style>
|
|
71
|
-
|
|
72
|
-
--
|
|
73
|
-
--
|
|
72
|
+
ogds-banner {
|
|
73
|
+
--ogds-banner-background-color: #d9e8f6; /** equivalent to `primary-lighter` from USWDS - https://designsystem.digital.gov/design-tokens/color/theme-tokens/#theme-color-tokens-table-2 */
|
|
74
|
+
--ogds-banner-button-close-background-color: #d6f3ff;
|
|
74
75
|
}
|
|
75
76
|
</style>
|
|
76
|
-
<
|
|
77
|
+
<ogds-banner></ogds-banner>
|
|
77
78
|
```
|
|
78
79
|
|
|
79
|
-
You can see this in the demo on the [USWDS Elements Storybook](<https://federalist-ab6c0bdb-eccd-4b26-bb5f-b0154661e999.sites.pages.cloud.gov/site/uswds/web-components/?path=/story/components-banner--default&args=--usa-banner-background-color:!hex(e4f7ff)>).
|
|
80
|
-
|
|
81
80
|
**Note:** Please be mindful of the accessibility implications of customizing component appearance. It's **your** responsibility to ensure that your customizations meet the [accessibility requirements](https://designsystem.digital.gov/accessibility/) of the design system and pass any [WCAG 2.2](https://www.w3.org/TR/WCAG22/) or [Section 508](https://www.section508.gov/) accessibility tests.
|
|
82
81
|
|
|
83
|
-
##
|
|
84
|
-
|
|
85
|
-
For more detailed documentation, refer to the Storybook for USWDS Elements. You can visit the most up-to-date Storybook documentation on [Cloud.gov Pages](https://federalist-ab6c0bdb-eccd-4b26-bb5f-b0154661e999.sites.pages.cloud.gov/site/uswds/web-components/?path=/docs/readme--docs).
|
|
86
|
-
|
|
87
|
-
## Browser support
|
|
88
|
-
|
|
89
|
-
We’ve designed the design system to support older and newer browsers through [progressive enhancement](https://en.wikipedia.org/wiki/Progressive_enhancement). The current major version of USWDS Elements (v1) follows the [2% rule](https://gds.blog.gov.uk/2012/01/25/support-for-browsers/): we officially support any browser above 2% usage as observed by [analytics.usa.gov](https://analytics.usa.gov/). Currently, this means support for the newest versions of Chrome, Firefox, and Safari.
|
|
90
|
-
|
|
91
|
-
## Accessibility
|
|
92
|
-
|
|
93
|
-
The design system also meets the [WCAG 2.0 AA accessibility guidelines](https://www.w3.org/TR/WCAG20/) and conforms to the standards of [Section 508 of the Rehabilitation Act](http://www.section508.gov/). Additionally, we try to meet the requirements of [WCAG 2.2](https://www.w3.org/TR/WCAG22/).
|
|
94
|
-
|
|
95
|
-
We use the following tools to ensure USWDS is accessible:
|
|
96
|
-
|
|
97
|
-
- [ANDI](https://www.ssa.gov/accessibility/andi/help/install.html).
|
|
98
|
-
- [Axe core](https://www.deque.com/axe/).
|
|
99
|
-
- [Axe dev tools](https://chrome.google.com/webstore/detail/axe-devtools-web-accessib/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US).
|
|
100
|
-
|
|
101
|
-
If you find any issues with our accessibility conformance, please create an issue in our GitHub repo or send us an email at [uswds@gsa.gov](mailto:uswds@gsa.gov). We prioritize accessibility issues. See [the Accessibility page of our website](https://designsystem.digital.gov/documentation/accessibility/) for more information.
|
|
102
|
-
|
|
103
|
-
## Publishing
|
|
104
|
-
|
|
105
|
-
This repository is automatically published to NPM when a new release is created.
|
|
106
|
-
|
|
107
|
-
We use Changesets to manage changelogs, version bumps, pre-releases (alpha/beta), and automated publishing via GitHub Actions. The repository includes a pre-configured Changesets setup so you can create pre-releases (for example, `alpha`) and standard releases.
|
|
108
|
-
|
|
109
|
-
### Pre-release flow
|
|
110
|
-
|
|
111
|
-
If you're working on a pre-release version, enter pre-release mode:
|
|
112
|
-
|
|
113
|
-
```bash
|
|
114
|
-
npx @changesets/cli pre enter <tag> # for example, npx @changesets/cli pre enter alpha
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
This will write a `.changeset/pre.json` that configures the pre-release tag and initial version. This file should be committed to the repository.
|
|
118
|
-
|
|
119
|
-
**Note:** Once you're in pre-release mode, you don't have to enter it every time. When you're ready to exit pre-release mode, run:
|
|
120
|
-
|
|
121
|
-
```bash
|
|
122
|
-
npx @changesets/cli pre exit
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
### Version bumps, and publishing (Changesets)
|
|
126
|
-
|
|
127
|
-
1. Create a changeset describing your change(s)
|
|
128
|
-
- Run the interactive prompt and follow the questions:
|
|
129
|
-
|
|
130
|
-
```bash
|
|
131
|
-
npx @changesets/cli
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
- The command creates a file under the `.changeset/` directory that describes the packages and the release type (patch/minor/major). You can edit this file to add more details, such as a link to the issue or pull request that the change addresses. The file will automatically get a nonsensical name like `fire-penguin-annex.md`, and that's normal. These files are only in the repository for a short time, to generate changelogs and version bumps. They aren't published to NPM and are cleaned up after the release is published.
|
|
135
|
-
|
|
136
|
-
2. Bump versions locally (optional)
|
|
137
|
-
- To update package.json versions and changelogs locally before publishing:
|
|
138
|
-
|
|
139
|
-
```bash
|
|
140
|
-
npx @changesets/cli version
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
- Commit the resulting changes (package.json updates and generated changelog files):
|
|
144
|
-
|
|
145
|
-
```bash
|
|
146
|
-
git add .
|
|
147
|
-
git commit -m "chore(release): version packages and changelogs"
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
3. Publish
|
|
151
|
-
- Option A — Let the repository automation handle publishing (recommended):
|
|
152
|
-
- Push your branch to GitHub and open a PR. The CI / release automation will run and, depending on the configuration and merged changesets, will publish releases when merged to `main`.
|
|
153
|
-
- Option B — Publish locally (requires NPM credentials and appropriate tokens):
|
|
82
|
+
## Contributing to OGDS Elements
|
|
154
83
|
|
|
155
|
-
|
|
156
|
-
npm run release
|
|
157
|
-
```
|
|
84
|
+
OGDS is run by contributors, including folks from many government agencies, departments, states, and more. If you have ideas for what to contribute, we would love your support!
|
|
158
85
|
|
|
159
|
-
|
|
86
|
+
### Code of Conduct
|
|
160
87
|
|
|
161
|
-
|
|
88
|
+
Everyone who participates in this project is expected to follow the OGDS Code of Conduct (TK CoC Link)
|
|
162
89
|
|
|
163
|
-
|
|
164
|
-
- The workflow runs on pushes to `main` and uses the Changesets GitHub Action.
|
|
165
|
-
- The action can either create a release PR or publish directly to NPM depending on repository and action settings.
|
|
166
|
-
- The workflow uses repository secrets:
|
|
167
|
-
- `GITHUB_TOKEN` — standard workflow permission for the action to create PRs/commits.
|
|
168
|
-
- The action is configured to run the project’s release script (for example `npm run release`) and is run in a controlled environment; it will also disable Husky hooks during automated runs (HUSKY=0) to avoid local commit hooks blocking automation.
|
|
90
|
+
### Join the Mailing List and Slack
|
|
169
91
|
|
|
170
|
-
|
|
92
|
+
If you'd like to [join the People's Design System mailing list and Slack](https://docs.google.com/document/d/10XN6ZsRt9aAOH1PUmtfcCCEBZQUSgs1cCI5krYBOoi4/edit?tab=t.0), that is where we discuss these topics.
|
|
171
93
|
|
|
172
|
-
|
|
173
|
-
- Pre-release flows:
|
|
174
|
-
- The repository includes a `.changeset/pre.json` configuration that sets a default pre-release tag (e.g., `alpha`) and initial versions for pre-release packages. Use `npx @changesets/cli pre enter <tag>` to begin a pre-release cycle.
|
|
175
|
-
- When in pre mode, version bumps will produce pre-release identifiers (for example, `1.0.0-alpha.1`).
|
|
176
|
-
- CI vs local publish:
|
|
177
|
-
- For most contributors, pushing a properly authored changeset and opening a PR is the recommended route—automation will create the release or open the release PR for maintainers to review.
|
|
178
|
-
- If you must publish locally, make sure `NPM_TOKEN` is configured in your environment or use a CI/protected account to run the publish steps.
|
|
179
|
-
- If releases aren't being published as expected:
|
|
180
|
-
- Verify `NPM_TOKEN` exists in repository secrets and has publish scope.
|
|
181
|
-
- Ensure the commit/push to `main` contains a changeset (or the automation has been triggered by the Changesets action).
|
|
182
|
-
- Review the release workflow logs in GitHub Actions for details (it'll show the changesets step and any publishing errors).
|
|
183
|
-
- If you want to change the default pre-release tag (for example, from `alpha` to `beta`), update the `.changeset/pre.json` file and follow the pre-mode steps above.
|
|
94
|
+
### Filing a bug report
|
|
184
95
|
|
|
185
|
-
|
|
96
|
+
If you discovered a bug that no one else has reported in our [issues backlog](https://github.com/open-government-design-system/ogds-elements/issues), let us know by [submitting an issue](https://github.com/open-government-design-system/ogds-elements/issues/new).
|
|
186
97
|
|
|
187
|
-
|
|
188
|
-
2. Enter pre mode if you want pre-release tagging:
|
|
189
|
-
- `npx @changesets/cli pre enter --tag alpha`
|
|
190
|
-
3. Run `npx @changesets/cli` and follow the prompts (choose the appropriate release type).
|
|
191
|
-
4. Commit the changeset file(s), push the branch, and open a PR.
|
|
192
|
-
5. Once the PR is merged to `main`, the repository release workflow will pick up the changeset and publish the pre-release to NPM (provided `NPM_TOKEN` and workflow permissions are set).
|
|
98
|
+
### Starting a discussion
|
|
193
99
|
|
|
194
|
-
|
|
100
|
+
To share ideas, questions, or concerns with the OGDS core team and community, you can join any of our [open discussions](https://github.com/open-government-design-system/ogds-elements/discussions) or [start a new one](https://github.com/open-government-design-system/ogds-elements/discussions/new/choose).
|
|
195
101
|
|
|
196
|
-
|
|
102
|
+
### Contributing Code
|
|
197
103
|
|
|
198
|
-
|
|
199
|
-
| ------------ | --------- |
|
|
200
|
-
| `usa-banner` | Beta |
|
|
201
|
-
| `usa-link` | Pre-alpha |
|
|
104
|
+
See Contributing.md
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { OGDSAlert as OGDSAlertElement } from "../../ogds-alert.js";
|
|
3
3
|
|
|
4
|
-
export type {
|
|
4
|
+
export type { OGDSAlertElement };
|
|
5
5
|
|
|
6
|
-
export interface
|
|
6
|
+
export interface OGDSAlertProps extends Pick<
|
|
7
7
|
React.AllHTMLAttributes<HTMLElement>,
|
|
8
8
|
| "children"
|
|
9
9
|
| "dir"
|
|
@@ -18,8 +18,14 @@ export interface UsaLinkProps extends Pick<
|
|
|
18
18
|
| "onFocus"
|
|
19
19
|
| "onBlur"
|
|
20
20
|
> {
|
|
21
|
-
/**
|
|
22
|
-
|
|
21
|
+
/** undefined */
|
|
22
|
+
noIcon?: boolean;
|
|
23
|
+
|
|
24
|
+
/** The type of alert (info, warning, etc) */
|
|
25
|
+
type?: OGDSAlertElement["type"];
|
|
26
|
+
|
|
27
|
+
/** Use this attribute to hide the icon */
|
|
28
|
+
undefined?: OGDSAlertElement["undefined"];
|
|
23
29
|
|
|
24
30
|
/** A space-separated list of the classes of the element. Classes allows CSS and JavaScript to select and access specific elements via the class selectors or functions like the method `Document.getElementsByClassName()`. */
|
|
25
31
|
className?: string;
|
|
@@ -44,17 +50,12 @@ export interface UsaLinkProps extends Pick<
|
|
|
44
50
|
}
|
|
45
51
|
|
|
46
52
|
/**
|
|
47
|
-
* The
|
|
53
|
+
* The ogds-alert component.
|
|
48
54
|
* ---
|
|
49
55
|
*
|
|
50
56
|
*
|
|
51
57
|
* ### **Slots:**
|
|
52
|
-
* -
|
|
53
|
-
*
|
|
54
|
-
* ### **CSS Properties:**
|
|
55
|
-
* - **--theme-link-color** - Sets the link color _(default: undefined)_
|
|
56
|
-
* - **--theme-link-visited-color** - Sets the color for visited links _(default: undefined)_
|
|
57
|
-
* - **--theme-link-hover-color** - Sets the hover state link color _(default: undefined)_
|
|
58
|
-
* - **--theme-link-active-color** - Sets the active state link color _(default: undefined)_
|
|
58
|
+
* - **heading** - Text for the heading. Make sure to specify the correct heading level (h2, h3, etc)
|
|
59
|
+
* - **body** - Body content for the alert. Can contain HTML (links, etc).
|
|
59
60
|
*/
|
|
60
|
-
export const
|
|
61
|
+
export const OGDSAlert: React.ForwardRefExoticComponent<OGDSAlertProps>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import "../../ogds-alert.js";
|
|
3
|
+
|
|
4
|
+
export const OGDSAlert = forwardRef((props, forwardedRef) => {
|
|
5
|
+
const { noIcon, type, ...filteredProps } = props;
|
|
6
|
+
|
|
7
|
+
return React.createElement(
|
|
8
|
+
"ogds-alert",
|
|
9
|
+
{
|
|
10
|
+
...filteredProps,
|
|
11
|
+
type: props.type,
|
|
12
|
+
noIcon: props.undefined,
|
|
13
|
+
class: props.className,
|
|
14
|
+
exportparts: props.exportparts,
|
|
15
|
+
for: props.htmlFor,
|
|
16
|
+
part: props.part,
|
|
17
|
+
tabindex: props.tabIndex,
|
|
18
|
+
"no-icon": props.noIcon ? true : undefined,
|
|
19
|
+
style: { ...props.style },
|
|
20
|
+
},
|
|
21
|
+
props.children,
|
|
22
|
+
);
|
|
23
|
+
});
|
|
@@ -21,12 +21,6 @@ export interface OgdsAccordionToggleProps extends Pick<
|
|
|
21
21
|
/** The `id` of the `<ogds-accordion>` to control. Required. */
|
|
22
22
|
controls?: OgdsAccordionToggleElement["controls"];
|
|
23
23
|
|
|
24
|
-
/** Button label when all panels are collapsed. Defaults to "Expand All". */
|
|
25
|
-
expandLabel?: OgdsAccordionToggleElement["expandLabel"];
|
|
26
|
-
|
|
27
|
-
/** Button label when one or more panels are open. Defaults to "Collapse All". */
|
|
28
|
-
collapseLabel?: OgdsAccordionToggleElement["collapseLabel"];
|
|
29
|
-
|
|
30
24
|
/** A space-separated list of the classes of the element. Classes allows CSS and JavaScript to select and access specific elements via the class selectors or functions like the method `Document.getElementsByClassName()`. */
|
|
31
25
|
className?: string;
|
|
32
26
|
|
|
@@ -54,6 +48,10 @@ export interface OgdsAccordionToggleProps extends Pick<
|
|
|
54
48
|
* ---
|
|
55
49
|
*
|
|
56
50
|
*
|
|
51
|
+
* ### **Slots:**
|
|
52
|
+
* - **expand-label** - Button label when all panels are collapsed. Defaults to "Expand All".
|
|
53
|
+
* - **collapse-label** - Button label when one or more panels are open. Defaults to "Collapse All".
|
|
54
|
+
*
|
|
57
55
|
* ### **CSS Parts:**
|
|
58
56
|
* - **button** - The toggle button.
|
|
59
57
|
*/
|
|
@@ -2,15 +2,13 @@ import React, { forwardRef } from "react";
|
|
|
2
2
|
import "../../ogds-accordion-toggle.js";
|
|
3
3
|
|
|
4
4
|
export const OgdsAccordionToggle = forwardRef((props, forwardedRef) => {
|
|
5
|
-
const { controls,
|
|
5
|
+
const { controls, ...filteredProps } = props;
|
|
6
6
|
|
|
7
7
|
return React.createElement(
|
|
8
8
|
"ogds-accordion-toggle",
|
|
9
9
|
{
|
|
10
10
|
...filteredProps,
|
|
11
11
|
controls: props.controls,
|
|
12
|
-
"expand-label": props.expandLabel || props["expand-label"],
|
|
13
|
-
"collapse-label": props.collapseLabel || props["collapse-label"],
|
|
14
12
|
class: props.className,
|
|
15
13
|
exportparts: props.exportparts,
|
|
16
14
|
for: props.htmlFor,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { OgdsBanner as OgdsBannerElement } from "../../ogds-banner.js";
|
|
3
3
|
|
|
4
|
-
export type {
|
|
4
|
+
export type { OgdsBannerElement };
|
|
5
5
|
|
|
6
|
-
export interface
|
|
6
|
+
export interface OgdsBannerProps extends Pick<
|
|
7
7
|
React.AllHTMLAttributes<HTMLElement>,
|
|
8
8
|
| "children"
|
|
9
9
|
| "dir"
|
|
@@ -22,16 +22,16 @@ export interface UsaBannerProps extends Pick<
|
|
|
22
22
|
isOpen?: boolean;
|
|
23
23
|
|
|
24
24
|
/** The element's language. */
|
|
25
|
-
lang?:
|
|
25
|
+
lang?: OgdsBannerElement["lang"];
|
|
26
26
|
|
|
27
27
|
/** The custom aria label users can override. */
|
|
28
|
-
label?:
|
|
28
|
+
label?: OgdsBannerElement["label"];
|
|
29
29
|
|
|
30
30
|
/** The top level domain for the site. */
|
|
31
|
-
tld?:
|
|
31
|
+
tld?: OgdsBannerElement["tld"];
|
|
32
32
|
|
|
33
33
|
/** undefined */
|
|
34
|
-
flagSrc?:
|
|
34
|
+
flagSrc?: OgdsBannerElement["flagSrc"];
|
|
35
35
|
|
|
36
36
|
/** A space-separated list of the classes of the element. Classes allows CSS and JavaScript to select and access specific elements via the class selectors or functions like the method `Document.getElementsByClassName()`. */
|
|
37
37
|
className?: string;
|
|
@@ -56,7 +56,7 @@ export interface UsaBannerProps extends Pick<
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
/**
|
|
59
|
-
* The
|
|
59
|
+
* The ogds-banner component.
|
|
60
60
|
* ---
|
|
61
61
|
*
|
|
62
62
|
*
|
|
@@ -79,4 +79,4 @@ export interface UsaBannerProps extends Pick<
|
|
|
79
79
|
* - **--ogds-banner-link-hover-color** - Sets the default link color. _(default: undefined)_
|
|
80
80
|
* - **--ogds-banner-text-color** - Sets the default text color. _(default: undefined)_
|
|
81
81
|
*/
|
|
82
|
-
export const
|
|
82
|
+
export const OgdsBanner: React.ForwardRefExoticComponent<OgdsBannerProps>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React, { forwardRef } from "react";
|
|
2
|
-
import "../../
|
|
2
|
+
import "../../ogds-banner.js";
|
|
3
3
|
|
|
4
|
-
export const
|
|
4
|
+
export const OgdsBanner = forwardRef((props, forwardedRef) => {
|
|
5
5
|
const { isOpen, lang, label, tld, flagSrc, ...filteredProps } = props;
|
|
6
6
|
|
|
7
7
|
return React.createElement(
|
|
8
|
-
"
|
|
8
|
+
"ogds-banner",
|
|
9
9
|
{
|
|
10
10
|
...filteredProps,
|
|
11
11
|
lang: props.lang,
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { OgdsTaskList as OgdsTaskListElement } from "../../ogds-task-list.js";
|
|
3
|
+
|
|
4
|
+
export type { OgdsTaskListElement };
|
|
5
|
+
|
|
6
|
+
export interface OgdsTaskListProps extends Pick<
|
|
7
|
+
React.AllHTMLAttributes<HTMLElement>,
|
|
8
|
+
| "children"
|
|
9
|
+
| "dir"
|
|
10
|
+
| "hidden"
|
|
11
|
+
| "id"
|
|
12
|
+
| "lang"
|
|
13
|
+
| "slot"
|
|
14
|
+
| "style"
|
|
15
|
+
| "title"
|
|
16
|
+
| "translate"
|
|
17
|
+
| "onClick"
|
|
18
|
+
| "onFocus"
|
|
19
|
+
| "onBlur"
|
|
20
|
+
> {
|
|
21
|
+
/** A space-separated list of the classes of the element. Classes allows CSS and JavaScript to select and access specific elements via the class selectors or functions like the method `Document.getElementsByClassName()`. */
|
|
22
|
+
className?: string;
|
|
23
|
+
|
|
24
|
+
/** Contains a space-separated list of the part names of the element that should be exposed on the host element. */
|
|
25
|
+
exportparts?: string;
|
|
26
|
+
|
|
27
|
+
/** Used for labels to link them with their inputs (using input id). */
|
|
28
|
+
htmlFor?: string;
|
|
29
|
+
|
|
30
|
+
/** Used to help React identify which items have changed, are added, or are removed within a list. */
|
|
31
|
+
key?: number | string;
|
|
32
|
+
|
|
33
|
+
/** Contains a space-separated list of the part names of the element. Part names allows CSS to select and style specific elements in a shadow tree via the ::part pseudo-element. */
|
|
34
|
+
part?: string;
|
|
35
|
+
|
|
36
|
+
/** A mutable ref object whose `.current` property is initialized to the passed argument (`initialValue`). The returned object will persist for the full lifetime of the component. */
|
|
37
|
+
ref?: any;
|
|
38
|
+
|
|
39
|
+
/** Allows developers to make HTML elements focusable, allow or prevent them from being sequentially focusable (usually with the `Tab` key, hence the name) and determine their relative ordering for sequential focus navigation. */
|
|
40
|
+
tabIndex?: number;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
* ---
|
|
46
|
+
*
|
|
47
|
+
*/
|
|
48
|
+
export const OgdsTaskList: React.ForwardRefExoticComponent<OgdsTaskListProps>;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import React, { forwardRef } from "react";
|
|
2
|
-
import "../../
|
|
3
|
-
|
|
4
|
-
export const UsaLink = forwardRef((props, forwardedRef) => {
|
|
5
|
-
const { href, ...filteredProps } = props;
|
|
2
|
+
import "../../ogds-task-list.js";
|
|
6
3
|
|
|
4
|
+
export const OgdsTaskList = forwardRef((props, forwardedRef) => {
|
|
7
5
|
return React.createElement(
|
|
8
|
-
"
|
|
6
|
+
"ogds-task-list",
|
|
9
7
|
{
|
|
10
|
-
...
|
|
11
|
-
href: props.href,
|
|
8
|
+
...props,
|
|
12
9
|
class: props.className,
|
|
13
10
|
exportparts: props.exportparts,
|
|
14
11
|
for: props.htmlFor,
|
|
@@ -1 +1,15 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../index-CC1QRihN.cjs"),s=require("lit"),g=require("lit/decorators.js"),k=s.css`@layer ogds.components{.ogds-accordion,ogds-accordion{--ogds-accordion-border:.25rem solid var(--ogds-theme-color-base-lightest);--ogds-accordion-content-padding:1rem 1.25rem .75rem ;--ogds-accordion-icon-closed:var(--icon-chevron-pointing-down);--ogds-accordion-icon-open:var(--icon-chevron-pointing-up)}:is(.ogds-accordion,ogds-accordion).plus{--ogds-accordion-icon-closed:var(--icon-plus);--ogds-accordion-icon-open:var(--icon-minus)}.ogds-accordion,ogds-accordion{--accordion-icon:var(--ogds-accordion-icon-closed)}:is(.ogds-accordion,ogds-accordion) details{color:var(--ogds-theme-color-base-ink);margin-block:.5rem}:is(.ogds-accordion,ogds-accordion) details[open]{--accordion-icon:var(--ogds-accordion-icon-open)}:is(.ogds-accordion,ogds-accordion) summary{background-color:var(--ogds-theme-color-base-lightest);padding:1rem 1.25rem;font-weight:700}:is(.ogds-accordion,ogds-accordion) summary:hover{background-color:var(--ogds-color-gray-10)}:is(.ogds-accordion,ogds-accordion) summary:focus{outline:.25rem solid #2491ff}:is(.ogds-accordion,ogds-accordion).with-icon summary{align-items:center;display:flex}:is(.ogds-accordion,ogds-accordion).with-icon summary::marker{display:none}:is(.ogds-accordion,ogds-accordion).with-icon summary::-webkit-details-marker{display:none}:is(.ogds-accordion,ogds-accordion).with-icon summary:before{content:\"\";height:1.25rem;-webkit-mask-image:var(--accordion-icon);mask-image:var(--accordion-icon);background-color:currentColor;flex-shrink:0;width:1.5rem;display:block;-webkit-mask-position:50%;mask-position:50%;-webkit-mask-size:contain;mask-size:contain;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}:is(.ogds-accordion,ogds-accordion).with-icon.right summary:before{order:2;margin-inline-start:auto}@supports selector(::details-content){:is(.ogds-accordion,ogds-accordion) details[open]::details-content{padding:var(--ogds-accordion-content-padding)}:is(.ogds-accordion,ogds-accordion).bordered details[open]::details-content{border-block-end:var(--ogds-accordion-border);border-inline-end:var(--ogds-accordion-border);border-inline-start:var(--ogds-accordion-border)}}@supports not selector(::details-content){:is(.ogds-accordion,ogds-accordion) .details-content{padding:var(--ogds-accordion-content-padding)}:is(.ogds-accordion,ogds-accordion).bordered .details-content{border-block-end:var(--ogds-accordion-border);border-inline-end:var(--ogds-accordion-border);border-inline-start:var(--ogds-accordion-border)}}}`,S="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%2013h-6v6h-2v-6H5v-2h6V5h2v6h6v2z'/%3e%3c/svg%3e",w="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%2013H5v-2h14v2z'/%3e%3c/svg%3e",x=s.css`:root,:host{--ogds-font-family-system:-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";--ogds-font-family-georgia:Georgia, Cambria, \"Times New Roman\", Times, serif;--ogds-font-family-helvetica:\"Helvetica Neue\", Helvetica, Roboto, Arial, sans-serif;--ogds-font-family-monospace:\"Bitstream Vera Sans Mono\", \"Consolas\", \"Courier\", monospace;--ogds-font-size-1:.75rem;--ogds-font-size-2:.8125rem;--ogds-font-size-3:.875rem;--ogds-font-size-4:.9375rem;--ogds-font-size-5:1rem;--ogds-font-size-6:1.0625rem;--ogds-font-size-7:1.125rem;--ogds-font-size-8:1.25rem;--ogds-font-size-9:1.375rem;--ogds-font-size-10:1.5rem;--ogds-font-size-11:1.75rem;--ogds-font-size-12:2rem;--ogds-font-size-13:2.25rem;--ogds-font-size-14:2.5rem;--ogds-font-size-15:3rem;--ogds-font-size-16:3.5rem;--ogds-font-size-17:4rem;--ogds-font-size-18:5rem;--ogds-font-size-19:7.5rem;--ogds-font-size-20:8.75rem;--ogds-font-size-micro:.625rem;--ogds-line-height-1:1;--ogds-line-height-2:1.2;--ogds-line-height-3:1.35;--ogds-line-height-4:1.5;--ogds-line-height-5:1.62;--ogds-line-height-6:1.75;--ogds-measure-smaller:44ex;--ogds-measure-small:60ex;--ogds-measure-base:64ex;--ogds-measure-large:68ex;--ogds-measure-larger:72ex;--ogds-measure-largest:88ex}`,z=s.css`:root,:host{--ogds-theme-color-base-lightest:#f0f0f0;--ogds-theme-color-base-lighter:#dfe1e2;--ogds-theme-color-base-light:#a9aeb1;--ogds-theme-color-base:#71767a;--ogds-theme-color-base-dark:#565c65;--ogds-theme-color-base-darker:#3d4551;--ogds-theme-color-base-darkest:#1b1b1b;--ogds-theme-color-base-ink:#1b1b1b;--ogds-theme-color-primary-lighter:#d9e8f6;--ogds-theme-color-primary-light:#73b3e7;--ogds-theme-color-primary:#005ea2;--ogds-theme-color-primary-vivid:#0050d8;--ogds-theme-color-primary-dark:#1a4480;--ogds-theme-color-primary-darker:#162e51;--ogds-theme-color-secondary-lighter:#f3e1e4;--ogds-theme-color-secondary-light:#f2938c;--ogds-theme-color-secondary:#d83933;--ogds-theme-color-secondary-vivid:#e41d3d;--ogds-theme-color-secondary-dark:#b50909;--ogds-theme-color-secondary-darker:#8b0a03;--ogds-theme-color-accent-warm-lighter:#f2e4d4;--ogds-theme-color-accent-warm-light:#ffbc78;--ogds-theme-color-accent-warm:#fa9441;--ogds-theme-color-accent-warm-dark:#c05600;--ogds-theme-color-accent-warm-darker:#775540;--ogds-theme-color-accent-cool-lighter:#e1f3f8;--ogds-theme-color-accent-cool-light:#97d4ea;--ogds-theme-color-accent-cool:#00bde3;--ogds-theme-color-accent-cool-dark:#28a0cb;--ogds-theme-color-accent-cool-darker:#07648d;--ogds-theme-color-error-lighter:#f4e3db;--ogds-theme-color-error-light:#f39268;--ogds-theme-color-error:#d54309;--ogds-theme-color-error-dark:#b50909;--ogds-theme-color-error-darker:#6f3331;--ogds-theme-color-warning-lighter:#faf3d1;--ogds-theme-color-warning-light:#fee685;--ogds-theme-color-warning:#ffbe2e;--ogds-theme-color-warning-dark:#e5a000;--ogds-theme-color-warning-darker:#936f38;--ogds-theme-color-success-lighter:#ecf3ec;--ogds-theme-color-success-light:#70e17b;--ogds-theme-color-success:#00a91c;--ogds-theme-color-success-dark:#008817;--ogds-theme-color-success-darker:#216e1f;--ogds-theme-color-info-lighter:#e7f6f8;--ogds-theme-color-info-light:#99deea;--ogds-theme-color-info:#00bde3;--ogds-theme-color-info-dark:#009ec1;--ogds-theme-color-info-darker:#2e6276;--ogds-theme-color-disabled-lighter:#c9c9c9;--ogds-theme-color-disabled-light:#919191;--ogds-theme-color-disabled:#757575;--ogds-theme-color-disabled-dark:#454545;--ogds-theme-color-disabled-darker:#1b1b1b;--ogds-theme-color-emergency:#9c3d10;--ogds-theme-color-emergency-dark:#332d29;--ogds-theme-body-background-color:#fff;--ogds-theme-text-color:#1b1b1b;--ogds-theme-text-reverse-color:#fff;--ogds-theme-link-color:#005ea2;--ogds-theme-link-visited-color:#54278f;--ogds-theme-link-hover-color:#1a4480;--ogds-theme-link-active-color:#162e51;--ogds-theme-link-reverse-color:#dfe1e2;--ogds-theme-link-reverse-hover-color:#f0f0f0;--ogds-theme-link-reverse-active-color:#fff;--ogds-theme-focus-color:#2491ff}`,C=s.css`:root,:host{--ogds-theme-button-border-radius:.25rem;--ogds-theme-button-fill-color:#005ea2;--ogds-theme-button-font-family:-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";--ogds-theme-button-icon-gap:.5rem;--ogds-theme-button-small-width:3rem;--ogds-theme-button-stroke-color:#005ea2;--ogds-theme-button-stroke-width:2px;--ogds-theme-button-text-color:#fff}`,A=s.css`:root,:host{--ogds-theme-border-radius-sm:2px;--ogds-theme-border-radius-md:.25rem;--ogds-theme-border-radius-lg:.5rem;--ogds-theme-column-gap-sm:2px;--ogds-theme-column-gap-md:1rem;--ogds-theme-column-gap-lg:1.5rem;--ogds-theme-column-gap-mobile:1rem;--ogds-theme-column-gap-desktop:2rem;--ogds-theme-grid-container-max-width:64rem;--ogds-theme-site-margins-breakpoint:64rem;--ogds-theme-site-margins-width:2rem;--ogds-theme-site-margins-mobile-width:1rem}`,E=s.css`:root,:host{--ogds-theme-type-scale-3xs:.8125rem;--ogds-theme-type-scale-2xs:.875rem;--ogds-theme-type-scale-xs:.9375rem;--ogds-theme-type-scale-sm:1rem;--ogds-theme-type-scale-md:1.0625rem;--ogds-theme-type-scale-lg:1.375rem;--ogds-theme-type-scale-xl:2rem;--ogds-theme-type-scale-2xl:2.5rem;--ogds-theme-type-scale-3xl:3rem;--ogds-theme-body-font-size:1rem;--ogds-theme-body-line-height:1.62;--ogds-theme-heading-line-height:1.2;--ogds-theme-display-font-size:3rem;--ogds-theme-h1-font-size:2.5rem;--ogds-theme-h2-font-size:2rem;--ogds-theme-h3-font-size:1.375rem;--ogds-theme-h4-font-size:1rem;--ogds-theme-h5-font-size:.9375rem;--ogds-theme-h6-font-size:.8125rem;--ogds-theme-lead-font-size:1.375rem;--ogds-theme-lead-line-height:1.75}`,m=new CSSStyleSheet;m.replaceSync([a.colorTokens,a.spacingTokens,x,z,C,A,E].map(i=>i.cssText).join(`
|
|
2
|
+
`));function u(){document.adoptedStyleSheets.includes(m)||(document.adoptedStyleSheets=[...document.adoptedStyleSheets,m])}var _=Object.defineProperty,f=(i,e,t,n)=>{for(var o=void 0,c=i.length-1,l;c>=0;c--)(l=i[c])&&(o=l(e,t,o)||o);return o&&_(e,t,o),o},r;const h=(r=class extends s.LitElement{constructor(){super(...arguments),this.useListSemantics=!1,this.headingLevel=0}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),u(),r._sheet||(r._sheet=new CSSStyleSheet,r._sheet.replaceSync(`ogds-accordion, .ogds-accordion {
|
|
3
|
+
--icon-chevron-pointing-down: url("${a.iconChevronDown}");
|
|
4
|
+
--icon-chevron-pointing-up: url("${a.iconChevronUp}");
|
|
5
|
+
--icon-plus: url("${S}");
|
|
6
|
+
--icon-minus: url("${w}");
|
|
7
|
+
}
|
|
8
|
+
`+k.cssText),document.adoptedStyleSheets=[...document.adoptedStyleSheets,r._sheet]),this.detailsChildren=this.getDetailsChildren(),this.childRoles=new Map(Array.from(this.detailsChildren??[]).map(e=>[e,new Set]))}firstUpdated(){if(this.useListSemantics&&this.headingLevel!==0){console.warn("<ogds-accordion>: use-list-semantics and heading-level are mutually exclusive. Screen readers cannot reliably announce both list position and heading level on the same element. Remove one attribute.");return}this.addListSemantics(),this.addHeadingSemantics(),this.applyChildRoles()}getDetailsChildren(){const e=this.getElementsByTagName("details");if(e.length>0)return e;console.error("<ogds-accordion>: This component expects to have at least one details element as a child")}addListSemantics(){this.useListSemantics&&this.detailsChildren&&(Array.from(this.detailsChildren).forEach(e=>this.childRoles.get(e)?.add("listitem")),this.setAttribute("role","list"))}addHeadingSemantics(){const e=this.headingLevel;e!==0&&this.detailsChildren&&Array.from(this.detailsChildren).forEach(t=>{const n=t.querySelector("summary");n&&(n.setAttribute("role","heading"),n.setAttribute("aria-level",String(e)))})}applyChildRoles(){this.childRoles.forEach((e,t)=>{e.size>0&&t.setAttribute("role",Array.from(e).join(" "))})}render(){return s.nothing}},r._sheet=null,r);f([g.property({type:Boolean,attribute:"use-list-semantics"})],h.prototype,"useListSemantics");f([g.property({type:Number,attribute:"heading-level"})],h.prototype,"headingLevel");let b=h;a.defineCustomElement("ogds-accordion",b);const O=s.css`@layer ogds.components{ogds-accordion-toggle::part(button){appearance:none;background-color:var(--ogds-theme-button-fill-color);border-radius:var(--ogds-theme-button-border-radius);border-color:#0000;border-width:var(--ogds-theme-button-stroke-width);color:var(--ogds-theme-button-text-color);cursor:pointer;font-family:var(--ogds-theme-button-font-family);font-size:var(--ogds-theme-type-scale-md);padding:var(--ogds-spacing-105) var(--ogds-spacing-205);font-weight:700}ogds-accordion-toggle::part(button):hover{background-color:color-mix(in srgb,var(--ogds-theme-button-fill-color),black 20%)}ogds-accordion-toggle::part(button):focus{outline-offset:.25rem;outline:.25rem solid #2491ff}}`;var T=Object.defineProperty,y=(i,e,t,n)=>{for(var o=void 0,c=i.length-1,l;c>=0;c--)(l=i[c])&&(o=l(e,t,o)||o);return o&&T(e,t,o),o},d;const p=(d=class extends s.LitElement{constructor(){super(...arguments),this.controls="",this._anyOpen=!1,this._observer=null}connectedCallback(){if(super.connectedCallback(),u(),d._sheet||(d._sheet=new CSSStyleSheet,d._sheet.replaceSync(O.cssText),document.adoptedStyleSheets=[...document.adoptedStyleSheets,d._sheet]),this.controls==""){console.error("<ogds-accordion-toggle>: Component must have a controls attribute with the IDof an <ogds-accordion> component");return}this._anyOpen=this.checkOpen(),this._observer=new MutationObserver(()=>{this._anyOpen=this.checkOpen()});const e=document.getElementById(this.controls);e&&this._observer.observe(e,{subtree:!0,attributeFilter:["open"]})}disconnectedCallback(){super.disconnectedCallback(),this._observer?.disconnect(),this._observer=null}checkOpen(){return!!document.getElementById(this.controls)?.querySelector("details[open]")}toggleAll(){const e=document.getElementById(this.controls);if(!e){console.error("<ogds-accordion-toggle>: Unable to get an accordion component with the ID specfied in the controls attribute");return}const t=Array.from(e.getElementsByTagName("details")),n=t.some(o=>o.hasAttribute("open"));n?t.forEach(o=>o.toggleAttribute("open",!1)):t.forEach(o=>o.toggleAttribute("open",!0)),this._anyOpen=!n}render(){return s.html`
|
|
9
|
+
<button @click="${this.toggleAll}" part="button">
|
|
10
|
+
<slot name="expand-label" ?hidden="${this._anyOpen}">Expand All</slot>
|
|
11
|
+
<slot name="collapse-label" ?hidden="${!this._anyOpen}"
|
|
12
|
+
>Collapse All</slot
|
|
13
|
+
>
|
|
14
|
+
</button>
|
|
15
|
+
`}},d._sheet=null,d);y([g.property({type:String,attribute:"controls"})],p.prototype,"controls");y([g.state()],p.prototype,"_anyOpen");let v=p;a.defineCustomElement("ogds-accordion-toggle",v);exports.OgdsBanner=a.OgdsBanner;exports.OgdsAccordion=b;exports.OgdsAccordionToggle=v;
|