@progress/kendo-react-inputs 8.2.0-develop.22 → 8.2.0-develop.24
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/index.d.mts +14 -3
- package/index.d.ts +14 -3
- package/package-metadata.mjs +1 -1
- package/package.json +8 -8
- package/range-slider/RangeSlider.js +11 -11
- package/range-slider/RangeSlider.mjs +169 -151
- package/range-slider/range-raducer.js +1 -1
- package/range-slider/range-raducer.mjs +35 -1
- package/slider/Slider.js +1 -1
- package/slider/Slider.mjs +27 -27
package/slider/Slider.mjs
CHANGED
|
@@ -8,14 +8,14 @@
|
|
|
8
8
|
"use client";
|
|
9
9
|
import * as i from "react";
|
|
10
10
|
import a from "prop-types";
|
|
11
|
-
import { Keys as
|
|
12
|
-
import { provideLocalizationService as
|
|
13
|
-
import { sliderIncreaseValue as d, messages as
|
|
14
|
-
import { SLIDER_LABEL_ATTRIBUTE as
|
|
11
|
+
import { Keys as n, validatePackage as y, classNames as w, Draggable as S, getTabIndex as x, dispatchEvent as T, createPropsContext as E, withPropsContext as D } from "@progress/kendo-react-common";
|
|
12
|
+
import { provideLocalizationService as C, registerForLocalization as I } from "@progress/kendo-react-intl";
|
|
13
|
+
import { sliderIncreaseValue as d, messages as h, sliderDecreaseValue as m, sliderDragTitle as u } from "../messages/index.mjs";
|
|
14
|
+
import { SLIDER_LABEL_ATTRIBUTE as L } from "./SliderLabel.mjs";
|
|
15
15
|
import { packageMetadata as B } from "../package-metadata.mjs";
|
|
16
16
|
import { Button as v } from "@progress/kendo-react-buttons";
|
|
17
17
|
import { caretAltUpIcon as g, caretAltLeftIcon as f, caretAltRightIcon as b, caretAltDownIcon as k } from "@progress/kendo-svg-icons";
|
|
18
|
-
const
|
|
18
|
+
const p = class p extends i.Component {
|
|
19
19
|
constructor(s) {
|
|
20
20
|
super(s), this.state = {
|
|
21
21
|
value: this.props.defaultValue === void 0 ? this.props.min : this.props.defaultValue,
|
|
@@ -24,14 +24,14 @@ const h = class h extends i.Component {
|
|
|
24
24
|
}, this._sliderTrack = null, this._element = null, this.buttons = (t) => {
|
|
25
25
|
if (!t.enabled)
|
|
26
26
|
return t.children;
|
|
27
|
-
const e = this.state.dir === "rtl" ? this.props.vertical ? g : f : this.props.vertical ? g : b,
|
|
27
|
+
const e = this.state.dir === "rtl" ? this.props.vertical ? g : f : this.props.vertical ? g : b, l = this.state.dir === "rtl" ? this.props.vertical ? k : b : this.props.vertical ? k : f, r = this.state.dir === "rtl" ? this.props.vertical ? "caret-alt-up" : "caret-alt-left" : this.props.vertical ? "caret-alt-up" : "caret-alt-right", o = this.state.dir === "rtl" ? this.props.vertical ? "caret-alt-down" : "caret-alt-right" : this.props.vertical ? "caret-alt-down" : "caret-alt-left";
|
|
28
28
|
return /* @__PURE__ */ i.createElement(i.Fragment, null, /* @__PURE__ */ i.createElement(
|
|
29
29
|
v,
|
|
30
30
|
{
|
|
31
31
|
className: "k-button-decrease",
|
|
32
32
|
rounded: "full",
|
|
33
|
-
icon:
|
|
34
|
-
svgIcon:
|
|
33
|
+
icon: o,
|
|
34
|
+
svgIcon: l,
|
|
35
35
|
title: t.decrementTitle,
|
|
36
36
|
onClick: t.decrement
|
|
37
37
|
}
|
|
@@ -51,7 +51,7 @@ const h = class h extends i.Component {
|
|
|
51
51
|
}, this.isLabel = (t) => {
|
|
52
52
|
let e = t;
|
|
53
53
|
for (; e; ) {
|
|
54
|
-
if (e.getAttribute(
|
|
54
|
+
if (e.getAttribute(L))
|
|
55
55
|
return !0;
|
|
56
56
|
e = e.parentElement;
|
|
57
57
|
}
|
|
@@ -62,7 +62,7 @@ const h = class h extends i.Component {
|
|
|
62
62
|
this.setState({ focused: !1 });
|
|
63
63
|
}, this.onKeyDown = (t) => {
|
|
64
64
|
let e;
|
|
65
|
-
t.keyCode ===
|
|
65
|
+
t.keyCode === n.left || t.keyCode === n.down ? e = this.state.value - (this.props.step || 0) : t.keyCode === n.right || t.keyCode === n.up ? e = this.state.value + (this.props.step || 0) : t.keyCode === n.pageDown ? e = this.state.value - (this.props.largeStep || 0) : t.keyCode === n.pageUp ? e = this.state.value + (this.props.largeStep || 0) : t.keyCode === n.home ? e = this.props.min : t.keyCode === n.end && (e = this.props.max), e !== void 0 && (t.preventDefault(), this.change(t, e));
|
|
66
66
|
}, this.decrement = (t) => {
|
|
67
67
|
t.preventDefault(), this.change(t, this.state.value - (this.props.step || 0));
|
|
68
68
|
}, this.increment = (t) => {
|
|
@@ -72,16 +72,16 @@ const h = class h extends i.Component {
|
|
|
72
72
|
}, this.dragOver = (t) => {
|
|
73
73
|
t.event.originalEvent.preventDefault(), this.drag(t);
|
|
74
74
|
}, this.drag = (t) => {
|
|
75
|
-
const e = t.element.getBoundingClientRect(),
|
|
76
|
-
this.change(t, this.props.min +
|
|
75
|
+
const e = t.element.getBoundingClientRect(), l = this.props.vertical ? e.bottom - t.event.clientY : this.state.dir === "rtl" ? e.right - t.event.clientX : t.event.clientX - e.left, r = this.props.vertical ? e.height : e.width, o = l / r;
|
|
76
|
+
this.change(t, this.props.min + o * (this.props.max - this.props.min));
|
|
77
77
|
}, y(B);
|
|
78
78
|
}
|
|
79
79
|
/**
|
|
80
80
|
* @hidden
|
|
81
81
|
*/
|
|
82
82
|
static getDerivedStateFromProps(s, t) {
|
|
83
|
-
const e = s.value !== void 0 ? s.value : t.value, { min:
|
|
84
|
-
return e === void 0 ? null : { value: Math.min(Math.max(e,
|
|
83
|
+
const e = s.value !== void 0 ? s.value : t.value, { min: l, max: r } = s;
|
|
84
|
+
return e === void 0 ? null : { value: Math.min(Math.max(e, l), r) };
|
|
85
85
|
}
|
|
86
86
|
/**
|
|
87
87
|
* @hidden
|
|
@@ -96,7 +96,7 @@ const h = class h extends i.Component {
|
|
|
96
96
|
* @hidden
|
|
97
97
|
*/
|
|
98
98
|
render() {
|
|
99
|
-
const s =
|
|
99
|
+
const s = C(this), t = (this.state.value - this.props.min) / (this.props.max - this.props.min) * 100, e = this.props.vertical ? { marginTop: "0.5rem", marginBottom: "0.5rem" } : { marginLeft: "0.5rem", marginRight: "0.5rem" }, l = this.props.vertical ? { paddingTop: 0, height: "100%" } : {};
|
|
100
100
|
return /* @__PURE__ */ i.createElement(
|
|
101
101
|
"div",
|
|
102
102
|
{
|
|
@@ -124,10 +124,10 @@ const h = class h extends i.Component {
|
|
|
124
124
|
enabled: this.props.buttons,
|
|
125
125
|
decrement: this.decrement,
|
|
126
126
|
increment: this.increment,
|
|
127
|
-
incrementTitle: s.toLanguageString(d,
|
|
128
|
-
decrementTitle: s.toLanguageString(m,
|
|
127
|
+
incrementTitle: s.toLanguageString(d, h[d]),
|
|
128
|
+
decrementTitle: s.toLanguageString(m, h[m])
|
|
129
129
|
},
|
|
130
|
-
/* @__PURE__ */ i.createElement(
|
|
130
|
+
/* @__PURE__ */ i.createElement(S, { onDrag: this.dragOver, onPress: this.dragStart, autoScroll: !1 }, /* @__PURE__ */ i.createElement(
|
|
131
131
|
"div",
|
|
132
132
|
{
|
|
133
133
|
className: "k-slider-track-wrap",
|
|
@@ -142,15 +142,15 @@ const h = class h extends i.Component {
|
|
|
142
142
|
"ul",
|
|
143
143
|
{
|
|
144
144
|
className: "k-reset k-slider-items",
|
|
145
|
-
style: { margin: 0, ...
|
|
145
|
+
style: { margin: 0, ...l }
|
|
146
146
|
},
|
|
147
|
-
i.Children.map(this.props.children, (r,
|
|
147
|
+
i.Children.map(this.props.children, (r, o) => r && i.cloneElement(
|
|
148
148
|
r,
|
|
149
149
|
{
|
|
150
150
|
position: 100 * (r.props.position - this.props.min) / (this.props.max - this.props.min),
|
|
151
151
|
vertical: this.props.vertical,
|
|
152
|
-
firstTick:
|
|
153
|
-
lastTick:
|
|
152
|
+
firstTick: o === 0,
|
|
153
|
+
lastTick: o === i.Children.count(this.props.children) - 1
|
|
154
154
|
},
|
|
155
155
|
r.props.children
|
|
156
156
|
))
|
|
@@ -182,9 +182,9 @@ const h = class h extends i.Component {
|
|
|
182
182
|
"aria-labelledby": this.props.ariaLabelledBy,
|
|
183
183
|
"aria-describedby": this.props.ariaDescribedBy,
|
|
184
184
|
"aria-label": this.props.ariaLabel,
|
|
185
|
-
tabIndex:
|
|
185
|
+
tabIndex: x(this.props.tabIndex, this.props.disabled, void 0),
|
|
186
186
|
className: "k-draghandle k-draghandle-end",
|
|
187
|
-
title: s.toLanguageString(u,
|
|
187
|
+
title: s.toLanguageString(u, h[u]),
|
|
188
188
|
style: this.props.vertical ? { bottom: "calc(" + t + "%)", zIndex: 1 } : this.state.dir === "rtl" ? { right: "calc(" + t + "% - 13px)", zIndex: 1 } : { left: "calc(" + t + "%)", zIndex: 1 }
|
|
189
189
|
}
|
|
190
190
|
)
|
|
@@ -203,7 +203,7 @@ const h = class h extends i.Component {
|
|
|
203
203
|
t = Math.min(Math.max(t, this.props.min), this.props.max), this.setState({ value: t }), T(this.props.onChange, s, this, { value: t });
|
|
204
204
|
}
|
|
205
205
|
};
|
|
206
|
-
|
|
206
|
+
p.displayName = "Slider", p.propTypes = {
|
|
207
207
|
min: a.number.isRequired,
|
|
208
208
|
max: a.number.isRequired,
|
|
209
209
|
value: a.number,
|
|
@@ -214,10 +214,10 @@ h.displayName = "Slider", h.propTypes = {
|
|
|
214
214
|
ariaLabel: a.string
|
|
215
215
|
// TODO: validation when buttons is set to true, but no step is provided
|
|
216
216
|
};
|
|
217
|
-
let c =
|
|
217
|
+
let c = p;
|
|
218
218
|
const A = E(), N = D(A, c);
|
|
219
219
|
N.displayName = "KendoReactSlider";
|
|
220
|
-
|
|
220
|
+
I(c);
|
|
221
221
|
export {
|
|
222
222
|
N as Slider,
|
|
223
223
|
A as SliderPropsContext,
|