@statistikzh/leu 0.5.0 → 0.6.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 (240) hide show
  1. package/.husky/commit-msg +0 -3
  2. package/.husky/pre-commit +0 -3
  3. package/CHANGELOG.md +48 -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 -26
  10. package/dist/{Button-da11d064.d.ts → Button-9692e403.d.ts} +10 -11
  11. package/dist/Button-9692e403.d.ts.map +1 -0
  12. package/dist/{Button-da11d064.js → Button-9692e403.js} +65 -62
  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 -19
  21. package/dist/CheckboxGroup.d.ts +2 -2
  22. package/dist/CheckboxGroup.d.ts.map +1 -1
  23. package/dist/CheckboxGroup.js +4 -6
  24. package/dist/Chip.d.ts +2 -2
  25. package/dist/Chip.d.ts.map +1 -1
  26. package/dist/Chip.js +6 -13
  27. package/dist/ChipGroup.d.ts +9 -7
  28. package/dist/ChipGroup.d.ts.map +1 -1
  29. package/dist/ChipGroup.js +8 -5
  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 +9 -1
  37. package/dist/ChipSelectable.d.ts.map +1 -1
  38. package/dist/ChipSelectable.js +12 -16
  39. package/dist/Dropdown.d.ts +9 -5
  40. package/dist/Dropdown.d.ts.map +1 -1
  41. package/dist/Dropdown.js +73 -32
  42. package/dist/Icon.d.ts +20 -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 +7 -16
  46. package/dist/Input.d.ts.map +1 -1
  47. package/dist/Input.js +24 -28
  48. package/dist/LeuElement-6de6f209.d.ts +7 -0
  49. package/dist/LeuElement-6de6f209.d.ts.map +1 -0
  50. package/dist/LeuElement-6de6f209.js +43 -0
  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 -19
  63. package/dist/Radio.d.ts +4 -2
  64. package/dist/Radio.d.ts.map +1 -1
  65. package/dist/Radio.js +9 -16
  66. package/dist/RadioGroup.d.ts +2 -2
  67. package/dist/RadioGroup.d.ts.map +1 -1
  68. package/dist/RadioGroup.js +4 -6
  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 -183
  75. package/dist/Table.d.ts +2 -6
  76. package/dist/Table.d.ts.map +1 -1
  77. package/dist/Table.js +17 -18
  78. package/dist/VisuallyHidden.d.ts +2 -2
  79. package/dist/VisuallyHidden.d.ts.map +1 -1
  80. package/dist/VisuallyHidden.js +5 -7
  81. package/dist/{index.js.d.ts → index.d.ts} +3 -3
  82. package/dist/index.d.ts.map +1 -0
  83. package/dist/{index.js.js → index.js} +5 -14
  84. package/dist/leu-accordion.d.ts.map +1 -1
  85. package/dist/leu-accordion.js +2 -3
  86. package/dist/leu-breadcrumb.d.ts.map +1 -1
  87. package/dist/leu-breadcrumb.js +4 -10
  88. package/dist/leu-button-group.d.ts.map +1 -1
  89. package/dist/leu-button-group.js +2 -3
  90. package/dist/leu-button.d.ts +1 -1
  91. package/dist/leu-button.d.ts.map +1 -1
  92. package/dist/leu-button.js +4 -5
  93. package/dist/leu-checkbox-group.d.ts.map +1 -1
  94. package/dist/leu-checkbox-group.js +2 -3
  95. package/dist/leu-checkbox.d.ts.map +1 -1
  96. package/dist/leu-checkbox.js +3 -4
  97. package/dist/leu-chip-group.d.ts.map +1 -1
  98. package/dist/leu-chip-group.js +2 -3
  99. package/dist/leu-chip-link.d.ts.map +1 -1
  100. package/dist/leu-chip-link.js +2 -3
  101. package/dist/leu-chip-removable.d.ts.map +1 -1
  102. package/dist/leu-chip-removable.js +3 -4
  103. package/dist/leu-chip-selectable.d.ts.map +1 -1
  104. package/dist/leu-chip-selectable.js +2 -3
  105. package/dist/leu-dropdown.d.ts.map +1 -1
  106. package/dist/leu-dropdown.js +5 -10
  107. package/dist/leu-icon.d.ts +3 -0
  108. package/dist/leu-icon.d.ts.map +1 -0
  109. package/dist/leu-icon.js +7 -0
  110. package/dist/leu-input.d.ts.map +1 -1
  111. package/dist/leu-input.js +3 -4
  112. package/dist/leu-menu-item.d.ts.map +1 -1
  113. package/dist/leu-menu-item.js +3 -5
  114. package/dist/leu-menu.d.ts.map +1 -1
  115. package/dist/leu-menu.js +5 -3
  116. package/dist/leu-pagination.d.ts.map +1 -1
  117. package/dist/leu-pagination.js +4 -7
  118. package/dist/leu-popup.d.ts.map +1 -1
  119. package/dist/leu-popup.js +2 -3
  120. package/dist/leu-radio-group.d.ts.map +1 -1
  121. package/dist/leu-radio-group.js +2 -3
  122. package/dist/leu-radio.d.ts.map +1 -1
  123. package/dist/leu-radio.js +2 -3
  124. package/dist/leu-scroll-top.d.ts.map +1 -1
  125. package/dist/leu-scroll-top.js +4 -6
  126. package/dist/leu-select.d.ts.map +1 -1
  127. package/dist/leu-select.js +5 -13
  128. package/dist/leu-table.d.ts.map +1 -1
  129. package/dist/leu-table.js +4 -8
  130. package/dist/leu-visually-hidden.d.ts.map +1 -1
  131. package/dist/leu-visually-hidden.js +2 -3
  132. package/dist/theme.css +2 -0
  133. package/dist/vscode.html-custom-data.json +616 -0
  134. package/dist/vue/index.d.ts +682 -0
  135. package/dist/web-types.json +1211 -0
  136. package/package.json +10 -13
  137. package/rollup.config.js +1 -1
  138. package/scripts/generate-component/templates/[Name].js +6 -3
  139. package/scripts/generate-component/templates/test/[name].test.js +1 -1
  140. package/src/components/accordion/Accordion.js +13 -10
  141. package/src/components/accordion/leu-accordion.js +1 -2
  142. package/src/components/breadcrumb/Breadcrumb.js +31 -18
  143. package/src/components/breadcrumb/leu-breadcrumb.js +1 -2
  144. package/src/components/button/Button.js +45 -71
  145. package/src/components/button/button.css +19 -4
  146. package/src/components/button/leu-button.js +1 -2
  147. package/src/components/button/stories/button.stories.js +60 -19
  148. package/src/components/button/test/button.test.js +26 -63
  149. package/src/components/button-group/ButtonGroup.js +4 -2
  150. package/src/components/button-group/leu-button-group.js +1 -2
  151. package/src/components/checkbox/Checkbox.js +17 -11
  152. package/src/components/checkbox/CheckboxGroup.js +6 -3
  153. package/src/components/checkbox/leu-checkbox-group.js +1 -2
  154. package/src/components/checkbox/leu-checkbox.js +1 -2
  155. package/src/components/checkbox/stories/checkbox-group.stories.js +10 -26
  156. package/src/components/checkbox/stories/checkbox.stories.js +2 -7
  157. package/src/components/checkbox/test/checkbox-group.test.js +6 -21
  158. package/src/components/checkbox/test/checkbox.test.js +1 -12
  159. package/src/components/chip/Chip.js +5 -4
  160. package/src/components/chip/ChipGroup.js +10 -4
  161. package/src/components/chip/ChipLink.js +3 -7
  162. package/src/components/chip/ChipRemovable.js +8 -11
  163. package/src/components/chip/ChipSelectable.js +11 -17
  164. package/src/components/chip/chip.css +3 -4
  165. package/src/components/chip/leu-chip-group.js +1 -2
  166. package/src/components/chip/leu-chip-link.js +1 -2
  167. package/src/components/chip/leu-chip-removable.js +1 -2
  168. package/src/components/chip/leu-chip-selectable.js +1 -2
  169. package/src/components/chip/stories/chip-link.stories.js +3 -5
  170. package/src/components/chip/stories/chip-removable.stories.js +3 -4
  171. package/src/components/chip/stories/chip-selectable.stories.js +2 -2
  172. package/src/components/chip/test/chip-group.test.js +15 -30
  173. package/src/components/chip/test/chip-link.test.js +2 -6
  174. package/src/components/chip/test/chip-removable.test.js +4 -10
  175. package/src/components/chip/test/chip-selectable.test.js +3 -5
  176. package/src/components/dropdown/Dropdown.js +80 -26
  177. package/src/components/dropdown/dropdown.css +4 -0
  178. package/src/components/dropdown/leu-dropdown.js +1 -2
  179. package/src/components/dropdown/stories/dropdown.stories.js +30 -7
  180. package/src/components/dropdown/test/dropdown.test.js +5 -5
  181. package/src/components/icon/Icon.js +55 -0
  182. package/src/components/icon/icon.css +6 -0
  183. package/src/components/icon/leu-icon.js +5 -0
  184. package/src/components/icon/{icon.js → paths.js} +4 -37
  185. package/src/components/icon/stories/icon.stories.js +47 -0
  186. package/src/components/icon/test/icon.test.js +23 -40
  187. package/src/components/input/Input.js +21 -23
  188. package/src/components/input/input.css +4 -2
  189. package/src/components/input/leu-input.js +1 -2
  190. package/src/components/input/stories/input.stories.js +2 -2
  191. package/src/components/input/test/input.test.js +2 -0
  192. package/src/components/menu/Menu.js +143 -2
  193. package/src/components/menu/MenuItem.js +104 -52
  194. package/src/components/menu/leu-menu-item.js +1 -2
  195. package/src/components/menu/leu-menu.js +1 -2
  196. package/src/components/menu/menu-item.css +11 -4
  197. package/src/components/menu/stories/menu-item.stories.js +15 -4
  198. package/src/components/menu/stories/menu.stories.js +34 -7
  199. package/src/components/menu/test/menu-item.test.js +88 -82
  200. package/src/components/menu/test/menu.test.js +101 -8
  201. package/src/components/pagination/Pagination.js +27 -18
  202. package/src/components/pagination/leu-pagination.js +1 -2
  203. package/src/components/popup/Popup.js +39 -16
  204. package/src/components/popup/leu-popup.js +1 -2
  205. package/src/components/popup/popup.css +1 -0
  206. package/src/components/radio/Radio.js +12 -7
  207. package/src/components/radio/RadioGroup.js +6 -3
  208. package/src/components/radio/leu-radio-group.js +1 -2
  209. package/src/components/radio/leu-radio.js +1 -2
  210. package/src/components/radio/stories/radio-group.stories.js +5 -19
  211. package/src/components/radio/stories/radio.stories.js +2 -7
  212. package/src/components/radio/test/radio-group.test.js +6 -9
  213. package/src/components/radio/test/radio.test.js +3 -13
  214. package/src/components/scroll-top/ScrollTop.js +15 -5
  215. package/src/components/scroll-top/leu-scroll-top.js +1 -2
  216. package/src/components/select/Select.js +279 -175
  217. package/src/components/select/leu-select.js +1 -2
  218. package/src/components/select/select.css +20 -12
  219. package/src/components/select/stories/select.stories.js +16 -2
  220. package/src/components/select/test/select.test.js +191 -37
  221. package/src/components/table/Table.js +15 -9
  222. package/src/components/table/leu-table.js +1 -2
  223. package/src/components/table/table.css +3 -1
  224. package/src/components/visually-hidden/VisuallyHidden.js +6 -2
  225. package/src/components/visually-hidden/leu-visually-hidden.js +1 -2
  226. package/src/lib/LeuElement.js +23 -0
  227. package/src/lib/a11y.js +26 -0
  228. package/src/styles/custom-properties.css +2 -0
  229. package/web-test-runner.config.mjs +2 -0
  230. package/dist/Button-da11d064.d.ts.map +0 -1
  231. package/dist/_rollupPluginBabelHelpers-20f659f4.d.ts +0 -3
  232. package/dist/_rollupPluginBabelHelpers-20f659f4.d.ts.map +0 -1
  233. package/dist/_rollupPluginBabelHelpers-20f659f4.js +0 -30
  234. package/dist/defineElement-40372b4b.d.ts +0 -9
  235. package/dist/defineElement-40372b4b.d.ts.map +0 -1
  236. package/dist/defineElement-40372b4b.js +0 -15
  237. package/dist/icon-03e86700.d.ts +0 -11
  238. package/dist/icon-03e86700.d.ts.map +0 -1
  239. package/dist/index.js.d.ts.map +0 -1
  240. package/src/lib/defineElement.js +0 -13
package/dist/Dropdown.js CHANGED
@@ -1,18 +1,13 @@
1
- import { _ as _defineProperty } from './_rollupPluginBabelHelpers-20f659f4.js';
2
- import { css, LitElement, html } from 'lit';
3
- import './leu-button.js';
4
- import './leu-menu.js';
5
- import './leu-menu-item.js';
6
- import './leu-popup.js';
7
- import './defineElement-40372b4b.js';
8
- import './Button-da11d064.js';
1
+ import { _ as _defineProperty, L as LeuElement } from './LeuElement-6de6f209.js';
2
+ import { css, html, nothing } from 'lit';
3
+ import { createRef, ref } from 'lit/directives/ref.js';
4
+ import { H as HasSlotController, L as LeuButton } from './Button-9692e403.js';
5
+ import { LeuMenu } from './Menu.js';
6
+ import { LeuMenuItem } from './MenuItem.js';
7
+ import { LeuPopup } from './Popup.js';
9
8
  import 'lit/directives/class-map.js';
10
9
  import 'lit/directives/if-defined.js';
11
- import './icon-03e86700.js';
12
- import './Menu.js';
13
- import './MenuItem.js';
14
- import 'lit/static-html.js';
15
- import './Popup.js';
10
+ import './Icon.js';
16
11
  import '@floating-ui/dom';
17
12
 
18
13
  var css_248z = css`:host,
@@ -31,56 +26,94 @@ var css_248z = css`:host,
31
26
 
32
27
  margin-top: 0.5rem;
33
28
  }
29
+
30
+ .button {
31
+ max-width: 100%;
32
+ }
34
33
  `;
35
34
 
36
35
  /**
37
36
  * @tagname leu-dropdown
38
37
  */
39
- class LeuDropdown extends LitElement {
38
+ class LeuDropdown extends LeuElement {
40
39
  constructor() {
41
40
  super();
41
+ _defineProperty(this, "hasSlotController", new HasSlotController(this, ["icon"]));
42
42
  _defineProperty(this, "_documentClickHandler", event => {
43
43
  if (!this.contains(event.target)) {
44
44
  this.expanded = false;
45
45
  }
46
46
  });
47
- _defineProperty(this, "_handleMenuItemClick", () => {
48
- this.expanded = false;
47
+ _defineProperty(this, "_menuItemClickHandler", e => {
48
+ if (e.target.tagName.toLowerCase() === "leu-menu-item") {
49
+ this.expanded = false;
50
+ this._toggleRef.value.focus();
51
+ }
52
+ });
53
+ /**
54
+ * Close the dropdown when the user presses the Escape or the Tab key.
55
+ * Navigating the menu with the arrow keys is handled by the menu itself.
56
+ * @param {KeyboardEvent} e
57
+ */
58
+ _defineProperty(this, "_keyDownMenuHandler", e => {
59
+ if (e.key === "Escape" || e.key === "Tab") {
60
+ e.preventDefault();
61
+ this.expanded = false;
62
+ this._toggleRef.value.focus();
63
+ }
49
64
  });
50
65
  this.label = "";
51
66
  this.expanded = false;
52
- this.menuItems = [];
67
+
68
+ /** @type {import("lit/directives/ref").Ref<HTMLButtonElement>} */
69
+ this._toggleRef = createRef();
53
70
  }
54
71
  connectedCallback() {
55
72
  super.connectedCallback();
56
73
  this.addEventListener("keyup", this._keyUpHandler);
57
74
  document.addEventListener("click", this._documentClickHandler);
75
+ const menu = this._getMenu();
76
+ menu.addEventListener("keydown", this._keyDownMenuHandler);
77
+ menu.addEventListener("click", this._menuItemClickHandler);
58
78
  }
59
79
  disconnectedCallback() {
60
80
  super.disconnectedCallback();
61
- this._removeMenuItemListeners();
62
81
  this.removeEventListener("keyup", this._keyUpHandler);
63
82
  document.removeEventListener("click", this._documentClickHandler);
83
+ const menu = this._getMenu();
84
+ menu.removeEventListener("keydown", this._keyDownMenuHandler);
85
+ menu.removeEventListener("click", this._menuItemClickHandler);
64
86
  }
65
87
  _keyUpHandler(event) {
66
88
  if (event.key === "Escape") {
67
89
  this.expanded = false;
68
90
  }
69
91
  }
70
- _handleSlotChange() {
71
- this._removeMenuItemListeners();
72
- this.menuItems = [...this.querySelectorAll("leu-menu > leu-menu-item")];
73
- this.menuItems.forEach(item => item.addEventListener("click", this._handleMenuItemClick));
74
- }
75
- _removeMenuItemListeners() {
76
- this.menuItems.forEach(item => {
77
- item.removeEventListener("click", this._handleMenuItemClick);
78
- });
92
+ async _keyDownToggleHandler(event) {
93
+ if (["ArrowDown", "ArrowUp", "Home", "End"].includes(event.key)) {
94
+ event.preventDefault();
95
+ const menu = this._getMenu();
96
+ this.expanded = true;
97
+ await this.updateComplete;
98
+ if (event.key === "ArrowDown" || event.key === "Home") {
99
+ menu.focusItem(0);
100
+ } else if (event.key === "ArrowUp" || event.key === "End") {
101
+ menu.focusItem(-1);
102
+ }
103
+ }
79
104
  }
80
105
  _handleToggleClick() {
81
106
  this.expanded = !this.expanded;
82
107
  }
108
+
109
+ /**
110
+ * @returns {import("../menu/Menu").LeuMenu}
111
+ */
112
+ _getMenu() {
113
+ return this.querySelector("leu-menu");
114
+ }
83
115
  render() {
116
+ const hasIcon = this.hasSlotController.test("icon");
84
117
  return html`
85
118
  <leu-popup
86
119
  ?active=${this.expanded}
@@ -91,23 +124,31 @@ class LeuDropdown extends LitElement {
91
124
  autoSizePadding="8"
92
125
  >
93
126
  <leu-button
127
+ ref=${ref(this._toggleRef)}
128
+ class="button"
94
129
  slot="anchor"
95
- icon="download"
96
130
  variant="ghost"
97
131
  expanded=${this.expanded ? "true" : "false"}
98
- aria-expanded=${this.expanded ? "true" : "false"}
99
- aria-controls="content"
100
132
  ?active=${this.expanded}
101
133
  @click=${this._handleToggleClick}
102
- >${this.label}</leu-button
134
+ @keydown=${this._keyDownToggleHandler}
135
+ >
136
+ ${hasIcon ? html`<slot name="icon" slot="before"></slot>` : nothing}
137
+ ${this.label}</leu-button
103
138
  >
104
139
  <div id="content" class="content" ?hidden=${!this.expanded}>
105
- <slot @slotchange=${this._handleSlotChange}></slot>
140
+ <slot></slot>
106
141
  </div>
107
142
  </leu-popup>
108
143
  `;
109
144
  }
110
145
  }
146
+ _defineProperty(LeuDropdown, "dependencies", {
147
+ "leu-button": LeuButton,
148
+ "leu-menu": LeuMenu,
149
+ "leu-menu-item": LeuMenuItem,
150
+ "leu-popup": LeuPopup
151
+ });
111
152
  _defineProperty(LeuDropdown, "styles", css_248z);
112
153
  _defineProperty(LeuDropdown, "properties", {
113
154
  label: {
package/dist/Icon.d.ts ADDED
@@ -0,0 +1,20 @@
1
+ export type IconPathName = "search" | "link" | "map" | "filter" | "time" | "hide" | "show" | "location" | "file" | "pause" | "play" | "stop" | "remove" | "clear" | "overflow" | "menu" | "close" | "home" | "email" | "forward" | "next" | "confirm" | "print" | "user" | "calendar" | "arrowDown" | "arrowUp" | "delete" | "minus" | "plus" | "comment" | "download" | "files" | "list" | "addNew" | "angleDropDown" | "angleDropup" | "angleLeft" | "angleRight" | "arrowLeft" | "arrowRight" | "caution" | "chatMessage" | "check" | "conference" | "confirmPlain" | "documents" | "edit" | "fileOutline" | "floppy" | "getInformation" | "lock" | "login" | "logout" | "mapLocateMe" | "mapLocation" | "mapNavigation" | "mapPin" | "menuOverflow" | "openMail" | "paperplane" | "paragraph" | "phoneCall" | "pin" | "resizeText" | "upload" | "cc" | "fastForward" | "fastRewind" | "fullScreen" | "playButton" | "previews" | "skipNext" | "skipPrevious" | "facebook" | "google" | "instagram" | "kununu" | "like" | "linkedin" | "love" | "repost" | "share" | "snapchat" | "twitter" | "users" | "vote" | "xing" | "youtube" | "youtubeLogo" | "smileyThrilled" | "smileySmile" | "smileyIndifferent" | "smileySad" | "smileyDevastated";
2
+ /**
3
+ * A component to render all defined zhWeb icons.
4
+ * The `fill` of the icon is set to `currentColor` and
5
+ * can be overriden by setting the css `color` property.
6
+ * If the icon name is not found, a placeholder will be displayed.
7
+ *
8
+ * @tagname leu-icon
9
+ * @prop {import("./paths").IconPathName} name - The name of the icon to display.
10
+ * @cssprop --leu-icon-size - The size of the icon.
11
+ */
12
+ export class LeuIcon extends LeuElement {
13
+ /**
14
+ * @type {import("./paths").IconPathName | ""}
15
+ */
16
+ name: any | "";
17
+ render(): import("lit-html").TemplateResult<1>;
18
+ }
19
+ import { L as LeuElement } from './LeuElement-6de6f209.js';
20
+ //# sourceMappingURL=Icon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["Icon.js"],"names":[],"mappings":";AAsHA;;;;;;;;;GASG;AACH;IAII;;OAEG;IACH,MAFU,GAA8B,GAAG,EAAE,CAE/B;IAEhB,+CAiBC;CACF;gCA3JqD,0BAA0B"}
@@ -1,11 +1,21 @@
1
- import { html, svg } from 'lit';
1
+ import { _ as _defineProperty, L as LeuElement } from './LeuElement-6de6f209.js';
2
+ import { css, html, svg } from 'lit';
2
3
 
3
- // to add new icons from zh web
4
- // - login into figma: https://www.figma.com/file/d6Pv21UVUbnBs3AdcZijHmbN?node-id=311:9677
5
- // - click icon and then export as svg on the right drawer
6
- // - copy svg path (multiple with space between)
7
- // - update @param {TYPE} with console.log() below
8
- const iconPaths = {
4
+ var css_248z = css`svg,
5
+ .placeholder {
6
+ display: block;
7
+ width: 1.5rem;
8
+ width: var(--leu-icon-size, 1.5rem);
9
+ height: 1.5rem;
10
+ height: var(--leu-icon-size, 1.5rem);
11
+ }
12
+ `;
13
+
14
+ /**
15
+ * @typedef {keyof paths} IconPathName
16
+ */
17
+
18
+ const paths = {
9
19
  addNew: "M12 1C5.926 1 1 5.925 1 12C1 18.075 5.926 23 12 23C18.074 23 23 18.075 23 12C23 5.925 18.074 1 12 1ZM17 13H13V17H11V13H7V11H11V7H13V11H17V13Z",
10
20
  angleDropDown: "M17 9.5L12 14.5L7 9.5L17 9.5Z",
11
21
  angleDropup: "M7 14.5L12 9.5L17 14.5H7Z",
@@ -38,8 +48,6 @@ const iconPaths = {
38
48
  getInformation: "M12 1C5.926 1 1 5.926 1 12C1 18.074 5.926 23 12 23C18.074 23 23 18.074 23 12C23 5.926 18.074 1 12 1ZM11.5 6C11.898 6.00013 12.2796 6.15835 12.5609 6.43984C12.8422 6.72133 13.0001 7.10304 13 7.501C12.9999 7.89896 12.8417 8.28056 12.5602 8.56187C12.2787 8.84317 11.897 9.00113 11.499 9.001C11.101 9.00087 10.7194 8.84265 10.4381 8.56116C10.1568 8.27967 9.99887 7.89796 9.999 7.5C9.99913 7.10204 10.1573 6.72044 10.4388 6.43913C10.7203 6.15783 11.102 5.99987 11.5 6ZM15 18H9V16H11V12H9V10H13V16H15V18Z",
39
49
  hide: "M23.7862 0.213819C23.6464 0.0767667 23.4584 0 23.2626 0C23.0668 0 22.8788 0.0767667 22.739 0.213819L16.9046 6.01077C15.3896 5.26962 13.7291 4.87365 12.0427 4.85138C5.31075 4.88878 0.598395 11.4711 0.411396 11.7329L0.112199 12.1817L0.411396 12.5931C1.81786 14.494 3.55313 16.128 5.53515 17.4177L0.299197 22.6536C0.213464 22.7179 0.142549 22.7999 0.0912528 22.894C0.0399571 22.9881 0.0094788 23.0921 0.00188187 23.199C-0.00571506 23.3059 0.00974673 23.4132 0.0472203 23.5136C0.0846938 23.614 0.143304 23.7051 0.219082 23.7809C0.29486 23.8567 0.386037 23.9153 0.486438 23.9528C0.586839 23.9903 0.694121 24.0057 0.801018 23.9981C0.907915 23.9905 1.01193 23.96 1.10602 23.9087C1.20012 23.8575 1.28209 23.7865 1.34639 23.7008L23.7862 1.26101C23.9232 1.12119 24 0.933204 24 0.737414C24 0.541625 23.9232 0.353641 23.7862 0.213819ZM7.55473 11.9947C7.55473 10.8044 8.02757 9.6629 8.86922 8.82125C9.71088 7.97959 10.8524 7.50675 12.0427 7.50675C12.9675 7.50625 13.8694 7.79383 14.6233 8.32954L8.37752 14.5753C7.84181 13.8215 7.55422 12.9195 7.55473 11.9947ZM19.56 7.61895L16.381 10.7979C16.5884 11.5629 16.5895 12.3692 16.3842 13.1347C16.1788 13.9002 15.7744 14.5978 15.2121 15.1563C14.6498 15.7148 13.9495 16.1145 13.1826 16.3146C12.4157 16.5148 11.6095 16.5082 10.8459 16.2957L8.34012 18.8014C9.52646 19.237 10.779 19.4647 12.0427 19.4746C18.7746 19.4746 23.487 12.8923 23.674 12.5931L23.9732 12.1817L23.674 11.7703C22.5141 10.1919 21.1279 8.7931 19.56 7.61895Z",
40
50
  home: "M23 10L12.0071 1L1 10V12L11.9925 3L23 12V10Z M3.375 12V23H9V17H15V23H20.625V12L12 5L3.375 12Z",
41
- layer1: "M15.875 6.875H9.125V0.125H6.875V6.875H0.125V9.125H6.875V15.875H9.125V9.125H15.875V6.875Z",
42
- layer11: "M0.5 0.5H16.25V2.75H0.5V0.5Z",
43
51
  link: "M22.2237 3.63526L20.3648 1.77638C19.7075 1.11912 18.816 0.749878 17.8864 0.749878C16.9569 0.749878 16.0654 1.11912 15.408 1.77638L12.3098 4.87501C11.6526 5.53238 11.2834 6.42386 11.2834 7.35338C11.2834 8.28291 11.6526 9.17438 12.3098 9.83176L12.6192 10.1415L13.182 10.704L14.4214 9.46501L13.8589 8.90251L13.5492 8.59238C13.2205 8.26374 13.0359 7.81804 13.0358 7.35327C13.0357 6.88851 13.2203 6.44275 13.5488 6.11401L16.647 3.01576C16.9758 2.68726 17.4215 2.50274 17.8862 2.50274C18.351 2.50274 18.7967 2.68726 19.1254 3.01576L20.9843 4.87501C21.3128 5.20368 21.4973 5.64934 21.4973 6.11401C21.4973 6.57868 21.3128 7.02433 20.9843 7.35301L17.886 10.4513C17.6013 10.7359 17.2273 10.9138 16.8268 10.9551C16.4264 10.9964 16.0239 10.8986 15.687 10.6781L14.4342 11.9306C15.1072 12.4782 15.9594 12.7568 16.8259 12.7125C17.6925 12.6682 18.5118 12.3041 19.1254 11.6906L22.2237 8.59238C22.5492 8.26693 22.8073 7.88055 22.9835 7.45531C23.1597 7.03007 23.2503 6.57429 23.2503 6.11401C23.2503 5.65372 23.1597 5.19795 22.9835 4.7727C22.8073 4.34746 22.5492 3.96108 22.2237 3.63563V3.63526ZM10.4513 17.8864L7.35304 20.9843C7.0243 21.3128 6.57859 21.4973 6.11385 21.4973C5.64912 21.4973 5.2034 21.3128 4.87467 20.9843L3.01579 19.1254C2.85296 18.9627 2.72378 18.7695 2.63565 18.5569C2.54751 18.3443 2.50215 18.1164 2.50215 17.8862C2.50215 17.656 2.54751 17.4281 2.63565 17.2155C2.72378 17.0029 2.85296 16.8097 3.01579 16.647L6.11404 13.5491C6.44274 13.2204 6.88856 13.0358 7.35342 13.0358C7.81827 13.0358 8.26409 13.2204 8.59279 13.5491L8.90179 13.8589L9.46429 14.4214L10.7037 13.1824L10.1408 12.6195L9.83179 12.3098C9.1744 11.6525 8.28285 11.2832 7.35323 11.2832C6.42361 11.2832 5.53206 11.6525 4.87467 12.3098L1.77642 15.408C1.45093 15.7335 1.19273 16.1198 1.01658 16.5451C0.840422 16.9703 0.749756 17.4261 0.749756 17.8864C0.749756 18.3467 0.840422 18.8024 1.01658 19.2277C1.19273 19.6529 1.45093 20.0393 1.77642 20.3648L3.63529 22.2236C4.2927 22.881 5.18433 23.2504 6.11404 23.2504C7.04375 23.2504 7.93538 22.881 8.59279 22.2236L11.6899 19.125C12.3032 18.5113 12.6672 17.692 12.7115 16.8255C12.7558 15.959 12.4774 15.1069 11.9299 14.4338L10.6774 15.6863C10.8981 16.0232 10.996 16.4258 10.9547 16.8264C10.9134 17.2271 10.7353 17.6012 10.4505 17.886L10.4513 17.8864Z M17.0416 6.95849C17.2058 7.12289 17.2981 7.34578 17.2981 7.57817C17.2981 7.81057 17.2058 8.03346 17.0416 8.19786L8.05806 17.181C7.97671 17.2624 7.88013 17.3269 7.77384 17.3709C7.66754 17.415 7.55361 17.4376 7.43856 17.4376C7.3235 17.4376 7.20957 17.415 7.10328 17.3709C6.99698 17.3269 6.90041 17.2624 6.81906 17.181C6.65471 17.0166 6.56238 16.7937 6.56238 16.5613C6.56238 16.3289 6.65471 16.106 6.81906 15.9416L15.8026 6.95849C15.9669 6.79434 16.1898 6.70215 16.4221 6.70215C16.6544 6.70215 16.8772 6.79434 17.0416 6.95849Z",
44
52
  list: "M5 5H2V8H5V5Z M22 5H8V8H22V5Z M2 11H5V14H2V11Z M22 11H8V14H22V11Z M2 17H5V20H2V17Z M22 17H8V20H22V17Z",
45
53
  lock: "M4.00211 15.1855C3.94503 17.4179 4.90163 19.6403 6.77048 21.1901C9.77412 23.6808 14.2259 23.6808 17.2296 21.1901C19.0987 19.6401 20.0553 17.4173 19.9979 15.1845C19.9993 15.1232 20 15.0617 20 15C20 13.4191 19.5414 11.9452 18.75 10.7043V6.48C18.75 2.90119 15.7279 0 12 0C8.2721 0 5.25002 2.90119 5.25002 6.48V10.7042C4.4586 11.9452 4 13.419 4 15C4 15.062 4.0007 15.1238 4.00211 15.1855ZM12 17C10.8954 17 10 16.1046 10 15C10 13.8954 10.8954 13 12 13C13.1046 13 14 13.8954 14 15C14 16.1046 13.1046 17 12 17ZM16.25 8.22103C15.0186 7.44741 13.5616 7 12 7C10.4384 7 8.98137 7.44741 7.75 8.22103V6.48C7.75 4.22668 9.65279 2.4 12 2.4C14.3472 2.4 16.25 4.22668 16.25 6.48V8.22103Z",
@@ -107,30 +115,51 @@ const iconPaths = {
107
115
  smileySad: "M11 0.5C8.9233 0.5 6.89323 1.11581 5.16652 2.26957C3.4398 3.42332 2.09399 5.0632 1.29927 6.98182C0.50455 8.90045 0.296614 11.0116 0.701759 13.0484C1.1069 15.0852 2.10693 16.9562 3.57538 18.4246C5.04383 19.8931 6.91476 20.8931 8.95156 21.2982C10.9884 21.7034 13.0996 21.4955 15.0182 20.7007C16.9368 19.906 18.5767 18.5602 19.7304 16.8335C20.8842 15.1068 21.5 13.0767 21.5 11C21.5 8.21523 20.3938 5.54451 18.4246 3.57538C16.4555 1.60625 13.7848 0.5 11 0.5ZM7.62501 7.25C7.99585 7.25 8.35836 7.35997 8.6667 7.56599C8.97504 7.77202 9.21537 8.06486 9.35728 8.40747C9.49919 8.75008 9.53633 9.12708 9.46398 9.4908C9.39163 9.85451 9.21305 10.1886 8.95083 10.4508C8.68861 10.713 8.35451 10.8916 7.9908 10.964C7.62709 11.0363 7.25008 10.9992 6.90747 10.8573C6.56486 10.7154 6.27203 10.475 6.066 10.1667C5.85997 9.85835 5.75 9.49584 5.75 9.125C5.74792 8.87565 5.796 8.62842 5.89137 8.39803C5.98675 8.16763 6.12748 7.95876 6.3052 7.78384C6.48292 7.60892 6.69399 7.47152 6.92588 7.37981C7.15776 7.2881 7.40572 7.24396 7.655 7.25H7.62501ZM14.855 16.94C14.4548 16.2753 13.8895 15.7255 13.214 15.3437C12.5385 14.962 11.7759 14.7614 11 14.7614C10.2241 14.7614 9.46146 14.962 8.786 15.3437C8.11054 15.7255 7.54525 16.2753 7.145 16.94L5.8625 16.19C6.39645 15.3049 7.15 14.5728 8.05011 14.0646C8.95021 13.5564 9.96634 13.2894 11 13.2894C12.0337 13.2894 13.0498 13.5564 13.9499 14.0646C14.85 14.5728 15.6036 15.3049 16.1375 16.19L14.855 16.94ZM14.375 11C13.8777 11 13.4008 10.8025 13.0492 10.4508C12.6975 10.0992 12.5 9.62228 12.5 9.125C12.5 8.62772 12.6975 8.15081 13.0492 7.79917C13.4008 7.44754 13.8777 7.25 14.375 7.25C14.8723 7.25 15.3492 7.44754 15.7008 7.79917C16.0525 8.15081 16.25 8.62772 16.25 9.125C16.25 9.62228 16.0525 10.0992 15.7008 10.4508C15.3492 10.8025 14.8723 11 14.375 11Z",
108
116
  smileyDevastated: "M11 0.5C8.9233 0.5 6.89323 1.11581 5.16652 2.26957C3.4398 3.42332 2.09399 5.0632 1.29927 6.98182C0.504549 8.90045 0.296614 11.0116 0.701759 13.0484C1.1069 15.0852 2.10693 16.9562 3.57538 18.4246C5.04383 19.8931 6.91476 20.8931 8.95156 21.2982C10.9884 21.7034 13.0996 21.4955 15.0182 20.7007C16.9368 19.906 18.5767 18.5602 19.7304 16.8335C20.8842 15.1068 21.5 13.0767 21.5 11C21.5 8.21523 20.3938 5.54451 18.4246 3.57538C16.4555 1.60625 13.7848 0.5 11 0.5ZM5.75 11.3075L4.6925 10.25L6.1925 8.75L4.6925 7.25L5.75 6.1925L7.25 7.6925L8.75 6.1925L9.8075 7.25L8.3075 8.75L9.8075 10.25L8.75 11.3075L7.25 9.8075L5.75 11.3075ZM11 17.75C10.555 17.75 10.12 17.618 9.74997 17.3708C9.37996 17.1236 9.09157 16.7722 8.92128 16.361C8.75098 15.9499 8.70642 15.4975 8.79324 15.061C8.88005 14.6246 9.09435 14.2237 9.40901 13.909C9.72368 13.5943 10.1246 13.38 10.5611 13.2932C10.9975 13.2064 11.4499 13.251 11.861 13.4213C12.2722 13.5916 12.6236 13.88 12.8708 14.25C13.118 14.62 13.25 15.055 13.25 15.5C13.25 16.0967 13.013 16.669 12.591 17.091C12.169 17.5129 11.5967 17.75 11 17.75ZM17.3075 10.25L16.25 11.3075L14.75 9.8075L13.25 11.3075L12.1925 10.25L13.6925 8.75L12.1925 7.25L13.25 6.1925L14.75 7.6925L16.25 6.1925L17.3075 7.25L15.8075 8.75L17.3075 10.25Z"
109
117
  };
110
- const ICON_NAMES = Object.keys(iconPaths);
111
- Object.freeze(ICON_NAMES);
112
- // console.log(JSON.stringify(Object.keys(iconPaths)).replace(/"/g, "'").replace(/,/g, "|").replace(/\[/g, "").replace(/\]/g, ""))
113
118
 
114
119
  /**
115
- * Returns an (ZhWeb) icon with a default size of 24px.
116
- * The CSS color is inherited from the parent object.
117
- * @param {'addNew'|'angleDropDown'|'angleDropup'|'angleLeft'|'angleRight'|'arrowDown'|'arrowLeft'|'arrowRight'|'arrowUp'|'calendar'|'caution'|'chatMessage'|'check'|'check1'|'clear'|'close'|'conference'|'confirm'|'confirmPlain'|'delete'|'documents'|'download'|'edit'|'email'|'file'|'fileOutline'|'files'|'filter'|'floppy'|'forward'|'getInformation'|'hide'|'home'|'layer1'|'layer11'|'link'|'list'|'lock'|'location'|'login'|'logout'|'map'|'mapLocateMe'|'mapLocation'|'mapNavigation'|'mapPin'|'menu'|'menuOverflow'|'minus'|'openMail'|'overflow'|'paperplane'|'paragraph'|'phoneCall'|'pin'|'plus'|'print'|'remove'|'resizeText'|'search'|'show'|'time'|'upload'|'cc'|'fastForward'|'fastRewind'|'fullScreen'|'next'|'pause'|'play'|'playButton'|'previews'|'skipNext'|'skipPrevious'|'stop'|'comment'|'facebook'|'google'|'instagram'|'kununu'|'like'|'linkedin'|'love'|'repost'|'share'|'snapchat'|'twitter'|'user'|'users'|'vote'|'xing'|'youtube'|'youtubeLogo'|'smileyThrilled'|'smileySmile'|'smileyIndifferent'|'smileySad'|'smileyDevastated'} name
118
- * @param {number} size
119
- * @returns TemplateResult<1>
120
+ * A component to render all defined zhWeb icons.
121
+ * The `fill` of the icon is set to `currentColor` and
122
+ * can be overriden by setting the css `color` property.
123
+ * If the icon name is not found, a placeholder will be displayed.
124
+ *
125
+ * @tagname leu-icon
126
+ * @prop {import("./paths").IconPathName} name - The name of the icon to display.
127
+ * @cssprop --leu-icon-size - The size of the icon.
120
128
  */
121
- const Icon = (name, size = 24) => {
122
- const iconPath = iconPaths[name];
123
- return html`
124
- <svg
125
- width="${size}"
126
- height="${size}"
127
- fill="currentColor"
128
- viewBox="0 0 24 24"
129
- fill-rule="evenodd"
130
- >
131
- ${svg`<path d=${iconPath} />`}
132
- </svg>
133
- `;
134
- };
129
+ class LeuIcon extends LeuElement {
130
+ constructor() {
131
+ super();
132
+
133
+ /**
134
+ * @type {import("./paths").IconPathName | ""}
135
+ */
136
+ this.name = "";
137
+ }
138
+ render() {
139
+ if (!paths[this.name]) {
140
+ return html`<div class="placeholder"></div>`;
141
+ }
142
+ const iconPath = paths[this.name];
143
+ return html`
144
+ <svg
145
+ width="24"
146
+ height="24"
147
+ fill="currentColor"
148
+ viewBox="0 0 24 24"
149
+ fill-rule="evenodd"
150
+ role="presentation"
151
+ >
152
+ ${svg`<path d=${iconPath} />`}
153
+ </svg>
154
+ `;
155
+ }
156
+ }
157
+ _defineProperty(LeuIcon, "styles", css_248z);
158
+ _defineProperty(LeuIcon, "properties", {
159
+ name: {
160
+ type: String,
161
+ reflect: true
162
+ }
163
+ });
135
164
 
136
- export { Icon as I, ICON_NAMES as a };
165
+ export { LeuIcon };
package/dist/Input.d.ts CHANGED
@@ -27,21 +27,19 @@
27
27
  *
28
28
  * @tagname leu-input
29
29
  */
30
- export class LeuInput extends LitElement {
30
+ export class LeuInput extends LeuElement {
31
31
  static resolveErrorMessage(message: any, refernceValue: any): any;
32
32
  disabled: boolean;
33
33
  required: boolean;
34
34
  clearable: boolean;
35
- /** @type {keyof typeof SIZE_TYPES} */
36
- size: keyof typeof SIZE_TYPES;
35
+ /** @type {"small" | "regular"} */
36
+ size: "small" | "regular";
37
37
  type: string;
38
38
  _validity: any;
39
39
  validationMessages: {};
40
40
  novalidate: boolean;
41
41
  /** @internal */
42
42
  _identifier: string;
43
- /** @internal */
44
- _clearIcon: import("lit-html").TemplateResult<1>;
45
43
  /**
46
44
  * @internal
47
45
  * @type {import("lit/directives/ref.js").Ref<HTMLInputElement>}
@@ -128,27 +126,20 @@ export class LeuInput extends LitElement {
128
126
  getValidationMessages(): any;
129
127
  /**
130
128
  * Creates an error list with an item for the given validity state.
131
- * @param {ValidityState} validityState
132
- * @param {Object} validationMessages
133
- * @param {String} idRef
134
- * @returns
129
+ * @returns {import("lit").TemplateResult | nothing}
135
130
  */
136
- renderErrorMessages(): import("lit-html").TemplateResult<1> | typeof nothing;
131
+ renderErrorMessages(): import("lit").TemplateResult | typeof nothing;
137
132
  /**
138
133
  * Determines the content that is displayed after the input element.
139
134
  * This can be either an icon, a clear button or an error indicator icon.
140
135
  *
141
136
  * @private
142
- * @returns {TemplateResult}
137
+ * @returns {import("lit").TemplateResult | nothing}
143
138
  */
144
139
  private renderAfterContent;
145
140
  isInvalid(): boolean;
146
141
  render(): import("lit-html").TemplateResult<1>;
147
142
  }
148
- export namespace SIZE_TYPES {
149
- let SMALL: string;
150
- let REGULAR: string;
151
- }
152
- import { LitElement } from 'lit';
143
+ import { L as LeuElement } from './LeuElement-6de6f209.js';
153
144
  import { nothing } from 'lit';
154
145
  //# sourceMappingURL=Input.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["Input.js"],"names":[],"mappings":"AA6SA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH;IACE,kEAKC;IAGC,kBAAqB;IACrB,kBAAqB;IACrB,mBAAsB;IAEtB,sCAAsC;IACtC,MADW,MAAM,iBAAiB,CACJ;IAC9B,aAAkB;IAClB,eAAqB;IACrB,uBAA4B;IAC5B,oBAAuB;IAEvB,gBAAgB;IAChB,oBAAqB;IAErB,gBAAgB;IAChB,iDAA+B;IAE/B;;;OAGG;IACH,WAFU,OAAO,uBAAuB,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAEnC;IAG9B;;;;;;;;;;OAUG;IACH,2BAIC;IAED;;;;;;OAMG;IACH,mBAKC;IAED;;;;;;OAMG;IACH,sBAEC;IAED;;;;;;;;OAQG;IACH,qBAMC;IAJG,WAA+B;IAMnC;;;;;;;OAOG;IACH,oBAOC;IAED;;;;;;;;OAQG;IACH,cAWC;IAED;;;;;;;OAOG;IACH,cAUC;IAED;;;;;;;;;;OAUG;IACH,6BAgBC;IAED;;;;;;OAMG;IACH,6EAcC;IAED;;;;;;OAMG;IACH,2BAkBC;IACD,qBAKC;IACD,+CA2CC;CACF;;;;;2BAhmB8C,KAAK;wBAAL,KAAK"}
1
+ {"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["Input.js"],"names":[],"mappings":"AAySA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH;IACE,kEAKC;IAGC,kBAAqB;IACrB,kBAAqB;IACrB,mBAAsB;IAEtB,kCAAkC;IAClC,MADW,OAAO,GAAG,SAAS,CACT;IACrB,aAAkB;IAClB,eAAqB;IACrB,uBAA4B;IAC5B,oBAAuB;IAEvB,gBAAgB;IAChB,oBAAqB;IAErB;;;OAGG;IACH,WAFU,OAAO,uBAAuB,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAEnC;IAG9B;;;;;;;;;;OAUG;IACH,2BAIC;IAED;;;;;;OAMG;IACH,mBAKC;IAED;;;;;;OAMG;IACH,sBAEC;IAED;;;;;;;;OAQG;IACH,qBAMC;IAJG,WAA+B;IAMnC;;;;;;;OAOG;IACH,oBAOC;IAED;;;;;;;;OAQG;IACH,cAWC;IAED;;;;;;;OAOG;IACH,cAUC;IAED;;;;;;;;;;OAUG;IACH,6BAgBC;IAED;;;OAGG;IACH,uBAFa,OAAO,KAAK,EAAE,cAAc,iBAAU,CAgBlD;IAED;;;;;;OAMG;IACH,2BAsBC;IACD,qBAKC;IACD,+CA2CC;CACF;gCA3lBqD,0BAA0B;wBAC7C,KAAK"}
package/dist/Input.js CHANGED
@@ -1,10 +1,10 @@
1
- import { _ as _defineProperty } from './_rollupPluginBabelHelpers-20f659f4.js';
2
- import { css, LitElement, nothing, html } from 'lit';
1
+ import { _ as _defineProperty, L as LeuElement } from './LeuElement-6de6f209.js';
2
+ import { css, nothing, html } from 'lit';
3
3
  import { classMap } from 'lit/directives/class-map.js';
4
4
  import { ifDefined } from 'lit/directives/if-defined.js';
5
5
  import { live } from 'lit/directives/live.js';
6
6
  import { createRef, ref } from 'lit/directives/ref.js';
7
- import { I as Icon } from './icon-03e86700.js';
7
+ import { LeuIcon } from './Icon.js';
8
8
 
9
9
  var css_248z = css`:host,
10
10
  :host * {
@@ -38,7 +38,6 @@ var css_248z = css`:host,
38
38
  --input-font-black: var(--leu-font-family-black);
39
39
 
40
40
  display: block;
41
- font-family: var(--leu-font-family-regular);
42
41
  font-family: var(--input-font-regular);
43
42
  }
44
43
 
@@ -181,7 +180,9 @@ var css_248z = css`:host,
181
180
 
182
181
  /* is size small AND has no focus AND is empty */
183
182
 
184
- :host(:not(:focus-within)[size="small"]) .input-wrapper--empty .label {
183
+ :host(:not(:focus-within)[size="small"])
184
+ .input-wrapper--empty:not(.input-wrapper--invalid)
185
+ .label {
185
186
  top: calc(0.75rem - var(--input-border-width));
186
187
  opacity: 1;
187
188
  visibility: visible;
@@ -270,16 +271,11 @@ var css_248z = css`:host,
270
271
  color: var(--input-color-invalid);
271
272
  }
272
273
 
273
- .icon svg, .error-icon svg {
274
+ .icon leu-icon, .error-icon leu-icon {
274
275
  display: block;
275
276
  }
276
277
  `;
277
278
 
278
- const SIZE_TYPES = {
279
- SMALL: "small",
280
- REGULAR: "regular"
281
- };
282
-
283
279
  /**
284
280
  * TODO:
285
281
  * - Add section to docs about how to mark up suffix and prefix for screenreaders
@@ -328,7 +324,7 @@ const VALIDATION_MESSAGES = {
328
324
  *
329
325
  * @tagname leu-input
330
326
  */
331
- class LeuInput extends LitElement {
327
+ class LeuInput extends LeuElement {
332
328
  static resolveErrorMessage(message, refernceValue) {
333
329
  if (typeof message === "function") {
334
330
  return message(refernceValue);
@@ -341,8 +337,8 @@ class LeuInput extends LitElement {
341
337
  this.required = false;
342
338
  this.clearable = false;
343
339
 
344
- /** @type {keyof typeof SIZE_TYPES} */
345
- this.size = SIZE_TYPES.REGULAR;
340
+ /** @type {"small" | "regular"} */
341
+ this.size = "regular";
346
342
  this.type = "text";
347
343
  this._validity = null;
348
344
  this.validationMessages = {};
@@ -351,9 +347,6 @@ class LeuInput extends LitElement {
351
347
  /** @internal */
352
348
  this._identifier = "";
353
349
 
354
- /** @internal */
355
- this._clearIcon = Icon("clear");
356
-
357
350
  /**
358
351
  * @internal
359
352
  * @type {import("lit/directives/ref.js").Ref<HTMLInputElement>}
@@ -510,10 +503,7 @@ class LeuInput extends LitElement {
510
503
 
511
504
  /**
512
505
  * Creates an error list with an item for the given validity state.
513
- * @param {ValidityState} validityState
514
- * @param {Object} validationMessages
515
- * @param {String} idRef
516
- * @returns
506
+ * @returns {import("lit").TemplateResult | nothing}
517
507
  */
518
508
  renderErrorMessages() {
519
509
  if (!this.isInvalid()) {
@@ -536,11 +526,13 @@ class LeuInput extends LitElement {
536
526
  * This can be either an icon, a clear button or an error indicator icon.
537
527
  *
538
528
  * @private
539
- * @returns {TemplateResult}
529
+ * @returns {import("lit").TemplateResult | nothing}
540
530
  */
541
531
  renderAfterContent() {
542
532
  if (this.isInvalid()) {
543
- return html`<div class="error-icon">${Icon("caution")}</div>`;
533
+ return html`<div class="error-icon">
534
+ <leu-icon name="caution"></leu-icon>
535
+ </div>`;
544
536
  }
545
537
  if (this.clearable && this.value) {
546
538
  return html`<button
@@ -549,11 +541,13 @@ class LeuInput extends LitElement {
549
541
  aria-label="Eingabefeld zurücksetzen"
550
542
  ?disabled=${this.disabled}
551
543
  >
552
- ${this._clearIcon}
544
+ <leu-icon name="clear"></leu-icon>
553
545
  </button>`;
554
546
  }
555
547
  if (this.icon) {
556
- return html`<div class="icon">${Icon(this.icon)}</div>`;
548
+ return html`<div class="icon">
549
+ <leu-icon name=${this.icon}></leu-icon>
550
+ </div>`;
557
551
  }
558
552
  return nothing;
559
553
  }
@@ -608,12 +602,15 @@ class LeuInput extends LitElement {
608
602
  `;
609
603
  }
610
604
  }
605
+ _defineProperty(LeuInput, "dependencies", {
606
+ "leu-icon": LeuIcon
607
+ });
611
608
  _defineProperty(LeuInput, "styles", css_248z);
612
609
  /**
613
610
  * @internal
614
611
  */
615
612
  _defineProperty(LeuInput, "shadowRootOptions", {
616
- ...LitElement.shadowRootOptions,
613
+ ...LeuElement.shadowRootOptions,
617
614
  delegatesFocus: true
618
615
  });
619
616
  _defineProperty(LeuInput, "properties", {
@@ -697,10 +694,9 @@ _defineProperty(LeuInput, "properties", {
697
694
  type: String,
698
695
  reflect: true
699
696
  },
700
- /** @type {ValidityState} */
701
697
  _validity: {
702
698
  state: true
703
699
  }
704
700
  });
705
701
 
706
- export { LeuInput, SIZE_TYPES };
702
+ export { LeuInput };
@@ -0,0 +1,7 @@
1
+ declare class LeuElement extends LitElement {
2
+ static define(name: any, constructor?: typeof LeuElement, options?: {}): void;
3
+ }
4
+ declare function _defineProperty(e: any, r: any, t: any): any;
5
+ import { LitElement } from 'lit';
6
+ export { LeuElement as L, _defineProperty as _ };
7
+ //# sourceMappingURL=LeuElement-6de6f209.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LeuElement-6de6f209.d.ts","sourceRoot":"","sources":["LeuElement-6de6f209.js"],"names":[],"mappings":"AAyBA;IACE,8EAMC;CAOF;AArCD,8DAOC;2BAT0B,KAAK"}
@@ -0,0 +1,43 @@
1
+ import { LitElement } from 'lit';
2
+
3
+ function _defineProperty(e, r, t) {
4
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
5
+ value: t,
6
+ enumerable: !0,
7
+ configurable: !0,
8
+ writable: !0
9
+ }) : e[r] = t, e;
10
+ }
11
+ function _toPrimitive(t, r) {
12
+ if ("object" != typeof t || !t) return t;
13
+ var e = t[Symbol.toPrimitive];
14
+ if (void 0 !== e) {
15
+ var i = e.call(t, r || "default");
16
+ if ("object" != typeof i) return i;
17
+ throw new TypeError("@@toPrimitive must return a primitive value.");
18
+ }
19
+ return ("string" === r ? String : Number)(t);
20
+ }
21
+ function _toPropertyKey(t) {
22
+ var i = _toPrimitive(t, "string");
23
+ return "symbol" == typeof i ? i : i + "";
24
+ }
25
+
26
+ class LeuElement extends LitElement {
27
+ static define(name, constructor = this, options = {}) {
28
+ if (!customElements.get(name)) {
29
+ customElements.define(name, constructor, options);
30
+ } else {
31
+ console.info(`${name} is already defined`);
32
+ }
33
+ }
34
+ constructor() {
35
+ super();
36
+ Object.entries(this.constructor.dependencies).forEach(([name, component]) => {
37
+ this.constructor.define(name, component);
38
+ });
39
+ }
40
+ }
41
+ _defineProperty(LeuElement, "dependencies", {});
42
+
43
+ export { LeuElement as L, _defineProperty as _ };
package/dist/Menu.d.ts CHANGED
@@ -1,8 +1,30 @@
1
+ export type SelectsType = "single" | "multiple" | "none";
2
+ /**
3
+ * @typedef {'single' | 'multiple' | 'none'} SelectsType
4
+ */
1
5
  /**
2
6
  * @tagname leu-menu
7
+ * @property {SelectsType} selects - This has only an effect when the role is 'menu'. It defines which role the menu items will get. Default is 'none'.
3
8
  */
4
- export class LeuMenu extends LitElement {
9
+ export class LeuMenu extends LeuElement {
10
+ /** @type {SelectsType} */
11
+ selects: SelectsType;
12
+ value: any;
13
+ _handleSlotChange(): void;
14
+ _setMenuItemRoles(): void;
15
+ /**
16
+ *
17
+ * @returns {import("./MenuItem").LeuMenuItem[]}
18
+ */
19
+ getMenuItems(): import("./MenuItem").LeuMenuItem[];
20
+ getVisibleMenuItems(): LeuMenuItem[];
21
+ _handleKeyDown(event: any): void;
22
+ setCurrentItem(index: any): any;
23
+ focusItem(index: any): void;
24
+ firstUpdated(): void;
25
+ updated(changedProperties: any): void;
5
26
  render(): import("lit-html").TemplateResult<1>;
6
27
  }
7
- import { LitElement } from 'lit';
28
+ import { L as LeuElement } from './LeuElement-6de6f209.js';
29
+ import { LeuMenuItem } from './MenuItem.js';
8
30
  //# sourceMappingURL=Menu.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Menu.d.ts","sourceRoot":"","sources":["Menu.js"],"names":[],"mappings":"AA0BA;;GAEG;AACH;IACE,+CAEC;CACF;2BAhCqC,KAAK"}
1
+ {"version":3,"file":"Menu.d.ts","sourceRoot":"","sources":["Menu.js"],"names":[],"mappings":"0BA8Ba,QAAQ,GAAG,UAAU,GAAG,MAAM;AAD3C;;GAEG;AAEH;;;GAGG;AACH;IAII,0BAA0B;IAC1B,SADW,WAAW,CACD;IACrB,WAAsB;IAaxB,0BAGC;IACD,0BAmBC;IAED;;;OAGG;IACH,gBAFa,OAAO,YAAY,EAAE,WAAW,EAAE,CAO9C;IACD,qCAEC;IACD,iCAgBC;IACD,gCAaC;IACD,4BAGC;IACD,qBAEC;IACD,sCAIC;IACD,+CAEC;CACF;gCA5IqD,0BAA0B;4BAEpD,eAAe"}