@statistikzh/leu 0.13.1 → 0.14.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 (174) hide show
  1. package/.eslintrc.json +8 -0
  2. package/.github/workflows/ci.yml +78 -0
  3. package/.github/workflows/deploy-github-pages.yaml +2 -1
  4. package/.github/workflows/release-please.yml +2 -1
  5. package/.nvmrc +1 -0
  6. package/.prettierignore +1 -0
  7. package/.storybook/main.js +19 -3
  8. package/CHANGELOG.md +16 -0
  9. package/custom-elements-manifest.config.js +2 -2
  10. package/dist/Accordion.d.ts +1 -1
  11. package/dist/Accordion.d.ts.map +1 -1
  12. package/dist/Accordion.js +2 -4
  13. package/dist/Button.d.ts +2 -2
  14. package/dist/Button.js +2 -2
  15. package/dist/ButtonGroup.d.ts +1 -1
  16. package/dist/ButtonGroup.js +1 -1
  17. package/dist/Checkbox.d.ts +1 -1
  18. package/dist/Checkbox.d.ts.map +1 -1
  19. package/dist/Checkbox.js +2 -3
  20. package/dist/CheckboxGroup.d.ts +1 -1
  21. package/dist/CheckboxGroup.d.ts.map +1 -1
  22. package/dist/CheckboxGroup.js +1 -3
  23. package/dist/Chip.d.ts +1 -1
  24. package/dist/Chip.d.ts.map +1 -1
  25. package/dist/Chip.js +1 -3
  26. package/dist/ChipGroup.d.ts +1 -1
  27. package/dist/ChipGroup.d.ts.map +1 -1
  28. package/dist/ChipGroup.js +2 -2
  29. package/dist/ChipLink.js +1 -1
  30. package/dist/ChipRemovable.js +1 -1
  31. package/dist/ChipSelectable.js +1 -1
  32. package/dist/Dialog.d.ts +1 -1
  33. package/dist/Dialog.d.ts.map +1 -1
  34. package/dist/Dialog.js +3 -5
  35. package/dist/Dropdown.d.ts +1 -1
  36. package/dist/Dropdown.js +3 -3
  37. package/dist/Icon.d.ts +2 -98
  38. package/dist/Icon.d.ts.map +1 -1
  39. package/dist/Icon.js +1 -1
  40. package/dist/Input.d.ts +7 -2
  41. package/dist/Input.d.ts.map +1 -1
  42. package/dist/Input.js +15 -8
  43. package/dist/{LeuElement-b670d77c.d.ts → LeuElement-BjGpKQpe.d.ts} +1 -1
  44. package/dist/LeuElement-BjGpKQpe.d.ts.map +1 -0
  45. package/dist/{LeuElement-b670d77c.js → LeuElement-BjGpKQpe.js} +2 -2
  46. package/dist/Menu.d.ts +2 -2
  47. package/dist/Menu.js +1 -1
  48. package/dist/MenuItem.d.ts +3 -3
  49. package/dist/MenuItem.js +1 -1
  50. package/dist/Pagination.d.ts +1 -1
  51. package/dist/Pagination.js +3 -3
  52. package/dist/Popup.d.ts +2 -2
  53. package/dist/Popup.d.ts.map +1 -1
  54. package/dist/Popup.js +1 -3
  55. package/dist/Radio.d.ts +1 -1
  56. package/dist/Radio.d.ts.map +1 -1
  57. package/dist/Radio.js +1 -3
  58. package/dist/RadioGroup.d.ts +1 -1
  59. package/dist/RadioGroup.d.ts.map +1 -1
  60. package/dist/RadioGroup.js +1 -3
  61. package/dist/Range.d.ts +1 -1
  62. package/dist/Range.d.ts.map +1 -1
  63. package/dist/Range.js +17 -19
  64. package/dist/ScrollTop.d.ts +1 -1
  65. package/dist/ScrollTop.d.ts.map +1 -1
  66. package/dist/ScrollTop.js +27 -3
  67. package/dist/Select.d.ts +3 -3
  68. package/dist/Select.d.ts.map +1 -1
  69. package/dist/Select.js +6 -4
  70. package/dist/Spinner.d.ts +1 -1
  71. package/dist/Spinner.js +1 -1
  72. package/dist/Table.d.ts +1 -1
  73. package/dist/Table.d.ts.map +1 -1
  74. package/dist/Table.js +3 -4
  75. package/dist/VisuallyHidden.d.ts +1 -1
  76. package/dist/VisuallyHidden.d.ts.map +1 -1
  77. package/dist/VisuallyHidden.js +3 -5
  78. package/dist/{hasSlotController-c09741c5.d.ts → hasSlotController-DvFw2NdC.d.ts} +1 -1
  79. package/dist/hasSlotController-DvFw2NdC.d.ts.map +1 -0
  80. package/dist/{hasSlotController-c09741c5.js → hasSlotController-DvFw2NdC.js} +1 -1
  81. package/dist/index.d.ts +1 -2
  82. package/dist/index.js +5 -7
  83. package/dist/leu-accordion.js +1 -1
  84. package/dist/leu-button-group.js +1 -1
  85. package/dist/leu-button.js +2 -2
  86. package/dist/leu-checkbox-group.js +1 -1
  87. package/dist/leu-checkbox.js +1 -1
  88. package/dist/leu-chip-group.js +1 -1
  89. package/dist/leu-chip-link.js +1 -1
  90. package/dist/leu-chip-removable.js +1 -1
  91. package/dist/leu-chip-selectable.js +1 -1
  92. package/dist/leu-dialog.js +2 -2
  93. package/dist/leu-dropdown.js +2 -2
  94. package/dist/leu-icon.js +1 -1
  95. package/dist/leu-input.js +1 -1
  96. package/dist/leu-menu-item.js +1 -1
  97. package/dist/leu-menu.js +1 -1
  98. package/dist/leu-pagination.js +2 -2
  99. package/dist/leu-popup.js +1 -1
  100. package/dist/leu-radio-group.js +1 -1
  101. package/dist/leu-radio.js +1 -1
  102. package/dist/leu-range.js +1 -1
  103. package/dist/leu-scroll-top.js +2 -3
  104. package/dist/leu-select.js +2 -2
  105. package/dist/leu-spinner.js +1 -1
  106. package/dist/leu-table.js +2 -2
  107. package/dist/leu-visually-hidden.js +1 -1
  108. package/dist/theme.css +143 -107
  109. package/dist/vscode.html-custom-data.json +3 -32
  110. package/dist/vue/index.d.ts +11 -77
  111. package/dist/web-types.json +246 -242
  112. package/index.js +0 -1
  113. package/package.json +55 -51
  114. package/rollup.config.js +3 -3
  115. package/scripts/generate-component/generate.js +5 -5
  116. package/src/components/accordion/test/accordion.test.js +24 -20
  117. package/src/components/button/Button.js +1 -1
  118. package/src/components/button/stories/button.stories.js +43 -45
  119. package/src/components/button/test/button.test.js +10 -10
  120. package/src/components/button-group/ButtonGroup.js +1 -1
  121. package/src/components/button-group/stories/button-group.stories.js +2 -2
  122. package/src/components/checkbox/checkbox.css +1 -0
  123. package/src/components/chip/ChipSelectable.js +1 -1
  124. package/src/components/chip/stories/chip-group.stories.js +4 -4
  125. package/src/components/chip/test/chip-group.test.js +25 -33
  126. package/src/components/chip/test/chip-link.test.js +5 -5
  127. package/src/components/chip/test/chip-removable.test.js +6 -8
  128. package/src/components/chip/test/chip-selectable.test.js +9 -11
  129. package/src/components/dialog/test/dialog.test.js +1 -1
  130. package/src/components/dropdown/test/dropdown.test.js +12 -13
  131. package/src/components/input/Input.js +25 -17
  132. package/src/components/input/stories/input.stories.js +0 -2
  133. package/src/components/input/test/input.test.js +26 -0
  134. package/src/components/menu/stories/menu-item.stories.js +2 -0
  135. package/src/components/menu/test/menu-item.test.js +3 -2
  136. package/src/components/menu/test/menu.test.js +24 -22
  137. package/src/components/pagination/Pagination.js +1 -1
  138. package/src/components/pagination/pagination.css +1 -1
  139. package/src/components/pagination/stories/pagination.stories.js +2 -1
  140. package/src/components/pagination/test/pagination.test.js +8 -6
  141. package/src/components/popup/Popup.js +4 -4
  142. package/src/components/popup/test/popup.test.js +6 -8
  143. package/src/components/radio/RadioGroup.js +2 -2
  144. package/src/components/range/Range.js +20 -21
  145. package/src/components/select/Select.js +6 -1
  146. package/src/components/select/stories/select.stories.js +1 -1
  147. package/src/components/select/test/select.test.js +18 -16
  148. package/src/components/table/Table.js +4 -4
  149. package/src/components/table/test/table.test.js +3 -2
  150. package/src/components/visually-hidden/test/visually-hidden.test.js +6 -8
  151. package/src/lib/LeuElement.js +2 -2
  152. package/src/lib/hasSlotController.js +1 -1
  153. package/src/styles/style.stories.js +3 -1
  154. package/tsconfig.build.json +4 -3
  155. package/web-dev-server.config.mjs +1 -0
  156. package/web-test-runner.config.mjs +1 -1
  157. package/.github/workflows/test.yml +0 -38
  158. package/.storybook/preview-head.html +0 -2
  159. package/dist/Breadcrumb.d.ts +0 -69
  160. package/dist/Breadcrumb.d.ts.map +0 -1
  161. package/dist/Breadcrumb.js +0 -391
  162. package/dist/LeuElement-b670d77c.d.ts.map +0 -1
  163. package/dist/hasSlotController-c09741c5.d.ts.map +0 -1
  164. package/dist/leu-breadcrumb.d.ts +0 -3
  165. package/dist/leu-breadcrumb.d.ts.map +0 -1
  166. package/dist/leu-breadcrumb.js +0 -17
  167. package/dist/utils-65469421.d.ts +0 -16
  168. package/dist/utils-65469421.d.ts.map +0 -1
  169. package/dist/utils-65469421.js +0 -35
  170. package/src/components/breadcrumb/Breadcrumb.js +0 -324
  171. package/src/components/breadcrumb/breadcrumb.css +0 -98
  172. package/src/components/breadcrumb/leu-breadcrumb.js +0 -5
  173. package/src/components/breadcrumb/stories/breadcrumb.stories.js +0 -73
  174. package/src/components/breadcrumb/test/breadcrumb.test.js +0 -141
@@ -1,17 +0,0 @@
1
- import { LeuBreadcrumb } from './Breadcrumb.js';
2
- import './LeuElement-b670d77c.js';
3
- import 'lit';
4
- import 'lit/directives/ref.js';
5
- import 'lit/directives/class-map.js';
6
- import './utils-65469421.js';
7
- import './Icon.js';
8
- import './Menu.js';
9
- import './MenuItem.js';
10
- import 'lit/directives/if-defined.js';
11
- import './Popup.js';
12
- import '@floating-ui/dom';
13
- import './VisuallyHidden.js';
14
-
15
- LeuBreadcrumb.define("leu-breadcrumb");
16
-
17
- export { LeuBreadcrumb };
@@ -1,16 +0,0 @@
1
- /**
2
- * Return a debounced function that delays invoking func until after wait milliseconds have elapsed since the last time the debounced function was invoked.
3
- * @param {Function} func - Your function
4
- * @param {Number} timeout - Default is 500 ms
5
- * @returns {Function} - Your function wrapped in a timeout function
6
- */
7
- declare function debounce(func: Function, timeout?: number): Function;
8
- /**
9
- * Return a throttled function that only invokes func at most once per every wait milliseconds.
10
- * @param {Function} func - Your function
11
- * @param {Number} timeout - Default is 500 ms
12
- * @returns {Function} - Your function wrapped in a timeout function
13
- */
14
- declare function throttle(func: Function, timeout?: number): Function;
15
- export { debounce as d, throttle as t };
16
- //# sourceMappingURL=utils-65469421.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils-65469421.d.ts","sourceRoot":"","sources":["utils-65469421.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,sEAQC;AAED;;;;;GAKG;AACH,sEAUC"}
@@ -1,35 +0,0 @@
1
- /**
2
- * Return a debounced function that delays invoking func until after wait milliseconds have elapsed since the last time the debounced function was invoked.
3
- * @param {Function} func - Your function
4
- * @param {Number} timeout - Default is 500 ms
5
- * @returns {Function} - Your function wrapped in a timeout function
6
- */
7
- const debounce = function debounce(func, timeout = 500) {
8
- let timer = null;
9
- return (...args) => {
10
- clearTimeout(timer);
11
- timer = setTimeout(() => {
12
- func.apply(this, args);
13
- }, timeout);
14
- };
15
- };
16
-
17
- /**
18
- * Return a throttled function that only invokes func at most once per every wait milliseconds.
19
- * @param {Function} func - Your function
20
- * @param {Number} timeout - Default is 500 ms
21
- * @returns {Function} - Your function wrapped in a timeout function
22
- */
23
- const throttle = function throttle(func, timeout = 500) {
24
- let timer = null;
25
- return (...args) => {
26
- if (timer === null) {
27
- func(...args);
28
- timer = setTimeout(() => {
29
- timer = null;
30
- }, timeout);
31
- }
32
- };
33
- };
34
-
35
- export { debounce as d, throttle as t };
@@ -1,324 +0,0 @@
1
- import { html, nothing } from "lit"
2
- import { createRef, ref } from "lit/directives/ref.js"
3
- import { classMap } from "lit/directives/class-map.js"
4
-
5
- import { LeuElement } from "../../lib/LeuElement.js"
6
- import { debounce } from "../../lib/utils.js"
7
- import { LeuIcon } from "../icon/Icon.js"
8
- import { LeuMenu } from "../menu/Menu.js"
9
- import { LeuMenuItem } from "../menu/MenuItem.js"
10
- import { LeuPopup } from "../popup/Popup.js"
11
- import { LeuVisuallyHidden } from "../visually-hidden/VisuallyHidden.js"
12
-
13
- import styles from "./breadcrumb.css"
14
-
15
- /**
16
- * A Breadcrumb Navigation.
17
- *
18
- * The breadcrumbs can be displayed in two different layouts.
19
- * Only the back link (the last item / parent of the current page)
20
- * is displayed when…
21
- * - … the width of the container is smaller
22
- * than the BACK_ONLY_BREAKPOINT.
23
- * - … less then two breadcrumb items could be displayed
24
- * without overflowing the container.
25
- *
26
- * Otherwise as many items as possible are displayed in an inline list
27
- * without overflowing the container. The remaining items are displayed
28
- * in a dropdown menu.
29
- *
30
- * In order to determine the exact numbers of items that have to be
31
- * hidden inside the dropdown, all of them have to be rendered first.
32
- * 1. Render all items
33
- * 2. Calculate (measure) the number of items that can be displayed
34
- * without overflowing the container.
35
- * 3. Updating the state (_hiddeItems) which will trigger a rerender
36
- * 4. Render the items again with the new state.
37
- *
38
- * This results in multiple updates scheduled one after another. Lit
39
- * will also print a waring in the console beacause of that.
40
- * It's no a nice behaviour but the only one that works without
41
- * having duplicate and hidden markup to derive the sizes from that.
42
- *
43
- *
44
- * @prop {Array} items - Object array with { label, href }
45
- * @prop {boolean} inverted - invert color on dark background
46
- *
47
- * @tagname leu-breadcrumb
48
- */
49
- export class LeuBreadcrumb extends LeuElement {
50
- static dependencies = {
51
- "leu-icon": LeuIcon,
52
- "leu-menu": LeuMenu,
53
- "leu-menu-item": LeuMenuItem,
54
- "leu-popup": LeuPopup,
55
- "leu-visually-hidden": LeuVisuallyHidden,
56
- }
57
-
58
- static styles = [LeuElement.styles, styles]
59
-
60
- static properties = {
61
- items: { type: Array },
62
- inverted: { type: Boolean, reflect: true },
63
-
64
- _hiddenItems: { state: true },
65
- _showBackOnly: { state: true },
66
- _isRecalculating: { state: true },
67
- _isDropdownOpen: { state: true },
68
- }
69
-
70
- static BACK_ONLY_BREAKPOINT = 320
71
-
72
- constructor() {
73
- super()
74
- /** @type {Array} */
75
- this.items = []
76
- /** @type {boolean} - will be used on dark Background */
77
- this.inverted = false
78
-
79
- /** @internal */
80
- this._containerRef = createRef()
81
- /** @internal */
82
- this._hiddenItems = 0
83
- /** @internal */
84
- this._showBackOnly = null
85
- /** @internal */
86
- this._lastContainerWidth = null
87
- /**
88
- * @internal
89
- * Forces the toggle button to be rendered
90
- * so that all possible inline items will be measured.
91
- * */
92
- this._isRecalculating = true
93
- /** @internal */
94
- this._isDropdownOpen = false
95
-
96
- this.resizeObserver = new ResizeObserver(
97
- debounce(() => {
98
- this._handleResize()
99
- }, 500)
100
- )
101
- }
102
-
103
- firstUpdated() {
104
- this.resizeObserver.observe(this._containerRef.value)
105
- }
106
-
107
- async updated(changedProperties) {
108
- if (changedProperties.has("items")) {
109
- this._hiddenItems = 0
110
- this._isRecalculating = true
111
- await this.updateComplete
112
- this._checkWidth()
113
- }
114
- }
115
-
116
- disconnectedCallback() {
117
- super.disconnectedCallback()
118
-
119
- window.removeEventListener("click", this._closeDropdown)
120
- this.resizeObserver.disconnect()
121
- }
122
-
123
- /** @internal */
124
- get _listItems() {
125
- return this.items.toSpliced(1, this._hiddenItems)
126
- }
127
-
128
- /** @internal */
129
- get _dropdownItems() {
130
- return this.items.slice(1, 1 + this._hiddenItems)
131
- }
132
-
133
- _handleResize = async () => {
134
- const containerOffsetWidth = this._containerRef.value.offsetWidth
135
- const sizeIsGrowing = containerOffsetWidth > this._lastContainerWidth
136
- this._lastContainerWidth = containerOffsetWidth
137
-
138
- /**
139
- * Show only the back link (parent of the current page)
140
- * when the width of the container is smaller than the BACK_ONLY_BREAKPOINT
141
- */
142
- if (containerOffsetWidth <= LeuBreadcrumb.BACK_ONLY_BREAKPOINT) {
143
- this._showBackOnly = true
144
- this._isRecalculating = false
145
- return
146
- }
147
-
148
- this._showBackOnly = false
149
-
150
- /**
151
- * In order to calculate how many items can be displayed
152
- * when the container is growing, all items have to
153
- * be marked as displayed (_hiddenItems = 0) and
154
- * rendered.
155
- */
156
- if (sizeIsGrowing && this._hiddenItems > 0) {
157
- this._hiddenItems = 0
158
- this._isRecalculating = true
159
- await this.updateComplete
160
- }
161
-
162
- this._checkWidth()
163
- }
164
-
165
- /**
166
- * Calculate the number of items that can be displayed
167
- * without overflowing the container.
168
- * @internal
169
- * @returns {void}
170
- */
171
- _checkWidth() {
172
- const containerOffsetWidth = this._containerRef.value.offsetWidth
173
- const containerScrollWidth = this._containerRef.value.scrollWidth
174
- this._lastContainerWidth = containerOffsetWidth
175
-
176
- /** When the container is not overflowing, nothing has to be done */
177
- if (containerOffsetWidth === containerScrollWidth) {
178
- this._isRecalculating = false
179
- return
180
- }
181
-
182
- const listItems = this._containerRef.value.querySelectorAll(
183
- "li:not([data-dropdown-toggle])"
184
- )
185
- const listItemWidths = [...listItems].map((o) => o.offsetWidth)
186
-
187
- let hiddenItems = 0
188
- let hiddenItemsWidth = 0
189
-
190
- /**
191
- * Remove item by item until the sum of the remaining items
192
- * is smaller than the width of the container.
193
- * The first item will not be removed.
194
- */
195
- while (
196
- hiddenItems < listItemWidths.length &&
197
- containerOffsetWidth < containerScrollWidth - hiddenItemsWidth
198
- ) {
199
- hiddenItems += 1
200
-
201
- hiddenItemsWidth = listItemWidths
202
- .slice(1, 1 + hiddenItems)
203
- .reduce((sum, itemWidth) => sum + itemWidth, 0)
204
- }
205
-
206
- this._hiddenItems += hiddenItems
207
- this._isRecalculating = false
208
- }
209
-
210
- /** @internal */
211
- _handleDropdownToggle = (e) => {
212
- e.stopPropagation()
213
-
214
- this._isDropdownOpen = !this._isDropdownOpen
215
-
216
- if (this._isDropdownOpen) {
217
- window.addEventListener("click", this._closeDropdown)
218
- } else {
219
- window.removeEventListener("click", this._closeDropdown)
220
- }
221
- }
222
-
223
- _closeDropdown = () => {
224
- this._isDropdownOpen = false
225
- window.removeEventListener("click", this._closeDropdown)
226
- }
227
-
228
- /**
229
- * Render the dropdown menu
230
- * @returns
231
- */
232
- renderDropdown() {
233
- if (this._dropdownItems.length === 0 && !this._isRecalculating)
234
- return nothing
235
-
236
- return html`
237
- <li class="breadcrumbs__item" data-dropdown-toggle>
238
- <span class="breadcrumbs__icon"
239
- ><leu-icon name="angleRight"></leu-icon
240
- ></span>
241
- <leu-popup
242
- ?active=${this._isDropdownOpen}
243
- placement="bottom-start"
244
- shift
245
- shiftPadding="8"
246
- autoSize="width"
247
- autoSizePadding="8"
248
- >
249
- <button
250
- slot="anchor"
251
- class="menu"
252
- @click=${this._handleDropdownToggle}
253
- tabindex="0"
254
- >
255
- &hellip;
256
- </button>
257
- <div class="dropdown">
258
- ${html`
259
- <leu-menu>
260
- ${this._dropdownItems.map(
261
- (item) =>
262
- html`
263
- <leu-menu-item href=${item.href}
264
- >${item.label}</leu-menu-item
265
- >
266
- `
267
- )}
268
- </leu-menu>
269
- `}
270
- </div>
271
- </leu-popup>
272
- </li>
273
- `
274
- }
275
-
276
- render() {
277
- if (this.items.length < 2) return nothing
278
-
279
- const parentItem = this.items[this.items.length - 2]
280
-
281
- const showBackOnly =
282
- this._showBackOnly || this.items.length - this._hiddenItems < 2
283
-
284
- const wrapperClasses = {
285
- breadcrumbs: true,
286
- "breadcrumbs--back-only": showBackOnly,
287
- }
288
-
289
- return html`
290
- <nav class=${classMap(wrapperClasses)}>
291
- <leu-visually-hidden><h2>Sie sind hier:</h2></leu-visually-hidden>
292
- <ol class="breadcrumbs__list" ref=${ref(this._containerRef)}>
293
- ${showBackOnly
294
- ? html` <li class="breadcrumbs__item breadcrumbs__item--back">
295
- <span class="breadcrumbs__icon"
296
- ><leu-icon name="arrowLeft"></leu-icon
297
- ></span>
298
- <a class="breadcrumbs__link" href=${parentItem.href}
299
- >${parentItem.label}</a
300
- >
301
- </li>`
302
- : this._listItems.map(
303
- (item, index, list) =>
304
- html`
305
- <li class="breadcrumbs__item">
306
- ${index > 0
307
- ? html`<span class="breadcrumbs__icon"
308
- ><leu-icon name="angleRight"></leu-icon
309
- ></span>` // First list item doesn't have an arrow
310
- : nothing}
311
- ${index === list.length - 1
312
- ? item.label // Last list item doesn't contain a link
313
- : html`<a class="breadcrumbs__link" href=${item.href}
314
- >${item.label}</a
315
- >`}
316
- </li>
317
- ${index === 0 ? this.renderDropdown() : nothing}
318
- `
319
- )}
320
- </ol>
321
- </nav>
322
- `
323
- }
324
- }
@@ -1,98 +0,0 @@
1
- :host {
2
- --breadcrumb-font-regular: var(--leu-font-family-regular);
3
- --breadcrumb-font-black: var(--leu-font-family-black);
4
-
5
- font-family: var(--breadcrumb-font-regular);
6
- line-height: 1.5;
7
- color: var(--leu-color-black-100);
8
- }
9
-
10
- :host([inverted]) {
11
- color: var(--leu-color-black-0);
12
- }
13
-
14
- .breadcrumbs__list {
15
- display: flex;
16
- align-items: center;
17
- list-style-type: none;
18
- margin: 0;
19
- padding: 0;
20
- }
21
-
22
- .breadcrumbs--back-only .breadcrumbs__list {
23
- overflow: hidden;
24
- }
25
-
26
- .breadcrumbs__item,
27
- .breadcrumbs__icon {
28
- align-items: center;
29
- display: flex;
30
- min-height: 1.875rem;
31
- white-space: nowrap;
32
- }
33
-
34
- .breadcrumbs__item:first-child:not(.breadcrumbs__item--back) {
35
- font-family: var(--breadcrumb-font-black);
36
- }
37
-
38
- .breadcrumbs__item--back {
39
- max-width: 100%;
40
- }
41
-
42
- .breadcrumbs__link {
43
- color: inherit;
44
- text-decoration: none;
45
- transition: color 0.1s ease;
46
- white-space: nowrap;
47
- }
48
-
49
- .breadcrumbs__item--back .breadcrumbs__link {
50
- overflow: hidden;
51
- text-overflow: ellipsis;
52
- margin-right: 0.25rem;
53
- }
54
-
55
- .menu {
56
- background: none;
57
- color: inherit;
58
- cursor: pointer;
59
- border: 2px solid transparent;
60
- }
61
-
62
- .menu:focus-visible {
63
- outline: 2px solid var(--leu-color-func-cyan);
64
- outline-offset: 2px;
65
- }
66
-
67
- .dropdown {
68
- background-color: var(--leu-color-black-0);
69
- box-shadow: var(--leu-box-shadow-short);
70
- }
71
-
72
- .breadcrumbs {
73
- font-size: 1rem;
74
- }
75
-
76
- @media (width >= 320px) {
77
- .breadcrumbs {
78
- font-size: calc(2.5vw + 8px);
79
- }
80
- }
81
-
82
- @media (width >= 400px) {
83
- .breadcrumbs {
84
- font-size: 18px;
85
- }
86
- }
87
-
88
- @media (width >= 1024px) {
89
- .breadcrumbs {
90
- font-size: calc(0.7813vw + 10px);
91
- }
92
- }
93
-
94
- @media (width >= 1280px) {
95
- .breadcrumbs {
96
- font-size: 20px;
97
- }
98
- }
@@ -1,5 +0,0 @@
1
- import { LeuBreadcrumb } from "./Breadcrumb.js"
2
-
3
- export { LeuBreadcrumb }
4
-
5
- LeuBreadcrumb.define("leu-breadcrumb")
@@ -1,73 +0,0 @@
1
- import { html } from "lit"
2
- import "../leu-breadcrumb.js"
3
-
4
- export default {
5
- title: "Breadcrumb",
6
- component: "leu-breadcrumb",
7
- parameters: {
8
- design: {
9
- type: "figma",
10
- url: "https://www.figma.com/file/d6Pv21UVUbnBs3AdcZijHmbN/KTZH-Design-System?type=design&node-id=18100-258351&mode=design&t=lzVrtq8lxYVJU5TB-11",
11
- },
12
- html: {
13
- root: "[data-root]",
14
- },
15
- },
16
- }
17
-
18
- function Template({ items, inverted }) {
19
- return html`
20
- <div
21
- style=${inverted ? "background: var(--leu-color-accent-blue);" : ""}
22
- data-root
23
- >
24
- <leu-breadcrumb .items=${items} ?inverted=${inverted}></leu-breadcrumb>
25
- </div>
26
- <button
27
- @click=${() => {
28
- document.getElementsByTagName("leu-breadcrumb")[0].items = [
29
- { label: "Kanton Zürich", href: "https://zh.ch" },
30
- { label: "Bildung", href: "https://www.zh.ch/de/bildung.html" },
31
- {
32
- label: "Schulen",
33
- href: "https://www.zh.ch/de/bildung/schulen.html",
34
- },
35
- {
36
- label: "Volksschule",
37
- href: "https://www.zh.ch/de/bildung/schulen/volksschule.html",
38
- },
39
- ]
40
- }}
41
- style="margin-top:50px;"
42
- >
43
- update items
44
- </button>
45
- `
46
- }
47
-
48
- export const Regular = Template.bind({})
49
- Regular.argTypes = {
50
- _allListElementWidths: { table: { disable: true } },
51
- _visible: { table: { disable: true } },
52
- _small: { table: { disable: true } },
53
- _resizeListenerFunction: { table: { disable: true } },
54
- }
55
- Regular.args = {
56
- items: [
57
- { label: "Kanton Zürich", href: "https://zh.ch" },
58
- { label: "Gesundheit", href: "https://zh.ch/de/gesundheit.html" },
59
- {
60
- label: "Lebensmittel & Gebrauchsgegenstände",
61
- href: "https://zh.ch/de/gesundheit/lebensmittel-gebrauchsgegenstaende.html",
62
- },
63
- {
64
- label: "Lebensmittel",
65
- href: "https://zh.ch/de/gesundheit/lebensmittel-gebrauchsgegenstaende/lebensmittel.html",
66
- },
67
- {
68
- label: "Trinkwasser",
69
- href: "https://zh.ch/de/gesundheit/lebensmittel-gebrauchsgegenstaende/lebensmittel.html",
70
- },
71
- ],
72
- inverted: true,
73
- }