@esri/solutions-components 0.10.7 → 0.10.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (148) hide show
  1. package/dist/cjs/basemap-gallery_7.cjs.entry.js +24 -8
  2. package/dist/cjs/buffer-tools_3.cjs.entry.js +1 -1
  3. package/dist/cjs/calcite-combobox_3.cjs.entry.js +354 -967
  4. package/dist/cjs/calcite-graph_2.cjs.entry.js +1082 -0
  5. package/dist/cjs/calcite-shell-panel_14.cjs.entry.js +6 -6
  6. package/dist/cjs/calcite-tree_3.cjs.entry.js +1 -1
  7. package/dist/cjs/card-manager_3.cjs.entry.js +246 -18
  8. package/dist/cjs/crowdsource-manager.cjs.entry.js +169 -49
  9. package/dist/cjs/loader.cjs.js +1 -1
  10. package/dist/cjs/map-select-tools_3.cjs.entry.js +3 -3
  11. package/dist/cjs/pci-calculator.cjs.entry.js +1 -1
  12. package/dist/cjs/public-notification.cjs.entry.js +1 -1
  13. package/dist/cjs/refine-results-flow-item.cjs.entry.js +1 -1
  14. package/dist/cjs/share-item.cjs.entry.js +1 -1
  15. package/dist/cjs/solution-configuration.cjs.entry.js +3 -3
  16. package/dist/cjs/solution-contents_3.cjs.entry.js +3 -3
  17. package/dist/cjs/solutions-components.cjs.js +1 -1
  18. package/dist/cjs/spatial-ref.cjs.entry.js +1 -1
  19. package/dist/collection/assets/t9n/crowdsource-manager/resources.json +5 -1
  20. package/dist/collection/assets/t9n/crowdsource-manager/resources_en.json +5 -1
  21. package/dist/collection/assets/t9n/layer-table/resources.json +1 -0
  22. package/dist/collection/assets/t9n/layer-table/resources_en.json +1 -0
  23. package/dist/collection/assets/t9n/map-card/resources.json +6 -1
  24. package/dist/collection/assets/t9n/map-card/resources_en.json +6 -1
  25. package/dist/collection/components/card-manager/card-manager.js +34 -8
  26. package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +173 -65
  27. package/dist/collection/components/layer-table/layer-table.js +175 -8
  28. package/dist/collection/components/map-card/map-card.css +4 -0
  29. package/dist/collection/components/map-card/map-card.js +368 -3
  30. package/dist/collection/components/map-draw-tools/map-draw-tools.js +1 -1
  31. package/dist/collection/components/map-fullscreen/map-fullscreen.js +1 -1
  32. package/dist/collection/components/map-layer-picker/map-layer-picker.js +9 -3
  33. package/dist/collection/components/map-legend/map-legend.js +1 -1
  34. package/dist/collection/components/map-picker/map-picker.css +8 -0
  35. package/dist/collection/components/map-picker/map-picker.js +74 -3
  36. package/dist/collection/components/map-search/map-search.js +1 -1
  37. package/dist/collection/components/map-select-tools/map-select-tools.js +1 -1
  38. package/dist/collection/components/map-tools/map-tools.js +1 -1
  39. package/dist/collection/components/pci-calculator/pci-calculator.js +1 -1
  40. package/dist/collection/components/pdf-download/pdf-download.js +1 -1
  41. package/dist/collection/components/public-notification/public-notification.js +1 -1
  42. package/dist/collection/components/refine-results-flow-item/refine-results-flow-item.js +1 -1
  43. package/dist/collection/components/refine-selection/refine-selection.js +1 -1
  44. package/dist/collection/components/share-item/share-item.js +1 -1
  45. package/dist/collection/components/solution-configuration/solution-configuration.js +3 -3
  46. package/dist/collection/components/solution-contents/solution-contents.js +1 -1
  47. package/dist/collection/components/solution-item/solution-item.js +1 -1
  48. package/dist/collection/components/solution-item-details/solution-item-details.js +1 -1
  49. package/dist/collection/components/solution-item-icon/solution-item-icon.js +1 -1
  50. package/dist/collection/components/solution-item-sharing/solution-item-sharing.js +1 -1
  51. package/dist/collection/components/solution-organization-variables/solution-organization-variables.js +1 -1
  52. package/dist/collection/components/solution-resource-item/solution-resource-item.js +1 -1
  53. package/dist/collection/components/solution-spatial-ref/solution-spatial-ref.js +1 -1
  54. package/dist/collection/components/solution-template-data/solution-template-data.js +1 -1
  55. package/dist/collection/components/solution-variables/solution-variables.js +1 -1
  56. package/dist/collection/components/spatial-ref/spatial-ref.js +1 -1
  57. package/dist/collection/demos/crowdsource-manager.html +1 -0
  58. package/dist/components/card-manager2.js +20 -8
  59. package/dist/components/crowdsource-manager.js +172 -53
  60. package/dist/components/layer-table2.js +72 -10
  61. package/dist/components/map-card2.js +288 -47
  62. package/dist/components/map-draw-tools2.js +1 -1
  63. package/dist/components/map-fullscreen2.js +1 -1
  64. package/dist/components/map-layer-picker2.js +9 -3
  65. package/dist/components/map-legend2.js +1 -1
  66. package/dist/components/map-picker2.js +24 -5
  67. package/dist/components/map-search2.js +1 -1
  68. package/dist/components/map-select-tools2.js +1 -1
  69. package/dist/components/map-tools2.js +1 -1
  70. package/dist/components/pci-calculator.js +1 -1
  71. package/dist/components/pdf-download2.js +1 -1
  72. package/dist/components/public-notification.js +1 -1
  73. package/dist/components/refine-results-flow-item.js +1 -1
  74. package/dist/components/refine-selection2.js +1 -1
  75. package/dist/components/share-item.js +1 -1
  76. package/dist/components/solution-configuration.js +3 -3
  77. package/dist/components/solution-contents2.js +1 -1
  78. package/dist/components/solution-item-details2.js +1 -1
  79. package/dist/components/solution-item-icon2.js +1 -1
  80. package/dist/components/solution-item-sharing2.js +1 -1
  81. package/dist/components/solution-item2.js +1 -1
  82. package/dist/components/solution-organization-variables2.js +1 -1
  83. package/dist/components/solution-resource-item2.js +1 -1
  84. package/dist/components/solution-spatial-ref2.js +1 -1
  85. package/dist/components/solution-template-data2.js +1 -1
  86. package/dist/components/solution-variables2.js +1 -1
  87. package/dist/components/spatial-ref.js +1 -1
  88. package/dist/esm/basemap-gallery_7.entry.js +24 -8
  89. package/dist/esm/buffer-tools_3.entry.js +1 -1
  90. package/dist/esm/calcite-combobox_3.entry.js +369 -982
  91. package/dist/esm/calcite-graph_2.entry.js +1077 -0
  92. package/dist/esm/calcite-shell-panel_14.entry.js +6 -6
  93. package/dist/esm/calcite-tree_3.entry.js +1 -1
  94. package/dist/esm/card-manager_3.entry.js +248 -20
  95. package/dist/esm/crowdsource-manager.entry.js +170 -50
  96. package/dist/esm/loader.js +1 -1
  97. package/dist/esm/map-select-tools_3.entry.js +3 -3
  98. package/dist/esm/pci-calculator.entry.js +1 -1
  99. package/dist/esm/public-notification.entry.js +1 -1
  100. package/dist/esm/refine-results-flow-item.entry.js +1 -1
  101. package/dist/esm/share-item.entry.js +1 -1
  102. package/dist/esm/solution-configuration.entry.js +3 -3
  103. package/dist/esm/solution-contents_3.entry.js +3 -3
  104. package/dist/esm/solutions-components.js +1 -1
  105. package/dist/esm/spatial-ref.entry.js +1 -1
  106. package/dist/solutions-components/assets/t9n/crowdsource-manager/resources.json +5 -1
  107. package/dist/solutions-components/assets/t9n/crowdsource-manager/resources_en.json +5 -1
  108. package/dist/solutions-components/assets/t9n/layer-table/resources.json +1 -0
  109. package/dist/solutions-components/assets/t9n/layer-table/resources_en.json +1 -0
  110. package/dist/solutions-components/assets/t9n/map-card/resources.json +6 -1
  111. package/dist/solutions-components/assets/t9n/map-card/resources_en.json +6 -1
  112. package/dist/solutions-components/demos/crowdsource-manager.html +1 -0
  113. package/dist/solutions-components/p-0abc1354.entry.js +6 -0
  114. package/dist/solutions-components/p-0f7b5d36.entry.js +6 -0
  115. package/dist/solutions-components/{p-a9818be2.entry.js → p-20c465e9.entry.js} +1 -1
  116. package/dist/solutions-components/{p-db18bce8.entry.js → p-36b50b5b.entry.js} +1 -1
  117. package/dist/solutions-components/{p-85512ae3.entry.js → p-445213cf.entry.js} +1 -1
  118. package/dist/solutions-components/{p-d49f895d.entry.js → p-4a5f0a97.entry.js} +1 -1
  119. package/dist/solutions-components/{p-002c97df.entry.js → p-5d201016.entry.js} +1 -1
  120. package/dist/solutions-components/{p-b7cec3bd.entry.js → p-618bafec.entry.js} +1 -1
  121. package/dist/solutions-components/p-6a66d5a9.entry.js +6 -0
  122. package/dist/solutions-components/p-71a2d5b8.entry.js +6 -0
  123. package/dist/solutions-components/p-7a64b026.entry.js +17 -0
  124. package/dist/solutions-components/p-85c25564.entry.js +6 -0
  125. package/dist/solutions-components/{p-235bf02e.entry.js → p-913413c3.entry.js} +1 -1
  126. package/dist/solutions-components/p-9af1cb14.entry.js +6 -0
  127. package/dist/solutions-components/{p-49aa2929.entry.js → p-bebd4646.entry.js} +1 -1
  128. package/dist/solutions-components/p-ce454f5a.entry.js +11 -0
  129. package/dist/solutions-components/solutions-components.esm.js +1 -1
  130. package/dist/types/components/card-manager/card-manager.d.ts +11 -0
  131. package/dist/types/components/crowdsource-manager/crowdsource-manager.d.ts +86 -20
  132. package/dist/types/components/layer-table/layer-table.d.ts +30 -0
  133. package/dist/types/components/map-card/map-card.d.ts +124 -0
  134. package/dist/types/components/map-layer-picker/map-layer-picker.d.ts +4 -0
  135. package/dist/types/components/map-picker/map-picker.d.ts +12 -0
  136. package/dist/types/components.d.ts +130 -0
  137. package/dist/types/preact.d.ts +4 -2
  138. package/package.json +1 -1
  139. package/dist/cjs/calcite-dropdown-group_2.cjs.entry.js +0 -453
  140. package/dist/esm/calcite-dropdown-group_2.entry.js +0 -448
  141. package/dist/solutions-components/p-129fd80e.entry.js +0 -6
  142. package/dist/solutions-components/p-3b426576.entry.js +0 -6
  143. package/dist/solutions-components/p-72b217f2.entry.js +0 -6
  144. package/dist/solutions-components/p-8b999a2b.entry.js +0 -6
  145. package/dist/solutions-components/p-973ff7b2.entry.js +0 -23
  146. package/dist/solutions-components/p-a001f9c9.entry.js +0 -6
  147. package/dist/solutions-components/p-c683b3fe.entry.js +0 -6
  148. package/dist/solutions-components/p-e9d049bd.entry.js +0 -6
@@ -0,0 +1,1077 @@
1
+ /*!
2
+ * Copyright 2022 Esri
3
+ * Licensed under the Apache License, Version 2.0
4
+ * http://www.apache.org/licenses/LICENSE-2.0
5
+ */
6
+ import { r as registerInstance, f as forceUpdate, h, g as getElement, c as createEvent, H as Host } from './index-e3f04fa1.js';
7
+ import { g as guid } from './guid-5c959cfd.js';
8
+ import { c as createObserver } from './observers-0f4a5f9e.js';
9
+ import { i as isPrimaryPointerButton, v as intersects } from './dom-982585e7.js';
10
+ import { c as connectForm, d as disconnectForm, a as afterConnectDefaultValueSet, H as HiddenFormInputSlot } from './form-9827fc54.js';
11
+ import { c as connectInteractive, d as disconnectInteractive, u as updateHostInteraction, I as InteractiveContainer } from './interactive-1d03c7ff.js';
12
+ import { i as isActivationKey } from './key-7f394a98.js';
13
+ import { c as connectLabel, d as disconnectLabel, g as getLabelText } from './label-38802319.js';
14
+ import { s as setUpLoadableComponent, a as setComponentLoaded, c as componentFocusable } from './loadable-869378d9.js';
15
+ import { n as numberStringFormatter, c as connectLocalized, d as disconnectLocalized } from './locale-53748f98.js';
16
+ import { d as decimalPlaces, c as clamp } from './math-dbb62ccf.js';
17
+ import './browser-8c71dd57.js';
18
+ import './resources-3bc82696.js';
19
+ import './component-e3f05da5.js';
20
+
21
+ /*!
22
+ * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
23
+ * See https://github.com/Esri/calcite-design-system/blob/dev/LICENSE.md for details.
24
+ * v2.11.1
25
+ */
26
+ /**
27
+ * Calculate slope of the tangents
28
+ * uses Steffen interpolation as it's monotonic
29
+ * http://jrwalsh1.github.io/posts/interpolations/
30
+ *
31
+ * @param p0
32
+ * @param p1
33
+ * @param p2
34
+ */
35
+ function slope(p0, p1, p2) {
36
+ const dx = p1[0] - p0[0];
37
+ const dx1 = p2[0] - p1[0];
38
+ const dy = p1[1] - p0[1];
39
+ const dy1 = p2[1] - p1[1];
40
+ const m = dy / (dx || (dx1 < 0 && 0));
41
+ const m1 = dy1 / (dx1 || (dx < 0 && 0));
42
+ const p = (m * dx1 + m1 * dx) / (dx + dx1);
43
+ return (Math.sign(m) + Math.sign(m1)) * Math.min(Math.abs(m), Math.abs(m1), 0.5 * Math.abs(p)) || 0;
44
+ }
45
+ /**
46
+ * Calculate slope for just one tangent (single-sided)
47
+ *
48
+ * @param p0
49
+ * @param p1
50
+ * @param m
51
+ */
52
+ function slopeSingle(p0, p1, m) {
53
+ const dx = p1[0] - p0[0];
54
+ const dy = p1[1] - p0[1];
55
+ return dx ? ((3 * dy) / dx - m) / 2 : m;
56
+ }
57
+ /**
58
+ * Given two points and their tangent slopes,
59
+ * calculate the bezier handle coordinates and return draw command.
60
+ *
61
+ * Translates Hermite Spline to Bézier curve:
62
+ * https://stackoverflow.com/questions/42574940/
63
+ *
64
+ * @param p0
65
+ * @param p1
66
+ * @param m0
67
+ * @param m1
68
+ * @param t
69
+ */
70
+ function bezier(p0, p1, m0, m1, t) {
71
+ const [x0, y0] = p0;
72
+ const [x1, y1] = p1;
73
+ const dx = (x1 - x0) / 3;
74
+ const h1 = t([x0 + dx, y0 + dx * m0]).join(",");
75
+ const h2 = t([x1 - dx, y1 - dx * m1]).join(",");
76
+ const p = t([x1, y1]).join(",");
77
+ return `C ${h1} ${h2} ${p}`;
78
+ }
79
+ /**
80
+ * Generate a function which will translate a point
81
+ * from the data coordinate space to svg viewbox oriented pixels
82
+ *
83
+ * @param root0
84
+ * @param root0.width
85
+ * @param root0.height
86
+ * @param root0.min
87
+ * @param root0.max
88
+ */
89
+ function translate({ width, height, min, max }) {
90
+ const rangeX = max[0] - min[0];
91
+ const rangeY = max[1] - min[1];
92
+ return (point) => {
93
+ const x = ((point[0] - min[0]) / rangeX) * width;
94
+ const y = height - (point[1] / rangeY) * height;
95
+ return [x, y];
96
+ };
97
+ }
98
+ /**
99
+ * Get the min and max values from the dataset
100
+ *
101
+ * @param data
102
+ */
103
+ function range(data) {
104
+ const [startX, startY] = data[0];
105
+ const min = [startX, startY];
106
+ const max = [startX, startY];
107
+ return data.reduce(({ min, max }, [x, y]) => ({
108
+ min: [Math.min(min[0], x), Math.min(min[1], y)],
109
+ max: [Math.max(max[0], x), Math.max(max[1], y)],
110
+ }), { min, max });
111
+ }
112
+ /**
113
+ * Generate drawing commands for an area graph
114
+ * returns a string can can be passed directly to a path element's `d` attribute
115
+ *
116
+ * @param root0
117
+ * @param root0.data
118
+ * @param root0.min
119
+ * @param root0.max
120
+ * @param root0.t
121
+ */
122
+ function area({ data, min, max, t }) {
123
+ if (data.length === 0) {
124
+ return "";
125
+ }
126
+ // important points for beginning and ending the path
127
+ const [startX, startY] = t(data[0]);
128
+ const [minX, minY] = t(min);
129
+ const [maxX] = t(max);
130
+ // keep track of previous slope/points
131
+ let m;
132
+ let p0;
133
+ let p1;
134
+ // iterate over data points, calculating command for each
135
+ const commands = data.reduce((acc, point, i) => {
136
+ p0 = data[i - 2];
137
+ p1 = data[i - 1];
138
+ if (i > 1) {
139
+ const m1 = slope(p0, p1, point);
140
+ const m0 = m === undefined ? slopeSingle(p0, p1, m1) : m;
141
+ const command = bezier(p0, p1, m0, m1, t);
142
+ m = m1;
143
+ return `${acc} ${command}`;
144
+ }
145
+ return acc;
146
+ }, `M ${minX},${minY} L ${minX},${startY} L ${startX},${startY}`);
147
+ // close the path
148
+ const last = data[data.length - 1];
149
+ const end = bezier(p1, last, m, slopeSingle(p1, last, m), t);
150
+ return `${commands} ${end} L ${maxX},${minY} Z`;
151
+ }
152
+
153
+ const graphCss = ":host{display:block;block-size:100%}.svg{fill:currentColor;stroke:transparent;margin:0px;display:block;block-size:100%;inline-size:100%;padding:0px}.svg .graph-path--highlight{fill:var(--calcite-color-brand);opacity:0.5}:host([hidden]){display:none}[hidden]{display:none}";
154
+ const CalciteGraphStyle0 = graphCss;
155
+
156
+ const Graph = class {
157
+ constructor(hostRef) {
158
+ registerInstance(this, hostRef);
159
+ this.graphId = `calcite-graph-${guid()}`;
160
+ this.resizeObserver = createObserver("resize", () => forceUpdate(this));
161
+ this.data = [];
162
+ this.colorStops = undefined;
163
+ this.highlightMin = undefined;
164
+ this.highlightMax = undefined;
165
+ this.min = undefined;
166
+ this.max = undefined;
167
+ }
168
+ //--------------------------------------------------------------------------
169
+ //
170
+ // Lifecycle
171
+ //
172
+ //--------------------------------------------------------------------------
173
+ connectedCallback() {
174
+ this.resizeObserver?.observe(this.el);
175
+ }
176
+ disconnectedCallback() {
177
+ this.resizeObserver?.disconnect();
178
+ }
179
+ render() {
180
+ const { data, colorStops, el, highlightMax, highlightMin, min, max } = this;
181
+ const id = this.graphId;
182
+ const { clientHeight: height, clientWidth: width } = el;
183
+ // if we have no data, return empty svg
184
+ if (!data || data.length === 0) {
185
+ return (h("svg", { "aria-hidden": "true", class: "svg", height: height, preserveAspectRatio: "none", viewBox: `0 0 ${width} ${height}`, width: width }));
186
+ }
187
+ const { min: rangeMin, max: rangeMax } = range(data);
188
+ let currentMin = rangeMin;
189
+ let currentMax = rangeMax;
190
+ if (min < rangeMin[0] || min > rangeMin[0]) {
191
+ currentMin = [min, 0];
192
+ }
193
+ if (max > rangeMax[0] || max < rangeMax[0]) {
194
+ currentMax = [max, rangeMax[1]];
195
+ }
196
+ const t = translate({ min: currentMin, max: currentMax, width, height });
197
+ const [hMinX] = t([highlightMin, currentMax[1]]);
198
+ const [hMaxX] = t([highlightMax, currentMax[1]]);
199
+ const areaPath = area({ data, min: rangeMin, max: rangeMax, t });
200
+ const fill = colorStops ? `url(#linear-gradient-${id})` : undefined;
201
+ return (h("svg", { "aria-hidden": "true", class: "svg", height: height, preserveAspectRatio: "none", viewBox: `0 0 ${width} ${height}`, width: width }, colorStops ? (h("defs", null, h("linearGradient", { id: `linear-gradient-${id}`, x1: "0", x2: "1", y1: "0", y2: "0" }, colorStops.map(({ offset, color, opacity }) => (h("stop", { offset: `${offset * 100}%`, "stop-color": color, "stop-opacity": opacity })))))) : null, highlightMin !== undefined ? ([
202
+ h("mask", { height: "100%", id: `${id}1`, width: "100%", x: "0%", y: "0%" }, h("path", { d: `
203
+ M 0,0
204
+ L ${hMinX - 1},0
205
+ L ${hMinX - 1},${height}
206
+ L 0,${height}
207
+ Z
208
+ `, fill: "white" })),
209
+ h("mask", { height: "100%", id: `${id}2`, width: "100%", x: "0%", y: "0%" }, h("path", { d: `
210
+ M ${hMinX + 1},0
211
+ L ${hMaxX - 1},0
212
+ L ${hMaxX - 1},${height}
213
+ L ${hMinX + 1}, ${height}
214
+ Z
215
+ `, fill: "white" })),
216
+ h("mask", { height: "100%", id: `${id}3`, width: "100%", x: "0%", y: "0%" }, h("path", { d: `
217
+ M ${hMaxX + 1},0
218
+ L ${width},0
219
+ L ${width},${height}
220
+ L ${hMaxX + 1}, ${height}
221
+ Z
222
+ `, fill: "white" })),
223
+ h("path", { class: "graph-path", d: areaPath, fill: fill, mask: `url(#${id}1)` }),
224
+ h("path", { class: "graph-path--highlight", d: areaPath, fill: fill, mask: `url(#${id}2)` }),
225
+ h("path", { class: "graph-path", d: areaPath, fill: fill, mask: `url(#${id}3)` }),
226
+ ]) : (h("path", { class: "graph-path", d: areaPath, fill: fill }))));
227
+ }
228
+ get el() { return getElement(this); }
229
+ };
230
+ Graph.style = CalciteGraphStyle0;
231
+
232
+ /*!
233
+ * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
234
+ * See https://github.com/Esri/calcite-design-system/blob/dev/LICENSE.md for details.
235
+ * v2.11.1
236
+ */
237
+ const CSS = {
238
+ container: "container",
239
+ containerRange: "container--range",
240
+ graph: "graph",
241
+ handle: "handle",
242
+ handleExtension: "handle-extension",
243
+ handleLabel: "handle__label",
244
+ handleLabelMinValue: "handle__label--minValue",
245
+ handleLabelValue: "handle__label--value",
246
+ hyphen: "hyphen",
247
+ hyphenWrap: "hyphen--wrap",
248
+ static: "static",
249
+ thumb: "thumb",
250
+ thumbActive: "thumb--active",
251
+ thumbContainer: "thumb-container",
252
+ thumbMinValue: "thumb--minValue",
253
+ thumbPrecise: "thumb--precise",
254
+ thumbValue: "thumb--value",
255
+ tick: "tick",
256
+ tickActive: "tick--active",
257
+ tickLabel: "tick__label",
258
+ tickMax: "tick__label--max",
259
+ tickMin: "tick__label--min",
260
+ ticks: "ticks",
261
+ track: "track",
262
+ trackRange: "track__range",
263
+ transformed: "transformed",
264
+ };
265
+ const maxTickElementThreshold = 250;
266
+
267
+ const sliderCss = "@charset \"UTF-8\";:host([disabled]){cursor:default;-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--calcite-opacity-disabled)}:host([disabled]) *,:host([disabled]) ::slotted(*){pointer-events:none}.scale--s{--calcite-slider-handle-size:0.625rem;--calcite-slider-handle-extension-height:0.4rem;--calcite-slider-container-font-size:var(--calcite-font-size--3)}.scale--s .handle__label,.scale--s .tick__label{line-height:.75rem}.scale--m{--calcite-slider-handle-size:0.875rem;--calcite-slider-handle-extension-height:0.5rem;--calcite-slider-container-font-size:var(--calcite-font-size--2)}.scale--m .handle__label,.scale--m .tick__label{line-height:1rem}.scale--l{--calcite-slider-handle-size:1rem;--calcite-slider-handle-extension-height:0.65rem;--calcite-slider-container-font-size:var(--calcite-font-size--1)}.scale--l .handle__label,.scale--l .tick__label{line-height:1rem}.handle__label,.tick__label{font-weight:var(--calcite-font-weight-medium);color:var(--calcite-color-text-2);font-size:var(--calcite-slider-container-font-size)}:host{display:block}.container{position:relative;display:block;overflow-wrap:normal;word-break:normal;padding-inline:calc(var(--calcite-slider-handle-size) * 0.5);padding-block:calc(var(--calcite-slider-handle-size) * 0.5);margin-block:calc(var(--calcite-slider-handle-size) * 0.5);margin-inline:0;--calcite-slider-full-handle-height:calc(\n var(--calcite-slider-handle-size) + var(--calcite-slider-handle-extension-height)\n );touch-action:none}:host([disabled]) .track__range,:host([disabled]) .tick--active{background-color:var(--calcite-color-text-3)}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.interaction-container{display:contents}.scale--s .thumb:not(.thumb--precise){--calcite-slider-thumb-y-offset:-0.375rem}.scale--m .thumb:not(.thumb--precise){--calcite-slider-thumb-y-offset:-0.5rem}.scale--l .thumb:not(.thumb--precise){--calcite-slider-thumb-y-offset:-0.55rem}:host([precise]:not([has-histogram])) .container .thumb--value{--calcite-slider-thumb-y-offset:calc(var(--calcite-slider-full-handle-height) * -1)}.thumb-container{position:relative;max-inline-size:100%}.thumb{--calcite-slider-thumb-x-offset:calc(var(--calcite-slider-handle-size) * 0.5);position:absolute;margin:0px;display:flex;cursor:pointer;flex-direction:column;align-items:center;border-style:none;background-color:transparent;padding:0px;font-family:inherit;outline:2px solid transparent;outline-offset:2px;transform:translate(var(--calcite-slider-thumb-x-offset), var(--calcite-slider-thumb-y-offset))}.thumb .handle__label.static,.thumb .handle__label.transformed{position:absolute;inset-block:0px;opacity:0}.thumb .handle__label.hyphen::after{content:\"—\";display:inline-block;inline-size:1em}.thumb .handle__label.hyphen--wrap{display:flex}.thumb .handle{box-sizing:border-box;border-radius:9999px;background-color:var(--calcite-color-foreground-1);outline-color:transparent;block-size:var(--calcite-slider-handle-size);inline-size:var(--calcite-slider-handle-size);box-shadow:0 0 0 2px var(--calcite-color-text-3) inset;transition:border var(--calcite-internal-animation-timing-medium) ease, background-color var(--calcite-internal-animation-timing-medium) ease, box-shadow var(--calcite-animation-timing) ease}.thumb .handle-extension{inline-size:0.125rem;block-size:var(--calcite-slider-handle-extension-height);background-color:var(--calcite-color-text-3)}.thumb:hover .handle{box-shadow:0 0 0 3px var(--calcite-color-brand) inset}.thumb:hover .handle-extension{background-color:var(--calcite-color-brand)}.thumb:focus .handle{outline:2px solid var(--calcite-ui-focus-color, var(--calcite-color-brand));outline-offset:calc(\n 2px *\n calc(\n 1 -\n 2 * clamp(\n 0,\n var(--calcite-offset-invert-focus),\n 1\n )\n )\n )}.thumb:focus .handle-extension{background-color:var(--calcite-color-brand)}.thumb.thumb--minValue{transform:translate(calc(var(--calcite-slider-thumb-x-offset) * -1), var(--calcite-slider-thumb-y-offset))}.thumb.thumb--precise{--calcite-slider-thumb-y-offset:-0.125rem}:host([label-handles]) .thumb{--calcite-slider-thumb-x-offset:50%}:host([label-handles]):host(:not([has-histogram])) .scale--s .thumb:not(.thumb--precise){--calcite-slider-thumb-y-offset:-1.4375rem}:host([label-handles]):host(:not([has-histogram])) .scale--m .thumb:not(.thumb--precise){--calcite-slider-thumb-y-offset:-1.875rem}:host([label-handles]):host(:not([has-histogram])) .scale--l .thumb:not(.thumb--precise){--calcite-slider-thumb-y-offset:-2rem}:host([has-histogram][label-handles]) .handle__label,:host([label-handles]:not([has-histogram])) .thumb--minValue.thumb--precise .handle__label{margin-block-start:0.5em}:host(:not([has-histogram]):not([precise])) .handle__label,:host([label-handles]:not([has-histogram])) .thumb--value .handle__label{margin-block-end:0.5em}:host([label-handles][precise]):host(:not([has-histogram])) .scale--s .thumb--value{--calcite-slider-thumb-y-offset:-2.075rem}:host([label-handles][precise]):host(:not([has-histogram])) .scale--m .thumb--value{--calcite-slider-thumb-y-offset:-2.75rem}:host([label-handles][precise]):host(:not([has-histogram])) .scale--l .thumb--value{--calcite-slider-thumb-y-offset:-3.0625rem}.thumb:focus .handle,.thumb--active .handle{background-color:var(--calcite-color-brand);box-shadow:0 0 8px 0 rgba(0, 0, 0, 0.16)}.thumb:hover.thumb--precise::after,.thumb:focus.thumb--precise::after,.thumb--active.thumb--precise::after{background-color:var(--calcite-color-brand)}.track{position:relative;block-size:0.125rem;border-radius:0px;background-color:var(--calcite-color-border-2);transition:all var(--calcite-internal-animation-timing-medium) ease-in}.track__range{position:absolute;inset-block-start:0px;block-size:0.125rem;background-color:var(--calcite-color-brand)}.container--range .track__range:hover{cursor:ew-resize}.container--range .track__range::after{position:absolute;inline-size:100%;content:\"\";inset-block-start:calc(var(--calcite-slider-full-handle-height) * 0.5 * -1);block-size:calc(var(--calcite-slider-handle-size) + var(--calcite-slider-handle-extension-height))}@media (forced-colors: active){.thumb{outline-width:0;outline-offset:0}.handle{outline:2px solid transparent;outline-offset:2px}.thumb:focus .handle,.thumb .handle-extension,.thumb:hover .handle-extension,.thumb:focus .handle-extension,.thumb:active .handle-extension{background-color:canvasText}.track{background-color:canvasText}.track__range{background-color:highlight}}.tick{position:absolute;block-size:0.25rem;inline-size:0.125rem;border-width:1px;border-style:solid;background-color:var(--calcite-color-border-input);border-color:var(--calcite-color-foreground-1);inset-block-start:-2px;pointer-events:none;margin-inline-start:calc(-1 * 0.125rem)}.tick--active{background-color:var(--calcite-color-brand)}.tick__label{pointer-events:none;margin-block-start:0.875rem;display:flex;justify-content:center}.tick__label--min{transition:opacity var(--calcite-animation-timing)}.tick__label--max{transition:opacity var(--calcite-internal-animation-timing-fast)}:host([has-histogram][label-handles]) .tick__label--min,:host([has-histogram][label-handles]) .tick__label--max,:host([has-histogram][precise]) .tick__label--min,:host([has-histogram][precise]) .tick__label--max{font-weight:var(--calcite-font-weight-normal);color:var(--calcite-color-text-3)}.graph{color:var(--calcite-color-foreground-3);block-size:48px}:host([label-ticks][ticks]) .container{padding-block-end:calc(0.875rem + var(--calcite-slider-container-font-size))}:host([has-histogram]):host([precise][label-handles]) .container{padding-block-end:calc(var(--calcite-slider-full-handle-height) + 1em)}:host([has-histogram]):host([label-handles]:not([precise])) .container{padding-block-end:calc(var(--calcite-slider-handle-size) * 0.5 + 1em)}:host([has-histogram]):host([precise]:not([label-handles])) .container{padding-block-end:var(--calcite-slider-full-handle-height)}:host(:not([has-histogram])):host([precise]:not([label-handles])) .container{padding-block-start:var(--calcite-slider-full-handle-height)}:host(:not([has-histogram])):host([precise]:not([label-handles])) .container--range{padding-block-end:var(--calcite-slider-full-handle-height)}:host(:not([has-histogram])):host([label-handles]:not([precise])) .container{padding-block-start:calc(var(--calcite-slider-full-handle-height) + 4px)}:host(:not([has-histogram])):host([label-handles][precise]) .container{padding-block-start:calc(var(--calcite-slider-full-handle-height) + var(--calcite-slider-container-font-size) + 4px)}:host(:not([has-histogram])):host([label-handles][precise]) .container--range{padding-block-end:calc(var(--calcite-slider-full-handle-height) + var(--calcite-slider-container-font-size) + 4px)}::slotted(input[slot=hidden-form-input]){margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}:host([hidden]){display:none}[hidden]{display:none}";
268
+ const CalciteSliderStyle0 = sliderCss;
269
+
270
+ function isRange(value) {
271
+ return Array.isArray(value);
272
+ }
273
+ const Slider = class {
274
+ constructor(hostRef) {
275
+ registerInstance(this, hostRef);
276
+ this.calciteSliderInput = createEvent(this, "calciteSliderInput", 6);
277
+ this.calciteSliderChange = createEvent(this, "calciteSliderChange", 6);
278
+ //--------------------------------------------------------------------------
279
+ //
280
+ // Event Listeners
281
+ //
282
+ //--------------------------------------------------------------------------
283
+ this.handleKeyDown = (event) => {
284
+ const mirror = this.shouldMirror();
285
+ const { activeProp, max, min, pageStep, step } = this;
286
+ const value = this[activeProp];
287
+ const { key } = event;
288
+ if (isActivationKey(key)) {
289
+ event.preventDefault();
290
+ return;
291
+ }
292
+ let adjustment;
293
+ if (key === "ArrowUp" || key === "ArrowRight") {
294
+ const directionFactor = mirror && key === "ArrowRight" ? -1 : 1;
295
+ adjustment = value + step * directionFactor;
296
+ }
297
+ else if (key === "ArrowDown" || key === "ArrowLeft") {
298
+ const directionFactor = mirror && key === "ArrowLeft" ? -1 : 1;
299
+ adjustment = value - step * directionFactor;
300
+ }
301
+ else if (key === "PageUp") {
302
+ if (pageStep) {
303
+ adjustment = value + pageStep;
304
+ }
305
+ }
306
+ else if (key === "PageDown") {
307
+ if (pageStep) {
308
+ adjustment = value - pageStep;
309
+ }
310
+ }
311
+ else if (key === "Home") {
312
+ adjustment = min;
313
+ }
314
+ else if (key === "End") {
315
+ adjustment = max;
316
+ }
317
+ if (isNaN(adjustment)) {
318
+ return;
319
+ }
320
+ event.preventDefault();
321
+ const fixedDecimalAdjustment = Number(adjustment.toFixed(decimalPlaces(step)));
322
+ this.setValue({
323
+ [activeProp]: this.clamp(fixedDecimalAdjustment, activeProp),
324
+ });
325
+ };
326
+ this.activeProp = "value";
327
+ this.guid = `calcite-slider-${guid()}`;
328
+ this.onThumbBlur = () => {
329
+ this.activeProp = null;
330
+ };
331
+ this.onThumbFocus = (event) => {
332
+ const thumb = event.currentTarget;
333
+ this.activeProp = thumb.getAttribute("data-value-prop");
334
+ };
335
+ this.onThumbPointerDown = (event) => {
336
+ const thumb = event.currentTarget;
337
+ this.pointerDownDragStart(event, thumb.getAttribute("data-value-prop"));
338
+ };
339
+ this.onTrackPointerDown = (event) => {
340
+ this.pointerDownDragStart(event, "minMaxValue");
341
+ };
342
+ this.dragUpdate = (event) => {
343
+ if (this.disabled) {
344
+ return;
345
+ }
346
+ event.preventDefault();
347
+ if (this.dragProp) {
348
+ const value = this.translate(event.clientX || event.pageX);
349
+ if (isRange(this.value) && this.dragProp === "minMaxValue") {
350
+ if (this.minValueDragRange && this.maxValueDragRange && this.minMaxValueRange) {
351
+ const newMinValue = value - this.minValueDragRange;
352
+ const newMaxValue = value + this.maxValueDragRange;
353
+ if (newMaxValue <= this.max &&
354
+ newMinValue >= this.min &&
355
+ newMaxValue - newMinValue === this.minMaxValueRange) {
356
+ this.setValue({
357
+ minValue: this.clamp(newMinValue, "minValue"),
358
+ maxValue: this.clamp(newMaxValue, "maxValue"),
359
+ });
360
+ }
361
+ }
362
+ else {
363
+ this.minValueDragRange = value - this.minValue;
364
+ this.maxValueDragRange = this.maxValue - value;
365
+ this.minMaxValueRange = this.maxValue - this.minValue;
366
+ }
367
+ }
368
+ else {
369
+ this.setValue({ [this.dragProp]: this.clamp(value, this.dragProp) });
370
+ }
371
+ }
372
+ };
373
+ this.pointerUpDragEnd = (event) => {
374
+ if (this.disabled || !isPrimaryPointerButton(event)) {
375
+ return;
376
+ }
377
+ this.dragEnd(event);
378
+ };
379
+ this.dragEnd = (event) => {
380
+ if (this.disabled) {
381
+ return;
382
+ }
383
+ this.removeDragListeners();
384
+ this.focusActiveHandle(event.clientX);
385
+ if (this.lastDragPropValue != this[this.dragProp]) {
386
+ this.emitChange();
387
+ }
388
+ this.dragProp = null;
389
+ this.lastDragPropValue = null;
390
+ this.minValueDragRange = null;
391
+ this.maxValueDragRange = null;
392
+ this.minMaxValueRange = null;
393
+ };
394
+ this.storeTrackRef = (node) => {
395
+ this.trackEl = node;
396
+ };
397
+ this.storeThumbRef = (el) => {
398
+ if (!el) {
399
+ return;
400
+ }
401
+ const valueProp = el.getAttribute("data-value-prop");
402
+ valueProp === "minValue" ? (this.minHandle = el) : (this.maxHandle = el);
403
+ };
404
+ /**
405
+ * Returns a string representing the localized label value based if the groupSeparator prop is parsed.
406
+ *
407
+ * @param value
408
+ */
409
+ this.formatValue = (value) => {
410
+ numberStringFormatter.numberFormatOptions = {
411
+ locale: this.effectiveLocale,
412
+ numberingSystem: this.numberingSystem,
413
+ useGrouping: this.groupSeparator,
414
+ };
415
+ return numberStringFormatter.localize(value.toString());
416
+ };
417
+ this.disabled = false;
418
+ this.fillPlacement = "start";
419
+ this.form = undefined;
420
+ this.groupSeparator = false;
421
+ this.hasHistogram = false;
422
+ this.histogram = undefined;
423
+ this.histogramStops = undefined;
424
+ this.labelHandles = false;
425
+ this.labelFormatter = undefined;
426
+ this.labelTicks = false;
427
+ this.max = 100;
428
+ this.maxLabel = undefined;
429
+ this.maxValue = undefined;
430
+ this.min = 0;
431
+ this.minLabel = undefined;
432
+ this.minValue = undefined;
433
+ this.mirrored = false;
434
+ this.name = undefined;
435
+ this.numberingSystem = undefined;
436
+ this.pageStep = undefined;
437
+ this.precise = false;
438
+ this.required = false;
439
+ this.snap = false;
440
+ this.step = 1;
441
+ this.ticks = undefined;
442
+ this.value = 0;
443
+ this.scale = "m";
444
+ this.effectiveLocale = "";
445
+ this.minMaxValueRange = null;
446
+ this.minValueDragRange = null;
447
+ this.maxValueDragRange = null;
448
+ this.tickValues = [];
449
+ }
450
+ histogramWatcher(newHistogram) {
451
+ this.hasHistogram = !!newHistogram;
452
+ }
453
+ ticksWatcher() {
454
+ this.tickValues = this.generateTickValues();
455
+ }
456
+ valueHandler() {
457
+ this.setMinMaxFromValue();
458
+ }
459
+ minMaxValueHandler() {
460
+ this.setValueFromMinMax();
461
+ }
462
+ //--------------------------------------------------------------------------
463
+ //
464
+ // Lifecycle
465
+ //
466
+ //--------------------------------------------------------------------------
467
+ connectedCallback() {
468
+ connectInteractive(this);
469
+ connectLocalized(this);
470
+ this.setMinMaxFromValue();
471
+ this.setValueFromMinMax();
472
+ connectLabel(this);
473
+ connectForm(this);
474
+ }
475
+ disconnectedCallback() {
476
+ disconnectInteractive(this);
477
+ disconnectLabel(this);
478
+ disconnectForm(this);
479
+ disconnectLocalized(this);
480
+ this.removeDragListeners();
481
+ }
482
+ componentWillLoad() {
483
+ setUpLoadableComponent(this);
484
+ if (!isRange(this.value)) {
485
+ this.value = this.snap ? this.getClosestStep(this.value) : this.clamp(this.value);
486
+ }
487
+ this.ticksWatcher();
488
+ this.histogramWatcher(this.histogram);
489
+ afterConnectDefaultValueSet(this, this.value);
490
+ }
491
+ componentDidLoad() {
492
+ setComponentLoaded(this);
493
+ }
494
+ componentDidRender() {
495
+ if (this.labelHandles) {
496
+ this.adjustHostObscuredHandleLabel("value");
497
+ if (isRange(this.value)) {
498
+ this.adjustHostObscuredHandleLabel("minValue");
499
+ if (!(this.precise && !this.hasHistogram)) {
500
+ this.hyphenateCollidingRangeHandleLabels();
501
+ }
502
+ }
503
+ }
504
+ this.hideObscuredBoundingTickLabels();
505
+ updateHostInteraction(this);
506
+ }
507
+ render() {
508
+ const id = this.el.id || this.guid;
509
+ const value = isRange(this.value) ? this.maxValue : this.value;
510
+ const min = this.minValue || this.min;
511
+ const useMinValue = this.shouldUseMinValue();
512
+ const minInterval = this.getUnitInterval(useMinValue ? this.minValue : min) * 100;
513
+ const maxInterval = this.getUnitInterval(value) * 100;
514
+ const mirror = this.shouldMirror();
515
+ const valueIsRange = isRange(this.value);
516
+ const thumbTypes = this.buildThumbType("max");
517
+ const thumb = this.renderThumb({
518
+ type: thumbTypes,
519
+ thumbPlacement: thumbTypes.includes("histogram") ? "below" : "above",
520
+ maxInterval,
521
+ minInterval,
522
+ mirror,
523
+ });
524
+ const minThumbTypes = this.buildThumbType("min");
525
+ const minThumb = valueIsRange &&
526
+ this.renderThumb({
527
+ type: minThumbTypes,
528
+ thumbPlacement: minThumbTypes.includes("histogram") || minThumbTypes.includes("precise")
529
+ ? "below"
530
+ : "above",
531
+ maxInterval,
532
+ minInterval,
533
+ mirror,
534
+ });
535
+ const fillPlacement = valueIsRange ? "start" : this.fillPlacement;
536
+ const trackRangePlacementStyles = fillPlacement === "none"
537
+ ? {
538
+ left: `unset`,
539
+ right: `unset`,
540
+ }
541
+ : fillPlacement === "end"
542
+ ? {
543
+ left: `${mirror ? minInterval : maxInterval}%`,
544
+ right: `${mirror ? maxInterval : minInterval}%`,
545
+ }
546
+ : /* default */
547
+ {
548
+ left: `${mirror ? 100 - maxInterval : minInterval}%`,
549
+ right: `${mirror ? minInterval : 100 - maxInterval}%`,
550
+ };
551
+ return (h(Host, { key: '345553b84f2336fe5a98bb2b3050d137130c41ef', id: id, onKeyDown: this.handleKeyDown, onTouchStart: this.handleTouchStart }, h(InteractiveContainer, { key: '0d9db31db94152095071d9ff40dbf3cf8ba685d6', disabled: this.disabled }, h("div", { key: '767ab1401000b02717013231c935fe1747def1b3', "aria-label": getLabelText(this), class: {
552
+ [CSS.container]: true,
553
+ [CSS.containerRange]: valueIsRange,
554
+ [`scale--${this.scale}`]: true,
555
+ } }, this.renderGraph(), h("div", { key: '1a104ad97079f71d37efea9d933f364520d49397', class: CSS.track, ref: this.storeTrackRef }, h("div", { key: '84f8033505dc0f373a0d19a641886e49ca4fe732', class: CSS.trackRange, onPointerDown: this.onTrackPointerDown, style: trackRangePlacementStyles }), h("div", { key: '79f89b93a6acbb05ffce09bd2aa34ef134b3e219', class: CSS.ticks }, this.tickValues.map((tick) => {
556
+ const tickOffset = `${this.getUnitInterval(tick) * 100}%`;
557
+ let activeTicks = false;
558
+ if (fillPlacement === "start" || fillPlacement === "end") {
559
+ if (useMinValue) {
560
+ activeTicks = tick >= this.minValue && tick <= this.maxValue;
561
+ }
562
+ else {
563
+ const rangeStart = fillPlacement === "start" ? min : value;
564
+ const rangeEnd = fillPlacement === "start" ? value : this.max;
565
+ activeTicks = tick >= rangeStart && tick <= rangeEnd;
566
+ }
567
+ }
568
+ return (h("span", { class: {
569
+ [CSS.tick]: true,
570
+ [CSS.tickActive]: activeTicks,
571
+ }, style: {
572
+ left: mirror ? "" : tickOffset,
573
+ right: mirror ? tickOffset : "",
574
+ } }, this.renderTickLabel(tick)));
575
+ }))), h("div", { key: '9bc6ea406e2036adb87da4a6053533283434864d', class: CSS.thumbContainer }, minThumb, thumb, h(HiddenFormInputSlot, { key: 'c13236898b527a1ffc058914fe87e6004b93aaf5', component: this }))))));
576
+ }
577
+ renderThumb({ type, mirror, thumbPlacement, minInterval, maxInterval, }) {
578
+ const isLabeled = type.includes("labeled");
579
+ const isPrecise = type.includes("precise");
580
+ const isMinThumb = type.includes("min");
581
+ const valueIsRange = isRange(this.value);
582
+ const value = isMinThumb
583
+ ? this.minValue
584
+ : valueIsRange
585
+ ? this.maxValue
586
+ : this.value;
587
+ const valueProp = isMinThumb ? "minValue" : valueIsRange ? "maxValue" : "value";
588
+ const ariaLabel = isMinThumb ? this.minLabel : valueIsRange ? this.maxLabel : this.minLabel;
589
+ const ariaValuenow = isMinThumb ? this.minValue : value;
590
+ const displayedValue = valueProp === "minValue"
591
+ ? this.internalLabelFormatter(this.minValue, "min")
592
+ : valueProp === "maxValue"
593
+ ? this.internalLabelFormatter(this.maxValue, "max")
594
+ : this.internalLabelFormatter(value, "value");
595
+ const thumbStyle = isMinThumb
596
+ ? { left: `${mirror ? 100 - minInterval : minInterval}%` }
597
+ : { right: `${mirror ? maxInterval : 100 - maxInterval}%` };
598
+ const thumbLabelClasses = `${CSS.handleLabel} ${isMinThumb ? CSS.handleLabelMinValue : CSS.handleLabelValue}`;
599
+ const labels = isLabeled
600
+ ? [
601
+ h("span", { "aria-hidden": "true", class: thumbLabelClasses }, displayedValue),
602
+ h("span", { "aria-hidden": "true", class: `${thumbLabelClasses} ${CSS.static}` }, displayedValue),
603
+ h("span", { "aria-hidden": "true", class: `${thumbLabelClasses} ${CSS.transformed}` }, displayedValue),
604
+ ]
605
+ : [];
606
+ const thumbContent = [
607
+ ...labels,
608
+ h("div", { class: CSS.handle }),
609
+ isPrecise && h("div", { class: CSS.handleExtension }),
610
+ ];
611
+ if (thumbPlacement === "below") {
612
+ thumbContent.reverse();
613
+ }
614
+ return (h("div", { "aria-disabled": this.disabled, "aria-label": ariaLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": ariaValuenow, class: {
615
+ [CSS.thumb]: true,
616
+ [CSS.thumbValue]: !isMinThumb,
617
+ [CSS.thumbActive]: this.lastDragProp !== "minMaxValue" && this.dragProp === valueProp,
618
+ [CSS.thumbPrecise]: isPrecise,
619
+ [CSS.thumbMinValue]: isMinThumb,
620
+ }, "data-value-prop": valueProp, key: type, onBlur: this.onThumbBlur, onFocus: this.onThumbFocus, onPointerDown: this.onThumbPointerDown, ref: this.storeThumbRef, role: "slider", style: thumbStyle, tabIndex: 0 }, thumbContent));
621
+ }
622
+ renderGraph() {
623
+ return this.histogram ? (h("calcite-graph", { class: CSS.graph, colorStops: this.histogramStops, data: this.histogram, highlightMax: isRange(this.value) ? this.maxValue : this.value, highlightMin: isRange(this.value) ? this.minValue : this.min, max: this.max, min: this.min })) : null;
624
+ }
625
+ renderTickLabel(tick) {
626
+ const { hasHistogram, labelHandles, labelTicks, max, min, precise, value } = this;
627
+ const valueIsRange = isRange(value);
628
+ const isMinTickLabel = tick === min;
629
+ const isMaxTickLabel = tick === max;
630
+ const isAtEdge = isMinTickLabel || isMaxTickLabel;
631
+ const shouldDisplayLabel = labelTicks &&
632
+ ((!hasHistogram && (isAtEdge || !precise || !valueIsRange)) ||
633
+ (hasHistogram && (isAtEdge || (!precise && !labelHandles))));
634
+ return shouldDisplayLabel ? (h("span", { class: {
635
+ [CSS.tickLabel]: true,
636
+ [CSS.tickMin]: isMinTickLabel,
637
+ [CSS.tickMax]: isMaxTickLabel,
638
+ } }, this.internalLabelFormatter(tick, "tick"))) : null;
639
+ }
640
+ pointerDownHandler(event) {
641
+ if (this.disabled || !isPrimaryPointerButton(event)) {
642
+ return;
643
+ }
644
+ const x = event.clientX || event.pageX;
645
+ const position = this.translate(x);
646
+ let prop = "value";
647
+ if (isRange(this.value)) {
648
+ const inRange = position >= this.minValue && position <= this.maxValue;
649
+ if (inRange && this.lastDragProp === "minMaxValue") {
650
+ prop = "minMaxValue";
651
+ }
652
+ else {
653
+ const closerToMax = Math.abs(this.maxValue - position) < Math.abs(this.minValue - position);
654
+ prop = closerToMax || position >= this.maxValue ? "maxValue" : "minValue";
655
+ }
656
+ }
657
+ this.lastDragPropValue = this[prop];
658
+ this.dragStart(prop);
659
+ const isThumbActive = this.el.shadowRoot.querySelector(`.${CSS.thumb}:active`);
660
+ if (!isThumbActive) {
661
+ this.setValue({ [prop]: this.clamp(position, prop) });
662
+ }
663
+ this.focusActiveHandle(x);
664
+ }
665
+ handleTouchStart(event) {
666
+ // needed to prevent extra click at the end of a handle drag
667
+ event.preventDefault();
668
+ }
669
+ //--------------------------------------------------------------------------
670
+ //
671
+ // Public Methods
672
+ //
673
+ //--------------------------------------------------------------------------
674
+ /** Sets focus on the component. */
675
+ async setFocus() {
676
+ await componentFocusable(this);
677
+ const handle = this.minHandle ? this.minHandle : this.maxHandle;
678
+ handle?.focus();
679
+ }
680
+ //--------------------------------------------------------------------------
681
+ //
682
+ // Private Methods
683
+ //
684
+ //--------------------------------------------------------------------------
685
+ buildThumbType(type) {
686
+ const thumbTypeParts = [type];
687
+ if (this.labelHandles) {
688
+ thumbTypeParts.push("labeled");
689
+ }
690
+ if (this.precise) {
691
+ thumbTypeParts.push("precise");
692
+ }
693
+ if (this.hasHistogram) {
694
+ thumbTypeParts.push("histogram");
695
+ }
696
+ return thumbTypeParts.join("-");
697
+ }
698
+ setValueFromMinMax() {
699
+ const { minValue, maxValue } = this;
700
+ if (typeof minValue === "number" && typeof maxValue === "number") {
701
+ this.value = [minValue, maxValue];
702
+ }
703
+ }
704
+ setMinMaxFromValue() {
705
+ const { value } = this;
706
+ if (isRange(value)) {
707
+ this.minValue = value[0];
708
+ this.maxValue = value[1];
709
+ }
710
+ }
711
+ onLabelClick() {
712
+ this.setFocus();
713
+ }
714
+ shouldMirror() {
715
+ return this.mirrored && !this.hasHistogram;
716
+ }
717
+ shouldUseMinValue() {
718
+ if (!isRange(this.value)) {
719
+ return false;
720
+ }
721
+ return ((this.hasHistogram && this.maxValue === 0) || (!this.hasHistogram && this.minValue === 0));
722
+ }
723
+ getTickDensity() {
724
+ const density = (this.max - this.min) / this.ticks / maxTickElementThreshold;
725
+ return density < 1 ? 1 : density;
726
+ }
727
+ generateTickValues() {
728
+ const tickInterval = this.ticks ?? 0;
729
+ if (tickInterval <= 0) {
730
+ return [];
731
+ }
732
+ const ticks = [this.min];
733
+ const density = this.getTickDensity();
734
+ const tickOffset = tickInterval * density;
735
+ let current = this.min;
736
+ while (current < this.max) {
737
+ current += tickOffset;
738
+ ticks.push(Math.min(current, this.max));
739
+ }
740
+ if (!ticks.includes(this.max)) {
741
+ ticks.push(this.max);
742
+ }
743
+ return ticks;
744
+ }
745
+ pointerDownDragStart(event, prop) {
746
+ if (!isPrimaryPointerButton(event)) {
747
+ return;
748
+ }
749
+ this.dragStart(prop);
750
+ }
751
+ dragStart(prop) {
752
+ this.dragProp = prop;
753
+ this.lastDragProp = this.dragProp;
754
+ this.activeProp = prop;
755
+ window.addEventListener("pointermove", this.dragUpdate);
756
+ window.addEventListener("pointerup", this.pointerUpDragEnd);
757
+ window.addEventListener("pointercancel", this.dragEnd);
758
+ }
759
+ focusActiveHandle(valueX) {
760
+ if (this.dragProp === "minValue") {
761
+ this.minHandle.focus();
762
+ }
763
+ else if (this.dragProp === "maxValue" || this.dragProp === "value") {
764
+ this.maxHandle.focus();
765
+ }
766
+ else if (this.dragProp === "minMaxValue") {
767
+ this.getClosestHandle(valueX).focus();
768
+ }
769
+ }
770
+ emitInput() {
771
+ this.calciteSliderInput.emit();
772
+ }
773
+ emitChange() {
774
+ this.calciteSliderChange.emit();
775
+ }
776
+ removeDragListeners() {
777
+ window.removeEventListener("pointermove", this.dragUpdate);
778
+ window.removeEventListener("pointerup", this.pointerUpDragEnd);
779
+ window.removeEventListener("pointercancel", this.dragEnd);
780
+ }
781
+ /**
782
+ * Set prop value(s) if changed at the component level
783
+ *
784
+ * @param {object} values - a set of key/value pairs delineating what properties in the component to update
785
+ */
786
+ setValue(values) {
787
+ let valueChanged;
788
+ Object.keys(values).forEach((propName) => {
789
+ const newValue = values[propName];
790
+ if (!valueChanged) {
791
+ const oldValue = this[propName];
792
+ valueChanged = oldValue !== newValue;
793
+ }
794
+ this[propName] = newValue;
795
+ });
796
+ if (!valueChanged) {
797
+ return;
798
+ }
799
+ const dragging = this.dragProp;
800
+ if (!dragging) {
801
+ this.emitChange();
802
+ }
803
+ this.emitInput();
804
+ }
805
+ /**
806
+ * If number is outside range, constrain to min or max
807
+ *
808
+ * @param value
809
+ * @param prop
810
+ * @internal
811
+ */
812
+ clamp(value, prop) {
813
+ value = clamp(value, this.min, this.max);
814
+ // ensure that maxValue and minValue don't swap positions
815
+ if (prop === "maxValue") {
816
+ value = Math.max(value, this.minValue);
817
+ }
818
+ if (prop === "minValue") {
819
+ value = Math.min(value, this.maxValue);
820
+ }
821
+ return value;
822
+ }
823
+ /**
824
+ * Translate a pixel position to value along the range
825
+ *
826
+ * @param x
827
+ * @internal
828
+ */
829
+ translate(x) {
830
+ const range = this.max - this.min;
831
+ const { left, width } = this.trackEl.getBoundingClientRect();
832
+ const percent = (x - left) / width;
833
+ const mirror = this.shouldMirror();
834
+ const clampedValue = this.clamp(this.min + range * (mirror ? 1 - percent : percent));
835
+ const value = Number(clampedValue.toFixed(decimalPlaces(this.step)));
836
+ return !(this.snap && this.step) ? value : this.getClosestStep(value);
837
+ }
838
+ /**
839
+ * Get closest allowed value along stepped values
840
+ *
841
+ * @param value
842
+ * @internal
843
+ */
844
+ getClosestStep(value) {
845
+ const { max, min, step } = this;
846
+ let snappedValue = Math.floor((value - min) / step) * step + min;
847
+ snappedValue = Math.min(Math.max(snappedValue, min), max);
848
+ if (snappedValue > max) {
849
+ snappedValue -= step;
850
+ }
851
+ return snappedValue;
852
+ }
853
+ getClosestHandle(valueX) {
854
+ return this.getDistanceX(this.maxHandle, valueX) > this.getDistanceX(this.minHandle, valueX)
855
+ ? this.minHandle
856
+ : this.maxHandle;
857
+ }
858
+ getDistanceX(el, valueX) {
859
+ return Math.abs(el.getBoundingClientRect().left - valueX);
860
+ }
861
+ getFontSizeForElement(element) {
862
+ return Number(window.getComputedStyle(element).getPropertyValue("font-size").match(/\d+/)[0]);
863
+ }
864
+ /**
865
+ * Get position of value along range as fractional value
866
+ *
867
+ * @param num
868
+ * @return {number} number in the unit interval [0,1]
869
+ * @internal
870
+ */
871
+ getUnitInterval(num) {
872
+ num = this.clamp(num);
873
+ const range = this.max - this.min;
874
+ return (num - this.min) / range;
875
+ }
876
+ adjustHostObscuredHandleLabel(name) {
877
+ const label = this.el.shadowRoot.querySelector(`.handle__label--${name}`);
878
+ const labelStatic = this.el.shadowRoot.querySelector(`.handle__label--${name}.static`);
879
+ const labelTransformed = this.el.shadowRoot.querySelector(`.handle__label--${name}.transformed`);
880
+ const labelStaticBounds = labelStatic.getBoundingClientRect();
881
+ const labelStaticOffset = this.getHostOffset(labelStaticBounds.left, labelStaticBounds.right);
882
+ label.style.transform = `translateX(${labelStaticOffset}px)`;
883
+ labelTransformed.style.transform = `translateX(${labelStaticOffset}px)`;
884
+ }
885
+ hyphenateCollidingRangeHandleLabels() {
886
+ const { shadowRoot } = this.el;
887
+ const mirror = this.shouldMirror();
888
+ const leftModifier = mirror ? "value" : "minValue";
889
+ const rightModifier = mirror ? "minValue" : "value";
890
+ const leftValueLabel = shadowRoot.querySelector(`.handle__label--${leftModifier}`);
891
+ const leftValueLabelStatic = shadowRoot.querySelector(`.handle__label--${leftModifier}.static`);
892
+ const leftValueLabelTransformed = shadowRoot.querySelector(`.handle__label--${leftModifier}.transformed`);
893
+ const leftValueLabelStaticHostOffset = this.getHostOffset(leftValueLabelStatic.getBoundingClientRect().left, leftValueLabelStatic.getBoundingClientRect().right);
894
+ const rightValueLabel = shadowRoot.querySelector(`.handle__label--${rightModifier}`);
895
+ const rightValueLabelStatic = shadowRoot.querySelector(`.handle__label--${rightModifier}.static`);
896
+ const rightValueLabelTransformed = shadowRoot.querySelector(`.handle__label--${rightModifier}.transformed`);
897
+ const rightValueLabelStaticHostOffset = this.getHostOffset(rightValueLabelStatic.getBoundingClientRect().left, rightValueLabelStatic.getBoundingClientRect().right);
898
+ const labelFontSize = this.getFontSizeForElement(leftValueLabel);
899
+ const labelTransformedOverlap = this.getRangeLabelOverlap(leftValueLabelTransformed, rightValueLabelTransformed);
900
+ const hyphenLabel = leftValueLabel;
901
+ const labelOffset = labelFontSize / 2;
902
+ if (labelTransformedOverlap > 0) {
903
+ hyphenLabel.classList.add(CSS.hyphen, CSS.hyphenWrap);
904
+ if (rightValueLabelStaticHostOffset === 0 && leftValueLabelStaticHostOffset === 0) {
905
+ // Neither handle overlaps the host boundary
906
+ let leftValueLabelTranslate = labelTransformedOverlap / 2 - labelOffset;
907
+ leftValueLabelTranslate =
908
+ Math.sign(leftValueLabelTranslate) === -1
909
+ ? Math.abs(leftValueLabelTranslate)
910
+ : -leftValueLabelTranslate;
911
+ const leftValueLabelTransformedHostOffset = this.getHostOffset(leftValueLabelTransformed.getBoundingClientRect().left +
912
+ leftValueLabelTranslate -
913
+ labelOffset, leftValueLabelTransformed.getBoundingClientRect().right +
914
+ leftValueLabelTranslate -
915
+ labelOffset);
916
+ let rightValueLabelTranslate = labelTransformedOverlap / 2;
917
+ const rightValueLabelTransformedHostOffset = this.getHostOffset(rightValueLabelTransformed.getBoundingClientRect().left + rightValueLabelTranslate, rightValueLabelTransformed.getBoundingClientRect().right + rightValueLabelTranslate);
918
+ if (leftValueLabelTransformedHostOffset !== 0) {
919
+ leftValueLabelTranslate += leftValueLabelTransformedHostOffset;
920
+ rightValueLabelTranslate += leftValueLabelTransformedHostOffset;
921
+ }
922
+ if (rightValueLabelTransformedHostOffset !== 0) {
923
+ leftValueLabelTranslate += rightValueLabelTransformedHostOffset;
924
+ rightValueLabelTranslate += rightValueLabelTransformedHostOffset;
925
+ }
926
+ leftValueLabel.style.transform = `translateX(${leftValueLabelTranslate}px)`;
927
+ leftValueLabelTransformed.style.transform = `translateX(${leftValueLabelTranslate - labelOffset}px)`;
928
+ rightValueLabel.style.transform = `translateX(${rightValueLabelTranslate}px)`;
929
+ rightValueLabelTransformed.style.transform = `translateX(${rightValueLabelTranslate}px)`;
930
+ }
931
+ else if (leftValueLabelStaticHostOffset > 0 || rightValueLabelStaticHostOffset > 0) {
932
+ // labels overlap host boundary on the left side
933
+ leftValueLabel.style.transform = `translateX(${leftValueLabelStaticHostOffset + labelOffset}px)`;
934
+ rightValueLabel.style.transform = `translateX(${labelTransformedOverlap + rightValueLabelStaticHostOffset}px)`;
935
+ rightValueLabelTransformed.style.transform = `translateX(${labelTransformedOverlap + rightValueLabelStaticHostOffset}px)`;
936
+ }
937
+ else if (leftValueLabelStaticHostOffset < 0 || rightValueLabelStaticHostOffset < 0) {
938
+ // labels overlap host boundary on the right side
939
+ let leftValueLabelTranslate = Math.abs(leftValueLabelStaticHostOffset) + labelTransformedOverlap - labelOffset;
940
+ leftValueLabelTranslate =
941
+ Math.sign(leftValueLabelTranslate) === -1
942
+ ? Math.abs(leftValueLabelTranslate)
943
+ : -leftValueLabelTranslate;
944
+ leftValueLabel.style.transform = `translateX(${leftValueLabelTranslate}px)`;
945
+ leftValueLabelTransformed.style.transform = `translateX(${leftValueLabelTranslate - labelOffset}px)`;
946
+ }
947
+ }
948
+ else {
949
+ hyphenLabel.classList.remove(CSS.hyphen, CSS.hyphenWrap);
950
+ leftValueLabel.style.transform = `translateX(${leftValueLabelStaticHostOffset}px)`;
951
+ leftValueLabelTransformed.style.transform = `translateX(${leftValueLabelStaticHostOffset}px)`;
952
+ rightValueLabel.style.transform = `translateX(${rightValueLabelStaticHostOffset}px)`;
953
+ rightValueLabelTransformed.style.transform = `translateX(${rightValueLabelStaticHostOffset}px)`;
954
+ }
955
+ }
956
+ /**
957
+ * Hides bounding tick labels that are obscured by either handle.
958
+ */
959
+ hideObscuredBoundingTickLabels() {
960
+ const valueIsRange = isRange(this.value);
961
+ if (!this.hasHistogram && !valueIsRange && !this.labelHandles && !this.precise) {
962
+ return;
963
+ }
964
+ if (!this.hasHistogram && !valueIsRange && this.labelHandles && !this.precise) {
965
+ return;
966
+ }
967
+ if (!this.hasHistogram && !valueIsRange && !this.labelHandles && this.precise) {
968
+ return;
969
+ }
970
+ if (!this.hasHistogram && !valueIsRange && this.labelHandles && this.precise) {
971
+ return;
972
+ }
973
+ if (!this.hasHistogram && valueIsRange && !this.precise) {
974
+ return;
975
+ }
976
+ if (this.hasHistogram && !this.precise && !this.labelHandles) {
977
+ return;
978
+ }
979
+ const minHandle = this.el.shadowRoot.querySelector(`.${CSS.thumbMinValue}`);
980
+ const maxHandle = this.el.shadowRoot.querySelector(`.${CSS.thumbValue}`);
981
+ const minTickLabel = this.el.shadowRoot.querySelector(`.${CSS.tickMin}`);
982
+ const maxTickLabel = this.el.shadowRoot.querySelector(`.${CSS.tickMax}`);
983
+ if (!minHandle && maxHandle && minTickLabel && maxTickLabel) {
984
+ minTickLabel.style.opacity = this.isMinTickLabelObscured(minTickLabel, maxHandle) ? "0" : "1";
985
+ maxTickLabel.style.opacity = this.isMaxTickLabelObscured(maxTickLabel, maxHandle) ? "0" : "1";
986
+ }
987
+ if (minHandle && maxHandle && minTickLabel && maxTickLabel) {
988
+ minTickLabel.style.opacity =
989
+ this.isMinTickLabelObscured(minTickLabel, minHandle) ||
990
+ this.isMinTickLabelObscured(minTickLabel, maxHandle)
991
+ ? "0"
992
+ : "1";
993
+ maxTickLabel.style.opacity =
994
+ this.isMaxTickLabelObscured(maxTickLabel, minHandle) ||
995
+ (this.isMaxTickLabelObscured(maxTickLabel, maxHandle) && this.hasHistogram)
996
+ ? "0"
997
+ : "1";
998
+ }
999
+ }
1000
+ /**
1001
+ * Returns an integer representing the number of pixels to offset on the left or right side based on desired position behavior.
1002
+ *
1003
+ * @param leftBounds
1004
+ * @param rightBounds
1005
+ * @internal
1006
+ */
1007
+ getHostOffset(leftBounds, rightBounds) {
1008
+ const hostBounds = this.el.getBoundingClientRect();
1009
+ const buffer = 7;
1010
+ if (leftBounds + buffer < hostBounds.left) {
1011
+ return hostBounds.left - leftBounds - buffer;
1012
+ }
1013
+ if (rightBounds - buffer > hostBounds.right) {
1014
+ return -(rightBounds - hostBounds.right) + buffer;
1015
+ }
1016
+ return 0;
1017
+ }
1018
+ /**
1019
+ * Returns an integer representing the number of pixels that the two given span elements are overlapping, taking into account
1020
+ * a space in between the two spans equal to the font-size set on them to account for the space needed to render a hyphen.
1021
+ *
1022
+ * @param leftLabel
1023
+ * @param rightLabel
1024
+ */
1025
+ getRangeLabelOverlap(leftLabel, rightLabel) {
1026
+ const leftLabelBounds = leftLabel.getBoundingClientRect();
1027
+ const rightLabelBounds = rightLabel.getBoundingClientRect();
1028
+ const leftLabelFontSize = this.getFontSizeForElement(leftLabel);
1029
+ const rangeLabelOverlap = leftLabelBounds.right + leftLabelFontSize - rightLabelBounds.left;
1030
+ return Math.max(rangeLabelOverlap, 0);
1031
+ }
1032
+ /**
1033
+ * Returns a boolean value representing if the minLabel span element is obscured (being overlapped) by the given handle div element.
1034
+ *
1035
+ * @param minLabel
1036
+ * @param handle
1037
+ */
1038
+ isMinTickLabelObscured(minLabel, handle) {
1039
+ const minLabelBounds = minLabel.getBoundingClientRect();
1040
+ const handleBounds = handle.getBoundingClientRect();
1041
+ return intersects(minLabelBounds, handleBounds);
1042
+ }
1043
+ /**
1044
+ * Returns a boolean value representing if the maxLabel span element is obscured (being overlapped) by the given handle div element.
1045
+ *
1046
+ * @param maxLabel
1047
+ * @param handle
1048
+ */
1049
+ isMaxTickLabelObscured(maxLabel, handle) {
1050
+ const maxLabelBounds = maxLabel.getBoundingClientRect();
1051
+ const handleBounds = handle.getBoundingClientRect();
1052
+ return intersects(maxLabelBounds, handleBounds);
1053
+ }
1054
+ internalLabelFormatter(value, type) {
1055
+ const customFormatter = this.labelFormatter;
1056
+ if (!customFormatter) {
1057
+ return this.formatValue(value);
1058
+ }
1059
+ const formattedValue = customFormatter(value, type, this.formatValue);
1060
+ if (formattedValue == null) {
1061
+ return this.formatValue(value);
1062
+ }
1063
+ return formattedValue;
1064
+ }
1065
+ static get delegatesFocus() { return true; }
1066
+ get el() { return getElement(this); }
1067
+ static get watchers() { return {
1068
+ "histogram": ["histogramWatcher"],
1069
+ "ticks": ["ticksWatcher"],
1070
+ "value": ["valueHandler"],
1071
+ "minValue": ["minMaxValueHandler"],
1072
+ "maxValue": ["minMaxValueHandler"]
1073
+ }; }
1074
+ };
1075
+ Slider.style = CalciteSliderStyle0;
1076
+
1077
+ export { Graph as calcite_graph, Slider as calcite_slider };