@statistikzh/leu 0.22.0 → 0.23.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 (199) hide show
  1. package/.github/workflows/release-please.yml +1 -2
  2. package/.nvmrc +1 -1
  3. package/.release-please-manifest.json +1 -1
  4. package/CHANGELOG.md +16 -0
  5. package/README.md +15 -10
  6. package/dist/Accordion.js +1 -1
  7. package/dist/Button.d.ts +1 -1
  8. package/dist/Button.js +1 -1
  9. package/dist/ButtonGroup.js +1 -1
  10. package/dist/ChartWrapper.js +1 -1
  11. package/dist/Checkbox.d.ts +1 -1
  12. package/dist/Checkbox.js +1 -1
  13. package/dist/CheckboxGroup.js +1 -1
  14. package/dist/Chip.d.ts +1 -7
  15. package/dist/Chip.js +7 -5
  16. package/dist/ChipGroup.d.ts +17 -36
  17. package/dist/ChipGroup.js +35 -33
  18. package/dist/ChipLink.d.ts +5 -21
  19. package/dist/ChipLink.js +14 -15
  20. package/dist/ChipRemovable.d.ts +4 -15
  21. package/dist/ChipRemovable.js +7 -9
  22. package/dist/ChipSelectable.d.ts +14 -37
  23. package/dist/ChipSelectable.js +24 -28
  24. package/dist/Dialog.d.ts +7 -18
  25. package/dist/Dialog.js +15 -18
  26. package/dist/Dropdown.d.ts +16 -28
  27. package/dist/Dropdown.js +22 -23
  28. package/dist/FileInput.d.ts +2 -1
  29. package/dist/FileInput.js +19 -5
  30. package/dist/Icon.d-itcQ94ym.d.ts +151 -0
  31. package/dist/Icon.d.ts +4 -156
  32. package/dist/Icon.js +1 -4
  33. package/dist/Input.d.ts +73 -141
  34. package/dist/Input.js +91 -88
  35. package/dist/{LeuElement-BooZrClI.js → LeuElement-CWseJvWv.js} +1 -1
  36. package/dist/Menu.d.ts +2 -8
  37. package/dist/Menu.js +7 -9
  38. package/dist/MenuItem.d.ts +31 -59
  39. package/dist/MenuItem.js +30 -33
  40. package/dist/Message.d.ts +1 -1
  41. package/dist/Message.js +1 -1
  42. package/dist/Pagination.d.ts +1 -1
  43. package/dist/Pagination.js +1 -1
  44. package/dist/Placeholder.js +1 -1
  45. package/dist/Popup.d.ts +16 -0
  46. package/dist/Popup.js +20 -2
  47. package/dist/ProgressBar.js +1 -1
  48. package/dist/Radio.js +1 -1
  49. package/dist/RadioGroup.js +1 -1
  50. package/dist/Range.d.ts +22 -65
  51. package/dist/Range.js +36 -37
  52. package/dist/ScrollTop.d.ts +5 -7
  53. package/dist/ScrollTop.js +10 -15
  54. package/dist/Select.d.ts +2 -1
  55. package/dist/Select.js +1 -1
  56. package/dist/Spinner.js +1 -1
  57. package/dist/Table.d.ts +1 -1
  58. package/dist/Table.js +1 -1
  59. package/dist/Tag.js +1 -1
  60. package/dist/VisuallyHidden.js +1 -1
  61. package/dist/components/chart-wrapper/leu-chart-wrapper.d.ts +5 -0
  62. package/dist/components/chart-wrapper/leu-chart-wrapper.d.ts.map +1 -1
  63. package/dist/components/chip/Chip.d.ts +1 -7
  64. package/dist/components/chip/Chip.d.ts.map +1 -1
  65. package/dist/components/chip/ChipGroup.d.ts +15 -35
  66. package/dist/components/chip/ChipGroup.d.ts.map +1 -1
  67. package/dist/components/chip/ChipLink.d.ts +4 -20
  68. package/dist/components/chip/ChipLink.d.ts.map +1 -1
  69. package/dist/components/chip/ChipRemovable.d.ts +3 -14
  70. package/dist/components/chip/ChipRemovable.d.ts.map +1 -1
  71. package/dist/components/chip/ChipSelectable.d.ts +13 -36
  72. package/dist/components/chip/ChipSelectable.d.ts.map +1 -1
  73. package/dist/components/chip/stories/chip-group.stories.d.ts +1 -1
  74. package/dist/components/chip/stories/chip-group.stories.d.ts.map +1 -1
  75. package/dist/components/chip/stories/chip-link.stories.d.ts.map +1 -1
  76. package/dist/components/chip/stories/chip-selectable.stories.d.ts.map +1 -1
  77. package/dist/components/dialog/Dialog.d.ts +5 -17
  78. package/dist/components/dialog/Dialog.d.ts.map +1 -1
  79. package/dist/components/dropdown/Dropdown.d.ts +14 -27
  80. package/dist/components/dropdown/Dropdown.d.ts.map +1 -1
  81. package/dist/components/file-input/FileInput.d.ts +1 -0
  82. package/dist/components/file-input/FileInput.d.ts.map +1 -1
  83. package/dist/components/file-input/leu-file-input.d.ts +5 -0
  84. package/dist/components/file-input/leu-file-input.d.ts.map +1 -1
  85. package/dist/components/file-input/stories/file-input.stories.d.ts +4 -0
  86. package/dist/components/file-input/stories/file-input.stories.d.ts.map +1 -1
  87. package/dist/components/icon/Icon.d.ts +0 -6
  88. package/dist/components/icon/Icon.d.ts.map +1 -1
  89. package/dist/components/input/Input.d.ts +73 -140
  90. package/dist/components/input/Input.d.ts.map +1 -1
  91. package/dist/components/menu/Menu.d.ts +1 -7
  92. package/dist/components/menu/Menu.d.ts.map +1 -1
  93. package/dist/components/menu/MenuItem.d.ts +30 -57
  94. package/dist/components/menu/MenuItem.d.ts.map +1 -1
  95. package/dist/components/message/leu-message.d.ts +5 -0
  96. package/dist/components/message/leu-message.d.ts.map +1 -1
  97. package/dist/components/placeholder/leu-placeholder.d.ts +5 -0
  98. package/dist/components/placeholder/leu-placeholder.d.ts.map +1 -1
  99. package/dist/components/popup/Popup.d.ts +16 -0
  100. package/dist/components/popup/Popup.d.ts.map +1 -1
  101. package/dist/components/popup/stories/popup.stories.d.ts +2 -0
  102. package/dist/components/popup/stories/popup.stories.d.ts.map +1 -1
  103. package/dist/components/progress-bar/leu-progress-bar.d.ts +5 -0
  104. package/dist/components/progress-bar/leu-progress-bar.d.ts.map +1 -1
  105. package/dist/components/range/Range.d.ts +22 -65
  106. package/dist/components/range/Range.d.ts.map +1 -1
  107. package/dist/components/scroll-top/ScrollTop.d.ts +4 -6
  108. package/dist/components/scroll-top/ScrollTop.d.ts.map +1 -1
  109. package/dist/components/tag/leu-tag.d.ts +5 -0
  110. package/dist/components/tag/leu-tag.d.ts.map +1 -1
  111. package/dist/index.d.ts +11 -0
  112. package/dist/index.d.ts.map +1 -1
  113. package/dist/index.js +13 -4
  114. package/dist/leu-accordion.js +1 -1
  115. package/dist/leu-button-group.js +1 -1
  116. package/dist/leu-button.d.ts +1 -1
  117. package/dist/leu-button.js +1 -1
  118. package/dist/leu-chart-wrapper.d.ts +10 -1
  119. package/dist/leu-chart-wrapper.js +1 -1
  120. package/dist/leu-checkbox-group.js +1 -1
  121. package/dist/leu-checkbox.d.ts +1 -1
  122. package/dist/leu-checkbox.js +1 -1
  123. package/dist/leu-chip-group.d.ts +2 -0
  124. package/dist/leu-chip-group.js +5 -1
  125. package/dist/leu-chip-link.js +3 -1
  126. package/dist/leu-chip-removable.d.ts +1 -1
  127. package/dist/leu-chip-removable.js +3 -3
  128. package/dist/leu-chip-selectable.js +3 -1
  129. package/dist/leu-dialog.d.ts +2 -1
  130. package/dist/leu-dialog.js +3 -3
  131. package/dist/leu-dropdown.d.ts +2 -1
  132. package/dist/leu-dropdown.js +3 -3
  133. package/dist/leu-file-input.d.ts +11 -2
  134. package/dist/leu-file-input.js +11 -4
  135. package/dist/leu-icon.d.ts +1 -1
  136. package/dist/leu-icon.js +1 -1
  137. package/dist/leu-input.d.ts +2 -1
  138. package/dist/leu-input.js +3 -3
  139. package/dist/leu-menu-item.d.ts +2 -2
  140. package/dist/leu-menu-item.js +3 -3
  141. package/dist/leu-menu.d.ts +1 -1
  142. package/dist/leu-menu.js +3 -3
  143. package/dist/leu-message.d.ts +11 -2
  144. package/dist/leu-message.js +1 -1
  145. package/dist/leu-pagination.d.ts +1 -1
  146. package/dist/leu-pagination.js +1 -1
  147. package/dist/leu-placeholder.d.ts +10 -1
  148. package/dist/leu-placeholder.js +1 -1
  149. package/dist/leu-popup.js +1 -1
  150. package/dist/leu-progress-bar.d.ts +10 -1
  151. package/dist/leu-progress-bar.js +1 -1
  152. package/dist/leu-radio-group.js +1 -1
  153. package/dist/leu-radio.js +1 -1
  154. package/dist/leu-range.js +3 -1
  155. package/dist/leu-scroll-top.d.ts +1 -1
  156. package/dist/leu-scroll-top.js +3 -3
  157. package/dist/leu-select.d.ts +2 -1
  158. package/dist/leu-select.js +1 -1
  159. package/dist/leu-spinner.js +1 -1
  160. package/dist/leu-table.d.ts +1 -1
  161. package/dist/leu-table.js +1 -1
  162. package/dist/leu-tag.d.ts +10 -1
  163. package/dist/leu-tag.js +1 -1
  164. package/dist/leu-visually-hidden.js +1 -1
  165. package/dist/vscode.html-custom-data.json +106 -88
  166. package/dist/vue/index.d.ts +105 -115
  167. package/dist/web-types.json +268 -243
  168. package/package.json +1 -1
  169. package/scripts/generate-component/templates/[namespace]-[name].ts +6 -0
  170. package/src/components/chart-wrapper/leu-chart-wrapper.ts +6 -0
  171. package/src/components/chip/Chip.ts +3 -9
  172. package/src/components/chip/ChipGroup.ts +26 -39
  173. package/src/components/chip/ChipLink.ts +7 -18
  174. package/src/components/chip/ChipRemovable.ts +4 -11
  175. package/src/components/chip/ChipSelectable.ts +21 -35
  176. package/src/components/chip/stories/chip-group.stories.ts +4 -7
  177. package/src/components/chip/stories/chip-link.stories.ts +2 -4
  178. package/src/components/chip/stories/chip-selectable.stories.ts +4 -6
  179. package/src/components/chip/test/chip-group.test.ts +34 -31
  180. package/src/components/dialog/Dialog.ts +9 -22
  181. package/src/components/dropdown/Dropdown.ts +19 -26
  182. package/src/components/file-input/FileInput.ts +12 -1
  183. package/src/components/file-input/leu-file-input.ts +6 -0
  184. package/src/components/file-input/stories/file-input.stories.ts +7 -0
  185. package/src/components/icon/Icon.ts +0 -4
  186. package/src/components/input/Input.ts +108 -105
  187. package/src/components/menu/Menu.ts +3 -12
  188. package/src/components/menu/MenuItem.ts +37 -41
  189. package/src/components/message/leu-message.ts +6 -0
  190. package/src/components/placeholder/leu-placeholder.ts +6 -0
  191. package/src/components/popup/Popup.ts +37 -0
  192. package/src/components/popup/stories/popup.stories.ts +10 -0
  193. package/src/components/popup/test/popup.test.ts +27 -0
  194. package/src/components/progress-bar/leu-progress-bar.ts +6 -0
  195. package/src/components/range/Range.ts +51 -59
  196. package/src/components/scroll-top/ScrollTop.ts +8 -15
  197. package/src/components/tag/leu-tag.ts +6 -0
  198. package/src/index.ts +11 -0
  199. package/web-test-runner.config.mjs +10 -0
@@ -4,6 +4,7 @@ on:
4
4
  - main
5
5
 
6
6
  permissions:
7
+ id-token: write
7
8
  contents: write
8
9
  pull-requests: write
9
10
 
@@ -33,6 +34,4 @@ jobs:
33
34
  - run: npm run build
34
35
  if: ${{ steps.release.outputs.release_created }}
35
36
  - run: npm publish --access public
36
- env:
37
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
38
37
  if: ${{ steps.release.outputs.release_created }}
package/.nvmrc CHANGED
@@ -1 +1 @@
1
- v20.9.0
1
+ v24
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "0.22.0"
2
+ ".": "0.23.0"
3
3
  }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.23.0](https://github.com/statistikZH/leu/compare/leu-v0.22.1...leu-v0.23.0) (2026-01-20)
4
+
5
+
6
+ ### Features
7
+
8
+ * **popup:** add offset properties to translate the popup content ([#324](https://github.com/statistikZH/leu/issues/324)) ([1e71bf0](https://github.com/statistikZH/leu/commit/1e71bf061bb940156dd0a24a71243db093d7bd49))
9
+
10
+ ## [0.22.1](https://github.com/statistikZH/leu/compare/leu-v0.22.0...leu-v0.22.1) (2025-12-17)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **exports:** add missing exports ([1d5a3a4](https://github.com/statistikZH/leu/commit/1d5a3a4099982e594baf41acf124f9f7d0b2c355))
16
+ * **file-input:** dispatch change and input events on drop ([#319](https://github.com/statistikZH/leu/issues/319)) ([5e83629](https://github.com/statistikZH/leu/commit/5e836290c2368a958154eeb7451cf9e59ccb908a))
17
+ * **types:** add missing HTMLElementTagNameMap definitions ([1d5a3a4](https://github.com/statistikZH/leu/commit/1d5a3a4099982e594baf41acf124f9f7d0b2c355))
18
+
3
19
  ## [0.22.0](https://github.com/statistikZH/leu/compare/leu-v0.21.1...leu-v0.22.0) (2025-11-18)
4
20
 
5
21
 
package/README.md CHANGED
@@ -4,13 +4,15 @@
4
4
 
5
5
  A UI component library based on the [design system](https://www.zh.ch/de/webangebote-entwickeln-und-gestalten.html) of the canton of zurich.
6
6
 
7
- ## ⚠️ This project is still in alpha state
7
+ ## ⚠️ Active development
8
8
 
9
- This package is still in alpha state. It is not recommended to use it in production yet.
9
+ This library hasn't had a major release yet. Therefore, all minor releases may include breaking changes.
10
+ Check the [changelog](CHANGELOG.md) for details on the changes made.
11
+ If you plan to use this library in production, please get [in touch with us](#contact).
10
12
 
11
13
  ## Prerequisites
12
14
 
13
- Node.js > v18.0.0
15
+ Node.js > v20.9.0
14
16
 
15
17
  ## Installation
16
18
 
@@ -20,9 +22,12 @@ npm i @statistikzh/leu
20
22
 
21
23
  ## Usage
22
24
 
25
+ The [storybook](https://statistikzh.github.io/leu/) contains a in depth guide to install the library and
26
+ a comprehensive overview of all components and their usage.
27
+
23
28
  In order for the components to work, you need to load the theme styles and the font definitions globally.
24
29
  The theme file is part of the package (`dist/theme.css`).
25
- The fonts on the other hand have to be licensed and are therefore not included in the package.
30
+ The fonts on the other hand have to be licensed and are therefore not included in this package.
26
31
 
27
32
  If you have an environment that resolves bare module imports, you can use the library like this:
28
33
 
@@ -32,25 +37,25 @@ If you have an environment that resolves bare module imports, you can use the li
32
37
  import "@statistikzh/leu/leu-input.js"
33
38
  </script>
34
39
 
35
- <leu-input></leu-input>
40
+ <leu-input label="Repository" type="text" value="@statistikzh/leu"></leu-input>
36
41
  ```
37
42
 
38
43
  ### CDN
39
44
 
40
45
  Browsers can't resolve bare module imports without import maps. But we can use a CDN to resolve the imports for us.
41
46
  This is useful if you're just using plain HTML and JavaScript without any build or transformation steps.
42
- Also this is applicable in an environment like [Observable](https://observablehq.com).
47
+ This is also applicable in an environment like [Observable](https://observablehq.com).
43
48
 
44
49
  ```html
45
50
  <link
46
51
  rel="stylesheet"
47
- href="https://esm.run/@statistikzh/leu@0.1/dist/theme.css"
52
+ href="https://esm.sh/@statistikzh/leu@0.22.0/dist/theme.css"
48
53
  />
49
54
  <script type="module">
50
- import "https://esm.run/@statistikzh/leu@0.1/dist/leu-input.js"
55
+ import "https://esm.sh/@statistikzh/leu@0.22.0/leu-input.js"
51
56
  </script>
52
57
 
53
- <leu-input></leu-input>
58
+ <leu-input label="Repository" type="text" value="@statistikzh/leu"></leu-input>
54
59
  ```
55
60
 
56
61
  ## Linting and formatting
@@ -112,7 +117,7 @@ dan.bueschlen@statistik.ji.zh.ch <br>
112
117
 
113
118
  This project uses the following license: <br>
114
119
 
115
- - Code license: [Copyright (c) <2024> <Statistisches Amt Kanton Zürich>](LICENSE)
120
+ - Code license: [Copyright (c) <2025> <Statistisches Amt Kanton Zürich>](LICENSE)
116
121
 
117
122
  ## Guidelines for contributing
118
123
 
package/dist/Accordion.js CHANGED
@@ -2,7 +2,7 @@ import { _ as __decorate } from './_tslib-CNEFicEt.js';
2
2
  import { css, nothing } from 'lit';
3
3
  import { unsafeStatic, html } from 'lit/static-html.js';
4
4
  import { property } from 'lit/decorators.js';
5
- import { L as LeuElement } from './LeuElement-BooZrClI.js';
5
+ import { L as LeuElement } from './LeuElement-CWseJvWv.js';
6
6
 
7
7
  var css_248z = css`:host {
8
8
  --accordion-font-regular: var(--leu-font-family-regular);
package/dist/Button.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as lit_html from 'lit-html';
2
2
  import * as lit from 'lit';
3
- import { LeuIcon } from './Icon.js';
3
+ import { L as LeuIcon } from './Icon.d-itcQ94ym.js';
4
4
  import { L as LeuElement } from './LeuElement.d-BevHqLUu.js';
5
5
 
6
6
  /**
package/dist/Button.js CHANGED
@@ -4,7 +4,7 @@ import { classMap } from 'lit/directives/class-map.js';
4
4
  import { ifDefined } from 'lit/directives/if-defined.js';
5
5
  import { property } from 'lit/decorators.js';
6
6
  import { LeuIcon } from './Icon.js';
7
- import { L as LeuElement } from './LeuElement-BooZrClI.js';
7
+ import { L as LeuElement } from './LeuElement-CWseJvWv.js';
8
8
  import { H as HasSlotController } from './hasSlotController-Bm2tipvG.js';
9
9
 
10
10
  /**
@@ -1,5 +1,5 @@
1
1
  import { css, html } from 'lit';
2
- import { L as LeuElement } from './LeuElement-BooZrClI.js';
2
+ import { L as LeuElement } from './LeuElement-CWseJvWv.js';
3
3
  import { LeuButton } from './Button.js';
4
4
  import './_tslib-CNEFicEt.js';
5
5
  import 'lit/directives/class-map.js';
@@ -1,7 +1,7 @@
1
1
  import { _ as __decorate } from './_tslib-CNEFicEt.js';
2
2
  import { css, nothing, html } from 'lit';
3
3
  import { property } from 'lit/decorators.js';
4
- import { L as LeuElement } from './LeuElement-BooZrClI.js';
4
+ import { L as LeuElement } from './LeuElement-CWseJvWv.js';
5
5
  import { H as HasSlotController } from './hasSlotController-Bm2tipvG.js';
6
6
  import { LeuSpinner } from './Spinner.js';
7
7
 
@@ -1,7 +1,7 @@
1
1
  import * as lit_html from 'lit-html';
2
2
  import * as lit from 'lit';
3
3
  import { L as LeuElement } from './LeuElement.d-BevHqLUu.js';
4
- import { LeuIcon } from './Icon.js';
4
+ import { L as LeuIcon } from './Icon.d-itcQ94ym.js';
5
5
 
6
6
  /**
7
7
  * @tagname leu-checkbox
package/dist/Checkbox.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { _ as __decorate } from './_tslib-CNEFicEt.js';
2
2
  import { css, html } from 'lit';
3
3
  import { property } from 'lit/decorators.js';
4
- import { L as LeuElement } from './LeuElement-BooZrClI.js';
4
+ import { L as LeuElement } from './LeuElement-CWseJvWv.js';
5
5
  import { LeuIcon } from './Icon.js';
6
6
 
7
7
  var css_248z = css`:host {
@@ -2,7 +2,7 @@ import { _ as __decorate } from './_tslib-CNEFicEt.js';
2
2
  import { css, html } from 'lit';
3
3
  import { classMap } from 'lit/directives/class-map.js';
4
4
  import { property } from 'lit/decorators.js';
5
- import { L as LeuElement } from './LeuElement-BooZrClI.js';
5
+ import { L as LeuElement } from './LeuElement-CWseJvWv.js';
6
6
  import { LeuCheckbox } from './Checkbox.js';
7
7
  import './Icon.js';
8
8
 
package/dist/Chip.d.ts CHANGED
@@ -12,13 +12,7 @@ declare class LeuChipBase extends LeuElement {
12
12
  customElements?: CustomElementRegistry;
13
13
  registry?: CustomElementRegistry;
14
14
  };
15
- static properties: {
16
- inverted: {
17
- type: BooleanConstructor;
18
- reflect: boolean;
19
- };
20
- };
21
- constructor();
15
+ inverted: boolean;
22
16
  }
23
17
 
24
18
  export { LeuChipBase };
package/dist/Chip.js CHANGED
@@ -1,4 +1,6 @@
1
- import { L as LeuElement } from './LeuElement-BooZrClI.js';
1
+ import { _ as __decorate } from './_tslib-CNEFicEt.js';
2
+ import { property } from 'lit/decorators.js';
3
+ import { L as LeuElement } from './LeuElement-CWseJvWv.js';
2
4
  import { css } from 'lit';
3
5
 
4
6
  var css_248z = css`:host *::before,
@@ -148,7 +150,7 @@ var css_248z = css`:host *::before,
148
150
  /* Design: https://www.figma.com/file/d6Pv21UVUbnBs3AdcZijHmbN/KTZH-Design-System?type=design&node-id=21161-184433&mode=design&t=Kjo5VDiqivihn8dh-11 */
149
151
  class LeuChipBase extends LeuElement {
150
152
  constructor() {
151
- super();
153
+ super(...arguments);
152
154
  this.inverted = false;
153
155
  }
154
156
  }
@@ -158,8 +160,8 @@ LeuChipBase.shadowRootOptions = {
158
160
  ...LeuElement.shadowRootOptions,
159
161
  delegatesFocus: true,
160
162
  };
161
- LeuChipBase.properties = {
162
- inverted: { type: Boolean, reflect: true },
163
- };
163
+ __decorate([
164
+ property({ type: Boolean, reflect: true })
165
+ ], LeuChipBase.prototype, "inverted", void 0);
164
166
 
165
167
  export { LeuChipBase };
@@ -1,12 +1,9 @@
1
1
  import * as lit_html from 'lit-html';
2
2
  import * as lit from 'lit';
3
3
  import { L as LeuElement } from './LeuElement.d-BevHqLUu.js';
4
+ import { LeuChipSelectable } from './ChipSelectable.js';
5
+ import './Chip.js';
4
6
 
5
- declare const SELECTION_MODES: Readonly<{
6
- single: "single";
7
- multiple: "multiple";
8
- none: "none";
9
- }>;
10
7
  /**
11
8
  * @slot - Place leu-chip-* elements inside this slot
12
9
  * @cssproperty --leu-chip-group-gap - The gap between the chips
@@ -14,49 +11,33 @@ declare const SELECTION_MODES: Readonly<{
14
11
  */
15
12
  declare class LeuChipGroup extends LeuElement {
16
13
  static styles: lit.CSSResultGroup[];
17
- static properties: {
18
- inverted: {
19
- type: BooleanConstructor;
20
- reflect: boolean;
21
- };
22
- selectionMode: {
23
- type: StringConstructor;
24
- attribute: string;
25
- reflect: boolean;
26
- };
27
- headingLevel: {
28
- type: NumberConstructor;
29
- attribute: string;
30
- reflect: boolean;
31
- };
32
- label: {
33
- type: StringConstructor;
34
- reflect: boolean;
35
- };
36
- };
37
- constructor();
14
+ inverted: boolean;
15
+ selectionMode: "single" | "multiple" | "none";
16
+ headingLevel: number;
17
+ label: string;
18
+ protected selectableItems: Array<LeuChipSelectable>;
38
19
  connectedCallback(): void;
39
20
  disconnectedCallback(): void;
40
- get value(): any;
21
+ get value(): string[];
41
22
  /**
42
23
  * Checks the items with the given values.
43
24
  * If the selectionMode is single, only the first item with the given value is checked.
44
- * @param {string[]} valueList
45
25
  */
46
- set value(valueList: any);
26
+ set value(valueList: string[]);
47
27
  /**
48
28
  * Determines the heading tag of the accordion toggle.
49
29
  * The headingLevel shouldn't be used directly to render the heading tag
50
30
  * in order to avoid XSS issues.
51
- * @returns {String} The heading tag of the accordion toggle.
52
31
  * @internal
53
32
  */
54
- _getHeadingTag(): string;
55
- /** @internal */
56
- handleInput: (e: any) => void;
57
- /** @internal */
58
- handleSlotChange: (e: any) => void;
33
+ protected _getHeadingTag(): string;
34
+ protected handleInput: (e: Event & {
35
+ target: LeuChipSelectable;
36
+ }) => void;
37
+ protected handleSlotChange: (e: Event & {
38
+ target: HTMLSlotElement;
39
+ }) => void;
59
40
  render(): lit_html.TemplateResult;
60
41
  }
61
42
 
62
- export { LeuChipGroup, SELECTION_MODES };
43
+ export { LeuChipGroup };
package/dist/ChipGroup.js CHANGED
@@ -1,6 +1,10 @@
1
+ import { _ as __decorate } from './_tslib-CNEFicEt.js';
1
2
  import { unsafeStatic, html } from 'lit/static-html.js';
2
- import { L as LeuElement } from './LeuElement-BooZrClI.js';
3
+ import { property } from 'lit/decorators.js';
4
+ import { L as LeuElement } from './LeuElement-CWseJvWv.js';
3
5
  import { css } from 'lit';
6
+ import { LeuChipSelectable } from './ChipSelectable.js';
7
+ import './Chip.js';
4
8
 
5
9
  var css_248z = css`.label {
6
10
  margin: 0 0 0.5rem;
@@ -20,12 +24,6 @@ var css_248z = css`.label {
20
24
  }
21
25
  `;
22
26
 
23
- /* Figma https://www.figma.com/file/d6Pv21UVUbnBs3AdcZijHmbN/KTZH-Design-System?type=design&node-id=131766-248643&mode=design&t=Kjo5VDiqivihn8dh-11 */
24
- const SELECTION_MODES = Object.freeze({
25
- single: "single",
26
- multiple: "multiple",
27
- none: "none",
28
- });
29
27
  /**
30
28
  * @slot - Place leu-chip-* elements inside this slot
31
29
  * @cssproperty --leu-chip-group-gap - The gap between the chips
@@ -33,28 +31,26 @@ const SELECTION_MODES = Object.freeze({
33
31
  */
34
32
  class LeuChipGroup extends LeuElement {
35
33
  constructor() {
36
- super();
37
- /** @internal */
34
+ super(...arguments);
35
+ this.inverted = false;
36
+ this.selectionMode = "none";
37
+ this.headingLevel = 2;
38
+ this.label = "";
39
+ this.selectableItems = [];
38
40
  this.handleInput = (e) => {
39
- if (this.selectionMode === SELECTION_MODES.single) {
40
- this.items.forEach((item) => {
41
+ if (this.selectionMode === "single") {
42
+ this.selectableItems.forEach((item) => {
41
43
  item.checked = item === e.target; // eslint-disable-line no-param-reassign
42
44
  });
43
45
  }
44
46
  };
45
- /** @internal */
46
47
  this.handleSlotChange = (e) => {
47
48
  const slot = e.target;
48
- const items = slot.assignedElements({ flatten: true });
49
- this.items = items;
49
+ const items = slot
50
+ .assignedElements({ flatten: true })
51
+ .filter((el) => el instanceof LeuChipSelectable);
52
+ this.selectableItems = items;
50
53
  };
51
- this.inverted = false;
52
- this.headingLevel = 2;
53
- this.label = "";
54
- /** @internal */
55
- this.items = [];
56
- /** @type {"single" | "multiple" | "none"} */
57
- this.selectionMode = SELECTION_MODES.none;
58
54
  }
59
55
  connectedCallback() {
60
56
  super.connectedCallback();
@@ -72,18 +68,19 @@ class LeuChipGroup extends LeuElement {
72
68
  this.removeEventListener("input", this.handleInput, { capture: true });
73
69
  }
74
70
  get value() {
75
- return this.items.filter((i) => i.checked).map((i) => i.getValue());
71
+ return this.selectableItems
72
+ .filter((i) => i.checked)
73
+ .map((i) => i.getValue());
76
74
  }
77
75
  /**
78
76
  * Checks the items with the given values.
79
77
  * If the selectionMode is single, only the first item with the given value is checked.
80
- * @param {string[]} valueList
81
78
  */
82
79
  set value(valueList) {
83
80
  let hasChanged = false;
84
- for (const item of this.items) {
81
+ for (const item of this.selectableItems) {
85
82
  item.checked = hasChanged ? false : valueList.includes(item.value);
86
- if (this.selectionMode === SELECTION_MODES.single && item.checked) {
83
+ if (this.selectionMode === "single" && item.checked) {
87
84
  hasChanged = true;
88
85
  }
89
86
  }
@@ -92,7 +89,6 @@ class LeuChipGroup extends LeuElement {
92
89
  * Determines the heading tag of the accordion toggle.
93
90
  * The headingLevel shouldn't be used directly to render the heading tag
94
91
  * in order to avoid XSS issues.
95
- * @returns {String} The heading tag of the accordion toggle.
96
92
  * @internal
97
93
  */
98
94
  _getHeadingTag() {
@@ -121,11 +117,17 @@ class LeuChipGroup extends LeuElement {
121
117
  }
122
118
  }
123
119
  LeuChipGroup.styles = [LeuElement.styles, css_248z];
124
- LeuChipGroup.properties = {
125
- inverted: { type: Boolean, reflect: true },
126
- selectionMode: { type: String, attribute: "selection-mode", reflect: true },
127
- headingLevel: { type: Number, attribute: "heading-level", reflect: true },
128
- label: { type: String, reflect: true },
129
- };
120
+ __decorate([
121
+ property({ type: Boolean, reflect: true })
122
+ ], LeuChipGroup.prototype, "inverted", void 0);
123
+ __decorate([
124
+ property({ type: String, attribute: "selection-mode", reflect: true })
125
+ ], LeuChipGroup.prototype, "selectionMode", void 0);
126
+ __decorate([
127
+ property({ type: Number, attribute: "heading-level", reflect: true })
128
+ ], LeuChipGroup.prototype, "headingLevel", void 0);
129
+ __decorate([
130
+ property({ type: String, reflect: true })
131
+ ], LeuChipGroup.prototype, "label", void 0);
130
132
 
131
- export { LeuChipGroup, SELECTION_MODES };
133
+ export { LeuChipGroup };
@@ -3,32 +3,16 @@ import { LeuChipBase } from './Chip.js';
3
3
  import 'lit';
4
4
  import './LeuElement.d-BevHqLUu.js';
5
5
 
6
- declare const SIZES: {
7
- regular: string;
8
- large: string;
9
- };
10
6
  /**
11
7
  * @tagname leu-chip-link
12
8
  * @slot - The content of the chip
13
- * @prop {keyof typeof SIZES} size - The size of the chip
14
9
  */
15
10
  declare class LeuChipLink extends LeuChipBase {
16
- static properties: {
17
- size: {
18
- type: StringConstructor;
19
- reflect: boolean;
20
- };
21
- href: {
22
- type: StringConstructor;
23
- reflect: boolean;
24
- };
25
- inverted: {
26
- type: BooleanConstructor;
27
- reflect: boolean;
28
- };
29
- };
30
- constructor();
11
+ /** The size of the chip */
12
+ size: "regular" | "large";
13
+ /** The URL that the chip links to */
14
+ href: string;
31
15
  render(): lit_html.TemplateResult<1>;
32
16
  }
33
17
 
34
- export { LeuChipLink, SIZES };
18
+ export { LeuChipLink };
package/dist/ChipLink.js CHANGED
@@ -1,21 +1,19 @@
1
+ import { _ as __decorate } from './_tslib-CNEFicEt.js';
1
2
  import { html } from 'lit';
3
+ import { property } from 'lit/decorators.js';
2
4
  import { LeuChipBase } from './Chip.js';
3
- import './LeuElement-BooZrClI.js';
5
+ import './LeuElement-CWseJvWv.js';
4
6
 
5
- const SIZES = {
6
- regular: "regular",
7
- large: "large",
8
- };
9
7
  /**
10
8
  * @tagname leu-chip-link
11
9
  * @slot - The content of the chip
12
- * @prop {keyof typeof SIZES} size - The size of the chip
13
10
  */
14
11
  class LeuChipLink extends LeuChipBase {
15
12
  constructor() {
16
- super();
17
- this.inverted = false;
18
- this.size = SIZES.regular;
13
+ super(...arguments);
14
+ /** The size of the chip */
15
+ this.size = "regular";
16
+ /** The URL that the chip links to */
19
17
  this.href = "";
20
18
  }
21
19
  render() {
@@ -24,10 +22,11 @@ class LeuChipLink extends LeuChipBase {
24
22
  </a>`;
25
23
  }
26
24
  }
27
- LeuChipLink.properties = {
28
- ...LeuChipBase.properties,
29
- size: { type: String, reflect: true },
30
- href: { type: String, reflect: true },
31
- };
25
+ __decorate([
26
+ property({ type: String, reflect: true })
27
+ ], LeuChipLink.prototype, "size", void 0);
28
+ __decorate([
29
+ property({ type: String, reflect: true })
30
+ ], LeuChipLink.prototype, "href", void 0);
32
31
 
33
- export { LeuChipLink, SIZES };
32
+ export { LeuChipLink };
@@ -1,6 +1,6 @@
1
1
  import * as lit_html from 'lit-html';
2
2
  import { LeuChipBase } from './Chip.js';
3
- import { LeuIcon } from './Icon.js';
3
+ import { L as LeuIcon } from './Icon.d-itcQ94ym.js';
4
4
  import 'lit';
5
5
  import './LeuElement.d-BevHqLUu.js';
6
6
 
@@ -14,23 +14,12 @@ declare class LeuChipRemovable extends LeuChipBase {
14
14
  static dependencies: {
15
15
  "leu-icon": typeof LeuIcon;
16
16
  };
17
- static properties: {
18
- value: {
19
- type: StringConstructor;
20
- reflect: boolean;
21
- };
22
- inverted: {
23
- type: BooleanConstructor;
24
- reflect: boolean;
25
- };
26
- };
27
- constructor();
17
+ value: string;
28
18
  /**
29
19
  * Returns the value of the chip. If `value` is not set, it will return the text content
30
- * @returns {string}
31
20
  */
32
- getValue(): any;
33
- handleClick(): void;
21
+ getValue(): string;
22
+ protected handleClick(): void;
34
23
  render(): lit_html.TemplateResult<1>;
35
24
  }
36
25
 
@@ -1,9 +1,9 @@
1
+ import { _ as __decorate } from './_tslib-CNEFicEt.js';
1
2
  import { html } from 'lit';
3
+ import { property } from 'lit/decorators.js';
2
4
  import { LeuChipBase } from './Chip.js';
3
5
  import { LeuIcon } from './Icon.js';
4
- import './LeuElement-BooZrClI.js';
5
- import './_tslib-CNEFicEt.js';
6
- import 'lit/decorators.js';
6
+ import './LeuElement-CWseJvWv.js';
7
7
 
8
8
  /**
9
9
  * @slot - The content of the chip
@@ -13,12 +13,11 @@ import 'lit/decorators.js';
13
13
  */
14
14
  class LeuChipRemovable extends LeuChipBase {
15
15
  constructor() {
16
- super();
16
+ super(...arguments);
17
17
  this.value = "";
18
18
  }
19
19
  /**
20
20
  * Returns the value of the chip. If `value` is not set, it will return the text content
21
- * @returns {string}
22
21
  */
23
22
  getValue() {
24
23
  return this.value || this.textContent.trim();
@@ -43,9 +42,8 @@ class LeuChipRemovable extends LeuChipBase {
43
42
  LeuChipRemovable.dependencies = {
44
43
  "leu-icon": LeuIcon,
45
44
  };
46
- LeuChipRemovable.properties = {
47
- ...LeuChipBase.properties,
48
- value: { type: String, reflect: true },
49
- };
45
+ __decorate([
46
+ property({ type: String, reflect: true })
47
+ ], LeuChipRemovable.prototype, "value", void 0);
50
48
 
51
49
  export { LeuChipRemovable };