@arcgis/common-components 5.1.0-next.4 → 5.1.0-next.41
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.
- package/README.md +24 -1
- package/dist/cdn/2TZIP7OF.js +2 -0
- package/dist/cdn/{7PB2GGQH.js → 357YPDTQ.js} +1 -1
- package/dist/cdn/3HKYWLJY.js +4 -0
- package/dist/cdn/45CNSLKA.js +2 -0
- package/dist/cdn/{XEB2RUND.js → 5GJ4DXIW.js} +1 -1
- package/dist/cdn/{ZOWIFVL3.js → 5PG2K3KH.js} +1 -1
- package/dist/cdn/736PTIHC.js +2 -0
- package/dist/cdn/ANGNTSLN.js +2 -0
- package/dist/cdn/CADM67RN.js +2 -0
- package/dist/cdn/{7Y42J3JI.js → ESI3PVIT.js} +1 -1
- package/dist/cdn/HVU4IDVW.js +2 -0
- package/dist/cdn/KAHX5ZGA.js +2 -0
- package/dist/cdn/{J5X5TNVW.js → KRJ6PIL6.js} +1 -1
- package/dist/cdn/MB7UDGWW.js +2 -0
- package/dist/cdn/{AXTSUI2Q.js → N5FBDEZK.js} +1 -1
- package/dist/cdn/{7HQMPKZO.js → TICCVQ7N.js} +1 -1
- package/dist/cdn/{C6JAR4IN.js → UCXHK4PA.js} +1 -1
- package/dist/cdn/{YVSTPEPS.js → UK3JIV7H.js} +1 -1
- package/dist/cdn/UKIOB6Y2.js +2 -0
- package/dist/cdn/ZHUCZTR2.js +2 -0
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/commonFunctions.js +5 -11
- package/dist/components/arcgis-ckeditor5/customElement.d.ts +1 -0
- package/dist/components/arcgis-ckeditor5/types.d.ts +9 -0
- package/dist/components/arcgis-ckeditor5-popover/customElement.d.ts +1 -0
- package/dist/components/arcgis-ckeditor5-popover/customElement.js +1 -1
- package/dist/components/arcgis-color-input/customElement.d.ts +1 -0
- package/dist/components/arcgis-field-info/customElement.d.ts +1 -0
- package/dist/components/arcgis-field-info/customElement.js +10 -10
- package/dist/components/arcgis-field-info/utils/basic.d.ts +1 -0
- package/dist/components/arcgis-field-pick-list/customElement.d.ts +1 -0
- package/dist/components/arcgis-field-pick-list/customElement.js +1 -1
- package/dist/components/arcgis-field-pick-list/utils/types.d.ts +5 -1
- package/dist/components/arcgis-histogram/customElement.d.ts +46 -28
- package/dist/components/arcgis-histogram/customElement.js +0 -2
- package/dist/components/arcgis-histogram/types.d.ts +1 -3
- package/dist/components/arcgis-label-input/customElement.d.ts +6 -6
- package/dist/components/arcgis-label-input/customElement.js +22 -17
- package/dist/components/arcgis-picker-input/customElement.d.ts +1 -0
- package/dist/components/arcgis-ramp-color/customElement.d.ts +2 -0
- package/dist/components/arcgis-ramp-color-break/customElement.d.ts +2 -0
- package/dist/components/arcgis-ramp-opacity/customElement.d.ts +1 -0
- package/dist/components/arcgis-slider/customElement.d.ts +270 -75
- package/dist/components/arcgis-slider/customElement.js +506 -438
- package/dist/components/arcgis-slider-input/customElement.d.ts +1 -0
- package/dist/components/arcgis-ticks/customElement.d.ts +101 -13
- package/dist/components/arcgis-ticks/customElement.js +28 -28
- package/dist/components/arcgis-ticks/types.d.ts +23 -0
- package/dist/components/arcgis-unique-values-list/customElement.d.ts +8 -1
- package/dist/components/arcgis-unique-values-list/customElement.js +153 -150
- package/dist/components/arcgis-unique-values-list/utils/basic.d.ts +1 -0
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/vscode.html-custom-data.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/loader.js +2 -2
- package/dist/types/lumina.d.ts +2 -2
- package/dist/types/preact.d.ts +2 -2
- package/dist/types/react.d.ts +2 -2
- package/dist/types/stencil.d.ts +2 -2
- package/dist/utils/types.d.ts +24 -7
- package/package.json +5 -5
- package/dist/cdn/6DQVLQL6.js +0 -2
- package/dist/cdn/6MGBOM6S.js +0 -2
- package/dist/cdn/6NYYZIHB.js +0 -2
- package/dist/cdn/BAVGT3I5.js +0 -2
- package/dist/cdn/GQLKGVRX.js +0 -2
- package/dist/cdn/P45VPBNI.js +0 -2
- package/dist/cdn/S7T3XQPB.js +0 -2
- package/dist/cdn/UTXWKXMT.js +0 -4
- package/dist/cdn/ZL3E4ZGE.js +0 -2
- package/dist/cdn/ZP76EPVI.js +0 -2
|
@@ -1,35 +1,73 @@
|
|
|
1
1
|
/// <reference path="../../index.d.ts" />
|
|
2
|
-
/// <reference types="@arcgis/core/interfaces.d.ts" />
|
|
3
2
|
import type { PublicLitElement as LitElement } from "@arcgis/lumina";
|
|
4
3
|
import type { T9nMeta } from "@arcgis/lumina/controllers";
|
|
5
4
|
import type { Popover as Popover } from "@esri/calcite-components/components/calcite-popover";
|
|
6
5
|
|
|
7
6
|
/**
|
|
7
|
+
* The Slider component is used to filter data or collect numeric input from users. It supports single or multiple thumbs, configured via the
|
|
8
|
+
* [values](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#values) property. The Slider can be displayed in horizontal or vertical [layout](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#layout), supports snapping to defined [steps](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#steps),
|
|
9
|
+
* configurable value [precision](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#precision), and custom [labelFormatter](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#labelFormatter). It also includes keyboard interaction,
|
|
10
|
+
* optional editable labels, and customizable popover content.
|
|
11
|
+
*
|
|
12
|
+
* The slider component can be set up with the [arcgis-ticks](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-ticks/) component. See the example below:
|
|
13
|
+
* ```html
|
|
14
|
+
* <arcgis-slider min="0" max="100" show-range-labels value-labels-display="always" steps="1" value-labels-placement="start">
|
|
15
|
+
* <arcgis-ticks interactive slot="content-end" style="flex:1;" min="0" max="100" mode="count" values="11" show-labels>
|
|
16
|
+
* </arcgis-ticks>
|
|
17
|
+
* </arcgis-slider>
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* > ### Which slider should you use: `arcgis-slider` or `calcite-slider`?
|
|
21
|
+
* >
|
|
22
|
+
* > It is recommended to use [`calcite-slider`](https://developers.arcgis.com/calcite-design-system/components/slider/) for most use cases, as the component
|
|
23
|
+
* > offers a consistent UI/UX and accommodates the majority of implementations.
|
|
24
|
+
* >
|
|
25
|
+
* > Use `arcgis-slider` for advanced use cases, where solutions seek the following:
|
|
26
|
+
* >
|
|
27
|
+
* > * [layout](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#layout): configurations, where `arcgis-slider` offers a `layout` of `"vertical"`.
|
|
28
|
+
* > * Display more than two values in the component.
|
|
29
|
+
* > * A custom range display, where `arcgis-slider` supports [fullRangeMin](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#fullRangeMin) and
|
|
30
|
+
* > [fullRangeMax](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#fullRangeMax) for displaying a wider range than the interactive range.
|
|
31
|
+
* > * Additional slot configurations for adding elements within or over the component, where `arcgis-slider` can slot
|
|
32
|
+
* > content using the `content-start`, `content-end`, and `popover` slots.
|
|
33
|
+
*
|
|
8
34
|
* @slot [content-start] - A slot for elements before the track.
|
|
9
35
|
* @slot [content-end] - A slot for elements after the track.
|
|
10
36
|
* @slot [popover] - A slot for custom content to be rendered in the popover.
|
|
37
|
+
* @since 5.0
|
|
11
38
|
*/
|
|
12
39
|
export abstract class ArcgisSlider extends LitElement {
|
|
13
40
|
/**
|
|
14
|
-
* The
|
|
41
|
+
* The active value of the slider, based on which thumb or range (segment) is active. This returns the stored value for the active thumb,
|
|
42
|
+
* so it may reflect the thumb’s last set position.
|
|
15
43
|
*
|
|
16
|
-
*
|
|
44
|
+
*
|
|
45
|
+
* It returns
|
|
17
46
|
* - `undefined` when no value is active
|
|
18
47
|
* - a `number` when a single value is active
|
|
19
|
-
* - `"all"` when the range is active
|
|
48
|
+
* - `"all"` when the range (segment) is active
|
|
20
49
|
*
|
|
21
|
-
* Listen to
|
|
50
|
+
* Listen to [@arcgisActiveValueChange](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#event-arcgisActiveValueChange) to be notified when a value becomes active or inactive.
|
|
22
51
|
*
|
|
23
|
-
* @see [arcgisActiveValueChange](
|
|
52
|
+
* @see [@arcgisActiveValueChange](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#event-arcgisActiveValueChange)
|
|
24
53
|
*/
|
|
25
54
|
get activeValue(): number | "all" | undefined;
|
|
26
55
|
/**
|
|
27
|
-
* When `true`, allows
|
|
56
|
+
* When `true`, allows multiple thumbs to overlap by sharing the same value.
|
|
57
|
+
* When `false`, thumbs are prevented from overlapping.
|
|
28
58
|
*
|
|
29
59
|
* @default false
|
|
30
60
|
*/
|
|
31
61
|
accessor allowValuesOverlap: boolean;
|
|
32
|
-
/**
|
|
62
|
+
/**
|
|
63
|
+
* If true, the component will not be destroyed automatically when it is
|
|
64
|
+
* disconnected from the document. This is useful when you want to move the
|
|
65
|
+
* component to a different place on the page, or temporarily hide it. If this
|
|
66
|
+
* is set, make sure to call the [destroy()](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#destroy) method when you are done to
|
|
67
|
+
* prevent memory leaks.
|
|
68
|
+
*
|
|
69
|
+
* @default false
|
|
70
|
+
*/
|
|
33
71
|
accessor autoDestroyDisabled: boolean;
|
|
34
72
|
/**
|
|
35
73
|
* Indicates whether the slider is disabled.
|
|
@@ -38,63 +76,106 @@ export abstract class ArcgisSlider extends LitElement {
|
|
|
38
76
|
*/
|
|
39
77
|
accessor disabled: boolean;
|
|
40
78
|
/**
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* Range mode will always display the fill between the min and max handles.
|
|
79
|
+
* Controls where the filled segment is displayed on the track for single-thumb sliders.
|
|
80
|
+
* Range sliders always display the fill between the min and max thumbs.
|
|
44
81
|
*
|
|
45
82
|
* @default "start"
|
|
46
83
|
*/
|
|
47
84
|
accessor fillPlacement: "end" | "none" | "start";
|
|
48
85
|
/**
|
|
49
|
-
*
|
|
86
|
+
* Sets the maximum value of the slider display full range.
|
|
87
|
+
* When specified, the slider track is scaled from [fullRangeMin](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#fullRangeMin) to `fullRangeMax`, while
|
|
88
|
+
* the thumbs remain constrained to the interactive range defined by [min](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#min) and [max](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#max).
|
|
50
89
|
*
|
|
51
|
-
* The
|
|
90
|
+
* The `fullRangeMax` must be greater than or equal to [max](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#max) property of the slider.
|
|
52
91
|
*
|
|
53
|
-
* @see [fullRangeMin](
|
|
92
|
+
* @see [fullRangeMin](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#fullRangeMin)
|
|
54
93
|
* @example
|
|
55
|
-
* Slider with a full range from 0 to 100, while only allowing thumb values between 25 and 75.
|
|
56
94
|
* ```html
|
|
95
|
+
* <!-- Slider with a full range from 0 to 100, while only allowing thumb values between 25 and 75. -->
|
|
57
96
|
* <arcgis-slider full-range-min="0" full-range-max="100" min="25" max="75" values="50"></arcgis-slider>
|
|
58
97
|
* ```
|
|
59
98
|
*/
|
|
60
99
|
accessor fullRangeMax: number | undefined;
|
|
61
100
|
/**
|
|
62
|
-
*
|
|
101
|
+
* Sets the minimum value of the slider display full range.
|
|
102
|
+
* When specified, the slider track is scaled from `fullRangeMin` to [fullRangeMax](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#fullRangeMax), while
|
|
103
|
+
* the thumbs remain constrained to the range defined by [min](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#min) and [max](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#max).
|
|
63
104
|
*
|
|
64
|
-
* The
|
|
105
|
+
* The `fullRangeMin` must be less than or equal to [min](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#min) property of the slider.
|
|
65
106
|
*
|
|
66
|
-
* @see [fullRangeMax](
|
|
107
|
+
* @see [fullRangeMax](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#fullRangeMax)
|
|
67
108
|
* @example
|
|
68
|
-
* Slider with a full range from 0 to 100, while only allowing thumb values between 25 and 75.
|
|
69
109
|
* ```html
|
|
110
|
+
* <!-- Slider with a full range from 0 to 100, while only allowing thumb values between 25 and 75. -->
|
|
70
111
|
* <arcgis-slider full-range-min="0" full-range-max="100" min="25" max="75" values="50"></arcgis-slider>
|
|
71
112
|
* ```
|
|
72
113
|
*/
|
|
73
114
|
accessor fullRangeMin: number | undefined;
|
|
74
115
|
/**
|
|
75
|
-
*
|
|
116
|
+
* Controls how many "small" keyboard increments are applied in order to move a thumb or range faster using the
|
|
117
|
+
* keyboard. The following keys are considered "large" increment keys:
|
|
118
|
+
*
|
|
119
|
+
* - PageUp/PageDown
|
|
120
|
+
* - Shift + Arrow keys
|
|
121
|
+
*
|
|
122
|
+
* @default 10
|
|
123
|
+
* @internal
|
|
124
|
+
*/
|
|
125
|
+
accessor keyboardLargeStep: number;
|
|
126
|
+
/**
|
|
127
|
+
* Allows customizing how slider labels are formatted for [min](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#min), [max](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#max), and thumb values.
|
|
128
|
+
* The formatted value is used for the visible labels and for the thumb’s accessible value text via `aria-valuetext`.
|
|
129
|
+
* Return `null` or `undefined` to use the default formatting.
|
|
76
130
|
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
131
|
+
* @example
|
|
132
|
+
* ```js
|
|
133
|
+
* // Format labels to use "K" for thousands and "M" for millions
|
|
134
|
+
* // and use "start" and "end" for min and max labels respectively.
|
|
135
|
+
* slider.labelFormatter = (value, type, defaultFormatter) => {
|
|
136
|
+
* if (type === "min") return "start";
|
|
137
|
+
* if (type === "max") return "end";
|
|
138
|
+
* if (type !== "value") return defaultFormatter(value);
|
|
139
|
+
*
|
|
140
|
+
* const abs = Math.abs(value);
|
|
141
|
+
* if (abs >= 1_000_000) {
|
|
142
|
+
* const num = (value / 1_000_000).toLocaleString(undefined, { maximumSignificantDigits: 3 });
|
|
143
|
+
* return `${num} M`;
|
|
144
|
+
* }
|
|
145
|
+
*
|
|
146
|
+
* if (abs >= 1_000) {
|
|
147
|
+
* const num = (value / 1_000).toLocaleString(undefined, { maximumSignificantDigits: 3 });
|
|
148
|
+
* return `${num} K`;
|
|
149
|
+
* }
|
|
150
|
+
* return defaultFormatter(value);
|
|
151
|
+
* };
|
|
152
|
+
* ```
|
|
80
153
|
*/
|
|
81
|
-
accessor labelFormatter: (
|
|
154
|
+
accessor labelFormatter: (value: number, type: "max" | "min" | "value", defaultFormatter: (value: number) => string) => string | null | undefined;
|
|
82
155
|
/**
|
|
83
|
-
* Determines the layout/orientation of the Slider
|
|
156
|
+
* Determines the layout/orientation of the Slider component. By default, the slider will render horizontally with the min value on the left side
|
|
157
|
+
* of the track.
|
|
84
158
|
*
|
|
85
159
|
* @default "horizontal"
|
|
160
|
+
* @see [mirrored](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#mirrored)
|
|
86
161
|
*/
|
|
87
162
|
accessor layout: "horizontal" | "vertical";
|
|
88
163
|
/**
|
|
89
|
-
* The maximum
|
|
164
|
+
* The maximum value for the slider thumbs. Thumbs will not move past this value.
|
|
90
165
|
*
|
|
91
|
-
* To display the `max`
|
|
92
|
-
* To allow the end user to modify the max value, set [rangeLabelsEditingEnabled](
|
|
166
|
+
* To display the `max` label on the slider, set [showRangeLabels](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#showRangeLabels) to `true`.
|
|
167
|
+
* To allow the end user to modify the `max` value, set [rangeLabelsEditingEnabled](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#rangeLabelsEditingEnabled) to `true`.
|
|
93
168
|
*
|
|
94
|
-
* @see [rangeLabelsEditingEnabled](
|
|
95
|
-
* @see [showRangeLabels](
|
|
169
|
+
* @see [rangeLabelsEditingEnabled](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#rangeLabelsEditingEnabled)
|
|
170
|
+
* @see [showRangeLabels](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#showRangeLabels)
|
|
171
|
+
* @see [fullRangeMax](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#fullRangeMax)
|
|
96
172
|
*/
|
|
97
173
|
accessor max: number;
|
|
174
|
+
/**
|
|
175
|
+
* Replace localized message strings with your own strings.
|
|
176
|
+
*
|
|
177
|
+
* _**Note**: Individual message keys may change between releases._
|
|
178
|
+
*/
|
|
98
179
|
accessor messageOverrides: {
|
|
99
180
|
componentLabel?: string | undefined;
|
|
100
181
|
maximumValue?: string | undefined;
|
|
@@ -120,33 +201,59 @@ export abstract class ArcgisSlider extends LitElement {
|
|
|
120
201
|
sliderValue: string;
|
|
121
202
|
}>;
|
|
122
203
|
/**
|
|
123
|
-
* The minimum
|
|
204
|
+
* The minimum value for the slider thumbs. Thumbs will not move past this value.
|
|
205
|
+
* To display the `min` label on the slider, set [showRangeLabels](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#showRangeLabels) to `true`.
|
|
206
|
+
* To allow the end user to modify the `min` value, set [rangeLabelsEditingEnabled](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#rangeLabelsEditingEnabled) to `true`.
|
|
124
207
|
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
* @see [rangeLabelsEditingEnabled](#rangeLabelsEditingEnabled)
|
|
129
|
-
* @see [showRangeLabels](#showRangeLabels)
|
|
208
|
+
* @see [rangeLabelsEditingEnabled](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#rangeLabelsEditingEnabled)
|
|
209
|
+
* @see [showRangeLabels](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#showRangeLabels)
|
|
130
210
|
*/
|
|
131
211
|
accessor min: number;
|
|
132
212
|
/**
|
|
133
|
-
* When `true`, the slider will display values from high to low.
|
|
213
|
+
* When `true`, the slider will display values from high to low. This inverts the direction of the slider.
|
|
134
214
|
*
|
|
135
215
|
* @default false
|
|
216
|
+
* @see [layout](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#layout)
|
|
136
217
|
*/
|
|
137
218
|
accessor mirrored: boolean;
|
|
138
219
|
/**
|
|
139
|
-
* The accessible label
|
|
220
|
+
* The accessible label for the popover. This label is used by assistive technologies and does not affect the visible UI.
|
|
140
221
|
*
|
|
141
222
|
* @default ""
|
|
223
|
+
* @see [Calcite popover](https://developers.arcgis.com/calcite-design-system/components/popover/#api-reference-properties-label)
|
|
142
224
|
*/
|
|
143
225
|
accessor popoverLabel: Popover["label"];
|
|
144
226
|
/**
|
|
145
|
-
* Determines
|
|
227
|
+
* Determines which side of the track the popover is placed on.
|
|
228
|
+
* The popover is the floating container that displays the content from the `popover` slot.
|
|
229
|
+
* * `"start"`: Positions the popover above a horizontal slider or to the left of a vertical slider.
|
|
230
|
+
* * `"end"`: Positions the popover below a horizontal slider or to the right of a vertical slider.
|
|
146
231
|
*
|
|
147
|
-
* @default "
|
|
232
|
+
* @default "start"
|
|
233
|
+
* @example
|
|
234
|
+
* ```js
|
|
235
|
+
* const slider = document.querySelector("arcgis-slider");
|
|
236
|
+
* slider.popoverPlacement = "end";
|
|
237
|
+
*
|
|
238
|
+
* // Example: Dynamic popover content based on slider value
|
|
239
|
+
* const popover = document.getElementById("popover");
|
|
240
|
+
* const unitCost = 12.5;
|
|
241
|
+
* const numberFormatter = new Intl.NumberFormat();
|
|
242
|
+
* const usd = new Intl.NumberFormat(undefined, { style: "currency", currency: "USD" });
|
|
243
|
+
*
|
|
244
|
+
* const renderPopover = () => {
|
|
245
|
+
* const value = Number(slider.values?.[0] ?? 0); // 0-100
|
|
246
|
+
* const annualCost = (value / 100) * 800 * 365 * unitCost;
|
|
247
|
+
* popover.textContent = `Est. annual cost: ${usd.format(annualCost)} (at ${numberFormatter.format(value)}%)`;
|
|
248
|
+
* slider.popoverLabel = `Cost estimate ${usd.format(annualCost)} at ${numberFormatter.format(value)} percent`;
|
|
249
|
+
* };
|
|
250
|
+
*
|
|
251
|
+
* slider.addEventListener("arcgisInput", renderPopover);
|
|
252
|
+
* slider.addEventListener("arcgisChange", renderPopover);
|
|
253
|
+
* renderPopover();
|
|
254
|
+
* ```
|
|
148
255
|
*/
|
|
149
|
-
accessor popoverPlacement: "
|
|
256
|
+
accessor popoverPlacement: "end" | "start";
|
|
150
257
|
/**
|
|
151
258
|
* Defines how slider thumb values should be rounded. This number indicates the number
|
|
152
259
|
* of decimal places slider thumb _values_ should round to when they have been moved.
|
|
@@ -162,34 +269,36 @@ export abstract class ArcgisSlider extends LitElement {
|
|
|
162
269
|
* The labels of the thumbs will display two decimal places, but the precision of the actual
|
|
163
270
|
* thumb values will not be lost even when the user slides or moves the thumb.
|
|
164
271
|
*
|
|
165
|
-
* Keep in mind this property rounds thumb [values](
|
|
166
|
-
* for formatting purposes. To format thumb `labels`, use the [labelFormatter](
|
|
272
|
+
* Keep in mind this property rounds thumb [values](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#values) and shouldn't be used exclusively
|
|
273
|
+
* for formatting purposes. To format thumb `labels`, use the [labelFormatter](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#labelFormatter)
|
|
167
274
|
* property.
|
|
168
275
|
*
|
|
169
276
|
* @default 4
|
|
170
277
|
* @example
|
|
171
|
-
* // thumb label will display 50.43
|
|
172
|
-
* // thumb value will maintain precision, so value will remain at 50.4331
|
|
173
278
|
* ```html
|
|
279
|
+
* <!-- thumb label will display 50.43 -->
|
|
280
|
+
* <!-- thumb value will maintain precision, so value will remain at 50.4331 -->
|
|
174
281
|
* <arcgis-slider min="0" max="100" values="50.4331" precision="4"></arcgis-slider>
|
|
175
282
|
* ```
|
|
176
283
|
*/
|
|
177
284
|
accessor precision: number;
|
|
178
285
|
/**
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
* This allows the user to increase or decrease the data range of the slider.
|
|
286
|
+
* When `true`, users can edit the [min](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#min) and [max](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#max) range labels via keyboard input.
|
|
287
|
+
* Editing these labels updates the slider’s interactive range.
|
|
182
288
|
*
|
|
183
289
|
* @default false
|
|
184
290
|
*/
|
|
185
291
|
accessor rangeLabelsEditingEnabled: boolean;
|
|
186
292
|
/**
|
|
187
|
-
*
|
|
188
|
-
*
|
|
293
|
+
* Controls where the [min](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#min) and [max](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#max) range labels are positioned relative to the track.
|
|
294
|
+
* This property only affects the slider when [layout](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#layout) is `"horizontal"`.
|
|
295
|
+
*
|
|
296
|
+
* - `"center"` (default): Places the [min](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#min) and [max](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#max) labels aligned with the track.
|
|
297
|
+
* - `"end"`: Places the range labels below the the track.
|
|
189
298
|
*
|
|
190
299
|
* @default "center"
|
|
191
300
|
*/
|
|
192
|
-
accessor rangeLabelsPlacement: "center" | "
|
|
301
|
+
accessor rangeLabelsPlacement: "center" | "end";
|
|
193
302
|
/**
|
|
194
303
|
* Indicates if the user can drag the segment between thumbs to update thumb positions.
|
|
195
304
|
*
|
|
@@ -197,7 +306,7 @@ export abstract class ArcgisSlider extends LitElement {
|
|
|
197
306
|
*/
|
|
198
307
|
accessor segmentsDraggingDisabled: boolean;
|
|
199
308
|
/**
|
|
200
|
-
* Indicates whether to min and max range labels are visible on the slider.
|
|
309
|
+
* Indicates whether to [min](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#min) and [max](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#max) range labels are visible on the slider.
|
|
201
310
|
*
|
|
202
311
|
* @default false
|
|
203
312
|
*/
|
|
@@ -212,24 +321,24 @@ export abstract class ArcgisSlider extends LitElement {
|
|
|
212
321
|
* slider range at an interval of the provided value. In this scenario,
|
|
213
322
|
* the user may only slide the thumbs to values at the provided interval.
|
|
214
323
|
* For example, if a value of `0.5` is set here, and the slider
|
|
215
|
-
* [min](
|
|
324
|
+
* [min](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#min) is `0` and the slider [max](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#max) is `10`, then the user will
|
|
216
325
|
* only be able to update the thumbs to values of 0, 0.5, 1.0, 1.5, 2.0, etc.
|
|
217
326
|
*
|
|
218
327
|
* @example
|
|
219
328
|
* ```html
|
|
220
|
-
*
|
|
221
|
-
*
|
|
329
|
+
* <!-- set steps at an interval of 0.5. So the -->
|
|
330
|
+
* <!-- slider thumb snaps at values of 0.5, 1.0, 1.5, etc. -->
|
|
222
331
|
* <arcgis-slider min="0" max="10" steps="0.5" values="5"></arcgis-slider>
|
|
223
332
|
* ```
|
|
224
333
|
* @example
|
|
225
334
|
* ```html
|
|
226
|
-
*
|
|
335
|
+
* <!-- Set steps at specific slider positions -->
|
|
227
336
|
* <arcgis-slider min="0" max="100" steps="5, 10, 15, 20, 25, 30, 35, 40" values="15, 30"></arcgis-slider>
|
|
228
337
|
* ```
|
|
229
338
|
*/
|
|
230
339
|
accessor steps: number[] | number | undefined;
|
|
231
340
|
/**
|
|
232
|
-
*
|
|
341
|
+
* Controls when thumb value labels are displayed.
|
|
233
342
|
*
|
|
234
343
|
* This property can be set to one of the following values:
|
|
235
344
|
* - `"always"`: Always show the labels.
|
|
@@ -241,49 +350,135 @@ export abstract class ArcgisSlider extends LitElement {
|
|
|
241
350
|
accessor valueLabelsDisplay: "always" | "auto" | "hidden";
|
|
242
351
|
/**
|
|
243
352
|
* Indicates whether to enable editing input values via keyboard input
|
|
244
|
-
* when the user clicks a label. This allows the user to move the slider
|
|
353
|
+
* when the user clicks a thumb value label. This allows the user to move the slider
|
|
245
354
|
* thumb to precise values without sliding the thumbs.
|
|
246
355
|
*
|
|
247
|
-
* 
|
|
248
357
|
*
|
|
249
358
|
* @default false
|
|
250
359
|
*/
|
|
251
360
|
accessor valueLabelsEditingEnabled: boolean;
|
|
252
361
|
/**
|
|
253
|
-
* Determines whether the labels are placed before or after the track.
|
|
362
|
+
* Determines whether the thumb value labels are placed before or after the track.
|
|
254
363
|
*
|
|
255
|
-
* @default "
|
|
364
|
+
* @default "start"
|
|
256
365
|
*/
|
|
257
|
-
accessor valueLabelsPlacement: "
|
|
366
|
+
accessor valueLabelsPlacement: "end" | "start";
|
|
258
367
|
/** An array of numbers representing absolute thumb positions on the slider. */
|
|
259
368
|
accessor values: number[];
|
|
369
|
+
/** Permanently destroys the component. */
|
|
260
370
|
destroy(): Promise<void>;
|
|
261
371
|
/**
|
|
262
|
-
* Fires when the
|
|
263
|
-
*
|
|
264
|
-
*
|
|
265
|
-
* This event does not fire when `values` changes.
|
|
266
|
-
* Use `arcgisInput` or `arcgisChange` instead.
|
|
372
|
+
* Fires when the [activeValue](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#activeValue) changes as a thumb or the range gains or loses focus.
|
|
373
|
+
* This event does not fire when [values](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#values) change. Use [@arcgisInput](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#event-arcgisInput) for continuous updates or
|
|
374
|
+
* [@arcgisChange](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#event-arcgisChange) when the interaction is committed.
|
|
267
375
|
*
|
|
268
|
-
* @
|
|
376
|
+
* @example
|
|
377
|
+
* ```js
|
|
378
|
+
* // Display the active value status of the slider in a div element
|
|
379
|
+
* const slider = document.querySelector("arcgis-slider");
|
|
380
|
+
* const status = document.getElementById("slider-status");
|
|
381
|
+
*
|
|
382
|
+
* const renderActive = () => {
|
|
383
|
+
* const active = slider.activeValue;
|
|
384
|
+
* // active is: undefined (none), number (thumb value), or "all" (range segment)
|
|
385
|
+
* status.textContent =
|
|
386
|
+
* active === "all"
|
|
387
|
+
* ? "Editing range"
|
|
388
|
+
* : active == null
|
|
389
|
+
* ? "No active thumb"
|
|
390
|
+
* : `Editing value: ${active}`;
|
|
391
|
+
* };
|
|
392
|
+
*
|
|
393
|
+
* slider.addEventListener("arcgisActiveValueChange", renderActive);
|
|
394
|
+
* // Pair with these when you need value updates:
|
|
395
|
+
* slider.addEventListener("arcgisInput", () => console.log("values", slider.values));
|
|
396
|
+
* slider.addEventListener("arcgisChange", () => console.log("committed", slider.values));
|
|
397
|
+
*
|
|
398
|
+
* renderActive();
|
|
399
|
+
* ```
|
|
400
|
+
* @see [activeValue](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#activeValue)
|
|
269
401
|
*/
|
|
270
402
|
readonly arcgisActiveValueChange: import("@arcgis/lumina").TargetedEvent<this, void>;
|
|
271
403
|
/**
|
|
272
404
|
* Fires when the thumb or range is released on the component.
|
|
273
405
|
*
|
|
274
|
-
*
|
|
275
|
-
*
|
|
406
|
+
* Use [@arcgisInput](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#event-arcgisInput) for continuous updates during a drag.
|
|
407
|
+
*
|
|
408
|
+
* @example
|
|
409
|
+
* ```js
|
|
410
|
+
* const slider = document.querySelector("arcgis-slider");
|
|
411
|
+
* slider.popoverPlacement = "end";
|
|
412
|
+
*
|
|
413
|
+
* // Example: Dynamic popover content based on slider value
|
|
414
|
+
* const popover = document.getElementById("popover");
|
|
415
|
+
* const unitCost = 12.5;
|
|
416
|
+
* const numberFormatter = new Intl.NumberFormat();
|
|
417
|
+
* const usd = new Intl.NumberFormat(undefined, { style: "currency", currency: "USD" });
|
|
418
|
+
*
|
|
419
|
+
* const renderPopover = () => {
|
|
420
|
+
* const value = Number(slider.values?.[0] ?? 0); // 0-100
|
|
421
|
+
* const annualCost = (value / 100) * 800 * 365 * unitCost;
|
|
422
|
+
* popover.textContent = `Est. annual cost: ${usd.format(annualCost)} (at ${numberFormatter.format(value)}%)`;
|
|
423
|
+
* slider.popoverLabel = `Cost estimate ${usd.format(annualCost)} at ${numberFormatter.format(value)} percent`;
|
|
424
|
+
* };
|
|
425
|
+
*
|
|
426
|
+
* slider.addEventListener("arcgisChange", renderPopover);
|
|
427
|
+
* renderPopover();
|
|
428
|
+
* ```
|
|
276
429
|
*/
|
|
277
430
|
readonly arcgisChange: import("@arcgis/lumina").TargetedEvent<this, void>;
|
|
278
431
|
/**
|
|
279
|
-
* Fires
|
|
432
|
+
* Fires continuously while the thumb or range is being dragged.
|
|
433
|
+
* This event can fire frequently; consider debouncing or throttling expensive work.
|
|
280
434
|
*
|
|
281
|
-
*
|
|
282
|
-
*
|
|
283
|
-
*
|
|
435
|
+
* @example
|
|
436
|
+
* ```js
|
|
437
|
+
* import FeatureEffect from "@arcgis/core/layers/support/FeatureEffect";
|
|
438
|
+
* import FeatureFilter from "@arcgis/core/layers/support/FeatureFilter";
|
|
439
|
+
*
|
|
440
|
+
* slider.addEventListener("arcgisInput", () => {
|
|
441
|
+
* const value = slider.values[0] ?? 0;
|
|
442
|
+
* layer.featureEffect = new FeatureEffect({
|
|
443
|
+
* filter: new FeatureFilter({
|
|
444
|
+
* where: `FIELD <= ${value}`,
|
|
445
|
+
* }),
|
|
446
|
+
* includedEffect: "bloom(1.4, 0.2px, 0.1)",
|
|
447
|
+
* excludedEffect: "opacity(20%) grayscale(100%)",
|
|
448
|
+
* });
|
|
449
|
+
* });
|
|
450
|
+
* ```
|
|
284
451
|
*/
|
|
285
452
|
readonly arcgisInput: import("@arcgis/lumina").TargetedEvent<this, void>;
|
|
286
|
-
/**
|
|
453
|
+
/**
|
|
454
|
+
* Fires when the slider's [min](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#min) and [max](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#max) range changes.
|
|
455
|
+
* This occurs when the user edits the [min](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#min) or [max](https://developers.arcgis.com/javascript/latest/references/common-components/components/arcgis-slider/#max) range labels (when enabled).
|
|
456
|
+
*
|
|
457
|
+
* @example
|
|
458
|
+
* ```js
|
|
459
|
+
* // Example: Keep a "budget" value inside the editable min/max range
|
|
460
|
+
* const slider = document.querySelector("arcgis-slider");
|
|
461
|
+
*
|
|
462
|
+
* const clamp = (val, min, max) => Math.min(max, Math.max(min, val));
|
|
463
|
+
*
|
|
464
|
+
* const render = () => {
|
|
465
|
+
* rangeText.textContent = `Allowed: ${slider.min}–${slider.max}`;
|
|
466
|
+
*
|
|
467
|
+
* // If your UI stores a single value, keep it inside the new range.
|
|
468
|
+
* const current = Number(slider.values?.[0] ?? slider.min);
|
|
469
|
+
* const next = clamp(current, slider.min, slider.max);
|
|
470
|
+
*
|
|
471
|
+
* if (next !== current) {
|
|
472
|
+
* slider.values = [next];
|
|
473
|
+
* }
|
|
474
|
+
*
|
|
475
|
+
* valueText.textContent = `Selected: ${next}`;
|
|
476
|
+
* };
|
|
477
|
+
*
|
|
478
|
+
* slider.addEventListener("arcgisRangeChange", render);
|
|
479
|
+
* render();
|
|
480
|
+
* ```
|
|
481
|
+
*/
|
|
287
482
|
readonly arcgisRangeChange: import("@arcgis/lumina").TargetedEvent<this, void>;
|
|
288
483
|
readonly "@eventTypes": {
|
|
289
484
|
arcgisActiveValueChange: ArcgisSlider["arcgisActiveValueChange"]["detail"];
|