@statistikzh/leu 0.15.1 → 0.17.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 +14 -0
- package/dist/Accordion.js +1 -1
- package/dist/Button.js +1 -1
- package/dist/ButtonGroup.js +1 -1
- package/dist/ChartWrapper.js +1 -1
- package/dist/Checkbox.js +1 -1
- package/dist/CheckboxGroup.js +1 -1
- 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 +1 -1
- package/dist/Icon.js +1 -1
- package/dist/Input.js +1 -1
- package/dist/{LeuElement-B84x5CPL.js → LeuElement-BRZYxDjR.js} +1 -1
- package/dist/Menu.js +1 -1
- package/dist/MenuItem.js +1 -1
- package/dist/Message.d.ts +63 -0
- package/dist/Message.js +268 -0
- package/dist/Pagination.js +1 -1
- package/dist/Placeholder.js +1 -1
- package/dist/Popup.js +1 -1
- package/dist/Radio.js +1 -1
- package/dist/RadioGroup.js +1 -1
- package/dist/Range.js +1 -1
- package/dist/ScrollTop.js +1 -1
- package/dist/Select.js +1 -1
- package/dist/Spinner.js +1 -1
- package/dist/Table.js +1 -1
- package/dist/Tag.d.ts +17 -0
- package/dist/Tag.js +75 -0
- package/dist/VisuallyHidden.js +1 -1
- package/dist/components/message/Message.d.ts +59 -0
- package/dist/components/message/Message.d.ts.map +1 -0
- package/dist/components/message/leu-message.d.ts +3 -0
- package/dist/components/message/leu-message.d.ts.map +1 -0
- package/dist/components/message/stories/message.stories.d.ts +179 -0
- package/dist/components/message/stories/message.stories.d.ts.map +1 -0
- package/dist/components/message/test/message.test.d.ts +2 -0
- package/dist/components/message/test/message.test.d.ts.map +1 -0
- package/dist/components/tag/Tag.d.ts +13 -0
- package/dist/components/tag/Tag.d.ts.map +1 -0
- package/dist/components/tag/leu-tag.d.ts +3 -0
- package/dist/components/tag/leu-tag.d.ts.map +1 -0
- package/dist/components/tag/stories/tag.stories.d.ts +136 -0
- package/dist/components/tag/stories/tag.stories.d.ts.map +1 -0
- package/dist/components/tag/test/tag.test.d.ts +2 -0
- package/dist/components/tag/test/tag.test.d.ts.map +1 -0
- package/dist/index.js +1 -1
- package/dist/leu-accordion.js +1 -1
- package/dist/leu-button-group.js +1 -1
- package/dist/leu-button.js +1 -1
- package/dist/leu-chart-wrapper.js +1 -1
- 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 +1 -1
- package/dist/leu-dropdown.js +1 -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-message.d.ts +5 -0
- package/dist/leu-message.js +12 -0
- package/dist/leu-pagination.js +1 -1
- package/dist/leu-placeholder.js +1 -1
- 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 +1 -1
- package/dist/leu-select.js +1 -1
- package/dist/leu-spinner.js +1 -1
- package/dist/leu-table.js +1 -1
- package/dist/leu-tag.d.ts +4 -0
- package/dist/leu-tag.js +9 -0
- package/dist/leu-visually-hidden.js +1 -1
- package/dist/vscode.html-custom-data.json +68 -11
- package/dist/vue/index.d.ts +72 -20
- package/dist/web-types.json +137 -28
- package/package.json +1 -1
- package/src/components/message/Message.ts +118 -0
- package/src/components/message/leu-message.ts +5 -0
- package/src/components/message/message.css +163 -0
- package/src/components/message/stories/message.mdx +76 -0
- package/src/components/message/stories/message.stories.ts +149 -0
- package/src/components/message/test/message.test.ts +96 -0
- package/src/components/tag/Tag.ts +28 -0
- package/src/components/tag/leu-tag.ts +5 -0
- package/src/components/tag/stories/tag.stories.ts +107 -0
- package/src/components/tag/tag.css +42 -0
- package/src/components/tag/test/tag.test.ts +28 -0
- package/src/docs/theme.mdx +49 -2
- package/src/styles/custom-media.css +1 -0
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/web-components"
|
|
2
|
+
import { html, TemplateResult } from "lit"
|
|
3
|
+
import { action } from "@storybook/addon-actions"
|
|
4
|
+
|
|
5
|
+
import "../leu-message.js"
|
|
6
|
+
import "../../button/leu-button.js"
|
|
7
|
+
import { LeuMessage } from "../Message.js"
|
|
8
|
+
|
|
9
|
+
type StoryArgs = LeuMessage
|
|
10
|
+
type Story = StoryObj<StoryArgs>
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
title: "Components/Message",
|
|
14
|
+
component: "leu-message",
|
|
15
|
+
parameters: {
|
|
16
|
+
design: {
|
|
17
|
+
type: "figma",
|
|
18
|
+
url: "https://www.figma.com/design/d6Pv21UVUbnBs3AdcZijHmbN/KTZH-Design-System?node-id=316-4172&p=f&t=RVDlqNcmiHHiwE5P-11",
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
argTypes: {
|
|
22
|
+
type: {
|
|
23
|
+
control: "select",
|
|
24
|
+
options: ["error", "success", "info", "warning"],
|
|
25
|
+
},
|
|
26
|
+
size: {
|
|
27
|
+
control: "select",
|
|
28
|
+
options: ["regular", "large"],
|
|
29
|
+
},
|
|
30
|
+
"--leu-message-accent-color": {
|
|
31
|
+
control: {
|
|
32
|
+
type: "color",
|
|
33
|
+
presetColors: [
|
|
34
|
+
"#0076bd",
|
|
35
|
+
"#00407c",
|
|
36
|
+
"#00797b",
|
|
37
|
+
"#1a7f1f",
|
|
38
|
+
"#b01657",
|
|
39
|
+
"#d40053",
|
|
40
|
+
"#7f3da7",
|
|
41
|
+
"#666666",
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
args: {
|
|
47
|
+
type: "success",
|
|
48
|
+
size: "regular",
|
|
49
|
+
removable: true,
|
|
50
|
+
onRemove: action("leu:remove"),
|
|
51
|
+
},
|
|
52
|
+
} satisfies Meta<StoryArgs>
|
|
53
|
+
|
|
54
|
+
const baseRender =
|
|
55
|
+
(messageContent: (args: StoryArgs) => TemplateResult) => (args: StoryArgs) =>
|
|
56
|
+
html` <leu-message
|
|
57
|
+
style="--leu-message-accent-color: ${args["--leu-message-accent-color"] ??
|
|
58
|
+
"unset"};"
|
|
59
|
+
type=${args.type}
|
|
60
|
+
size=${args.size}
|
|
61
|
+
?removable=${args.removable}
|
|
62
|
+
?popup=${args.popup}
|
|
63
|
+
@leu:remove=${args.onRemove}
|
|
64
|
+
>
|
|
65
|
+
${messageContent(args)}
|
|
66
|
+
</leu-message>`
|
|
67
|
+
|
|
68
|
+
const Template: Story = {
|
|
69
|
+
render: baseRender(
|
|
70
|
+
(args) =>
|
|
71
|
+
html`<strong>Nachricht Titel</strong><br />
|
|
72
|
+
Beschreibungstext einer Nachricht
|
|
73
|
+
<leu-button
|
|
74
|
+
slot="cta"
|
|
75
|
+
variant="secondary"
|
|
76
|
+
size="small"
|
|
77
|
+
?inverted=${args.type === "error" || args.type === "success"}
|
|
78
|
+
>
|
|
79
|
+
Rückgängig
|
|
80
|
+
</leu-button>`,
|
|
81
|
+
),
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export const Success = {
|
|
85
|
+
...Template,
|
|
86
|
+
args: {
|
|
87
|
+
type: "success",
|
|
88
|
+
size: "large",
|
|
89
|
+
},
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export const Error = {
|
|
93
|
+
...Template,
|
|
94
|
+
args: {
|
|
95
|
+
type: "error",
|
|
96
|
+
size: "large",
|
|
97
|
+
},
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export const Warning = {
|
|
101
|
+
...Template,
|
|
102
|
+
args: {
|
|
103
|
+
type: "warning",
|
|
104
|
+
size: "large",
|
|
105
|
+
},
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export const Info = {
|
|
109
|
+
...Template,
|
|
110
|
+
render: baseRender(
|
|
111
|
+
() =>
|
|
112
|
+
html`<strong>Nachricht Titel</strong><br />
|
|
113
|
+
Beschreibungstext einer Nachricht`,
|
|
114
|
+
),
|
|
115
|
+
args: {
|
|
116
|
+
type: "info",
|
|
117
|
+
size: "large",
|
|
118
|
+
},
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export const CustomColor = {
|
|
122
|
+
...Template,
|
|
123
|
+
render: baseRender(
|
|
124
|
+
() =>
|
|
125
|
+
html`<strong>Entscheid wurde auf den 21.12.2024 verschoben</strong><br />
|
|
126
|
+
Aufgrund ausstehender Abklärungen wurde der Termin verschoben.`,
|
|
127
|
+
),
|
|
128
|
+
args: {
|
|
129
|
+
type: "info",
|
|
130
|
+
size: "large",
|
|
131
|
+
"--message-accent-color": "#00797b",
|
|
132
|
+
},
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export const Small = {
|
|
136
|
+
...Template,
|
|
137
|
+
render: baseRender(() => html`Nachricht ohne Titel`),
|
|
138
|
+
args: {
|
|
139
|
+
type: "success",
|
|
140
|
+
},
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export const Popup = {
|
|
144
|
+
...Small,
|
|
145
|
+
args: {
|
|
146
|
+
...Small.args,
|
|
147
|
+
popup: true,
|
|
148
|
+
},
|
|
149
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { html } from "lit"
|
|
2
|
+
import { fixture, expect, oneEvent } from "@open-wc/testing"
|
|
3
|
+
|
|
4
|
+
import "../leu-message.js"
|
|
5
|
+
import { LeuMessage } from "../Message.js"
|
|
6
|
+
import { LeuIcon } from "../../icon/Icon.js"
|
|
7
|
+
|
|
8
|
+
async function defaultFixture({ removable = false } = {}): Promise<LeuMessage> {
|
|
9
|
+
return fixture(
|
|
10
|
+
html`<leu-message ?removable=${removable}>
|
|
11
|
+
<strong>Entscheid wurde auf den 21.12.2024 verschoben</strong><br />
|
|
12
|
+
Aufgrund ausstehender Abklärungen wurde der Termin verschoben.
|
|
13
|
+
</leu-message>`,
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
describe("LeuMessage", () => {
|
|
18
|
+
it("is a defined element", async () => {
|
|
19
|
+
const el = customElements.get("leu-message")
|
|
20
|
+
|
|
21
|
+
expect(el).not.to.be.undefined
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
it("passes the a11y audit", async () => {
|
|
25
|
+
const el = await defaultFixture()
|
|
26
|
+
|
|
27
|
+
await expect(el).shadowDom.to.be.accessible()
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
it("renders the message content", async () => {
|
|
31
|
+
const el = await defaultFixture()
|
|
32
|
+
|
|
33
|
+
expect(el).to.contain.text("Entscheid wurde auf den 21.12.2024 verschoben")
|
|
34
|
+
|
|
35
|
+
expect(el).to.contain.text(
|
|
36
|
+
"Aufgrund ausstehender Abklärungen wurde der Termin verschoben.",
|
|
37
|
+
)
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
it("renders the remove button according to its 'removable' property", async () => {
|
|
41
|
+
const el = await defaultFixture({ removable: true })
|
|
42
|
+
|
|
43
|
+
let removeButton = el.shadowRoot?.querySelector(".message__remove")
|
|
44
|
+
|
|
45
|
+
expect(removeButton).to.exist
|
|
46
|
+
|
|
47
|
+
el.removable = false
|
|
48
|
+
await el.updateComplete
|
|
49
|
+
|
|
50
|
+
removeButton = el.shadowRoot?.querySelector(".message__remove")
|
|
51
|
+
|
|
52
|
+
expect(removeButton).to.not.exist
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
it("dispatches 'leu:remove' event when remove button is clicked", async () => {
|
|
56
|
+
const el = await defaultFixture({ removable: true })
|
|
57
|
+
|
|
58
|
+
const button = el.shadowRoot?.querySelector(
|
|
59
|
+
".message__remove",
|
|
60
|
+
) as HTMLButtonElement
|
|
61
|
+
|
|
62
|
+
setTimeout(() => button.click())
|
|
63
|
+
|
|
64
|
+
const event = await oneEvent(el, "leu:remove", false)
|
|
65
|
+
|
|
66
|
+
expect(event).to.exist
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
it("renders the correct icon based on the type", async () => {
|
|
70
|
+
const el = await defaultFixture()
|
|
71
|
+
|
|
72
|
+
const icon = el.shadowRoot?.querySelector(".message__icon") as LeuIcon
|
|
73
|
+
|
|
74
|
+
expect(icon).to.exist
|
|
75
|
+
|
|
76
|
+
el.type = "success"
|
|
77
|
+
await el.updateComplete
|
|
78
|
+
|
|
79
|
+
expect(icon.name).to.equal("confirm")
|
|
80
|
+
|
|
81
|
+
el.type = "error"
|
|
82
|
+
await el.updateComplete
|
|
83
|
+
|
|
84
|
+
expect(icon.name).to.equal("caution")
|
|
85
|
+
|
|
86
|
+
el.type = "info"
|
|
87
|
+
await el.updateComplete
|
|
88
|
+
|
|
89
|
+
expect(icon.name).to.equal("getInformation")
|
|
90
|
+
|
|
91
|
+
el.type = "warning"
|
|
92
|
+
await el.updateComplete
|
|
93
|
+
|
|
94
|
+
expect(icon.name).to.equal("caution")
|
|
95
|
+
})
|
|
96
|
+
})
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { html } from "lit"
|
|
2
|
+
import { property } from "lit/decorators.js"
|
|
3
|
+
|
|
4
|
+
import { LeuElement } from "../../lib/LeuElement.js"
|
|
5
|
+
|
|
6
|
+
import styles from "./tag.css"
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @tagname leu-tag
|
|
10
|
+
* @cssprop --leu-tag-accent-color - The color of the tag
|
|
11
|
+
* @slot default - The label of the tag
|
|
12
|
+
* @slot icon - An icon to display in the tag
|
|
13
|
+
*/
|
|
14
|
+
export class LeuTag extends LeuElement {
|
|
15
|
+
static styles = [LeuElement.styles, styles]
|
|
16
|
+
|
|
17
|
+
@property({ type: String })
|
|
18
|
+
variant: "solid" | "outline" | "ghost" = "solid"
|
|
19
|
+
|
|
20
|
+
render() {
|
|
21
|
+
return html`
|
|
22
|
+
<div class="tag tag--${this.variant}">
|
|
23
|
+
<slot class="tag__icon" name="icon"></slot>
|
|
24
|
+
<slot class="tag__label"></slot>
|
|
25
|
+
</div>
|
|
26
|
+
`
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/web-components"
|
|
2
|
+
import { html } from "lit"
|
|
3
|
+
import { ifDefined } from "lit/directives/if-defined.js"
|
|
4
|
+
|
|
5
|
+
import "../leu-tag.js"
|
|
6
|
+
import "../../icon/leu-icon.js"
|
|
7
|
+
import { LeuTag } from "../Tag.js"
|
|
8
|
+
|
|
9
|
+
import { paths as iconPaths } from "../../icon/paths.js"
|
|
10
|
+
|
|
11
|
+
type StoryArgs = LeuTag
|
|
12
|
+
type Story = StoryObj<StoryArgs>
|
|
13
|
+
|
|
14
|
+
export default {
|
|
15
|
+
title: "Components/Tag",
|
|
16
|
+
component: "leu-tag",
|
|
17
|
+
parameters: {
|
|
18
|
+
design: {
|
|
19
|
+
type: "figma",
|
|
20
|
+
url: "https://www.figma.com/design/d6Pv21UVUbnBs3AdcZijHmbN/KTZH-Design-System?node-id=21161-184432&t=QMYWpoD4FMWFrUkK-11",
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
argTypes: {
|
|
24
|
+
variant: {
|
|
25
|
+
control: "select",
|
|
26
|
+
options: ["solid", "outline", "ghost"],
|
|
27
|
+
},
|
|
28
|
+
"--leu-tag-accent-color": {
|
|
29
|
+
control: {
|
|
30
|
+
type: "color",
|
|
31
|
+
presetColors: [
|
|
32
|
+
"#0076bd",
|
|
33
|
+
"#00407c",
|
|
34
|
+
"#00797b",
|
|
35
|
+
"#1a7f1f",
|
|
36
|
+
"#b01657",
|
|
37
|
+
"#d40053",
|
|
38
|
+
"#7f3da7",
|
|
39
|
+
"#666666",
|
|
40
|
+
"#009ee0",
|
|
41
|
+
"#d93c1a",
|
|
42
|
+
"#1a7f1f",
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
icon: { control: "select", options: Object.keys(iconPaths) },
|
|
47
|
+
},
|
|
48
|
+
args: {
|
|
49
|
+
variant: "solid",
|
|
50
|
+
icon: "confirm",
|
|
51
|
+
default: "Abgeschlossen",
|
|
52
|
+
"--leu-tag-accent-color": "#7f3da7",
|
|
53
|
+
},
|
|
54
|
+
} satisfies Meta<StoryArgs>
|
|
55
|
+
|
|
56
|
+
const Template: Story = {
|
|
57
|
+
render: (args: StoryArgs) =>
|
|
58
|
+
html` <leu-tag
|
|
59
|
+
variant=${ifDefined(args.variant)}
|
|
60
|
+
style="--leu-tag-accent-color: ${args["--leu-tag-accent-color"] ??
|
|
61
|
+
"unset"}"
|
|
62
|
+
>
|
|
63
|
+
${args.icon
|
|
64
|
+
? html`<leu-icon slot="icon" name=${args.icon}></leu-icon>`
|
|
65
|
+
: ""}
|
|
66
|
+
${args.default}</leu-tag
|
|
67
|
+
>`,
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export const Solid = {
|
|
71
|
+
...Template,
|
|
72
|
+
args: {
|
|
73
|
+
variant: "solid",
|
|
74
|
+
},
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export const Outline = {
|
|
78
|
+
...Template,
|
|
79
|
+
args: {
|
|
80
|
+
variant: "outline",
|
|
81
|
+
},
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export const Ghost = {
|
|
85
|
+
...Template,
|
|
86
|
+
args: {
|
|
87
|
+
variant: "ghost",
|
|
88
|
+
},
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export const Warning = {
|
|
92
|
+
...Template,
|
|
93
|
+
args: {
|
|
94
|
+
variant: "solid",
|
|
95
|
+
"--leu-tag-accent-color": "#d93c1a",
|
|
96
|
+
default: "Abgelaufen",
|
|
97
|
+
},
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export const NoIcon = {
|
|
101
|
+
...Template,
|
|
102
|
+
args: {
|
|
103
|
+
variant: "solid",
|
|
104
|
+
"--leu-tag-accent-color": "#7f3da7",
|
|
105
|
+
icon: undefined,
|
|
106
|
+
},
|
|
107
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
/* --tag-font-regular: var(--leu-font-family-regular);
|
|
3
|
+
--tag-font-black: var(--leu-font-family-black);
|
|
4
|
+
|
|
5
|
+
font-family: var(--tag-font-regular); */
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.tag {
|
|
9
|
+
--_accent-color: var(--leu-tag-accent-color, var(--leu-color-black-60));
|
|
10
|
+
|
|
11
|
+
display: inline-flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
padding: 0.25rem 0.5rem;
|
|
14
|
+
gap: 0.25rem;
|
|
15
|
+
border-radius: 0.25rem;
|
|
16
|
+
|
|
17
|
+
background-color: var(--_accent-color);
|
|
18
|
+
border: 2px solid var(--_accent-color);
|
|
19
|
+
color: var(--leu-color-black-0);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.tag--outline {
|
|
23
|
+
background-color: transparent;
|
|
24
|
+
border-color: var(--_accent-color);
|
|
25
|
+
color: var(--_accent-color);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.tag--ghost {
|
|
29
|
+
background-color: transparent;
|
|
30
|
+
border-color: transparent;
|
|
31
|
+
color: var(--_accent-color);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.tag__icon {
|
|
35
|
+
--leu-icon-size: 1rem;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.tag__label {
|
|
39
|
+
display: block;
|
|
40
|
+
font: var(--leu-t-tiny-regular-font);
|
|
41
|
+
line-height: 1rem;
|
|
42
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { html } from "lit"
|
|
2
|
+
import { fixture, expect } from "@open-wc/testing"
|
|
3
|
+
|
|
4
|
+
import "../leu-tag.js"
|
|
5
|
+
|
|
6
|
+
async function defaultFixture() {
|
|
7
|
+
return fixture(html`<leu-tag>Abgeschlossen</leu-tag>`)
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
describe("LeuTag", () => {
|
|
11
|
+
it("is a defined element", async () => {
|
|
12
|
+
const el = customElements.get("leu-tag")
|
|
13
|
+
|
|
14
|
+
expect(el).not.to.be.undefined
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
it("passes the a11y audit", async () => {
|
|
18
|
+
const el = await defaultFixture()
|
|
19
|
+
|
|
20
|
+
await expect(el).shadowDom.to.be.accessible()
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
it("renders with default slot content", async () => {
|
|
24
|
+
const el = await defaultFixture()
|
|
25
|
+
|
|
26
|
+
expect(el).to.have.trimmed.text("Abgeschlossen")
|
|
27
|
+
})
|
|
28
|
+
})
|
package/src/docs/theme.mdx
CHANGED
|
@@ -59,6 +59,7 @@ This is helpful if you want to use the it to style your application or to build
|
|
|
59
59
|
## Table of Contents
|
|
60
60
|
|
|
61
61
|
- [Design System](#design-system)
|
|
62
|
+
- [Quick start](#quick-start)
|
|
62
63
|
- [Structure of the file](#structure-of-the-file)
|
|
63
64
|
- [Custom property naming](#custom-property-naming)
|
|
64
65
|
- [Colors](#colors)
|
|
@@ -75,6 +76,50 @@ The theme is based on the official [design system](https://www.zh.ch/de/webangeb
|
|
|
75
76
|
Currently there is no automatic workflow that generates the theme from the design system. The theme is manually updated when the design system changes.
|
|
76
77
|
If you spot any inconsistencies between the theme and the design system, please open an issue.
|
|
77
78
|
|
|
79
|
+
## Quick start
|
|
80
|
+
|
|
81
|
+
The following css snippet is a good starting point when you want to use the theme to style your application.
|
|
82
|
+
Details about the specific definitions can be found in the content below.
|
|
83
|
+
|
|
84
|
+
```css
|
|
85
|
+
html {
|
|
86
|
+
font-family: var(--leu-font-family-regular);
|
|
87
|
+
font-feature-settings: var(--leu-t-font-feature-settings);
|
|
88
|
+
|
|
89
|
+
/* Prevent browser from synthesizing font weights */
|
|
90
|
+
font-synthesis-weight: none;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
strong {
|
|
94
|
+
font-family: var(--leu-font-family-black);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/* Heading style mapping. Use whatever selector make sense in your project. */
|
|
98
|
+
h1 {
|
|
99
|
+
font: var(--leu-t-curve-huge-black-font);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
h2 {
|
|
103
|
+
font: var(--leu-t-curve-large-black-font);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
h3 {
|
|
107
|
+
font: var(--leu-t-curve-medium-black-font);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
h4 {
|
|
111
|
+
font: var(--leu-t-curve-regular-black-font);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/*
|
|
115
|
+
* Prevent "Flash of Unstyled Custom Elements" (FOUCE)
|
|
116
|
+
* https://www.abeautifulsite.net/posts/flash-of-undefined-custom-elements
|
|
117
|
+
*/
|
|
118
|
+
:not(:defined) {
|
|
119
|
+
visibility: hidden;
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
78
123
|
## Structure of the file
|
|
79
124
|
|
|
80
125
|
The theme contains custom properties for:
|
|
@@ -175,6 +220,8 @@ box-shadow: var(--leu-box-shadow-short);
|
|
|
175
220
|
|
|
176
221
|
## z-index
|
|
177
222
|
|
|
223
|
+
TODO
|
|
224
|
+
|
|
178
225
|
## Typography
|
|
179
226
|
|
|
180
227
|
The design system is based on the [Inter](https://rsms.me/inter/) font family. It just uses the `regular` and `black` weights.
|
|
@@ -306,9 +353,9 @@ h1 {
|
|
|
306
353
|
|
|
307
354
|
As the theme only consist of custom properties, it isn't possible to provide a full set of grid classes.
|
|
308
355
|
Instead the theme contains just five necessary values that can be applied directly.
|
|
356
|
+
This approach helps us to keep the css footprint as small as possible.
|
|
309
357
|
Most components don't need a grid anyway and those who do mostly have a very simple configuration.
|
|
310
|
-
Alternatively you can use to build your own classes
|
|
311
|
-
This aproach helps us to keep the css footprint small.
|
|
358
|
+
Alternatively you can use the variables to build your own classes. You can find a possible implementation in this [GitHub Gist](https://gist.github.com/daenub/735d657cc0bf297e9a7d2015f003084c).
|
|
312
359
|
|
|
313
360
|
The official design system uses a 6 columns system on smaller screens.
|
|
314
361
|
For simplicity we use a 12 column grid for all breakpoints.
|