@statistikzh/leu 0.10.0 → 0.11.1

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 (151) hide show
  1. package/.github/workflows/deploy-github-pages.yaml +2 -2
  2. package/.github/workflows/release-please.yml +1 -1
  3. package/CHANGELOG.md +15 -0
  4. package/dist/Accordion.d.ts +1 -1
  5. package/dist/Accordion.d.ts.map +1 -1
  6. package/dist/Accordion.js +22 -30
  7. package/dist/Breadcrumb.d.ts +1 -1
  8. package/dist/Breadcrumb.d.ts.map +1 -1
  9. package/dist/Breadcrumb.js +3 -8
  10. package/dist/Button.d.ts +1 -1
  11. package/dist/Button.js +3 -3
  12. package/dist/ButtonGroup.d.ts +1 -1
  13. package/dist/ButtonGroup.d.ts.map +1 -1
  14. package/dist/ButtonGroup.js +3 -8
  15. package/dist/Checkbox.d.ts +1 -1
  16. package/dist/Checkbox.js +2 -2
  17. package/dist/CheckboxGroup.d.ts +1 -1
  18. package/dist/CheckboxGroup.js +2 -2
  19. package/dist/Chip.d.ts +1 -1
  20. package/dist/Chip.d.ts.map +1 -1
  21. package/dist/Chip.js +3 -5
  22. package/dist/ChipGroup.d.ts +1 -1
  23. package/dist/ChipGroup.js +2 -2
  24. package/dist/ChipLink.js +1 -1
  25. package/dist/ChipRemovable.js +1 -1
  26. package/dist/ChipSelectable.js +1 -1
  27. package/dist/Dialog.d.ts +1 -1
  28. package/dist/Dialog.d.ts.map +1 -1
  29. package/dist/Dialog.js +3 -7
  30. package/dist/Dropdown.d.ts +1 -1
  31. package/dist/Dropdown.d.ts.map +1 -1
  32. package/dist/Dropdown.js +4 -9
  33. package/dist/Icon.d.ts +1 -1
  34. package/dist/Icon.js +2 -2
  35. package/dist/Input.d.ts +1 -1
  36. package/dist/Input.d.ts.map +1 -1
  37. package/dist/Input.js +3 -8
  38. package/dist/{LeuElement-6fbc0dee.d.ts → LeuElement-e092765a.d.ts} +1 -1
  39. package/dist/LeuElement-e092765a.d.ts.map +1 -0
  40. package/dist/{LeuElement-6fbc0dee.js → LeuElement-e092765a.js} +10 -2
  41. package/dist/Menu.d.ts +1 -1
  42. package/dist/Menu.d.ts.map +1 -1
  43. package/dist/Menu.js +3 -8
  44. package/dist/MenuItem.d.ts +1 -1
  45. package/dist/MenuItem.d.ts.map +1 -1
  46. package/dist/MenuItem.js +3 -8
  47. package/dist/Pagination.d.ts +1 -1
  48. package/dist/Pagination.js +3 -3
  49. package/dist/Popup.d.ts +1 -1
  50. package/dist/Popup.d.ts.map +1 -1
  51. package/dist/Popup.js +3 -8
  52. package/dist/Radio.d.ts +1 -1
  53. package/dist/Radio.js +2 -2
  54. package/dist/RadioGroup.d.ts +1 -1
  55. package/dist/RadioGroup.js +2 -2
  56. package/dist/Range.d.ts +60 -0
  57. package/dist/Range.d.ts.map +1 -0
  58. package/dist/Range.js +413 -0
  59. package/dist/ScrollTop.d.ts +1 -1
  60. package/dist/ScrollTop.js +3 -3
  61. package/dist/Select.d.ts +1 -1
  62. package/dist/Select.d.ts.map +1 -1
  63. package/dist/Select.js +4 -9
  64. package/dist/Spinner.d.ts +1 -1
  65. package/dist/Spinner.js +2 -2
  66. package/dist/Table.d.ts +1 -1
  67. package/dist/Table.js +3 -3
  68. package/dist/VisuallyHidden.d.ts +1 -1
  69. package/dist/VisuallyHidden.js +2 -2
  70. package/dist/{hasSlotController-04d0dfa2.d.ts → hasSlotController-d1f26756.d.ts} +1 -1
  71. package/dist/{hasSlotController-04d0dfa2.d.ts.map → hasSlotController-d1f26756.d.ts.map} +1 -1
  72. package/dist/{hasSlotController-04d0dfa2.js → hasSlotController-d1f26756.js} +1 -1
  73. package/dist/index.js +2 -2
  74. package/dist/leu-accordion.js +1 -1
  75. package/dist/leu-breadcrumb.js +1 -1
  76. package/dist/leu-button-group.js +1 -1
  77. package/dist/leu-button.js +2 -2
  78. package/dist/leu-checkbox-group.js +1 -1
  79. package/dist/leu-checkbox.js +1 -1
  80. package/dist/leu-chip-group.js +1 -1
  81. package/dist/leu-chip-link.js +1 -1
  82. package/dist/leu-chip-removable.js +1 -1
  83. package/dist/leu-chip-selectable.js +1 -1
  84. package/dist/leu-dialog.js +2 -2
  85. package/dist/leu-dropdown.js +2 -2
  86. package/dist/leu-icon.js +1 -1
  87. package/dist/leu-input.js +1 -1
  88. package/dist/leu-menu-item.js +1 -1
  89. package/dist/leu-menu.js +1 -1
  90. package/dist/leu-pagination.js +2 -2
  91. package/dist/leu-popup.js +1 -1
  92. package/dist/leu-radio-group.js +1 -1
  93. package/dist/leu-radio.js +1 -1
  94. package/dist/leu-range.d.ts +3 -0
  95. package/dist/leu-range.d.ts.map +1 -0
  96. package/dist/leu-range.js +7 -0
  97. package/dist/leu-scroll-top.js +2 -2
  98. package/dist/leu-select.js +2 -2
  99. package/dist/leu-spinner.js +1 -1
  100. package/dist/leu-table.js +2 -2
  101. package/dist/leu-visually-hidden.js +1 -1
  102. package/dist/vscode.html-custom-data.json +130 -110
  103. package/dist/vue/index.d.ts +194 -153
  104. package/dist/web-types.json +243 -199
  105. package/package.json +1 -1
  106. package/scripts/generate-component/templates/[Name].js +1 -1
  107. package/scripts/generate-component/templates/[name].css +0 -5
  108. package/src/components/accordion/Accordion.js +10 -6
  109. package/src/components/accordion/accordion.css +9 -22
  110. package/src/components/breadcrumb/Breadcrumb.js +1 -1
  111. package/src/components/breadcrumb/breadcrumb.css +0 -5
  112. package/src/components/button/Button.js +1 -1
  113. package/src/components/button-group/ButtonGroup.js +1 -1
  114. package/src/components/button-group/button-group.css +0 -5
  115. package/src/components/checkbox/Checkbox.js +1 -1
  116. package/src/components/checkbox/CheckboxGroup.js +1 -1
  117. package/src/components/chip/Chip.js +1 -1
  118. package/src/components/chip/ChipGroup.js +1 -1
  119. package/src/components/chip/chip.css +0 -2
  120. package/src/components/dialog/Dialog.js +1 -1
  121. package/src/components/dialog/dialog.css +0 -5
  122. package/src/components/dropdown/Dropdown.js +1 -1
  123. package/src/components/dropdown/dropdown.css +0 -5
  124. package/src/components/icon/Icon.js +1 -1
  125. package/src/components/input/Input.js +1 -1
  126. package/src/components/input/input.css +0 -5
  127. package/src/components/menu/Menu.js +1 -1
  128. package/src/components/menu/MenuItem.js +1 -1
  129. package/src/components/menu/menu-item.css +0 -5
  130. package/src/components/menu/menu.css +0 -5
  131. package/src/components/pagination/Pagination.js +1 -1
  132. package/src/components/popup/Popup.js +1 -1
  133. package/src/components/popup/popup.css +0 -5
  134. package/src/components/radio/Radio.js +1 -1
  135. package/src/components/radio/RadioGroup.js +1 -1
  136. package/src/components/range/Range.js +237 -0
  137. package/src/components/range/leu-range.js +5 -0
  138. package/src/components/range/range.css +180 -0
  139. package/src/components/range/stories/range-slider.stories.js +142 -0
  140. package/src/components/range/test/range-test.js +24 -0
  141. package/src/components/scroll-top/ScrollTop.js +1 -1
  142. package/src/components/select/Select.js +1 -1
  143. package/src/components/select/select.css +0 -5
  144. package/src/components/spinner/Spinner.js +1 -1
  145. package/src/components/table/Table.js +1 -1
  146. package/src/components/visually-hidden/VisuallyHidden.js +1 -1
  147. package/src/lib/LeuElement.js +3 -0
  148. package/src/styles/common-styles.css +5 -0
  149. package/src/styles/style.stories.js +1 -0
  150. package/web-dev-server.config.mjs +1 -0
  151. package/dist/LeuElement-6fbc0dee.d.ts.map +0 -1
package/dist/Menu.js CHANGED
@@ -1,15 +1,10 @@
1
- import { _ as _defineProperty, L as LeuElement } from './LeuElement-6fbc0dee.js';
1
+ import { _ as _defineProperty, L as LeuElement } from './LeuElement-e092765a.js';
2
2
  import { css, html } from 'lit';
3
3
  import { LeuMenuItem } from './MenuItem.js';
4
4
  import 'lit/directives/if-defined.js';
5
5
  import './Icon.js';
6
6
 
7
- var css_248z = css`:host,
8
- :host * {
9
- box-sizing: border-box;
10
- }
11
-
12
- :host {
7
+ var css_248z = css`:host {
13
8
  --menu-divider-color: var(--leu-color-black-transp-20);
14
9
  }
15
10
 
@@ -139,7 +134,7 @@ class LeuMenu extends LeuElement {
139
134
  return html`<slot></slot>`;
140
135
  }
141
136
  }
142
- _defineProperty(LeuMenu, "styles", css_248z);
137
+ _defineProperty(LeuMenu, "styles", [LeuElement.styles, css_248z]);
143
138
  _defineProperty(LeuMenu, "shadowRootOptions", {
144
139
  ...LeuElement.shadowRootOptions,
145
140
  delegatesFocus: true
@@ -37,6 +37,6 @@ export class LeuMenuItem extends LeuElement {
37
37
  _renderBeforeSlotDefault(): import("lit-html").TemplateResult<1> | typeof nothing;
38
38
  render(): import("lit-html").TemplateResult<1>;
39
39
  }
40
- import { L as LeuElement } from './LeuElement-6fbc0dee.js';
40
+ import { L as LeuElement } from './LeuElement-e092765a.js';
41
41
  import { nothing } from 'lit';
42
42
  //# sourceMappingURL=MenuItem.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MenuItem.d.ts","sourceRoot":"","sources":["MenuItem.js"],"names":[],"mappings":"2BA8Fa,UAAU,GAAG,kBAAkB,GAAG,eAAe,GAAG,QAAQ,GAAG,MAAM;AADlF;;GAEG;AAEH;;;;;;;;;;GAUG;AACH;IAGI,gBAAmB;IACnB,kBAAqB;IACrB,2BAA8B;IAC9B,WAAsB;IACtB,UAAqB;IACrB,cAAyB;IAEzB,2BAA2B;IAC3B,eADW,YAAY,CACQ;IAUjC,+BAKC;IAED;;;OAGG;IACH,YAFa,MAAM,CAIlB;IACD;;MAaC;IACD,uBAKC;IACD,gEAYC;IACD,kEAYC;IACD,kFAKC;IACD,+CASC;CACF;gCA7MqD,0BAA0B;wBAC7C,KAAK"}
1
+ {"version":3,"file":"MenuItem.d.ts","sourceRoot":"","sources":["MenuItem.js"],"names":[],"mappings":"2BAyFa,UAAU,GAAG,kBAAkB,GAAG,eAAe,GAAG,QAAQ,GAAG,MAAM;AADlF;;GAEG;AAEH;;;;;;;;;;GAUG;AACH;IAGI,gBAAmB;IACnB,kBAAqB;IACrB,2BAA8B;IAC9B,WAAsB;IACtB,UAAqB;IACrB,cAAyB;IAEzB,2BAA2B;IAC3B,eADW,YAAY,CACQ;IAUjC,+BAKC;IAED;;;OAGG;IACH,YAFa,MAAM,CAIlB;IACD;;MAaC;IACD,uBAKC;IACD,gEAYC;IACD,kEAYC;IACD,kFAKC;IACD,+CASC;CACF;gCAxMqD,0BAA0B;wBAC7C,KAAK"}
package/dist/MenuItem.js CHANGED
@@ -1,14 +1,9 @@
1
- import { _ as _defineProperty, L as LeuElement } from './LeuElement-6fbc0dee.js';
1
+ import { _ as _defineProperty, L as LeuElement } from './LeuElement-e092765a.js';
2
2
  import { css, html, nothing } from 'lit';
3
3
  import { ifDefined } from 'lit/directives/if-defined.js';
4
4
  import { LeuIcon } from './Icon.js';
5
5
 
6
- var css_248z = css`:host,
7
- :host * {
8
- box-sizing: border-box;
9
- }
10
-
11
- :host {
6
+ var css_248z = css`:host {
12
7
  --background: var(--leu-color-black-0);
13
8
  --background-hover: var(--leu-color-black-10);
14
9
  --background-active: var(--leu-color-func-cyan);
@@ -207,7 +202,7 @@ class LeuMenuItem extends LeuElement {
207
202
  _defineProperty(LeuMenuItem, "dependencies", {
208
203
  "leu-icon": LeuIcon
209
204
  });
210
- _defineProperty(LeuMenuItem, "styles", css_248z);
205
+ _defineProperty(LeuMenuItem, "styles", [LeuElement.styles, css_248z]);
211
206
  /**
212
207
  * @internal
213
208
  */
@@ -30,5 +30,5 @@ export class LeuPagination extends LeuElement {
30
30
  _handleKeyDown(event: any): void;
31
31
  render(): import("lit-html").TemplateResult<1>;
32
32
  }
33
- import { L as LeuElement } from './LeuElement-6fbc0dee.js';
33
+ import { L as LeuElement } from './LeuElement-e092765a.js';
34
34
  //# sourceMappingURL=Pagination.d.ts.map
@@ -1,4 +1,4 @@
1
- import { _ as _defineProperty, L as LeuElement } from './LeuElement-6fbc0dee.js';
1
+ import { _ as _defineProperty, L as LeuElement } from './LeuElement-e092765a.js';
2
2
  import { css, html } from 'lit';
3
3
  import { live } from 'lit/directives/live.js';
4
4
  import { LeuButton } from './Button.js';
@@ -6,7 +6,7 @@ import { LeuVisuallyHidden } from './VisuallyHidden.js';
6
6
  import { LeuIcon } from './Icon.js';
7
7
  import 'lit/directives/class-map.js';
8
8
  import 'lit/directives/if-defined.js';
9
- import './hasSlotController-04d0dfa2.js';
9
+ import './hasSlotController-d1f26756.js';
10
10
 
11
11
  var css_248z = css`:host {
12
12
  margin-top: 16px;
@@ -202,7 +202,7 @@ _defineProperty(LeuPagination, "dependencies", {
202
202
  "leu-icon": LeuIcon,
203
203
  "leu-visually-hidden": LeuVisuallyHidden
204
204
  });
205
- _defineProperty(LeuPagination, "styles", css_248z);
205
+ _defineProperty(LeuPagination, "styles", [LeuElement.styles, css_248z]);
206
206
  /**
207
207
  * @internal
208
208
  */
package/dist/Popup.d.ts CHANGED
@@ -32,5 +32,5 @@ export class LeuPopup extends LeuElement {
32
32
  handleAnchorChange(): void;
33
33
  render(): import("lit-html").TemplateResult<1>;
34
34
  }
35
- import { L as LeuElement } from './LeuElement-6fbc0dee.js';
35
+ import { L as LeuElement } from './LeuElement-e092765a.js';
36
36
  //# sourceMappingURL=Popup.d.ts.map
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"Popup.d.ts","sourceRoot":"","sources":["Popup.js"],"names":[],"mappings":"wBAoCa,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;gCAlMqD,0BAA0B"}
package/dist/Popup.js CHANGED
@@ -1,13 +1,8 @@
1
- import { _ as _defineProperty, L as LeuElement } from './LeuElement-6fbc0dee.js';
1
+ import { _ as _defineProperty, L as LeuElement } from './LeuElement-e092765a.js';
2
2
  import { css, html } from 'lit';
3
3
  import { autoUpdate, size, flip, shift, computePosition } from '@floating-ui/dom';
4
4
 
5
- var css_248z = css`:host,
6
- :host * {
7
- box-sizing: border-box;
8
- }
9
-
10
- :host {
5
+ var css_248z = css`:host {
11
6
  --popup-font-regular: var(--leu-font-family-regular);
12
7
  --popup-font-black: var(--leu-font-family-black);
13
8
 
@@ -198,7 +193,7 @@ class LeuPopup extends LeuElement {
198
193
  `;
199
194
  }
200
195
  }
201
- _defineProperty(LeuPopup, "styles", css_248z);
196
+ _defineProperty(LeuPopup, "styles", [LeuElement.styles, css_248z]);
202
197
  _defineProperty(LeuPopup, "shadowRootOptions", {
203
198
  ...LeuElement.shadowRootOptions,
204
199
  delegatesFocus: true
package/dist/Radio.d.ts CHANGED
@@ -10,5 +10,5 @@ export class LeuRadio extends LeuElement {
10
10
  handleInput(event: any): void;
11
11
  render(): import("lit-html").TemplateResult<1>;
12
12
  }
13
- import { L as LeuElement } from './LeuElement-6fbc0dee.js';
13
+ import { L as LeuElement } from './LeuElement-e092765a.js';
14
14
  //# sourceMappingURL=Radio.d.ts.map
package/dist/Radio.js CHANGED
@@ -1,4 +1,4 @@
1
- import { _ as _defineProperty, L as LeuElement } from './LeuElement-6fbc0dee.js';
1
+ import { _ as _defineProperty, L as LeuElement } from './LeuElement-e092765a.js';
2
2
  import { css, html } from 'lit';
3
3
 
4
4
  var css_248z = css`:host {
@@ -130,7 +130,7 @@ class LeuRadio extends LeuElement {
130
130
  `;
131
131
  }
132
132
  }
133
- _defineProperty(LeuRadio, "styles", css_248z);
133
+ _defineProperty(LeuRadio, "styles", [LeuElement.styles, css_248z]);
134
134
  /** @internal */
135
135
  _defineProperty(LeuRadio, "shadowRootOptions", {
136
136
  ...LeuElement.shadowRootOptions,
@@ -16,5 +16,5 @@ export class LeuRadioGroup extends LeuElement {
16
16
  initializeIndex(): void;
17
17
  render(): import("lit-html").TemplateResult<1>;
18
18
  }
19
- import { L as LeuElement } from './LeuElement-6fbc0dee.js';
19
+ import { L as LeuElement } from './LeuElement-e092765a.js';
20
20
  //# sourceMappingURL=RadioGroup.d.ts.map
@@ -1,4 +1,4 @@
1
- import { _ as _defineProperty, L as LeuElement } from './LeuElement-6fbc0dee.js';
1
+ import { _ as _defineProperty, L as LeuElement } from './LeuElement-e092765a.js';
2
2
  import { css, html } from 'lit';
3
3
  import { classMap } from 'lit/directives/class-map.js';
4
4
 
@@ -162,7 +162,7 @@ class LeuRadioGroup extends LeuElement {
162
162
  `;
163
163
  }
164
164
  }
165
- _defineProperty(LeuRadioGroup, "styles", css_248z);
165
+ _defineProperty(LeuRadioGroup, "styles", [LeuElement.styles, css_248z]);
166
166
  _defineProperty(LeuRadioGroup, "properties", {
167
167
  orientation: {
168
168
  type: String,
@@ -0,0 +1,60 @@
1
+ /**
2
+ * @tagname leu-range
3
+ */
4
+ export class LeuRange extends LeuElement {
5
+ defaultValue: number[];
6
+ min: number;
7
+ max: number;
8
+ step: number;
9
+ name: string;
10
+ label: string;
11
+ disabled: boolean;
12
+ multiple: boolean;
13
+ updated(): void;
14
+ _updateStyles(): void;
15
+ /**
16
+ * Sets the value of the underlying input element(s).
17
+ * The value has to be an array if "multiple" range is used.
18
+ * Otherwise it has to be a string.
19
+ * @param {string | Array} value
20
+ */
21
+ set value(value: string | any[]);
22
+ get value(): string | any[];
23
+ get valueAsArray(): number[];
24
+ get valueLow(): string | number;
25
+ get valueHigh(): string | number;
26
+ /**
27
+ * @returns {HTMLInputElement | null}
28
+ */
29
+ _getBaseInput(): HTMLInputElement | null;
30
+ /**
31
+ * @returns {HTMLInputElement | null}
32
+ */
33
+ _getGhostInput(): HTMLInputElement | null;
34
+ /**
35
+ *
36
+ * @param {number} _index
37
+ * @param {InputEvent & {target: HTMLInputElement}} _e
38
+ */
39
+ _handleInput(_index: number, _e: InputEvent & {
40
+ target: HTMLInputElement;
41
+ }): void;
42
+ /**
43
+ *
44
+ * @param {number} value
45
+ * @returns {number}
46
+ */
47
+ _getNormalizedValue(value: number): number;
48
+ _getNormalizedRange(): number[];
49
+ /**
50
+ * Determine if the "click" (pointer event) is closer the
51
+ * the value of the other input element. Swap the values if this is the case.
52
+ * @param {PointerEvent & {target: HTMLInputElement}} e
53
+ */
54
+ _handlePointerDown(e: PointerEvent & {
55
+ target: HTMLInputElement;
56
+ }): void;
57
+ render(): import("lit-html").TemplateResult<1>;
58
+ }
59
+ import { L as LeuElement } from './LeuElement-e092765a.js';
60
+ //# sourceMappingURL=Range.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Range.d.ts","sourceRoot":"","sources":["Range.js"],"names":[],"mappings":"AA0MA;;GAEG;AACH;IAGI,uBAAwB;IACxB,YAAY;IACZ,YAAc;IACd,aAAa;IACb,aAAc;IACd,cAAe;IACf,kBAAqB;IACrB,kBAAqB;IAEvB,gBAEC;IACD,sBAYC;IAMD;;;;;OAKG;IACH,iCAWC;IAtBD,4BAGC;IAoBD,6BAEC;IACD,gCAMC;IACD,iCAMC;IAED;;OAEG;IACH,iBAFa,gBAAgB,GAAG,IAAI,CAInC;IAED;;OAEG;IACH,kBAFa,gBAAgB,GAAG,IAAI,CAInC;IAED;;;;OAIG;IACH,qBAHW,MAAM,MACN,UAAU,GAAG;QAAC,MAAM,EAAE,gBAAgB,CAAA;KAAC,QAIjD;IAED;;;;OAIG;IACH,2BAHW,MAAM,GACJ,MAAM,CAIlB;IACD,gCAKC;IAED;;;;OAIG;IACH,sBAFW,YAAY,GAAG;QAAC,MAAM,EAAE,gBAAgB,CAAA;KAAC,QAanD;IACD,+CAyCC;CACF;gCAnXqD,0BAA0B"}
package/dist/Range.js ADDED
@@ -0,0 +1,413 @@
1
+ import { _ as _defineProperty, L as LeuElement } from './LeuElement-e092765a.js';
2
+ import { css, html } from 'lit';
3
+
4
+ var css_248z = css`:host {
5
+ --range-color: var(--leu-color-black-40);
6
+ --range-color-disabled: var(--leu-color-black-20);
7
+ --range-color-focus: var(--leu-color-func-cyan);
8
+
9
+ --range-track-background-color: var(--leu-color-black-10);
10
+ --range-track-height: 4px;
11
+ --range-track-radius: var(--range-track-height);
12
+
13
+ --range-track-value-color: var(--leu-color-func-cyan);
14
+ --range-track-value-width: 0;
15
+ --range-track-value-min: 0;
16
+
17
+ --range-thumb-color: var(--leu-color-black-0);
18
+ --range-thumb-border-color: var(--range-color);
19
+ --range-thumb-hover-border-color: var(--leu-color-black-100);
20
+ --range-thumb-diameter: 32px;
21
+
22
+ --range-value-color: var(--leu-color-black-100);
23
+ --range-value-color-disabled: var(--range-color-disabled);
24
+
25
+ --range-font-regular: var(--leu-font-family-regular);
26
+ --range-font-black: var(--leu-font-family-black);
27
+
28
+ display: block;
29
+
30
+ font-family: var(--leu-font-family-regular);
31
+
32
+ font-family: var(--range-font-regular);
33
+ }
34
+
35
+ :host([disabled]) {
36
+ --range-track-background: var(--range-color-disabled);
37
+ --range-track-value-color: var(--range-color-disabled);
38
+ --range-thumb-border-color: var(--range-color-disabled);
39
+ --range-thumb-hover-border-color: var(--range-color-disabled);
40
+ --range-value-color: var(--range-value-color-disabled);
41
+ }
42
+
43
+ /*************************** */
44
+
45
+ .label {
46
+ display: inline-block;
47
+ margin-bottom: 0.5rem;
48
+ color: var(--leu-color-black-100);
49
+ font: var(--leu-t-regular-regular-font);
50
+ }
51
+
52
+ .outputs {
53
+ position: relative;
54
+ height: 1.5rem;
55
+ margin-bottom: 0.25rem;
56
+ }
57
+
58
+ .output {
59
+ position: absolute;
60
+
61
+ text-align: center;
62
+ font: var(--leu-t-tiny-black-font);
63
+ color: var(--range-value-color);
64
+
65
+ min-width: var(--range-thumb-diameter);
66
+
67
+ --_stop: calc(100% - var(--range-thumb-diameter));
68
+ --_start: 0%;
69
+
70
+ left: calc(var(--value) * (calc(100% - var(--range-thumb-diameter)) - 0%) + 0%);
71
+
72
+ left: calc(var(--value) * (var(--_stop) - var(--_start)) + var(--_start));
73
+ transform: translateX(calc(-50% + var(--range-thumb-diameter) / 2));
74
+ }
75
+
76
+ .inputs {
77
+ position: relative;
78
+ }
79
+
80
+ .range {
81
+ -webkit-appearance: none;
82
+ -moz-appearance: none;
83
+ appearance: none;
84
+ width: 100%;
85
+ height: var(--range-thumb-diameter);
86
+ padding: 0;
87
+ margin: 0;
88
+ background: transparent;
89
+
90
+ --_track-background: linear-gradient(
91
+ to right,
92
+ var(--range-track-background-color) calc(var(--low) * 100%),
93
+ var(--range-track-value-color) 0,
94
+ var(--range-track-value-color) calc(var(--high) * 100%),
95
+ var(--range-track-background-color) 0
96
+ );
97
+ }
98
+
99
+ .range--ghost {
100
+ position: absolute;
101
+ top: 0;
102
+ left: 0;
103
+ z-index: 1;
104
+ pointer-events: none;
105
+ }
106
+
107
+ .range:focus {
108
+ outline: none;
109
+ }
110
+
111
+ /* Thumb */
112
+
113
+ .range::-moz-range-thumb {
114
+ cursor: pointer;
115
+ background: var(--range-thumb-color);
116
+
117
+ border: 2px var(--range-thumb-border-color) solid;
118
+ border-radius: 50%;
119
+
120
+ height: var(--range-thumb-diameter);
121
+ width: var(--range-thumb-diameter);
122
+
123
+ pointer-events: all;
124
+ }
125
+
126
+ .range:disabled::-moz-range-thumb {
127
+ cursor: not-allowed;
128
+ }
129
+
130
+ .range:focus-visible::-moz-range-thumb {
131
+ outline: 2px solid var(--range-color-focus);
132
+ outline-offset: 2px;
133
+ }
134
+
135
+ .range::-moz-range-thumb:hover,
136
+ .range:focus-visible::-moz-range-thumb {
137
+ border-color: var(--range-thumb-hover-border-color);
138
+ }
139
+
140
+ .range::-webkit-slider-thumb {
141
+ -webkit-appearance: none;
142
+ appearance: none;
143
+ cursor: pointer;
144
+ background: var(--range-thumb-color);
145
+
146
+ border: 2px var(--range-thumb-border-color) solid;
147
+ border-radius: 50%;
148
+
149
+ height: var(--range-thumb-diameter);
150
+ width: var(--range-thumb-diameter);
151
+ margin-top: calc(var(--range-thumb-diameter) / -2 + 2px);
152
+
153
+ pointer-events: all;
154
+ }
155
+
156
+ .range:disabled::-webkit-slider-thumb {
157
+ cursor: not-allowed;
158
+ }
159
+
160
+ .range:focus::-webkit-slider-thumb {
161
+ outline: 2px solid var(--range-color-focus);
162
+ outline-offset: 2px;
163
+ }
164
+
165
+ .range:focus::-webkit-slider-thumb,
166
+ .range::-webkit-slider-thumb:hover {
167
+ border-color: var(--range-thumb-hover-border-color);
168
+ }
169
+
170
+ /* Track */
171
+
172
+ .range::-moz-range-track {
173
+ background: var(--_track-background);
174
+ border-radius: var(--range-track-radius);
175
+ height: var(--range-track-height);
176
+ }
177
+
178
+ .range--ghost::-moz-range-track {
179
+ background: transparent;
180
+ }
181
+
182
+ .range::-webkit-slider-runnable-track {
183
+ background: var(--_track-background);
184
+ border-radius: var(--range-track-radius);
185
+ height: var(--range-track-height);
186
+ }
187
+
188
+ .range--ghost::-webkit-slider-runnable-track {
189
+ background: transparent;
190
+ }
191
+ `;
192
+
193
+ const defaultValueConverter = {
194
+ fromAttribute(value) {
195
+ return value.split(",").map(v => Number(v.trim()));
196
+ },
197
+ toAttribute(value) {
198
+ return value.join(",");
199
+ }
200
+ };
201
+ const RANGE_LABELS = ["Von", "Bis"];
202
+
203
+ /**
204
+ * @tagname leu-range
205
+ */
206
+ class LeuRange extends LeuElement {
207
+ constructor() {
208
+ super();
209
+ this.defaultValue = [50];
210
+ this.min = 0;
211
+ this.max = 100;
212
+ this.step = 1;
213
+ this.name = "";
214
+ this.label = "";
215
+ this.disabled = false;
216
+ this.multiple = false;
217
+ }
218
+ updated() {
219
+ this._updateStyles();
220
+ }
221
+ _updateStyles() {
222
+ const normalizedRange = this._getNormalizedRange();
223
+ this.style.setProperty("--low", normalizedRange[0].toString());
224
+ this.style.setProperty("--high", normalizedRange[1].toString());
225
+ const inputs = this.multiple ? [this._getBaseInput(), this._getGhostInput()] : [this._getBaseInput()];
226
+ inputs.forEach(input => {
227
+ /** @type {HTMLOutputElement} */
228
+ const output = this.shadowRoot.querySelector(`.output[for=${input.id}]`);
229
+ const normalizedValue = this._getNormalizedValue(input.valueAsNumber);
230
+ output.style.setProperty("--value", normalizedValue.toString());
231
+ output.value = input.value;
232
+ });
233
+ }
234
+ get value() {
235
+ const inputs = Array.from(this.shadowRoot.querySelectorAll("input"));
236
+ return inputs.map(input => input.value).join(",");
237
+ }
238
+
239
+ /**
240
+ * Sets the value of the underlying input element(s).
241
+ * The value has to be an array if "multiple" range is used.
242
+ * Otherwise it has to be a string.
243
+ * @param {string | Array} value
244
+ */
245
+ set value(value) {
246
+ if (this.multiple && Array.isArray(value)) {
247
+ const inputs = Array.from(this.shadowRoot.querySelectorAll("input"));
248
+ value.forEach((v, i) => {
249
+ inputs[i].value = v;
250
+ });
251
+ this._updateStyles();
252
+ } else if (!this.multiple) {
253
+ this._getBaseInput().value = value;
254
+ this._updateStyles();
255
+ }
256
+ }
257
+ get valueAsArray() {
258
+ return Array.from(this.shadowRoot.querySelectorAll("input")).map(input => input.valueAsNumber);
259
+ }
260
+ get valueLow() {
261
+ const inputs = Array.from(this.shadowRoot.querySelectorAll("input"));
262
+ if (this.multiple) {
263
+ return inputs.map(input => input.valueAsNumber).sort((a, b) => a - b)[0];
264
+ }
265
+ return inputs[0].value;
266
+ }
267
+ get valueHigh() {
268
+ const inputs = Array.from(this.shadowRoot.querySelectorAll("input"));
269
+ if (this.multiple) {
270
+ return inputs.map(input => input.valueAsNumber).sort((a, b) => a - b)[1];
271
+ }
272
+ return inputs[0].value;
273
+ }
274
+
275
+ /**
276
+ * @returns {HTMLInputElement | null}
277
+ */
278
+ _getBaseInput() {
279
+ return this.shadowRoot.querySelector(".range--base");
280
+ }
281
+
282
+ /**
283
+ * @returns {HTMLInputElement | null}
284
+ */
285
+ _getGhostInput() {
286
+ return this.shadowRoot.querySelector(".range--ghost");
287
+ }
288
+
289
+ /**
290
+ *
291
+ * @param {number} _index
292
+ * @param {InputEvent & {target: HTMLInputElement}} _e
293
+ */
294
+ _handleInput(_index, _e) {
295
+ this._updateStyles();
296
+ }
297
+
298
+ /**
299
+ *
300
+ * @param {number} value
301
+ * @returns {number}
302
+ */
303
+ _getNormalizedValue(value) {
304
+ return (value - this.min) / (this.max - this.min);
305
+ }
306
+ _getNormalizedRange() {
307
+ if (this.multiple) {
308
+ return this.valueAsArray.map(value => this._getNormalizedValue(value)).sort((a, b) => a - b);
309
+ }
310
+ return [0, this._getNormalizedValue(this.valueAsArray[0])];
311
+ }
312
+
313
+ /**
314
+ * Determine if the "click" (pointer event) is closer the
315
+ * the value of the other input element. Swap the values if this is the case.
316
+ * @param {PointerEvent & {target: HTMLInputElement}} e
317
+ */
318
+ _handlePointerDown(e) {
319
+ const clickValue = this.min + (this.max - this.min) * e.offsetX / this.offsetWidth;
320
+ const middleValue = (this.valueAsArray[0] + this.valueAsArray[1]) / 2;
321
+ if (e.target.valueAsNumber === this.valueLow === clickValue > middleValue) {
322
+ /**
323
+ * As the pointerdown event is fired before the input event, we first overwrite the value
324
+ * of the input element that was not clicked on. The active input element will update itself.
325
+ */
326
+ // this._value = [e.target.valueAsNumber, e.target.valueAsNumber]
327
+ this._getGhostInput().value = e.target.value;
328
+ }
329
+ }
330
+ render() {
331
+ const inputs = this.multiple ? ["base", "ghost"] : ["base"];
332
+ const {
333
+ multiple,
334
+ disabled,
335
+ label,
336
+ defaultValue
337
+ } = this;
338
+ return html`
339
+ <div
340
+ role=${multiple ? "group" : undefined}
341
+ aria-labelledby=${multiple ? "group-label" : undefined}
342
+ >
343
+ ${multiple ? html`<span id="group-label" class="label">${label}</span>` : html`<label for="input-base" class="label">${label}</label>`}
344
+ <div class="outputs">
345
+ ${inputs.map((type, index) => html`<output
346
+ class="output"
347
+ for="input-${type}"
348
+ value=${defaultValue[index]}
349
+ ></output>`)}
350
+ </div>
351
+ <div class="inputs">
352
+ ${inputs.map((type, index) => html`
353
+ <input
354
+ @input=${e => this._handleInput(index, e)}
355
+ @pointerdown=${multiple && !disabled && index === 0 ? this._handlePointerDown : undefined}
356
+ type="range"
357
+ class="range range--${type}"
358
+ id="input-${type}"
359
+ name=${this.name}
360
+ min=${this.min}
361
+ max=${this.max}
362
+ step=${this.step}
363
+ aria-label=${multiple ? RANGE_LABELS[index] : undefined}
364
+ ?disabled=${disabled}
365
+ .value=${defaultValue[index].toString()}
366
+ />
367
+ `)}
368
+ </div>
369
+ </div>
370
+ `;
371
+ }
372
+ }
373
+ _defineProperty(LeuRange, "styles", [LeuElement.styles, css_248z]);
374
+ _defineProperty(LeuRange, "shadowRootOptions", {
375
+ ...LeuElement.shadowRootOptions,
376
+ delegatesFocus: true
377
+ });
378
+ _defineProperty(LeuRange, "properties", {
379
+ defaultValue: {
380
+ converter: defaultValueConverter,
381
+ attribute: "value"
382
+ },
383
+ min: {
384
+ type: Number,
385
+ reflect: true
386
+ },
387
+ max: {
388
+ type: Number,
389
+ reflect: true
390
+ },
391
+ step: {
392
+ type: Number,
393
+ reflect: true
394
+ },
395
+ name: {
396
+ type: String,
397
+ reflect: true
398
+ },
399
+ label: {
400
+ type: String,
401
+ reflect: true
402
+ },
403
+ disabled: {
404
+ type: Boolean,
405
+ reflect: true
406
+ },
407
+ multiple: {
408
+ type: Boolean,
409
+ reflect: true
410
+ }
411
+ });
412
+
413
+ export { LeuRange };
@@ -15,5 +15,5 @@ export class LeuScrollTop extends LeuElement {
15
15
  _scrollListener: Function;
16
16
  render(): import("lit-html").TemplateResult<1>;
17
17
  }
18
- import { L as LeuElement } from './LeuElement-6fbc0dee.js';
18
+ import { L as LeuElement } from './LeuElement-e092765a.js';
19
19
  //# sourceMappingURL=ScrollTop.d.ts.map