@statistikzh/leu 0.3.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 (295) hide show
  1. package/.github/workflows/deploy-github-pages.yaml +33 -0
  2. package/.storybook/main.js +27 -1
  3. package/.storybook/manager-head.html +1 -0
  4. package/.storybook/manager.js +9 -0
  5. package/.storybook/preview-head.html +1 -1
  6. package/.storybook/preview.js +59 -6
  7. package/.storybook/static/logo.svg +19 -0
  8. package/.storybook/theme.js +7 -0
  9. package/CHANGELOG.md +54 -0
  10. package/README.md +1 -1
  11. package/custom-elements-manifest.config.js +46 -0
  12. package/dist/Accordion.d.ts +31 -0
  13. package/dist/Accordion.d.ts.map +1 -0
  14. package/dist/Accordion.js +257 -0
  15. package/dist/Breadcrumb.d.ts +69 -0
  16. package/dist/Breadcrumb.d.ts.map +1 -0
  17. package/dist/Breadcrumb.js +392 -0
  18. package/dist/Button-da11d064.d.ts +84 -0
  19. package/dist/Button-da11d064.d.ts.map +1 -0
  20. package/dist/Button-da11d064.js +542 -0
  21. package/dist/Button.d.ts +2 -0
  22. package/dist/Button.d.ts.map +1 -0
  23. package/dist/Button.js +6 -423
  24. package/dist/ButtonGroup.d.ts +24 -0
  25. package/dist/ButtonGroup.d.ts.map +1 -0
  26. package/dist/ButtonGroup.js +72 -43
  27. package/dist/Checkbox.d.ts +13 -0
  28. package/dist/Checkbox.d.ts.map +1 -0
  29. package/dist/Checkbox.js +101 -84
  30. package/dist/CheckboxGroup.d.ts +13 -0
  31. package/dist/CheckboxGroup.d.ts.map +1 -0
  32. package/dist/CheckboxGroup.js +41 -37
  33. package/dist/Chip.d.ts +5 -0
  34. package/dist/Chip.d.ts.map +1 -0
  35. package/dist/{Chip-5f70d04f.js → Chip.js} +21 -6
  36. package/dist/ChipGroup.d.ts +28 -0
  37. package/dist/ChipGroup.d.ts.map +1 -0
  38. package/dist/ChipGroup.js +64 -10
  39. package/dist/ChipLink.d.ts +15 -0
  40. package/dist/ChipLink.d.ts.map +1 -0
  41. package/dist/ChipLink.js +4 -7
  42. package/dist/ChipRemovable.d.ts +13 -0
  43. package/dist/ChipRemovable.d.ts.map +1 -0
  44. package/dist/ChipRemovable.js +5 -8
  45. package/dist/ChipSelectable.d.ts +22 -0
  46. package/dist/ChipSelectable.d.ts.map +1 -0
  47. package/dist/ChipSelectable.js +8 -11
  48. package/dist/Dropdown.d.ts +15 -0
  49. package/dist/Dropdown.d.ts.map +1 -0
  50. package/dist/Dropdown.js +73 -26
  51. package/dist/Input.d.ts +154 -0
  52. package/dist/Input.d.ts.map +1 -0
  53. package/dist/Input.js +42 -35
  54. package/dist/Menu.d.ts +8 -0
  55. package/dist/Menu.d.ts.map +1 -0
  56. package/dist/Menu.js +2 -5
  57. package/dist/MenuItem.d.ts +21 -0
  58. package/dist/MenuItem.d.ts.map +1 -0
  59. package/dist/MenuItem.js +32 -17
  60. package/dist/Pagination.d.ts +27 -0
  61. package/dist/Pagination.d.ts.map +1 -0
  62. package/dist/Pagination.js +121 -89
  63. package/dist/Popup.d.ts +18 -0
  64. package/dist/Popup.d.ts.map +1 -0
  65. package/dist/Popup.js +215 -0
  66. package/dist/Radio.d.ts +12 -0
  67. package/dist/Radio.d.ts.map +1 -0
  68. package/dist/Radio.js +9 -8
  69. package/dist/RadioGroup.d.ts +20 -0
  70. package/dist/RadioGroup.d.ts.map +1 -0
  71. package/dist/RadioGroup.js +41 -39
  72. package/dist/ScrollTop.d.ts +19 -0
  73. package/dist/ScrollTop.d.ts.map +1 -0
  74. package/dist/ScrollTop.js +122 -0
  75. package/dist/Select.d.ts +98 -0
  76. package/dist/Select.d.ts.map +1 -0
  77. package/dist/Select.js +79 -122
  78. package/dist/Table.d.ts +48 -0
  79. package/dist/Table.d.ts.map +1 -0
  80. package/dist/Table.js +141 -121
  81. package/dist/VisuallyHidden.d.ts +8 -0
  82. package/dist/VisuallyHidden.d.ts.map +1 -0
  83. package/dist/VisuallyHidden.js +28 -0
  84. package/dist/_rollupPluginBabelHelpers-20f659f4.d.ts +3 -0
  85. package/dist/_rollupPluginBabelHelpers-20f659f4.d.ts.map +1 -0
  86. package/dist/{defineElement-ba770aed.js → _rollupPluginBabelHelpers-20f659f4.js} +1 -15
  87. package/dist/defineElement-40372b4b.d.ts +9 -0
  88. package/dist/defineElement-40372b4b.d.ts.map +1 -0
  89. package/dist/defineElement-40372b4b.js +15 -0
  90. package/dist/icon-03e86700.d.ts +11 -0
  91. package/dist/icon-03e86700.d.ts.map +1 -0
  92. package/dist/index.js.d.ts +21 -0
  93. package/dist/index.js.d.ts.map +1 -0
  94. package/dist/index.js.js +42 -0
  95. package/dist/leu-accordion.d.ts +3 -0
  96. package/dist/leu-accordion.d.ts.map +1 -0
  97. package/dist/leu-accordion.js +9 -0
  98. package/dist/leu-breadcrumb.d.ts +3 -0
  99. package/dist/leu-breadcrumb.d.ts.map +1 -0
  100. package/dist/leu-breadcrumb.js +23 -0
  101. package/dist/leu-button-group.d.ts +3 -0
  102. package/dist/leu-button-group.d.ts.map +1 -0
  103. package/dist/leu-button-group.js +6 -6
  104. package/dist/leu-button.d.ts +3 -0
  105. package/dist/leu-button.d.ts.map +1 -0
  106. package/dist/leu-button.js +7 -3
  107. package/dist/leu-checkbox-group.d.ts +3 -0
  108. package/dist/leu-checkbox-group.d.ts.map +1 -0
  109. package/dist/leu-checkbox-group.js +6 -3
  110. package/dist/leu-checkbox.d.ts +3 -0
  111. package/dist/leu-checkbox.d.ts.map +1 -0
  112. package/dist/leu-checkbox.js +6 -3
  113. package/dist/leu-chip-group.d.ts +3 -0
  114. package/dist/leu-chip-group.d.ts.map +1 -0
  115. package/dist/leu-chip-group.js +7 -3
  116. package/dist/leu-chip-link.d.ts +3 -0
  117. package/dist/leu-chip-link.d.ts.map +1 -0
  118. package/dist/leu-chip-link.js +7 -4
  119. package/dist/leu-chip-removable.d.ts +3 -0
  120. package/dist/leu-chip-removable.d.ts.map +1 -0
  121. package/dist/leu-chip-removable.js +7 -4
  122. package/dist/leu-chip-selectable.d.ts +3 -0
  123. package/dist/leu-chip-selectable.d.ts.map +1 -0
  124. package/dist/leu-chip-selectable.js +7 -4
  125. package/dist/leu-dropdown.d.ts +3 -0
  126. package/dist/leu-dropdown.d.ts.map +1 -0
  127. package/dist/leu-dropdown.js +15 -4
  128. package/dist/leu-input.d.ts +3 -0
  129. package/dist/leu-input.d.ts.map +1 -0
  130. package/dist/leu-input.js +7 -3
  131. package/dist/leu-menu-item.d.ts +3 -0
  132. package/dist/leu-menu-item.d.ts.map +1 -0
  133. package/dist/leu-menu-item.js +8 -3
  134. package/dist/leu-menu.d.ts +3 -0
  135. package/dist/leu-menu.d.ts.map +1 -0
  136. package/dist/leu-menu.js +6 -3
  137. package/dist/leu-pagination.d.ts +3 -0
  138. package/dist/leu-pagination.d.ts.map +1 -0
  139. package/dist/leu-pagination.js +12 -4
  140. package/dist/leu-popup.d.ts +3 -0
  141. package/dist/leu-popup.d.ts.map +1 -0
  142. package/dist/leu-popup.js +9 -0
  143. package/dist/leu-radio-group.d.ts +3 -0
  144. package/dist/leu-radio-group.d.ts.map +1 -0
  145. package/dist/leu-radio-group.js +6 -3
  146. package/dist/leu-radio.d.ts +3 -0
  147. package/dist/leu-radio.d.ts.map +1 -0
  148. package/dist/leu-radio.js +6 -3
  149. package/dist/leu-scroll-top.d.ts +3 -0
  150. package/dist/leu-scroll-top.d.ts.map +1 -0
  151. package/dist/leu-scroll-top.js +14 -0
  152. package/dist/leu-select.d.ts +3 -0
  153. package/dist/leu-select.d.ts.map +1 -0
  154. package/dist/leu-select.js +16 -4
  155. package/dist/leu-table.d.ts +3 -0
  156. package/dist/leu-table.d.ts.map +1 -0
  157. package/dist/leu-table.js +13 -4
  158. package/dist/leu-visually-hidden.d.ts +3 -0
  159. package/dist/leu-visually-hidden.d.ts.map +1 -0
  160. package/dist/leu-visually-hidden.js +8 -0
  161. package/dist/theme.css +386 -2
  162. package/dist/utils-65469421.d.ts +16 -0
  163. package/dist/utils-65469421.d.ts.map +1 -0
  164. package/dist/utils-65469421.js +35 -0
  165. package/index.js +3 -0
  166. package/package.json +47 -17
  167. package/postcss.config.cjs +2 -0
  168. package/rollup.config.js +21 -40
  169. package/scripts/generate-component/templates/[Name].js +0 -5
  170. package/scripts/generate-component/templates/[name].css +3 -3
  171. package/scripts/generate-component/templates/[namespace]-[name].js +5 -2
  172. package/scripts/postcss-leu-font-styles.cjs +160 -0
  173. package/src/components/accordion/Accordion.js +0 -6
  174. package/src/components/accordion/accordion.css +2 -2
  175. package/src/components/accordion/leu-accordion.js +5 -2
  176. package/src/components/accordion/stories/accordion.stories.js +8 -4
  177. package/src/components/accordion/test/accordion.test.js +95 -3
  178. package/src/components/breadcrumb/Breadcrumb.js +311 -0
  179. package/src/components/breadcrumb/breadcrumb.css +103 -0
  180. package/src/components/breadcrumb/leu-breadcrumb.js +6 -0
  181. package/src/components/breadcrumb/stories/breadcrumb.stories.js +73 -0
  182. package/src/components/breadcrumb/test/breadcrumb.test.js +141 -0
  183. package/src/components/button/Button.js +76 -20
  184. package/src/components/button/button.css +13 -5
  185. package/src/components/button/leu-button.js +5 -2
  186. package/src/components/button/stories/button.stories.js +79 -105
  187. package/src/components/button/test/button.test.js +184 -3
  188. package/src/components/button-group/ButtonGroup.js +76 -40
  189. package/src/components/button-group/leu-button-group.js +5 -2
  190. package/src/components/button-group/stories/button-group.stories.js +19 -6
  191. package/src/components/button-group/test/button-group.test.js +87 -4
  192. package/src/components/checkbox/Checkbox.js +6 -85
  193. package/src/components/checkbox/CheckboxGroup.js +8 -38
  194. package/src/components/checkbox/checkbox-group.css +29 -0
  195. package/src/components/checkbox/checkbox.css +76 -0
  196. package/src/components/checkbox/leu-checkbox-group.js +5 -2
  197. package/src/components/checkbox/leu-checkbox.js +5 -2
  198. package/src/components/checkbox/stories/checkbox-group.stories.js +44 -21
  199. package/src/components/checkbox/stories/checkbox.stories.js +7 -1
  200. package/src/components/checkbox/test/checkbox-group.test.js +124 -0
  201. package/src/components/checkbox/test/checkbox.test.js +72 -59
  202. package/src/components/chip/Chip.js +1 -0
  203. package/src/components/chip/ChipGroup.js +42 -7
  204. package/src/components/chip/ChipLink.js +1 -6
  205. package/src/components/chip/ChipRemovable.js +2 -7
  206. package/src/components/chip/ChipSelectable.js +5 -10
  207. package/src/components/chip/chip-group.css +12 -2
  208. package/src/components/chip/chip.css +14 -3
  209. package/src/components/chip/exports.js +4 -10
  210. package/src/components/chip/leu-chip-group.js +5 -2
  211. package/src/components/chip/leu-chip-link.js +5 -2
  212. package/src/components/chip/leu-chip-removable.js +5 -2
  213. package/src/components/chip/leu-chip-selectable.js +5 -2
  214. package/src/components/chip/stories/chip-group.stories.js +110 -44
  215. package/src/components/chip/stories/chip-link.stories.js +16 -4
  216. package/src/components/chip/stories/chip-removable.stories.js +15 -4
  217. package/src/components/chip/stories/chip-selectable.stories.js +13 -3
  218. package/src/components/chip/test/chip-group.test.js +124 -0
  219. package/src/components/chip/test/chip-link.test.js +58 -0
  220. package/src/components/chip/test/chip-removable.test.js +79 -0
  221. package/src/components/chip/test/chip-selectable.test.js +95 -0
  222. package/src/components/chip/test/chip.test.js +1 -1
  223. package/src/components/dropdown/Dropdown.js +72 -24
  224. package/src/components/dropdown/dropdown.css +1 -2
  225. package/src/components/dropdown/leu-dropdown.js +5 -2
  226. package/src/components/dropdown/stories/dropdown.stories.js +11 -5
  227. package/src/components/dropdown/test/dropdown.test.js +6 -6
  228. package/src/components/icon/icon.js +1 -1
  229. package/src/components/icon/test/icon.test.js +66 -0
  230. package/src/components/input/Input.js +25 -28
  231. package/src/components/input/input.css +11 -8
  232. package/src/components/input/leu-input.js +5 -2
  233. package/src/components/input/stories/input.stories.js +21 -2
  234. package/src/components/input/test/input.test.js +432 -4
  235. package/src/components/menu/Menu.js +0 -5
  236. package/src/components/menu/MenuItem.js +20 -13
  237. package/src/components/menu/leu-menu-item.js +5 -2
  238. package/src/components/menu/leu-menu.js +5 -2
  239. package/src/components/menu/menu-item.css +7 -4
  240. package/src/components/menu/stories/menu-item.stories.js +13 -4
  241. package/src/components/menu/stories/menu.stories.js +11 -5
  242. package/src/components/menu/test/menu-item.test.js +180 -0
  243. package/src/components/menu/test/menu.test.js +10 -2
  244. package/src/components/pagination/Pagination.js +118 -99
  245. package/src/components/pagination/leu-pagination.js +5 -2
  246. package/src/components/pagination/pagination.css +6 -1
  247. package/src/components/pagination/stories/pagination.stories.js +30 -9
  248. package/src/components/pagination/test/pagination.test.js +191 -5
  249. package/src/components/popup/Popup.js +200 -0
  250. package/src/components/popup/leu-popup.js +6 -0
  251. package/src/components/popup/popup.css +27 -0
  252. package/src/components/popup/stories/popup.stories.js +58 -0
  253. package/src/components/popup/test/popup.test.js +29 -0
  254. package/src/components/radio/Radio.js +2 -6
  255. package/src/components/radio/RadioGroup.js +6 -38
  256. package/src/components/radio/leu-radio-group.js +5 -2
  257. package/src/components/radio/leu-radio.js +5 -2
  258. package/src/components/radio/radio-group.css +29 -0
  259. package/src/components/radio/radio.css +1 -1
  260. package/src/components/radio/stories/radio-group.stories.js +38 -19
  261. package/src/components/radio/stories/radio.stories.js +7 -1
  262. package/src/components/radio/test/radio-group.test.js +86 -0
  263. package/src/components/radio/test/radio.test.js +108 -17
  264. package/src/components/scroll-top/ScrollTop.js +87 -0
  265. package/src/components/scroll-top/leu-scroll-top.js +6 -0
  266. package/src/components/scroll-top/scroll-top.css +34 -0
  267. package/src/components/scroll-top/stories/scroll-top.stories.js +217 -0
  268. package/src/components/scroll-top/test/scroll-top.test.js +22 -0
  269. package/src/components/select/Select.js +58 -37
  270. package/src/components/select/leu-select.js +5 -2
  271. package/src/components/select/select.css +15 -15
  272. package/src/components/select/stories/select.stories.js +15 -168
  273. package/src/components/select/test/fixtures.js +162 -0
  274. package/src/components/select/test/select.test.js +236 -12
  275. package/src/components/table/Table.js +43 -118
  276. package/src/components/table/leu-table.js +5 -2
  277. package/src/components/table/stories/table.stories.js +20 -10
  278. package/src/components/table/table.css +99 -0
  279. package/src/components/table/test/table.test.js +1 -1
  280. package/src/components/visually-hidden/VisuallyHidden.js +13 -0
  281. package/src/components/visually-hidden/leu-visually-hidden.js +6 -0
  282. package/src/components/visually-hidden/stories/visually-hidden.stories.js +22 -0
  283. package/src/components/visually-hidden/test/visually-hidden.test.js +36 -0
  284. package/src/components/visually-hidden/visually-hidden.css +10 -0
  285. package/src/lib/defineElement.js +1 -1
  286. package/src/lib/hasSlotController.js +5 -3
  287. package/src/lib/utils.js +35 -0
  288. package/src/styles/custom-properties.css +6 -2
  289. package/src/styles/font-definitions.json +202 -0
  290. package/stylelint.config.mjs +2 -0
  291. package/tsconfig.build.json +21 -0
  292. package/tsconfig.json +16 -0
  293. package/{web-dev-server-storybook.config.mjs → web-dev-server.config.mjs} +1 -2
  294. package/web-test-runner.config.mjs +15 -2
  295. package/dist/index.js +0 -26
package/dist/Checkbox.js CHANGED
@@ -1,7 +1,100 @@
1
- import { _ as _defineProperty, d as defineElement } from './defineElement-ba770aed.js';
1
+ import { _ as _defineProperty } from './_rollupPluginBabelHelpers-20f659f4.js';
2
2
  import { css, LitElement, html } from 'lit';
3
3
  import { I as Icon } from './icon-03e86700.js';
4
4
 
5
+ var css_248z = css`:host {
6
+ --checkbox-color: var(--leu-color-black-40);
7
+ --checkbox-color-disabled: var(--leu-color-black-20);
8
+ --checkbox-color-focus: var(--leu-color-func-cyan);
9
+
10
+ --checkbox-label-color: var(--leu-color-black-100);
11
+ --checkbox-label-color-disabled: var(--checkbox-color-disabled);
12
+
13
+ --checkbox-tick-color: var(--leu-color-black-0);
14
+
15
+ --checkbox-font-regular: var(--leu-font-family-regular);
16
+
17
+ position: relative;
18
+
19
+ display: inline-flex;
20
+ align-items: flex-start;
21
+ gap: 0.5rem;
22
+
23
+ font-family: var(--leu-font-family-regular);
24
+
25
+ font-family: var(--checkbox-font-regular);
26
+ }
27
+
28
+ .checkbox {
29
+ --_length: 1.5rem;
30
+ -webkit-appearance: none;
31
+ -moz-appearance: none;
32
+ appearance: none;
33
+ cursor: pointer;
34
+
35
+ width: 1.5rem;
36
+
37
+ width: var(--_length);
38
+ height: 1.5rem;
39
+ height: var(--_length);
40
+ margin: 0;
41
+
42
+ border: 2px solid var(--checkbox-color);
43
+ border-radius: 2px;
44
+
45
+ flex: 1 0 1.5rem;
46
+
47
+ flex: 1 0 var(--_length);
48
+
49
+ display: grid;
50
+ align-items: center;
51
+ justify-items: center;
52
+ place-items: center;
53
+ }
54
+
55
+ .checkbox:checked {
56
+ background-color: var(--checkbox-color);
57
+ }
58
+
59
+ .checkbox:checked {
60
+ --checkbox-color: var(--checkbox-color-focus);
61
+ }
62
+
63
+ .checkbox:hover, .checkbox:focus {
64
+ --checkbox-color: var(--checkbox-color-focus);
65
+ }
66
+
67
+ .checkbox:focus-visible {
68
+ outline: 2px solid var(--checkbox-color-focus);
69
+ outline-offset: 2px;
70
+ }
71
+
72
+ .checkbox:disabled {
73
+ --checkbox-color: var(--checkbox-color-disabled);
74
+ cursor: not-allowed;
75
+ }
76
+
77
+ .label {
78
+ cursor: pointer;
79
+ color: var(--checkbox-label-color);
80
+ font-size: 1rem;
81
+ line-height: 1.5;
82
+ }
83
+
84
+ .checkbox:disabled + .label {
85
+ --checkbox-label-color: var(--checkbox-label-color-disabled);
86
+ cursor: not-allowed;
87
+ }
88
+
89
+ .icon {
90
+ position: absolute;
91
+ top: 0;
92
+ left: 0;
93
+ color: var(--checkbox-tick-color);
94
+ pointer-events: none;
95
+ }
96
+ `;
97
+
5
98
  /**
6
99
  * @tagname leu-checkbox
7
100
  */
@@ -33,89 +126,12 @@ class LeuCheckbox extends LitElement {
33
126
  ?disabled=${this.disabled}
34
127
  .value=${this.value}
35
128
  />
36
- <label for=${this.identifier} class="label"><slot></slot></label>
129
+ <label for=${this.identifier} class="label">${this.label}</label>
37
130
  <div class="icon">${this.checkIcon}</div>
38
131
  `;
39
132
  }
40
133
  }
41
- _defineProperty(LeuCheckbox, "styles", css`
42
- :host {
43
- --checkbox-color: var(--leu-color-black-40);
44
- --checkbox-color-disabled: var(--leu-color-black-20);
45
- --checkbox-color-focus: var(--leu-color-func-cyan);
46
-
47
- --checkbox-label-color: var(--leu-color-black-100);
48
- --checkbox-label-color-disabled: var(--checkbox-color-disabled);
49
-
50
- --checkbox-tick-color: var(--leu-color-black-0);
51
-
52
- --checkbox-font-regular: var(--leu-font-regular);
53
-
54
- position: relative;
55
-
56
- display: inline-flex;
57
- align-items: flex-start;
58
- gap: 0.5rem;
59
-
60
- font-family: var(--checkbox-font-regular);
61
- }
62
-
63
- .checkbox {
64
- --_length: 1.5rem;
65
- appearance: none;
66
- cursor: pointer;
67
-
68
- width: var(--_length);
69
- height: var(--_length);
70
- margin: 0;
71
-
72
- border: 2px solid var(--checkbox-color);
73
- border-radius: 2px;
74
-
75
- flex: 1 0 var(--_length);
76
-
77
- display: grid;
78
- place-items: center;
79
- }
80
-
81
- .checkbox:checked {
82
- background-color: var(--checkbox-color);
83
- }
84
-
85
- .checkbox:is(:hover, :checked, :focus) {
86
- --checkbox-color: var(--checkbox-color-focus);
87
- }
88
-
89
- .checkbox:focus-visible {
90
- outline: 2px solid var(--checkbox-color-focus);
91
- outline-offset: 2px;
92
- }
93
-
94
- .checkbox:disabled {
95
- --checkbox-color: var(--checkbox-color-disabled);
96
- cursor: not-allowed;
97
- }
98
-
99
- .label {
100
- cursor: pointer;
101
- color: var(--checkbox-label-color);
102
- font-size: 1rem;
103
- line-height: 1.5;
104
- }
105
-
106
- .checkbox:disabled + .label {
107
- --checkbox-label-color: var(--checkbox-label-color-disabled);
108
- cursor: not-allowed;
109
- }
110
-
111
- .icon {
112
- position: absolute;
113
- top: 0;
114
- left: 0;
115
- color: var(--checkbox-tick-color);
116
- pointer-events: none;
117
- }
118
- `);
134
+ _defineProperty(LeuCheckbox, "styles", css_248z);
119
135
  _defineProperty(LeuCheckbox, "shadowRootOptions", {
120
136
  ...LitElement.shadowRootOptions,
121
137
  delegatesFocus: true
@@ -140,10 +156,11 @@ _defineProperty(LeuCheckbox, "properties", {
140
156
  name: {
141
157
  type: String,
142
158
  reflect: true
159
+ },
160
+ label: {
161
+ type: String,
162
+ reflect: true
143
163
  }
144
164
  });
145
- function defineCheckboxElements() {
146
- defineElement("checkbox", LeuCheckbox);
147
- }
148
165
 
149
- export { LeuCheckbox, defineCheckboxElements };
166
+ export { LeuCheckbox };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @tagname leu-checkbox-group
3
+ */
4
+ export class LeuCheckboxGroup extends LitElement {
5
+ orientation: string;
6
+ items: any[];
7
+ get value(): any[];
8
+ handleSlotChange(): void;
9
+ handleItems(): void;
10
+ render(): import("lit-html").TemplateResult<1>;
11
+ }
12
+ import { LitElement } from 'lit';
13
+ //# sourceMappingURL=CheckboxGroup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CheckboxGroup.d.ts","sourceRoot":"","sources":["CheckboxGroup.js"],"names":[],"mappings":"AAqCA;;GAEG;AACH;IAGI,oBAA+B;IAC/B,aAAe;IAEjB,mBAEC;IACD,yBAEC;IACD,oBAEC;IACD,+CAWC;CACF;2BAlEqC,KAAK"}
@@ -1,7 +1,40 @@
1
- import { _ as _defineProperty, d as defineElement } from './defineElement-ba770aed.js';
1
+ import { _ as _defineProperty } from './_rollupPluginBabelHelpers-20f659f4.js';
2
2
  import { css, LitElement, html } from 'lit';
3
3
  import { classMap } from 'lit/directives/class-map.js';
4
4
 
5
+ var css_248z = css`:host {
6
+ --group-font-regular: var(--leu-font-family-regular);
7
+ --group-font-black: var(--leu-font-family-black);
8
+
9
+ font-family: var(--leu-font-family-regular);
10
+
11
+ font-family: var(--group-font-regular);
12
+ }
13
+
14
+ .fieldset {
15
+ display: flex;
16
+ align-items: flex-start;
17
+ flex-wrap: wrap;
18
+ gap: 0.5rem 1rem;
19
+
20
+ border: none;
21
+ padding: 0;
22
+ }
23
+
24
+ .fieldset--vertical {
25
+ flex-direction: column;
26
+ gap: 1rem;
27
+ }
28
+
29
+ .legend {
30
+ font-family: var(--group-font-black);
31
+ font-size: 1.125rem;
32
+ line-height: 1.5;
33
+
34
+ margin-bottom: 0.5rem;
35
+ }
36
+ `;
37
+
5
38
  /**
6
39
  * @tagname leu-checkbox-group
7
40
  */
@@ -27,51 +60,22 @@ class LeuCheckboxGroup extends LitElement {
27
60
  };
28
61
  return html`
29
62
  <fieldset class=${classMap(fieldsetClasses)}>
30
- <legend class="legend"><slot name="legend"></slot></legend>
63
+ ${this.label ? html`<legend class="legend">${this.label}</legend>` : html``}
31
64
  <slot @slotchange=${this.handleSlotChange}></slot>
32
65
  </fieldset>
33
66
  `;
34
67
  }
35
68
  }
36
- _defineProperty(LeuCheckboxGroup, "styles", css`
37
- :host {
38
- --group-font-regular: var(--leu-font-regular);
39
- --group-font-black: var(--leu-font-black);
40
-
41
- font-family: var(--group-font-regular);
42
- }
43
-
44
- .fieldset {
45
- display: flex;
46
- align-items: flex-start;
47
- flex-wrap: wrap;
48
- gap: 0.5rem 1rem;
49
-
50
- border: none;
51
- padding: 0;
52
- }
53
-
54
- .fieldset--vertical {
55
- flex-direction: column;
56
- gap: 1rem;
57
- }
58
-
59
- .legend {
60
- font-family: var(--group-font-black);
61
- font-size: 1.125rem;
62
- line-height: 1.5;
63
-
64
- margin-bottom: 0.5rem;
65
- }
66
- `);
69
+ _defineProperty(LeuCheckboxGroup, "styles", css_248z);
67
70
  _defineProperty(LeuCheckboxGroup, "properties", {
68
71
  orientation: {
69
72
  type: String,
70
73
  reflect: true
74
+ },
75
+ label: {
76
+ type: String,
77
+ reflect: true
71
78
  }
72
79
  });
73
- function defineCheckboxGroupElements() {
74
- defineElement("checkbox-group", LeuCheckboxGroup);
75
- }
76
80
 
77
- export { LeuCheckboxGroup, defineCheckboxGroupElements };
81
+ export { LeuCheckboxGroup };
package/dist/Chip.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ export class LeuChipBase extends LitElement {
2
+ inverted: boolean;
3
+ }
4
+ import { LitElement } from 'lit';
5
+ //# sourceMappingURL=Chip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Chip.d.ts","sourceRoot":"","sources":["Chip.js"],"names":[],"mappings":"AAyJA;IAGI,kBAAqB;CAExB;2BA7J+B,KAAK"}
@@ -1,4 +1,4 @@
1
- import { _ as _defineProperty } from './defineElement-ba770aed.js';
1
+ import { _ as _defineProperty } from './_rollupPluginBabelHelpers-20f659f4.js';
2
2
  import { css, LitElement } from 'lit';
3
3
 
4
4
  var css_248z = css`:host,
@@ -23,17 +23,20 @@ var css_248z = css`:host,
23
23
  --chip-radio-background-default: var(--leu-color-black-0);
24
24
  --chip-radio-background-selected: var(--leu-color-func-cyan);
25
25
 
26
- --chip-font-regular: var(--leu-font-regular);
27
- --chip-font-black: var(--leu-font-black);
26
+ --chip-font-regular: var(--leu-font-family-regular);
27
+ --chip-font-black: var(--leu-font-family-black);
28
28
 
29
29
  --chip-background-color: var(--chip-background-color-default);
30
30
  --chip-color: var(--chip-color-default);
31
31
  --chip-radio-border: var(--chip-radio-border-default);
32
32
  --chip-radio-background: var(--chip-radio-background-default);
33
33
 
34
- font-family: var(--leu-font-regular);
34
+ font-family: var(--leu-font-family-regular);
35
35
 
36
36
  font-family: var(--chip-font-regular);
37
+
38
+ /* Allow shrinking to achieve text truncation (ellipsis) */
39
+ min-width: 0;
37
40
  }
38
41
 
39
42
  :host([inverted]) {
@@ -68,8 +71,11 @@ var css_248z = css`:host,
68
71
  cursor: pointer;
69
72
 
70
73
  display: inline-flex;
71
- align-items: center;
72
74
  gap: 0.5rem;
75
+
76
+ /* Allow shrinking to achieve text truncation (ellipsis) */
77
+ min-width: 0;
78
+ max-width: 100%;
73
79
  }
74
80
 
75
81
  .button:hover,
@@ -117,6 +123,7 @@ var css_248z = css`:host,
117
123
 
118
124
  :host([variant="radio"]) .button::before {
119
125
  content: "";
126
+ flex: 0 0 1rem;
120
127
  width: 1rem;
121
128
  height: 1rem;
122
129
  background-color: var(--chip-radio-background);
@@ -131,6 +138,10 @@ var css_248z = css`:host,
131
138
  .label {
132
139
  position: relative;
133
140
  top: -0.0625rem;
141
+
142
+ overflow: hidden;
143
+ text-overflow: ellipsis;
144
+ white-space: nowrap;
134
145
  }
135
146
 
136
147
  .icon svg {
@@ -156,7 +167,11 @@ _defineProperty(LeuChipBase, "properties", {
156
167
  inverted: {
157
168
  type: Boolean,
158
169
  reflect: true
170
+ },
171
+ label: {
172
+ type: String,
173
+ reflect: true
159
174
  }
160
175
  });
161
176
 
162
- export { LeuChipBase as L };
177
+ export { LeuChipBase };
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @slot - Place leu-chip-* elements inside this slot
3
+ * @cssproperty --leu-chip-group-gap - The gap between the chips
4
+ * @tagname leu-chip-group
5
+ */
6
+ export class LeuChipGroup extends LitElement {
7
+ items: any[];
8
+ inverted: boolean;
9
+ headingLevel: number;
10
+ label: string;
11
+ get value(): any[];
12
+ /**
13
+ * Determines the heading tag of the accordion toggle.
14
+ * The headingLevel shouldn't be used directly to render the heading tag
15
+ * in order to avoid XSS issues.
16
+ * @returns {String} The heading tag of the accordion toggle.
17
+ * @internal
18
+ */
19
+ _getHeadingTag(): string;
20
+ render(): import("lit-html").TemplateResult;
21
+ }
22
+ export namespace SELECTION_MODES {
23
+ let single: string;
24
+ let multiple: string;
25
+ let none: string;
26
+ }
27
+ import { LitElement } from 'lit';
28
+ //# sourceMappingURL=ChipGroup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChipGroup.d.ts","sourceRoot":"","sources":["ChipGroup.js"],"names":[],"mappings":"AA8BA;;;;GAIG;AACH;IAiBM,aAAkB;IAEpB,kBAAqB;IACrB,qBAAqB;IACrB,cAAe;IAajB,mBAEC;IAED;;;;;;OAMG;IACH,yBAMC;IACD,4CAeC;CACF;;;;;;2BAtG+B,KAAK"}
package/dist/ChipGroup.js CHANGED
@@ -1,10 +1,22 @@
1
- import { _ as _defineProperty, d as defineElement } from './defineElement-ba770aed.js';
2
- import { css, LitElement, html } from 'lit';
1
+ import { _ as _defineProperty } from './_rollupPluginBabelHelpers-20f659f4.js';
2
+ import { css, LitElement } from 'lit';
3
+ import { html, unsafeStatic } from 'lit/static-html.js';
3
4
 
4
- var css_248z = css`:host {
5
+ var css_248z = css`.label {
6
+ margin: 0 0 0.5rem;
7
+ font: var(--leu-t-curve-35-black-font);
8
+ color: var(--leu-color-black-100);
9
+ }
10
+
11
+ :host([inverted]) .label {
12
+ color: var(--leu-color-black-0);
13
+ }
14
+
15
+ .group {
5
16
  display: flex;
6
17
  flex-wrap: wrap;
7
18
  gap: 0.5rem;
19
+ gap: var(--leu-chip-group-gap, 0.5rem);
8
20
  }
9
21
  `;
10
22
 
@@ -18,13 +30,12 @@ const SELECTION_MODES = {
18
30
 
19
31
  /**
20
32
  * @slot - Place leu-chip-* elements inside this slot
33
+ * @cssproperty --leu-chip-group-gap - The gap between the chips
21
34
  * @tagname leu-chip-group
22
35
  */
23
36
  class LeuChipGroup extends LitElement {
24
37
  constructor() {
25
38
  super();
26
-
27
- /** @internal */
28
39
  /** @internal */
29
40
  _defineProperty(this, "handleInput", e => {
30
41
  if (this.selectionMode === SELECTION_MODES.single) {
@@ -41,6 +52,11 @@ class LeuChipGroup extends LitElement {
41
52
  });
42
53
  this.items = items;
43
54
  });
55
+ this.inverted = false;
56
+ this.headingLevel = 2;
57
+ this.label = "";
58
+
59
+ /** @internal */
44
60
  this.items = [];
45
61
  }
46
62
  connectedCallback() {
@@ -54,20 +70,58 @@ class LeuChipGroup extends LitElement {
54
70
  get value() {
55
71
  return this.items.filter(i => i.selected).map(i => i.value);
56
72
  }
73
+
74
+ /**
75
+ * Determines the heading tag of the accordion toggle.
76
+ * The headingLevel shouldn't be used directly to render the heading tag
77
+ * in order to avoid XSS issues.
78
+ * @returns {String} The heading tag of the accordion toggle.
79
+ * @internal
80
+ */
81
+ _getHeadingTag() {
82
+ let level = 2;
83
+ if (this.headingLevel > 0 && this.headingLevel < 7) {
84
+ level = this.headingLevel;
85
+ }
86
+ return `h${level}`;
87
+ }
57
88
  render() {
58
- return html`<slot @slotchange=${this.handleSlotChange}></slot>`;
89
+ const hTag = this._getHeadingTag();
90
+
91
+ /* The eslint rules don't recognize html import from lit/static-html.js */
92
+ /* eslint-disable lit/binding-positions, lit/no-invalid-html */
93
+ return html`
94
+ ${this.label ? html`<${unsafeStatic(hTag)} class="label">
95
+ <span class="label">${this.label}</span>
96
+ </${unsafeStatic(hTag)}>` : ""}
97
+ <slot
98
+ class="group"
99
+ part="group"
100
+ @slotchange=${this.handleSlotChange}
101
+ ></slot>
102
+ `;
59
103
  }
60
104
  }
61
105
  _defineProperty(LeuChipGroup, "styles", css_248z);
62
106
  _defineProperty(LeuChipGroup, "properties", {
107
+ inverted: {
108
+ type: Boolean,
109
+ reflect: true
110
+ },
63
111
  selectionMode: {
64
112
  type: String,
65
113
  attribute: "selection-mode",
66
114
  reflect: true
115
+ },
116
+ headingLevel: {
117
+ type: Number,
118
+ attribute: "heading-level",
119
+ reflect: true
120
+ },
121
+ label: {
122
+ type: String,
123
+ reflect: true
67
124
  }
68
125
  });
69
- function defineChipGroupElements() {
70
- defineElement("chip-group", LeuChipGroup);
71
- }
72
126
 
73
- export { LeuChipGroup, SELECTION_MODES, defineChipGroupElements };
127
+ export { LeuChipGroup, SELECTION_MODES };
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @slot - The content of the chip
3
+ * @tagname leu-chip-link
4
+ */
5
+ export class LeuChipLink extends LeuChipBase {
6
+ size: string;
7
+ href: string;
8
+ render(): import("lit-html").TemplateResult<1>;
9
+ }
10
+ export namespace SIZES {
11
+ let regular: string;
12
+ let large: string;
13
+ }
14
+ import { LeuChipBase } from './Chip.js';
15
+ //# sourceMappingURL=ChipLink.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChipLink.d.ts","sourceRoot":"","sources":["ChipLink.js"],"names":[],"mappings":"AASA;;;GAGG;AACH;IAII,aAAyB;IACzB,aAAc;IAEhB,+CAIC;CACF;;;;;4BAvB2B,WAAW"}
package/dist/ChipLink.js CHANGED
@@ -1,6 +1,6 @@
1
- import { _ as _defineProperty, d as defineElement } from './defineElement-ba770aed.js';
1
+ import { _ as _defineProperty } from './_rollupPluginBabelHelpers-20f659f4.js';
2
2
  import { html } from 'lit';
3
- import { L as LeuChipBase } from './Chip-5f70d04f.js';
3
+ import { LeuChipBase } from './Chip.js';
4
4
 
5
5
  const SIZES = {
6
6
  regular: "regular",
@@ -20,7 +20,7 @@ class LeuChipLink extends LeuChipBase {
20
20
  }
21
21
  render() {
22
22
  return html`<a href=${this.href} class="button">
23
- <span class="label"><slot></slot></span>
23
+ <span class="label">${this.label}</span>
24
24
  </a>`;
25
25
  }
26
26
  }
@@ -39,8 +39,5 @@ _defineProperty(LeuChipLink, "properties", {
39
39
  reflect: true
40
40
  }
41
41
  });
42
- function defineChipLinkElements() {
43
- defineElement("chip-link", LeuChipLink);
44
- }
45
42
 
46
- export { LeuChipLink, SIZES, defineChipLinkElements };
43
+ export { LeuChipLink, SIZES };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @slot - The content of the chip
3
+ * @tagname leu-chip-removable
4
+ * @fires remove - Dispatched when the user clicks on the chip
5
+ */
6
+ export class LeuChipRemovable extends LeuChipBase {
7
+ /** @internal */
8
+ _removeIcon: import("lit-html").TemplateResult<1>;
9
+ handleClick(): void;
10
+ render(): import("lit-html").TemplateResult<1>;
11
+ }
12
+ import { LeuChipBase } from './Chip.js';
13
+ //# sourceMappingURL=ChipRemovable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChipRemovable.d.ts","sourceRoot":"","sources":["ChipRemovable.js"],"names":[],"mappings":"AAKA;;;;GAIG;AACH;IAII,gBAAgB;IAChB,kDAAoC;IAEtC,oBAMC;IACD,+CAKC;CACF;4BA5B2B,WAAW"}
@@ -1,6 +1,6 @@
1
- import { _ as _defineProperty, d as defineElement } from './defineElement-ba770aed.js';
1
+ import { _ as _defineProperty } from './_rollupPluginBabelHelpers-20f659f4.js';
2
2
  import { html } from 'lit';
3
- import { L as LeuChipBase } from './Chip-5f70d04f.js';
3
+ import { LeuChipBase } from './Chip.js';
4
4
  import { I as Icon } from './icon-03e86700.js';
5
5
 
6
6
  /**
@@ -16,7 +16,7 @@ class LeuChipRemovable extends LeuChipBase {
16
16
  this._removeIcon = Icon("close", 16);
17
17
  }
18
18
  handleClick() {
19
- const customEvent = new CustomEvent("remove", {
19
+ const customEvent = new CustomEvent("leu:remove", {
20
20
  bubble: true,
21
21
  composed: true
22
22
  });
@@ -24,7 +24,7 @@ class LeuChipRemovable extends LeuChipBase {
24
24
  }
25
25
  render() {
26
26
  return html`<button @click=${e => this.handleClick(e)} class="button">
27
- <span class="label"><slot></slot></span>
27
+ <span class="label">${this.label}</span>
28
28
  <div class="icon">${this._removeIcon}</div>
29
29
  </button>`;
30
30
  }
@@ -32,8 +32,5 @@ class LeuChipRemovable extends LeuChipBase {
32
32
  _defineProperty(LeuChipRemovable, "properties", {
33
33
  ...LeuChipBase.properties
34
34
  });
35
- function defineChipRemovableElements() {
36
- defineElement("chip-removable", LeuChipRemovable);
37
- }
38
35
 
39
- export { LeuChipRemovable, defineChipRemovableElements };
36
+ export { LeuChipRemovable };
@@ -0,0 +1,22 @@
1
+ /**
2
+ * A chip component that can be selected.
3
+ * @slot - The content of the chip
4
+ * @tagname leu-chip-selectable
5
+ */
6
+ export class LeuChipSelectable extends LeuChipBase {
7
+ size: string;
8
+ variant: string;
9
+ selected: boolean;
10
+ handleClick(): void;
11
+ render(): import("lit-html").TemplateResult<1>;
12
+ }
13
+ export namespace SIZES {
14
+ let small: string;
15
+ let regular: string;
16
+ }
17
+ export namespace VARIANTS {
18
+ let toggle: string;
19
+ let radio: string;
20
+ }
21
+ import { LeuChipBase } from './Chip.js';
22
+ //# sourceMappingURL=ChipSelectable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChipSelectable.d.ts","sourceRoot":"","sources":["ChipSelectable.js"],"names":[],"mappings":"AAaA;;;;GAIG;AACH;IAGI,aAAyB;IACzB,gBAA8B;IAC9B,kBAAqB;IAKvB,oBAiBC;IACD,+CAQC;CACF;;;;;;;;;4BArD2B,WAAW"}