@statistikzh/leu 0.25.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 +28 -0
- package/CONTRIBUTING.md +19 -8
- package/dist/{Accordion-CDNyrB8d.js → Accordion-DLsqXcK8.js} +1 -1
- package/dist/Accordion.js +2 -2
- package/dist/{Button-EdS9xr2J.js → Button-BSyDL_cV.js} +57 -17
- package/dist/{Button-DSGPIcjm.d.ts → Button-BgNUxmo_.d.ts} +6 -0
- package/dist/Button.d.ts +1 -1
- package/dist/Button.js +5 -4
- package/dist/{ButtonGroup-BQqf8o_d.js → ButtonGroup-BmSvl-Oc.js} +2 -2
- package/dist/ButtonGroup.js +6 -5
- package/dist/{ChartWrapper-LiNHTNRw.js → ChartWrapper-CvDvQsd5.js} +3 -3
- package/dist/ChartWrapper.d.ts +2 -2
- package/dist/ChartWrapper.js +3 -3
- package/dist/{Checkbox-BtDWmPab.js → Checkbox-Cl_X6gBJ.js} +3 -3
- package/dist/Checkbox.js +4 -4
- package/dist/{CheckboxGroup-C8MbwW9u.js → CheckboxGroup-BKhOmZYX.js} +2 -2
- package/dist/CheckboxGroup.js +5 -5
- package/dist/{Chip-Ch09jjYi.js → Chip-McVP3N_x.js} +1 -1
- package/dist/Chip.js +2 -2
- package/dist/{ChipGroup-PvqVW-tm.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-CV1JTkCn.js → Dialog-BlDd4T2u.js} +3 -3
- package/dist/Dialog.d.ts +1 -1
- package/dist/Dialog.js +3 -3
- package/dist/{Dropdown-DpFdFbA1.js → Dropdown-BLxSIe6p.js} +6 -6
- package/dist/Dropdown.d.ts +2 -2
- package/dist/Dropdown.js +9 -8
- package/dist/{FileInput-5apX17JT.js → FileInput-DntYrpZ-.js} +23 -8
- package/dist/FileInput.d.ts +12 -1
- package/dist/FileInput.js +7 -6
- package/dist/{Icon-DhAvH0XM.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-CnEz-2dK.js → Input-DBXX7ev8.js} +33 -12
- package/dist/Input.d.ts +1 -1
- package/dist/Input.js +4 -4
- package/dist/{LeuElement-B7NJzWwP.js → LeuElement-k4RjIeoG.js} +1 -1
- package/dist/{Menu-DpiheIPk.js → Menu-Cu8eIF1T.js} +2 -2
- package/dist/Menu.js +4 -4
- package/dist/{MenuItem-CZTqGg5R.js → MenuItem-Cs3KFhJm.js} +2 -2
- package/dist/MenuItem.js +3 -3
- package/dist/{Message-J4Kj7yHE.js → Message-C6Zlk_2p.js} +3 -3
- package/dist/Message.js +3 -3
- package/dist/{Pagination-CWqgusWZ.js → Pagination-CB2eVlXk.js} +4 -4
- package/dist/{Pagination-Be8TcBoC.d.ts → Pagination-CqkHh-Vd.d.ts} +1 -1
- package/dist/Pagination.d.ts +1 -1
- package/dist/Pagination.js +7 -6
- package/dist/{Placeholder-DMN6sMbp.js → Placeholder-DHMexMhK.js} +1 -1
- package/dist/Placeholder.js +2 -2
- package/dist/{Popup-JQjuj26v.js → Popup-8jhVy8gB.js} +1 -1
- package/dist/Popup.js +2 -2
- package/dist/{ProgressBar-CzN3fqiH.js → ProgressBar-CG0_lHfS.js} +1 -1
- package/dist/ProgressBar.js +2 -2
- package/dist/{Radio-CX8aCsff.js → Radio-DG3xqP3s.js} +1 -1
- package/dist/Radio.js +2 -2
- package/dist/{RadioGroup-CgEWQnC4.js → RadioGroup-BKCp9ICX.js} +2 -2
- package/dist/RadioGroup.js +3 -3
- package/dist/{Range-DoW_ZdKm.js → Range-7LrESv4K.js} +1 -1
- package/dist/Range.js +2 -2
- package/dist/{ScrollTop-DxChetWq.js → ScrollTop-CJJsfniA.js} +20 -20
- package/dist/ScrollTop.d.ts +6 -6
- package/dist/ScrollTop.js +6 -5
- package/dist/{Select-BCx79gOH.js → Select-CxEDXIBn.js} +154 -134
- package/dist/Select.d.ts +75 -73
- package/dist/Select.js +10 -9
- package/dist/{Spinner-DJR4gv3Y.js → Spinner-VhKfzI3Q.js} +1 -1
- package/dist/Spinner.d.ts +1 -1
- package/dist/Spinner.js +2 -2
- package/dist/{Table-DZz1ic3j.js → Table-rg_JCtsA.js} +3 -3
- package/dist/Table.d.ts +1 -1
- package/dist/Table.js +8 -7
- package/dist/{Tag-DsZS_8pl.js → Tag-BROUaDAZ.js} +1 -1
- package/dist/Tag.js +2 -2
- package/dist/{VisuallyHidden-BkllVjlz.js → VisuallyHidden-Co_txzxB.js} +1 -1
- package/dist/VisuallyHidden.js +2 -2
- package/dist/index.d.ts +4 -4
- package/dist/index.js +31 -31
- package/dist/leu-accordion.js +2 -2
- package/dist/leu-button-group.js +6 -5
- package/dist/leu-button.d.ts +1 -1
- package/dist/leu-button.js +5 -4
- package/dist/leu-chart-wrapper.js +3 -3
- package/dist/leu-checkbox-group.js +5 -5
- package/dist/leu-checkbox.js +4 -4
- 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 +9 -8
- package/dist/leu-file-input.js +7 -6
- package/dist/leu-icon.js +2 -2
- package/dist/leu-input.d.ts +1 -1
- package/dist/leu-input.js +4 -4
- 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.d.ts +1 -1
- package/dist/leu-pagination.js +7 -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 +6 -5
- package/dist/leu-select.js +10 -9
- package/dist/leu-spinner.d.ts +1 -1
- package/dist/leu-spinner.js +2 -2
- package/dist/leu-table.js +8 -7
- package/dist/leu-tag.js +2 -2
- package/dist/leu-visually-hidden.js +2 -2
- package/dist/vscode.html-custom-data.json +19 -27
- package/dist/vue/index.d.ts +18 -24
- package/dist/web-types.json +51 -60
- package/package.json +1 -1
- package/src/components/button/Button.ts +15 -3
- package/src/components/button/button.css +37 -9
- package/src/components/button/stories/button.stories.ts +23 -0
- package/src/components/button/test/button.test.ts +30 -3
- 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/{FormAssociatedMixin-BbFlza53.js → FormAssociatedMixin-DLPvFtbT.js} +0 -0
- /package/dist/{Spinner-CMo_o6Fy.d.ts → Spinner-CrM1enM0.d.ts} +0 -0
- /package/dist/{hasSlotController-DjdfnOQp.js → hasSlotController-DSBCVzPD.js} +0 -0
- /package/dist/{hasSlotController-BLtZurRh.d.ts → hasSlotController-DWPyZ52b.d.ts} +0 -0
|
@@ -100,6 +100,11 @@
|
|
|
100
100
|
"name": "fluid",
|
|
101
101
|
"description": "Alters the shape of the button to be full width of its parent container",
|
|
102
102
|
"values": []
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"name": "loading",
|
|
106
|
+
"description": "Replaces the content with a spinner",
|
|
107
|
+
"values": []
|
|
103
108
|
}
|
|
104
109
|
],
|
|
105
110
|
"references": [
|
|
@@ -303,7 +308,7 @@
|
|
|
303
308
|
},
|
|
304
309
|
{
|
|
305
310
|
"name": "leu-file-input",
|
|
306
|
-
"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 ",
|
|
307
312
|
"attributes": [
|
|
308
313
|
{ "name": "label", "values": [] },
|
|
309
314
|
{
|
|
@@ -375,11 +380,6 @@
|
|
|
375
380
|
"description": "Adds a button to clear the input element",
|
|
376
381
|
"values": []
|
|
377
382
|
},
|
|
378
|
-
{
|
|
379
|
-
"name": "value",
|
|
380
|
-
"description": "The value of the input element.",
|
|
381
|
-
"values": []
|
|
382
|
-
},
|
|
383
383
|
{
|
|
384
384
|
"name": "error",
|
|
385
385
|
"description": "A custom error that is completely independent of the validity state. Useful for displaying server side errors.",
|
|
@@ -454,6 +454,11 @@
|
|
|
454
454
|
"name": "novalidate",
|
|
455
455
|
"description": "Disables the browser's validation.",
|
|
456
456
|
"values": []
|
|
457
|
+
},
|
|
458
|
+
{
|
|
459
|
+
"name": "value",
|
|
460
|
+
"description": "The default value of the input element.",
|
|
461
|
+
"values": []
|
|
457
462
|
}
|
|
458
463
|
],
|
|
459
464
|
"references": [
|
|
@@ -803,22 +808,12 @@
|
|
|
803
808
|
},
|
|
804
809
|
{
|
|
805
810
|
"name": "leu-select",
|
|
806
|
-
"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",
|
|
807
812
|
"attributes": [
|
|
808
813
|
{
|
|
809
814
|
"name": "value",
|
|
810
|
-
"description": "
|
|
811
|
-
"values": [{ "name": "
|
|
812
|
-
},
|
|
813
|
-
{
|
|
814
|
-
"name": "name",
|
|
815
|
-
"description": "Reflects to the name attribute of the hidden input field that would be used in a form",
|
|
816
|
-
"values": []
|
|
817
|
-
},
|
|
818
|
-
{
|
|
819
|
-
"name": "open",
|
|
820
|
-
"description": "The expanded state of the popup",
|
|
821
|
-
"values": []
|
|
815
|
+
"description": "The default value of the select. Corresponds to the `value` HTML attribute.",
|
|
816
|
+
"values": [{ "name": "Array<string>" }]
|
|
822
817
|
},
|
|
823
818
|
{
|
|
824
819
|
"name": "label",
|
|
@@ -830,11 +825,6 @@
|
|
|
830
825
|
"description": "Show a clearable button to reset the value",
|
|
831
826
|
"values": []
|
|
832
827
|
},
|
|
833
|
-
{
|
|
834
|
-
"name": "disabled",
|
|
835
|
-
"description": "If the select should be disabled",
|
|
836
|
-
"values": []
|
|
837
|
-
},
|
|
838
828
|
{
|
|
839
829
|
"name": "filterable",
|
|
840
830
|
"description": "Show an input field to filter the options inside the popup",
|
|
@@ -845,9 +835,11 @@
|
|
|
845
835
|
"description": "Allow multiple selections",
|
|
846
836
|
"values": []
|
|
847
837
|
},
|
|
848
|
-
{
|
|
849
|
-
|
|
850
|
-
|
|
838
|
+
{
|
|
839
|
+
"name": "required",
|
|
840
|
+
"description": "Marks the input element as required",
|
|
841
|
+
"values": []
|
|
842
|
+
}
|
|
851
843
|
],
|
|
852
844
|
"references": [
|
|
853
845
|
{
|
package/dist/vue/index.d.ts
CHANGED
|
@@ -72,6 +72,8 @@ If it is set, the icon will either show an expanded or collapsed state. */
|
|
|
72
72
|
expanded?: LeuButton["expanded"];
|
|
73
73
|
/** Alters the shape of the button to be full width of its parent container */
|
|
74
74
|
fluid?: LeuButton["fluid"];
|
|
75
|
+
/** Replaces the content with a spinner */
|
|
76
|
+
loading?: LeuButton["loading"];
|
|
75
77
|
};
|
|
76
78
|
|
|
77
79
|
type LeuButtonGroupProps = {
|
|
@@ -211,8 +213,6 @@ type LeuInputProps = {
|
|
|
211
213
|
required?: LeuInput["required"];
|
|
212
214
|
/** Adds a button to clear the input element */
|
|
213
215
|
clearable?: LeuInput["clearable"];
|
|
214
|
-
/** The value of the input element. */
|
|
215
|
-
value?: LeuInput["value"];
|
|
216
216
|
/** A custom error that is completely independent of the validity state. Useful for displaying server side errors. */
|
|
217
217
|
error?: LeuInput["error"];
|
|
218
218
|
/** The label of the input element */
|
|
@@ -243,6 +243,10 @@ type LeuInputProps = {
|
|
|
243
243
|
validationMessages?: LeuInput["validationMessages"];
|
|
244
244
|
/** Disables the browser's validation. */
|
|
245
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"];
|
|
246
250
|
/** */
|
|
247
251
|
_validity?: LeuInput["_validity"];
|
|
248
252
|
/** */
|
|
@@ -427,34 +431,21 @@ type LeuScrollTopProps = {
|
|
|
427
431
|
};
|
|
428
432
|
|
|
429
433
|
type LeuSelectProps = {
|
|
430
|
-
/**
|
|
431
|
-
value?: LeuSelect["
|
|
432
|
-
/** Reflects to the name attribute of the hidden input field that would be used in a form */
|
|
433
|
-
name?: LeuSelect["name"];
|
|
434
|
-
/** The expanded state of the popup */
|
|
435
|
-
open?: LeuSelect["open"];
|
|
434
|
+
/** The default value of the select. Corresponds to the `value` HTML attribute. */
|
|
435
|
+
value?: LeuSelect["defaultValue"];
|
|
436
436
|
/** The label of the select */
|
|
437
437
|
label?: LeuSelect["label"];
|
|
438
438
|
/** Show a clearable button to reset the value */
|
|
439
439
|
clearable?: LeuSelect["clearable"];
|
|
440
|
-
/** If the select should be disabled */
|
|
441
|
-
disabled?: LeuSelect["disabled"];
|
|
442
440
|
/** Show an input field to filter the options inside the popup */
|
|
443
441
|
filterable?: LeuSelect["filterable"];
|
|
444
442
|
/** Allow multiple selections */
|
|
445
443
|
multiple?: LeuSelect["multiple"];
|
|
446
|
-
/**
|
|
447
|
-
|
|
448
|
-
/**
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
_displayValue?: LeuSelect["_displayValue"];
|
|
452
|
-
/** */
|
|
453
|
-
_optionFilterRef?: LeuSelect["_optionFilterRef"];
|
|
454
|
-
/** */
|
|
455
|
-
_toggleButtonRef?: LeuSelect["_toggleButtonRef"];
|
|
456
|
-
/** */
|
|
457
|
-
_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"];
|
|
458
449
|
};
|
|
459
450
|
|
|
460
451
|
type LeuSpinnerProps = {};
|
|
@@ -642,6 +633,9 @@ export type CustomElements = {
|
|
|
642
633
|
* ### **Events:**
|
|
643
634
|
* - **input**
|
|
644
635
|
* - **change**
|
|
636
|
+
*
|
|
637
|
+
* ### **Methods:**
|
|
638
|
+
*
|
|
645
639
|
*/
|
|
646
640
|
"leu-file-input": DefineComponent<LeuFileInputProps>;
|
|
647
641
|
|
|
@@ -800,8 +794,8 @@ export type CustomElements = {
|
|
|
800
794
|
* - **_updateMenuItems(changed)** - Apply the current state to the menu items.
|
|
801
795
|
* - Set the active property when the value property has changed.
|
|
802
796
|
* - Hide menu items that do not match the filter.
|
|
803
|
-
* - **_getDisplayValue()
|
|
804
|
-
* - **_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.
|
|
805
799
|
*
|
|
806
800
|
* ### **Slots:**
|
|
807
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": {
|
|
@@ -133,6 +133,11 @@
|
|
|
133
133
|
"name": "fluid",
|
|
134
134
|
"description": "Alters the shape of the button to be full width of its parent container",
|
|
135
135
|
"value": { "type": "boolean", "default": "false" }
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"name": "loading",
|
|
139
|
+
"description": "Replaces the content with a spinner",
|
|
140
|
+
"value": { "type": "boolean", "default": "false" }
|
|
136
141
|
}
|
|
137
142
|
],
|
|
138
143
|
"slots": [
|
|
@@ -206,6 +211,11 @@
|
|
|
206
211
|
"name": "fluid",
|
|
207
212
|
"description": "Alters the shape of the button to be full width of its parent container",
|
|
208
213
|
"type": "boolean"
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
"name": "loading",
|
|
217
|
+
"description": "Replaces the content with a spinner",
|
|
218
|
+
"type": "boolean"
|
|
209
219
|
}
|
|
210
220
|
],
|
|
211
221
|
"events": []
|
|
@@ -603,7 +613,7 @@
|
|
|
603
613
|
},
|
|
604
614
|
{
|
|
605
615
|
"name": "leu-file-input",
|
|
606
|
-
"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 ",
|
|
607
617
|
"doc-url": "",
|
|
608
618
|
"attributes": [
|
|
609
619
|
{
|
|
@@ -723,11 +733,6 @@
|
|
|
723
733
|
"description": "Adds a button to clear the input element",
|
|
724
734
|
"value": { "type": "boolean", "default": "false" }
|
|
725
735
|
},
|
|
726
|
-
{
|
|
727
|
-
"name": "value",
|
|
728
|
-
"description": "The value of the input element.",
|
|
729
|
-
"value": { "type": "string", "default": "\"\"" }
|
|
730
|
-
},
|
|
731
736
|
{
|
|
732
737
|
"name": "error",
|
|
733
738
|
"description": "A custom error that is completely independent of the validity state. Useful for displaying server side errors.",
|
|
@@ -805,6 +810,11 @@
|
|
|
805
810
|
"name": "novalidate",
|
|
806
811
|
"description": "Disables the browser's validation.",
|
|
807
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": "\"\"" }
|
|
808
818
|
}
|
|
809
819
|
],
|
|
810
820
|
"events": [
|
|
@@ -836,11 +846,6 @@
|
|
|
836
846
|
"description": "Adds a button to clear the input element",
|
|
837
847
|
"type": "boolean"
|
|
838
848
|
},
|
|
839
|
-
{
|
|
840
|
-
"name": "value",
|
|
841
|
-
"description": "The value of the input element.",
|
|
842
|
-
"type": "string"
|
|
843
|
-
},
|
|
844
849
|
{
|
|
845
850
|
"name": "error",
|
|
846
851
|
"description": "A custom error that is completely independent of the validity state. Useful for displaying server side errors.",
|
|
@@ -916,6 +921,16 @@
|
|
|
916
921
|
"description": "Disables the browser's validation.",
|
|
917
922
|
"type": "boolean"
|
|
918
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
|
+
},
|
|
919
934
|
{ "name": "_validity", "type": "ValidityState | null" },
|
|
920
935
|
{ "name": "valueAsNumber" }
|
|
921
936
|
],
|
|
@@ -1571,23 +1586,13 @@
|
|
|
1571
1586
|
},
|
|
1572
1587
|
{
|
|
1573
1588
|
"name": "leu-select",
|
|
1574
|
-
"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",
|
|
1575
1590
|
"doc-url": "",
|
|
1576
1591
|
"attributes": [
|
|
1577
1592
|
{
|
|
1578
1593
|
"name": "value",
|
|
1579
|
-
"description": "
|
|
1580
|
-
"value": { "type": "
|
|
1581
|
-
},
|
|
1582
|
-
{
|
|
1583
|
-
"name": "name",
|
|
1584
|
-
"description": "Reflects to the name attribute of the hidden input field that would be used in a form",
|
|
1585
|
-
"value": { "type": "string", "default": "\"\"" }
|
|
1586
|
-
},
|
|
1587
|
-
{
|
|
1588
|
-
"name": "open",
|
|
1589
|
-
"description": "The expanded state of the popup",
|
|
1590
|
-
"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": "[]" }
|
|
1591
1596
|
},
|
|
1592
1597
|
{
|
|
1593
1598
|
"name": "label",
|
|
@@ -1599,11 +1604,6 @@
|
|
|
1599
1604
|
"description": "Show a clearable button to reset the value",
|
|
1600
1605
|
"value": { "type": "boolean", "default": "false" }
|
|
1601
1606
|
},
|
|
1602
|
-
{
|
|
1603
|
-
"name": "disabled",
|
|
1604
|
-
"description": "If the select should be disabled",
|
|
1605
|
-
"value": { "type": "boolean", "default": "false" }
|
|
1606
|
-
},
|
|
1607
1607
|
{
|
|
1608
1608
|
"name": "filterable",
|
|
1609
1609
|
"description": "Show an input field to filter the options inside the popup",
|
|
@@ -1614,9 +1614,11 @@
|
|
|
1614
1614
|
"description": "Allow multiple selections",
|
|
1615
1615
|
"value": { "type": "boolean", "default": "false" }
|
|
1616
1616
|
},
|
|
1617
|
-
{
|
|
1618
|
-
|
|
1619
|
-
|
|
1617
|
+
{
|
|
1618
|
+
"name": "required",
|
|
1619
|
+
"description": "Marks the input element as required",
|
|
1620
|
+
"value": { "type": "boolean", "default": "false" }
|
|
1621
|
+
}
|
|
1620
1622
|
],
|
|
1621
1623
|
"slots": [
|
|
1622
1624
|
{
|
|
@@ -1632,19 +1634,19 @@
|
|
|
1632
1634
|
"js": {
|
|
1633
1635
|
"properties": [
|
|
1634
1636
|
{
|
|
1635
|
-
"name": "
|
|
1636
|
-
"description": "The
|
|
1637
|
-
"type": "
|
|
1637
|
+
"name": "label",
|
|
1638
|
+
"description": "The label of the select",
|
|
1639
|
+
"type": "string"
|
|
1638
1640
|
},
|
|
1639
1641
|
{
|
|
1640
|
-
"name": "
|
|
1641
|
-
"description": "
|
|
1642
|
-
"type": "
|
|
1642
|
+
"name": "defaultValue",
|
|
1643
|
+
"description": "The default value of the select. Corresponds to the `value` HTML attribute.",
|
|
1644
|
+
"type": "Array<string>"
|
|
1643
1645
|
},
|
|
1644
1646
|
{
|
|
1645
|
-
"name": "
|
|
1646
|
-
"description": "
|
|
1647
|
-
"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>"
|
|
1648
1650
|
},
|
|
1649
1651
|
{
|
|
1650
1652
|
"name": "clearable",
|
|
@@ -1657,26 +1659,15 @@
|
|
|
1657
1659
|
"type": "boolean"
|
|
1658
1660
|
},
|
|
1659
1661
|
{
|
|
1660
|
-
"name": "
|
|
1661
|
-
"description": "
|
|
1662
|
-
"type": "
|
|
1663
|
-
},
|
|
1664
|
-
{
|
|
1665
|
-
"name": "label",
|
|
1666
|
-
"description": "The label of the select",
|
|
1667
|
-
"type": "string"
|
|
1662
|
+
"name": "multiple",
|
|
1663
|
+
"description": "Allow multiple selections",
|
|
1664
|
+
"type": "boolean"
|
|
1668
1665
|
},
|
|
1669
1666
|
{
|
|
1670
|
-
"name": "
|
|
1671
|
-
"description": "
|
|
1672
|
-
"type": "
|
|
1673
|
-
}
|
|
1674
|
-
{ "name": "_optionFilterRef", "type": "Ref<LeuInput>" },
|
|
1675
|
-
{ "name": "_toggleButtonRef", "type": "Ref<HTMLButtonElement>" },
|
|
1676
|
-
{ "name": "_menuRef", "type": "Ref<LeuMenu>" },
|
|
1677
|
-
{ "name": "_optionFilter", "type": "string" },
|
|
1678
|
-
{ "name": "_hasFilterResults", "type": "boolean" },
|
|
1679
|
-
{ "name": "_displayValue", "type": "string" }
|
|
1667
|
+
"name": "required",
|
|
1668
|
+
"description": "Marks the input element as required",
|
|
1669
|
+
"type": "boolean"
|
|
1670
|
+
}
|
|
1680
1671
|
],
|
|
1681
1672
|
"events": []
|
|
1682
1673
|
}
|
package/package.json
CHANGED
|
@@ -4,6 +4,7 @@ import { ifDefined } from "lit/directives/if-defined.js"
|
|
|
4
4
|
import { property, query } from "lit/decorators.js"
|
|
5
5
|
|
|
6
6
|
import { LeuIcon } from "../icon/Icon.js"
|
|
7
|
+
import { LeuSpinner } from "../spinner/Spinner.js"
|
|
7
8
|
import { LeuElement } from "../../lib/LeuElement.js"
|
|
8
9
|
import { HasSlotController } from "../../lib/hasSlotController.js"
|
|
9
10
|
import { ARIA_CHECKED_ROLES, ARIA_SELECTED_ROLES } from "../../lib/a11y.js"
|
|
@@ -21,6 +22,7 @@ import { FormAssociatedMixin } from "../../lib/mixins/FormAssociatedMixin.js"
|
|
|
21
22
|
export class LeuButton extends FormAssociatedMixin(LeuElement) {
|
|
22
23
|
static dependencies = {
|
|
23
24
|
"leu-icon": LeuIcon,
|
|
25
|
+
"leu-spinner": LeuSpinner,
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
static styles = [LeuElement.styles, styles]
|
|
@@ -110,6 +112,12 @@ export class LeuButton extends FormAssociatedMixin(LeuElement) {
|
|
|
110
112
|
@property({ type: Boolean, reflect: true })
|
|
111
113
|
fluid: boolean = false
|
|
112
114
|
|
|
115
|
+
/**
|
|
116
|
+
* Replaces the content with a spinner
|
|
117
|
+
*/
|
|
118
|
+
@property({ type: Boolean, reflect: true })
|
|
119
|
+
loading: boolean = false
|
|
120
|
+
|
|
113
121
|
@query(".button")
|
|
114
122
|
private button!: HTMLButtonElement
|
|
115
123
|
|
|
@@ -166,7 +174,7 @@ export class LeuButton extends FormAssociatedMixin(LeuElement) {
|
|
|
166
174
|
setFormValue() {}
|
|
167
175
|
|
|
168
176
|
protected handleClick(e: PointerEvent) {
|
|
169
|
-
if (this.disabled) {
|
|
177
|
+
if (this.disabled || this.loading) {
|
|
170
178
|
e.preventDefault()
|
|
171
179
|
e.stopImmediatePropagation()
|
|
172
180
|
return
|
|
@@ -228,7 +236,9 @@ export class LeuButton extends FormAssociatedMixin(LeuElement) {
|
|
|
228
236
|
"icon-after": hasIconAfter,
|
|
229
237
|
round: this.round,
|
|
230
238
|
active: this.active,
|
|
239
|
+
disabled: this.disabled,
|
|
231
240
|
inverted: this.inverted,
|
|
241
|
+
loading: this.loading,
|
|
232
242
|
[this.variant]: true,
|
|
233
243
|
[this.size]: true,
|
|
234
244
|
}
|
|
@@ -241,7 +251,7 @@ export class LeuButton extends FormAssociatedMixin(LeuElement) {
|
|
|
241
251
|
aria-expanded=${ifDefined(this.expanded)}
|
|
242
252
|
role=${ifDefined(aria.role)}
|
|
243
253
|
class=${classMap(cssClasses)}
|
|
244
|
-
?disabled=${this.disabled}
|
|
254
|
+
?disabled=${this.disabled || this.loading}
|
|
245
255
|
type=${this.type}
|
|
246
256
|
>
|
|
247
257
|
<div class="icon-wrapper icon-wrapper--before">
|
|
@@ -251,7 +261,9 @@ export class LeuButton extends FormAssociatedMixin(LeuElement) {
|
|
|
251
261
|
<div class="icon-wrapper icon-wrapper--after">
|
|
252
262
|
<slot name="after" class="icon-wrapper__slot"></slot>
|
|
253
263
|
</div>
|
|
254
|
-
|
|
264
|
+
${this.loading
|
|
265
|
+
? html`<leu-spinner class="spinner"></leu-spinner>`
|
|
266
|
+
: nothing}
|
|
255
267
|
${this.renderExpandingIcon()}
|
|
256
268
|
</button>
|
|
257
269
|
`
|
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
display: inline-block;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
+
/*
|
|
6
|
+
* @todo : Disable hover styles for loading state
|
|
7
|
+
*/
|
|
5
8
|
button {
|
|
9
|
+
position: relative;
|
|
10
|
+
|
|
6
11
|
font-family: var(--leu-font-family-black);
|
|
7
12
|
text-align: center;
|
|
8
13
|
appearance: none;
|
|
@@ -28,10 +33,14 @@ button.round {
|
|
|
28
33
|
border-radius: 50%;
|
|
29
34
|
}
|
|
30
35
|
|
|
31
|
-
button
|
|
36
|
+
button.disabled {
|
|
32
37
|
cursor: not-allowed;
|
|
33
38
|
}
|
|
34
39
|
|
|
40
|
+
button.loading {
|
|
41
|
+
cursor: wait;
|
|
42
|
+
}
|
|
43
|
+
|
|
35
44
|
button:focus-visible {
|
|
36
45
|
outline: 2px solid var(--leu-color-func-cyan);
|
|
37
46
|
outline-offset: 2px;
|
|
@@ -46,6 +55,10 @@ button.inverted:focus-visible {
|
|
|
46
55
|
justify-content: center;
|
|
47
56
|
}
|
|
48
57
|
|
|
58
|
+
button.loading :where(.content, .icon-wrapper) {
|
|
59
|
+
visibility: hidden;
|
|
60
|
+
}
|
|
61
|
+
|
|
49
62
|
/* size - regular */
|
|
50
63
|
button.regular {
|
|
51
64
|
padding: 12px 24px;
|
|
@@ -90,7 +103,7 @@ button.primary.active:hover {
|
|
|
90
103
|
background: var(--leu-color-black-transp-80);
|
|
91
104
|
}
|
|
92
105
|
|
|
93
|
-
button.primary
|
|
106
|
+
button.primary.disabled {
|
|
94
107
|
color: var(--leu-color-black-0);
|
|
95
108
|
background: var(--leu-color-black-transp-20);
|
|
96
109
|
}
|
|
@@ -115,7 +128,7 @@ button.secondary.active:hover {
|
|
|
115
128
|
background: var(--leu-color-black-transp-80);
|
|
116
129
|
}
|
|
117
130
|
|
|
118
|
-
button.secondary
|
|
131
|
+
button.secondary.disabled {
|
|
119
132
|
color: var(--leu-color-black-transp-20);
|
|
120
133
|
background: var(--leu-color-black-transp-5);
|
|
121
134
|
}
|
|
@@ -139,7 +152,7 @@ button.ghost.active {
|
|
|
139
152
|
color: var(--leu-color-black-100);
|
|
140
153
|
}
|
|
141
154
|
|
|
142
|
-
button.ghost
|
|
155
|
+
button.ghost.disabled {
|
|
143
156
|
color: var(--leu-color-black-20);
|
|
144
157
|
}
|
|
145
158
|
|
|
@@ -159,7 +172,7 @@ button.primary.inverted.active {
|
|
|
159
172
|
background: var(--leu-color-black-100);
|
|
160
173
|
}
|
|
161
174
|
|
|
162
|
-
button.primary.inverted
|
|
175
|
+
button.primary.inverted.disabled {
|
|
163
176
|
color: var(--leu-color-black-40);
|
|
164
177
|
background: var(--leu-color-white-transp-70);
|
|
165
178
|
}
|
|
@@ -180,7 +193,7 @@ button.secondary.inverted.active {
|
|
|
180
193
|
background: var(--leu-color-black-0);
|
|
181
194
|
}
|
|
182
195
|
|
|
183
|
-
button.secondary.inverted
|
|
196
|
+
button.secondary.inverted.disabled {
|
|
184
197
|
color: var(--leu-color-white-transp-70);
|
|
185
198
|
background: var(--leu-color-black-transp-10);
|
|
186
199
|
}
|
|
@@ -198,7 +211,7 @@ button.ghost.inverted.active {
|
|
|
198
211
|
color: var(--leu-color-black-0);
|
|
199
212
|
}
|
|
200
213
|
|
|
201
|
-
button.ghost.inverted
|
|
214
|
+
button.ghost.inverted.disabled {
|
|
202
215
|
color: var(--leu-color-black-20);
|
|
203
216
|
}
|
|
204
217
|
|
|
@@ -249,7 +262,7 @@ button.ghost.inverted:disabled {
|
|
|
249
262
|
--_color: var(--leu-color-black-0);
|
|
250
263
|
}
|
|
251
264
|
|
|
252
|
-
.ghost
|
|
265
|
+
.ghost.disabled .icon-wrapper {
|
|
253
266
|
--_bg: var(--leu-color-black-transp-5);
|
|
254
267
|
}
|
|
255
268
|
|
|
@@ -264,7 +277,7 @@ button.ghost.inverted:disabled {
|
|
|
264
277
|
--_color: var(--leu-color-black-0);
|
|
265
278
|
}
|
|
266
279
|
|
|
267
|
-
.ghost.inverted
|
|
280
|
+
.ghost.inverted.disabled .icon-wrapper {
|
|
268
281
|
--_bg: var(--leu-color-black-transp-20);
|
|
269
282
|
--_color: var(--leu-color-white-transp-70);
|
|
270
283
|
}
|
|
@@ -286,3 +299,18 @@ button.ghost.inverted:disabled {
|
|
|
286
299
|
:host([expanded="true"]) .icon-expanded {
|
|
287
300
|
transform: rotate(180deg);
|
|
288
301
|
}
|
|
302
|
+
|
|
303
|
+
.spinner {
|
|
304
|
+
--leu-spinner-size: 1.75rem;
|
|
305
|
+
padding: 0;
|
|
306
|
+
position: absolute;
|
|
307
|
+
top: 50%;
|
|
308
|
+
left: 50%;
|
|
309
|
+
transform: translate(-50%, -50%);
|
|
310
|
+
color: currentcolor;
|
|
311
|
+
display: block;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
button.small .spinner {
|
|
315
|
+
--leu-spinner-size: 1.25rem;
|
|
316
|
+
}
|
|
@@ -41,6 +41,7 @@ function Template(args = {}) {
|
|
|
41
41
|
?active=${args.active}
|
|
42
42
|
?inverted=${args.inverted}
|
|
43
43
|
?disabled=${args.disabled}
|
|
44
|
+
?loading=${args.loading}
|
|
44
45
|
@click=${copyContent}
|
|
45
46
|
>
|
|
46
47
|
${args.icon
|
|
@@ -87,6 +88,7 @@ Regular.argTypes = {
|
|
|
87
88
|
disabled: { control: "boolean" },
|
|
88
89
|
round: { control: "boolean" },
|
|
89
90
|
active: { control: "boolean" },
|
|
91
|
+
loading: { control: "boolean" },
|
|
90
92
|
}
|
|
91
93
|
Regular.args = {
|
|
92
94
|
content: "Click Mich...",
|
|
@@ -125,6 +127,22 @@ const items = [
|
|
|
125
127
|
disabled: true,
|
|
126
128
|
},
|
|
127
129
|
|
|
130
|
+
{ content: "Normal", icon: "calendar", iconPosition: "after", loading: true },
|
|
131
|
+
{
|
|
132
|
+
content: "Active",
|
|
133
|
+
icon: "calendar",
|
|
134
|
+
iconPosition: "after",
|
|
135
|
+
active: true,
|
|
136
|
+
loading: true,
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
content: "Disabled",
|
|
140
|
+
icon: "calendar",
|
|
141
|
+
iconPosition: "after",
|
|
142
|
+
disabled: true,
|
|
143
|
+
loading: true,
|
|
144
|
+
},
|
|
145
|
+
|
|
128
146
|
{ icon: "calendar" },
|
|
129
147
|
{ icon: "calendar", active: true },
|
|
130
148
|
{ icon: "calendar", disabled: true },
|
|
@@ -132,6 +150,10 @@ const items = [
|
|
|
132
150
|
{ icon: "calendar", round: true },
|
|
133
151
|
{ icon: "calendar", round: true, active: true },
|
|
134
152
|
{ icon: "calendar", round: true, disabled: true },
|
|
153
|
+
|
|
154
|
+
{ icon: "calendar", round: true, loading: true },
|
|
155
|
+
{ icon: "calendar", round: true, active: true, loading: true },
|
|
156
|
+
{ icon: "calendar", round: true, disabled: true, loading: true },
|
|
135
157
|
]
|
|
136
158
|
|
|
137
159
|
const ghostItems = [
|
|
@@ -309,6 +331,7 @@ function TemplateOverview() {
|
|
|
309
331
|
?active=${item.active}
|
|
310
332
|
?disabled=${item.disabled}
|
|
311
333
|
?inverted=${group.inverted}
|
|
334
|
+
?loading=${item.loading}
|
|
312
335
|
@click=${copyContent}
|
|
313
336
|
>
|
|
314
337
|
${item.icon
|