@statistikzh/leu 0.26.0 → 0.27.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/CHANGELOG.md +21 -0
- package/dist/{Accordion-B04QkmHz.js → Accordion-DLsqXcK8.js} +1 -1
- package/dist/Accordion.js +2 -2
- package/dist/{Button-BkhqVjug.js → Button-BSyDL_cV.js} +3 -3
- package/dist/Button.js +4 -4
- package/dist/{ButtonGroup-B8U9fDvM.js → ButtonGroup-BmSvl-Oc.js} +2 -2
- package/dist/ButtonGroup.js +5 -5
- package/dist/{ChartWrapper-CSMFwz9e.js → ChartWrapper-CvDvQsd5.js} +2 -2
- package/dist/ChartWrapper.js +3 -3
- package/dist/{Checkbox-Dd1QLpfn.js → Checkbox-Cl_X6gBJ.js} +2 -2
- package/dist/Checkbox.js +3 -3
- package/dist/{CheckboxGroup-Bz2eWEFL.js → CheckboxGroup-BKhOmZYX.js} +2 -2
- package/dist/CheckboxGroup.js +4 -4
- package/dist/{Chip-XAQIIsXq.js → Chip-McVP3N_x.js} +1 -1
- package/dist/Chip.js +2 -2
- package/dist/{ChipGroup-DLqfK2kn.js → ChipGroup-DUGavZeU.js} +1 -1
- package/dist/ChipGroup.js +3 -3
- package/dist/ChipLink.js +2 -2
- package/dist/ChipRemovable.js +3 -3
- package/dist/ChipSelectable.js +2 -2
- package/dist/{Dialog-DHuXR_oo.js → Dialog-BlDd4T2u.js} +2 -2
- package/dist/Dialog.js +3 -3
- package/dist/{Dropdown-DtFTePbc.js → Dropdown-BLxSIe6p.js} +5 -5
- package/dist/Dropdown.js +8 -8
- package/dist/{FileInput-b8sbLDPI.js → FileInput-DntYrpZ-.js} +22 -7
- package/dist/FileInput.d.ts +11 -0
- package/dist/FileInput.js +6 -6
- package/dist/{Icon-C_yYuynf.js → Icon-CbZXpyHU.js} +1 -1
- package/dist/Icon.js +2 -2
- package/dist/{Input-D2THgo7c.d.ts → Input-CeaAOB4p.d.ts} +6 -2
- package/dist/{Input-DEOVocTa.js → Input-DBXX7ev8.js} +32 -11
- package/dist/Input.d.ts +1 -1
- package/dist/Input.js +3 -3
- package/dist/{LeuElement-BeFrgKes.js → LeuElement-k4RjIeoG.js} +1 -1
- package/dist/{Menu-BeqqtCw6.js → Menu-Cu8eIF1T.js} +2 -2
- package/dist/Menu.js +4 -4
- package/dist/{MenuItem-DVg8-1Bq.js → MenuItem-Cs3KFhJm.js} +2 -2
- package/dist/MenuItem.js +3 -3
- package/dist/{Message-BhknWvAF.js → Message-C6Zlk_2p.js} +2 -2
- package/dist/Message.js +3 -3
- package/dist/{Pagination-DJI5MIi_.js → Pagination-CB2eVlXk.js} +4 -4
- package/dist/Pagination.js +6 -6
- package/dist/{Placeholder-BJybFwSg.js → Placeholder-DHMexMhK.js} +1 -1
- package/dist/Placeholder.js +2 -2
- package/dist/{Popup-DNlm_9AA.js → Popup-8jhVy8gB.js} +1 -1
- package/dist/Popup.js +2 -2
- package/dist/{ProgressBar-B0wYj1KF.js → ProgressBar-CG0_lHfS.js} +1 -1
- package/dist/ProgressBar.js +2 -2
- package/dist/{Radio-DMCL8c4D.js → Radio-DG3xqP3s.js} +1 -1
- package/dist/Radio.js +2 -2
- package/dist/{RadioGroup-CM6IyBlq.js → RadioGroup-BKCp9ICX.js} +2 -2
- package/dist/RadioGroup.js +3 -3
- package/dist/{Range-B72rtfln.js → Range-7LrESv4K.js} +1 -1
- package/dist/Range.js +2 -2
- package/dist/{ScrollTop-BFAqBVDR.js → ScrollTop-CJJsfniA.js} +20 -20
- package/dist/ScrollTop.d.ts +5 -5
- package/dist/ScrollTop.js +5 -5
- package/dist/{Select-vxl3BvD4.js → Select-CxEDXIBn.js} +153 -133
- package/dist/Select.d.ts +73 -71
- package/dist/Select.js +9 -9
- package/dist/{Spinner-DDTqijTO.js → Spinner-VhKfzI3Q.js} +1 -1
- package/dist/Spinner.js +2 -2
- package/dist/{Table-BgCxfBcm.js → Table-rg_JCtsA.js} +3 -3
- package/dist/Table.js +7 -7
- package/dist/{Tag-DK2KkPIQ.js → Tag-BROUaDAZ.js} +1 -1
- package/dist/Tag.js +2 -2
- package/dist/{VisuallyHidden-pll3amXE.js → VisuallyHidden-Co_txzxB.js} +1 -1
- package/dist/VisuallyHidden.js +2 -2
- package/dist/index.d.ts +1 -1
- 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.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.js +3 -3
- package/dist/leu-chip-link.js +2 -2
- package/dist/leu-chip-removable.js +3 -3
- 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.js +2 -2
- package/dist/leu-input.d.ts +1 -1
- package/dist/leu-input.js +3 -3
- package/dist/leu-menu-item.js +3 -3
- package/dist/leu-menu.js +4 -4
- package/dist/leu-message.js +3 -3
- package/dist/leu-pagination.js +6 -6
- package/dist/leu-placeholder.js +2 -2
- 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.js +2 -2
- package/dist/leu-table.js +7 -7
- package/dist/leu-tag.js +2 -2
- package/dist/leu-visually-hidden.js +2 -2
- package/dist/vscode.html-custom-data.json +14 -27
- package/dist/vue/index.d.ts +16 -24
- package/dist/web-types.json +41 -60
- package/package.json +1 -1
- 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 -124
- 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/dist/leu-placeholder.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./LeuElement-
|
|
2
|
-
import { t as LeuPlaceholder } from "./Placeholder-
|
|
1
|
+
import "./LeuElement-k4RjIeoG.js";
|
|
2
|
+
import { t as LeuPlaceholder } from "./Placeholder-DHMexMhK.js";
|
|
3
3
|
//#region src/components/placeholder/leu-placeholder.ts
|
|
4
4
|
LeuPlaceholder.define("leu-placeholder");
|
|
5
5
|
//#endregion
|
package/dist/leu-popup.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./LeuElement-
|
|
2
|
-
import { t as LeuPopup } from "./Popup-
|
|
1
|
+
import "./LeuElement-k4RjIeoG.js";
|
|
2
|
+
import { t as LeuPopup } from "./Popup-8jhVy8gB.js";
|
|
3
3
|
//#region src/components/popup/leu-popup.ts
|
|
4
4
|
LeuPopup.define("leu-popup");
|
|
5
5
|
//#endregion
|
package/dist/leu-progress-bar.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./LeuElement-
|
|
2
|
-
import { t as LeuProgressBar } from "./ProgressBar-
|
|
1
|
+
import "./LeuElement-k4RjIeoG.js";
|
|
2
|
+
import { t as LeuProgressBar } from "./ProgressBar-CG0_lHfS.js";
|
|
3
3
|
//#region src/components/progress-bar/leu-progress-bar.ts
|
|
4
4
|
LeuProgressBar.define("leu-progress-bar");
|
|
5
5
|
//#endregion
|
package/dist/leu-radio-group.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "./LeuElement-
|
|
2
|
-
import "./Radio-
|
|
3
|
-
import { t as LeuRadioGroup } from "./RadioGroup-
|
|
1
|
+
import "./LeuElement-k4RjIeoG.js";
|
|
2
|
+
import "./Radio-DG3xqP3s.js";
|
|
3
|
+
import { t as LeuRadioGroup } from "./RadioGroup-BKCp9ICX.js";
|
|
4
4
|
//#region src/components/radio/leu-radio-group.ts
|
|
5
5
|
LeuRadioGroup.define("leu-radio-group");
|
|
6
6
|
//#endregion
|
package/dist/leu-radio.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./LeuElement-
|
|
2
|
-
import { t as LeuRadio } from "./Radio-
|
|
1
|
+
import "./LeuElement-k4RjIeoG.js";
|
|
2
|
+
import { t as LeuRadio } from "./Radio-DG3xqP3s.js";
|
|
3
3
|
//#region src/components/radio/leu-radio.ts
|
|
4
4
|
LeuRadio.define("leu-radio");
|
|
5
5
|
//#endregion
|
package/dist/leu-range.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./LeuElement-
|
|
2
|
-
import { t as LeuRange } from "./Range-
|
|
1
|
+
import "./LeuElement-k4RjIeoG.js";
|
|
2
|
+
import { t as LeuRange } from "./Range-7LrESv4K.js";
|
|
3
3
|
//#region src/components/range/leu-range.ts
|
|
4
4
|
LeuRange.define("leu-range");
|
|
5
5
|
//#endregion
|
package/dist/leu-scroll-top.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import "./LeuElement-
|
|
2
|
-
import "./Icon-
|
|
3
|
-
import "./Spinner-
|
|
4
|
-
import "./Button-
|
|
1
|
+
import "./LeuElement-k4RjIeoG.js";
|
|
2
|
+
import "./Icon-CbZXpyHU.js";
|
|
3
|
+
import "./Spinner-VhKfzI3Q.js";
|
|
4
|
+
import "./Button-BSyDL_cV.js";
|
|
5
5
|
import "./FormAssociatedMixin-DLPvFtbT.js";
|
|
6
|
-
import { t as LeuScrollTop } from "./ScrollTop-
|
|
6
|
+
import { t as LeuScrollTop } from "./ScrollTop-CJJsfniA.js";
|
|
7
7
|
//#region src/components/scroll-top/leu-scroll-top.ts
|
|
8
8
|
LeuScrollTop.define("leu-scroll-top");
|
|
9
9
|
//#endregion
|
package/dist/leu-select.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import "./LeuElement-
|
|
2
|
-
import "./Icon-
|
|
3
|
-
import "./Spinner-
|
|
4
|
-
import "./Button-
|
|
1
|
+
import "./LeuElement-k4RjIeoG.js";
|
|
2
|
+
import "./Icon-CbZXpyHU.js";
|
|
3
|
+
import "./Spinner-VhKfzI3Q.js";
|
|
4
|
+
import "./Button-BSyDL_cV.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-Cs3KFhJm.js";
|
|
7
|
+
import "./Menu-Cu8eIF1T.js";
|
|
8
|
+
import "./Popup-8jhVy8gB.js";
|
|
9
|
+
import "./Input-DBXX7ev8.js";
|
|
10
|
+
import { t as LeuSelect } from "./Select-CxEDXIBn.js";
|
|
11
11
|
//#region src/components/select/leu-select.ts
|
|
12
12
|
LeuSelect.define("leu-select");
|
|
13
13
|
//#endregion
|
package/dist/leu-spinner.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./LeuElement-
|
|
2
|
-
import { t as LeuSpinner } from "./Spinner-
|
|
1
|
+
import "./LeuElement-k4RjIeoG.js";
|
|
2
|
+
import { t as LeuSpinner } from "./Spinner-VhKfzI3Q.js";
|
|
3
3
|
//#region src/components/spinner/leu-spinner.ts
|
|
4
4
|
LeuSpinner.define("leu-spinner");
|
|
5
5
|
//#endregion
|
package/dist/leu-table.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import "./LeuElement-
|
|
2
|
-
import "./Icon-
|
|
3
|
-
import "./Spinner-
|
|
4
|
-
import "./Button-
|
|
1
|
+
import "./LeuElement-k4RjIeoG.js";
|
|
2
|
+
import "./Icon-CbZXpyHU.js";
|
|
3
|
+
import "./Spinner-VhKfzI3Q.js";
|
|
4
|
+
import "./Button-BSyDL_cV.js";
|
|
5
5
|
import "./FormAssociatedMixin-DLPvFtbT.js";
|
|
6
|
-
import "./VisuallyHidden-
|
|
7
|
-
import "./Pagination-
|
|
8
|
-
import { t as LeuTable } from "./Table-
|
|
6
|
+
import "./VisuallyHidden-Co_txzxB.js";
|
|
7
|
+
import "./Pagination-CB2eVlXk.js";
|
|
8
|
+
import { t as LeuTable } from "./Table-rg_JCtsA.js";
|
|
9
9
|
//#region src/components/table/leu-table.ts
|
|
10
10
|
LeuTable.define("leu-table");
|
|
11
11
|
//#endregion
|
package/dist/leu-tag.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./LeuElement-
|
|
2
|
-
import { t as LeuVisuallyHidden } from "./VisuallyHidden-
|
|
1
|
+
import "./LeuElement-k4RjIeoG.js";
|
|
2
|
+
import { t as LeuVisuallyHidden } from "./VisuallyHidden-Co_txzxB.js";
|
|
3
3
|
//#region src/components/visually-hidden/leu-visually-hidden.ts
|
|
4
4
|
LeuVisuallyHidden.define("leu-visually-hidden");
|
|
5
5
|
//#endregion
|
|
@@ -308,7 +308,7 @@
|
|
|
308
308
|
},
|
|
309
309
|
{
|
|
310
310
|
"name": "leu-file-input",
|
|
311
|
-
"description": "\n---\n\n\n### **Events:**\n - **input**\n- **change**",
|
|
311
|
+
"description": "\n---\n\n\n### **Events:**\n - **input**\n- **change**\n\n### **Methods:**\n ",
|
|
312
312
|
"attributes": [
|
|
313
313
|
{ "name": "label", "values": [] },
|
|
314
314
|
{
|
|
@@ -380,11 +380,6 @@
|
|
|
380
380
|
"description": "Adds a button to clear the input element",
|
|
381
381
|
"values": []
|
|
382
382
|
},
|
|
383
|
-
{
|
|
384
|
-
"name": "value",
|
|
385
|
-
"description": "The value of the input element.",
|
|
386
|
-
"values": []
|
|
387
|
-
},
|
|
388
383
|
{
|
|
389
384
|
"name": "error",
|
|
390
385
|
"description": "A custom error that is completely independent of the validity state. Useful for displaying server side errors.",
|
|
@@ -459,6 +454,11 @@
|
|
|
459
454
|
"name": "novalidate",
|
|
460
455
|
"description": "Disables the browser's validation.",
|
|
461
456
|
"values": []
|
|
457
|
+
},
|
|
458
|
+
{
|
|
459
|
+
"name": "value",
|
|
460
|
+
"description": "The default value of the input element.",
|
|
461
|
+
"values": []
|
|
462
462
|
}
|
|
463
463
|
],
|
|
464
464
|
"references": [
|
|
@@ -808,22 +808,12 @@
|
|
|
808
808
|
},
|
|
809
809
|
{
|
|
810
810
|
"name": "leu-select",
|
|
811
|
-
"description": "\n---\n\n\n### **Methods:**\n - **_updateMenuItems(changed)** - Apply the current state to the menu items.\n- Set the active property when the value property has changed.\n- Hide menu items that do not match the filter.\n- **_getDisplayValue()
|
|
811
|
+
"description": "\n---\n\n\n### **Methods:**\n - **_updateMenuItems(changed)** - Apply the current state to the menu items.\n- Set the active property when the value property has changed.\n- Hide menu items that do not match the filter.\n- **_getDisplayValue()** - Determines the value or label that should be displayed inside the toggle button.\n- **_isSelected(menuItemValue: _string_)** - Checks if the given value is selected.\n\n### **Slots:**\n - **before** - Optional content the appears before the option list\n- **after** - Optional content the appears after the option list",
|
|
812
812
|
"attributes": [
|
|
813
813
|
{
|
|
814
814
|
"name": "value",
|
|
815
|
-
"description": "
|
|
816
|
-
"values": [{ "name": "
|
|
817
|
-
},
|
|
818
|
-
{
|
|
819
|
-
"name": "name",
|
|
820
|
-
"description": "Reflects to the name attribute of the hidden input field that would be used in a form",
|
|
821
|
-
"values": []
|
|
822
|
-
},
|
|
823
|
-
{
|
|
824
|
-
"name": "open",
|
|
825
|
-
"description": "The expanded state of the popup",
|
|
826
|
-
"values": []
|
|
815
|
+
"description": "The default value of the select. Corresponds to the `value` HTML attribute.",
|
|
816
|
+
"values": [{ "name": "Array<string>" }]
|
|
827
817
|
},
|
|
828
818
|
{
|
|
829
819
|
"name": "label",
|
|
@@ -835,11 +825,6 @@
|
|
|
835
825
|
"description": "Show a clearable button to reset the value",
|
|
836
826
|
"values": []
|
|
837
827
|
},
|
|
838
|
-
{
|
|
839
|
-
"name": "disabled",
|
|
840
|
-
"description": "If the select should be disabled",
|
|
841
|
-
"values": []
|
|
842
|
-
},
|
|
843
828
|
{
|
|
844
829
|
"name": "filterable",
|
|
845
830
|
"description": "Show an input field to filter the options inside the popup",
|
|
@@ -850,9 +835,11 @@
|
|
|
850
835
|
"description": "Allow multiple selections",
|
|
851
836
|
"values": []
|
|
852
837
|
},
|
|
853
|
-
{
|
|
854
|
-
|
|
855
|
-
|
|
838
|
+
{
|
|
839
|
+
"name": "required",
|
|
840
|
+
"description": "Marks the input element as required",
|
|
841
|
+
"values": []
|
|
842
|
+
}
|
|
856
843
|
],
|
|
857
844
|
"references": [
|
|
858
845
|
{
|
package/dist/vue/index.d.ts
CHANGED
|
@@ -213,8 +213,6 @@ type LeuInputProps = {
|
|
|
213
213
|
required?: LeuInput["required"];
|
|
214
214
|
/** Adds a button to clear the input element */
|
|
215
215
|
clearable?: LeuInput["clearable"];
|
|
216
|
-
/** The value of the input element. */
|
|
217
|
-
value?: LeuInput["value"];
|
|
218
216
|
/** A custom error that is completely independent of the validity state. Useful for displaying server side errors. */
|
|
219
217
|
error?: LeuInput["error"];
|
|
220
218
|
/** The label of the input element */
|
|
@@ -245,6 +243,10 @@ type LeuInputProps = {
|
|
|
245
243
|
validationMessages?: LeuInput["validationMessages"];
|
|
246
244
|
/** Disables the browser's validation. */
|
|
247
245
|
novalidate?: LeuInput["novalidate"];
|
|
246
|
+
/** The default value of the input element. */
|
|
247
|
+
value?: LeuInput["defaultValue"];
|
|
248
|
+
/** The value of the input element. */
|
|
249
|
+
value?: LeuInput["value"];
|
|
248
250
|
/** */
|
|
249
251
|
_validity?: LeuInput["_validity"];
|
|
250
252
|
/** */
|
|
@@ -429,34 +431,21 @@ type LeuScrollTopProps = {
|
|
|
429
431
|
};
|
|
430
432
|
|
|
431
433
|
type LeuSelectProps = {
|
|
432
|
-
/**
|
|
433
|
-
value?: LeuSelect["
|
|
434
|
-
/** Reflects to the name attribute of the hidden input field that would be used in a form */
|
|
435
|
-
name?: LeuSelect["name"];
|
|
436
|
-
/** The expanded state of the popup */
|
|
437
|
-
open?: LeuSelect["open"];
|
|
434
|
+
/** The default value of the select. Corresponds to the `value` HTML attribute. */
|
|
435
|
+
value?: LeuSelect["defaultValue"];
|
|
438
436
|
/** The label of the select */
|
|
439
437
|
label?: LeuSelect["label"];
|
|
440
438
|
/** Show a clearable button to reset the value */
|
|
441
439
|
clearable?: LeuSelect["clearable"];
|
|
442
|
-
/** If the select should be disabled */
|
|
443
|
-
disabled?: LeuSelect["disabled"];
|
|
444
440
|
/** Show an input field to filter the options inside the popup */
|
|
445
441
|
filterable?: LeuSelect["filterable"];
|
|
446
442
|
/** Allow multiple selections */
|
|
447
443
|
multiple?: LeuSelect["multiple"];
|
|
448
|
-
/**
|
|
449
|
-
|
|
450
|
-
/**
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
_displayValue?: LeuSelect["_displayValue"];
|
|
454
|
-
/** */
|
|
455
|
-
_optionFilterRef?: LeuSelect["_optionFilterRef"];
|
|
456
|
-
/** */
|
|
457
|
-
_toggleButtonRef?: LeuSelect["_toggleButtonRef"];
|
|
458
|
-
/** */
|
|
459
|
-
_menuRef?: LeuSelect["_menuRef"];
|
|
444
|
+
/** Marks the input element as required */
|
|
445
|
+
required?: LeuSelect["required"];
|
|
446
|
+
/** List of selected values. If they're set from outside the component, the select element
|
|
447
|
+
finds all the options that match the given values and selects them. */
|
|
448
|
+
value?: LeuSelect["value"];
|
|
460
449
|
};
|
|
461
450
|
|
|
462
451
|
type LeuSpinnerProps = {};
|
|
@@ -644,6 +633,9 @@ export type CustomElements = {
|
|
|
644
633
|
* ### **Events:**
|
|
645
634
|
* - **input**
|
|
646
635
|
* - **change**
|
|
636
|
+
*
|
|
637
|
+
* ### **Methods:**
|
|
638
|
+
*
|
|
647
639
|
*/
|
|
648
640
|
"leu-file-input": DefineComponent<LeuFileInputProps>;
|
|
649
641
|
|
|
@@ -802,8 +794,8 @@ export type CustomElements = {
|
|
|
802
794
|
* - **_updateMenuItems(changed)** - Apply the current state to the menu items.
|
|
803
795
|
* - Set the active property when the value property has changed.
|
|
804
796
|
* - Hide menu items that do not match the filter.
|
|
805
|
-
* - **_getDisplayValue()
|
|
806
|
-
* - **_isSelected(menuItemValue:
|
|
797
|
+
* - **_getDisplayValue()** - Determines the value or label that should be displayed inside the toggle button.
|
|
798
|
+
* - **_isSelected(menuItemValue: _string_)** - Checks if the given value is selected.
|
|
807
799
|
*
|
|
808
800
|
* ### **Slots:**
|
|
809
801
|
* - **before** - Optional content the appears before the option list
|
package/dist/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
|
|
3
3
|
"name": "@statistikzh/leu",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.27.0",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -613,7 +613,7 @@
|
|
|
613
613
|
},
|
|
614
614
|
{
|
|
615
615
|
"name": "leu-file-input",
|
|
616
|
-
"description": "\n---\n\n\n### **Events:**\n - **input**\n- **change**",
|
|
616
|
+
"description": "\n---\n\n\n### **Events:**\n - **input**\n- **change**\n\n### **Methods:**\n ",
|
|
617
617
|
"doc-url": "",
|
|
618
618
|
"attributes": [
|
|
619
619
|
{
|
|
@@ -733,11 +733,6 @@
|
|
|
733
733
|
"description": "Adds a button to clear the input element",
|
|
734
734
|
"value": { "type": "boolean", "default": "false" }
|
|
735
735
|
},
|
|
736
|
-
{
|
|
737
|
-
"name": "value",
|
|
738
|
-
"description": "The value of the input element.",
|
|
739
|
-
"value": { "type": "string", "default": "\"\"" }
|
|
740
|
-
},
|
|
741
736
|
{
|
|
742
737
|
"name": "error",
|
|
743
738
|
"description": "A custom error that is completely independent of the validity state. Useful for displaying server side errors.",
|
|
@@ -815,6 +810,11 @@
|
|
|
815
810
|
"name": "novalidate",
|
|
816
811
|
"description": "Disables the browser's validation.",
|
|
817
812
|
"value": { "type": "boolean", "default": "false" }
|
|
813
|
+
},
|
|
814
|
+
{
|
|
815
|
+
"name": "value",
|
|
816
|
+
"description": "The default value of the input element.",
|
|
817
|
+
"value": { "type": "string", "default": "\"\"" }
|
|
818
818
|
}
|
|
819
819
|
],
|
|
820
820
|
"events": [
|
|
@@ -846,11 +846,6 @@
|
|
|
846
846
|
"description": "Adds a button to clear the input element",
|
|
847
847
|
"type": "boolean"
|
|
848
848
|
},
|
|
849
|
-
{
|
|
850
|
-
"name": "value",
|
|
851
|
-
"description": "The value of the input element.",
|
|
852
|
-
"type": "string"
|
|
853
|
-
},
|
|
854
849
|
{
|
|
855
850
|
"name": "error",
|
|
856
851
|
"description": "A custom error that is completely independent of the validity state. Useful for displaying server side errors.",
|
|
@@ -926,6 +921,16 @@
|
|
|
926
921
|
"description": "Disables the browser's validation.",
|
|
927
922
|
"type": "boolean"
|
|
928
923
|
},
|
|
924
|
+
{
|
|
925
|
+
"name": "defaultValue",
|
|
926
|
+
"description": "The default value of the input element.",
|
|
927
|
+
"type": "string"
|
|
928
|
+
},
|
|
929
|
+
{
|
|
930
|
+
"name": "value",
|
|
931
|
+
"description": "The value of the input element.",
|
|
932
|
+
"type": "string"
|
|
933
|
+
},
|
|
929
934
|
{ "name": "_validity", "type": "ValidityState | null" },
|
|
930
935
|
{ "name": "valueAsNumber" }
|
|
931
936
|
],
|
|
@@ -1581,23 +1586,13 @@
|
|
|
1581
1586
|
},
|
|
1582
1587
|
{
|
|
1583
1588
|
"name": "leu-select",
|
|
1584
|
-
"description": "\n---\n\n\n### **Methods:**\n - **_updateMenuItems(changed)** - Apply the current state to the menu items.\n- Set the active property when the value property has changed.\n- Hide menu items that do not match the filter.\n- **_getDisplayValue()
|
|
1589
|
+
"description": "\n---\n\n\n### **Methods:**\n - **_updateMenuItems(changed)** - Apply the current state to the menu items.\n- Set the active property when the value property has changed.\n- Hide menu items that do not match the filter.\n- **_getDisplayValue()** - Determines the value or label that should be displayed inside the toggle button.\n- **_isSelected(menuItemValue: _string_)** - Checks if the given value is selected.\n\n### **Slots:**\n - **before** - Optional content the appears before the option list\n- **after** - Optional content the appears after the option list",
|
|
1585
1590
|
"doc-url": "",
|
|
1586
1591
|
"attributes": [
|
|
1587
1592
|
{
|
|
1588
1593
|
"name": "value",
|
|
1589
|
-
"description": "
|
|
1590
|
-
"value": { "type": "
|
|
1591
|
-
},
|
|
1592
|
-
{
|
|
1593
|
-
"name": "name",
|
|
1594
|
-
"description": "Reflects to the name attribute of the hidden input field that would be used in a form",
|
|
1595
|
-
"value": { "type": "string", "default": "\"\"" }
|
|
1596
|
-
},
|
|
1597
|
-
{
|
|
1598
|
-
"name": "open",
|
|
1599
|
-
"description": "The expanded state of the popup",
|
|
1600
|
-
"value": { "type": "boolean", "default": "false" }
|
|
1594
|
+
"description": "The default value of the select. Corresponds to the `value` HTML attribute.",
|
|
1595
|
+
"value": { "type": "Array<string>", "default": "[]" }
|
|
1601
1596
|
},
|
|
1602
1597
|
{
|
|
1603
1598
|
"name": "label",
|
|
@@ -1609,11 +1604,6 @@
|
|
|
1609
1604
|
"description": "Show a clearable button to reset the value",
|
|
1610
1605
|
"value": { "type": "boolean", "default": "false" }
|
|
1611
1606
|
},
|
|
1612
|
-
{
|
|
1613
|
-
"name": "disabled",
|
|
1614
|
-
"description": "If the select should be disabled",
|
|
1615
|
-
"value": { "type": "boolean", "default": "false" }
|
|
1616
|
-
},
|
|
1617
1607
|
{
|
|
1618
1608
|
"name": "filterable",
|
|
1619
1609
|
"description": "Show an input field to filter the options inside the popup",
|
|
@@ -1624,9 +1614,11 @@
|
|
|
1624
1614
|
"description": "Allow multiple selections",
|
|
1625
1615
|
"value": { "type": "boolean", "default": "false" }
|
|
1626
1616
|
},
|
|
1627
|
-
{
|
|
1628
|
-
|
|
1629
|
-
|
|
1617
|
+
{
|
|
1618
|
+
"name": "required",
|
|
1619
|
+
"description": "Marks the input element as required",
|
|
1620
|
+
"value": { "type": "boolean", "default": "false" }
|
|
1621
|
+
}
|
|
1630
1622
|
],
|
|
1631
1623
|
"slots": [
|
|
1632
1624
|
{
|
|
@@ -1642,19 +1634,19 @@
|
|
|
1642
1634
|
"js": {
|
|
1643
1635
|
"properties": [
|
|
1644
1636
|
{
|
|
1645
|
-
"name": "
|
|
1646
|
-
"description": "The
|
|
1647
|
-
"type": "
|
|
1637
|
+
"name": "label",
|
|
1638
|
+
"description": "The label of the select",
|
|
1639
|
+
"type": "string"
|
|
1648
1640
|
},
|
|
1649
1641
|
{
|
|
1650
|
-
"name": "
|
|
1651
|
-
"description": "
|
|
1652
|
-
"type": "
|
|
1642
|
+
"name": "defaultValue",
|
|
1643
|
+
"description": "The default value of the select. Corresponds to the `value` HTML attribute.",
|
|
1644
|
+
"type": "Array<string>"
|
|
1653
1645
|
},
|
|
1654
1646
|
{
|
|
1655
|
-
"name": "
|
|
1656
|
-
"description": "
|
|
1657
|
-
"type": "
|
|
1647
|
+
"name": "value",
|
|
1648
|
+
"description": "List of selected values. If they're set from outside the component, the select element\nfinds all the options that match the given values and selects them.",
|
|
1649
|
+
"type": "Array<string>"
|
|
1658
1650
|
},
|
|
1659
1651
|
{
|
|
1660
1652
|
"name": "clearable",
|
|
@@ -1667,26 +1659,15 @@
|
|
|
1667
1659
|
"type": "boolean"
|
|
1668
1660
|
},
|
|
1669
1661
|
{
|
|
1670
|
-
"name": "
|
|
1671
|
-
"description": "
|
|
1672
|
-
"type": "
|
|
1673
|
-
},
|
|
1674
|
-
{
|
|
1675
|
-
"name": "label",
|
|
1676
|
-
"description": "The label of the select",
|
|
1677
|
-
"type": "string"
|
|
1662
|
+
"name": "multiple",
|
|
1663
|
+
"description": "Allow multiple selections",
|
|
1664
|
+
"type": "boolean"
|
|
1678
1665
|
},
|
|
1679
1666
|
{
|
|
1680
|
-
"name": "
|
|
1681
|
-
"description": "
|
|
1682
|
-
"type": "
|
|
1683
|
-
}
|
|
1684
|
-
{ "name": "_optionFilterRef", "type": "Ref<LeuInput>" },
|
|
1685
|
-
{ "name": "_toggleButtonRef", "type": "Ref<HTMLButtonElement>" },
|
|
1686
|
-
{ "name": "_menuRef", "type": "Ref<LeuMenu>" },
|
|
1687
|
-
{ "name": "_optionFilter", "type": "string" },
|
|
1688
|
-
{ "name": "_hasFilterResults", "type": "boolean" },
|
|
1689
|
-
{ "name": "_displayValue", "type": "string" }
|
|
1667
|
+
"name": "required",
|
|
1668
|
+
"description": "Marks the input element as required",
|
|
1669
|
+
"type": "boolean"
|
|
1670
|
+
}
|
|
1690
1671
|
],
|
|
1691
1672
|
"events": []
|
|
1692
1673
|
}
|
package/package.json
CHANGED
|
@@ -145,16 +145,35 @@ export class LeuFileInput extends FormAssociatedMixin(LeuElement) {
|
|
|
145
145
|
)
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
+
/**
|
|
149
|
+
* This implementation Uses base-10 (decimal) units:
|
|
150
|
+
* 1 KB = 1_000 bytes
|
|
151
|
+
* 1 MB = 1_000_000 bytes
|
|
152
|
+
* 1 GB = 1_000_000_000 bytes
|
|
153
|
+
*
|
|
154
|
+
* To switch to base-2 (binary), use the following implementation:
|
|
155
|
+
* // const KB = 1024
|
|
156
|
+
* // const MB = 1024 * 1024
|
|
157
|
+
* // const GB = 1024 * 1024 * 1024
|
|
158
|
+
*/
|
|
148
159
|
protected static formatFileSize(size: number) {
|
|
149
|
-
|
|
150
|
-
|
|
160
|
+
const KB = 1e3
|
|
161
|
+
const MB = 1e6
|
|
162
|
+
const GB = 1e9
|
|
163
|
+
|
|
164
|
+
if (size >= GB) {
|
|
165
|
+
return html`${(size / GB).toFixed(1)} GB`
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (size >= MB) {
|
|
169
|
+
return html`${(size / MB).toFixed(1)} MB`
|
|
151
170
|
}
|
|
152
171
|
|
|
153
|
-
if (size >=
|
|
154
|
-
return html`${(size /
|
|
172
|
+
if (size >= KB) {
|
|
173
|
+
return html`${(size / KB).toFixed(1)} KB`
|
|
155
174
|
}
|
|
156
175
|
|
|
157
|
-
return html`${
|
|
176
|
+
return html`${size} bytes`
|
|
158
177
|
}
|
|
159
178
|
|
|
160
179
|
protected handleDragEnter = (event: DragEvent) => {
|
|
@@ -86,10 +86,6 @@ export class LeuInput extends FormAssociatedMixin(LeuElement) {
|
|
|
86
86
|
@property({ type: Boolean, reflect: true })
|
|
87
87
|
clearable: boolean = false
|
|
88
88
|
|
|
89
|
-
/** The value of the input element. */
|
|
90
|
-
@property({ type: String, reflect: true })
|
|
91
|
-
value: string = ""
|
|
92
|
-
|
|
93
89
|
/** A custom error that is completely independent of the validity state. Useful for displaying server side errors. */
|
|
94
90
|
@property({ type: String, reflect: true })
|
|
95
91
|
error: string = ""
|
|
@@ -150,6 +146,26 @@ export class LeuInput extends FormAssociatedMixin(LeuElement) {
|
|
|
150
146
|
@property({ type: Boolean, reflect: true })
|
|
151
147
|
novalidate: boolean = false
|
|
152
148
|
|
|
149
|
+
/** The default value of the input element. */
|
|
150
|
+
@property({ type: String, reflect: true, attribute: "value" })
|
|
151
|
+
defaultValue: string = ""
|
|
152
|
+
|
|
153
|
+
protected _value: string
|
|
154
|
+
|
|
155
|
+
/** The value of the input element. */
|
|
156
|
+
@property({ type: String, attribute: false })
|
|
157
|
+
set value(value: string) {
|
|
158
|
+
this._value = value
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
get value(): string {
|
|
162
|
+
if (typeof this._value === "string") {
|
|
163
|
+
return this._value
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return this.defaultValue
|
|
167
|
+
}
|
|
168
|
+
|
|
153
169
|
@state()
|
|
154
170
|
_validity: ValidityState | null = null
|
|
155
171
|
|
|
@@ -171,15 +187,32 @@ export class LeuInput extends FormAssociatedMixin(LeuElement) {
|
|
|
171
187
|
}
|
|
172
188
|
|
|
173
189
|
formResetCallback() {
|
|
174
|
-
this.value =
|
|
190
|
+
this.value = this.defaultValue
|
|
175
191
|
}
|
|
176
192
|
|
|
177
193
|
protected setFormValue(): void {
|
|
178
|
-
this.internals.setFormValue(this.value)
|
|
194
|
+
this.internals.setFormValue(this.disabled ? null : this.value)
|
|
179
195
|
}
|
|
180
196
|
|
|
181
197
|
protected willUpdate(changedProperties: PropertyValues<this>): void {
|
|
182
|
-
|
|
198
|
+
super.willUpdate(changedProperties)
|
|
199
|
+
let valueChanged = false
|
|
200
|
+
|
|
201
|
+
if (
|
|
202
|
+
changedProperties.has("defaultValue") &&
|
|
203
|
+
!changedProperties.has("value") &&
|
|
204
|
+
!this.hasInteracted
|
|
205
|
+
) {
|
|
206
|
+
this.value = this.defaultValue
|
|
207
|
+
valueChanged = true
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (
|
|
211
|
+
valueChanged ||
|
|
212
|
+
changedProperties.has("value") ||
|
|
213
|
+
changedProperties.has("name") ||
|
|
214
|
+
changedProperties.has("disabled")
|
|
215
|
+
) {
|
|
183
216
|
this.setFormValue()
|
|
184
217
|
}
|
|
185
218
|
}
|
|
@@ -225,6 +258,7 @@ export class LeuInput extends FormAssociatedMixin(LeuElement) {
|
|
|
225
258
|
* @fires {CustomEvent} change
|
|
226
259
|
*/
|
|
227
260
|
protected handleChange(event: Event & { target: HTMLInputElement }) {
|
|
261
|
+
this.hasInteracted = true
|
|
228
262
|
if (event.target.validity.valid) {
|
|
229
263
|
this.value = event.target.value
|
|
230
264
|
}
|
|
@@ -239,6 +273,7 @@ export class LeuInput extends FormAssociatedMixin(LeuElement) {
|
|
|
239
273
|
* the event can be handled outside the shadow DOM.
|
|
240
274
|
*/
|
|
241
275
|
protected handleInput(event: Event & { target: HTMLInputElement }) {
|
|
276
|
+
this.hasInteracted = true
|
|
242
277
|
this.value = event.target.value
|
|
243
278
|
|
|
244
279
|
const customEvent = new CustomEvent("input", {
|
|
@@ -311,7 +346,7 @@ export class LeuInput extends FormAssociatedMixin(LeuElement) {
|
|
|
311
346
|
return true
|
|
312
347
|
}
|
|
313
348
|
|
|
314
|
-
return this._validity === null || this.novalidate
|
|
349
|
+
return this._validity === null || this.novalidate || this.disabled
|
|
315
350
|
? false
|
|
316
351
|
: !this._validity.valid
|
|
317
352
|
}
|