@statistikzh/leu 0.4.0 → 0.5.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 (216) hide show
  1. package/.storybook/preview.js +1 -2
  2. package/CHANGELOG.md +24 -0
  3. package/custom-elements-manifest.config.js +46 -0
  4. package/dist/Accordion.d.ts +31 -0
  5. package/dist/Accordion.d.ts.map +1 -0
  6. package/dist/Accordion.js +257 -0
  7. package/dist/Breadcrumb.d.ts +69 -0
  8. package/dist/Breadcrumb.d.ts.map +1 -0
  9. package/dist/Breadcrumb.js +392 -0
  10. package/dist/Button-da11d064.d.ts +84 -0
  11. package/dist/Button-da11d064.d.ts.map +1 -0
  12. package/dist/Button-da11d064.js +542 -0
  13. package/dist/Button.d.ts +2 -0
  14. package/dist/Button.d.ts.map +1 -0
  15. package/dist/Button.js +6 -420
  16. package/dist/ButtonGroup.d.ts +24 -0
  17. package/dist/ButtonGroup.d.ts.map +1 -0
  18. package/dist/ButtonGroup.js +70 -39
  19. package/dist/Checkbox.d.ts +13 -0
  20. package/dist/Checkbox.d.ts.map +1 -0
  21. package/dist/Checkbox.js +2 -2
  22. package/dist/CheckboxGroup.d.ts +13 -0
  23. package/dist/CheckboxGroup.d.ts.map +1 -0
  24. package/dist/CheckboxGroup.js +3 -3
  25. package/dist/Chip.d.ts +5 -0
  26. package/dist/Chip.d.ts.map +1 -0
  27. package/dist/{Chip-dac7337d.js → Chip.js} +16 -5
  28. package/dist/ChipGroup.d.ts +28 -0
  29. package/dist/ChipGroup.d.ts.map +1 -0
  30. package/dist/ChipGroup.js +62 -5
  31. package/dist/ChipLink.d.ts +15 -0
  32. package/dist/ChipLink.d.ts.map +1 -0
  33. package/dist/ChipLink.js +1 -1
  34. package/dist/ChipRemovable.d.ts +13 -0
  35. package/dist/ChipRemovable.d.ts.map +1 -0
  36. package/dist/ChipRemovable.js +2 -2
  37. package/dist/ChipSelectable.d.ts +22 -0
  38. package/dist/ChipSelectable.d.ts.map +1 -0
  39. package/dist/ChipSelectable.js +5 -5
  40. package/dist/Dropdown.d.ts +15 -0
  41. package/dist/Dropdown.d.ts.map +1 -0
  42. package/dist/Dropdown.js +25 -7
  43. package/dist/Input.d.ts +154 -0
  44. package/dist/Input.d.ts.map +1 -0
  45. package/dist/Input.js +13 -7
  46. package/dist/Menu.d.ts +8 -0
  47. package/dist/Menu.d.ts.map +1 -0
  48. package/dist/MenuItem.d.ts +21 -0
  49. package/dist/MenuItem.d.ts.map +1 -0
  50. package/dist/MenuItem.js +3 -3
  51. package/dist/Pagination.d.ts +27 -0
  52. package/dist/Pagination.d.ts.map +1 -0
  53. package/dist/Pagination.js +93 -61
  54. package/dist/Popup.d.ts +18 -0
  55. package/dist/Popup.d.ts.map +1 -0
  56. package/dist/{leu-popup-4bf6f1f4.js → Popup.js} +4 -5
  57. package/dist/Radio.d.ts +12 -0
  58. package/dist/Radio.d.ts.map +1 -0
  59. package/dist/Radio.js +2 -2
  60. package/dist/RadioGroup.d.ts +20 -0
  61. package/dist/RadioGroup.d.ts.map +1 -0
  62. package/dist/RadioGroup.js +3 -3
  63. package/dist/ScrollTop.d.ts +19 -0
  64. package/dist/ScrollTop.d.ts.map +1 -0
  65. package/dist/ScrollTop.js +122 -0
  66. package/dist/Select.d.ts +98 -0
  67. package/dist/Select.d.ts.map +1 -0
  68. package/dist/Select.js +27 -82
  69. package/dist/Table.d.ts +48 -0
  70. package/dist/Table.d.ts.map +1 -0
  71. package/dist/Table.js +7 -4
  72. package/dist/VisuallyHidden.d.ts +8 -0
  73. package/dist/VisuallyHidden.d.ts.map +1 -0
  74. package/dist/VisuallyHidden.js +28 -0
  75. package/dist/_rollupPluginBabelHelpers-20f659f4.d.ts +3 -0
  76. package/dist/_rollupPluginBabelHelpers-20f659f4.d.ts.map +1 -0
  77. package/dist/defineElement-40372b4b.d.ts +9 -0
  78. package/dist/defineElement-40372b4b.d.ts.map +1 -0
  79. package/dist/{defineElement-47d4f665.js → defineElement-40372b4b.js} +1 -1
  80. package/dist/icon-03e86700.d.ts +11 -0
  81. package/dist/icon-03e86700.d.ts.map +1 -0
  82. package/dist/index.js.d.ts +21 -0
  83. package/dist/index.js.d.ts.map +1 -0
  84. package/dist/{index.js → index.js.js} +14 -8
  85. package/dist/leu-accordion.d.ts +3 -0
  86. package/dist/leu-accordion.d.ts.map +1 -0
  87. package/dist/leu-accordion.js +9 -0
  88. package/dist/leu-breadcrumb.d.ts +3 -0
  89. package/dist/leu-breadcrumb.d.ts.map +1 -0
  90. package/dist/leu-breadcrumb.js +23 -0
  91. package/dist/leu-button-group.d.ts +3 -0
  92. package/dist/leu-button-group.d.ts.map +1 -0
  93. package/dist/leu-button-group.js +1 -5
  94. package/dist/leu-button.d.ts +3 -0
  95. package/dist/leu-button.d.ts.map +1 -0
  96. package/dist/leu-button.js +3 -2
  97. package/dist/leu-checkbox-group.d.ts +3 -0
  98. package/dist/leu-checkbox-group.d.ts.map +1 -0
  99. package/dist/leu-checkbox-group.js +1 -1
  100. package/dist/leu-checkbox.d.ts +3 -0
  101. package/dist/leu-checkbox.d.ts.map +1 -0
  102. package/dist/leu-checkbox.js +1 -1
  103. package/dist/leu-chip-group.d.ts +3 -0
  104. package/dist/leu-chip-group.d.ts.map +1 -0
  105. package/dist/leu-chip-group.js +2 -1
  106. package/dist/leu-chip-link.d.ts +3 -0
  107. package/dist/leu-chip-link.d.ts.map +1 -0
  108. package/dist/leu-chip-link.js +2 -2
  109. package/dist/leu-chip-removable.d.ts +3 -0
  110. package/dist/leu-chip-removable.d.ts.map +1 -0
  111. package/dist/leu-chip-removable.js +2 -2
  112. package/dist/leu-chip-selectable.d.ts +3 -0
  113. package/dist/leu-chip-selectable.d.ts.map +1 -0
  114. package/dist/leu-chip-selectable.js +2 -2
  115. package/dist/leu-dropdown.d.ts +3 -0
  116. package/dist/leu-dropdown.d.ts.map +1 -0
  117. package/dist/leu-dropdown.js +5 -4
  118. package/dist/leu-input.d.ts +3 -0
  119. package/dist/leu-input.d.ts.map +1 -0
  120. package/dist/leu-input.js +1 -1
  121. package/dist/leu-menu-item.d.ts +3 -0
  122. package/dist/leu-menu-item.d.ts.map +1 -0
  123. package/dist/leu-menu-item.js +1 -1
  124. package/dist/leu-menu.d.ts +3 -0
  125. package/dist/leu-menu.d.ts.map +1 -0
  126. package/dist/leu-menu.js +1 -1
  127. package/dist/leu-pagination.d.ts +3 -0
  128. package/dist/leu-pagination.d.ts.map +1 -0
  129. package/dist/leu-pagination.js +5 -2
  130. package/dist/leu-popup.d.ts +3 -0
  131. package/dist/leu-popup.d.ts.map +1 -0
  132. package/dist/leu-popup.js +9 -0
  133. package/dist/leu-radio-group.d.ts +3 -0
  134. package/dist/leu-radio-group.d.ts.map +1 -0
  135. package/dist/leu-radio-group.js +1 -1
  136. package/dist/leu-radio.d.ts +3 -0
  137. package/dist/leu-radio.d.ts.map +1 -0
  138. package/dist/leu-radio.js +1 -1
  139. package/dist/leu-scroll-top.d.ts +3 -0
  140. package/dist/leu-scroll-top.d.ts.map +1 -0
  141. package/dist/leu-scroll-top.js +14 -0
  142. package/dist/leu-select.d.ts +3 -0
  143. package/dist/leu-select.d.ts.map +1 -0
  144. package/dist/leu-select.js +4 -3
  145. package/dist/leu-table.d.ts +3 -0
  146. package/dist/leu-table.d.ts.map +1 -0
  147. package/dist/leu-table.js +5 -2
  148. package/dist/leu-visually-hidden.d.ts +3 -0
  149. package/dist/leu-visually-hidden.d.ts.map +1 -0
  150. package/dist/leu-visually-hidden.js +8 -0
  151. package/dist/theme.css +386 -2
  152. package/dist/utils-65469421.d.ts +16 -0
  153. package/dist/utils-65469421.d.ts.map +1 -0
  154. package/dist/utils-65469421.js +35 -0
  155. package/index.js +3 -0
  156. package/package.json +30 -12
  157. package/postcss.config.cjs +2 -0
  158. package/rollup.config.js +21 -40
  159. package/scripts/generate-component/templates/[name].css +2 -2
  160. package/scripts/postcss-leu-font-styles.cjs +160 -0
  161. package/src/components/accordion/accordion.css +2 -2
  162. package/src/components/accordion/stories/accordion.stories.js +2 -1
  163. package/src/components/accordion/test/accordion.test.js +4 -2
  164. package/src/components/breadcrumb/Breadcrumb.js +2 -1
  165. package/src/components/breadcrumb/breadcrumb.css +2 -13
  166. package/src/components/button/Button.js +69 -8
  167. package/src/components/button/button.css +10 -2
  168. package/src/components/button/stories/button.stories.js +43 -90
  169. package/src/components/button/test/button.test.js +90 -19
  170. package/src/components/button-group/ButtonGroup.js +76 -34
  171. package/src/components/button-group/stories/button-group.stories.js +13 -6
  172. package/src/components/button-group/test/button-group.test.js +38 -31
  173. package/src/components/checkbox/checkbox-group.css +2 -2
  174. package/src/components/checkbox/checkbox.css +1 -1
  175. package/src/components/chip/ChipGroup.js +42 -2
  176. package/src/components/chip/ChipRemovable.js +1 -1
  177. package/src/components/chip/ChipSelectable.js +4 -4
  178. package/src/components/chip/chip-group.css +12 -2
  179. package/src/components/chip/chip.css +14 -3
  180. package/src/components/chip/stories/chip-group.stories.js +100 -46
  181. package/src/components/chip/test/chip-removable.test.js +3 -3
  182. package/src/components/dropdown/Dropdown.js +23 -3
  183. package/src/components/input/Input.js +7 -4
  184. package/src/components/input/input.css +2 -2
  185. package/src/components/input/stories/input.stories.js +13 -0
  186. package/src/components/input/test/input.test.js +1 -0
  187. package/src/components/menu/menu-item.css +3 -3
  188. package/src/components/pagination/Pagination.js +91 -60
  189. package/src/components/pagination/pagination.css +6 -1
  190. package/src/components/pagination/stories/pagination.stories.js +15 -2
  191. package/src/components/pagination/test/pagination.test.js +15 -15
  192. package/src/components/popup/popup.css +2 -2
  193. package/src/components/popup/stories/popup.stories.js +1 -1
  194. package/src/components/radio/radio-group.css +2 -2
  195. package/src/components/radio/radio.css +1 -1
  196. package/src/components/scroll-top/ScrollTop.js +87 -0
  197. package/src/components/scroll-top/leu-scroll-top.js +6 -0
  198. package/src/components/scroll-top/scroll-top.css +34 -0
  199. package/src/components/scroll-top/stories/scroll-top.stories.js +217 -0
  200. package/src/components/scroll-top/test/scroll-top.test.js +22 -0
  201. package/src/components/select/Select.js +24 -6
  202. package/src/components/select/select.css +2 -2
  203. package/src/components/table/table.css +2 -2
  204. package/src/components/visually-hidden/VisuallyHidden.js +13 -0
  205. package/src/components/visually-hidden/leu-visually-hidden.js +6 -0
  206. package/src/components/visually-hidden/stories/visually-hidden.stories.js +22 -0
  207. package/src/components/visually-hidden/test/visually-hidden.test.js +36 -0
  208. package/src/components/visually-hidden/visually-hidden.css +10 -0
  209. package/src/lib/defineElement.js +1 -1
  210. package/src/lib/hasSlotController.js +5 -3
  211. package/src/lib/utils.js +21 -3
  212. package/src/styles/custom-properties.css +6 -2
  213. package/src/styles/font-definitions.json +202 -0
  214. package/stylelint.config.mjs +2 -0
  215. package/tsconfig.build.json +21 -0
  216. package/tsconfig.json +16 -0
@@ -0,0 +1,542 @@
1
+ import { _ as _defineProperty } from './_rollupPluginBabelHelpers-20f659f4.js';
2
+ import { css, LitElement, html, nothing } from 'lit';
3
+ import { classMap } from 'lit/directives/class-map.js';
4
+ import { ifDefined } from 'lit/directives/if-defined.js';
5
+ import { I as Icon } from './icon-03e86700.js';
6
+
7
+ /**
8
+ * Thanks Shoelace!
9
+ * Source: https://github.com/shoelace-style/shoelace/blob/next/src/internal/slot.ts
10
+ */
11
+
12
+ /**
13
+ * A reactive controller that determines when slots exist.
14
+ * @typedef {import("lit").ReactiveController} ReactiveController
15
+ * @implements {ReactiveController}
16
+ */
17
+ class HasSlotController {
18
+ constructor(host, slotNames) {
19
+ /**
20
+ * @private
21
+ * @param {Event} event
22
+ */
23
+ _defineProperty(this, "handleSlotChange", event => {
24
+ const slot = event.target;
25
+ if (slot instanceof HTMLSlotElement && (this.slotNames.includes("[default]") && !slot.name || slot.name && this.slotNames.includes(slot.name))) {
26
+ this.host.requestUpdate();
27
+ }
28
+ });
29
+ this.host = host;
30
+ host.addController(this);
31
+ this.slotNames = slotNames;
32
+ }
33
+
34
+ /**
35
+ * @private
36
+ * @returns {Boolean}
37
+ */
38
+ hasDefaultSlot() {
39
+ return [...this.host.childNodes].some(node => {
40
+ if (node.nodeType === node.TEXT_NODE && node.textContent.trim() !== "") {
41
+ return true;
42
+ }
43
+ if (node.nodeType === node.ELEMENT_NODE) {
44
+ const el = node;
45
+
46
+ // If it doesn't have a slot attribute, it's part of the default slot
47
+ if (!el.hasAttribute("slot")) {
48
+ return true;
49
+ }
50
+ }
51
+ return false;
52
+ });
53
+ }
54
+
55
+ /**
56
+ * @private
57
+ * @param {String} name
58
+ * @returns {Boolean}
59
+ */
60
+ hasNamedSlot(name) {
61
+ return this.host.querySelector(`:scope > [slot="${name}"]`) !== null;
62
+ }
63
+
64
+ /**
65
+ * @param {String} slotName
66
+ * @returns {Boolean}
67
+ */
68
+ test(slotName) {
69
+ return slotName === "[default]" ? this.hasDefaultSlot() : this.hasNamedSlot(slotName);
70
+ }
71
+ hostConnected() {
72
+ this.host.shadowRoot.addEventListener("slotchange", this.handleSlotChange);
73
+ }
74
+ hostDisconnected() {
75
+ this.host.shadowRoot.removeEventListener("slotchange", this.handleSlotChange);
76
+ }
77
+ }
78
+
79
+ var css_248z = css`:host {
80
+ display: inline-block;
81
+ }
82
+
83
+ button {
84
+ font-family: var(--leu-font-family-black);
85
+ text-align: center;
86
+ -webkit-appearance: none;
87
+ -moz-appearance: none;
88
+ appearance: none;
89
+ transition: background 0.1s ease;
90
+ cursor: pointer;
91
+ border: 1px solid transparent;
92
+ border-radius: 2px;
93
+ display: flex;
94
+ align-items: center;
95
+ -moz-column-gap: 8px;
96
+ column-gap: 8px;
97
+ }
98
+
99
+ button.round {
100
+ border-radius: 50%;
101
+ }
102
+
103
+ button:disabled {
104
+ cursor: not-allowed;
105
+ }
106
+
107
+ button:focus-visible {
108
+ border: 1px solid var(--leu-color-black-0);
109
+ outline: 2px solid var(--leu-color-func-cyan);
110
+ }
111
+
112
+ button.inverted:focus-visible {
113
+ border: 1px solid var(--leu-color-black-100);
114
+ outline: 2px solid var(--leu-color-black-0);
115
+ }
116
+
117
+ :host([fluid]) button {
118
+ width: 100%;
119
+ justify-content: center;
120
+ }
121
+
122
+ /* size - regular */
123
+
124
+ button.regular {
125
+ padding: 12px 24px;
126
+ font-size: 16px;
127
+ line-height: 24px;
128
+ }
129
+
130
+ button.regular.icon {
131
+ padding: 12px;
132
+ }
133
+
134
+ /* size - small */
135
+
136
+ button.small {
137
+ padding: 6px 24px;
138
+ font-size: 14px;
139
+ line-height: 20px;
140
+ }
141
+
142
+ button.small.icon {
143
+ padding: 8px;
144
+ }
145
+
146
+ /* primary */
147
+
148
+ button.primary {
149
+ color: var(--leu-color-black-0);
150
+ background: var(--leu-color-black-100);
151
+ }
152
+
153
+ button.primary:hover {
154
+ color: var(--leu-color-black-0);
155
+ background: var(--leu-color-black-transp-80);
156
+ }
157
+
158
+ button.primary.active {
159
+ color: var(--leu-color-black-0);
160
+ background: var(--leu-color-black-100);
161
+ }
162
+
163
+ button.primary.active:hover {
164
+ background: var(--leu-color-black-transp-80);
165
+ }
166
+
167
+ button.primary:disabled {
168
+ color: var(--leu-color-black-0);
169
+ background: var(--leu-color-black-transp-20);
170
+ }
171
+
172
+ /* secondary */
173
+
174
+ button.secondary {
175
+ color: var(--leu-color-black-transp-60);
176
+ background: var(--leu-color-black-transp-10);
177
+ }
178
+
179
+ button.secondary:hover {
180
+ color: var(--leu-color-black-100);
181
+ background: var(--leu-color-black-transp-20);
182
+ }
183
+
184
+ button.secondary.active {
185
+ color: var(--leu-color-black-0);
186
+ background: var(--leu-color-black-100);
187
+ }
188
+
189
+ button.secondary.active:hover {
190
+ background: var(--leu-color-black-transp-80);
191
+ }
192
+
193
+ button.secondary:disabled {
194
+ color: var(--leu-color-black-transp-20);
195
+ background: var(--leu-color-black-transp-5);
196
+ }
197
+
198
+ /* ghost */
199
+
200
+ button.ghost {
201
+ background: transparent;
202
+ padding: 0 0.5rem;
203
+ color: var(--leu-color-black-60);
204
+ font-family: var(--leu-font-family-regular);
205
+ }
206
+
207
+ button.ghost:hover {
208
+ color: var(--leu-color-black-100);
209
+ }
210
+
211
+ button.ghost.active {
212
+ color: var(--leu-color-black-100);
213
+ }
214
+
215
+ button.ghost:disabled {
216
+ color: var(--leu-color-black-20);
217
+ }
218
+
219
+ /* primary + inverted */
220
+
221
+ button.primary.inverted {
222
+ color: var(--leu-color-black-100);
223
+ background: var(--leu-color-black-0);
224
+ }
225
+
226
+ button.primary.inverted:hover {
227
+ color: var(--leu-color-black-100);
228
+ background: var(--leu-color-white-transp-70);
229
+ }
230
+
231
+ button.primary.inverted.active {
232
+ color: var(--leu-color-black-0);
233
+ background: var(--leu-color-black-100);
234
+ }
235
+
236
+ button.primary.inverted:disabled {
237
+ color: var(--leu-color-black-40);
238
+ background: var(--leu-color-white-transp-70);
239
+ }
240
+
241
+ /* secondary + inverted */
242
+
243
+ button.secondary.inverted {
244
+ color: var(--leu-color-black-0);
245
+ background: var(--leu-color-black-transp-20);
246
+ }
247
+
248
+ button.secondary.inverted:hover {
249
+ color: var(--leu-color-black-0);
250
+ background: var(--leu-color-black-transp-40);
251
+ }
252
+
253
+ button.secondary.inverted.active {
254
+ color: var(--leu-color-black-100);
255
+ background: var(--leu-color-black-0);
256
+ }
257
+
258
+ button.secondary.inverted:disabled {
259
+ color: var(--leu-color-white-transp-70);
260
+ background: var(--leu-color-black-transp-10);
261
+ }
262
+
263
+ /* ghost + inverted */
264
+
265
+ button.ghost.inverted {
266
+ color: var(--leu-color-black-0);
267
+ }
268
+
269
+ button.ghost.inverted:hover {
270
+ color: var(--leu-color-white-transp-70);
271
+ }
272
+
273
+ button.ghost.inverted.active {
274
+ color: var(--leu-color-black-0);
275
+ }
276
+
277
+ button.ghost.inverted:disabled {
278
+ color: var(--leu-color-black-20);
279
+ }
280
+
281
+ /* icon-wrapper */
282
+
283
+ .icon-wrapper svg {
284
+ display: block;
285
+ }
286
+
287
+ .ghost .icon-wrapper--before, .ghost .icon-wrapper--after {
288
+ padding: 0.5rem;
289
+ border-radius: 50%;
290
+ background: var(--leu-color-black-transp-10);
291
+ }
292
+
293
+ .ghost.active .icon-wrapper--before, .ghost.active .icon-wrapper--after {
294
+ background: var(--leu-color-black-100);
295
+ color: var(--leu-color-black-0);
296
+ }
297
+
298
+ .ghost:disabled .icon-wrapper--before {
299
+ background: var(--leu-color-black-transp-5);
300
+ }
301
+
302
+ .ghost:disabled .icon-wrapper--after {
303
+ background: var(--leu-color-black-transp-5);
304
+ }
305
+
306
+ /* inverted */
307
+
308
+ .ghost.inverted .icon-wrapper--before, .ghost.inverted .icon-wrapper--after {
309
+ background: var(--leu-color-black-transp-20);
310
+ }
311
+
312
+ .ghost.inverted:hover .icon-wrapper--before, .ghost.inverted:hover .icon-wrapper--after {
313
+ background: var(--leu-color-black-transp-40);
314
+ color: var(--leu-color-black-0);
315
+ }
316
+
317
+ .ghost.inverted:disabled .icon-wrapper--before {
318
+ background: var(--leu-color-black-transp-20);
319
+ color: var(--leu-color-white-transp-70);
320
+ }
321
+
322
+ .ghost.inverted:disabled .icon-wrapper--after {
323
+ background: var(--leu-color-black-transp-20);
324
+ color: var(--leu-color-white-transp-70);
325
+ }
326
+
327
+ .ghost.active.inverted .icon-wrapper--before, .ghost.active.inverted .icon-wrapper--after {
328
+ background: var(--leu-color-black-0);
329
+ color: var(--leu-color-black-100);
330
+ }
331
+
332
+ /* Expanded icon */
333
+
334
+ .icon-wrapper--expanded {
335
+ transition: transform 0.1s ease;
336
+ }
337
+
338
+ :host([expanded="open"]) .icon-wrapper--expanded {
339
+ transform: rotate(180deg);
340
+ }
341
+ `;
342
+
343
+ /*
344
+ Design: https://www.figma.com/file/d6Pv21UVUbnBs3AdcZijHmbN/KTZH-Design-System?type=design&node-id=4-1444&mode=design&t=xu5Vii8jXKKCKDez-0
345
+ Live Demo: zh.ch
346
+ */
347
+
348
+ const BUTTON_VARIANTS = ["primary", "secondary", "ghost"];
349
+ Object.freeze(BUTTON_VARIANTS);
350
+ const BUTTON_SIZES = ["regular", "small"];
351
+ Object.freeze(BUTTON_SIZES);
352
+ const BUTTON_TYPES = ["button", "submit", "reset"];
353
+ Object.freeze(BUTTON_TYPES);
354
+ const BUTTON_EXPANDED_OPTIONS = ["true", "false"];
355
+ Object.freeze(BUTTON_EXPANDED_OPTIONS);
356
+
357
+ /**
358
+ * All roles that are associated with a aria-checked attribute
359
+ * @link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-checked
360
+ */
361
+ const ARIA_ROLES_CHECKED = ["checkbox", "menuitemcheckbox", "menuitemradio", "option", "radio", "switch"];
362
+
363
+ /**
364
+ * All roles that are associated with a aria-selected attribute
365
+ * @link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-selected
366
+ */
367
+ const ARIA_ROLES_SELECTED = ["gridcell", "option", "row", "tab", "columnheader", "rowheader", "treeitem"];
368
+
369
+ /**
370
+ * @tagname leu-button
371
+ */
372
+ class LeuButton extends LitElement {
373
+ constructor() {
374
+ super();
375
+ /** @type {string} */
376
+ /**
377
+ * @internal
378
+ */
379
+ _defineProperty(this, "hasSlotController", new HasSlotController(this, ["[default]"]));
380
+ this.label = null;
381
+ /** @type {string} */
382
+ this.icon = null;
383
+ /** @type {("before" | "after")} - Only taken into account if Label and no Icon is set */
384
+ this.iconPosition = "before";
385
+ /** @type {string} */
386
+ this.size = "regular";
387
+ /** @type {string} */
388
+ this.variant = "primary";
389
+ /** @type {"button" | "submit" | "reset"} */
390
+ this.type = "button";
391
+
392
+ /** @type {boolean} */
393
+ this.disabled = false;
394
+ /** @type {boolean} - Only taken into account if no Label and an Icon is set */
395
+ this.round = false;
396
+ /** @type {boolean} */
397
+ this.active = false;
398
+ /** @type {boolean} - will be used on dark Background */
399
+ this.inverted = false;
400
+
401
+ /** @type {boolean} - Alters the shape of the button to be full width of its parent container */
402
+ this.fluid = false;
403
+
404
+ /**
405
+ * Only taken into account if variant is "ghost"
406
+ * @type {("true" | "false" | undefined)}
407
+ */
408
+ this.expanded = undefined;
409
+ }
410
+ getIconSize() {
411
+ return this.size === "small" || this.variant === "ghost" ? 16 : 24;
412
+ }
413
+ renderIconBefore() {
414
+ if (this.icon && this.iconPosition === "before") {
415
+ return html`<div class="icon-wrapper icon-wrapper--before">
416
+ ${Icon(this.icon, this.getIconSize())}
417
+ </div>`;
418
+ }
419
+ return nothing;
420
+ }
421
+ renderIconAfter() {
422
+ if (this.icon && this.iconPosition === "after") {
423
+ return html`<div class="icon-wrapper icon-wrapper--after">
424
+ ${Icon(this.icon, this.getIconSize())}
425
+ </div>`;
426
+ }
427
+ return nothing;
428
+ }
429
+ renderExpandingIcon() {
430
+ if (typeof this.expanded !== "undefined" && this.variant === "ghost") {
431
+ return html`<div class="icon-wrapper icon-wrapper--expanded">
432
+ ${Icon("angleDropDown", 24)}
433
+ </div>`;
434
+ }
435
+ return nothing;
436
+ }
437
+ getAriaAttributes() {
438
+ const attributes = {
439
+ role: this.componentRole,
440
+ label: this.label
441
+ };
442
+ if (this.componentRole) {
443
+ if (ARIA_ROLES_CHECKED.includes(this.componentRole)) {
444
+ attributes.checked = this.active ? "true" : "false";
445
+ } else if (ARIA_ROLES_SELECTED.includes(this.componentRole)) {
446
+ attributes.selected = this.active ? "true" : "false";
447
+ }
448
+ }
449
+ return attributes;
450
+ }
451
+ render() {
452
+ const hasContent = this.hasSlotController.test("[default]");
453
+ const aria = this.getAriaAttributes();
454
+ const cssClasses = {
455
+ icon: !hasContent && this.icon,
456
+ round: !hasContent && this.icon && this.round,
457
+ active: this.active,
458
+ inverted: this.inverted,
459
+ [this.variant]: true,
460
+ [this.size]: true
461
+ };
462
+ return html`
463
+ <button
464
+ aria-label=${ifDefined(aria.label)}
465
+ aria-selected=${ifDefined(aria.selected)}
466
+ aria-checked=${ifDefined(aria.checked)}
467
+ role=${ifDefined(aria.role)}
468
+ class=${classMap(cssClasses)}
469
+ ?disabled=${this.disabled}
470
+ type=${this.type}
471
+ >
472
+ ${this.renderIconBefore()}
473
+ <slot></slot>
474
+ ${this.renderIconAfter()} ${this.renderExpandingIcon()}
475
+ </button>
476
+ `;
477
+ }
478
+ }
479
+ _defineProperty(LeuButton, "styles", css_248z);
480
+ /**
481
+ * @internal
482
+ */
483
+ _defineProperty(LeuButton, "shadowRootOptions", {
484
+ ...LitElement.shadowRootOptions,
485
+ delegatesFocus: true
486
+ });
487
+ _defineProperty(LeuButton, "properties", {
488
+ label: {
489
+ type: String,
490
+ reflect: true
491
+ },
492
+ icon: {
493
+ type: String,
494
+ reflect: true
495
+ },
496
+ iconPosition: {
497
+ type: String,
498
+ reflect: true
499
+ },
500
+ size: {
501
+ type: String,
502
+ reflect: true
503
+ },
504
+ variant: {
505
+ type: String,
506
+ reflect: true
507
+ },
508
+ type: {
509
+ type: String,
510
+ reflect: true
511
+ },
512
+ componentRole: {
513
+ type: String,
514
+ reflect: true
515
+ },
516
+ disabled: {
517
+ type: Boolean,
518
+ reflect: true
519
+ },
520
+ round: {
521
+ type: Boolean,
522
+ reflect: true
523
+ },
524
+ active: {
525
+ type: Boolean,
526
+ reflect: true
527
+ },
528
+ inverted: {
529
+ type: Boolean,
530
+ reflect: true
531
+ },
532
+ expanded: {
533
+ type: String,
534
+ reflect: true
535
+ },
536
+ fluid: {
537
+ type: Boolean,
538
+ reflect: true
539
+ }
540
+ });
541
+
542
+ export { BUTTON_VARIANTS as B, HasSlotController as H, LeuButton as L, BUTTON_SIZES as a, BUTTON_TYPES as b, BUTTON_EXPANDED_OPTIONS as c };
@@ -0,0 +1,2 @@
1
+ export { c as BUTTON_EXPANDED_OPTIONS, a as BUTTON_SIZES, b as BUTTON_TYPES, B as BUTTON_VARIANTS, L as LeuButton } from "./Button-da11d064.js";
2
+ //# sourceMappingURL=Button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["Button.js"],"names":[],"mappings":""}