@statistikzh/leu 0.5.1 → 0.7.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/.husky/commit-msg +0 -3
- package/.husky/pre-commit +0 -3
- package/CHANGELOG.md +54 -0
- package/dist/Accordion.d.ts +10 -9
- package/dist/Accordion.d.ts.map +1 -1
- package/dist/Accordion.js +12 -11
- package/dist/Breadcrumb.d.ts +4 -4
- package/dist/Breadcrumb.d.ts.map +1 -1
- package/dist/Breadcrumb.js +28 -24
- package/dist/{Button-5326c982.d.ts → Button-7370f901.d.ts} +10 -11
- package/dist/Button-7370f901.d.ts.map +1 -0
- package/dist/{Button-5326c982.js → Button-7370f901.js} +57 -67
- package/dist/Button.d.ts +1 -1
- package/dist/Button.js +3 -3
- package/dist/ButtonGroup.d.ts +2 -2
- package/dist/ButtonGroup.d.ts.map +1 -1
- package/dist/ButtonGroup.js +3 -3
- package/dist/Checkbox.d.ts +4 -3
- package/dist/Checkbox.d.ts.map +1 -1
- package/dist/Checkbox.js +14 -17
- package/dist/CheckboxGroup.d.ts +2 -2
- package/dist/CheckboxGroup.d.ts.map +1 -1
- package/dist/CheckboxGroup.js +4 -4
- package/dist/Chip.d.ts +2 -2
- package/dist/Chip.d.ts.map +1 -1
- package/dist/Chip.js +23 -28
- package/dist/ChipGroup.d.ts +16 -8
- package/dist/ChipGroup.d.ts.map +1 -1
- package/dist/ChipGroup.js +39 -9
- package/dist/ChipLink.d.ts +2 -1
- package/dist/ChipLink.d.ts.map +1 -1
- package/dist/ChipLink.js +4 -7
- package/dist/ChipRemovable.d.ts +0 -2
- package/dist/ChipRemovable.d.ts.map +1 -1
- package/dist/ChipRemovable.js +8 -11
- package/dist/ChipSelectable.d.ts +12 -2
- package/dist/ChipSelectable.d.ts.map +1 -1
- package/dist/ChipSelectable.js +24 -26
- package/dist/Dropdown.d.ts +9 -5
- package/dist/Dropdown.d.ts.map +1 -1
- package/dist/Dropdown.js +68 -32
- package/dist/Icon.d.ts +116 -0
- package/dist/Icon.d.ts.map +1 -0
- package/dist/{icon-03e86700.js → Icon.js} +61 -32
- package/dist/Input.d.ts +13 -17
- package/dist/Input.d.ts.map +1 -1
- package/dist/Input.js +33 -24
- package/dist/LeuElement-ba5ea33d.d.ts +7 -0
- package/dist/LeuElement-ba5ea33d.d.ts.map +1 -0
- package/dist/{_rollupPluginBabelHelpers-20f659f4.js → LeuElement-ba5ea33d.js} +20 -1
- package/dist/Menu.d.ts +24 -2
- package/dist/Menu.d.ts.map +1 -1
- package/dist/Menu.js +120 -3
- package/dist/MenuItem.d.ts +28 -11
- package/dist/MenuItem.d.ts.map +1 -1
- package/dist/MenuItem.js +110 -63
- package/dist/Pagination.d.ts +10 -3
- package/dist/Pagination.d.ts.map +1 -1
- package/dist/Pagination.js +24 -21
- package/dist/Popup.d.ts +21 -3
- package/dist/Popup.d.ts.map +1 -1
- package/dist/Popup.js +44 -17
- package/dist/Radio.d.ts +4 -2
- package/dist/Radio.d.ts.map +1 -1
- package/dist/Radio.js +9 -14
- package/dist/RadioGroup.d.ts +2 -2
- package/dist/RadioGroup.d.ts.map +1 -1
- package/dist/RadioGroup.js +20 -11
- package/dist/ScrollTop.d.ts +2 -2
- package/dist/ScrollTop.d.ts.map +1 -1
- package/dist/ScrollTop.js +10 -8
- package/dist/Select.d.ts +75 -37
- package/dist/Select.d.ts.map +1 -1
- package/dist/Select.js +279 -181
- package/dist/Table.d.ts +2 -6
- package/dist/Table.d.ts.map +1 -1
- package/dist/Table.js +16 -16
- package/dist/VisuallyHidden.d.ts +2 -2
- package/dist/VisuallyHidden.d.ts.map +1 -1
- package/dist/VisuallyHidden.js +3 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -14
- package/dist/leu-accordion.d.ts.map +1 -1
- package/dist/leu-accordion.js +2 -3
- package/dist/leu-breadcrumb.d.ts.map +1 -1
- package/dist/leu-breadcrumb.js +4 -10
- package/dist/leu-button-group.d.ts.map +1 -1
- package/dist/leu-button-group.js +2 -3
- package/dist/leu-button.d.ts +1 -1
- package/dist/leu-button.d.ts.map +1 -1
- package/dist/leu-button.js +4 -5
- package/dist/leu-checkbox-group.d.ts.map +1 -1
- package/dist/leu-checkbox-group.js +2 -3
- package/dist/leu-checkbox.d.ts.map +1 -1
- package/dist/leu-checkbox.js +3 -4
- package/dist/leu-chip-group.d.ts.map +1 -1
- package/dist/leu-chip-group.js +2 -3
- package/dist/leu-chip-link.d.ts.map +1 -1
- package/dist/leu-chip-link.js +2 -3
- package/dist/leu-chip-removable.d.ts.map +1 -1
- package/dist/leu-chip-removable.js +3 -4
- package/dist/leu-chip-selectable.d.ts.map +1 -1
- package/dist/leu-chip-selectable.js +2 -3
- package/dist/leu-dropdown.d.ts.map +1 -1
- package/dist/leu-dropdown.js +5 -10
- package/dist/leu-icon.d.ts +3 -0
- package/dist/leu-icon.d.ts.map +1 -0
- package/dist/leu-icon.js +7 -0
- package/dist/leu-input.d.ts.map +1 -1
- package/dist/leu-input.js +3 -4
- package/dist/leu-menu-item.d.ts.map +1 -1
- package/dist/leu-menu-item.js +3 -5
- package/dist/leu-menu.d.ts.map +1 -1
- package/dist/leu-menu.js +5 -3
- package/dist/leu-pagination.d.ts.map +1 -1
- package/dist/leu-pagination.js +4 -7
- package/dist/leu-popup.d.ts.map +1 -1
- package/dist/leu-popup.js +2 -3
- package/dist/leu-radio-group.d.ts.map +1 -1
- package/dist/leu-radio-group.js +2 -3
- package/dist/leu-radio.d.ts.map +1 -1
- package/dist/leu-radio.js +2 -3
- package/dist/leu-scroll-top.d.ts.map +1 -1
- package/dist/leu-scroll-top.js +4 -6
- package/dist/leu-select.d.ts.map +1 -1
- package/dist/leu-select.js +5 -13
- package/dist/leu-table.d.ts.map +1 -1
- package/dist/leu-table.js +4 -8
- package/dist/leu-visually-hidden.d.ts.map +1 -1
- package/dist/leu-visually-hidden.js +2 -3
- package/dist/theme.css +2 -0
- package/dist/vscode.html-custom-data.json +124 -74
- package/dist/vue/index.d.ts +83 -67
- package/dist/web-types.json +256 -142
- package/package.json +9 -12
- package/scripts/generate-component/templates/[Name].js +6 -3
- package/scripts/generate-component/templates/test/[name].test.js +1 -1
- package/src/components/accordion/Accordion.js +13 -10
- package/src/components/accordion/leu-accordion.js +1 -2
- package/src/components/breadcrumb/Breadcrumb.js +31 -18
- package/src/components/breadcrumb/leu-breadcrumb.js +1 -2
- package/src/components/button/Button.js +45 -71
- package/src/components/button/button.css +11 -9
- package/src/components/button/leu-button.js +1 -2
- package/src/components/button/stories/button.stories.js +60 -19
- package/src/components/button/test/button.test.js +26 -63
- package/src/components/button-group/ButtonGroup.js +4 -2
- package/src/components/button-group/leu-button-group.js +1 -2
- package/src/components/checkbox/Checkbox.js +17 -11
- package/src/components/checkbox/CheckboxGroup.js +6 -3
- package/src/components/checkbox/leu-checkbox-group.js +1 -2
- package/src/components/checkbox/leu-checkbox.js +1 -2
- package/src/components/checkbox/stories/checkbox-group.stories.js +10 -26
- package/src/components/checkbox/stories/checkbox.stories.js +2 -7
- package/src/components/checkbox/test/checkbox-group.test.js +6 -21
- package/src/components/checkbox/test/checkbox.test.js +1 -12
- package/src/components/chip/Chip.js +5 -4
- package/src/components/chip/ChipGroup.js +38 -8
- package/src/components/chip/ChipLink.js +3 -7
- package/src/components/chip/ChipRemovable.js +8 -11
- package/src/components/chip/ChipSelectable.js +23 -27
- package/src/components/chip/chip.css +19 -20
- package/src/components/chip/leu-chip-group.js +1 -2
- package/src/components/chip/leu-chip-link.js +1 -2
- package/src/components/chip/leu-chip-removable.js +1 -2
- package/src/components/chip/leu-chip-selectable.js +1 -2
- package/src/components/chip/stories/chip-group.stories.js +6 -9
- package/src/components/chip/stories/chip-link.stories.js +3 -5
- package/src/components/chip/stories/chip-removable.stories.js +3 -4
- package/src/components/chip/stories/chip-selectable.stories.js +3 -3
- package/src/components/chip/test/chip-group.test.js +82 -30
- package/src/components/chip/test/chip-link.test.js +2 -6
- package/src/components/chip/test/chip-removable.test.js +4 -10
- package/src/components/chip/test/chip-selectable.test.js +10 -12
- package/src/components/dropdown/Dropdown.js +79 -26
- package/src/components/dropdown/leu-dropdown.js +1 -2
- package/src/components/dropdown/stories/dropdown.stories.js +30 -7
- package/src/components/dropdown/test/dropdown.test.js +5 -5
- package/src/components/icon/Icon.js +55 -0
- package/src/components/icon/icon.css +6 -0
- package/src/components/icon/leu-icon.js +5 -0
- package/src/components/icon/{icon.js → paths.js} +4 -37
- package/src/components/icon/stories/icon.stories.js +47 -0
- package/src/components/icon/test/icon.test.js +23 -40
- package/src/components/input/Input.js +31 -20
- package/src/components/input/input.css +4 -2
- package/src/components/input/leu-input.js +1 -2
- package/src/components/input/stories/input.stories.js +5 -5
- package/src/components/input/test/input.test.js +22 -0
- package/src/components/menu/Menu.js +143 -2
- package/src/components/menu/MenuItem.js +104 -52
- package/src/components/menu/leu-menu-item.js +1 -2
- package/src/components/menu/leu-menu.js +1 -2
- package/src/components/menu/menu-item.css +11 -4
- package/src/components/menu/stories/menu-item.stories.js +15 -4
- package/src/components/menu/stories/menu.stories.js +34 -7
- package/src/components/menu/test/menu-item.test.js +88 -82
- package/src/components/menu/test/menu.test.js +101 -8
- package/src/components/pagination/Pagination.js +27 -18
- package/src/components/pagination/leu-pagination.js +1 -2
- package/src/components/popup/Popup.js +39 -16
- package/src/components/popup/leu-popup.js +1 -2
- package/src/components/popup/popup.css +1 -0
- package/src/components/radio/Radio.js +12 -7
- package/src/components/radio/RadioGroup.js +18 -12
- package/src/components/radio/leu-radio-group.js +1 -2
- package/src/components/radio/leu-radio.js +1 -2
- package/src/components/radio/stories/radio-group.stories.js +5 -19
- package/src/components/radio/stories/radio.stories.js +2 -7
- package/src/components/radio/test/radio-group.test.js +6 -9
- package/src/components/radio/test/radio.test.js +3 -13
- package/src/components/scroll-top/ScrollTop.js +15 -5
- package/src/components/scroll-top/leu-scroll-top.js +1 -2
- package/src/components/select/Select.js +279 -175
- package/src/components/select/leu-select.js +1 -2
- package/src/components/select/select.css +20 -12
- package/src/components/select/stories/select.stories.js +16 -2
- package/src/components/select/test/select.test.js +191 -37
- package/src/components/table/Table.js +15 -9
- package/src/components/table/leu-table.js +1 -2
- package/src/components/table/table.css +3 -1
- package/src/components/visually-hidden/VisuallyHidden.js +6 -2
- package/src/components/visually-hidden/leu-visually-hidden.js +1 -2
- package/src/lib/LeuElement.js +23 -0
- package/src/lib/a11y.js +26 -0
- package/src/styles/custom-properties.css +2 -0
- package/web-test-runner.config.mjs +2 -0
- package/dist/Button-5326c982.d.ts.map +0 -1
- package/dist/_rollupPluginBabelHelpers-20f659f4.d.ts +0 -3
- package/dist/_rollupPluginBabelHelpers-20f659f4.d.ts.map +0 -1
- package/dist/defineElement-40372b4b.d.ts +0 -9
- package/dist/defineElement-40372b4b.d.ts.map +0 -1
- package/dist/defineElement-40372b4b.js +0 -15
- package/dist/icon-03e86700.d.ts +0 -11
- package/dist/icon-03e86700.d.ts.map +0 -1
- package/src/lib/defineElement.js +0 -13
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { html } from "lit"
|
|
1
|
+
import { html, nothing } from "lit"
|
|
2
2
|
import { ifDefined } from "lit/directives/if-defined.js"
|
|
3
3
|
import { classMap } from "lit/directives/class-map.js"
|
|
4
4
|
import "../leu-button.js"
|
|
5
|
-
import
|
|
5
|
+
import "../../icon/leu-icon.js"
|
|
6
|
+
import { paths as iconPaths } from "../../icon/paths.js"
|
|
6
7
|
import {
|
|
7
8
|
BUTTON_VARIANTS,
|
|
8
9
|
BUTTON_TYPES,
|
|
@@ -35,8 +36,6 @@ function Template(args = {}) {
|
|
|
35
36
|
content=${ifDefined(args.content)}
|
|
36
37
|
size=${ifDefined(args.size)}
|
|
37
38
|
variant=${ifDefined(args.variant)}
|
|
38
|
-
icon=${ifDefined(args.icon)}
|
|
39
|
-
iconPosition=${ifDefined(args.iconPosition)}
|
|
40
39
|
type=${ifDefined(args.type)}
|
|
41
40
|
expanded=${ifDefined(args.expanded)}
|
|
42
41
|
?round=${args.round}
|
|
@@ -45,6 +44,12 @@ function Template(args = {}) {
|
|
|
45
44
|
?disabled=${args.disabled}
|
|
46
45
|
@click=${copyContent}
|
|
47
46
|
>
|
|
47
|
+
${args.icon
|
|
48
|
+
? html`<leu-icon
|
|
49
|
+
slot=${ifDefined(args.content ? args.iconPosition : undefined)}
|
|
50
|
+
name=${args.icon}
|
|
51
|
+
></leu-icon>`
|
|
52
|
+
: nothing}
|
|
48
53
|
${args.content}
|
|
49
54
|
</leu-button>
|
|
50
55
|
</div>
|
|
@@ -70,13 +75,18 @@ function Template(args = {}) {
|
|
|
70
75
|
|
|
71
76
|
export const Regular = Template.bind({})
|
|
72
77
|
Regular.argTypes = {
|
|
73
|
-
content: {
|
|
74
|
-
icon: { control: "select", options:
|
|
75
|
-
iconPosition: {
|
|
78
|
+
content: { control: "text" },
|
|
79
|
+
icon: { control: "select", options: Object.keys(iconPaths) },
|
|
80
|
+
iconPosition: {
|
|
81
|
+
control: "select",
|
|
82
|
+
options: ["before", "after"],
|
|
83
|
+
},
|
|
76
84
|
type: { control: "radio", options: BUTTON_TYPES },
|
|
77
85
|
size: { control: "radio", options: BUTTON_SIZES },
|
|
78
86
|
variant: { control: "radio", options: BUTTON_VARIANTS },
|
|
79
87
|
expanded: { control: "radio", options: BUTTON_EXPANDED_OPTIONS },
|
|
88
|
+
disabled: { control: "boolean" },
|
|
89
|
+
round: { control: "boolean" },
|
|
80
90
|
}
|
|
81
91
|
Regular.args = {
|
|
82
92
|
content: "Click Mich...",
|
|
@@ -86,7 +96,7 @@ Regular.args = {
|
|
|
86
96
|
inverted: false,
|
|
87
97
|
|
|
88
98
|
icon: null,
|
|
89
|
-
iconPosition:
|
|
99
|
+
iconPosition: "before",
|
|
90
100
|
size: null,
|
|
91
101
|
variant: null,
|
|
92
102
|
type: null,
|
|
@@ -97,9 +107,14 @@ const items = [
|
|
|
97
107
|
{ content: "Active", active: true },
|
|
98
108
|
{ content: "Disabled", disabled: true },
|
|
99
109
|
|
|
100
|
-
{ content: "Normal", icon: "calendar" },
|
|
101
|
-
{ content: "Active", icon: "calendar", active: true },
|
|
102
|
-
{
|
|
110
|
+
{ content: "Normal", icon: "calendar", iconPosition: "before" },
|
|
111
|
+
{ content: "Active", icon: "calendar", iconPosition: "before", active: true },
|
|
112
|
+
{
|
|
113
|
+
content: "Disabled",
|
|
114
|
+
icon: "calendar",
|
|
115
|
+
iconPosition: "before",
|
|
116
|
+
disabled: true,
|
|
117
|
+
},
|
|
103
118
|
|
|
104
119
|
{ content: "Normal", icon: "calendar", iconPosition: "after" },
|
|
105
120
|
{ content: "Active", icon: "calendar", iconPosition: "after", active: true },
|
|
@@ -120,13 +135,35 @@ const items = [
|
|
|
120
135
|
]
|
|
121
136
|
|
|
122
137
|
const ghostItems = [
|
|
123
|
-
{ content: "Normal", icon: "calendar" },
|
|
124
|
-
{ content: "Active", icon: "calendar", active: true },
|
|
125
|
-
{
|
|
138
|
+
{ content: "Normal", icon: "calendar", iconPosition: "before" },
|
|
139
|
+
{ content: "Active", icon: "calendar", iconPosition: "before", active: true },
|
|
140
|
+
{
|
|
141
|
+
content: "Disabled",
|
|
142
|
+
icon: "calendar",
|
|
143
|
+
iconPosition: "before",
|
|
144
|
+
disabled: true,
|
|
145
|
+
},
|
|
126
146
|
|
|
127
|
-
{
|
|
128
|
-
|
|
129
|
-
|
|
147
|
+
{
|
|
148
|
+
content: "Normal",
|
|
149
|
+
icon: "calendar",
|
|
150
|
+
iconPosition: "before",
|
|
151
|
+
expanded: "closed",
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
content: "Active",
|
|
155
|
+
icon: "calendar",
|
|
156
|
+
iconPosition: "before",
|
|
157
|
+
active: true,
|
|
158
|
+
expanded: "closed",
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
content: "Disabled",
|
|
162
|
+
icon: "calendar",
|
|
163
|
+
iconPosition: "before",
|
|
164
|
+
disabled: true,
|
|
165
|
+
expanded: "closed",
|
|
166
|
+
},
|
|
130
167
|
|
|
131
168
|
{ content: "Normal", icon: "calendar", iconPosition: "after" },
|
|
132
169
|
{ content: "Active", icon: "calendar", iconPosition: "after", active: true },
|
|
@@ -269,8 +306,6 @@ function TemplateOverview() {
|
|
|
269
306
|
label=${ifDefined(item.label)}
|
|
270
307
|
size=${ifDefined(size.size)}
|
|
271
308
|
variant=${ifDefined(group.variant)}
|
|
272
|
-
icon=${ifDefined(item.icon)}
|
|
273
|
-
iconPosition=${ifDefined(item.iconPosition)}
|
|
274
309
|
expanded=${ifDefined(item.expanded)}
|
|
275
310
|
?round=${item.round}
|
|
276
311
|
?active=${item.active}
|
|
@@ -278,6 +313,12 @@ function TemplateOverview() {
|
|
|
278
313
|
?inverted=${group.inverted}
|
|
279
314
|
@click=${copyContent}
|
|
280
315
|
>
|
|
316
|
+
${item.icon
|
|
317
|
+
? html` <leu-icon
|
|
318
|
+
slot=${ifDefined(item.iconPosition)}
|
|
319
|
+
name=${item.icon}
|
|
320
|
+
></leu-icon>`
|
|
321
|
+
: nothing}
|
|
281
322
|
${item.content}
|
|
282
323
|
</leu-button>
|
|
283
324
|
`
|
|
@@ -2,6 +2,7 @@ import { html } from "lit"
|
|
|
2
2
|
import { fixture, expect, elementUpdated, oneEvent } from "@open-wc/testing"
|
|
3
3
|
|
|
4
4
|
import "../leu-button.js"
|
|
5
|
+
import "../../icon/leu-icon.js"
|
|
5
6
|
|
|
6
7
|
async function defaultFixture() {
|
|
7
8
|
return fixture(html` <leu-button>button</leu-button>`)
|
|
@@ -22,7 +23,9 @@ describe("LeuButton", () => {
|
|
|
22
23
|
|
|
23
24
|
it("passes the a11y audit with no visible text", async () => {
|
|
24
25
|
const el = await fixture(
|
|
25
|
-
html` <leu-button
|
|
26
|
+
html` <leu-button label="sichern">
|
|
27
|
+
<leu-icon name="download"></leu-icon>
|
|
28
|
+
</leu-button>`
|
|
26
29
|
)
|
|
27
30
|
|
|
28
31
|
await expect(el).shadowDom.to.be.accessible()
|
|
@@ -36,9 +39,8 @@ describe("LeuButton", () => {
|
|
|
36
39
|
|
|
37
40
|
it("sets the aria-label attribute", async () => {
|
|
38
41
|
const el = await fixture(
|
|
39
|
-
html` <leu-button
|
|
40
|
-
icon="download"
|
|
41
|
-
label="Dokument herunterladen"
|
|
42
|
+
html` <leu-button label="Dokument herunterladen"
|
|
43
|
+
><leu-icon name="download"></leu-icon
|
|
42
44
|
></leu-button>`
|
|
43
45
|
)
|
|
44
46
|
const button = el.shadowRoot.querySelector("button")
|
|
@@ -46,62 +48,33 @@ describe("LeuButton", () => {
|
|
|
46
48
|
expect(button).to.have.attribute("aria-label", "Dokument herunterladen")
|
|
47
49
|
})
|
|
48
50
|
|
|
49
|
-
it("renders the icon at the correct position", async () => {
|
|
50
|
-
const el = await fixture(
|
|
51
|
-
html` <leu-button icon="addNew">Sichern</leu-button>`
|
|
52
|
-
)
|
|
53
|
-
|
|
54
|
-
const button = el.shadowRoot.querySelector("button")
|
|
55
|
-
|
|
56
|
-
expect(button).dom.to.equal(
|
|
57
|
-
"<button><div><svg><path /></svg></div><slot></slot></div>",
|
|
58
|
-
{ ignoreAttributes: ["d", "class", "type"] }
|
|
59
|
-
)
|
|
60
|
-
|
|
61
|
-
el.iconPosition = "after"
|
|
62
|
-
|
|
63
|
-
await elementUpdated(el)
|
|
64
|
-
|
|
65
|
-
expect(button).dom.to.equal(
|
|
66
|
-
"<button><slot></slot><div><svg><path /></svg></div></div>",
|
|
67
|
-
{ ignoreAttributes: ["d", "class", "type"] }
|
|
68
|
-
)
|
|
69
|
-
})
|
|
70
|
-
|
|
71
|
-
it("renders the icon at the correct size", async () => {
|
|
51
|
+
it("renders the icon slots at the correct position", async () => {
|
|
72
52
|
const el = await fixture(
|
|
73
|
-
html` <leu-button
|
|
53
|
+
html` <leu-button
|
|
54
|
+
><leu-icon name="addBew" slot="before"></leu-icon>Sichern</leu-button
|
|
55
|
+
>`
|
|
74
56
|
)
|
|
75
57
|
|
|
76
58
|
const button = el.shadowRoot.querySelector("button")
|
|
77
59
|
|
|
78
60
|
expect(button).dom.to.equal(
|
|
79
|
-
"<button><
|
|
80
|
-
{ ignoreAttributes: ["
|
|
81
|
-
)
|
|
82
|
-
|
|
83
|
-
el.size = "small"
|
|
84
|
-
|
|
85
|
-
await elementUpdated(el)
|
|
86
|
-
|
|
87
|
-
expect(button).dom.to.equal(
|
|
88
|
-
"<button><div><svg width='16' height='16'><path /></svg></div><slot></slot></div>",
|
|
89
|
-
{ ignoreAttributes: ["d", "class", "type"] }
|
|
61
|
+
"<button><slot name='before'></slot><span><slot></slot></span><slot name='after'></slot></button>",
|
|
62
|
+
{ ignoreAttributes: ["class", "type"] }
|
|
90
63
|
)
|
|
91
64
|
})
|
|
92
65
|
|
|
93
66
|
it("renders the expanded icon only when the variant is ghost", async () => {
|
|
94
67
|
const el = await fixture(
|
|
95
|
-
html` <leu-button
|
|
96
|
-
>Sichern</leu-button
|
|
68
|
+
html` <leu-button variant="ghost" expanded="true"
|
|
69
|
+
><leu-icon name="addNew" slot="before"></leu-icon>Sichern</leu-button
|
|
97
70
|
>`
|
|
98
71
|
)
|
|
99
72
|
|
|
100
73
|
const button = el.shadowRoot.querySelector("button")
|
|
101
74
|
|
|
102
75
|
expect(button).dom.to.equal(
|
|
103
|
-
"<button
|
|
104
|
-
{ ignoreAttributes: ["
|
|
76
|
+
"<button aria-expanded='true'><slot name='before'></slot><span><slot></slot></span><slot name='after'></slot><div class='icon-wrapper icon-wrapper--expanded'><leu-icon name='angleDropDown' size='24'></leu-icon></div></button>",
|
|
77
|
+
{ ignoreAttributes: ["class", "type"] }
|
|
105
78
|
)
|
|
106
79
|
|
|
107
80
|
el.variant = "primary"
|
|
@@ -109,20 +82,17 @@ describe("LeuButton", () => {
|
|
|
109
82
|
await elementUpdated(el)
|
|
110
83
|
|
|
111
84
|
expect(button).dom.to.equal(
|
|
112
|
-
"<button class='primary regular'
|
|
113
|
-
{ ignoreAttributes: ["
|
|
85
|
+
"<button class='primary regular' aria-expanded='true'><slot name='before'></slot><span><slot></slot></span><slot name='after'></slot></button>",
|
|
86
|
+
{ ignoreAttributes: ["class", "type"] }
|
|
114
87
|
)
|
|
115
88
|
})
|
|
116
89
|
|
|
117
90
|
it("sets the dissabled attrbiute", async () => {
|
|
118
91
|
const el = await fixture(
|
|
119
|
-
html` <leu-button
|
|
120
|
-
icon="addNew"
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
expanded="true"
|
|
124
|
-
disabled
|
|
125
|
-
></leu-button>`
|
|
92
|
+
html` <leu-button variant="ghost" expanded="true" disabled>
|
|
93
|
+
<leu-icon name="addNew" slot="before"></leu-icon>
|
|
94
|
+
Sichern
|
|
95
|
+
</leu-button>`
|
|
126
96
|
)
|
|
127
97
|
|
|
128
98
|
const button = el.shadowRoot.querySelector("button")
|
|
@@ -137,11 +107,8 @@ describe("LeuButton", () => {
|
|
|
137
107
|
|
|
138
108
|
it("reflects the role attribute", async () => {
|
|
139
109
|
const el = await fixture(
|
|
140
|
-
html` <leu-button
|
|
141
|
-
icon="addNew"
|
|
142
|
-
variant="ghost"
|
|
143
|
-
componentRole="menuitemradio"
|
|
144
|
-
>Sichern</leu-button
|
|
110
|
+
html` <leu-button variant="ghost" componentRole="menuitemradio"
|
|
111
|
+
><leu-icon name="addNew" slot="before"></leu-icon>Sichern</leu-button
|
|
145
112
|
>`
|
|
146
113
|
)
|
|
147
114
|
|
|
@@ -152,12 +119,8 @@ describe("LeuButton", () => {
|
|
|
152
119
|
|
|
153
120
|
it("sets the either checked or selected attribute depending on the role", async () => {
|
|
154
121
|
const el = await fixture(
|
|
155
|
-
html` <leu-button
|
|
156
|
-
icon="addNew"
|
|
157
|
-
variant="ghost"
|
|
158
|
-
componentRole="menuitemradio"
|
|
159
|
-
active
|
|
160
|
-
>Sichern</leu-button
|
|
122
|
+
html` <leu-button variant="ghost" componentRole="menuitemradio" active
|
|
123
|
+
><leu-icon name="addNew" slot="before"></leu-icon>Sichern</leu-button
|
|
161
124
|
>`
|
|
162
125
|
)
|
|
163
126
|
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { html
|
|
1
|
+
import { html } from "lit"
|
|
2
|
+
import { LeuElement } from "../../lib/LeuElement.js"
|
|
3
|
+
|
|
2
4
|
// @ts-ignore
|
|
3
5
|
import styles from "./button-group.css"
|
|
4
6
|
|
|
@@ -8,7 +10,7 @@ import styles from "./button-group.css"
|
|
|
8
10
|
* @prop {string} value - The value of the currenty selected (active) button
|
|
9
11
|
* @fires input - When the value of the group changes by clicking a button
|
|
10
12
|
*/
|
|
11
|
-
export class LeuButtonGroup extends
|
|
13
|
+
export class LeuButtonGroup extends LeuElement {
|
|
12
14
|
static styles = styles
|
|
13
15
|
|
|
14
16
|
constructor() {
|
|
@@ -1,34 +1,40 @@
|
|
|
1
|
-
import { html
|
|
2
|
-
import { Icon } from "../icon/icon.js"
|
|
1
|
+
import { html } from "lit"
|
|
3
2
|
|
|
3
|
+
import { LeuElement } from "../../lib/LeuElement.js"
|
|
4
|
+
import { LeuIcon } from "../icon/Icon.js"
|
|
5
|
+
|
|
6
|
+
// @ts-ignore
|
|
4
7
|
import styles from "./checkbox.css"
|
|
5
8
|
|
|
6
9
|
/**
|
|
7
10
|
* @tagname leu-checkbox
|
|
8
11
|
*/
|
|
9
|
-
export class LeuCheckbox extends
|
|
12
|
+
export class LeuCheckbox extends LeuElement {
|
|
13
|
+
static dependencies = {
|
|
14
|
+
"leu-icon": LeuIcon,
|
|
15
|
+
}
|
|
16
|
+
|
|
10
17
|
static styles = styles
|
|
11
18
|
|
|
19
|
+
/** @internal */
|
|
12
20
|
static shadowRootOptions = {
|
|
13
|
-
...
|
|
21
|
+
...LeuElement.shadowRootOptions,
|
|
14
22
|
delegatesFocus: true,
|
|
15
23
|
}
|
|
16
24
|
|
|
17
25
|
static properties = {
|
|
18
26
|
checked: { type: Boolean, reflect: true },
|
|
19
27
|
disabled: { type: Boolean, reflect: true },
|
|
20
|
-
identifier: { type: String, reflect: true },
|
|
21
28
|
value: { type: String, reflect: true },
|
|
22
29
|
name: { type: String, reflect: true },
|
|
23
|
-
label: { type: String, reflect: true },
|
|
24
30
|
}
|
|
25
31
|
|
|
26
32
|
constructor() {
|
|
27
33
|
super()
|
|
28
34
|
this.checked = false
|
|
29
35
|
this.disabled = false
|
|
30
|
-
|
|
31
|
-
this.
|
|
36
|
+
this.name = ""
|
|
37
|
+
this.value = ""
|
|
32
38
|
}
|
|
33
39
|
|
|
34
40
|
handleChange(event) {
|
|
@@ -45,7 +51,7 @@ export class LeuCheckbox extends LitElement {
|
|
|
45
51
|
render() {
|
|
46
52
|
return html`
|
|
47
53
|
<input
|
|
48
|
-
id=${this.
|
|
54
|
+
id=${`checkbox-${this.name}`}
|
|
49
55
|
class="checkbox"
|
|
50
56
|
type="checkbox"
|
|
51
57
|
name="${this.name}"
|
|
@@ -55,8 +61,8 @@ export class LeuCheckbox extends LitElement {
|
|
|
55
61
|
?disabled=${this.disabled}
|
|
56
62
|
.value=${this.value}
|
|
57
63
|
/>
|
|
58
|
-
<label for=${this.
|
|
59
|
-
<
|
|
64
|
+
<label for=${`checkbox-${this.name}`} class="label"><slot></slot></label>
|
|
65
|
+
<leu-icon class="icon" name="check"></leu-icon>
|
|
60
66
|
`
|
|
61
67
|
}
|
|
62
68
|
}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import { html
|
|
1
|
+
import { html } from "lit"
|
|
2
2
|
import { classMap } from "lit/directives/class-map.js"
|
|
3
3
|
|
|
4
|
+
import { LeuElement } from "../../lib/LeuElement.js"
|
|
5
|
+
|
|
6
|
+
// @ts-ignore
|
|
4
7
|
import styles from "./checkbox-group.css"
|
|
5
8
|
|
|
6
9
|
/**
|
|
7
10
|
* @tagname leu-checkbox-group
|
|
8
11
|
*/
|
|
9
|
-
export class LeuCheckboxGroup extends
|
|
12
|
+
export class LeuCheckboxGroup extends LeuElement {
|
|
10
13
|
static styles = styles
|
|
11
14
|
|
|
12
15
|
static properties = {
|
|
@@ -29,7 +32,7 @@ export class LeuCheckboxGroup extends LitElement {
|
|
|
29
32
|
}
|
|
30
33
|
|
|
31
34
|
handleItems() {
|
|
32
|
-
this.items =
|
|
35
|
+
this.items = Array.from(this.querySelectorAll(":scope > *:not([slot])"))
|
|
33
36
|
}
|
|
34
37
|
|
|
35
38
|
render() {
|
|
@@ -27,32 +27,16 @@ function Template({ label, orientation }) {
|
|
|
27
27
|
orientation=${ifDefined(orientation)}
|
|
28
28
|
label=${ifDefined(label)}
|
|
29
29
|
>
|
|
30
|
-
<leu-checkbox
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
<leu-checkbox
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
name="checkbox-button"
|
|
41
|
-
label="Etwas Länger"
|
|
42
|
-
></leu-checkbox>
|
|
43
|
-
<leu-checkbox
|
|
44
|
-
identifier="3"
|
|
45
|
-
value="3"
|
|
46
|
-
name="checkbox-button"
|
|
47
|
-
disabled
|
|
48
|
-
label="Deaktiviert dazwischen"
|
|
49
|
-
></leu-checkbox>
|
|
50
|
-
<leu-checkbox
|
|
51
|
-
identifier="4"
|
|
52
|
-
value="4"
|
|
53
|
-
name="checkbox-button"
|
|
54
|
-
label="Ein langes Label um sicher ein umbruch zu erzwingen"
|
|
55
|
-
></leu-checkbox>
|
|
30
|
+
<leu-checkbox value="1" name="checkbox-button" disabled
|
|
31
|
+
>Kurz</leu-checkbox
|
|
32
|
+
>
|
|
33
|
+
<leu-checkbox value="2" name="checkbox-button">Etwas Länger</leu-checkbox>
|
|
34
|
+
<leu-checkbox value="3" name="checkbox-button" disabled
|
|
35
|
+
>Deaktiviert dazwischen</leu-checkbox
|
|
36
|
+
>
|
|
37
|
+
<leu-checkbox value="4" name="checkbox-button"
|
|
38
|
+
>Ein langes Label um sicher ein umbruch zu erzwingen</leu-checkbox
|
|
39
|
+
>
|
|
56
40
|
</leu-checkbox-group>
|
|
57
41
|
`
|
|
58
42
|
}
|
|
@@ -19,13 +19,8 @@ export default {
|
|
|
19
19
|
|
|
20
20
|
function Template({ label = "Label", value, checked, disabled }) {
|
|
21
21
|
return html`
|
|
22
|
-
<leu-checkbox
|
|
23
|
-
|
|
24
|
-
?checked=${checked}
|
|
25
|
-
?disabled=${disabled}
|
|
26
|
-
label=${label}
|
|
27
|
-
identifier="checkbox-1"
|
|
28
|
-
>
|
|
22
|
+
<leu-checkbox .value=${value} ?checked=${checked} ?disabled=${disabled}>
|
|
23
|
+
${label}
|
|
29
24
|
</leu-checkbox>
|
|
30
25
|
`
|
|
31
26
|
}
|
|
@@ -8,14 +8,9 @@ import "../leu-checkbox-group.js"
|
|
|
8
8
|
async function defaultFixture() {
|
|
9
9
|
return fixture(html`
|
|
10
10
|
<leu-checkbox-group>
|
|
11
|
-
<leu-checkbox
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
value="1"
|
|
15
|
-
disabled
|
|
16
|
-
></leu-checkbox>
|
|
17
|
-
<leu-checkbox label="Option 2" identifier="b" value="2"></leu-checkbox>
|
|
18
|
-
<leu-checkbox label="Option 3" identifier="c" value="3"></leu-checkbox>
|
|
11
|
+
<leu-checkbox value="1" disabled>Option 1</leu-checkbox>
|
|
12
|
+
<leu-checkbox value="2">Option 2</leu-checkbox>
|
|
13
|
+
<leu-checkbox value="3">Option 3</leu-checkbox>
|
|
19
14
|
</leu-checkbox-group>
|
|
20
15
|
`)
|
|
21
16
|
}
|
|
@@ -23,19 +18,9 @@ async function defaultFixture() {
|
|
|
23
18
|
async function checkedFixture() {
|
|
24
19
|
return fixture(html`
|
|
25
20
|
<leu-checkbox-group>
|
|
26
|
-
<leu-checkbox
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
value="1"
|
|
30
|
-
disabled
|
|
31
|
-
></leu-checkbox>
|
|
32
|
-
<leu-checkbox
|
|
33
|
-
label="Option 2"
|
|
34
|
-
identifier="b"
|
|
35
|
-
value="2"
|
|
36
|
-
checked
|
|
37
|
-
></leu-checkbox>
|
|
38
|
-
<leu-checkbox label="Option 3" identifier="c" value="3"></leu-checkbox>
|
|
21
|
+
<leu-checkbox value="1" disabled>Option 1</leu-checkbox>
|
|
22
|
+
<leu-checkbox value="2" checked>Option 2</leu-checkbox>
|
|
23
|
+
<leu-checkbox value="3">Option 3</leu-checkbox>
|
|
39
24
|
</leu-checkbox-group>
|
|
40
25
|
`)
|
|
41
26
|
}
|
|
@@ -6,11 +6,7 @@ import "../leu-checkbox.js"
|
|
|
6
6
|
|
|
7
7
|
async function defaultFixture() {
|
|
8
8
|
return fixture(html`
|
|
9
|
-
<leu-checkbox
|
|
10
|
-
identifier="b"
|
|
11
|
-
value="2"
|
|
12
|
-
label="Das ist ein Label"
|
|
13
|
-
></leu-checkbox>
|
|
9
|
+
<leu-checkbox value="2">Das ist ein Label</leu-checkbox>
|
|
14
10
|
`)
|
|
15
11
|
}
|
|
16
12
|
|
|
@@ -104,11 +100,4 @@ describe("LeuCheckbox", () => {
|
|
|
104
100
|
|
|
105
101
|
expect(event).to.exist
|
|
106
102
|
})
|
|
107
|
-
|
|
108
|
-
it("applies the identifier to the input and the label", async () => {
|
|
109
|
-
const el = await defaultFixture()
|
|
110
|
-
|
|
111
|
-
expect(el.shadowRoot.querySelector("input").id).to.equal("b")
|
|
112
|
-
expect(el.shadowRoot.querySelector("label").htmlFor).to.equal("b")
|
|
113
|
-
})
|
|
114
103
|
})
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LeuElement } from "../../lib/LeuElement.js"
|
|
2
|
+
|
|
3
|
+
// @ts-ignore
|
|
2
4
|
import styles from "./chip.css"
|
|
3
5
|
|
|
4
6
|
/* Design: https://www.figma.com/file/d6Pv21UVUbnBs3AdcZijHmbN/KTZH-Design-System?type=design&node-id=21161-184433&mode=design&t=Kjo5VDiqivihn8dh-11 */
|
|
5
7
|
|
|
6
|
-
export class LeuChipBase extends
|
|
8
|
+
export class LeuChipBase extends LeuElement {
|
|
7
9
|
static styles = styles
|
|
8
10
|
|
|
9
11
|
/** @internal */
|
|
10
12
|
static shadowRootOptions = {
|
|
11
|
-
...
|
|
13
|
+
...LeuElement.shadowRootOptions,
|
|
12
14
|
delegatesFocus: true,
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
static properties = {
|
|
16
18
|
inverted: { type: Boolean, reflect: true },
|
|
17
|
-
label: { type: String, reflect: true },
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
constructor() {
|