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