@statistikzh/leu 0.5.1 → 0.7.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 (236) hide show
  1. package/.husky/commit-msg +0 -3
  2. package/.husky/pre-commit +0 -3
  3. package/CHANGELOG.md +54 -0
  4. package/dist/Accordion.d.ts +10 -9
  5. package/dist/Accordion.d.ts.map +1 -1
  6. package/dist/Accordion.js +12 -11
  7. package/dist/Breadcrumb.d.ts +4 -4
  8. package/dist/Breadcrumb.d.ts.map +1 -1
  9. package/dist/Breadcrumb.js +28 -24
  10. package/dist/{Button-5326c982.d.ts → Button-7370f901.d.ts} +10 -11
  11. package/dist/Button-7370f901.d.ts.map +1 -0
  12. package/dist/{Button-5326c982.js → Button-7370f901.js} +57 -67
  13. package/dist/Button.d.ts +1 -1
  14. package/dist/Button.js +3 -3
  15. package/dist/ButtonGroup.d.ts +2 -2
  16. package/dist/ButtonGroup.d.ts.map +1 -1
  17. package/dist/ButtonGroup.js +3 -3
  18. package/dist/Checkbox.d.ts +4 -3
  19. package/dist/Checkbox.d.ts.map +1 -1
  20. package/dist/Checkbox.js +14 -17
  21. package/dist/CheckboxGroup.d.ts +2 -2
  22. package/dist/CheckboxGroup.d.ts.map +1 -1
  23. package/dist/CheckboxGroup.js +4 -4
  24. package/dist/Chip.d.ts +2 -2
  25. package/dist/Chip.d.ts.map +1 -1
  26. package/dist/Chip.js +23 -28
  27. package/dist/ChipGroup.d.ts +16 -8
  28. package/dist/ChipGroup.d.ts.map +1 -1
  29. package/dist/ChipGroup.js +39 -9
  30. package/dist/ChipLink.d.ts +2 -1
  31. package/dist/ChipLink.d.ts.map +1 -1
  32. package/dist/ChipLink.js +4 -7
  33. package/dist/ChipRemovable.d.ts +0 -2
  34. package/dist/ChipRemovable.d.ts.map +1 -1
  35. package/dist/ChipRemovable.js +8 -11
  36. package/dist/ChipSelectable.d.ts +12 -2
  37. package/dist/ChipSelectable.d.ts.map +1 -1
  38. package/dist/ChipSelectable.js +24 -26
  39. package/dist/Dropdown.d.ts +9 -5
  40. package/dist/Dropdown.d.ts.map +1 -1
  41. package/dist/Dropdown.js +68 -32
  42. package/dist/Icon.d.ts +116 -0
  43. package/dist/Icon.d.ts.map +1 -0
  44. package/dist/{icon-03e86700.js → Icon.js} +61 -32
  45. package/dist/Input.d.ts +13 -17
  46. package/dist/Input.d.ts.map +1 -1
  47. package/dist/Input.js +33 -24
  48. package/dist/LeuElement-ba5ea33d.d.ts +7 -0
  49. package/dist/LeuElement-ba5ea33d.d.ts.map +1 -0
  50. package/dist/{_rollupPluginBabelHelpers-20f659f4.js → LeuElement-ba5ea33d.js} +20 -1
  51. package/dist/Menu.d.ts +24 -2
  52. package/dist/Menu.d.ts.map +1 -1
  53. package/dist/Menu.js +120 -3
  54. package/dist/MenuItem.d.ts +28 -11
  55. package/dist/MenuItem.d.ts.map +1 -1
  56. package/dist/MenuItem.js +110 -63
  57. package/dist/Pagination.d.ts +10 -3
  58. package/dist/Pagination.d.ts.map +1 -1
  59. package/dist/Pagination.js +24 -21
  60. package/dist/Popup.d.ts +21 -3
  61. package/dist/Popup.d.ts.map +1 -1
  62. package/dist/Popup.js +44 -17
  63. package/dist/Radio.d.ts +4 -2
  64. package/dist/Radio.d.ts.map +1 -1
  65. package/dist/Radio.js +9 -14
  66. package/dist/RadioGroup.d.ts +2 -2
  67. package/dist/RadioGroup.d.ts.map +1 -1
  68. package/dist/RadioGroup.js +20 -11
  69. package/dist/ScrollTop.d.ts +2 -2
  70. package/dist/ScrollTop.d.ts.map +1 -1
  71. package/dist/ScrollTop.js +10 -8
  72. package/dist/Select.d.ts +75 -37
  73. package/dist/Select.d.ts.map +1 -1
  74. package/dist/Select.js +279 -181
  75. package/dist/Table.d.ts +2 -6
  76. package/dist/Table.d.ts.map +1 -1
  77. package/dist/Table.js +16 -16
  78. package/dist/VisuallyHidden.d.ts +2 -2
  79. package/dist/VisuallyHidden.d.ts.map +1 -1
  80. package/dist/VisuallyHidden.js +3 -3
  81. package/dist/index.d.ts +2 -2
  82. package/dist/index.js +5 -14
  83. package/dist/leu-accordion.d.ts.map +1 -1
  84. package/dist/leu-accordion.js +2 -3
  85. package/dist/leu-breadcrumb.d.ts.map +1 -1
  86. package/dist/leu-breadcrumb.js +4 -10
  87. package/dist/leu-button-group.d.ts.map +1 -1
  88. package/dist/leu-button-group.js +2 -3
  89. package/dist/leu-button.d.ts +1 -1
  90. package/dist/leu-button.d.ts.map +1 -1
  91. package/dist/leu-button.js +4 -5
  92. package/dist/leu-checkbox-group.d.ts.map +1 -1
  93. package/dist/leu-checkbox-group.js +2 -3
  94. package/dist/leu-checkbox.d.ts.map +1 -1
  95. package/dist/leu-checkbox.js +3 -4
  96. package/dist/leu-chip-group.d.ts.map +1 -1
  97. package/dist/leu-chip-group.js +2 -3
  98. package/dist/leu-chip-link.d.ts.map +1 -1
  99. package/dist/leu-chip-link.js +2 -3
  100. package/dist/leu-chip-removable.d.ts.map +1 -1
  101. package/dist/leu-chip-removable.js +3 -4
  102. package/dist/leu-chip-selectable.d.ts.map +1 -1
  103. package/dist/leu-chip-selectable.js +2 -3
  104. package/dist/leu-dropdown.d.ts.map +1 -1
  105. package/dist/leu-dropdown.js +5 -10
  106. package/dist/leu-icon.d.ts +3 -0
  107. package/dist/leu-icon.d.ts.map +1 -0
  108. package/dist/leu-icon.js +7 -0
  109. package/dist/leu-input.d.ts.map +1 -1
  110. package/dist/leu-input.js +3 -4
  111. package/dist/leu-menu-item.d.ts.map +1 -1
  112. package/dist/leu-menu-item.js +3 -5
  113. package/dist/leu-menu.d.ts.map +1 -1
  114. package/dist/leu-menu.js +5 -3
  115. package/dist/leu-pagination.d.ts.map +1 -1
  116. package/dist/leu-pagination.js +4 -7
  117. package/dist/leu-popup.d.ts.map +1 -1
  118. package/dist/leu-popup.js +2 -3
  119. package/dist/leu-radio-group.d.ts.map +1 -1
  120. package/dist/leu-radio-group.js +2 -3
  121. package/dist/leu-radio.d.ts.map +1 -1
  122. package/dist/leu-radio.js +2 -3
  123. package/dist/leu-scroll-top.d.ts.map +1 -1
  124. package/dist/leu-scroll-top.js +4 -6
  125. package/dist/leu-select.d.ts.map +1 -1
  126. package/dist/leu-select.js +5 -13
  127. package/dist/leu-table.d.ts.map +1 -1
  128. package/dist/leu-table.js +4 -8
  129. package/dist/leu-visually-hidden.d.ts.map +1 -1
  130. package/dist/leu-visually-hidden.js +2 -3
  131. package/dist/theme.css +2 -0
  132. package/dist/vscode.html-custom-data.json +124 -74
  133. package/dist/vue/index.d.ts +83 -67
  134. package/dist/web-types.json +256 -142
  135. package/package.json +9 -12
  136. package/scripts/generate-component/templates/[Name].js +6 -3
  137. package/scripts/generate-component/templates/test/[name].test.js +1 -1
  138. package/src/components/accordion/Accordion.js +13 -10
  139. package/src/components/accordion/leu-accordion.js +1 -2
  140. package/src/components/breadcrumb/Breadcrumb.js +31 -18
  141. package/src/components/breadcrumb/leu-breadcrumb.js +1 -2
  142. package/src/components/button/Button.js +45 -71
  143. package/src/components/button/button.css +11 -9
  144. package/src/components/button/leu-button.js +1 -2
  145. package/src/components/button/stories/button.stories.js +60 -19
  146. package/src/components/button/test/button.test.js +26 -63
  147. package/src/components/button-group/ButtonGroup.js +4 -2
  148. package/src/components/button-group/leu-button-group.js +1 -2
  149. package/src/components/checkbox/Checkbox.js +17 -11
  150. package/src/components/checkbox/CheckboxGroup.js +6 -3
  151. package/src/components/checkbox/leu-checkbox-group.js +1 -2
  152. package/src/components/checkbox/leu-checkbox.js +1 -2
  153. package/src/components/checkbox/stories/checkbox-group.stories.js +10 -26
  154. package/src/components/checkbox/stories/checkbox.stories.js +2 -7
  155. package/src/components/checkbox/test/checkbox-group.test.js +6 -21
  156. package/src/components/checkbox/test/checkbox.test.js +1 -12
  157. package/src/components/chip/Chip.js +5 -4
  158. package/src/components/chip/ChipGroup.js +38 -8
  159. package/src/components/chip/ChipLink.js +3 -7
  160. package/src/components/chip/ChipRemovable.js +8 -11
  161. package/src/components/chip/ChipSelectable.js +23 -27
  162. package/src/components/chip/chip.css +19 -20
  163. package/src/components/chip/leu-chip-group.js +1 -2
  164. package/src/components/chip/leu-chip-link.js +1 -2
  165. package/src/components/chip/leu-chip-removable.js +1 -2
  166. package/src/components/chip/leu-chip-selectable.js +1 -2
  167. package/src/components/chip/stories/chip-group.stories.js +6 -9
  168. package/src/components/chip/stories/chip-link.stories.js +3 -5
  169. package/src/components/chip/stories/chip-removable.stories.js +3 -4
  170. package/src/components/chip/stories/chip-selectable.stories.js +3 -3
  171. package/src/components/chip/test/chip-group.test.js +82 -30
  172. package/src/components/chip/test/chip-link.test.js +2 -6
  173. package/src/components/chip/test/chip-removable.test.js +4 -10
  174. package/src/components/chip/test/chip-selectable.test.js +10 -12
  175. package/src/components/dropdown/Dropdown.js +79 -26
  176. package/src/components/dropdown/leu-dropdown.js +1 -2
  177. package/src/components/dropdown/stories/dropdown.stories.js +30 -7
  178. package/src/components/dropdown/test/dropdown.test.js +5 -5
  179. package/src/components/icon/Icon.js +55 -0
  180. package/src/components/icon/icon.css +6 -0
  181. package/src/components/icon/leu-icon.js +5 -0
  182. package/src/components/icon/{icon.js → paths.js} +4 -37
  183. package/src/components/icon/stories/icon.stories.js +47 -0
  184. package/src/components/icon/test/icon.test.js +23 -40
  185. package/src/components/input/Input.js +31 -20
  186. package/src/components/input/input.css +4 -2
  187. package/src/components/input/leu-input.js +1 -2
  188. package/src/components/input/stories/input.stories.js +5 -5
  189. package/src/components/input/test/input.test.js +22 -0
  190. package/src/components/menu/Menu.js +143 -2
  191. package/src/components/menu/MenuItem.js +104 -52
  192. package/src/components/menu/leu-menu-item.js +1 -2
  193. package/src/components/menu/leu-menu.js +1 -2
  194. package/src/components/menu/menu-item.css +11 -4
  195. package/src/components/menu/stories/menu-item.stories.js +15 -4
  196. package/src/components/menu/stories/menu.stories.js +34 -7
  197. package/src/components/menu/test/menu-item.test.js +88 -82
  198. package/src/components/menu/test/menu.test.js +101 -8
  199. package/src/components/pagination/Pagination.js +27 -18
  200. package/src/components/pagination/leu-pagination.js +1 -2
  201. package/src/components/popup/Popup.js +39 -16
  202. package/src/components/popup/leu-popup.js +1 -2
  203. package/src/components/popup/popup.css +1 -0
  204. package/src/components/radio/Radio.js +12 -7
  205. package/src/components/radio/RadioGroup.js +18 -12
  206. package/src/components/radio/leu-radio-group.js +1 -2
  207. package/src/components/radio/leu-radio.js +1 -2
  208. package/src/components/radio/stories/radio-group.stories.js +5 -19
  209. package/src/components/radio/stories/radio.stories.js +2 -7
  210. package/src/components/radio/test/radio-group.test.js +6 -9
  211. package/src/components/radio/test/radio.test.js +3 -13
  212. package/src/components/scroll-top/ScrollTop.js +15 -5
  213. package/src/components/scroll-top/leu-scroll-top.js +1 -2
  214. package/src/components/select/Select.js +279 -175
  215. package/src/components/select/leu-select.js +1 -2
  216. package/src/components/select/select.css +20 -12
  217. package/src/components/select/stories/select.stories.js +16 -2
  218. package/src/components/select/test/select.test.js +191 -37
  219. package/src/components/table/Table.js +15 -9
  220. package/src/components/table/leu-table.js +1 -2
  221. package/src/components/table/table.css +3 -1
  222. package/src/components/visually-hidden/VisuallyHidden.js +6 -2
  223. package/src/components/visually-hidden/leu-visually-hidden.js +1 -2
  224. package/src/lib/LeuElement.js +23 -0
  225. package/src/lib/a11y.js +26 -0
  226. package/src/styles/custom-properties.css +2 -0
  227. package/web-test-runner.config.mjs +2 -0
  228. package/dist/Button-5326c982.d.ts.map +0 -1
  229. package/dist/_rollupPluginBabelHelpers-20f659f4.d.ts +0 -3
  230. package/dist/_rollupPluginBabelHelpers-20f659f4.d.ts.map +0 -1
  231. package/dist/defineElement-40372b4b.d.ts +0 -9
  232. package/dist/defineElement-40372b4b.d.ts.map +0 -1
  233. package/dist/defineElement-40372b4b.js +0 -15
  234. package/dist/icon-03e86700.d.ts +0 -11
  235. package/dist/icon-03e86700.d.ts.map +0 -1
  236. package/src/lib/defineElement.js +0 -13
@@ -4,7 +4,7 @@
4
4
  * @prop {string} value - The value of the currenty selected (active) button
5
5
  * @fires input - When the value of the group changes by clicking a button
6
6
  */
7
- export class LeuButtonGroup extends LitElement {
7
+ export class LeuButtonGroup extends LeuElement {
8
8
  /**
9
9
  * @param {import("../button/Button").LeuButton} button
10
10
  * @returns {string}
@@ -20,5 +20,5 @@ export class LeuButtonGroup extends LitElement {
20
20
  _handleButtonClick(button: any): void;
21
21
  render(): import("lit-html").TemplateResult<1>;
22
22
  }
23
- import { LitElement } from 'lit';
23
+ import { L as LeuElement } from './LeuElement-ba5ea33d.js';
24
24
  //# sourceMappingURL=ButtonGroup.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ButtonGroup.d.ts","sourceRoot":"","sources":["ButtonGroup.js"],"names":[],"mappings":"AAeA;;;;;GAKG;AACH;IAME;;;OAGG;IACH,oCAFa,MAAM,CAIlB;IATC,cAAgB;IAclB,4BAMC;IAVD,oBAGC;IAQD,0BA+BC;IAED;;OAEG;IACH,sCAWC;IACD,+CAMC;CACF;2BAnGqC,KAAK"}
1
+ {"version":3,"file":"ButtonGroup.d.ts","sourceRoot":"","sources":["ButtonGroup.js"],"names":[],"mappings":"AAeA;;;;;GAKG;AACH;IAME;;;OAGG;IACH,oCAFa,MAAM,CAIlB;IATC,cAAgB;IAclB,4BAMC;IAVD,oBAGC;IAQD,0BA+BC;IAED;;OAEG;IACH,sCAWC;IACD,+CAMC;CACF;gCApGqD,0BAA0B"}
@@ -1,5 +1,5 @@
1
- import { _ as _defineProperty } from './_rollupPluginBabelHelpers-20f659f4.js';
2
- import { css, LitElement, html } from 'lit';
1
+ import { _ as _defineProperty, L as LeuElement } from './LeuElement-ba5ea33d.js';
2
+ import { css, html } from 'lit';
3
3
 
4
4
  var css_248z = css`:host,
5
5
  :host * {
@@ -19,7 +19,7 @@ var css_248z = css`:host,
19
19
  * @prop {string} value - The value of the currenty selected (active) button
20
20
  * @fires input - When the value of the group changes by clicking a button
21
21
  */
22
- class LeuButtonGroup extends LitElement {
22
+ class LeuButtonGroup extends LeuElement {
23
23
  constructor() {
24
24
  super();
25
25
  this._items = [];
@@ -1,13 +1,14 @@
1
1
  /**
2
2
  * @tagname leu-checkbox
3
3
  */
4
- export class LeuCheckbox extends LitElement {
4
+ export class LeuCheckbox extends LeuElement {
5
5
  checked: boolean;
6
6
  disabled: boolean;
7
- checkIcon: import("lit-html").TemplateResult<1>;
7
+ name: string;
8
+ value: string;
8
9
  handleChange(event: any): void;
9
10
  handleInput(event: any): void;
10
11
  render(): import("lit-html").TemplateResult<1>;
11
12
  }
12
- import { LitElement } from 'lit';
13
+ import { L as LeuElement } from './LeuElement-ba5ea33d.js';
13
14
  //# sourceMappingURL=Checkbox.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["Checkbox.js"],"names":[],"mappings":"AAiGA;;GAEG;AACH;IAGI,iBAAoB;IACpB,kBAAqB;IACrB,gDAA8B;IAEhC,+BAIC;IACD,8BAEC;IACD,+CAgBC;CACF;2BAnIqC,KAAK"}
1
+ {"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["Checkbox.js"],"names":[],"mappings":"AAiGA;;GAEG;AACH;IAGI,iBAAoB;IACpB,kBAAqB;IACrB,aAAc;IACd,cAAe;IAEjB,+BAIC;IACD,8BAEC;IACD,+CAgBC;CACF;gCArIqD,0BAA0B"}
package/dist/Checkbox.js CHANGED
@@ -1,6 +1,6 @@
1
- import { _ as _defineProperty } from './_rollupPluginBabelHelpers-20f659f4.js';
2
- import { css, LitElement, html } from 'lit';
3
- import { I as Icon } from './icon-03e86700.js';
1
+ import { _ as _defineProperty, L as LeuElement } from './LeuElement-ba5ea33d.js';
2
+ import { css, html } from 'lit';
3
+ import { LeuIcon } from './Icon.js';
4
4
 
5
5
  var css_248z = css`:host {
6
6
  --checkbox-color: var(--leu-color-black-40);
@@ -98,12 +98,13 @@ var css_248z = css`:host {
98
98
  /**
99
99
  * @tagname leu-checkbox
100
100
  */
101
- class LeuCheckbox extends LitElement {
101
+ class LeuCheckbox extends LeuElement {
102
102
  constructor() {
103
103
  super();
104
104
  this.checked = false;
105
105
  this.disabled = false;
106
- this.checkIcon = Icon("check");
106
+ this.name = "";
107
+ this.value = "";
107
108
  }
108
109
  handleChange(event) {
109
110
  this.checked = event.target.checked;
@@ -116,7 +117,7 @@ class LeuCheckbox extends LitElement {
116
117
  render() {
117
118
  return html`
118
119
  <input
119
- id=${this.identifier}
120
+ id=${`checkbox-${this.name}`}
120
121
  class="checkbox"
121
122
  type="checkbox"
122
123
  name="${this.name}"
@@ -126,14 +127,18 @@ class LeuCheckbox extends LitElement {
126
127
  ?disabled=${this.disabled}
127
128
  .value=${this.value}
128
129
  />
129
- <label for=${this.identifier} class="label">${this.label}</label>
130
- <div class="icon">${this.checkIcon}</div>
130
+ <label for=${`checkbox-${this.name}`} class="label"><slot></slot></label>
131
+ <leu-icon class="icon" name="check"></leu-icon>
131
132
  `;
132
133
  }
133
134
  }
135
+ _defineProperty(LeuCheckbox, "dependencies", {
136
+ "leu-icon": LeuIcon
137
+ });
134
138
  _defineProperty(LeuCheckbox, "styles", css_248z);
139
+ /** @internal */
135
140
  _defineProperty(LeuCheckbox, "shadowRootOptions", {
136
- ...LitElement.shadowRootOptions,
141
+ ...LeuElement.shadowRootOptions,
137
142
  delegatesFocus: true
138
143
  });
139
144
  _defineProperty(LeuCheckbox, "properties", {
@@ -145,10 +150,6 @@ _defineProperty(LeuCheckbox, "properties", {
145
150
  type: Boolean,
146
151
  reflect: true
147
152
  },
148
- identifier: {
149
- type: String,
150
- reflect: true
151
- },
152
153
  value: {
153
154
  type: String,
154
155
  reflect: true
@@ -156,10 +157,6 @@ _defineProperty(LeuCheckbox, "properties", {
156
157
  name: {
157
158
  type: String,
158
159
  reflect: true
159
- },
160
- label: {
161
- type: String,
162
- reflect: true
163
160
  }
164
161
  });
165
162
 
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @tagname leu-checkbox-group
3
3
  */
4
- export class LeuCheckboxGroup extends LitElement {
4
+ export class LeuCheckboxGroup extends LeuElement {
5
5
  orientation: string;
6
6
  items: any[];
7
7
  get value(): any[];
@@ -9,5 +9,5 @@ export class LeuCheckboxGroup extends LitElement {
9
9
  handleItems(): void;
10
10
  render(): import("lit-html").TemplateResult<1>;
11
11
  }
12
- import { LitElement } from 'lit';
12
+ import { L as LeuElement } from './LeuElement-ba5ea33d.js';
13
13
  //# sourceMappingURL=CheckboxGroup.d.ts.map
@@ -1 +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
+ {"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;gCAnEqD,0BAA0B"}
@@ -1,5 +1,5 @@
1
- import { _ as _defineProperty } from './_rollupPluginBabelHelpers-20f659f4.js';
2
- import { css, LitElement, html } from 'lit';
1
+ import { _ as _defineProperty, L as LeuElement } from './LeuElement-ba5ea33d.js';
2
+ import { css, html } from 'lit';
3
3
  import { classMap } from 'lit/directives/class-map.js';
4
4
 
5
5
  var css_248z = css`:host {
@@ -38,7 +38,7 @@ var css_248z = css`:host {
38
38
  /**
39
39
  * @tagname leu-checkbox-group
40
40
  */
41
- class LeuCheckboxGroup extends LitElement {
41
+ class LeuCheckboxGroup extends LeuElement {
42
42
  constructor() {
43
43
  super();
44
44
  this.orientation = "HORIZONTAL";
@@ -51,7 +51,7 @@ class LeuCheckboxGroup extends LitElement {
51
51
  this.handleItems();
52
52
  }
53
53
  handleItems() {
54
- this.items = [...this.querySelectorAll(":scope > *:not([slot])")];
54
+ this.items = Array.from(this.querySelectorAll(":scope > *:not([slot])"));
55
55
  }
56
56
  render() {
57
57
  const fieldsetClasses = {
package/dist/Chip.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export class LeuChipBase extends LitElement {
1
+ export class LeuChipBase extends LeuElement {
2
2
  inverted: boolean;
3
3
  }
4
- import { LitElement } from 'lit';
4
+ import { L as LeuElement } from './LeuElement-ba5ea33d.js';
5
5
  //# sourceMappingURL=Chip.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Chip.d.ts","sourceRoot":"","sources":["Chip.js"],"names":[],"mappings":"AAyJA;IAGI,kBAAqB;CAExB;2BA7J+B,KAAK"}
1
+ {"version":3,"file":"Chip.d.ts","sourceRoot":"","sources":["Chip.js"],"names":[],"mappings":"AAwJA;IAGI,kBAAqB;CAExB;gCA7JqD,0BAA0B"}
package/dist/Chip.js CHANGED
@@ -1,5 +1,5 @@
1
- import { _ as _defineProperty } from './_rollupPluginBabelHelpers-20f659f4.js';
2
- import { css, LitElement } from 'lit';
1
+ import { _ as _defineProperty, L as LeuElement } from './LeuElement-ba5ea33d.js';
2
+ import { css } from 'lit';
3
3
 
4
4
  var css_248z = css`:host,
5
5
  :host *,
@@ -11,17 +11,17 @@ var css_248z = css`:host,
11
11
  :host {
12
12
  --chip-background-color-default: var(--leu-color-black-transp-10);
13
13
  --chip-background-color-hover: var(--leu-color-black-transp-20);
14
- --chip-background-color-selected: var(--leu-color-black-100);
15
- --chip-background-color-selected-hover: var(--leu-color-black-transp-80);
14
+ --chip-background-color-checked: var(--leu-color-black-100);
15
+ --chip-background-color-checked-hover: var(--leu-color-black-transp-80);
16
16
 
17
17
  --chip-color-default: var(--leu-color-black-transp-60);
18
18
  --chip-color-hover: var(--leu-color-black-100);
19
- --chip-color-selected: var(--leu-color-black-0);
19
+ --chip-color-checked: var(--leu-color-black-0);
20
20
 
21
21
  --chip-radio-border-default: var(--leu-color-black-transp-40);
22
- --chip-radio-border-selected: var(--leu-color-black-0);
22
+ --chip-radio-border-checked: var(--leu-color-black-0);
23
23
  --chip-radio-background-default: var(--leu-color-black-0);
24
- --chip-radio-background-selected: var(--leu-color-func-cyan);
24
+ --chip-radio-background-checked: var(--leu-color-func-cyan);
25
25
 
26
26
  --chip-font-regular: var(--leu-font-family-regular);
27
27
  --chip-font-black: var(--leu-font-family-black);
@@ -31,6 +31,8 @@ var css_248z = css`:host,
31
31
  --chip-radio-border: var(--chip-radio-border-default);
32
32
  --chip-radio-background: var(--chip-radio-background-default);
33
33
 
34
+ --leu-icon-size: 1rem;
35
+
34
36
  font-family: var(--leu-font-family-regular);
35
37
 
36
38
  font-family: var(--chip-font-regular);
@@ -45,14 +47,14 @@ var css_248z = css`:host,
45
47
 
46
48
  --chip-color-default: var(--leu-color-black-0);
47
49
  --chip-color-hover: var(--leu-color-black-0);
48
- --chip-color-selected: var(--leu-color-black-0);
50
+ --chip-color-checked: var(--leu-color-black-0);
49
51
  }
50
52
 
51
- :host([selected]) {
52
- --chip-background-color: var(--chip-background-color-selected);
53
- --chip-color: var(--chip-color-selected);
54
- --chip-radio-border: var(--chip-radio-border-selected);
55
- --chip-radio-background: var(--chip-radio-background-selected);
53
+ :host([checked]) {
54
+ --chip-background-color: var(--chip-background-color-checked);
55
+ --chip-color: var(--chip-color-checked);
56
+ --chip-radio-border: var(--chip-radio-border-checked);
57
+ --chip-radio-background: var(--chip-radio-background-checked);
56
58
  }
57
59
 
58
60
  .button {
@@ -65,6 +67,7 @@ var css_248z = css`:host,
65
67
  padding: 0.5rem 1rem;
66
68
 
67
69
  color: var(--chip-color);
70
+ font-family: inherit;
68
71
  font-size: 0.875rem;
69
72
  line-height: 1rem;
70
73
 
@@ -100,10 +103,10 @@ var css_248z = css`:host,
100
103
  text-decoration: none;
101
104
  }
102
105
 
103
- :host([selected]) .button:hover,
104
- :host([selected]) .button:focus-visible {
105
- --chip-background-color: var(--chip-background-color-selected-hover);
106
- --chip-color: var(--chip-color-selected);
106
+ :host([checked]) .button:hover,
107
+ :host([checked]) .button:focus-visible {
108
+ --chip-background-color: var(--chip-background-color-checked-hover);
109
+ --chip-color: var(--chip-color-checked);
107
110
  }
108
111
 
109
112
  :host([href][size="large"]) .button {
@@ -131,7 +134,7 @@ var css_248z = css`:host,
131
134
  border-radius: 50%;
132
135
  }
133
136
 
134
- :host([variant="radio"][selected]) .button::before {
137
+ :host([variant="radio"][checked]) .button::before {
135
138
  border-width: 3px;
136
139
  }
137
140
 
@@ -143,15 +146,11 @@ var css_248z = css`:host,
143
146
  text-overflow: ellipsis;
144
147
  white-space: nowrap;
145
148
  }
146
-
147
- .icon svg {
148
- display: block;
149
- }
150
149
  `;
151
150
 
152
151
  /* Design: https://www.figma.com/file/d6Pv21UVUbnBs3AdcZijHmbN/KTZH-Design-System?type=design&node-id=21161-184433&mode=design&t=Kjo5VDiqivihn8dh-11 */
153
152
 
154
- class LeuChipBase extends LitElement {
153
+ class LeuChipBase extends LeuElement {
155
154
  constructor() {
156
155
  super();
157
156
  this.inverted = false;
@@ -160,17 +159,13 @@ class LeuChipBase extends LitElement {
160
159
  _defineProperty(LeuChipBase, "styles", css_248z);
161
160
  /** @internal */
162
161
  _defineProperty(LeuChipBase, "shadowRootOptions", {
163
- ...LitElement.shadowRootOptions,
162
+ ...LeuElement.shadowRootOptions,
164
163
  delegatesFocus: true
165
164
  });
166
165
  _defineProperty(LeuChipBase, "properties", {
167
166
  inverted: {
168
167
  type: Boolean,
169
168
  reflect: true
170
- },
171
- label: {
172
- type: String,
173
- reflect: true
174
169
  }
175
170
  });
176
171
 
@@ -3,12 +3,20 @@
3
3
  * @cssproperty --leu-chip-group-gap - The gap between the chips
4
4
  * @tagname leu-chip-group
5
5
  */
6
- export class LeuChipGroup extends LitElement {
6
+ export class LeuChipGroup extends LeuElement {
7
7
  items: any[];
8
8
  inverted: boolean;
9
9
  headingLevel: number;
10
10
  label: string;
11
- get value(): any[];
11
+ /** @type {"single" | "multiple" | "none"} */
12
+ selectionMode: "single" | "multiple" | "none";
13
+ /**
14
+ * Checks the items with the given values.
15
+ * If the selectionMode is single, only the first item with the given value is checked.
16
+ * @param {string[]} valueList
17
+ */
18
+ set value(valueList: string[]);
19
+ get value(): string[];
12
20
  /**
13
21
  * Determines the heading tag of the accordion toggle.
14
22
  * The headingLevel shouldn't be used directly to render the heading tag
@@ -19,10 +27,10 @@ export class LeuChipGroup extends LitElement {
19
27
  _getHeadingTag(): string;
20
28
  render(): import("lit-html").TemplateResult;
21
29
  }
22
- export namespace SELECTION_MODES {
23
- let single: string;
24
- let multiple: string;
25
- let none: string;
26
- }
27
- import { LitElement } from 'lit';
30
+ export const SELECTION_MODES: Readonly<{
31
+ single: "single";
32
+ multiple: "multiple";
33
+ none: "none";
34
+ }>;
35
+ import { L as LeuElement } from './LeuElement-ba5ea33d.js';
28
36
  //# sourceMappingURL=ChipGroup.d.ts.map
@@ -1 +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"}
1
+ {"version":3,"file":"ChipGroup.d.ts","sourceRoot":"","sources":["ChipGroup.js"],"names":[],"mappings":"AA8BA;;;;GAIG;AACH;IAiBM,aAAkB;IAEpB,kBAAqB;IACrB,qBAAqB;IACrB,cAAe;IAKf,6CAA6C;IAC7C,eADW,QAAQ,GAAG,UAAU,GAAG,MAAM,CACA;IA0B3C;;;;OAIG;IACH,+BAQC;IAjBD,sBAEC;IAiBD;;;;;;OAMG;IACH,yBAMC;IACD,4CAeC;CACF;AA7GD;;;;GAIG;gCA5BmD,0BAA0B"}
package/dist/ChipGroup.js CHANGED
@@ -1,6 +1,6 @@
1
- import { _ as _defineProperty } from './_rollupPluginBabelHelpers-20f659f4.js';
2
- import { css, LitElement } from 'lit';
1
+ import { _ as _defineProperty, L as LeuElement } from './LeuElement-ba5ea33d.js';
3
2
  import { html, unsafeStatic } from 'lit/static-html.js';
3
+ import { css } from 'lit';
4
4
 
5
5
  var css_248z = css`.label {
6
6
  margin: 0 0 0.5rem;
@@ -22,25 +22,25 @@ var css_248z = css`.label {
22
22
 
23
23
  /* Figma https://www.figma.com/file/d6Pv21UVUbnBs3AdcZijHmbN/KTZH-Design-System?type=design&node-id=131766-248643&mode=design&t=Kjo5VDiqivihn8dh-11 */
24
24
 
25
- const SELECTION_MODES = {
25
+ const SELECTION_MODES = Object.freeze({
26
26
  single: "single",
27
27
  multiple: "multiple",
28
28
  none: "none"
29
- };
29
+ });
30
30
 
31
31
  /**
32
32
  * @slot - Place leu-chip-* elements inside this slot
33
33
  * @cssproperty --leu-chip-group-gap - The gap between the chips
34
34
  * @tagname leu-chip-group
35
35
  */
36
- class LeuChipGroup extends LitElement {
36
+ class LeuChipGroup extends LeuElement {
37
37
  constructor() {
38
38
  super();
39
39
  /** @internal */
40
40
  _defineProperty(this, "handleInput", e => {
41
41
  if (this.selectionMode === SELECTION_MODES.single) {
42
42
  this.items.forEach(item => {
43
- item.selected = item === e.target; // eslint-disable-line no-param-reassign
43
+ item.checked = item === e.target; // eslint-disable-line no-param-reassign
44
44
  });
45
45
  }
46
46
  });
@@ -58,17 +58,47 @@ class LeuChipGroup extends LitElement {
58
58
 
59
59
  /** @internal */
60
60
  this.items = [];
61
+
62
+ /** @type {"single" | "multiple" | "none"} */
63
+ this.selectionMode = SELECTION_MODES.none;
61
64
  }
62
65
  connectedCallback() {
63
66
  super.connectedCallback();
64
- this.addEventListener("input", this.handleInput);
67
+
68
+ /**
69
+ * It is technically possible to add an event listener to the host element
70
+ * before it is connected to the dom. In that case the outside event listener would
71
+ * be called before the following event listener. But at this point multiple
72
+ * radio chips could be selected at the same time because `handleInput` hasn't been
73
+ * called yet. That's why we use the capture phase.
74
+ */
75
+ this.addEventListener("input", this.handleInput, {
76
+ capture: true
77
+ });
65
78
  }
66
79
  disconnectedCallback() {
67
80
  super.disconnectedCallback();
68
- this.removeEventListener("input", this.handleInput);
81
+ this.removeEventListener("input", this.handleInput, {
82
+ capture: true
83
+ });
69
84
  }
70
85
  get value() {
71
- return this.items.filter(i => i.selected).map(i => i.value);
86
+ return this.items.filter(i => i.checked).map(i => i.value);
87
+ }
88
+
89
+ /**
90
+ * Checks the items with the given values.
91
+ * If the selectionMode is single, only the first item with the given value is checked.
92
+ * @param {string[]} valueList
93
+ */
94
+ set value(valueList) {
95
+ let hasChanged = false;
96
+ for (const item of this.items) {
97
+ item.checked = hasChanged ? false : valueList.includes(item.value);
98
+ if (this.selectionMode === SELECTION_MODES.single && item.checked) {
99
+ hasChanged = true;
100
+ }
101
+ }
72
102
  }
73
103
 
74
104
  /**
@@ -1,6 +1,7 @@
1
1
  /**
2
- * @slot - The content of the chip
3
2
  * @tagname leu-chip-link
3
+ * @slot - The content of the chip
4
+ * @prop {keyof typeof SIZES} size - The size of the chip
4
5
  */
5
6
  export class LeuChipLink extends LeuChipBase {
6
7
  size: string;
@@ -1 +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"}
1
+ {"version":3,"file":"ChipLink.d.ts","sourceRoot":"","sources":["ChipLink.js"],"names":[],"mappings":"AASA;;;;GAIG;AACH;IAII,aAAyB;IACzB,aAAc;IAEhB,+CAIC;CACF;;;;;4BAxB2B,WAAW"}
package/dist/ChipLink.js CHANGED
@@ -1,4 +1,4 @@
1
- import { _ as _defineProperty } from './_rollupPluginBabelHelpers-20f659f4.js';
1
+ import { _ as _defineProperty } from './LeuElement-ba5ea33d.js';
2
2
  import { html } from 'lit';
3
3
  import { LeuChipBase } from './Chip.js';
4
4
 
@@ -8,8 +8,9 @@ const SIZES = {
8
8
  };
9
9
 
10
10
  /**
11
- * @slot - The content of the chip
12
11
  * @tagname leu-chip-link
12
+ * @slot - The content of the chip
13
+ * @prop {keyof typeof SIZES} size - The size of the chip
13
14
  */
14
15
  class LeuChipLink extends LeuChipBase {
15
16
  constructor() {
@@ -20,16 +21,12 @@ class LeuChipLink extends LeuChipBase {
20
21
  }
21
22
  render() {
22
23
  return html`<a href=${this.href} class="button">
23
- <span class="label">${this.label}</span>
24
+ <span class="label"><slot></slot></span>
24
25
  </a>`;
25
26
  }
26
27
  }
27
28
  _defineProperty(LeuChipLink, "properties", {
28
29
  ...LeuChipBase.properties,
29
- /**
30
- * The size of the chip
31
- * @type {keyof typeof SIZES}
32
- */
33
30
  size: {
34
31
  type: String,
35
32
  reflect: true
@@ -4,8 +4,6 @@
4
4
  * @fires remove - Dispatched when the user clicks on the chip
5
5
  */
6
6
  export class LeuChipRemovable extends LeuChipBase {
7
- /** @internal */
8
- _removeIcon: import("lit-html").TemplateResult<1>;
9
7
  handleClick(): void;
10
8
  render(): import("lit-html").TemplateResult<1>;
11
9
  }
@@ -1 +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
+ {"version":3,"file":"ChipRemovable.d.ts","sourceRoot":"","sources":["ChipRemovable.js"],"names":[],"mappings":"AAKA;;;;GAIG;AACH;IACE,oBAMC;IACD,+CAKC;CACF;4BAtB2B,WAAW"}
@@ -1,7 +1,7 @@
1
- import { _ as _defineProperty } from './_rollupPluginBabelHelpers-20f659f4.js';
1
+ import { _ as _defineProperty } from './LeuElement-ba5ea33d.js';
2
2
  import { html } from 'lit';
3
3
  import { LeuChipBase } from './Chip.js';
4
- import { I as Icon } from './icon-03e86700.js';
4
+ import { LeuIcon } from './Icon.js';
5
5
 
6
6
  /**
7
7
  * @slot - The content of the chip
@@ -9,26 +9,23 @@ import { I as Icon } from './icon-03e86700.js';
9
9
  * @fires remove - Dispatched when the user clicks on the chip
10
10
  */
11
11
  class LeuChipRemovable extends LeuChipBase {
12
- constructor() {
13
- super();
14
-
15
- /** @internal */
16
- this._removeIcon = Icon("close", 16);
17
- }
18
12
  handleClick() {
19
13
  const customEvent = new CustomEvent("leu:remove", {
20
- bubble: true,
14
+ bubbles: true,
21
15
  composed: true
22
16
  });
23
17
  this.dispatchEvent(customEvent);
24
18
  }
25
19
  render() {
26
20
  return html`<button @click=${e => this.handleClick(e)} class="button">
27
- <span class="label">${this.label}</span>
28
- <div class="icon">${this._removeIcon}</div>
21
+ <span class="label"><slot></slot></span>
22
+ <leu-icon name="close" class="icon"></leu-icon>
29
23
  </button>`;
30
24
  }
31
25
  }
26
+ _defineProperty(LeuChipRemovable, "dependencies", {
27
+ "leu-icon": LeuIcon
28
+ });
32
29
  _defineProperty(LeuChipRemovable, "properties", {
33
30
  ...LeuChipBase.properties
34
31
  });
@@ -1,12 +1,22 @@
1
1
  /**
2
2
  * A chip component that can be selected.
3
- * @slot - The content of the chip
4
3
  * @tagname leu-chip-selectable
4
+ * @slot - The content of the chip
5
+ * @prop {keyof typeof SIZES} size - The size of the chip. Not supported for radio variant.
6
+ * @prop {keyof typeof VARIANTS} variant - `toggle` or `radio`. Determines if only one or multiple chips can be selected.
7
+ * @prop {boolean} checked - Whether the chip is selected.
8
+ * @prop {string} value - The value of the chip.
5
9
  */
6
10
  export class LeuChipSelectable extends LeuChipBase {
7
11
  size: string;
12
+ /**
13
+ * The variant of the chip. Has an effect not only on the visual appearance but also on the behavior.
14
+ * - `toggle`: The chip behaves like a toggle button.
15
+ * - `radio`: The chip behaves like a radio button.
16
+ * @default "toggle"
17
+ */
8
18
  variant: string;
9
- selected: boolean;
19
+ checked: boolean;
10
20
  handleClick(): void;
11
21
  render(): import("lit-html").TemplateResult<1>;
12
22
  }
@@ -1 +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"}
1
+ {"version":3,"file":"ChipSelectable.d.ts","sourceRoot":"","sources":["ChipSelectable.js"],"names":[],"mappings":"AAaA;;;;;;;;GAQG;AACH;IAGI,aAAyB;IAEzB;;;;;OAKG;IACH,gBAA8B;IAC9B,iBAAoB;IAKtB,oBAiBC;IACD,+CAQC;CACF;;;;;;;;;4BAhE2B,WAAW"}