@statistikzh/leu 0.13.1 → 0.14.1
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/.eslintrc.json +8 -0
- package/.github/workflows/ci.yml +78 -0
- package/.github/workflows/deploy-github-pages.yaml +2 -1
- package/.github/workflows/release-please.yml +2 -1
- package/.nvmrc +1 -0
- package/.prettierignore +1 -0
- package/.storybook/main.js +19 -3
- package/.storybook/preview.js +11 -0
- package/CHANGELOG.md +27 -0
- package/README.md +0 -67
- package/custom-elements-manifest.config.js +2 -2
- package/dist/Accordion.d.ts +1 -1
- package/dist/Accordion.js +8 -8
- package/dist/Button.d.ts +2 -2
- package/dist/Button.js +2 -2
- package/dist/ButtonGroup.d.ts +1 -1
- package/dist/ButtonGroup.js +1 -1
- package/dist/Checkbox.d.ts +1 -1
- package/dist/Checkbox.d.ts.map +1 -1
- package/dist/Checkbox.js +2 -3
- package/dist/CheckboxGroup.d.ts +1 -1
- package/dist/CheckboxGroup.d.ts.map +1 -1
- package/dist/CheckboxGroup.js +1 -3
- package/dist/Chip.d.ts +1 -1
- package/dist/Chip.d.ts.map +1 -1
- package/dist/Chip.js +1 -3
- package/dist/ChipGroup.d.ts +1 -1
- package/dist/ChipGroup.d.ts.map +1 -1
- package/dist/ChipGroup.js +2 -2
- package/dist/ChipLink.js +1 -1
- package/dist/ChipRemovable.js +1 -1
- package/dist/ChipSelectable.js +1 -1
- package/dist/Dialog.d.ts +1 -1
- package/dist/Dialog.d.ts.map +1 -1
- package/dist/Dialog.js +3 -5
- package/dist/Dropdown.d.ts +1 -1
- package/dist/Dropdown.js +3 -3
- package/dist/Icon.d.ts +2 -98
- package/dist/Icon.d.ts.map +1 -1
- package/dist/Icon.js +1 -1
- package/dist/Input.d.ts +8 -3
- package/dist/Input.d.ts.map +1 -1
- package/dist/Input.js +18 -12
- package/dist/{LeuElement-b670d77c.d.ts → LeuElement-DH0PPSMq.d.ts} +1 -1
- package/dist/LeuElement-DH0PPSMq.d.ts.map +1 -0
- package/dist/{LeuElement-b670d77c.js → LeuElement-DH0PPSMq.js} +2 -2
- package/dist/Menu.d.ts +2 -2
- package/dist/Menu.js +1 -1
- package/dist/MenuItem.d.ts +3 -3
- package/dist/MenuItem.js +1 -1
- package/dist/Pagination.d.ts +1 -1
- package/dist/Pagination.js +3 -3
- package/dist/Popup.d.ts +2 -2
- package/dist/Popup.d.ts.map +1 -1
- package/dist/Popup.js +1 -3
- package/dist/Radio.d.ts +1 -1
- package/dist/Radio.d.ts.map +1 -1
- package/dist/Radio.js +1 -3
- package/dist/RadioGroup.d.ts +1 -1
- package/dist/RadioGroup.d.ts.map +1 -1
- package/dist/RadioGroup.js +1 -3
- package/dist/Range.d.ts +1 -1
- package/dist/Range.d.ts.map +1 -1
- package/dist/Range.js +17 -19
- package/dist/ScrollTop.d.ts +1 -1
- package/dist/ScrollTop.d.ts.map +1 -1
- package/dist/ScrollTop.js +27 -3
- package/dist/Select.d.ts +3 -7
- package/dist/Select.d.ts.map +1 -1
- package/dist/Select.js +7 -18
- package/dist/Spinner.d.ts +1 -1
- package/dist/Spinner.js +1 -1
- package/dist/Table.d.ts +1 -1
- package/dist/Table.d.ts.map +1 -1
- package/dist/Table.js +3 -4
- package/dist/VisuallyHidden.d.ts +1 -1
- package/dist/VisuallyHidden.d.ts.map +1 -1
- package/dist/VisuallyHidden.js +3 -5
- package/dist/{hasSlotController-c09741c5.d.ts → hasSlotController-CYd5tWew.d.ts} +1 -1
- package/dist/hasSlotController-CYd5tWew.d.ts.map +1 -0
- package/dist/{hasSlotController-c09741c5.js → hasSlotController-CYd5tWew.js} +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js +5 -7
- package/dist/leu-accordion.js +1 -1
- package/dist/leu-button-group.js +1 -1
- package/dist/leu-button.js +2 -2
- package/dist/leu-checkbox-group.js +1 -1
- package/dist/leu-checkbox.js +1 -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 +2 -2
- package/dist/leu-dropdown.js +2 -2
- 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.js +2 -2
- package/dist/leu-popup.js +1 -1
- package/dist/leu-radio-group.js +1 -1
- package/dist/leu-radio.js +1 -1
- package/dist/leu-range.js +1 -1
- package/dist/leu-scroll-top.js +2 -3
- package/dist/leu-select.js +2 -2
- package/dist/leu-spinner.js +1 -1
- package/dist/leu-table.js +2 -2
- package/dist/leu-visually-hidden.js +1 -1
- package/dist/theme.css +143 -107
- package/dist/vscode.html-custom-data.json +4 -33
- package/dist/vue/index.d.ts +11 -78
- package/dist/web-types.json +247 -243
- package/index.js +0 -1
- package/package.json +55 -51
- package/rollup.config.js +3 -3
- package/scripts/generate-component/generate.js +5 -5
- package/scripts/generate-component/templates/stories/[name].stories.js +1 -1
- package/src/components/accordion/Accordion.js +1 -1
- package/src/components/accordion/accordion.css +6 -3
- package/src/components/accordion/stories/accordion.stories.js +7 -6
- package/src/components/accordion/test/accordion.test.js +24 -20
- package/src/components/button/Button.js +1 -1
- package/src/components/button/stories/button.stories.js +44 -46
- package/src/components/button/test/button.test.js +10 -10
- package/src/components/button-group/ButtonGroup.js +1 -1
- package/src/components/button-group/stories/button-group.stories.js +3 -3
- package/src/components/checkbox/checkbox.css +1 -0
- package/src/components/checkbox/stories/checkbox-group.stories.js +1 -1
- package/src/components/checkbox/stories/checkbox.stories.js +1 -1
- package/src/components/chip/ChipSelectable.js +1 -1
- package/src/components/chip/stories/chip-group.stories.js +5 -5
- package/src/components/chip/stories/chip-link.stories.js +1 -1
- package/src/components/chip/stories/chip-removable.stories.js +1 -1
- package/src/components/chip/stories/chip-selectable.stories.js +1 -1
- package/src/components/chip/test/chip-group.test.js +25 -33
- package/src/components/chip/test/chip-link.test.js +5 -5
- package/src/components/chip/test/chip-removable.test.js +6 -8
- package/src/components/chip/test/chip-selectable.test.js +9 -11
- package/src/components/dialog/stories/dialog.stories.js +1 -1
- package/src/components/dialog/test/dialog.test.js +1 -1
- package/src/components/dropdown/stories/dropdown.stories.js +1 -1
- package/src/components/dropdown/test/dropdown.test.js +12 -13
- package/src/components/icon/stories/icon.stories.js +1 -1
- package/src/components/input/Input.js +26 -18
- package/src/components/input/input.css +2 -2
- package/src/components/input/stories/input.stories.js +1 -4
- package/src/components/input/test/input.test.js +26 -0
- package/src/components/menu/stories/menu-item.stories.js +3 -1
- package/src/components/menu/stories/menu.stories.js +1 -1
- package/src/components/menu/test/menu-item.test.js +3 -2
- package/src/components/menu/test/menu.test.js +24 -22
- package/src/components/pagination/Pagination.js +1 -1
- package/src/components/pagination/pagination.css +1 -1
- package/src/components/pagination/stories/pagination.stories.js +3 -2
- package/src/components/pagination/test/pagination.test.js +8 -6
- package/src/components/popup/Popup.js +4 -4
- package/src/components/popup/stories/popup.stories.js +1 -1
- package/src/components/popup/test/popup.test.js +6 -8
- package/src/components/radio/RadioGroup.js +2 -2
- package/src/components/radio/stories/radio-group.stories.js +1 -1
- package/src/components/radio/stories/radio.stories.js +1 -1
- package/src/components/range/Range.js +20 -21
- package/src/components/range/stories/range-slider.stories.js +1 -1
- package/src/components/scroll-top/stories/scroll-top.stories.js +1 -1
- package/src/components/select/Select.js +7 -18
- package/src/components/select/stories/select.stories.js +3 -3
- package/src/components/select/test/select.test.js +18 -16
- package/src/components/spinner/stories/spinner.stories.js +1 -1
- package/src/components/table/Table.js +4 -4
- package/src/components/table/stories/table.stories.js +1 -1
- package/src/components/table/test/table.test.js +3 -2
- package/src/components/visually-hidden/stories/visually-hidden.stories.js +1 -1
- package/src/components/visually-hidden/test/visually-hidden.test.js +6 -8
- package/src/docs/contributing.mdx +154 -0
- package/src/docs/installation.mdx +35 -0
- package/src/docs/theme.mdx +349 -0
- package/src/docs/usage.mdx +73 -0
- package/src/lib/LeuElement.js +2 -2
- package/src/lib/hasSlotController.js +1 -1
- package/src/styles/style.stories.js +4 -2
- package/tsconfig.build.json +4 -3
- package/web-dev-server.config.mjs +1 -0
- package/web-test-runner.config.mjs +1 -1
- package/.github/workflows/test.yml +0 -38
- package/.storybook/preview-head.html +0 -2
- package/dist/Breadcrumb.d.ts +0 -69
- package/dist/Breadcrumb.d.ts.map +0 -1
- package/dist/Breadcrumb.js +0 -391
- package/dist/LeuElement-b670d77c.d.ts.map +0 -1
- package/dist/hasSlotController-c09741c5.d.ts.map +0 -1
- package/dist/leu-breadcrumb.d.ts +0 -3
- package/dist/leu-breadcrumb.d.ts.map +0 -1
- package/dist/leu-breadcrumb.js +0 -17
- package/dist/utils-65469421.d.ts +0 -16
- package/dist/utils-65469421.d.ts.map +0 -1
- package/dist/utils-65469421.js +0 -35
- package/src/components/breadcrumb/Breadcrumb.js +0 -324
- package/src/components/breadcrumb/breadcrumb.css +0 -98
- package/src/components/breadcrumb/leu-breadcrumb.js +0 -5
- package/src/components/breadcrumb/stories/breadcrumb.stories.js +0 -73
- package/src/components/breadcrumb/test/breadcrumb.test.js +0 -141
|
@@ -11,7 +11,7 @@ import { SELECTION_MODES } from "../ChipGroup.js"
|
|
|
11
11
|
import { VARIANTS as SELECTABLE_VARIANTS } from "../ChipSelectable.js"
|
|
12
12
|
|
|
13
13
|
export default {
|
|
14
|
-
title: "Chip/Group",
|
|
14
|
+
title: "Components/Chip/Group",
|
|
15
15
|
component: "leu-chip-group",
|
|
16
16
|
argTypes: {
|
|
17
17
|
selectionMode: {
|
|
@@ -98,7 +98,7 @@ function DefaultTemplate(args) {
|
|
|
98
98
|
<leu-chip-removable ?inverted=${args.inverted}>
|
|
99
99
|
${chip}
|
|
100
100
|
</leu-chip-removable>
|
|
101
|
-
|
|
101
|
+
`,
|
|
102
102
|
)}
|
|
103
103
|
`
|
|
104
104
|
|
|
@@ -116,7 +116,7 @@ function SingleTemplate(args) {
|
|
|
116
116
|
>
|
|
117
117
|
${chip}
|
|
118
118
|
</leu-chip-selectable>
|
|
119
|
-
|
|
119
|
+
`,
|
|
120
120
|
)}
|
|
121
121
|
`
|
|
122
122
|
|
|
@@ -130,7 +130,7 @@ function MultipleTemplate(args) {
|
|
|
130
130
|
<leu-chip-selectable ?inverted=${args.inverted} value="chip-${chip}">
|
|
131
131
|
${chip}
|
|
132
132
|
</leu-chip-selectable>
|
|
133
|
-
|
|
133
|
+
`,
|
|
134
134
|
)}
|
|
135
135
|
`
|
|
136
136
|
|
|
@@ -142,7 +142,7 @@ function LabeledTemplate(args) {
|
|
|
142
142
|
${links.map(
|
|
143
143
|
(chip) => html`
|
|
144
144
|
<leu-chip-link ?inverted=${args.inverted}> ${chip} </leu-chip-link>
|
|
145
|
-
|
|
145
|
+
`,
|
|
146
146
|
)}
|
|
147
147
|
`
|
|
148
148
|
|
|
@@ -6,7 +6,7 @@ import "../leu-chip-selectable.js"
|
|
|
6
6
|
import { SIZES, VARIANTS } from "../ChipSelectable.js"
|
|
7
7
|
|
|
8
8
|
export default {
|
|
9
|
-
title: "Chip/Selectable",
|
|
9
|
+
title: "Components/Chip/Selectable",
|
|
10
10
|
component: "leu-chip-selectable",
|
|
11
11
|
argTypes: {
|
|
12
12
|
variant: { control: "select", options: Object.values(VARIANTS) },
|
|
@@ -6,45 +6,37 @@ import "../leu-chip-removable.js"
|
|
|
6
6
|
import "../leu-chip-group.js"
|
|
7
7
|
|
|
8
8
|
async function removableFixture() {
|
|
9
|
-
return fixture(
|
|
10
|
-
|
|
11
|
-
<leu-chip-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
`
|
|
17
|
-
)
|
|
9
|
+
return fixture(html`
|
|
10
|
+
<leu-chip-group>
|
|
11
|
+
<leu-chip-removable>Publikationen</leu-chip-removable>
|
|
12
|
+
<leu-chip-removable value="2">Daten</leu-chip-removable>
|
|
13
|
+
<leu-chip-removable value="3">Schnittstellen</leu-chip-removable>
|
|
14
|
+
</leu-chip-group>
|
|
15
|
+
`)
|
|
18
16
|
}
|
|
19
17
|
|
|
20
18
|
async function singleSelectionFixture() {
|
|
21
|
-
return fixture(
|
|
22
|
-
|
|
23
|
-
<leu-chip-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
>
|
|
33
|
-
</leu-chip-group>
|
|
34
|
-
`
|
|
35
|
-
)
|
|
19
|
+
return fixture(html`
|
|
20
|
+
<leu-chip-group selection-mode="single">
|
|
21
|
+
<leu-chip-selectable value="1" variant="radio"
|
|
22
|
+
>Publikationen</leu-chip-selectable
|
|
23
|
+
>
|
|
24
|
+
<leu-chip-selectable value="2" variant="radio">Daten</leu-chip-selectable>
|
|
25
|
+
<leu-chip-selectable value="3" variant="radio"
|
|
26
|
+
>Schnittstellen</leu-chip-selectable
|
|
27
|
+
>
|
|
28
|
+
</leu-chip-group>
|
|
29
|
+
`)
|
|
36
30
|
}
|
|
37
31
|
|
|
38
32
|
async function multipleSelectionFixture() {
|
|
39
|
-
return fixture(
|
|
40
|
-
|
|
41
|
-
<leu-chip-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
`
|
|
47
|
-
)
|
|
33
|
+
return fixture(html`
|
|
34
|
+
<leu-chip-group selection-mode="multiple">
|
|
35
|
+
<leu-chip-selectable value="1">Publikationen</leu-chip-selectable>
|
|
36
|
+
<leu-chip-selectable value="2">Daten</leu-chip-selectable>
|
|
37
|
+
<leu-chip-selectable value="3">Schnittstellen</leu-chip-selectable>
|
|
38
|
+
</leu-chip-group>
|
|
39
|
+
`)
|
|
48
40
|
}
|
|
49
41
|
|
|
50
42
|
describe("LeuChipGroup", () => {
|
|
@@ -4,9 +4,9 @@ import { fixture, expect } from "@open-wc/testing"
|
|
|
4
4
|
import "../leu-chip-link.js"
|
|
5
5
|
|
|
6
6
|
async function defaultFixture() {
|
|
7
|
-
return fixture(
|
|
8
|
-
|
|
9
|
-
)
|
|
7
|
+
return fixture(html`
|
|
8
|
+
<leu-chip-link href="https://zh.ch/daten">Daten</leu-chip-link>
|
|
9
|
+
`)
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
describe("LeuChipLink", () => {
|
|
@@ -38,7 +38,7 @@ describe("LeuChipLink", () => {
|
|
|
38
38
|
const el = await defaultFixture()
|
|
39
39
|
|
|
40
40
|
expect(el.shadowRoot.querySelector("a").getAttribute("href")).to.equal(
|
|
41
|
-
"https://zh.ch/daten"
|
|
41
|
+
"https://zh.ch/daten",
|
|
42
42
|
)
|
|
43
43
|
})
|
|
44
44
|
|
|
@@ -48,7 +48,7 @@ describe("LeuChipLink", () => {
|
|
|
48
48
|
el.focus()
|
|
49
49
|
|
|
50
50
|
expect(el.shadowRoot.querySelector("a")).to.equal(
|
|
51
|
-
el.shadowRoot.activeElement
|
|
51
|
+
el.shadowRoot.activeElement,
|
|
52
52
|
)
|
|
53
53
|
})
|
|
54
54
|
})
|
|
@@ -6,13 +6,11 @@ import { ifDefined } from "lit/directives/if-defined.js"
|
|
|
6
6
|
import "../leu-chip-removable.js"
|
|
7
7
|
|
|
8
8
|
async function defaultFixture(args = {}) {
|
|
9
|
-
return fixture(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
`
|
|
15
|
-
)
|
|
9
|
+
return fixture(html`
|
|
10
|
+
<leu-chip-removable value=${ifDefined(args.value)}
|
|
11
|
+
>${args.label ?? "Daten"}</leu-chip-removable
|
|
12
|
+
>
|
|
13
|
+
`)
|
|
16
14
|
}
|
|
17
15
|
|
|
18
16
|
describe("LeuChipRemovable", () => {
|
|
@@ -54,7 +52,7 @@ describe("LeuChipRemovable", () => {
|
|
|
54
52
|
el.focus()
|
|
55
53
|
|
|
56
54
|
expect(el.shadowRoot.querySelector("button")).to.equal(
|
|
57
|
-
el.shadowRoot.activeElement
|
|
55
|
+
el.shadowRoot.activeElement,
|
|
58
56
|
)
|
|
59
57
|
})
|
|
60
58
|
|
|
@@ -6,16 +6,14 @@ import { sendKeys } from "@web/test-runner-commands"
|
|
|
6
6
|
import "../leu-chip-selectable.js"
|
|
7
7
|
|
|
8
8
|
async function defaultFixture(args = {}) {
|
|
9
|
-
return fixture(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
`
|
|
18
|
-
)
|
|
9
|
+
return fixture(html`
|
|
10
|
+
<leu-chip-selectable
|
|
11
|
+
value=${ifDefined(args.value)}
|
|
12
|
+
variant=${ifDefined(args.variant)}
|
|
13
|
+
?checked=${args.checked}
|
|
14
|
+
>Publikationen</leu-chip-selectable
|
|
15
|
+
>
|
|
16
|
+
`)
|
|
19
17
|
}
|
|
20
18
|
|
|
21
19
|
describe("LeuChipSelectable", () => {
|
|
@@ -49,7 +47,7 @@ describe("LeuChipSelectable", () => {
|
|
|
49
47
|
el.focus()
|
|
50
48
|
|
|
51
49
|
expect(el.shadowRoot.querySelector("button")).to.equal(
|
|
52
|
-
el.shadowRoot.activeElement
|
|
50
|
+
el.shadowRoot.activeElement,
|
|
53
51
|
)
|
|
54
52
|
})
|
|
55
53
|
|
|
@@ -4,19 +4,18 @@ import { fixture, expect, elementUpdated } from "@open-wc/testing"
|
|
|
4
4
|
import "../leu-dropdown.js"
|
|
5
5
|
|
|
6
6
|
async function defaultFixture(args = { expanded: false }) {
|
|
7
|
-
return fixture(
|
|
8
|
-
label="Download"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
</leu-dropdown>`)
|
|
7
|
+
return fixture(
|
|
8
|
+
html` <leu-dropdown label="Download" ?expanded=${args.expanded}>
|
|
9
|
+
<leu-menu>
|
|
10
|
+
<leu-menu-item>Als CSV Tabelle</leu-menu-item>
|
|
11
|
+
<leu-menu-item>Als XLS Tabelle</leu-menu-item>
|
|
12
|
+
<hr />
|
|
13
|
+
<leu-menu-item>Als PNG exportieren</leu-menu-item>
|
|
14
|
+
<leu-menu-item>Als SVG exportieren</leu-menu-item>
|
|
15
|
+
<leu-menu-item>Als PDF exportieren</leu-menu-item>
|
|
16
|
+
</leu-menu>
|
|
17
|
+
</leu-dropdown>`,
|
|
18
|
+
)
|
|
20
19
|
}
|
|
21
20
|
|
|
22
21
|
describe("LeuDropdown", () => {
|
|
@@ -171,7 +171,7 @@ export class LeuInput extends LeuElement {
|
|
|
171
171
|
* Method for handling the blur event of the input element.
|
|
172
172
|
* Checks validity of the input element and sets the validity state.
|
|
173
173
|
* @private
|
|
174
|
-
* @param {FocusEvent} event
|
|
174
|
+
* @param {FocusEvent & {target: HTMLInputElement}} event
|
|
175
175
|
* @returns {void}
|
|
176
176
|
*/
|
|
177
177
|
handleBlur(event) {
|
|
@@ -244,10 +244,10 @@ export class LeuInput extends LeuElement {
|
|
|
244
244
|
this._inputRef.value.focus()
|
|
245
245
|
|
|
246
246
|
this.dispatchEvent(
|
|
247
|
-
new CustomEvent("input", { bubbles: true, composed: true })
|
|
247
|
+
new CustomEvent("input", { bubbles: true, composed: true }),
|
|
248
248
|
)
|
|
249
249
|
this.dispatchEvent(
|
|
250
|
-
new CustomEvent("change", { bubbles: true, composed: true })
|
|
250
|
+
new CustomEvent("change", { bubbles: true, composed: true }),
|
|
251
251
|
)
|
|
252
252
|
}
|
|
253
253
|
|
|
@@ -296,24 +296,42 @@ export class LeuInput extends LeuElement {
|
|
|
296
296
|
|
|
297
297
|
validationMessages.tooLong = LeuInput.resolveErrorMessage(
|
|
298
298
|
tooLong,
|
|
299
|
-
this.maxlength
|
|
299
|
+
this.maxlength,
|
|
300
300
|
)
|
|
301
301
|
validationMessages.tooShort = LeuInput.resolveErrorMessage(
|
|
302
302
|
tooShort,
|
|
303
|
-
this.minlength
|
|
303
|
+
this.minlength,
|
|
304
304
|
)
|
|
305
305
|
validationMessages.rangeOverflow = LeuInput.resolveErrorMessage(
|
|
306
306
|
rangeOverflow,
|
|
307
|
-
this.max
|
|
307
|
+
this.max,
|
|
308
308
|
)
|
|
309
309
|
validationMessages.rangeUnderflow = LeuInput.resolveErrorMessage(
|
|
310
310
|
rangeUnderflow,
|
|
311
|
-
this.min
|
|
311
|
+
this.min,
|
|
312
312
|
)
|
|
313
313
|
|
|
314
314
|
return validationMessages
|
|
315
315
|
}
|
|
316
316
|
|
|
317
|
+
isInvalid() {
|
|
318
|
+
if (this.error) {
|
|
319
|
+
return true
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
return this._validity === null || this.novalidate
|
|
323
|
+
? false
|
|
324
|
+
: !this._validity.valid
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Check input validation
|
|
329
|
+
* @returns {boolean} if valid or not
|
|
330
|
+
*/
|
|
331
|
+
checkValidity() {
|
|
332
|
+
return this._inputRef.value?.checkValidity() ?? false
|
|
333
|
+
}
|
|
334
|
+
|
|
317
335
|
/**
|
|
318
336
|
* Creates an error list with an item for the given validity state.
|
|
319
337
|
* @returns {import("lit").TemplateResult | nothing}
|
|
@@ -337,7 +355,7 @@ export class LeuInput extends LeuElement {
|
|
|
337
355
|
return html`
|
|
338
356
|
<ul class="error" aria-errormessage=${`input-${this.getId()}`}>
|
|
339
357
|
${errorMessages.map(
|
|
340
|
-
(message) => html`<li class="error-message">${message}</li
|
|
358
|
+
(message) => html`<li class="error-message">${message}</li>`,
|
|
341
359
|
)}
|
|
342
360
|
</ul>
|
|
343
361
|
`
|
|
@@ -377,16 +395,6 @@ export class LeuInput extends LeuElement {
|
|
|
377
395
|
return nothing
|
|
378
396
|
}
|
|
379
397
|
|
|
380
|
-
isInvalid() {
|
|
381
|
-
if (this.error) {
|
|
382
|
-
return true
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
return this._validity === null || this.novalidate
|
|
386
|
-
? false
|
|
387
|
-
: !this._validity.valid
|
|
388
|
-
}
|
|
389
|
-
|
|
390
398
|
render() {
|
|
391
399
|
const isInvalid = this.isInvalid()
|
|
392
400
|
|
|
@@ -7,9 +7,8 @@ import { SIZES } from "../Input.js"
|
|
|
7
7
|
import { paths as iconPaths } from "../../icon/paths.js"
|
|
8
8
|
|
|
9
9
|
export default {
|
|
10
|
-
title: "Input",
|
|
10
|
+
title: "Components/Input",
|
|
11
11
|
component: "leu-input",
|
|
12
|
-
tags: ["autodocs"],
|
|
13
12
|
argTypes: {
|
|
14
13
|
size: {
|
|
15
14
|
control: {
|
|
@@ -49,8 +48,6 @@ function Template(args) {
|
|
|
49
48
|
novalidate = false,
|
|
50
49
|
} = args
|
|
51
50
|
|
|
52
|
-
console.log(min, max)
|
|
53
|
-
|
|
54
51
|
return html`
|
|
55
52
|
<leu-input
|
|
56
53
|
value=${ifDefined(value)}
|
|
@@ -469,4 +469,30 @@ describe("LeuInput", () => {
|
|
|
469
469
|
|
|
470
470
|
expect(el.valueAsNumber).to.be.NaN
|
|
471
471
|
})
|
|
472
|
+
|
|
473
|
+
it("check input is valid", async () => {
|
|
474
|
+
{
|
|
475
|
+
const el = await defaultFixture({ label: "Länge", type: "number" })
|
|
476
|
+
el.focus()
|
|
477
|
+
|
|
478
|
+
await sendKeys({ type: "text" })
|
|
479
|
+
expect(el.checkValidity()).to.be.false
|
|
480
|
+
|
|
481
|
+
await elementUpdated(el)
|
|
482
|
+
const error = el.shadowRoot.querySelector(".error")
|
|
483
|
+
expect(error).not.to.be.null
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
{
|
|
487
|
+
const el = await defaultFixture({ label: "Länge", type: "number" })
|
|
488
|
+
el.focus()
|
|
489
|
+
|
|
490
|
+
await sendKeys({ type: "123" })
|
|
491
|
+
expect(el.checkValidity()).to.be.true
|
|
492
|
+
|
|
493
|
+
await elementUpdated(el)
|
|
494
|
+
const error = el.shadowRoot.querySelector(".error")
|
|
495
|
+
expect(error).to.be.null
|
|
496
|
+
}
|
|
497
|
+
})
|
|
472
498
|
})
|
|
@@ -10,7 +10,7 @@ function isIcon(name) {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export default {
|
|
13
|
-
title: "Menu/Item",
|
|
13
|
+
title: "Components/Menu/Item",
|
|
14
14
|
component: "leu-menu-item",
|
|
15
15
|
args: {
|
|
16
16
|
label: "Menu Item",
|
|
@@ -23,6 +23,7 @@ export default {
|
|
|
23
23
|
},
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
/* eslint-disable no-nested-ternary */
|
|
26
27
|
function Template(args) {
|
|
27
28
|
return html`
|
|
28
29
|
<leu-menu-item
|
|
@@ -45,6 +46,7 @@ function Template(args) {
|
|
|
45
46
|
</leu-menu-item>
|
|
46
47
|
`
|
|
47
48
|
}
|
|
49
|
+
/* eslint-enable no-nested-ternary */
|
|
48
50
|
|
|
49
51
|
export const Regular = Template.bind({})
|
|
50
52
|
|
|
@@ -185,7 +185,7 @@ describe("LeuMenuItem", () => {
|
|
|
185
185
|
expect(el.getValue()).to.equal("download-01")
|
|
186
186
|
})
|
|
187
187
|
|
|
188
|
-
it("renders a
|
|
188
|
+
it("renders a placeholder icon when the menu item is part of multiple selection but not active", async () => {
|
|
189
189
|
const el = await defaultFixture({
|
|
190
190
|
label: "Download",
|
|
191
191
|
multipleSelection: true,
|
|
@@ -193,13 +193,14 @@ describe("LeuMenuItem", () => {
|
|
|
193
193
|
|
|
194
194
|
const icon = el.shadowRoot.querySelector("leu-icon")
|
|
195
195
|
expect(icon).to.exist
|
|
196
|
-
expect(icon).to.have.attribute("name", "
|
|
196
|
+
expect(icon).to.have.attribute("name", "")
|
|
197
197
|
})
|
|
198
198
|
|
|
199
199
|
it("renders a check icon when the menu item is part of multiple selection and is active", async () => {
|
|
200
200
|
const el = await defaultFixture({
|
|
201
201
|
label: "Download",
|
|
202
202
|
multipleSelection: true,
|
|
203
|
+
active: true,
|
|
203
204
|
})
|
|
204
205
|
|
|
205
206
|
const icon = el.shadowRoot.querySelector("leu-icon")
|
|
@@ -8,29 +8,31 @@ import "../leu-menu-item.js"
|
|
|
8
8
|
import "../../icon/leu-icon.js"
|
|
9
9
|
|
|
10
10
|
async function defaultFixture(args = {}) {
|
|
11
|
-
return fixture(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
<leu-menu-item
|
|
16
|
-
><leu-icon slot="before"></leu-icon>Menu Item 1</leu-menu-item
|
|
11
|
+
return fixture(
|
|
12
|
+
html` <leu-menu
|
|
13
|
+
role=${ifDefined(args.role)}
|
|
14
|
+
selects=${ifDefined(args.selects)}
|
|
17
15
|
>
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
16
|
+
<leu-menu-item
|
|
17
|
+
><leu-icon slot="before"></leu-icon>Menu Item 1</leu-menu-item
|
|
18
|
+
>
|
|
19
|
+
<leu-menu-item active
|
|
20
|
+
><leu-icon slot="before" name="check"></leu-icon>Menu Item
|
|
21
|
+
2</leu-menu-item
|
|
22
|
+
>
|
|
23
|
+
<leu-menu-item
|
|
24
|
+
><leu-icon slot="before"></leu-icon>Menu Item 3</leu-menu-item
|
|
25
|
+
>
|
|
26
|
+
<hr />
|
|
27
|
+
<leu-menu-item
|
|
28
|
+
><leu-icon name="pin" slot="before"></leu-icon>Menu Item 3<slot
|
|
29
|
+
name="after"
|
|
30
|
+
>CH</slot
|
|
31
|
+
></leu-menu-item
|
|
32
|
+
>
|
|
33
|
+
<leu-menu-item>Menu Item 4</leu-menu-item>
|
|
34
|
+
</leu-menu>`,
|
|
35
|
+
)
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
describe("LeuMenu", () => {
|
|
@@ -6,6 +6,7 @@ import "../leu-pagination.js"
|
|
|
6
6
|
// https://stackoverflow.com/questions/72566428/storybook-angular-how-to-dynamically-update-args-from-the-template
|
|
7
7
|
import { UPDATE_STORY_ARGS } from "@storybook/core-events" // eslint-disable-line
|
|
8
8
|
import { ifDefined } from "lit/directives/if-defined.js"
|
|
9
|
+
|
|
9
10
|
function updateStorybookArgss(id, args) {
|
|
10
11
|
const channel = window.__STORYBOOK_ADDONS_CHANNEL__
|
|
11
12
|
channel.emit(UPDATE_STORY_ARGS, {
|
|
@@ -57,7 +58,7 @@ const items = [
|
|
|
57
58
|
]
|
|
58
59
|
|
|
59
60
|
export default {
|
|
60
|
-
title: "Pagination",
|
|
61
|
+
title: "Components/Pagination",
|
|
61
62
|
component: "leu-pagination",
|
|
62
63
|
args: {
|
|
63
64
|
onPageChange: action("leu:pagechange"),
|
|
@@ -72,7 +73,7 @@ export default {
|
|
|
72
73
|
|
|
73
74
|
function Template(
|
|
74
75
|
{ startIndex, endIndex, onPageChange, itemsPerPage, defaultPage },
|
|
75
|
-
{ id }
|
|
76
|
+
{ id },
|
|
76
77
|
) {
|
|
77
78
|
return html`
|
|
78
79
|
${items
|