@orangelogic/design-system 2.44.0 → 2.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/library/chunks/{color-swatch-group.DrpRd8Xw.js → color-swatch-group.CMz7zQdk.js} +1 -1
- package/library/chunks/{file-on-demand.ZcYwCR_s.js → file-on-demand.CODE3g50.js} +1 -1
- package/library/chunks/{list-editor.B_BRQoUp.js → list-editor.BZMql0Tj.js} +1 -1
- package/library/chunks/ref.BDmlFGTP.js +99 -0
- package/library/chunks/{tab-group.g2uXM2W8.js → tab-group.uF5JbAGa.js} +1 -1
- package/library/chunks/{table.Be9berv0.js → table.D6Abk0xC.js} +1 -1
- package/library/components/atoms.js +3 -3
- package/library/components/color-swatch-group.js +2 -2
- package/library/components/file-on-demand.js +2 -2
- package/library/components/list-editor.js +2 -2
- package/library/components/menu-item.js +678 -13
- package/library/components/menu.js +1 -1
- package/library/components/molecules.js +1 -1
- package/library/components/organisms.js +2 -2
- package/library/components/range.js +535 -396
- package/library/components/tab-group.js +2 -2
- package/library/components/table.js +1 -1
- package/library/components/types.js +204 -189
- package/library/package.json +1 -1
- package/library/packages/atoms/src/components/range/mark-controller.d.ts +34 -0
- package/library/packages/atoms/src/components/range/range.d.ts +6 -8
- package/library/packages/atoms/src/components/range/range.utils.d.ts +58 -1
- package/library/packages/organisms/src/downloader/downloader.d.ts +1 -0
- package/library/packages/tools/src/fetch-image/fetch-image.d.ts +6 -1
- package/library/react-web-component.d.ts +4 -0
- package/package.json +1 -1
- package/library/chunks/menu-item.DOFCmq0Z.js +0 -775
|
@@ -1,23 +1,247 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { c as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { d as
|
|
6
|
-
import { d as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
1
|
+
import R from "./resize-observer.js";
|
|
2
|
+
import { x as M, i as I, n as u, C as P, c as F } from "../chunks/custom-element.fmLrnDZr.js";
|
|
3
|
+
import { c as U } from "../chunks/component.styles.DtouHn2g.js";
|
|
4
|
+
import { f as O } from "../chunks/form-control.styles.j0hNjZTU.js";
|
|
5
|
+
import { d as $ } from "../chunks/popup.CJrePm7n.js";
|
|
6
|
+
import { d as N } from "../chunks/default-value.BrNrMtnz.js";
|
|
7
|
+
import { d as w } from "../chunks/drag.DXEXVXPv.js";
|
|
8
|
+
import { F as A } from "../chunks/form.BY8-x3IU.js";
|
|
9
|
+
import { L as S } from "../chunks/i18n.D33BKrRs.js";
|
|
10
|
+
import { c as d } from "../chunks/math.DqTA6ya4.js";
|
|
11
|
+
import { H as B } from "../chunks/slot.DJLm4Dig.js";
|
|
12
|
+
import { w as v } from "../chunks/watch.BCJD77bD.js";
|
|
13
|
+
import { r as g } from "../chunks/state.Dt9F_SuS.js";
|
|
14
|
+
import { t as E } from "../chunks/event-options.CYHYGOd8.js";
|
|
15
|
+
import { e as c } from "../chunks/query.BBf1UFkC.js";
|
|
15
16
|
import { e as p } from "../chunks/class-map.DqNfBvJI.js";
|
|
16
|
-
import { o as
|
|
17
|
-
import { l as
|
|
18
|
-
import { o as
|
|
19
|
-
import
|
|
20
|
-
|
|
17
|
+
import { o as k } from "../chunks/if-defined.CKupVaWs.js";
|
|
18
|
+
import { l as W } from "../chunks/live.DCdtYl87.js";
|
|
19
|
+
import { o as f } from "../chunks/style-map.lEJHEwk3.js";
|
|
20
|
+
import H from "./tooltip.js";
|
|
21
|
+
import { e as K, n as j } from "../chunks/ref.BDmlFGTP.js";
|
|
22
|
+
import { c as q } from "../chunks/repeat.B1pVpmRx.js";
|
|
23
|
+
function X({
|
|
24
|
+
edgeMode: t = "center",
|
|
25
|
+
maxOffset: e,
|
|
26
|
+
minOffset: i,
|
|
27
|
+
percentValue: a
|
|
28
|
+
}) {
|
|
29
|
+
const r = t === "inside" ? i : 0, n = t === "inside" ? 100 - e : 100;
|
|
30
|
+
let o = a - i, h = a + e;
|
|
31
|
+
if (t === "inside")
|
|
32
|
+
o < r && (o = r, h = r + i + e), h > n && (h = n, o = n - i - e);
|
|
33
|
+
else {
|
|
34
|
+
if (o < 0) {
|
|
35
|
+
const m = -o;
|
|
36
|
+
o = 0, h += m;
|
|
37
|
+
}
|
|
38
|
+
if (h > 100) {
|
|
39
|
+
const m = h - 100;
|
|
40
|
+
h = 100, o -= m;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
maxThumbMaxLeft: d(n, 0, 100),
|
|
45
|
+
maxThumbMinLeft: d(h, 0, 100),
|
|
46
|
+
minThumbMaxLeft: d(o, 0, 100),
|
|
47
|
+
minThumbMinLeft: d(r, 0, 100)
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function y(t, e, i) {
|
|
51
|
+
const a = i - e;
|
|
52
|
+
return a === 0 ? 0 : d((t - e) / a, 0, 1) * 100;
|
|
53
|
+
}
|
|
54
|
+
function Y(t) {
|
|
55
|
+
return t.filter((e) => !e.hidden);
|
|
56
|
+
}
|
|
57
|
+
function J(t, e) {
|
|
58
|
+
return Math.floor(t / Math.max(e, 1));
|
|
59
|
+
}
|
|
60
|
+
function G(t, e) {
|
|
61
|
+
const i = (t - 1) / (e + 1);
|
|
62
|
+
return Math.ceil(i);
|
|
63
|
+
}
|
|
64
|
+
function Q(t, e) {
|
|
65
|
+
return t / e * 100;
|
|
66
|
+
}
|
|
67
|
+
function Z(t, e, i, a) {
|
|
68
|
+
const r = Math.abs(t - e), n = Math.abs(t - i);
|
|
69
|
+
return r >= a && n >= a;
|
|
70
|
+
}
|
|
71
|
+
function tt(t) {
|
|
72
|
+
return new Set(t.map((e) => e.value));
|
|
73
|
+
}
|
|
74
|
+
function et(t) {
|
|
75
|
+
const e = /* @__PURE__ */ new Set(), i = Math.floor(t.length / 2), a = t[i];
|
|
76
|
+
return a && e.add(a.value), e;
|
|
77
|
+
}
|
|
78
|
+
function it(t, e) {
|
|
79
|
+
const i = /* @__PURE__ */ new Set(), a = t[0], r = t.at(-1);
|
|
80
|
+
return a && i.add(a.value), r && e > 1 && i.add(r.value), i;
|
|
81
|
+
}
|
|
82
|
+
function at(t, e, i, a, r, n) {
|
|
83
|
+
const o = /* @__PURE__ */ new Set(), h = t[0], m = t.at(-1);
|
|
84
|
+
if (!h || !m)
|
|
85
|
+
return o;
|
|
86
|
+
const x = G(t.length, e), b = Q(i, a), D = y(h.value, r, n), _ = y(m.value, r, n);
|
|
87
|
+
for (let V = 1; V <= e; V++) {
|
|
88
|
+
const C = V * x, T = t[C];
|
|
89
|
+
if (!T || C >= t.length - 1)
|
|
90
|
+
continue;
|
|
91
|
+
const z = y(T.value, r, n);
|
|
92
|
+
Z(
|
|
93
|
+
z,
|
|
94
|
+
D,
|
|
95
|
+
_,
|
|
96
|
+
b
|
|
97
|
+
) && o.add(T.value);
|
|
98
|
+
}
|
|
99
|
+
return o;
|
|
100
|
+
}
|
|
101
|
+
function rt(t, e, i, a, r) {
|
|
102
|
+
if (!e || t.length === 0)
|
|
103
|
+
return /* @__PURE__ */ new Set();
|
|
104
|
+
const n = Y(t);
|
|
105
|
+
if (n.length === 0)
|
|
106
|
+
return /* @__PURE__ */ new Set();
|
|
107
|
+
const o = J(e, i);
|
|
108
|
+
if (o >= n.length)
|
|
109
|
+
return tt(n);
|
|
110
|
+
if (o <= 1)
|
|
111
|
+
return et(n);
|
|
112
|
+
const h = it(n, o);
|
|
113
|
+
if (o > 2) {
|
|
114
|
+
const m = o - 2;
|
|
115
|
+
at(
|
|
116
|
+
n,
|
|
117
|
+
m,
|
|
118
|
+
i,
|
|
119
|
+
e,
|
|
120
|
+
a,
|
|
121
|
+
r
|
|
122
|
+
).forEach((b) => h.add(b));
|
|
123
|
+
}
|
|
124
|
+
return h;
|
|
125
|
+
}
|
|
126
|
+
var st = Object.defineProperty, nt = Object.getOwnPropertyDescriptor, lt = (t, e, i, a) => {
|
|
127
|
+
for (var r = nt(e, i), n = t.length - 1, o; n >= 0; n--)
|
|
128
|
+
(o = t[n]) && (r = o(e, i, r) || r);
|
|
129
|
+
return r && st(e, i, r), r;
|
|
130
|
+
};
|
|
131
|
+
class L {
|
|
132
|
+
constructor(e) {
|
|
133
|
+
this.marksContainerRef = K(), this.containerWidth = 0, this.marksWithLabels = /* @__PURE__ */ new Set(), this.host = e, this.host.addController(this), this.localize = new S(e), this.handleResize = this.handleResize.bind(this);
|
|
134
|
+
}
|
|
135
|
+
hostConnected() {
|
|
136
|
+
}
|
|
137
|
+
hostDisconnected() {
|
|
138
|
+
}
|
|
139
|
+
hostUpdated() {
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Gets all mark elements from the datalist slot.
|
|
143
|
+
* @returns NodeList of option elements or null
|
|
144
|
+
*/
|
|
145
|
+
getAllMarks() {
|
|
146
|
+
return this.host.querySelector("datalist")?.querySelectorAll("option");
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Initializes marks based on the datalist slot or auto-generates them from step.
|
|
150
|
+
* @returns Array of valid mark objects
|
|
151
|
+
*/
|
|
152
|
+
initMarks() {
|
|
153
|
+
if (!this.host.showMarks)
|
|
154
|
+
return [];
|
|
155
|
+
const e = this.getAllMarks(), i = [];
|
|
156
|
+
if (e && e.length > 0)
|
|
157
|
+
e.forEach((a) => {
|
|
158
|
+
const r = a.getAttribute("value");
|
|
159
|
+
if (!r)
|
|
160
|
+
return;
|
|
161
|
+
const n = Number.parseFloat(r);
|
|
162
|
+
Number.isNaN(n) || i.push({
|
|
163
|
+
hidden: a.hasAttribute("hidden"),
|
|
164
|
+
label: a.textContent || "",
|
|
165
|
+
value: n
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
else {
|
|
169
|
+
const a = this.host.step || 1, r = this.host.min, n = this.host.max, o = Math.round((n - r) / a);
|
|
170
|
+
for (let h = 0; h <= o; h++) {
|
|
171
|
+
const m = r + h * a;
|
|
172
|
+
i.push({
|
|
173
|
+
hidden: !1,
|
|
174
|
+
label: m.toString(),
|
|
175
|
+
value: m
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return this.calculateVisibleLabels(i), i;
|
|
180
|
+
}
|
|
181
|
+
renderMark(e) {
|
|
182
|
+
const i = this.localize.dir() === "rtl", a = y(
|
|
183
|
+
e.value,
|
|
184
|
+
this.host.min,
|
|
185
|
+
this.host.max
|
|
186
|
+
), r = i ? 100 - a : a;
|
|
187
|
+
return M` <div
|
|
188
|
+
class=${p({
|
|
189
|
+
mark__tick: !0,
|
|
190
|
+
"mark__tick--hidden": e.hidden
|
|
191
|
+
})}
|
|
192
|
+
part="mark-tick"
|
|
193
|
+
style=${f({ left: `${r}%` })}
|
|
194
|
+
></div>
|
|
195
|
+
<div
|
|
196
|
+
class=${p({
|
|
197
|
+
mark__label: !0,
|
|
198
|
+
"mark__label--hidden": e.hidden || !this.marksWithLabels.has(e.value)
|
|
199
|
+
})}
|
|
200
|
+
part="mark-label"
|
|
201
|
+
style=${f({ left: `${r}%` })}
|
|
202
|
+
>
|
|
203
|
+
${e.label}
|
|
204
|
+
</div>`;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Calculates which marks should display labels based on available width.
|
|
208
|
+
* Uses a minimum spacing between labels to prevent overcrowding.
|
|
209
|
+
*/
|
|
210
|
+
calculateVisibleLabels(e) {
|
|
211
|
+
this.marksWithLabels = rt(
|
|
212
|
+
e,
|
|
213
|
+
this.containerWidth,
|
|
214
|
+
this.host.markLabelSpacing,
|
|
215
|
+
this.host.min,
|
|
216
|
+
this.host.max
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
handleResize() {
|
|
220
|
+
const e = this.marksContainerRef.value?.clientWidth ?? 0;
|
|
221
|
+
e !== this.containerWidth && (this.containerWidth = e, this.calculateVisibleLabels(this.host.marks), this.host.requestUpdate());
|
|
222
|
+
}
|
|
223
|
+
renderMarks() {
|
|
224
|
+
return M` <cx-resize-observer @cx-resize=${this.handleResize}>
|
|
225
|
+
<div
|
|
226
|
+
class="range__marks"
|
|
227
|
+
${j(this.marksContainerRef)}
|
|
228
|
+
style=${f({
|
|
229
|
+
visibility: this.host.showMarks ? "visible" : "hidden"
|
|
230
|
+
})}
|
|
231
|
+
>
|
|
232
|
+
${q(
|
|
233
|
+
this.host.marks,
|
|
234
|
+
(e) => e.value,
|
|
235
|
+
(e) => this.renderMark(e)
|
|
236
|
+
)}
|
|
237
|
+
</div>
|
|
238
|
+
</cx-resize-observer>`;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
lt([
|
|
242
|
+
$(100)
|
|
243
|
+
], L.prototype, "handleResize");
|
|
244
|
+
const ot = I`
|
|
21
245
|
:host {
|
|
22
246
|
--thumb-color: #fff;
|
|
23
247
|
--thumb-size: 20px;
|
|
@@ -331,50 +555,23 @@ const U = T`
|
|
|
331
555
|
display: none;
|
|
332
556
|
}
|
|
333
557
|
`;
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
percentValue: a
|
|
339
|
-
}) {
|
|
340
|
-
const n = t === "inside" ? e : 0, l = t === "inside" ? 100 - i : 100;
|
|
341
|
-
let o = a - e, u = a + i;
|
|
342
|
-
if (t === "inside")
|
|
343
|
-
o < n && (o = n, u = n + e + i), u > l && (u = l, o = l - e - i);
|
|
344
|
-
else {
|
|
345
|
-
if (o < 0) {
|
|
346
|
-
const f = -o;
|
|
347
|
-
o = 0, u += f;
|
|
348
|
-
}
|
|
349
|
-
if (u > 100) {
|
|
350
|
-
const f = u - 100;
|
|
351
|
-
u = 100, o -= f;
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
return {
|
|
355
|
-
maxThumbMaxLeft: m(l, 0, 100),
|
|
356
|
-
maxThumbMinLeft: m(u, 0, 100),
|
|
357
|
-
minThumbMaxLeft: m(o, 0, 100),
|
|
358
|
-
minThumbMinLeft: m(n, 0, 100)
|
|
359
|
-
};
|
|
360
|
-
}
|
|
361
|
-
var O = Object.defineProperty, A = Object.getOwnPropertyDescriptor, s = (t, i, e, a) => {
|
|
362
|
-
for (var n = a > 1 ? void 0 : a ? A(i, e) : i, l = t.length - 1, o; l >= 0; l--)
|
|
363
|
-
(o = t[l]) && (n = (a ? o(i, e, n) : o(n)) || n);
|
|
364
|
-
return a && n && O(i, e, n), n;
|
|
558
|
+
var ht = Object.defineProperty, ut = Object.getOwnPropertyDescriptor, l = (t, e, i, a) => {
|
|
559
|
+
for (var r = a > 1 ? void 0 : a ? ut(e, i) : e, n = t.length - 1, o; n >= 0; n--)
|
|
560
|
+
(o = t[n]) && (r = (a ? o(e, i, r) : o(r)) || r);
|
|
561
|
+
return a && r && ht(e, i, r), r;
|
|
365
562
|
};
|
|
366
|
-
let
|
|
563
|
+
let s = class extends P {
|
|
367
564
|
constructor() {
|
|
368
|
-
super(), this.formControlController = new
|
|
565
|
+
super(), this.formControlController = new A(this), this.hasSlotController = new B(
|
|
369
566
|
this,
|
|
370
567
|
"help-text",
|
|
371
568
|
"label",
|
|
372
569
|
"thumb-min",
|
|
373
570
|
"thumb-max"
|
|
374
|
-
), this.localize = new
|
|
571
|
+
), this.localize = new S(this), this.markController = new L(this), this.hasFocus = !1, this.hasTooltip = !1, this._multiValue = { max: 75, min: 25 }, this._singleValue = 0, this.multiDragTarget = null, this.multiIsDragging = !1, this.multiRangeWidth = 0, this.multiDragStartValue = { max: 0, min: 0 }, this.thumbConstraints = {
|
|
375
572
|
max: { maxLeft: 100, minLeft: 0 },
|
|
376
573
|
min: { maxLeft: 100, minLeft: 0 }
|
|
377
|
-
}, this.state = "idle", this.title = "", this.name = "", this.multi = !1, this.label = "", this.helpText = "", this.disabled = !1, this.min = 0, this.max = 100, this.tooltipPlacement = "top", this.tooltipDisplay = "auto", this.tooltipHoist = !1, this.tooltipFormatter = (t) => t.toString(), this.form = void 0, this.snapThreshold = 12, this.showMarks = !1, this.tooltipOffset = 8, this.minThumbDisabled = !1, this.maxThumbDisabled = !1, this.rangeSlideDisabled = !1, this.thumbsCrossover = "swap", this.noOverlap = !1, this.thumbEdgeMode = "center", this.marks = [], this.defaultValue = 0, this.handleMouseUp = this.handleMouseUp.bind(this), this.handleMultiResize = this.handleMultiResize.bind(this);
|
|
574
|
+
}, this.state = "idle", this.title = "", this.name = "", this.multi = !1, this.label = "", this.helpText = "", this.disabled = !1, this.min = 0, this.max = 100, this.markLabelSpacing = 10, this.tooltipPlacement = "top", this.tooltipDisplay = "auto", this.tooltipHoist = !1, this.tooltipFormatter = (t) => t.toString(), this.form = void 0, this.snapThreshold = 12, this.showMarks = !1, this.tooltipOffset = 8, this.minThumbDisabled = !1, this.maxThumbDisabled = !1, this.rangeSlideDisabled = !1, this.thumbsCrossover = "swap", this.noOverlap = !1, this.thumbEdgeMode = "center", this.marks = [], this.defaultValue = 0, this.handleMouseUp = this.handleMouseUp.bind(this), this.handleMultiResize = this.handleMultiResize.bind(this);
|
|
378
575
|
}
|
|
379
576
|
set value(t) {
|
|
380
577
|
Array.isArray(t) ? this._multiValue = { max: t[1], min: t[0] } : this._singleValue = t;
|
|
@@ -423,42 +620,18 @@ let r = class extends V {
|
|
|
423
620
|
if (super.connectedCallback(), this.resizeObserver = new ResizeObserver(() => {
|
|
424
621
|
this.multi && this.handleMultiResize(), this.syncRange();
|
|
425
622
|
}), this.multi) {
|
|
426
|
-
const [t,
|
|
427
|
-
(t !==
|
|
623
|
+
const [t, e] = this.value, i = Math.max(this.min, Math.min(t, this.max)), a = Math.max(this.min, Math.min(e, this.max));
|
|
624
|
+
(t !== i || e !== a) && (this.value = [i, a]);
|
|
428
625
|
} else {
|
|
429
626
|
const t = this.value;
|
|
430
627
|
t < this.min && (this.value = this.min), t > this.max && (this.value = this.max);
|
|
431
628
|
}
|
|
432
|
-
this.initMarks(), !this.step && (!this.marks || this.marks.length === 0) && (this.step = 1), this.updateComplete.then(() => {
|
|
629
|
+
this.marks = this.markController.initMarks(), !this.step && (!this.marks || this.marks.length === 0) && (this.step = 1), this.updateComplete.then(() => {
|
|
433
630
|
this.multi && this.multiContainer ? this.resizeObserver.observe(this.multiContainer) : this.input && this.resizeObserver.observe(this.input), this.syncRange();
|
|
434
631
|
});
|
|
435
632
|
}
|
|
436
633
|
initMarks() {
|
|
437
|
-
|
|
438
|
-
return;
|
|
439
|
-
const t = this.getAllMarks(), i = [];
|
|
440
|
-
if (t && t.length > 0)
|
|
441
|
-
t.forEach((e) => {
|
|
442
|
-
const a = e.getAttribute("value");
|
|
443
|
-
if (!a)
|
|
444
|
-
return;
|
|
445
|
-
const n = Number.parseFloat(a);
|
|
446
|
-
Number.isNaN(n) || i.push({
|
|
447
|
-
hidden: e.hasAttribute("hidden"),
|
|
448
|
-
label: e.textContent || "",
|
|
449
|
-
value: n
|
|
450
|
-
});
|
|
451
|
-
});
|
|
452
|
-
else {
|
|
453
|
-
const e = this.step || 1, a = this.min, n = this.max;
|
|
454
|
-
for (let l = a; l <= n; l += e)
|
|
455
|
-
i.push({
|
|
456
|
-
hidden: !1,
|
|
457
|
-
label: l.toString(),
|
|
458
|
-
value: l
|
|
459
|
-
});
|
|
460
|
-
}
|
|
461
|
-
this.marks = i;
|
|
634
|
+
this.marks = this.markController.initMarks();
|
|
462
635
|
}
|
|
463
636
|
disconnectedCallback() {
|
|
464
637
|
super.disconnectedCallback(), this.input && this.resizeObserver?.unobserve(this.input), this.multiContainer && this.resizeObserver?.unobserve(this.multiContainer);
|
|
@@ -484,33 +657,33 @@ let r = class extends V {
|
|
|
484
657
|
* @returns whether the value has changed
|
|
485
658
|
*/
|
|
486
659
|
snapValue(t) {
|
|
487
|
-
let
|
|
488
|
-
const
|
|
489
|
-
let a = 1 / 0,
|
|
490
|
-
for (const
|
|
491
|
-
const
|
|
492
|
-
let
|
|
493
|
-
this.localize.dir() === "rtl" && (
|
|
494
|
-
const
|
|
495
|
-
if (
|
|
660
|
+
let e = t;
|
|
661
|
+
const i = this.marks.map((h) => h.value);
|
|
662
|
+
let a = 1 / 0, r = 0;
|
|
663
|
+
for (const h of i) {
|
|
664
|
+
const m = this.valueToPercentage(h), x = this.input.clientWidth;
|
|
665
|
+
let b = x * (m / 100);
|
|
666
|
+
this.localize.dir() === "rtl" && (b = x - b);
|
|
667
|
+
const _ = Math.abs(e - b);
|
|
668
|
+
if (_ > a)
|
|
496
669
|
break;
|
|
497
|
-
a =
|
|
670
|
+
a = _, r = b;
|
|
498
671
|
}
|
|
499
|
-
this.step ? a <= this.snapThreshold && (
|
|
500
|
-
const
|
|
501
|
-
this.pixelsToValue(
|
|
672
|
+
this.step ? a <= this.snapThreshold && (e = r) : e = r;
|
|
673
|
+
const n = d(
|
|
674
|
+
this.pixelsToValue(e),
|
|
502
675
|
this.min,
|
|
503
676
|
this.max
|
|
504
677
|
);
|
|
505
|
-
this.input.value =
|
|
678
|
+
this.input.value = n.toString();
|
|
506
679
|
const o = Number.parseFloat(this.input.value);
|
|
507
680
|
return this.value === o ? !1 : (this.value = o, !0);
|
|
508
681
|
}
|
|
509
682
|
handleThumbDragStart(t) {
|
|
510
|
-
this.disabled || (this.hasTooltip = !0, this.state = "dragging", this.emit("cx-drag-start"),
|
|
683
|
+
this.disabled || (this.hasTooltip = !0, this.state = "dragging", this.emit("cx-drag-start"), w(this, {
|
|
511
684
|
initialEvent: t,
|
|
512
|
-
onMove: (
|
|
513
|
-
this.handleInput(), document.body.style.userSelect = "none", this.snapValue(
|
|
685
|
+
onMove: (e) => {
|
|
686
|
+
this.handleInput(), document.body.style.userSelect = "none", this.snapValue(e);
|
|
514
687
|
},
|
|
515
688
|
onStop: () => {
|
|
516
689
|
document.body.style.userSelect = "", this.state = "idle", this.hasTooltip = !1, this.emit("cx-drag-end"), this.handleChange();
|
|
@@ -548,8 +721,8 @@ let r = class extends V {
|
|
|
548
721
|
handleMouseDown(t) {
|
|
549
722
|
if (this.disabled)
|
|
550
723
|
return;
|
|
551
|
-
const
|
|
552
|
-
this.snapValue(
|
|
724
|
+
const e = t.x - this.input.getBoundingClientRect().left;
|
|
725
|
+
this.snapValue(e), this.range.addEventListener("mouseup", this.handleMouseUp, {
|
|
553
726
|
once: !0
|
|
554
727
|
});
|
|
555
728
|
}
|
|
@@ -568,11 +741,11 @@ let r = class extends V {
|
|
|
568
741
|
}
|
|
569
742
|
}
|
|
570
743
|
valueToPercentage(t) {
|
|
571
|
-
return
|
|
744
|
+
return d((t - this.min) / (this.max - this.min), 0, 1) * 100;
|
|
572
745
|
}
|
|
573
746
|
pixelsToValue(t) {
|
|
574
|
-
const
|
|
575
|
-
return (this.localize.dir() === "rtl" ?
|
|
747
|
+
const e = this.input.clientWidth;
|
|
748
|
+
return (this.localize.dir() === "rtl" ? e - t : t) / e * 100 / 100 * (this.max - this.min) + this.min;
|
|
576
749
|
}
|
|
577
750
|
syncProgress(t) {
|
|
578
751
|
this.range.style.setProperty("--percent", `${t * 100}%`);
|
|
@@ -591,12 +764,12 @@ let r = class extends V {
|
|
|
591
764
|
} else {
|
|
592
765
|
if (!this.output)
|
|
593
766
|
return;
|
|
594
|
-
const t = this.value,
|
|
767
|
+
const t = this.value, e = d(
|
|
595
768
|
(t - this.min) / (this.max - this.min),
|
|
596
769
|
0,
|
|
597
770
|
1
|
|
598
771
|
);
|
|
599
|
-
this.syncProgress(
|
|
772
|
+
this.syncProgress(e), this.tooltipDisplay === "auto" && (this.output.open = this.hasTooltip);
|
|
600
773
|
}
|
|
601
774
|
}
|
|
602
775
|
handleInvalid(t) {
|
|
@@ -620,52 +793,52 @@ let r = class extends V {
|
|
|
620
793
|
return t ? t === "min" ? !this.minThumbDisabled : !this.maxThumbDisabled : !1;
|
|
621
794
|
}
|
|
622
795
|
/** Updates multi value for a specific thumb and returns whether it changed */
|
|
623
|
-
updateMultiThumbValue(t,
|
|
624
|
-
const
|
|
625
|
-
let
|
|
626
|
-
return
|
|
796
|
+
updateMultiThumbValue(t, e) {
|
|
797
|
+
const i = this._multiValue.min, a = this._multiValue.max;
|
|
798
|
+
let r = t === "min" ? e : this._multiValue.min, n = t === "max" ? e : this._multiValue.max;
|
|
799
|
+
return r > n && (this.thumbsCrossover === "block" ? t === "min" ? r = this._multiValue.max : n = this._multiValue.min : [r, n] = [n, r]), this.setMultiValue(r, n), this._multiValue.min !== i || this._multiValue.max !== a;
|
|
627
800
|
}
|
|
628
801
|
/** Finds the next mark value greater than the current value */
|
|
629
802
|
findNextMark(t) {
|
|
630
|
-
return this.marks.find((
|
|
803
|
+
return this.marks.find((e) => e.value > t)?.value;
|
|
631
804
|
}
|
|
632
805
|
/** Finds the previous mark value less than the current value */
|
|
633
806
|
findPreviousMark(t) {
|
|
634
|
-
for (let
|
|
635
|
-
if (this.marks[
|
|
636
|
-
return this.marks[
|
|
807
|
+
for (let e = this.marks.length - 1; e >= 0; e--)
|
|
808
|
+
if (this.marks[e].value < t)
|
|
809
|
+
return this.marks[e].value;
|
|
637
810
|
}
|
|
638
811
|
/** Handles step up for single mode */
|
|
639
812
|
stepUpSingle() {
|
|
640
813
|
const t = this.value;
|
|
641
814
|
if (this.step)
|
|
642
815
|
return this.input.stepUp(), t !== Number(this.input.value) ? (this.value = Number(this.input.value), !0) : !1;
|
|
643
|
-
const
|
|
644
|
-
return
|
|
816
|
+
const e = this.findNextMark(t);
|
|
817
|
+
return e !== void 0 ? (this.value = e, !0) : !1;
|
|
645
818
|
}
|
|
646
819
|
/** Handles step down for single mode */
|
|
647
820
|
stepDownSingle() {
|
|
648
821
|
const t = this.value;
|
|
649
822
|
if (this.step)
|
|
650
823
|
return this.input.stepDown(), t !== Number(this.input.value) ? (this.value = Number(this.input.value), !0) : !1;
|
|
651
|
-
const
|
|
652
|
-
return
|
|
824
|
+
const e = this.findPreviousMark(t);
|
|
825
|
+
return e !== void 0 ? (this.value = e, !0) : !1;
|
|
653
826
|
}
|
|
654
827
|
/** Handles step up for multi mode */
|
|
655
828
|
stepUpMulti(t) {
|
|
656
|
-
const
|
|
829
|
+
const e = this._multiValue[t];
|
|
657
830
|
if (this.step)
|
|
658
|
-
return this.updateMultiThumbValue(t,
|
|
659
|
-
const
|
|
660
|
-
return
|
|
831
|
+
return this.updateMultiThumbValue(t, e + this.step);
|
|
832
|
+
const i = this.findNextMark(e);
|
|
833
|
+
return i !== void 0 ? this.updateMultiThumbValue(t, i) : !1;
|
|
661
834
|
}
|
|
662
835
|
/** Handles step down for multi mode */
|
|
663
836
|
stepDownMulti(t) {
|
|
664
|
-
const
|
|
837
|
+
const e = this._multiValue[t];
|
|
665
838
|
if (this.step)
|
|
666
|
-
return this.updateMultiThumbValue(t,
|
|
667
|
-
const
|
|
668
|
-
return
|
|
839
|
+
return this.updateMultiThumbValue(t, e - this.step);
|
|
840
|
+
const i = this.findPreviousMark(e);
|
|
841
|
+
return i !== void 0 ? this.updateMultiThumbValue(t, i) : !1;
|
|
669
842
|
}
|
|
670
843
|
/**
|
|
671
844
|
* Increments the value of the range by the value of the step attribute.
|
|
@@ -699,58 +872,27 @@ let r = class extends V {
|
|
|
699
872
|
setCustomValidity(t) {
|
|
700
873
|
this.multi ? (this.multiInputMin?.setCustomValidity(t), this.multiInputMax?.setCustomValidity(t)) : this.input?.setCustomValidity(t), this.formControlController.updateValidity();
|
|
701
874
|
}
|
|
702
|
-
getAllMarks() {
|
|
703
|
-
return this.querySelector(
|
|
704
|
-
"datalist"
|
|
705
|
-
)?.querySelectorAll("option");
|
|
706
|
-
}
|
|
707
|
-
renderMarks() {
|
|
708
|
-
const t = this.localize.dir() === "rtl";
|
|
709
|
-
return this.marks.map((i) => {
|
|
710
|
-
const e = this.valueToPercentage(
|
|
711
|
-
t ? 100 - i.value : i.value
|
|
712
|
-
);
|
|
713
|
-
return _` <div
|
|
714
|
-
class=${p({
|
|
715
|
-
mark__tick: !0,
|
|
716
|
-
"mark__tick--hidden": i.hidden
|
|
717
|
-
})}
|
|
718
|
-
part="mark-tick"
|
|
719
|
-
style=${c({ left: `${e}%` })}
|
|
720
|
-
></div>
|
|
721
|
-
<div
|
|
722
|
-
class=${p({
|
|
723
|
-
mark__label: !0,
|
|
724
|
-
"mark__label--hidden": i.hidden
|
|
725
|
-
})}
|
|
726
|
-
part="mark-label"
|
|
727
|
-
style=${c({ left: `${e}%` })}
|
|
728
|
-
>
|
|
729
|
-
${i.label}
|
|
730
|
-
</div>`;
|
|
731
|
-
});
|
|
732
|
-
}
|
|
733
875
|
handleMultiResize() {
|
|
734
876
|
this.noOverlap && this.updateNoOverlapConstraints(), this.requestUpdate();
|
|
735
877
|
}
|
|
736
878
|
multiValueToPercent(t) {
|
|
737
|
-
return
|
|
879
|
+
return d((t - this.min) / (this.max - this.min), 0, 1) * 100;
|
|
738
880
|
}
|
|
739
881
|
multiPercentToValue(t) {
|
|
740
882
|
return t / 100 * (this.max - this.min) + this.min;
|
|
741
883
|
}
|
|
742
|
-
multiPositionToValue(t,
|
|
743
|
-
const
|
|
744
|
-
return this.multiPercentToValue(
|
|
884
|
+
multiPositionToValue(t, e) {
|
|
885
|
+
const i = t / e * 100;
|
|
886
|
+
return this.multiPercentToValue(i);
|
|
745
887
|
}
|
|
746
888
|
getConstrainedPercent(t) {
|
|
747
|
-
const
|
|
748
|
-
let
|
|
889
|
+
const e = this._multiValue[t];
|
|
890
|
+
let i = this.multiValueToPercent(e);
|
|
749
891
|
if (this.noOverlap) {
|
|
750
892
|
const a = this.thumbConstraints[t];
|
|
751
|
-
|
|
893
|
+
i = d(i, a.minLeft, a.maxLeft);
|
|
752
894
|
}
|
|
753
|
-
return
|
|
895
|
+
return d(i, 0, 100);
|
|
754
896
|
}
|
|
755
897
|
getMultiThumbStyle(t) {
|
|
756
898
|
return { left: `${this.getConstrainedPercent(t)}%` };
|
|
@@ -759,10 +901,10 @@ let r = class extends V {
|
|
|
759
901
|
* Gets the style for the range bar (active portion between thumbs).
|
|
760
902
|
* In 'inside' mode, the bar is trimmed to match the track bounds.
|
|
761
903
|
*/
|
|
762
|
-
getRangeBarStyle(t,
|
|
763
|
-
const
|
|
904
|
+
getRangeBarStyle(t, e) {
|
|
905
|
+
const i = this.trackLeftInset, a = this.trackRightInset, r = Math.max(t, i), n = Math.min(e, 100 - a), o = Math.max(0, n - r);
|
|
764
906
|
return {
|
|
765
|
-
left: `${
|
|
907
|
+
left: `${r}%`,
|
|
766
908
|
/**
|
|
767
909
|
* Hide the bar when width is 0 to prevent border from showing
|
|
768
910
|
*/
|
|
@@ -770,20 +912,20 @@ let r = class extends V {
|
|
|
770
912
|
width: `${o}%`
|
|
771
913
|
};
|
|
772
914
|
}
|
|
773
|
-
setMultiValue(t,
|
|
774
|
-
this.multiInputMin.value = String(t), this.multiInputMax.value = String(
|
|
775
|
-
let
|
|
776
|
-
|
|
915
|
+
setMultiValue(t, e) {
|
|
916
|
+
this.multiInputMin.value = String(t), this.multiInputMax.value = String(e);
|
|
917
|
+
let i = Number.parseFloat(this.multiInputMin.value), a = Number.parseFloat(this.multiInputMax.value);
|
|
918
|
+
i = d(i, this.min, this.max), a = d(a, this.min, this.max), i > a && (this.thumbsCrossover === "swap" ? (this.multiDragTarget === "min" ? this.multiDragTarget = "max" : this.multiDragTarget === "max" && (this.multiDragTarget = "min"), [i, a] = [a, i]) : this.multiDragTarget === "min" ? i = this._multiValue.max : this.multiDragTarget === "max" ? a = this._multiValue.min : (i = Math.min(i, a), a = Math.max(i, a))), !(this._multiValue.min === i && this._multiValue.max === a) && (this._multiValue = { max: a, min: i });
|
|
777
919
|
}
|
|
778
920
|
updateNoOverlapConstraints() {
|
|
779
921
|
if (!this.noOverlap)
|
|
780
922
|
return;
|
|
781
|
-
const t = this.multiValueToPercent(this._multiValue.min),
|
|
923
|
+
const t = this.multiValueToPercent(this._multiValue.min), e = this.minThumbOffset, i = this.maxThumbOffset;
|
|
782
924
|
if (this.thumbsCrossover === "block") {
|
|
783
|
-
const a =
|
|
925
|
+
const a = X({
|
|
784
926
|
edgeMode: this.thumbEdgeMode,
|
|
785
|
-
maxOffset:
|
|
786
|
-
minOffset:
|
|
927
|
+
maxOffset: i,
|
|
928
|
+
minOffset: e,
|
|
787
929
|
percentValue: t
|
|
788
930
|
});
|
|
789
931
|
this.thumbConstraints = {
|
|
@@ -796,15 +938,15 @@ let r = class extends V {
|
|
|
796
938
|
min: { maxLeft: 100, minLeft: 0 }
|
|
797
939
|
};
|
|
798
940
|
}
|
|
799
|
-
initiateMultiThumbDrag(t,
|
|
800
|
-
if (this.disabled || (
|
|
941
|
+
initiateMultiThumbDrag(t, e) {
|
|
942
|
+
if (this.disabled || (e === "min" ? this.minThumbDisabled : this.maxThumbDisabled))
|
|
801
943
|
return;
|
|
802
|
-
t.preventDefault(), t.stopPropagation(), this.hasTooltip = !0, this.multiIsDragging = !0, this.multiDragTarget =
|
|
803
|
-
const
|
|
804
|
-
|
|
944
|
+
t.preventDefault(), t.stopPropagation(), this.hasTooltip = !0, this.multiIsDragging = !0, this.multiDragTarget = e === "min" ? "min" : "max", this.emit("cx-thumb-drag-start");
|
|
945
|
+
const r = this.multiContainer.getBoundingClientRect().width;
|
|
946
|
+
w(this, {
|
|
805
947
|
initialEvent: t,
|
|
806
|
-
onMove: (
|
|
807
|
-
const o = this.multiPositionToValue(
|
|
948
|
+
onMove: (n) => {
|
|
949
|
+
const o = this.multiPositionToValue(n, r);
|
|
808
950
|
this.multiDragTarget === "min" ? this.setMultiValue(o, this._multiValue.max) : this.setMultiValue(this._multiValue.min, o), this.handleInput();
|
|
809
951
|
},
|
|
810
952
|
onStop: () => {
|
|
@@ -816,13 +958,13 @@ let r = class extends V {
|
|
|
816
958
|
if (this.disabled || this.rangeSlideDisabled || this.minThumbDisabled && this.maxThumbDisabled)
|
|
817
959
|
return;
|
|
818
960
|
t.preventDefault(), t.stopPropagation(), this.multiIsDragging = !0, this.multiDragTarget = "range", this.multiRangeWidth = this._multiValue.max - this._multiValue.min, this.multiDragStartValue = { ...this._multiValue }, this.emit("cx-range-drag-start");
|
|
819
|
-
const
|
|
820
|
-
this.hasTooltip = !0,
|
|
961
|
+
const e = this.multiContainer.getBoundingClientRect(), i = e.width, a = t.clientX - e.left;
|
|
962
|
+
this.hasTooltip = !0, w(this, {
|
|
821
963
|
initialEvent: t,
|
|
822
|
-
onMove: (
|
|
823
|
-
const
|
|
824
|
-
let o = this.multiDragStartValue.min +
|
|
825
|
-
o < this.min && (o = this.min,
|
|
964
|
+
onMove: (r) => {
|
|
965
|
+
const n = this.multiPositionToValue(r, i) - this.multiPositionToValue(a, i);
|
|
966
|
+
let o = this.multiDragStartValue.min + n, h = this.multiDragStartValue.max + n;
|
|
967
|
+
o < this.min && (o = this.min, h = this.min + this.multiRangeWidth), h > this.max && (h = this.max, o = this.max - this.multiRangeWidth), this.minThumbDisabled && (o = this._multiValue.min, h = this._multiValue.min + this.multiRangeWidth), this.maxThumbDisabled && (h = this._multiValue.max, o = this._multiValue.max - this.multiRangeWidth), this.setMultiValue(o, h), this.handleInput();
|
|
826
968
|
},
|
|
827
969
|
onStop: () => {
|
|
828
970
|
this.multiIsDragging = !1, this.multiDragTarget = null, this.emit("cx-range-drag-end"), this.emit("cx-change"), this.hasTooltip = !1;
|
|
@@ -832,33 +974,33 @@ let r = class extends V {
|
|
|
832
974
|
handleMultiContainerClick(t) {
|
|
833
975
|
if (this.disabled)
|
|
834
976
|
return;
|
|
835
|
-
const
|
|
836
|
-
if (
|
|
977
|
+
const e = t.target;
|
|
978
|
+
if (e.classList.contains("range-slider__thumb") || e.classList.contains("range-slider__range") || this.minThumbDisabled && this.maxThumbDisabled)
|
|
837
979
|
return;
|
|
838
|
-
const
|
|
839
|
-
this.minThumbDisabled ?
|
|
980
|
+
const i = this.multiContainer.getBoundingClientRect(), a = i.width, r = t.clientX - i.left, n = this.multiPositionToValue(r, a), o = Math.abs(this._multiValue.min - n), h = Math.abs(this._multiValue.max - n);
|
|
981
|
+
this.minThumbDisabled ? n >= this._multiValue.min && this.setMultiValue(this._multiValue.min, n) : this.maxThumbDisabled ? n <= this._multiValue.max && this.setMultiValue(n, this._multiValue.max) : o <= h ? this.setMultiValue(n, this._multiValue.max) : this.setMultiValue(this._multiValue.min, n), this.emit("cx-change");
|
|
840
982
|
}
|
|
841
|
-
handleMultiKeyDown(t,
|
|
842
|
-
if (this.disabled || (
|
|
983
|
+
handleMultiKeyDown(t, e) {
|
|
984
|
+
if (this.disabled || (e === "min" ? this.minThumbDisabled : this.maxThumbDisabled))
|
|
843
985
|
return;
|
|
844
986
|
let a = !1;
|
|
845
987
|
switch (t.key) {
|
|
846
988
|
case "ArrowLeft":
|
|
847
989
|
case "ArrowDown": {
|
|
848
|
-
t.preventDefault(), a = this.stepDown(
|
|
990
|
+
t.preventDefault(), a = this.stepDown(e);
|
|
849
991
|
break;
|
|
850
992
|
}
|
|
851
993
|
case "ArrowRight":
|
|
852
994
|
case "ArrowUp": {
|
|
853
|
-
t.preventDefault(), a = this.stepUp(
|
|
995
|
+
t.preventDefault(), a = this.stepUp(e);
|
|
854
996
|
break;
|
|
855
997
|
}
|
|
856
998
|
case "Home": {
|
|
857
|
-
t.preventDefault(), a = !0, this.updateMultiThumbValue(
|
|
999
|
+
t.preventDefault(), a = !0, this.updateMultiThumbValue(e, this.min);
|
|
858
1000
|
break;
|
|
859
1001
|
}
|
|
860
1002
|
case "End": {
|
|
861
|
-
t.preventDefault(), a = !0, this.updateMultiThumbValue(
|
|
1003
|
+
t.preventDefault(), a = !0, this.updateMultiThumbValue(e, this.max);
|
|
862
1004
|
break;
|
|
863
1005
|
}
|
|
864
1006
|
}
|
|
@@ -871,15 +1013,15 @@ let r = class extends V {
|
|
|
871
1013
|
this.multi && (this.requestUpdate("value"), this.noOverlap && this.updateNoOverlapConstraints());
|
|
872
1014
|
}
|
|
873
1015
|
renderSingleRange() {
|
|
874
|
-
const t = this.hasSlotController.test("label"),
|
|
875
|
-
return
|
|
1016
|
+
const t = this.hasSlotController.test("label"), e = this.hasSlotController.test("help-text"), i = this.label ? !0 : !!t, a = this.helpText ? !0 : !!e;
|
|
1017
|
+
return M`
|
|
876
1018
|
<div
|
|
877
1019
|
part="form-control"
|
|
878
1020
|
class=${p({
|
|
879
1021
|
"form-control": !0,
|
|
880
1022
|
"form-control--has-help-text": a,
|
|
881
1023
|
// range only has one size
|
|
882
|
-
"form-control--has-label":
|
|
1024
|
+
"form-control--has-label": i,
|
|
883
1025
|
"form-control--medium": !0
|
|
884
1026
|
})}
|
|
885
1027
|
@focus=${this.focus}
|
|
@@ -891,7 +1033,7 @@ let r = class extends V {
|
|
|
891
1033
|
part="form-control-label"
|
|
892
1034
|
class="form-control__label"
|
|
893
1035
|
for="input"
|
|
894
|
-
aria-hidden=${
|
|
1036
|
+
aria-hidden=${i ? "false" : "true"}
|
|
895
1037
|
>
|
|
896
1038
|
<slot name="label">${this.label}</slot>
|
|
897
1039
|
</label>
|
|
@@ -915,14 +1057,14 @@ let r = class extends V {
|
|
|
915
1057
|
class="range__control"
|
|
916
1058
|
title=${this.title}
|
|
917
1059
|
type="range"
|
|
918
|
-
name=${
|
|
1060
|
+
name=${k(this.name)}
|
|
919
1061
|
?disabled=${this.disabled}
|
|
920
|
-
min=${
|
|
921
|
-
max=${
|
|
1062
|
+
min=${k(this.min)}
|
|
1063
|
+
max=${k(this.max)}
|
|
922
1064
|
step=${this.step || Number.MIN_VALUE}
|
|
923
|
-
.value=${
|
|
1065
|
+
.value=${W(this.value.toString())}
|
|
924
1066
|
aria-describedby="help-text"
|
|
925
|
-
aria-label=${
|
|
1067
|
+
aria-label=${k(this.ariaLabel)}
|
|
926
1068
|
@change=${this.handleChange}
|
|
927
1069
|
@focus=${this.handleFocus}
|
|
928
1070
|
@input=${this.handleInput}
|
|
@@ -950,14 +1092,7 @@ let r = class extends V {
|
|
|
950
1092
|
|
|
951
1093
|
<slot name="marks"> </slot>
|
|
952
1094
|
|
|
953
|
-
|
|
954
|
-
class="range__marks"
|
|
955
|
-
style=${c({
|
|
956
|
-
visibility: this.showMarks ? "visible" : "hidden"
|
|
957
|
-
})}
|
|
958
|
-
>
|
|
959
|
-
${this.renderMarks()}
|
|
960
|
-
</div>
|
|
1095
|
+
${this.markController.renderMarks()}
|
|
961
1096
|
</div>
|
|
962
1097
|
</div>
|
|
963
1098
|
|
|
@@ -973,20 +1108,20 @@ let r = class extends V {
|
|
|
973
1108
|
`;
|
|
974
1109
|
}
|
|
975
1110
|
renderMultiRange() {
|
|
976
|
-
const t = this.hasSlotController.test("label"),
|
|
1111
|
+
const t = this.hasSlotController.test("label"), e = this.hasSlotController.test("help-text"), i = this.label ? !0 : !!t, a = this.helpText ? !0 : e, r = this.getConstrainedPercent(
|
|
977
1112
|
"min"
|
|
978
1113
|
/* MIN */
|
|
979
|
-
),
|
|
1114
|
+
), n = this.getConstrainedPercent(
|
|
980
1115
|
"max"
|
|
981
1116
|
/* MAX */
|
|
982
1117
|
);
|
|
983
|
-
return
|
|
1118
|
+
return M`
|
|
984
1119
|
<div
|
|
985
1120
|
part="form-control"
|
|
986
1121
|
class=${p({
|
|
987
1122
|
"form-control": !0,
|
|
988
1123
|
"form-control--has-help-text": a,
|
|
989
|
-
"form-control--has-label":
|
|
1124
|
+
"form-control--has-label": i,
|
|
990
1125
|
"form-control--medium": !0
|
|
991
1126
|
})}
|
|
992
1127
|
@focus=${this.focus}
|
|
@@ -996,7 +1131,7 @@ let r = class extends V {
|
|
|
996
1131
|
part="form-control-label"
|
|
997
1132
|
class="form-control__label"
|
|
998
1133
|
for="input"
|
|
999
|
-
aria-hidden=${
|
|
1134
|
+
aria-hidden=${i ? "false" : "true"}
|
|
1000
1135
|
>
|
|
1001
1136
|
<slot name="label">${this.label}</slot>
|
|
1002
1137
|
</label>
|
|
@@ -1028,7 +1163,7 @@ let r = class extends V {
|
|
|
1028
1163
|
"range-slider--disabled": this.disabled,
|
|
1029
1164
|
"range-slider--dragging": this.multiIsDragging
|
|
1030
1165
|
})}
|
|
1031
|
-
style=${
|
|
1166
|
+
style=${f({
|
|
1032
1167
|
"--track-left-inset": `${this.trackLeftInset}%`,
|
|
1033
1168
|
"--track-right-inset": `${this.trackRightInset}%`
|
|
1034
1169
|
})}
|
|
@@ -1054,7 +1189,7 @@ let r = class extends V {
|
|
|
1054
1189
|
"range-slider__thumb--min": !0,
|
|
1055
1190
|
"range-slider__thumb--slotted": this.hasSlotController.test("thumb-min")
|
|
1056
1191
|
})}
|
|
1057
|
-
style=${
|
|
1192
|
+
style=${f(this.getMultiThumbStyle(
|
|
1058
1193
|
"min"
|
|
1059
1194
|
/* MIN */
|
|
1060
1195
|
))}
|
|
@@ -1095,7 +1230,7 @@ let r = class extends V {
|
|
|
1095
1230
|
"range-slider__thumb--max": !0,
|
|
1096
1231
|
"range-slider__thumb--slotted": this.hasSlotController.test("thumb-max")
|
|
1097
1232
|
})}
|
|
1098
|
-
style=${
|
|
1233
|
+
style=${f(this.getMultiThumbStyle(
|
|
1099
1234
|
"max"
|
|
1100
1235
|
/* MAX */
|
|
1101
1236
|
))}
|
|
@@ -1124,7 +1259,7 @@ let r = class extends V {
|
|
|
1124
1259
|
"range-slider__range--active": this.multiDragTarget === "range"
|
|
1125
1260
|
/* RANGE */
|
|
1126
1261
|
})}
|
|
1127
|
-
style=${
|
|
1262
|
+
style=${f(this.getRangeBarStyle(r, n))}
|
|
1128
1263
|
?data-active=${this.multiDragTarget === "range"}
|
|
1129
1264
|
@pointerdown=${this.initiateMultiRangeDrag}
|
|
1130
1265
|
></div>
|
|
@@ -1146,78 +1281,79 @@ let r = class extends V {
|
|
|
1146
1281
|
return this.multi ? this.renderMultiRange() : this.renderSingleRange();
|
|
1147
1282
|
}
|
|
1148
1283
|
};
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1284
|
+
s.styles = [
|
|
1285
|
+
U,
|
|
1286
|
+
O,
|
|
1287
|
+
ot
|
|
1153
1288
|
];
|
|
1154
|
-
|
|
1155
|
-
"cx-
|
|
1289
|
+
s.dependencies = {
|
|
1290
|
+
"cx-resize-observer": R,
|
|
1291
|
+
"cx-tooltip": H
|
|
1156
1292
|
};
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
],
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
],
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
],
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
],
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
],
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
],
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
],
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
],
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
],
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
],
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
],
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
],
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
],
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
],
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
],
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
],
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
],
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
],
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
],
|
|
1214
|
-
|
|
1215
|
-
|
|
1293
|
+
l([
|
|
1294
|
+
c(".range__control")
|
|
1295
|
+
], s.prototype, "input", 2);
|
|
1296
|
+
l([
|
|
1297
|
+
c(".range-slider__input--min")
|
|
1298
|
+
], s.prototype, "multiInputMin", 2);
|
|
1299
|
+
l([
|
|
1300
|
+
c(".range-slider__input--max")
|
|
1301
|
+
], s.prototype, "multiInputMax", 2);
|
|
1302
|
+
l([
|
|
1303
|
+
c(".range__tooltip")
|
|
1304
|
+
], s.prototype, "output", 2);
|
|
1305
|
+
l([
|
|
1306
|
+
c(".range__tooltip--min")
|
|
1307
|
+
], s.prototype, "minTooltip", 2);
|
|
1308
|
+
l([
|
|
1309
|
+
c(".range__tooltip--max")
|
|
1310
|
+
], s.prototype, "maxTooltip", 2);
|
|
1311
|
+
l([
|
|
1312
|
+
c(".range-slider__thumb--min")
|
|
1313
|
+
], s.prototype, "minThumb", 2);
|
|
1314
|
+
l([
|
|
1315
|
+
c(".range-slider__thumb--max")
|
|
1316
|
+
], s.prototype, "maxThumb", 2);
|
|
1317
|
+
l([
|
|
1318
|
+
c(".range")
|
|
1319
|
+
], s.prototype, "range", 2);
|
|
1320
|
+
l([
|
|
1321
|
+
c(".range-slider")
|
|
1322
|
+
], s.prototype, "multiContainer", 2);
|
|
1323
|
+
l([
|
|
1324
|
+
g()
|
|
1325
|
+
], s.prototype, "hasFocus", 2);
|
|
1326
|
+
l([
|
|
1327
|
+
g()
|
|
1328
|
+
], s.prototype, "hasTooltip", 2);
|
|
1329
|
+
l([
|
|
1330
|
+
g()
|
|
1331
|
+
], s.prototype, "_multiValue", 2);
|
|
1332
|
+
l([
|
|
1333
|
+
g()
|
|
1334
|
+
], s.prototype, "_singleValue", 2);
|
|
1335
|
+
l([
|
|
1336
|
+
g()
|
|
1337
|
+
], s.prototype, "multiDragTarget", 2);
|
|
1338
|
+
l([
|
|
1339
|
+
g()
|
|
1340
|
+
], s.prototype, "multiIsDragging", 2);
|
|
1341
|
+
l([
|
|
1342
|
+
u()
|
|
1343
|
+
], s.prototype, "state", 2);
|
|
1344
|
+
l([
|
|
1345
|
+
u()
|
|
1346
|
+
], s.prototype, "title", 2);
|
|
1347
|
+
l([
|
|
1348
|
+
u()
|
|
1349
|
+
], s.prototype, "name", 2);
|
|
1350
|
+
l([
|
|
1351
|
+
u({
|
|
1216
1352
|
converter: {
|
|
1217
1353
|
fromAttribute: (t) => {
|
|
1218
1354
|
if (t.includes(" ")) {
|
|
1219
|
-
const
|
|
1220
|
-
return [
|
|
1355
|
+
const e = t.split(" ").map((i) => Number.parseFloat(i.trim()));
|
|
1356
|
+
return [e[0] ?? 0, e[1] ?? 0];
|
|
1221
1357
|
}
|
|
1222
1358
|
return Number.parseFloat(t) || 0;
|
|
1223
1359
|
},
|
|
@@ -1225,109 +1361,112 @@ s([
|
|
|
1225
1361
|
},
|
|
1226
1362
|
reflect: !0
|
|
1227
1363
|
})
|
|
1228
|
-
],
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
],
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
],
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
],
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
],
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
],
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
],
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
],
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
],
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
],
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
],
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
],
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
],
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
],
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
],
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
],
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
],
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
],
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
],
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
],
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
],
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
],
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
],
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
],
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
],
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
],
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
],
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
],
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
],
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
],
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
],
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
],
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
],
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
],
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
],
|
|
1364
|
+
], s.prototype, "value", 1);
|
|
1365
|
+
l([
|
|
1366
|
+
u({ reflect: !0, type: Boolean })
|
|
1367
|
+
], s.prototype, "multi", 2);
|
|
1368
|
+
l([
|
|
1369
|
+
u()
|
|
1370
|
+
], s.prototype, "label", 2);
|
|
1371
|
+
l([
|
|
1372
|
+
u({ attribute: "help-text" })
|
|
1373
|
+
], s.prototype, "helpText", 2);
|
|
1374
|
+
l([
|
|
1375
|
+
u({ reflect: !0, type: Boolean })
|
|
1376
|
+
], s.prototype, "disabled", 2);
|
|
1377
|
+
l([
|
|
1378
|
+
u({ type: Number })
|
|
1379
|
+
], s.prototype, "min", 2);
|
|
1380
|
+
l([
|
|
1381
|
+
u({ type: Number })
|
|
1382
|
+
], s.prototype, "max", 2);
|
|
1383
|
+
l([
|
|
1384
|
+
u({ reflect: !0, type: Number })
|
|
1385
|
+
], s.prototype, "step", 2);
|
|
1386
|
+
l([
|
|
1387
|
+
u({ attribute: "mark-label-spacing", type: Number })
|
|
1388
|
+
], s.prototype, "markLabelSpacing", 2);
|
|
1389
|
+
l([
|
|
1390
|
+
u({ attribute: "tooltip-placement" })
|
|
1391
|
+
], s.prototype, "tooltipPlacement", 2);
|
|
1392
|
+
l([
|
|
1393
|
+
u({ attribute: "tooltip-display" })
|
|
1394
|
+
], s.prototype, "tooltipDisplay", 2);
|
|
1395
|
+
l([
|
|
1396
|
+
u({ attribute: "tooltip-hoist", type: Boolean })
|
|
1397
|
+
], s.prototype, "tooltipHoist", 2);
|
|
1398
|
+
l([
|
|
1399
|
+
u({ attribute: "tooltip-formatter" })
|
|
1400
|
+
], s.prototype, "tooltipFormatter", 2);
|
|
1401
|
+
l([
|
|
1402
|
+
u()
|
|
1403
|
+
], s.prototype, "form", 2);
|
|
1404
|
+
l([
|
|
1405
|
+
u({ attribute: "snap-threshold", type: Number })
|
|
1406
|
+
], s.prototype, "snapThreshold", 2);
|
|
1407
|
+
l([
|
|
1408
|
+
u({ attribute: "show-marks", type: Boolean })
|
|
1409
|
+
], s.prototype, "showMarks", 2);
|
|
1410
|
+
l([
|
|
1411
|
+
u({ attribute: "tooltip-offset", type: Number })
|
|
1412
|
+
], s.prototype, "tooltipOffset", 2);
|
|
1413
|
+
l([
|
|
1414
|
+
u({ attribute: "min-thumb-disabled", reflect: !0, type: Boolean })
|
|
1415
|
+
], s.prototype, "minThumbDisabled", 2);
|
|
1416
|
+
l([
|
|
1417
|
+
u({ attribute: "max-thumb-disabled", reflect: !0, type: Boolean })
|
|
1418
|
+
], s.prototype, "maxThumbDisabled", 2);
|
|
1419
|
+
l([
|
|
1420
|
+
u({ attribute: "range-slide-disabled", type: Boolean })
|
|
1421
|
+
], s.prototype, "rangeSlideDisabled", 2);
|
|
1422
|
+
l([
|
|
1423
|
+
u({ attribute: "thumbs-crossover" })
|
|
1424
|
+
], s.prototype, "thumbsCrossover", 2);
|
|
1425
|
+
l([
|
|
1426
|
+
u({ attribute: "aria-label-lower" })
|
|
1427
|
+
], s.prototype, "ariaLabelLower", 2);
|
|
1428
|
+
l([
|
|
1429
|
+
u({ attribute: "aria-label-upper" })
|
|
1430
|
+
], s.prototype, "ariaLabelUpper", 2);
|
|
1431
|
+
l([
|
|
1432
|
+
u({ attribute: "no-overlap", reflect: !0, type: Boolean })
|
|
1433
|
+
], s.prototype, "noOverlap", 2);
|
|
1434
|
+
l([
|
|
1435
|
+
u({ attribute: "thumb-edge-mode" })
|
|
1436
|
+
], s.prototype, "thumbEdgeMode", 2);
|
|
1437
|
+
l([
|
|
1438
|
+
g()
|
|
1439
|
+
], s.prototype, "marks", 2);
|
|
1440
|
+
l([
|
|
1441
|
+
N()
|
|
1442
|
+
], s.prototype, "defaultValue", 2);
|
|
1443
|
+
l([
|
|
1444
|
+
v(["min", "max", "step"])
|
|
1445
|
+
], s.prototype, "initMarks", 1);
|
|
1446
|
+
l([
|
|
1447
|
+
E({ passive: !0 })
|
|
1448
|
+
], s.prototype, "handleThumbDragStart", 1);
|
|
1449
|
+
l([
|
|
1450
|
+
v("value", { waitUntilFirstUpdate: !0 })
|
|
1451
|
+
], s.prototype, "handleValueChange", 1);
|
|
1452
|
+
l([
|
|
1453
|
+
v("disabled", { waitUntilFirstUpdate: !0 })
|
|
1454
|
+
], s.prototype, "handleDisabledChange", 1);
|
|
1455
|
+
l([
|
|
1456
|
+
v("hasTooltip", { waitUntilFirstUpdate: !0 })
|
|
1457
|
+
], s.prototype, "syncRange", 1);
|
|
1458
|
+
l([
|
|
1459
|
+
$(100)
|
|
1460
|
+
], s.prototype, "handleMultiResize", 1);
|
|
1461
|
+
l([
|
|
1462
|
+
v(["min", "max", "step"], { waitUntilFirstUpdate: !0 })
|
|
1463
|
+
], s.prototype, "handleConstraintsChange", 1);
|
|
1464
|
+
l([
|
|
1465
|
+
v("_multiValue", { waitUntilFirstUpdate: !0 })
|
|
1466
|
+
], s.prototype, "handleMultiValueChange", 1);
|
|
1467
|
+
s = l([
|
|
1468
|
+
F("cx-range")
|
|
1469
|
+
], s);
|
|
1331
1470
|
export {
|
|
1332
|
-
|
|
1471
|
+
s as default
|
|
1333
1472
|
};
|