@statistikzh/leu 0.26.0 → 0.28.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/.release-please-manifest.json +1 -1
- package/.storybook/main.ts +1 -1
- package/.storybook/preview.ts +6 -4
- package/.storybook/static/global.css +5 -0
- package/CHANGELOG.md +44 -0
- package/dist/{Accordion-B04QkmHz.js → Accordion-D9kLsiBW.js} +1 -1
- package/dist/Accordion.d.ts +1 -1
- package/dist/Accordion.js +2 -2
- package/dist/{Button-BgNUxmo_.d.ts → Button-DcuvEVkC.d.ts} +14 -12
- package/dist/{Button-BkhqVjug.js → Button-DyNVOHCd.js} +90 -82
- package/dist/Button.d.ts +1 -1
- package/dist/Button.js +4 -4
- package/dist/{ButtonGroup-B8U9fDvM.js → ButtonGroup-MEh4vb5a.js} +2 -2
- package/dist/ButtonGroup.d.ts +1 -1
- package/dist/ButtonGroup.js +5 -5
- package/dist/{ChartWrapper-CSMFwz9e.js → ChartWrapper-DAl91BIN.js} +2 -2
- package/dist/ChartWrapper.d.ts +3 -3
- package/dist/ChartWrapper.js +3 -3
- package/dist/{Checkbox-Dd1QLpfn.js → Checkbox-CGGyUW9U.js} +2 -2
- package/dist/Checkbox.d.ts +3 -3
- package/dist/Checkbox.js +3 -3
- package/dist/{CheckboxGroup-Bz2eWEFL.js → CheckboxGroup-DXt5iMdj.js} +2 -2
- package/dist/CheckboxGroup.d.ts +1 -1
- package/dist/CheckboxGroup.js +4 -4
- package/dist/{Chip-XAQIIsXq.js → Chip-BGs71WGH.js} +1 -1
- package/dist/{Chip-DLKM9P7v.d.ts → Chip-DVGjEPJE.d.ts} +1 -1
- package/dist/Chip.d.ts +1 -1
- package/dist/Chip.js +2 -2
- package/dist/{ChipGroup-Ta8Ht4jc.d.ts → ChipGroup-BK5BYM0X.d.ts} +2 -2
- package/dist/{ChipGroup-DLqfK2kn.js → ChipGroup-BcGyusP-.js} +1 -1
- package/dist/ChipGroup.d.ts +1 -1
- package/dist/ChipGroup.js +3 -3
- package/dist/{ChipLink-BAxyQO2M.d.ts → ChipLink-BdG2o-nk.d.ts} +1 -1
- package/dist/ChipLink.d.ts +1 -1
- package/dist/ChipLink.js +2 -2
- package/dist/{ChipRemovable-DBjwt0CH.d.ts → ChipRemovable-CCwSQTAL.d.ts} +2 -2
- package/dist/ChipRemovable.d.ts +1 -1
- package/dist/ChipRemovable.js +3 -3
- package/dist/{ChipSelectable-CMJNcE4U.d.ts → ChipSelectable-BQ3VLVi5.d.ts} +1 -1
- package/dist/ChipSelectable.d.ts +1 -1
- package/dist/ChipSelectable.js +2 -2
- package/dist/{Dialog-DHuXR_oo.js → Dialog-BzuyL1U3.js} +2 -2
- package/dist/Dialog.d.ts +3 -3
- package/dist/Dialog.js +3 -3
- package/dist/{Dropdown-DtFTePbc.js → Dropdown-plyBTM15.js} +5 -5
- package/dist/Dropdown.d.ts +6 -6
- package/dist/Dropdown.js +8 -8
- package/dist/{FileInput-b8sbLDPI.js → FileInput-BT3Fe-0J.js} +22 -7
- package/dist/FileInput.d.ts +16 -5
- package/dist/FileInput.js +6 -6
- package/dist/{Icon-Op80LrrO.d.ts → Icon-CUfh3eb3.d.ts} +1 -1
- package/dist/{Icon-C_yYuynf.js → Icon-D83qesg5.js} +1 -1
- package/dist/Icon.d.ts +1 -1
- package/dist/Icon.js +2 -2
- package/dist/{Input-DEOVocTa.js → Input-D7zS50oz.js} +32 -11
- package/dist/{Input-D2THgo7c.d.ts → Input-fEiQvGDF.d.ts} +9 -5
- package/dist/Input.d.ts +1 -1
- package/dist/Input.js +3 -3
- package/dist/{LeuElement-BeFrgKes.js → LeuElement-DQI8cqZV.js} +1 -1
- package/dist/{Menu-BeqqtCw6.js → Menu-DRU1LiMM.js} +2 -2
- package/dist/{Menu-CQdx1ef3.d.ts → Menu-Z2b7dsB5.d.ts} +2 -2
- package/dist/Menu.d.ts +1 -1
- package/dist/Menu.js +4 -4
- package/dist/{MenuItem-DVg8-1Bq.js → MenuItem-DCttylRO.js} +2 -2
- package/dist/{MenuItem-QcgnRk_7.d.ts → MenuItem-LY4TRIho.d.ts} +2 -2
- package/dist/MenuItem.d.ts +1 -1
- package/dist/MenuItem.js +3 -3
- package/dist/{Message-BhknWvAF.js → Message-0NxnKEqw.js} +2 -2
- package/dist/Message.d.ts +2 -2
- package/dist/Message.js +3 -3
- package/dist/{Pagination-CqkHh-Vd.d.ts → Pagination-9eZ8WMvR.d.ts} +4 -4
- package/dist/{Pagination-DJI5MIi_.js → Pagination-CIy7YvWE.js} +4 -4
- package/dist/Pagination.d.ts +1 -1
- package/dist/Pagination.js +6 -6
- package/dist/{Placeholder-BJybFwSg.js → Placeholder-Dol_X5Hp.js} +1 -1
- package/dist/Placeholder.d.ts +1 -1
- package/dist/Placeholder.js +2 -2
- package/dist/{Popup-Btgm2a3D.d.ts → Popup-B5iDSLIO.d.ts} +1 -1
- package/dist/{Popup-DNlm_9AA.js → Popup-nJrJHGSy.js} +1 -1
- package/dist/Popup.d.ts +1 -1
- package/dist/Popup.js +2 -2
- package/dist/{ProgressBar-B0wYj1KF.js → ProgressBar-Dmq9veqU.js} +1 -1
- package/dist/ProgressBar.d.ts +1 -1
- package/dist/ProgressBar.js +2 -2
- package/dist/{Radio-DMCL8c4D.js → Radio-W5ck_IJI.js} +1 -1
- package/dist/Radio.d.ts +1 -1
- package/dist/Radio.js +2 -2
- package/dist/{RadioGroup-CM6IyBlq.js → RadioGroup-De5x2YCO.js} +2 -2
- package/dist/RadioGroup.d.ts +1 -1
- package/dist/RadioGroup.js +3 -3
- package/dist/{Range-B72rtfln.js → Range-NCdfDkeD.js} +1 -1
- package/dist/Range.d.ts +1 -1
- package/dist/Range.js +2 -2
- package/dist/{ScrollTop-BFAqBVDR.js → ScrollTop-DwcNIKmN.js} +20 -20
- package/dist/ScrollTop.d.ts +8 -8
- package/dist/ScrollTop.js +5 -5
- package/dist/{Select-vxl3BvD4.js → Select-Bpicra9q.js} +153 -134
- package/dist/Select.d.ts +80 -78
- package/dist/Select.js +9 -9
- package/dist/{Spinner-DDTqijTO.js → Spinner-BBiVZxFH.js} +1 -1
- package/dist/{Spinner-CrM1enM0.d.ts → Spinner-DHYaX6-Y.d.ts} +1 -1
- package/dist/Spinner.d.ts +1 -1
- package/dist/Spinner.js +2 -2
- package/dist/Tab-CN97q0nj.d.ts +30 -0
- package/dist/Tab-Ce9nrDok.js +117 -0
- package/dist/Tab.d.ts +2 -0
- package/dist/Tab.js +3 -0
- package/dist/TabGroup-C-cd4Wcx.js +248 -0
- package/dist/TabGroup.d.ts +64 -0
- package/dist/TabGroup.js +5 -0
- package/dist/TabPanel-BW1ydVBT.js +65 -0
- package/dist/TabPanel-DQgWP7LO.d.ts +26 -0
- package/dist/TabPanel.d.ts +2 -0
- package/dist/TabPanel.js +3 -0
- package/dist/{Table-BgCxfBcm.js → Table-DiYqIzBu.js} +3 -3
- package/dist/Table.d.ts +3 -3
- package/dist/Table.js +7 -7
- package/dist/{Tag-DK2KkPIQ.js → Tag-Ct8Hhv7W.js} +1 -1
- package/dist/Tag.d.ts +1 -1
- package/dist/Tag.js +2 -2
- package/dist/{VisuallyHidden-OeQvhxYn.d.ts → VisuallyHidden-CB7aRJzF.d.ts} +1 -1
- package/dist/{VisuallyHidden-pll3amXE.js → VisuallyHidden-CpYXyuC7.js} +1 -1
- package/dist/VisuallyHidden.d.ts +1 -1
- package/dist/VisuallyHidden.js +2 -2
- package/dist/index.d.ts +14 -14
- package/dist/index.js +30 -30
- package/dist/leu-accordion.js +2 -2
- package/dist/leu-button-group.js +5 -5
- package/dist/leu-button.d.ts +1 -1
- package/dist/leu-button.js +4 -4
- package/dist/leu-chart-wrapper.js +3 -3
- package/dist/leu-checkbox-group.js +4 -4
- package/dist/leu-checkbox.js +3 -3
- package/dist/leu-chip-group.d.ts +1 -1
- package/dist/leu-chip-group.js +3 -3
- package/dist/leu-chip-link.d.ts +1 -1
- package/dist/leu-chip-link.js +2 -2
- package/dist/leu-chip-removable.d.ts +1 -1
- package/dist/leu-chip-removable.js +3 -3
- package/dist/leu-chip-selectable.d.ts +1 -1
- package/dist/leu-chip-selectable.js +2 -2
- package/dist/leu-dialog.js +3 -3
- package/dist/leu-dropdown.js +8 -8
- package/dist/leu-file-input.js +6 -6
- package/dist/leu-icon.d.ts +1 -1
- package/dist/leu-icon.js +2 -2
- package/dist/leu-input.d.ts +1 -1
- package/dist/leu-input.js +3 -3
- package/dist/leu-menu-item.d.ts +1 -1
- package/dist/leu-menu-item.js +3 -3
- package/dist/leu-menu.d.ts +1 -1
- package/dist/leu-menu.js +4 -4
- package/dist/leu-message.js +3 -3
- package/dist/leu-pagination.d.ts +1 -1
- package/dist/leu-pagination.js +6 -6
- package/dist/leu-placeholder.js +2 -2
- package/dist/leu-popup.d.ts +1 -1
- package/dist/leu-popup.js +2 -2
- package/dist/leu-progress-bar.js +2 -2
- package/dist/leu-radio-group.js +3 -3
- package/dist/leu-radio.js +2 -2
- package/dist/leu-range.js +2 -2
- package/dist/leu-scroll-top.js +5 -5
- package/dist/leu-select.js +9 -9
- package/dist/leu-spinner.d.ts +1 -1
- package/dist/leu-spinner.js +2 -2
- package/dist/leu-tab-group.d.ts +10 -0
- package/dist/leu-tab-group.js +8 -0
- package/dist/leu-tab-panel.d.ts +10 -0
- package/dist/leu-tab-panel.js +6 -0
- package/dist/leu-tab.d.ts +10 -0
- package/dist/leu-tab.js +6 -0
- package/dist/leu-table.js +7 -7
- package/dist/leu-tag.js +2 -2
- package/dist/leu-visually-hidden.d.ts +1 -1
- package/dist/leu-visually-hidden.js +2 -2
- package/dist/vscode.html-custom-data.json +90 -35
- package/dist/vue/index.d.ts +89 -29
- package/dist/web-types.json +182 -76
- package/package.json +1 -2
- package/src/components/button/Button.ts +45 -30
- package/src/components/button/button.css +55 -54
- package/src/components/button/stories/button.stories.ts +17 -20
- package/src/components/button/test/button.test.ts +46 -0
- package/src/components/file-input/FileInput.ts +24 -5
- package/src/components/input/Input.ts +43 -8
- package/src/components/input/test/input.test.ts +106 -1
- package/src/components/scroll-top/ScrollTop.ts +18 -16
- package/src/components/select/Select.ts +198 -125
- package/src/components/select/select.css +4 -0
- package/src/components/select/stories/select.stories.ts +10 -0
- package/src/components/select/test/select.test.ts +440 -35
- package/src/components/tab/Tab.ts +72 -0
- package/src/components/tab/TabGroup.ts +267 -0
- package/src/components/tab/TabPanel.ts +59 -0
- package/src/components/tab/leu-tab-group.ts +11 -0
- package/src/components/tab/leu-tab-panel.ts +11 -0
- package/src/components/tab/leu-tab.ts +11 -0
- package/src/components/tab/stories/tab.stories.ts +97 -0
- package/src/components/tab/tab-group.css +63 -0
- package/src/components/tab/tab-panel.css +10 -0
- package/src/components/tab/tab.css +54 -0
- package/src/components/tab/test/tab-group.test.ts +426 -0
- package/src/components/tab/test/tab-panel.test.ts +102 -0
- package/src/components/tab/test/tab.test.ts +139 -0
- package/tsconfig.json +1 -0
- /package/dist/{FormAssociatedMixin-Cc74LjbC.d.ts → FormAssociatedMixin-Cw7LsSUE.d.ts} +0 -0
- /package/dist/{LeuElement-pJFU18Xm.d.ts → LeuElement-DK1jntuu.d.ts} +0 -0
- /package/dist/{hasSlotController-DWPyZ52b.d.ts → hasSlotController-BjKyhJm-.d.ts} +0 -0
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import { t as LeuElement } from "./LeuElement-
|
|
2
|
-
import { t as
|
|
1
|
+
import { t as LeuElement } from "./LeuElement-DQI8cqZV.js";
|
|
2
|
+
import { t as __decorate } from "./decorate-DwpAc4D0.js";
|
|
3
|
+
import { t as LeuIcon } from "./Icon-D83qesg5.js";
|
|
3
4
|
import { t as HasSlotController } from "./hasSlotController-DSBCVzPD.js";
|
|
4
|
-
import { t as LeuButton } from "./Button-
|
|
5
|
-
import { t as
|
|
6
|
-
import { t as
|
|
7
|
-
import { t as
|
|
8
|
-
import { t as
|
|
5
|
+
import { t as LeuButton } from "./Button-DyNVOHCd.js";
|
|
6
|
+
import { t as FormAssociatedMixin } from "./FormAssociatedMixin-DLPvFtbT.js";
|
|
7
|
+
import { t as LeuMenuItem } from "./MenuItem-DCttylRO.js";
|
|
8
|
+
import { t as LeuMenu } from "./Menu-DRU1LiMM.js";
|
|
9
|
+
import { t as LeuPopup } from "./Popup-nJrJHGSy.js";
|
|
10
|
+
import { t as LeuInput } from "./Input-D7zS50oz.js";
|
|
9
11
|
import { css, html, nothing } from "lit";
|
|
12
|
+
import { property, state } from "lit/decorators.js";
|
|
10
13
|
import { classMap } from "lit/directives/class-map.js";
|
|
11
14
|
import { ifDefined } from "lit/directives/if-defined.js";
|
|
12
15
|
import { createRef, ref } from "lit/directives/ref.js";
|
|
@@ -107,6 +110,10 @@ var select_default = css`:host {
|
|
|
107
110
|
font-family: var(--select-font-regular);
|
|
108
111
|
}
|
|
109
112
|
|
|
113
|
+
:host([required]) .label::after {
|
|
114
|
+
content: "*";
|
|
115
|
+
}
|
|
116
|
+
|
|
110
117
|
.clear-button {
|
|
111
118
|
--_length: 1.5rem;
|
|
112
119
|
|
|
@@ -248,17 +255,33 @@ var select_default = css`:host {
|
|
|
248
255
|
* @tagname leu-select
|
|
249
256
|
* @slot before - Optional content the appears before the option list
|
|
250
257
|
* @slot after - Optional content the appears after the option list
|
|
251
|
-
* @property {string} name - Reflects to the name attribute of the hidden input field that would be used in a form
|
|
252
|
-
* @property {boolean} open - The expanded state of the popup
|
|
253
|
-
* @property {string} label - The label of the select
|
|
254
|
-
* @property {array} value - List of selected values. If they're set from outside the component, the select element tries to find all the options with the given values and selects them.
|
|
255
|
-
* @property {boolean} clearable - Show a clearable button to reset the value
|
|
256
|
-
* @property {boolean} disabled - If the select should be disabled
|
|
257
|
-
* @property {boolean} filterable - Show an input field to filter the options inside the popup
|
|
258
|
-
* @property {boolean} multiple - Allow multiple selections
|
|
259
258
|
* @attribute {string} value - The selected values separated by commas.
|
|
260
259
|
*/
|
|
261
|
-
var LeuSelect = class extends LeuElement {
|
|
260
|
+
var LeuSelect = class extends FormAssociatedMixin(LeuElement) {
|
|
261
|
+
constructor(..._args) {
|
|
262
|
+
super(..._args);
|
|
263
|
+
this.label = "";
|
|
264
|
+
this.defaultValue = [];
|
|
265
|
+
this.clearable = false;
|
|
266
|
+
this.filterable = false;
|
|
267
|
+
this.multiple = false;
|
|
268
|
+
this.required = false;
|
|
269
|
+
this.open = false;
|
|
270
|
+
this._optionFilter = "";
|
|
271
|
+
this._hasFilterResults = true;
|
|
272
|
+
this._displayValue = "";
|
|
273
|
+
this._deferedChangeEvent = false;
|
|
274
|
+
this._optionFilterRef = createRef();
|
|
275
|
+
this._toggleButtonRef = createRef();
|
|
276
|
+
this._menuRef = createRef();
|
|
277
|
+
this.hasSlotController = new HasSlotController(this, ["before", "after"]);
|
|
278
|
+
this._handleDocumentClick = (event) => {
|
|
279
|
+
if (!event.composedPath().includes(this) && this.open) this._closeDropdown();
|
|
280
|
+
};
|
|
281
|
+
this._handleKeyDown = (event) => {
|
|
282
|
+
if (event.key === "Escape") this._closeDropdown();
|
|
283
|
+
};
|
|
284
|
+
}
|
|
262
285
|
static {
|
|
263
286
|
this.dependencies = {
|
|
264
287
|
"leu-button": LeuButton,
|
|
@@ -272,90 +295,49 @@ var LeuSelect = class extends LeuElement {
|
|
|
272
295
|
static {
|
|
273
296
|
this.styles = [LeuElement.styles, select_default];
|
|
274
297
|
}
|
|
275
|
-
static
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
reflect: true
|
|
280
|
-
},
|
|
281
|
-
open: {
|
|
282
|
-
type: Boolean,
|
|
283
|
-
reflect: true
|
|
284
|
-
},
|
|
285
|
-
label: {
|
|
286
|
-
type: String,
|
|
287
|
-
reflect: true
|
|
288
|
-
},
|
|
289
|
-
value: {
|
|
290
|
-
type: Array,
|
|
291
|
-
converter: { fromAttribute(value) {
|
|
292
|
-
if (value) return value.split(",").map((v) => v.trim());
|
|
293
|
-
return value;
|
|
294
|
-
} }
|
|
295
|
-
},
|
|
296
|
-
clearable: {
|
|
297
|
-
type: Boolean,
|
|
298
|
-
reflect: true
|
|
299
|
-
},
|
|
300
|
-
disabled: {
|
|
301
|
-
type: Boolean,
|
|
302
|
-
reflect: true
|
|
303
|
-
},
|
|
304
|
-
filterable: {
|
|
305
|
-
type: Boolean,
|
|
306
|
-
reflect: true
|
|
307
|
-
},
|
|
308
|
-
multiple: {
|
|
309
|
-
type: Boolean,
|
|
310
|
-
reflect: true
|
|
311
|
-
},
|
|
312
|
-
_optionFilter: { state: true },
|
|
313
|
-
_hasFilterResults: { state: true },
|
|
314
|
-
_displayValue: { state: true }
|
|
298
|
+
static {
|
|
299
|
+
this.shadowRootOptions = {
|
|
300
|
+
...LeuElement.shadowRootOptions,
|
|
301
|
+
delegatesFocus: true
|
|
315
302
|
};
|
|
316
303
|
}
|
|
304
|
+
/**
|
|
305
|
+
* List of selected values. If they're set from outside the component, the select element
|
|
306
|
+
* finds all the options that match the given values and selects them.
|
|
307
|
+
*/
|
|
308
|
+
set value(value) {
|
|
309
|
+
/**
|
|
310
|
+
* @todo Check if all of the value items are actually present in the options
|
|
311
|
+
*/
|
|
312
|
+
this._value = value;
|
|
313
|
+
}
|
|
314
|
+
get value() {
|
|
315
|
+
return this._value ?? this.defaultValue;
|
|
316
|
+
}
|
|
317
317
|
static getOptionLabel(option) {
|
|
318
318
|
if (typeof option === "object" && option !== null) return option.label;
|
|
319
319
|
return option;
|
|
320
320
|
}
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
};
|
|
330
|
-
this.
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
this.
|
|
335
|
-
this.filterable = false;
|
|
336
|
-
this.value = [];
|
|
337
|
-
this.label = "";
|
|
338
|
-
this.name = "";
|
|
339
|
-
/** @internal */
|
|
340
|
-
this._optionFilter = "";
|
|
341
|
-
/** @internal */
|
|
342
|
-
this._hasFilterResults = true;
|
|
343
|
-
/** @internal */
|
|
344
|
-
this._deferedChangeEvent = false;
|
|
345
|
-
/** @internal */
|
|
321
|
+
setFormValue() {
|
|
322
|
+
const isEmpty = this.value.length === 0 || !this.value.some((v) => v !== "");
|
|
323
|
+
if (isEmpty || this.disabled) this.internals.setFormValue(null);
|
|
324
|
+
else if (this.multiple) {
|
|
325
|
+
const formData = new FormData();
|
|
326
|
+
this.value.forEach((v) => formData.append(this.name ?? "", v));
|
|
327
|
+
this.internals.setFormValue(formData);
|
|
328
|
+
} else this.internals.setFormValue(this.value[0]);
|
|
329
|
+
if (this.required && isEmpty) this.internals.setValidity({ valueMissing: true }, "Bitte wählen Sie eine Option aus.");
|
|
330
|
+
else this.internals.setValidity({});
|
|
331
|
+
}
|
|
332
|
+
formResetCallback() {
|
|
333
|
+
super.formResetCallback();
|
|
334
|
+
this.value = this.defaultValue;
|
|
346
335
|
this._displayValue = "";
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
this.
|
|
351
|
-
|
|
352
|
-
* @type {import("lit/directives/ref").Ref<HTMLButtonElement>}
|
|
353
|
-
*/
|
|
354
|
-
this._toggleButtonRef = createRef();
|
|
355
|
-
/**
|
|
356
|
-
* @type {import("lit/directives/ref").Ref<import("../menu/Menu").LeuMenu>}
|
|
357
|
-
*/
|
|
358
|
-
this._menuRef = createRef();
|
|
336
|
+
}
|
|
337
|
+
willUpdate(changedProperties) {
|
|
338
|
+
super.willUpdate(changedProperties);
|
|
339
|
+
if (changedProperties.has("defaultValue") && !changedProperties.has("value") && !this.hasInteracted) this.value = this.defaultValue;
|
|
340
|
+
if (changedProperties.has("value") || changedProperties.has("defaultValue") || changedProperties.has("name") || changedProperties.has("disabled") || changedProperties.has("required")) this.setFormValue();
|
|
359
341
|
}
|
|
360
342
|
connectedCallback() {
|
|
361
343
|
super.connectedCallback();
|
|
@@ -375,13 +357,15 @@ var LeuSelect = class extends LeuElement {
|
|
|
375
357
|
multiple: changedProperties.has("multiple")
|
|
376
358
|
});
|
|
377
359
|
}
|
|
360
|
+
click() {
|
|
361
|
+
this._toggleButtonRef.value?.click();
|
|
362
|
+
}
|
|
378
363
|
/**
|
|
379
364
|
* Apply the current state to the menu items.
|
|
380
365
|
* - Set the active property when the value property has changed.
|
|
381
366
|
* - Hide menu items that do not match the filter.
|
|
382
367
|
*/
|
|
383
368
|
async _updateMenuItems(changed) {
|
|
384
|
-
/** @type {LeuMenu} */
|
|
385
369
|
const menu = this._menuRef.value;
|
|
386
370
|
await menu.updateComplete;
|
|
387
371
|
const menuItems = menu.getMenuItems();
|
|
@@ -418,7 +402,6 @@ var LeuSelect = class extends LeuElement {
|
|
|
418
402
|
}
|
|
419
403
|
/**
|
|
420
404
|
* @internal
|
|
421
|
-
* @param {KeyboardEvent} event
|
|
422
405
|
*/
|
|
423
406
|
async _handleToggleKeyDown(event) {
|
|
424
407
|
if ([
|
|
@@ -437,7 +420,6 @@ var LeuSelect = class extends LeuElement {
|
|
|
437
420
|
}
|
|
438
421
|
/**
|
|
439
422
|
* @internal
|
|
440
|
-
* @param {KeyboardEvent} event
|
|
441
423
|
*/
|
|
442
424
|
_handleFilterInputKeyDown(event) {
|
|
443
425
|
if (event.key === "ArrowDown") this._menuRef.value.focusItem(0);
|
|
@@ -445,7 +427,6 @@ var LeuSelect = class extends LeuElement {
|
|
|
445
427
|
}
|
|
446
428
|
/**
|
|
447
429
|
* Determines the value or label that should be displayed inside the toggle button.
|
|
448
|
-
* @returns {String | nothing}
|
|
449
430
|
*/
|
|
450
431
|
_getDisplayValue() {
|
|
451
432
|
if (this.multiple) return this.value.length === 0 ? `` : `${this.value.length} gewählt`;
|
|
@@ -468,6 +449,7 @@ var LeuSelect = class extends LeuElement {
|
|
|
468
449
|
_clearValue(event) {
|
|
469
450
|
if (!this.disabled) {
|
|
470
451
|
event.stopPropagation();
|
|
452
|
+
this.hasInteracted = true;
|
|
471
453
|
this.value = [];
|
|
472
454
|
}
|
|
473
455
|
this._emitInputEvent();
|
|
@@ -488,18 +470,16 @@ var LeuSelect = class extends LeuElement {
|
|
|
488
470
|
}
|
|
489
471
|
/**
|
|
490
472
|
* Checks if the given value is selected.
|
|
491
|
-
* @param {String} menuItemValue
|
|
492
|
-
* @returns {Boolean}
|
|
493
473
|
*/
|
|
494
474
|
_isSelected(menuItemValue) {
|
|
495
475
|
return this.value.includes(menuItemValue);
|
|
496
476
|
}
|
|
497
477
|
_handleMenuItemClick(event) {
|
|
498
478
|
if (!(event.target instanceof LeuMenuItem) || event.target.disabled) return;
|
|
499
|
-
/** @type {LeuMenuItem} */
|
|
500
479
|
const menuItem = event.target;
|
|
501
480
|
const value = menuItem.getValue();
|
|
502
481
|
const isSelected = this._isSelected(value);
|
|
482
|
+
this.hasInteracted = true;
|
|
503
483
|
if (this.multiple) {
|
|
504
484
|
this.value = isSelected ? this.value.filter((v) => v !== value) : this.value.concat(value);
|
|
505
485
|
this._deferedChangeEvent = true;
|
|
@@ -529,7 +509,6 @@ var LeuSelect = class extends LeuElement {
|
|
|
529
509
|
type="button"
|
|
530
510
|
class="apply-button"
|
|
531
511
|
@click=${this._closeDropdown}
|
|
532
|
-
fluid
|
|
533
512
|
>Anwenden</leu-button
|
|
534
513
|
>
|
|
535
514
|
</div>
|
|
@@ -574,45 +553,85 @@ var LeuSelect = class extends LeuElement {
|
|
|
574
553
|
}
|
|
575
554
|
render() {
|
|
576
555
|
return html`<div
|
|
577
|
-
|
|
556
|
+
class=${classMap({
|
|
578
557
|
select: true,
|
|
579
558
|
"select--has-before": this.hasSlotController.test("before"),
|
|
580
559
|
"select--has-after": this.hasSlotController.test("after")
|
|
581
560
|
})}
|
|
582
|
-
|
|
561
|
+
@keydown=${this._handleKeyDown}
|
|
562
|
+
>
|
|
563
|
+
<leu-popup
|
|
564
|
+
?active=${this.open}
|
|
565
|
+
placement="bottom-start"
|
|
566
|
+
flip
|
|
567
|
+
matchSize="width"
|
|
568
|
+
autoSize="height"
|
|
569
|
+
autoSizePadding="8"
|
|
583
570
|
>
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
<
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
${this._hasFilterResults || this._optionFilter === "" ? nothing : html` <p class="filter-message-empty" aria-live="polite">
|
|
607
|
-
Keine Resultate
|
|
608
|
-
</p>`}
|
|
609
|
-
${this._renderApplyButton()}
|
|
610
|
-
<slot name="after" class="after"></slot>
|
|
611
|
-
</div>
|
|
612
|
-
</leu-popup>
|
|
613
|
-
</div>
|
|
614
|
-
<input type="hidden" name=${this.name} .value=${this.value.join(",")} />`;
|
|
571
|
+
${this._renderToggleButton()}
|
|
572
|
+
<div id="select-popup" class="select-menu-container">
|
|
573
|
+
<slot name="before" class="before"></slot>
|
|
574
|
+
${this._renderFilterInput()}
|
|
575
|
+
<leu-menu
|
|
576
|
+
ref=${ref(this._menuRef)}
|
|
577
|
+
role="listbox"
|
|
578
|
+
aria-multiselectable=${ifDefined(this.multiple ? "true" : void 0)}
|
|
579
|
+
class="menu"
|
|
580
|
+
@click=${this._handleMenuItemClick}
|
|
581
|
+
aria-labelledby="select-label"
|
|
582
|
+
>
|
|
583
|
+
<slot @slotchange=${this._handleItemSlotChange}> </slot>
|
|
584
|
+
</leu-menu>
|
|
585
|
+
${this._hasFilterResults || this._optionFilter === "" ? nothing : html` <p class="filter-message-empty" aria-live="polite">
|
|
586
|
+
Keine Resultate
|
|
587
|
+
</p>`}
|
|
588
|
+
${this._renderApplyButton()}
|
|
589
|
+
<slot name="after" class="after"></slot>
|
|
590
|
+
</div>
|
|
591
|
+
</leu-popup>
|
|
592
|
+
</div>`;
|
|
615
593
|
}
|
|
616
594
|
};
|
|
595
|
+
__decorate([property({
|
|
596
|
+
type: String,
|
|
597
|
+
reflect: true
|
|
598
|
+
})], LeuSelect.prototype, "label", void 0);
|
|
599
|
+
__decorate([property({
|
|
600
|
+
reflect: true,
|
|
601
|
+
attribute: "value",
|
|
602
|
+
converter: {
|
|
603
|
+
fromAttribute(value) {
|
|
604
|
+
if (value) return value.split(",").map((v) => v.trim());
|
|
605
|
+
return [];
|
|
606
|
+
},
|
|
607
|
+
toAttribute(value) {
|
|
608
|
+
return value.length > 0 ? value.join(",") : null;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
})], LeuSelect.prototype, "defaultValue", void 0);
|
|
612
|
+
__decorate([property({
|
|
613
|
+
type: Array,
|
|
614
|
+
attribute: false
|
|
615
|
+
})], LeuSelect.prototype, "value", null);
|
|
616
|
+
__decorate([property({
|
|
617
|
+
type: Boolean,
|
|
618
|
+
reflect: true
|
|
619
|
+
})], LeuSelect.prototype, "clearable", void 0);
|
|
620
|
+
__decorate([property({
|
|
621
|
+
type: Boolean,
|
|
622
|
+
reflect: true
|
|
623
|
+
})], LeuSelect.prototype, "filterable", void 0);
|
|
624
|
+
__decorate([property({
|
|
625
|
+
type: Boolean,
|
|
626
|
+
reflect: true
|
|
627
|
+
})], LeuSelect.prototype, "multiple", void 0);
|
|
628
|
+
__decorate([property({
|
|
629
|
+
type: Boolean,
|
|
630
|
+
reflect: true
|
|
631
|
+
})], LeuSelect.prototype, "required", void 0);
|
|
632
|
+
__decorate([state()], LeuSelect.prototype, "open", void 0);
|
|
633
|
+
__decorate([state()], LeuSelect.prototype, "_optionFilter", void 0);
|
|
634
|
+
__decorate([state()], LeuSelect.prototype, "_hasFilterResults", void 0);
|
|
635
|
+
__decorate([state()], LeuSelect.prototype, "_displayValue", void 0);
|
|
617
636
|
//#endregion
|
|
618
637
|
export { LeuSelect as t };
|
package/dist/Select.d.ts
CHANGED
|
@@ -1,30 +1,25 @@
|
|
|
1
|
-
import { t as LeuElement } from "./LeuElement-
|
|
2
|
-
import { t as
|
|
3
|
-
import { t as
|
|
4
|
-
import { t as
|
|
5
|
-
import { t as
|
|
6
|
-
import { t as
|
|
7
|
-
import { t as
|
|
8
|
-
import { t as
|
|
1
|
+
import { t as LeuElement } from "./LeuElement-DK1jntuu.js";
|
|
2
|
+
import { t as FormAssociatedMixinType } from "./FormAssociatedMixin-Cw7LsSUE.js";
|
|
3
|
+
import { t as LeuIcon } from "./Icon-CUfh3eb3.js";
|
|
4
|
+
import { t as LeuButton } from "./Button-DcuvEVkC.js";
|
|
5
|
+
import { t as HasSlotController } from "./hasSlotController-BjKyhJm-.js";
|
|
6
|
+
import { t as LeuMenuItem } from "./MenuItem-LY4TRIho.js";
|
|
7
|
+
import { t as LeuMenu } from "./Menu-Z2b7dsB5.js";
|
|
8
|
+
import { t as LeuPopup } from "./Popup-B5iDSLIO.js";
|
|
9
|
+
import { t as LeuInput } from "./Input-fEiQvGDF.js";
|
|
9
10
|
import { PropertyValues, nothing } from "lit";
|
|
10
11
|
import * as lit_html0 from "lit-html";
|
|
12
|
+
import * as lit_html_directives_ref_js0 from "lit-html/directives/ref.js";
|
|
11
13
|
|
|
12
14
|
//#region src/components/select/Select.d.ts
|
|
15
|
+
declare const LeuSelect_base: (abstract new (...args: any[]) => FormAssociatedMixinType) & typeof LeuElement;
|
|
13
16
|
/**
|
|
14
17
|
* @tagname leu-select
|
|
15
18
|
* @slot before - Optional content the appears before the option list
|
|
16
19
|
* @slot after - Optional content the appears after the option list
|
|
17
|
-
* @property {string} name - Reflects to the name attribute of the hidden input field that would be used in a form
|
|
18
|
-
* @property {boolean} open - The expanded state of the popup
|
|
19
|
-
* @property {string} label - The label of the select
|
|
20
|
-
* @property {array} value - List of selected values. If they're set from outside the component, the select element tries to find all the options with the given values and selects them.
|
|
21
|
-
* @property {boolean} clearable - Show a clearable button to reset the value
|
|
22
|
-
* @property {boolean} disabled - If the select should be disabled
|
|
23
|
-
* @property {boolean} filterable - Show an input field to filter the options inside the popup
|
|
24
|
-
* @property {boolean} multiple - Allow multiple selections
|
|
25
20
|
* @attribute {string} value - The selected values separated by commas.
|
|
26
21
|
*/
|
|
27
|
-
declare class LeuSelect extends
|
|
22
|
+
declare class LeuSelect extends LeuSelect_base {
|
|
28
23
|
static dependencies: {
|
|
29
24
|
"leu-button": typeof LeuButton;
|
|
30
25
|
"leu-menu": typeof LeuMenu;
|
|
@@ -34,60 +29,74 @@ declare class LeuSelect extends LeuElement {
|
|
|
34
29
|
"leu-popup": typeof LeuPopup;
|
|
35
30
|
};
|
|
36
31
|
static styles: any[];
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
type: StringConstructor;
|
|
48
|
-
reflect: boolean;
|
|
49
|
-
};
|
|
50
|
-
value: {
|
|
51
|
-
type: ArrayConstructor;
|
|
52
|
-
converter: {
|
|
53
|
-
fromAttribute(value: any): any;
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
clearable: {
|
|
57
|
-
type: BooleanConstructor;
|
|
58
|
-
reflect: boolean;
|
|
59
|
-
};
|
|
60
|
-
disabled: {
|
|
61
|
-
type: BooleanConstructor;
|
|
62
|
-
reflect: boolean;
|
|
63
|
-
};
|
|
64
|
-
filterable: {
|
|
65
|
-
type: BooleanConstructor;
|
|
66
|
-
reflect: boolean;
|
|
67
|
-
};
|
|
68
|
-
multiple: {
|
|
69
|
-
type: BooleanConstructor;
|
|
70
|
-
reflect: boolean;
|
|
71
|
-
};
|
|
72
|
-
_optionFilter: {
|
|
73
|
-
state: boolean;
|
|
74
|
-
};
|
|
75
|
-
_hasFilterResults: {
|
|
76
|
-
state: boolean;
|
|
77
|
-
};
|
|
78
|
-
_displayValue: {
|
|
79
|
-
state: boolean;
|
|
80
|
-
};
|
|
32
|
+
/**
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
35
|
+
static shadowRootOptions: {
|
|
36
|
+
delegatesFocus: boolean;
|
|
37
|
+
clonable?: boolean;
|
|
38
|
+
customElementRegistry?: CustomElementRegistry;
|
|
39
|
+
mode: ShadowRootMode;
|
|
40
|
+
serializable?: boolean;
|
|
41
|
+
slotAssignment?: SlotAssignmentMode;
|
|
81
42
|
};
|
|
43
|
+
/**
|
|
44
|
+
* The label of the select
|
|
45
|
+
*/
|
|
46
|
+
label: string;
|
|
47
|
+
/**
|
|
48
|
+
* The default value of the select. Corresponds to the `value` HTML attribute.
|
|
49
|
+
*/
|
|
50
|
+
defaultValue: Array<string>;
|
|
51
|
+
/** @internal */
|
|
52
|
+
protected _value: Array<string> | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* List of selected values. If they're set from outside the component, the select element
|
|
55
|
+
* finds all the options that match the given values and selects them.
|
|
56
|
+
*/
|
|
57
|
+
set value(value: Array<string>);
|
|
58
|
+
get value(): Array<string>;
|
|
59
|
+
/**
|
|
60
|
+
* Show a clearable button to reset the value
|
|
61
|
+
*/
|
|
62
|
+
clearable: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Show an input field to filter the options inside the popup
|
|
65
|
+
*/
|
|
66
|
+
filterable: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Allow multiple selections
|
|
69
|
+
*/
|
|
70
|
+
multiple: boolean;
|
|
71
|
+
/** Marks the input element as required */
|
|
72
|
+
required: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* The expanded state of the popup
|
|
75
|
+
*/
|
|
76
|
+
protected open: boolean;
|
|
77
|
+
protected _optionFilter: string;
|
|
78
|
+
protected _hasFilterResults: boolean;
|
|
79
|
+
protected _displayValue: string;
|
|
82
80
|
static getOptionLabel(option: any): any;
|
|
81
|
+
/** @internal */
|
|
82
|
+
protected _deferedChangeEvent: boolean;
|
|
83
|
+
/** @internal */
|
|
84
|
+
protected _optionFilterRef: lit_html_directives_ref_js0.Ref<LeuInput>;
|
|
85
|
+
/** @internal */
|
|
86
|
+
protected _toggleButtonRef: lit_html_directives_ref_js0.Ref<HTMLButtonElement>;
|
|
87
|
+
/** @internal */
|
|
88
|
+
protected _menuRef: lit_html_directives_ref_js0.Ref<LeuMenu>;
|
|
83
89
|
/**
|
|
84
90
|
* @internal
|
|
85
91
|
*/
|
|
86
92
|
hasSlotController: HasSlotController;
|
|
87
|
-
|
|
93
|
+
protected setFormValue(): void;
|
|
94
|
+
formResetCallback(): void;
|
|
95
|
+
protected willUpdate(changedProperties: PropertyValues<this>): void;
|
|
88
96
|
connectedCallback(): void;
|
|
89
97
|
disconnectedCallback(): void;
|
|
90
98
|
updated(changedProperties: PropertyValues<this>): void;
|
|
99
|
+
click(): void;
|
|
91
100
|
/**
|
|
92
101
|
* Apply the current state to the menu items.
|
|
93
102
|
* - Set the active property when the value property has changed.
|
|
@@ -104,42 +113,35 @@ declare class LeuSelect extends LeuElement {
|
|
|
104
113
|
/**
|
|
105
114
|
* Handles clicks outside of the component to close the dropdown.
|
|
106
115
|
* @internal
|
|
107
|
-
* @param {MouseEvent} event
|
|
108
116
|
*/
|
|
109
|
-
_handleDocumentClick: (event:
|
|
117
|
+
_handleDocumentClick: (event: MouseEvent) => void;
|
|
110
118
|
/**
|
|
111
119
|
* @internal
|
|
112
|
-
* @param {KeyboardEvent} event
|
|
113
120
|
*/
|
|
114
|
-
_handleKeyDown: (event:
|
|
121
|
+
_handleKeyDown: (event: KeyboardEvent) => void;
|
|
115
122
|
/**
|
|
116
123
|
* @internal
|
|
117
|
-
* @param {KeyboardEvent} event
|
|
118
124
|
*/
|
|
119
|
-
_handleToggleKeyDown(event:
|
|
125
|
+
_handleToggleKeyDown(event: KeyboardEvent): Promise<void>;
|
|
120
126
|
/**
|
|
121
127
|
* @internal
|
|
122
|
-
* @param {KeyboardEvent} event
|
|
123
128
|
*/
|
|
124
|
-
_handleFilterInputKeyDown(event:
|
|
129
|
+
_handleFilterInputKeyDown(event: KeyboardEvent): void;
|
|
125
130
|
/**
|
|
126
131
|
* Determines the value or label that should be displayed inside the toggle button.
|
|
127
|
-
* @returns {String | nothing}
|
|
128
132
|
*/
|
|
129
|
-
_getDisplayValue():
|
|
133
|
+
_getDisplayValue(): string | typeof nothing;
|
|
130
134
|
_emitInputEvent(): void;
|
|
131
135
|
_emitChangeEvent(): void;
|
|
132
|
-
_clearValue(event:
|
|
136
|
+
_clearValue(event: MouseEvent): void;
|
|
133
137
|
_toggleDropdown(): void;
|
|
134
138
|
_closeDropdown(): void;
|
|
135
|
-
_handleFilterInput(event:
|
|
139
|
+
_handleFilterInput(event: InputEvent): void;
|
|
136
140
|
/**
|
|
137
141
|
* Checks if the given value is selected.
|
|
138
|
-
* @param {String} menuItemValue
|
|
139
|
-
* @returns {Boolean}
|
|
140
142
|
*/
|
|
141
|
-
_isSelected(menuItemValue:
|
|
142
|
-
_handleMenuItemClick(event:
|
|
143
|
+
_isSelected(menuItemValue: string): boolean;
|
|
144
|
+
_handleMenuItemClick(event: MouseEvent): void;
|
|
143
145
|
_renderFilterInput(): lit_html0.TemplateResult<1> | typeof nothing;
|
|
144
146
|
_renderApplyButton(): lit_html0.TemplateResult<1> | typeof nothing;
|
|
145
147
|
_renderToggleButton(): lit_html0.TemplateResult<1>;
|
package/dist/Select.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import "./LeuElement-
|
|
2
|
-
import "./Icon-
|
|
3
|
-
import "./Spinner-
|
|
4
|
-
import "./Button-
|
|
1
|
+
import "./LeuElement-DQI8cqZV.js";
|
|
2
|
+
import "./Icon-D83qesg5.js";
|
|
3
|
+
import "./Spinner-BBiVZxFH.js";
|
|
4
|
+
import "./Button-DyNVOHCd.js";
|
|
5
5
|
import "./FormAssociatedMixin-DLPvFtbT.js";
|
|
6
|
-
import "./MenuItem-
|
|
7
|
-
import "./Menu-
|
|
8
|
-
import "./Popup-
|
|
9
|
-
import "./Input-
|
|
10
|
-
import { t as LeuSelect } from "./Select-
|
|
6
|
+
import "./MenuItem-DCttylRO.js";
|
|
7
|
+
import "./Menu-DRU1LiMM.js";
|
|
8
|
+
import "./Popup-nJrJHGSy.js";
|
|
9
|
+
import "./Input-D7zS50oz.js";
|
|
10
|
+
import { t as LeuSelect } from "./Select-Bpicra9q.js";
|
|
11
11
|
export { LeuSelect };
|
package/dist/Spinner.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as LeuSpinner } from "./Spinner-
|
|
1
|
+
import { t as LeuSpinner } from "./Spinner-DHYaX6-Y.js";
|
|
2
2
|
export { LeuSpinner };
|
package/dist/Spinner.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import "./LeuElement-
|
|
2
|
-
import { t as LeuSpinner } from "./Spinner-
|
|
1
|
+
import "./LeuElement-DQI8cqZV.js";
|
|
2
|
+
import { t as LeuSpinner } from "./Spinner-BBiVZxFH.js";
|
|
3
3
|
export { LeuSpinner };
|