@statistikzh/leu 0.27.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.
- 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/CHANGELOG.md +23 -0
- package/dist/{Accordion-DLsqXcK8.js → Accordion-D9kLsiBW.js} +1 -1
- package/dist/Accordion.d.ts +1 -1
- package/dist/Accordion.js +2 -2
- package/dist/{Button-BgNUxmo_.d.ts → Button-DcuvEVkC.d.ts} +14 -12
- package/dist/{Button-BSyDL_cV.js → Button-DyNVOHCd.js} +90 -82
- package/dist/Button.d.ts +1 -1
- package/dist/Button.js +4 -4
- package/dist/{ButtonGroup-BmSvl-Oc.js → ButtonGroup-MEh4vb5a.js} +2 -2
- package/dist/ButtonGroup.d.ts +1 -1
- package/dist/ButtonGroup.js +5 -5
- package/dist/{ChartWrapper-CvDvQsd5.js → ChartWrapper-DAl91BIN.js} +2 -2
- package/dist/ChartWrapper.d.ts +3 -3
- package/dist/ChartWrapper.js +3 -3
- package/dist/{Checkbox-Cl_X6gBJ.js → Checkbox-CGGyUW9U.js} +2 -2
- package/dist/Checkbox.d.ts +3 -3
- package/dist/Checkbox.js +3 -3
- package/dist/{CheckboxGroup-BKhOmZYX.js → CheckboxGroup-DXt5iMdj.js} +2 -2
- package/dist/CheckboxGroup.d.ts +1 -1
- package/dist/CheckboxGroup.js +4 -4
- package/dist/{Chip-McVP3N_x.js → Chip-BGs71WGH.js} +1 -1
- package/dist/{Chip-DLKM9P7v.d.ts → Chip-DVGjEPJE.d.ts} +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-BcGyusP-.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-BzuyL1U3.js} +2 -2
- package/dist/Dialog.d.ts +3 -3
- package/dist/Dialog.js +3 -3
- package/dist/{Dropdown-BLxSIe6p.js → Dropdown-plyBTM15.js} +5 -5
- package/dist/Dropdown.d.ts +6 -6
- package/dist/Dropdown.js +8 -8
- package/dist/{FileInput-DntYrpZ-.js → FileInput-BT3Fe-0J.js} +4 -4
- package/dist/FileInput.d.ts +5 -5
- package/dist/FileInput.js +6 -6
- package/dist/{Icon-Op80LrrO.d.ts → Icon-CUfh3eb3.d.ts} +1 -1
- package/dist/{Icon-CbZXpyHU.js → Icon-D83qesg5.js} +1 -1
- package/dist/Icon.d.ts +1 -1
- package/dist/Icon.js +2 -2
- package/dist/{Input-DBXX7ev8.js → Input-D7zS50oz.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-DQI8cqZV.js} +1 -1
- package/dist/{Menu-Cu8eIF1T.js → Menu-DRU1LiMM.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-DCttylRO.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-0NxnKEqw.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-CIy7YvWE.js} +4 -4
- package/dist/Pagination.d.ts +1 -1
- package/dist/Pagination.js +6 -6
- package/dist/{Placeholder-DHMexMhK.js → Placeholder-Dol_X5Hp.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-nJrJHGSy.js} +1 -1
- package/dist/Popup.d.ts +1 -1
- package/dist/Popup.js +2 -2
- package/dist/{ProgressBar-CG0_lHfS.js → ProgressBar-Dmq9veqU.js} +1 -1
- package/dist/ProgressBar.d.ts +1 -1
- package/dist/ProgressBar.js +2 -2
- package/dist/{Radio-DG3xqP3s.js → Radio-W5ck_IJI.js} +1 -1
- package/dist/Radio.d.ts +1 -1
- package/dist/Radio.js +2 -2
- package/dist/{RadioGroup-BKCp9ICX.js → RadioGroup-De5x2YCO.js} +2 -2
- package/dist/RadioGroup.d.ts +1 -1
- package/dist/RadioGroup.js +3 -3
- package/dist/{Range-7LrESv4K.js → Range-NCdfDkeD.js} +1 -1
- package/dist/Range.d.ts +1 -1
- package/dist/Range.js +2 -2
- package/dist/{ScrollTop-CJJsfniA.js → ScrollTop-DwcNIKmN.js} +3 -3
- package/dist/ScrollTop.d.ts +3 -3
- package/dist/ScrollTop.js +5 -5
- package/dist/{Select-CxEDXIBn.js → Select-Bpicra9q.js} +7 -8
- package/dist/Select.d.ts +9 -9
- package/dist/Select.js +9 -9
- package/dist/{Spinner-VhKfzI3Q.js → Spinner-BBiVZxFH.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-CN97q0nj.d.ts +30 -0
- package/dist/Tab-Ce9nrDok.js +117 -0
- package/dist/Tab.d.ts +2 -0
- package/dist/Tab.js +3 -0
- package/dist/TabGroup-C-cd4Wcx.js +248 -0
- package/dist/TabGroup.d.ts +64 -0
- package/dist/TabGroup.js +5 -0
- package/dist/TabPanel-BW1ydVBT.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-DiYqIzBu.js} +3 -3
- package/dist/Table.d.ts +3 -3
- package/dist/Table.js +7 -7
- package/dist/{Tag-BROUaDAZ.js → Tag-Ct8Hhv7W.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-CpYXyuC7.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 +76 -8
- package/dist/vue/index.d.ts +73 -5
- package/dist/web-types.json +142 -17
- package/package.json +1 -2
- 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/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.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",
|
|
@@ -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.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 {
|
|
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
|
}
|