@statistikzh/leu 0.15.1 → 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.
Files changed (82) hide show
  1. package/.release-please-manifest.json +1 -1
  2. package/CHANGELOG.md +7 -0
  3. package/dist/Accordion.js +1 -1
  4. package/dist/Button.js +1 -1
  5. package/dist/ButtonGroup.js +1 -1
  6. package/dist/ChartWrapper.js +1 -1
  7. package/dist/Checkbox.js +1 -1
  8. package/dist/CheckboxGroup.js +1 -1
  9. package/dist/Chip.js +1 -1
  10. package/dist/ChipGroup.js +1 -1
  11. package/dist/ChipLink.js +1 -1
  12. package/dist/ChipRemovable.js +1 -1
  13. package/dist/ChipSelectable.js +1 -1
  14. package/dist/Dialog.js +1 -1
  15. package/dist/Dropdown.js +1 -1
  16. package/dist/Icon.js +1 -1
  17. package/dist/Input.js +1 -1
  18. package/dist/{LeuElement-B84x5CPL.js → LeuElement-C0BZ_nPB.js} +1 -1
  19. package/dist/Menu.js +1 -1
  20. package/dist/MenuItem.js +1 -1
  21. package/dist/Message.d.ts +63 -0
  22. package/dist/Message.js +268 -0
  23. package/dist/Pagination.js +1 -1
  24. package/dist/Placeholder.js +1 -1
  25. package/dist/Popup.js +1 -1
  26. package/dist/Radio.js +1 -1
  27. package/dist/RadioGroup.js +1 -1
  28. package/dist/Range.js +1 -1
  29. package/dist/ScrollTop.js +1 -1
  30. package/dist/Select.js +1 -1
  31. package/dist/Spinner.js +1 -1
  32. package/dist/Table.js +1 -1
  33. package/dist/VisuallyHidden.js +1 -1
  34. package/dist/components/message/Message.d.ts +59 -0
  35. package/dist/components/message/Message.d.ts.map +1 -0
  36. package/dist/components/message/leu-message.d.ts +3 -0
  37. package/dist/components/message/leu-message.d.ts.map +1 -0
  38. package/dist/components/message/stories/message.stories.d.ts +179 -0
  39. package/dist/components/message/stories/message.stories.d.ts.map +1 -0
  40. package/dist/components/message/test/message.test.d.ts +2 -0
  41. package/dist/components/message/test/message.test.d.ts.map +1 -0
  42. package/dist/index.js +1 -1
  43. package/dist/leu-accordion.js +1 -1
  44. package/dist/leu-button-group.js +1 -1
  45. package/dist/leu-button.js +1 -1
  46. package/dist/leu-chart-wrapper.js +1 -1
  47. package/dist/leu-checkbox-group.js +1 -1
  48. package/dist/leu-checkbox.js +1 -1
  49. package/dist/leu-chip-group.js +1 -1
  50. package/dist/leu-chip-link.js +1 -1
  51. package/dist/leu-chip-removable.js +1 -1
  52. package/dist/leu-chip-selectable.js +1 -1
  53. package/dist/leu-dialog.js +1 -1
  54. package/dist/leu-dropdown.js +1 -1
  55. package/dist/leu-icon.js +1 -1
  56. package/dist/leu-input.js +1 -1
  57. package/dist/leu-menu-item.js +1 -1
  58. package/dist/leu-menu.js +1 -1
  59. package/dist/leu-message.d.ts +5 -0
  60. package/dist/leu-message.js +12 -0
  61. package/dist/leu-pagination.js +1 -1
  62. package/dist/leu-placeholder.js +1 -1
  63. package/dist/leu-popup.js +1 -1
  64. package/dist/leu-radio-group.js +1 -1
  65. package/dist/leu-radio.js +1 -1
  66. package/dist/leu-range.js +1 -1
  67. package/dist/leu-scroll-top.js +1 -1
  68. package/dist/leu-select.js +1 -1
  69. package/dist/leu-spinner.js +1 -1
  70. package/dist/leu-table.js +1 -1
  71. package/dist/leu-visually-hidden.js +1 -1
  72. package/dist/vscode.html-custom-data.json +48 -11
  73. package/dist/vue/index.d.ts +52 -20
  74. package/dist/web-types.json +109 -28
  75. package/package.json +1 -1
  76. package/src/components/message/Message.ts +118 -0
  77. package/src/components/message/leu-message.ts +5 -0
  78. package/src/components/message/message.css +163 -0
  79. package/src/components/message/stories/message.mdx +76 -0
  80. package/src/components/message/stories/message.stories.ts +149 -0
  81. package/src/components/message/test/message.test.ts +96 -0
  82. package/src/styles/custom-media.css +1 -0
@@ -34,17 +34,6 @@
34
34
  }
35
35
  ]
36
36
  },
37
- {
38
- "name": "leu-button-group",
39
- "description": "A radio input-like button group component.\nIt allows only one button to be active at a time.\n---\n\n\n### **Events:**\n - **input** - When the value of the group changes by clicking a button\n\n### **Slots:**\n - _default_ - Slot for the buttons",
40
- "attributes": [],
41
- "references": [
42
- {
43
- "name": "Documentation",
44
- "url": "https://statistikzh.github.io/leu/?path=/story/button-group"
45
- }
46
- ]
47
- },
48
37
  {
49
38
  "name": "leu-button",
50
39
  "description": "\n---\n\n\n### **Slots:**\n - **before** - The icon to display before the label\n- **after** - The icon to display after the label\n- _default_ - The label of the button or the icon if no label is set",
@@ -120,6 +109,17 @@
120
109
  }
121
110
  ]
122
111
  },
112
+ {
113
+ "name": "leu-button-group",
114
+ "description": "A radio input-like button group component.\nIt allows only one button to be active at a time.\n---\n\n\n### **Events:**\n - **input** - When the value of the group changes by clicking a button\n\n### **Slots:**\n - _default_ - Slot for the buttons",
115
+ "attributes": [],
116
+ "references": [
117
+ {
118
+ "name": "Documentation",
119
+ "url": "https://statistikzh.github.io/leu/?path=/story/button-group"
120
+ }
121
+ ]
122
+ },
123
123
  {
124
124
  "name": "leu-chart-wrapper",
125
125
  "description": "A wrapper element for charts.\n---\n\n\n### **Slots:**\n - **title** - The title of the chart. Use a heading tag (h2-4) depending on your context.\n- **description** - A description of the chart. Content is wrapped in a `<p>` tag by the component.\n- **chart** - The actual chart\n- **caption** - A caption for the chart, e.g. a source or explanation of the data.\n- **download** - A download button or dropdown to export the chart in different formats.",
@@ -491,6 +491,43 @@
491
491
  }
492
492
  ]
493
493
  },
494
+ {
495
+ "name": "leu-message",
496
+ "description": "\n---\n\n\n### **Events:**\n - **leu:remove** - Fired when the close button is clicked.\n\n### **Slots:**\n - **default** - The content of the message. The title of the message should marked up with a `<strong>` tag.\n- **cta** - A call to action button that is only allowed for `size=large`\n\n### **CSS Properties:**\n - **--leu-message-accent-color** - Sets the color of the message. According to the design system, it is only allowd for `info` _(default: undefined)_",
497
+ "attributes": [
498
+ {
499
+ "name": "type",
500
+ "description": "The type of the message. `error` and `success` will be displayed as filled boxes.",
501
+ "values": [
502
+ { "name": "error" },
503
+ { "name": "success" },
504
+ { "name": "info" },
505
+ { "name": "warning" }
506
+ ]
507
+ },
508
+ {
509
+ "name": "size",
510
+ "description": "The size of the message. A call to action button is only allowed for `large` messages.",
511
+ "values": [{ "name": "regular" }, { "name": "large" }]
512
+ },
513
+ {
514
+ "name": "removable",
515
+ "description": "Wheter the message is removable or not. The component will not remove itself when the close button is clicked.",
516
+ "values": []
517
+ },
518
+ {
519
+ "name": "popup",
520
+ "description": "Wheter the message is used as a popup or not. This will add a drop shadow but will not position the message absolutely.",
521
+ "values": []
522
+ }
523
+ ],
524
+ "references": [
525
+ {
526
+ "name": "Documentation",
527
+ "url": "https://statistikzh.github.io/leu/?path=/story/message"
528
+ }
529
+ ]
530
+ },
494
531
  {
495
532
  "name": "leu-pagination",
496
533
  "description": "\n---\n\n\n### **Events:**\n - **leu:pagechange**",
@@ -1,8 +1,8 @@
1
1
  import type { DefineComponent } from "vue";
2
2
 
3
3
  import type { LeuAccordion } from "../Accordion.js";
4
- import type { LeuButtonGroup } from "../ButtonGroup.js";
5
4
  import type { LeuButton } from "../Button.js";
5
+ import type { LeuButtonGroup } from "../ButtonGroup.js";
6
6
  import type { LeuChartWrapper } from "../ChartWrapper.js";
7
7
  import type { LeuCheckbox } from "../Checkbox.js";
8
8
  import type { LeuCheckboxGroup } from "../CheckboxGroup.js";
@@ -16,6 +16,7 @@ import type { LeuIcon } from "../Icon.js";
16
16
  import type { LeuInput, CustomEvent } from "../Input.js";
17
17
  import type { LeuMenu } from "../Menu.js";
18
18
  import type { LeuMenuItem } from "../MenuItem.js";
19
+ import type { LeuMessage, CustomEvent } from "../Message.js";
19
20
  import type { LeuPagination, CustomEvent } from "../Pagination.js";
20
21
  import type { LeuPlaceholder } from "../Placeholder.js";
21
22
  import type { LeuPopup } from "../Popup.js";
@@ -39,13 +40,6 @@ type LeuAccordionProps = {
39
40
  label?: LeuAccordion["label"];
40
41
  };
41
42
 
42
- type LeuButtonGroupProps = {
43
- /** The value of the currently selected (active) button */
44
- value?: LeuButtonGroup["value"];
45
- /** When the value of the group changes by clicking a button */
46
- oninput?: (e: CustomEvent<never>) => void;
47
- };
48
-
49
43
  type LeuButtonProps = {
50
44
  /** `aria-label` of the underlying button elements.
51
45
  Use it to provide a label when only an icon is visible. */
@@ -77,6 +71,13 @@ If it is set, the icon will either show an expanded or collapsed state. */
77
71
  fluid?: LeuButton["fluid"];
78
72
  };
79
73
 
74
+ type LeuButtonGroupProps = {
75
+ /** The value of the currently selected (active) button */
76
+ value?: LeuButtonGroup["value"];
77
+ /** When the value of the group changes by clicking a button */
78
+ oninput?: (e: CustomEvent<never>) => void;
79
+ };
80
+
80
81
  type LeuChartWrapperProps = {
81
82
  /** Whether the chart is currently loading or not.
82
83
  When set to `true`, a spinner will be shown in the chart container. */
@@ -263,6 +264,20 @@ type LeuMenuItemProps = {
263
264
  componentRole?: LeuMenuItem["componentRole"];
264
265
  };
265
266
 
267
+ type LeuMessageProps = {
268
+ /** The type of the message. `error` and `success` will be displayed as filled boxes. */
269
+ type?: LeuMessage["type"];
270
+ /** The size of the message. A call to action button is only allowed for `large` messages. */
271
+ size?: LeuMessage["size"];
272
+ /** Wheter the message is removable or not. The component will not remove itself when the close button is clicked. */
273
+ removable?: LeuMessage["removable"];
274
+ /** Wheter the message is used as a popup or not. This will add a drop shadow but will not position the message absolutely. */
275
+ popup?: LeuMessage["popup"];
276
+
277
+ /** Fired when the close button is clicked. */
278
+ "onleu:remove"?: (e: CustomEvent<CustomEvent>) => void;
279
+ };
280
+
266
281
  type LeuPaginationProps = {
267
282
  /** */
268
283
  defaultPage?: LeuPagination["defaultPage"];
@@ -448,30 +463,30 @@ export type CustomElements = {
448
463
  "leu-accordion": DefineComponent<LeuAccordionProps>;
449
464
 
450
465
  /**
451
- * A radio input-like button group component.
452
- * It allows only one button to be active at a time.
453
- * ---
454
466
  *
467
+ * ---
455
468
  *
456
- * ### **Events:**
457
- * - **input** - When the value of the group changes by clicking a button
458
469
  *
459
470
  * ### **Slots:**
460
- * - _default_ - Slot for the buttons
471
+ * - **before** - The icon to display before the label
472
+ * - **after** - The icon to display after the label
473
+ * - _default_ - The label of the button or the icon if no label is set
461
474
  */
462
- "leu-button-group": DefineComponent<LeuButtonGroupProps>;
475
+ "leu-button": DefineComponent<LeuButtonProps>;
463
476
 
464
477
  /**
465
- *
478
+ * A radio input-like button group component.
479
+ * It allows only one button to be active at a time.
466
480
  * ---
467
481
  *
468
482
  *
483
+ * ### **Events:**
484
+ * - **input** - When the value of the group changes by clicking a button
485
+ *
469
486
  * ### **Slots:**
470
- * - **before** - The icon to display before the label
471
- * - **after** - The icon to display after the label
472
- * - _default_ - The label of the button or the icon if no label is set
487
+ * - _default_ - Slot for the buttons
473
488
  */
474
- "leu-button": DefineComponent<LeuButtonProps>;
489
+ "leu-button-group": DefineComponent<LeuButtonGroupProps>;
475
490
 
476
491
  /**
477
492
  * A wrapper element for charts.
@@ -628,6 +643,23 @@ export type CustomElements = {
628
643
  */
629
644
  "leu-menu-item": DefineComponent<LeuMenuItemProps>;
630
645
 
646
+ /**
647
+ *
648
+ * ---
649
+ *
650
+ *
651
+ * ### **Events:**
652
+ * - **leu:remove** - Fired when the close button is clicked.
653
+ *
654
+ * ### **Slots:**
655
+ * - **default** - The content of the message. The title of the message should marked up with a `<strong>` tag.
656
+ * - **cta** - A call to action button that is only allowed for `size=large`
657
+ *
658
+ * ### **CSS Properties:**
659
+ * - **--leu-message-accent-color** - Sets the color of the message. According to the design system, it is only allowd for `info` _(default: undefined)_
660
+ */
661
+ "leu-message": DefineComponent<LeuMessageProps>;
662
+
631
663
  /**
632
664
  *
633
665
  * ---
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "name": "@statistikzh/leu",
4
- "version": "0.15.1",
4
+ "version": "0.16.0",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -65,33 +65,6 @@
65
65
  "events": []
66
66
  }
67
67
  },
68
- {
69
- "name": "leu-button-group",
70
- "description": "A radio input-like button group component.\nIt allows only one button to be active at a time.\n---\n\n\n### **Events:**\n - **input** - When the value of the group changes by clicking a button\n\n### **Slots:**\n - _default_ - Slot for the buttons",
71
- "doc-url": "",
72
- "attributes": [],
73
- "slots": [{ "name": "", "description": "Slot for the buttons" }],
74
- "events": [
75
- {
76
- "name": "input",
77
- "description": "When the value of the group changes by clicking a button"
78
- }
79
- ],
80
- "js": {
81
- "properties": [
82
- {
83
- "name": "value",
84
- "description": "The value of the currently selected (active) button"
85
- }
86
- ],
87
- "events": [
88
- {
89
- "name": "input",
90
- "description": "When the value of the group changes by clicking a button"
91
- }
92
- ]
93
- }
94
- },
95
68
  {
96
69
  "name": "leu-button",
97
70
  "description": "\n---\n\n\n### **Slots:**\n - **before** - The icon to display before the label\n- **after** - The icon to display after the label\n- _default_ - The label of the button or the icon if no label is set",
@@ -238,6 +211,33 @@
238
211
  "events": []
239
212
  }
240
213
  },
214
+ {
215
+ "name": "leu-button-group",
216
+ "description": "A radio input-like button group component.\nIt allows only one button to be active at a time.\n---\n\n\n### **Events:**\n - **input** - When the value of the group changes by clicking a button\n\n### **Slots:**\n - _default_ - Slot for the buttons",
217
+ "doc-url": "",
218
+ "attributes": [],
219
+ "slots": [{ "name": "", "description": "Slot for the buttons" }],
220
+ "events": [
221
+ {
222
+ "name": "input",
223
+ "description": "When the value of the group changes by clicking a button"
224
+ }
225
+ ],
226
+ "js": {
227
+ "properties": [
228
+ {
229
+ "name": "value",
230
+ "description": "The value of the currently selected (active) button"
231
+ }
232
+ ],
233
+ "events": [
234
+ {
235
+ "name": "input",
236
+ "description": "When the value of the group changes by clicking a button"
237
+ }
238
+ ]
239
+ }
240
+ },
241
241
  {
242
242
  "name": "leu-chart-wrapper",
243
243
  "description": "A wrapper element for charts.\n---\n\n\n### **Slots:**\n - **title** - The title of the chart. Use a heading tag (h2-4) depending on your context.\n- **description** - A description of the chart. Content is wrapped in a `<p>` tag by the component.\n- **chart** - The actual chart\n- **caption** - A caption for the chart, e.g. a source or explanation of the data.\n- **download** - A download button or dropdown to export the chart in different formats.",
@@ -969,6 +969,87 @@
969
969
  "events": []
970
970
  }
971
971
  },
972
+ {
973
+ "name": "leu-message",
974
+ "description": "\n---\n\n\n### **Events:**\n - **leu:remove** - Fired when the close button is clicked.\n\n### **Slots:**\n - **default** - The content of the message. The title of the message should marked up with a `<strong>` tag.\n- **cta** - A call to action button that is only allowed for `size=large`\n\n### **CSS Properties:**\n - **--leu-message-accent-color** - Sets the color of the message. According to the design system, it is only allowd for `info` _(default: undefined)_",
975
+ "doc-url": "",
976
+ "attributes": [
977
+ {
978
+ "name": "type",
979
+ "description": "The type of the message. `error` and `success` will be displayed as filled boxes.",
980
+ "value": {
981
+ "type": "\"error\" | \"success\" | \"info\" | \"warning\"",
982
+ "default": "\"success\""
983
+ }
984
+ },
985
+ {
986
+ "name": "size",
987
+ "description": "The size of the message. A call to action button is only allowed for `large` messages.",
988
+ "value": {
989
+ "type": "\"regular\" | \"large\"",
990
+ "default": "\"regular\""
991
+ }
992
+ },
993
+ {
994
+ "name": "removable",
995
+ "description": "Wheter the message is removable or not. The component will not remove itself when the close button is clicked.",
996
+ "value": { "type": "boolean", "default": "false" }
997
+ },
998
+ {
999
+ "name": "popup",
1000
+ "description": "Wheter the message is used as a popup or not. This will add a drop shadow but will not position the message absolutely.",
1001
+ "value": { "type": "boolean", "default": "false" }
1002
+ }
1003
+ ],
1004
+ "slots": [
1005
+ {
1006
+ "name": "default",
1007
+ "description": "The content of the message. The title of the message should marked up with a `<strong>` tag."
1008
+ },
1009
+ {
1010
+ "name": "cta",
1011
+ "description": "A call to action button that is only allowed for `size=large`"
1012
+ }
1013
+ ],
1014
+ "events": [
1015
+ {
1016
+ "name": "leu:remove",
1017
+ "type": "CustomEvent",
1018
+ "description": "Fired when the close button is clicked."
1019
+ }
1020
+ ],
1021
+ "js": {
1022
+ "properties": [
1023
+ {
1024
+ "name": "type",
1025
+ "description": "The type of the message. `error` and `success` will be displayed as filled boxes.",
1026
+ "type": "\"error\" | \"success\" | \"info\" | \"warning\""
1027
+ },
1028
+ {
1029
+ "name": "size",
1030
+ "description": "The size of the message. A call to action button is only allowed for `large` messages.",
1031
+ "type": "\"regular\" | \"large\""
1032
+ },
1033
+ {
1034
+ "name": "removable",
1035
+ "description": "Wheter the message is removable or not. The component will not remove itself when the close button is clicked.",
1036
+ "type": "boolean"
1037
+ },
1038
+ {
1039
+ "name": "popup",
1040
+ "description": "Wheter the message is used as a popup or not. This will add a drop shadow but will not position the message absolutely.",
1041
+ "type": "boolean"
1042
+ }
1043
+ ],
1044
+ "events": [
1045
+ {
1046
+ "name": "leu:remove",
1047
+ "type": "CustomEvent",
1048
+ "description": "Fired when the close button is clicked."
1049
+ }
1050
+ ]
1051
+ }
1052
+ },
972
1053
  {
973
1054
  "name": "leu-pagination",
974
1055
  "description": "\n---\n\n\n### **Events:**\n - **leu:pagechange**",
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "UI component library of the canton of zurich",
4
4
  "license": "MIT",
5
5
  "author": "statistikzh",
6
- "version": "0.15.1",
6
+ "version": "0.16.0",
7
7
  "type": "module",
8
8
  "main": "dist/index.js",
9
9
  "module": "dist/index.js",
@@ -0,0 +1,118 @@
1
+ import { html, nothing } from "lit"
2
+ import { property } from "lit/decorators.js"
3
+ import { classMap } from "lit/directives/class-map.js"
4
+
5
+ import { LeuElement } from "../../lib/LeuElement.js"
6
+
7
+ import styles from "./message.css"
8
+ import { LeuIcon } from "../icon/Icon.js"
9
+ import { HasSlotController } from "../../lib/hasSlotController.js"
10
+
11
+ /**
12
+ * @tagname leu-message
13
+ * @cssprop --leu-message-accent-color - Sets the color of the message. According to the design system, it is only allowd for `info`
14
+ * @slot [default] - The content of the message. The title of the message should marked up with a `<strong>` tag.
15
+ * @slot cta - A call to action button that is only allowed for `size=large`
16
+ * @fires leu:remove - Fired when the close button is clicked.
17
+ */
18
+ export class LeuMessage extends LeuElement {
19
+ static styles = [LeuElement.styles, styles]
20
+
21
+ /**
22
+ * @internal
23
+ */
24
+ static shadowRootOptions = {
25
+ ...LeuElement.shadowRootOptions,
26
+ delegatesFocus: true,
27
+ }
28
+
29
+ /**
30
+ * @internal
31
+ */
32
+ static dependencies = {
33
+ "leu-icon": LeuIcon,
34
+ }
35
+
36
+ /**
37
+ * @internal
38
+ */
39
+ static iconToTypeMap = {
40
+ info: "getInformation",
41
+ error: "caution",
42
+ success: "confirm",
43
+ warning: "caution",
44
+ }
45
+
46
+ /**
47
+ * The type of the message. `error` and `success` will be displayed as filled boxes.
48
+ */
49
+ @property({ type: String, reflect: true })
50
+ type: "error" | "success" | "info" | "warning" = "success"
51
+
52
+ /**
53
+ * The size of the message. A call to action button is only allowed for `large` messages.
54
+ */
55
+ @property({ type: String, reflect: true })
56
+ size: "regular" | "large" = "regular"
57
+
58
+ /**
59
+ * Wheter the message is removable or not. The component will not remove itself when the close button is clicked.
60
+ */
61
+ @property({ type: Boolean, reflect: true })
62
+ removable: boolean = false
63
+
64
+ /**
65
+ * Wheter the message is used as a popup or not. This will add a drop shadow but will not position the message absolutely.
66
+ */
67
+ @property({ type: Boolean, reflect: true })
68
+ popup: boolean = false
69
+
70
+ private hasSlotController = new HasSlotController(this, ["cta"])
71
+
72
+ protected renderIcon() {
73
+ const name = LeuMessage.iconToTypeMap[this.type]
74
+
75
+ return html`<leu-icon class="message__icon" name=${name}></leu-icon>`
76
+ }
77
+
78
+ protected handleRemove() {
79
+ this.dispatchEvent(
80
+ new CustomEvent("leu:remove", {
81
+ bubbles: true,
82
+ composed: true,
83
+ }),
84
+ )
85
+ }
86
+
87
+ render() {
88
+ const hasCta = this.hasSlotController.test("cta")
89
+ const classes = classMap({
90
+ message: true,
91
+ "message--filled": this.type === "error" || this.type === "success",
92
+ "message--popup": this.popup,
93
+ [`message--${this.size}`]: true,
94
+ [`message--${this.type}`]: true,
95
+ })
96
+
97
+ return html`
98
+ <div class="${classes}">
99
+ ${this.renderIcon()}
100
+ <p class="message__content">
101
+ <slot></slot>
102
+ </p>
103
+ ${hasCta
104
+ ? html`<slot class="message__cta" name="cta"></slot>`
105
+ : nothing}
106
+ ${this.removable
107
+ ? html`<button
108
+ class="message__remove"
109
+ aria-label="Meldung schliessen"
110
+ @click=${this.handleRemove}
111
+ >
112
+ <leu-icon class="message__remove-icon" name="close"></leu-icon>
113
+ </button>`
114
+ : nothing}
115
+ </div>
116
+ `
117
+ }
118
+ }
@@ -0,0 +1,5 @@
1
+ import { LeuMessage } from "./Message.js"
2
+
3
+ export { LeuMessage }
4
+
5
+ LeuMessage.define("leu-message")
@@ -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
+ }