@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
package/dist/MenuItem.js CHANGED
@@ -1,8 +1,7 @@
1
- import { _ as _defineProperty } from './_rollupPluginBabelHelpers-20f659f4.js';
2
- import { css, LitElement, nothing } from 'lit';
3
- import { html, unsafeStatic } from 'lit/static-html.js';
1
+ import { _ as _defineProperty, L as LeuElement } from './LeuElement-ba5ea33d.js';
2
+ import { css, html } from 'lit';
4
3
  import { ifDefined } from 'lit/directives/if-defined.js';
5
- import { a as ICON_NAMES, I as Icon } from './icon-03e86700.js';
4
+ import { LeuIcon } from './Icon.js';
6
5
 
7
6
  var css_248z = css`:host,
8
7
  :host * {
@@ -12,9 +11,10 @@ var css_248z = css`:host,
12
11
  :host {
13
12
  --background: var(--leu-color-black-0);
14
13
  --background-hover: var(--leu-color-black-10);
15
- --background-active: var(--leu-color-func-cyan);
14
+ --background-active: var(--leu-color-accent-blue);
16
15
  --background-disabled: var(--leu-color-black-black-0);
17
16
  --color: var(--leu-color-black-transp-60);
17
+ --color-active: var(--leu-color-black-0);
18
18
  --color-disabled: var(--leu-color-black-transp-20);
19
19
  --font-regular: var(--leu-font-family-regular);
20
20
  --font-black: var(--leu-font-family-black);
@@ -38,6 +38,7 @@ var css_248z = css`:host,
38
38
 
39
39
  padding: 0.75rem;
40
40
 
41
+ font-family: inherit;
41
42
  font-size: 1rem;
42
43
  line-height: 1.5;
43
44
  text-align: left;
@@ -52,21 +53,27 @@ var css_248z = css`:host,
52
53
  }
53
54
 
54
55
  .button:hover,
55
- :host([highlighted]) .button {
56
+ .button:focus-visible {
56
57
  --background: var(--background-hover);
57
58
  }
58
59
 
60
+ /*
61
+ * These colors do not match with the design system (yet).
62
+ * But at least they are compliant with the WCAG AA contrast ratio.
63
+ */
64
+
59
65
  :host([active]) .button {
60
66
  --background: var(--background-active);
67
+ --color: var(--color-active);
61
68
  }
62
69
 
63
70
  :host([disabled]) .button {
64
71
  --background: var(--background-disabled);
65
72
  --color: var(--color-disabled);
66
- cursor: default;
73
+ cursor: not-allowed;
67
74
  }
68
75
 
69
- .before svg, .after svg {
76
+ .before leu-icon, .after leu-icon {
70
77
  display: block;
71
78
  }
72
79
 
@@ -84,102 +91,142 @@ var css_248z = css`:host,
84
91
  }
85
92
  `;
86
93
 
94
+ /**
95
+ * @typedef {'menuitem' | 'menuitemcheckbox' | 'menuitemradio' | 'option' | 'none'} MenuItemRole
96
+ */
97
+
87
98
  /**
88
99
  * @tagname leu-menu-item
89
100
  * @slot - The label of the menu item
101
+ * @property {boolean} active - Defines if the item is selected or checked
102
+ * @property {boolean} disabled - Disables the underlying button or link
103
+ * @property {string} value - The value of the item. It must not contain commas. See `getValue()`
104
+ * @property {string} href - The href of the underlying link
105
+ * @property {boolean} tabbable - If the item should be focusable. Will be reflected as `tabindex` to the underlying button or link
106
+ * @property {MenuItemRole} componentRole - The role of the item. This will be reflected as `role` to the underlying button or link. Default is `'menuitem'.`
90
107
  */
91
- class LeuMenuItem extends LitElement {
108
+ class LeuMenuItem extends LeuElement {
92
109
  constructor() {
93
110
  super();
94
111
  this.active = false;
95
112
  this.disabled = false;
113
+ this.value = undefined;
114
+ this.href = undefined;
115
+ this.tabbable = undefined;
96
116
 
97
- /**
98
- * A programmatic way to highlight the menu item like it is hovered.
99
- * This is just a visual effect and does not change the active state.
100
- */
101
- this.highlighted = false;
117
+ /** @type {MenuItemRole} */
118
+ this.componentRole = "menuitem";
102
119
  }
103
- static getIconOrText(name) {
104
- if (ICON_NAMES.includes(name)) {
105
- return Icon(name);
106
- }
107
- if (name === "EMPTY") {
108
- return html`<div class="icon-placeholder"></div>`;
120
+ connectedCallback() {
121
+ super.connectedCallback();
122
+ this.addEventListener("click", this._handleClick, true);
123
+ }
124
+ disconnectedCallback() {
125
+ super.disconnectedCallback();
126
+ this.removeEventListener("click", this._handleClick, true);
127
+ }
128
+ _handleClick(event) {
129
+ if (this.disabled) {
130
+ event.stopPropagation();
131
+ event.preventDefault();
109
132
  }
110
- return name;
111
133
  }
112
- renderBefore() {
113
- if (this.before) {
114
- const content = LeuMenuItem.getIconOrText(this.before);
115
- return html`<span class="before">${content}</span>`;
134
+
135
+ /**
136
+ * Returns the value of the item. If `value` is not set, it will return the inner text
137
+ * @returns {string}
138
+ */
139
+ getValue() {
140
+ return this.value || this.innerText;
141
+ }
142
+ _getAria() {
143
+ const commonAttributes = {
144
+ disabled: this.disabled
145
+ };
146
+ if (this.href) {
147
+ return commonAttributes;
116
148
  }
117
- return nothing;
149
+ return {
150
+ ...commonAttributes,
151
+ checked: this.componentRole === "menuitemcheckbox" || this.componentRole === "menuitemradio" ? this.active : undefined,
152
+ selected: this.componentRole === "option" ? this.active : undefined,
153
+ role: this.componentRole === "none" ? undefined : this.componentRole
154
+ };
118
155
  }
119
- renderAfter() {
120
- if (this.after) {
121
- const content = LeuMenuItem.getIconOrText(this.after);
122
- return html`<span class="after">${content}</span>`;
156
+ _getTabIndex() {
157
+ if (typeof this.tabbable === "boolean") {
158
+ return this.tabbable ? 0 : -1;
123
159
  }
124
- return nothing;
160
+ return undefined;
161
+ }
162
+ _renderLink(content) {
163
+ const aria = this._getAria();
164
+ return html`<a
165
+ class="button"
166
+ href=${this.href}
167
+ aria-disabled=${ifDefined(aria.disabled)}
168
+ aria-checked=${ifDefined(aria.checked)}
169
+ aria-selected=${ifDefined(aria.selected)}
170
+ role=${ifDefined(aria.role)}
171
+ tabindex=${ifDefined(this._getTabIndex())}
172
+ >${content}</a
173
+ >`;
125
174
  }
126
- getTagName() {
127
- return this.href ? "a" : "button";
175
+ _renderButton(content) {
176
+ const aria = this._getAria();
177
+ return html`<button
178
+ class="button"
179
+ aria-disabled=${ifDefined(aria.disabled)}
180
+ aria-checked=${ifDefined(aria.checked)}
181
+ aria-selected=${ifDefined(aria.selected)}
182
+ role=${ifDefined(aria.role)}
183
+ tabindex=${ifDefined(this._getTabIndex())}
184
+ >
185
+ ${content}
186
+ </button>`;
128
187
  }
129
188
  render() {
130
- /* The eslint rules don't recognize html import from lit/static-html.js */
131
- /* eslint-disable lit/binding-positions, lit/no-invalid-html */
132
- return html`<${unsafeStatic(this.getTagName())} class="button" href=${ifDefined(this.href)} ?disabled=${this.disabled}>
133
- ${this.renderBefore()}<span class="label">${this.label}</span
134
- >${this.renderAfter()}
135
- </${unsafeStatic(this.getTagName())}>`;
136
- /* eslint-enable lit/binding-positions, lit/no-invalid-html */
189
+ const content = html`
190
+ <slot class="before" name="before"></slot>
191
+ <span class="label"><slot></slot></span>
192
+ <slot class="after" name="after"></slot>
193
+ `;
194
+ return this.href ? this._renderLink(content) : this._renderButton(content);
137
195
  }
138
196
  }
197
+ _defineProperty(LeuMenuItem, "dependencies", {
198
+ "leu-icon": LeuIcon
199
+ });
139
200
  _defineProperty(LeuMenuItem, "styles", css_248z);
140
201
  /**
141
202
  * @internal
142
203
  */
143
204
  _defineProperty(LeuMenuItem, "shadowRootOptions", {
144
- ...LitElement.shadowRootOptions,
205
+ ...LeuElement.shadowRootOptions,
145
206
  delegatesFocus: true
146
207
  });
147
208
  _defineProperty(LeuMenuItem, "properties", {
148
- /**
149
- * Can be either an icon name or a text
150
- * If no icon with this value is found, it will be displayed as text.
151
- * If the value is "EMPTY", an empty placeholder with the size of an icon will be displayed.
152
- */
153
- before: {
154
- type: String,
155
- reflect: true
156
- },
157
- /**
158
- * Can be either an icon name or a text
159
- * If no icon with this value is found, it will be displayed as text
160
- * If the value is "EMPTY", an empty placeholder with the size of an icon will be displayed.
161
- */
162
- after: {
163
- type: String,
164
- reflect: true
165
- },
166
209
  active: {
167
210
  type: Boolean,
168
211
  reflect: true
169
212
  },
170
- highlighted: {
213
+ disabled: {
171
214
  type: Boolean,
172
215
  reflect: true
173
216
  },
174
- disabled: {
217
+ tabbable: {
175
218
  type: Boolean,
176
219
  reflect: true
177
220
  },
178
- label: {
221
+ href: {
222
+ type: String,
223
+ reflect: true
224
+ },
225
+ value: {
179
226
  type: String,
180
227
  reflect: true
181
228
  },
182
- href: {
229
+ componentRole: {
183
230
  type: String,
184
231
  reflect: true
185
232
  }
@@ -1,12 +1,19 @@
1
1
  /**
2
2
  * @tagname leu-pagination
3
3
  */
4
- export class LeuPagination extends LitElement {
4
+ export class LeuPagination extends LeuElement {
5
5
  /** @type {Number} */
6
6
  numOfItems: number;
7
7
  /** @type {Number} */
8
8
  itemsPerPage: number;
9
- /** @type {Number} */
9
+ /**
10
+ * Internal page state that contains an
11
+ * already clamped page number. Should only
12
+ * be accessed through the `page` getter and
13
+ * setter.
14
+ * @type {Number}
15
+ * @internal
16
+ */
10
17
  _page: number;
11
18
  attributeChangedCallback(name: any, oldVal: any, newVal: any): void;
12
19
  set page(page: number);
@@ -23,5 +30,5 @@ export class LeuPagination extends LitElement {
23
30
  _handleKeyDown(event: any): void;
24
31
  render(): import("lit-html").TemplateResult<1>;
25
32
  }
26
- import { LitElement } from 'lit';
33
+ import { L as LeuElement } from './LeuElement-ba5ea33d.js';
27
34
  //# sourceMappingURL=Pagination.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Pagination.d.ts","sourceRoot":"","sources":["Pagination.js"],"names":[],"mappings":"AA2EA;;GAEG;AACH;IAII,qBAAqB;IACrB,mBAAmB;IACnB,qBAAqB;IACrB,qBAAqB;IACrB,qBAAqB;IACrB,cAAc;IAEhB,oEAKC;IAID,uBAEC;IALD,mBAEC;IAID,yBAEC;IACD,uBAEC;IACD,uBAEC;IACD,wBAEC;IACD,uBAEC;IACD,8BAEC;IACD,6BAaC;IACD,gCAEC;IACD,+BAKC;IACD,iCASC;IACD,+CAsCC;CACF;2BA9LqC,KAAK"}
1
+ {"version":3,"file":"Pagination.d.ts","sourceRoot":"","sources":["Pagination.js"],"names":[],"mappings":"AAwEA;;GAEG;AACH;IAII,qBAAqB;IACrB,mBAAmB;IAEnB,qBAAqB;IACrB,qBAAqB;IAErB;;;;;;;OAOG;IACH,cAAc;IAEhB,oEAKC;IAID,uBAEC;IALD,mBAEC;IAID,yBAEC;IACD,uBAEC;IACD,uBAEC;IACD,wBAEC;IACD,uBAEC;IACD,8BAEC;IACD,6BAaC;IACD,gCAEC;IACD,+BAKC;IACD,iCASC;IACD,+CAsCC;CACF;gCArMqD,0BAA0B"}
@@ -1,14 +1,11 @@
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 { live } from 'lit/directives/live.js';
4
- import './leu-button.js';
5
- import './leu-visually-hidden.js';
6
- import './defineElement-40372b4b.js';
7
- import './Button-5326c982.js';
4
+ import { L as LeuButton } from './Button-7370f901.js';
5
+ import { LeuVisuallyHidden } from './VisuallyHidden.js';
6
+ import { LeuIcon } from './Icon.js';
8
7
  import 'lit/directives/class-map.js';
9
8
  import 'lit/directives/if-defined.js';
10
- import './icon-03e86700.js';
11
- import './VisuallyHidden.js';
12
9
 
13
10
  var css_248z = css`:host {
14
11
  margin-top: 16px;
@@ -76,15 +73,24 @@ const MIN_PAGE = 1;
76
73
  /**
77
74
  * @tagname leu-pagination
78
75
  */
79
- class LeuPagination extends LitElement {
76
+ class LeuPagination extends LeuElement {
80
77
  constructor() {
81
78
  super();
82
79
 
83
80
  /** @type {Number} */
84
81
  this.numOfItems = 1;
82
+
85
83
  /** @type {Number} */
86
84
  this.itemsPerPage = 1;
87
- /** @type {Number} */
85
+
86
+ /**
87
+ * Internal page state that contains an
88
+ * already clamped page number. Should only
89
+ * be accessed through the `page` getter and
90
+ * setter.
91
+ * @type {Number}
92
+ * @internal
93
+ */
88
94
  this._page = 1;
89
95
  }
90
96
  attributeChangedCallback(name, oldVal, newVal) {
@@ -169,33 +175,38 @@ class LeuPagination extends LitElement {
169
175
  <div class="label">von ${this._maxPage}</div>
170
176
  <div class="button-group">
171
177
  <leu-button
172
- icon="angleLeft"
173
178
  variant="secondary"
174
179
  label="Vorherige Seite"
175
180
  @click=${_ => {
176
181
  this._updatePage(this.page - 1);
177
182
  }}
178
183
  ?disabled=${this._isFirstPage()}
184
+ ><leu-icon name="angleLeft"></leu-icon
179
185
  ></leu-button>
180
186
  <leu-button
181
- icon="angleRight"
182
187
  variant="secondary"
183
188
  label="Nächste Seite"
184
189
  @click=${_ => {
185
190
  this._updatePage(this.page + 1);
186
191
  }}
187
192
  ?disabled=${this._isLastPage()}
193
+ ><leu-icon name="angleRight"></leu-icon
188
194
  ></leu-button>
189
195
  </div>
190
196
  `;
191
197
  }
192
198
  }
199
+ _defineProperty(LeuPagination, "dependencies", {
200
+ "leu-button": LeuButton,
201
+ "leu-icon": LeuIcon,
202
+ "leu-visually-hidden": LeuVisuallyHidden
203
+ });
193
204
  _defineProperty(LeuPagination, "styles", css_248z);
194
205
  /**
195
206
  * @internal
196
207
  */
197
208
  _defineProperty(LeuPagination, "shadowRootOptions", {
198
- ...LitElement.shadowRootOptions,
209
+ ...LeuElement.shadowRootOptions,
199
210
  delegatesFocus: true
200
211
  });
201
212
  _defineProperty(LeuPagination, "properties", {
@@ -211,14 +222,6 @@ _defineProperty(LeuPagination, "properties", {
211
222
  type: Number,
212
223
  reflect: true
213
224
  },
214
- /**
215
- * Internal page state that contains an
216
- * already clamped page number. Should only
217
- * be accessed through the `page` getter and
218
- * setter.
219
- * @type {Number}
220
- * @internal
221
- */
222
225
  _page: {
223
226
  state: true
224
227
  }
package/dist/Popup.d.ts CHANGED
@@ -1,18 +1,36 @@
1
+ export type Placement = "top" | "top-start" | "top-end" | "bottom" | "bottom-start" | "bottom-end" | "left" | "left-start" | "left-end" | "right" | "right-start" | "right-end";
2
+ /**
3
+ * @typedef {"top"|"top-start"|"top-end"|"bottom"|"bottom-start"|"bottom-end"|"left"|"left-start"|"left-end"|"right"|"right-start"|"right-end"} Placement
4
+ */
1
5
  /**
2
6
  * @tagname leu-popup
3
7
  */
4
- export class LeuPopup extends LitElement {
8
+ export class LeuPopup extends LeuElement {
5
9
  anchorEl: any;
6
10
  cleanup: () => void;
7
11
  flip: boolean;
8
12
  shift: boolean;
13
+ active: boolean;
14
+ /** @type {Placement} */
15
+ placement: Placement;
16
+ /** @type {"width" | "height" | "both"} */
17
+ matchSize: "width" | "height" | "both";
18
+ /** @type {"width" | "height" | "both"} */
19
+ autoSize: "width" | "height" | "both";
20
+ shiftPadding: number;
21
+ autoSizePadding: number;
22
+ /** @type {string | HTMLElement} */
23
+ anchor: string | HTMLElement;
9
24
  updated(changedProperties: any): void;
10
- get popupEl(): Element;
25
+ /**
26
+ * @returns {HTMLElement | null}
27
+ */
28
+ get popupEl(): HTMLElement;
11
29
  start(): void;
12
30
  stop(): void;
13
31
  reposition(): void;
14
32
  handleAnchorChange(): void;
15
33
  render(): import("lit-html").TemplateResult<1>;
16
34
  }
17
- import { LitElement } from 'lit';
35
+ import { L as LeuElement } from './LeuElement-ba5ea33d.js';
18
36
  //# sourceMappingURL=Popup.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Popup.d.ts","sourceRoot":"","sources":["Popup.js"],"names":[],"mappings":"AAuCA;;GAEG;AACH;IAGI,cAAoB;IACpB,oBAAwB;IACxB,cAAiB;IACjB,eAAkB;IAMpB,sCAcC;IACD,uBAEC;IACD,cAKC;IACD,aAIC;IACD,mBAiEC;IACD,2BAiBC;IACD,+CAOC;CACF;2BA9KqC,KAAK"}
1
+ {"version":3,"file":"Popup.d.ts","sourceRoot":"","sources":["Popup.js"],"names":[],"mappings":"wBAyCa,KAAK,GAAC,WAAW,GAAC,SAAS,GAAC,QAAQ,GAAC,cAAc,GAAC,YAAY,GAAC,MAAM,GAAC,YAAY,GAAC,UAAU,GAAC,OAAO,GAAC,aAAa,GAAC,WAAW;AAD9I;;GAEG;AAEH;;GAEG;AACH;IAGI,cAAoB;IACpB,oBAAwB;IACxB,cAAiB;IACjB,eAAkB;IAClB,gBAAmB;IAEnB,wBAAwB;IACxB,WADW,SAAS,CACM;IAE1B,0CAA0C;IAC1C,WADW,OAAO,GAAG,QAAQ,GAAG,MAAM,CACZ;IAE1B,0CAA0C;IAC1C,UADW,OAAO,GAAG,QAAQ,GAAG,MAAM,CACb;IACzB,qBAAqB;IACrB,wBAAwB;IAExB,mCAAmC;IACnC,QADW,MAAM,GAAG,WAAW,CACR;IAMzB,sCAcC;IAED;;OAEG;IACH,2BAEC;IACD,cAKC;IACD,aAIC;IACD,mBAiEC;IACD,2BAiBC;IACD,+CAOC;CACF;gCAvMqD,0BAA0B"}
package/dist/Popup.js CHANGED
@@ -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 { autoUpdate, size, flip, shift, computePosition } from '@floating-ui/dom';
4
4
 
5
5
  var css_248z = css`:host,
@@ -28,6 +28,7 @@ var css_248z = css`:host,
28
28
  position: absolute;
29
29
  top: 0;
30
30
  left: 0;
31
+ z-index: var(--leu-z-index-popup);
31
32
  }
32
33
 
33
34
  /* TODO: Should visibility be a matter of the popup component? */
@@ -37,16 +38,35 @@ var css_248z = css`:host,
37
38
  }
38
39
  `;
39
40
 
41
+ /**
42
+ * @typedef {"top"|"top-start"|"top-end"|"bottom"|"bottom-start"|"bottom-end"|"left"|"left-start"|"left-end"|"right"|"right-start"|"right-end"} Placement
43
+ */
44
+
40
45
  /**
41
46
  * @tagname leu-popup
42
47
  */
43
- class LeuPopup extends LitElement {
48
+ class LeuPopup extends LeuElement {
44
49
  constructor() {
45
50
  super();
46
51
  this.anchorEl = null;
47
52
  this.cleanup = undefined;
48
53
  this.flip = false;
49
54
  this.shift = false;
55
+ this.active = false;
56
+
57
+ /** @type {Placement} */
58
+ this.placement = undefined;
59
+
60
+ /** @type {"width" | "height" | "both"} */
61
+ this.matchSize = undefined;
62
+
63
+ /** @type {"width" | "height" | "both"} */
64
+ this.autoSize = undefined;
65
+ this.shiftPadding = 0;
66
+ this.autoSizePadding = 0;
67
+
68
+ /** @type {string | HTMLElement} */
69
+ this.anchor = undefined;
50
70
  }
51
71
  disconnectedCallback() {
52
72
  super.disconnectedCallback();
@@ -67,6 +87,10 @@ class LeuPopup extends LitElement {
67
87
  this.reposition();
68
88
  }
69
89
  }
90
+
91
+ /**
92
+ * @returns {HTMLElement | null}
93
+ */
70
94
  get popupEl() {
71
95
  return this.renderRoot?.querySelector(".popup") ?? null;
72
96
  }
@@ -176,39 +200,42 @@ class LeuPopup extends LitElement {
176
200
  }
177
201
  _defineProperty(LeuPopup, "styles", css_248z);
178
202
  _defineProperty(LeuPopup, "shadowRootOptions", {
179
- ...LitElement.shadowRootOptions,
203
+ ...LeuElement.shadowRootOptions,
180
204
  delegatesFocus: true
181
205
  });
182
206
  _defineProperty(LeuPopup, "properties", {
183
207
  anchor: {},
184
208
  active: {
185
- type: Boolean
209
+ type: Boolean,
210
+ reflect: true
186
211
  },
187
- /**
188
- * @type {"top"|"top-start"|"top-end"|"bottom"|"bottom-start"|"bottom-end"|"left"|"left-start"|"left-end"|"right"|"right-start"|"right-end"}
189
- */
190
212
  placement: {
191
- type: String
213
+ type: String,
214
+ reflect: true
192
215
  },
193
216
  flip: {
194
- type: Boolean
217
+ type: Boolean,
218
+ reflect: true
195
219
  },
196
220
  shift: {
197
- type: Boolean
221
+ type: Boolean,
222
+ reflect: true
198
223
  },
199
224
  shiftPadding: {
200
- type: Number
225
+ type: Number,
226
+ reflect: true
201
227
  },
202
- /** @type {"width" | "height" | "both"} */
203
228
  matchSize: {
204
- type: String
229
+ type: String,
230
+ reflect: true
205
231
  },
206
- /** @type {"width" | "height" | "both"} */
207
232
  autoSize: {
208
- type: String
233
+ type: String,
234
+ reflect: true
209
235
  },
210
236
  autoSizePadding: {
211
- type: Number
237
+ type: Number,
238
+ reflect: true
212
239
  }
213
240
  });
214
241
 
package/dist/Radio.d.ts CHANGED
@@ -1,12 +1,14 @@
1
1
  /**
2
2
  * @tagname leu-radio
3
3
  */
4
- export class LeuRadio extends LitElement {
4
+ export class LeuRadio extends LeuElement {
5
5
  checked: boolean;
6
6
  disabled: boolean;
7
+ name: string;
8
+ value: string;
7
9
  handleChange(event: any): void;
8
10
  handleInput(event: any): void;
9
11
  render(): import("lit-html").TemplateResult<1>;
10
12
  }
11
- import { LitElement } from 'lit';
13
+ import { L as LeuElement } from './LeuElement-ba5ea33d.js';
12
14
  //# sourceMappingURL=Radio.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Radio.d.ts","sourceRoot":"","sources":["Radio.js"],"names":[],"mappings":"AAgGA;;GAEG;AACH;IAGI,iBAAoB;IACpB,kBAAqB;IAEvB,+BAIC;IACD,8BAEC;IACD,+CAeC;CACF;2BAhIqC,KAAK"}
1
+ {"version":3,"file":"Radio.d.ts","sourceRoot":"","sources":["Radio.js"],"names":[],"mappings":"AAgGA;;GAEG;AACH;IAGI,iBAAoB;IACpB,kBAAqB;IACrB,aAAc;IACd,cAAe;IAEjB,+BAIC;IACD,8BAEC;IACD,+CAeC;CACF;gCAnIqD,0BAA0B"}
package/dist/Radio.js CHANGED
@@ -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
  --radio-color: var(--leu-color-black-40);
@@ -97,11 +97,13 @@ var css_248z = css`:host {
97
97
  /**
98
98
  * @tagname leu-radio
99
99
  */
100
- class LeuRadio extends LitElement {
100
+ class LeuRadio extends LeuElement {
101
101
  constructor() {
102
102
  super();
103
103
  this.checked = false;
104
104
  this.disabled = false;
105
+ this.name = "";
106
+ this.value = "";
105
107
  }
106
108
  handleChange(event) {
107
109
  this.checked = event.target.checked;
@@ -114,7 +116,7 @@ class LeuRadio extends LitElement {
114
116
  render() {
115
117
  return html`
116
118
  <input
117
- id=${this.identifier}
119
+ id=${`radio-${this.name}`}
118
120
  class="radio"
119
121
  type="radio"
120
122
  name="${this.name}"
@@ -124,13 +126,14 @@ class LeuRadio extends LitElement {
124
126
  ?disabled=${this.disabled}
125
127
  .value=${this.value}
126
128
  />
127
- <label for=${this.identifier} class="label">${this.label}</label>
129
+ <label for=${`radio-${this.name}`} class="label"><slot></slot></label>
128
130
  `;
129
131
  }
130
132
  }
131
133
  _defineProperty(LeuRadio, "styles", css_248z);
134
+ /** @internal */
132
135
  _defineProperty(LeuRadio, "shadowRootOptions", {
133
- ...LitElement.shadowRootOptions,
136
+ ...LeuElement.shadowRootOptions,
134
137
  delegatesFocus: true
135
138
  });
136
139
  _defineProperty(LeuRadio, "properties", {
@@ -142,10 +145,6 @@ _defineProperty(LeuRadio, "properties", {
142
145
  type: Boolean,
143
146
  reflect: true
144
147
  },
145
- identifier: {
146
- type: String,
147
- reflect: true
148
- },
149
148
  value: {
150
149
  type: String,
151
150
  reflect: true
@@ -153,10 +152,6 @@ _defineProperty(LeuRadio, "properties", {
153
152
  name: {
154
153
  type: String,
155
154
  reflect: true
156
- },
157
- label: {
158
- type: String,
159
- reflect: true
160
155
  }
161
156
  });
162
157
 
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @tagname leu-radio-group
3
3
  */
4
- export class LeuRadioGroup extends LitElement {
4
+ export class LeuRadioGroup extends LeuElement {
5
5
  _currentIndex: number;
6
6
  orientation: string;
7
7
  items: any[];
@@ -16,5 +16,5 @@ export class LeuRadioGroup extends LitElement {
16
16
  initializeIndex(): void;
17
17
  render(): import("lit-html").TemplateResult<1>;
18
18
  }
19
- import { LitElement } from 'lit';
19
+ import { L as LeuElement } from './LeuElement-ba5ea33d.js';
20
20
  //# sourceMappingURL=RadioGroup.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RadioGroup.d.ts","sourceRoot":"","sources":["RadioGroup.js"],"names":[],"mappings":"AAqCA;;GAEG;AACH;IAIM,sBAAiD;IA6BnD,oBAA+B;IAE/B,aAAe;IAEjB,iBAGC;IAUD,0BAIC;IACD,6BAIC;IACD,yBAEC;IACD,qCAIC;IACD,yDAaC;IACD,oBAQC;IACD,oBAIC;IACD,wBAIC;IACD,+CAWC;CACF;2BAxJqC,KAAK"}
1
+ {"version":3,"file":"RadioGroup.d.ts","sourceRoot":"","sources":["RadioGroup.js"],"names":[],"mappings":"AAqCA;;GAEG;AACH;IAIM,sBAAiD;IA2BnD,oBAA+B;IAE/B,aAAe;IAEjB,iBAGC;IAUD,0BAaC;IACD,6BAMC;IACD,yBAEC;IACD,qCAIC;IACD,yDAaC;IACD,oBAQC;IACD,oBAIC;IACD,wBAIC;IACD,+CAWC;CACF;gCAlKqD,0BAA0B"}