@warp-ds/elements 2.9.1-next.3 → 2.9.1-next.5

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 (97) hide show
  1. package/dist/custom-elements.json +83 -239
  2. package/dist/docs/affix/affix.md +9 -10
  3. package/dist/docs/affix/api.md +9 -10
  4. package/dist/docs/alert/alert.md +4 -2
  5. package/dist/docs/alert/api.md +4 -2
  6. package/dist/docs/attention/api.md +16 -14
  7. package/dist/docs/attention/attention.md +16 -14
  8. package/dist/docs/badge/api.md +5 -6
  9. package/dist/docs/badge/badge.md +5 -6
  10. package/dist/docs/box/api.md +3 -4
  11. package/dist/docs/box/box.md +3 -4
  12. package/dist/docs/breadcrumbs/accessibility.md +46 -0
  13. package/dist/docs/breadcrumbs/api.md +8 -8
  14. package/dist/docs/breadcrumbs/breadcrumbs.md +127 -9
  15. package/dist/docs/breadcrumbs/examples.md +35 -0
  16. package/dist/docs/breadcrumbs/usage.md +36 -0
  17. package/dist/docs/button/api.md +15 -13
  18. package/dist/docs/button/button.md +15 -13
  19. package/dist/docs/card/api.md +5 -6
  20. package/dist/docs/card/card.md +5 -6
  21. package/dist/docs/combobox/api.md +18 -19
  22. package/dist/docs/combobox/combobox.md +18 -19
  23. package/dist/docs/datepicker/api.md +38 -39
  24. package/dist/docs/datepicker/datepicker.md +38 -39
  25. package/dist/docs/expandable/api.md +11 -12
  26. package/dist/docs/expandable/expandable.md +11 -12
  27. package/dist/docs/link/api.md +8 -6
  28. package/dist/docs/link/link.md +8 -6
  29. package/dist/docs/page-indicator/api.md +7 -8
  30. package/dist/docs/page-indicator/page-indicator.md +7 -8
  31. package/dist/docs/pagination/api.md +17 -9
  32. package/dist/docs/pagination/pagination.md +17 -9
  33. package/dist/docs/pill/api.md +30 -17
  34. package/dist/docs/pill/pill.md +30 -17
  35. package/dist/docs/select/api.md +17 -9
  36. package/dist/docs/select/select.md +17 -9
  37. package/dist/docs/slider/api.md +37 -116
  38. package/dist/docs/slider/examples.md +331 -0
  39. package/dist/docs/slider/slider.md +378 -118
  40. package/dist/docs/slider/usage.md +10 -0
  41. package/dist/docs/slider-thumb/api.md +26 -55
  42. package/dist/docs/slider-thumb/slider-thumb.md +26 -57
  43. package/dist/docs/step/api.md +3 -4
  44. package/dist/docs/step/step.md +3 -4
  45. package/dist/docs/step-indicator/api.md +3 -4
  46. package/dist/docs/step-indicator/step-indicator.md +3 -4
  47. package/dist/docs/switch/api.md +13 -5
  48. package/dist/docs/switch/switch.md +13 -5
  49. package/dist/docs/tab/api.md +9 -62
  50. package/dist/docs/tab/tab.md +9 -70
  51. package/dist/docs/tab-panel/api.md +7 -11
  52. package/dist/docs/tab-panel/tab-panel.md +7 -19
  53. package/dist/docs/tabs/accessibility.md +11 -0
  54. package/dist/docs/tabs/api.md +10 -18
  55. package/dist/docs/tabs/examples.md +68 -0
  56. package/dist/docs/tabs/tabs.md +97 -20
  57. package/dist/docs/tabs/usage.md +8 -0
  58. package/dist/docs/textarea/api.md +15 -16
  59. package/dist/docs/textarea/textarea.md +15 -16
  60. package/dist/docs/textfield/api.md +14 -15
  61. package/dist/docs/textfield/textfield.md +14 -15
  62. package/dist/index.d.ts +124 -224
  63. package/dist/packages/breadcrumbs/breadcrumbs.d.ts +7 -1
  64. package/dist/packages/breadcrumbs/breadcrumbs.js.map +2 -2
  65. package/dist/packages/button/button.react.stories.d.ts +8 -2
  66. package/dist/packages/button/button.react.test.d.ts +1 -0
  67. package/dist/packages/button/button.react.test.js +16 -0
  68. package/dist/packages/button/react.d.ts +5 -1
  69. package/dist/packages/button/react.js +8 -1
  70. package/dist/packages/pagination/pagination.test.js +38 -0
  71. package/dist/packages/select/select.react.stories.d.ts +1 -1
  72. package/dist/packages/slider/slider.d.ts +34 -45
  73. package/dist/packages/slider/slider.js +1 -1
  74. package/dist/packages/slider/slider.js.map +2 -2
  75. package/dist/packages/slider-thumb/slider-thumb.d.ts +36 -31
  76. package/dist/packages/slider-thumb/slider-thumb.js +1 -1
  77. package/dist/packages/slider-thumb/slider-thumb.js.map +2 -2
  78. package/dist/packages/tab/tab.d.ts +29 -24
  79. package/dist/packages/tab/tab.js +3 -3
  80. package/dist/packages/tab/tab.js.map +2 -2
  81. package/dist/packages/tab-panel/tab-panel.d.ts +9 -8
  82. package/dist/packages/tab-panel/tab-panel.js +3 -3
  83. package/dist/packages/tab-panel/tab-panel.js.map +2 -2
  84. package/dist/packages/tabs/index.d.ts +1 -0
  85. package/dist/packages/tabs/index.js +0 -1
  86. package/dist/packages/tabs/react.d.ts +4 -3
  87. package/dist/packages/tabs/tabs.d.ts +9 -3
  88. package/dist/packages/tabs/tabs.js.map +2 -2
  89. package/dist/packages/tabs/tabs.react.stories.d.ts +2 -2
  90. package/dist/web-types.json +201 -93
  91. package/package.json +2 -1
  92. package/dist/docs/tab/accessibility.md +0 -1
  93. package/dist/docs/tab/examples.md +0 -1
  94. package/dist/docs/tab/usage.md +0 -1
  95. package/dist/docs/tab-panel/accessibility.md +0 -1
  96. package/dist/docs/tab-panel/examples.md +0 -1
  97. package/dist/docs/tab-panel/usage.md +0 -1
@@ -1,73 +1,30 @@
1
- ## API Documentation
1
+ ## `<w-slider>` API
2
+
3
+ Unless otherwise noted all properties are HTML attributes (as opposed to JavaScript object properties).
2
4
 
3
5
  ### Properties
4
6
 
5
7
  | Name | Type | Default | Summary |
6
8
  |-|-|-|-|
7
- | _hasInternalError | `boolean` | `false` | - |
8
- | _invalidMessage | `string` | `''` | - |
9
- | _showError | `boolean` | `false` | - |
10
- | _tabbableElements | `Array<HTMLElement>` | `[]` | - |
11
- | componentHasError | `boolean` | `-` | - |
12
9
  | disabled | `boolean` | `false` | - |
13
- | edgeMax | `unknown` | `-` | - |
14
- | edgeMin | `unknown` | `-` | - |
15
- | error | `string` | `-` | - |
16
- | errorText | `string` | `-` | - |
17
- | fieldset | `HTMLFieldSetElement` | `-` | - |
18
- | helpText | `string` | `-` | - |
19
- | hiddenTextfield | `boolean` | `false` | - |
20
- | invalid | `boolean` | `false` | - |
10
+ | error | `string` | `-` | Validation error text, if any |
11
+ | help-text | `string` | `-` | Additional description to show below the fieldset |
12
+ | hidden-textfield | `boolean` | `false` | Should only be used in special cases |
13
+ | invalid | `boolean` | `false` | Sets the form fields and fieldset in an invalid state |
21
14
  | label | `string` | `-` | The slider fieldset label. Required for proper accessibility. |
22
- | labelFormatter | `(slot: SliderSlot) => string` | `-` | Formatter for the min and max labels below the range. |
15
+ | labelFormatter (JS only) | `(slot: SliderSlot) => string` | `-` | Formatter for the min and max labels below the range. |
23
16
  | markers | `number` | `-` | Pass a value similar to step to create visual markers at that interval |
24
- | max | `string` | `-` | - |
25
- | min | `string` | `-` | - |
26
- | openEnded | `boolean` | `false` | Whether or not to allow values outside the range such as "Before 1950" and "2025+". |
27
- | required | `boolean` | `false` | Ensures a child slider thumb has a value before allowing the containing form to submit. |
28
- | shadowRootOptions | `object` | `{ ...LitElement.shadowRootOptions, delegatesFocus: true, }` | - |
29
- | step | `number` | `-` | - |
30
- | suffix | `string` | `-` | Suffix used in text input fields and for the min and max values of the slider. |
31
- | tooltipFormatter | `(value: string, slot: SliderSlot) => string` | `-` | Replaces valueFormatter for the tooltip. Use in open-ended sliders to show for example "300+ hk" instead of "Max" in the tooltip. |
32
- | valueFormatter | `(value: string, slot: SliderSlot) => string` | `-` | Formatter for the tooltip and input mask values. |
17
+ | max | `string` | `100` | The maximum allowed value in the range inputs |
18
+ | min | `string` | `0` | The minimum allowed value in the range inputs |
19
+ | open-ended | `boolean` | `false` | Whether or not to allow values outside the range such as "Before 1950" and "2025+". |
20
+ | required | `boolean` | `false` | Ensures a child slider thumb has a value before allowing the containing form to submit |
21
+ | step | `number` | `-` | ets step on the range input to jump between values when dragging |
22
+ | suffix | `string` | `-` | Suffix used in text input fields and for the min and max values of the slider |
23
+ | tooltipFormatter (JS only) | `(value: string, slot: SliderSlot) => string` | `-` | Overrides valueFormatter for the tooltip. |
24
+ | valueFormatter (JS only) | `(value: string, slot: SliderSlot) => string` | `-` | Formatter for the tooltip and input mask values |
33
25
 
34
26
  ### Property Details
35
27
 
36
- #### _hasInternalError
37
-
38
-
39
-
40
- - Type: `boolean`
41
- - Default: `false`
42
-
43
- #### _invalidMessage
44
-
45
-
46
-
47
- - Type: `string`
48
- - Default: `''`
49
-
50
- #### _showError
51
-
52
-
53
-
54
- - Type: `boolean`
55
- - Default: `false`
56
-
57
- #### _tabbableElements
58
-
59
-
60
-
61
- - Type: `Array<HTMLElement>`
62
- - Default: `[]`
63
-
64
- #### componentHasError
65
-
66
-
67
-
68
- - Type: `boolean`
69
- - Default: `-`
70
-
71
28
  #### disabled
72
29
 
73
30
 
@@ -75,58 +32,30 @@
75
32
  - Type: `boolean`
76
33
  - Default: `false`
77
34
 
78
- #### edgeMax
79
-
80
-
81
-
82
- - Type: `unknown`
83
- - Default: `-`
84
-
85
- #### edgeMin
86
-
87
-
88
-
89
- - Type: `unknown`
90
- - Default: `-`
91
-
92
35
  #### error
93
36
 
94
-
95
-
96
- - Type: `string`
97
- - Default: `-`
98
-
99
- #### errorText
100
-
101
-
37
+ Validation error text, if any
102
38
 
103
39
  - Type: `string`
104
40
  - Default: `-`
105
41
 
106
- #### fieldset
107
-
108
-
109
-
110
- - Type: `HTMLFieldSetElement`
111
- - Default: `-`
112
-
113
- #### helpText
114
-
42
+ #### help-text
115
43
 
44
+ Additional description to show below the fieldset
116
45
 
117
46
  - Type: `string`
118
47
  - Default: `-`
119
48
 
120
- #### hiddenTextfield
121
-
49
+ #### hidden-textfield
122
50
 
51
+ Should only be used in special cases
123
52
 
124
53
  - Type: `boolean`
125
54
  - Default: `false`
126
55
 
127
56
  #### invalid
128
57
 
129
-
58
+ Sets the form fields and fieldset in an invalid state
130
59
 
131
60
  - Type: `boolean`
132
61
  - Default: `false`
@@ -140,7 +69,7 @@ If you need to display HTML, use the `label` slot instead (f. ex. `<legend class
140
69
  - Type: `string`
141
70
  - Default: `-`
142
71
 
143
- #### labelFormatter
72
+ #### labelFormatter (JS only)
144
73
 
145
74
  Formatter for the min and max labels below the range.
146
75
 
@@ -156,19 +85,19 @@ Pass a value similar to step to create visual markers at that interval
156
85
 
157
86
  #### max
158
87
 
159
-
88
+ The maximum allowed value in the range inputs
160
89
 
161
90
  - Type: `string`
162
- - Default: `-`
91
+ - Default: `100`
163
92
 
164
93
  #### min
165
94
 
166
-
95
+ The minimum allowed value in the range inputs
167
96
 
168
97
  - Type: `string`
169
- - Default: `-`
98
+ - Default: `0`
170
99
 
171
- #### openEnded
100
+ #### open-ended
172
101
 
173
102
  Whether or not to allow values outside the range such as "Before 1950" and "2025+".
174
103
 
@@ -177,46 +106,38 @@ Whether or not to allow values outside the range such as "Before 1950" and "2025
177
106
 
178
107
  #### required
179
108
 
180
- Ensures a child slider thumb has a value before allowing the containing form to submit.
109
+ Ensures a child slider thumb has a value before allowing the containing form to submit
181
110
 
182
111
  - Type: `boolean`
183
112
  - Default: `false`
184
113
 
185
- #### shadowRootOptions
186
-
187
-
188
-
189
- - Type: `object`
190
- - Default: `{ ...LitElement.shadowRootOptions, delegatesFocus: true, }`
191
-
192
114
  #### step
193
115
 
194
-
116
+ ets step on the range input to jump between values when dragging
195
117
 
196
118
  - Type: `number`
197
119
  - Default: `-`
198
120
 
199
121
  #### suffix
200
122
 
201
- Suffix used in text input fields and for the min and max values of the slider.
123
+ Suffix used in text input fields and for the min and max values of the slider
202
124
 
203
125
  - Type: `string`
204
126
  - Default: `-`
205
127
 
206
- #### tooltipFormatter
128
+ #### tooltipFormatter (JS only)
207
129
 
208
- Replaces valueFormatter for the tooltip. Use in open-ended sliders to show for example "300+ hk" instead of "Max" in the tooltip.
130
+ Overrides valueFormatter for the tooltip.
131
+
132
+ Use in open-ended sliders to show for example "300+ hk" instead of "Max" in the tooltip.
209
133
 
210
134
  - Type: `(value: string, slot: SliderSlot) => string`
211
135
  - Default: `-`
212
136
 
213
- #### valueFormatter
137
+ #### valueFormatter (JS only)
214
138
 
215
- Formatter for the tooltip and input mask values.
139
+ Formatter for the tooltip and input mask values
216
140
 
217
141
  - Type: `(value: string, slot: SliderSlot) => string`
218
142
  - Default: `-`
219
143
 
220
- ### Types
221
-
222
- No types documented.
@@ -1 +1,332 @@
1
1
  ## Examples
2
+
3
+ ### Single slider
4
+
5
+ <elements-example>
6
+
7
+ ```html
8
+ <form id="audio">
9
+ <w-slider label="Volume" min="0" max="100">
10
+ <w-slider-thumb name="volume"></w-slider-thumb>
11
+ </w-slider>
12
+ </form>
13
+ ```
14
+
15
+ </elements-example>
16
+
17
+ ### Range slider
18
+
19
+ <elements-example>
20
+
21
+ ```html
22
+ <w-slider label="Range" min="0" max="100">
23
+ <w-slider-thumb
24
+ slot="from"
25
+ aria-label="From value"
26
+ name="from"
27
+ ></w-slider-thumb>
28
+ <w-slider-thumb
29
+ slot="to"
30
+ aria-label="To value"
31
+ name="to"
32
+ ></w-slider-thumb>
33
+ </w-slider>
34
+ ```
35
+
36
+ </elements-example>
37
+
38
+ ### Open ended range slider
39
+
40
+ An open ended range slider covers a case where you want to offer a selection in a common range of values, but allow values outside of that range.
41
+
42
+ In the example below the case is production year. The edges of the open ended range slider are taken to mean "anything before 1950" and "anything after 2025". This is indicated by an empty string value (`""`).
43
+
44
+ Users can also choose to enter values into the input field that are outside the range of the slider, for example `1932` or `2027`.
45
+
46
+ <elements-example>
47
+
48
+ ```html
49
+ <form id="openended">
50
+ <w-slider label="Production year" min="1950" max="2025" open-ended>
51
+ <w-slider-thumb slot="from" name="from-year"></w-slider-thumb>
52
+ <w-slider-thumb slot="to" name="to-year"></w-slider-thumb>
53
+ </w-slider>
54
+ </form>
55
+ <script>
56
+ const openEndedSlider = document.querySelector("w-slider");
57
+
58
+ openEndedSlider.labelFormatter = function (slot) {
59
+ if (slot === "from") {
60
+ return "Before 1950";
61
+ }
62
+ return "2025+";
63
+ };
64
+ openEndedSlider.valueFormatter = function (value, slot) {
65
+ if (slot === "from" && value === "") {
66
+ return "Min";
67
+ }
68
+ if (slot === "to" && value === "") {
69
+ return "Max";
70
+ }
71
+ return value;
72
+ };
73
+
74
+ document.forms["openended"].addEventListener("input", function () {
75
+ const formData = new FormData(this);
76
+ const from = formData.get("from-year");
77
+ const to = formData.get("to-year");
78
+ });
79
+ </script>
80
+ ```
81
+
82
+ </elements-example>
83
+
84
+ ### Suffix in the input field
85
+
86
+ You can set a `suffix` on `<w-slider>` and have it apply to any input field in the component.
87
+
88
+ <elements-example>
89
+
90
+ ```html
91
+ <w-slider
92
+ label="Apartment size"
93
+ min="0"
94
+ max="250"
95
+ suffix="${suffix}"
96
+ data-testid="sqm"
97
+ >
98
+ <w-slider-thumb
99
+ slot="from"
100
+ aria-label="From size"
101
+ name="from"
102
+ ></w-slider-thumb>
103
+ <w-slider-thumb
104
+ slot="to"
105
+ aria-label="To size"
106
+ name="to"
107
+ ></w-slider-thumb>
108
+ </w-slider>
109
+ ```
110
+
111
+ </elements-example>
112
+
113
+ ### Number formatter
114
+
115
+ If you need to format numbers, use the [`valueFormatter`](#valueformatter) and [`labelFormatter`](#labelFormatter) properties.
116
+
117
+ <elements-example>
118
+
119
+ ```html
120
+ <w-slider
121
+ label="Price"
122
+ min="0"
123
+ max="250000"
124
+ suffix="${suffix}"
125
+ data-testid="currency"
126
+ >
127
+ <w-slider-thumb
128
+ slot="from"
129
+ aria-label="From price"
130
+ name="from"
131
+ ></w-slider-thumb>
132
+ <w-slider-thumb
133
+ slot="to"
134
+ aria-label="To price"
135
+ name="to"
136
+ ></w-slider-thumb>
137
+ </w-slider>
138
+ <script type="module">
139
+ const numberFormatter = window.getNumberFormatter(
140
+ "${locale}",
141
+ ).format;
142
+ const currencySlider = document.querySelector(
143
+ 'w-slider[data-testid="currency"]',
144
+ );
145
+ currencySlider.valueFormatter = numberFormatter;
146
+ currencySlider.labelFormatter = (slot) => {
147
+ if (slot === "from") return "0";
148
+ return numberFormatter("250000");
149
+ };
150
+ </script>
151
+ ```
152
+
153
+ </elements-example>
154
+
155
+ ### Steps
156
+
157
+ Sets the [`step` HTML attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/step) on the inputs.
158
+
159
+ <elements-example>
160
+
161
+ ```html
162
+ <w-slider label="Single" step="${step}" min="0" max="100">
163
+ <w-slider-thumb name="value"></w-slider-thumb>
164
+ </w-slider>
165
+ ```
166
+
167
+ </elements-example>
168
+
169
+ ### Marks
170
+
171
+ Show tick markers along the slider. Only works with a single slider.
172
+
173
+ <elements-example>
174
+
175
+ ```html
176
+ <w-slider
177
+ label="Single"
178
+ min="0"
179
+ max="100"
180
+ step="5"
181
+ markers="5"
182
+ >
183
+ <w-slider-thumb name="value"></w-slider-thumb>
184
+ </w-slider>
185
+ ```
186
+
187
+ </elements-example>
188
+
189
+ ### With help text
190
+
191
+ <elements-example>
192
+
193
+ ```html
194
+ <w-slider
195
+ label="Model year"
196
+ min="1950"
197
+ max="2025"
198
+ help-text="Model year of the car"
199
+ >
200
+ <w-slider-thumb slot="from" name="from"></w-slider-thumb>
201
+ <w-slider-thumb slot="to" name="to"></w-slider-thumb>
202
+ </w-slider>
203
+ ```
204
+
205
+ </elements-example>
206
+
207
+ ### With validation error
208
+
209
+ <elements-example>
210
+
211
+ ```html
212
+ <w-slider
213
+ label="Model year"
214
+ min="1950"
215
+ max="2025"
216
+ error="Something is wrong and this should help you solve the problem"
217
+ invalid
218
+ >
219
+ <w-slider-thumb slot="from" name="from"></w-slider-thumb>
220
+ <w-slider-thumb slot="to" name="to"></w-slider-thumb>
221
+ </w-slider>
222
+ ```
223
+
224
+ </elements-example>
225
+
226
+ ### Visually hidden labels
227
+
228
+ <elements-example>
229
+
230
+ ```html
231
+ <w-slider
232
+ min="1950"
233
+ max="2025"
234
+ help-text="Model year of the car"
235
+ >
236
+ <legend class="sr-only" slot="label">Model year</legend>
237
+ <w-slider-thumb slot="from" name="from"></w-slider-thumb>
238
+ <w-slider-thumb slot="to" name="to"></w-slider-thumb>
239
+ </w-slider>
240
+ ```
241
+
242
+ </elements-example>
243
+
244
+
245
+ ### Hidden min and max value labels
246
+
247
+ Give the component a label formatter and always return the empty string.
248
+
249
+ <elements-example>
250
+
251
+ ```html
252
+
253
+ <w-slider
254
+ min="1950"
255
+ max="2025"
256
+ help-text="Model year of the car"
257
+ data-testid="hidden-minmax-label"
258
+ >
259
+ <legend class="sr-only" slot="label">Model year</legend>
260
+ <w-slider-thumb slot="from" name="from"></w-slider-thumb>
261
+ <w-slider-thumb slot="to" name="to"></w-slider-thumb>
262
+ </w-slider>
263
+ <script>
264
+ const hiddenMinMaxSlider = document.querySelector(
265
+ 'w-slider[data-testid="hidden-minmax-label"]',
266
+ );
267
+ hiddenMinMaxSlider.labelFormatter = () => "";
268
+ </script>
269
+ ```
270
+
271
+ </elements-example>
272
+
273
+ ### Visually hiden text field
274
+
275
+ The text field doubles as a visualization of the exact value, which is difficult to see on a slider. If you visually hide the text field with the `hidden-textfield` attribute always make sure to show the value some place, unless the exact value is irrellevant.
276
+
277
+ <elements-example>
278
+
279
+ ```html
280
+ <output class="text-xs">
281
+ <span class="font-bold">Distance:</span>
282
+ <span id="distance-value"></span>
283
+ </output>
284
+ <form name="map">
285
+ <w-slider min="0" max="20" hidden-textfield data-testid="map-radius">
286
+ <legend class="sr-only" slot="label">Location filter radius</legend>
287
+ <w-slider-thumb name="distance"></w-slider-thumb>
288
+ </w-slider>
289
+ </form>
290
+ <script>
291
+ const radiusSteps = [
292
+ 200, 300, 400, 500, 700, 1000, 1500, 2000, 3000, 5000, 7000, 10000,
293
+ 20000, 30000, 50000, 75000, 100000, 200000, 300000, 400000, 500000,
294
+ ];
295
+ const mapRadiusSlider = document.querySelector(
296
+ 'w-slider[data-testid="map-radius"]',
297
+ );
298
+ const formatter = window.getNumberFormatter("${locale}");
299
+ function formatDistance(value) {
300
+ const index = Number.parseInt(value);
301
+ const numValue = radiusSteps[index];
302
+
303
+ let formattedValue = "";
304
+
305
+ if (numValue < 1000) {
306
+ // Use non-breaking space here
307
+ formattedValue = formatter.format(numValue) + " m";
308
+ } else {
309
+ formattedValue = formatter.format(numValue / 1000) + " km";
310
+ }
311
+ return formattedValue;
312
+ };
313
+ mapRadiusSlider.labelFormatter = (slot) => {
314
+ if (slot === "from") {
315
+ return formatDistance("0");
316
+ }
317
+ return formatDistance(String(radiusSteps.length - 1));
318
+ };
319
+ mapRadiusSlider.valueFormatter = (value) => {
320
+ const formattedValue = formatDistance(value);
321
+ document.getElementById("distance-value").innerText = formattedValue;
322
+ return formattedValue;
323
+ };
324
+
325
+ document.forms["map"].addEventListener("input", function () {
326
+ const formData = new FormData(this);
327
+ const distance = formData.get("distance");
328
+ });
329
+ </script>
330
+ ```
331
+
332
+ </elements-example>