@progress/kendo-react-inputs 15.1.1-develop.3 → 15.2.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/checkbox/Checkbox.js +1 -1
- package/checkbox/Checkbox.mjs +25 -25
- package/colors/ColorPicker.js +1 -1
- package/colors/ColorPicker.mjs +123 -123
- package/colors/FlatColorPicker.js +1 -1
- package/colors/FlatColorPicker.mjs +86 -86
- package/dist/cdn/js/kendo-react-inputs.js +1 -1
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +10 -10
- package/slider/Slider.js +1 -1
- package/slider/Slider.mjs +103 -103
- package/switch/Switch.js +1 -1
- package/switch/Switch.mjs +56 -54
package/switch/Switch.mjs
CHANGED
|
@@ -5,12 +5,12 @@
|
|
|
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 H, useRef as
|
|
8
|
+
import * as d from "react";
|
|
9
|
+
import { useState as H, useRef as l, useMemo as S, useEffect as M, useCallback as m, useImperativeHandle as V } from "react";
|
|
10
10
|
import t from "prop-types";
|
|
11
|
-
import { withIdHOC as
|
|
12
|
-
import { LocalizationService as
|
|
13
|
-
import { switchValidation as $, messages as
|
|
11
|
+
import { withIdHOC as ie, withPropsContext as ce, noop as B, dispatchEvent as re, subscribeToKendoPaste as de, Keys as W, useWebMcpRegister as le, classNames as N, kendoThemeMaps as x, getTabIndex as se, createPropsContext as oe } from "@progress/kendo-react-common";
|
|
12
|
+
import { LocalizationService as ue, useLocalization as fe } from "@progress/kendo-react-intl";
|
|
13
|
+
import { switchValidation as $, messages as me } from "../messages/index.mjs";
|
|
14
14
|
const c = {
|
|
15
15
|
disabled: !1,
|
|
16
16
|
defaultChecked: !1,
|
|
@@ -22,19 +22,21 @@ const c = {
|
|
|
22
22
|
onFocus: B,
|
|
23
23
|
onLabel: "ON",
|
|
24
24
|
validityStyles: !0
|
|
25
|
-
},
|
|
25
|
+
}, j = d.forwardRef((e, G) => {
|
|
26
26
|
var T;
|
|
27
27
|
const {
|
|
28
28
|
disabled: r = c.disabled,
|
|
29
|
-
defaultChecked:
|
|
29
|
+
defaultChecked: J = c.defaultChecked,
|
|
30
30
|
size: k = c.size,
|
|
31
31
|
trackRounded: w = c.trackRounded,
|
|
32
32
|
thumbRounded: C = c.thumbRounded,
|
|
33
33
|
offLabel: I = c.offLabel,
|
|
34
34
|
onBlur: R = c.onBlur,
|
|
35
|
-
onFocus:
|
|
36
|
-
onLabel:
|
|
37
|
-
} = e, [
|
|
35
|
+
onFocus: E = c.onFocus,
|
|
36
|
+
onLabel: F = c.onLabel
|
|
37
|
+
} = e, [z, Q] = H(J || !1), [U, D] = H(!1), s = l(null), o = l(null), h = l(null), v = l(void 0), L = l(!1), K = l(void 0), O = S(() => new ue(), []);
|
|
38
|
+
fe();
|
|
39
|
+
const n = S(() => v.current !== void 0 ? v.current : e.checked !== void 0 ? e.checked : z, [e.checked, z]), b = S(() => {
|
|
38
40
|
var y, q;
|
|
39
41
|
const a = e.validationMessage !== void 0, i = (y = e.valid) != null ? y : e.required ? !!n : !0, g = (q = e.valid) != null ? q : i;
|
|
40
42
|
return {
|
|
@@ -42,11 +44,11 @@ const c = {
|
|
|
42
44
|
valid: g,
|
|
43
45
|
valueMissing: n === null
|
|
44
46
|
};
|
|
45
|
-
}, [e.valid, e.validationMessage, e.required, n]),
|
|
47
|
+
}, [e.valid, e.validationMessage, e.required, n]), X = (T = e.validityStyles) != null ? T : c.validityStyles;
|
|
46
48
|
M(() => {
|
|
47
49
|
var a;
|
|
48
50
|
(a = h.current) != null && a.setCustomValidity && h.current.setCustomValidity(
|
|
49
|
-
b.valid ? "" : e.validationMessage || O.toLanguageString($,
|
|
51
|
+
b.valid ? "" : e.validationMessage || O.toLanguageString($, me[$])
|
|
50
52
|
);
|
|
51
53
|
}, [b, e.validationMessage, O]), M(() => {
|
|
52
54
|
s.current && (K.current = e.dir || getComputedStyle(s.current).direction || void 0);
|
|
@@ -74,7 +76,7 @@ const c = {
|
|
|
74
76
|
}
|
|
75
77
|
}), [e, n, b]), f = m(
|
|
76
78
|
(a, i) => {
|
|
77
|
-
|
|
79
|
+
Q(a), v.current = a, re(
|
|
78
80
|
e.onChange,
|
|
79
81
|
i,
|
|
80
82
|
{ ...u(), value: a },
|
|
@@ -84,7 +86,7 @@ const c = {
|
|
|
84
86
|
[e.onChange, u]
|
|
85
87
|
);
|
|
86
88
|
M(() => {
|
|
87
|
-
const a = e.name || e.id, i =
|
|
89
|
+
const a = e.name || e.id, i = de(o.current, {
|
|
88
90
|
fieldName: a,
|
|
89
91
|
onValueChange: (g) => {
|
|
90
92
|
if (g !== n) {
|
|
@@ -101,19 +103,19 @@ const c = {
|
|
|
101
103
|
i == null || i.unsubscribe();
|
|
102
104
|
};
|
|
103
105
|
}, [e.name, e.id, n, f]);
|
|
104
|
-
const
|
|
106
|
+
const Y = m(
|
|
105
107
|
(a) => {
|
|
106
108
|
if (a.target === h.current) {
|
|
107
|
-
if (
|
|
108
|
-
|
|
109
|
+
if (L.current) {
|
|
110
|
+
L.current = !1;
|
|
109
111
|
return;
|
|
110
112
|
}
|
|
111
113
|
} else
|
|
112
|
-
|
|
114
|
+
L.current = !0;
|
|
113
115
|
f(!n, a);
|
|
114
116
|
},
|
|
115
117
|
[n, f]
|
|
116
|
-
),
|
|
118
|
+
), Z = m(
|
|
117
119
|
(a) => {
|
|
118
120
|
if (r)
|
|
119
121
|
return;
|
|
@@ -121,32 +123,32 @@ const c = {
|
|
|
121
123
|
(i === W.space || i === W.enter) && (f(!n, a), a.preventDefault());
|
|
122
124
|
},
|
|
123
125
|
[r, n, f]
|
|
124
|
-
),
|
|
126
|
+
), _ = m(
|
|
125
127
|
(a) => {
|
|
126
|
-
r || (D(!0),
|
|
128
|
+
r || (D(!0), E && E(a));
|
|
127
129
|
},
|
|
128
|
-
[r,
|
|
129
|
-
),
|
|
130
|
+
[r, E]
|
|
131
|
+
), p = m(
|
|
130
132
|
(a) => {
|
|
131
133
|
r || (D(!1), R && R(a));
|
|
132
134
|
},
|
|
133
135
|
[r, R]
|
|
134
136
|
);
|
|
135
|
-
V(
|
|
136
|
-
const P =
|
|
137
|
-
V(P, u, [u]),
|
|
138
|
-
const
|
|
137
|
+
V(G, u, [u]);
|
|
138
|
+
const P = l(null);
|
|
139
|
+
V(P, u, [u]), le("switch", P, e, e.webMcp);
|
|
140
|
+
const ee = K.current || e.dir || s.current && getComputedStyle(s.current).direction || void 0, te = !X || b.valid, ae = N(
|
|
139
141
|
"k-switch",
|
|
140
142
|
{
|
|
141
143
|
[`k-switch-${x.sizeMap[k] || k}`]: k,
|
|
142
144
|
"k-switch-on": n,
|
|
143
145
|
"k-switch-off": !n,
|
|
144
|
-
"k-focus":
|
|
146
|
+
"k-focus": U,
|
|
145
147
|
"k-disabled": r,
|
|
146
|
-
"k-invalid": !
|
|
148
|
+
"k-invalid": !te
|
|
147
149
|
},
|
|
148
150
|
e.className
|
|
149
|
-
),
|
|
151
|
+
), ne = /* @__PURE__ */ d.createElement(
|
|
150
152
|
"input",
|
|
151
153
|
{
|
|
152
154
|
type: "checkbox",
|
|
@@ -159,7 +161,7 @@ const c = {
|
|
|
159
161
|
name: e.name || void 0
|
|
160
162
|
}
|
|
161
163
|
);
|
|
162
|
-
return /* @__PURE__ */
|
|
164
|
+
return /* @__PURE__ */ d.createElement(
|
|
163
165
|
"span",
|
|
164
166
|
{
|
|
165
167
|
ref: o,
|
|
@@ -168,19 +170,19 @@ const c = {
|
|
|
168
170
|
"aria-disabled": r || void 0,
|
|
169
171
|
"aria-labelledby": e.ariaLabelledBy,
|
|
170
172
|
"aria-describedby": e.ariaDescribedBy,
|
|
171
|
-
"aria-label": e.ariaLabel
|
|
173
|
+
"aria-label": e.ariaLabel,
|
|
172
174
|
"aria-required": e.required,
|
|
173
|
-
className:
|
|
174
|
-
dir:
|
|
175
|
-
onKeyDown:
|
|
176
|
-
onClick:
|
|
177
|
-
onBlur:
|
|
178
|
-
onFocus:
|
|
179
|
-
tabIndex:
|
|
175
|
+
className: ae,
|
|
176
|
+
dir: ee,
|
|
177
|
+
onKeyDown: Z,
|
|
178
|
+
onClick: Y,
|
|
179
|
+
onBlur: p,
|
|
180
|
+
onFocus: _,
|
|
181
|
+
tabIndex: se(e.tabIndex, r, void 0),
|
|
180
182
|
accessKey: e.accessKey,
|
|
181
183
|
id: e.id
|
|
182
184
|
},
|
|
183
|
-
/* @__PURE__ */
|
|
185
|
+
/* @__PURE__ */ d.createElement(
|
|
184
186
|
"span",
|
|
185
187
|
{
|
|
186
188
|
className: N("k-switch-track", {
|
|
@@ -188,11 +190,11 @@ const c = {
|
|
|
188
190
|
}),
|
|
189
191
|
ref: s
|
|
190
192
|
},
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
I ? /* @__PURE__ */
|
|
193
|
+
ne,
|
|
194
|
+
F ? /* @__PURE__ */ d.createElement("span", { className: "k-switch-label-on" }, F) : "",
|
|
195
|
+
I ? /* @__PURE__ */ d.createElement("span", { className: "k-switch-label-off" }, I) : ""
|
|
194
196
|
),
|
|
195
|
-
/* @__PURE__ */
|
|
197
|
+
/* @__PURE__ */ d.createElement("span", { className: "k-switch-thumb-wrap" }, /* @__PURE__ */ d.createElement(
|
|
196
198
|
"span",
|
|
197
199
|
{
|
|
198
200
|
className: N("k-switch-thumb", {
|
|
@@ -202,15 +204,15 @@ const c = {
|
|
|
202
204
|
))
|
|
203
205
|
);
|
|
204
206
|
});
|
|
205
|
-
|
|
206
|
-
const
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
207
|
+
j.displayName = "Switch";
|
|
208
|
+
const be = oe(), A = ie(
|
|
209
|
+
ce(
|
|
210
|
+
be,
|
|
211
|
+
j
|
|
210
212
|
)
|
|
211
213
|
);
|
|
212
|
-
|
|
213
|
-
|
|
214
|
+
A.displayName = "KendoReactSwitch";
|
|
215
|
+
A.propTypes = {
|
|
214
216
|
accessKey: t.string,
|
|
215
217
|
checked: t.bool,
|
|
216
218
|
className: t.string,
|
|
@@ -239,7 +241,7 @@ J.propTypes = {
|
|
|
239
241
|
validityStyles: t.bool
|
|
240
242
|
};
|
|
241
243
|
export {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
244
|
+
A as Switch,
|
|
245
|
+
be as SwitchPropsContext,
|
|
246
|
+
j as SwitchWithoutContext
|
|
245
247
|
};
|