@statistikzh/leu 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/deploy-github-pages.yaml +33 -0
- package/.storybook/main.js +27 -1
- package/.storybook/manager-head.html +1 -0
- package/.storybook/manager.js +9 -0
- package/.storybook/preview-head.html +1 -1
- package/.storybook/preview.js +59 -5
- package/.storybook/static/logo.svg +19 -0
- package/.storybook/theme.js +7 -0
- package/CHANGELOG.md +30 -0
- package/README.md +1 -1
- package/dist/Button.js +15 -18
- package/dist/ButtonGroup.js +5 -7
- package/dist/Checkbox.js +101 -84
- package/dist/CheckboxGroup.js +41 -37
- package/dist/{Chip-5f70d04f.js → Chip-dac7337d.js} +5 -1
- package/dist/ChipGroup.js +2 -5
- package/dist/ChipLink.js +4 -7
- package/dist/ChipRemovable.js +4 -7
- package/dist/ChipSelectable.js +4 -7
- package/dist/Dropdown.js +55 -26
- package/dist/Input.js +29 -28
- package/dist/Menu.js +2 -5
- package/dist/MenuItem.js +30 -15
- package/dist/Pagination.js +54 -54
- package/dist/Radio.js +7 -6
- package/dist/RadioGroup.js +41 -39
- package/dist/Select.js +55 -43
- package/dist/Table.js +137 -120
- package/dist/{defineElement-ba770aed.js → _rollupPluginBabelHelpers-20f659f4.js} +1 -15
- package/dist/defineElement-47d4f665.js +15 -0
- package/dist/index.js +29 -19
- package/dist/leu-button-group.js +7 -3
- package/dist/leu-button.js +6 -3
- package/dist/leu-checkbox-group.js +6 -3
- package/dist/leu-checkbox.js +6 -3
- package/dist/leu-chip-group.js +6 -3
- package/dist/leu-chip-link.js +7 -4
- package/dist/leu-chip-removable.js +7 -4
- package/dist/leu-chip-selectable.js +7 -4
- package/dist/leu-dropdown.js +13 -3
- package/dist/leu-input.js +7 -3
- package/dist/leu-menu-item.js +8 -3
- package/dist/leu-menu.js +6 -3
- package/dist/leu-pagination.js +8 -3
- package/dist/leu-popup-4bf6f1f4.js +216 -0
- package/dist/leu-radio-group.js +6 -3
- package/dist/leu-radio.js +6 -3
- package/dist/leu-select.js +14 -3
- package/dist/leu-table.js +9 -3
- package/package.json +24 -12
- package/scripts/generate-component/templates/[Name].js +0 -5
- package/scripts/generate-component/templates/[name].css +1 -1
- package/scripts/generate-component/templates/[namespace]-[name].js +5 -2
- package/src/components/accordion/Accordion.js +0 -6
- package/src/components/accordion/leu-accordion.js +5 -2
- package/src/components/accordion/stories/accordion.stories.js +7 -4
- package/src/components/accordion/test/accordion.test.js +92 -2
- package/src/components/breadcrumb/Breadcrumb.js +310 -0
- package/src/components/breadcrumb/breadcrumb.css +114 -0
- package/src/components/breadcrumb/leu-breadcrumb.js +6 -0
- package/src/components/breadcrumb/stories/breadcrumb.stories.js +73 -0
- package/src/components/breadcrumb/test/breadcrumb.test.js +141 -0
- package/src/components/button/Button.js +10 -15
- package/src/components/button/button.css +3 -3
- package/src/components/button/leu-button.js +5 -2
- package/src/components/button/stories/button.stories.js +58 -37
- package/src/components/button/test/button.test.js +112 -2
- package/src/components/button-group/ButtonGroup.js +1 -7
- package/src/components/button-group/leu-button-group.js +5 -2
- package/src/components/button-group/stories/button-group.stories.js +6 -0
- package/src/components/button-group/test/button-group.test.js +79 -3
- package/src/components/checkbox/Checkbox.js +6 -85
- package/src/components/checkbox/CheckboxGroup.js +8 -38
- package/src/components/checkbox/checkbox-group.css +29 -0
- package/src/components/checkbox/checkbox.css +76 -0
- package/src/components/checkbox/leu-checkbox-group.js +5 -2
- package/src/components/checkbox/leu-checkbox.js +5 -2
- package/src/components/checkbox/stories/checkbox-group.stories.js +44 -21
- package/src/components/checkbox/stories/checkbox.stories.js +7 -1
- package/src/components/checkbox/test/checkbox-group.test.js +124 -0
- package/src/components/checkbox/test/checkbox.test.js +72 -59
- package/src/components/chip/Chip.js +1 -0
- package/src/components/chip/ChipGroup.js +0 -5
- package/src/components/chip/ChipLink.js +1 -6
- package/src/components/chip/ChipRemovable.js +1 -6
- package/src/components/chip/ChipSelectable.js +1 -6
- package/src/components/chip/exports.js +4 -10
- package/src/components/chip/leu-chip-group.js +5 -2
- package/src/components/chip/leu-chip-link.js +5 -2
- package/src/components/chip/leu-chip-removable.js +5 -2
- package/src/components/chip/leu-chip-selectable.js +5 -2
- package/src/components/chip/stories/chip-group.stories.js +18 -6
- package/src/components/chip/stories/chip-link.stories.js +16 -4
- package/src/components/chip/stories/chip-removable.stories.js +15 -4
- package/src/components/chip/stories/chip-selectable.stories.js +13 -3
- package/src/components/chip/test/chip-group.test.js +124 -0
- package/src/components/chip/test/chip-link.test.js +58 -0
- package/src/components/chip/test/chip-removable.test.js +79 -0
- package/src/components/chip/test/chip-selectable.test.js +95 -0
- package/src/components/chip/test/chip.test.js +1 -1
- package/src/components/dropdown/Dropdown.js +52 -24
- package/src/components/dropdown/dropdown.css +1 -2
- package/src/components/dropdown/leu-dropdown.js +5 -2
- package/src/components/dropdown/stories/dropdown.stories.js +11 -5
- package/src/components/dropdown/test/dropdown.test.js +6 -6
- package/src/components/icon/icon.js +1 -1
- package/src/components/icon/test/icon.test.js +66 -0
- package/src/components/input/Input.js +18 -24
- package/src/components/input/input.css +9 -6
- package/src/components/input/leu-input.js +5 -2
- package/src/components/input/stories/input.stories.js +8 -2
- package/src/components/input/test/input.test.js +431 -4
- package/src/components/menu/Menu.js +0 -5
- package/src/components/menu/MenuItem.js +20 -13
- package/src/components/menu/leu-menu-item.js +5 -2
- package/src/components/menu/leu-menu.js +5 -2
- package/src/components/menu/menu-item.css +5 -2
- package/src/components/menu/stories/menu-item.stories.js +13 -4
- package/src/components/menu/stories/menu.stories.js +11 -5
- package/src/components/menu/test/menu-item.test.js +180 -0
- package/src/components/menu/test/menu.test.js +10 -2
- package/src/components/pagination/Pagination.js +53 -65
- package/src/components/pagination/leu-pagination.js +5 -2
- package/src/components/pagination/stories/pagination.stories.js +17 -9
- package/src/components/pagination/test/pagination.test.js +191 -5
- package/src/components/popup/Popup.js +200 -0
- package/src/components/popup/leu-popup.js +6 -0
- package/src/components/popup/popup.css +27 -0
- package/src/components/popup/stories/popup.stories.js +58 -0
- package/src/components/popup/test/popup.test.js +29 -0
- package/src/components/radio/Radio.js +2 -6
- package/src/components/radio/RadioGroup.js +6 -38
- package/src/components/radio/leu-radio-group.js +5 -2
- package/src/components/radio/leu-radio.js +5 -2
- package/src/components/radio/radio-group.css +29 -0
- package/src/components/radio/stories/radio-group.stories.js +38 -19
- package/src/components/radio/stories/radio.stories.js +7 -1
- package/src/components/radio/test/radio-group.test.js +86 -0
- package/src/components/radio/test/radio.test.js +108 -17
- package/src/components/select/Select.js +34 -31
- package/src/components/select/leu-select.js +5 -2
- package/src/components/select/select.css +13 -13
- package/src/components/select/stories/select.stories.js +15 -168
- package/src/components/select/test/fixtures.js +162 -0
- package/src/components/select/test/select.test.js +236 -12
- package/src/components/table/Table.js +43 -118
- package/src/components/table/leu-table.js +5 -2
- package/src/components/table/stories/table.stories.js +20 -10
- package/src/components/table/table.css +99 -0
- package/src/components/table/test/table.test.js +1 -1
- package/src/lib/utils.js +17 -0
- package/{web-dev-server-storybook.config.mjs → web-dev-server.config.mjs} +1 -2
- package/web-test-runner.config.mjs +15 -2
package/dist/Pagination.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { _ as _defineProperty
|
|
1
|
+
import { _ as _defineProperty } from './_rollupPluginBabelHelpers-20f659f4.js';
|
|
2
2
|
import { css, LitElement, html } from 'lit';
|
|
3
|
-
import {
|
|
3
|
+
import { live } from 'lit/directives/live.js';
|
|
4
|
+
import './leu-button.js';
|
|
5
|
+
import './defineElement-47d4f665.js';
|
|
6
|
+
import './Button.js';
|
|
4
7
|
import 'lit/directives/class-map.js';
|
|
5
8
|
import './icon-03e86700.js';
|
|
6
9
|
|
|
@@ -71,36 +74,47 @@ class LeuPagination extends LitElement {
|
|
|
71
74
|
/** @type {number} */
|
|
72
75
|
this.page = 1;
|
|
73
76
|
/** @type {number} */
|
|
74
|
-
this.
|
|
77
|
+
this.numOfItems = 1;
|
|
75
78
|
/** @type {number} */
|
|
76
|
-
this.
|
|
79
|
+
this.itemsPerPage = 1;
|
|
77
80
|
}
|
|
78
81
|
get maxPage() {
|
|
79
|
-
return Math.ceil(this.
|
|
82
|
+
return Math.ceil(this.numOfItems / this.itemsPerPage);
|
|
80
83
|
}
|
|
81
84
|
get firstPage() {
|
|
82
|
-
return this.
|
|
85
|
+
return this.boundPage === MIN_PAGE;
|
|
83
86
|
}
|
|
84
87
|
get lastPage() {
|
|
85
|
-
return this.
|
|
88
|
+
return this.boundPage === this.maxPage;
|
|
86
89
|
}
|
|
87
|
-
|
|
88
|
-
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* The boundPage getter is necessary to ensure that the current page (this.page) is always within the valid range of pages.
|
|
93
|
+
* It prevents the page number from going below the minimum page limit (MIN_PAGE) or above the maximum page limit (this.maxPage).
|
|
94
|
+
* This is important for the correct functioning of the pagination system, as it prevents users from navigating to non-existent pages.
|
|
95
|
+
*
|
|
96
|
+
* @returns {number}
|
|
97
|
+
*/
|
|
98
|
+
get boundPage() {
|
|
99
|
+
return Math.min(Math.max(this.page, MIN_PAGE), this.maxPage);
|
|
89
100
|
}
|
|
90
101
|
numberUpdate(number) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
102
|
+
const prevPage = this.page;
|
|
103
|
+
this.page = number;
|
|
104
|
+
if (this.page !== prevPage) {
|
|
105
|
+
const startIndex = (this.boundPage - 1) * this.itemsPerPage;
|
|
106
|
+
const endIndex = Math.min(startIndex + this.itemsPerPage, this.numOfItems);
|
|
107
|
+
this.dispatchEvent(new CustomEvent("leu:pagechange", {
|
|
108
|
+
detail: {
|
|
109
|
+
startIndex,
|
|
110
|
+
endIndex,
|
|
111
|
+
page: this.boundPage
|
|
112
|
+
},
|
|
113
|
+
bubbles: false
|
|
114
|
+
}));
|
|
115
|
+
}
|
|
101
116
|
}
|
|
102
117
|
change(event) {
|
|
103
|
-
// target.value = this.page // eslint-disable-line
|
|
104
118
|
this.numberUpdate(parseInt(event.target.value, 10) || 0);
|
|
105
119
|
}
|
|
106
120
|
input(event) {
|
|
@@ -110,35 +124,22 @@ class LeuPagination extends LitElement {
|
|
|
110
124
|
}
|
|
111
125
|
}
|
|
112
126
|
keydown(event) {
|
|
113
|
-
|
|
114
|
-
const numberKeys = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"];
|
|
115
|
-
if (!numberKeys.includes(event.key) && !specialKeys.includes(event.key)) {
|
|
127
|
+
if (event.key === "ArrowUp") {
|
|
116
128
|
event.preventDefault();
|
|
117
|
-
|
|
118
|
-
if (event.key === "ArrowUp") {
|
|
119
|
-
event.preventDefault();
|
|
120
|
-
this.numberUpdate(this.page + 1);
|
|
121
|
-
}
|
|
122
|
-
if (event.key === "ArrowDown") {
|
|
123
|
-
event.preventDefault();
|
|
124
|
-
this.numberUpdate(this.page - 1);
|
|
125
|
-
}
|
|
129
|
+
this.numberUpdate(this.boundPage + 1);
|
|
126
130
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
requestUpdate(name, oldValue, newValue) {
|
|
132
|
-
if (name === "itemsOnAPage") {
|
|
133
|
-
this.numberUpdate(this.page);
|
|
131
|
+
if (event.key === "ArrowDown") {
|
|
132
|
+
event.preventDefault();
|
|
133
|
+
this.numberUpdate(this.boundPage - 1);
|
|
134
134
|
}
|
|
135
|
-
return super.requestUpdate(name, oldValue, newValue);
|
|
136
135
|
}
|
|
137
136
|
render() {
|
|
138
137
|
return html`
|
|
139
138
|
<input
|
|
140
139
|
class="input"
|
|
141
|
-
|
|
140
|
+
min=${MIN_PAGE}
|
|
141
|
+
max=${this.maxPage}
|
|
142
|
+
.value=${live(this.boundPage.toString())}
|
|
142
143
|
@input=${this.input}
|
|
143
144
|
@change=${this.change}
|
|
144
145
|
@keydown=${this.keydown}
|
|
@@ -149,7 +150,7 @@ class LeuPagination extends LitElement {
|
|
|
149
150
|
icon="angleLeft"
|
|
150
151
|
variant="secondary"
|
|
151
152
|
@click=${_ => {
|
|
152
|
-
this.numberUpdate(this.
|
|
153
|
+
this.numberUpdate(this.boundPage - 1);
|
|
153
154
|
}}
|
|
154
155
|
?disabled=${this.firstPage}
|
|
155
156
|
></leu-button>
|
|
@@ -157,7 +158,7 @@ class LeuPagination extends LitElement {
|
|
|
157
158
|
icon="angleRight"
|
|
158
159
|
variant="secondary"
|
|
159
160
|
@click=${_ => {
|
|
160
|
-
this.numberUpdate(this.
|
|
161
|
+
this.numberUpdate(this.boundPage + 1);
|
|
161
162
|
}}
|
|
162
163
|
?disabled=${this.lastPage}
|
|
163
164
|
style="margin-left:4px;"
|
|
@@ -166,6 +167,13 @@ class LeuPagination extends LitElement {
|
|
|
166
167
|
}
|
|
167
168
|
}
|
|
168
169
|
_defineProperty(LeuPagination, "styles", css_248z);
|
|
170
|
+
/**
|
|
171
|
+
* @internal
|
|
172
|
+
*/
|
|
173
|
+
_defineProperty(LeuPagination, "shadowRootOptions", {
|
|
174
|
+
...LitElement.shadowRootOptions,
|
|
175
|
+
delegatesFocus: true
|
|
176
|
+
});
|
|
169
177
|
_defineProperty(LeuPagination, "events", {
|
|
170
178
|
range: {}
|
|
171
179
|
});
|
|
@@ -174,22 +182,14 @@ _defineProperty(LeuPagination, "properties", {
|
|
|
174
182
|
type: Number,
|
|
175
183
|
reflect: true
|
|
176
184
|
},
|
|
177
|
-
|
|
185
|
+
itemsPerPage: {
|
|
178
186
|
type: Number,
|
|
179
187
|
reflect: true
|
|
180
188
|
},
|
|
181
|
-
|
|
189
|
+
numOfItems: {
|
|
182
190
|
type: Number,
|
|
183
191
|
reflect: true
|
|
184
|
-
},
|
|
185
|
-
_minPage: {
|
|
186
|
-
type: Number,
|
|
187
|
-
state: true
|
|
188
192
|
}
|
|
189
193
|
});
|
|
190
|
-
function definePaginationElements() {
|
|
191
|
-
defineButtonElements();
|
|
192
|
-
defineElement("pagination", LeuPagination);
|
|
193
|
-
}
|
|
194
194
|
|
|
195
|
-
export { LeuPagination
|
|
195
|
+
export { LeuPagination };
|
package/dist/Radio.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as _defineProperty
|
|
1
|
+
import { _ as _defineProperty } from './_rollupPluginBabelHelpers-20f659f4.js';
|
|
2
2
|
import { css, LitElement, html } from 'lit';
|
|
3
3
|
|
|
4
4
|
var css_248z = css`:host {
|
|
@@ -124,7 +124,7 @@ class LeuRadio extends LitElement {
|
|
|
124
124
|
?disabled=${this.disabled}
|
|
125
125
|
.value=${this.value}
|
|
126
126
|
/>
|
|
127
|
-
<label for=${this.identifier} class="label"
|
|
127
|
+
<label for=${this.identifier} class="label">${this.label}</label>
|
|
128
128
|
`;
|
|
129
129
|
}
|
|
130
130
|
}
|
|
@@ -153,10 +153,11 @@ _defineProperty(LeuRadio, "properties", {
|
|
|
153
153
|
name: {
|
|
154
154
|
type: String,
|
|
155
155
|
reflect: true
|
|
156
|
+
},
|
|
157
|
+
label: {
|
|
158
|
+
type: String,
|
|
159
|
+
reflect: true
|
|
156
160
|
}
|
|
157
161
|
});
|
|
158
|
-
function defineRadioElements() {
|
|
159
|
-
defineElement("radio", LeuRadio);
|
|
160
|
-
}
|
|
161
162
|
|
|
162
|
-
export { LeuRadio
|
|
163
|
+
export { LeuRadio };
|
package/dist/RadioGroup.js
CHANGED
|
@@ -1,7 +1,40 @@
|
|
|
1
|
-
import { _ as _defineProperty
|
|
1
|
+
import { _ as _defineProperty } from './_rollupPluginBabelHelpers-20f659f4.js';
|
|
2
2
|
import { css, LitElement, html } from 'lit';
|
|
3
3
|
import { classMap } from 'lit/directives/class-map.js';
|
|
4
4
|
|
|
5
|
+
var css_248z = css`:host {
|
|
6
|
+
--group-font-regular: var(--leu-font-regular);
|
|
7
|
+
--group-font-black: var(--leu-font-black);
|
|
8
|
+
|
|
9
|
+
font-family: var(--leu-font-regular);
|
|
10
|
+
|
|
11
|
+
font-family: var(--group-font-regular);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.fieldset {
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: flex-start;
|
|
17
|
+
flex-wrap: wrap;
|
|
18
|
+
gap: 0.5rem 1rem;
|
|
19
|
+
|
|
20
|
+
border: none;
|
|
21
|
+
padding: 0;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.fieldset--vertical {
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
gap: 1rem;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.legend {
|
|
30
|
+
font-family: var(--group-font-black);
|
|
31
|
+
font-size: 1.125rem;
|
|
32
|
+
line-height: 1.5;
|
|
33
|
+
|
|
34
|
+
margin-bottom: 0.5rem;
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
|
|
5
38
|
/**
|
|
6
39
|
* @tagname leu-radio-group
|
|
7
40
|
*/
|
|
@@ -73,7 +106,6 @@ class LeuRadioGroup extends LitElement {
|
|
|
73
106
|
item.checked = item === selectingItem; // eslint-disable-line no-param-reassign
|
|
74
107
|
});
|
|
75
108
|
}
|
|
76
|
-
|
|
77
109
|
selectNextItem(startingIndex, direction) {
|
|
78
110
|
let selected = false;
|
|
79
111
|
for (let index = 0; index < this.items.length; index += 1) {
|
|
@@ -97,7 +129,6 @@ class LeuRadioGroup extends LitElement {
|
|
|
97
129
|
}
|
|
98
130
|
});
|
|
99
131
|
}
|
|
100
|
-
|
|
101
132
|
handleItems() {
|
|
102
133
|
this.items = [...this.querySelectorAll(":scope > *:not([slot])")];
|
|
103
134
|
this.initializeIndex();
|
|
@@ -115,51 +146,22 @@ class LeuRadioGroup extends LitElement {
|
|
|
115
146
|
};
|
|
116
147
|
return html`
|
|
117
148
|
<fieldset class=${classMap(fieldsetClasses)}>
|
|
118
|
-
<legend class="legend"
|
|
149
|
+
<legend class="legend">${this.label}</legend>
|
|
119
150
|
<slot @slotchange=${this.handleSlotChange}></slot>
|
|
120
151
|
</fieldset>
|
|
121
152
|
`;
|
|
122
153
|
}
|
|
123
154
|
}
|
|
124
|
-
_defineProperty(LeuRadioGroup, "styles",
|
|
125
|
-
:host {
|
|
126
|
-
--group-font-regular: var(--leu-font-regular);
|
|
127
|
-
--group-font-black: var(--leu-font-black);
|
|
128
|
-
|
|
129
|
-
font-family: var(--group-font-regular);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
.fieldset {
|
|
133
|
-
display: flex;
|
|
134
|
-
align-items: flex-start;
|
|
135
|
-
flex-wrap: wrap;
|
|
136
|
-
gap: 0.5rem 1rem;
|
|
137
|
-
|
|
138
|
-
border: none;
|
|
139
|
-
padding: 0;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
.fieldset--vertical {
|
|
143
|
-
flex-direction: column;
|
|
144
|
-
gap: 1rem;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
.legend {
|
|
148
|
-
font-family: var(--group-font-black);
|
|
149
|
-
font-size: 1.125rem;
|
|
150
|
-
line-height: 1.5;
|
|
151
|
-
|
|
152
|
-
margin-bottom: 0.5rem;
|
|
153
|
-
}
|
|
154
|
-
`);
|
|
155
|
+
_defineProperty(LeuRadioGroup, "styles", css_248z);
|
|
155
156
|
_defineProperty(LeuRadioGroup, "properties", {
|
|
156
157
|
orientation: {
|
|
157
158
|
type: String,
|
|
158
159
|
reflect: true
|
|
160
|
+
},
|
|
161
|
+
label: {
|
|
162
|
+
type: String,
|
|
163
|
+
reflect: true
|
|
159
164
|
}
|
|
160
165
|
});
|
|
161
|
-
function defineRadioGroupElements() {
|
|
162
|
-
defineElement("radio-group", LeuRadioGroup);
|
|
163
|
-
}
|
|
164
166
|
|
|
165
|
-
export { LeuRadioGroup
|
|
167
|
+
export { LeuRadioGroup };
|
package/dist/Select.js
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
1
|
-
import { _ as _defineProperty
|
|
1
|
+
import { _ as _defineProperty } from './_rollupPluginBabelHelpers-20f659f4.js';
|
|
2
2
|
import { css, LitElement, html, nothing } from 'lit';
|
|
3
3
|
import { classMap } from 'lit/directives/class-map.js';
|
|
4
4
|
import { map } from 'lit/directives/map.js';
|
|
5
5
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
6
6
|
import { createRef, ref } from 'lit/directives/ref.js';
|
|
7
7
|
import { I as Icon } from './icon-03e86700.js';
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
8
|
+
import './leu-button.js';
|
|
9
|
+
import './leu-menu.js';
|
|
10
|
+
import './leu-menu-item.js';
|
|
11
|
+
import './leu-input.js';
|
|
12
|
+
import './leu-popup-4bf6f1f4.js';
|
|
13
|
+
import './defineElement-47d4f665.js';
|
|
14
|
+
import './Button.js';
|
|
15
|
+
import './Menu.js';
|
|
16
|
+
import './MenuItem.js';
|
|
17
|
+
import 'lit/static-html.js';
|
|
18
|
+
import './Input.js';
|
|
19
|
+
import 'lit/directives/live.js';
|
|
20
|
+
import '@floating-ui/dom';
|
|
12
21
|
|
|
13
22
|
/**
|
|
14
23
|
* Thanks Shoelace!
|
|
@@ -262,18 +271,22 @@ var css_248z = css`:host,
|
|
|
262
271
|
}
|
|
263
272
|
|
|
264
273
|
.select-menu-container {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
274
|
+
position: static;
|
|
275
|
+
overflow: auto;
|
|
276
|
+
|
|
277
|
+
display: flex;
|
|
278
|
+
flex-direction: column;
|
|
279
|
+
|
|
268
280
|
width: 100%;
|
|
269
|
-
|
|
270
|
-
|
|
281
|
+
max-height: var(--auto-size-available-height);
|
|
282
|
+
|
|
271
283
|
padding: 0;
|
|
272
284
|
margin: 0;
|
|
273
|
-
|
|
274
|
-
|
|
285
|
+
|
|
286
|
+
border: none;
|
|
287
|
+
border-radius: 1px;
|
|
288
|
+
background-color: white;
|
|
275
289
|
box-shadow: var(--select-box-shadow-regular), var(--select-box-shadow-short);
|
|
276
|
-
overflow: auto;
|
|
277
290
|
}
|
|
278
291
|
|
|
279
292
|
.select-menu {
|
|
@@ -281,11 +294,7 @@ var css_248z = css`:host,
|
|
|
281
294
|
padding: 0;
|
|
282
295
|
margin: 0;
|
|
283
296
|
overflow: auto;
|
|
284
|
-
max-height:
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
.select-menu.multiple {
|
|
288
|
-
max-height: 21rem;
|
|
297
|
+
max-height: 100%;
|
|
289
298
|
}
|
|
290
299
|
|
|
291
300
|
.before,
|
|
@@ -351,7 +360,6 @@ class LeuSelect extends LitElement {
|
|
|
351
360
|
reflect: true
|
|
352
361
|
},
|
|
353
362
|
optionFilter: {
|
|
354
|
-
type: String,
|
|
355
363
|
state: true
|
|
356
364
|
}
|
|
357
365
|
};
|
|
@@ -534,14 +542,15 @@ class LeuSelect extends LitElement {
|
|
|
534
542
|
before=${ifDefined(beforeIcon)}
|
|
535
543
|
@click=${() => this.selectOption(option)}
|
|
536
544
|
role="option"
|
|
545
|
+
label=${LeuSelect.getOptionLabel(option)}
|
|
537
546
|
?active=${isSelected}
|
|
538
547
|
aria-selected=${isSelected}
|
|
539
548
|
>
|
|
540
|
-
${LeuSelect.getOptionLabel(option)}
|
|
541
549
|
</leu-menu-item>`;
|
|
542
|
-
}) : html`<leu-menu-item
|
|
543
|
-
|
|
544
|
-
|
|
550
|
+
}) : html`<leu-menu-item
|
|
551
|
+
label=${this.optionFilter === "" ? "Keine Optionen" : "Keine Resultate"}
|
|
552
|
+
disabled
|
|
553
|
+
></leu-menu-item>`}
|
|
545
554
|
</leu-menu>
|
|
546
555
|
`;
|
|
547
556
|
}
|
|
@@ -553,8 +562,8 @@ class LeuSelect extends LitElement {
|
|
|
553
562
|
@input=${this.handleFilterInput}
|
|
554
563
|
clearable
|
|
555
564
|
ref=${ref(this.optionFilterRef)}
|
|
556
|
-
|
|
557
|
-
>`;
|
|
565
|
+
label="Nach Stichwort filtern"
|
|
566
|
+
></leu-input>`;
|
|
558
567
|
}
|
|
559
568
|
return nothing;
|
|
560
569
|
}
|
|
@@ -588,6 +597,7 @@ class LeuSelect extends LitElement {
|
|
|
588
597
|
aria-expanded="${this.open}"
|
|
589
598
|
role="combobox"
|
|
590
599
|
ref=${ref(this.toggleButtonRef)}
|
|
600
|
+
slot="anchor"
|
|
591
601
|
>
|
|
592
602
|
<span class="label" id="select-label">${this.label}</span>
|
|
593
603
|
<span class="value"> ${this.getDisplayValue(this.value)} </span>
|
|
@@ -616,27 +626,29 @@ class LeuSelect extends LitElement {
|
|
|
616
626
|
aria-labelledby="select-label"
|
|
617
627
|
@keydown=${this.handleKeyDown}
|
|
618
628
|
>
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
629
|
+
<leu-popup
|
|
630
|
+
?active=${this.open}
|
|
631
|
+
placement="bottom-start"
|
|
632
|
+
flip
|
|
633
|
+
matchSize="width"
|
|
634
|
+
autoSize="height"
|
|
635
|
+
autoSizePadding="8"
|
|
624
636
|
>
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
637
|
+
${this.renderToggleButton()}
|
|
638
|
+
<dialog
|
|
639
|
+
id="select-dialog"
|
|
640
|
+
class="select-menu-container"
|
|
641
|
+
?open=${this.open}
|
|
642
|
+
>
|
|
643
|
+
<slot name="before" class="before"></slot>
|
|
644
|
+
${this.renderFilterInput()} ${this.renderMenu()}
|
|
645
|
+
${this.renderApplyButton()}
|
|
646
|
+
<slot name="after" class="after"></slot>
|
|
647
|
+
</dialog>
|
|
648
|
+
</leu-popup>
|
|
630
649
|
</div> `;
|
|
631
650
|
}
|
|
632
651
|
}
|
|
633
652
|
_defineProperty(LeuSelect, "styles", css_248z);
|
|
634
|
-
function defineSelectElements() {
|
|
635
|
-
defineButtonElements();
|
|
636
|
-
defineMenuElements();
|
|
637
|
-
defineMenuItemElements();
|
|
638
|
-
defineInputElements();
|
|
639
|
-
defineElement("select", LeuSelect);
|
|
640
|
-
}
|
|
641
653
|
|
|
642
|
-
export { LeuSelect
|
|
654
|
+
export { LeuSelect };
|