@statistikzh/leu 0.13.0 → 0.14.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/.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/static/fonts/Inter-Black.woff2 +0 -0
- package/.storybook/static/fonts/Inter-Regular.woff2 +0 -0
- package/.storybook/static/fonts.css +11 -0
- package/CHANGELOG.md +27 -0
- package/custom-elements-manifest.config.js +2 -2
- package/dist/Accordion.d.ts +1 -1
- package/dist/Accordion.d.ts.map +1 -1
- package/dist/Accordion.js +2 -4
- package/dist/Button.d.ts +2 -2
- package/dist/Button.d.ts.map +1 -1
- package/dist/Button.js +64 -34
- 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 +5 -6
- 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.d.ts.map +1 -1
- package/dist/Dropdown.js +4 -3
- package/dist/Icon.d.ts +2 -98
- package/dist/Icon.d.ts.map +1 -1
- package/dist/Icon.js +6 -2
- package/dist/Input.d.ts +7 -2
- package/dist/Input.d.ts.map +1 -1
- package/dist/Input.js +15 -8
- package/dist/{LeuElement-874a297c.d.ts → LeuElement-BjGpKQpe.d.ts} +1 -1
- package/dist/LeuElement-BjGpKQpe.d.ts.map +1 -0
- package/dist/{LeuElement-874a297c.js → LeuElement-BjGpKQpe.js} +12 -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 +2 -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 -3
- package/dist/Select.d.ts.map +1 -1
- package/dist/Select.js +7 -5
- 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-dbcac394.d.ts → hasSlotController-DvFw2NdC.d.ts} +1 -1
- package/dist/hasSlotController-DvFw2NdC.d.ts.map +1 -0
- package/dist/{hasSlotController-dbcac394.js → hasSlotController-DvFw2NdC.js} +1 -1
- package/dist/index.d.ts +1 -1
- 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 +3 -32
- package/dist/vue/index.d.ts +11 -77
- package/dist/web-types.json +246 -242
- package/index.js +1 -1
- package/package.json +55 -51
- package/rollup.config.js +3 -3
- package/scripts/generate-component/generate.js +5 -5
- package/src/components/accordion/test/accordion.test.js +24 -20
- package/src/components/button/Button.js +9 -4
- package/src/components/button/button.css +56 -22
- package/src/components/button/stories/button.stories.js +44 -45
- package/src/components/button/test/button.test.js +13 -13
- package/src/components/button-group/ButtonGroup.js +1 -1
- package/src/components/button-group/stories/button-group.stories.js +2 -2
- package/src/components/checkbox/checkbox.css +1 -0
- package/src/components/chip/ChipSelectable.js +1 -1
- package/src/components/chip/chip.css +4 -3
- package/src/components/chip/stories/chip-group.stories.js +4 -4
- 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/test/dialog.test.js +1 -1
- package/src/components/dropdown/dropdown.css +1 -0
- package/src/components/dropdown/test/dropdown.test.js +12 -13
- package/src/components/icon/icon.css +4 -0
- package/src/components/input/Input.js +25 -17
- package/src/components/input/stories/input.stories.js +0 -2
- package/src/components/input/test/input.test.js +26 -0
- package/src/components/menu/stories/menu-item.stories.js +2 -0
- 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 +2 -1
- package/src/components/pagination/test/pagination.test.js +8 -6
- package/src/components/popup/Popup.js +4 -4
- package/src/components/popup/popup.css +1 -0
- package/src/components/popup/test/popup.test.js +6 -8
- package/src/components/radio/RadioGroup.js +2 -2
- package/src/components/range/Range.js +20 -21
- package/src/components/select/Select.js +6 -1
- package/src/components/select/select.css +1 -1
- package/src/components/select/stories/select.stories.js +1 -1
- package/src/components/select/test/select.test.js +19 -16
- package/src/components/table/Table.js +4 -4
- package/src/components/table/test/table.test.js +3 -2
- package/src/components/visually-hidden/test/visually-hidden.test.js +6 -8
- package/src/lib/LeuElement.js +2 -2
- package/src/lib/hasSlotController.js +1 -1
- package/src/styles/common-styles.css +9 -0
- package/src/styles/style.stories.js +3 -1
- package/tsconfig.build.json +4 -3
- package/web-dev-server.config.mjs +1 -0
- package/web-test-runner.config.mjs +2 -1
- package/.github/workflows/test.yml +0 -38
- package/.storybook/preview-head.html +0 -5
- package/dist/Breadcrumb.d.ts +0 -69
- package/dist/Breadcrumb.d.ts.map +0 -1
- package/dist/Breadcrumb.js +0 -391
- package/dist/LeuElement-874a297c.d.ts.map +0 -1
- package/dist/hasSlotController-dbcac394.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
|
@@ -36,10 +36,10 @@ function Template({ items, value }, { id }) {
|
|
|
36
36
|
(i) =>
|
|
37
37
|
html`<leu-button
|
|
38
38
|
variant="secondary"
|
|
39
|
-
?active=${value === i}
|
|
39
|
+
?active=${value === i || value === `${i}-attr`}
|
|
40
40
|
value=${`${i}-attr`}
|
|
41
41
|
>${i}
|
|
42
|
-
</leu-button
|
|
42
|
+
</leu-button>`,
|
|
43
43
|
)}
|
|
44
44
|
</leu-button-group>
|
|
45
45
|
<br />
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
border: none;
|
|
56
56
|
border-radius: 1rem;
|
|
57
57
|
background-color: var(--chip-background-color);
|
|
58
|
-
padding:
|
|
58
|
+
padding: 8px 1rem;
|
|
59
59
|
|
|
60
60
|
color: var(--chip-color);
|
|
61
61
|
font-family: inherit;
|
|
@@ -66,6 +66,7 @@
|
|
|
66
66
|
|
|
67
67
|
display: inline-flex;
|
|
68
68
|
gap: 0.5rem;
|
|
69
|
+
align-items: center;
|
|
69
70
|
|
|
70
71
|
/* Allow shrinking to achieve text truncation (ellipsis) */
|
|
71
72
|
min-width: 0;
|
|
@@ -108,10 +109,10 @@
|
|
|
108
109
|
}
|
|
109
110
|
|
|
110
111
|
:host([size="small"]:not([variant="radio"])) .button {
|
|
111
|
-
padding: 0.
|
|
112
|
+
padding: 0.3125rem 0.75rem;
|
|
112
113
|
|
|
113
114
|
font-size: 0.75rem;
|
|
114
|
-
line-height: 1;
|
|
115
|
+
line-height: 1.25rem;
|
|
115
116
|
}
|
|
116
117
|
|
|
117
118
|
:host([variant="radio"]) .button::before {
|
|
@@ -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
|
|
|
@@ -50,7 +50,7 @@ export const Default = Template.bind({})
|
|
|
50
50
|
Default.args = {}
|
|
51
51
|
|
|
52
52
|
export const Small = Template.bind({})
|
|
53
|
-
Small.args = { size: SIZES.small }
|
|
53
|
+
Small.args = { size: SIZES.small, label: "Publikationen Region" }
|
|
54
54
|
|
|
55
55
|
export const Radio = Template.bind({})
|
|
56
56
|
Radio.args = { variant: VARIANTS.radio }
|
|
@@ -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", () => {
|
|
@@ -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
|
|
|
@@ -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
|
})
|
|
@@ -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, {
|
|
@@ -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
|
|
@@ -7,12 +7,14 @@ import { spy } from "sinon"
|
|
|
7
7
|
import "../leu-pagination.js"
|
|
8
8
|
|
|
9
9
|
async function defaultFixture(args = {}) {
|
|
10
|
-
return fixture(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
return fixture(
|
|
11
|
+
html`<leu-pagination
|
|
12
|
+
numOfItems=${ifDefined(args.numOfItems)}
|
|
13
|
+
itemsPerPage=${ifDefined(args.itemsPerPage)}
|
|
14
|
+
defaultPage=${ifDefined(args.defaultPage)}
|
|
15
|
+
>
|
|
16
|
+
</leu-pagination>`,
|
|
17
|
+
)
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
describe("LeuPagination", () => {
|
|
@@ -130,7 +130,7 @@ export class LeuPopup extends LeuElement {
|
|
|
130
130
|
? `${rects.reference.height}px`
|
|
131
131
|
: ""
|
|
132
132
|
},
|
|
133
|
-
})
|
|
133
|
+
}),
|
|
134
134
|
)
|
|
135
135
|
} else {
|
|
136
136
|
// Cleanup styles if we're not matching width/height
|
|
@@ -159,7 +159,7 @@ export class LeuPopup extends LeuElement {
|
|
|
159
159
|
if (setMaxHeight) {
|
|
160
160
|
this.style.setProperty(
|
|
161
161
|
"--auto-size-available-height",
|
|
162
|
-
`${availableHeight}px
|
|
162
|
+
`${availableHeight}px`,
|
|
163
163
|
)
|
|
164
164
|
} else {
|
|
165
165
|
this.style.removeProperty("--auto-size-available-height")
|
|
@@ -168,13 +168,13 @@ export class LeuPopup extends LeuElement {
|
|
|
168
168
|
if (setMaxWidth) {
|
|
169
169
|
this.style.setProperty(
|
|
170
170
|
"--auto-size-available-width",
|
|
171
|
-
`${availableWidth}px
|
|
171
|
+
`${availableWidth}px`,
|
|
172
172
|
)
|
|
173
173
|
} else {
|
|
174
174
|
this.style.removeProperty("--auto-size-available-width")
|
|
175
175
|
}
|
|
176
176
|
},
|
|
177
|
-
})
|
|
177
|
+
}),
|
|
178
178
|
)
|
|
179
179
|
} else {
|
|
180
180
|
// Cleanup styles if we're not auto-sizing
|