@statistikzh/leu 0.26.0 → 0.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/.release-please-manifest.json +1 -1
  2. package/.storybook/main.ts +1 -1
  3. package/.storybook/preview.ts +6 -4
  4. package/.storybook/static/global.css +5 -0
  5. package/CHANGELOG.md +44 -0
  6. package/dist/{Accordion-B04QkmHz.js → Accordion-D9kLsiBW.js} +1 -1
  7. package/dist/Accordion.d.ts +1 -1
  8. package/dist/Accordion.js +2 -2
  9. package/dist/{Button-BgNUxmo_.d.ts → Button-DcuvEVkC.d.ts} +14 -12
  10. package/dist/{Button-BkhqVjug.js → Button-DyNVOHCd.js} +90 -82
  11. package/dist/Button.d.ts +1 -1
  12. package/dist/Button.js +4 -4
  13. package/dist/{ButtonGroup-B8U9fDvM.js → ButtonGroup-MEh4vb5a.js} +2 -2
  14. package/dist/ButtonGroup.d.ts +1 -1
  15. package/dist/ButtonGroup.js +5 -5
  16. package/dist/{ChartWrapper-CSMFwz9e.js → ChartWrapper-DAl91BIN.js} +2 -2
  17. package/dist/ChartWrapper.d.ts +3 -3
  18. package/dist/ChartWrapper.js +3 -3
  19. package/dist/{Checkbox-Dd1QLpfn.js → Checkbox-CGGyUW9U.js} +2 -2
  20. package/dist/Checkbox.d.ts +3 -3
  21. package/dist/Checkbox.js +3 -3
  22. package/dist/{CheckboxGroup-Bz2eWEFL.js → CheckboxGroup-DXt5iMdj.js} +2 -2
  23. package/dist/CheckboxGroup.d.ts +1 -1
  24. package/dist/CheckboxGroup.js +4 -4
  25. package/dist/{Chip-XAQIIsXq.js → Chip-BGs71WGH.js} +1 -1
  26. package/dist/{Chip-DLKM9P7v.d.ts → Chip-DVGjEPJE.d.ts} +1 -1
  27. package/dist/Chip.d.ts +1 -1
  28. package/dist/Chip.js +2 -2
  29. package/dist/{ChipGroup-Ta8Ht4jc.d.ts → ChipGroup-BK5BYM0X.d.ts} +2 -2
  30. package/dist/{ChipGroup-DLqfK2kn.js → ChipGroup-BcGyusP-.js} +1 -1
  31. package/dist/ChipGroup.d.ts +1 -1
  32. package/dist/ChipGroup.js +3 -3
  33. package/dist/{ChipLink-BAxyQO2M.d.ts → ChipLink-BdG2o-nk.d.ts} +1 -1
  34. package/dist/ChipLink.d.ts +1 -1
  35. package/dist/ChipLink.js +2 -2
  36. package/dist/{ChipRemovable-DBjwt0CH.d.ts → ChipRemovable-CCwSQTAL.d.ts} +2 -2
  37. package/dist/ChipRemovable.d.ts +1 -1
  38. package/dist/ChipRemovable.js +3 -3
  39. package/dist/{ChipSelectable-CMJNcE4U.d.ts → ChipSelectable-BQ3VLVi5.d.ts} +1 -1
  40. package/dist/ChipSelectable.d.ts +1 -1
  41. package/dist/ChipSelectable.js +2 -2
  42. package/dist/{Dialog-DHuXR_oo.js → Dialog-BzuyL1U3.js} +2 -2
  43. package/dist/Dialog.d.ts +3 -3
  44. package/dist/Dialog.js +3 -3
  45. package/dist/{Dropdown-DtFTePbc.js → Dropdown-plyBTM15.js} +5 -5
  46. package/dist/Dropdown.d.ts +6 -6
  47. package/dist/Dropdown.js +8 -8
  48. package/dist/{FileInput-b8sbLDPI.js → FileInput-BT3Fe-0J.js} +22 -7
  49. package/dist/FileInput.d.ts +16 -5
  50. package/dist/FileInput.js +6 -6
  51. package/dist/{Icon-Op80LrrO.d.ts → Icon-CUfh3eb3.d.ts} +1 -1
  52. package/dist/{Icon-C_yYuynf.js → Icon-D83qesg5.js} +1 -1
  53. package/dist/Icon.d.ts +1 -1
  54. package/dist/Icon.js +2 -2
  55. package/dist/{Input-DEOVocTa.js → Input-D7zS50oz.js} +32 -11
  56. package/dist/{Input-D2THgo7c.d.ts → Input-fEiQvGDF.d.ts} +9 -5
  57. package/dist/Input.d.ts +1 -1
  58. package/dist/Input.js +3 -3
  59. package/dist/{LeuElement-BeFrgKes.js → LeuElement-DQI8cqZV.js} +1 -1
  60. package/dist/{Menu-BeqqtCw6.js → Menu-DRU1LiMM.js} +2 -2
  61. package/dist/{Menu-CQdx1ef3.d.ts → Menu-Z2b7dsB5.d.ts} +2 -2
  62. package/dist/Menu.d.ts +1 -1
  63. package/dist/Menu.js +4 -4
  64. package/dist/{MenuItem-DVg8-1Bq.js → MenuItem-DCttylRO.js} +2 -2
  65. package/dist/{MenuItem-QcgnRk_7.d.ts → MenuItem-LY4TRIho.d.ts} +2 -2
  66. package/dist/MenuItem.d.ts +1 -1
  67. package/dist/MenuItem.js +3 -3
  68. package/dist/{Message-BhknWvAF.js → Message-0NxnKEqw.js} +2 -2
  69. package/dist/Message.d.ts +2 -2
  70. package/dist/Message.js +3 -3
  71. package/dist/{Pagination-CqkHh-Vd.d.ts → Pagination-9eZ8WMvR.d.ts} +4 -4
  72. package/dist/{Pagination-DJI5MIi_.js → Pagination-CIy7YvWE.js} +4 -4
  73. package/dist/Pagination.d.ts +1 -1
  74. package/dist/Pagination.js +6 -6
  75. package/dist/{Placeholder-BJybFwSg.js → Placeholder-Dol_X5Hp.js} +1 -1
  76. package/dist/Placeholder.d.ts +1 -1
  77. package/dist/Placeholder.js +2 -2
  78. package/dist/{Popup-Btgm2a3D.d.ts → Popup-B5iDSLIO.d.ts} +1 -1
  79. package/dist/{Popup-DNlm_9AA.js → Popup-nJrJHGSy.js} +1 -1
  80. package/dist/Popup.d.ts +1 -1
  81. package/dist/Popup.js +2 -2
  82. package/dist/{ProgressBar-B0wYj1KF.js → ProgressBar-Dmq9veqU.js} +1 -1
  83. package/dist/ProgressBar.d.ts +1 -1
  84. package/dist/ProgressBar.js +2 -2
  85. package/dist/{Radio-DMCL8c4D.js → Radio-W5ck_IJI.js} +1 -1
  86. package/dist/Radio.d.ts +1 -1
  87. package/dist/Radio.js +2 -2
  88. package/dist/{RadioGroup-CM6IyBlq.js → RadioGroup-De5x2YCO.js} +2 -2
  89. package/dist/RadioGroup.d.ts +1 -1
  90. package/dist/RadioGroup.js +3 -3
  91. package/dist/{Range-B72rtfln.js → Range-NCdfDkeD.js} +1 -1
  92. package/dist/Range.d.ts +1 -1
  93. package/dist/Range.js +2 -2
  94. package/dist/{ScrollTop-BFAqBVDR.js → ScrollTop-DwcNIKmN.js} +20 -20
  95. package/dist/ScrollTop.d.ts +8 -8
  96. package/dist/ScrollTop.js +5 -5
  97. package/dist/{Select-vxl3BvD4.js → Select-Bpicra9q.js} +153 -134
  98. package/dist/Select.d.ts +80 -78
  99. package/dist/Select.js +9 -9
  100. package/dist/{Spinner-DDTqijTO.js → Spinner-BBiVZxFH.js} +1 -1
  101. package/dist/{Spinner-CrM1enM0.d.ts → Spinner-DHYaX6-Y.d.ts} +1 -1
  102. package/dist/Spinner.d.ts +1 -1
  103. package/dist/Spinner.js +2 -2
  104. package/dist/Tab-CN97q0nj.d.ts +30 -0
  105. package/dist/Tab-Ce9nrDok.js +117 -0
  106. package/dist/Tab.d.ts +2 -0
  107. package/dist/Tab.js +3 -0
  108. package/dist/TabGroup-C-cd4Wcx.js +248 -0
  109. package/dist/TabGroup.d.ts +64 -0
  110. package/dist/TabGroup.js +5 -0
  111. package/dist/TabPanel-BW1ydVBT.js +65 -0
  112. package/dist/TabPanel-DQgWP7LO.d.ts +26 -0
  113. package/dist/TabPanel.d.ts +2 -0
  114. package/dist/TabPanel.js +3 -0
  115. package/dist/{Table-BgCxfBcm.js → Table-DiYqIzBu.js} +3 -3
  116. package/dist/Table.d.ts +3 -3
  117. package/dist/Table.js +7 -7
  118. package/dist/{Tag-DK2KkPIQ.js → Tag-Ct8Hhv7W.js} +1 -1
  119. package/dist/Tag.d.ts +1 -1
  120. package/dist/Tag.js +2 -2
  121. package/dist/{VisuallyHidden-OeQvhxYn.d.ts → VisuallyHidden-CB7aRJzF.d.ts} +1 -1
  122. package/dist/{VisuallyHidden-pll3amXE.js → VisuallyHidden-CpYXyuC7.js} +1 -1
  123. package/dist/VisuallyHidden.d.ts +1 -1
  124. package/dist/VisuallyHidden.js +2 -2
  125. package/dist/index.d.ts +14 -14
  126. package/dist/index.js +30 -30
  127. package/dist/leu-accordion.js +2 -2
  128. package/dist/leu-button-group.js +5 -5
  129. package/dist/leu-button.d.ts +1 -1
  130. package/dist/leu-button.js +4 -4
  131. package/dist/leu-chart-wrapper.js +3 -3
  132. package/dist/leu-checkbox-group.js +4 -4
  133. package/dist/leu-checkbox.js +3 -3
  134. package/dist/leu-chip-group.d.ts +1 -1
  135. package/dist/leu-chip-group.js +3 -3
  136. package/dist/leu-chip-link.d.ts +1 -1
  137. package/dist/leu-chip-link.js +2 -2
  138. package/dist/leu-chip-removable.d.ts +1 -1
  139. package/dist/leu-chip-removable.js +3 -3
  140. package/dist/leu-chip-selectable.d.ts +1 -1
  141. package/dist/leu-chip-selectable.js +2 -2
  142. package/dist/leu-dialog.js +3 -3
  143. package/dist/leu-dropdown.js +8 -8
  144. package/dist/leu-file-input.js +6 -6
  145. package/dist/leu-icon.d.ts +1 -1
  146. package/dist/leu-icon.js +2 -2
  147. package/dist/leu-input.d.ts +1 -1
  148. package/dist/leu-input.js +3 -3
  149. package/dist/leu-menu-item.d.ts +1 -1
  150. package/dist/leu-menu-item.js +3 -3
  151. package/dist/leu-menu.d.ts +1 -1
  152. package/dist/leu-menu.js +4 -4
  153. package/dist/leu-message.js +3 -3
  154. package/dist/leu-pagination.d.ts +1 -1
  155. package/dist/leu-pagination.js +6 -6
  156. package/dist/leu-placeholder.js +2 -2
  157. package/dist/leu-popup.d.ts +1 -1
  158. package/dist/leu-popup.js +2 -2
  159. package/dist/leu-progress-bar.js +2 -2
  160. package/dist/leu-radio-group.js +3 -3
  161. package/dist/leu-radio.js +2 -2
  162. package/dist/leu-range.js +2 -2
  163. package/dist/leu-scroll-top.js +5 -5
  164. package/dist/leu-select.js +9 -9
  165. package/dist/leu-spinner.d.ts +1 -1
  166. package/dist/leu-spinner.js +2 -2
  167. package/dist/leu-tab-group.d.ts +10 -0
  168. package/dist/leu-tab-group.js +8 -0
  169. package/dist/leu-tab-panel.d.ts +10 -0
  170. package/dist/leu-tab-panel.js +6 -0
  171. package/dist/leu-tab.d.ts +10 -0
  172. package/dist/leu-tab.js +6 -0
  173. package/dist/leu-table.js +7 -7
  174. package/dist/leu-tag.js +2 -2
  175. package/dist/leu-visually-hidden.d.ts +1 -1
  176. package/dist/leu-visually-hidden.js +2 -2
  177. package/dist/vscode.html-custom-data.json +90 -35
  178. package/dist/vue/index.d.ts +89 -29
  179. package/dist/web-types.json +182 -76
  180. package/package.json +1 -2
  181. package/src/components/button/Button.ts +45 -30
  182. package/src/components/button/button.css +55 -54
  183. package/src/components/button/stories/button.stories.ts +17 -20
  184. package/src/components/button/test/button.test.ts +46 -0
  185. package/src/components/file-input/FileInput.ts +24 -5
  186. package/src/components/input/Input.ts +43 -8
  187. package/src/components/input/test/input.test.ts +106 -1
  188. package/src/components/scroll-top/ScrollTop.ts +18 -16
  189. package/src/components/select/Select.ts +198 -125
  190. package/src/components/select/select.css +4 -0
  191. package/src/components/select/stories/select.stories.ts +10 -0
  192. package/src/components/select/test/select.test.ts +440 -35
  193. package/src/components/tab/Tab.ts +72 -0
  194. package/src/components/tab/TabGroup.ts +267 -0
  195. package/src/components/tab/TabPanel.ts +59 -0
  196. package/src/components/tab/leu-tab-group.ts +11 -0
  197. package/src/components/tab/leu-tab-panel.ts +11 -0
  198. package/src/components/tab/leu-tab.ts +11 -0
  199. package/src/components/tab/stories/tab.stories.ts +97 -0
  200. package/src/components/tab/tab-group.css +63 -0
  201. package/src/components/tab/tab-panel.css +10 -0
  202. package/src/components/tab/tab.css +54 -0
  203. package/src/components/tab/test/tab-group.test.ts +426 -0
  204. package/src/components/tab/test/tab-panel.test.ts +102 -0
  205. package/src/components/tab/test/tab.test.ts +139 -0
  206. package/tsconfig.json +1 -0
  207. /package/dist/{FormAssociatedMixin-Cc74LjbC.d.ts → FormAssociatedMixin-Cw7LsSUE.d.ts} +0 -0
  208. /package/dist/{LeuElement-pJFU18Xm.d.ts → LeuElement-DK1jntuu.d.ts} +0 -0
  209. /package/dist/{hasSlotController-DWPyZ52b.d.ts → hasSlotController-BjKyhJm-.d.ts} +0 -0
@@ -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.26.0",
4
+ "version": "0.28.0",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -93,7 +93,7 @@
93
93
  },
94
94
  {
95
95
  "name": "type",
96
- "description": "The `type` of the underlying button element.",
96
+ "description": "The `type` of the underlying button element. Ignored when `href` is set.",
97
97
  "value": {
98
98
  "type": "\"button\" | \"submit\" | \"reset\"",
99
99
  "default": "\"button\""
@@ -101,12 +101,24 @@
101
101
  },
102
102
  {
103
103
  "name": "componentRole",
104
- "description": "The `role` of the underlying button element.",
104
+ "description": "The `role` of the underlying button element. Ignored when `href` is set.",
105
105
  "value": { "type": "string | undefined" }
106
106
  },
107
+ {
108
+ "name": "href",
109
+ "description": "If set, renders the button as an <a> element instead of a <button> with the provided href.",
110
+ "value": { "type": "string" }
111
+ },
112
+ {
113
+ "name": "target",
114
+ "description": "Tells the browser where to display the linked URL. Only used when `href` is set.",
115
+ "value": {
116
+ "type": "\"_blank\" | \"_parent\" | \"_self\" | \"_top\""
117
+ }
118
+ },
107
119
  {
108
120
  "name": "disabled",
109
- "description": "Whether the button is disabled or not.",
121
+ "description": "Whether the button is disabled or not. Ignored when `href` is set.",
110
122
  "value": { "type": "boolean", "default": "false" }
111
123
  },
112
124
  {
@@ -129,11 +141,6 @@
129
141
  "description": "Whether the button is expanded or not.\nOnly has an effect on the variant `ghost` to show an expanding icon.\nIf the property is not set, the icon will not be shown.\nIf it is set, the icon will either show an expanded or collapsed state.",
130
142
  "value": { "type": "\"true\" | \"false\" | undefined" }
131
143
  },
132
- {
133
- "name": "fluid",
134
- "description": "Alters the shape of the button to be full width of its parent container",
135
- "value": { "type": "boolean", "default": "false" }
136
- },
137
144
  {
138
145
  "name": "loading",
139
146
  "description": "Replaces the content with a spinner",
@@ -174,17 +181,27 @@
174
181
  },
175
182
  {
176
183
  "name": "type",
177
- "description": "The `type` of the underlying button element.",
184
+ "description": "The `type` of the underlying button element. Ignored when `href` is set.",
178
185
  "type": "\"button\" | \"submit\" | \"reset\""
179
186
  },
180
187
  {
181
188
  "name": "componentRole",
182
- "description": "The `role` of the underlying button element.",
189
+ "description": "The `role` of the underlying button element. Ignored when `href` is set.",
183
190
  "type": "string | undefined"
184
191
  },
192
+ {
193
+ "name": "href",
194
+ "description": "If set, renders the button as an <a> element instead of a <button> with the provided href.",
195
+ "type": "string"
196
+ },
197
+ {
198
+ "name": "target",
199
+ "description": "Tells the browser where to display the linked URL. Only used when `href` is set.",
200
+ "type": "\"_blank\" | \"_parent\" | \"_self\" | \"_top\""
201
+ },
185
202
  {
186
203
  "name": "disabled",
187
- "description": "Whether the button is disabled or not.",
204
+ "description": "Whether the button is disabled or not. Ignored when `href` is set.",
188
205
  "type": "boolean"
189
206
  },
190
207
  {
@@ -207,11 +224,6 @@
207
224
  "description": "Whether the button is expanded or not.\nOnly has an effect on the variant `ghost` to show an expanding icon.\nIf the property is not set, the icon will not be shown.\nIf it is set, the icon will either show an expanded or collapsed state.",
208
225
  "type": "\"true\" | \"false\" | undefined"
209
226
  },
210
- {
211
- "name": "fluid",
212
- "description": "Alters the shape of the button to be full width of its parent container",
213
- "type": "boolean"
214
- },
215
227
  {
216
228
  "name": "loading",
217
229
  "description": "Replaces the content with a spinner",
@@ -613,7 +625,7 @@
613
625
  },
614
626
  {
615
627
  "name": "leu-file-input",
616
- "description": "\n---\n\n\n### **Events:**\n - **input**\n- **change**",
628
+ "description": "\n---\n\n\n### **Events:**\n - **input**\n- **change**\n\n### **Methods:**\n ",
617
629
  "doc-url": "",
618
630
  "attributes": [
619
631
  {
@@ -733,11 +745,6 @@
733
745
  "description": "Adds a button to clear the input element",
734
746
  "value": { "type": "boolean", "default": "false" }
735
747
  },
736
- {
737
- "name": "value",
738
- "description": "The value of the input element.",
739
- "value": { "type": "string", "default": "\"\"" }
740
- },
741
748
  {
742
749
  "name": "error",
743
750
  "description": "A custom error that is completely independent of the validity state. Useful for displaying server side errors.",
@@ -815,6 +822,11 @@
815
822
  "name": "novalidate",
816
823
  "description": "Disables the browser's validation.",
817
824
  "value": { "type": "boolean", "default": "false" }
825
+ },
826
+ {
827
+ "name": "value",
828
+ "description": "The default value of the input element.",
829
+ "value": { "type": "string", "default": "\"\"" }
818
830
  }
819
831
  ],
820
832
  "events": [
@@ -846,11 +858,6 @@
846
858
  "description": "Adds a button to clear the input element",
847
859
  "type": "boolean"
848
860
  },
849
- {
850
- "name": "value",
851
- "description": "The value of the input element.",
852
- "type": "string"
853
- },
854
861
  {
855
862
  "name": "error",
856
863
  "description": "A custom error that is completely independent of the validity state. Useful for displaying server side errors.",
@@ -926,6 +933,16 @@
926
933
  "description": "Disables the browser's validation.",
927
934
  "type": "boolean"
928
935
  },
936
+ {
937
+ "name": "defaultValue",
938
+ "description": "The default value of the input element.",
939
+ "type": "string"
940
+ },
941
+ {
942
+ "name": "value",
943
+ "description": "The value of the input element.",
944
+ "type": "string"
945
+ },
929
946
  { "name": "_validity", "type": "ValidityState | null" },
930
947
  { "name": "valueAsNumber" }
931
948
  ],
@@ -1581,23 +1598,13 @@
1581
1598
  },
1582
1599
  {
1583
1600
  "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(): _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",
1601
+ "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
1602
  "doc-url": "",
1586
1603
  "attributes": [
1587
1604
  {
1588
1605
  "name": "value",
1589
- "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.",
1590
- "value": { "type": "array", "default": "[]" }
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" }
1606
+ "description": "The default value of the select. Corresponds to the `value` HTML attribute.",
1607
+ "value": { "type": "Array<string>", "default": "[]" }
1601
1608
  },
1602
1609
  {
1603
1610
  "name": "label",
@@ -1609,11 +1616,6 @@
1609
1616
  "description": "Show a clearable button to reset the value",
1610
1617
  "value": { "type": "boolean", "default": "false" }
1611
1618
  },
1612
- {
1613
- "name": "disabled",
1614
- "description": "If the select should be disabled",
1615
- "value": { "type": "boolean", "default": "false" }
1616
- },
1617
1619
  {
1618
1620
  "name": "filterable",
1619
1621
  "description": "Show an input field to filter the options inside the popup",
@@ -1624,9 +1626,11 @@
1624
1626
  "description": "Allow multiple selections",
1625
1627
  "value": { "type": "boolean", "default": "false" }
1626
1628
  },
1627
- { "name": "_optionFilter", "value": { "type": "string" } },
1628
- { "name": "_hasFilterResults", "value": { "type": "string" } },
1629
- { "name": "_displayValue", "value": { "type": "string" } }
1629
+ {
1630
+ "name": "required",
1631
+ "description": "Marks the input element as required",
1632
+ "value": { "type": "boolean", "default": "false" }
1633
+ }
1630
1634
  ],
1631
1635
  "slots": [
1632
1636
  {
@@ -1642,19 +1646,19 @@
1642
1646
  "js": {
1643
1647
  "properties": [
1644
1648
  {
1645
- "name": "open",
1646
- "description": "The expanded state of the popup",
1647
- "type": "boolean"
1649
+ "name": "label",
1650
+ "description": "The label of the select",
1651
+ "type": "string"
1648
1652
  },
1649
1653
  {
1650
- "name": "disabled",
1651
- "description": "If the select should be disabled",
1652
- "type": "boolean"
1654
+ "name": "defaultValue",
1655
+ "description": "The default value of the select. Corresponds to the `value` HTML attribute.",
1656
+ "type": "Array<string>"
1653
1657
  },
1654
1658
  {
1655
- "name": "multiple",
1656
- "description": "Allow multiple selections",
1657
- "type": "boolean"
1659
+ "name": "value",
1660
+ "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.",
1661
+ "type": "Array<string>"
1658
1662
  },
1659
1663
  {
1660
1664
  "name": "clearable",
@@ -1667,26 +1671,15 @@
1667
1671
  "type": "boolean"
1668
1672
  },
1669
1673
  {
1670
- "name": "value",
1671
- "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.",
1672
- "type": "array"
1673
- },
1674
- {
1675
- "name": "label",
1676
- "description": "The label of the select",
1677
- "type": "string"
1674
+ "name": "multiple",
1675
+ "description": "Allow multiple selections",
1676
+ "type": "boolean"
1678
1677
  },
1679
1678
  {
1680
- "name": "name",
1681
- "description": "Reflects to the name attribute of the hidden input field that would be used in a form",
1682
- "type": "string"
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" }
1679
+ "name": "required",
1680
+ "description": "Marks the input element as required",
1681
+ "type": "boolean"
1682
+ }
1690
1683
  ],
1691
1684
  "events": []
1692
1685
  }
@@ -1699,6 +1692,119 @@
1699
1692
  "events": [],
1700
1693
  "js": { "properties": [], "events": [] }
1701
1694
  },
1695
+ {
1696
+ "name": "leu-tab",
1697
+ "description": "Tab Button.\n---\n\n\n### **Events:**\n - **leu:tab-select**",
1698
+ "doc-url": "",
1699
+ "attributes": [
1700
+ {
1701
+ "name": "name",
1702
+ "description": "Name to link Button and Panel together",
1703
+ "value": { "type": "string", "default": "\"\"" }
1704
+ },
1705
+ {
1706
+ "name": "active",
1707
+ "description": "Is active",
1708
+ "value": { "type": "boolean", "default": "false" }
1709
+ }
1710
+ ],
1711
+ "events": [{ "name": "leu:tab-select", "type": "CustomEvent" }],
1712
+ "js": {
1713
+ "properties": [
1714
+ {
1715
+ "name": "name",
1716
+ "description": "Name to link Button and Panel together",
1717
+ "type": "string"
1718
+ },
1719
+ {
1720
+ "name": "active",
1721
+ "description": "Is active",
1722
+ "type": "boolean"
1723
+ }
1724
+ ],
1725
+ "events": [{ "name": "leu:tab-select", "type": "CustomEvent" }]
1726
+ }
1727
+ },
1728
+ {
1729
+ "name": "leu-tab-group",
1730
+ "description": "Tab Group\n---\n\n\n### **Methods:**\n \n\n### **Slots:**\n - **tabs** - Slot for the leu-tab elements\n- **panels** - Slot for the leu-tab-panel elements",
1731
+ "doc-url": "",
1732
+ "attributes": [
1733
+ {
1734
+ "name": "label",
1735
+ "description": "Label for the tab list, used for accessibility.\nContent will not be visible on the page, but should be provided for screen readers.",
1736
+ "value": { "type": "string", "default": "\"\"" }
1737
+ },
1738
+ {
1739
+ "name": "active",
1740
+ "description": "Name of the active/selected tab and panel. Has to match the name property of a leu-tab and leu-tab-panel.",
1741
+ "value": { "type": "string", "default": "\"\"" }
1742
+ }
1743
+ ],
1744
+ "slots": [
1745
+ { "name": "tabs", "description": "Slot for the leu-tab elements" },
1746
+ {
1747
+ "name": "panels",
1748
+ "description": "Slot for the leu-tab-panel elements"
1749
+ }
1750
+ ],
1751
+ "events": [],
1752
+ "js": {
1753
+ "properties": [
1754
+ {
1755
+ "name": "label",
1756
+ "description": "Label for the tab list, used for accessibility.\nContent will not be visible on the page, but should be provided for screen readers.",
1757
+ "type": "string"
1758
+ },
1759
+ {
1760
+ "name": "active",
1761
+ "description": "Name of the active/selected tab and panel. Has to match the name property of a leu-tab and leu-tab-panel.",
1762
+ "type": "string"
1763
+ }
1764
+ ],
1765
+ "events": []
1766
+ }
1767
+ },
1768
+ {
1769
+ "name": "leu-tab-panel",
1770
+ "description": "Tab Panel\n---\n\n\n### **Events:**\n - **leu:show-tab-panel** - Fired when a tab panel is shown",
1771
+ "doc-url": "",
1772
+ "attributes": [
1773
+ {
1774
+ "name": "name",
1775
+ "description": "Name of the tab. Apply the same name to the corresponding tab button to link them together.\nHas to be unique within the tab component.",
1776
+ "value": { "type": "string", "default": "\"\"" }
1777
+ },
1778
+ {
1779
+ "name": "active",
1780
+ "value": { "type": "boolean", "default": "false" }
1781
+ }
1782
+ ],
1783
+ "events": [
1784
+ {
1785
+ "name": "leu:show-tab-panel",
1786
+ "type": "CustomEvent",
1787
+ "description": "Fired when a tab panel is shown"
1788
+ }
1789
+ ],
1790
+ "js": {
1791
+ "properties": [
1792
+ {
1793
+ "name": "name",
1794
+ "description": "Name of the tab. Apply the same name to the corresponding tab button to link them together.\nHas to be unique within the tab component.",
1795
+ "type": "string"
1796
+ },
1797
+ { "name": "active", "type": "boolean" }
1798
+ ],
1799
+ "events": [
1800
+ {
1801
+ "name": "leu:show-tab-panel",
1802
+ "type": "CustomEvent",
1803
+ "description": "Fired when a tab panel is shown"
1804
+ }
1805
+ ]
1806
+ }
1807
+ },
1702
1808
  {
1703
1809
  "name": "leu-table",
1704
1810
  "description": "\n---\n",
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.26.0",
6
+ "version": "0.28.0",
7
7
  "type": "module",
8
8
  "main": "dist/index.js",
9
9
  "module": "dist/index.js",
@@ -66,7 +66,6 @@
66
66
  "@web/test-runner": "^0.20.2",
67
67
  "@web/test-runner-commands": "^0.9.0",
68
68
  "@web/test-runner-playwright": "^0.11.1",
69
- "@whitespace/storybook-addon-html": "^9.0.0",
70
69
  "arg": "^5.0.2",
71
70
  "custom-element-jet-brains-integration": "^1.7.0",
72
71
  "custom-element-vs-code-integration": "^1.5.0",
@@ -1,4 +1,5 @@
1
- import { html, nothing } from "lit"
1
+ import { nothing } from "lit"
2
+ import { html, literal } from "lit/static-html.js"
2
3
  import { classMap } from "lit/directives/class-map.js"
3
4
  import { ifDefined } from "lit/directives/if-defined.js"
4
5
  import { property, query } from "lit/decorators.js"
@@ -58,19 +59,28 @@ export class LeuButton extends FormAssociatedMixin(LeuElement) {
58
59
  variant: "primary" | "secondary" | "ghost" = "primary"
59
60
 
60
61
  /**
61
- * The `type` of the underlying button element.
62
+ * The `type` of the underlying button element. Ignored when `href` is set.
62
63
  */
63
64
  @property({ type: String, reflect: true })
64
65
  type: "button" | "submit" | "reset" = "button"
65
66
 
66
67
  /**
67
- * The `role` of the underlying button element.
68
+ * The `role` of the underlying button element. Ignored when `href` is set.
68
69
  */
69
70
  @property({ type: String, reflect: true })
70
71
  componentRole?: string
71
72
 
72
73
  /**
73
- * Whether the button is disabled or not.
74
+ * If set, renders the button as an <a> element instead of a <button> with the provided href.
75
+ */
76
+ @property({ type: String, reflect: true })
77
+ href: string
78
+
79
+ /** Tells the browser where to display the linked URL. Only used when `href` is set. */
80
+ @property() target: "_blank" | "_parent" | "_self" | "_top"
81
+
82
+ /**
83
+ * Whether the button is disabled or not. Ignored when `href` is set.
74
84
  * @type {boolean}
75
85
  */
76
86
  @property({ type: Boolean, reflect: true })
@@ -106,12 +116,6 @@ export class LeuButton extends FormAssociatedMixin(LeuElement) {
106
116
  @property({ type: String, reflect: true })
107
117
  expanded?: "true" | "false"
108
118
 
109
- /**
110
- * Alters the shape of the button to be full width of its parent container
111
- */
112
- @property({ type: Boolean, reflect: true })
113
- fluid: boolean = false
114
-
115
119
  /**
116
120
  * Replaces the content with a spinner
117
121
  */
@@ -119,7 +123,7 @@ export class LeuButton extends FormAssociatedMixin(LeuElement) {
119
123
  loading: boolean = false
120
124
 
121
125
  @query(".button")
122
- private button!: HTMLButtonElement
126
+ private button!: HTMLButtonElement | HTMLAnchorElement
123
127
 
124
128
  private renderExpandingIcon() {
125
129
  if (typeof this.expanded !== "undefined" && this.variant === "ghost") {
@@ -227,32 +231,40 @@ export class LeuButton extends FormAssociatedMixin(LeuElement) {
227
231
  const hasIconDefault = Boolean(this.querySelector("leu-icon"))
228
232
  const hasIconBefore = this.hasSlotController.test("before")
229
233
  const hasIconAfter = this.hasSlotController.test("after")
234
+ const isLink = Boolean(this.href)
230
235
  const aria = this.getAriaAttributes()
231
236
 
237
+ const tag = isLink ? literal`a` : literal`button`
238
+
232
239
  const cssClasses = {
233
240
  button: true,
234
- "icon-only": hasIconDefault && !hasTextContent,
235
- "icon-before": hasIconBefore,
236
- "icon-after": hasIconAfter,
237
- round: this.round,
238
- active: this.active,
239
- disabled: this.disabled,
240
- inverted: this.inverted,
241
- loading: this.loading,
242
- [this.variant]: true,
243
- [this.size]: true,
241
+ "button--icon-only": hasIconDefault && !hasTextContent,
242
+ "button--icon-before": hasIconBefore,
243
+ "button--icon-after": hasIconAfter,
244
+ "button--round": this.round,
245
+ "button--active": this.active,
246
+ "button--inverted": this.inverted,
247
+ "button--loading": this.loading,
248
+ "button--disabled": this.disabled,
249
+ [`button--${this.variant}`]: true,
250
+ [`button--${this.size}`]: true,
244
251
  }
252
+
253
+ /* The eslint rules don't recognize html import from lit/static-html.js */
254
+ /* eslint-disable lit/binding-positions, lit/no-invalid-html */
245
255
  return html`
246
- <button
247
- @click=${this.handleClick}
256
+ <${tag}
257
+ @click=${!isLink ? this.handleClick : undefined}
248
258
  aria-label=${ifDefined(aria.label)}
249
259
  aria-selected=${ifDefined(aria.selected)}
250
260
  aria-checked=${ifDefined(aria.checked)}
251
261
  aria-expanded=${ifDefined(this.expanded)}
252
- role=${ifDefined(aria.role)}
262
+ role=${ifDefined(isLink ? undefined : aria.role)}
263
+ href=${ifDefined(this.href)}
264
+ target=${ifDefined(isLink ? this.target : undefined)}
253
265
  class=${classMap(cssClasses)}
254
- ?disabled=${this.disabled || this.loading}
255
- type=${this.type}
266
+ ?disabled=${(this.disabled && !isLink) || this.loading}
267
+ type=${ifDefined(isLink ? undefined : this.type)}
256
268
  >
257
269
  <div class="icon-wrapper icon-wrapper--before">
258
270
  <slot name="before" class="icon-wrapper__slot"></slot>
@@ -261,11 +273,14 @@ export class LeuButton extends FormAssociatedMixin(LeuElement) {
261
273
  <div class="icon-wrapper icon-wrapper--after">
262
274
  <slot name="after" class="icon-wrapper__slot"></slot>
263
275
  </div>
264
- ${this.loading
265
- ? html`<leu-spinner class="spinner"></leu-spinner>`
266
- : nothing}
276
+ ${
277
+ this.loading
278
+ ? html`<leu-spinner class="spinner"></leu-spinner>`
279
+ : nothing
280
+ }
267
281
  ${this.renderExpandingIcon()}
268
- </button>
282
+ </${tag}>
269
283
  `
284
+ /* eslint-enable lit/binding-positions, lit/no-invalid-html */
270
285
  }
271
286
  }