@progress/kendo-react-inputs 8.2.0-develop.8 → 8.2.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/checkbox/Checkbox.js +1 -1
- package/checkbox/Checkbox.mjs +74 -70
- package/colors/ColorGradient.js +1 -1
- package/colors/ColorGradient.mjs +181 -121
- package/colors/ColorPalette.js +1 -1
- package/colors/ColorPalette.mjs +29 -29
- package/colors/ColorPicker.js +1 -1
- package/colors/ColorPicker.mjs +168 -152
- package/colors/FlatColorPicker.js +1 -1
- package/colors/FlatColorPicker.mjs +120 -104
- package/dist/cdn/js/kendo-react-inputs.js +1 -1
- package/index.d.mts +120 -45
- package/index.d.ts +120 -45
- package/input/Input.js +1 -1
- package/input/Input.mjs +47 -43
- package/maskedtextbox/MaskedTextBox.js +1 -1
- package/maskedtextbox/MaskedTextBox.mjs +61 -57
- package/numerictextbox/NumericTextBox.js +1 -1
- package/numerictextbox/NumericTextBox.mjs +89 -86
- package/package-metadata.mjs +1 -1
- package/package.json +8 -8
- package/range-slider/RangeSlider.js +11 -11
- package/range-slider/RangeSlider.mjs +176 -154
- package/range-slider/range-raducer.js +1 -1
- package/range-slider/range-raducer.mjs +35 -1
- package/signature/Signature.js +1 -1
- package/signature/Signature.mjs +112 -111
- package/slider/Slider.js +1 -1
- package/slider/Slider.mjs +29 -29
- package/textarea/TextArea.js +1 -1
- package/textarea/TextArea.mjs +96 -92
- package/textbox/Textbox.js +1 -1
- package/textbox/Textbox.mjs +54 -50
|
@@ -8,178 +8,199 @@
|
|
|
8
8
|
"use client";
|
|
9
9
|
import * as a from "react";
|
|
10
10
|
import R from "prop-types";
|
|
11
|
-
import { createPropsContext as Y, validatePackage as _, usePropsContext as j, useDir as F, Keys as
|
|
12
|
-
import { sliderDragTitle as
|
|
13
|
-
import { useLocalization as
|
|
14
|
-
import { RANGE_ACTION as
|
|
15
|
-
import { packageMetadata as
|
|
16
|
-
const
|
|
17
|
-
const [e,
|
|
18
|
-
(
|
|
19
|
-
const b =
|
|
20
|
-
|
|
11
|
+
import { createPropsContext as Y, validatePackage as _, usePropsContext as j, useDir as F, Keys as m, useDraggable as J, classNames as Q, getTabIndex as M } from "@progress/kendo-react-common";
|
|
12
|
+
import { sliderDragTitle as S, messages as V } from "../messages/index.mjs";
|
|
13
|
+
import { useLocalization as Z } from "@progress/kendo-react-intl";
|
|
14
|
+
import { RANGE_ACTION as r, rangeReducer as ee } from "./range-raducer.mjs";
|
|
15
|
+
import { packageMetadata as te } from "../package-metadata.mjs";
|
|
16
|
+
const ae = (n, s, p) => {
|
|
17
|
+
const [e, c] = a.useState(n), u = a.useCallback(
|
|
18
|
+
(g) => {
|
|
19
|
+
const b = ee(s.state || e, { ...g, ...s });
|
|
20
|
+
p && p(b, g.event), c(b);
|
|
21
21
|
},
|
|
22
|
-
[
|
|
22
|
+
[s, p]
|
|
23
23
|
);
|
|
24
|
-
return [e,
|
|
25
|
-
},
|
|
26
|
-
_(
|
|
27
|
-
const
|
|
28
|
-
step:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
24
|
+
return [e, u];
|
|
25
|
+
}, re = Y(), z = a.forwardRef((n, s) => {
|
|
26
|
+
_(te);
|
|
27
|
+
const p = j(re, n), e = {
|
|
28
|
+
step: y.step,
|
|
29
|
+
largeStep: y.largeStep,
|
|
30
|
+
defaultValue: y.defaultValue,
|
|
31
|
+
vertical: y.vertical,
|
|
32
|
+
disabled: y.disabled,
|
|
33
|
+
...p
|
|
34
|
+
}, c = a.useRef(null), u = a.useRef(null), g = a.useRef(null), b = a.useRef(null), I = a.useRef(null), P = a.useCallback(
|
|
34
35
|
() => {
|
|
35
36
|
b.current && b.current.focus();
|
|
36
37
|
},
|
|
37
38
|
[b]
|
|
38
39
|
);
|
|
39
|
-
a.useImperativeHandle(
|
|
40
|
-
element:
|
|
41
|
-
focus:
|
|
40
|
+
a.useImperativeHandle(c, () => ({
|
|
41
|
+
element: u.current,
|
|
42
|
+
focus: P,
|
|
42
43
|
props: e
|
|
43
|
-
})), a.useImperativeHandle(
|
|
44
|
-
const
|
|
44
|
+
})), a.useImperativeHandle(s, () => c.current);
|
|
45
|
+
const f = a.useMemo(
|
|
45
46
|
() => e.min,
|
|
46
47
|
[e.min]
|
|
47
48
|
), k = a.useMemo(
|
|
48
49
|
() => e.max,
|
|
49
50
|
[e.max]
|
|
51
|
+
), K = a.useMemo(
|
|
52
|
+
() => e.step !== void 0 ? e.step : y.step,
|
|
53
|
+
[e.step, y.step]
|
|
50
54
|
), A = a.useMemo(
|
|
51
|
-
() => e.
|
|
52
|
-
[e.
|
|
53
|
-
),
|
|
54
|
-
e.onChange &&
|
|
55
|
+
() => e.largeStep !== void 0 ? e.largeStep : y.largeStep,
|
|
56
|
+
[e.largeStep, y.largeStep]
|
|
57
|
+
), d = F(u, e.dir), H = (t, o) => {
|
|
58
|
+
e.onChange && c.current && e.onChange.call(void 0, {
|
|
55
59
|
value: t,
|
|
56
|
-
target:
|
|
57
|
-
syntheticEvent:
|
|
60
|
+
target: c.current,
|
|
61
|
+
syntheticEvent: o
|
|
58
62
|
});
|
|
59
|
-
}, [
|
|
60
|
-
e.defaultValue ||
|
|
63
|
+
}, [T, E] = a.useState(""), [x, l] = ae(
|
|
64
|
+
e.defaultValue || y.defaultValue,
|
|
61
65
|
{
|
|
62
|
-
min:
|
|
66
|
+
min: f,
|
|
63
67
|
max: k,
|
|
64
|
-
step:
|
|
68
|
+
step: K,
|
|
69
|
+
largeStep: A,
|
|
65
70
|
state: e.value
|
|
66
71
|
},
|
|
67
72
|
H
|
|
68
|
-
),
|
|
73
|
+
), i = a.useMemo(
|
|
69
74
|
() => e.value || x,
|
|
70
75
|
[e.value, x]
|
|
71
|
-
),
|
|
72
|
-
() => (
|
|
73
|
-
[
|
|
76
|
+
), N = a.useRef(null), w = a.useRef(null), h = a.useMemo(
|
|
77
|
+
() => (i.start - f) / (k - f) * 100,
|
|
78
|
+
[i.start, f, k]
|
|
74
79
|
), D = a.useMemo(
|
|
75
|
-
() => (
|
|
76
|
-
[
|
|
77
|
-
),
|
|
80
|
+
() => (i.end - f) / (k - f) * 100,
|
|
81
|
+
[i.end, f, k]
|
|
82
|
+
), q = a.useMemo(
|
|
78
83
|
() => e.vertical ? { paddingTop: 0, height: "100%" } : {},
|
|
79
84
|
[e.vertical]
|
|
80
|
-
),
|
|
85
|
+
), B = a.useMemo(
|
|
81
86
|
() => e.vertical ? { marginTop: "0.5rem", marginBottom: "0.5rem" } : { marginLeft: "0.5rem", marginRight: "0.5rem" },
|
|
82
87
|
[e.vertical]
|
|
83
|
-
),
|
|
88
|
+
), L = Z(), $ = a.useCallback(
|
|
84
89
|
(t) => {
|
|
85
90
|
if (!w.current)
|
|
86
91
|
return;
|
|
87
|
-
const
|
|
88
|
-
return
|
|
92
|
+
const o = w.current.getBoundingClientRect(), v = e.vertical ? o.bottom - t.clientY : d === "rtl" ? o.right - t.clientX : t.clientX - o.left, C = e.vertical ? o.height : o.width, W = v / C;
|
|
93
|
+
return f + W * (k - f);
|
|
89
94
|
},
|
|
90
95
|
[
|
|
91
96
|
w,
|
|
92
97
|
e.vertical,
|
|
98
|
+
d,
|
|
93
99
|
f,
|
|
94
|
-
m,
|
|
95
100
|
k,
|
|
96
101
|
x.start,
|
|
97
102
|
x.end,
|
|
98
103
|
e.value && e.value.start,
|
|
99
104
|
e.value && e.value.end
|
|
100
105
|
]
|
|
101
|
-
),
|
|
102
|
-
(t) => t <=
|
|
106
|
+
), G = a.useCallback(
|
|
107
|
+
(t) => t <= i.start ? "start" : t >= i.end ? "end" : 2 * t < i.end + i.start ? "start" : "end",
|
|
103
108
|
[
|
|
104
109
|
x.start,
|
|
105
110
|
x.end,
|
|
106
111
|
e.value && e.value.start,
|
|
107
112
|
e.value && e.value.end
|
|
108
113
|
]
|
|
109
|
-
),
|
|
114
|
+
), O = a.useCallback(
|
|
110
115
|
(t) => {
|
|
111
116
|
switch (t.keyCode) {
|
|
112
|
-
case
|
|
113
|
-
t.preventDefault(),
|
|
117
|
+
case m.right:
|
|
118
|
+
t.preventDefault(), l({ type: d === "rtl" ? r.decrease : r.increase, key: "start", event: t });
|
|
119
|
+
break;
|
|
120
|
+
case m.up:
|
|
121
|
+
t.preventDefault(), l({ type: r.increase, key: "start", event: t });
|
|
122
|
+
break;
|
|
123
|
+
case m.left:
|
|
124
|
+
t.preventDefault(), l({ type: d === "rtl" ? r.increase : r.decrease, key: "start", event: t });
|
|
114
125
|
break;
|
|
115
|
-
case
|
|
116
|
-
t.preventDefault(),
|
|
126
|
+
case m.down:
|
|
127
|
+
t.preventDefault(), l({ type: r.decrease, key: "start", event: t });
|
|
117
128
|
break;
|
|
118
|
-
case
|
|
119
|
-
t.preventDefault(),
|
|
129
|
+
case m.home:
|
|
130
|
+
t.preventDefault(), l({ type: r.min, key: "start", event: t });
|
|
120
131
|
break;
|
|
121
|
-
case
|
|
122
|
-
t.preventDefault(),
|
|
132
|
+
case m.end:
|
|
133
|
+
t.preventDefault(), l({ type: r.max, key: "start", event: t });
|
|
123
134
|
break;
|
|
124
|
-
case
|
|
125
|
-
t.preventDefault(),
|
|
135
|
+
case m.pageDown:
|
|
136
|
+
t.preventDefault(), l({ type: d === "rtl" ? r.increaseLarge : r.decreaseLarge, key: "start", event: t });
|
|
126
137
|
break;
|
|
127
|
-
case
|
|
128
|
-
t.preventDefault(),
|
|
138
|
+
case m.pageUp:
|
|
139
|
+
t.preventDefault(), l({ type: d === "rtl" ? r.decreaseLarge : r.increaseLarge, key: "start", event: t });
|
|
129
140
|
break;
|
|
130
141
|
}
|
|
131
142
|
},
|
|
132
|
-
[
|
|
133
|
-
),
|
|
143
|
+
[l]
|
|
144
|
+
), U = a.useCallback(
|
|
134
145
|
(t) => {
|
|
135
146
|
switch (t.keyCode) {
|
|
136
|
-
case
|
|
137
|
-
t.preventDefault(),
|
|
147
|
+
case m.right:
|
|
148
|
+
t.preventDefault(), l({ type: d === "rtl" ? r.decrease : r.increase, key: "end", event: t });
|
|
149
|
+
break;
|
|
150
|
+
case m.up:
|
|
151
|
+
t.preventDefault(), l({ type: r.increase, key: "end", event: t });
|
|
138
152
|
break;
|
|
139
|
-
case
|
|
140
|
-
t.preventDefault(),
|
|
153
|
+
case m.left:
|
|
154
|
+
t.preventDefault(), l({ type: d === "rtl" ? r.increase : r.decrease, key: "end", event: t });
|
|
141
155
|
break;
|
|
142
|
-
case
|
|
143
|
-
t.preventDefault(),
|
|
156
|
+
case m.down:
|
|
157
|
+
t.preventDefault(), l({ type: r.decrease, key: "end", event: t });
|
|
144
158
|
break;
|
|
145
|
-
case
|
|
146
|
-
t.preventDefault(),
|
|
159
|
+
case m.home:
|
|
160
|
+
t.preventDefault(), l({ type: r.min, key: "end", event: t });
|
|
147
161
|
break;
|
|
148
|
-
case
|
|
149
|
-
t.preventDefault(),
|
|
162
|
+
case m.end:
|
|
163
|
+
t.preventDefault(), l({ type: r.max, key: "end", event: t });
|
|
150
164
|
break;
|
|
151
|
-
case
|
|
152
|
-
t.preventDefault(),
|
|
165
|
+
case m.pageDown:
|
|
166
|
+
t.preventDefault(), l({ type: d === "rtl" ? r.increaseLarge : r.decreaseLarge, key: "end", event: t });
|
|
167
|
+
break;
|
|
168
|
+
case m.pageUp:
|
|
169
|
+
t.preventDefault(), l({ type: d === "rtl" ? r.decreaseLarge : r.increaseLarge, key: "end", event: t });
|
|
153
170
|
break;
|
|
154
171
|
}
|
|
155
172
|
},
|
|
156
|
-
[
|
|
173
|
+
[l, d]
|
|
157
174
|
), X = a.useCallback(
|
|
158
175
|
(t) => {
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
const
|
|
162
|
-
|
|
176
|
+
const o = $(t), v = G(o);
|
|
177
|
+
E(v), v === "end" ? I.current.focus() : b.current.focus();
|
|
178
|
+
const C = v === "end" ? r.end : r.start;
|
|
179
|
+
l({ type: C, payload: o, event: t });
|
|
163
180
|
},
|
|
164
|
-
[e.vertical,
|
|
181
|
+
[e.vertical, f, k, l]
|
|
165
182
|
);
|
|
166
|
-
return J(w, {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
183
|
+
return J(w, {
|
|
184
|
+
onPress: X,
|
|
185
|
+
onDrag: (t) => {
|
|
186
|
+
const o = $(t), v = T === "end" ? r.end : r.start;
|
|
187
|
+
l({ type: v, payload: o, event: t });
|
|
188
|
+
},
|
|
189
|
+
onRelease: (t) => {
|
|
190
|
+
const o = $(t), v = T === "end" ? r.end : r.start;
|
|
191
|
+
l({ type: v, payload: o, event: t }), E("");
|
|
192
|
+
}
|
|
193
|
+
}, { autoScroll: !1 }), /* @__PURE__ */ a.createElement(
|
|
173
194
|
"div",
|
|
174
195
|
{
|
|
175
196
|
id: e.id,
|
|
176
197
|
style: e.style,
|
|
177
|
-
ref:
|
|
178
|
-
dir:
|
|
198
|
+
ref: u,
|
|
199
|
+
dir: d,
|
|
179
200
|
className: Q(
|
|
180
201
|
"k-slider",
|
|
181
202
|
{
|
|
182
|
-
"k-rtl":
|
|
203
|
+
"k-rtl": d === "rtl",
|
|
183
204
|
"k-disabled": e.disabled,
|
|
184
205
|
"k-slider-vertical": e.vertical,
|
|
185
206
|
"k-slider-horizontal": !e.vertical
|
|
@@ -196,22 +217,22 @@ const te = (r, l, u) => {
|
|
|
196
217
|
flexGrow: 1,
|
|
197
218
|
position: "relative",
|
|
198
219
|
touchAction: "none",
|
|
199
|
-
...
|
|
220
|
+
...B
|
|
200
221
|
}
|
|
201
222
|
},
|
|
202
223
|
e.children && /* @__PURE__ */ a.createElement(
|
|
203
224
|
"ul",
|
|
204
225
|
{
|
|
205
226
|
className: "k-reset k-slider-items",
|
|
206
|
-
style: { ...
|
|
227
|
+
style: { ...q }
|
|
207
228
|
},
|
|
208
|
-
a.Children.map(e.children, (t,
|
|
229
|
+
a.Children.map(e.children, (t, o) => t && a.cloneElement(
|
|
209
230
|
t,
|
|
210
231
|
{
|
|
211
232
|
position: 100 * (t.props.position - e.min) / (e.max - e.min),
|
|
212
233
|
vertical: e.vertical,
|
|
213
|
-
firstTick:
|
|
214
|
-
lastTick:
|
|
234
|
+
firstTick: o === 0,
|
|
235
|
+
lastTick: o === a.Children.count(e.children) - 1
|
|
215
236
|
},
|
|
216
237
|
t.props.children
|
|
217
238
|
))
|
|
@@ -219,20 +240,20 @@ const te = (r, l, u) => {
|
|
|
219
240
|
/* @__PURE__ */ a.createElement(
|
|
220
241
|
"div",
|
|
221
242
|
{
|
|
222
|
-
ref:
|
|
243
|
+
ref: N,
|
|
223
244
|
className: "k-slider-track",
|
|
224
|
-
style: e.vertical ? { bottom: 0, height: "100%" } : { [
|
|
245
|
+
style: e.vertical ? { bottom: 0, height: "100%" } : { [d === "rtl" ? "right" : "left"]: 0, width: "100%" }
|
|
225
246
|
},
|
|
226
|
-
|
|
247
|
+
h !== null && D !== null && /* @__PURE__ */ a.createElement(
|
|
227
248
|
"div",
|
|
228
249
|
{
|
|
229
250
|
"data-selection": !0,
|
|
230
|
-
ref:
|
|
231
|
-
title: `${
|
|
251
|
+
ref: g,
|
|
252
|
+
title: `${i.start} - ${i.end}`,
|
|
232
253
|
className: "k-slider-selection",
|
|
233
|
-
style: e.vertical ? { height: D -
|
|
234
|
-
[
|
|
235
|
-
width: D -
|
|
254
|
+
style: e.vertical ? { height: D - h + "%", bottom: h + "%" } : {
|
|
255
|
+
[d === "rtl" ? "right" : "left"]: h + "%",
|
|
256
|
+
width: D - h + "%"
|
|
236
257
|
}
|
|
237
258
|
}
|
|
238
259
|
),
|
|
@@ -241,57 +262,57 @@ const te = (r, l, u) => {
|
|
|
241
262
|
{
|
|
242
263
|
ref: b,
|
|
243
264
|
role: "slider",
|
|
244
|
-
tabIndex:
|
|
245
|
-
"aria-valuemin":
|
|
246
|
-
"aria-valuemax": Math.max(k,
|
|
247
|
-
"aria-valuenow":
|
|
265
|
+
tabIndex: M(e.startTabIndex, e.disabled, void 0),
|
|
266
|
+
"aria-valuemin": f,
|
|
267
|
+
"aria-valuemax": Math.max(k, i.end),
|
|
268
|
+
"aria-valuenow": i.start,
|
|
248
269
|
"aria-disabled": e.disabled ? "true" : void 0,
|
|
249
|
-
"aria-valuetext": `${
|
|
270
|
+
"aria-valuetext": `${i.start} - ${i.end}`,
|
|
250
271
|
className: "k-draghandle k-draghandle-start",
|
|
251
|
-
title:
|
|
252
|
-
style: e.vertical ? { bottom: "calc(" +
|
|
253
|
-
onKeyDown:
|
|
272
|
+
title: L.toLanguageString(S, V[S]),
|
|
273
|
+
style: e.vertical ? { bottom: "calc(" + h + "%)", zIndex: 1 } : d === "rtl" ? { right: "calc(" + h + "% - 13px)", zIndex: 1 } : { left: "calc(" + h + "%)", zIndex: 1 },
|
|
274
|
+
onKeyDown: O
|
|
254
275
|
}
|
|
255
276
|
),
|
|
256
277
|
/* @__PURE__ */ a.createElement(
|
|
257
278
|
"span",
|
|
258
279
|
{
|
|
259
|
-
ref:
|
|
280
|
+
ref: I,
|
|
260
281
|
role: "slider",
|
|
261
|
-
tabIndex:
|
|
262
|
-
"aria-valuemin": Math.min(
|
|
282
|
+
tabIndex: M(e.endTabIndex, e.disabled, void 0),
|
|
283
|
+
"aria-valuemin": Math.min(f, i.start),
|
|
263
284
|
"aria-valuemax": k,
|
|
264
|
-
"aria-valuenow":
|
|
285
|
+
"aria-valuenow": i.end,
|
|
265
286
|
"aria-disabled": e.disabled ? "true" : void 0,
|
|
266
|
-
"aria-valuetext": `${
|
|
287
|
+
"aria-valuetext": `${i.start} - ${i.end}`,
|
|
267
288
|
className: "k-draghandle k-draghandle-end",
|
|
268
|
-
title:
|
|
269
|
-
style: e.vertical ? { bottom: "calc(" + D + "%)", zIndex: 1 } :
|
|
270
|
-
onKeyDown:
|
|
289
|
+
title: L.toLanguageString(S, V[S]),
|
|
290
|
+
style: e.vertical ? { bottom: "calc(" + D + "%)", zIndex: 1 } : d === "rtl" ? { right: "calc(" + D + "% - 13px)", zIndex: 1 } : { left: "calc(" + D + "%)", zIndex: 1 },
|
|
291
|
+
onKeyDown: U
|
|
271
292
|
}
|
|
272
293
|
)
|
|
273
294
|
)
|
|
274
295
|
)
|
|
275
296
|
);
|
|
276
|
-
}),
|
|
277
|
-
value: (
|
|
278
|
-
if (
|
|
279
|
-
const e =
|
|
280
|
-
if (e >
|
|
297
|
+
}), ne = {
|
|
298
|
+
value: (n, s, p) => {
|
|
299
|
+
if (n.value) {
|
|
300
|
+
const e = n.value.start, c = n.value.end, u = n.min, g = n.max;
|
|
301
|
+
if (e > c || e > g || e < u || c > g || c < u || c < e)
|
|
281
302
|
return new Error(
|
|
282
|
-
`Invalid prop + ${
|
|
303
|
+
`Invalid prop + ${s} supplied to ${p}.
|
|
283
304
|
The { start, end } value must be between the min & max value and { start, end } must be start < end.
|
|
284
305
|
`
|
|
285
306
|
);
|
|
286
307
|
}
|
|
287
308
|
return null;
|
|
288
309
|
},
|
|
289
|
-
defaultValue: (
|
|
290
|
-
if (
|
|
291
|
-
const e =
|
|
292
|
-
if (e >
|
|
310
|
+
defaultValue: (n, s, p) => {
|
|
311
|
+
if (n.defaultValue) {
|
|
312
|
+
const e = n.defaultValue.start, c = n.defaultValue.end, u = n.min, g = n.max;
|
|
313
|
+
if (e > c || e > g || e < u || c > g || c < u || c < e)
|
|
293
314
|
return new Error(
|
|
294
|
-
`Invalid prop + ${
|
|
315
|
+
`Invalid prop + ${s} supplied to ${p}.
|
|
295
316
|
The { start, end } value must be between the min & max value and { start, end } must be start < end.
|
|
296
317
|
`
|
|
297
318
|
);
|
|
@@ -300,35 +321,36 @@ const te = (r, l, u) => {
|
|
|
300
321
|
},
|
|
301
322
|
onChange: R.func,
|
|
302
323
|
step: R.number,
|
|
303
|
-
min: (
|
|
304
|
-
const e =
|
|
305
|
-
return
|
|
306
|
-
`Invalid prop + ${
|
|
307
|
-
${
|
|
324
|
+
min: (n, s, p) => {
|
|
325
|
+
const e = n[s], c = n.min, u = n.max;
|
|
326
|
+
return c === void 0 ? new Error(
|
|
327
|
+
`Invalid prop + ${s} supplied to ${p}.
|
|
328
|
+
${s} value can not be undefined.
|
|
308
329
|
`
|
|
309
|
-
) : e &&
|
|
310
|
-
`Invalid prop + ${
|
|
311
|
-
${
|
|
330
|
+
) : e && c >= u ? new Error(
|
|
331
|
+
`Invalid prop + ${s} supplied to ${p}.
|
|
332
|
+
${s} value can not be equal to or bigger than the max value.
|
|
312
333
|
`
|
|
313
334
|
) : null;
|
|
314
335
|
},
|
|
315
|
-
max: (
|
|
316
|
-
const e =
|
|
317
|
-
return
|
|
318
|
-
`Invalid prop + ${
|
|
319
|
-
${
|
|
336
|
+
max: (n, s, p) => {
|
|
337
|
+
const e = n[s], c = n.min, u = n.max;
|
|
338
|
+
return u === void 0 ? new Error(
|
|
339
|
+
`Invalid prop + ${s} supplied to ${p}.
|
|
340
|
+
${s} value can not be undefined.
|
|
320
341
|
`
|
|
321
|
-
) : e &&
|
|
322
|
-
`Invalid prop + ${
|
|
323
|
-
${
|
|
342
|
+
) : e && u <= c ? new Error(
|
|
343
|
+
`Invalid prop + ${s} supplied to ${p}.
|
|
344
|
+
${s} value can not be equal to or smaller than the min value.
|
|
324
345
|
`
|
|
325
346
|
) : null;
|
|
326
347
|
},
|
|
327
348
|
vertical: R.bool,
|
|
328
349
|
disabled: R.bool,
|
|
329
350
|
dir: R.oneOf(["ltr", "rtl"])
|
|
330
|
-
},
|
|
351
|
+
}, y = {
|
|
331
352
|
step: 1,
|
|
353
|
+
largeStep: 10,
|
|
332
354
|
defaultValue: {
|
|
333
355
|
start: 0,
|
|
334
356
|
end: 0
|
|
@@ -336,9 +358,9 @@ const te = (r, l, u) => {
|
|
|
336
358
|
vertical: !1,
|
|
337
359
|
disabled: !1
|
|
338
360
|
};
|
|
339
|
-
|
|
340
|
-
|
|
361
|
+
z.displayName = "KendoReactRangeSlider";
|
|
362
|
+
z.propTypes = ne;
|
|
341
363
|
export {
|
|
342
|
-
|
|
343
|
-
|
|
364
|
+
z as RangeSlider,
|
|
365
|
+
re as RangeSliderPropsContext
|
|
344
366
|
};
|
|
@@ -5,4 +5,4 @@
|
|
|
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"});var l=(e=>(e.start="start",e.end="end",e.min="min",e.max="max",e.increase="increase",e.decrease="decrease",e))(l||{});const
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var l=(e=>(e.start="start",e.end="end",e.min="min",e.max="max",e.increase="increase",e.decrease="decrease",e.increaseLarge="increaseLarge",e.decreaseLarge="decreaseLarge",e))(l||{});const s=(e,r)=>{let d,m;switch(r.type){case"start":if(r.payload===void 0)return e;d={start:r.payload>e.end?e.end:Math.max(r.payload,r.min),end:e.end};break;case"end":if(r.payload===void 0)return e;d={start:e.start,end:r.payload<e.start?e.start:Math.min(r.payload,r.max)};break;case"min":r.key==="start"?d={...e,start:r.min}:d={...e,end:Math.max(r.min,e.start)};break;case"max":r.key==="start"?d={...e,start:Math.min(r.max,e.end)}:d={...e,end:r.max};break;case"increase":if(r.step===void 0||r.key===void 0)return e;m=e[r.key]+r.step,r.key==="start"?m<r.min?d={...e,start:r.min}:d={...e,start:Math.min(m,e.end)}:m>r.max?d={...e,end:r.max}:d={...e,end:Math.max(m,e.start)};break;case"decrease":if(r.step===void 0||r.key===void 0)return e;m=e[r.key]-r.step,r.key==="start"?m<r.min?d={...e,start:r.min}:d={...e,start:Math.min(m,e.end)}:m>r.max?d={...e,end:r.max}:d={...e,end:Math.max(m,e.start)};break;case"increaseLarge":if(r.largeStep===void 0||r.key===void 0)return e;m=e[r.key]+r.largeStep,r.key==="start"?m<r.min?d={...e,start:r.min}:d={...e,start:Math.min(m,e.end)}:m>r.max?d={...e,end:r.max}:d={...e,end:Math.max(m,e.start)};break;case"decreaseLarge":if(r.largeStep===void 0||r.key===void 0)return e;m=e[r.key]-r.largeStep,r.key==="start"?m<r.min?d={...e,start:r.min}:d={...e,start:Math.min(m,e.end)}:m>r.max?d={...e,end:r.max}:d={...e,end:Math.max(m,e.start)};break;default:d=e;break}return d};exports.RANGE_ACTION=l;exports.rangeReducer=s;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
var l = /* @__PURE__ */ ((e) => (e.start = "start", e.end = "end", e.min = "min", e.max = "max", e.increase = "increase", e.decrease = "decrease", e))(l || {});
|
|
9
|
+
var l = /* @__PURE__ */ ((e) => (e.start = "start", e.end = "end", e.min = "min", e.max = "max", e.increase = "increase", e.decrease = "decrease", e.increaseLarge = "increaseLarge", e.decreaseLarge = "decreaseLarge", e))(l || {});
|
|
10
10
|
const s = (e, r) => {
|
|
11
11
|
let d, m;
|
|
12
12
|
switch (r.type) {
|
|
@@ -78,6 +78,40 @@ const s = (e, r) => {
|
|
|
78
78
|
end: Math.max(m, e.start)
|
|
79
79
|
};
|
|
80
80
|
break;
|
|
81
|
+
case "increaseLarge":
|
|
82
|
+
if (r.largeStep === void 0 || r.key === void 0)
|
|
83
|
+
return e;
|
|
84
|
+
m = e[r.key] + r.largeStep, r.key === "start" ? m < r.min ? d = {
|
|
85
|
+
...e,
|
|
86
|
+
start: r.min
|
|
87
|
+
} : d = {
|
|
88
|
+
...e,
|
|
89
|
+
start: Math.min(m, e.end)
|
|
90
|
+
} : m > r.max ? d = {
|
|
91
|
+
...e,
|
|
92
|
+
end: r.max
|
|
93
|
+
} : d = {
|
|
94
|
+
...e,
|
|
95
|
+
end: Math.max(m, e.start)
|
|
96
|
+
};
|
|
97
|
+
break;
|
|
98
|
+
case "decreaseLarge":
|
|
99
|
+
if (r.largeStep === void 0 || r.key === void 0)
|
|
100
|
+
return e;
|
|
101
|
+
m = e[r.key] - r.largeStep, r.key === "start" ? m < r.min ? d = {
|
|
102
|
+
...e,
|
|
103
|
+
start: r.min
|
|
104
|
+
} : d = {
|
|
105
|
+
...e,
|
|
106
|
+
start: Math.min(m, e.end)
|
|
107
|
+
} : m > r.max ? d = {
|
|
108
|
+
...e,
|
|
109
|
+
end: r.max
|
|
110
|
+
} : d = {
|
|
111
|
+
...e,
|
|
112
|
+
end: Math.max(m, e.start)
|
|
113
|
+
};
|
|
114
|
+
break;
|
|
81
115
|
default:
|
|
82
116
|
d = e;
|
|
83
117
|
break;
|
package/signature/Signature.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
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 Ce=require("@progress/kendo-inputs-common"),
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ce=require("@progress/kendo-inputs-common"),B=require("@progress/kendo-react-buttons"),r=require("@progress/kendo-react-common"),he=require("@progress/kendo-react-dialogs"),Se=require("@progress/kendo-react-intl"),a=require("prop-types"),ze=require("react"),p=require("../messages/index.js"),Oe=require("../package-metadata.js"),Ee=require("./utils/index.js"),_=require("@progress/kendo-svg-icons");function xe(c){const b=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const f in c)if(f!=="default"){const e=Object.getOwnPropertyDescriptor(c,f);Object.defineProperty(b,f,e.get?e:{enumerable:!0,get:()=>c[f]})}}return b.default=c,Object.freeze(b)}const n=xe(ze),Me=250,Ie=84,te=3,ne=2,we="#000000",Pe="#ffffff",ee=c=>c!==void 0,oe=r.createPropsContext(),O=n.forwardRef((c,b)=>{r.validatePackage(Oe.packageMetadata);const f=r.usePropsContext(oe,c),e=n.useMemo(()=>({strokeWidth:l.strokeWidth,smooth:l.smooth,popupScale:l.popupScale,exportScale:l.exportScale,maximizable:l.maximizable,disabled:l.disabled,required:l.required,validityStyles:l.validityStyles,onChange:l.onChange,onFocus:l.onFocus,onBlur:l.onBlur,onOpen:l.onOpen,onClose:l.onClose,size:l.size,rounded:l.rounded,fillMode:l.fillMode,...f}),[f]),E=Se.useLocalization(),d=n.useRef(null),y=n.useRef(null),N=n.useRef(null),F=n.useRef(null),x=n.useRef(null),[s,ae]=n.useState(),[v,j]=n.useState(!1),[M,G]=n.useState(!1),[C,W]=n.useState(),[se,re]=n.useState(),A=ee(e.value)?e.value:C,[ie,le]=n.useState(!1),k=ee(e.open),g=k?e.open:ie,ce=e.maximized||M||!e.maximizable||e.disabled,ue=!(e.maximized&&!M),de=!(!(e.value||C)||M||e.readOnly||e.disabled),V=E.toLanguageString(p.signatureMaximize,p.messages[p.signatureMaximize]),U=E.toLanguageString(p.signatureMinimize,p.messages[p.signatureMinimize]),H=E.toLanguageString(p.signatureClear,p.messages[p.signatureClear]),I=e.popupScale||te,w=e.exportScale||ne,P=t=>{W(t),e.onChange&&e.onChange({value:t})},me=t=>{s==null||s.loadImage(t.value),P(t.value)};n.useEffect(()=>{e.value!==C&&(W(e.value),s==null||s.loadImage(e.value))},[e.value]);const pe=()=>{s==null||s.clear(),P()},h=n.useCallback(t=>{k||le(t)},[k]),fe=t=>{var o,i;Q(t),(i=((o=x.current)==null?void 0:o.element)||y.current)==null||i.focus()},L=n.useCallback(()=>{let t=we;return!e.color&&typeof document!="undefined"&&d.current&&(t=getComputedStyle(d.current).color),e.color||t},[e.color]),q=n.useCallback(()=>{let t=Pe;return!e.backgroundColor&&typeof document!="undefined"&&d.current&&(t=getComputedStyle(d.current).backgroundColor),e.backgroundColor||t},[e.backgroundColor]),$=()=>({scale:e.maximized?e.popupScale:1,color:L(),backgroundColor:q(),strokeWidth:e.strokeWidth,smooth:e.smooth,readonly:e.readOnly}),K=async t=>{const{width:o,height:i}=t;return await(s==null?void 0:s.exportImage({width:o*w,height:i*w}))};n.useEffect(()=>{const t=y.current,o=new Ce.SignaturePad(t,$());return A&&o.loadImage(A),ae(o),()=>o.destroy()},[]),n.useEffect(()=>{s==null||s.setOptions({onChange:async()=>P(await K(Y())),onDraw:()=>G(!0),onDrawEnd:()=>G(!1)})},[s]),r.useIsomorphicLayoutEffect(()=>s==null?void 0:s.setOptions($()),[e.readOnly,e.color,e.backgroundColor,e.strokeWidth,e.smooth]),n.useEffect(()=>{var i,u;const t=(u=(i=N.current)==null?void 0:i.element)==null?void 0:u.querySelector(".k-overlay");if(!t)return;const o=()=>h(!1);return t.addEventListener("click",o),()=>t.removeEventListener("click",o)},[g]),n.useEffect(()=>{if(!g||typeof document=="undefined")return;const t=o=>{var i,u;o.key==="Escape"&&(h(!1),(u=(i=x.current)==null?void 0:i.element)==null||u.focus())};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[g]),n.useEffect(()=>{var t,o;e.maximized&&((o=(t=F.current)==null?void 0:t.element)==null||o.focus())},[]);const D=n.useCallback(()=>{var t;return(t=y.current)==null?void 0:t.focus()},[]),S=n.useCallback(()=>e.value,[e.value]),X=n.useCallback(()=>e.name,[e.name]),z=n.useCallback(()=>e.required,[e.required]),R=n.useCallback(()=>{const t=e.validationMessage!==void 0,i=!S(),u=e.valid!==void 0?e.valid:!z()||!i;return{customError:t,valid:u,valueMissing:i}},[e.validationMessage,e.valid,S,z]),T=n.useCallback(()=>e.validityStyles,[e.validityStyles]),J=n.useCallback(()=>e,[e]),m=n.useCallback(()=>{const t={element:d.current,focus:D};return Object.defineProperty(t,"name",{get:X}),Object.defineProperty(t,"value",{get:S}),Object.defineProperty(t,"validity",{get:R}),Object.defineProperty(t,"validityStyles",{get:T}),Object.defineProperty(t,"required",{get:z}),Object.defineProperty(t,"props",{get:J}),Object.defineProperty(t,"color",{get:L}),Object.defineProperty(t,"backgroundColor",{get:q}),t},[X,S,R,T,z,D,J,L,q]);n.useImperativeHandle(b,m);const ge=n.useCallback(t=>{v||e.maximized||(j(!0),r.dispatchEvent(e.onFocus,t,m(),{}))},[v,e.onFocus,m]),be=n.useCallback(t=>{Ee.hasParent(t.relatedTarget,d.current)||(j(!1),r.dispatchEvent(e.onBlur,t,m(),{}))},[v,e.onBlur,m]),ke=n.useCallback(async t=>{re(await K(Z())),h(!0),r.dispatchEvent(e.onOpen,t,m(),{})},[g,k,e.onOpen,e.value,C,m]),Q=n.useCallback(t=>{h(!1),r.dispatchEvent(e.onClose,t,m(),{})},[g,k,e.onClose,m]),ye=()=>{pe(),D()},Y=()=>{var i,u;const t=e.width||((i=d.current)==null?void 0:i.offsetWidth)||Me,o=e.height||((u=d.current)==null?void 0:u.offsetHeight)||Ie;return{width:t,height:o}},Z=()=>{const{width:t,height:o}=Y();return{width:t*I,height:o*I}},ve=!T()||R().valid;return n.createElement("div",{ref:d,dir:e.dir,style:{width:e.width,height:e.height,...e.style},className:r.classNames("k-input","k-signature",{"k-signature-maximized":e.maximized,[`k-signature-${r.kendoThemeMaps.sizeMap[e.size]||e.size}`]:e.size,[`k-signature-${e.fillMode}`]:e.fillMode,[`k-input-${e.fillMode}`]:e.fillMode,[`k-rounded-${r.kendoThemeMaps.roundedMap[e.rounded]||e.rounded}`]:e.rounded,"k-invalid":!ve,"k-required":e.required,"k-disabled":e.disabled,"k-focus":v},e.className),onFocus:ge,onBlur:be},n.createElement("div",{className:"k-signature-canvas",ref:y,tabIndex:r.getTabIndex(e.tabIndex,e.disabled),role:"img",id:e.id,"aria-label":e.ariaLabel,"aria-labelledby":e.ariaLabelledBy,"aria-describedby":e.ariaDescribedBy,"aria-disabled":e.disabled?"true":void 0}),n.createElement("div",{className:"k-signature-actions k-signature-actions-top"},n.createElement(B.Button,{type:"button",className:r.classNames("k-signature-action","k-signature-maximize",{"k-hidden":e.disabled||ce}),ref:x,icon:"hyperlink-open",svgIcon:_.hyperlinkOpenIcon,fillMode:"flat",size:e.size,onClick:ke,"aria-label":V,title:V}),n.createElement(B.Button,{type:"button",className:r.classNames("k-signature-action","k-signature-minimize","k-rotate-180",{"k-hidden":e.disabled||ue}),ref:F,icon:"hyperlink-open",svgIcon:_.hyperlinkOpenIcon,fillMode:"flat",size:e.size,onClick:Q,"aria-label":U,title:U})),!e.hideLine&&n.createElement("div",{className:"k-signature-line",style:{zIndex:2,pointerEvents:"none"}}),n.createElement("div",{className:"k-signature-actions k-signature-actions-bottom"},de&&n.createElement(B.Button,{type:"button",className:"k-signature-action k-signature-clear",icon:"x",svgIcon:_.xIcon,fillMode:"flat",size:e.size,onClick:ye,"aria-label":H,title:H})),g&&n.createElement(he.Dialog,{ref:N},n.createElement(O,{...e,...Z(),value:se,maximized:!0,exportScale:1/I*w,open:!1,onChange:me,onClose:fe})))});O.propTypes={value:a.string,width:a.number,height:a.number,tabIndex:a.number,dir:a.string,ariaDescribedBy:a.string,ariaLabelledBy:a.string,ariaLabel:a.string,readOnly:a.bool,disabled:a.bool,validationMessage:a.string,required:a.bool,onChange:a.func,onFocus:a.func,onBlur:a.func,onOpen:a.func,onClose:a.func,size:a.oneOf([null,"small","medium","large"]),rounded:a.oneOf([null,"small","medium","large"]),fillMode:a.oneOf([null,"solid","flat","outline"])};const l={strokeWidth:1,smooth:!1,popupScale:te,exportScale:ne,maximizable:!0,disabled:!1,required:!1,validityStyles:!0,onChange:c=>r.noop,onFocus:c=>r.noop,onBlur:c=>r.noop,onOpen:c=>r.noop,onClose:c=>r.noop,size:"medium",rounded:"medium",fillMode:"solid"};O.displayName="KendoSignature";exports.Signature=O;exports.SignaturePropsContext=oe;
|