@statistikzh/leu 0.27.0 → 0.28.1
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/.github/workflows/publish.yml +1 -3
- package/.release-please-manifest.json +1 -1
- package/.storybook/main.ts +1 -1
- package/.storybook/preview.ts +6 -4
- package/.storybook/static/global.css +5 -0
- package/AGENTS.md +162 -0
- package/CHANGELOG.md +30 -0
- package/dist/{Accordion-DLsqXcK8.js → Accordion-CwkI7sfx.js} +1 -1
- package/dist/Accordion.d.ts +1 -1
- package/dist/Accordion.js +2 -2
- package/dist/{Button-BSyDL_cV.js → Button-D1aYnunQ.js} +90 -82
- package/dist/{Button-BgNUxmo_.d.ts → Button-DcuvEVkC.d.ts} +14 -12
- package/dist/Button.d.ts +1 -1
- package/dist/Button.js +4 -4
- package/dist/{ButtonGroup-BmSvl-Oc.js → ButtonGroup-CqThYjzX.js} +2 -2
- package/dist/ButtonGroup.d.ts +1 -1
- package/dist/ButtonGroup.js +5 -5
- package/dist/{ChartWrapper-CvDvQsd5.js → ChartWrapper-BjVT4x-H.js} +2 -2
- package/dist/ChartWrapper.d.ts +3 -3
- package/dist/ChartWrapper.js +3 -3
- package/dist/{Checkbox-Cl_X6gBJ.js → Checkbox-HxYqp2w4.js} +2 -2
- package/dist/Checkbox.d.ts +3 -3
- package/dist/Checkbox.js +3 -3
- package/dist/{CheckboxGroup-BKhOmZYX.js → CheckboxGroup-DYws2rwt.js} +2 -2
- package/dist/CheckboxGroup.d.ts +1 -1
- package/dist/CheckboxGroup.js +4 -4
- package/dist/{Chip-DLKM9P7v.d.ts → Chip-DVGjEPJE.d.ts} +1 -1
- package/dist/{Chip-McVP3N_x.js → Chip-gKxD6IaZ.js} +1 -1
- package/dist/Chip.d.ts +1 -1
- package/dist/Chip.js +2 -2
- package/dist/{ChipGroup-Ta8Ht4jc.d.ts → ChipGroup-BK5BYM0X.d.ts} +2 -2
- package/dist/{ChipGroup-DUGavZeU.js → ChipGroup-ZvBzX_wd.js} +1 -1
- package/dist/ChipGroup.d.ts +1 -1
- package/dist/ChipGroup.js +3 -3
- package/dist/{ChipLink-BAxyQO2M.d.ts → ChipLink-BdG2o-nk.d.ts} +1 -1
- package/dist/ChipLink.d.ts +1 -1
- package/dist/ChipLink.js +2 -2
- package/dist/{ChipRemovable-DBjwt0CH.d.ts → ChipRemovable-CCwSQTAL.d.ts} +2 -2
- package/dist/ChipRemovable.d.ts +1 -1
- package/dist/ChipRemovable.js +3 -3
- package/dist/{ChipSelectable-CMJNcE4U.d.ts → ChipSelectable-BQ3VLVi5.d.ts} +1 -1
- package/dist/ChipSelectable.d.ts +1 -1
- package/dist/ChipSelectable.js +2 -2
- package/dist/{Dialog-BlDd4T2u.js → Dialog-BYpzTprV.js} +2 -2
- package/dist/Dialog.d.ts +3 -3
- package/dist/Dialog.js +3 -3
- package/dist/{Dropdown-BLxSIe6p.js → Dropdown-C4CgE4E-.js} +5 -5
- package/dist/Dropdown.d.ts +6 -6
- package/dist/Dropdown.js +8 -8
- package/dist/{FileInput-DntYrpZ-.js → FileInput-nsnSQCaU.js} +8 -6
- package/dist/FileInput.d.ts +6 -6
- package/dist/FileInput.js +6 -6
- package/dist/{Icon-Op80LrrO.d.ts → Icon-CUfh3eb3.d.ts} +1 -1
- package/dist/{Icon-CbZXpyHU.js → Icon-D8HTPEFH.js} +1 -1
- package/dist/Icon.d.ts +1 -1
- package/dist/Icon.js +2 -2
- package/dist/{Input-DBXX7ev8.js → Input-OrILqlax.js} +2 -2
- package/dist/{Input-CeaAOB4p.d.ts → Input-fEiQvGDF.d.ts} +3 -3
- package/dist/Input.d.ts +1 -1
- package/dist/Input.js +3 -3
- package/dist/{LeuElement-k4RjIeoG.js → LeuElement-C_lcHzQI.js} +1 -1
- package/dist/{Menu-Cu8eIF1T.js → Menu-CFLCnI34.js} +2 -2
- package/dist/{Menu-CQdx1ef3.d.ts → Menu-Z2b7dsB5.d.ts} +2 -2
- package/dist/Menu.d.ts +1 -1
- package/dist/Menu.js +4 -4
- package/dist/{MenuItem-Cs3KFhJm.js → MenuItem-ICjLCGim.js} +2 -2
- package/dist/{MenuItem-QcgnRk_7.d.ts → MenuItem-LY4TRIho.d.ts} +2 -2
- package/dist/MenuItem.d.ts +1 -1
- package/dist/MenuItem.js +3 -3
- package/dist/{Message-C6Zlk_2p.js → Message-Dw5D_0i1.js} +2 -2
- package/dist/Message.d.ts +2 -2
- package/dist/Message.js +3 -3
- package/dist/{Pagination-CqkHh-Vd.d.ts → Pagination-9eZ8WMvR.d.ts} +4 -4
- package/dist/{Pagination-CB2eVlXk.js → Pagination-D1tP5FrM.js} +4 -4
- package/dist/Pagination.d.ts +1 -1
- package/dist/Pagination.js +6 -6
- package/dist/{Placeholder-DHMexMhK.js → Placeholder-CnGzCZ5-.js} +1 -1
- package/dist/Placeholder.d.ts +1 -1
- package/dist/Placeholder.js +2 -2
- package/dist/{Popup-Btgm2a3D.d.ts → Popup-B5iDSLIO.d.ts} +1 -1
- package/dist/{Popup-8jhVy8gB.js → Popup-BiN_tZDN.js} +1 -1
- package/dist/Popup.d.ts +1 -1
- package/dist/Popup.js +2 -2
- package/dist/{ProgressBar-CG0_lHfS.js → ProgressBar-BfJo_KyU.js} +1 -1
- package/dist/ProgressBar.d.ts +1 -1
- package/dist/ProgressBar.js +2 -2
- package/dist/{Radio-DG3xqP3s.js → Radio-CV7vuQUj.js} +1 -1
- package/dist/Radio.d.ts +1 -1
- package/dist/Radio.js +2 -2
- package/dist/{RadioGroup-BKCp9ICX.js → RadioGroup-C3XWSScc.js} +2 -2
- package/dist/RadioGroup.d.ts +1 -1
- package/dist/RadioGroup.js +3 -3
- package/dist/{Range-7LrESv4K.js → Range-C8RVrIM9.js} +1 -1
- package/dist/Range.d.ts +1 -1
- package/dist/Range.js +2 -2
- package/dist/{ScrollTop-CJJsfniA.js → ScrollTop-B_TJ_k4m.js} +3 -3
- package/dist/ScrollTop.d.ts +3 -3
- package/dist/ScrollTop.js +5 -5
- package/dist/{Select-CxEDXIBn.js → Select-CbPTrL3G.js} +7 -8
- package/dist/Select.d.ts +9 -9
- package/dist/Select.js +9 -9
- package/dist/{Spinner-VhKfzI3Q.js → Spinner-ChKJQJTN.js} +1 -1
- package/dist/{Spinner-CrM1enM0.d.ts → Spinner-DHYaX6-Y.d.ts} +1 -1
- package/dist/Spinner.d.ts +1 -1
- package/dist/Spinner.js +2 -2
- package/dist/Tab-BJbzY1xd.js +117 -0
- package/dist/Tab-CN97q0nj.d.ts +30 -0
- package/dist/Tab.d.ts +2 -0
- package/dist/Tab.js +3 -0
- package/dist/TabGroup-BIaCHrKR.js +248 -0
- package/dist/TabGroup.d.ts +64 -0
- package/dist/TabGroup.js +5 -0
- package/dist/TabPanel-CTyw410b.js +65 -0
- package/dist/TabPanel-DQgWP7LO.d.ts +26 -0
- package/dist/TabPanel.d.ts +2 -0
- package/dist/TabPanel.js +3 -0
- package/dist/{Table-rg_JCtsA.js → Table-D3QmePJd.js} +3 -3
- package/dist/Table.d.ts +3 -3
- package/dist/Table.js +7 -7
- package/dist/{Tag-BROUaDAZ.js → Tag-nUnWtHYy.js} +1 -1
- package/dist/Tag.d.ts +1 -1
- package/dist/Tag.js +2 -2
- package/dist/{VisuallyHidden-OeQvhxYn.d.ts → VisuallyHidden-CB7aRJzF.d.ts} +1 -1
- package/dist/{VisuallyHidden-Co_txzxB.js → VisuallyHidden-DF2q9pTa.js} +1 -1
- package/dist/VisuallyHidden.d.ts +1 -1
- package/dist/VisuallyHidden.js +2 -2
- package/dist/index.d.ts +14 -14
- package/dist/index.js +30 -30
- package/dist/leu-accordion.js +2 -2
- package/dist/leu-button-group.js +5 -5
- package/dist/leu-button.d.ts +1 -1
- package/dist/leu-button.js +4 -4
- package/dist/leu-chart-wrapper.js +3 -3
- package/dist/leu-checkbox-group.js +4 -4
- package/dist/leu-checkbox.js +3 -3
- package/dist/leu-chip-group.d.ts +1 -1
- package/dist/leu-chip-group.js +3 -3
- package/dist/leu-chip-link.d.ts +1 -1
- package/dist/leu-chip-link.js +2 -2
- package/dist/leu-chip-removable.d.ts +1 -1
- package/dist/leu-chip-removable.js +3 -3
- package/dist/leu-chip-selectable.d.ts +1 -1
- package/dist/leu-chip-selectable.js +2 -2
- package/dist/leu-dialog.js +3 -3
- package/dist/leu-dropdown.js +8 -8
- package/dist/leu-file-input.js +6 -6
- package/dist/leu-icon.d.ts +1 -1
- package/dist/leu-icon.js +2 -2
- package/dist/leu-input.d.ts +1 -1
- package/dist/leu-input.js +3 -3
- package/dist/leu-menu-item.d.ts +1 -1
- package/dist/leu-menu-item.js +3 -3
- package/dist/leu-menu.d.ts +1 -1
- package/dist/leu-menu.js +4 -4
- package/dist/leu-message.js +3 -3
- package/dist/leu-pagination.d.ts +1 -1
- package/dist/leu-pagination.js +6 -6
- package/dist/leu-placeholder.js +2 -2
- package/dist/leu-popup.d.ts +1 -1
- package/dist/leu-popup.js +2 -2
- package/dist/leu-progress-bar.js +2 -2
- package/dist/leu-radio-group.js +3 -3
- package/dist/leu-radio.js +2 -2
- package/dist/leu-range.js +2 -2
- package/dist/leu-scroll-top.js +5 -5
- package/dist/leu-select.js +9 -9
- package/dist/leu-spinner.d.ts +1 -1
- package/dist/leu-spinner.js +2 -2
- package/dist/leu-tab-group.d.ts +10 -0
- package/dist/leu-tab-group.js +8 -0
- package/dist/leu-tab-panel.d.ts +10 -0
- package/dist/leu-tab-panel.js +6 -0
- package/dist/leu-tab.d.ts +10 -0
- package/dist/leu-tab.js +6 -0
- package/dist/leu-table.js +7 -7
- package/dist/leu-tag.js +2 -2
- package/dist/leu-visually-hidden.d.ts +1 -1
- package/dist/leu-visually-hidden.js +2 -2
- package/dist/vscode.html-custom-data.json +87 -19
- package/dist/vue/index.d.ts +93 -25
- package/dist/web-types.json +169 -44
- package/package.json +6 -5
- package/src/components/button/Button.ts +45 -30
- package/src/components/button/button.css +55 -54
- package/src/components/button/stories/button.stories.ts +17 -20
- package/src/components/button/test/button.test.ts +46 -0
- package/src/components/file-input/FileInput.ts +4 -2
- package/src/components/file-input/test/file-input.test.ts +24 -0
- package/src/components/select/Select.ts +0 -1
- package/src/components/tab/Tab.ts +72 -0
- package/src/components/tab/TabGroup.ts +267 -0
- package/src/components/tab/TabPanel.ts +59 -0
- package/src/components/tab/leu-tab-group.ts +11 -0
- package/src/components/tab/leu-tab-panel.ts +11 -0
- package/src/components/tab/leu-tab.ts +11 -0
- package/src/components/tab/stories/tab.stories.ts +97 -0
- package/src/components/tab/tab-group.css +63 -0
- package/src/components/tab/tab-panel.css +10 -0
- package/src/components/tab/tab.css +54 -0
- package/src/components/tab/test/tab-group.test.ts +426 -0
- package/src/components/tab/test/tab-panel.test.ts +102 -0
- package/src/components/tab/test/tab.test.ts +139 -0
- package/tsconfig.json +1 -0
- /package/dist/{FormAssociatedMixin-Cc74LjbC.d.ts → FormAssociatedMixin-Cw7LsSUE.d.ts} +0 -0
- /package/dist/{LeuElement-pJFU18Xm.d.ts → LeuElement-DK1jntuu.d.ts} +0 -0
- /package/dist/{hasSlotController-DWPyZ52b.d.ts → hasSlotController-BjKyhJm-.d.ts} +0 -0
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.28.1",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -65,6 +65,33 @@
|
|
|
65
65
|
"events": []
|
|
66
66
|
}
|
|
67
67
|
},
|
|
68
|
+
{
|
|
69
|
+
"name": "leu-button-group",
|
|
70
|
+
"description": "A radio input-like button group component.\nIt allows only one button to be active at a time.\n---\n\n\n### **Events:**\n - **input** - When the value of the group changes by clicking a button\n\n### **Slots:**\n - _default_ - Slot for the buttons",
|
|
71
|
+
"doc-url": "",
|
|
72
|
+
"attributes": [],
|
|
73
|
+
"slots": [{ "name": "", "description": "Slot for the buttons" }],
|
|
74
|
+
"events": [
|
|
75
|
+
{
|
|
76
|
+
"name": "input",
|
|
77
|
+
"description": "When the value of the group changes by clicking a button"
|
|
78
|
+
}
|
|
79
|
+
],
|
|
80
|
+
"js": {
|
|
81
|
+
"properties": [
|
|
82
|
+
{
|
|
83
|
+
"name": "value",
|
|
84
|
+
"description": "The value of the currently selected (active) button"
|
|
85
|
+
}
|
|
86
|
+
],
|
|
87
|
+
"events": [
|
|
88
|
+
{
|
|
89
|
+
"name": "input",
|
|
90
|
+
"description": "When the value of the group changes by clicking a button"
|
|
91
|
+
}
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
},
|
|
68
95
|
{
|
|
69
96
|
"name": "leu-button",
|
|
70
97
|
"description": "\n---\n\n\n### **Slots:**\n - **before** - The icon to display before the label\n- **after** - The icon to display after the label\n- _default_ - The label of the button or the icon if no label is set",
|
|
@@ -93,7 +120,7 @@
|
|
|
93
120
|
},
|
|
94
121
|
{
|
|
95
122
|
"name": "type",
|
|
96
|
-
"description": "The `type` of the underlying button element.",
|
|
123
|
+
"description": "The `type` of the underlying button element. Ignored when `href` is set.",
|
|
97
124
|
"value": {
|
|
98
125
|
"type": "\"button\" | \"submit\" | \"reset\"",
|
|
99
126
|
"default": "\"button\""
|
|
@@ -101,12 +128,24 @@
|
|
|
101
128
|
},
|
|
102
129
|
{
|
|
103
130
|
"name": "componentRole",
|
|
104
|
-
"description": "The `role` of the underlying button element.",
|
|
131
|
+
"description": "The `role` of the underlying button element. Ignored when `href` is set.",
|
|
105
132
|
"value": { "type": "string | undefined" }
|
|
106
133
|
},
|
|
134
|
+
{
|
|
135
|
+
"name": "href",
|
|
136
|
+
"description": "If set, renders the button as an <a> element instead of a <button> with the provided href.",
|
|
137
|
+
"value": { "type": "string" }
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"name": "target",
|
|
141
|
+
"description": "Tells the browser where to display the linked URL. Only used when `href` is set.",
|
|
142
|
+
"value": {
|
|
143
|
+
"type": "\"_blank\" | \"_parent\" | \"_self\" | \"_top\""
|
|
144
|
+
}
|
|
145
|
+
},
|
|
107
146
|
{
|
|
108
147
|
"name": "disabled",
|
|
109
|
-
"description": "Whether the button is disabled or not.",
|
|
148
|
+
"description": "Whether the button is disabled or not. Ignored when `href` is set.",
|
|
110
149
|
"value": { "type": "boolean", "default": "false" }
|
|
111
150
|
},
|
|
112
151
|
{
|
|
@@ -129,11 +168,6 @@
|
|
|
129
168
|
"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
169
|
"value": { "type": "\"true\" | \"false\" | undefined" }
|
|
131
170
|
},
|
|
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
171
|
{
|
|
138
172
|
"name": "loading",
|
|
139
173
|
"description": "Replaces the content with a spinner",
|
|
@@ -174,17 +208,27 @@
|
|
|
174
208
|
},
|
|
175
209
|
{
|
|
176
210
|
"name": "type",
|
|
177
|
-
"description": "The `type` of the underlying button element.",
|
|
211
|
+
"description": "The `type` of the underlying button element. Ignored when `href` is set.",
|
|
178
212
|
"type": "\"button\" | \"submit\" | \"reset\""
|
|
179
213
|
},
|
|
180
214
|
{
|
|
181
215
|
"name": "componentRole",
|
|
182
|
-
"description": "The `role` of the underlying button element.",
|
|
216
|
+
"description": "The `role` of the underlying button element. Ignored when `href` is set.",
|
|
183
217
|
"type": "string | undefined"
|
|
184
218
|
},
|
|
219
|
+
{
|
|
220
|
+
"name": "href",
|
|
221
|
+
"description": "If set, renders the button as an <a> element instead of a <button> with the provided href.",
|
|
222
|
+
"type": "string"
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
"name": "target",
|
|
226
|
+
"description": "Tells the browser where to display the linked URL. Only used when `href` is set.",
|
|
227
|
+
"type": "\"_blank\" | \"_parent\" | \"_self\" | \"_top\""
|
|
228
|
+
},
|
|
185
229
|
{
|
|
186
230
|
"name": "disabled",
|
|
187
|
-
"description": "Whether the button is disabled or not.",
|
|
231
|
+
"description": "Whether the button is disabled or not. Ignored when `href` is set.",
|
|
188
232
|
"type": "boolean"
|
|
189
233
|
},
|
|
190
234
|
{
|
|
@@ -207,11 +251,6 @@
|
|
|
207
251
|
"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
252
|
"type": "\"true\" | \"false\" | undefined"
|
|
209
253
|
},
|
|
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
254
|
{
|
|
216
255
|
"name": "loading",
|
|
217
256
|
"description": "Replaces the content with a spinner",
|
|
@@ -221,33 +260,6 @@
|
|
|
221
260
|
"events": []
|
|
222
261
|
}
|
|
223
262
|
},
|
|
224
|
-
{
|
|
225
|
-
"name": "leu-button-group",
|
|
226
|
-
"description": "A radio input-like button group component.\nIt allows only one button to be active at a time.\n---\n\n\n### **Events:**\n - **input** - When the value of the group changes by clicking a button\n\n### **Slots:**\n - _default_ - Slot for the buttons",
|
|
227
|
-
"doc-url": "",
|
|
228
|
-
"attributes": [],
|
|
229
|
-
"slots": [{ "name": "", "description": "Slot for the buttons" }],
|
|
230
|
-
"events": [
|
|
231
|
-
{
|
|
232
|
-
"name": "input",
|
|
233
|
-
"description": "When the value of the group changes by clicking a button"
|
|
234
|
-
}
|
|
235
|
-
],
|
|
236
|
-
"js": {
|
|
237
|
-
"properties": [
|
|
238
|
-
{
|
|
239
|
-
"name": "value",
|
|
240
|
-
"description": "The value of the currently selected (active) button"
|
|
241
|
-
}
|
|
242
|
-
],
|
|
243
|
-
"events": [
|
|
244
|
-
{
|
|
245
|
-
"name": "input",
|
|
246
|
-
"description": "When the value of the group changes by clicking a button"
|
|
247
|
-
}
|
|
248
|
-
]
|
|
249
|
-
}
|
|
250
|
-
},
|
|
251
263
|
{
|
|
252
264
|
"name": "leu-chart-wrapper",
|
|
253
265
|
"description": "A wrapper element for charts.\n---\n\n\n### **Slots:**\n - **title** - The title of the chart. Use a heading tag (h2-4) depending on your context.\n- **description** - A description of the chart. Content is wrapped in a `<p>` tag by the component.\n- **chart** - The actual chart\n- **caption** - A caption for the chart, e.g. a source or explanation of the data.\n- **download** - A download button or dropdown to export the chart in different formats.",
|
|
@@ -1680,6 +1692,119 @@
|
|
|
1680
1692
|
"events": [],
|
|
1681
1693
|
"js": { "properties": [], "events": [] }
|
|
1682
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
|
+
},
|
|
1683
1808
|
{
|
|
1684
1809
|
"name": "leu-table",
|
|
1685
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.
|
|
6
|
+
"version": "0.28.1",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"module": "dist/index.js",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
},
|
|
20
20
|
"repository": {
|
|
21
21
|
"type": "git",
|
|
22
|
-
"url": "git+https://github.com/
|
|
22
|
+
"url": "git+https://github.com/statistikZH/leu.git"
|
|
23
23
|
},
|
|
24
|
-
"homepage": "https://github.com/
|
|
24
|
+
"homepage": "https://github.com/statistikZH/leu/",
|
|
25
25
|
"scripts": {
|
|
26
26
|
"analyze": "cem analyze --config custom-elements-manifest.config.js",
|
|
27
27
|
"build": "npm run build:js && npm run build:css && npm run analyze",
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"format": "npm run format:eslint && npm run format:prettier",
|
|
37
37
|
"format:eslint": "eslint . --fix",
|
|
38
38
|
"format:prettier": "prettier \"**/*.{ts,js,mjs,md,mdx,html,json}\" --write",
|
|
39
|
+
"generate-component": "./scripts/generate-component/generate.js",
|
|
39
40
|
"test": "web-test-runner --coverage",
|
|
40
41
|
"test:watch": "web-test-runner --watch",
|
|
41
42
|
"prepare": "husky",
|
|
@@ -66,7 +67,6 @@
|
|
|
66
67
|
"@web/test-runner": "^0.20.2",
|
|
67
68
|
"@web/test-runner-commands": "^0.9.0",
|
|
68
69
|
"@web/test-runner-playwright": "^0.11.1",
|
|
69
|
-
"@whitespace/storybook-addon-html": "^9.0.0",
|
|
70
70
|
"arg": "^5.0.2",
|
|
71
71
|
"custom-element-jet-brains-integration": "^1.7.0",
|
|
72
72
|
"custom-element-vs-code-integration": "^1.5.0",
|
|
@@ -113,6 +113,7 @@
|
|
|
113
113
|
"bundle": false
|
|
114
114
|
},
|
|
115
115
|
"publishConfig": {
|
|
116
|
-
"access": "public"
|
|
116
|
+
"access": "public",
|
|
117
|
+
"provenance": true
|
|
117
118
|
}
|
|
118
119
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
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
|
-
*
|
|
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
|
-
|
|
240
|
-
|
|
241
|
-
|
|
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
|
-
|
|
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
|
-
${
|
|
265
|
-
|
|
266
|
-
|
|
276
|
+
${
|
|
277
|
+
this.loading
|
|
278
|
+
? html`<leu-spinner class="spinner"></leu-spinner>`
|
|
279
|
+
: nothing
|
|
280
|
+
}
|
|
267
281
|
${this.renderExpandingIcon()}
|
|
268
|
-
|
|
282
|
+
</${tag}>
|
|
269
283
|
`
|
|
284
|
+
/* eslint-enable lit/binding-positions, lit/no-invalid-html */
|
|
270
285
|
}
|
|
271
286
|
}
|