@progress/kendo-react-inputs 11.4.0 → 12.0.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/dist/cdn/js/kendo-react-inputs.js +1 -1
- package/index.d.mts +38 -80
- package/index.d.ts +38 -80
- package/maskedtextbox/MaskedTextBox.mjs +12 -21
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +10 -10
- package/switch/Switch.js +1 -1
- package/switch/Switch.mjs +19 -19
- package/textarea/TextArea.js +1 -1
- package/textarea/TextArea.mjs +82 -78
package/textarea/TextArea.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 ce=require("react"),e=require("prop-types"),a=require("@progress/kendo-react-common");function de(o){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const s in o)if(s!=="default"){const l=Object.getOwnPropertyDescriptor(o,s);Object.defineProperty(c,s,l.get?l:{enumerable:!0,get:()=>o[s]})}}return c.default=o,Object.freeze(c)}const t=de(ce),N=a.createPropsContext(),O=t.forwardRef((o,c)=>{const s=a.usePropsContext(N,o),{size:l=p.size,rounded:b=p.rounded,fillMode:z=p.fillMode,autoFocus:j=p.autoFocus,prefix:w=null,suffix:q=null,ariaDescribedBy:R,ariaLabelledBy:D,autoSize:T,className:H,defaultValue:$,disabled:n,readOnly:L,required:d,rows:_,id:K,name:G,placeholder:J,style:Q,tabIndex:U,value:g,valid:P,validationMessage:S,validityStyles:E,onChange:x,onFocus:v,onBlur:y,visited:fe,touched:me,modified:pe,resizable:h,inputAttributes:W,...X}=s,r=t.useRef(null),M=t.useCallback(()=>{r.current&&r.current.focus()},[]),F=t.useCallback(()=>{r.current&&r.current.blur()},[]),[I,A]=t.useState($),[Y,V]=t.useState(!1),[Z,ee]=a.useCustomComponent(w),[te,ae]=a.useCustomComponent(q),f=g!==void 0,m=f?g:I,u=t.useCallback(()=>({element:r,focus:M,blur:F,get value(){return m},get name(){return r.current&&r.current.name}}),[F,M,m]);t.useImperativeHandle(c,u);const[re,B]=t.useState("auto"),ne=a.useId(),se=a.useDir(r,s.dir),k=P!==void 0?P:d?!!m:!0;t.useEffect(()=>{r.current&&r.current.setCustomValidity&&r.current.setCustomValidity(k?"":S||"")},[k,S]),a.useIsomorphicLayoutEffect(()=>{r.current&&B(`${r.current.scrollHeight}px`)},[m]);const oe=t.useCallback(i=>{const C=i.target.value;B("auto"),!f&&!n&&A(C),x&&!n&&a.dispatchEvent(x,i,{...u(),value:C},{value:C})},[A,x,n,f]),le=t.useCallback(i=>{V(!0),v&&!n&&a.dispatchEvent(v,i,u(),void 0)},[v,n,u]),ue=t.useCallback(i=>{V(!1),y&&!n&&a.dispatchEvent(y,i,u(),void 0)},[y,n,u]),ie={id:K||ne,role:"textbox",name:G,className:a.classNames("k-input-inner","!k-overflow-auto",{"k-resize":!T&&h!=="none"}),ref:r,disabled:n,rows:_,placeholder:J,readOnly:L,required:d,tabIndex:a.getTabIndex(U,n),autoFocus:j,style:T?{resize:"none",overflow:"hidden",height:re}:h?{resize:h}:{},"aria-labelledby":D,"aria-describedby":R,"aria-multiline":!0,"aria-disabled":n||void 0,"aria-required":d,value:f?g:I,...Object.assign({},X,W),onChange:oe,onFocus:le,onBlur:ue};return t.createElement("span",{className:a.classNames("k-input","k-textarea",{[`k-input-${a.kendoThemeMaps.sizeMap[l]||l}`]:l,[`k-input-${z}`]:z,[`k-rounded-${a.kendoThemeMaps.roundedMap[b]||b}`]:b,"k-invalid":!(k||E!==void 0||E===!0),"k-required":d,"k-disabled":n,"k-focus":Y},H),style:Q,dir:se},s.prefix&&t.createElement(Z,{...ee}),t.createElement("textarea",{...ie}),s.suffix&&t.createElement(te,{...ae}))});O.propTypes={ariaDescribedBy:e.string,ariaLabelledBy:e.string,autoSize:e.bool,className:e.string,defaultValue:e.string,dir:e.string,disabled:e.bool,readOnly:e.bool,rows:e.number,id:e.string,name:e.string,placeholder:e.string,style:e.object,tabIndex:e.number,value:e.oneOfType([e.string,e.arrayOf(e.string),e.number]),onChange:e.func,onFocus:e.func,onBlur:e.func,size:e.oneOf([null,"small","medium","large"]),rounded:e.oneOf([null,"small","medium","large","full"]),fillMode:e.oneOf([null,"solid","flat","outline"]),resizable:e.oneOf(["none","both","horizontal","vertical"]),autoFocus:e.bool};const p={size:"medium",rounded:"medium",fillMode:"solid",autoFocus:!1};O.displayName="KendoTextArea";exports.TextArea=O;exports.TextAreaPropsContext=N;
|
package/textarea/TextArea.mjs
CHANGED
|
@@ -7,136 +7,140 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import * as t from "react";
|
|
9
9
|
import e from "prop-types";
|
|
10
|
-
import { createPropsContext as
|
|
11
|
-
const
|
|
12
|
-
const
|
|
10
|
+
import { createPropsContext as fe, usePropsContext as me, useCustomComponent as M, useId as pe, useDir as be, useIsomorphicLayoutEffect as ge, dispatchEvent as y, classNames as S, getTabIndex as xe, kendoThemeMaps as A } from "@progress/kendo-react-common";
|
|
11
|
+
const ve = fe(), w = t.forwardRef((N, H) => {
|
|
12
|
+
const n = me(ve, N), {
|
|
13
13
|
size: c = d.size,
|
|
14
14
|
rounded: f = d.rounded,
|
|
15
15
|
fillMode: k = d.fillMode,
|
|
16
|
-
autoFocus:
|
|
17
|
-
prefix:
|
|
18
|
-
suffix:
|
|
19
|
-
ariaDescribedBy:
|
|
20
|
-
ariaLabelledBy:
|
|
16
|
+
autoFocus: R = d.autoFocus,
|
|
17
|
+
prefix: $ = null,
|
|
18
|
+
suffix: q = null,
|
|
19
|
+
ariaDescribedBy: D,
|
|
20
|
+
ariaLabelledBy: L,
|
|
21
21
|
autoSize: C,
|
|
22
|
-
className:
|
|
23
|
-
defaultValue:
|
|
22
|
+
className: j,
|
|
23
|
+
defaultValue: K,
|
|
24
24
|
disabled: r,
|
|
25
|
-
readOnly:
|
|
26
|
-
required:
|
|
27
|
-
rows:
|
|
28
|
-
id:
|
|
29
|
-
name:
|
|
30
|
-
placeholder:
|
|
31
|
-
style:
|
|
32
|
-
tabIndex:
|
|
25
|
+
readOnly: G,
|
|
26
|
+
required: l,
|
|
27
|
+
rows: J,
|
|
28
|
+
id: Q,
|
|
29
|
+
name: U,
|
|
30
|
+
placeholder: W,
|
|
31
|
+
style: X,
|
|
32
|
+
tabIndex: Y,
|
|
33
33
|
value: m,
|
|
34
34
|
valid: z,
|
|
35
|
-
validationMessage:
|
|
36
|
-
validityStyles:
|
|
35
|
+
validationMessage: F,
|
|
36
|
+
validityStyles: I,
|
|
37
37
|
onChange: p,
|
|
38
38
|
onFocus: b,
|
|
39
39
|
onBlur: g,
|
|
40
40
|
// Removed to support direct use in Form Field component
|
|
41
|
-
visited:
|
|
42
|
-
touched:
|
|
43
|
-
modified:
|
|
41
|
+
visited: he,
|
|
42
|
+
touched: ye,
|
|
43
|
+
modified: ke,
|
|
44
44
|
resizable: x,
|
|
45
|
-
inputAttributes:
|
|
46
|
-
...
|
|
47
|
-
} =
|
|
45
|
+
inputAttributes: Z,
|
|
46
|
+
..._
|
|
47
|
+
} = n, a = t.useRef(null), E = t.useCallback(() => {
|
|
48
48
|
a.current && a.current.focus();
|
|
49
|
-
}, []),
|
|
49
|
+
}, []), O = t.useCallback(() => {
|
|
50
|
+
a.current && a.current.blur();
|
|
51
|
+
}, []), [P, T] = t.useState(K), [ee, V] = t.useState(!1), [te, ae] = M($), [re, se] = M(q), u = m !== void 0, i = u ? m : P, s = t.useCallback(() => ({
|
|
50
52
|
element: a,
|
|
51
|
-
focus:
|
|
53
|
+
focus: E,
|
|
54
|
+
blur: O,
|
|
52
55
|
get value() {
|
|
53
56
|
return i;
|
|
54
57
|
},
|
|
55
58
|
get name() {
|
|
56
59
|
return a.current && a.current.name;
|
|
57
60
|
}
|
|
58
|
-
}), [
|
|
59
|
-
t.useImperativeHandle(
|
|
60
|
-
const [
|
|
61
|
+
}), [O, E, i]);
|
|
62
|
+
t.useImperativeHandle(H, s);
|
|
63
|
+
const [oe, B] = t.useState("auto"), ne = pe(), le = be(a, n.dir), v = z !== void 0 ? z : l ? !!i : !0;
|
|
61
64
|
t.useEffect(() => {
|
|
62
|
-
a.current && a.current.setCustomValidity && a.current.setCustomValidity(v ? "" :
|
|
63
|
-
}, [v,
|
|
65
|
+
a.current && a.current.setCustomValidity && a.current.setCustomValidity(v ? "" : F || "");
|
|
66
|
+
}, [v, F]), ge(() => {
|
|
64
67
|
a.current && B(`${a.current.scrollHeight}px`);
|
|
65
68
|
}, [i]);
|
|
66
|
-
const
|
|
69
|
+
const ue = t.useCallback(
|
|
67
70
|
(o) => {
|
|
68
71
|
const h = o.target.value;
|
|
69
|
-
B("auto"), !
|
|
72
|
+
B("auto"), !u && !r && T(h), p && !r && y(
|
|
70
73
|
p,
|
|
71
74
|
o,
|
|
72
75
|
{
|
|
73
|
-
...
|
|
76
|
+
...s(),
|
|
74
77
|
value: h
|
|
75
78
|
},
|
|
76
79
|
{ value: h }
|
|
77
80
|
);
|
|
78
81
|
},
|
|
79
|
-
[
|
|
80
|
-
),
|
|
82
|
+
[T, p, r, u]
|
|
83
|
+
), ie = t.useCallback(
|
|
81
84
|
(o) => {
|
|
82
|
-
b && !r && y(b, o,
|
|
85
|
+
V(!0), b && !r && y(b, o, s(), void 0);
|
|
83
86
|
},
|
|
84
|
-
[b, r]
|
|
85
|
-
),
|
|
87
|
+
[b, r, s]
|
|
88
|
+
), de = t.useCallback(
|
|
86
89
|
(o) => {
|
|
87
|
-
g && !r && y(g, o,
|
|
90
|
+
V(!1), g && !r && y(g, o, s(), void 0);
|
|
88
91
|
},
|
|
89
|
-
[g, r]
|
|
90
|
-
),
|
|
91
|
-
id:
|
|
92
|
+
[g, r, s]
|
|
93
|
+
), ce = {
|
|
94
|
+
id: Q || ne,
|
|
92
95
|
role: "textbox",
|
|
93
|
-
name:
|
|
94
|
-
className:
|
|
96
|
+
name: U,
|
|
97
|
+
className: S("k-input-inner", "!k-overflow-auto", { "k-resize": !C && x !== "none" }),
|
|
95
98
|
ref: a,
|
|
96
99
|
disabled: r,
|
|
97
|
-
rows:
|
|
98
|
-
placeholder:
|
|
99
|
-
readOnly:
|
|
100
|
-
required:
|
|
101
|
-
tabIndex:
|
|
102
|
-
autoFocus:
|
|
103
|
-
style: C ? { resize: "none", overflow: "hidden", height:
|
|
104
|
-
"aria-labelledby":
|
|
105
|
-
"aria-describedby":
|
|
100
|
+
rows: J,
|
|
101
|
+
placeholder: W,
|
|
102
|
+
readOnly: G,
|
|
103
|
+
required: l,
|
|
104
|
+
tabIndex: xe(Y, r),
|
|
105
|
+
autoFocus: R,
|
|
106
|
+
style: C ? { resize: "none", overflow: "hidden", height: oe } : x ? { resize: x } : {},
|
|
107
|
+
"aria-labelledby": L,
|
|
108
|
+
"aria-describedby": D,
|
|
106
109
|
"aria-multiline": !0,
|
|
107
110
|
"aria-disabled": r || void 0,
|
|
108
|
-
"aria-required":
|
|
109
|
-
value:
|
|
110
|
-
...Object.assign({},
|
|
111
|
-
onChange:
|
|
112
|
-
onFocus:
|
|
113
|
-
onBlur:
|
|
111
|
+
"aria-required": l,
|
|
112
|
+
value: u ? m : P,
|
|
113
|
+
...Object.assign({}, _, Z),
|
|
114
|
+
onChange: ue,
|
|
115
|
+
onFocus: ie,
|
|
116
|
+
onBlur: de
|
|
114
117
|
};
|
|
115
118
|
return /* @__PURE__ */ t.createElement(
|
|
116
119
|
"span",
|
|
117
120
|
{
|
|
118
|
-
className:
|
|
121
|
+
className: S(
|
|
119
122
|
"k-input",
|
|
120
123
|
"k-textarea",
|
|
121
124
|
{
|
|
122
|
-
[`k-input-${
|
|
125
|
+
[`k-input-${A.sizeMap[c] || c}`]: c,
|
|
123
126
|
[`k-input-${k}`]: k,
|
|
124
|
-
[`k-rounded-${
|
|
125
|
-
"k-invalid": !(v ||
|
|
126
|
-
"k-required":
|
|
127
|
-
"k-disabled": r
|
|
127
|
+
[`k-rounded-${A.roundedMap[f] || f}`]: f,
|
|
128
|
+
"k-invalid": !(v || I !== void 0 || I === !0),
|
|
129
|
+
"k-required": l,
|
|
130
|
+
"k-disabled": r,
|
|
131
|
+
"k-focus": ee
|
|
128
132
|
},
|
|
129
|
-
|
|
133
|
+
j
|
|
130
134
|
),
|
|
131
|
-
style:
|
|
132
|
-
dir:
|
|
135
|
+
style: X,
|
|
136
|
+
dir: le
|
|
133
137
|
},
|
|
134
|
-
|
|
135
|
-
/* @__PURE__ */ t.createElement("textarea", { ...
|
|
136
|
-
|
|
138
|
+
n.prefix && /* @__PURE__ */ t.createElement(te, { ...ae }),
|
|
139
|
+
/* @__PURE__ */ t.createElement("textarea", { ...ce }),
|
|
140
|
+
n.suffix && /* @__PURE__ */ t.createElement(re, { ...se })
|
|
137
141
|
);
|
|
138
142
|
});
|
|
139
|
-
|
|
143
|
+
w.propTypes = {
|
|
140
144
|
ariaDescribedBy: e.string,
|
|
141
145
|
ariaLabelledBy: e.string,
|
|
142
146
|
autoSize: e.bool,
|
|
@@ -167,8 +171,8 @@ const d = {
|
|
|
167
171
|
fillMode: "solid",
|
|
168
172
|
autoFocus: !1
|
|
169
173
|
};
|
|
170
|
-
|
|
174
|
+
w.displayName = "KendoTextArea";
|
|
171
175
|
export {
|
|
172
|
-
|
|
173
|
-
|
|
176
|
+
w as TextArea,
|
|
177
|
+
ve as TextAreaPropsContext
|
|
174
178
|
};
|