@progress/kendo-react-inputs 13.4.0-develop.1 → 13.4.0-develop.3
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.mjs +22 -22
- package/colors/ColorGradient.mjs +4 -4
- package/colors/ColorPicker.mjs +11 -11
- package/colors/FlatColorPicker.mjs +11 -11
- package/dist/cdn/js/kendo-react-inputs.js +1 -1
- package/index.d.mts +1 -1
- package/index.d.ts +1 -1
- package/input/Input.mjs +13 -13
- package/maskedtextbox/MaskedTextBox.mjs +14 -14
- package/numerictextbox/NumericTextBox.mjs +7 -7
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +1 -1
- package/package.json +10 -10
- package/radiobutton/RadioButton.mjs +18 -18
- package/radiobutton/RadioGroup.mjs +15 -15
- package/range-slider/RangeSlider.mjs +15 -15
- package/rating/Rating.mjs +12 -12
- package/rating/RatingItem.mjs +4 -4
- package/signature/Signature.mjs +12 -12
- package/slider/Slider.d.ts +12 -78
- package/slider/Slider.js +1 -1
- package/slider/Slider.mjs +241 -191
- package/switch/Switch.d.ts +9 -124
- package/switch/Switch.js +1 -1
- package/switch/Switch.mjs +187 -209
- package/textarea/TextArea.mjs +20 -20
- package/textbox/Textbox.mjs +18 -18
package/slider/Slider.mjs
CHANGED
|
@@ -5,216 +5,266 @@
|
|
|
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
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
8
|
+
import * as l from "react";
|
|
9
|
+
import { useState as L, useRef as R, useMemo as N, useEffect as q, useCallback as o, useImperativeHandle as me } from "react";
|
|
10
|
+
import * as i from "prop-types";
|
|
11
|
+
import { withPropsContext as ue, createPropsContext as fe, dispatchEvent as ge, Keys as s, classNames as ve, Draggable as he, getTabIndex as be } from "@progress/kendo-react-common";
|
|
12
|
+
import { LocalizationService as ye, registerForLocalization as ke } from "@progress/kendo-react-intl";
|
|
13
|
+
import { sliderDragTitle as H, messages as A, sliderDecreaseValue as O, sliderIncreaseValue as X } from "../messages/index.mjs";
|
|
14
|
+
import { SLIDER_LABEL_ATTRIBUTE as xe } from "./SliderLabel.mjs";
|
|
15
|
+
import { Button as _ } from "@progress/kendo-react-buttons";
|
|
16
|
+
import { caretAltUpIcon as j, caretAltLeftIcon as G, caretAltDownIcon as W, caretAltRightIcon as Y } from "@progress/kendo-svg-icons";
|
|
17
|
+
const f = {
|
|
18
|
+
step: 1,
|
|
19
|
+
largeStep: 10,
|
|
20
|
+
buttons: !1,
|
|
21
|
+
vertical: !1,
|
|
22
|
+
disabled: !1,
|
|
23
|
+
tabIndex: 0
|
|
24
|
+
}, z = l.forwardRef((t, P) => {
|
|
25
|
+
var M, K, U;
|
|
26
|
+
const {
|
|
27
|
+
step: m = f.step,
|
|
28
|
+
largeStep: w = f.largeStep,
|
|
29
|
+
vertical: a = f.vertical,
|
|
30
|
+
disabled: C = f.disabled,
|
|
31
|
+
tabIndex: Q = f.tabIndex
|
|
32
|
+
} = t, [Z, $] = L((M = t.defaultValue) != null ? M : t.min), [p, B] = L(!1), [I, ee] = L(t.dir), E = R(null), g = R(null), T = N(() => new ye(), []), V = R(null), D = t.value !== void 0, y = D && t.value !== void 0 ? t.value : Z, r = N(() => {
|
|
33
|
+
const { min: e, max: n } = t;
|
|
34
|
+
return y < e ? e : y > n ? n : y;
|
|
35
|
+
}, [y, t.min, t.max]), v = N(() => {
|
|
36
|
+
const { min: e, max: n } = t, c = n - e;
|
|
37
|
+
return c === 0 ? 0 : (r - e) / c * 100;
|
|
38
|
+
}, [r, t.min, t.max]), u = (K = t.dir) != null ? K : I;
|
|
39
|
+
q(() => {
|
|
40
|
+
if (t.dir === void 0 && g.current) {
|
|
41
|
+
const n = window.getComputedStyle(g.current).direction;
|
|
42
|
+
n !== I && ee(n);
|
|
43
|
+
}
|
|
44
|
+
}, [t.dir, I]);
|
|
45
|
+
const F = o((e) => {
|
|
46
|
+
let n = e;
|
|
47
|
+
for (; n; ) {
|
|
48
|
+
if (n.getAttribute(xe))
|
|
49
|
+
return !0;
|
|
50
|
+
n = n.parentElement;
|
|
51
|
+
}
|
|
52
|
+
return !1;
|
|
53
|
+
}, []), d = o(
|
|
54
|
+
(e, n) => {
|
|
55
|
+
const c = Math.min(Math.max(n, t.min), t.max);
|
|
56
|
+
D || $(c), ge(t.onChange, e, V.current, { value: c });
|
|
57
|
+
},
|
|
58
|
+
[t.min, t.max, t.onChange, D]
|
|
59
|
+
), te = o(() => {
|
|
60
|
+
B(!0);
|
|
61
|
+
}, []), ne = o(() => {
|
|
62
|
+
B(!1);
|
|
63
|
+
}, []), ae = o(
|
|
64
|
+
(e) => {
|
|
65
|
+
let n;
|
|
66
|
+
e.keyCode === s.left || e.keyCode === s.down ? n = r - (m || 0) : e.keyCode === s.right || e.keyCode === s.up ? n = r + (m || 0) : e.keyCode === s.pageDown ? n = r - (w || 0) : e.keyCode === s.pageUp ? n = r + (w || 0) : e.keyCode === s.home ? n = t.min : e.keyCode === s.end && (n = t.max), n !== void 0 && (e.preventDefault(), d(e, n));
|
|
67
|
+
},
|
|
68
|
+
[r, m, w, t.min, t.max, d]
|
|
69
|
+
), ie = o(
|
|
70
|
+
(e) => {
|
|
71
|
+
e.preventDefault(), d(e, r - (m || 0));
|
|
72
|
+
},
|
|
73
|
+
[r, m, d]
|
|
74
|
+
), le = o(
|
|
75
|
+
(e) => {
|
|
76
|
+
e.preventDefault(), d(e, r + (m || 0));
|
|
77
|
+
},
|
|
78
|
+
[r, m, d]
|
|
79
|
+
), k = o(
|
|
80
|
+
(e) => {
|
|
81
|
+
const n = e.element.getBoundingClientRect();
|
|
82
|
+
let c;
|
|
83
|
+
a ? c = n.bottom - e.event.clientY : c = u === "rtl" ? n.right - e.event.clientX : e.event.clientX - n.left;
|
|
84
|
+
const h = a ? n.height : n.width, b = c / h;
|
|
85
|
+
d(e, t.min + b * (t.max - t.min));
|
|
86
|
+
},
|
|
87
|
+
[a, t.min, t.max, u, d]
|
|
88
|
+
), re = o(
|
|
89
|
+
(e) => {
|
|
90
|
+
F(e.event.originalEvent.target) || (e.event.isTouch && e.event.originalEvent.preventDefault(), k(e));
|
|
91
|
+
},
|
|
92
|
+
[F, k]
|
|
93
|
+
), ce = o(
|
|
94
|
+
(e) => {
|
|
95
|
+
e.event.originalEvent.preventDefault(), k(e);
|
|
96
|
+
},
|
|
97
|
+
[k]
|
|
98
|
+
), x = o(() => {
|
|
99
|
+
g.current && g.current.focus();
|
|
100
|
+
}, []), oe = o(
|
|
101
|
+
(e) => {
|
|
102
|
+
if (!e.enabled)
|
|
103
|
+
return e.children;
|
|
104
|
+
let n, c, h, b;
|
|
105
|
+
return u === "rtl" ? (n = a ? j : G, c = a ? W : Y, h = a ? "caret-alt-up" : "caret-alt-left", b = a ? "caret-alt-down" : "caret-alt-right") : (n = a ? j : Y, c = a ? W : G, h = a ? "caret-alt-up" : "caret-alt-right", b = a ? "caret-alt-down" : "caret-alt-left"), /* @__PURE__ */ l.createElement(l.Fragment, null, /* @__PURE__ */ l.createElement(
|
|
106
|
+
_,
|
|
28
107
|
{
|
|
29
108
|
className: "k-button-decrease",
|
|
30
109
|
rounded: "full",
|
|
31
|
-
icon:
|
|
32
|
-
svgIcon:
|
|
33
|
-
title:
|
|
34
|
-
onClick:
|
|
110
|
+
icon: b,
|
|
111
|
+
svgIcon: c,
|
|
112
|
+
title: e.decrementTitle,
|
|
113
|
+
onClick: e.decrement
|
|
35
114
|
}
|
|
36
|
-
),
|
|
37
|
-
|
|
115
|
+
), e.children, /* @__PURE__ */ l.createElement(
|
|
116
|
+
_,
|
|
38
117
|
{
|
|
39
118
|
className: "k-button-increase",
|
|
40
119
|
rounded: "full",
|
|
41
|
-
icon:
|
|
42
|
-
svgIcon:
|
|
43
|
-
title:
|
|
44
|
-
onClick:
|
|
120
|
+
icon: h,
|
|
121
|
+
svgIcon: n,
|
|
122
|
+
title: e.incrementTitle,
|
|
123
|
+
onClick: e.increment
|
|
45
124
|
}
|
|
46
125
|
));
|
|
47
|
-
},
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
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));
|
|
64
|
-
}, this.decrement = (t) => {
|
|
65
|
-
t.preventDefault(), this.change(t, this.state.value - (this.props.step || 0));
|
|
66
|
-
}, this.increment = (t) => {
|
|
67
|
-
t.preventDefault(), this.change(t, this.state.value + (this.props.step || 0));
|
|
68
|
-
}, this.dragStart = (t) => {
|
|
69
|
-
this.isLabel(t.event.originalEvent.target) || (t.event.isTouch && t.event.originalEvent.preventDefault(), this.drag(t));
|
|
70
|
-
}, this.dragOver = (t) => {
|
|
71
|
-
t.event.originalEvent.preventDefault(), this.drag(t);
|
|
72
|
-
}, this.drag = (t) => {
|
|
73
|
-
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;
|
|
74
|
-
this.change(t, this.props.min + o * (this.props.max - this.props.min));
|
|
126
|
+
},
|
|
127
|
+
[u, a]
|
|
128
|
+
);
|
|
129
|
+
me(
|
|
130
|
+
P,
|
|
131
|
+
() => ({
|
|
132
|
+
props: t,
|
|
133
|
+
sliderTrack: E.current,
|
|
134
|
+
focus: x
|
|
135
|
+
}),
|
|
136
|
+
[t, x]
|
|
137
|
+
), q(() => {
|
|
138
|
+
V.current = {
|
|
139
|
+
props: t,
|
|
140
|
+
sliderTrack: E.current,
|
|
141
|
+
focus: x
|
|
75
142
|
};
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
render() {
|
|
97
|
-
const s = D(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%" } : {};
|
|
98
|
-
return /* @__PURE__ */ i.createElement(
|
|
99
|
-
"div",
|
|
100
|
-
{
|
|
101
|
-
ref: (r) => {
|
|
102
|
-
this._element = r;
|
|
143
|
+
}, [t, x]);
|
|
144
|
+
const de = a ? { marginTop: "0.5rem", marginBottom: "0.5rem" } : { marginLeft: "0.5rem", marginRight: "0.5rem" }, se = a ? { paddingTop: 0, height: "100%" } : {};
|
|
145
|
+
let S;
|
|
146
|
+
return a ? S = { bottom: "calc(" + v + "%)", zIndex: 1 } : u === "rtl" ? S = { right: "calc(" + v + "% - 13px)", zIndex: 1 } : S = { left: "calc(" + v + "%)", zIndex: 1 }, /* @__PURE__ */ l.createElement(
|
|
147
|
+
"div",
|
|
148
|
+
{
|
|
149
|
+
ref: g,
|
|
150
|
+
dir: u,
|
|
151
|
+
id: t.id,
|
|
152
|
+
style: { gap: 0, ...t.style },
|
|
153
|
+
onFocus: te,
|
|
154
|
+
onBlur: ne,
|
|
155
|
+
onKeyDown: ae,
|
|
156
|
+
className: ve(
|
|
157
|
+
"k-slider",
|
|
158
|
+
{
|
|
159
|
+
"k-focus": p,
|
|
160
|
+
"k-disabled": C,
|
|
161
|
+
"k-slider-horizontal": !a,
|
|
162
|
+
"k-slider-vertical": a
|
|
103
163
|
},
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
/* @__PURE__ */ i.createElement(
|
|
122
|
-
this.buttons,
|
|
164
|
+
t.className
|
|
165
|
+
)
|
|
166
|
+
},
|
|
167
|
+
oe({
|
|
168
|
+
enabled: (U = t.buttons) != null ? U : f.buttons,
|
|
169
|
+
decrement: ie,
|
|
170
|
+
increment: le,
|
|
171
|
+
incrementTitle: T.toLanguageString(
|
|
172
|
+
X,
|
|
173
|
+
A[X]
|
|
174
|
+
),
|
|
175
|
+
decrementTitle: T.toLanguageString(
|
|
176
|
+
O,
|
|
177
|
+
A[O]
|
|
178
|
+
),
|
|
179
|
+
children: /* @__PURE__ */ l.createElement(he, { onDrag: ce, onPress: re, autoScroll: !1 }, /* @__PURE__ */ l.createElement(
|
|
180
|
+
"div",
|
|
123
181
|
{
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
182
|
+
className: "k-slider-track-wrap",
|
|
183
|
+
style: {
|
|
184
|
+
flexGrow: 1,
|
|
185
|
+
position: "relative",
|
|
186
|
+
touchAction: "none",
|
|
187
|
+
...de
|
|
188
|
+
}
|
|
129
189
|
},
|
|
130
|
-
/* @__PURE__ */
|
|
190
|
+
t.children && /* @__PURE__ */ l.createElement("ul", { className: "k-reset k-slider-items", style: { margin: 0, ...se } }, l.Children.map(t.children, (e, n) => e && l.cloneElement(
|
|
191
|
+
e,
|
|
192
|
+
{
|
|
193
|
+
position: 100 * (e.props.position - t.min) / (t.max - t.min),
|
|
194
|
+
vertical: a,
|
|
195
|
+
firstTick: n === 0,
|
|
196
|
+
lastTick: n === l.Children.count(t.children) - 1
|
|
197
|
+
},
|
|
198
|
+
e.props.children
|
|
199
|
+
))),
|
|
200
|
+
/* @__PURE__ */ l.createElement(
|
|
131
201
|
"div",
|
|
132
202
|
{
|
|
133
|
-
className: "k-slider-track
|
|
134
|
-
style: {
|
|
135
|
-
|
|
136
|
-
position: "relative",
|
|
137
|
-
touchAction: "none",
|
|
138
|
-
...e
|
|
139
|
-
}
|
|
203
|
+
className: "k-slider-track",
|
|
204
|
+
style: a ? { bottom: 0, height: "100%" } : { [u === "rtl" ? "right" : "left"]: 0, width: "100%" },
|
|
205
|
+
ref: E
|
|
140
206
|
},
|
|
141
|
-
|
|
142
|
-
r,
|
|
143
|
-
{
|
|
144
|
-
position: 100 * (r.props.position - this.props.min) / (this.props.max - this.props.min),
|
|
145
|
-
vertical: this.props.vertical,
|
|
146
|
-
firstTick: o === 0,
|
|
147
|
-
lastTick: o === i.Children.count(this.props.children) - 1
|
|
148
|
-
},
|
|
149
|
-
r.props.children
|
|
150
|
-
))),
|
|
151
|
-
/* @__PURE__ */ i.createElement(
|
|
207
|
+
/* @__PURE__ */ l.createElement(
|
|
152
208
|
"div",
|
|
153
209
|
{
|
|
154
|
-
className: "k-slider-
|
|
155
|
-
style:
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
"
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
"
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
"aria-label": this.props.ariaLabel,
|
|
180
|
-
tabIndex: T(this.props.tabIndex, this.props.disabled, void 0),
|
|
181
|
-
className: "k-draghandle k-draghandle-end",
|
|
182
|
-
title: s.toLanguageString(u, h[u]),
|
|
183
|
-
style: this.props.vertical ? { bottom: "calc(" + t + "%)", zIndex: 1 } : this.state.dir === "rtl" ? { right: "calc(" + t + "% - 13px)", zIndex: 1 } : { left: "calc(" + t + "%)", zIndex: 1 }
|
|
184
|
-
}
|
|
185
|
-
)
|
|
210
|
+
className: "k-slider-selection",
|
|
211
|
+
style: a ? { height: v + "%" } : { width: v + "%" }
|
|
212
|
+
}
|
|
213
|
+
),
|
|
214
|
+
/* @__PURE__ */ l.createElement(
|
|
215
|
+
"span",
|
|
216
|
+
{
|
|
217
|
+
role: "slider",
|
|
218
|
+
"aria-valuemin": t.min,
|
|
219
|
+
"aria-valuemax": t.max,
|
|
220
|
+
"aria-valuenow": r,
|
|
221
|
+
"aria-valuetext": String(r),
|
|
222
|
+
"aria-orientation": a ? "vertical" : void 0,
|
|
223
|
+
"aria-disabled": C ? "true" : void 0,
|
|
224
|
+
"aria-labelledby": t.ariaLabelledBy,
|
|
225
|
+
"aria-describedby": t.ariaDescribedBy,
|
|
226
|
+
"aria-label": t.ariaLabel,
|
|
227
|
+
tabIndex: be(Q, C, void 0),
|
|
228
|
+
className: "k-draghandle k-draghandle-end",
|
|
229
|
+
title: T.toLanguageString(
|
|
230
|
+
H,
|
|
231
|
+
A[H]
|
|
232
|
+
),
|
|
233
|
+
style: S
|
|
234
|
+
}
|
|
186
235
|
)
|
|
187
|
-
)
|
|
188
|
-
)
|
|
189
|
-
)
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
236
|
+
)
|
|
237
|
+
))
|
|
238
|
+
})
|
|
239
|
+
);
|
|
240
|
+
});
|
|
241
|
+
z.displayName = "Slider";
|
|
242
|
+
const Se = fe(), J = ue(Se, z);
|
|
243
|
+
J.displayName = "KendoReactSlider";
|
|
244
|
+
J.propTypes = {
|
|
245
|
+
value: i.number,
|
|
246
|
+
defaultValue: i.number,
|
|
247
|
+
min: i.number.isRequired,
|
|
248
|
+
max: i.number.isRequired,
|
|
249
|
+
step: i.number,
|
|
250
|
+
largeStep: i.number,
|
|
251
|
+
onChange: i.func,
|
|
252
|
+
style: i.object,
|
|
253
|
+
className: i.string,
|
|
254
|
+
buttons: i.bool,
|
|
255
|
+
tabIndex: i.number,
|
|
256
|
+
disabled: i.bool,
|
|
257
|
+
vertical: i.bool,
|
|
258
|
+
id: i.string,
|
|
259
|
+
ariaDescribedBy: i.string,
|
|
260
|
+
ariaLabelledBy: i.string,
|
|
261
|
+
ariaLabel: i.string,
|
|
262
|
+
dir: i.oneOf(["ltr", "rtl"]),
|
|
263
|
+
children: i.node
|
|
211
264
|
};
|
|
212
|
-
|
|
213
|
-
const L = w(), A = y(L, c);
|
|
214
|
-
A.displayName = "KendoReactSlider";
|
|
215
|
-
C(c);
|
|
265
|
+
ke(z);
|
|
216
266
|
export {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
267
|
+
J as Slider,
|
|
268
|
+
Se as SliderPropsContext,
|
|
269
|
+
z as SliderWithoutContext
|
|
220
270
|
};
|
package/switch/Switch.d.ts
CHANGED
|
@@ -5,14 +5,13 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import {
|
|
9
|
-
import { BaseEvent, FormComponent, FormComponentProps, FormComponentValidity } from '@progress/kendo-react-common';
|
|
8
|
+
import { BaseEvent, FormComponentProps, FormComponentValidity } from '@progress/kendo-react-common';
|
|
10
9
|
import { ToggleBaseProps } from '../interfaces/ToggleBaseProps.js';
|
|
11
10
|
import * as React from 'react';
|
|
12
11
|
/**
|
|
13
12
|
* The arguments for the `onChange` Switch event.
|
|
14
13
|
*/
|
|
15
|
-
export interface SwitchChangeEvent extends BaseEvent<
|
|
14
|
+
export interface SwitchChangeEvent extends BaseEvent<SwitchHandle> {
|
|
16
15
|
/**
|
|
17
16
|
* The new value of the Switch.
|
|
18
17
|
*/
|
|
@@ -103,7 +102,7 @@ export interface SwitchProps extends ToggleBaseProps, FormComponentProps {
|
|
|
103
102
|
* - large
|
|
104
103
|
* - null—Does not set a size `className`.
|
|
105
104
|
*
|
|
106
|
-
* @default
|
|
105
|
+
* @default undefined (theme-controlled)
|
|
107
106
|
* @example
|
|
108
107
|
* ```jsx
|
|
109
108
|
* <Switch size="large" />
|
|
@@ -236,124 +235,8 @@ export interface SwitchProps extends ToggleBaseProps, FormComponentProps {
|
|
|
236
235
|
*/
|
|
237
236
|
ariaLabel?: string;
|
|
238
237
|
}
|
|
239
|
-
/**
|
|
240
|
-
* @hidden
|
|
241
|
-
*/
|
|
242
|
-
export interface SwitchState {
|
|
243
|
-
checked: boolean;
|
|
244
|
-
focused: boolean;
|
|
245
|
-
}
|
|
246
238
|
/** @hidden */
|
|
247
|
-
export declare
|
|
248
|
-
static displayName: string;
|
|
249
|
-
/**
|
|
250
|
-
* Gets the value of the Switch.
|
|
251
|
-
*/
|
|
252
|
-
get value(): boolean;
|
|
253
|
-
get element(): HTMLSpanElement | null;
|
|
254
|
-
get actionElement(): HTMLSpanElement | null;
|
|
255
|
-
/**
|
|
256
|
-
* Gets the `name` property of the Switch.
|
|
257
|
-
*/
|
|
258
|
-
get name(): string | undefined;
|
|
259
|
-
/**
|
|
260
|
-
* Represents the validity state into which the Switch is set.
|
|
261
|
-
*/
|
|
262
|
-
get validity(): FormComponentValidity;
|
|
263
|
-
/**
|
|
264
|
-
* @hidden
|
|
265
|
-
*/
|
|
266
|
-
protected get validityStyles(): boolean;
|
|
267
|
-
/**
|
|
268
|
-
* @hidden
|
|
269
|
-
*/
|
|
270
|
-
protected get required(): boolean;
|
|
271
|
-
/**
|
|
272
|
-
* @hidden
|
|
273
|
-
*/
|
|
274
|
-
protected setValidity: () => void;
|
|
275
|
-
protected limit: (offset: number, drag: HTMLSpanElement, wrapper: HTMLSpanElement) => number;
|
|
276
|
-
protected toggle: (value: boolean, event: any) => void;
|
|
277
|
-
/**
|
|
278
|
-
* @hidden
|
|
279
|
-
*/
|
|
280
|
-
static propTypes: {
|
|
281
|
-
accessKey: PropTypes.Requireable<string>;
|
|
282
|
-
checked: PropTypes.Requireable<boolean>;
|
|
283
|
-
className: PropTypes.Requireable<string>;
|
|
284
|
-
disabled: PropTypes.Requireable<boolean>;
|
|
285
|
-
defaultChecked: PropTypes.Requireable<boolean>;
|
|
286
|
-
size: PropTypes.Requireable<"small" | "medium" | "large" | undefined>;
|
|
287
|
-
trackRounded: PropTypes.Requireable<"small" | "medium" | "large" | "full" | undefined>;
|
|
288
|
-
thumbRounded: PropTypes.Requireable<"small" | "medium" | "large" | "full" | undefined>;
|
|
289
|
-
dir: PropTypes.Requireable<string>;
|
|
290
|
-
id: PropTypes.Requireable<string>;
|
|
291
|
-
ariaLabelledBy: PropTypes.Requireable<string>;
|
|
292
|
-
ariaDescribedBy: PropTypes.Requireable<string>;
|
|
293
|
-
offLabel: PropTypes.Requireable<string>;
|
|
294
|
-
required: PropTypes.Requireable<boolean>;
|
|
295
|
-
tabIndex: PropTypes.Requireable<number>;
|
|
296
|
-
valid: PropTypes.Requireable<boolean>;
|
|
297
|
-
validate: PropTypes.Requireable<boolean>;
|
|
298
|
-
validationMessage: PropTypes.Requireable<string>;
|
|
299
|
-
onBlur: PropTypes.Requireable<any>;
|
|
300
|
-
onChange: PropTypes.Requireable<any>;
|
|
301
|
-
onFocus: PropTypes.Requireable<any>;
|
|
302
|
-
onLabel: PropTypes.Requireable<string>;
|
|
303
|
-
};
|
|
304
|
-
/**
|
|
305
|
-
* @hidden
|
|
306
|
-
*/
|
|
307
|
-
static defaultProps: {
|
|
308
|
-
disabled: boolean;
|
|
309
|
-
defaultChecked: boolean;
|
|
310
|
-
size: undefined;
|
|
311
|
-
trackRounded: undefined;
|
|
312
|
-
thumbRounded: undefined;
|
|
313
|
-
offLabel: string;
|
|
314
|
-
onBlur: () => void;
|
|
315
|
-
onFocus: () => void;
|
|
316
|
-
onLabel: string;
|
|
317
|
-
validityStyles: boolean;
|
|
318
|
-
};
|
|
319
|
-
/**
|
|
320
|
-
* @hidden
|
|
321
|
-
*/
|
|
322
|
-
readonly state: SwitchState;
|
|
323
|
-
private _element;
|
|
324
|
-
private _wrapper;
|
|
325
|
-
private _input;
|
|
326
|
-
private _id;
|
|
327
|
-
private valueDuringOnChange;
|
|
328
|
-
private dir?;
|
|
329
|
-
private defaultValidationMessage;
|
|
330
|
-
private eventTimeStamp?;
|
|
331
|
-
/**
|
|
332
|
-
* @hidden
|
|
333
|
-
*/
|
|
334
|
-
constructor(props: SwitchProps);
|
|
335
|
-
/**
|
|
336
|
-
* @hidden
|
|
337
|
-
*/
|
|
338
|
-
componentDidMount(): void;
|
|
339
|
-
/**
|
|
340
|
-
* @hidden
|
|
341
|
-
*/
|
|
342
|
-
componentDidUpdate(): void;
|
|
343
|
-
/**
|
|
344
|
-
* @hidden
|
|
345
|
-
*/
|
|
346
|
-
focus: () => void;
|
|
347
|
-
/**
|
|
348
|
-
* @hidden
|
|
349
|
-
*/
|
|
350
|
-
render(): React.JSX.Element;
|
|
351
|
-
private dummyInput;
|
|
352
|
-
private handleClick;
|
|
353
|
-
private handleKeyDown;
|
|
354
|
-
private handleWrapperFocus;
|
|
355
|
-
private handleWrapperBlur;
|
|
356
|
-
}
|
|
239
|
+
export declare const SwitchWithoutContext: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<SwitchHandle>>;
|
|
357
240
|
/**
|
|
358
241
|
* Represents the PropsContext of the `Switch` component.
|
|
359
242
|
* Used for global configuration of all `Switch` instances.
|
|
@@ -364,7 +247,11 @@ export declare const SwitchPropsContext: React.Context<(p: SwitchProps) => Switc
|
|
|
364
247
|
/**
|
|
365
248
|
* Represent the `ref` of the Switch component.
|
|
366
249
|
*/
|
|
367
|
-
export interface SwitchHandle
|
|
250
|
+
export interface SwitchHandle {
|
|
251
|
+
/**
|
|
252
|
+
* The props of the SwitchHandle component.
|
|
253
|
+
*/
|
|
254
|
+
props: SwitchProps;
|
|
368
255
|
/**
|
|
369
256
|
* @hidden
|
|
370
257
|
*/
|
|
@@ -386,8 +273,6 @@ export interface SwitchHandle extends Pick<SwitchWithoutContext, keyof SwitchWit
|
|
|
386
273
|
*/
|
|
387
274
|
value: boolean;
|
|
388
275
|
}
|
|
389
|
-
/** @hidden */
|
|
390
|
-
export type Switch = SwitchHandle;
|
|
391
276
|
/**
|
|
392
277
|
* Represents the [KendoReact Switch component](https://www.telerik.com/kendo-react-ui/components/inputs/switch).
|
|
393
278
|
*
|