@statistikzh/leu 0.13.1 → 0.14.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.
- package/.eslintrc.json +8 -0
- package/.github/workflows/ci.yml +78 -0
- package/.github/workflows/deploy-github-pages.yaml +2 -1
- package/.github/workflows/release-please.yml +2 -1
- package/.nvmrc +1 -0
- package/.prettierignore +1 -0
- package/.storybook/main.js +19 -3
- package/.storybook/preview.js +11 -0
- package/CHANGELOG.md +27 -0
- package/README.md +0 -67
- package/custom-elements-manifest.config.js +2 -2
- package/dist/Accordion.d.ts +1 -1
- package/dist/Accordion.js +8 -8
- package/dist/Button.d.ts +2 -2
- package/dist/Button.js +2 -2
- package/dist/ButtonGroup.d.ts +1 -1
- package/dist/ButtonGroup.js +1 -1
- package/dist/Checkbox.d.ts +1 -1
- package/dist/Checkbox.d.ts.map +1 -1
- package/dist/Checkbox.js +2 -3
- package/dist/CheckboxGroup.d.ts +1 -1
- package/dist/CheckboxGroup.d.ts.map +1 -1
- package/dist/CheckboxGroup.js +1 -3
- package/dist/Chip.d.ts +1 -1
- package/dist/Chip.d.ts.map +1 -1
- package/dist/Chip.js +1 -3
- package/dist/ChipGroup.d.ts +1 -1
- package/dist/ChipGroup.d.ts.map +1 -1
- package/dist/ChipGroup.js +2 -2
- package/dist/ChipLink.js +1 -1
- package/dist/ChipRemovable.js +1 -1
- package/dist/ChipSelectable.js +1 -1
- package/dist/Dialog.d.ts +1 -1
- package/dist/Dialog.d.ts.map +1 -1
- package/dist/Dialog.js +3 -5
- package/dist/Dropdown.d.ts +1 -1
- package/dist/Dropdown.js +3 -3
- package/dist/Icon.d.ts +2 -98
- package/dist/Icon.d.ts.map +1 -1
- package/dist/Icon.js +1 -1
- package/dist/Input.d.ts +8 -3
- package/dist/Input.d.ts.map +1 -1
- package/dist/Input.js +18 -12
- package/dist/{LeuElement-b670d77c.d.ts → LeuElement-DH0PPSMq.d.ts} +1 -1
- package/dist/LeuElement-DH0PPSMq.d.ts.map +1 -0
- package/dist/{LeuElement-b670d77c.js → LeuElement-DH0PPSMq.js} +2 -2
- package/dist/Menu.d.ts +2 -2
- package/dist/Menu.js +1 -1
- package/dist/MenuItem.d.ts +3 -3
- package/dist/MenuItem.js +1 -1
- package/dist/Pagination.d.ts +1 -1
- package/dist/Pagination.js +3 -3
- package/dist/Popup.d.ts +2 -2
- package/dist/Popup.d.ts.map +1 -1
- package/dist/Popup.js +1 -3
- package/dist/Radio.d.ts +1 -1
- package/dist/Radio.d.ts.map +1 -1
- package/dist/Radio.js +1 -3
- package/dist/RadioGroup.d.ts +1 -1
- package/dist/RadioGroup.d.ts.map +1 -1
- package/dist/RadioGroup.js +1 -3
- package/dist/Range.d.ts +1 -1
- package/dist/Range.d.ts.map +1 -1
- package/dist/Range.js +17 -19
- package/dist/ScrollTop.d.ts +1 -1
- package/dist/ScrollTop.d.ts.map +1 -1
- package/dist/ScrollTop.js +27 -3
- package/dist/Select.d.ts +3 -7
- package/dist/Select.d.ts.map +1 -1
- package/dist/Select.js +7 -18
- package/dist/Spinner.d.ts +1 -1
- package/dist/Spinner.js +1 -1
- package/dist/Table.d.ts +1 -1
- package/dist/Table.d.ts.map +1 -1
- package/dist/Table.js +3 -4
- package/dist/VisuallyHidden.d.ts +1 -1
- package/dist/VisuallyHidden.d.ts.map +1 -1
- package/dist/VisuallyHidden.js +3 -5
- package/dist/{hasSlotController-c09741c5.d.ts → hasSlotController-CYd5tWew.d.ts} +1 -1
- package/dist/hasSlotController-CYd5tWew.d.ts.map +1 -0
- package/dist/{hasSlotController-c09741c5.js → hasSlotController-CYd5tWew.js} +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js +5 -7
- package/dist/leu-accordion.js +1 -1
- package/dist/leu-button-group.js +1 -1
- package/dist/leu-button.js +2 -2
- 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 +2 -2
- package/dist/leu-dropdown.js +2 -2
- 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-pagination.js +2 -2
- 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 +2 -3
- package/dist/leu-select.js +2 -2
- package/dist/leu-spinner.js +1 -1
- package/dist/leu-table.js +2 -2
- package/dist/leu-visually-hidden.js +1 -1
- package/dist/theme.css +143 -107
- package/dist/vscode.html-custom-data.json +4 -33
- package/dist/vue/index.d.ts +11 -78
- package/dist/web-types.json +247 -243
- package/index.js +0 -1
- package/package.json +55 -51
- package/rollup.config.js +3 -3
- package/scripts/generate-component/generate.js +5 -5
- package/scripts/generate-component/templates/stories/[name].stories.js +1 -1
- package/src/components/accordion/Accordion.js +1 -1
- package/src/components/accordion/accordion.css +6 -3
- package/src/components/accordion/stories/accordion.stories.js +7 -6
- package/src/components/accordion/test/accordion.test.js +24 -20
- package/src/components/button/Button.js +1 -1
- package/src/components/button/stories/button.stories.js +44 -46
- package/src/components/button/test/button.test.js +10 -10
- package/src/components/button-group/ButtonGroup.js +1 -1
- package/src/components/button-group/stories/button-group.stories.js +3 -3
- package/src/components/checkbox/checkbox.css +1 -0
- package/src/components/checkbox/stories/checkbox-group.stories.js +1 -1
- package/src/components/checkbox/stories/checkbox.stories.js +1 -1
- package/src/components/chip/ChipSelectable.js +1 -1
- package/src/components/chip/stories/chip-group.stories.js +5 -5
- package/src/components/chip/stories/chip-link.stories.js +1 -1
- package/src/components/chip/stories/chip-removable.stories.js +1 -1
- package/src/components/chip/stories/chip-selectable.stories.js +1 -1
- package/src/components/chip/test/chip-group.test.js +25 -33
- package/src/components/chip/test/chip-link.test.js +5 -5
- package/src/components/chip/test/chip-removable.test.js +6 -8
- package/src/components/chip/test/chip-selectable.test.js +9 -11
- package/src/components/dialog/stories/dialog.stories.js +1 -1
- package/src/components/dialog/test/dialog.test.js +1 -1
- package/src/components/dropdown/stories/dropdown.stories.js +1 -1
- package/src/components/dropdown/test/dropdown.test.js +12 -13
- package/src/components/icon/stories/icon.stories.js +1 -1
- package/src/components/input/Input.js +26 -18
- package/src/components/input/input.css +2 -2
- package/src/components/input/stories/input.stories.js +1 -4
- package/src/components/input/test/input.test.js +26 -0
- package/src/components/menu/stories/menu-item.stories.js +3 -1
- package/src/components/menu/stories/menu.stories.js +1 -1
- package/src/components/menu/test/menu-item.test.js +3 -2
- package/src/components/menu/test/menu.test.js +24 -22
- package/src/components/pagination/Pagination.js +1 -1
- package/src/components/pagination/pagination.css +1 -1
- package/src/components/pagination/stories/pagination.stories.js +3 -2
- package/src/components/pagination/test/pagination.test.js +8 -6
- package/src/components/popup/Popup.js +4 -4
- package/src/components/popup/stories/popup.stories.js +1 -1
- package/src/components/popup/test/popup.test.js +6 -8
- package/src/components/radio/RadioGroup.js +2 -2
- package/src/components/radio/stories/radio-group.stories.js +1 -1
- package/src/components/radio/stories/radio.stories.js +1 -1
- package/src/components/range/Range.js +20 -21
- package/src/components/range/stories/range-slider.stories.js +1 -1
- package/src/components/scroll-top/stories/scroll-top.stories.js +1 -1
- package/src/components/select/Select.js +7 -18
- package/src/components/select/stories/select.stories.js +3 -3
- package/src/components/select/test/select.test.js +18 -16
- package/src/components/spinner/stories/spinner.stories.js +1 -1
- package/src/components/table/Table.js +4 -4
- package/src/components/table/stories/table.stories.js +1 -1
- package/src/components/table/test/table.test.js +3 -2
- package/src/components/visually-hidden/stories/visually-hidden.stories.js +1 -1
- package/src/components/visually-hidden/test/visually-hidden.test.js +6 -8
- package/src/docs/contributing.mdx +154 -0
- package/src/docs/installation.mdx +35 -0
- package/src/docs/theme.mdx +349 -0
- package/src/docs/usage.mdx +73 -0
- package/src/lib/LeuElement.js +2 -2
- package/src/lib/hasSlotController.js +1 -1
- package/src/styles/style.stories.js +4 -2
- package/tsconfig.build.json +4 -3
- package/web-dev-server.config.mjs +1 -0
- package/web-test-runner.config.mjs +1 -1
- package/.github/workflows/test.yml +0 -38
- package/.storybook/preview-head.html +0 -2
- package/dist/Breadcrumb.d.ts +0 -69
- package/dist/Breadcrumb.d.ts.map +0 -1
- package/dist/Breadcrumb.js +0 -391
- package/dist/LeuElement-b670d77c.d.ts.map +0 -1
- package/dist/hasSlotController-c09741c5.d.ts.map +0 -1
- package/dist/leu-breadcrumb.d.ts +0 -3
- package/dist/leu-breadcrumb.d.ts.map +0 -1
- package/dist/leu-breadcrumb.js +0 -17
- package/dist/utils-65469421.d.ts +0 -16
- package/dist/utils-65469421.d.ts.map +0 -1
- package/dist/utils-65469421.js +0 -35
- package/src/components/breadcrumb/Breadcrumb.js +0 -324
- package/src/components/breadcrumb/breadcrumb.css +0 -98
- package/src/components/breadcrumb/leu-breadcrumb.js +0 -5
- package/src/components/breadcrumb/stories/breadcrumb.stories.js +0 -73
- package/src/components/breadcrumb/test/breadcrumb.test.js +0 -141
package/dist/Breadcrumb.js
DELETED
|
@@ -1,391 +0,0 @@
|
|
|
1
|
-
import { _ as _defineProperty, L as LeuElement } from './LeuElement-b670d77c.js';
|
|
2
|
-
import { css, nothing, html } from 'lit';
|
|
3
|
-
import { createRef, ref } from 'lit/directives/ref.js';
|
|
4
|
-
import { classMap } from 'lit/directives/class-map.js';
|
|
5
|
-
import { d as debounce } from './utils-65469421.js';
|
|
6
|
-
import { LeuIcon } from './Icon.js';
|
|
7
|
-
import { LeuMenu } from './Menu.js';
|
|
8
|
-
import { LeuMenuItem } from './MenuItem.js';
|
|
9
|
-
import { LeuPopup } from './Popup.js';
|
|
10
|
-
import { LeuVisuallyHidden } from './VisuallyHidden.js';
|
|
11
|
-
import 'lit/directives/if-defined.js';
|
|
12
|
-
import '@floating-ui/dom';
|
|
13
|
-
|
|
14
|
-
var css_248z = css`:host {
|
|
15
|
-
--breadcrumb-font-regular: var(--leu-font-family-regular);
|
|
16
|
-
--breadcrumb-font-black: var(--leu-font-family-black);
|
|
17
|
-
|
|
18
|
-
font-family: var(--leu-font-family-regular);
|
|
19
|
-
|
|
20
|
-
font-family: var(--breadcrumb-font-regular);
|
|
21
|
-
line-height: 1.5;
|
|
22
|
-
color: var(--leu-color-black-100);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
:host([inverted]) {
|
|
26
|
-
color: var(--leu-color-black-0);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.breadcrumbs__list {
|
|
30
|
-
display: flex;
|
|
31
|
-
align-items: center;
|
|
32
|
-
list-style-type: none;
|
|
33
|
-
margin: 0;
|
|
34
|
-
padding: 0;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.breadcrumbs--back-only .breadcrumbs__list {
|
|
38
|
-
overflow: hidden;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.breadcrumbs__item,
|
|
42
|
-
.breadcrumbs__icon {
|
|
43
|
-
align-items: center;
|
|
44
|
-
display: flex;
|
|
45
|
-
min-height: 1.875rem;
|
|
46
|
-
white-space: nowrap;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.breadcrumbs__item:first-child:not(.breadcrumbs__item--back) {
|
|
50
|
-
font-family: var(--breadcrumb-font-black);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.breadcrumbs__item--back {
|
|
54
|
-
max-width: 100%;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.breadcrumbs__link {
|
|
58
|
-
color: inherit;
|
|
59
|
-
-webkit-text-decoration: none;
|
|
60
|
-
text-decoration: none;
|
|
61
|
-
transition: color 0.1s ease;
|
|
62
|
-
white-space: nowrap;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.breadcrumbs__item--back .breadcrumbs__link {
|
|
66
|
-
overflow: hidden;
|
|
67
|
-
text-overflow: ellipsis;
|
|
68
|
-
margin-right: 0.25rem;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.menu {
|
|
72
|
-
background: none;
|
|
73
|
-
color: inherit;
|
|
74
|
-
cursor: pointer;
|
|
75
|
-
border: 2px solid transparent;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.menu:focus-visible {
|
|
79
|
-
outline: 2px solid var(--leu-color-func-cyan);
|
|
80
|
-
outline-offset: 2px;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.dropdown {
|
|
84
|
-
background-color: var(--leu-color-black-0);
|
|
85
|
-
box-shadow: var(--leu-box-shadow-short);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.breadcrumbs {
|
|
89
|
-
font-size: 1rem;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
@media (min-width: 320px) {
|
|
93
|
-
.breadcrumbs {
|
|
94
|
-
font-size: calc(2.5vw + 8px);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
@media (min-width: 400px) {
|
|
99
|
-
.breadcrumbs {
|
|
100
|
-
font-size: 18px;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
@media (min-width: 1024px) {
|
|
105
|
-
.breadcrumbs {
|
|
106
|
-
font-size: calc(0.7813vw + 10px);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
@media (min-width: 1280px) {
|
|
111
|
-
.breadcrumbs {
|
|
112
|
-
font-size: 20px;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
`;
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* A Breadcrumb Navigation.
|
|
119
|
-
*
|
|
120
|
-
* The breadcrumbs can be displayed in two different layouts.
|
|
121
|
-
* Only the back link (the last item / parent of the current page)
|
|
122
|
-
* is displayed when…
|
|
123
|
-
* - … the width of the container is smaller
|
|
124
|
-
* than the BACK_ONLY_BREAKPOINT.
|
|
125
|
-
* - … less then two breadcrumb items could be displayed
|
|
126
|
-
* without overflowing the container.
|
|
127
|
-
*
|
|
128
|
-
* Otherwise as many items as possible are displayed in an inline list
|
|
129
|
-
* without overflowing the container. The remaining items are displayed
|
|
130
|
-
* in a dropdown menu.
|
|
131
|
-
*
|
|
132
|
-
* In order to determine the exact numbers of items that have to be
|
|
133
|
-
* hidden inside the dropdown, all of them have to be rendered first.
|
|
134
|
-
* 1. Render all items
|
|
135
|
-
* 2. Calculate (measure) the number of items that can be displayed
|
|
136
|
-
* without overflowing the container.
|
|
137
|
-
* 3. Updating the state (_hiddeItems) which will trigger a rerender
|
|
138
|
-
* 4. Render the items again with the new state.
|
|
139
|
-
*
|
|
140
|
-
* This results in multiple updates scheduled one after another. Lit
|
|
141
|
-
* will also print a waring in the console beacause of that.
|
|
142
|
-
* It's no a nice behaviour but the only one that works without
|
|
143
|
-
* having duplicate and hidden markup to derive the sizes from that.
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
* @prop {Array} items - Object array with { label, href }
|
|
147
|
-
* @prop {boolean} inverted - invert color on dark background
|
|
148
|
-
*
|
|
149
|
-
* @tagname leu-breadcrumb
|
|
150
|
-
*/
|
|
151
|
-
class LeuBreadcrumb extends LeuElement {
|
|
152
|
-
constructor() {
|
|
153
|
-
super();
|
|
154
|
-
/** @type {Array} */
|
|
155
|
-
_defineProperty(this, "_handleResize", async () => {
|
|
156
|
-
const containerOffsetWidth = this._containerRef.value.offsetWidth;
|
|
157
|
-
const sizeIsGrowing = containerOffsetWidth > this._lastContainerWidth;
|
|
158
|
-
this._lastContainerWidth = containerOffsetWidth;
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Show only the back link (parent of the current page)
|
|
162
|
-
* when the width of the container is smaller than the BACK_ONLY_BREAKPOINT
|
|
163
|
-
*/
|
|
164
|
-
if (containerOffsetWidth <= LeuBreadcrumb.BACK_ONLY_BREAKPOINT) {
|
|
165
|
-
this._showBackOnly = true;
|
|
166
|
-
this._isRecalculating = false;
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
this._showBackOnly = false;
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* In order to calculate how many items can be displayed
|
|
173
|
-
* when the container is growing, all items have to
|
|
174
|
-
* be marked as displayed (_hiddenItems = 0) and
|
|
175
|
-
* rendered.
|
|
176
|
-
*/
|
|
177
|
-
if (sizeIsGrowing && this._hiddenItems > 0) {
|
|
178
|
-
this._hiddenItems = 0;
|
|
179
|
-
this._isRecalculating = true;
|
|
180
|
-
await this.updateComplete;
|
|
181
|
-
}
|
|
182
|
-
this._checkWidth();
|
|
183
|
-
});
|
|
184
|
-
/** @internal */
|
|
185
|
-
_defineProperty(this, "_handleDropdownToggle", e => {
|
|
186
|
-
e.stopPropagation();
|
|
187
|
-
this._isDropdownOpen = !this._isDropdownOpen;
|
|
188
|
-
if (this._isDropdownOpen) {
|
|
189
|
-
window.addEventListener("click", this._closeDropdown);
|
|
190
|
-
} else {
|
|
191
|
-
window.removeEventListener("click", this._closeDropdown);
|
|
192
|
-
}
|
|
193
|
-
});
|
|
194
|
-
_defineProperty(this, "_closeDropdown", () => {
|
|
195
|
-
this._isDropdownOpen = false;
|
|
196
|
-
window.removeEventListener("click", this._closeDropdown);
|
|
197
|
-
});
|
|
198
|
-
this.items = [];
|
|
199
|
-
/** @type {boolean} - will be used on dark Background */
|
|
200
|
-
this.inverted = false;
|
|
201
|
-
|
|
202
|
-
/** @internal */
|
|
203
|
-
this._containerRef = createRef();
|
|
204
|
-
/** @internal */
|
|
205
|
-
this._hiddenItems = 0;
|
|
206
|
-
/** @internal */
|
|
207
|
-
this._showBackOnly = null;
|
|
208
|
-
/** @internal */
|
|
209
|
-
this._lastContainerWidth = null;
|
|
210
|
-
/**
|
|
211
|
-
* @internal
|
|
212
|
-
* Forces the toggle button to be rendered
|
|
213
|
-
* so that all possible inline items will be measured.
|
|
214
|
-
* */
|
|
215
|
-
this._isRecalculating = true;
|
|
216
|
-
/** @internal */
|
|
217
|
-
this._isDropdownOpen = false;
|
|
218
|
-
this.resizeObserver = new ResizeObserver(debounce(() => {
|
|
219
|
-
this._handleResize();
|
|
220
|
-
}, 500));
|
|
221
|
-
}
|
|
222
|
-
firstUpdated() {
|
|
223
|
-
this.resizeObserver.observe(this._containerRef.value);
|
|
224
|
-
}
|
|
225
|
-
async updated(changedProperties) {
|
|
226
|
-
if (changedProperties.has("items")) {
|
|
227
|
-
this._hiddenItems = 0;
|
|
228
|
-
this._isRecalculating = true;
|
|
229
|
-
await this.updateComplete;
|
|
230
|
-
this._checkWidth();
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
disconnectedCallback() {
|
|
234
|
-
super.disconnectedCallback();
|
|
235
|
-
window.removeEventListener("click", this._closeDropdown);
|
|
236
|
-
this.resizeObserver.disconnect();
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
/** @internal */
|
|
240
|
-
get _listItems() {
|
|
241
|
-
return this.items.toSpliced(1, this._hiddenItems);
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
/** @internal */
|
|
245
|
-
get _dropdownItems() {
|
|
246
|
-
return this.items.slice(1, 1 + this._hiddenItems);
|
|
247
|
-
}
|
|
248
|
-
/**
|
|
249
|
-
* Calculate the number of items that can be displayed
|
|
250
|
-
* without overflowing the container.
|
|
251
|
-
* @internal
|
|
252
|
-
* @returns {void}
|
|
253
|
-
*/
|
|
254
|
-
_checkWidth() {
|
|
255
|
-
const containerOffsetWidth = this._containerRef.value.offsetWidth;
|
|
256
|
-
const containerScrollWidth = this._containerRef.value.scrollWidth;
|
|
257
|
-
this._lastContainerWidth = containerOffsetWidth;
|
|
258
|
-
|
|
259
|
-
/** When the container is not overflowing, nothing has to be done */
|
|
260
|
-
if (containerOffsetWidth === containerScrollWidth) {
|
|
261
|
-
this._isRecalculating = false;
|
|
262
|
-
return;
|
|
263
|
-
}
|
|
264
|
-
const listItems = this._containerRef.value.querySelectorAll("li:not([data-dropdown-toggle])");
|
|
265
|
-
const listItemWidths = [...listItems].map(o => o.offsetWidth);
|
|
266
|
-
let hiddenItems = 0;
|
|
267
|
-
let hiddenItemsWidth = 0;
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
* Remove item by item until the sum of the remaining items
|
|
271
|
-
* is smaller than the width of the container.
|
|
272
|
-
* The first item will not be removed.
|
|
273
|
-
*/
|
|
274
|
-
while (hiddenItems < listItemWidths.length && containerOffsetWidth < containerScrollWidth - hiddenItemsWidth) {
|
|
275
|
-
hiddenItems += 1;
|
|
276
|
-
hiddenItemsWidth = listItemWidths.slice(1, 1 + hiddenItems).reduce((sum, itemWidth) => sum + itemWidth, 0);
|
|
277
|
-
}
|
|
278
|
-
this._hiddenItems += hiddenItems;
|
|
279
|
-
this._isRecalculating = false;
|
|
280
|
-
}
|
|
281
|
-
/**
|
|
282
|
-
* Render the dropdown menu
|
|
283
|
-
* @returns
|
|
284
|
-
*/
|
|
285
|
-
renderDropdown() {
|
|
286
|
-
if (this._dropdownItems.length === 0 && !this._isRecalculating) return nothing;
|
|
287
|
-
return html`
|
|
288
|
-
<li class="breadcrumbs__item" data-dropdown-toggle>
|
|
289
|
-
<span class="breadcrumbs__icon"
|
|
290
|
-
><leu-icon name="angleRight"></leu-icon
|
|
291
|
-
></span>
|
|
292
|
-
<leu-popup
|
|
293
|
-
?active=${this._isDropdownOpen}
|
|
294
|
-
placement="bottom-start"
|
|
295
|
-
shift
|
|
296
|
-
shiftPadding="8"
|
|
297
|
-
autoSize="width"
|
|
298
|
-
autoSizePadding="8"
|
|
299
|
-
>
|
|
300
|
-
<button
|
|
301
|
-
slot="anchor"
|
|
302
|
-
class="menu"
|
|
303
|
-
@click=${this._handleDropdownToggle}
|
|
304
|
-
tabindex="0"
|
|
305
|
-
>
|
|
306
|
-
…
|
|
307
|
-
</button>
|
|
308
|
-
<div class="dropdown">
|
|
309
|
-
${html`
|
|
310
|
-
<leu-menu>
|
|
311
|
-
${this._dropdownItems.map(item => html`
|
|
312
|
-
<leu-menu-item href=${item.href}
|
|
313
|
-
>${item.label}</leu-menu-item
|
|
314
|
-
>
|
|
315
|
-
`)}
|
|
316
|
-
</leu-menu>
|
|
317
|
-
`}
|
|
318
|
-
</div>
|
|
319
|
-
</leu-popup>
|
|
320
|
-
</li>
|
|
321
|
-
`;
|
|
322
|
-
}
|
|
323
|
-
render() {
|
|
324
|
-
if (this.items.length < 2) return nothing;
|
|
325
|
-
const parentItem = this.items[this.items.length - 2];
|
|
326
|
-
const showBackOnly = this._showBackOnly || this.items.length - this._hiddenItems < 2;
|
|
327
|
-
const wrapperClasses = {
|
|
328
|
-
breadcrumbs: true,
|
|
329
|
-
"breadcrumbs--back-only": showBackOnly
|
|
330
|
-
};
|
|
331
|
-
return html`
|
|
332
|
-
<nav class=${classMap(wrapperClasses)}>
|
|
333
|
-
<leu-visually-hidden><h2>Sie sind hier:</h2></leu-visually-hidden>
|
|
334
|
-
<ol class="breadcrumbs__list" ref=${ref(this._containerRef)}>
|
|
335
|
-
${showBackOnly ? html` <li class="breadcrumbs__item breadcrumbs__item--back">
|
|
336
|
-
<span class="breadcrumbs__icon"
|
|
337
|
-
><leu-icon name="arrowLeft"></leu-icon
|
|
338
|
-
></span>
|
|
339
|
-
<a class="breadcrumbs__link" href=${parentItem.href}
|
|
340
|
-
>${parentItem.label}</a
|
|
341
|
-
>
|
|
342
|
-
</li>` : this._listItems.map((item, index, list) => html`
|
|
343
|
-
<li class="breadcrumbs__item">
|
|
344
|
-
${index > 0 ? html`<span class="breadcrumbs__icon"
|
|
345
|
-
><leu-icon name="angleRight"></leu-icon
|
|
346
|
-
></span>` // First list item doesn't have an arrow
|
|
347
|
-
: nothing}
|
|
348
|
-
${index === list.length - 1 ? item.label // Last list item doesn't contain a link
|
|
349
|
-
: html`<a class="breadcrumbs__link" href=${item.href}
|
|
350
|
-
>${item.label}</a
|
|
351
|
-
>`}
|
|
352
|
-
</li>
|
|
353
|
-
${index === 0 ? this.renderDropdown() : nothing}
|
|
354
|
-
`)}
|
|
355
|
-
</ol>
|
|
356
|
-
</nav>
|
|
357
|
-
`;
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
_defineProperty(LeuBreadcrumb, "dependencies", {
|
|
361
|
-
"leu-icon": LeuIcon,
|
|
362
|
-
"leu-menu": LeuMenu,
|
|
363
|
-
"leu-menu-item": LeuMenuItem,
|
|
364
|
-
"leu-popup": LeuPopup,
|
|
365
|
-
"leu-visually-hidden": LeuVisuallyHidden
|
|
366
|
-
});
|
|
367
|
-
_defineProperty(LeuBreadcrumb, "styles", [LeuElement.styles, css_248z]);
|
|
368
|
-
_defineProperty(LeuBreadcrumb, "properties", {
|
|
369
|
-
items: {
|
|
370
|
-
type: Array
|
|
371
|
-
},
|
|
372
|
-
inverted: {
|
|
373
|
-
type: Boolean,
|
|
374
|
-
reflect: true
|
|
375
|
-
},
|
|
376
|
-
_hiddenItems: {
|
|
377
|
-
state: true
|
|
378
|
-
},
|
|
379
|
-
_showBackOnly: {
|
|
380
|
-
state: true
|
|
381
|
-
},
|
|
382
|
-
_isRecalculating: {
|
|
383
|
-
state: true
|
|
384
|
-
},
|
|
385
|
-
_isDropdownOpen: {
|
|
386
|
-
state: true
|
|
387
|
-
}
|
|
388
|
-
});
|
|
389
|
-
_defineProperty(LeuBreadcrumb, "BACK_ONLY_BREAKPOINT", 320);
|
|
390
|
-
|
|
391
|
-
export { LeuBreadcrumb };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LeuElement-b670d77c.d.ts","sourceRoot":"","sources":["LeuElement-b670d77c.js"],"names":[],"mappings":"AAgDA;IACE,8EAcC;CACF;AA9DD,sEAaC;2BAf+B,KAAK"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hasSlotController-c09741c5.d.ts","sourceRoot":"","sources":["hasSlotController-c09741c5.js"],"names":[],"mappings":";;;;iCASa,OAAO,KAAK,EAAE,kBAAkB;AAP7C;;;GAGG;AAEH;;;;GAIG;AACH;IACE,uCAcC;IAHC,UAAgB;IAEhB,eAA0B;IAG5B;;;OAGG;IACH,uBAeC;IAED;;;;OAIG;IACH,qBAEC;IAED;;;OAGG;IACH,gCAEC;IACD,sBAEC;IACD,yBAEC;CACF"}
|
package/dist/leu-breadcrumb.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"leu-breadcrumb.d.ts","sourceRoot":"","sources":["leu-breadcrumb.js"],"names":[],"mappings":";8BAA8B,iBAAiB"}
|
package/dist/leu-breadcrumb.js
DELETED
|
@@ -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 };
|
package/dist/utils-65469421.d.ts
DELETED
|
@@ -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"}
|
package/dist/utils-65469421.js
DELETED
|
@@ -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 };
|