@statistikzh/leu 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (216) hide show
  1. package/.storybook/preview.js +1 -2
  2. package/CHANGELOG.md +24 -0
  3. package/custom-elements-manifest.config.js +46 -0
  4. package/dist/Accordion.d.ts +31 -0
  5. package/dist/Accordion.d.ts.map +1 -0
  6. package/dist/Accordion.js +257 -0
  7. package/dist/Breadcrumb.d.ts +69 -0
  8. package/dist/Breadcrumb.d.ts.map +1 -0
  9. package/dist/Breadcrumb.js +392 -0
  10. package/dist/Button-da11d064.d.ts +84 -0
  11. package/dist/Button-da11d064.d.ts.map +1 -0
  12. package/dist/Button-da11d064.js +542 -0
  13. package/dist/Button.d.ts +2 -0
  14. package/dist/Button.d.ts.map +1 -0
  15. package/dist/Button.js +6 -420
  16. package/dist/ButtonGroup.d.ts +24 -0
  17. package/dist/ButtonGroup.d.ts.map +1 -0
  18. package/dist/ButtonGroup.js +70 -39
  19. package/dist/Checkbox.d.ts +13 -0
  20. package/dist/Checkbox.d.ts.map +1 -0
  21. package/dist/Checkbox.js +2 -2
  22. package/dist/CheckboxGroup.d.ts +13 -0
  23. package/dist/CheckboxGroup.d.ts.map +1 -0
  24. package/dist/CheckboxGroup.js +3 -3
  25. package/dist/Chip.d.ts +5 -0
  26. package/dist/Chip.d.ts.map +1 -0
  27. package/dist/{Chip-dac7337d.js → Chip.js} +16 -5
  28. package/dist/ChipGroup.d.ts +28 -0
  29. package/dist/ChipGroup.d.ts.map +1 -0
  30. package/dist/ChipGroup.js +62 -5
  31. package/dist/ChipLink.d.ts +15 -0
  32. package/dist/ChipLink.d.ts.map +1 -0
  33. package/dist/ChipLink.js +1 -1
  34. package/dist/ChipRemovable.d.ts +13 -0
  35. package/dist/ChipRemovable.d.ts.map +1 -0
  36. package/dist/ChipRemovable.js +2 -2
  37. package/dist/ChipSelectable.d.ts +22 -0
  38. package/dist/ChipSelectable.d.ts.map +1 -0
  39. package/dist/ChipSelectable.js +5 -5
  40. package/dist/Dropdown.d.ts +15 -0
  41. package/dist/Dropdown.d.ts.map +1 -0
  42. package/dist/Dropdown.js +25 -7
  43. package/dist/Input.d.ts +154 -0
  44. package/dist/Input.d.ts.map +1 -0
  45. package/dist/Input.js +13 -7
  46. package/dist/Menu.d.ts +8 -0
  47. package/dist/Menu.d.ts.map +1 -0
  48. package/dist/MenuItem.d.ts +21 -0
  49. package/dist/MenuItem.d.ts.map +1 -0
  50. package/dist/MenuItem.js +3 -3
  51. package/dist/Pagination.d.ts +27 -0
  52. package/dist/Pagination.d.ts.map +1 -0
  53. package/dist/Pagination.js +93 -61
  54. package/dist/Popup.d.ts +18 -0
  55. package/dist/Popup.d.ts.map +1 -0
  56. package/dist/{leu-popup-4bf6f1f4.js → Popup.js} +4 -5
  57. package/dist/Radio.d.ts +12 -0
  58. package/dist/Radio.d.ts.map +1 -0
  59. package/dist/Radio.js +2 -2
  60. package/dist/RadioGroup.d.ts +20 -0
  61. package/dist/RadioGroup.d.ts.map +1 -0
  62. package/dist/RadioGroup.js +3 -3
  63. package/dist/ScrollTop.d.ts +19 -0
  64. package/dist/ScrollTop.d.ts.map +1 -0
  65. package/dist/ScrollTop.js +122 -0
  66. package/dist/Select.d.ts +98 -0
  67. package/dist/Select.d.ts.map +1 -0
  68. package/dist/Select.js +27 -82
  69. package/dist/Table.d.ts +48 -0
  70. package/dist/Table.d.ts.map +1 -0
  71. package/dist/Table.js +7 -4
  72. package/dist/VisuallyHidden.d.ts +8 -0
  73. package/dist/VisuallyHidden.d.ts.map +1 -0
  74. package/dist/VisuallyHidden.js +28 -0
  75. package/dist/_rollupPluginBabelHelpers-20f659f4.d.ts +3 -0
  76. package/dist/_rollupPluginBabelHelpers-20f659f4.d.ts.map +1 -0
  77. package/dist/defineElement-40372b4b.d.ts +9 -0
  78. package/dist/defineElement-40372b4b.d.ts.map +1 -0
  79. package/dist/{defineElement-47d4f665.js → defineElement-40372b4b.js} +1 -1
  80. package/dist/icon-03e86700.d.ts +11 -0
  81. package/dist/icon-03e86700.d.ts.map +1 -0
  82. package/dist/index.js.d.ts +21 -0
  83. package/dist/index.js.d.ts.map +1 -0
  84. package/dist/{index.js → index.js.js} +14 -8
  85. package/dist/leu-accordion.d.ts +3 -0
  86. package/dist/leu-accordion.d.ts.map +1 -0
  87. package/dist/leu-accordion.js +9 -0
  88. package/dist/leu-breadcrumb.d.ts +3 -0
  89. package/dist/leu-breadcrumb.d.ts.map +1 -0
  90. package/dist/leu-breadcrumb.js +23 -0
  91. package/dist/leu-button-group.d.ts +3 -0
  92. package/dist/leu-button-group.d.ts.map +1 -0
  93. package/dist/leu-button-group.js +1 -5
  94. package/dist/leu-button.d.ts +3 -0
  95. package/dist/leu-button.d.ts.map +1 -0
  96. package/dist/leu-button.js +3 -2
  97. package/dist/leu-checkbox-group.d.ts +3 -0
  98. package/dist/leu-checkbox-group.d.ts.map +1 -0
  99. package/dist/leu-checkbox-group.js +1 -1
  100. package/dist/leu-checkbox.d.ts +3 -0
  101. package/dist/leu-checkbox.d.ts.map +1 -0
  102. package/dist/leu-checkbox.js +1 -1
  103. package/dist/leu-chip-group.d.ts +3 -0
  104. package/dist/leu-chip-group.d.ts.map +1 -0
  105. package/dist/leu-chip-group.js +2 -1
  106. package/dist/leu-chip-link.d.ts +3 -0
  107. package/dist/leu-chip-link.d.ts.map +1 -0
  108. package/dist/leu-chip-link.js +2 -2
  109. package/dist/leu-chip-removable.d.ts +3 -0
  110. package/dist/leu-chip-removable.d.ts.map +1 -0
  111. package/dist/leu-chip-removable.js +2 -2
  112. package/dist/leu-chip-selectable.d.ts +3 -0
  113. package/dist/leu-chip-selectable.d.ts.map +1 -0
  114. package/dist/leu-chip-selectable.js +2 -2
  115. package/dist/leu-dropdown.d.ts +3 -0
  116. package/dist/leu-dropdown.d.ts.map +1 -0
  117. package/dist/leu-dropdown.js +5 -4
  118. package/dist/leu-input.d.ts +3 -0
  119. package/dist/leu-input.d.ts.map +1 -0
  120. package/dist/leu-input.js +1 -1
  121. package/dist/leu-menu-item.d.ts +3 -0
  122. package/dist/leu-menu-item.d.ts.map +1 -0
  123. package/dist/leu-menu-item.js +1 -1
  124. package/dist/leu-menu.d.ts +3 -0
  125. package/dist/leu-menu.d.ts.map +1 -0
  126. package/dist/leu-menu.js +1 -1
  127. package/dist/leu-pagination.d.ts +3 -0
  128. package/dist/leu-pagination.d.ts.map +1 -0
  129. package/dist/leu-pagination.js +5 -2
  130. package/dist/leu-popup.d.ts +3 -0
  131. package/dist/leu-popup.d.ts.map +1 -0
  132. package/dist/leu-popup.js +9 -0
  133. package/dist/leu-radio-group.d.ts +3 -0
  134. package/dist/leu-radio-group.d.ts.map +1 -0
  135. package/dist/leu-radio-group.js +1 -1
  136. package/dist/leu-radio.d.ts +3 -0
  137. package/dist/leu-radio.d.ts.map +1 -0
  138. package/dist/leu-radio.js +1 -1
  139. package/dist/leu-scroll-top.d.ts +3 -0
  140. package/dist/leu-scroll-top.d.ts.map +1 -0
  141. package/dist/leu-scroll-top.js +14 -0
  142. package/dist/leu-select.d.ts +3 -0
  143. package/dist/leu-select.d.ts.map +1 -0
  144. package/dist/leu-select.js +4 -3
  145. package/dist/leu-table.d.ts +3 -0
  146. package/dist/leu-table.d.ts.map +1 -0
  147. package/dist/leu-table.js +5 -2
  148. package/dist/leu-visually-hidden.d.ts +3 -0
  149. package/dist/leu-visually-hidden.d.ts.map +1 -0
  150. package/dist/leu-visually-hidden.js +8 -0
  151. package/dist/theme.css +386 -2
  152. package/dist/utils-65469421.d.ts +16 -0
  153. package/dist/utils-65469421.d.ts.map +1 -0
  154. package/dist/utils-65469421.js +35 -0
  155. package/index.js +3 -0
  156. package/package.json +30 -12
  157. package/postcss.config.cjs +2 -0
  158. package/rollup.config.js +21 -40
  159. package/scripts/generate-component/templates/[name].css +2 -2
  160. package/scripts/postcss-leu-font-styles.cjs +160 -0
  161. package/src/components/accordion/accordion.css +2 -2
  162. package/src/components/accordion/stories/accordion.stories.js +2 -1
  163. package/src/components/accordion/test/accordion.test.js +4 -2
  164. package/src/components/breadcrumb/Breadcrumb.js +2 -1
  165. package/src/components/breadcrumb/breadcrumb.css +2 -13
  166. package/src/components/button/Button.js +69 -8
  167. package/src/components/button/button.css +10 -2
  168. package/src/components/button/stories/button.stories.js +43 -90
  169. package/src/components/button/test/button.test.js +90 -19
  170. package/src/components/button-group/ButtonGroup.js +76 -34
  171. package/src/components/button-group/stories/button-group.stories.js +13 -6
  172. package/src/components/button-group/test/button-group.test.js +38 -31
  173. package/src/components/checkbox/checkbox-group.css +2 -2
  174. package/src/components/checkbox/checkbox.css +1 -1
  175. package/src/components/chip/ChipGroup.js +42 -2
  176. package/src/components/chip/ChipRemovable.js +1 -1
  177. package/src/components/chip/ChipSelectable.js +4 -4
  178. package/src/components/chip/chip-group.css +12 -2
  179. package/src/components/chip/chip.css +14 -3
  180. package/src/components/chip/stories/chip-group.stories.js +100 -46
  181. package/src/components/chip/test/chip-removable.test.js +3 -3
  182. package/src/components/dropdown/Dropdown.js +23 -3
  183. package/src/components/input/Input.js +7 -4
  184. package/src/components/input/input.css +2 -2
  185. package/src/components/input/stories/input.stories.js +13 -0
  186. package/src/components/input/test/input.test.js +1 -0
  187. package/src/components/menu/menu-item.css +3 -3
  188. package/src/components/pagination/Pagination.js +91 -60
  189. package/src/components/pagination/pagination.css +6 -1
  190. package/src/components/pagination/stories/pagination.stories.js +15 -2
  191. package/src/components/pagination/test/pagination.test.js +15 -15
  192. package/src/components/popup/popup.css +2 -2
  193. package/src/components/popup/stories/popup.stories.js +1 -1
  194. package/src/components/radio/radio-group.css +2 -2
  195. package/src/components/radio/radio.css +1 -1
  196. package/src/components/scroll-top/ScrollTop.js +87 -0
  197. package/src/components/scroll-top/leu-scroll-top.js +6 -0
  198. package/src/components/scroll-top/scroll-top.css +34 -0
  199. package/src/components/scroll-top/stories/scroll-top.stories.js +217 -0
  200. package/src/components/scroll-top/test/scroll-top.test.js +22 -0
  201. package/src/components/select/Select.js +24 -6
  202. package/src/components/select/select.css +2 -2
  203. package/src/components/table/table.css +2 -2
  204. package/src/components/visually-hidden/VisuallyHidden.js +13 -0
  205. package/src/components/visually-hidden/leu-visually-hidden.js +6 -0
  206. package/src/components/visually-hidden/stories/visually-hidden.stories.js +22 -0
  207. package/src/components/visually-hidden/test/visually-hidden.test.js +36 -0
  208. package/src/components/visually-hidden/visually-hidden.css +10 -0
  209. package/src/lib/defineElement.js +1 -1
  210. package/src/lib/hasSlotController.js +5 -3
  211. package/src/lib/utils.js +21 -3
  212. package/src/styles/custom-properties.css +6 -2
  213. package/src/styles/font-definitions.json +202 -0
  214. package/stylelint.config.mjs +2 -0
  215. package/tsconfig.build.json +21 -0
  216. package/tsconfig.json +16 -0
@@ -23,17 +23,20 @@ var css_248z = css`:host,
23
23
  --chip-radio-background-default: var(--leu-color-black-0);
24
24
  --chip-radio-background-selected: var(--leu-color-func-cyan);
25
25
 
26
- --chip-font-regular: var(--leu-font-regular);
27
- --chip-font-black: var(--leu-font-black);
26
+ --chip-font-regular: var(--leu-font-family-regular);
27
+ --chip-font-black: var(--leu-font-family-black);
28
28
 
29
29
  --chip-background-color: var(--chip-background-color-default);
30
30
  --chip-color: var(--chip-color-default);
31
31
  --chip-radio-border: var(--chip-radio-border-default);
32
32
  --chip-radio-background: var(--chip-radio-background-default);
33
33
 
34
- font-family: var(--leu-font-regular);
34
+ font-family: var(--leu-font-family-regular);
35
35
 
36
36
  font-family: var(--chip-font-regular);
37
+
38
+ /* Allow shrinking to achieve text truncation (ellipsis) */
39
+ min-width: 0;
37
40
  }
38
41
 
39
42
  :host([inverted]) {
@@ -68,8 +71,11 @@ var css_248z = css`:host,
68
71
  cursor: pointer;
69
72
 
70
73
  display: inline-flex;
71
- align-items: center;
72
74
  gap: 0.5rem;
75
+
76
+ /* Allow shrinking to achieve text truncation (ellipsis) */
77
+ min-width: 0;
78
+ max-width: 100%;
73
79
  }
74
80
 
75
81
  .button:hover,
@@ -117,6 +123,7 @@ var css_248z = css`:host,
117
123
 
118
124
  :host([variant="radio"]) .button::before {
119
125
  content: "";
126
+ flex: 0 0 1rem;
120
127
  width: 1rem;
121
128
  height: 1rem;
122
129
  background-color: var(--chip-radio-background);
@@ -131,6 +138,10 @@ var css_248z = css`:host,
131
138
  .label {
132
139
  position: relative;
133
140
  top: -0.0625rem;
141
+
142
+ overflow: hidden;
143
+ text-overflow: ellipsis;
144
+ white-space: nowrap;
134
145
  }
135
146
 
136
147
  .icon svg {
@@ -163,4 +174,4 @@ _defineProperty(LeuChipBase, "properties", {
163
174
  }
164
175
  });
165
176
 
166
- export { LeuChipBase as L };
177
+ export { LeuChipBase };
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @slot - Place leu-chip-* elements inside this slot
3
+ * @cssproperty --leu-chip-group-gap - The gap between the chips
4
+ * @tagname leu-chip-group
5
+ */
6
+ export class LeuChipGroup extends LitElement {
7
+ items: any[];
8
+ inverted: boolean;
9
+ headingLevel: number;
10
+ label: string;
11
+ get value(): any[];
12
+ /**
13
+ * Determines the heading tag of the accordion toggle.
14
+ * The headingLevel shouldn't be used directly to render the heading tag
15
+ * in order to avoid XSS issues.
16
+ * @returns {String} The heading tag of the accordion toggle.
17
+ * @internal
18
+ */
19
+ _getHeadingTag(): string;
20
+ render(): import("lit-html").TemplateResult;
21
+ }
22
+ export namespace SELECTION_MODES {
23
+ let single: string;
24
+ let multiple: string;
25
+ let none: string;
26
+ }
27
+ import { LitElement } from 'lit';
28
+ //# sourceMappingURL=ChipGroup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChipGroup.d.ts","sourceRoot":"","sources":["ChipGroup.js"],"names":[],"mappings":"AA8BA;;;;GAIG;AACH;IAiBM,aAAkB;IAEpB,kBAAqB;IACrB,qBAAqB;IACrB,cAAe;IAajB,mBAEC;IAED;;;;;;OAMG;IACH,yBAMC;IACD,4CAeC;CACF;;;;;;2BAtG+B,KAAK"}
package/dist/ChipGroup.js CHANGED
@@ -1,10 +1,22 @@
1
1
  import { _ as _defineProperty } from './_rollupPluginBabelHelpers-20f659f4.js';
2
- import { css, LitElement, html } from 'lit';
2
+ import { css, LitElement } from 'lit';
3
+ import { html, unsafeStatic } from 'lit/static-html.js';
3
4
 
4
- var css_248z = css`:host {
5
+ var css_248z = css`.label {
6
+ margin: 0 0 0.5rem;
7
+ font: var(--leu-t-curve-35-black-font);
8
+ color: var(--leu-color-black-100);
9
+ }
10
+
11
+ :host([inverted]) .label {
12
+ color: var(--leu-color-black-0);
13
+ }
14
+
15
+ .group {
5
16
  display: flex;
6
17
  flex-wrap: wrap;
7
18
  gap: 0.5rem;
19
+ gap: var(--leu-chip-group-gap, 0.5rem);
8
20
  }
9
21
  `;
10
22
 
@@ -18,13 +30,12 @@ const SELECTION_MODES = {
18
30
 
19
31
  /**
20
32
  * @slot - Place leu-chip-* elements inside this slot
33
+ * @cssproperty --leu-chip-group-gap - The gap between the chips
21
34
  * @tagname leu-chip-group
22
35
  */
23
36
  class LeuChipGroup extends LitElement {
24
37
  constructor() {
25
38
  super();
26
-
27
- /** @internal */
28
39
  /** @internal */
29
40
  _defineProperty(this, "handleInput", e => {
30
41
  if (this.selectionMode === SELECTION_MODES.single) {
@@ -41,6 +52,11 @@ class LeuChipGroup extends LitElement {
41
52
  });
42
53
  this.items = items;
43
54
  });
55
+ this.inverted = false;
56
+ this.headingLevel = 2;
57
+ this.label = "";
58
+
59
+ /** @internal */
44
60
  this.items = [];
45
61
  }
46
62
  connectedCallback() {
@@ -54,16 +70,57 @@ class LeuChipGroup extends LitElement {
54
70
  get value() {
55
71
  return this.items.filter(i => i.selected).map(i => i.value);
56
72
  }
73
+
74
+ /**
75
+ * Determines the heading tag of the accordion toggle.
76
+ * The headingLevel shouldn't be used directly to render the heading tag
77
+ * in order to avoid XSS issues.
78
+ * @returns {String} The heading tag of the accordion toggle.
79
+ * @internal
80
+ */
81
+ _getHeadingTag() {
82
+ let level = 2;
83
+ if (this.headingLevel > 0 && this.headingLevel < 7) {
84
+ level = this.headingLevel;
85
+ }
86
+ return `h${level}`;
87
+ }
57
88
  render() {
58
- return html`<slot @slotchange=${this.handleSlotChange}></slot>`;
89
+ const hTag = this._getHeadingTag();
90
+
91
+ /* The eslint rules don't recognize html import from lit/static-html.js */
92
+ /* eslint-disable lit/binding-positions, lit/no-invalid-html */
93
+ return html`
94
+ ${this.label ? html`<${unsafeStatic(hTag)} class="label">
95
+ <span class="label">${this.label}</span>
96
+ </${unsafeStatic(hTag)}>` : ""}
97
+ <slot
98
+ class="group"
99
+ part="group"
100
+ @slotchange=${this.handleSlotChange}
101
+ ></slot>
102
+ `;
59
103
  }
60
104
  }
61
105
  _defineProperty(LeuChipGroup, "styles", css_248z);
62
106
  _defineProperty(LeuChipGroup, "properties", {
107
+ inverted: {
108
+ type: Boolean,
109
+ reflect: true
110
+ },
63
111
  selectionMode: {
64
112
  type: String,
65
113
  attribute: "selection-mode",
66
114
  reflect: true
115
+ },
116
+ headingLevel: {
117
+ type: Number,
118
+ attribute: "heading-level",
119
+ reflect: true
120
+ },
121
+ label: {
122
+ type: String,
123
+ reflect: true
67
124
  }
68
125
  });
69
126
 
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @slot - The content of the chip
3
+ * @tagname leu-chip-link
4
+ */
5
+ export class LeuChipLink extends LeuChipBase {
6
+ size: string;
7
+ href: string;
8
+ render(): import("lit-html").TemplateResult<1>;
9
+ }
10
+ export namespace SIZES {
11
+ let regular: string;
12
+ let large: string;
13
+ }
14
+ import { LeuChipBase } from './Chip.js';
15
+ //# sourceMappingURL=ChipLink.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChipLink.d.ts","sourceRoot":"","sources":["ChipLink.js"],"names":[],"mappings":"AASA;;;GAGG;AACH;IAII,aAAyB;IACzB,aAAc;IAEhB,+CAIC;CACF;;;;;4BAvB2B,WAAW"}
package/dist/ChipLink.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { _ as _defineProperty } from './_rollupPluginBabelHelpers-20f659f4.js';
2
2
  import { html } from 'lit';
3
- import { L as LeuChipBase } from './Chip-dac7337d.js';
3
+ import { LeuChipBase } from './Chip.js';
4
4
 
5
5
  const SIZES = {
6
6
  regular: "regular",
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @slot - The content of the chip
3
+ * @tagname leu-chip-removable
4
+ * @fires remove - Dispatched when the user clicks on the chip
5
+ */
6
+ export class LeuChipRemovable extends LeuChipBase {
7
+ /** @internal */
8
+ _removeIcon: import("lit-html").TemplateResult<1>;
9
+ handleClick(): void;
10
+ render(): import("lit-html").TemplateResult<1>;
11
+ }
12
+ import { LeuChipBase } from './Chip.js';
13
+ //# sourceMappingURL=ChipRemovable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChipRemovable.d.ts","sourceRoot":"","sources":["ChipRemovable.js"],"names":[],"mappings":"AAKA;;;;GAIG;AACH;IAII,gBAAgB;IAChB,kDAAoC;IAEtC,oBAMC;IACD,+CAKC;CACF;4BA5B2B,WAAW"}
@@ -1,6 +1,6 @@
1
1
  import { _ as _defineProperty } from './_rollupPluginBabelHelpers-20f659f4.js';
2
2
  import { html } from 'lit';
3
- import { L as LeuChipBase } from './Chip-dac7337d.js';
3
+ import { LeuChipBase } from './Chip.js';
4
4
  import { I as Icon } from './icon-03e86700.js';
5
5
 
6
6
  /**
@@ -16,7 +16,7 @@ class LeuChipRemovable extends LeuChipBase {
16
16
  this._removeIcon = Icon("close", 16);
17
17
  }
18
18
  handleClick() {
19
- const customEvent = new CustomEvent("remove", {
19
+ const customEvent = new CustomEvent("leu:remove", {
20
20
  bubble: true,
21
21
  composed: true
22
22
  });
@@ -0,0 +1,22 @@
1
+ /**
2
+ * A chip component that can be selected.
3
+ * @slot - The content of the chip
4
+ * @tagname leu-chip-selectable
5
+ */
6
+ export class LeuChipSelectable extends LeuChipBase {
7
+ size: string;
8
+ variant: string;
9
+ selected: boolean;
10
+ handleClick(): void;
11
+ render(): import("lit-html").TemplateResult<1>;
12
+ }
13
+ export namespace SIZES {
14
+ let small: string;
15
+ let regular: string;
16
+ }
17
+ export namespace VARIANTS {
18
+ let toggle: string;
19
+ let radio: string;
20
+ }
21
+ import { LeuChipBase } from './Chip.js';
22
+ //# sourceMappingURL=ChipSelectable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChipSelectable.d.ts","sourceRoot":"","sources":["ChipSelectable.js"],"names":[],"mappings":"AAaA;;;;GAIG;AACH;IAGI,aAAyB;IACzB,gBAA8B;IAC9B,kBAAqB;IAKvB,oBAiBC;IACD,+CAQC;CACF;;;;;;;;;4BArD2B,WAAW"}
@@ -1,13 +1,13 @@
1
1
  import { _ as _defineProperty } from './_rollupPluginBabelHelpers-20f659f4.js';
2
2
  import { html } from 'lit';
3
- import { L as LeuChipBase } from './Chip-dac7337d.js';
3
+ import { LeuChipBase } from './Chip.js';
4
4
 
5
5
  const SIZES = {
6
6
  small: "small",
7
7
  regular: "regular"
8
8
  };
9
9
  const VARIANTS = {
10
- default: "default",
10
+ toggle: "toggle",
11
11
  radio: "radio"
12
12
  };
13
13
 
@@ -48,7 +48,7 @@ class LeuChipSelectable extends LeuChipBase {
48
48
  return html`<button
49
49
  @click=${e => this.handleClick(e)}
50
50
  class="button"
51
- aria-selected=${this.selected ? "true" : "false"}
51
+ aria-pressed=${this.selected ? "true" : "false"}
52
52
  >
53
53
  <span class="label">${this.label}</span>
54
54
  </button>`;
@@ -67,11 +67,11 @@ _defineProperty(LeuChipSelectable, "properties", {
67
67
  },
68
68
  /**
69
69
  * The variant of the chip. Has an effect not only on the visual appearance but also on the behavior.
70
- * - `default`: The chip behaves like a toggle button.
70
+ * - `toggle`: The chip behaves like a toggle button.
71
71
  * - `radio`: The chip behaves like a radio button.
72
72
  *
73
73
  * @type {keyof typeof VARIANTS}
74
- * @default "default"
74
+ * @default "toggle"
75
75
  */
76
76
  variant: {
77
77
  type: String,
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @tagname leu-dropdown
3
+ */
4
+ export class LeuDropdown extends LitElement {
5
+ expanded: boolean;
6
+ label: string;
7
+ menuItems: any[];
8
+ _keyUpHandler(event: any): void;
9
+ _handleSlotChange(): void;
10
+ _removeMenuItemListeners(): void;
11
+ _handleToggleClick(): void;
12
+ render(): import("lit-html").TemplateResult<1>;
13
+ }
14
+ import { LitElement } from 'lit';
15
+ //# sourceMappingURL=Dropdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dropdown.d.ts","sourceRoot":"","sources":["Dropdown.js"],"names":[],"mappings":"AAmCA;;GAEG;AACH;IAKQ,kBAAqB;IAMzB,cAAe;IAEf,iBAAmB;IAarB,gCAIC;IACD,0BAIC;IACD,iCAIC;IACD,2BAEC;IACD,+CA0BC;CACF;2BA5GqC,KAAK"}
package/dist/Dropdown.js CHANGED
@@ -3,15 +3,16 @@ import { css, LitElement, html } from 'lit';
3
3
  import './leu-button.js';
4
4
  import './leu-menu.js';
5
5
  import './leu-menu-item.js';
6
- import './leu-popup-4bf6f1f4.js';
7
- import './defineElement-47d4f665.js';
8
- import './Button.js';
6
+ import './leu-popup.js';
7
+ import './defineElement-40372b4b.js';
8
+ import './Button-da11d064.js';
9
9
  import 'lit/directives/class-map.js';
10
+ import 'lit/directives/if-defined.js';
10
11
  import './icon-03e86700.js';
11
12
  import './Menu.js';
12
13
  import './MenuItem.js';
13
14
  import 'lit/static-html.js';
14
- import 'lit/directives/if-defined.js';
15
+ import './Popup.js';
15
16
  import '@floating-ui/dom';
16
17
 
17
18
  var css_248z = css`:host,
@@ -38,6 +39,11 @@ var css_248z = css`:host,
38
39
  class LeuDropdown extends LitElement {
39
40
  constructor() {
40
41
  super();
42
+ _defineProperty(this, "_documentClickHandler", event => {
43
+ if (!this.contains(event.target)) {
44
+ this.expanded = false;
45
+ }
46
+ });
41
47
  _defineProperty(this, "_handleMenuItemClick", () => {
42
48
  this.expanded = false;
43
49
  });
@@ -45,9 +51,21 @@ class LeuDropdown extends LitElement {
45
51
  this.expanded = false;
46
52
  this.menuItems = [];
47
53
  }
54
+ connectedCallback() {
55
+ super.connectedCallback();
56
+ this.addEventListener("keyup", this._keyUpHandler);
57
+ document.addEventListener("click", this._documentClickHandler);
58
+ }
48
59
  disconnectedCallback() {
49
60
  super.disconnectedCallback();
50
61
  this._removeMenuItemListeners();
62
+ this.removeEventListener("keyup", this._keyUpHandler);
63
+ document.removeEventListener("click", this._documentClickHandler);
64
+ }
65
+ _keyUpHandler(event) {
66
+ if (event.key === "Escape") {
67
+ this.expanded = false;
68
+ }
51
69
  }
52
70
  _handleSlotChange() {
53
71
  this._removeMenuItemListeners();
@@ -76,13 +94,13 @@ class LeuDropdown extends LitElement {
76
94
  slot="anchor"
77
95
  icon="download"
78
96
  variant="ghost"
79
- label=${this.label}
80
- expanded=${this.expanded ? "open" : "closed"}
97
+ expanded=${this.expanded ? "true" : "false"}
81
98
  aria-expanded=${this.expanded ? "true" : "false"}
82
99
  aria-controls="content"
83
100
  ?active=${this.expanded}
84
101
  @click=${this._handleToggleClick}
85
- ></leu-button>
102
+ >${this.label}</leu-button
103
+ >
86
104
  <div id="content" class="content" ?hidden=${!this.expanded}>
87
105
  <slot @slotchange=${this._handleSlotChange}></slot>
88
106
  </div>
@@ -0,0 +1,154 @@
1
+ /**
2
+ * A text input element.
3
+ *
4
+ * @prop {boolean} disabled - Disables the input element.
5
+ * @prop {boolean} required - Marks the input element as required.
6
+ * @prop {boolean} clearable - Adds a button to clear the input element.
7
+ * @prop {string} value - The value of the input element.
8
+ * @prop {string} name - The name of the input element.
9
+ * @prop {string} label - The label of the input element.
10
+ * @prop {string} error - A custom error that is completely independent of the validity state. Useful for displaying server side errors.
11
+ * @prop {string} size - The size of the input element.
12
+ * @prop {string} icon - The icon that is displayed at the end of the input element.
13
+ * @prop {string} prefix - A prefix that relates to the value of the input (e.g. CHF).
14
+ * @prop {string} suffix - A suffix that relates to the value of the input (e.g. mm).
15
+ * @prop {string} pattern - A regular expression that the value is checked against.
16
+ * @prop {string} type - The type of the input element.
17
+ * @prop {string} min - The minimum value of the input element.
18
+ * @prop {string} max - The maximum value of the input element.
19
+ * @prop {string} minlength - The minimum length of the input element.
20
+ * @prop {string} maxlength - The maximum length of the input element.
21
+ * @prop {object} validationMessages - Custom validation messages. The key is the name of the validity state and the value is the message.
22
+ * @prop {boolean} novalidate - Disables the browser's validation.
23
+ * @prop {string} step - The step value of the input element.
24
+ *
25
+ * @fires {CustomEvent} input - Dispatched when the value of the input element changes.
26
+ * @fires {CustomEvent} change - Dispatched when the value of the input element changes and the input element loses focus.
27
+ *
28
+ * @tagname leu-input
29
+ */
30
+ export class LeuInput extends LitElement {
31
+ static resolveErrorMessage(message: any, refernceValue: any): any;
32
+ disabled: boolean;
33
+ required: boolean;
34
+ clearable: boolean;
35
+ /** @type {keyof typeof SIZE_TYPES} */
36
+ size: keyof typeof SIZE_TYPES;
37
+ type: string;
38
+ _validity: any;
39
+ validationMessages: {};
40
+ novalidate: boolean;
41
+ /** @internal */
42
+ _identifier: string;
43
+ /** @internal */
44
+ _clearIcon: import("lit-html").TemplateResult<1>;
45
+ /**
46
+ * @internal
47
+ * @type {import("lit/directives/ref.js").Ref<HTMLInputElement>}
48
+ */
49
+ _inputRef: import("lit/directives/ref.js").Ref<HTMLInputElement>;
50
+ /**
51
+ * Method for handling the click event of the wrapper element.
52
+ * Redirect every click on the wrapper to the input element.
53
+ * This is only necessary for click events because the wrapper element
54
+ * looks like the input element. But the actual input field does not
55
+ * completely fill the wrapper element. Keyboard events don't need to be
56
+ * handled because the actual input element is focusable.
57
+ * @private
58
+ * @param {MouseEvent|PointerEvent} event
59
+ * @returns {void}
60
+ */
61
+ private handleWrapperClick;
62
+ /**
63
+ * Method for handling the blur event of the input element.
64
+ * Checks validity of the input element and sets the validity state.
65
+ * @private
66
+ * @param {FocusEvent} event
67
+ * @returns {void}
68
+ */
69
+ private handleBlur;
70
+ /**
71
+ * Method for handling the invalid event of the input element.
72
+ * Sets the validity state.
73
+ * @private
74
+ * @param {Event} event
75
+ * @returns {void}
76
+ */
77
+ private handleInvalid;
78
+ /**
79
+ * Method for handling the change event of the input element.
80
+ * Sets the value property and dispatches a change event so that
81
+ * the event can be handled outside the shadow DOM.
82
+ * @private
83
+ * @param {Event} event
84
+ * @fires {CustomEvent} change
85
+ * @returns {void}
86
+ */
87
+ private handleChange;
88
+ value: any;
89
+ /**
90
+ * Method for handling the input event of the input element.
91
+ * Sets the value property and dispatches an input event so that
92
+ * the event can be handled outside the shadow DOM.
93
+ * @private
94
+ * @param {Event} event
95
+ * @returns {void}
96
+ */
97
+ private handleInput;
98
+ /**
99
+ * Method for clearing the input element.
100
+ * Sets the value property to an empty string and dispatches
101
+ * an input and a change event.
102
+ * @private
103
+ * @returns {void}
104
+ * @fires {CustomEvent} input
105
+ * @fires {CustomEvent} change
106
+ */
107
+ private clear;
108
+ /**
109
+ * Method for getting the id of the input element.
110
+ * If the id attribute is set, the value of the id attribute is returned.
111
+ * Otherwise a random id is generated and returned.
112
+ *
113
+ * @private
114
+ * @returns {string} id
115
+ */
116
+ private getId;
117
+ /**
118
+ * Merge custom and default validation messages.
119
+ * A validation message can be a function or a string.
120
+ * If it s a function, the function is called with the corresponding
121
+ * attribute value as argument.
122
+ * e.g.
123
+ * `tooLong(this.maxlength)`
124
+ * This way the framework user can create reasonable validation messages
125
+ *
126
+ * @returns {Object} validationMessages
127
+ */
128
+ getValidationMessages(): any;
129
+ /**
130
+ * 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
135
+ */
136
+ renderErrorMessages(): import("lit-html").TemplateResult<1> | typeof nothing;
137
+ /**
138
+ * Determines the content that is displayed after the input element.
139
+ * This can be either an icon, a clear button or an error indicator icon.
140
+ *
141
+ * @private
142
+ * @returns {TemplateResult}
143
+ */
144
+ private renderAfterContent;
145
+ isInvalid(): boolean;
146
+ render(): import("lit-html").TemplateResult<1>;
147
+ }
148
+ export namespace SIZE_TYPES {
149
+ let SMALL: string;
150
+ let REGULAR: string;
151
+ }
152
+ import { LitElement } from 'lit';
153
+ import { nothing } from 'lit';
154
+ //# sourceMappingURL=Input.d.ts.map
@@ -0,0 +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"}
package/dist/Input.js CHANGED
@@ -34,11 +34,11 @@ var css_248z = css`:host,
34
34
 
35
35
  --input-clear-color: var(--leu-color-black-60);
36
36
 
37
- --input-font-regular: var(--leu-font-regular);
38
- --input-font-black: var(--leu-font-black);
37
+ --input-font-regular: var(--leu-font-family-regular);
38
+ --input-font-black: var(--leu-font-family-black);
39
39
 
40
40
  display: block;
41
- font-family: var(--leu-font-regular);
41
+ font-family: var(--leu-font-family-regular);
42
42
  font-family: var(--input-font-regular);
43
43
  }
44
44
 
@@ -321,6 +321,7 @@ const VALIDATION_MESSAGES = {
321
321
  * @prop {string} maxlength - The maximum length of the input element.
322
322
  * @prop {object} validationMessages - Custom validation messages. The key is the name of the validity state and the value is the message.
323
323
  * @prop {boolean} novalidate - Disables the browser's validation.
324
+ * @prop {string} step - The step value of the input element.
324
325
  *
325
326
  * @fires {CustomEvent} input - Dispatched when the value of the input element changes.
326
327
  * @fires {CustomEvent} change - Dispatched when the value of the input element changes and the input element loses focus.
@@ -594,6 +595,7 @@ class LeuInput extends LitElement {
594
595
  max=${ifDefined(this.max)}
595
596
  maxlength=${ifDefined(this.maxlength)}
596
597
  minlength=${ifDefined(this.minlength)}
598
+ step=${ifDefined(this.step)}
597
599
  ref=${ref(this._inputRef)}
598
600
  aria-invalid=${isInvalid}
599
601
  />
@@ -669,19 +671,19 @@ _defineProperty(LeuInput, "properties", {
669
671
  reflect: true
670
672
  },
671
673
  min: {
672
- type: Number,
674
+ type: String,
673
675
  reflect: true
674
676
  },
675
677
  max: {
676
- type: Number,
678
+ type: String,
677
679
  reflect: true
678
680
  },
679
681
  maxlength: {
680
- type: Number,
682
+ type: String,
681
683
  reflect: true
682
684
  },
683
685
  minlength: {
684
- type: Number,
686
+ type: String,
685
687
  reflect: true
686
688
  },
687
689
  validationMessages: {
@@ -691,6 +693,10 @@ _defineProperty(LeuInput, "properties", {
691
693
  type: Boolean,
692
694
  reflect: true
693
695
  },
696
+ step: {
697
+ type: String,
698
+ reflect: true
699
+ },
694
700
  /** @type {ValidityState} */
695
701
  _validity: {
696
702
  state: true
package/dist/Menu.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @tagname leu-menu
3
+ */
4
+ export class LeuMenu extends LitElement {
5
+ render(): import("lit-html").TemplateResult<1>;
6
+ }
7
+ import { LitElement } from 'lit';
8
+ //# sourceMappingURL=Menu.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Menu.d.ts","sourceRoot":"","sources":["Menu.js"],"names":[],"mappings":"AA0BA;;GAEG;AACH;IACE,+CAEC;CACF;2BAhCqC,KAAK"}