@statistikzh/leu 0.12.2 → 0.13.1

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 (115) hide show
  1. package/.storybook/preview-head.html +1 -4
  2. package/.storybook/static/fonts/Inter-Black.woff2 +0 -0
  3. package/.storybook/static/fonts/Inter-Regular.woff2 +0 -0
  4. package/.storybook/static/fonts.css +11 -0
  5. package/CHANGELOG.md +18 -0
  6. package/dist/Accordion.d.ts +1 -1
  7. package/dist/Accordion.js +1 -1
  8. package/dist/Breadcrumb.d.ts +1 -1
  9. package/dist/Breadcrumb.js +1 -1
  10. package/dist/Button.d.ts +1 -1
  11. package/dist/Button.d.ts.map +1 -1
  12. package/dist/Button.js +64 -34
  13. package/dist/ButtonGroup.d.ts +1 -1
  14. package/dist/ButtonGroup.js +1 -1
  15. package/dist/Checkbox.d.ts +1 -1
  16. package/dist/Checkbox.js +1 -1
  17. package/dist/CheckboxGroup.d.ts +1 -1
  18. package/dist/CheckboxGroup.js +1 -1
  19. package/dist/Chip.d.ts +1 -1
  20. package/dist/Chip.d.ts.map +1 -1
  21. package/dist/Chip.js +5 -4
  22. package/dist/ChipGroup.d.ts +1 -1
  23. package/dist/ChipGroup.js +1 -1
  24. package/dist/ChipLink.js +1 -1
  25. package/dist/ChipRemovable.js +1 -1
  26. package/dist/ChipSelectable.js +1 -1
  27. package/dist/Dialog.d.ts +1 -1
  28. package/dist/Dialog.js +2 -2
  29. package/dist/Dropdown.d.ts +1 -1
  30. package/dist/Dropdown.d.ts.map +1 -1
  31. package/dist/Dropdown.js +3 -2
  32. package/dist/Icon.d.ts +1 -1
  33. package/dist/Icon.d.ts.map +1 -1
  34. package/dist/Icon.js +6 -2
  35. package/dist/Input.d.ts +1 -1
  36. package/dist/Input.js +1 -1
  37. package/dist/{LeuElement-519af050.d.ts → LeuElement-b670d77c.d.ts} +1 -1
  38. package/dist/LeuElement-b670d77c.d.ts.map +1 -0
  39. package/dist/{LeuElement-519af050.js → LeuElement-b670d77c.js} +11 -1
  40. package/dist/Menu.d.ts +1 -1
  41. package/dist/Menu.js +1 -1
  42. package/dist/MenuItem.d.ts +1 -1
  43. package/dist/MenuItem.js +1 -1
  44. package/dist/Pagination.d.ts +1 -1
  45. package/dist/Pagination.js +2 -2
  46. package/dist/Popup.d.ts +1 -1
  47. package/dist/Popup.d.ts.map +1 -1
  48. package/dist/Popup.js +2 -1
  49. package/dist/Radio.d.ts +1 -1
  50. package/dist/Radio.js +1 -1
  51. package/dist/RadioGroup.d.ts +1 -1
  52. package/dist/RadioGroup.js +1 -1
  53. package/dist/Range.d.ts +1 -1
  54. package/dist/Range.js +1 -1
  55. package/dist/ScrollTop.d.ts +1 -1
  56. package/dist/ScrollTop.js +2 -2
  57. package/dist/Select.d.ts +1 -1
  58. package/dist/Select.js +3 -3
  59. package/dist/Spinner.d.ts +1 -1
  60. package/dist/Spinner.js +1 -1
  61. package/dist/Table.d.ts +1 -3
  62. package/dist/Table.d.ts.map +1 -1
  63. package/dist/Table.js +49 -20
  64. package/dist/VisuallyHidden.d.ts +1 -1
  65. package/dist/VisuallyHidden.js +1 -1
  66. package/dist/{hasSlotController-bf769658.d.ts → hasSlotController-c09741c5.d.ts} +1 -1
  67. package/dist/{hasSlotController-bf769658.d.ts.map → hasSlotController-c09741c5.d.ts.map} +1 -1
  68. package/dist/{hasSlotController-bf769658.js → hasSlotController-c09741c5.js} +1 -1
  69. package/dist/index.d.ts +1 -0
  70. package/dist/index.js +2 -2
  71. package/dist/leu-accordion.js +1 -1
  72. package/dist/leu-breadcrumb.js +1 -1
  73. package/dist/leu-button-group.js +1 -1
  74. package/dist/leu-button.js +2 -2
  75. package/dist/leu-checkbox-group.js +1 -1
  76. package/dist/leu-checkbox.js +1 -1
  77. package/dist/leu-chip-group.js +1 -1
  78. package/dist/leu-chip-link.js +1 -1
  79. package/dist/leu-chip-removable.js +1 -1
  80. package/dist/leu-chip-selectable.js +1 -1
  81. package/dist/leu-dialog.js +2 -2
  82. package/dist/leu-dropdown.js +2 -2
  83. package/dist/leu-icon.js +1 -1
  84. package/dist/leu-input.js +1 -1
  85. package/dist/leu-menu-item.js +1 -1
  86. package/dist/leu-menu.js +1 -1
  87. package/dist/leu-pagination.js +2 -2
  88. package/dist/leu-popup.js +1 -1
  89. package/dist/leu-radio-group.js +1 -1
  90. package/dist/leu-radio.js +1 -1
  91. package/dist/leu-range.js +1 -1
  92. package/dist/leu-scroll-top.js +2 -2
  93. package/dist/leu-select.js +2 -2
  94. package/dist/leu-spinner.js +1 -1
  95. package/dist/leu-table.js +2 -2
  96. package/dist/leu-visually-hidden.js +1 -1
  97. package/dist/web-types.json +1 -1
  98. package/index.js +1 -0
  99. package/package.json +1 -1
  100. package/src/components/button/Button.js +8 -3
  101. package/src/components/button/button.css +56 -22
  102. package/src/components/button/stories/button.stories.js +1 -0
  103. package/src/components/button/test/button.test.js +3 -3
  104. package/src/components/chip/chip.css +4 -3
  105. package/src/components/chip/stories/chip-selectable.stories.js +1 -1
  106. package/src/components/dropdown/dropdown.css +1 -0
  107. package/src/components/icon/icon.css +4 -0
  108. package/src/components/popup/popup.css +1 -0
  109. package/src/components/select/select.css +1 -1
  110. package/src/components/select/test/select.test.js +1 -0
  111. package/src/components/table/Table.js +33 -15
  112. package/src/components/table/table.css +16 -6
  113. package/src/styles/common-styles.css +9 -0
  114. package/web-test-runner.config.mjs +1 -0
  115. package/dist/LeuElement-519af050.d.ts.map +0 -1
@@ -128,6 +128,7 @@ button.ghost {
128
128
  padding: 0 0.5rem;
129
129
  color: var(--leu-color-black-60);
130
130
  font-family: var(--leu-font-family-regular);
131
+ height: 2rem;
131
132
  }
132
133
 
133
134
  button.ghost:hover {
@@ -206,49 +207,82 @@ button.ghost.inverted:disabled {
206
207
  display: block;
207
208
  }
208
209
 
209
- .ghost.icon-before .icon-wrapper--before,
210
- .ghost.icon-after .icon-wrapper--after {
210
+ .icon-wrapper {
211
+ display: none;
212
+ }
213
+
214
+ .icon-before .icon-wrapper--before,
215
+ .icon-after .icon-wrapper--after {
211
216
  display: block;
212
- padding: 0.5rem;
217
+ }
218
+
219
+ .ghost .icon-wrapper {
220
+ position: relative;
221
+ width: 2rem;
222
+ padding: 0 0.5rem;
223
+ --_bg: var(--leu-color-black-transp-10);
224
+ --_color: currentcolor;
225
+ }
226
+
227
+ .ghost .icon-wrapper__slot {
228
+ display: block;
229
+ position: relative;
230
+ z-index: 1;
231
+ color: var(--_color);
232
+ }
233
+
234
+ .ghost .icon-wrapper::before {
235
+ content: "";
236
+ position: absolute;
237
+ z-index: 0;
238
+ left: 0;
239
+ top: -0.5rem;
240
+
241
+ width: 2rem;
242
+ aspect-ratio: 1;
213
243
  border-radius: 50%;
214
- background: var(--leu-color-black-transp-10);
244
+ background: var(--_bg);
215
245
  }
216
246
 
217
- .ghost.active :is(.icon-wrapper--before, .icon-wrapper--after) {
218
- background: var(--leu-color-black-100);
219
- color: var(--leu-color-black-0);
247
+ .ghost.active .icon-wrapper {
248
+ --_bg: var(--leu-color-black-100);
249
+ --_color: var(--leu-color-black-0);
220
250
  }
221
251
 
222
- .ghost:disabled :is(.icon-wrapper--before, .icon-wrapper--after) {
223
- background: var(--leu-color-black-transp-5);
252
+ .ghost:disabled .icon-wrapper {
253
+ --_bg: var(--leu-color-black-transp-5);
224
254
  }
225
255
 
226
256
  /* inverted */
227
257
 
228
- .ghost.inverted :is(.icon-wrapper--before, .icon-wrapper--after) {
229
- background: var(--leu-color-black-transp-20);
258
+ .ghost.inverted .icon-wrapper {
259
+ --_bg: var(--leu-color-black-transp-20);
230
260
  }
231
261
 
232
- .ghost.inverted:hover :is(.icon-wrapper--before, .icon-wrapper--after) {
233
- background: var(--leu-color-black-transp-40);
234
- color: var(--leu-color-black-0);
262
+ .ghost.inverted:hover .icon-wrapper {
263
+ --_bg: var(--leu-color-black-transp-40);
264
+ --_color: var(--leu-color-black-0);
235
265
  }
236
266
 
237
- .ghost.inverted:disabled :is(.icon-wrapper--before, .icon-wrapper--after) {
238
- background: var(--leu-color-black-transp-20);
239
- color: var(--leu-color-white-transp-70);
267
+ .ghost.inverted:disabled .icon-wrapper {
268
+ --_bg: var(--leu-color-black-transp-20);
269
+ --_color: var(--leu-color-white-transp-70);
240
270
  }
241
271
 
242
- .ghost.active.inverted :is(.icon-wrapper--before, .icon-wrapper--after) {
243
- background: var(--leu-color-black-0);
244
- color: var(--leu-color-black-100);
272
+ .ghost.active.inverted .icon-wrapper {
273
+ --_bg: var(--leu-color-black-0);
274
+ --_color: var(--leu-color-black-100);
245
275
  }
246
276
 
247
277
  /* Expanded icon */
248
- .icon-wrapper--expanded {
278
+ .icon-expanded leu-icon {
279
+ display: block;
280
+ }
281
+
282
+ .icon-expanded {
249
283
  transition: transform 0.1s ease;
250
284
  }
251
285
 
252
- :host([expanded="open"]) .icon-wrapper--expanded {
286
+ :host([expanded="true"]) .icon-expanded {
253
287
  transform: rotate(180deg);
254
288
  }
@@ -87,6 +87,7 @@ Regular.argTypes = {
87
87
  expanded: { control: "radio", options: BUTTON_EXPANDED_OPTIONS },
88
88
  disabled: { control: "boolean" },
89
89
  round: { control: "boolean" },
90
+ active: { control: "boolean" },
90
91
  }
91
92
  Regular.args = {
92
93
  content: "Click Mich...",
@@ -58,7 +58,7 @@ describe("LeuButton", () => {
58
58
  const button = el.shadowRoot.querySelector("button")
59
59
 
60
60
  expect(button).dom.to.equal(
61
- "<button><slot name='before'></slot><span><slot></slot></span><slot name='after'></slot></button>",
61
+ "<button><div><slot name='before'></slot></div><span><slot></slot></span><div><slot name='after'></slot></div></button>",
62
62
  { ignoreAttributes: ["class", "type"] }
63
63
  )
64
64
  })
@@ -73,7 +73,7 @@ describe("LeuButton", () => {
73
73
  const button = el.shadowRoot.querySelector("button")
74
74
 
75
75
  expect(button).dom.to.equal(
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>",
76
+ "<button aria-expanded='true'><div><slot name='before'></slot></div><span><slot></slot></span><div><slot name='after'></slot></div><div class='icon-expanded'><leu-icon name='angleDropDown' size='24'></leu-icon></div></button>",
77
77
  { ignoreAttributes: ["class", "type"] }
78
78
  )
79
79
 
@@ -82,7 +82,7 @@ describe("LeuButton", () => {
82
82
  await elementUpdated(el)
83
83
 
84
84
  expect(button).dom.to.equal(
85
- "<button class='primary regular' aria-expanded='true'><slot name='before'></slot><span><slot></slot></span><slot name='after'></slot></button>",
85
+ "<button class='primary regular' aria-expanded='true'><div><slot name='before'></slot></div><span><slot></slot></span><div><slot name='after'></slot></div></button>",
86
86
  { ignoreAttributes: ["class", "type"] }
87
87
  )
88
88
  })
@@ -55,7 +55,7 @@
55
55
  border: none;
56
56
  border-radius: 1rem;
57
57
  background-color: var(--chip-background-color);
58
- padding: 0.5rem 1rem;
58
+ padding: 8px 1rem;
59
59
 
60
60
  color: var(--chip-color);
61
61
  font-family: inherit;
@@ -66,6 +66,7 @@
66
66
 
67
67
  display: inline-flex;
68
68
  gap: 0.5rem;
69
+ align-items: center;
69
70
 
70
71
  /* Allow shrinking to achieve text truncation (ellipsis) */
71
72
  min-width: 0;
@@ -108,10 +109,10 @@
108
109
  }
109
110
 
110
111
  :host([size="small"]:not([variant="radio"])) .button {
111
- padding: 0.5625rem 0.75rem 0.4375rem;
112
+ padding: 0.3125rem 0.75rem;
112
113
 
113
114
  font-size: 0.75rem;
114
- line-height: 1;
115
+ line-height: 1.25rem;
115
116
  }
116
117
 
117
118
  :host([variant="radio"]) .button::before {
@@ -50,7 +50,7 @@ export const Default = Template.bind({})
50
50
  Default.args = {}
51
51
 
52
52
  export const Small = Template.bind({})
53
- Small.args = { size: SIZES.small }
53
+ Small.args = { size: SIZES.small, label: "Publikationen Region" }
54
54
 
55
55
  export const Radio = Template.bind({})
56
56
  Radio.args = { variant: VARIANTS.radio }
@@ -1,5 +1,6 @@
1
1
  :host {
2
2
  position: relative;
3
+ display: contents;
3
4
  }
4
5
 
5
6
  .content {
@@ -1,3 +1,7 @@
1
+ :host {
2
+ display: contents;
3
+ }
4
+
1
5
  svg,
2
6
  .placeholder {
3
7
  display: block;
@@ -3,6 +3,7 @@
3
3
  --popup-font-black: var(--leu-font-family-black);
4
4
 
5
5
  font-family: var(--popup-font-regular);
6
+ display: contents;
6
7
  }
7
8
 
8
9
  .popup {
@@ -58,7 +58,7 @@
58
58
  line-height: 1.5;
59
59
  padding: 1.375rem 3rem 1.375rem 1rem;
60
60
 
61
- background: none;
61
+ background: var(--leu-color-black-0);
62
62
  overflow: hidden;
63
63
  text-overflow: ellipsis;
64
64
  white-space: nowrap;
@@ -419,6 +419,7 @@ describe("LeuSelect", () => {
419
419
  await elementUpdated(el)
420
420
 
421
421
  expect(menuItems.every((item) => !item.multipleSelection)).to.be.true
422
+ })
422
423
 
423
424
  it("closes the popup when the document is clicked outside the component", async () => {
424
425
  const el = await defaultFixture({
@@ -115,7 +115,7 @@ export class LeuTable extends LeuElement {
115
115
  this.sortOrderAsc = !this.sortOrderAsc
116
116
  } else {
117
117
  this.sortIndex = index
118
- this.sortOrder = "asc"
118
+ this.sortOrderAsc = false
119
119
  }
120
120
  }
121
121
 
@@ -125,10 +125,6 @@ export class LeuTable extends LeuElement {
125
125
  ></leu-icon>`
126
126
  }
127
127
 
128
- sortArrow(col) {
129
- return html` ${this.isSorted(col) ? this.sortArrowIcon() : nothing} `
130
- }
131
-
132
128
  get _columns() {
133
129
  return this.columns
134
130
  }
@@ -172,6 +168,26 @@ export class LeuTable extends LeuElement {
172
168
  sticky: this.firstColumnSticky,
173
169
  }
174
170
 
171
+ function headerStyle(col) {
172
+ if (col.headerStyle) {
173
+ return styleMap({
174
+ ...col.headerStyle(),
175
+ textAlign: col.align === "right" ? "right" : undefined,
176
+ })
177
+ }
178
+ return col.align === "right" ? styleMap({ textAlign: "right" }) : nothing
179
+ }
180
+
181
+ function bodyStyle(col, row) {
182
+ if (col.style) {
183
+ return styleMap({
184
+ ...col.style(row),
185
+ textAlign: col.align === "right" ? "right" : undefined,
186
+ })
187
+ }
188
+ return col.align === "right" ? styleMap({ textAlign: "right" }) : nothing
189
+ }
190
+
175
191
  return html`
176
192
  <div
177
193
  class=${classMap(scrollClasses)}
@@ -183,15 +199,19 @@ export class LeuTable extends LeuElement {
183
199
  <tr>
184
200
  ${this._columns.map(
185
201
  (col) =>
186
- html`<th
187
- style=${col.headerStyle
188
- ? styleMap(col.headerStyle())
189
- : nothing}
190
- >
202
+ html`<th style=${headerStyle(col)}>
191
203
  ${col.sort
192
- ? html`<button @click=${(_) => this.sortClick(col)}>
204
+ ? html`<button
205
+ @click=${(_) => this.sortClick(col)}
206
+ class=${this.isSorted(col) ? "active" : nothing}
207
+ >
208
+ ${col.align === "right"
209
+ ? this.sortArrowIcon()
210
+ : nothing}
193
211
  <span>${col.name}</span>
194
- ${this.sortArrow(col)}
212
+ ${col.align !== "right"
213
+ ? this.sortArrowIcon()
214
+ : nothing}
195
215
  </button>`
196
216
  : col.name}
197
217
  </th>`
@@ -204,9 +224,7 @@ export class LeuTable extends LeuElement {
204
224
  html`<tr>
205
225
  ${this._columns.map(
206
226
  (col) =>
207
- html`<td
208
- style=${col.style ? styleMap(col.style(row)) : nothing}
209
- >
227
+ html`<td style=${bodyStyle(col, row)}>
210
228
  ${col.value(row)}
211
229
  </td>`
212
230
  )}
@@ -66,20 +66,30 @@ button {
66
66
  line-height: 1.5;
67
67
  padding: 0;
68
68
  border: 0;
69
- width: 100%;
70
- display: flex;
71
- align-items: flex-center;
72
69
  font-size: inherit;
73
70
  font-family: inherit;
74
71
  color: inherit;
75
72
  }
76
73
 
77
- thead leu-icon {
78
- --leu-icon-size: 1.25rem;
74
+ button span {
75
+ vertical-align: bottom;
76
+ }
79
77
 
78
+ button leu-icon {
79
+ --leu-icon-size: 1.25rem;
80
80
  display: inline-block;
81
- color: var(--leu-color-accent-blue);
82
81
  padding: 0;
82
+ opacity: 0;
83
+ vertical-align: bottom;
84
+ }
85
+
86
+ button:hover leu-icon {
87
+ opacity: 1;
88
+ }
89
+
90
+ button.active leu-icon {
91
+ color: var(--leu-color-accent-blue);
92
+ opacity: 1;
83
93
  }
84
94
 
85
95
  table.sticky td:first-child,
@@ -3,3 +3,12 @@
3
3
  box-sizing: border-box;
4
4
  font-feature-settings: var(--leu-t-font-feature-settings);
5
5
  }
6
+
7
+ /**
8
+ * If a custom element sets the display property to any value
9
+ * it will not be hidden by the [hidden] attribute.
10
+ * That's why we need to specify this rule.
11
+ */
12
+ :host([hidden]) {
13
+ display: none;
14
+ }
@@ -9,6 +9,7 @@ export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
9
9
  plugins: wdsPlugins,
10
10
  mimeTypes: {
11
11
  "src/components/**/*.css": "js",
12
+ "src/styles/common-styles.css": "js",
12
13
  },
13
14
 
14
15
  /** Resolve bare module imports */
@@ -1 +0,0 @@
1
- {"version":3,"file":"LeuElement-519af050.d.ts","sourceRoot":"","sources":["LeuElement-519af050.js"],"names":[],"mappings":"AAsCA;IACE,8EAcC;CACF;AApDD,sEAaC;2BAf+B,KAAK"}