@progress/kendo-react-inputs 14.5.0-develop.1 → 14.5.0-develop.10
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/colors/ColorPicker.js +1 -1
- package/colors/ColorPicker.mjs +197 -192
- package/colors/FlatColorPicker.js +1 -1
- package/colors/FlatColorPicker.mjs +88 -88
- package/colors/interfaces/ColorPickerProps.d.ts +6 -0
- package/common/AdaptiveMode.d.ts +1 -1
- package/common/AdaptiveMode.js +1 -1
- package/common/AdaptiveMode.mjs +1 -1
- package/dist/cdn/js/kendo-react-inputs.js +1 -1
- package/numerictextbox/NumericTextBox.js +1 -1
- package/numerictextbox/NumericTextBox.mjs +95 -95
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +16 -11
- package/rating/Rating.js +1 -1
- package/rating/Rating.mjs +62 -62
- package/slider/Slider.js +1 -1
- package/slider/Slider.mjs +38 -38
- package/switch/Switch.js +1 -1
- package/switch/Switch.mjs +114 -107
package/switch/Switch.mjs
CHANGED
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
import * as d from "react";
|
|
9
|
-
import { useState as q, useRef as u, useMemo as
|
|
10
|
-
import
|
|
11
|
-
import { withIdHOC as re, withPropsContext as ce, noop as
|
|
9
|
+
import { useState as q, useRef as u, useMemo as N, useEffect as x, useCallback as f, useImperativeHandle as ie } from "react";
|
|
10
|
+
import t from "prop-types";
|
|
11
|
+
import { withIdHOC as re, withPropsContext as ce, noop as I, dispatchEvent as de, subscribeToKendoPaste as le, Keys as H, classNames as M, kendoThemeMaps as B, getTabIndex as se, createPropsContext as oe } from "@progress/kendo-react-common";
|
|
12
12
|
import { LocalizationService as ue } from "@progress/kendo-react-intl";
|
|
13
|
-
import { switchValidation as
|
|
13
|
+
import { switchValidation as V, messages as W, switchAriaLabel as $ } from "../messages/index.mjs";
|
|
14
14
|
const r = {
|
|
15
15
|
disabled: !1,
|
|
16
16
|
defaultChecked: !1,
|
|
@@ -18,50 +18,50 @@ const r = {
|
|
|
18
18
|
trackRounded: void 0,
|
|
19
19
|
thumbRounded: void 0,
|
|
20
20
|
offLabel: "OFF",
|
|
21
|
-
onBlur:
|
|
22
|
-
onFocus:
|
|
21
|
+
onBlur: I,
|
|
22
|
+
onFocus: I,
|
|
23
23
|
onLabel: "ON",
|
|
24
24
|
validityStyles: !0
|
|
25
25
|
}, A = d.forwardRef((e, G) => {
|
|
26
|
-
var
|
|
26
|
+
var P;
|
|
27
27
|
const {
|
|
28
28
|
disabled: c = r.disabled,
|
|
29
29
|
defaultChecked: J = r.defaultChecked,
|
|
30
|
-
size:
|
|
31
|
-
trackRounded:
|
|
32
|
-
thumbRounded:
|
|
33
|
-
offLabel:
|
|
34
|
-
onBlur:
|
|
35
|
-
onFocus:
|
|
36
|
-
onLabel:
|
|
37
|
-
} = e, [
|
|
38
|
-
var
|
|
39
|
-
const
|
|
30
|
+
size: k = r.size,
|
|
31
|
+
trackRounded: w = r.trackRounded,
|
|
32
|
+
thumbRounded: C = r.thumbRounded,
|
|
33
|
+
offLabel: F = r.offLabel,
|
|
34
|
+
onBlur: R = r.onBlur,
|
|
35
|
+
onFocus: L = r.onFocus,
|
|
36
|
+
onLabel: D = r.onLabel
|
|
37
|
+
} = e, [K, Q] = q(J || !1), [U, z] = q(!1), l = u(null), s = u(null), b = u(null), h = u(void 0), S = u(!1), O = u(void 0), E = N(() => new ue(), []), n = N(() => h.current !== void 0 ? h.current : e.checked !== void 0 ? e.checked : K, [e.checked, K]), m = N(() => {
|
|
38
|
+
var y, T;
|
|
39
|
+
const a = e.validationMessage !== void 0, i = (y = e.valid) != null ? y : e.required ? !!n : !0, g = (T = e.valid) != null ? T : i;
|
|
40
40
|
return {
|
|
41
|
-
customError:
|
|
42
|
-
valid:
|
|
41
|
+
customError: a,
|
|
42
|
+
valid: g,
|
|
43
43
|
valueMissing: n === null
|
|
44
44
|
};
|
|
45
|
-
}, [e.valid, e.validationMessage, e.required, n]), X = (
|
|
46
|
-
|
|
47
|
-
var
|
|
48
|
-
(
|
|
49
|
-
|
|
45
|
+
}, [e.valid, e.validationMessage, e.required, n]), X = (P = e.validityStyles) != null ? P : r.validityStyles;
|
|
46
|
+
x(() => {
|
|
47
|
+
var a;
|
|
48
|
+
(a = b.current) != null && a.setCustomValidity && b.current.setCustomValidity(
|
|
49
|
+
m.valid ? "" : e.validationMessage || E.toLanguageString(V, W[V])
|
|
50
50
|
);
|
|
51
|
-
}, [
|
|
51
|
+
}, [m, e.validationMessage, E]), x(() => {
|
|
52
52
|
l.current && (O.current = e.dir || getComputedStyle(l.current).direction || void 0);
|
|
53
53
|
}, [e.dir]);
|
|
54
|
-
const
|
|
54
|
+
const v = f(() => ({
|
|
55
55
|
props: e,
|
|
56
56
|
get element() {
|
|
57
57
|
return l.current;
|
|
58
58
|
},
|
|
59
59
|
get actionElement() {
|
|
60
|
-
return
|
|
60
|
+
return s.current;
|
|
61
61
|
},
|
|
62
62
|
focus: () => {
|
|
63
|
-
var
|
|
64
|
-
(
|
|
63
|
+
var a;
|
|
64
|
+
(a = s.current) == null || a.focus();
|
|
65
65
|
},
|
|
66
66
|
get value() {
|
|
67
67
|
return n;
|
|
@@ -70,66 +70,73 @@ const r = {
|
|
|
70
70
|
return e.name;
|
|
71
71
|
},
|
|
72
72
|
get validity() {
|
|
73
|
-
return
|
|
73
|
+
return m;
|
|
74
74
|
}
|
|
75
|
-
}), [e, n,
|
|
76
|
-
(
|
|
77
|
-
Q(
|
|
75
|
+
}), [e, n, m]), o = f(
|
|
76
|
+
(a, i) => {
|
|
77
|
+
Q(a), h.current = a, de(
|
|
78
78
|
e.onChange,
|
|
79
79
|
i,
|
|
80
|
-
{ ...
|
|
81
|
-
{ value:
|
|
82
|
-
),
|
|
80
|
+
{ ...v(), value: a },
|
|
81
|
+
{ value: a }
|
|
82
|
+
), h.current = void 0;
|
|
83
83
|
},
|
|
84
|
-
[e.onChange,
|
|
84
|
+
[e.onChange, v]
|
|
85
85
|
);
|
|
86
|
-
|
|
87
|
-
const
|
|
88
|
-
fieldName:
|
|
89
|
-
onValueChange: (
|
|
90
|
-
if (
|
|
91
|
-
const
|
|
92
|
-
target:
|
|
93
|
-
currentTarget:
|
|
86
|
+
x(() => {
|
|
87
|
+
const a = e.name || e.id, i = le(s.current, {
|
|
88
|
+
fieldName: a,
|
|
89
|
+
onValueChange: (g) => {
|
|
90
|
+
if (g !== n) {
|
|
91
|
+
const y = {
|
|
92
|
+
target: s.current,
|
|
93
|
+
currentTarget: s.current,
|
|
94
94
|
nativeEvent: new Event("change", { bubbles: !0 })
|
|
95
95
|
};
|
|
96
|
-
|
|
96
|
+
o(g, y);
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
});
|
|
100
100
|
return () => {
|
|
101
101
|
i == null || i.unsubscribe();
|
|
102
102
|
};
|
|
103
|
-
}, [e.name, e.id, n,
|
|
104
|
-
const Y =
|
|
105
|
-
(
|
|
106
|
-
|
|
103
|
+
}, [e.name, e.id, n, o]);
|
|
104
|
+
const Y = f(
|
|
105
|
+
(a) => {
|
|
106
|
+
if (a.target === b.current) {
|
|
107
|
+
if (S.current) {
|
|
108
|
+
S.current = !1;
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
} else
|
|
112
|
+
S.current = !0;
|
|
113
|
+
o(!n, a);
|
|
107
114
|
},
|
|
108
|
-
[n,
|
|
109
|
-
), Z =
|
|
110
|
-
(
|
|
115
|
+
[n, o]
|
|
116
|
+
), Z = f(
|
|
117
|
+
(a) => {
|
|
111
118
|
if (c)
|
|
112
119
|
return;
|
|
113
|
-
const { keyCode: i } =
|
|
114
|
-
(i ===
|
|
120
|
+
const { keyCode: i } = a;
|
|
121
|
+
(i === H.space || i === H.enter) && (o(!n, a), a.preventDefault());
|
|
115
122
|
},
|
|
116
|
-
[c, n,
|
|
117
|
-
), _ =
|
|
118
|
-
(
|
|
119
|
-
c || (
|
|
123
|
+
[c, n, o]
|
|
124
|
+
), _ = f(
|
|
125
|
+
(a) => {
|
|
126
|
+
c || (z(!0), L && L(a));
|
|
120
127
|
},
|
|
121
|
-
[c,
|
|
122
|
-
), p =
|
|
123
|
-
(
|
|
124
|
-
c || (
|
|
128
|
+
[c, L]
|
|
129
|
+
), p = f(
|
|
130
|
+
(a) => {
|
|
131
|
+
c || (z(!1), R && R(a));
|
|
125
132
|
},
|
|
126
|
-
[c,
|
|
133
|
+
[c, R]
|
|
127
134
|
);
|
|
128
|
-
ie(G,
|
|
129
|
-
const ee = O.current || e.dir || l.current && getComputedStyle(l.current).direction || void 0, te = !X ||
|
|
135
|
+
ie(G, v, [v]);
|
|
136
|
+
const ee = O.current || e.dir || l.current && getComputedStyle(l.current).direction || void 0, te = !X || m.valid, ae = M(
|
|
130
137
|
"k-switch",
|
|
131
138
|
{
|
|
132
|
-
[`k-switch-${
|
|
139
|
+
[`k-switch-${B.sizeMap[k] || k}`]: k,
|
|
133
140
|
"k-switch-on": n,
|
|
134
141
|
"k-switch-off": !n,
|
|
135
142
|
"k-focus": U,
|
|
@@ -142,20 +149,20 @@ const r = {
|
|
|
142
149
|
{
|
|
143
150
|
type: "checkbox",
|
|
144
151
|
checked: e.checked,
|
|
145
|
-
ref:
|
|
152
|
+
ref: b,
|
|
146
153
|
tabIndex: -1,
|
|
147
154
|
"aria-hidden": !0,
|
|
148
|
-
"aria-label": e.ariaLabel ||
|
|
155
|
+
"aria-label": e.ariaLabel || E.toLanguageString($, W[$]),
|
|
149
156
|
value: n,
|
|
150
157
|
style: { opacity: 0, width: 1, border: 0, zIndex: -1, position: "absolute", left: "50%" },
|
|
151
|
-
onChange:
|
|
158
|
+
onChange: I,
|
|
152
159
|
name: e.name || void 0
|
|
153
160
|
}
|
|
154
161
|
);
|
|
155
162
|
return /* @__PURE__ */ d.createElement(
|
|
156
163
|
"span",
|
|
157
164
|
{
|
|
158
|
-
ref:
|
|
165
|
+
ref: s,
|
|
159
166
|
role: "switch",
|
|
160
167
|
"aria-checked": n,
|
|
161
168
|
"aria-disabled": c || void 0,
|
|
@@ -169,70 +176,70 @@ const r = {
|
|
|
169
176
|
onClick: Y,
|
|
170
177
|
onBlur: p,
|
|
171
178
|
onFocus: _,
|
|
172
|
-
tabIndex:
|
|
179
|
+
tabIndex: se(e.tabIndex, c, void 0),
|
|
173
180
|
accessKey: e.accessKey,
|
|
174
181
|
id: e.id
|
|
175
182
|
},
|
|
176
183
|
/* @__PURE__ */ d.createElement(
|
|
177
184
|
"span",
|
|
178
185
|
{
|
|
179
|
-
className:
|
|
180
|
-
[`k-rounded-${
|
|
186
|
+
className: M("k-switch-track", {
|
|
187
|
+
[`k-rounded-${B.roundedMap[w] || w}`]: w
|
|
181
188
|
}),
|
|
182
189
|
ref: l
|
|
183
190
|
},
|
|
184
191
|
ne,
|
|
185
|
-
|
|
186
|
-
|
|
192
|
+
D ? /* @__PURE__ */ d.createElement("span", { className: "k-switch-label-on" }, D) : "",
|
|
193
|
+
F ? /* @__PURE__ */ d.createElement("span", { className: "k-switch-label-off" }, F) : ""
|
|
187
194
|
),
|
|
188
195
|
/* @__PURE__ */ d.createElement("span", { className: "k-switch-thumb-wrap" }, /* @__PURE__ */ d.createElement(
|
|
189
196
|
"span",
|
|
190
197
|
{
|
|
191
|
-
className:
|
|
192
|
-
[`k-rounded-${
|
|
198
|
+
className: M("k-switch-thumb", {
|
|
199
|
+
[`k-rounded-${B.roundedMap[C] || C}`]: C
|
|
193
200
|
})
|
|
194
201
|
}
|
|
195
202
|
))
|
|
196
203
|
);
|
|
197
204
|
});
|
|
198
205
|
A.displayName = "Switch";
|
|
199
|
-
const
|
|
206
|
+
const fe = oe(), j = re(
|
|
200
207
|
ce(
|
|
201
|
-
|
|
208
|
+
fe,
|
|
202
209
|
A
|
|
203
210
|
)
|
|
204
211
|
);
|
|
205
212
|
j.displayName = "KendoReactSwitch";
|
|
206
213
|
j.propTypes = {
|
|
207
|
-
accessKey:
|
|
208
|
-
checked:
|
|
209
|
-
className:
|
|
210
|
-
defaultChecked:
|
|
211
|
-
defaultValue:
|
|
212
|
-
disabled:
|
|
213
|
-
dir:
|
|
214
|
-
id:
|
|
215
|
-
size:
|
|
216
|
-
trackRounded:
|
|
217
|
-
thumbRounded:
|
|
218
|
-
ariaDescribedBy:
|
|
219
|
-
ariaLabelledBy:
|
|
220
|
-
ariaLabel:
|
|
221
|
-
offLabel:
|
|
222
|
-
onBlur:
|
|
223
|
-
onChange:
|
|
224
|
-
onFocus:
|
|
225
|
-
onLabel:
|
|
226
|
-
tabIndex:
|
|
227
|
-
value:
|
|
228
|
-
name:
|
|
229
|
-
required:
|
|
230
|
-
valid:
|
|
231
|
-
validationMessage:
|
|
232
|
-
validityStyles:
|
|
214
|
+
accessKey: t.string,
|
|
215
|
+
checked: t.bool,
|
|
216
|
+
className: t.string,
|
|
217
|
+
defaultChecked: t.bool,
|
|
218
|
+
defaultValue: t.any,
|
|
219
|
+
disabled: t.bool,
|
|
220
|
+
dir: t.string,
|
|
221
|
+
id: t.string,
|
|
222
|
+
size: t.oneOf(["small", "medium", "large"]),
|
|
223
|
+
trackRounded: t.oneOf(["small", "medium", "large", "full"]),
|
|
224
|
+
thumbRounded: t.oneOf(["small", "medium", "large", "full"]),
|
|
225
|
+
ariaDescribedBy: t.string,
|
|
226
|
+
ariaLabelledBy: t.string,
|
|
227
|
+
ariaLabel: t.string,
|
|
228
|
+
offLabel: t.node,
|
|
229
|
+
onBlur: t.func,
|
|
230
|
+
onChange: t.func,
|
|
231
|
+
onFocus: t.func,
|
|
232
|
+
onLabel: t.node,
|
|
233
|
+
tabIndex: t.number,
|
|
234
|
+
value: t.any,
|
|
235
|
+
name: t.string,
|
|
236
|
+
required: t.bool,
|
|
237
|
+
valid: t.bool,
|
|
238
|
+
validationMessage: t.string,
|
|
239
|
+
validityStyles: t.bool
|
|
233
240
|
};
|
|
234
241
|
export {
|
|
235
242
|
j as Switch,
|
|
236
|
-
|
|
243
|
+
fe as SwitchPropsContext,
|
|
237
244
|
A as SwitchWithoutContext
|
|
238
245
|
};
|