@statistikzh/leu 0.14.4 → 0.15.0
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/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +8 -0
- package/dist/Accordion.js +2 -30
- package/dist/Button.d.ts +56 -68
- package/dist/Button.js +74 -52
- package/dist/ButtonGroup.d.ts +9 -9
- package/dist/ButtonGroup.js +30 -20
- package/dist/ChartWrapper.d.ts +38 -0
- package/dist/ChartWrapper.js +153 -0
- package/dist/Checkbox.d.ts +6 -21
- package/dist/Checkbox.js +17 -9
- package/dist/CheckboxGroup.d.ts +13 -14
- package/dist/CheckboxGroup.js +18 -11
- package/dist/Chip.js +1 -1
- package/dist/ChipGroup.js +1 -1
- package/dist/ChipLink.js +1 -1
- package/dist/ChipRemovable.js +1 -1
- package/dist/ChipSelectable.js +1 -1
- package/dist/Dialog.js +1 -1
- package/dist/Dropdown.js +3 -1
- package/dist/Icon.js +1 -1
- package/dist/Input.js +1 -1
- package/dist/{LeuElement-x8UlIDDl.js → LeuElement-BhAmogDy.js} +1 -1
- package/dist/Menu.js +1 -1
- package/dist/MenuItem.js +1 -1
- package/dist/Pagination.d.ts +40 -28
- package/dist/Pagination.js +39 -14
- package/dist/Placeholder.d.ts +27 -0
- package/dist/Placeholder.js +90 -0
- package/dist/Popup.js +1 -1
- package/dist/Radio.d.ts +6 -21
- package/dist/Radio.js +17 -9
- package/dist/RadioGroup.d.ts +28 -23
- package/dist/RadioGroup.js +29 -16
- package/dist/Range.js +1 -1
- package/dist/ScrollTop.d.ts +0 -1
- package/dist/ScrollTop.js +3 -1
- package/dist/Select.js +3 -1
- package/dist/Spinner.js +1 -1
- package/dist/Table.d.ts +0 -1
- package/dist/Table.js +3 -1
- package/dist/VisuallyHidden.js +1 -1
- package/dist/_tslib-CNEFicEt.js +30 -0
- package/dist/components/button/Button.d.ts +55 -67
- package/dist/components/button/Button.d.ts.map +1 -1
- package/dist/components/button/stories/button.stories.d.ts.map +1 -1
- package/dist/components/button-group/ButtonGroup.d.ts +9 -9
- package/dist/components/button-group/ButtonGroup.d.ts.map +1 -1
- package/dist/components/checkbox/Checkbox.d.ts +6 -21
- package/dist/components/checkbox/Checkbox.d.ts.map +1 -1
- package/dist/components/checkbox/CheckboxGroup.d.ts +13 -14
- package/dist/components/checkbox/CheckboxGroup.d.ts.map +1 -1
- package/dist/components/icon/stories/icon.stories.d.ts +10 -0
- package/dist/components/icon/stories/icon.stories.d.ts.map +1 -1
- package/dist/components/pagination/Pagination.d.ts +40 -27
- package/dist/components/pagination/Pagination.d.ts.map +1 -1
- package/dist/components/pagination/stories/pagination.stories.d.ts +10 -2
- package/dist/components/pagination/stories/pagination.stories.d.ts.map +1 -1
- package/dist/components/placeholder/Placeholder.d.ts +23 -0
- package/dist/components/placeholder/Placeholder.d.ts.map +1 -0
- package/dist/components/placeholder/leu-placeholder.d.ts +3 -0
- package/dist/components/placeholder/leu-placeholder.d.ts.map +1 -0
- package/dist/components/placeholder/stories/placeholder.stories.d.ts +27 -0
- package/dist/components/placeholder/stories/placeholder.stories.d.ts.map +1 -0
- package/dist/components/placeholder/test/placeholder.test.d.ts +2 -0
- package/dist/components/placeholder/test/placeholder.test.d.ts.map +1 -0
- package/dist/components/radio/Radio.d.ts +6 -21
- package/dist/components/radio/Radio.d.ts.map +1 -1
- package/dist/components/radio/RadioGroup.d.ts +28 -23
- package/dist/components/radio/RadioGroup.d.ts.map +1 -1
- package/dist/components/visualization/ChartWrapper.d.ts +34 -0
- package/dist/components/visualization/ChartWrapper.d.ts.map +1 -0
- package/dist/components/visualization/leu-chart-wrapper.d.ts +3 -0
- package/dist/components/visualization/leu-chart-wrapper.d.ts.map +1 -0
- package/dist/components/visualization/stories/chart-wrapper.stories.d.ts +28 -0
- package/dist/components/visualization/stories/chart-wrapper.stories.d.ts.map +1 -0
- package/dist/components/visualization/test/chart-wrapper.test.d.ts +2 -0
- package/dist/components/visualization/test/chart-wrapper.test.d.ts.map +1 -0
- package/dist/index.js +3 -2
- package/dist/leu-accordion.js +2 -1
- package/dist/leu-button-group.js +8 -1
- package/dist/leu-button.d.ts +0 -1
- package/dist/leu-button.js +3 -1
- package/dist/leu-chart-wrapper.d.ts +6 -0
- package/dist/leu-chart-wrapper.js +11 -0
- package/dist/leu-checkbox-group.js +5 -1
- package/dist/leu-checkbox.js +3 -1
- package/dist/leu-chip-group.js +1 -1
- package/dist/leu-chip-link.js +1 -1
- package/dist/leu-chip-removable.js +1 -1
- package/dist/leu-chip-selectable.js +1 -1
- package/dist/leu-dialog.js +1 -1
- package/dist/leu-dropdown.js +3 -1
- package/dist/leu-icon.js +1 -1
- package/dist/leu-input.js +1 -1
- package/dist/leu-menu-item.js +1 -1
- package/dist/leu-menu.js +1 -1
- package/dist/leu-pagination.d.ts +0 -1
- package/dist/leu-pagination.js +3 -1
- package/dist/leu-placeholder.d.ts +4 -0
- package/dist/leu-placeholder.js +7 -0
- package/dist/leu-popup.js +1 -1
- package/dist/leu-radio-group.js +4 -1
- package/dist/leu-radio.js +3 -1
- package/dist/leu-range.js +1 -1
- package/dist/leu-scroll-top.d.ts +0 -1
- package/dist/leu-scroll-top.js +3 -1
- package/dist/leu-select.js +3 -1
- package/dist/leu-spinner.js +1 -1
- package/dist/leu-table.d.ts +0 -1
- package/dist/leu-table.js +3 -1
- package/dist/leu-visually-hidden.js +1 -1
- package/dist/lib/a11y.d.ts +2 -2
- package/dist/vscode.html-custom-data.json +92 -22
- package/dist/vue/index.d.ts +78 -38
- package/dist/web-types.json +208 -66
- package/package.json +1 -1
- package/release-please-config.json +0 -2
- package/scripts/generate-component/templates/stories/[name].stories.ts +17 -4
- package/src/components/button/Button.ts +95 -79
- package/src/components/button/stories/button.stories.ts +5 -6
- package/src/components/button-group/ButtonGroup.ts +18 -13
- package/src/components/checkbox/Checkbox.ts +13 -15
- package/src/components/checkbox/CheckboxGroup.ts +20 -16
- package/src/components/icon/stories/icon.stories.ts +27 -0
- package/src/components/pagination/Pagination.ts +45 -32
- package/src/components/pagination/stories/pagination.stories.ts +28 -17
- package/src/components/placeholder/Placeholder.ts +33 -0
- package/src/components/placeholder/leu-placeholder.ts +5 -0
- package/src/components/placeholder/placeholder.css +59 -0
- package/src/components/placeholder/stories/placeholder.stories.ts +34 -0
- package/src/components/placeholder/test/placeholder.test.ts +31 -0
- package/src/components/radio/Radio.ts +13 -15
- package/src/components/radio/RadioGroup.ts +42 -28
- package/src/components/visualization/ChartWrapper.ts +75 -0
- package/src/components/visualization/chart-wrapper.css +78 -0
- package/src/components/visualization/leu-chart-wrapper.ts +5 -0
- package/src/components/visualization/stories/chart-wrapper.stories.ts +52 -0
- package/src/components/visualization/test/chart-wrapper.test.ts +74 -0
- package/src/lib/a11y.ts +2 -2
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { html } from "lit"
|
|
2
|
+
import { fixture, expect } from "@open-wc/testing"
|
|
3
|
+
|
|
4
|
+
import "../leu-chart-wrapper.js"
|
|
5
|
+
|
|
6
|
+
async function defaultFixture({ pending = false } = {}) {
|
|
7
|
+
return fixture(
|
|
8
|
+
html`<leu-chart-wrapper ?pending=${pending}>
|
|
9
|
+
<h2 slot="title">Entwicklung der Leerwohnungsziffer seit 1984</h2>
|
|
10
|
+
<span slot="description">Leerwohnungsziffer, in Prozent</span>
|
|
11
|
+
<img
|
|
12
|
+
style="display: block; width: 100%; height: auto;"
|
|
13
|
+
slot="chart"
|
|
14
|
+
src="https://placehold.co/1200x400"
|
|
15
|
+
alt="A placeholder to indicate where a chart would appear"
|
|
16
|
+
/>
|
|
17
|
+
<span slot="caption">Quelle: Statistisches Amt des Kantons Zürich</span>
|
|
18
|
+
<leu-dropdown slot="download" label="Download">
|
|
19
|
+
<leu-icon name="download" slot="icon"></leu-icon>
|
|
20
|
+
<leu-menu>
|
|
21
|
+
<leu-menu-item
|
|
22
|
+
href="https://www.web.statistik.zh.ch/ogd/daten/ressourcen/KTZH_00001120_00002165.csv"
|
|
23
|
+
>OGD Ressource</leu-menu-item
|
|
24
|
+
>
|
|
25
|
+
<leu-menu-item>Als CSV Tabelle</leu-menu-item>
|
|
26
|
+
<leu-menu-item>Als XLS Tabelle</leu-menu-item>
|
|
27
|
+
<hr />
|
|
28
|
+
<leu-menu-item>Als PNG exportieren</leu-menu-item>
|
|
29
|
+
<leu-menu-item>Als SVG exportieren</leu-menu-item>
|
|
30
|
+
<leu-menu-item disabled>Als PDF exportieren</leu-menu-item>
|
|
31
|
+
</leu-menu>
|
|
32
|
+
</leu-dropdown>
|
|
33
|
+
</leu-chart-wrapper>`,
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
describe("LeuChartWrapper", () => {
|
|
38
|
+
it("is a defined element", async () => {
|
|
39
|
+
const el = await customElements.get("leu-chart-wrapper")
|
|
40
|
+
|
|
41
|
+
await expect(el).not.to.be.undefined
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
it("passes the a11y audit", async () => {
|
|
45
|
+
const el = await defaultFixture()
|
|
46
|
+
|
|
47
|
+
await expect(el).shadowDom.to.be.accessible()
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
it("conditionally renders slots", async () => {
|
|
51
|
+
let el = await defaultFixture()
|
|
52
|
+
|
|
53
|
+
expect(el.shadowRoot.querySelector(".description")).to.exist
|
|
54
|
+
expect(el.shadowRoot.querySelector(".caption")).to.exist
|
|
55
|
+
expect(el.shadowRoot.querySelector(".download")).to.exist
|
|
56
|
+
|
|
57
|
+
el = await fixture(html`<leu-chart-wrapper></leu-chart-wrapper>`)
|
|
58
|
+
|
|
59
|
+
expect(el.shadowRoot.querySelector(".description")).not.to.exist
|
|
60
|
+
expect(el.shadowRoot.querySelector(".caption")).not.to.exist
|
|
61
|
+
expect(el.shadowRoot.querySelector(".download")).not.to.exist
|
|
62
|
+
|
|
63
|
+
// Check that the title and chart slots are always present
|
|
64
|
+
expect(el.shadowRoot.querySelector(".title")).to.exist
|
|
65
|
+
expect(el.shadowRoot.querySelector(".chart")).to.exist
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
it("shows a spinner when pending is set", async () => {
|
|
69
|
+
const el = await defaultFixture({ pending: true })
|
|
70
|
+
|
|
71
|
+
expect(el.shadowRoot.querySelector(".spinner-container")).to.exist
|
|
72
|
+
expect(el.shadowRoot.querySelector("leu-spinner.spinner")).to.exist
|
|
73
|
+
})
|
|
74
|
+
})
|
package/src/lib/a11y.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* All roles that are associated with a aria-checked attribute
|
|
3
|
-
* @
|
|
3
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-checked
|
|
4
4
|
*/
|
|
5
5
|
export const ARIA_CHECKED_ROLES = [
|
|
6
6
|
"checkbox",
|
|
@@ -13,7 +13,7 @@ export const ARIA_CHECKED_ROLES = [
|
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* All roles that are associated with a aria-selected attribute
|
|
16
|
-
* @
|
|
16
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-selected
|
|
17
17
|
*/
|
|
18
18
|
export const ARIA_SELECTED_ROLES = [
|
|
19
19
|
"gridcell",
|