@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.
- package/README.md +28 -96
- package/dist/components/frameworks/react/OGDSAlert.d.ts +61 -0
- 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/{UsaHeader.d.ts → OgdsTaskList.d.ts} +4 -4
- package/dist/components/frameworks/react/{UsaHeader.js → OgdsTaskList.js} +3 -3
- package/dist/components/frameworks/react/index.d.ts +2 -1
- package/dist/components/frameworks/react/index.js +2 -1
- package/dist/components/index.cjs +14 -7
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.ts +2 -1
- package/dist/components/index.js +112 -45
- package/dist/components/index.js.map +1 -1
- package/dist/components/ogds-accordion-toggle/index.d.ts +7 -4
- 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/ogds-banner/index.d.ts +1 -1
- package/dist/components/ogds-banner.cjs +1 -1
- package/dist/components/ogds-banner.js +1 -1
- package/dist/components/task-list/index.d.ts +21 -0
- package/dist/{index-DTiLuJoA.cjs → index-CC1QRihN.cjs} +2 -2
- package/dist/index-CC1QRihN.cjs.map +1 -0
- package/dist/{index-Bl2KLDbH.js → index-DDf2o6Dk.js} +6 -6
- package/dist/index-DDf2o6Dk.js.map +1 -0
- package/dist/types/custom-element-jsx.d.ts +35 -4
- package/dist/types/custom-element-solidjs.d.ts +39 -4
- package/dist/types/custom-element-svelte.d.ts +35 -4
- package/dist/types/custom-element-vuejs.d.ts +35 -4
- package/package.json +36 -21
- package/src/Globals.d.ts +3 -0
- package/src/components/index.ts +2 -1
- 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/ogds-banner/index.ts +6 -6
- package/src/components/ogds-banner/ogds-banner.spec.ts +1 -1
- 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/storybook/contributing.mdx +1 -110
- package/storybook/readme.mdx +1 -1
- package/dist/components/usa-header/index.d.ts +0 -6
- package/dist/index-Bl2KLDbH.js.map +0 -1
- package/dist/index-DTiLuJoA.cjs.map +0 -1
- package/src/components/usa-header/index.ts +0 -49
- package/src/components/usa-header/usa-header.css +0 -1
|
@@ -20,26 +20,26 @@ const f = r`:root,:host{--ogds-color-black-transparent-5:#00000003;--ogds-color-
|
|
|
20
20
|
heading2: "websites use HTTPS",
|
|
21
21
|
text1: "A <strong>lock</strong>",
|
|
22
22
|
text2: "or <strong>https://</strong> means you’ve safely connected to the",
|
|
23
|
-
text3: "website. Share sensitive information only on official, secure websites."
|
|
23
|
+
text3: " website. Share sensitive information only on official, secure websites."
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
es: {
|
|
27
27
|
banner: {
|
|
28
|
-
label: "Un sitio oficial del
|
|
29
|
-
text: "Un sitio oficial del
|
|
28
|
+
label: "Un sitio oficial del gobierno de Estados Unidos",
|
|
29
|
+
text: "Un sitio oficial del gobierno de Estados Unidos",
|
|
30
30
|
action: "Así es como usted puede verificarlo"
|
|
31
31
|
},
|
|
32
32
|
domain: {
|
|
33
33
|
heading: "Los sitios web oficiales usan",
|
|
34
34
|
text1: "Un sitio web",
|
|
35
|
-
text2: "pertenece a una organización oficial del
|
|
35
|
+
text2: "pertenece a una organización oficial del gobierno de Estados Unidos."
|
|
36
36
|
},
|
|
37
37
|
https: {
|
|
38
38
|
heading1: "Los sitios web seguros",
|
|
39
39
|
heading2: "usan HTTPS",
|
|
40
40
|
text1: "Un <strong>candado</strong>",
|
|
41
41
|
text2: "o <strong>https://</strong> significa que usted se conectó de forma segura a un sitio web",
|
|
42
|
-
text3: "Comparta información sensible
|
|
42
|
+
text3: ". Comparta información sensible solo en sitios web oficiales y seguros."
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
}, c = class c extends t {
|
|
@@ -97,7 +97,7 @@ const f = r`:root,:host{--ogds-color-black-transparent-5:#00000003;--ogds-color-
|
|
|
97
97
|
><br />
|
|
98
98
|
<slot name="https-text">
|
|
99
99
|
${l(e.text1)} (${this.lockIcon()})
|
|
100
|
-
${l(e.text2)} .${o}
|
|
100
|
+
${l(e.text2)} .${o}${e.text3}
|
|
101
101
|
</slot>
|
|
102
102
|
</p>
|
|
103
103
|
</div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-DDf2o6Dk.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 solo 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":"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","x_google_ignoreList":[0,1,2]}
|
|
@@ -74,10 +74,17 @@ export type OgdsAccordionProps = {
|
|
|
74
74
|
export type OgdsAccordionToggleProps = {
|
|
75
75
|
/** The `id` of the `<ogds-accordion>` to control. Required. */
|
|
76
76
|
controls?: string;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export type OGDSAlertProps = {
|
|
80
|
+
/** The type of alert (info, warning, etc) */
|
|
81
|
+
type?: string;
|
|
82
|
+
/** Use this attribute to hide the icon */
|
|
83
|
+
noIcon?: string;
|
|
84
|
+
/** */
|
|
85
|
+
"no-icon"?: boolean;
|
|
86
|
+
/** */
|
|
87
|
+
_headingNodes?: Node[];
|
|
81
88
|
};
|
|
82
89
|
|
|
83
90
|
export type OgdsBannerProps = {
|
|
@@ -93,6 +100,8 @@ export type OgdsBannerProps = {
|
|
|
93
100
|
isOpen?: boolean;
|
|
94
101
|
};
|
|
95
102
|
|
|
103
|
+
export type OgdsTaskListProps = {};
|
|
104
|
+
|
|
96
105
|
export type CustomElements = {
|
|
97
106
|
/**
|
|
98
107
|
* The ogds-accordion component.
|
|
@@ -121,11 +130,26 @@ export type CustomElements = {
|
|
|
121
130
|
* ---
|
|
122
131
|
*
|
|
123
132
|
*
|
|
133
|
+
* ### **Slots:**
|
|
134
|
+
* - **expand-label** - Button label when all panels are collapsed. Defaults to "Expand All".
|
|
135
|
+
* - **collapse-label** - Button label when one or more panels are open. Defaults to "Collapse All".
|
|
136
|
+
*
|
|
124
137
|
* ### **CSS Parts:**
|
|
125
138
|
* - **button** - The toggle button.
|
|
126
139
|
*/
|
|
127
140
|
"ogds-accordion-toggle": Partial<OgdsAccordionToggleProps & BaseProps & BaseEvents>;
|
|
128
141
|
|
|
142
|
+
/**
|
|
143
|
+
* The ogds-alert component.
|
|
144
|
+
* ---
|
|
145
|
+
*
|
|
146
|
+
*
|
|
147
|
+
* ### **Slots:**
|
|
148
|
+
* - **heading** - Text for the heading. Make sure to specify the correct heading level (h2, h3, etc)
|
|
149
|
+
* - **body** - Body content for the alert. Can contain HTML (links, etc).
|
|
150
|
+
*/
|
|
151
|
+
"ogds-alert": Partial<OGDSAlertProps & BaseProps & BaseEvents>;
|
|
152
|
+
|
|
129
153
|
/**
|
|
130
154
|
* The ogds-banner component.
|
|
131
155
|
* ---
|
|
@@ -151,4 +175,11 @@ export type CustomElements = {
|
|
|
151
175
|
* - **--ogds-banner-text-color** - Sets the default text color. _(default: undefined)_
|
|
152
176
|
*/
|
|
153
177
|
"ogds-banner": Partial<OgdsBannerProps & BaseProps & BaseEvents>;
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
*
|
|
181
|
+
* ---
|
|
182
|
+
*
|
|
183
|
+
*/
|
|
184
|
+
"ogds-task-list": Partial<OgdsTaskListProps & BaseProps & BaseEvents>;
|
|
154
185
|
};
|
|
@@ -78,14 +78,23 @@ type OgdsAccordionProps = {
|
|
|
78
78
|
type OgdsAccordionToggleProps = {
|
|
79
79
|
/** The `id` of the `<ogds-accordion>` to control. Required. */
|
|
80
80
|
controls?: string;
|
|
81
|
-
/** Button label when all panels are collapsed. Defaults to "Expand All". */
|
|
82
|
-
"expand-label"?: string;
|
|
83
|
-
/** Button label when one or more panels are open. Defaults to "Collapse All". */
|
|
84
|
-
"collapse-label"?: string;
|
|
85
81
|
} & JSX.DirectiveFunctionAttributes<OgdsAccordionToggle> &
|
|
86
82
|
JSX.OnAttributes<OgdsAccordionToggle> &
|
|
87
83
|
JSX.OnCaptureAttributes<OgdsAccordionToggle>;
|
|
88
84
|
|
|
85
|
+
type OGDSAlertProps = {
|
|
86
|
+
/** The type of alert (info, warning, etc) */
|
|
87
|
+
type?: string;
|
|
88
|
+
/** Use this attribute to hide the icon */
|
|
89
|
+
noIcon?: string;
|
|
90
|
+
/** */
|
|
91
|
+
"no-icon"?: boolean;
|
|
92
|
+
/** */
|
|
93
|
+
"prop:_headingNodes"?: Node[];
|
|
94
|
+
} & JSX.DirectiveFunctionAttributes<OGDSAlert> &
|
|
95
|
+
JSX.OnAttributes<OGDSAlert> &
|
|
96
|
+
JSX.OnCaptureAttributes<OGDSAlert>;
|
|
97
|
+
|
|
89
98
|
type OgdsBannerProps = {
|
|
90
99
|
/** The element's language. */
|
|
91
100
|
lang?: "en" | "es";
|
|
@@ -101,6 +110,10 @@ type OgdsBannerProps = {
|
|
|
101
110
|
JSX.OnAttributes<OgdsBanner> &
|
|
102
111
|
JSX.OnCaptureAttributes<OgdsBanner>;
|
|
103
112
|
|
|
113
|
+
type OgdsTaskListProps = {} & JSX.DirectiveFunctionAttributes<OgdsTaskList> &
|
|
114
|
+
JSX.OnAttributes<OgdsTaskList> &
|
|
115
|
+
JSX.OnCaptureAttributes<OgdsTaskList>;
|
|
116
|
+
|
|
104
117
|
export type CustomElements = {
|
|
105
118
|
/**
|
|
106
119
|
* The ogds-accordion component.
|
|
@@ -129,11 +142,26 @@ export type CustomElements = {
|
|
|
129
142
|
* ---
|
|
130
143
|
*
|
|
131
144
|
*
|
|
145
|
+
* ### **Slots:**
|
|
146
|
+
* - **expand-label** - Button label when all panels are collapsed. Defaults to "Expand All".
|
|
147
|
+
* - **collapse-label** - Button label when one or more panels are open. Defaults to "Collapse All".
|
|
148
|
+
*
|
|
132
149
|
* ### **CSS Parts:**
|
|
133
150
|
* - **button** - The toggle button.
|
|
134
151
|
*/
|
|
135
152
|
"ogds-accordion-toggle": Partial<OgdsAccordionToggleProps & BaseProps & BaseEvents>;
|
|
136
153
|
|
|
154
|
+
/**
|
|
155
|
+
* The ogds-alert component.
|
|
156
|
+
* ---
|
|
157
|
+
*
|
|
158
|
+
*
|
|
159
|
+
* ### **Slots:**
|
|
160
|
+
* - **heading** - Text for the heading. Make sure to specify the correct heading level (h2, h3, etc)
|
|
161
|
+
* - **body** - Body content for the alert. Can contain HTML (links, etc).
|
|
162
|
+
*/
|
|
163
|
+
"ogds-alert": Partial<OGDSAlertProps & BaseProps & BaseEvents>;
|
|
164
|
+
|
|
137
165
|
/**
|
|
138
166
|
* The ogds-banner component.
|
|
139
167
|
* ---
|
|
@@ -159,4 +187,11 @@ export type CustomElements = {
|
|
|
159
187
|
* - **--ogds-banner-text-color** - Sets the default text color. _(default: undefined)_
|
|
160
188
|
*/
|
|
161
189
|
"ogds-banner": Partial<OgdsBannerProps & BaseProps & BaseEvents>;
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
*
|
|
193
|
+
* ---
|
|
194
|
+
*
|
|
195
|
+
*/
|
|
196
|
+
"ogds-task-list": Partial<OgdsTaskListProps & BaseProps & BaseEvents>;
|
|
162
197
|
};
|
|
@@ -51,10 +51,17 @@ type OgdsAccordionProps = {
|
|
|
51
51
|
type OgdsAccordionToggleProps = {
|
|
52
52
|
/** The `id` of the `<ogds-accordion>` to control. Required. */
|
|
53
53
|
controls?: string;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
type OGDSAlertProps = {
|
|
57
|
+
/** The type of alert (info, warning, etc) */
|
|
58
|
+
type?: string;
|
|
59
|
+
/** Use this attribute to hide the icon */
|
|
60
|
+
noIcon?: string;
|
|
61
|
+
/** */
|
|
62
|
+
"no-icon"?: boolean;
|
|
63
|
+
/** */
|
|
64
|
+
"bind:_headingNodes"?: Node[];
|
|
58
65
|
};
|
|
59
66
|
|
|
60
67
|
type OgdsBannerProps = {
|
|
@@ -70,6 +77,8 @@ type OgdsBannerProps = {
|
|
|
70
77
|
isOpen?: boolean;
|
|
71
78
|
};
|
|
72
79
|
|
|
80
|
+
type OgdsTaskListProps = {};
|
|
81
|
+
|
|
73
82
|
export type CustomElements = {
|
|
74
83
|
/**
|
|
75
84
|
* The ogds-accordion component.
|
|
@@ -98,11 +107,26 @@ export type CustomElements = {
|
|
|
98
107
|
* ---
|
|
99
108
|
*
|
|
100
109
|
*
|
|
110
|
+
* ### **Slots:**
|
|
111
|
+
* - **expand-label** - Button label when all panels are collapsed. Defaults to "Expand All".
|
|
112
|
+
* - **collapse-label** - Button label when one or more panels are open. Defaults to "Collapse All".
|
|
113
|
+
*
|
|
101
114
|
* ### **CSS Parts:**
|
|
102
115
|
* - **button** - The toggle button.
|
|
103
116
|
*/
|
|
104
117
|
"ogds-accordion-toggle": Partial<OgdsAccordionToggleProps & BaseProps & BaseEvents>;
|
|
105
118
|
|
|
119
|
+
/**
|
|
120
|
+
* The ogds-alert component.
|
|
121
|
+
* ---
|
|
122
|
+
*
|
|
123
|
+
*
|
|
124
|
+
* ### **Slots:**
|
|
125
|
+
* - **heading** - Text for the heading. Make sure to specify the correct heading level (h2, h3, etc)
|
|
126
|
+
* - **body** - Body content for the alert. Can contain HTML (links, etc).
|
|
127
|
+
*/
|
|
128
|
+
"ogds-alert": Partial<OGDSAlertProps & BaseProps & BaseEvents>;
|
|
129
|
+
|
|
106
130
|
/**
|
|
107
131
|
* The ogds-banner component.
|
|
108
132
|
* ---
|
|
@@ -128,6 +152,13 @@ export type CustomElements = {
|
|
|
128
152
|
* - **--ogds-banner-text-color** - Sets the default text color. _(default: undefined)_
|
|
129
153
|
*/
|
|
130
154
|
"ogds-banner": Partial<OgdsBannerProps & BaseProps & BaseEvents>;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
*
|
|
158
|
+
* ---
|
|
159
|
+
*
|
|
160
|
+
*/
|
|
161
|
+
"ogds-task-list": Partial<OgdsTaskListProps & BaseProps & BaseEvents>;
|
|
131
162
|
};
|
|
132
163
|
|
|
133
164
|
declare namespace svelteHTML {
|
|
@@ -14,10 +14,17 @@ type OgdsAccordionProps = {
|
|
|
14
14
|
type OgdsAccordionToggleProps = {
|
|
15
15
|
/** The `id` of the `<ogds-accordion>` to control. Required. */
|
|
16
16
|
controls?: string;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
type OGDSAlertProps = {
|
|
20
|
+
/** The type of alert (info, warning, etc) */
|
|
21
|
+
type?: string;
|
|
22
|
+
/** Use this attribute to hide the icon */
|
|
23
|
+
noIcon?: string;
|
|
24
|
+
/** */
|
|
25
|
+
"no-icon"?: boolean;
|
|
26
|
+
/** */
|
|
27
|
+
_headingNodes?: Node[];
|
|
21
28
|
};
|
|
22
29
|
|
|
23
30
|
type OgdsBannerProps = {
|
|
@@ -33,6 +40,8 @@ type OgdsBannerProps = {
|
|
|
33
40
|
isOpen?: boolean;
|
|
34
41
|
};
|
|
35
42
|
|
|
43
|
+
type OgdsTaskListProps = {};
|
|
44
|
+
|
|
36
45
|
export type CustomElements = {
|
|
37
46
|
/**
|
|
38
47
|
* The ogds-accordion component.
|
|
@@ -61,11 +70,26 @@ export type CustomElements = {
|
|
|
61
70
|
* ---
|
|
62
71
|
*
|
|
63
72
|
*
|
|
73
|
+
* ### **Slots:**
|
|
74
|
+
* - **expand-label** - Button label when all panels are collapsed. Defaults to "Expand All".
|
|
75
|
+
* - **collapse-label** - Button label when one or more panels are open. Defaults to "Collapse All".
|
|
76
|
+
*
|
|
64
77
|
* ### **CSS Parts:**
|
|
65
78
|
* - **button** - The toggle button.
|
|
66
79
|
*/
|
|
67
80
|
"ogds-accordion-toggle": DefineComponent<OgdsAccordionToggleProps>;
|
|
68
81
|
|
|
82
|
+
/**
|
|
83
|
+
* The ogds-alert component.
|
|
84
|
+
* ---
|
|
85
|
+
*
|
|
86
|
+
*
|
|
87
|
+
* ### **Slots:**
|
|
88
|
+
* - **heading** - Text for the heading. Make sure to specify the correct heading level (h2, h3, etc)
|
|
89
|
+
* - **body** - Body content for the alert. Can contain HTML (links, etc).
|
|
90
|
+
*/
|
|
91
|
+
"ogds-alert": DefineComponent<OGDSAlertProps>;
|
|
92
|
+
|
|
69
93
|
/**
|
|
70
94
|
* The ogds-banner component.
|
|
71
95
|
* ---
|
|
@@ -91,6 +115,13 @@ export type CustomElements = {
|
|
|
91
115
|
* - **--ogds-banner-text-color** - Sets the default text color. _(default: undefined)_
|
|
92
116
|
*/
|
|
93
117
|
"ogds-banner": DefineComponent<OgdsBannerProps>;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
*
|
|
121
|
+
* ---
|
|
122
|
+
*
|
|
123
|
+
*/
|
|
124
|
+
"ogds-task-list": DefineComponent<OgdsTaskListProps>;
|
|
94
125
|
};
|
|
95
126
|
|
|
96
127
|
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.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"customElements": "custom-elements.json",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -37,11 +37,16 @@
|
|
|
37
37
|
"dev": "vite --config ./config/vite.config.ts",
|
|
38
38
|
"fix-permissions": "sudo chown -R $(id -u):$(id -g) .",
|
|
39
39
|
"pages": "npm run storybook:build && cp -r storybook-static _site",
|
|
40
|
+
"playwright:install": "playwright install --with-deps",
|
|
41
|
+
"playwright:test": "playwright test --config=./config/playwright.config.ts",
|
|
42
|
+
"playwright:update-screenshots": "playwright test --config=./config/playwright.config.ts --update-snapshots",
|
|
40
43
|
"prepare": "husky",
|
|
41
|
-
"prettier:js": "
|
|
42
|
-
"prettier:js:fix": "
|
|
43
|
-
"prettier:md": "
|
|
44
|
-
"prettier:md:fix": "
|
|
44
|
+
"prettier:js": "prettier --check '**/*.{cjs,css,js,json,jsx,mjs,ts,tsx}' --config ./config/.prettierrc",
|
|
45
|
+
"prettier:js:fix": "prettier --write '**/*.{cjs,css,js,json,jsx,mjs,ts,tsx}' --config ./config/.prettierrc",
|
|
46
|
+
"prettier:md": "prettier --check '**/*.{md,mdx}' --config ./config/.prettierrc",
|
|
47
|
+
"prettier:md:fix": "prettier --write '**/*.{md,mdx}' --config ./config/.prettierrc",
|
|
48
|
+
"prettier:github": "prettier --check '.github' --config ./config/.prettierrc",
|
|
49
|
+
"prettier:github:fix": "prettier --write '.github' --config ./config/.prettierrc",
|
|
45
50
|
"start": "npm run storybook & npm run manifest:watch",
|
|
46
51
|
"storybook:build": "storybook build",
|
|
47
52
|
"storybook": "storybook dev -p 8008",
|
|
@@ -49,8 +54,8 @@
|
|
|
49
54
|
"storybook:serve": "node ./internals/scripts/serve-storybook.js",
|
|
50
55
|
"stylelint": "stylelint './src/components/**/*.{css,css.js,css.ts}' --config=./config/stylelint.config.mjs",
|
|
51
56
|
"stylelint:fix": "stylelint './src/components/**/*.{css,css.js,css.ts}' --fix --config=./config/stylelint.config.mjs",
|
|
52
|
-
"manifest:build": "
|
|
53
|
-
"manifest:watch": "
|
|
57
|
+
"manifest:build": "cem analyze --config ./config/custom-elements-manifest.config.js",
|
|
58
|
+
"manifest:watch": "cem analyze --config ./config/custom-elements-manifest.config.js --watch --dev",
|
|
54
59
|
"release": "npm run build && changeset publish",
|
|
55
60
|
"test": "vitest --config ./config/vitest.config.js",
|
|
56
61
|
"test:ci": "vitest run --config ./config/vitest.config.js",
|
|
@@ -66,42 +71,42 @@
|
|
|
66
71
|
"devDependencies": {
|
|
67
72
|
"@changesets/cli": "^2.29.8",
|
|
68
73
|
"@custom-elements-manifest/analyzer": "^0.11.0",
|
|
69
|
-
"@eslint/css": "^1.
|
|
74
|
+
"@eslint/css": "^1.2.0",
|
|
70
75
|
"@eslint/js": "^10.0.1",
|
|
71
|
-
"@playwright/test": "^1.
|
|
72
|
-
"@storybook/addon-a11y": "^10.3.
|
|
73
|
-
"@storybook/addon-docs": "^10.3.
|
|
74
|
-
"@storybook/addon-links": "^10.3.
|
|
76
|
+
"@playwright/test": "^1.60.0",
|
|
77
|
+
"@storybook/addon-a11y": "^10.3.6",
|
|
78
|
+
"@storybook/addon-docs": "^10.3.6",
|
|
79
|
+
"@storybook/addon-links": "^10.3.6",
|
|
75
80
|
"@storybook/test-runner": "^0.24.3",
|
|
76
|
-
"@storybook/web-components-vite": "^10.3.
|
|
81
|
+
"@storybook/web-components-vite": "^10.3.6",
|
|
77
82
|
"@types/express": "^5.0.6",
|
|
78
83
|
"@types/node": "^25.6.0",
|
|
79
84
|
"@types/serve-static": "^2.2.0",
|
|
80
85
|
"@vitest/eslint-plugin": "^1.6.16",
|
|
81
|
-
"@vitest/ui": "^4.
|
|
86
|
+
"@vitest/ui": "^4.1.8",
|
|
82
87
|
"@wc-toolkit/storybook-helpers": "^10.3.0",
|
|
83
88
|
"axe-playwright": "^2.2.2",
|
|
84
89
|
"browserslist": "^4.28.1",
|
|
85
|
-
"concurrently": "^
|
|
90
|
+
"concurrently": "^10.0.3",
|
|
86
91
|
"custom-element-jsx-integration": "^1.6.0",
|
|
87
92
|
"custom-element-react-wrappers": "^1.7.3",
|
|
88
93
|
"custom-element-solidjs-integration": "^1.9.0",
|
|
89
94
|
"custom-element-svelte-integration": "^1.2.0",
|
|
90
95
|
"custom-element-vuejs-integration": "^1.4.0",
|
|
91
96
|
"custom-elements-manifest": "^2.1.0",
|
|
92
|
-
"eslint": "^10.
|
|
97
|
+
"eslint": "^10.3.0",
|
|
93
98
|
"eslint-config-prettier": "^10.1.8",
|
|
94
|
-
"eslint-plugin-storybook": "10.3.
|
|
99
|
+
"eslint-plugin-storybook": "10.3.6",
|
|
95
100
|
"express": "^5.2.1",
|
|
96
101
|
"husky": "^9.1.7",
|
|
97
|
-
"jsdom": "^
|
|
102
|
+
"jsdom": "^29.1.1",
|
|
98
103
|
"lightningcss": "^1.31.1",
|
|
99
104
|
"prettier": "^3.8.3",
|
|
100
105
|
"serve-static": "^2.2.1",
|
|
101
106
|
"shadow-dom-testing-library": "^1.13.1",
|
|
102
107
|
"storybook": "^10.0.7",
|
|
103
108
|
"storybook-addon-tag-badges": "^3.1.0",
|
|
104
|
-
"stylelint": "^17.
|
|
109
|
+
"stylelint": "^17.10.0",
|
|
105
110
|
"stylelint-config-standard": "^40.0.0",
|
|
106
111
|
"stylelint-order": "^8.1.1",
|
|
107
112
|
"typescript": "^6.0.3",
|
|
@@ -110,10 +115,20 @@
|
|
|
110
115
|
"vite-plugin-dts": "^4.5.4",
|
|
111
116
|
"vite-plugin-lit-css": "^2.2.2",
|
|
112
117
|
"vitest": "^4.0.8",
|
|
113
|
-
"wait-on": "^9.0.
|
|
114
|
-
"web-vitals": "^5.
|
|
118
|
+
"wait-on": "^9.0.10",
|
|
119
|
+
"web-vitals": "^5.3.0"
|
|
115
120
|
},
|
|
116
121
|
"optionalDependencies": {
|
|
117
122
|
"@rollup/rollup-linux-x64-gnu": "^4.59.0"
|
|
123
|
+
},
|
|
124
|
+
"allowScripts": {
|
|
125
|
+
"esbuild@0.25.9": true,
|
|
126
|
+
"esbuild@0.27.3": true,
|
|
127
|
+
"@parcel/watcher@2.5.1": true,
|
|
128
|
+
"@swc/core@1.13.5": true,
|
|
129
|
+
"fsevents@2.3.3": true,
|
|
130
|
+
"fsevents@2.3.2": true,
|
|
131
|
+
"unrs-resolver@1.11.1": true,
|
|
132
|
+
"rs-module-lexer@2.6.0": true
|
|
118
133
|
}
|
|
119
134
|
}
|
package/src/Globals.d.ts
ADDED
package/src/components/index.ts
CHANGED
|
@@ -4,41 +4,41 @@ import { Meta, Title, Primary, Stories } from "@storybook/addon-docs/blocks";
|
|
|
4
4
|
|
|
5
5
|
<Title />
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
See also: [USWDS Accessibility Checklist for Accordion](https://designsystem.digital.gov/components/accordion/accessibility-tests/).
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## Default
|
|
9
|
+
Accordions show and hide sections of related content on a page. This component can be used without JavaScript (see [Fallbacks Without JavaScript](#fallbacks-without-javascript)).
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
## Differences between the OGDS Accordion and USWDS Accordion
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
- The OGDS implementation uses [the browser-native `<details>` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/details), which works even when JavaScript is not available.
|
|
14
|
+
- The OGDS implementation allows for the icon to be on the left or the right.
|
|
15
|
+
- The OGDS implementation allows for the icon itself to be customized.
|
|
16
16
|
|
|
17
|
-
##
|
|
17
|
+
## Example Accordion
|
|
18
18
|
|
|
19
|
-
<
|
|
19
|
+
<Primary />
|
|
20
20
|
|
|
21
21
|
## Guidance
|
|
22
22
|
|
|
23
23
|
### When to use the accordion component
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
**To organize related content.** Accordions can help reduce page length when there are multiple sections of content that users may not need to read in full.
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
**To let users get to relevant content faster.** Accordions keep a page focused by allowing users to choose what they read rather than having to scroll past large amounts of content.
|
|
28
28
|
|
|
29
29
|
### When to consider something else
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
**If users need most or all of the content.** If users are likely to need most of the content on a page, showing it all at once may be more helpful than hiding it behind an accordion.
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
**For critical information.** Avoid using accordions to hide important content that all users should see, as users may miss it.
|
|
34
34
|
|
|
35
35
|
### Usability guidance
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
**Use clear, descriptive labels.** The summary text should clearly describe the content within. Users should be able to decide whether to expand a section based on the label alone.
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
**Use icons to reinforce state.** Add the `with-icon` class to provide a visual indicator of open and closed state. Use `with-icon right` to align the icon to the trailing edge of the summary, or `with-icon plus` to use plus/minus icons instead of chevrons.
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
**Use `bordered` for visual separation.** Add the `bordered` class when the accordion needs stronger visual separation from surrounding content.
|
|
42
42
|
|
|
43
43
|
#### Built-in `<details>` element functionality
|
|
44
44
|
|
|
@@ -71,13 +71,20 @@ Depending on the kind of content in the accordion, you may want to add some ARIA
|
|
|
71
71
|
1. **Heading semantics.** The USWDS accordion uses heading elements inside the buttons that toggle the sections. If you want to follow this pattern, you can add a `heading-level=<Number>` attribute to the opening `<ogds-accordion>` tag, and it will automatically set the correct ARIA attributes on each of the child `<summary>` tags to set the heading at the level you tell it. As always, it is important to use the right heading level to preserve the document outline. Even if you are not using the web component version of the component, you can achieve this same effect by including a heading element inside the summary tag, though this may require a little extra CSS to keep the visual appearance consistent.
|
|
72
72
|
2. **List semantics.** If the content in the accordion makes more sense as a list, adding a `use-list-semantics` attribute to the `<ogds-accordion>` tag will add the correct ARIA.
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
## Custom Element vs CSS-Only Versions
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
### Custom Element Behavior
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
The examples on this page use the cusom element `<ogds-accordion></ogds-accordion>`. This custom element uses all light DOM (no [shadow DOM](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_shadow_DOM)). This custom element is used for styling, and it makes it easy to access the icon variations. [Custom elements](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements) have been [widely supported since 2020](https://caniuse.com/wf-autonomous-custom-elements), but do require JavaScript for some of their functionality.
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
### Fallbacks without JavaScript
|
|
81
|
+
|
|
82
|
+
If a user does not have JavaScript for any reason, this component will still generally work.
|
|
83
|
+
|
|
84
|
+
1. **Native details component.** This approach uses the browser-native `<details>` component, these can be opened in closed without JavaScript in all browsers that support this feature ([widely available since January 2020](https://caniuse.com/details)). In an even older browser, the accordions would all be open by default, so content would not be hidden.
|
|
85
|
+
2. **Styles.** As long as you have the accordion styles pulled into your application's styles, the visual styling will still work without JavaScript.
|
|
86
|
+
3. **Class-based equivalent.** You can optionally substitute `<div class="ogds-accordion">` in place of `<ogds-accordion>`. These are equivalent, and will not affect styling or behavior for this component.
|
|
87
|
+
4. **Icons.** If you are using non-default icons and you also want those to work witohut JavaScript, then you can update your project's CSS styles to point to the svg files:
|
|
81
88
|
|
|
82
89
|
```css
|
|
83
90
|
ogds-accordion,
|
|
@@ -87,4 +94,8 @@ ogds-accordion,
|
|
|
87
94
|
}
|
|
88
95
|
```
|
|
89
96
|
|
|
90
|
-
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## More Examples
|
|
100
|
+
|
|
101
|
+
<Stories />
|
|
@@ -75,3 +75,15 @@ export const WithPlusIconsBordered = {
|
|
|
75
75
|
>${items}</ogds-accordion
|
|
76
76
|
>`,
|
|
77
77
|
};
|
|
78
|
+
|
|
79
|
+
export const WithPlusIconsRight = {
|
|
80
|
+
render: () =>
|
|
81
|
+
html`<ogds-accordion class="with-icon plus right"
|
|
82
|
+
>${items}</ogds-accordion
|
|
83
|
+
>`,
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export const WithPlusIconsRightWithoutCustomElement = {
|
|
87
|
+
render: () =>
|
|
88
|
+
html`<div class="ogds-accordion with-icon plus right">${items}</div>`,
|
|
89
|
+
};
|