@progress/kendo-react-inputs 14.3.0-develop.8 → 14.3.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/dist/cdn/js/kendo-react-inputs.js +1 -1
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +10 -10
- package/range-slider/RangeSlider.js +1 -1
- package/range-slider/RangeSlider.mjs +108 -106
- package/slider/Slider.js +1 -1
- package/slider/Slider.mjs +53 -51
package/slider/Slider.mjs
CHANGED
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
import * as l from "react";
|
|
9
9
|
import { useState as L, useRef as R, useMemo as N, useEffect as q, useCallback as o, useImperativeHandle as me } from "react";
|
|
10
10
|
import i from "prop-types";
|
|
11
|
-
import { withPropsContext as ue, dispatchEvent as fe, Keys as
|
|
11
|
+
import { withPropsContext as ue, dispatchEvent as fe, Keys as m, classNames as ge, Draggable as ve, getTabIndex as he, createPropsContext as be } from "@progress/kendo-react-common";
|
|
12
12
|
import { LocalizationService as ye, registerForLocalization as ke } from "@progress/kendo-react-intl";
|
|
13
13
|
import { sliderDragTitle as H, messages as A, sliderDecreaseValue as O, sliderIncreaseValue as X } from "../messages/index.mjs";
|
|
14
14
|
import { SLIDER_LABEL_ATTRIBUTE as xe } from "./SliderLabel.mjs";
|
|
15
15
|
import { Button as _ } from "@progress/kendo-react-buttons";
|
|
16
16
|
import { caretAltUpIcon as j, caretAltLeftIcon as G, caretAltDownIcon as W, caretAltRightIcon as Y } from "@progress/kendo-svg-icons";
|
|
17
|
-
const
|
|
17
|
+
const g = {
|
|
18
18
|
step: 1,
|
|
19
19
|
largeStep: 10,
|
|
20
20
|
buttons: !1,
|
|
@@ -24,21 +24,21 @@ const f = {
|
|
|
24
24
|
}, z = l.forwardRef((t, P) => {
|
|
25
25
|
var M, K, U;
|
|
26
26
|
const {
|
|
27
|
-
step:
|
|
28
|
-
largeStep:
|
|
29
|
-
vertical: a =
|
|
30
|
-
disabled:
|
|
31
|
-
tabIndex: Q =
|
|
32
|
-
} = t, [Z, $] = L((M = t.defaultValue) != null ? M : t.min), [p, B] = L(!1), [I, ee] = L(t.dir), E = R(null),
|
|
27
|
+
step: u = g.step,
|
|
28
|
+
largeStep: C = g.largeStep,
|
|
29
|
+
vertical: a = g.vertical,
|
|
30
|
+
disabled: d = g.disabled,
|
|
31
|
+
tabIndex: Q = g.tabIndex
|
|
32
|
+
} = t, [Z, $] = L((M = t.defaultValue) != null ? M : t.min), [p, B] = L(!1), [I, ee] = L(t.dir), E = R(null), v = R(null), T = N(() => new ye(), []), V = R(null), D = t.value !== void 0, k = D && t.value !== void 0 ? t.value : Z, r = N(() => {
|
|
33
33
|
const { min: e, max: n } = t;
|
|
34
|
-
return
|
|
35
|
-
}, [
|
|
34
|
+
return k < e ? e : k > n ? n : k;
|
|
35
|
+
}, [k, t.min, t.max]), h = N(() => {
|
|
36
36
|
const { min: e, max: n } = t, c = n - e;
|
|
37
37
|
return c === 0 ? 0 : (r - e) / c * 100;
|
|
38
|
-
}, [r, t.min, t.max]),
|
|
38
|
+
}, [r, t.min, t.max]), f = (K = t.dir) != null ? K : I;
|
|
39
39
|
q(() => {
|
|
40
|
-
if (t.dir === void 0 &&
|
|
41
|
-
const n = window.getComputedStyle(
|
|
40
|
+
if (t.dir === void 0 && v.current) {
|
|
41
|
+
const n = window.getComputedStyle(v.current).direction;
|
|
42
42
|
n !== I && ee(n);
|
|
43
43
|
}
|
|
44
44
|
}, [t.dir, I]);
|
|
@@ -50,7 +50,7 @@ const f = {
|
|
|
50
50
|
n = n.parentElement;
|
|
51
51
|
}
|
|
52
52
|
return !1;
|
|
53
|
-
}, []),
|
|
53
|
+
}, []), s = o(
|
|
54
54
|
(e, n) => {
|
|
55
55
|
const c = Math.min(Math.max(n, t.min), t.max);
|
|
56
56
|
D || $(c), fe(t.onChange, e, V.current, { value: c });
|
|
@@ -62,52 +62,54 @@ const f = {
|
|
|
62
62
|
B(!1);
|
|
63
63
|
}, []), ae = o(
|
|
64
64
|
(e) => {
|
|
65
|
+
if (d)
|
|
66
|
+
return;
|
|
65
67
|
let n;
|
|
66
|
-
e.keyCode ===
|
|
68
|
+
e.keyCode === m.left || e.keyCode === m.down ? n = r - (u || 0) : e.keyCode === m.right || e.keyCode === m.up ? n = r + (u || 0) : e.keyCode === m.pageDown ? n = r - (C || 0) : e.keyCode === m.pageUp ? n = r + (C || 0) : e.keyCode === m.home ? n = t.min : e.keyCode === m.end && (n = t.max), n !== void 0 && (e.preventDefault(), s(e, n));
|
|
67
69
|
},
|
|
68
|
-
[r,
|
|
70
|
+
[r, u, C, t.min, t.max, s, d]
|
|
69
71
|
), ie = o(
|
|
70
72
|
(e) => {
|
|
71
|
-
e.preventDefault(), d(e, r - (
|
|
73
|
+
e.preventDefault(), !d && s(e, r - (u || 0));
|
|
72
74
|
},
|
|
73
|
-
[r,
|
|
75
|
+
[r, u, s, d]
|
|
74
76
|
), le = o(
|
|
75
77
|
(e) => {
|
|
76
|
-
e.preventDefault(), d(e, r + (
|
|
78
|
+
e.preventDefault(), !d && s(e, r + (u || 0));
|
|
77
79
|
},
|
|
78
|
-
[r,
|
|
79
|
-
),
|
|
80
|
+
[r, u, s, d]
|
|
81
|
+
), x = o(
|
|
80
82
|
(e) => {
|
|
81
83
|
const n = e.element.getBoundingClientRect();
|
|
82
84
|
let c;
|
|
83
|
-
a ? c = n.bottom - e.event.clientY : c =
|
|
84
|
-
const
|
|
85
|
-
|
|
85
|
+
a ? c = n.bottom - e.event.clientY : c = f === "rtl" ? n.right - e.event.clientX : e.event.clientX - n.left;
|
|
86
|
+
const b = a ? n.height : n.width, y = c / b;
|
|
87
|
+
s(e, t.min + y * (t.max - t.min));
|
|
86
88
|
},
|
|
87
|
-
[a, t.min, t.max,
|
|
89
|
+
[a, t.min, t.max, f, s]
|
|
88
90
|
), re = o(
|
|
89
91
|
(e) => {
|
|
90
|
-
F(e.event.originalEvent.target) || (e.event.isTouch && e.event.originalEvent.preventDefault(),
|
|
92
|
+
F(e.event.originalEvent.target) || (e.event.isTouch && e.event.originalEvent.preventDefault(), x(e));
|
|
91
93
|
},
|
|
92
|
-
[F,
|
|
94
|
+
[F, x]
|
|
93
95
|
), ce = o(
|
|
94
96
|
(e) => {
|
|
95
|
-
e.event.originalEvent.preventDefault(),
|
|
97
|
+
e.event.originalEvent.preventDefault(), x(e);
|
|
96
98
|
},
|
|
97
|
-
[
|
|
98
|
-
),
|
|
99
|
-
|
|
99
|
+
[x]
|
|
100
|
+
), S = o(() => {
|
|
101
|
+
v.current && v.current.focus();
|
|
100
102
|
}, []), oe = o(
|
|
101
103
|
(e) => {
|
|
102
104
|
if (!e.enabled)
|
|
103
105
|
return e.children;
|
|
104
|
-
let n, c,
|
|
105
|
-
return
|
|
106
|
+
let n, c, b, y;
|
|
107
|
+
return f === "rtl" ? (n = a ? j : G, c = a ? W : Y, b = a ? "caret-alt-up" : "caret-alt-left", y = a ? "caret-alt-down" : "caret-alt-right") : (n = a ? j : Y, c = a ? W : G, b = a ? "caret-alt-up" : "caret-alt-right", y = a ? "caret-alt-down" : "caret-alt-left"), /* @__PURE__ */ l.createElement(l.Fragment, null, /* @__PURE__ */ l.createElement(
|
|
106
108
|
_,
|
|
107
109
|
{
|
|
108
110
|
className: "k-button-decrease",
|
|
109
111
|
rounded: "full",
|
|
110
|
-
icon:
|
|
112
|
+
icon: y,
|
|
111
113
|
svgIcon: c,
|
|
112
114
|
title: e.decrementTitle,
|
|
113
115
|
onClick: e.decrement
|
|
@@ -117,37 +119,37 @@ const f = {
|
|
|
117
119
|
{
|
|
118
120
|
className: "k-button-increase",
|
|
119
121
|
rounded: "full",
|
|
120
|
-
icon:
|
|
122
|
+
icon: b,
|
|
121
123
|
svgIcon: n,
|
|
122
124
|
title: e.incrementTitle,
|
|
123
125
|
onClick: e.increment
|
|
124
126
|
}
|
|
125
127
|
));
|
|
126
128
|
},
|
|
127
|
-
[
|
|
129
|
+
[f, a]
|
|
128
130
|
);
|
|
129
131
|
me(
|
|
130
132
|
P,
|
|
131
133
|
() => ({
|
|
132
134
|
props: t,
|
|
133
135
|
sliderTrack: E.current,
|
|
134
|
-
focus:
|
|
136
|
+
focus: S
|
|
135
137
|
}),
|
|
136
|
-
[t,
|
|
138
|
+
[t, S]
|
|
137
139
|
), q(() => {
|
|
138
140
|
V.current = {
|
|
139
141
|
props: t,
|
|
140
142
|
sliderTrack: E.current,
|
|
141
|
-
focus:
|
|
143
|
+
focus: S
|
|
142
144
|
};
|
|
143
|
-
}, [t,
|
|
145
|
+
}, [t, S]);
|
|
144
146
|
const de = a ? { marginTop: "0.5rem", marginBottom: "0.5rem" } : { marginLeft: "0.5rem", marginRight: "0.5rem" }, se = a ? { paddingTop: 0, height: "100%" } : {};
|
|
145
|
-
let
|
|
146
|
-
return a ?
|
|
147
|
+
let w;
|
|
148
|
+
return a ? w = { bottom: "calc(" + h + "%)", zIndex: 1 } : f === "rtl" ? w = { right: "calc(" + h + "% - 13px)", zIndex: 1 } : w = { left: "calc(" + h + "%)", zIndex: 1 }, /* @__PURE__ */ l.createElement(
|
|
147
149
|
"div",
|
|
148
150
|
{
|
|
149
|
-
ref:
|
|
150
|
-
dir:
|
|
151
|
+
ref: v,
|
|
152
|
+
dir: f,
|
|
151
153
|
id: t.id,
|
|
152
154
|
style: { gap: 0, ...t.style },
|
|
153
155
|
onFocus: te,
|
|
@@ -157,7 +159,7 @@ const f = {
|
|
|
157
159
|
"k-slider",
|
|
158
160
|
{
|
|
159
161
|
"k-focus": p,
|
|
160
|
-
"k-disabled":
|
|
162
|
+
"k-disabled": d,
|
|
161
163
|
"k-slider-horizontal": !a,
|
|
162
164
|
"k-slider-vertical": a
|
|
163
165
|
},
|
|
@@ -165,7 +167,7 @@ const f = {
|
|
|
165
167
|
)
|
|
166
168
|
},
|
|
167
169
|
oe({
|
|
168
|
-
enabled: (U = t.buttons) != null ? U :
|
|
170
|
+
enabled: (U = t.buttons) != null ? U : g.buttons,
|
|
169
171
|
decrement: ie,
|
|
170
172
|
increment: le,
|
|
171
173
|
incrementTitle: T.toLanguageString(
|
|
@@ -201,14 +203,14 @@ const f = {
|
|
|
201
203
|
"div",
|
|
202
204
|
{
|
|
203
205
|
className: "k-slider-track",
|
|
204
|
-
style: a ? { bottom: 0, height: "100%" } : { [
|
|
206
|
+
style: a ? { bottom: 0, height: "100%" } : { [f === "rtl" ? "right" : "left"]: 0, width: "100%" },
|
|
205
207
|
ref: E
|
|
206
208
|
},
|
|
207
209
|
/* @__PURE__ */ l.createElement(
|
|
208
210
|
"div",
|
|
209
211
|
{
|
|
210
212
|
className: "k-slider-selection",
|
|
211
|
-
style: a ? { height:
|
|
213
|
+
style: a ? { height: h + "%" } : { width: h + "%" }
|
|
212
214
|
}
|
|
213
215
|
),
|
|
214
216
|
/* @__PURE__ */ l.createElement(
|
|
@@ -220,17 +222,17 @@ const f = {
|
|
|
220
222
|
"aria-valuenow": r,
|
|
221
223
|
"aria-valuetext": String(r),
|
|
222
224
|
"aria-orientation": a ? "vertical" : void 0,
|
|
223
|
-
"aria-disabled":
|
|
225
|
+
"aria-disabled": d ? "true" : void 0,
|
|
224
226
|
"aria-labelledby": t.ariaLabelledBy,
|
|
225
227
|
"aria-describedby": t.ariaDescribedBy,
|
|
226
228
|
"aria-label": t.ariaLabel,
|
|
227
|
-
tabIndex: he(Q,
|
|
229
|
+
tabIndex: he(Q, d, void 0),
|
|
228
230
|
className: "k-draghandle k-draghandle-end",
|
|
229
231
|
title: T.toLanguageString(
|
|
230
232
|
H,
|
|
231
233
|
A[H]
|
|
232
234
|
),
|
|
233
|
-
style:
|
|
235
|
+
style: w
|
|
234
236
|
}
|
|
235
237
|
)
|
|
236
238
|
)
|