@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
|
@@ -5,21 +5,22 @@
|
|
|
5
5
|
/*
|
|
6
6
|
* @todo : Disable hover styles for loading state
|
|
7
7
|
*/
|
|
8
|
-
button {
|
|
8
|
+
.button {
|
|
9
9
|
position: relative;
|
|
10
|
-
|
|
11
10
|
font-family: var(--leu-font-family-black);
|
|
12
11
|
text-align: center;
|
|
12
|
+
text-decoration: none;
|
|
13
13
|
appearance: none;
|
|
14
14
|
transition: background 0.1s ease;
|
|
15
15
|
cursor: pointer;
|
|
16
16
|
border: none;
|
|
17
17
|
border-radius: 2px;
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
display: inline-flex;
|
|
20
|
+
justify-content: center;
|
|
21
21
|
align-items: center;
|
|
22
22
|
column-gap: 8px;
|
|
23
|
+
width: 100%;
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
.content {
|
|
@@ -29,49 +30,49 @@ button {
|
|
|
29
30
|
white-space: nowrap;
|
|
30
31
|
}
|
|
31
32
|
|
|
32
|
-
button
|
|
33
|
+
.button--round {
|
|
33
34
|
border-radius: 50%;
|
|
34
35
|
}
|
|
35
36
|
|
|
36
|
-
button
|
|
37
|
+
.button--disabled {
|
|
37
38
|
cursor: not-allowed;
|
|
38
39
|
}
|
|
39
40
|
|
|
40
|
-
button
|
|
41
|
+
.button--loading {
|
|
41
42
|
cursor: wait;
|
|
42
43
|
}
|
|
43
44
|
|
|
44
|
-
button:focus-visible {
|
|
45
|
+
.button:focus-visible {
|
|
45
46
|
outline: 2px solid var(--leu-color-func-cyan);
|
|
46
47
|
outline-offset: 2px;
|
|
47
48
|
}
|
|
48
49
|
|
|
49
|
-
button
|
|
50
|
+
.button--inverted:focus-visible {
|
|
50
51
|
outline: 2px solid var(--leu-color-black-0);
|
|
51
52
|
}
|
|
52
53
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
.button--icon-only {
|
|
55
|
+
aspect-ratio: 1;
|
|
56
|
+
width: unset;
|
|
56
57
|
}
|
|
57
58
|
|
|
58
|
-
button
|
|
59
|
+
.button--loading :where(.content, .icon-wrapper) {
|
|
59
60
|
visibility: hidden;
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
/* size - regular */
|
|
63
|
-
button
|
|
64
|
+
.button--regular {
|
|
64
65
|
padding: 12px 24px;
|
|
65
66
|
font-size: 16px;
|
|
66
67
|
line-height: 24px;
|
|
67
68
|
}
|
|
68
69
|
|
|
69
|
-
button
|
|
70
|
+
.button--regular.button--icon-only {
|
|
70
71
|
padding: 12px;
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
/* size - small */
|
|
74
|
-
button
|
|
75
|
+
.button--small {
|
|
75
76
|
padding: 6px 24px;
|
|
76
77
|
font-size: 14px;
|
|
77
78
|
line-height: 20px;
|
|
@@ -79,62 +80,62 @@ button.small {
|
|
|
79
80
|
--leu-icon-size: 1rem;
|
|
80
81
|
}
|
|
81
82
|
|
|
82
|
-
button
|
|
83
|
+
.button--small.button--icon-only {
|
|
83
84
|
padding: 8px;
|
|
84
85
|
}
|
|
85
86
|
|
|
86
87
|
/* primary */
|
|
87
|
-
button
|
|
88
|
+
.button--primary {
|
|
88
89
|
color: var(--leu-color-black-0);
|
|
89
90
|
background: var(--leu-color-black-100);
|
|
90
91
|
}
|
|
91
92
|
|
|
92
|
-
button
|
|
93
|
+
.button--primary:hover {
|
|
93
94
|
color: var(--leu-color-black-0);
|
|
94
95
|
background: var(--leu-color-black-transp-80);
|
|
95
96
|
}
|
|
96
97
|
|
|
97
|
-
button
|
|
98
|
+
.button--primary.button--active {
|
|
98
99
|
color: var(--leu-color-black-0);
|
|
99
100
|
background: var(--leu-color-black-100);
|
|
100
101
|
}
|
|
101
102
|
|
|
102
|
-
button
|
|
103
|
+
.button--primary.button--active:hover {
|
|
103
104
|
background: var(--leu-color-black-transp-80);
|
|
104
105
|
}
|
|
105
106
|
|
|
106
|
-
button
|
|
107
|
+
.button--primary.button--disabled {
|
|
107
108
|
color: var(--leu-color-black-0);
|
|
108
109
|
background: var(--leu-color-black-transp-20);
|
|
109
110
|
}
|
|
110
111
|
|
|
111
112
|
/* secondary */
|
|
112
|
-
button
|
|
113
|
+
.button--secondary {
|
|
113
114
|
color: var(--leu-color-black-transp-60);
|
|
114
115
|
background: var(--leu-color-black-transp-10);
|
|
115
116
|
}
|
|
116
117
|
|
|
117
|
-
button
|
|
118
|
+
.button--secondary:hover {
|
|
118
119
|
color: var(--leu-color-black-100);
|
|
119
120
|
background: var(--leu-color-black-transp-20);
|
|
120
121
|
}
|
|
121
122
|
|
|
122
|
-
button
|
|
123
|
+
.button--secondary.button--active {
|
|
123
124
|
color: var(--leu-color-black-0);
|
|
124
125
|
background: var(--leu-color-black-100);
|
|
125
126
|
}
|
|
126
127
|
|
|
127
|
-
button
|
|
128
|
+
.button--secondary.button--active:hover {
|
|
128
129
|
background: var(--leu-color-black-transp-80);
|
|
129
130
|
}
|
|
130
131
|
|
|
131
|
-
button
|
|
132
|
+
.button--secondary.button--disabled {
|
|
132
133
|
color: var(--leu-color-black-transp-20);
|
|
133
134
|
background: var(--leu-color-black-transp-5);
|
|
134
135
|
}
|
|
135
136
|
|
|
136
137
|
/* ghost */
|
|
137
|
-
button
|
|
138
|
+
.button--ghost {
|
|
138
139
|
--leu-icon-size: 1rem;
|
|
139
140
|
|
|
140
141
|
background: transparent;
|
|
@@ -144,74 +145,74 @@ button.ghost {
|
|
|
144
145
|
height: 2rem;
|
|
145
146
|
}
|
|
146
147
|
|
|
147
|
-
button
|
|
148
|
+
.button--ghost:hover {
|
|
148
149
|
color: var(--leu-color-black-100);
|
|
149
150
|
}
|
|
150
151
|
|
|
151
|
-
button
|
|
152
|
+
.button--ghost.button--active {
|
|
152
153
|
color: var(--leu-color-black-100);
|
|
153
154
|
}
|
|
154
155
|
|
|
155
|
-
button
|
|
156
|
+
.button--ghost.button--disabled {
|
|
156
157
|
color: var(--leu-color-black-20);
|
|
157
158
|
}
|
|
158
159
|
|
|
159
160
|
/* primary + inverted */
|
|
160
|
-
button
|
|
161
|
+
.button--primary.button--inverted {
|
|
161
162
|
color: var(--leu-color-black-100);
|
|
162
163
|
background: var(--leu-color-black-0);
|
|
163
164
|
}
|
|
164
165
|
|
|
165
|
-
button
|
|
166
|
+
.button--primary.button--inverted:hover {
|
|
166
167
|
color: var(--leu-color-black-100);
|
|
167
168
|
background: var(--leu-color-white-transp-70);
|
|
168
169
|
}
|
|
169
170
|
|
|
170
|
-
button
|
|
171
|
+
.button--primary.button--inverted.button--active {
|
|
171
172
|
color: var(--leu-color-black-0);
|
|
172
173
|
background: var(--leu-color-black-100);
|
|
173
174
|
}
|
|
174
175
|
|
|
175
|
-
button
|
|
176
|
+
.button--primary.button--inverted.button--disabled {
|
|
176
177
|
color: var(--leu-color-black-40);
|
|
177
178
|
background: var(--leu-color-white-transp-70);
|
|
178
179
|
}
|
|
179
180
|
|
|
180
181
|
/* secondary + inverted */
|
|
181
|
-
button
|
|
182
|
+
.button--secondary.button--inverted {
|
|
182
183
|
color: var(--leu-color-black-0);
|
|
183
184
|
background: var(--leu-color-black-transp-20);
|
|
184
185
|
}
|
|
185
186
|
|
|
186
|
-
button
|
|
187
|
+
.button--secondary.button--inverted:hover {
|
|
187
188
|
color: var(--leu-color-black-0);
|
|
188
189
|
background: var(--leu-color-black-transp-40);
|
|
189
190
|
}
|
|
190
191
|
|
|
191
|
-
button
|
|
192
|
+
.button--secondary.button--inverted.button--active {
|
|
192
193
|
color: var(--leu-color-black-100);
|
|
193
194
|
background: var(--leu-color-black-0);
|
|
194
195
|
}
|
|
195
196
|
|
|
196
|
-
button
|
|
197
|
+
.button--secondary.button--inverted.button--disabled {
|
|
197
198
|
color: var(--leu-color-white-transp-70);
|
|
198
199
|
background: var(--leu-color-black-transp-10);
|
|
199
200
|
}
|
|
200
201
|
|
|
201
202
|
/* ghost + inverted */
|
|
202
|
-
button
|
|
203
|
+
.button--ghost.button--inverted {
|
|
203
204
|
color: var(--leu-color-black-0);
|
|
204
205
|
}
|
|
205
206
|
|
|
206
|
-
button
|
|
207
|
+
.button--ghost.button--inverted:hover {
|
|
207
208
|
color: var(--leu-color-white-transp-70);
|
|
208
209
|
}
|
|
209
210
|
|
|
210
|
-
button
|
|
211
|
+
.button--ghost.button--inverted.button--active {
|
|
211
212
|
color: var(--leu-color-black-0);
|
|
212
213
|
}
|
|
213
214
|
|
|
214
|
-
button
|
|
215
|
+
.button--ghost.button--inverted.button--disabled {
|
|
215
216
|
color: var(--leu-color-black-20);
|
|
216
217
|
}
|
|
217
218
|
|
|
@@ -224,12 +225,12 @@ button.ghost.inverted.disabled {
|
|
|
224
225
|
display: none;
|
|
225
226
|
}
|
|
226
227
|
|
|
227
|
-
.icon-before .icon-wrapper--before,
|
|
228
|
-
.icon-after .icon-wrapper--after {
|
|
228
|
+
.button--icon-before .icon-wrapper--before,
|
|
229
|
+
.button--icon-after .icon-wrapper--after {
|
|
229
230
|
display: block;
|
|
230
231
|
}
|
|
231
232
|
|
|
232
|
-
.ghost .icon-wrapper {
|
|
233
|
+
.button--ghost .icon-wrapper {
|
|
233
234
|
position: relative;
|
|
234
235
|
width: 2rem;
|
|
235
236
|
padding: 0 0.5rem;
|
|
@@ -237,14 +238,14 @@ button.ghost.inverted.disabled {
|
|
|
237
238
|
--_color: currentcolor;
|
|
238
239
|
}
|
|
239
240
|
|
|
240
|
-
.ghost .icon-wrapper__slot {
|
|
241
|
+
.button--ghost .icon-wrapper__slot {
|
|
241
242
|
display: block;
|
|
242
243
|
position: relative;
|
|
243
244
|
z-index: 1;
|
|
244
245
|
color: var(--_color);
|
|
245
246
|
}
|
|
246
247
|
|
|
247
|
-
.ghost .icon-wrapper::before {
|
|
248
|
+
.button--ghost .icon-wrapper::before {
|
|
248
249
|
content: "";
|
|
249
250
|
position: absolute;
|
|
250
251
|
z-index: 0;
|
|
@@ -257,32 +258,32 @@ button.ghost.inverted.disabled {
|
|
|
257
258
|
background: var(--_bg);
|
|
258
259
|
}
|
|
259
260
|
|
|
260
|
-
.ghost.active .icon-wrapper {
|
|
261
|
+
.button--ghost.button--active .icon-wrapper {
|
|
261
262
|
--_bg: var(--leu-color-black-100);
|
|
262
263
|
--_color: var(--leu-color-black-0);
|
|
263
264
|
}
|
|
264
265
|
|
|
265
|
-
.ghost.disabled .icon-wrapper {
|
|
266
|
+
.button--ghost.button--disabled .icon-wrapper {
|
|
266
267
|
--_bg: var(--leu-color-black-transp-5);
|
|
267
268
|
}
|
|
268
269
|
|
|
269
270
|
/* inverted */
|
|
270
271
|
|
|
271
|
-
.ghost.inverted .icon-wrapper {
|
|
272
|
+
.button--ghost.button--inverted .icon-wrapper {
|
|
272
273
|
--_bg: var(--leu-color-black-transp-20);
|
|
273
274
|
}
|
|
274
275
|
|
|
275
|
-
.ghost.inverted:hover .icon-wrapper {
|
|
276
|
+
.button--ghost.button--inverted:hover .icon-wrapper {
|
|
276
277
|
--_bg: var(--leu-color-black-transp-40);
|
|
277
278
|
--_color: var(--leu-color-black-0);
|
|
278
279
|
}
|
|
279
280
|
|
|
280
|
-
.ghost.inverted.disabled .icon-wrapper {
|
|
281
|
+
.button--ghost.button--inverted.button--disabled .icon-wrapper {
|
|
281
282
|
--_bg: var(--leu-color-black-transp-20);
|
|
282
283
|
--_color: var(--leu-color-white-transp-70);
|
|
283
284
|
}
|
|
284
285
|
|
|
285
|
-
.ghost.active.inverted .icon-wrapper {
|
|
286
|
+
.button--ghost.button--active.button--inverted .icon-wrapper {
|
|
286
287
|
--_bg: var(--leu-color-black-0);
|
|
287
288
|
--_color: var(--leu-color-black-100);
|
|
288
289
|
}
|
|
@@ -29,7 +29,7 @@ export default {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
function Template(args = {}) {
|
|
32
|
-
|
|
32
|
+
return html`
|
|
33
33
|
<div data-root>
|
|
34
34
|
<leu-button
|
|
35
35
|
content=${ifDefined(args.content)}
|
|
@@ -37,12 +37,14 @@ function Template(args = {}) {
|
|
|
37
37
|
variant=${ifDefined(args.variant)}
|
|
38
38
|
type=${ifDefined(args.type)}
|
|
39
39
|
expanded=${ifDefined(args.expanded)}
|
|
40
|
+
href=${ifDefined(args.href)}
|
|
41
|
+
target=${ifDefined(args.target)}
|
|
40
42
|
?round=${args.round}
|
|
41
43
|
?active=${args.active}
|
|
42
44
|
?inverted=${args.inverted}
|
|
43
45
|
?disabled=${args.disabled}
|
|
44
46
|
?loading=${args.loading}
|
|
45
|
-
@click=${copyContent}
|
|
47
|
+
@click=${args.href ? undefined : copyContent}
|
|
46
48
|
>
|
|
47
49
|
${args.icon
|
|
48
50
|
? html`<leu-icon
|
|
@@ -53,23 +55,6 @@ function Template(args = {}) {
|
|
|
53
55
|
${args.content}
|
|
54
56
|
</leu-button>
|
|
55
57
|
</div>
|
|
56
|
-
<br />
|
|
57
|
-
<p>Click the button to copy the code to the clipboard</p>
|
|
58
|
-
`
|
|
59
|
-
|
|
60
|
-
return html`
|
|
61
|
-
<style>
|
|
62
|
-
* {
|
|
63
|
-
font-family: Helvetica;
|
|
64
|
-
}
|
|
65
|
-
</style>
|
|
66
|
-
<div
|
|
67
|
-
style="${args.inverted
|
|
68
|
-
? "background:var(--leu-color-accent-blue); color: var(--leu-color-white-transp-90);"
|
|
69
|
-
: ""}padding:40px;"
|
|
70
|
-
>
|
|
71
|
-
${component}
|
|
72
|
-
</div>
|
|
73
58
|
`
|
|
74
59
|
}
|
|
75
60
|
|
|
@@ -89,6 +74,7 @@ Regular.argTypes = {
|
|
|
89
74
|
round: { control: "boolean" },
|
|
90
75
|
active: { control: "boolean" },
|
|
91
76
|
loading: { control: "boolean" },
|
|
77
|
+
href: { control: "text" },
|
|
92
78
|
}
|
|
93
79
|
Regular.args = {
|
|
94
80
|
content: "Click Mich...",
|
|
@@ -104,6 +90,17 @@ Regular.args = {
|
|
|
104
90
|
type: null,
|
|
105
91
|
}
|
|
106
92
|
|
|
93
|
+
export const Link = Template.bind({})
|
|
94
|
+
Link.args = {
|
|
95
|
+
content: "Zu den Daten",
|
|
96
|
+
icon: "link",
|
|
97
|
+
iconPosition: "before",
|
|
98
|
+
href: "https://datenkatalog.statistik.zh.ch/",
|
|
99
|
+
target: "_blank",
|
|
100
|
+
variant: "ghost",
|
|
101
|
+
size: "regular",
|
|
102
|
+
}
|
|
103
|
+
|
|
107
104
|
const items = [
|
|
108
105
|
{ content: "Normal" },
|
|
109
106
|
{ content: "Active", active: true },
|
|
@@ -301,6 +298,7 @@ function TemplateOverview() {
|
|
|
301
298
|
.table {
|
|
302
299
|
display: grid;
|
|
303
300
|
align-items: center;
|
|
301
|
+
justify-items: start;
|
|
304
302
|
grid-template-columns: auto auto auto;
|
|
305
303
|
gap: 10px;
|
|
306
304
|
padding: 10px;
|
|
@@ -327,7 +325,6 @@ function TemplateOverview() {
|
|
|
327
325
|
size=${ifDefined(size.size)}
|
|
328
326
|
variant=${ifDefined(group.variant)}
|
|
329
327
|
expanded=${ifDefined(item.expanded)}
|
|
330
|
-
?round=${item.round}
|
|
331
328
|
?active=${item.active}
|
|
332
329
|
?disabled=${item.disabled}
|
|
333
330
|
?inverted=${group.inverted}
|
|
@@ -32,6 +32,16 @@ describe("LeuButton", () => {
|
|
|
32
32
|
await expect(el).shadowDom.to.be.accessible()
|
|
33
33
|
})
|
|
34
34
|
|
|
35
|
+
it("passes the a11y audit when rendered as link", async () => {
|
|
36
|
+
const el = await fixture(
|
|
37
|
+
html` <leu-button href="https://datenkatalog.statistik.zh.ch/"
|
|
38
|
+
>Link</leu-button
|
|
39
|
+
>`,
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
await expect(el).shadowDom.to.be.accessible()
|
|
43
|
+
})
|
|
44
|
+
|
|
35
45
|
it("renders the label", async () => {
|
|
36
46
|
const el = await fixture(html` <leu-button>Sichern</leu-button>`)
|
|
37
47
|
|
|
@@ -192,6 +202,42 @@ describe("LeuButton", () => {
|
|
|
192
202
|
expect(clicked).to.be.false
|
|
193
203
|
})
|
|
194
204
|
|
|
205
|
+
it("renders as an anchor when href is set", async () => {
|
|
206
|
+
const el = await fixture(
|
|
207
|
+
html` <leu-button
|
|
208
|
+
href="https://datenkatalog.statistik.zh.ch/"
|
|
209
|
+
target="_blank"
|
|
210
|
+
>Zu den Daten <leu-icon name="link" slot="before"></leu-icon
|
|
211
|
+
></leu-button>`,
|
|
212
|
+
)
|
|
213
|
+
|
|
214
|
+
const anchor = el.shadowRoot.querySelector("a")
|
|
215
|
+
|
|
216
|
+
expect(anchor).to.exist
|
|
217
|
+
expect(anchor).to.have.attribute(
|
|
218
|
+
"href",
|
|
219
|
+
"https://datenkatalog.statistik.zh.ch/",
|
|
220
|
+
)
|
|
221
|
+
expect(anchor).to.have.attribute("target", "_blank")
|
|
222
|
+
})
|
|
223
|
+
|
|
224
|
+
it("does not set disabled or type attribute on anchor", async () => {
|
|
225
|
+
const el = await fixture(
|
|
226
|
+
html` <leu-button
|
|
227
|
+
href="https://datenkatalog.statistik.zh.ch/"
|
|
228
|
+
disabled
|
|
229
|
+
type="submit"
|
|
230
|
+
>Zu den Daten <leu-icon name="link" slot="before"></leu-icon
|
|
231
|
+
></leu-button>`,
|
|
232
|
+
)
|
|
233
|
+
|
|
234
|
+
const anchor = el.shadowRoot.querySelector("a")
|
|
235
|
+
|
|
236
|
+
expect(anchor).to.exist
|
|
237
|
+
expect(anchor).to.not.have.attribute("disabled")
|
|
238
|
+
expect(anchor).to.not.have.attribute("type")
|
|
239
|
+
})
|
|
240
|
+
|
|
195
241
|
describe("form association", () => {
|
|
196
242
|
it("submits the form when type is submit", async () => {
|
|
197
243
|
const form = await fixture<HTMLFormElement>(html`
|
|
@@ -92,7 +92,8 @@ export class LeuFileInput extends FormAssociatedMixin(LeuElement) {
|
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
private handleChange(event: Event & { target: HTMLInputElement }) {
|
|
95
|
+
private async handleChange(event: Event & { target: HTMLInputElement }) {
|
|
96
|
+
await this.updateComplete
|
|
96
97
|
const customEvent = new CustomEvent(event.type, event)
|
|
97
98
|
this.dispatchEvent(customEvent)
|
|
98
99
|
}
|
|
@@ -130,7 +131,8 @@ export class LeuFileInput extends FormAssociatedMixin(LeuElement) {
|
|
|
130
131
|
this.dispatchChangeAndInputEvents()
|
|
131
132
|
}
|
|
132
133
|
|
|
133
|
-
protected dispatchChangeAndInputEvents() {
|
|
134
|
+
protected async dispatchChangeAndInputEvents() {
|
|
135
|
+
await this.updateComplete
|
|
134
136
|
this.dispatchEvent(
|
|
135
137
|
new CustomEvent("input", {
|
|
136
138
|
composed: true,
|
|
@@ -35,4 +35,28 @@ describe("LeuFileInput", () => {
|
|
|
35
35
|
expect(fileInput.validity.valueMissing).to.be.true
|
|
36
36
|
expect(form.checkValidity()).to.be.false
|
|
37
37
|
})
|
|
38
|
+
|
|
39
|
+
it("dispatches change after validity is updated", async () => {
|
|
40
|
+
const el = await fixture<LeuFileInput>(html`
|
|
41
|
+
<leu-file-input
|
|
42
|
+
label="File upload"
|
|
43
|
+
required
|
|
44
|
+
accept="text/plain"
|
|
45
|
+
></leu-file-input>
|
|
46
|
+
`)
|
|
47
|
+
const dropzone = el.shadowRoot?.querySelector<HTMLDivElement>(".dropzone")
|
|
48
|
+
const dataTransfer = new DataTransfer()
|
|
49
|
+
const file = new File(["content"], "test.txt", { type: "text/plain" })
|
|
50
|
+
dataTransfer.items.add(file)
|
|
51
|
+
let validityAtChangeEvent: boolean | undefined
|
|
52
|
+
|
|
53
|
+
el.addEventListener("change", () => {
|
|
54
|
+
validityAtChangeEvent = el.checkValidity()
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
dropzone?.dispatchEvent(new DragEvent("drop", { dataTransfer }))
|
|
58
|
+
await el.updateComplete
|
|
59
|
+
|
|
60
|
+
expect(validityAtChangeEvent).to.be.true
|
|
61
|
+
})
|
|
38
62
|
})
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { html, PropertyValues } from "lit"
|
|
2
|
+
import { property } from "lit/decorators.js"
|
|
3
|
+
import { LeuElement } from "../../lib/LeuElement.js"
|
|
4
|
+
|
|
5
|
+
import styles from "./tab.css?inline"
|
|
6
|
+
|
|
7
|
+
let nextId = 1
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Tab Button.
|
|
11
|
+
*
|
|
12
|
+
* @prop {string} name - Name to link Button and Panel together
|
|
13
|
+
* @prop {boolean} active - Is active
|
|
14
|
+
*
|
|
15
|
+
* @tagname leu-tab
|
|
16
|
+
*/
|
|
17
|
+
export class LeuTab extends LeuElement {
|
|
18
|
+
static styles = [LeuElement.styles, styles]
|
|
19
|
+
|
|
20
|
+
protected readonly componentId = `leu-tab-${nextId++}`
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Name of the tab. Apply the same name to the corresponding panel to link them together.
|
|
24
|
+
* Has to be unique within the tab component.
|
|
25
|
+
*/
|
|
26
|
+
@property({ type: String, reflect: true })
|
|
27
|
+
name = ""
|
|
28
|
+
|
|
29
|
+
@property({ type: Boolean, reflect: true })
|
|
30
|
+
active = false
|
|
31
|
+
|
|
32
|
+
connectedCallback() {
|
|
33
|
+
super.connectedCallback()
|
|
34
|
+
this.setAttribute("role", "tab")
|
|
35
|
+
this.addEventListener("click", this.handleClick)
|
|
36
|
+
// Set an id if not already provided. The id is used by the tab-group
|
|
37
|
+
// to set the aria-controls / aria-labelledby attributes.
|
|
38
|
+
this.id = this.id.length > 0 ? this.id : this.componentId
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
disconnectedCallback(): void {
|
|
42
|
+
super.disconnectedCallback()
|
|
43
|
+
this.removeEventListener("click", this.handleClick)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
handleClick() {
|
|
47
|
+
if (this.active) {
|
|
48
|
+
return
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
this.active = true
|
|
52
|
+
|
|
53
|
+
this.dispatchEvent(
|
|
54
|
+
new CustomEvent("leu:tab-select", {
|
|
55
|
+
detail: { name: this.name },
|
|
56
|
+
bubbles: true,
|
|
57
|
+
composed: true,
|
|
58
|
+
}),
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
updated(changedProperties: PropertyValues<this>) {
|
|
63
|
+
if (changedProperties.has("active")) {
|
|
64
|
+
this.ariaSelected = this.active ? "true" : "false"
|
|
65
|
+
this.tabIndex = this.active ? 0 : -1
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
render() {
|
|
70
|
+
return html`<span class="label"><slot></slot></span>`
|
|
71
|
+
}
|
|
72
|
+
}
|