@esri/solutions-components 0.10.6 → 0.10.8

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