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