@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.
Files changed (136) hide show
  1. package/.release-please-manifest.json +1 -1
  2. package/CHANGELOG.md +28 -0
  3. package/CONTRIBUTING.md +19 -8
  4. package/dist/{Accordion-CDNyrB8d.js → Accordion-DLsqXcK8.js} +1 -1
  5. package/dist/Accordion.js +2 -2
  6. package/dist/{Button-EdS9xr2J.js → Button-BSyDL_cV.js} +57 -17
  7. package/dist/{Button-DSGPIcjm.d.ts → Button-BgNUxmo_.d.ts} +6 -0
  8. package/dist/Button.d.ts +1 -1
  9. package/dist/Button.js +5 -4
  10. package/dist/{ButtonGroup-BQqf8o_d.js → ButtonGroup-BmSvl-Oc.js} +2 -2
  11. package/dist/ButtonGroup.js +6 -5
  12. package/dist/{ChartWrapper-LiNHTNRw.js → ChartWrapper-CvDvQsd5.js} +3 -3
  13. package/dist/ChartWrapper.d.ts +2 -2
  14. package/dist/ChartWrapper.js +3 -3
  15. package/dist/{Checkbox-BtDWmPab.js → Checkbox-Cl_X6gBJ.js} +3 -3
  16. package/dist/Checkbox.js +4 -4
  17. package/dist/{CheckboxGroup-C8MbwW9u.js → CheckboxGroup-BKhOmZYX.js} +2 -2
  18. package/dist/CheckboxGroup.js +5 -5
  19. package/dist/{Chip-Ch09jjYi.js → Chip-McVP3N_x.js} +1 -1
  20. package/dist/Chip.js +2 -2
  21. package/dist/{ChipGroup-PvqVW-tm.js → ChipGroup-DUGavZeU.js} +1 -1
  22. package/dist/ChipGroup.js +3 -3
  23. package/dist/ChipLink.js +2 -2
  24. package/dist/ChipRemovable.js +3 -3
  25. package/dist/ChipSelectable.js +2 -2
  26. package/dist/{Dialog-CV1JTkCn.js → Dialog-BlDd4T2u.js} +3 -3
  27. package/dist/Dialog.d.ts +1 -1
  28. package/dist/Dialog.js +3 -3
  29. package/dist/{Dropdown-DpFdFbA1.js → Dropdown-BLxSIe6p.js} +6 -6
  30. package/dist/Dropdown.d.ts +2 -2
  31. package/dist/Dropdown.js +9 -8
  32. package/dist/{FileInput-5apX17JT.js → FileInput-DntYrpZ-.js} +23 -8
  33. package/dist/FileInput.d.ts +12 -1
  34. package/dist/FileInput.js +7 -6
  35. package/dist/{Icon-DhAvH0XM.js → Icon-CbZXpyHU.js} +1 -1
  36. package/dist/Icon.js +2 -2
  37. package/dist/{Input-D2THgo7c.d.ts → Input-CeaAOB4p.d.ts} +6 -2
  38. package/dist/{Input-CnEz-2dK.js → Input-DBXX7ev8.js} +33 -12
  39. package/dist/Input.d.ts +1 -1
  40. package/dist/Input.js +4 -4
  41. package/dist/{LeuElement-B7NJzWwP.js → LeuElement-k4RjIeoG.js} +1 -1
  42. package/dist/{Menu-DpiheIPk.js → Menu-Cu8eIF1T.js} +2 -2
  43. package/dist/Menu.js +4 -4
  44. package/dist/{MenuItem-CZTqGg5R.js → MenuItem-Cs3KFhJm.js} +2 -2
  45. package/dist/MenuItem.js +3 -3
  46. package/dist/{Message-J4Kj7yHE.js → Message-C6Zlk_2p.js} +3 -3
  47. package/dist/Message.js +3 -3
  48. package/dist/{Pagination-CWqgusWZ.js → Pagination-CB2eVlXk.js} +4 -4
  49. package/dist/{Pagination-Be8TcBoC.d.ts → Pagination-CqkHh-Vd.d.ts} +1 -1
  50. package/dist/Pagination.d.ts +1 -1
  51. package/dist/Pagination.js +7 -6
  52. package/dist/{Placeholder-DMN6sMbp.js → Placeholder-DHMexMhK.js} +1 -1
  53. package/dist/Placeholder.js +2 -2
  54. package/dist/{Popup-JQjuj26v.js → Popup-8jhVy8gB.js} +1 -1
  55. package/dist/Popup.js +2 -2
  56. package/dist/{ProgressBar-CzN3fqiH.js → ProgressBar-CG0_lHfS.js} +1 -1
  57. package/dist/ProgressBar.js +2 -2
  58. package/dist/{Radio-CX8aCsff.js → Radio-DG3xqP3s.js} +1 -1
  59. package/dist/Radio.js +2 -2
  60. package/dist/{RadioGroup-CgEWQnC4.js → RadioGroup-BKCp9ICX.js} +2 -2
  61. package/dist/RadioGroup.js +3 -3
  62. package/dist/{Range-DoW_ZdKm.js → Range-7LrESv4K.js} +1 -1
  63. package/dist/Range.js +2 -2
  64. package/dist/{ScrollTop-DxChetWq.js → ScrollTop-CJJsfniA.js} +20 -20
  65. package/dist/ScrollTop.d.ts +6 -6
  66. package/dist/ScrollTop.js +6 -5
  67. package/dist/{Select-BCx79gOH.js → Select-CxEDXIBn.js} +154 -134
  68. package/dist/Select.d.ts +75 -73
  69. package/dist/Select.js +10 -9
  70. package/dist/{Spinner-DJR4gv3Y.js → Spinner-VhKfzI3Q.js} +1 -1
  71. package/dist/Spinner.d.ts +1 -1
  72. package/dist/Spinner.js +2 -2
  73. package/dist/{Table-DZz1ic3j.js → Table-rg_JCtsA.js} +3 -3
  74. package/dist/Table.d.ts +1 -1
  75. package/dist/Table.js +8 -7
  76. package/dist/{Tag-DsZS_8pl.js → Tag-BROUaDAZ.js} +1 -1
  77. package/dist/Tag.js +2 -2
  78. package/dist/{VisuallyHidden-BkllVjlz.js → VisuallyHidden-Co_txzxB.js} +1 -1
  79. package/dist/VisuallyHidden.js +2 -2
  80. package/dist/index.d.ts +4 -4
  81. package/dist/index.js +31 -31
  82. package/dist/leu-accordion.js +2 -2
  83. package/dist/leu-button-group.js +6 -5
  84. package/dist/leu-button.d.ts +1 -1
  85. package/dist/leu-button.js +5 -4
  86. package/dist/leu-chart-wrapper.js +3 -3
  87. package/dist/leu-checkbox-group.js +5 -5
  88. package/dist/leu-checkbox.js +4 -4
  89. package/dist/leu-chip-group.js +3 -3
  90. package/dist/leu-chip-link.js +2 -2
  91. package/dist/leu-chip-removable.js +3 -3
  92. package/dist/leu-chip-selectable.js +2 -2
  93. package/dist/leu-dialog.js +3 -3
  94. package/dist/leu-dropdown.js +9 -8
  95. package/dist/leu-file-input.js +7 -6
  96. package/dist/leu-icon.js +2 -2
  97. package/dist/leu-input.d.ts +1 -1
  98. package/dist/leu-input.js +4 -4
  99. package/dist/leu-menu-item.js +3 -3
  100. package/dist/leu-menu.js +4 -4
  101. package/dist/leu-message.js +3 -3
  102. package/dist/leu-pagination.d.ts +1 -1
  103. package/dist/leu-pagination.js +7 -6
  104. package/dist/leu-placeholder.js +2 -2
  105. package/dist/leu-popup.js +2 -2
  106. package/dist/leu-progress-bar.js +2 -2
  107. package/dist/leu-radio-group.js +3 -3
  108. package/dist/leu-radio.js +2 -2
  109. package/dist/leu-range.js +2 -2
  110. package/dist/leu-scroll-top.js +6 -5
  111. package/dist/leu-select.js +10 -9
  112. package/dist/leu-spinner.d.ts +1 -1
  113. package/dist/leu-spinner.js +2 -2
  114. package/dist/leu-table.js +8 -7
  115. package/dist/leu-tag.js +2 -2
  116. package/dist/leu-visually-hidden.js +2 -2
  117. package/dist/vscode.html-custom-data.json +19 -27
  118. package/dist/vue/index.d.ts +18 -24
  119. package/dist/web-types.json +51 -60
  120. package/package.json +1 -1
  121. package/src/components/button/Button.ts +15 -3
  122. package/src/components/button/button.css +37 -9
  123. package/src/components/button/stories/button.stories.ts +23 -0
  124. package/src/components/button/test/button.test.ts +30 -3
  125. package/src/components/file-input/FileInput.ts +24 -5
  126. package/src/components/input/Input.ts +43 -8
  127. package/src/components/input/test/input.test.ts +106 -1
  128. package/src/components/scroll-top/ScrollTop.ts +18 -16
  129. package/src/components/select/Select.ts +198 -124
  130. package/src/components/select/select.css +4 -0
  131. package/src/components/select/stories/select.stories.ts +10 -0
  132. package/src/components/select/test/select.test.ts +440 -35
  133. /package/dist/{FormAssociatedMixin-BbFlza53.js → FormAssociatedMixin-DLPvFtbT.js} +0 -0
  134. /package/dist/{Spinner-CMo_o6Fy.d.ts → Spinner-CrM1enM0.d.ts} +0 -0
  135. /package/dist/{hasSlotController-DjdfnOQp.js → hasSlotController-DSBCVzPD.js} +0 -0
  136. /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(): _String | nothing_** - Determines the value or label that should be displayed inside the toggle button.\n- **_isSelected(menuItemValue: _String_): _Boolean_** - 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",
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": "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.",
811
- "values": [{ "name": "array" }]
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
- { "name": "_optionFilter", "values": [] },
849
- { "name": "_hasFilterResults", "values": [] },
850
- { "name": "_displayValue", "values": [] }
838
+ {
839
+ "name": "required",
840
+ "description": "Marks the input element as required",
841
+ "values": []
842
+ }
851
843
  ],
852
844
  "references": [
853
845
  {
@@ -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
- /** 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. */
431
- value?: LeuSelect["value"];
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
- _optionFilter?: LeuSelect["_optionFilter"];
448
- /** */
449
- _hasFilterResults?: LeuSelect["_hasFilterResults"];
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(): _String | nothing_** - Determines the value or label that should be displayed inside the toggle button.
804
- * - **_isSelected(menuItemValue: _String_): _Boolean_** - Checks if the given value is selected.
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
@@ -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.25.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(): _String | nothing_** - Determines the value or label that should be displayed inside the toggle button.\n- **_isSelected(menuItemValue: _String_): _Boolean_** - 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",
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": "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.",
1580
- "value": { "type": "array", "default": "[]" }
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
- { "name": "_optionFilter", "value": { "type": "string" } },
1618
- { "name": "_hasFilterResults", "value": { "type": "string" } },
1619
- { "name": "_displayValue", "value": { "type": "string" } }
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": "open",
1636
- "description": "The expanded state of the popup",
1637
- "type": "boolean"
1637
+ "name": "label",
1638
+ "description": "The label of the select",
1639
+ "type": "string"
1638
1640
  },
1639
1641
  {
1640
- "name": "disabled",
1641
- "description": "If the select should be disabled",
1642
- "type": "boolean"
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": "multiple",
1646
- "description": "Allow multiple selections",
1647
- "type": "boolean"
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": "value",
1661
- "description": "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.",
1662
- "type": "array"
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": "name",
1671
- "description": "Reflects to the name attribute of the hidden input field that would be used in a form",
1672
- "type": "string"
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
@@ -3,7 +3,7 @@
3
3
  "description": "UI component library of the canton of zurich",
4
4
  "license": "MIT",
5
5
  "author": "statistikzh",
6
- "version": "0.25.0",
6
+ "version": "0.27.0",
7
7
  "type": "module",
8
8
  "main": "dist/index.js",
9
9
  "module": "dist/index.js",
@@ -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:disabled {
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:disabled {
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:disabled {
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:disabled {
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:disabled {
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:disabled {
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:disabled {
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:disabled .icon-wrapper {
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:disabled .icon-wrapper {
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