@progress/kendo-react-inputs 8.1.0-develop.9 → 8.1.1-develop.1
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/checkbox/Checkbox.js +1 -1
- package/checkbox/Checkbox.mjs +87 -90
- package/colors/ColorPicker.js +1 -1
- package/colors/ColorPicker.mjs +53 -54
- package/dist/cdn/js/kendo-react-inputs.js +1 -1
- package/index.d.mts +2 -2
- package/index.d.ts +2 -2
- package/numerictextbox/NumericTextBox.js +1 -1
- package/numerictextbox/NumericTextBox.mjs +208 -206
- package/package-metadata.mjs +1 -1
- package/package.json +8 -8
- package/radiobutton/RadioButton.js +1 -1
- package/radiobutton/RadioButton.mjs +21 -22
- package/radiobutton/RadioGroup.js +1 -1
- package/radiobutton/RadioGroup.mjs +54 -55
- package/range-slider/RangeSlider.js +7 -7
- package/range-slider/RangeSlider.mjs +161 -156
- package/rating/Rating.js +3 -3
- package/rating/Rating.mjs +145 -134
- package/rating/RatingItem.js +1 -1
- package/rating/RatingItem.mjs +40 -41
- package/signature/Signature.js +1 -1
- package/signature/Signature.mjs +151 -133
- package/textarea/TextArea.js +1 -1
- package/textarea/TextArea.mjs +64 -65
- package/textbox/Textbox.js +1 -1
- package/textbox/Textbox.mjs +33 -34
|
@@ -7,173 +7,179 @@
|
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
9
|
import * as a from "react";
|
|
10
|
-
import
|
|
11
|
-
import { createPropsContext as
|
|
12
|
-
import { sliderDragTitle as
|
|
13
|
-
import { useLocalization as
|
|
14
|
-
import { RANGE_ACTION as n, rangeReducer as
|
|
15
|
-
import { packageMetadata as
|
|
16
|
-
const
|
|
17
|
-
const [
|
|
18
|
-
(
|
|
19
|
-
const
|
|
20
|
-
|
|
10
|
+
import R from "prop-types";
|
|
11
|
+
import { createPropsContext as Y, validatePackage as _, usePropsContext as j, useDir as F, Keys as p, useDraggable as J, classNames as Q, getTabIndex as V } from "@progress/kendo-react-common";
|
|
12
|
+
import { sliderDragTitle as $, messages as z } from "../messages/index.mjs";
|
|
13
|
+
import { useLocalization as U } from "@progress/kendo-react-intl";
|
|
14
|
+
import { RANGE_ACTION as n, rangeReducer as Z } from "./range-raducer.mjs";
|
|
15
|
+
import { packageMetadata as ee } from "../package-metadata.mjs";
|
|
16
|
+
const te = (r, l, u) => {
|
|
17
|
+
const [e, s] = a.useState(r), o = a.useCallback(
|
|
18
|
+
(v) => {
|
|
19
|
+
const b = Z(l.state || e, { ...v, ...l });
|
|
20
|
+
u && u(b, v.event), s(b);
|
|
21
21
|
},
|
|
22
|
-
[l,
|
|
22
|
+
[l, u]
|
|
23
23
|
);
|
|
24
|
-
return [
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
const
|
|
24
|
+
return [e, o];
|
|
25
|
+
}, ae = Y(), P = a.forwardRef((r, l) => {
|
|
26
|
+
_(ee);
|
|
27
|
+
const u = j(ae, r), e = {
|
|
28
|
+
step: g.step,
|
|
29
|
+
defaultValue: g.defaultValue,
|
|
30
|
+
vertical: g.vertical,
|
|
31
|
+
disabled: g.disabled,
|
|
32
|
+
...u
|
|
33
|
+
}, s = a.useRef(null), o = a.useRef(null), v = a.useRef(null), b = a.useRef(null), T = a.useRef(null), K = a.useCallback(
|
|
28
34
|
() => {
|
|
29
|
-
|
|
35
|
+
b.current && b.current.focus();
|
|
30
36
|
},
|
|
31
|
-
[
|
|
37
|
+
[b]
|
|
32
38
|
);
|
|
33
39
|
a.useImperativeHandle(s, () => ({
|
|
34
|
-
element:
|
|
35
|
-
focus:
|
|
40
|
+
element: o.current,
|
|
41
|
+
focus: K,
|
|
36
42
|
props: e
|
|
37
43
|
})), a.useImperativeHandle(l, () => s.current);
|
|
38
|
-
const
|
|
44
|
+
const m = a.useMemo(
|
|
39
45
|
() => e.min,
|
|
40
46
|
[e.min]
|
|
41
47
|
), k = a.useMemo(
|
|
42
48
|
() => e.max,
|
|
43
49
|
[e.max]
|
|
44
|
-
),
|
|
45
|
-
() => e.step !== void 0 ? e.step :
|
|
46
|
-
[e.step,
|
|
47
|
-
),
|
|
50
|
+
), A = a.useMemo(
|
|
51
|
+
() => e.step !== void 0 ? e.step : g.step,
|
|
52
|
+
[e.step, g.step]
|
|
53
|
+
), f = F(o, e.dir), H = (t, d) => {
|
|
48
54
|
e.onChange && s.current && e.onChange.call(void 0, {
|
|
49
55
|
value: t,
|
|
50
56
|
target: s.current,
|
|
51
|
-
syntheticEvent:
|
|
57
|
+
syntheticEvent: d
|
|
52
58
|
});
|
|
53
|
-
}, [E, S] = a.useState(""), [
|
|
54
|
-
e.defaultValue ||
|
|
59
|
+
}, [E, S] = a.useState(""), [x, i] = te(
|
|
60
|
+
e.defaultValue || g.defaultValue,
|
|
55
61
|
{
|
|
56
|
-
min:
|
|
62
|
+
min: m,
|
|
57
63
|
max: k,
|
|
58
|
-
step:
|
|
64
|
+
step: A,
|
|
59
65
|
state: e.value
|
|
60
66
|
},
|
|
61
|
-
|
|
62
|
-
),
|
|
63
|
-
() => e.value ||
|
|
64
|
-
[e.value,
|
|
65
|
-
),
|
|
66
|
-
() => (
|
|
67
|
-
[
|
|
68
|
-
),
|
|
69
|
-
() => (
|
|
70
|
-
[
|
|
71
|
-
),
|
|
67
|
+
H
|
|
68
|
+
), c = a.useMemo(
|
|
69
|
+
() => e.value || x,
|
|
70
|
+
[e.value, x]
|
|
71
|
+
), L = a.useRef(null), w = a.useRef(null), y = a.useMemo(
|
|
72
|
+
() => (c.start - m) / (k - m) * 100,
|
|
73
|
+
[c.start, m, k]
|
|
74
|
+
), D = a.useMemo(
|
|
75
|
+
() => (c.end - m) / (k - m) * 100,
|
|
76
|
+
[c.end, m, k]
|
|
77
|
+
), N = a.useMemo(
|
|
72
78
|
() => e.vertical ? { paddingTop: 0, height: "100%" } : {},
|
|
73
79
|
[e.vertical]
|
|
74
|
-
),
|
|
80
|
+
), q = a.useMemo(
|
|
75
81
|
() => e.vertical ? { marginTop: "0.5rem", marginBottom: "0.5rem" } : { marginLeft: "0.5rem", marginRight: "0.5rem" },
|
|
76
82
|
[e.vertical]
|
|
77
|
-
), M =
|
|
83
|
+
), M = U(), C = a.useCallback(
|
|
78
84
|
(t) => {
|
|
79
85
|
if (!w.current)
|
|
80
86
|
return;
|
|
81
|
-
const
|
|
82
|
-
return
|
|
87
|
+
const d = w.current.getBoundingClientRect(), h = e.vertical ? d.bottom - t.clientY : f === "rtl" ? d.right - t.clientX : t.clientX - d.left, I = e.vertical ? d.height : d.width, W = h / I;
|
|
88
|
+
return m + W * (k - m);
|
|
83
89
|
},
|
|
84
90
|
[
|
|
85
91
|
w,
|
|
86
92
|
e.vertical,
|
|
87
|
-
p,
|
|
88
93
|
f,
|
|
94
|
+
m,
|
|
89
95
|
k,
|
|
90
|
-
|
|
91
|
-
|
|
96
|
+
x.start,
|
|
97
|
+
x.end,
|
|
92
98
|
e.value && e.value.start,
|
|
93
99
|
e.value && e.value.end
|
|
94
100
|
]
|
|
95
|
-
),
|
|
96
|
-
(t) => t <=
|
|
101
|
+
), B = a.useCallback(
|
|
102
|
+
(t) => t <= c.start ? "start" : t >= c.end ? "end" : 2 * t < c.end + c.start ? "start" : "end",
|
|
97
103
|
[
|
|
98
|
-
|
|
99
|
-
|
|
104
|
+
x.start,
|
|
105
|
+
x.end,
|
|
100
106
|
e.value && e.value.start,
|
|
101
107
|
e.value && e.value.end
|
|
102
108
|
]
|
|
103
|
-
),
|
|
109
|
+
), G = a.useCallback(
|
|
104
110
|
(t) => {
|
|
105
111
|
switch (t.keyCode) {
|
|
106
|
-
case
|
|
107
|
-
t.preventDefault(),
|
|
112
|
+
case p.right:
|
|
113
|
+
t.preventDefault(), i({ type: f === "rtl" ? n.decrease : n.increase, key: "start", event: t });
|
|
108
114
|
break;
|
|
109
|
-
case
|
|
110
|
-
t.preventDefault(),
|
|
115
|
+
case p.up:
|
|
116
|
+
t.preventDefault(), i({ type: n.increase, key: "start", event: t });
|
|
111
117
|
break;
|
|
112
|
-
case
|
|
113
|
-
t.preventDefault(),
|
|
118
|
+
case p.left:
|
|
119
|
+
t.preventDefault(), i({ type: f === "rtl" ? n.increase : n.decrease, key: "start", event: t });
|
|
114
120
|
break;
|
|
115
|
-
case
|
|
116
|
-
t.preventDefault(),
|
|
121
|
+
case p.down:
|
|
122
|
+
t.preventDefault(), i({ type: n.decrease, key: "start", event: t });
|
|
117
123
|
break;
|
|
118
|
-
case
|
|
119
|
-
t.preventDefault(),
|
|
124
|
+
case p.home:
|
|
125
|
+
t.preventDefault(), i({ type: n.min, key: "start", event: t });
|
|
120
126
|
break;
|
|
121
|
-
case
|
|
122
|
-
t.preventDefault(),
|
|
127
|
+
case p.end:
|
|
128
|
+
t.preventDefault(), i({ type: n.max, key: "start", event: t });
|
|
123
129
|
break;
|
|
124
130
|
}
|
|
125
131
|
},
|
|
126
|
-
[
|
|
127
|
-
),
|
|
132
|
+
[i]
|
|
133
|
+
), O = a.useCallback(
|
|
128
134
|
(t) => {
|
|
129
135
|
switch (t.keyCode) {
|
|
130
|
-
case
|
|
131
|
-
t.preventDefault(),
|
|
136
|
+
case p.right:
|
|
137
|
+
t.preventDefault(), i({ type: f === "rtl" ? n.decrease : n.increase, key: "end", event: t });
|
|
132
138
|
break;
|
|
133
|
-
case
|
|
134
|
-
t.preventDefault(),
|
|
139
|
+
case p.up:
|
|
140
|
+
t.preventDefault(), i({ type: n.increase, key: "end", event: t });
|
|
135
141
|
break;
|
|
136
|
-
case
|
|
137
|
-
t.preventDefault(),
|
|
142
|
+
case p.left:
|
|
143
|
+
t.preventDefault(), i({ type: f === "rtl" ? n.increase : n.decrease, key: "end", event: t });
|
|
138
144
|
break;
|
|
139
|
-
case
|
|
140
|
-
t.preventDefault(),
|
|
145
|
+
case p.down:
|
|
146
|
+
t.preventDefault(), i({ type: n.decrease, key: "end", event: t });
|
|
141
147
|
break;
|
|
142
|
-
case
|
|
143
|
-
t.preventDefault(),
|
|
148
|
+
case p.home:
|
|
149
|
+
t.preventDefault(), i({ type: n.min, key: "end", event: t });
|
|
144
150
|
break;
|
|
145
|
-
case
|
|
146
|
-
t.preventDefault(),
|
|
151
|
+
case p.end:
|
|
152
|
+
t.preventDefault(), i({ type: n.max, key: "end", event: t });
|
|
147
153
|
break;
|
|
148
154
|
}
|
|
149
155
|
},
|
|
150
|
-
[
|
|
151
|
-
),
|
|
156
|
+
[i, f]
|
|
157
|
+
), X = a.useCallback(
|
|
152
158
|
(t) => {
|
|
153
|
-
const
|
|
154
|
-
S(h), h === "end" ?
|
|
159
|
+
const d = C(t), h = B(d);
|
|
160
|
+
S(h), h === "end" ? T.current.focus() : b.current.focus();
|
|
155
161
|
const I = h === "end" ? n.end : n.start;
|
|
156
|
-
|
|
162
|
+
i({ type: I, payload: d, event: t });
|
|
157
163
|
},
|
|
158
|
-
[e.vertical,
|
|
164
|
+
[e.vertical, m, k, i]
|
|
159
165
|
);
|
|
160
|
-
return
|
|
161
|
-
const
|
|
162
|
-
|
|
166
|
+
return J(w, { onPress: X, onDrag: (t) => {
|
|
167
|
+
const d = C(t), h = E === "end" ? n.end : n.start;
|
|
168
|
+
i({ type: h, payload: d, event: t });
|
|
163
169
|
}, onRelease: (t) => {
|
|
164
|
-
const
|
|
165
|
-
|
|
170
|
+
const d = C(t), h = E === "end" ? n.end : n.start;
|
|
171
|
+
i({ type: h, payload: d, event: t }), S("");
|
|
166
172
|
} }), /* @__PURE__ */ a.createElement(
|
|
167
173
|
"div",
|
|
168
174
|
{
|
|
169
175
|
id: e.id,
|
|
170
176
|
style: e.style,
|
|
171
|
-
ref:
|
|
172
|
-
dir:
|
|
173
|
-
className:
|
|
177
|
+
ref: o,
|
|
178
|
+
dir: f,
|
|
179
|
+
className: Q(
|
|
174
180
|
"k-slider",
|
|
175
181
|
{
|
|
176
|
-
"k-rtl":
|
|
182
|
+
"k-rtl": f === "rtl",
|
|
177
183
|
"k-disabled": e.disabled,
|
|
178
184
|
"k-slider-vertical": e.vertical,
|
|
179
185
|
"k-slider-horizontal": !e.vertical
|
|
@@ -190,22 +196,22 @@ const ee = (r, l, e) => {
|
|
|
190
196
|
flexGrow: 1,
|
|
191
197
|
position: "relative",
|
|
192
198
|
touchAction: "none",
|
|
193
|
-
...
|
|
199
|
+
...q
|
|
194
200
|
}
|
|
195
201
|
},
|
|
196
202
|
e.children && /* @__PURE__ */ a.createElement(
|
|
197
203
|
"ul",
|
|
198
204
|
{
|
|
199
205
|
className: "k-reset k-slider-items",
|
|
200
|
-
style: { ...
|
|
206
|
+
style: { ...N }
|
|
201
207
|
},
|
|
202
|
-
a.Children.map(e.children, (t,
|
|
208
|
+
a.Children.map(e.children, (t, d) => t && a.cloneElement(
|
|
203
209
|
t,
|
|
204
210
|
{
|
|
205
211
|
position: 100 * (t.props.position - e.min) / (e.max - e.min),
|
|
206
212
|
vertical: e.vertical,
|
|
207
|
-
firstTick:
|
|
208
|
-
lastTick:
|
|
213
|
+
firstTick: d === 0,
|
|
214
|
+
lastTick: d === a.Children.count(e.children) - 1
|
|
209
215
|
},
|
|
210
216
|
t.props.children
|
|
211
217
|
))
|
|
@@ -213,115 +219,115 @@ const ee = (r, l, e) => {
|
|
|
213
219
|
/* @__PURE__ */ a.createElement(
|
|
214
220
|
"div",
|
|
215
221
|
{
|
|
216
|
-
ref:
|
|
222
|
+
ref: L,
|
|
217
223
|
className: "k-slider-track",
|
|
218
|
-
style: e.vertical ? { bottom: 0, height: "100%" } : { [
|
|
224
|
+
style: e.vertical ? { bottom: 0, height: "100%" } : { [f === "rtl" ? "right" : "left"]: 0, width: "100%" }
|
|
219
225
|
},
|
|
220
|
-
y !== null &&
|
|
226
|
+
y !== null && D !== null && /* @__PURE__ */ a.createElement(
|
|
221
227
|
"div",
|
|
222
228
|
{
|
|
223
229
|
"data-selection": !0,
|
|
224
|
-
ref:
|
|
225
|
-
title: `${
|
|
230
|
+
ref: v,
|
|
231
|
+
title: `${c.start} - ${c.end}`,
|
|
226
232
|
className: "k-slider-selection",
|
|
227
|
-
style: e.vertical ? { height:
|
|
228
|
-
[
|
|
229
|
-
width:
|
|
233
|
+
style: e.vertical ? { height: D - y + "%", bottom: y + "%" } : {
|
|
234
|
+
[f === "rtl" ? "right" : "left"]: y + "%",
|
|
235
|
+
width: D - y + "%"
|
|
230
236
|
}
|
|
231
237
|
}
|
|
232
238
|
),
|
|
233
239
|
/* @__PURE__ */ a.createElement(
|
|
234
240
|
"span",
|
|
235
241
|
{
|
|
236
|
-
ref:
|
|
242
|
+
ref: b,
|
|
237
243
|
role: "slider",
|
|
238
|
-
tabIndex:
|
|
239
|
-
"aria-valuemin":
|
|
240
|
-
"aria-valuemax": Math.max(k,
|
|
241
|
-
"aria-valuenow":
|
|
244
|
+
tabIndex: V(e.startTabIndex, e.disabled, void 0),
|
|
245
|
+
"aria-valuemin": m,
|
|
246
|
+
"aria-valuemax": Math.max(k, c.end),
|
|
247
|
+
"aria-valuenow": c.start,
|
|
242
248
|
"aria-disabled": e.disabled ? "true" : void 0,
|
|
243
|
-
"aria-valuetext": `${
|
|
249
|
+
"aria-valuetext": `${c.start} - ${c.end}`,
|
|
244
250
|
className: "k-draghandle k-draghandle-start",
|
|
245
|
-
title: M.toLanguageString(
|
|
246
|
-
style: e.vertical ? { bottom: "calc(" + y + "%)", zIndex: 1 } :
|
|
247
|
-
onKeyDown:
|
|
251
|
+
title: M.toLanguageString($, z[$]),
|
|
252
|
+
style: e.vertical ? { bottom: "calc(" + y + "%)", zIndex: 1 } : f === "rtl" ? { right: "calc(" + y + "% - 13px)", zIndex: 1 } : { left: "calc(" + y + "%)", zIndex: 1 },
|
|
253
|
+
onKeyDown: G
|
|
248
254
|
}
|
|
249
255
|
),
|
|
250
256
|
/* @__PURE__ */ a.createElement(
|
|
251
257
|
"span",
|
|
252
258
|
{
|
|
253
|
-
ref:
|
|
259
|
+
ref: T,
|
|
254
260
|
role: "slider",
|
|
255
|
-
tabIndex:
|
|
256
|
-
"aria-valuemin": Math.min(
|
|
261
|
+
tabIndex: V(e.endTabIndex, e.disabled, void 0),
|
|
262
|
+
"aria-valuemin": Math.min(m, c.start),
|
|
257
263
|
"aria-valuemax": k,
|
|
258
|
-
"aria-valuenow":
|
|
264
|
+
"aria-valuenow": c.end,
|
|
259
265
|
"aria-disabled": e.disabled ? "true" : void 0,
|
|
260
|
-
"aria-valuetext": `${
|
|
266
|
+
"aria-valuetext": `${c.start} - ${c.end}`,
|
|
261
267
|
className: "k-draghandle k-draghandle-end",
|
|
262
|
-
title: M.toLanguageString(
|
|
263
|
-
style: e.vertical ? { bottom: "calc(" +
|
|
264
|
-
onKeyDown:
|
|
268
|
+
title: M.toLanguageString($, z[$]),
|
|
269
|
+
style: e.vertical ? { bottom: "calc(" + D + "%)", zIndex: 1 } : f === "rtl" ? { right: "calc(" + D + "% - 13px)", zIndex: 1 } : { left: "calc(" + D + "%)", zIndex: 1 },
|
|
270
|
+
onKeyDown: O
|
|
265
271
|
}
|
|
266
272
|
)
|
|
267
273
|
)
|
|
268
274
|
)
|
|
269
275
|
);
|
|
270
|
-
}),
|
|
271
|
-
value: (r, l,
|
|
276
|
+
}), re = {
|
|
277
|
+
value: (r, l, u) => {
|
|
272
278
|
if (r.value) {
|
|
273
|
-
const
|
|
274
|
-
if (
|
|
279
|
+
const e = r.value.start, s = r.value.end, o = r.min, v = r.max;
|
|
280
|
+
if (e > s || e > v || e < o || s > v || s < o || s < e)
|
|
275
281
|
return new Error(
|
|
276
|
-
`Invalid prop + ${l} supplied to ${
|
|
282
|
+
`Invalid prop + ${l} supplied to ${u}.
|
|
277
283
|
The { start, end } value must be between the min & max value and { start, end } must be start < end.
|
|
278
284
|
`
|
|
279
285
|
);
|
|
280
286
|
}
|
|
281
287
|
return null;
|
|
282
288
|
},
|
|
283
|
-
defaultValue: (r, l,
|
|
289
|
+
defaultValue: (r, l, u) => {
|
|
284
290
|
if (r.defaultValue) {
|
|
285
|
-
const
|
|
286
|
-
if (
|
|
291
|
+
const e = r.defaultValue.start, s = r.defaultValue.end, o = r.min, v = r.max;
|
|
292
|
+
if (e > s || e > v || e < o || s > v || s < o || s < e)
|
|
287
293
|
return new Error(
|
|
288
|
-
`Invalid prop + ${l} supplied to ${
|
|
294
|
+
`Invalid prop + ${l} supplied to ${u}.
|
|
289
295
|
The { start, end } value must be between the min & max value and { start, end } must be start < end.
|
|
290
296
|
`
|
|
291
297
|
);
|
|
292
298
|
}
|
|
293
299
|
return null;
|
|
294
300
|
},
|
|
295
|
-
onChange:
|
|
296
|
-
step:
|
|
297
|
-
min: (r, l,
|
|
298
|
-
const
|
|
299
|
-
return
|
|
300
|
-
`Invalid prop + ${l} supplied to ${
|
|
301
|
+
onChange: R.func,
|
|
302
|
+
step: R.number,
|
|
303
|
+
min: (r, l, u) => {
|
|
304
|
+
const e = r[l], s = r.min, o = r.max;
|
|
305
|
+
return s === void 0 ? new Error(
|
|
306
|
+
`Invalid prop + ${l} supplied to ${u}.
|
|
301
307
|
${l} value can not be undefined.
|
|
302
308
|
`
|
|
303
|
-
) :
|
|
304
|
-
`Invalid prop + ${l} supplied to ${
|
|
309
|
+
) : e && s >= o ? new Error(
|
|
310
|
+
`Invalid prop + ${l} supplied to ${u}.
|
|
305
311
|
${l} value can not be equal to or bigger than the max value.
|
|
306
312
|
`
|
|
307
313
|
) : null;
|
|
308
314
|
},
|
|
309
|
-
max: (r, l,
|
|
310
|
-
const
|
|
311
|
-
return
|
|
312
|
-
`Invalid prop + ${l} supplied to ${
|
|
315
|
+
max: (r, l, u) => {
|
|
316
|
+
const e = r[l], s = r.min, o = r.max;
|
|
317
|
+
return o === void 0 ? new Error(
|
|
318
|
+
`Invalid prop + ${l} supplied to ${u}.
|
|
313
319
|
${l} value can not be undefined.
|
|
314
320
|
`
|
|
315
|
-
) :
|
|
316
|
-
`Invalid prop + ${l} supplied to ${
|
|
321
|
+
) : e && o <= s ? new Error(
|
|
322
|
+
`Invalid prop + ${l} supplied to ${u}.
|
|
317
323
|
${l} value can not be equal to or smaller than the min value.
|
|
318
324
|
`
|
|
319
325
|
) : null;
|
|
320
326
|
},
|
|
321
|
-
vertical:
|
|
322
|
-
disabled:
|
|
323
|
-
dir:
|
|
324
|
-
},
|
|
327
|
+
vertical: R.bool,
|
|
328
|
+
disabled: R.bool,
|
|
329
|
+
dir: R.oneOf(["ltr", "rtl"])
|
|
330
|
+
}, g = {
|
|
325
331
|
step: 1,
|
|
326
332
|
defaultValue: {
|
|
327
333
|
start: 0,
|
|
@@ -330,10 +336,9 @@ const ee = (r, l, e) => {
|
|
|
330
336
|
vertical: !1,
|
|
331
337
|
disabled: !1
|
|
332
338
|
};
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
T.defaultProps = $;
|
|
339
|
+
P.displayName = "KendoReactRangeSlider";
|
|
340
|
+
P.propTypes = re;
|
|
336
341
|
export {
|
|
337
|
-
|
|
338
|
-
|
|
342
|
+
P as RangeSlider,
|
|
343
|
+
ae as RangeSliderPropsContext
|
|
339
344
|
};
|
package/rating/Rating.js
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const J=require("react"),u=require("prop-types"),l=require("@progress/kendo-react-common"),M=require("@progress/kendo-svg-icons"),Q=require("./RatingItem.js"),c=require("./rating-reducer.js"),d=require("./utils/index.js"),V=require("../messages/index.js"),U=require("@progress/kendo-react-intl");function Y(a){const g=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const m in a)if(m!=="default"){const e=Object.getOwnPropertyDescriptor(a,m);Object.defineProperty(g,m,e.get?e:{enumerable:!0,get:()=>a[m]})}}return g.default=a,Object.freeze(g)}const n=Y(J),z=(a,g,m)=>{const[e,D]=n.useState(a);return[e,h=>{const i=c.ratingReducer(g.state||e,{...h,...g});m&&m(i,h.event),D(i)}]},F=l.createPropsContext(),S=n.forwardRef((a,g)=>{const m=l.usePropsContext(F,a),e={dir:s.dir,min:s.min,max:s.max,step:s.step,item:s.item,defaultValue:s.defaultValue,readonly:s.readonly,disabled:s.disabled,selection:s.selection,precision:s.precision,...m},D=U.useLocalization(),I=n.useRef(null),h=n.useRef(null),i=l.useDir(h,e.dir);n.useImperativeHandle(I,()=>({element:h.current,props:e})),n.useImperativeHandle(g,()=>I.current);const H=n.useCallback((t,o)=>{e.onChange&&I.current&&e.onChange.call(void 0,{value:t,target:I.current,syntheticEvent:o})},[e.onChange]),N=n.useMemo(()=>e.min!==void 0?e.min:s.min,[e.min]),R=n.useMemo(()=>e.max!==void 0?e.max:s.max,[e.max]),v=n.useMemo(()=>e.precision||s.precision,[e.precision]),r=n.useMemo(()=>e.step!==void 0?e.step:s.step,[e.step]),A=n.useMemo(()=>e.readonly||s.readonly,[e.readonly]),C=n.useMemo(()=>e.disabled||s.disabled,[e.disabled]),K=n.useMemo(()=>e.item||s.item,[e.item]),[G,f]=z(e.defaultValue!==void 0?e.defaultValue:s.defaultValue,{state:e.value,min:N,max:R,step:v==="half"?r/2:r},H),[w,E]=z(null,{state:e.value,min:N,max:R,step:v==="half"?r/2:r,precision:v}),p=n.useMemo(()=>e.value!==void 0?e.value:G,[e.value,G]),T=n.useMemo(()=>w,[w]),_=n.useMemo(()=>e.selection||s.selection,[e.selection]),k=n.useMemo(()=>r/(v==="half"?2:1),[r,v]),q=n.useCallback(t=>{if(!(!t.target||!t.target.element||A||C)){if(v==="half"){const o=t.target.element.getBoundingClientRect(),x=d.calcIsFirstHalf(i||"ltr",o,t.syntheticEvent.clientX)?d.toRound(t.target.value-r/2,k):t.target.value;f({type:c.RATING_ACTION.select,payload:x,event:t.syntheticEvent})}else f({type:c.RATING_ACTION.select,payload:t.target.value,event:t.syntheticEvent});if(e.onClick){const o={value:p,target:I.current,syntheticEvent:t.syntheticEvent};e.onClick.call(void 0,o)}}},[e.onClick,f,p]),B=n.useCallback(t=>{if(!(A||C)){switch(t.keyCode){case l.Keys.right:t.preventDefault(),f({type:i==="rtl"?c.RATING_ACTION.decrease:c.RATING_ACTION.increase,event:t});break;case l.Keys.left:t.preventDefault(),f({type:i==="rtl"?c.RATING_ACTION.increase:c.RATING_ACTION.decrease,event:t});break;case l.Keys.home:t.preventDefault(),f({type:i==="rtl"?c.RATING_ACTION.min:c.RATING_ACTION.max,event:t});break;case l.Keys.end:t.preventDefault(),f({type:i==="rtl"?c.RATING_ACTION.max:c.RATING_ACTION.min,event:t});break;case l.Keys.esc:t.preventDefault(),f({type:c.RATING_ACTION.deselect,event:t});break}e.onKeyDown&&e.onKeyDown.call(void 0,{value:p,target:I.current,syntheticEvent:t})}},[e.onKeyDown,f,p]),$=n.useCallback(t=>{if(e.onFocus){const o={target:I.current,syntheticEvent:t};e.onFocus.call(void 0,o)}},[e.onFocus]),W=n.useCallback(t=>{if(e.onBlur){const o={target:I.current,syntheticEvent:t};e.onBlur.call(void 0,o)}},[e.onBlur]),L=n.useCallback(t=>{if(!(!t.target||!t.target.element))if(v==="half"){const o=t.target.element.getBoundingClientRect(),x=d.calcIsFirstHalf(i||"ltr",o,t.syntheticEvent.clientX)?t.target.value-r/2:t.target.value;E({type:c.RATING_ACTION.select,payload:x,event:t.syntheticEvent})}else E({type:c.RATING_ACTION.select,payload:t.target.value,event:t.syntheticEvent})},[v,r,i]),j=n.useCallback(t=>{E({type:c.RATING_ACTION.reset,event:t.syntheticEvent})},[]),P=[],X=d.getRemainder(d.toRound(R-N,k),r);for(let t=N;t<=R;t=d.toRound(t+r,k)){const o=d.toRound(t+X,k),y=v==="half"?d.isHalf(o,T!==null?T:p!==null?p:0,r):!1,x=d.isSelected(o,p,r,_),O=d.isSelected(o,T!==null?T:p,r,_),b=d.isSelected(o,T,r,_);P.push(n.createElement(K,{key:o,value:o,dir:i,title:String(y?d.toRound(o-r/2,k):o),icon:e.icon,svgIcon:e.svgIcon,half:y,selected:x||O,hovered:b,onClick:q,onMouseMove:L,onMouseLeave:j},y&&n.createElement("span",{className:"k-rating-precision-complement"},!(e.icon||e.svgIconOutline)&&n.createElement(l.IconWrap,{name:"star-outline",icon:M.starOutlineIcon,style:{clipPath:`${i==="rtl"?"inset(0 50% 0 0)":"inset(0 0 0 50%)"}`},size:"xlarge"}),(e.icon||e.svgIconOutline)&&n.createElement(l.IconWrap,{name:l.toIconName(`${e.icon}-outline`),icon:e.svgIconOutline,size:"xlarge"})),y&&n.createElement("span",{className:"k-rating-precision-part"},!(e.icon||e.svgIcon)&&n.createElement(l.IconWrap,{name:"star",icon:M.starIcon,style:{clipPath:`${i==="rtl"?"inset(0 0 0 50%)":"inset(0 50% 0 0)"}`},size:"xlarge"}),(e.icon||e.svgIcon)&&n.createElement(l.IconWrap,{name:e.icon?l.toIconName(e.icon):void 0,icon:e.svgIcon,size:"xlarge"})),y&&n.createElement("span",{style:{width:"24px",height:"24px",display:"block"}}),!y&&!(e.icon||e.svgIcon)&&(b||O&&!b)&&n.createElement(l.IconWrap,{name:"star",icon:M.starIcon,size:"xlarge"})||!(e.icon||e.svgIcon)&&!b&&!O&&n.createElement(l.IconWrap,{name:"star-outline",icon:M.starOutlineIcon,size:"xlarge"})||(e.icon||e.svgIcon)&&(b||O&&!b)&&n.createElement(l.IconWrap,{name:e.icon,icon:e.svgIcon,size:"xlarge"})||(e.icon||e.svgIcon)&&!b&&n.createElement(l.IconWrap,{name:l.toIconName(`${e.icon}-outline`),icon:e.svgIconOutline,size:"xlarge"})))}return n.createElement("span",{id:e.id,style:e.style,ref:h,role:"slider",dir:i,tabIndex:l.getTabIndex(e.tabIndex,e.disabled,void 0),className:l.classNames("k-rating",{"k-rtl":i==="rtl","k-readonly":A,"k-disabled":C},e.className),onKeyDown:B,onFocus:$,onBlur:W,"aria-valuemin":N,"aria-valuemax":R,"aria-valuenow":p!==null?p:void 0,"aria-disabled":C?"true":void 0,"aria-label":D.toLanguageString(V.ratingAriaLabel,V.messages[V.ratingAriaLabel]),"aria-labelledby":e.ariaLabelledBy,"aria-describedby":e.ariaDescribedBy},n.createElement("input",{id:"rating",className:"k-hidden",readOnly:A,disabled:C}),n.createElement("span",{className:"k-rating-container"},P),e.label&&n.createElement("span",{className:"k-rating-label"},e.label))}),Z={id:u.string,dir:u.oneOf(["ltr","rtl"]),selection:u.oneOf(["continues","single"]),precision:u.oneOf(["item","half"]),value:(a,g,m)=>a.value&&a.min&&a.max&&a.step&&!(a.precision==="half"?d.isCorrectValue(a.min,a.max,a.step/2,a.value):d.isCorrectValue(a.min,a.max,a.step,a.value))&&a.precision==="half"?new Error(`Invalid prop + ${g} supplied to ${m}.
|
|
9
9
|
The value of the { value } property is not correct, please check your values.
|
|
10
|
-
`):null,defaultValue:
|
|
10
|
+
`):null,defaultValue:u.number,min:u.number,max:u.number,step:(a,g,m)=>a.step!==void 0&&a.step<=0?new Error(`Invalid prop + ${g} supplied to ${m}.
|
|
11
11
|
The value of the { step } property is cannot be equal or less than "0", please check your values.
|
|
12
|
-
`):null,hovered:
|
|
12
|
+
`):null,hovered:u.number,label:u.string,readonly:u.bool,disabled:u.bool,half:u.bool,icon:u.string,svgIcon:l.svgIconPropType,svgIconOutline:l.svgIconPropType,ariaDescribedBy:u.string},s={dir:"ltr",min:1,max:5,step:1,item:Q.RatingItem,defaultValue:null,readonly:!1,disabled:!1,selection:"continues",precision:"item"};S.displayName="KendoReactRating";S.propTypes=Z;exports.Rating=S;exports.RatingPropsContext=F;
|