@unoff/ui 1.21.1 → 1.21.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/assets/Bar.css +1 -1
- package/dist/assets/FormItem.css +1 -1
- package/dist/assets/MultipleSlider.css +1 -1
- package/dist/assets/SimpleSlider.css +1 -1
- package/dist/assets/styles/icons/icons.css +1 -1
- package/dist/assets/styles/icons/styles/figma.css +1 -1
- package/dist/assets/styles/icons/styles/framer.css +1 -1
- package/dist/assets/styles/icons/styles/penpot.css +1 -1
- package/dist/assets/styles/icons/styles/sketch.css +1 -1
- package/dist/components/actions/accordion/Accordion.d.ts +0 -1
- package/dist/components/actions/accordion/Accordion.d.ts.map +1 -1
- package/dist/components/actions/button/Button.d.ts +2 -3
- package/dist/components/actions/button/Button.d.ts.map +1 -1
- package/dist/components/actions/button/Button.js.map +1 -1
- package/dist/components/actions/card/Card.d.ts +0 -1
- package/dist/components/actions/card/Card.d.ts.map +1 -1
- package/dist/components/actions/knob/Knob.d.ts +2 -3
- package/dist/components/actions/knob/Knob.d.ts.map +1 -1
- package/dist/components/actions/knob/Knob.js.map +1 -1
- package/dist/components/actions/menu/Menu.d.ts +2 -3
- package/dist/components/actions/menu/Menu.d.ts.map +1 -1
- package/dist/components/actions/menu/Menu.js.map +1 -1
- package/dist/components/assets/avatar/Avatar.d.ts +0 -1
- package/dist/components/assets/avatar/Avatar.d.ts.map +1 -1
- package/dist/components/assets/icon/Icon.d.ts +0 -1
- package/dist/components/assets/icon/Icon.d.ts.map +1 -1
- package/dist/components/assets/section-title/SectionTitle.d.ts +0 -1
- package/dist/components/assets/section-title/SectionTitle.d.ts.map +1 -1
- package/dist/components/assets/text/Text.d.ts +0 -1
- package/dist/components/assets/text/Text.d.ts.map +1 -1
- package/dist/components/assets/thumbnail/Thumbnail.d.ts +0 -1
- package/dist/components/assets/thumbnail/Thumbnail.d.ts.map +1 -1
- package/dist/components/dialogs/consent/Consent.d.ts +2 -3
- package/dist/components/dialogs/consent/Consent.d.ts.map +1 -1
- package/dist/components/dialogs/consent/Consent.js.map +1 -1
- package/dist/components/dialogs/dialog/Dialog.d.ts +0 -1
- package/dist/components/dialogs/dialog/Dialog.d.ts.map +1 -1
- package/dist/components/dialogs/message/Message.d.ts +0 -1
- package/dist/components/dialogs/notification/Notification.d.ts +0 -1
- package/dist/components/dialogs/notification/Notification.d.ts.map +1 -1
- package/dist/components/dialogs/semantic-message/SemanticMessage.d.ts +2 -3
- package/dist/components/dialogs/semantic-message/SemanticMessage.d.ts.map +1 -1
- package/dist/components/dialogs/semantic-message/SemanticMessage.js.map +1 -1
- package/dist/components/inputs/dropdown/Dropdown.d.ts +2 -3
- package/dist/components/inputs/dropdown/Dropdown.d.ts.map +1 -1
- package/dist/components/inputs/dropdown/Dropdown.js.map +1 -1
- package/dist/components/inputs/dropzone/Dropzone.d.ts +2 -3
- package/dist/components/inputs/dropzone/Dropzone.d.ts.map +1 -1
- package/dist/components/inputs/dropzone/Dropzone.js.map +1 -1
- package/dist/components/inputs/input/Input.d.ts +2 -3
- package/dist/components/inputs/input/Input.d.ts.map +1 -1
- package/dist/components/inputs/input/Input.js.map +1 -1
- package/dist/components/inputs/inputs-bar/InputsBar.d.ts +0 -1
- package/dist/components/inputs/inputs-bar/InputsBar.d.ts.map +1 -1
- package/dist/components/inputs/multiple-slider/MultipleSlider.d.ts +15 -8
- package/dist/components/inputs/multiple-slider/MultipleSlider.d.ts.map +1 -1
- package/dist/components/inputs/multiple-slider/MultipleSlider.js +270 -241
- package/dist/components/inputs/multiple-slider/MultipleSlider.js.map +1 -1
- package/dist/components/inputs/multiple-slider/actions/addStop.d.ts.map +1 -1
- package/dist/components/inputs/multiple-slider/actions/deleteStop.d.ts.map +1 -1
- package/dist/components/inputs/multiple-slider/actions/shiftLeftStop.d.ts.map +1 -1
- package/dist/components/inputs/multiple-slider/actions/shiftRightStop.d.ts.map +1 -1
- package/dist/components/inputs/select/Select.d.ts +3 -4
- package/dist/components/inputs/select/Select.d.ts.map +1 -1
- package/dist/components/inputs/select/Select.js.map +1 -1
- package/dist/components/inputs/simple-slider/SimpleSlider.d.ts +14 -4
- package/dist/components/inputs/simple-slider/SimpleSlider.d.ts.map +1 -1
- package/dist/components/inputs/simple-slider/SimpleSlider.js +94 -74
- package/dist/components/inputs/simple-slider/SimpleSlider.js.map +1 -1
- package/dist/components/lists/actions-item/ActionsItem.d.ts +0 -1
- package/dist/components/lists/actions-list/ActionsList.d.ts +4 -5
- package/dist/components/lists/actions-list/ActionsList.d.ts.map +1 -1
- package/dist/components/lists/actions-list/ActionsList.js.map +1 -1
- package/dist/components/lists/color-item/ColorItem.d.ts +0 -1
- package/dist/components/lists/color-item/ColorItem.d.ts.map +1 -1
- package/dist/components/lists/draggable-item/DraggableItem.d.ts +2 -3
- package/dist/components/lists/draggable-item/DraggableItem.d.ts.map +1 -1
- package/dist/components/lists/draggable-item/DraggableItem.js.map +1 -1
- package/dist/components/lists/keyboard-shortcut-item/KeyboardShortcutItem.d.ts +0 -1
- package/dist/components/lists/keyboard-shortcut-item/KeyboardShortcutItem.d.ts.map +1 -1
- package/dist/components/lists/members-list/MembersList.d.ts +0 -1
- package/dist/components/lists/sortable-list/SortableList.d.ts +2 -3
- package/dist/components/lists/sortable-list/SortableList.d.ts.map +1 -1
- package/dist/components/lists/sortable-list/SortableList.js.map +1 -1
- package/dist/components/lists/tabs/Tabs.d.ts +0 -1
- package/dist/components/lists/tabs/Tabs.d.ts.map +1 -1
- package/dist/components/slots/bar/Bar.d.ts +6 -2
- package/dist/components/slots/bar/Bar.d.ts.map +1 -1
- package/dist/components/slots/bar/Bar.js +21 -18
- package/dist/components/slots/bar/Bar.js.map +1 -1
- package/dist/components/slots/draggable-window/DraggableWindow.d.ts +0 -1
- package/dist/components/slots/draggable-window/DraggableWindow.d.ts.map +1 -1
- package/dist/components/slots/drawer/Drawer.d.ts +1 -2
- package/dist/components/slots/drawer/Drawer.d.ts.map +1 -1
- package/dist/components/slots/form-item/FormItem.d.ts +0 -1
- package/dist/components/slots/form-item/FormItem.d.ts.map +1 -1
- package/dist/components/slots/layout/Layout.d.ts +0 -1
- package/dist/components/slots/layout/Layout.d.ts.map +1 -1
- package/dist/components/slots/list/List.d.ts +0 -1
- package/dist/components/slots/list/List.d.ts.map +1 -1
- package/dist/components/slots/popin/Popin.d.ts +0 -1
- package/dist/components/slots/popin/Popin.d.ts.map +1 -1
- package/dist/components/slots/section/Section.d.ts +1 -2
- package/dist/components/slots/section/Section.d.ts.map +1 -1
- package/dist/components/slots/simple-item/SimpleItem.d.ts +0 -1
- package/dist/components/tags/chip/Chip.d.ts +0 -1
- package/dist/components/tags/chip/Chip.d.ts.map +1 -1
- package/dist/components/tags/color-chip/ColorChip.d.ts +2 -3
- package/dist/components/tags/color-chip/ColorChip.d.ts.map +1 -1
- package/dist/components/tags/color-chip/ColorChip.js.map +1 -1
- package/dist/components/tags/icon-chip/IconChip.d.ts +2 -3
- package/dist/components/tags/icon-chip/IconChip.d.ts.map +1 -1
- package/dist/components/tags/icon-chip/IconChip.js.map +1 -1
- package/dist/components/tags/tooltip/Tooltip.d.ts +0 -1
- package/dist/components/tags/tooltip/Tooltip.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/styles/icons/icons.module.js +114 -110
- package/dist/styles/icons/icons.module.js.map +1 -1
- package/dist/tests/setup.d.ts +0 -1
- package/dist/types/consent.types.d.ts +0 -1
- package/dist/types/consent.types.d.ts.map +1 -1
- package/dist/types/icon.types.d.ts +2 -1
- package/dist/types/icon.types.d.ts.map +1 -1
- package/dist/types/icon.types.js +114 -1
- package/dist/types/icon.types.js.map +1 -1
- package/dist/types/list.types.d.ts +0 -1
- package/package.json +18 -15
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import '../../../assets/MultipleSlider.css';
|
|
2
|
-
import {
|
|
2
|
+
import { jsx as m, jsxs as y } from "react/jsx-runtime";
|
|
3
3
|
import T from "react";
|
|
4
4
|
import { r as f } from "../../../do-map-2nhWP1KI.js";
|
|
5
|
-
import { t as
|
|
5
|
+
import { t as I } from "../../../do-classnames-DSDFCvzy.js";
|
|
6
6
|
import w from "../../tags/icon-chip/IconChip.js";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
const
|
|
7
|
+
import A from "../../tags/chip/Chip.js";
|
|
8
|
+
import E from "../../actions/knob/Knob.js";
|
|
9
|
+
const F = (h, e, a, o = "LINEAR") => {
|
|
10
10
|
let t = 1;
|
|
11
|
-
const
|
|
11
|
+
const c = {};
|
|
12
12
|
return h.map((r) => {
|
|
13
|
-
|
|
14
|
-
}),
|
|
15
|
-
},
|
|
16
|
-
var
|
|
17
|
-
const
|
|
13
|
+
c[r] = o !== "NONE" ? parseFloat(f(D(o, t), 0, 1, e, a).toFixed(1)) : r, t -= 1 / (h.length - 1), t < 0.01 && (t = 0);
|
|
14
|
+
}), c;
|
|
15
|
+
}, D = (h, e) => {
|
|
16
|
+
var a;
|
|
17
|
+
const o = {
|
|
18
18
|
LINEAR: (t) => t,
|
|
19
19
|
EASEIN_SINE: (t) => Math.pow(t, 1.2),
|
|
20
20
|
EASEOUT_SINE: (t) => 1 - Math.pow(1 - t, 1.2),
|
|
@@ -26,74 +26,74 @@ const M = (h, e, i, l = "LINEAR") => {
|
|
|
26
26
|
EASEOUT_CUBIC: (t) => Math.sin(t * Math.PI / 2),
|
|
27
27
|
EASEINOUT_CUBIC: (t) => -(Math.cos(Math.PI * t) - 1) / 2
|
|
28
28
|
};
|
|
29
|
-
return (
|
|
30
|
-
}, _ = (h, e,
|
|
31
|
-
const r = [],
|
|
32
|
-
Object.entries(h).sort((
|
|
33
|
-
r.push(
|
|
29
|
+
return (a = o[h ?? "LINEAR"]) == null ? void 0 : a.call(o, e);
|
|
30
|
+
}, _ = (h, e, a, o, t, c = 1) => {
|
|
31
|
+
const r = [], n = a ? c * 10 : c;
|
|
32
|
+
Object.entries(h).sort((d, u) => d[1] - u[1]).forEach((d) => {
|
|
33
|
+
r.push(d[0]);
|
|
34
34
|
});
|
|
35
|
-
const
|
|
35
|
+
const i = r.indexOf(
|
|
36
36
|
e.dataset.id
|
|
37
|
-
),
|
|
38
|
-
return s +
|
|
39
|
-
scale:
|
|
37
|
+
), l = h, s = l[r[i]];
|
|
38
|
+
return s + n <= o ? l[r[i]] = o : s + n >= t ? l[r[i]] = t : l[r[i]] = l[r[i]] + n, {
|
|
39
|
+
scale: l
|
|
40
40
|
};
|
|
41
|
-
}, N = (h, e,
|
|
42
|
-
const r = [],
|
|
43
|
-
Object.entries(h).sort((
|
|
44
|
-
r.push(
|
|
41
|
+
}, N = (h, e, a, o, t, c = 1) => {
|
|
42
|
+
const r = [], n = a ? c * 10 : c;
|
|
43
|
+
Object.entries(h).sort((d, u) => d[1] - u[1]).forEach((d) => {
|
|
44
|
+
r.push(d[0]);
|
|
45
45
|
});
|
|
46
|
-
const
|
|
46
|
+
const i = r.indexOf(
|
|
47
47
|
e.dataset.id
|
|
48
|
-
),
|
|
49
|
-
return s -
|
|
50
|
-
scale:
|
|
48
|
+
), l = h, s = l[r[i]];
|
|
49
|
+
return s - n <= o ? l[r[i]] = o : s - n >= t ? l[r[i]] = t : l[r[i]] = l[r[i]] - n, {
|
|
50
|
+
scale: l
|
|
51
51
|
};
|
|
52
52
|
}, O = (h) => {
|
|
53
53
|
const e = Math.floor(Math.abs(h)).toString().length;
|
|
54
54
|
return Math.pow(10, e - 1);
|
|
55
55
|
}, L = (h, e) => {
|
|
56
|
-
const
|
|
57
|
-
index: parseFloat(
|
|
58
|
-
value:
|
|
59
|
-
})).filter((
|
|
60
|
-
(
|
|
61
|
-
), r =
|
|
62
|
-
(
|
|
63
|
-
const s = Math.max(1,
|
|
64
|
-
return
|
|
56
|
+
const a = Object.entries(h).map(([n, i]) => ({
|
|
57
|
+
index: parseFloat(n),
|
|
58
|
+
value: i
|
|
59
|
+
})).filter((n) => n.index > 0), o = Math.min(...a.map((n) => n.index)), t = O(o), c = a.filter(
|
|
60
|
+
(n) => n.index !== parseFloat(e.dataset.id)
|
|
61
|
+
), r = c.reduce(
|
|
62
|
+
(n, i, l) => {
|
|
63
|
+
const s = Math.max(1, l + 1) * t;
|
|
64
|
+
return n[s] = c[l].value, n;
|
|
65
65
|
},
|
|
66
66
|
{}
|
|
67
67
|
);
|
|
68
68
|
return {
|
|
69
69
|
scale: r,
|
|
70
|
-
stops: Object.keys(r).map((
|
|
70
|
+
stops: Object.keys(r).map((n) => parseFloat(n)),
|
|
71
71
|
min: Math.min(...Object.values(r)),
|
|
72
72
|
max: Math.max(...Object.values(r))
|
|
73
73
|
};
|
|
74
74
|
}, C = (h) => {
|
|
75
75
|
const e = Math.floor(Math.abs(h)).toString().length;
|
|
76
76
|
return Math.pow(10, e - 1);
|
|
77
|
-
}, K = (h, e,
|
|
78
|
-
const t = Object.entries(e).map(([s,
|
|
77
|
+
}, K = (h, e, a, o) => {
|
|
78
|
+
const t = Object.entries(e).map(([s, d]) => ({
|
|
79
79
|
index: Math.max(1, parseFloat(s)),
|
|
80
|
-
value:
|
|
81
|
-
})).filter((s) => s.index > 0),
|
|
82
|
-
f(h.layerX, 0,
|
|
80
|
+
value: d
|
|
81
|
+
})).filter((s) => s.index > 0), c = C(Math.min(...t.map((s) => s.index))), r = t[0].value > t[t.length - 1].value, n = h.target, i = parseFloat(
|
|
82
|
+
f(h.layerX, 0, n.offsetWidth, a, o).toFixed(1)
|
|
83
83
|
);
|
|
84
84
|
t.push({
|
|
85
|
-
index: Math.max(...t.map((s) => s.index)) +
|
|
86
|
-
value:
|
|
87
|
-
}), t.sort((s,
|
|
88
|
-
const
|
|
89
|
-
(s,
|
|
85
|
+
index: Math.max(...t.map((s) => s.index)) + c,
|
|
86
|
+
value: i
|
|
87
|
+
}), t.sort((s, d) => r ? d.value - s.value : s.value - d.value);
|
|
88
|
+
const l = t.reduce(
|
|
89
|
+
(s, d, u) => (s[(u + 1) * c] = d.value, s),
|
|
90
90
|
{}
|
|
91
91
|
);
|
|
92
92
|
return {
|
|
93
|
-
scale:
|
|
94
|
-
stops: Object.keys(
|
|
95
|
-
min: Math.min(...Object.values(
|
|
96
|
-
max: Math.max(...Object.values(
|
|
93
|
+
scale: l,
|
|
94
|
+
stops: Object.keys(l).map((s) => parseFloat(s)),
|
|
95
|
+
min: Math.min(...Object.values(l)),
|
|
96
|
+
max: Math.max(...Object.values(l))
|
|
97
97
|
};
|
|
98
98
|
};
|
|
99
99
|
class H extends T.Component {
|
|
@@ -104,10 +104,8 @@ class H extends T.Component {
|
|
|
104
104
|
min: 0,
|
|
105
105
|
max: 100
|
|
106
106
|
},
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
max: "white"
|
|
110
|
-
},
|
|
107
|
+
hasProgressBar: !1,
|
|
108
|
+
hasPadding: !0,
|
|
111
109
|
isBlocked: !1,
|
|
112
110
|
isNew: !1
|
|
113
111
|
};
|
|
@@ -118,186 +116,202 @@ class H extends T.Component {
|
|
|
118
116
|
};
|
|
119
117
|
}
|
|
120
118
|
// Handlers
|
|
121
|
-
validHandler = (e,
|
|
122
|
-
const { scale:
|
|
123
|
-
if (
|
|
124
|
-
let
|
|
125
|
-
|
|
119
|
+
validHandler = (e, a) => {
|
|
120
|
+
const { scale: o, onChange: t, range: c } = this.props, r = c.step || 0.1, n = o ?? {}, i = a.target;
|
|
121
|
+
if (i.value !== "") {
|
|
122
|
+
let l = parseFloat(i.value);
|
|
123
|
+
l = Math.round(l / r) * r, l > parseFloat(i.max) ? l = parseFloat(i.max) : l < parseFloat(i.min) && (l = parseFloat(i.min));
|
|
126
124
|
const s = r.toString().split(".")[1]?.length || 0;
|
|
127
|
-
|
|
128
|
-
scale:
|
|
125
|
+
n[e] = parseFloat(l.toFixed(s)), t("TYPED", {
|
|
126
|
+
scale: n
|
|
129
127
|
});
|
|
130
128
|
}
|
|
131
129
|
};
|
|
132
130
|
// Direct Actions
|
|
133
131
|
onGrab = (e) => {
|
|
134
132
|
e.stopPropagation();
|
|
135
|
-
const
|
|
133
|
+
const a = e.currentTarget, o = a.parentElement, t = e.clientX - e.currentTarget.getBoundingClientRect().left - e.currentTarget.getBoundingClientRect().width / 2, c = o.getBoundingClientRect(), r = c.width, n = o.parentElement, i = Array.from(
|
|
134
|
+
o.children
|
|
135
|
+
).filter((s) => s.dataset.id !== void 0);
|
|
136
136
|
this.setState({
|
|
137
|
-
activeKnobId:
|
|
137
|
+
activeKnobId: a.dataset.id || null
|
|
138
138
|
});
|
|
139
|
-
const
|
|
140
|
-
const { range:
|
|
141
|
-
|
|
142
|
-
(
|
|
139
|
+
const l = (s) => {
|
|
140
|
+
const { range: d, onChange: u } = this.props, p = {};
|
|
141
|
+
i.forEach(
|
|
142
|
+
(g) => p[g.dataset.id] = parseFloat(
|
|
143
143
|
f(
|
|
144
|
-
parseFloat(
|
|
144
|
+
parseFloat(g.style.left.replace("%", "")),
|
|
145
145
|
0,
|
|
146
146
|
100,
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
d.min,
|
|
148
|
+
d.max
|
|
149
149
|
).toFixed(1)
|
|
150
150
|
)
|
|
151
151
|
), u(s, {
|
|
152
|
-
scale:
|
|
152
|
+
scale: p
|
|
153
153
|
});
|
|
154
154
|
};
|
|
155
|
-
|
|
155
|
+
a.style.zIndex = "2", document.onmousemove = (s) => this.onSlide(
|
|
156
156
|
s,
|
|
157
|
-
a,
|
|
158
|
-
l,
|
|
159
157
|
n,
|
|
158
|
+
o,
|
|
160
159
|
i,
|
|
160
|
+
a,
|
|
161
161
|
t,
|
|
162
162
|
r,
|
|
163
|
-
|
|
164
|
-
(
|
|
165
|
-
), document.onmouseup = () => this.onRelease(
|
|
163
|
+
c,
|
|
164
|
+
(d) => l(d)
|
|
165
|
+
), document.onmouseup = () => this.onRelease(i, a, (s) => l(s));
|
|
166
166
|
};
|
|
167
|
-
onSlide = (e,
|
|
168
|
-
const { min: s, max:
|
|
169
|
-
let
|
|
170
|
-
if (
|
|
167
|
+
onSlide = (e, a, o, t, c, r, n, i, l) => {
|
|
168
|
+
const { min: s, max: d, step: u = 0.1 } = this.props.range;
|
|
169
|
+
let p = e.clientX - i.left - r;
|
|
170
|
+
if (p <= 0 ? p = 0 : p >= n && (p = n), c === o.firstChild && e.shiftKey)
|
|
171
171
|
return this.distributeStops(
|
|
172
172
|
"MIN",
|
|
173
|
-
parseFloat(f(
|
|
173
|
+
parseFloat(f(p, 0, n, s, d).toFixed(1)),
|
|
174
174
|
t
|
|
175
175
|
);
|
|
176
|
-
if (
|
|
176
|
+
if (c === o.lastChild && e.shiftKey)
|
|
177
177
|
return this.distributeStops(
|
|
178
178
|
"MAX",
|
|
179
|
-
parseFloat(f(
|
|
179
|
+
parseFloat(f(p, 0, n, s, d).toFixed(1)),
|
|
180
180
|
t
|
|
181
181
|
);
|
|
182
182
|
if (e.ctrlKey || e.metaKey)
|
|
183
|
-
if (
|
|
184
|
-
|
|
183
|
+
if (p < c.offsetLeft - o.firstChild.offsetLeft || p > n - o.lastChild.offsetLeft + c.offsetLeft)
|
|
184
|
+
p = c.offsetLeft;
|
|
185
185
|
else
|
|
186
186
|
return this.linkStops(
|
|
187
|
-
parseFloat(f(
|
|
188
|
-
|
|
187
|
+
parseFloat(f(p, 0, n, s, d).toFixed(1)),
|
|
188
|
+
c,
|
|
189
189
|
t
|
|
190
190
|
);
|
|
191
191
|
e.ctrlKey === !1 && e.metaKey === !1 && e.shiftKey === !1 && this.setState({
|
|
192
192
|
isTooltipDisplay: Array(t.length).fill(!1)
|
|
193
193
|
});
|
|
194
|
-
const
|
|
194
|
+
const g = f(p, 0, n, s, d), x = Math.round(g / u) * u, S = u.toString().split(".")[1]?.length || 0;
|
|
195
195
|
if (u >= 1) {
|
|
196
|
-
const
|
|
196
|
+
const v = parseFloat(
|
|
197
197
|
f(
|
|
198
|
-
parseFloat(
|
|
198
|
+
parseFloat(c.style.left.replace("%", "")),
|
|
199
199
|
0,
|
|
200
200
|
100,
|
|
201
201
|
s,
|
|
202
|
-
|
|
202
|
+
d
|
|
203
203
|
).toFixed(S)
|
|
204
|
-
), b = parseFloat(
|
|
205
|
-
if (
|
|
206
|
-
const
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
}),
|
|
204
|
+
), b = parseFloat(x.toFixed(S));
|
|
205
|
+
if (v !== b) {
|
|
206
|
+
const M = f(x, s, d, 0, 100);
|
|
207
|
+
c.style.left = M.toFixed(S) + "%", requestAnimationFrame(() => {
|
|
208
|
+
c.focus();
|
|
209
|
+
}), l("UPDATING");
|
|
210
210
|
}
|
|
211
211
|
} else {
|
|
212
|
-
const
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
}),
|
|
212
|
+
const v = f(x, s, d, 0, 100);
|
|
213
|
+
c.style.left = v.toFixed(S) + "%", requestAnimationFrame(() => {
|
|
214
|
+
c.focus();
|
|
215
|
+
}), l("UPDATING");
|
|
216
216
|
}
|
|
217
217
|
document.body.style.cursor = "ew-resize";
|
|
218
218
|
};
|
|
219
|
-
onRelease = (e,
|
|
220
|
-
document.onmousemove = null, document.onmouseup = null,
|
|
219
|
+
onRelease = (e, a, o) => {
|
|
220
|
+
document.onmousemove = null, document.onmouseup = null, a.onmouseup = null, a.style.zIndex = "1", this.setState({
|
|
221
221
|
activeKnobId: null
|
|
222
222
|
}), requestAnimationFrame(() => {
|
|
223
|
-
|
|
223
|
+
a.focus();
|
|
224
224
|
}), this.setState({
|
|
225
225
|
isTooltipDisplay: Array(e.length).fill(!1)
|
|
226
|
-
}),
|
|
226
|
+
}), o("RELEASED"), document.body.style.cursor = "";
|
|
227
227
|
};
|
|
228
228
|
onAdd = (e) => {
|
|
229
|
-
const { scale:
|
|
230
|
-
|
|
229
|
+
const { scale: a, onChange: o } = this.props, { min: t, max: c } = this.props.range, r = K(e.nativeEvent, a, t, c);
|
|
230
|
+
o("SHIFTED", r, "ADD_STOP");
|
|
231
231
|
};
|
|
232
232
|
onDelete = (e) => {
|
|
233
|
-
const { scale:
|
|
234
|
-
|
|
233
|
+
const { scale: a, onChange: o } = this.props, t = L(a, e);
|
|
234
|
+
o("SHIFTED", t, "DELETE_STOP");
|
|
235
235
|
};
|
|
236
|
-
onShiftRight = (e,
|
|
237
|
-
const { scale:
|
|
238
|
-
t("SHIFTED",
|
|
239
|
-
const
|
|
240
|
-
if (
|
|
241
|
-
const s =
|
|
236
|
+
onShiftRight = (e, a) => {
|
|
237
|
+
const { scale: o, onChange: t } = this.props, { min: c, max: r, step: n = 1 } = this.props.range, i = _(o, e, a, c, r, n);
|
|
238
|
+
t("SHIFTED", i), requestAnimationFrame(() => {
|
|
239
|
+
const l = e.closest(".multiple-slider__range");
|
|
240
|
+
if (l) {
|
|
241
|
+
const s = l.querySelector(
|
|
242
242
|
`[data-id="${e.dataset.id}"]`
|
|
243
243
|
);
|
|
244
244
|
s instanceof HTMLElement && s.focus();
|
|
245
245
|
}
|
|
246
246
|
});
|
|
247
247
|
};
|
|
248
|
-
onShiftLeft = (e,
|
|
249
|
-
const { scale:
|
|
250
|
-
t("SHIFTED",
|
|
251
|
-
const
|
|
252
|
-
if (
|
|
253
|
-
const s =
|
|
248
|
+
onShiftLeft = (e, a) => {
|
|
249
|
+
const { scale: o, onChange: t } = this.props, { min: c, max: r, step: n = 1 } = this.props.range, i = N(o, e, a, c, r, n);
|
|
250
|
+
t("SHIFTED", i), requestAnimationFrame(() => {
|
|
251
|
+
const l = e.closest(".multiple-slider__range");
|
|
252
|
+
if (l) {
|
|
253
|
+
const s = l.querySelector(
|
|
254
254
|
`[data-id="${e.dataset.id}"]`
|
|
255
255
|
);
|
|
256
256
|
s instanceof HTMLElement && s.focus();
|
|
257
257
|
}
|
|
258
258
|
});
|
|
259
259
|
};
|
|
260
|
-
distributeStops = (e,
|
|
261
|
-
const { scale: t, distributionEasing:
|
|
260
|
+
distributeStops = (e, a, o) => {
|
|
261
|
+
const { scale: t, distributionEasing: c, onChange: r, range: n } = this.props, { min: i, max: l, step: s = 0.1 } = n, d = Math.round(a / s) * s, u = s.toString().split(".")[1]?.length || 0;
|
|
262
262
|
e === "MIN" ? r("UPDATING", {
|
|
263
|
-
scale:
|
|
264
|
-
Object.entries(t).sort((
|
|
265
|
-
parseFloat(
|
|
266
|
-
Math.max(...Object.values(t)) ??
|
|
267
|
-
|
|
263
|
+
scale: F(
|
|
264
|
+
Object.entries(t).sort((p, g) => g[1] - p[1]).map((p) => parseFloat(p[0])),
|
|
265
|
+
parseFloat(d.toFixed(u)),
|
|
266
|
+
Math.max(...Object.values(t)) ?? l,
|
|
267
|
+
c
|
|
268
268
|
)
|
|
269
269
|
}) : e === "MAX" && r("UPDATING", {
|
|
270
|
-
scale:
|
|
271
|
-
Object.entries(t).sort((
|
|
272
|
-
Math.min(...Object.values(t)) ??
|
|
273
|
-
parseFloat(
|
|
274
|
-
|
|
270
|
+
scale: F(
|
|
271
|
+
Object.entries(t).sort((p, g) => g[1] - p[1]).map((p) => parseFloat(p[0])),
|
|
272
|
+
Math.min(...Object.values(t)) ?? i,
|
|
273
|
+
parseFloat(d.toFixed(u)),
|
|
274
|
+
c
|
|
275
275
|
)
|
|
276
276
|
}), this.setState({
|
|
277
|
-
isTooltipDisplay: Array(
|
|
277
|
+
isTooltipDisplay: Array(o.length).fill(!0)
|
|
278
278
|
}), document.body.style.cursor = "ew-resize";
|
|
279
279
|
};
|
|
280
|
-
linkStops = (e,
|
|
281
|
-
const { scale: t, onChange:
|
|
282
|
-
|
|
283
|
-
const u =
|
|
284
|
-
|
|
285
|
-
|
|
280
|
+
linkStops = (e, a, o) => {
|
|
281
|
+
const { scale: t, onChange: c, range: r } = this.props, { step: n = 0.1 } = r, i = t, l = Math.round(e / n) * n, s = n.toString().split(".")[1]?.length || 0;
|
|
282
|
+
o.filter((d) => d !== a).forEach((d) => {
|
|
283
|
+
const u = i[d.dataset.id] - i[a.dataset.id] + l, p = Math.round(u / n) * n;
|
|
284
|
+
i[d.dataset.id] = parseFloat(
|
|
285
|
+
p.toFixed(s)
|
|
286
286
|
);
|
|
287
|
-
}),
|
|
288
|
-
|
|
287
|
+
}), i[a.dataset.id] = parseFloat(
|
|
288
|
+
l.toFixed(s)
|
|
289
289
|
), this.setState({
|
|
290
|
-
isTooltipDisplay:
|
|
291
|
-
}),
|
|
292
|
-
scale:
|
|
290
|
+
isTooltipDisplay: Array(o.length).fill(!0)
|
|
291
|
+
}), c("UPDATING", {
|
|
292
|
+
scale: i
|
|
293
293
|
}), document.body.style.cursor = "ew-resize";
|
|
294
294
|
};
|
|
295
295
|
// Templates
|
|
296
|
+
Progress = () => {
|
|
297
|
+
const { scale: e, range: a, hasProgressBar: o } = this.props;
|
|
298
|
+
if (!o) return null;
|
|
299
|
+
const t = Object.values(e).sort((n, i) => n - i);
|
|
300
|
+
if (t.length < 2) return null;
|
|
301
|
+
const c = f(t[0], a.min, a.max, 0, 100), r = f(t[t.length - 1], a.min, a.max, 0, 100);
|
|
302
|
+
return /* @__PURE__ */ m(
|
|
303
|
+
"div",
|
|
304
|
+
{
|
|
305
|
+
className: "multiple-slider__progress",
|
|
306
|
+
style: { left: `${c}%`, width: `${r - c}%` }
|
|
307
|
+
}
|
|
308
|
+
);
|
|
309
|
+
};
|
|
296
310
|
Status = () => {
|
|
297
|
-
const { warning: e, isBlocked:
|
|
298
|
-
if (e ||
|
|
299
|
-
return /* @__PURE__ */
|
|
300
|
-
e !== void 0 && /* @__PURE__ */
|
|
311
|
+
const { warning: e, isBlocked: a, isNew: o } = this.props;
|
|
312
|
+
if (e || a || o)
|
|
313
|
+
return /* @__PURE__ */ y("div", { className: "multiple-slider__status", children: [
|
|
314
|
+
e !== void 0 && /* @__PURE__ */ m(
|
|
301
315
|
w,
|
|
302
316
|
{
|
|
303
317
|
iconType: "PICTO",
|
|
@@ -307,127 +321,142 @@ class H extends T.Component {
|
|
|
307
321
|
type: e.type
|
|
308
322
|
}
|
|
309
323
|
),
|
|
310
|
-
(
|
|
311
|
-
|
|
324
|
+
(a || o) && /* @__PURE__ */ m(
|
|
325
|
+
A,
|
|
312
326
|
{
|
|
313
327
|
isSolo: !0,
|
|
314
|
-
action:
|
|
315
|
-
children:
|
|
328
|
+
action: a ? this.props.onUnblock : void 0,
|
|
329
|
+
children: o ? "New" : "Pro"
|
|
316
330
|
}
|
|
317
331
|
)
|
|
318
332
|
] });
|
|
319
333
|
};
|
|
320
334
|
Edit = () => {
|
|
321
|
-
const { scale: e, range:
|
|
322
|
-
return /* @__PURE__ */
|
|
335
|
+
const { scale: e, range: a, colors: o, tips: t, isBlocked: c } = this.props, { isTooltipDisplay: r } = this.state;
|
|
336
|
+
return /* @__PURE__ */ y(
|
|
323
337
|
"div",
|
|
324
338
|
{
|
|
325
|
-
className:
|
|
339
|
+
className: I([
|
|
326
340
|
"multiple-slider__range",
|
|
327
|
-
|
|
341
|
+
c && "multiple-slider__range--blocked"
|
|
328
342
|
]),
|
|
329
343
|
style: {
|
|
330
|
-
background: `linear-gradient(90deg, ${
|
|
344
|
+
background: o !== void 0 ? `linear-gradient(90deg, ${o.min}, ${o.max})` : void 0
|
|
331
345
|
},
|
|
332
346
|
role: "presentation",
|
|
333
|
-
children:
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
347
|
+
children: [
|
|
348
|
+
/* @__PURE__ */ m(this.Progress, {}),
|
|
349
|
+
Object.entries(e).sort((n, i) => n[1] - i[1]).map((n, i, l) => /* @__PURE__ */ m(
|
|
350
|
+
E,
|
|
351
|
+
{
|
|
352
|
+
id: n[0],
|
|
353
|
+
shortId: n[0],
|
|
354
|
+
value: n[1],
|
|
355
|
+
offset: f(n[1], a.min, a.max, 0, 100),
|
|
356
|
+
min: a.min.toString(),
|
|
357
|
+
max: a.max.toString(),
|
|
358
|
+
helper: i === 0 || i === l.length - 1 ? {
|
|
359
|
+
label: t.minMax,
|
|
360
|
+
type: "MULTI_LINE"
|
|
361
|
+
} : void 0,
|
|
362
|
+
canBeTyped: !0,
|
|
363
|
+
isDisplayed: r[i],
|
|
364
|
+
isBlocked: c,
|
|
365
|
+
style: {
|
|
366
|
+
pointerEvents: this.state.activeKnobId && this.state.activeKnobId !== n[0] || c ? "none" : "auto"
|
|
367
|
+
},
|
|
368
|
+
onShiftRight: (s) => {
|
|
369
|
+
this.onShiftRight(s.target, s.shiftKey);
|
|
370
|
+
},
|
|
371
|
+
onShiftLeft: (s) => {
|
|
372
|
+
this.onShiftLeft(s.target, s.shiftKey);
|
|
373
|
+
},
|
|
374
|
+
onMouseDown: (s) => {
|
|
375
|
+
this.onGrab(s), s.target.focus();
|
|
376
|
+
},
|
|
377
|
+
onValidStopValue: (s, d) => this.validHandler(s, d),
|
|
378
|
+
"aria-valuenow": n[1]
|
|
357
379
|
},
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
onValidStopValue: (s, c) => this.validHandler(s, c),
|
|
362
|
-
"aria-valuenow": a[1]
|
|
363
|
-
},
|
|
364
|
-
a[0]
|
|
365
|
-
))
|
|
380
|
+
n[0]
|
|
381
|
+
))
|
|
382
|
+
]
|
|
366
383
|
}
|
|
367
384
|
);
|
|
368
385
|
};
|
|
369
386
|
FullyEdit = () => {
|
|
370
|
-
const { scale: e, stops:
|
|
371
|
-
return /* @__PURE__ */
|
|
387
|
+
const { scale: e, stops: a, range: o, colors: t, tips: c, isBlocked: r } = this.props, { isTooltipDisplay: n } = this.state;
|
|
388
|
+
return /* @__PURE__ */ y(
|
|
372
389
|
"div",
|
|
373
390
|
{
|
|
374
|
-
className:
|
|
391
|
+
className: I([
|
|
375
392
|
"multiple-slider__range",
|
|
376
|
-
|
|
377
|
-
|
|
393
|
+
a.list.length < (a.max ?? 1 / 0) && !r && "multiple-slider__range--add",
|
|
394
|
+
a.list.length === (a.max ?? 1 / 0) && "multiple-slider__range--not-allowed",
|
|
378
395
|
r && "multiple-slider__range--blocked"
|
|
379
396
|
]),
|
|
380
397
|
style: {
|
|
381
|
-
background: `linear-gradient(90deg, ${t.min}, ${t.max})`
|
|
398
|
+
background: t !== void 0 ? `linear-gradient(90deg, ${t.min}, ${t.max})` : void 0
|
|
382
399
|
},
|
|
383
|
-
onMouseDown: (
|
|
384
|
-
children:
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
400
|
+
onMouseDown: (i) => a.list.length < (a.max ?? 1 / 0) && this.onAdd(i),
|
|
401
|
+
children: [
|
|
402
|
+
/* @__PURE__ */ m(this.Progress, {}),
|
|
403
|
+
Object.entries(e).sort((i, l) => i[1] - l[1]).map((i, l, s) => /* @__PURE__ */ m(
|
|
404
|
+
E,
|
|
405
|
+
{
|
|
406
|
+
id: i[0],
|
|
407
|
+
shortId: i[0],
|
|
408
|
+
value: i[1],
|
|
409
|
+
offset: f(i[1], o.min, o.max, 0, 100),
|
|
410
|
+
min: o.min.toString(),
|
|
411
|
+
max: o.max.toString(),
|
|
412
|
+
helper: l === 0 || l === s.length - 1 ? {
|
|
413
|
+
label: c.minMax,
|
|
414
|
+
type: "MULTI_LINE"
|
|
415
|
+
} : void 0,
|
|
416
|
+
canBeTyped: !0,
|
|
417
|
+
isDisplayed: n[l],
|
|
418
|
+
isBlocked: r,
|
|
419
|
+
style: {
|
|
420
|
+
pointerEvents: this.state.activeKnobId && this.state.activeKnobId !== i[0] || r ? "none" : "auto"
|
|
421
|
+
},
|
|
422
|
+
onShiftRight: (d) => {
|
|
423
|
+
this.onShiftRight(d.target, d.shiftKey);
|
|
424
|
+
},
|
|
425
|
+
onShiftLeft: (d) => {
|
|
426
|
+
this.onShiftLeft(d.target, d.shiftKey);
|
|
427
|
+
},
|
|
428
|
+
onDelete: (d) => {
|
|
429
|
+
a.list.length > (a.min ?? 1 / 0) && this.onDelete(d.target);
|
|
430
|
+
},
|
|
431
|
+
onMouseDown: (d) => {
|
|
432
|
+
this.onGrab(d), d.target.focus();
|
|
433
|
+
},
|
|
434
|
+
onValidStopValue: (d, u) => this.validHandler(d, u),
|
|
435
|
+
"aria-valuenow": i[1]
|
|
414
436
|
},
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
n[0]
|
|
419
|
-
))
|
|
437
|
+
i[0]
|
|
438
|
+
))
|
|
439
|
+
]
|
|
420
440
|
}
|
|
421
441
|
);
|
|
422
442
|
};
|
|
423
443
|
// Render
|
|
424
444
|
render() {
|
|
425
|
-
const { type: e } = this.props;
|
|
426
|
-
return /* @__PURE__ */
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
445
|
+
const { type: e, hasPadding: a } = this.props;
|
|
446
|
+
return /* @__PURE__ */ y(
|
|
447
|
+
"div",
|
|
448
|
+
{
|
|
449
|
+
className: I([
|
|
450
|
+
"multiple-slider",
|
|
451
|
+
!a && "multiple-slider--no-padding"
|
|
452
|
+
]),
|
|
453
|
+
children: [
|
|
454
|
+
e === "EDIT" && /* @__PURE__ */ m(this.Edit, {}),
|
|
455
|
+
e === "FULLY_EDIT" && /* @__PURE__ */ m(this.FullyEdit, {}),
|
|
456
|
+
this.Status()
|
|
457
|
+
]
|
|
458
|
+
}
|
|
459
|
+
);
|
|
431
460
|
}
|
|
432
461
|
}
|
|
433
462
|
export {
|