@progress/kendo-react-inputs 13.4.0-develop.4 → 13.4.0-develop.5
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 +133 -118
- package/dist/cdn/js/kendo-react-inputs.js +1 -1
- package/input/Input.js +1 -1
- package/input/Input.mjs +120 -101
- package/maskedtextbox/MaskedTextBox.d.ts +6 -0
- package/maskedtextbox/MaskedTextBox.js +1 -1
- package/maskedtextbox/MaskedTextBox.mjs +82 -61
- package/numerictextbox/NumericTextBox.js +1 -1
- package/numerictextbox/NumericTextBox.mjs +251 -227
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +1 -1
- package/package.json +10 -10
- package/switch/Switch.js +1 -1
- package/switch/Switch.mjs +109 -90
- package/textarea/TextArea.js +1 -1
- package/textarea/TextArea.mjs +131 -115
- package/textbox/Textbox.js +1 -1
- package/textbox/Textbox.mjs +77 -62
package/checkbox/Checkbox.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
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const xe=require("react"),e=require("prop-types"),o=require("@progress/kendo-react-common"),Pe=require("@progress/kendo-react-intl"),I=require("../messages/index.js");function Ve(c){const b=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const r in c)if(r!=="default"){const k=Object.getOwnPropertyDescriptor(c,r);Object.defineProperty(b,r,k.get?k:{enumerable:!0,get:()=>c[r]})}}return b.default=c,Object.freeze(b)}const t=Ve(xe),G=o.createPropsContext(),M=t.forwardRef((c,b)=>{const r=o.usePropsContext(G,c),{ariaDescribedBy:k,ariaLabelledBy:J,checked:O,className:Q,labelClassName:X,children:Y,defaultChecked:Z,disabled:n,defaultValue:ee,id:h,size:v=W.size,rounded:g=W.rounded,label:T,labelPlacement:q,name:z,labelOptional:te,onChange:C,onFocus:y,onBlur:x,tabIndex:ae,value:i,required:p,valid:D,validationMessage:F,validityStyles:K,autoFocus:ne,visited:Ee,touched:Ne,modified:Se,...oe}=r,l=t.useRef(null),R=t.useCallback(()=>{l.current&&l.current.focus()},[]),d=t.useCallback(()=>({element:l.current,focus:R,get name(){return l.current&&l.current.name}}),[R]);t.useImperativeHandle(b,d);const[le,se]=t.useState(Z),[ce,re]=t.useState(ee),w=typeof i=="boolean"||i===null,P=O!==void 0,m=w,V=m?i:ce,E=P?O:m?void 0:le,j=z||h,L=E===void 0&&V,_=L?V:E,f=L||m?i===null?i:void 0:i||V,ie=_===null||f===null,H=o.useId(),de=Pe.useLocalization(),U=a=>de.toLanguageString(a,I.messages[a]),$=U(I.checkboxValidation),ue=U(I.checkboxOptionalText),N=D!==void 0?D:p?!!E:!0;t.useEffect(()=>{l.current&&l.current.setCustomValidity&&l.current.setCustomValidity(N?"":F||$)},[N,F,$]);const u=t.useCallback((a,s)=>{!m&&!n&&(re(s),!P&&!n&&se(s)),C&&!n&&o.dispatchEvent(C,a,{...d(),value:s},{value:s})},[P,n,C,m,d]),be=t.useCallback(a=>{const s={target:l.current,currentTarget:l.current};u(s,a)},[u]);o.useKendoPaste(l,{fieldName:j,onValueChange:be,enabled:!!j});const me=t.useCallback(a=>{const s=a.target.checked;u(a,s)},[u,i]),ke=t.useCallback(a=>{if(n)return;const{keyCode:s}=a,ye=a.currentTarget.checked;s===o.Keys.space&&(a.preventDefault(),a.stopPropagation(),u(a,!ye))},[n,u]),pe=t.useCallback(a=>{if(n)return;const{keyCode:s}=a;s===o.Keys.space&&a.preventDefault()},[n]),fe=t.useCallback(a=>{y&&!n&&o.dispatchEvent(y,a,d(),void 0)},[y,n,d]),he=t.useCallback(a=>{x&&!n&&o.dispatchEvent(x,a,d(),void 0)},[x,n,d]),ve=o.useDir(l,r.dir),ge=o.classNames("k-checkbox-wrap",Q),A={type:"checkbox",className:o.classNames("k-checkbox",{[`k-checkbox-${o.kendoThemeMaps.sizeMap[v]||v}`]:v,[`k-rounded-${o.kendoThemeMaps.roundedMap[g]||g}`]:g,"k-indeterminate":ie,"k-disabled":n,"k-invalid k-invalid":!(N||K!==void 0||K===!0)}),ref:l,name:z,id:h||H,disabled:n,required:p!==void 0?p:!1,tabIndex:o.getTabIndex(ae,n),role:"checkbox",checked:!!_,"aria-describedby":k,"aria-labelledby":J,"aria-disabled":n||void 0,"aria-required":p,autoFocus:ne,...oe,onChange:me,onKeyDown:ke,onKeyUp:pe,onFocus:fe,onBlur:he},Ce=f===void 0?t.createElement("input",{...A}):t.createElement("input",{...A,value:w?void 0:f===null?"":f}),S=T!==void 0?t.createElement("label",{className:o.classNames("k-checkbox-label",X),htmlFor:h||H,style:{userSelect:"none"}},T,te&&t.createElement("span",{className:"k-label-optional"},ue)):null,B=t.createElement("span",{className:ge},Ce,Y);return t.createElement(t.Fragment,null,q==="before"?t.createElement("div",{dir:"rtl"},B,S):q==="after"?t.createElement("div",{dir:"ltr"},B,S):t.createElement("div",{dir:ve},B,S))});M.propTypes={checked:e.bool,className:e.string,defaultChecked:e.bool,defaultValue:e.any,dir:e.string,disabled:e.bool,id:e.string,size:e.oneOf(["small","medium","large"]),rounded:e.oneOf(["small","medium","large","none"]),ariaLabelledBy:e.string,ariaDescribedBy:e.string,label:e.any,labelPlacement:e.string,labelOptional:e.bool,name:e.string,tabIndex:e.number,value:e.any,validationMessage:e.string,required:e.bool,validate:e.bool,valid:e.bool,autoFocus:e.bool,onChange:e.func,onFocus:e.func,onBlur:e.func};const W={size:void 0,rounded:void 0};M.displayName="KendoCheckbox";exports.Checkbox=M;exports.CheckboxPropsContext=G;
|
package/checkbox/Checkbox.mjs
CHANGED
|
@@ -5,47 +5,47 @@
|
|
|
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 { createPropsContext as
|
|
11
|
-
import { useLocalization as
|
|
12
|
-
import { messages as
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
ariaDescribedBy:
|
|
16
|
-
ariaLabelledBy:
|
|
17
|
-
checked:
|
|
18
|
-
className:
|
|
19
|
-
labelClassName:
|
|
20
|
-
children:
|
|
21
|
-
defaultChecked:
|
|
8
|
+
import * as e from "react";
|
|
9
|
+
import a from "prop-types";
|
|
10
|
+
import { createPropsContext as Ve, usePropsContext as Pe, useId as Ee, dispatchEvent as P, useKendoPaste as Be, Keys as _, useDir as Ne, classNames as E, getTabIndex as Ie, kendoThemeMaps as $ } from "@progress/kendo-react-common";
|
|
11
|
+
import { useLocalization as Fe } from "@progress/kendo-react-intl";
|
|
12
|
+
import { messages as ze, checkboxValidation as Ke, checkboxOptionalText as Me } from "../messages/index.mjs";
|
|
13
|
+
const Se = Ve(), W = e.forwardRef((j, G) => {
|
|
14
|
+
const B = Pe(Se, j), {
|
|
15
|
+
ariaDescribedBy: J,
|
|
16
|
+
ariaLabelledBy: Q,
|
|
17
|
+
checked: N,
|
|
18
|
+
className: X,
|
|
19
|
+
labelClassName: Y,
|
|
20
|
+
children: Z,
|
|
21
|
+
defaultChecked: ee,
|
|
22
22
|
disabled: o,
|
|
23
|
-
defaultValue:
|
|
24
|
-
id:
|
|
25
|
-
size:
|
|
26
|
-
rounded:
|
|
27
|
-
label:
|
|
28
|
-
labelPlacement:
|
|
29
|
-
name:
|
|
30
|
-
labelOptional:
|
|
31
|
-
onChange:
|
|
32
|
-
onFocus:
|
|
33
|
-
onBlur:
|
|
34
|
-
tabIndex:
|
|
23
|
+
defaultValue: ae,
|
|
24
|
+
id: b,
|
|
25
|
+
size: m = A.size,
|
|
26
|
+
rounded: p = A.rounded,
|
|
27
|
+
label: I,
|
|
28
|
+
labelPlacement: F,
|
|
29
|
+
name: z,
|
|
30
|
+
labelOptional: te,
|
|
31
|
+
onChange: k,
|
|
32
|
+
onFocus: f,
|
|
33
|
+
onBlur: h,
|
|
34
|
+
tabIndex: oe,
|
|
35
35
|
value: s,
|
|
36
|
-
required:
|
|
37
|
-
valid:
|
|
36
|
+
required: d,
|
|
37
|
+
valid: K,
|
|
38
38
|
validationMessage: M,
|
|
39
39
|
validityStyles: S,
|
|
40
|
-
autoFocus:
|
|
40
|
+
autoFocus: ne,
|
|
41
41
|
// Removed to support direct use in Form Field component
|
|
42
|
-
visited:
|
|
43
|
-
touched:
|
|
44
|
-
modified:
|
|
45
|
-
...
|
|
46
|
-
} =
|
|
42
|
+
visited: De,
|
|
43
|
+
touched: Te,
|
|
44
|
+
modified: we,
|
|
45
|
+
...le
|
|
46
|
+
} = B, n = e.useRef(null), D = e.useCallback(() => {
|
|
47
47
|
n.current && n.current.focus();
|
|
48
|
-
}, []), c =
|
|
48
|
+
}, []), c = e.useCallback(
|
|
49
49
|
() => ({
|
|
50
50
|
element: n.current,
|
|
51
51
|
focus: D,
|
|
@@ -55,15 +55,15 @@ const Fe = ye(), $ = a.forwardRef((A, W) => {
|
|
|
55
55
|
}),
|
|
56
56
|
[D]
|
|
57
57
|
);
|
|
58
|
-
|
|
59
|
-
const [
|
|
60
|
-
|
|
61
|
-
n.current && n.current.setCustomValidity && n.current.setCustomValidity(
|
|
62
|
-
}, [
|
|
63
|
-
const
|
|
58
|
+
e.useImperativeHandle(G, c);
|
|
59
|
+
const [se, ce] = e.useState(ee), [re, ie] = e.useState(ae), T = typeof s == "boolean" || s === null, v = N !== void 0, i = T, C = i ? s : re, g = v ? N : i ? void 0 : se, w = z || b, L = g === void 0 && C, O = L ? C : g, u = L || i ? s === null ? s : void 0 : s || C, de = O === null || u === null, q = Ee(), ue = Fe(), R = (t) => ue.toLanguageString(t, ze[t]), H = R(Ke), be = R(Me), y = K !== void 0 ? K : d ? !!g : !0;
|
|
60
|
+
e.useEffect(() => {
|
|
61
|
+
n.current && n.current.setCustomValidity && n.current.setCustomValidity(y ? "" : M || H);
|
|
62
|
+
}, [y, M, H]);
|
|
63
|
+
const r = e.useCallback(
|
|
64
64
|
(t, l) => {
|
|
65
|
-
!
|
|
66
|
-
|
|
65
|
+
!i && !o && (ie(l), !v && !o && ce(l)), k && !o && P(
|
|
66
|
+
k,
|
|
67
67
|
t,
|
|
68
68
|
{
|
|
69
69
|
...c(),
|
|
@@ -72,116 +72,131 @@ const Fe = ye(), $ = a.forwardRef((A, W) => {
|
|
|
72
72
|
{ value: l }
|
|
73
73
|
);
|
|
74
74
|
},
|
|
75
|
-
[
|
|
76
|
-
),
|
|
75
|
+
[v, o, k, i, c]
|
|
76
|
+
), me = e.useCallback(
|
|
77
|
+
(t) => {
|
|
78
|
+
const l = {
|
|
79
|
+
target: n.current,
|
|
80
|
+
currentTarget: n.current
|
|
81
|
+
};
|
|
82
|
+
r(l, t);
|
|
83
|
+
},
|
|
84
|
+
[r]
|
|
85
|
+
);
|
|
86
|
+
Be(n, {
|
|
87
|
+
fieldName: w,
|
|
88
|
+
onValueChange: me,
|
|
89
|
+
enabled: !!w
|
|
90
|
+
});
|
|
91
|
+
const pe = e.useCallback(
|
|
77
92
|
(t) => {
|
|
78
93
|
const l = t.target.checked;
|
|
79
|
-
|
|
94
|
+
r(t, l);
|
|
80
95
|
},
|
|
81
|
-
[
|
|
82
|
-
),
|
|
96
|
+
[r, s]
|
|
97
|
+
), ke = e.useCallback(
|
|
83
98
|
(t) => {
|
|
84
99
|
if (o)
|
|
85
100
|
return;
|
|
86
|
-
const { keyCode: l } = t,
|
|
87
|
-
l ===
|
|
101
|
+
const { keyCode: l } = t, xe = t.currentTarget.checked;
|
|
102
|
+
l === _.space && (t.preventDefault(), t.stopPropagation(), r(t, !xe));
|
|
88
103
|
},
|
|
89
|
-
[o,
|
|
90
|
-
),
|
|
104
|
+
[o, r]
|
|
105
|
+
), fe = e.useCallback(
|
|
91
106
|
(t) => {
|
|
92
107
|
if (o)
|
|
93
108
|
return;
|
|
94
109
|
const { keyCode: l } = t;
|
|
95
|
-
l ===
|
|
110
|
+
l === _.space && t.preventDefault();
|
|
96
111
|
},
|
|
97
112
|
[o]
|
|
98
|
-
),
|
|
113
|
+
), he = e.useCallback(
|
|
99
114
|
(t) => {
|
|
100
|
-
|
|
115
|
+
f && !o && P(f, t, c(), void 0);
|
|
101
116
|
},
|
|
102
|
-
[
|
|
103
|
-
),
|
|
117
|
+
[f, o, c]
|
|
118
|
+
), ve = e.useCallback(
|
|
104
119
|
(t) => {
|
|
105
|
-
|
|
120
|
+
h && !o && P(h, t, c(), void 0);
|
|
106
121
|
},
|
|
107
|
-
[
|
|
108
|
-
),
|
|
122
|
+
[h, o, c]
|
|
123
|
+
), Ce = Ne(n, B.dir), ge = E("k-checkbox-wrap", X), U = {
|
|
109
124
|
type: "checkbox",
|
|
110
125
|
className: E("k-checkbox", {
|
|
111
|
-
[`k-checkbox-${
|
|
112
|
-
[`k-rounded-${
|
|
113
|
-
"k-indeterminate":
|
|
126
|
+
[`k-checkbox-${$.sizeMap[m] || m}`]: m,
|
|
127
|
+
[`k-rounded-${$.roundedMap[p] || p}`]: p,
|
|
128
|
+
"k-indeterminate": de,
|
|
114
129
|
"k-disabled": o,
|
|
115
|
-
"k-invalid k-invalid": !(
|
|
130
|
+
"k-invalid k-invalid": !(y || S !== void 0 || S === !0)
|
|
116
131
|
}),
|
|
117
132
|
ref: n,
|
|
118
|
-
name:
|
|
119
|
-
id:
|
|
133
|
+
name: z,
|
|
134
|
+
id: b || q,
|
|
120
135
|
disabled: o,
|
|
121
|
-
required:
|
|
122
|
-
tabIndex:
|
|
136
|
+
required: d !== void 0 ? d : !1,
|
|
137
|
+
tabIndex: Ie(oe, o),
|
|
123
138
|
role: "checkbox",
|
|
124
|
-
checked: !!
|
|
125
|
-
"aria-describedby":
|
|
126
|
-
"aria-labelledby":
|
|
139
|
+
checked: !!O,
|
|
140
|
+
"aria-describedby": J,
|
|
141
|
+
"aria-labelledby": Q,
|
|
127
142
|
"aria-disabled": o || void 0,
|
|
128
|
-
"aria-required":
|
|
129
|
-
autoFocus:
|
|
130
|
-
...
|
|
131
|
-
onChange:
|
|
132
|
-
onKeyDown:
|
|
133
|
-
onKeyUp:
|
|
134
|
-
onFocus:
|
|
135
|
-
onBlur:
|
|
136
|
-
},
|
|
143
|
+
"aria-required": d,
|
|
144
|
+
autoFocus: ne,
|
|
145
|
+
...le,
|
|
146
|
+
onChange: pe,
|
|
147
|
+
onKeyDown: ke,
|
|
148
|
+
onKeyUp: fe,
|
|
149
|
+
onFocus: he,
|
|
150
|
+
onBlur: ve
|
|
151
|
+
}, ye = (
|
|
137
152
|
// removing value prop is required due to bug in react where
|
|
138
153
|
// value set to undefined override default submit value
|
|
139
|
-
|
|
140
|
-
),
|
|
154
|
+
u === void 0 ? /* @__PURE__ */ e.createElement("input", { ...U }) : /* @__PURE__ */ e.createElement("input", { ...U, value: T ? void 0 : u === null ? "" : u })
|
|
155
|
+
), x = I !== void 0 ? /* @__PURE__ */ e.createElement(
|
|
141
156
|
"label",
|
|
142
157
|
{
|
|
143
|
-
className: E("k-checkbox-label",
|
|
144
|
-
htmlFor:
|
|
158
|
+
className: E("k-checkbox-label", Y),
|
|
159
|
+
htmlFor: b || q,
|
|
145
160
|
style: { userSelect: "none" }
|
|
146
161
|
},
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
) : null,
|
|
150
|
-
return /* @__PURE__ */
|
|
162
|
+
I,
|
|
163
|
+
te && /* @__PURE__ */ e.createElement("span", { className: "k-label-optional" }, be)
|
|
164
|
+
) : null, V = /* @__PURE__ */ e.createElement("span", { className: ge }, ye, Z);
|
|
165
|
+
return /* @__PURE__ */ e.createElement(e.Fragment, null, F === "before" ? /* @__PURE__ */ e.createElement("div", { dir: "rtl" }, V, x) : F === "after" ? /* @__PURE__ */ e.createElement("div", { dir: "ltr" }, V, x) : /* @__PURE__ */ e.createElement("div", { dir: Ce }, V, x));
|
|
151
166
|
});
|
|
152
|
-
|
|
153
|
-
checked:
|
|
154
|
-
className:
|
|
155
|
-
defaultChecked:
|
|
156
|
-
defaultValue:
|
|
157
|
-
dir:
|
|
158
|
-
disabled:
|
|
159
|
-
id:
|
|
160
|
-
size:
|
|
161
|
-
rounded:
|
|
162
|
-
ariaLabelledBy:
|
|
163
|
-
ariaDescribedBy:
|
|
164
|
-
label:
|
|
165
|
-
labelPlacement:
|
|
166
|
-
labelOptional:
|
|
167
|
-
name:
|
|
168
|
-
tabIndex:
|
|
169
|
-
value:
|
|
170
|
-
validationMessage:
|
|
171
|
-
required:
|
|
172
|
-
validate:
|
|
173
|
-
valid:
|
|
174
|
-
autoFocus:
|
|
175
|
-
onChange:
|
|
176
|
-
onFocus:
|
|
177
|
-
onBlur:
|
|
167
|
+
W.propTypes = {
|
|
168
|
+
checked: a.bool,
|
|
169
|
+
className: a.string,
|
|
170
|
+
defaultChecked: a.bool,
|
|
171
|
+
defaultValue: a.any,
|
|
172
|
+
dir: a.string,
|
|
173
|
+
disabled: a.bool,
|
|
174
|
+
id: a.string,
|
|
175
|
+
size: a.oneOf(["small", "medium", "large"]),
|
|
176
|
+
rounded: a.oneOf(["small", "medium", "large", "none"]),
|
|
177
|
+
ariaLabelledBy: a.string,
|
|
178
|
+
ariaDescribedBy: a.string,
|
|
179
|
+
label: a.any,
|
|
180
|
+
labelPlacement: a.string,
|
|
181
|
+
labelOptional: a.bool,
|
|
182
|
+
name: a.string,
|
|
183
|
+
tabIndex: a.number,
|
|
184
|
+
value: a.any,
|
|
185
|
+
validationMessage: a.string,
|
|
186
|
+
required: a.bool,
|
|
187
|
+
validate: a.bool,
|
|
188
|
+
valid: a.bool,
|
|
189
|
+
autoFocus: a.bool,
|
|
190
|
+
onChange: a.func,
|
|
191
|
+
onFocus: a.func,
|
|
192
|
+
onBlur: a.func
|
|
178
193
|
};
|
|
179
|
-
const
|
|
194
|
+
const A = {
|
|
180
195
|
size: void 0,
|
|
181
196
|
rounded: void 0
|
|
182
197
|
};
|
|
183
|
-
|
|
198
|
+
W.displayName = "KendoCheckbox";
|
|
184
199
|
export {
|
|
185
|
-
|
|
186
|
-
|
|
200
|
+
W as Checkbox,
|
|
201
|
+
Se as CheckboxPropsContext
|
|
187
202
|
};
|