@statistikzh/leu 0.10.0 → 0.11.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 (98) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/Accordion.d.ts +1 -1
  3. package/dist/Accordion.js +1 -1
  4. package/dist/Breadcrumb.d.ts +1 -1
  5. package/dist/Breadcrumb.js +1 -1
  6. package/dist/Button.d.ts +1 -1
  7. package/dist/Button.js +2 -2
  8. package/dist/ButtonGroup.d.ts +1 -1
  9. package/dist/ButtonGroup.js +1 -1
  10. package/dist/Checkbox.d.ts +1 -1
  11. package/dist/Checkbox.js +1 -1
  12. package/dist/CheckboxGroup.d.ts +1 -1
  13. package/dist/CheckboxGroup.js +1 -1
  14. package/dist/Chip.d.ts +1 -1
  15. package/dist/Chip.js +1 -1
  16. package/dist/ChipGroup.d.ts +1 -1
  17. package/dist/ChipGroup.js +1 -1
  18. package/dist/ChipLink.js +1 -1
  19. package/dist/ChipRemovable.js +1 -1
  20. package/dist/ChipSelectable.js +1 -1
  21. package/dist/Dialog.d.ts +1 -1
  22. package/dist/Dialog.js +2 -2
  23. package/dist/Dropdown.d.ts +1 -1
  24. package/dist/Dropdown.js +2 -2
  25. package/dist/Icon.d.ts +1 -1
  26. package/dist/Icon.js +1 -1
  27. package/dist/Input.d.ts +1 -1
  28. package/dist/Input.js +1 -1
  29. package/dist/{LeuElement-6fbc0dee.d.ts → LeuElement-78b4a998.d.ts} +1 -1
  30. package/dist/LeuElement-78b4a998.d.ts.map +1 -0
  31. package/dist/{LeuElement-6fbc0dee.js → LeuElement-78b4a998.js} +1 -1
  32. package/dist/Menu.d.ts +1 -1
  33. package/dist/Menu.js +1 -1
  34. package/dist/MenuItem.d.ts +1 -1
  35. package/dist/MenuItem.js +1 -1
  36. package/dist/Pagination.d.ts +1 -1
  37. package/dist/Pagination.js +2 -2
  38. package/dist/Popup.d.ts +1 -1
  39. package/dist/Popup.js +1 -1
  40. package/dist/Radio.d.ts +1 -1
  41. package/dist/Radio.js +1 -1
  42. package/dist/RadioGroup.d.ts +1 -1
  43. package/dist/RadioGroup.js +1 -1
  44. package/dist/Range.d.ts +60 -0
  45. package/dist/Range.d.ts.map +1 -0
  46. package/dist/Range.js +414 -0
  47. package/dist/ScrollTop.d.ts +1 -1
  48. package/dist/ScrollTop.js +2 -2
  49. package/dist/Select.d.ts +1 -1
  50. package/dist/Select.js +2 -2
  51. package/dist/Spinner.d.ts +1 -1
  52. package/dist/Spinner.js +1 -1
  53. package/dist/Table.d.ts +1 -1
  54. package/dist/Table.js +2 -2
  55. package/dist/VisuallyHidden.d.ts +1 -1
  56. package/dist/VisuallyHidden.js +1 -1
  57. package/dist/{hasSlotController-04d0dfa2.d.ts → hasSlotController-fd1950b4.d.ts} +1 -1
  58. package/dist/{hasSlotController-04d0dfa2.d.ts.map → hasSlotController-fd1950b4.d.ts.map} +1 -1
  59. package/dist/{hasSlotController-04d0dfa2.js → hasSlotController-fd1950b4.js} +1 -1
  60. package/dist/index.js +2 -2
  61. package/dist/leu-accordion.js +1 -1
  62. package/dist/leu-breadcrumb.js +1 -1
  63. package/dist/leu-button-group.js +1 -1
  64. package/dist/leu-button.js +2 -2
  65. package/dist/leu-checkbox-group.js +1 -1
  66. package/dist/leu-checkbox.js +1 -1
  67. package/dist/leu-chip-group.js +1 -1
  68. package/dist/leu-chip-link.js +1 -1
  69. package/dist/leu-chip-removable.js +1 -1
  70. package/dist/leu-chip-selectable.js +1 -1
  71. package/dist/leu-dialog.js +2 -2
  72. package/dist/leu-dropdown.js +2 -2
  73. package/dist/leu-icon.js +1 -1
  74. package/dist/leu-input.js +1 -1
  75. package/dist/leu-menu-item.js +1 -1
  76. package/dist/leu-menu.js +1 -1
  77. package/dist/leu-pagination.js +2 -2
  78. package/dist/leu-popup.js +1 -1
  79. package/dist/leu-radio-group.js +1 -1
  80. package/dist/leu-radio.js +1 -1
  81. package/dist/leu-range.d.ts +3 -0
  82. package/dist/leu-range.d.ts.map +1 -0
  83. package/dist/leu-range.js +7 -0
  84. package/dist/leu-scroll-top.js +2 -2
  85. package/dist/leu-select.js +2 -2
  86. package/dist/leu-spinner.js +1 -1
  87. package/dist/leu-table.js +2 -2
  88. package/dist/leu-visually-hidden.js +1 -1
  89. package/dist/vscode.html-custom-data.json +20 -0
  90. package/dist/vue/index.d.ts +41 -0
  91. package/dist/web-types.json +45 -1
  92. package/package.json +1 -1
  93. package/src/components/range/Range.js +237 -0
  94. package/src/components/range/leu-range.js +5 -0
  95. package/src/components/range/range.css +181 -0
  96. package/src/components/range/stories/range-slider.stories.js +142 -0
  97. package/src/components/range/test/range-test.js +24 -0
  98. package/dist/LeuElement-6fbc0dee.d.ts.map +0 -1
package/dist/leu-input.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { LeuInput } from './Input.js';
2
- import './LeuElement-6fbc0dee.js';
2
+ import './LeuElement-78b4a998.js';
3
3
  import 'lit';
4
4
  import 'lit/directives/class-map.js';
5
5
  import 'lit/directives/if-defined.js';
@@ -1,5 +1,5 @@
1
1
  import { LeuMenuItem } from './MenuItem.js';
2
- import './LeuElement-6fbc0dee.js';
2
+ import './LeuElement-78b4a998.js';
3
3
  import 'lit';
4
4
  import 'lit/directives/if-defined.js';
5
5
  import './Icon.js';
package/dist/leu-menu.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { LeuMenu } from './Menu.js';
2
- import './LeuElement-6fbc0dee.js';
2
+ import './LeuElement-78b4a998.js';
3
3
  import 'lit';
4
4
  import './MenuItem.js';
5
5
  import 'lit/directives/if-defined.js';
@@ -1,12 +1,12 @@
1
1
  import { LeuPagination } from './Pagination.js';
2
- import './LeuElement-6fbc0dee.js';
2
+ import './LeuElement-78b4a998.js';
3
3
  import 'lit';
4
4
  import 'lit/directives/live.js';
5
5
  import './Button.js';
6
6
  import 'lit/directives/class-map.js';
7
7
  import 'lit/directives/if-defined.js';
8
8
  import './Icon.js';
9
- import './hasSlotController-04d0dfa2.js';
9
+ import './hasSlotController-fd1950b4.js';
10
10
  import './VisuallyHidden.js';
11
11
 
12
12
  LeuPagination.define("leu-pagination");
package/dist/leu-popup.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { LeuPopup } from './Popup.js';
2
- import './LeuElement-6fbc0dee.js';
2
+ import './LeuElement-78b4a998.js';
3
3
  import 'lit';
4
4
  import '@floating-ui/dom';
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { LeuRadioGroup } from './RadioGroup.js';
2
- import './LeuElement-6fbc0dee.js';
2
+ import './LeuElement-78b4a998.js';
3
3
  import 'lit';
4
4
  import 'lit/directives/class-map.js';
5
5
 
package/dist/leu-radio.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { LeuRadio } from './Radio.js';
2
- import './LeuElement-6fbc0dee.js';
2
+ import './LeuElement-78b4a998.js';
3
3
  import 'lit';
4
4
 
5
5
  LeuRadio.define("leu-radio");
@@ -0,0 +1,3 @@
1
+ export { LeuRange };
2
+ import { LeuRange } from './Range.js';
3
+ //# sourceMappingURL=leu-range.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"leu-range.d.ts","sourceRoot":"","sources":["leu-range.js"],"names":[],"mappings":";yBAAyB,YAAY"}
@@ -0,0 +1,7 @@
1
+ import { LeuRange } from './Range.js';
2
+ import './LeuElement-78b4a998.js';
3
+ import 'lit';
4
+
5
+ LeuRange.define("leu-range");
6
+
7
+ export { LeuRange };
@@ -1,11 +1,11 @@
1
1
  import { LeuScrollTop } from './ScrollTop.js';
2
- import './LeuElement-6fbc0dee.js';
2
+ import './LeuElement-78b4a998.js';
3
3
  import 'lit';
4
4
  import 'lit/directives/class-map.js';
5
5
  import './Button.js';
6
6
  import 'lit/directives/if-defined.js';
7
7
  import './Icon.js';
8
- import './hasSlotController-04d0dfa2.js';
8
+ import './hasSlotController-fd1950b4.js';
9
9
  import './utils-65469421.js';
10
10
 
11
11
  LeuScrollTop.define("leu-scroll-top");
@@ -1,10 +1,10 @@
1
1
  import { LeuSelect } from './Select.js';
2
- import './LeuElement-6fbc0dee.js';
2
+ import './LeuElement-78b4a998.js';
3
3
  import 'lit';
4
4
  import 'lit/directives/class-map.js';
5
5
  import 'lit/directives/ref.js';
6
6
  import 'lit/directives/if-defined.js';
7
- import './hasSlotController-04d0dfa2.js';
7
+ import './hasSlotController-fd1950b4.js';
8
8
  import './Button.js';
9
9
  import './Icon.js';
10
10
  import './Menu.js';
@@ -1,5 +1,5 @@
1
1
  import { LeuSpinner } from './Spinner.js';
2
- import './LeuElement-6fbc0dee.js';
2
+ import './LeuElement-78b4a998.js';
3
3
  import 'lit';
4
4
 
5
5
  LeuSpinner.define("leu-spinner");
package/dist/leu-table.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { LeuTable } from './Table.js';
2
- import './LeuElement-6fbc0dee.js';
2
+ import './LeuElement-78b4a998.js';
3
3
  import 'lit';
4
4
  import 'lit/directives/class-map.js';
5
5
  import 'lit/directives/style-map.js';
@@ -9,7 +9,7 @@ import './Pagination.js';
9
9
  import 'lit/directives/live.js';
10
10
  import './Button.js';
11
11
  import 'lit/directives/if-defined.js';
12
- import './hasSlotController-04d0dfa2.js';
12
+ import './hasSlotController-fd1950b4.js';
13
13
  import './VisuallyHidden.js';
14
14
 
15
15
  LeuTable.define("leu-table");
@@ -1,5 +1,5 @@
1
1
  import { LeuVisuallyHidden } from './VisuallyHidden.js';
2
- import './LeuElement-6fbc0dee.js';
2
+ import './LeuElement-78b4a998.js';
3
3
  import 'lit';
4
4
 
5
5
  LeuVisuallyHidden.define("leu-visually-hidden");
@@ -557,6 +557,26 @@
557
557
  }
558
558
  ]
559
559
  },
560
+ {
561
+ "name": "leu-range",
562
+ "description": "\n---\n\n\n### **Methods:**\n - **_handlePointerDown(e: _PointerEvent & {target: HTMLInputElement}_)** - Determine if the \"click\" (pointer event) is closer the\nthe value of the other input element. Swap the values if this is the case.",
563
+ "attributes": [
564
+ { "name": "value", "values": [{ "name": "array" }] },
565
+ { "name": "min", "values": [] },
566
+ { "name": "max", "values": [] },
567
+ { "name": "step", "values": [] },
568
+ { "name": "name", "values": [] },
569
+ { "name": "label", "values": [] },
570
+ { "name": "disabled", "values": [] },
571
+ { "name": "multiple", "values": [] }
572
+ ],
573
+ "references": [
574
+ {
575
+ "name": "Documentation",
576
+ "url": "https://statistikzh.github.io/leu/?path=/story/range"
577
+ }
578
+ ]
579
+ },
560
580
  {
561
581
  "name": "leu-scroll-top",
562
582
  "description": "\n---\n",
@@ -20,6 +20,7 @@ import type { LeuPagination, CustomEvent } from "../Pagination.js";
20
20
  import type { LeuPopup } from "../Popup.js";
21
21
  import type { LeuRadio } from "../Radio.js";
22
22
  import type { LeuRadioGroup } from "../RadioGroup.js";
23
+ import type { LeuRange } from "../Range.js";
23
24
  import type { LeuScrollTop } from "../ScrollTop.js";
24
25
  import type { LeuSelect } from "../Select.js";
25
26
  import type { LeuSpinner } from "../Spinner.js";
@@ -360,6 +361,35 @@ type LeuRadioGroupProps = {
360
361
  items?: LeuRadioGroup["items"];
361
362
  };
362
363
 
364
+ type LeuRangeProps = {
365
+ /** */
366
+ value?: LeuRange["defaultValue"];
367
+ /** */
368
+ min?: LeuRange["min"];
369
+ /** */
370
+ max?: LeuRange["max"];
371
+ /** */
372
+ step?: LeuRange["step"];
373
+ /** */
374
+ name?: LeuRange["name"];
375
+ /** */
376
+ label?: LeuRange["label"];
377
+ /** */
378
+ disabled?: LeuRange["disabled"];
379
+ /** */
380
+ multiple?: LeuRange["multiple"];
381
+ /** Sets the value of the underlying input element(s).
382
+ The value has to be an array if "multiple" range is used.
383
+ Otherwise it has to be a string. */
384
+ value?: LeuRange["value"];
385
+ /** */
386
+ valueAsArray?: LeuRange["valueAsArray"];
387
+ /** */
388
+ valueLow?: LeuRange["valueLow"];
389
+ /** */
390
+ valueHigh?: LeuRange["valueHigh"];
391
+ };
392
+
363
393
  type LeuScrollTopProps = {
364
394
  /** */
365
395
  _showButton?: LeuScrollTop["_showButton"];
@@ -672,6 +702,17 @@ export type CustomElements = {
672
702
  */
673
703
  "leu-radio-group": DefineComponent<LeuRadioGroupProps>;
674
704
 
705
+ /**
706
+ *
707
+ * ---
708
+ *
709
+ *
710
+ * ### **Methods:**
711
+ * - **_handlePointerDown(e: _PointerEvent & {target: HTMLInputElement}_)** - Determine if the "click" (pointer event) is closer the
712
+ * the value of the other input element. Swap the values if this is the case.
713
+ */
714
+ "leu-range": DefineComponent<LeuRangeProps>;
715
+
675
716
  /**
676
717
  *
677
718
  * ---
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "name": "@statistikzh/leu",
4
- "version": "0.10.0",
4
+ "version": "0.11.0",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -1063,6 +1063,50 @@
1063
1063
  "events": []
1064
1064
  }
1065
1065
  },
1066
+ {
1067
+ "name": "leu-range",
1068
+ "description": "\n---\n\n\n### **Methods:**\n - **_handlePointerDown(e: _PointerEvent & {target: HTMLInputElement}_)** - Determine if the \"click\" (pointer event) is closer the\nthe value of the other input element. Swap the values if this is the case.",
1069
+ "doc-url": "",
1070
+ "attributes": [
1071
+ {
1072
+ "name": "value",
1073
+ "value": { "type": "array", "default": "[50]" }
1074
+ },
1075
+ { "name": "min", "value": { "type": "number", "default": "0" } },
1076
+ { "name": "max", "value": { "type": "number", "default": "100" } },
1077
+ { "name": "step", "value": { "type": "number", "default": "1" } },
1078
+ {
1079
+ "name": "name",
1080
+ "value": { "type": "string", "default": "\"\"" }
1081
+ },
1082
+ {
1083
+ "name": "label",
1084
+ "value": { "type": "string", "default": "\"\"" }
1085
+ },
1086
+ {
1087
+ "name": "disabled",
1088
+ "value": { "type": "boolean", "default": "false" }
1089
+ },
1090
+ {
1091
+ "name": "multiple",
1092
+ "value": { "type": "boolean", "default": "false" }
1093
+ }
1094
+ ],
1095
+ "events": [],
1096
+ "js": {
1097
+ "properties": [
1098
+ { "name": "value", "value": { "type": "array" } },
1099
+ { "name": "min", "value": { "type": "number" } },
1100
+ { "name": "max", "value": { "type": "number" } },
1101
+ { "name": "step", "value": { "type": "number" } },
1102
+ { "name": "name", "value": { "type": "string" } },
1103
+ { "name": "label", "value": { "type": "string" } },
1104
+ { "name": "disabled", "value": { "type": "boolean" } },
1105
+ { "name": "multiple", "value": { "type": "boolean" } }
1106
+ ],
1107
+ "events": []
1108
+ }
1109
+ },
1066
1110
  {
1067
1111
  "name": "leu-scroll-top",
1068
1112
  "description": "\n---\n",
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "UI component library of the canton of zurich",
4
4
  "license": "MIT",
5
5
  "author": "statistikzh",
6
- "version": "0.10.0",
6
+ "version": "0.11.0",
7
7
  "type": "module",
8
8
  "main": "dist/index.js",
9
9
  "module": "dist/index.js",
@@ -0,0 +1,237 @@
1
+ import { html } from "lit"
2
+
3
+ import styles from "./range.css"
4
+ import { LeuElement } from "../../lib/LeuElement.js"
5
+
6
+ const defaultValueConverter = {
7
+ fromAttribute(value) {
8
+ return value.split(",").map((v) => Number(v.trim()))
9
+ },
10
+ toAttribute(value) {
11
+ return value.join(",")
12
+ },
13
+ }
14
+
15
+ const RANGE_LABELS = ["Von", "Bis"]
16
+
17
+ /**
18
+ * @tagname leu-range
19
+ */
20
+ export class LeuRange extends LeuElement {
21
+ static styles = styles
22
+
23
+ static shadowRootOptions = {
24
+ ...LeuElement.shadowRootOptions,
25
+ delegatesFocus: true,
26
+ }
27
+
28
+ static properties = {
29
+ defaultValue: { converter: defaultValueConverter, attribute: "value" },
30
+ min: { type: Number, reflect: true },
31
+ max: { type: Number, reflect: true },
32
+ step: { type: Number, reflect: true },
33
+ name: { type: String, reflect: true },
34
+ label: { type: String, reflect: true },
35
+ disabled: { type: Boolean, reflect: true },
36
+ multiple: { type: Boolean, reflect: true },
37
+ }
38
+
39
+ constructor() {
40
+ super()
41
+ this.defaultValue = [50]
42
+ this.min = 0
43
+ this.max = 100
44
+ this.step = 1
45
+ this.name = ""
46
+ this.label = ""
47
+ this.disabled = false
48
+ this.multiple = false
49
+ }
50
+
51
+ updated() {
52
+ this._updateStyles()
53
+ }
54
+
55
+ _updateStyles() {
56
+ const normalizedRange = this._getNormalizedRange()
57
+ this.style.setProperty("--low", normalizedRange[0].toString())
58
+ this.style.setProperty("--high", normalizedRange[1].toString())
59
+
60
+ const inputs = this.multiple
61
+ ? [this._getBaseInput(), this._getGhostInput()]
62
+ : [this._getBaseInput()]
63
+
64
+ inputs.forEach((input) => {
65
+ /** @type {HTMLOutputElement} */
66
+ const output = this.shadowRoot.querySelector(`.output[for=${input.id}]`)
67
+ const normalizedValue = this._getNormalizedValue(input.valueAsNumber)
68
+ output.style.setProperty("--value", normalizedValue.toString())
69
+ output.value = input.value
70
+ })
71
+ }
72
+
73
+ get value() {
74
+ const inputs = Array.from(this.shadowRoot.querySelectorAll("input"))
75
+ return inputs.map((input) => input.value).join(",")
76
+ }
77
+
78
+ /**
79
+ * Sets the value of the underlying input element(s).
80
+ * The value has to be an array if "multiple" range is used.
81
+ * Otherwise it has to be a string.
82
+ * @param {string | Array} value
83
+ */
84
+ set value(value) {
85
+ if (this.multiple && Array.isArray(value)) {
86
+ const inputs = Array.from(this.shadowRoot.querySelectorAll("input"))
87
+ value.forEach((v, i) => {
88
+ inputs[i].value = v
89
+ })
90
+ this._updateStyles()
91
+ } else if (!this.multiple) {
92
+ this._getBaseInput().value = value
93
+ this._updateStyles()
94
+ }
95
+ }
96
+
97
+ get valueAsArray() {
98
+ return Array.from(this.shadowRoot.querySelectorAll("input")).map(
99
+ (input) => input.valueAsNumber
100
+ )
101
+ }
102
+
103
+ get valueLow() {
104
+ const inputs = Array.from(this.shadowRoot.querySelectorAll("input"))
105
+
106
+ if (this.multiple) {
107
+ return inputs.map((input) => input.valueAsNumber).sort((a, b) => a - b)[0]
108
+ }
109
+
110
+ return inputs[0].value
111
+ }
112
+
113
+ get valueHigh() {
114
+ const inputs = Array.from(this.shadowRoot.querySelectorAll("input"))
115
+
116
+ if (this.multiple) {
117
+ return inputs.map((input) => input.valueAsNumber).sort((a, b) => a - b)[1]
118
+ }
119
+
120
+ return inputs[0].value
121
+ }
122
+
123
+ /**
124
+ * @returns {HTMLInputElement | null}
125
+ */
126
+ _getBaseInput() {
127
+ return this.shadowRoot.querySelector(".range--base")
128
+ }
129
+
130
+ /**
131
+ * @returns {HTMLInputElement | null}
132
+ */
133
+ _getGhostInput() {
134
+ return this.shadowRoot.querySelector(".range--ghost")
135
+ }
136
+
137
+ /**
138
+ *
139
+ * @param {number} _index
140
+ * @param {InputEvent & {target: HTMLInputElement}} _e
141
+ */
142
+ _handleInput(_index, _e) {
143
+ this._updateStyles()
144
+ }
145
+
146
+ /**
147
+ *
148
+ * @param {number} value
149
+ * @returns {number}
150
+ */
151
+ _getNormalizedValue(value) {
152
+ return (value - this.min) / (this.max - this.min)
153
+ }
154
+
155
+ _getNormalizedRange() {
156
+ if (this.multiple) {
157
+ return this.valueAsArray
158
+ .map((value) => this._getNormalizedValue(value))
159
+ .sort((a, b) => a - b)
160
+ }
161
+
162
+ return [0, this._getNormalizedValue(this.valueAsArray[0])]
163
+ }
164
+
165
+ /**
166
+ * Determine if the "click" (pointer event) is closer the
167
+ * the value of the other input element. Swap the values if this is the case.
168
+ * @param {PointerEvent & {target: HTMLInputElement}} e
169
+ */
170
+ _handlePointerDown(e) {
171
+ const clickValue =
172
+ this.min + ((this.max - this.min) * e.offsetX) / this.offsetWidth
173
+ const middleValue = (this.valueAsArray[0] + this.valueAsArray[1]) / 2
174
+
175
+ if (
176
+ (e.target.valueAsNumber === this.valueLow) ===
177
+ clickValue > middleValue
178
+ ) {
179
+ /**
180
+ * As the pointerdown event is fired before the input event, we first overwrite the value
181
+ * of the input element that was not clicked on. The active input element will update itself.
182
+ */
183
+ // this._value = [e.target.valueAsNumber, e.target.valueAsNumber]
184
+ this._getGhostInput().value = e.target.value
185
+ }
186
+ }
187
+
188
+ render() {
189
+ const inputs = this.multiple ? ["base", "ghost"] : ["base"]
190
+
191
+ const { multiple, disabled, label, defaultValue } = this
192
+
193
+ return html`
194
+ <div
195
+ role=${multiple ? "group" : undefined}
196
+ aria-labelledby=${multiple ? "group-label" : undefined}
197
+ >
198
+ ${multiple
199
+ ? html`<span id="group-label" class="label">${label}</span>`
200
+ : html`<label for="input-base" class="label">${label}</label>`}
201
+ <div class="outputs">
202
+ ${inputs.map(
203
+ (type, index) =>
204
+ html`<output
205
+ class="output"
206
+ for="input-${type}"
207
+ value=${defaultValue[index]}
208
+ ></output>`
209
+ )}
210
+ </div>
211
+ <div class="inputs">
212
+ ${inputs.map(
213
+ (type, index) =>
214
+ html`
215
+ <input
216
+ @input=${(e) => this._handleInput(index, e)}
217
+ @pointerdown=${multiple && !disabled && index === 0
218
+ ? this._handlePointerDown
219
+ : undefined}
220
+ type="range"
221
+ class="range range--${type}"
222
+ id="input-${type}"
223
+ name=${this.name}
224
+ min=${this.min}
225
+ max=${this.max}
226
+ step=${this.step}
227
+ aria-label=${multiple ? RANGE_LABELS[index] : undefined}
228
+ ?disabled=${disabled}
229
+ .value=${defaultValue[index].toString()}
230
+ />
231
+ `
232
+ )}
233
+ </div>
234
+ </div>
235
+ `
236
+ }
237
+ }
@@ -0,0 +1,5 @@
1
+ import { LeuRange } from "./Range.js"
2
+
3
+ export { LeuRange }
4
+
5
+ LeuRange.define("leu-range")