@statistikzh/leu 0.15.0 → 0.16.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 +16 -0
- package/dist/Accordion.js +1 -1
- package/dist/Button.js +1 -1
- package/dist/ButtonGroup.js +1 -1
- package/dist/ChartWrapper.js +40 -29
- 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-BhAmogDy.js → LeuElement-C0BZ_nPB.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/VisuallyHidden.js +1 -1
- package/dist/components/{visualization → chart-wrapper}/ChartWrapper.d.ts.map +1 -1
- package/dist/components/{visualization → chart-wrapper}/leu-chart-wrapper.d.ts.map +1 -1
- package/dist/components/{visualization → chart-wrapper}/stories/chart-wrapper.stories.d.ts +19 -0
- package/dist/components/{visualization → chart-wrapper}/stories/chart-wrapper.stories.d.ts.map +1 -1
- package/dist/components/chart-wrapper/test/chart-wrapper.test.d.ts.map +1 -0
- 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/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -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-visually-hidden.js +1 -1
- package/dist/theme.css +18 -18
- package/dist/vscode.html-custom-data.json +54 -17
- package/dist/vue/index.d.ts +55 -23
- package/dist/web-types.json +125 -44
- package/package.json +1 -1
- package/release-please-config.json +1 -0
- package/scripts/postcss-leu-font-styles.cjs +10 -10
- package/src/components/{visualization → chart-wrapper}/ChartWrapper.ts +13 -10
- package/src/components/{visualization → chart-wrapper}/chart-wrapper.css +20 -11
- package/src/components/{visualization → chart-wrapper}/stories/chart-wrapper.stories.ts +7 -1
- package/src/components/{visualization → chart-wrapper}/test/chart-wrapper.test.ts +13 -10
- 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/docs/contributing.mdx +1 -1
- package/src/index.ts +1 -0
- package/src/styles/custom-media.css +1 -0
- package/src/styles/theme.css +89 -1
- package/dist/components/visualization/test/chart-wrapper.test.d.ts.map +0 -1
- package/src/styles/custom-properties.css +0 -89
- /package/dist/components/{visualization → chart-wrapper}/ChartWrapper.d.ts +0 -0
- /package/dist/components/{visualization → chart-wrapper}/leu-chart-wrapper.d.ts +0 -0
- /package/dist/components/{visualization → chart-wrapper}/test/chart-wrapper.test.d.ts +0 -0
- /package/src/components/{visualization → chart-wrapper}/leu-chart-wrapper.ts +0 -0
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
@import url("../../styles/custom-media.css");
|
|
2
|
+
|
|
3
|
+
:host {
|
|
4
|
+
font-family: var(--leu-font-family-regular);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.message {
|
|
8
|
+
position: relative;
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-flow: row nowrap;
|
|
11
|
+
align-items: center;
|
|
12
|
+
|
|
13
|
+
padding: var(--_padding);
|
|
14
|
+
border-radius: 0.25rem;
|
|
15
|
+
overflow: hidden;
|
|
16
|
+
|
|
17
|
+
background-color: var(--leu-color-black-0);
|
|
18
|
+
color: var(--_accent-color);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.message::before {
|
|
22
|
+
content: "";
|
|
23
|
+
position: absolute;
|
|
24
|
+
inset-block-start: 0;
|
|
25
|
+
inset-inline-start: 0;
|
|
26
|
+
width: 0.25rem;
|
|
27
|
+
height: 100%;
|
|
28
|
+
background-color: var(--_accent-color);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.message--error {
|
|
32
|
+
--_accent-color: var(--leu-message-accent-color, var(--leu-color-func-red));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.message--warning {
|
|
36
|
+
--_accent-color: var(--leu-message-accent-color, var(--leu-color-func-red));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.message--success {
|
|
40
|
+
--_accent-color: var(--leu-message-accent-color, var(--leu-color-func-green));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.message--info {
|
|
44
|
+
--_accent-color: var(
|
|
45
|
+
--leu-message-accent-color,
|
|
46
|
+
var(--leu-color-accent-violet)
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.message--filled {
|
|
51
|
+
background-color: var(--_accent-color);
|
|
52
|
+
color: var(--leu-color-black-0);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.message--filled::before {
|
|
56
|
+
content: none;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.message--regular {
|
|
60
|
+
--_padding: 0.75rem;
|
|
61
|
+
--_icon-size: 24px;
|
|
62
|
+
|
|
63
|
+
@media (--viewport-large) {
|
|
64
|
+
--_padding: 1rem;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.message--large {
|
|
69
|
+
--_padding: 1rem;
|
|
70
|
+
--_icon-size: 32px;
|
|
71
|
+
|
|
72
|
+
@media (--viewport-small-max) {
|
|
73
|
+
flex-flow: column;
|
|
74
|
+
align-items: start;
|
|
75
|
+
gap: 0.75rem;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@media (--viewport-regular) {
|
|
79
|
+
--_padding: 1.25rem;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
@media (--viewport-large) {
|
|
83
|
+
--_padding: 1.5rem;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.message--popup {
|
|
88
|
+
box-shadow: var(--leu-box-shadow-regular);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.message__icon {
|
|
92
|
+
--leu-icon-size: var(--_icon-size);
|
|
93
|
+
|
|
94
|
+
display: block;
|
|
95
|
+
flex: 0 0 min-content;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.message__content {
|
|
99
|
+
flex: 1 1 auto;
|
|
100
|
+
font: var(--leu-t-curve-small-regular-font);
|
|
101
|
+
margin: 0 0.5rem;
|
|
102
|
+
|
|
103
|
+
@media (--viewport-regular) {
|
|
104
|
+
margin-inline: 0.75rem;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
@media (--viewport-large) {
|
|
108
|
+
margin-inline: 1rem;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.message--large .message__content {
|
|
113
|
+
@media (--viewport-small-max) {
|
|
114
|
+
margin-inline: 0;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.message__content ::slotted(strong) {
|
|
119
|
+
font-family: var(--leu-font-family-black);
|
|
120
|
+
font-weight: normal;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.message__cta {
|
|
124
|
+
display: block;
|
|
125
|
+
flex: 0 0 min-content;
|
|
126
|
+
margin-inline-end: 0.5rem;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.message__remove {
|
|
130
|
+
flex: 0 0 min-content;
|
|
131
|
+
border: none;
|
|
132
|
+
background: none;
|
|
133
|
+
padding: 0;
|
|
134
|
+
color: var(--leu-color-black-60);
|
|
135
|
+
cursor: pointer;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.message__remove:where(:hover, :focus-visible) {
|
|
139
|
+
color: var(--leu-color-black-40);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.message--filled .message__remove {
|
|
143
|
+
color: var(--leu-color-black-0);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.message--filled .message__remove:where(:hover, :focus-visible) {
|
|
147
|
+
color: var(--leu-color-white-transp-70);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.message--large .message__remove {
|
|
151
|
+
position: absolute;
|
|
152
|
+
inset-block-start: var(--_padding);
|
|
153
|
+
inset-inline-end: var(--_padding);
|
|
154
|
+
|
|
155
|
+
@media (--viewport-regular) {
|
|
156
|
+
position: static;
|
|
157
|
+
inset: auto;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.message__remove-icon {
|
|
162
|
+
--leu-icon-size: 1.5rem;
|
|
163
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { Canvas, Meta, Controls } from "@storybook/addon-docs/blocks"
|
|
2
|
+
|
|
3
|
+
import * as MessageStories from "./message.stories"
|
|
4
|
+
|
|
5
|
+
<Meta of={MessageStories} />
|
|
6
|
+
|
|
7
|
+
# Message
|
|
8
|
+
|
|
9
|
+
A message component that can be used to display feedback, alerts, or important information to the user.
|
|
10
|
+
|
|
11
|
+
[Meldungen | Design System | zh.ch](https://www.zh.ch/de/webangebote-entwickeln-und-gestalten/inhalt/designsystem/komponenten/meldungen.zhweb-noredirect.zhweb-cache.html?node-id=18369%3A164719&node-id=18369%3A163396&node-id=18369%3A166594&search=meldung) <br />
|
|
12
|
+
|
|
13
|
+
## Background
|
|
14
|
+
|
|
15
|
+
The message can appear with a colored background or with a white background. The appearance depends on the `type` attribute:
|
|
16
|
+
|
|
17
|
+
`success` and `warning` will have a colored background.
|
|
18
|
+
|
|
19
|
+
<Canvas of={MessageStories.Success} />
|
|
20
|
+
<Canvas of={MessageStories.Error} />
|
|
21
|
+
|
|
22
|
+
While `error` and `info` will have a white background.
|
|
23
|
+
|
|
24
|
+
<Canvas of={MessageStories.Warning} />
|
|
25
|
+
<Canvas of={MessageStories.Info} />
|
|
26
|
+
|
|
27
|
+
## Content
|
|
28
|
+
|
|
29
|
+
The text content can simply be passed into the default slot. The optional title of the message has to be marked up with a `<strong>` tag.
|
|
30
|
+
|
|
31
|
+
```html
|
|
32
|
+
<leu-message>
|
|
33
|
+
<strong>Title of the message</strong><br />
|
|
34
|
+
This is the content of the message. It can span multiple lines.
|
|
35
|
+
</leu-message>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Size
|
|
39
|
+
|
|
40
|
+
The message component can be rendered in two sizes: `small` and `large`.
|
|
41
|
+
The `small` size does not allow for a call to action button and a title.
|
|
42
|
+
|
|
43
|
+
## Call to action button
|
|
44
|
+
|
|
45
|
+
A call to action button can added to the message by using the `cta` slot. This is only allowed for the `large` size.
|
|
46
|
+
Be aware that you have to set the `inverted` attribute on the button if you use it on a colored background.
|
|
47
|
+
The component does not handle any events of the button.
|
|
48
|
+
|
|
49
|
+
## Remove button
|
|
50
|
+
|
|
51
|
+
With setting the `removable` attribute, a close button will be displayed in the top right corner of the message.
|
|
52
|
+
The component does not remove itself from the DOM, but it will dispatch a `leu:remove` event when the close button is clicked.
|
|
53
|
+
|
|
54
|
+
## Popup / Toast
|
|
55
|
+
|
|
56
|
+
If you use the message as a toast or lay it over other content, you can set the `popup` attribute.
|
|
57
|
+
This will add box shadow to the message.
|
|
58
|
+
|
|
59
|
+
<Canvas of={MessageStories.Popup} />
|
|
60
|
+
|
|
61
|
+
## Custom accent colored
|
|
62
|
+
|
|
63
|
+
While `success`, `warning`, and `error` have a predefined accent color, you can set a custom accent color for the `info` type.
|
|
64
|
+
Just set the `--leu-message-accent-color` css custom property on the message element.
|
|
65
|
+
|
|
66
|
+
<Canvas of={MessageStories.CustomColor} />
|
|
67
|
+
|
|
68
|
+
## Accessibility
|
|
69
|
+
|
|
70
|
+
We have decided to not use the `role="alert"` or the
|
|
71
|
+
`aria-live` attribute as the message component can be used in various contexts.
|
|
72
|
+
We simply can't predict which role or which `aria-live` value would make sense.
|
|
73
|
+
Please ensure that you add the appropriate role or attribute yourself.
|
|
74
|
+
|
|
75
|
+
<Controls />
|
|
76
|
+
```
|
|
@@ -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
|
+
})
|
|
@@ -92,7 +92,7 @@ window.customElements.define("leu-input", LeuInput)
|
|
|
92
92
|
### Scoped styles
|
|
93
93
|
|
|
94
94
|
All CSS declarations have to live inside a custom element. This way we ensure that the styles won't interfere with the environment they're loaded into.
|
|
95
|
-
Styles that are shared between components should be defined as global custom properties inside the `styles/
|
|
95
|
+
Styles that are shared between components should be defined as global custom properties inside the `styles/theme.css`.
|
|
96
96
|
When a global custom property is used inside a component it could be a good practice to assign them to a local custom property with a semantic naming.
|
|
97
97
|
This only make a sense when the component has a certain complexity and the global custom property are used multiple times.
|
|
98
98
|
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from "./components/accordion/Accordion.js"
|
|
2
2
|
export * from "./components/button/Button.js"
|
|
3
3
|
export * from "./components/button-group/ButtonGroup.js"
|
|
4
|
+
export * from "./components/chart-wrapper/ChartWrapper.js"
|
|
4
5
|
export * from "./components/checkbox/Checkbox.js"
|
|
5
6
|
export * from "./components/checkbox/CheckboxGroup.js"
|
|
6
7
|
export * from "./components/chip/exports.js"
|
package/src/styles/theme.css
CHANGED
|
@@ -1 +1,89 @@
|
|
|
1
|
-
@import url("./custom-
|
|
1
|
+
@import url("./custom-media.css");
|
|
2
|
+
|
|
3
|
+
:root,
|
|
4
|
+
:host {
|
|
5
|
+
--leu-color-black-100: #000;
|
|
6
|
+
--leu-color-black-80: #333;
|
|
7
|
+
--leu-color-black-60: #666;
|
|
8
|
+
--leu-color-black-40: #949494;
|
|
9
|
+
--leu-color-black-20: #ccc;
|
|
10
|
+
--leu-color-black-10: #f0f0f0;
|
|
11
|
+
--leu-color-black-5: #f7f7f7;
|
|
12
|
+
--leu-color-black-0: #fffffe;
|
|
13
|
+
|
|
14
|
+
--leu-color-black-transp-80: rgb(0 0 0 / 80%);
|
|
15
|
+
--leu-color-black-transp-60: rgb(0 0 0 / 60%);
|
|
16
|
+
--leu-color-black-transp-40: rgb(0 0 0 / 40%);
|
|
17
|
+
--leu-color-black-transp-20: rgb(0 0 0 / 20%);
|
|
18
|
+
--leu-color-black-transp-10: rgb(0 0 0 / 10%);
|
|
19
|
+
--leu-color-black-transp-5: rgb(0 0 0 / 5%);
|
|
20
|
+
|
|
21
|
+
--leu-color-white-transp-90: rgb(255 255 255 / 90%);
|
|
22
|
+
--leu-color-white-transp-70: rgb(255 255 255 / 70%);
|
|
23
|
+
--leu-color-white-transp-40: rgb(255 255 255 / 40%);
|
|
24
|
+
--leu-color-white-transp-10: rgb(255 255 255 / 10%);
|
|
25
|
+
|
|
26
|
+
--leu-color-accent-blue: #0076bd;
|
|
27
|
+
--leu-color-accent-darkblue: #00407c;
|
|
28
|
+
--leu-color-accent-turquoise: #00797b;
|
|
29
|
+
--leu-color-accent-green: #1a7f1f;
|
|
30
|
+
--leu-color-accent-bordeaux: #b01657;
|
|
31
|
+
--leu-color-accent-magenta: #d40053;
|
|
32
|
+
--leu-color-accent-violet: #7f3da7;
|
|
33
|
+
--leu-color-accent-gray: var(--leu-color-black-60);
|
|
34
|
+
|
|
35
|
+
--leu-color-accent-blue-soft: #edf5fa;
|
|
36
|
+
--leu-color-accent-darkblue-soft: #e0e8ee;
|
|
37
|
+
--leu-color-accent-turquoise-soft: #e8f3f2;
|
|
38
|
+
--leu-color-accent-green-soft: #ebf6eb;
|
|
39
|
+
--leu-color-accent-bordeaux-soft: #f6e3ea;
|
|
40
|
+
--leu-color-accent-magenta-soft: #fcedf3;
|
|
41
|
+
--leu-color-accent-violet-soft: #ece2f1;
|
|
42
|
+
--leu-color-accent-gray-soft: var(--leu-color-black-10);
|
|
43
|
+
|
|
44
|
+
--leu-color-func-cyan: #009ee0;
|
|
45
|
+
--leu-color-func-red: #d93c1a;
|
|
46
|
+
--leu-color-func-green: #1a7f1f;
|
|
47
|
+
|
|
48
|
+
/* stylelint-disable value-keyword-case */
|
|
49
|
+
--leu-font-family-regular:
|
|
50
|
+
"InterRegular", "HelveticaNowRegular", "Helvetica", sans-serif;
|
|
51
|
+
--leu-font-family-black:
|
|
52
|
+
"InterBlack", "HelveticaNowBlack", "Arial Black", "Helvetica", sans-serif;
|
|
53
|
+
/* stylelint-enable value-keyword-case */
|
|
54
|
+
|
|
55
|
+
--leu-box-shadow-short: 0px 0px 2px var(--leu-color-black-transp-40);
|
|
56
|
+
--leu-box-shadow-regular: 0px 0px 16px var(--leu-color-black-transp-20);
|
|
57
|
+
--leu-box-shadow-long: 0px 0px 80px var(--leu-color-black-transp-20);
|
|
58
|
+
|
|
59
|
+
--leu-z-index-popup: 100;
|
|
60
|
+
|
|
61
|
+
@leu-font-styles './font-definitions.json';
|
|
62
|
+
--leu-t-font-feature-settings: "ss07", "ss08", "cv03", "cv04", "cv10";
|
|
63
|
+
|
|
64
|
+
/*
|
|
65
|
+
* Grid system
|
|
66
|
+
*
|
|
67
|
+
* The design system uses a 6 columns system on smaller screens.
|
|
68
|
+
* For simplicity we use a 12 column grid for all breakpoints (zh web implementation does the same).
|
|
69
|
+
*
|
|
70
|
+
* The goal is to keep the css footprint small
|
|
71
|
+
* by not generating all classes for every cell width for every breakpoint.
|
|
72
|
+
* Most components don't need a grid and those who do probably have a very simple configuration.
|
|
73
|
+
* If we have enough use cases for a more complex grid system we can add it later.
|
|
74
|
+
*/
|
|
75
|
+
--leu-grid-gap: 1rem;
|
|
76
|
+
--leu-grid-template-columns: repeat(12, minmax(0, 4.25rem));
|
|
77
|
+
--leu-grid-max-width: 73rem;
|
|
78
|
+
|
|
79
|
+
--leu-grid-columns-full: 1 / -1;
|
|
80
|
+
--leu-grid-columns-offset: 1 / -1;
|
|
81
|
+
|
|
82
|
+
@media (--viewport-regular) {
|
|
83
|
+
--leu-grid-columns-offset: 3 / -1;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@media (--viewport-medium) {
|
|
87
|
+
--leu-grid-gap: 2rem;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chart-wrapper.test.d.ts","sourceRoot":"","sources":["../../../../src/components/visualization/test/chart-wrapper.test.ts"],"names":[],"mappings":"AAGA,OAAO,yBAAyB,CAAA"}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
@import url("./custom-media.css");
|
|
2
|
-
|
|
3
|
-
:root,
|
|
4
|
-
:host {
|
|
5
|
-
--leu-color-black-100: #000;
|
|
6
|
-
--leu-color-black-80: #333;
|
|
7
|
-
--leu-color-black-60: #666;
|
|
8
|
-
--leu-color-black-40: #949494;
|
|
9
|
-
--leu-color-black-20: #ccc;
|
|
10
|
-
--leu-color-black-10: #f0f0f0;
|
|
11
|
-
--leu-color-black-5: #f7f7f7;
|
|
12
|
-
--leu-color-black-0: #fffffe;
|
|
13
|
-
|
|
14
|
-
--leu-color-black-transp-80: rgb(0 0 0 / 80%);
|
|
15
|
-
--leu-color-black-transp-60: rgb(0 0 0 / 60%);
|
|
16
|
-
--leu-color-black-transp-40: rgb(0 0 0 / 40%);
|
|
17
|
-
--leu-color-black-transp-20: rgb(0 0 0 / 20%);
|
|
18
|
-
--leu-color-black-transp-10: rgb(0 0 0 / 10%);
|
|
19
|
-
--leu-color-black-transp-5: rgb(0 0 0 / 5%);
|
|
20
|
-
|
|
21
|
-
--leu-color-white-transp-90: rgb(255 255 255 / 90%);
|
|
22
|
-
--leu-color-white-transp-70: rgb(255 255 255 / 70%);
|
|
23
|
-
--leu-color-white-transp-40: rgb(255 255 255 / 40%);
|
|
24
|
-
--leu-color-white-transp-10: rgb(255 255 255 / 10%);
|
|
25
|
-
|
|
26
|
-
--leu-color-accent-blue: #0076bd;
|
|
27
|
-
--leu-color-accent-darkblue: #00407c;
|
|
28
|
-
--leu-color-accent-turquoise: #00797b;
|
|
29
|
-
--leu-color-accent-green: #1a7f1f;
|
|
30
|
-
--leu-color-accent-bordeaux: #b01657;
|
|
31
|
-
--leu-color-accent-magenta: #d40053;
|
|
32
|
-
--leu-color-accent-violet: #7f3da7;
|
|
33
|
-
--leu-color-accent-gray: var(--leu-color-black-60);
|
|
34
|
-
|
|
35
|
-
--leu-color-accent-blue-soft: #edf5fa;
|
|
36
|
-
--leu-color-accent-darkblue-soft: #e0e8ee;
|
|
37
|
-
--leu-color-accent-turquoise-soft: #e8f3f2;
|
|
38
|
-
--leu-color-accent-green-soft: #ebf6eb;
|
|
39
|
-
--leu-color-accent-bordeaux-soft: #f6e3ea;
|
|
40
|
-
--leu-color-accent-magenta-soft: #fcedf3;
|
|
41
|
-
--leu-color-accent-violet-soft: #ece2f1;
|
|
42
|
-
--leu-color-accent-gray-soft: var(--leu-color-black-10);
|
|
43
|
-
|
|
44
|
-
--leu-color-func-cyan: #009ee0;
|
|
45
|
-
--leu-color-func-red: #d93c1a;
|
|
46
|
-
--leu-color-func-green: #1a7f1f;
|
|
47
|
-
|
|
48
|
-
/* stylelint-disable value-keyword-case */
|
|
49
|
-
--leu-font-family-regular:
|
|
50
|
-
"InterRegular", "HelveticaNowRegular", "Helvetica", sans-serif;
|
|
51
|
-
--leu-font-family-black:
|
|
52
|
-
"InterBlack", "HelveticaNowBlack", "Arial Black", "Helvetica", sans-serif;
|
|
53
|
-
/* stylelint-enable value-keyword-case */
|
|
54
|
-
|
|
55
|
-
--leu-box-shadow-short: 0px 0px 2px var(--leu-color-black-transp-40);
|
|
56
|
-
--leu-box-shadow-regular: 0px 0px 16px var(--leu-color-black-transp-20);
|
|
57
|
-
--leu-box-shadow-long: 0px 0px 80px var(--leu-color-black-transp-20);
|
|
58
|
-
|
|
59
|
-
--leu-z-index-popup: 100;
|
|
60
|
-
|
|
61
|
-
@leu-font-styles './font-definitions.json';
|
|
62
|
-
--leu-t-font-feature-settings: "ss07", "ss08", "cv03", "cv04", "cv10";
|
|
63
|
-
|
|
64
|
-
/*
|
|
65
|
-
* Grid system
|
|
66
|
-
*
|
|
67
|
-
* The design system uses a 6 columns system on smaller screens.
|
|
68
|
-
* For simplicity we use a 12 column grid for all breakpoints (zh web implementation does the same).
|
|
69
|
-
*
|
|
70
|
-
* The goal is to keep the css footprint small
|
|
71
|
-
* by not generating all classes for every cell width for every breakpoint.
|
|
72
|
-
* Most components don't need a grid and those who do probably have a very simple configuration.
|
|
73
|
-
* If we have enough use cases for a more complex grid system we can add it later.
|
|
74
|
-
*/
|
|
75
|
-
--leu-grid-gap: 1rem;
|
|
76
|
-
--leu-grid-template-columns: repeat(12, minmax(0, 4.25rem));
|
|
77
|
-
--leu-grid-max-width: 73rem;
|
|
78
|
-
|
|
79
|
-
--leu-grid-columns-full: 1 / -1;
|
|
80
|
-
--leu-grid-columns-offset: 1 / -1;
|
|
81
|
-
|
|
82
|
-
@media (--viewport-regular) {
|
|
83
|
-
--leu-grid-columns-offset: 3 / -1;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
@media (--viewport-medium) {
|
|
87
|
-
--leu-grid-gap: 2rem;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|