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