@progress/kendo-react-inputs 14.5.0-develop.8 → 15.0.0-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/MaskedTextBoxMcpWrapper.d.ts +17 -0
- package/MaskedTextBoxMcpWrapper.js +8 -0
- package/MaskedTextBoxMcpWrapper.mjs +18 -0
- package/README.md +4 -4
- package/checkbox/Checkbox.js +1 -1
- package/checkbox/Checkbox.mjs +64 -64
- package/colors/ColorGradient.js +1 -1
- package/colors/ColorGradient.mjs +74 -72
- package/colors/ColorInput.js +1 -1
- package/colors/ColorInput.mjs +57 -45
- package/colors/ColorPalette.js +1 -1
- package/colors/ColorPalette.mjs +84 -81
- package/colors/ColorPicker.js +1 -1
- package/colors/ColorPicker.mjs +228 -215
- package/colors/FlatColorPicker.js +1 -1
- package/colors/FlatColorPicker.mjs +86 -94
- package/colors/interfaces/ColorPickerProps.d.ts +6 -1
- package/dist/cdn/js/kendo-react-inputs.js +1 -1
- package/index.d.mts +5 -1
- package/index.d.ts +5 -1
- package/index.js +1 -1
- package/index.mjs +92 -89
- package/maskedtextbox/MaskedTextBoxProps.d.ts +6 -1
- package/messages/index.d.ts +55 -0
- package/messages/index.js +1 -1
- package/messages/index.mjs +82 -60
- package/numerictextbox/NumericTextBox.js +1 -1
- package/numerictextbox/NumericTextBox.mjs +215 -213
- package/numerictextbox/interfaces/NumericTextBoxProps.d.ts +6 -1
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +16 -11
- package/radiobutton/RadioButton.js +1 -1
- package/radiobutton/RadioButton.mjs +23 -20
- package/radiobutton/interfaces/RadioButtonProps.d.ts +7 -0
- package/range-slider/RangeSlider.d.ts +14 -1
- package/range-slider/RangeSlider.js +11 -11
- package/range-slider/RangeSlider.mjs +188 -185
- package/rating/Rating.d.ts +6 -1
- package/rating/Rating.js +3 -3
- package/rating/Rating.mjs +83 -76
- package/signature/Signature.js +1 -1
- package/signature/Signature.mjs +127 -129
- package/signature/interfaces/SignatureProps.d.ts +6 -1
- package/slider/Slider.d.ts +6 -1
- package/slider/Slider.js +1 -1
- package/slider/Slider.mjs +155 -150
- package/slider/SliderLabel.js +1 -1
- package/slider/SliderLabel.mjs +3 -2
- package/switch/Switch.d.ts +6 -1
- package/switch/Switch.js +1 -1
- package/switch/Switch.mjs +100 -100
- package/textarea/TextArea.js +1 -1
- package/textarea/TextArea.mjs +101 -101
- package/textarea/interfaces/TextAreaProps.d.ts +6 -1
- package/textbox/Textbox.d.ts +20 -1
- package/textbox/Textbox.js +1 -1
- package/textbox/Textbox.mjs +92 -81
package/slider/Slider.mjs
CHANGED
|
@@ -5,180 +5,178 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import * as
|
|
9
|
-
import { useState as
|
|
8
|
+
import * as r from "react";
|
|
9
|
+
import { useState as z, useRef as B, useMemo as V, useEffect as H, useCallback as c, useImperativeHandle as ue } from "react";
|
|
10
10
|
import i from "prop-types";
|
|
11
|
-
import { withPropsContext as
|
|
12
|
-
import { LocalizationService as
|
|
13
|
-
import {
|
|
14
|
-
import { SLIDER_LABEL_ATTRIBUTE as
|
|
11
|
+
import { withPropsContext as ge, dispatchEvent as fe, Keys as m, useWebMcpRegister as ve, classNames as he, Draggable as be, getTabIndex as ye, createPropsContext as ke } from "@progress/kendo-react-common";
|
|
12
|
+
import { LocalizationService as xe, registerForLocalization as Se } from "@progress/kendo-react-intl";
|
|
13
|
+
import { sliderAriaLabel as E, messages as x, sliderDragTitle as O, sliderDecreaseValue as W, sliderIncreaseValue as X } from "../messages/index.mjs";
|
|
14
|
+
import { SLIDER_LABEL_ATTRIBUTE as we } from "./SliderLabel.mjs";
|
|
15
15
|
import { Button as _ } from "@progress/kendo-react-buttons";
|
|
16
|
-
import {
|
|
17
|
-
const
|
|
16
|
+
import { chevronUpIcon as j, chevronLeftIcon as G, chevronDownIcon as Y, chevronRightIcon as J } from "@progress/kendo-svg-icons";
|
|
17
|
+
const f = {
|
|
18
18
|
step: 1,
|
|
19
19
|
largeStep: 10,
|
|
20
20
|
buttons: !1,
|
|
21
21
|
vertical: !1,
|
|
22
22
|
disabled: !1,
|
|
23
23
|
tabIndex: 0
|
|
24
|
-
},
|
|
25
|
-
var
|
|
24
|
+
}, A = r.forwardRef((e, Q) => {
|
|
25
|
+
var K, U, q;
|
|
26
26
|
const {
|
|
27
|
-
step: u =
|
|
28
|
-
largeStep:
|
|
29
|
-
vertical: a =
|
|
30
|
-
disabled: d =
|
|
31
|
-
tabIndex:
|
|
32
|
-
} =
|
|
33
|
-
const
|
|
34
|
-
return
|
|
35
|
-
}, [
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}, [r, t.min, t.max]), f = (K = t.dir) != null ? K : I;
|
|
39
|
-
q(() => {
|
|
40
|
-
if (t.dir === void 0 && v.current) {
|
|
27
|
+
step: u = f.step,
|
|
28
|
+
largeStep: T = f.largeStep,
|
|
29
|
+
vertical: a = f.vertical,
|
|
30
|
+
disabled: d = f.disabled,
|
|
31
|
+
tabIndex: Z = f.tabIndex
|
|
32
|
+
} = e, [$, p] = z((K = e.defaultValue) != null ? K : e.min), [ee, F] = z(!1), [D, te] = z(e.dir), L = B(null), v = B(null), h = V(() => new xe(), []), R = B(null), N = e.value !== void 0, S = N && e.value !== void 0 ? e.value : $, l = V(() => S < e.min ? e.min : S > e.max ? e.max : S, [S, e.min, e.max]), b = V(() => {
|
|
33
|
+
const t = e.max - e.min;
|
|
34
|
+
return t === 0 ? 0 : (l - e.min) / t * 100;
|
|
35
|
+
}, [l, e.min, e.max]), g = (U = e.dir) != null ? U : D;
|
|
36
|
+
H(() => {
|
|
37
|
+
if (e.dir === void 0 && v.current) {
|
|
41
38
|
const n = window.getComputedStyle(v.current).direction;
|
|
42
|
-
n !==
|
|
39
|
+
n !== D && te(n);
|
|
43
40
|
}
|
|
44
|
-
}, [
|
|
45
|
-
const
|
|
46
|
-
let n =
|
|
41
|
+
}, [e.dir, D]);
|
|
42
|
+
const M = c((t) => {
|
|
43
|
+
let n = t;
|
|
47
44
|
for (; n; ) {
|
|
48
|
-
if (n.getAttribute(
|
|
45
|
+
if (n.getAttribute(we))
|
|
49
46
|
return !0;
|
|
50
47
|
n = n.parentElement;
|
|
51
48
|
}
|
|
52
49
|
return !1;
|
|
53
|
-
}, []), s =
|
|
54
|
-
(
|
|
55
|
-
const
|
|
56
|
-
|
|
50
|
+
}, []), s = c(
|
|
51
|
+
(t, n) => {
|
|
52
|
+
const o = Math.min(Math.max(n, e.min), e.max);
|
|
53
|
+
N || p(o), fe(e.onChange, t, R.current, { value: o });
|
|
57
54
|
},
|
|
58
|
-
[
|
|
59
|
-
),
|
|
60
|
-
|
|
61
|
-
}, []),
|
|
62
|
-
|
|
63
|
-
}, []),
|
|
64
|
-
(
|
|
55
|
+
[e.min, e.max, e.onChange, N]
|
|
56
|
+
), ne = c(() => {
|
|
57
|
+
F(!0);
|
|
58
|
+
}, []), ae = c(() => {
|
|
59
|
+
F(!1);
|
|
60
|
+
}, []), ie = c(
|
|
61
|
+
(t) => {
|
|
65
62
|
if (d)
|
|
66
63
|
return;
|
|
67
64
|
let n;
|
|
68
|
-
|
|
65
|
+
t.keyCode === m.left || t.keyCode === m.down ? n = l - (u || 0) : t.keyCode === m.right || t.keyCode === m.up ? n = l + (u || 0) : t.keyCode === m.pageDown ? n = l - (T || 0) : t.keyCode === m.pageUp ? n = l + (T || 0) : t.keyCode === m.home ? n = e.min : t.keyCode === m.end && (n = e.max), n !== void 0 && (t.preventDefault(), s(t, n));
|
|
69
66
|
},
|
|
70
|
-
[
|
|
71
|
-
),
|
|
72
|
-
(
|
|
73
|
-
|
|
67
|
+
[l, u, T, e.min, e.max, s, d]
|
|
68
|
+
), re = c(
|
|
69
|
+
(t) => {
|
|
70
|
+
t.preventDefault(), !d && s(t, l - (u || 0));
|
|
74
71
|
},
|
|
75
|
-
[
|
|
76
|
-
), le =
|
|
77
|
-
(
|
|
78
|
-
|
|
72
|
+
[l, u, s, d]
|
|
73
|
+
), le = c(
|
|
74
|
+
(t) => {
|
|
75
|
+
t.preventDefault(), !d && s(t, l + (u || 0));
|
|
79
76
|
},
|
|
80
|
-
[
|
|
81
|
-
),
|
|
82
|
-
(
|
|
83
|
-
const n =
|
|
84
|
-
let
|
|
85
|
-
a ?
|
|
86
|
-
const
|
|
87
|
-
s(
|
|
77
|
+
[l, u, s, d]
|
|
78
|
+
), w = c(
|
|
79
|
+
(t) => {
|
|
80
|
+
const n = t.element.getBoundingClientRect();
|
|
81
|
+
let o;
|
|
82
|
+
a ? o = n.bottom - t.event.clientY : o = g === "rtl" ? n.right - t.event.clientX : t.event.clientX - n.left;
|
|
83
|
+
const y = a ? n.height : n.width, k = o / y;
|
|
84
|
+
s(t, e.min + k * (e.max - e.min));
|
|
88
85
|
},
|
|
89
|
-
[a,
|
|
90
|
-
),
|
|
91
|
-
(
|
|
92
|
-
|
|
86
|
+
[a, e.min, e.max, g, s]
|
|
87
|
+
), ce = c(
|
|
88
|
+
(t) => {
|
|
89
|
+
M(t.event.originalEvent.target) || (t.event.isTouch && t.event.originalEvent.preventDefault(), w(t));
|
|
93
90
|
},
|
|
94
|
-
[
|
|
95
|
-
),
|
|
96
|
-
(
|
|
97
|
-
|
|
91
|
+
[M, w]
|
|
92
|
+
), oe = c(
|
|
93
|
+
(t) => {
|
|
94
|
+
t.event.originalEvent.preventDefault(), w(t);
|
|
98
95
|
},
|
|
99
|
-
[
|
|
100
|
-
),
|
|
96
|
+
[w]
|
|
97
|
+
), C = c(() => {
|
|
101
98
|
v.current && v.current.focus();
|
|
102
|
-
}, []),
|
|
103
|
-
(
|
|
104
|
-
if (!
|
|
105
|
-
return
|
|
106
|
-
let n,
|
|
107
|
-
return
|
|
99
|
+
}, []), de = c(
|
|
100
|
+
(t) => {
|
|
101
|
+
if (!t.enabled)
|
|
102
|
+
return t.children;
|
|
103
|
+
let n, o, y, k;
|
|
104
|
+
return g === "rtl" ? (n = a ? j : G, o = a ? Y : J, y = a ? "chevron-up" : "chevron-left", k = a ? "chevron-down" : "chevron-right") : (n = a ? j : J, o = a ? Y : G, y = a ? "chevron-up" : "chevron-right", k = a ? "chevron-down" : "chevron-left"), /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(
|
|
108
105
|
_,
|
|
109
106
|
{
|
|
110
107
|
className: "k-button-decrease",
|
|
111
108
|
rounded: "full",
|
|
112
|
-
icon:
|
|
113
|
-
svgIcon:
|
|
114
|
-
title:
|
|
115
|
-
onClick:
|
|
109
|
+
icon: k,
|
|
110
|
+
svgIcon: o,
|
|
111
|
+
title: t.decrementTitle,
|
|
112
|
+
onClick: t.decrement
|
|
116
113
|
}
|
|
117
|
-
),
|
|
114
|
+
), t.children, /* @__PURE__ */ r.createElement(
|
|
118
115
|
_,
|
|
119
116
|
{
|
|
120
117
|
className: "k-button-increase",
|
|
121
118
|
rounded: "full",
|
|
122
|
-
icon:
|
|
119
|
+
icon: y,
|
|
123
120
|
svgIcon: n,
|
|
124
|
-
title:
|
|
125
|
-
onClick:
|
|
121
|
+
title: t.incrementTitle,
|
|
122
|
+
onClick: t.increment
|
|
126
123
|
}
|
|
127
124
|
));
|
|
128
125
|
},
|
|
129
|
-
[
|
|
126
|
+
[g, a]
|
|
130
127
|
);
|
|
131
|
-
|
|
132
|
-
|
|
128
|
+
ue(
|
|
129
|
+
Q,
|
|
133
130
|
() => ({
|
|
134
|
-
props:
|
|
135
|
-
sliderTrack:
|
|
136
|
-
focus:
|
|
131
|
+
props: e,
|
|
132
|
+
sliderTrack: L.current,
|
|
133
|
+
focus: C
|
|
137
134
|
}),
|
|
138
|
-
[
|
|
139
|
-
),
|
|
140
|
-
|
|
141
|
-
props:
|
|
142
|
-
sliderTrack:
|
|
143
|
-
focus:
|
|
135
|
+
[e, C]
|
|
136
|
+
), ve("slider", R, e, e.webMcp), H(() => {
|
|
137
|
+
R.current = {
|
|
138
|
+
props: e,
|
|
139
|
+
sliderTrack: L.current,
|
|
140
|
+
focus: C
|
|
144
141
|
};
|
|
145
|
-
}, [
|
|
146
|
-
const
|
|
147
|
-
let
|
|
148
|
-
return a ?
|
|
142
|
+
}, [e, C]);
|
|
143
|
+
const se = a ? { marginTop: "0.5rem", marginBottom: "0.5rem" } : { marginLeft: "0.5rem", marginRight: "0.5rem" }, me = a ? { paddingTop: 0, height: "100%" } : {};
|
|
144
|
+
let I;
|
|
145
|
+
return a ? I = { bottom: "calc(" + b + "%)", zIndex: 1 } : g === "rtl" ? I = { right: "calc(" + b + "% - 13px)", zIndex: 1 } : I = { left: "calc(" + b + "%)", zIndex: 1 }, /* @__PURE__ */ r.createElement(
|
|
149
146
|
"div",
|
|
150
147
|
{
|
|
151
148
|
ref: v,
|
|
152
|
-
dir:
|
|
153
|
-
id:
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
149
|
+
dir: g,
|
|
150
|
+
id: e.id,
|
|
151
|
+
"aria-label": e.ariaLabel || h.toLanguageString(E, x[E]),
|
|
152
|
+
style: { gap: 0, ...e.style },
|
|
153
|
+
onFocus: ne,
|
|
154
|
+
onBlur: ae,
|
|
155
|
+
onKeyDown: ie,
|
|
156
|
+
className: he(
|
|
159
157
|
"k-slider",
|
|
160
158
|
{
|
|
161
|
-
"k-focus":
|
|
159
|
+
"k-focus": ee,
|
|
162
160
|
"k-disabled": d,
|
|
163
161
|
"k-slider-horizontal": !a,
|
|
164
162
|
"k-slider-vertical": a
|
|
165
163
|
},
|
|
166
|
-
|
|
164
|
+
e.className
|
|
167
165
|
)
|
|
168
166
|
},
|
|
169
|
-
|
|
170
|
-
enabled: (
|
|
171
|
-
decrement:
|
|
167
|
+
de({
|
|
168
|
+
enabled: (q = e.buttons) != null ? q : f.buttons,
|
|
169
|
+
decrement: re,
|
|
172
170
|
increment: le,
|
|
173
|
-
incrementTitle:
|
|
171
|
+
incrementTitle: h.toLanguageString(
|
|
174
172
|
X,
|
|
175
|
-
|
|
173
|
+
x[X]
|
|
176
174
|
),
|
|
177
|
-
decrementTitle:
|
|
178
|
-
|
|
179
|
-
|
|
175
|
+
decrementTitle: h.toLanguageString(
|
|
176
|
+
W,
|
|
177
|
+
x[W]
|
|
180
178
|
),
|
|
181
|
-
children: /* @__PURE__ */
|
|
179
|
+
children: /* @__PURE__ */ r.createElement(be, { onDrag: oe, onPress: ce, autoScroll: !1 }, /* @__PURE__ */ r.createElement(
|
|
182
180
|
"div",
|
|
183
181
|
{
|
|
184
182
|
className: "k-slider-track-wrap",
|
|
@@ -186,53 +184,60 @@ const g = {
|
|
|
186
184
|
flexGrow: 1,
|
|
187
185
|
position: "relative",
|
|
188
186
|
touchAction: "none",
|
|
189
|
-
...
|
|
187
|
+
...se
|
|
190
188
|
}
|
|
191
189
|
},
|
|
192
|
-
|
|
193
|
-
|
|
190
|
+
e.children && /* @__PURE__ */ r.createElement(
|
|
191
|
+
"ul",
|
|
194
192
|
{
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
lastTick: n === l.Children.count(t.children) - 1
|
|
193
|
+
className: "k-reset k-slider-items",
|
|
194
|
+
"aria-hidden": "true",
|
|
195
|
+
style: { margin: 0, ...me }
|
|
199
196
|
},
|
|
200
|
-
e.
|
|
201
|
-
|
|
202
|
-
|
|
197
|
+
r.Children.map(e.children, (t, n) => t && r.cloneElement(
|
|
198
|
+
t,
|
|
199
|
+
{
|
|
200
|
+
position: 100 * (t.props.position - e.min) / (e.max - e.min),
|
|
201
|
+
vertical: a,
|
|
202
|
+
firstTick: n === 0,
|
|
203
|
+
lastTick: n === r.Children.count(e.children) - 1
|
|
204
|
+
},
|
|
205
|
+
t.props.children
|
|
206
|
+
))
|
|
207
|
+
),
|
|
208
|
+
/* @__PURE__ */ r.createElement(
|
|
203
209
|
"div",
|
|
204
210
|
{
|
|
205
211
|
className: "k-slider-track",
|
|
206
|
-
style: a ? { bottom: 0, height: "100%" } : { [
|
|
207
|
-
ref:
|
|
212
|
+
style: a ? { bottom: 0, height: "100%" } : { [g === "rtl" ? "right" : "left"]: 0, width: "100%" },
|
|
213
|
+
ref: L
|
|
208
214
|
},
|
|
209
|
-
/* @__PURE__ */
|
|
215
|
+
/* @__PURE__ */ r.createElement(
|
|
210
216
|
"div",
|
|
211
217
|
{
|
|
212
218
|
className: "k-slider-selection",
|
|
213
|
-
style: a ? { height:
|
|
219
|
+
style: a ? { height: b + "%" } : { width: b + "%" }
|
|
214
220
|
}
|
|
215
221
|
),
|
|
216
|
-
/* @__PURE__ */
|
|
222
|
+
/* @__PURE__ */ r.createElement(
|
|
217
223
|
"span",
|
|
218
224
|
{
|
|
219
225
|
role: "slider",
|
|
220
|
-
"aria-valuemin":
|
|
221
|
-
"aria-valuemax":
|
|
222
|
-
"aria-valuenow":
|
|
223
|
-
"aria-valuetext": String(r),
|
|
226
|
+
"aria-valuemin": e.min,
|
|
227
|
+
"aria-valuemax": e.max,
|
|
228
|
+
"aria-valuenow": l,
|
|
224
229
|
"aria-orientation": a ? "vertical" : void 0,
|
|
225
230
|
"aria-disabled": d ? "true" : void 0,
|
|
226
|
-
"aria-labelledby":
|
|
227
|
-
"aria-describedby":
|
|
228
|
-
"aria-label":
|
|
229
|
-
tabIndex:
|
|
231
|
+
"aria-labelledby": e.ariaLabelledBy,
|
|
232
|
+
"aria-describedby": e.ariaDescribedBy,
|
|
233
|
+
"aria-label": e.ariaLabel || h.toLanguageString(E, x[E]),
|
|
234
|
+
tabIndex: ye(Z, d, void 0),
|
|
230
235
|
className: "k-draghandle k-draghandle-end",
|
|
231
|
-
title:
|
|
232
|
-
|
|
233
|
-
|
|
236
|
+
title: h.toLanguageString(
|
|
237
|
+
O,
|
|
238
|
+
x[O]
|
|
234
239
|
),
|
|
235
|
-
style:
|
|
240
|
+
style: I
|
|
236
241
|
}
|
|
237
242
|
)
|
|
238
243
|
)
|
|
@@ -240,10 +245,10 @@ const g = {
|
|
|
240
245
|
})
|
|
241
246
|
);
|
|
242
247
|
});
|
|
243
|
-
|
|
244
|
-
const
|
|
245
|
-
|
|
246
|
-
|
|
248
|
+
A.displayName = "Slider";
|
|
249
|
+
const Ce = ke(), P = ge(Ce, A);
|
|
250
|
+
P.displayName = "KendoReactSlider";
|
|
251
|
+
P.propTypes = {
|
|
247
252
|
value: i.number,
|
|
248
253
|
defaultValue: i.number,
|
|
249
254
|
min: i.number.isRequired,
|
|
@@ -264,9 +269,9 @@ J.propTypes = {
|
|
|
264
269
|
dir: i.oneOf(["ltr", "rtl"]),
|
|
265
270
|
children: i.node
|
|
266
271
|
};
|
|
267
|
-
|
|
272
|
+
Se(A);
|
|
268
273
|
export {
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
274
|
+
P as Slider,
|
|
275
|
+
Ce as SliderPropsContext,
|
|
276
|
+
A as SliderWithoutContext
|
|
272
277
|
};
|
package/slider/SliderLabel.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 strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react"),a=require("@progress/kendo-react-common");function s(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const l in e)if(l!=="default"){const n=Object.getOwnPropertyDescriptor(e,l);Object.defineProperty(t,l,n.get?n:{enumerable:!0,get:()=>e[l]})}}return t.default=e,Object.freeze(t)}const c=s(i),r="data-slider-label",o=e=>{const t=c.useRef(null);return a.useDir(t),c.createElement("li",{ref:t,role:"presentation",className:a.classNames("k-tick",{"k-tick-large":e.children,"k-first":e.firstTick,"k-last":e.lastTick}),title:e.title},e.children&&c.createElement("span",{[r]:!0,className:"k-label",onClick:e.onClick},e.children))};exports.SLIDER_LABEL_ATTRIBUTE=r;exports.SliderLabel=o;
|
package/slider/SliderLabel.mjs
CHANGED
|
@@ -7,12 +7,13 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import * as l from "react";
|
|
9
9
|
import { useDir as a, classNames as i } from "@progress/kendo-react-common";
|
|
10
|
-
const c = "data-slider-label",
|
|
10
|
+
const c = "data-slider-label", n = (e) => {
|
|
11
11
|
const t = l.useRef(null);
|
|
12
12
|
return a(t), /* @__PURE__ */ l.createElement(
|
|
13
13
|
"li",
|
|
14
14
|
{
|
|
15
15
|
ref: t,
|
|
16
|
+
role: "presentation",
|
|
16
17
|
className: i("k-tick", {
|
|
17
18
|
"k-tick-large": e.children,
|
|
18
19
|
"k-first": e.firstTick,
|
|
@@ -25,5 +26,5 @@ const c = "data-slider-label", s = (e) => {
|
|
|
25
26
|
};
|
|
26
27
|
export {
|
|
27
28
|
c as SLIDER_LABEL_ATTRIBUTE,
|
|
28
|
-
|
|
29
|
+
n as SliderLabel
|
|
29
30
|
};
|
package/switch/Switch.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import { BaseEvent, FormComponentProps, FormComponentValidity } from '@progress/kendo-react-common';
|
|
8
|
+
import { BaseEvent, WebMcpProps, FormComponentProps, FormComponentValidity } from '@progress/kendo-react-common';
|
|
9
9
|
import { ToggleBaseProps } from '../interfaces/ToggleBaseProps';
|
|
10
10
|
import * as React from 'react';
|
|
11
11
|
/**
|
|
@@ -243,6 +243,11 @@ export interface SwitchProps extends ToggleBaseProps, FormComponentProps {
|
|
|
243
243
|
* ```
|
|
244
244
|
*/
|
|
245
245
|
ariaLabel?: string;
|
|
246
|
+
/**
|
|
247
|
+
* Enables Web MCP tool registration for this component.
|
|
248
|
+
* Requires a parent `WebMcpProvider` from `@progress/kendo-react-webmcp`.
|
|
249
|
+
*/
|
|
250
|
+
webMcp?: boolean | WebMcpProps;
|
|
246
251
|
}
|
|
247
252
|
/** @hidden */
|
|
248
253
|
export declare const SwitchWithoutContext: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<SwitchHandle>>;
|
package/switch/Switch.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 strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),t=require("prop-types"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),t=require("prop-types"),c=require("@progress/kendo-react-common"),j=require("@progress/kendo-react-intl"),b=require("../messages/index.js");function p(e){const h=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const v=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(h,s,v.get?v:{enumerable:!0,get:()=>e[s]})}}return h.default=e,Object.freeze(h)}const u=p(n),r={disabled:!1,defaultChecked:!1,size:void 0,trackRounded:void 0,thumbRounded:void 0,offLabel:"OFF",onBlur:c.noop,onFocus:c.noop,onLabel:"ON",validityStyles:!0},x=u.forwardRef((e,h)=>{var F;const{disabled:s=r.disabled,defaultChecked:v=r.defaultChecked,size:R=r.size,trackRounded:S=r.trackRounded,thumbRounded:M=r.thumbRounded,offLabel:I=r.offLabel,onBlur:L=r.onBlur,onFocus:E=r.onFocus,onLabel:q=r.onLabel}=e,[z,V]=n.useState(v||!1),[W,B]=n.useState(!1),d=n.useRef(null),o=n.useRef(null),k=n.useRef(null),y=n.useRef(void 0),N=n.useRef(!1),D=n.useRef(void 0),P=n.useMemo(()=>new j.LocalizationService,[]),_=j.useLocalization(),i=n.useMemo(()=>y.current!==void 0?y.current:e.checked!==void 0?e.checked:z,[e.checked,z]),g=n.useMemo(()=>{var C,K;const a=e.validationMessage!==void 0,l=(C=e.valid)!=null?C:e.required?!!i:!0,w=(K=e.valid)!=null?K:l;return{customError:a,valid:w,valueMissing:i===null}},[e.valid,e.validationMessage,e.required,i]),$=(F=e.validityStyles)!=null?F:r.validityStyles;n.useEffect(()=>{var a;(a=k.current)!=null&&a.setCustomValidity&&k.current.setCustomValidity(g.valid?"":e.validationMessage||P.toLanguageString(b.switchValidation,b.messages[b.switchValidation]))},[g,e.validationMessage,P]),n.useEffect(()=>{d.current&&(D.current=e.dir||getComputedStyle(d.current).direction||void 0)},[e.dir]);const f=n.useCallback(()=>({props:e,get element(){return d.current},get actionElement(){return o.current},focus:()=>{var a;(a=o.current)==null||a.focus()},get value(){return i},get name(){return e.name},get validity(){return g}}),[e,i,g]),m=n.useCallback((a,l)=>{V(a),y.current=a,c.dispatchEvent(e.onChange,l,{...f(),value:a},{value:a}),y.current=void 0},[e.onChange,f]);n.useEffect(()=>{const a=e.name||e.id,l=c.subscribeToKendoPaste(o.current,{fieldName:a,onValueChange:w=>{if(w!==i){const C={target:o.current,currentTarget:o.current,nativeEvent:new Event("change",{bubbles:!0})};m(w,C)}}});return()=>{l==null||l.unsubscribe()}},[e.name,e.id,i,m]);const A=n.useCallback(a=>{if(a.target===k.current){if(N.current){N.current=!1;return}}else N.current=!0;m(!i,a)},[i,m]),G=n.useCallback(a=>{if(s)return;const{keyCode:l}=a;(l===c.Keys.space||l===c.Keys.enter)&&(m(!i,a),a.preventDefault())},[s,i,m]),J=n.useCallback(a=>{s||(B(!0),E&&E(a))},[s,E]),Q=n.useCallback(a=>{s||(B(!1),L&&L(a))},[s,L]);n.useImperativeHandle(h,f,[f]);const T=n.useRef(null);n.useImperativeHandle(T,f,[f]),c.useWebMcpRegister("switch",T,e,e.webMcp);const U=D.current||e.dir||d.current&&getComputedStyle(d.current).direction||void 0,X=!$||g.valid,Y=c.classNames("k-switch",{[`k-switch-${c.kendoThemeMaps.sizeMap[R]||R}`]:R,"k-switch-on":i,"k-switch-off":!i,"k-focus":W,"k-disabled":s,"k-invalid":!X},e.className),Z=u.createElement("input",{type:"checkbox",checked:e.checked,ref:k,tabIndex:-1,value:i,style:{opacity:0,width:1,border:0,zIndex:-1,position:"absolute",left:"50%"},onChange:c.noop,name:e.name||void 0});return u.createElement("span",{ref:o,role:"switch","aria-checked":i,"aria-disabled":s||void 0,"aria-labelledby":e.ariaLabelledBy,"aria-describedby":e.ariaDescribedBy,"aria-label":e.ariaLabel||_.toLanguageString(b.switchAriaLabel,b.messages[b.switchAriaLabel]),"aria-required":e.required,className:Y,dir:U,onKeyDown:G,onClick:A,onBlur:Q,onFocus:J,tabIndex:c.getTabIndex(e.tabIndex,s,void 0),accessKey:e.accessKey,id:e.id},u.createElement("span",{className:c.classNames("k-switch-track",{[`k-rounded-${c.kendoThemeMaps.roundedMap[S]||S}`]:S}),ref:d},Z,q?u.createElement("span",{className:"k-switch-label-on"},q):"",I?u.createElement("span",{className:"k-switch-label-off"},I):""),u.createElement("span",{className:"k-switch-thumb-wrap"},u.createElement("span",{className:c.classNames("k-switch-thumb",{[`k-rounded-${c.kendoThemeMaps.roundedMap[M]||M}`]:M})})))});x.displayName="Switch";const H=c.createPropsContext(),O=c.withIdHOC(c.withPropsContext(H,x));O.displayName="KendoReactSwitch";O.propTypes={accessKey:t.string,checked:t.bool,className:t.string,defaultChecked:t.bool,defaultValue:t.any,disabled:t.bool,dir:t.string,id:t.string,size:t.oneOf(["small","medium","large"]),trackRounded:t.oneOf(["small","medium","large","full"]),thumbRounded:t.oneOf(["small","medium","large","full"]),ariaDescribedBy:t.string,ariaLabelledBy:t.string,ariaLabel:t.string,offLabel:t.node,onBlur:t.func,onChange:t.func,onFocus:t.func,onLabel:t.node,tabIndex:t.number,value:t.any,name:t.string,required:t.bool,valid:t.bool,validationMessage:t.string,validityStyles:t.bool};exports.Switch=O;exports.SwitchPropsContext=H;exports.SwitchWithoutContext=x;
|