@progress/kendo-react-inputs 14.5.0-develop.8 → 15.0.0-develop.1
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 +17 -0
- package/MaskedTextBoxMcpWrapper.js +8 -0
- package/MaskedTextBoxMcpWrapper.mjs +18 -0
- package/README.md +4 -4
- package/checkbox/Checkbox.js +1 -1
- package/checkbox/Checkbox.mjs +64 -64
- package/colors/ColorGradient.js +1 -1
- package/colors/ColorGradient.mjs +74 -72
- package/colors/ColorInput.js +1 -1
- package/colors/ColorInput.mjs +57 -45
- package/colors/ColorPalette.js +1 -1
- package/colors/ColorPalette.mjs +84 -81
- package/colors/ColorPicker.js +1 -1
- package/colors/ColorPicker.mjs +228 -215
- package/colors/FlatColorPicker.js +1 -1
- package/colors/FlatColorPicker.mjs +86 -94
- package/colors/interfaces/ColorPickerProps.d.ts +6 -1
- package/dist/cdn/js/kendo-react-inputs.js +1 -1
- package/index.d.mts +5 -1
- package/index.d.ts +5 -1
- package/index.js +1 -1
- package/index.mjs +92 -89
- package/maskedtextbox/MaskedTextBoxProps.d.ts +6 -1
- package/messages/index.d.ts +55 -0
- package/messages/index.js +1 -1
- package/messages/index.mjs +82 -60
- package/numerictextbox/NumericTextBox.js +1 -1
- package/numerictextbox/NumericTextBox.mjs +215 -213
- package/numerictextbox/interfaces/NumericTextBoxProps.d.ts +6 -1
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +16 -11
- package/radiobutton/RadioButton.js +1 -1
- package/radiobutton/RadioButton.mjs +23 -20
- package/radiobutton/interfaces/RadioButtonProps.d.ts +7 -0
- package/range-slider/RangeSlider.d.ts +14 -1
- package/range-slider/RangeSlider.js +11 -11
- package/range-slider/RangeSlider.mjs +188 -185
- package/rating/Rating.d.ts +6 -1
- package/rating/Rating.js +3 -3
- package/rating/Rating.mjs +83 -76
- package/signature/Signature.js +1 -1
- package/signature/Signature.mjs +127 -129
- package/signature/interfaces/SignatureProps.d.ts +6 -1
- package/slider/Slider.d.ts +6 -1
- package/slider/Slider.js +1 -1
- package/slider/Slider.mjs +155 -150
- package/slider/SliderLabel.js +1 -1
- package/slider/SliderLabel.mjs +3 -2
- package/switch/Switch.d.ts +6 -1
- package/switch/Switch.js +1 -1
- package/switch/Switch.mjs +100 -100
- package/textarea/TextArea.js +1 -1
- package/textarea/TextArea.mjs +101 -101
- package/textarea/interfaces/TextAreaProps.d.ts +6 -1
- package/textbox/Textbox.d.ts +20 -1
- package/textbox/Textbox.js +1 -1
- package/textbox/Textbox.mjs +92 -81
package/switch/Switch.mjs
CHANGED
|
@@ -5,63 +5,63 @@
|
|
|
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 { useState as
|
|
8
|
+
import * as l from "react";
|
|
9
|
+
import { useState as H, useRef as d, useMemo as E, useEffect as M, useCallback as m, useImperativeHandle as V } from "react";
|
|
10
10
|
import t from "prop-types";
|
|
11
|
-
import { withIdHOC as
|
|
12
|
-
import { LocalizationService as
|
|
13
|
-
import { switchValidation as
|
|
14
|
-
const
|
|
11
|
+
import { withIdHOC as le, withPropsContext as de, noop as B, dispatchEvent as se, subscribeToKendoPaste as oe, Keys as W, useWebMcpRegister as ue, classNames as N, kendoThemeMaps as x, getTabIndex as fe, createPropsContext as me } from "@progress/kendo-react-common";
|
|
12
|
+
import { LocalizationService as be, useLocalization as he } from "@progress/kendo-react-intl";
|
|
13
|
+
import { switchValidation as $, messages as A, switchAriaLabel as j } from "../messages/index.mjs";
|
|
14
|
+
const c = {
|
|
15
15
|
disabled: !1,
|
|
16
16
|
defaultChecked: !1,
|
|
17
17
|
size: void 0,
|
|
18
18
|
trackRounded: void 0,
|
|
19
19
|
thumbRounded: void 0,
|
|
20
20
|
offLabel: "OFF",
|
|
21
|
-
onBlur:
|
|
22
|
-
onFocus:
|
|
21
|
+
onBlur: B,
|
|
22
|
+
onFocus: B,
|
|
23
23
|
onLabel: "ON",
|
|
24
24
|
validityStyles: !0
|
|
25
|
-
},
|
|
26
|
-
var
|
|
25
|
+
}, G = l.forwardRef((e, Q) => {
|
|
26
|
+
var T;
|
|
27
27
|
const {
|
|
28
|
-
disabled:
|
|
29
|
-
defaultChecked:
|
|
30
|
-
size: k =
|
|
31
|
-
trackRounded: w =
|
|
32
|
-
thumbRounded: C =
|
|
33
|
-
offLabel:
|
|
34
|
-
onBlur: R =
|
|
35
|
-
onFocus: L =
|
|
36
|
-
onLabel:
|
|
37
|
-
} = e, [
|
|
38
|
-
var y,
|
|
39
|
-
const a = e.validationMessage !== void 0, i = (y = e.valid) != null ? y : e.required ? !!n : !0, g = (
|
|
28
|
+
disabled: r = c.disabled,
|
|
29
|
+
defaultChecked: U = c.defaultChecked,
|
|
30
|
+
size: k = c.size,
|
|
31
|
+
trackRounded: w = c.trackRounded,
|
|
32
|
+
thumbRounded: C = c.thumbRounded,
|
|
33
|
+
offLabel: I = c.offLabel,
|
|
34
|
+
onBlur: R = c.onBlur,
|
|
35
|
+
onFocus: L = c.onFocus,
|
|
36
|
+
onLabel: z = c.onLabel
|
|
37
|
+
} = e, [F, X] = H(U || !1), [Y, D] = H(!1), s = d(null), o = d(null), h = d(null), v = d(void 0), S = d(!1), K = d(void 0), O = E(() => new be(), []), Z = he(), n = E(() => v.current !== void 0 ? v.current : e.checked !== void 0 ? e.checked : F, [e.checked, F]), b = E(() => {
|
|
38
|
+
var y, q;
|
|
39
|
+
const a = e.validationMessage !== void 0, i = (y = e.valid) != null ? y : e.required ? !!n : !0, g = (q = e.valid) != null ? q : i;
|
|
40
40
|
return {
|
|
41
41
|
customError: a,
|
|
42
42
|
valid: g,
|
|
43
43
|
valueMissing: n === null
|
|
44
44
|
};
|
|
45
|
-
}, [e.valid, e.validationMessage, e.required, n]),
|
|
46
|
-
|
|
45
|
+
}, [e.valid, e.validationMessage, e.required, n]), _ = (T = e.validityStyles) != null ? T : c.validityStyles;
|
|
46
|
+
M(() => {
|
|
47
47
|
var a;
|
|
48
|
-
(a =
|
|
49
|
-
|
|
48
|
+
(a = h.current) != null && a.setCustomValidity && h.current.setCustomValidity(
|
|
49
|
+
b.valid ? "" : e.validationMessage || O.toLanguageString($, A[$])
|
|
50
50
|
);
|
|
51
|
-
}, [
|
|
52
|
-
|
|
51
|
+
}, [b, e.validationMessage, O]), M(() => {
|
|
52
|
+
s.current && (K.current = e.dir || getComputedStyle(s.current).direction || void 0);
|
|
53
53
|
}, [e.dir]);
|
|
54
|
-
const
|
|
54
|
+
const u = m(() => ({
|
|
55
55
|
props: e,
|
|
56
56
|
get element() {
|
|
57
|
-
return
|
|
57
|
+
return s.current;
|
|
58
58
|
},
|
|
59
59
|
get actionElement() {
|
|
60
|
-
return
|
|
60
|
+
return o.current;
|
|
61
61
|
},
|
|
62
62
|
focus: () => {
|
|
63
63
|
var a;
|
|
64
|
-
(a =
|
|
64
|
+
(a = o.current) == null || a.focus();
|
|
65
65
|
},
|
|
66
66
|
get value() {
|
|
67
67
|
return n;
|
|
@@ -70,147 +70,147 @@ const r = {
|
|
|
70
70
|
return e.name;
|
|
71
71
|
},
|
|
72
72
|
get validity() {
|
|
73
|
-
return
|
|
73
|
+
return b;
|
|
74
74
|
}
|
|
75
|
-
}), [e, n,
|
|
75
|
+
}), [e, n, b]), f = m(
|
|
76
76
|
(a, i) => {
|
|
77
|
-
|
|
77
|
+
X(a), v.current = a, se(
|
|
78
78
|
e.onChange,
|
|
79
79
|
i,
|
|
80
|
-
{ ...
|
|
80
|
+
{ ...u(), value: a },
|
|
81
81
|
{ value: a }
|
|
82
|
-
),
|
|
82
|
+
), v.current = void 0;
|
|
83
83
|
},
|
|
84
|
-
[e.onChange,
|
|
84
|
+
[e.onChange, u]
|
|
85
85
|
);
|
|
86
|
-
|
|
87
|
-
const a = e.name || e.id, i =
|
|
86
|
+
M(() => {
|
|
87
|
+
const a = e.name || e.id, i = oe(o.current, {
|
|
88
88
|
fieldName: a,
|
|
89
89
|
onValueChange: (g) => {
|
|
90
90
|
if (g !== n) {
|
|
91
91
|
const y = {
|
|
92
|
-
target:
|
|
93
|
-
currentTarget:
|
|
92
|
+
target: o.current,
|
|
93
|
+
currentTarget: o.current,
|
|
94
94
|
nativeEvent: new Event("change", { bubbles: !0 })
|
|
95
95
|
};
|
|
96
|
-
|
|
96
|
+
f(g, y);
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
});
|
|
100
100
|
return () => {
|
|
101
101
|
i == null || i.unsubscribe();
|
|
102
102
|
};
|
|
103
|
-
}, [e.name, e.id, n,
|
|
104
|
-
const
|
|
103
|
+
}, [e.name, e.id, n, f]);
|
|
104
|
+
const p = m(
|
|
105
105
|
(a) => {
|
|
106
|
-
if (a.target ===
|
|
106
|
+
if (a.target === h.current) {
|
|
107
107
|
if (S.current) {
|
|
108
108
|
S.current = !1;
|
|
109
109
|
return;
|
|
110
110
|
}
|
|
111
111
|
} else
|
|
112
112
|
S.current = !0;
|
|
113
|
-
|
|
113
|
+
f(!n, a);
|
|
114
114
|
},
|
|
115
|
-
[n,
|
|
116
|
-
),
|
|
115
|
+
[n, f]
|
|
116
|
+
), ee = m(
|
|
117
117
|
(a) => {
|
|
118
|
-
if (
|
|
118
|
+
if (r)
|
|
119
119
|
return;
|
|
120
120
|
const { keyCode: i } = a;
|
|
121
|
-
(i ===
|
|
121
|
+
(i === W.space || i === W.enter) && (f(!n, a), a.preventDefault());
|
|
122
122
|
},
|
|
123
|
-
[
|
|
124
|
-
),
|
|
123
|
+
[r, n, f]
|
|
124
|
+
), te = m(
|
|
125
125
|
(a) => {
|
|
126
|
-
|
|
126
|
+
r || (D(!0), L && L(a));
|
|
127
127
|
},
|
|
128
|
-
[
|
|
129
|
-
),
|
|
128
|
+
[r, L]
|
|
129
|
+
), ae = m(
|
|
130
130
|
(a) => {
|
|
131
|
-
|
|
131
|
+
r || (D(!1), R && R(a));
|
|
132
132
|
},
|
|
133
|
-
[
|
|
133
|
+
[r, R]
|
|
134
134
|
);
|
|
135
|
-
|
|
136
|
-
const
|
|
135
|
+
V(Q, u, [u]);
|
|
136
|
+
const P = d(null);
|
|
137
|
+
V(P, u, [u]), ue("switch", P, e, e.webMcp);
|
|
138
|
+
const ne = K.current || e.dir || s.current && getComputedStyle(s.current).direction || void 0, ie = !_ || b.valid, ce = N(
|
|
137
139
|
"k-switch",
|
|
138
140
|
{
|
|
139
|
-
[`k-switch-${
|
|
141
|
+
[`k-switch-${x.sizeMap[k] || k}`]: k,
|
|
140
142
|
"k-switch-on": n,
|
|
141
143
|
"k-switch-off": !n,
|
|
142
|
-
"k-focus":
|
|
143
|
-
"k-disabled":
|
|
144
|
-
"k-invalid": !
|
|
144
|
+
"k-focus": Y,
|
|
145
|
+
"k-disabled": r,
|
|
146
|
+
"k-invalid": !ie
|
|
145
147
|
},
|
|
146
148
|
e.className
|
|
147
|
-
),
|
|
149
|
+
), re = /* @__PURE__ */ l.createElement(
|
|
148
150
|
"input",
|
|
149
151
|
{
|
|
150
152
|
type: "checkbox",
|
|
151
153
|
checked: e.checked,
|
|
152
|
-
ref:
|
|
154
|
+
ref: h,
|
|
153
155
|
tabIndex: -1,
|
|
154
|
-
"aria-hidden": !0,
|
|
155
|
-
"aria-label": e.ariaLabel || E.toLanguageString($, W[$]),
|
|
156
156
|
value: n,
|
|
157
157
|
style: { opacity: 0, width: 1, border: 0, zIndex: -1, position: "absolute", left: "50%" },
|
|
158
|
-
onChange:
|
|
158
|
+
onChange: B,
|
|
159
159
|
name: e.name || void 0
|
|
160
160
|
}
|
|
161
161
|
);
|
|
162
|
-
return /* @__PURE__ */
|
|
162
|
+
return /* @__PURE__ */ l.createElement(
|
|
163
163
|
"span",
|
|
164
164
|
{
|
|
165
|
-
ref:
|
|
165
|
+
ref: o,
|
|
166
166
|
role: "switch",
|
|
167
167
|
"aria-checked": n,
|
|
168
|
-
"aria-disabled":
|
|
168
|
+
"aria-disabled": r || void 0,
|
|
169
169
|
"aria-labelledby": e.ariaLabelledBy,
|
|
170
170
|
"aria-describedby": e.ariaDescribedBy,
|
|
171
|
-
"aria-label": e.ariaLabel,
|
|
171
|
+
"aria-label": e.ariaLabel || Z.toLanguageString(j, A[j]),
|
|
172
172
|
"aria-required": e.required,
|
|
173
|
-
className:
|
|
174
|
-
dir:
|
|
175
|
-
onKeyDown:
|
|
176
|
-
onClick:
|
|
177
|
-
onBlur:
|
|
178
|
-
onFocus:
|
|
179
|
-
tabIndex:
|
|
173
|
+
className: ce,
|
|
174
|
+
dir: ne,
|
|
175
|
+
onKeyDown: ee,
|
|
176
|
+
onClick: p,
|
|
177
|
+
onBlur: ae,
|
|
178
|
+
onFocus: te,
|
|
179
|
+
tabIndex: fe(e.tabIndex, r, void 0),
|
|
180
180
|
accessKey: e.accessKey,
|
|
181
181
|
id: e.id
|
|
182
182
|
},
|
|
183
|
-
/* @__PURE__ */
|
|
183
|
+
/* @__PURE__ */ l.createElement(
|
|
184
184
|
"span",
|
|
185
185
|
{
|
|
186
|
-
className:
|
|
187
|
-
[`k-rounded-${
|
|
186
|
+
className: N("k-switch-track", {
|
|
187
|
+
[`k-rounded-${x.roundedMap[w] || w}`]: w
|
|
188
188
|
}),
|
|
189
|
-
ref:
|
|
189
|
+
ref: s
|
|
190
190
|
},
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
191
|
+
re,
|
|
192
|
+
z ? /* @__PURE__ */ l.createElement("span", { className: "k-switch-label-on" }, z) : "",
|
|
193
|
+
I ? /* @__PURE__ */ l.createElement("span", { className: "k-switch-label-off" }, I) : ""
|
|
194
194
|
),
|
|
195
|
-
/* @__PURE__ */
|
|
195
|
+
/* @__PURE__ */ l.createElement("span", { className: "k-switch-thumb-wrap" }, /* @__PURE__ */ l.createElement(
|
|
196
196
|
"span",
|
|
197
197
|
{
|
|
198
|
-
className:
|
|
199
|
-
[`k-rounded-${
|
|
198
|
+
className: N("k-switch-thumb", {
|
|
199
|
+
[`k-rounded-${x.roundedMap[C] || C}`]: C
|
|
200
200
|
})
|
|
201
201
|
}
|
|
202
202
|
))
|
|
203
203
|
);
|
|
204
204
|
});
|
|
205
|
-
|
|
206
|
-
const
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
205
|
+
G.displayName = "Switch";
|
|
206
|
+
const ve = me(), J = le(
|
|
207
|
+
de(
|
|
208
|
+
ve,
|
|
209
|
+
G
|
|
210
210
|
)
|
|
211
211
|
);
|
|
212
|
-
|
|
213
|
-
|
|
212
|
+
J.displayName = "KendoReactSwitch";
|
|
213
|
+
J.propTypes = {
|
|
214
214
|
accessKey: t.string,
|
|
215
215
|
checked: t.bool,
|
|
216
216
|
className: t.string,
|
|
@@ -239,7 +239,7 @@ j.propTypes = {
|
|
|
239
239
|
validityStyles: t.bool
|
|
240
240
|
};
|
|
241
241
|
export {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
242
|
+
J as Switch,
|
|
243
|
+
ve as SwitchPropsContext,
|
|
244
|
+
G as SwitchWithoutContext
|
|
245
245
|
};
|
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 ge=require("react"),e=require("prop-types"),n=require("@progress/kendo-react-common");function ve(l){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const o in l)if(o!=="default"){const i=Object.getOwnPropertyDescriptor(l,o);Object.defineProperty(c,o,i.get?i:{enumerable:!0,get:()=>l[o]})}}return c.default=l,Object.freeze(c)}const t=ve(ge),K=n.createPropsContext(),T=t.forwardRef((l,c)=>{const o=n.usePropsContext(K,l),{size:i=m.size,rounded:x=m.rounded,fillMode:S=m.fillMode,autoFocus:L=m.autoFocus,flow:h=m.flow,prefix:_=null,suffix:W=null,ariaDescribedBy:G,ariaLabelledBy:J,autoSize:p,className:Q,defaultValue:U,disabled:s,readOnly:X,required:b,rows:Y,id:M,name:w,placeholder:Z,style:ee,tabIndex:te,value:y,valid:E,validationMessage:F,validityStyles:I,onChange:k,onFocus:C,onBlur:z,visited:xe,touched:he,modified:ye,resizable:d,inputAttributes:ae,textareaStyle:V,...ne}=o,a=t.useRef(null),A=t.useCallback(()=>{a.current&&a.current.focus()},[]),N=t.useCallback(()=>{a.current&&a.current.blur()},[]),[B,R]=t.useState(U),[re,j]=t.useState(!1),[oe,se]=n.useCustomComponent(_),[le,ue]=n.useCustomComponent(W),g=y!==void 0,v=g?y:B,q=w||M,u=t.useCallback(()=>({element:a,focus:A,blur:N,get value(){return v},get name(){return a.current&&a.current.name}}),[N,A,v]);t.useImperativeHandle(c,u);const H=t.useRef(null);t.useImperativeHandle(H,u),n.useWebMcpRegister("textarea",H,o,o.webMcp);const[D,$]=t.useState("auto"),ie=n.useId(),ce=n.useDir(a,o.dir),O=E!==void 0?E:b?!!v:!0;t.useEffect(()=>{a.current&&a.current.setCustomValidity&&a.current.setCustomValidity(O?"":F||"")},[O,F]),n.useIsomorphicLayoutEffect(()=>{a.current&&$(`${a.current.scrollHeight}px`)},[v]);const P=t.useCallback(r=>{const f=r.target.value;$("auto"),!g&&!s&&R(f),k&&!s&&n.dispatchEvent(k,r,{...u(),value:f},{value:f})},[R,k,s,g]),de=t.useCallback(r=>{j(!0),C&&!s&&n.dispatchEvent(C,r,u(),void 0)},[C,s,u]),fe=t.useCallback(r=>{j(!1),z&&!s&&n.dispatchEvent(z,r,u(),void 0)},[z,s,u]),me=t.useCallback(r=>{a.current&&(a.current.value=r);const f={target:a.current,currentTarget:a.current};P(f)},[P]);n.useKendoPaste(a,{fieldName:q,onValueChange:me,enabled:!!q});const pe=t.useMemo(()=>{let r={};return p?r={resize:"none",overflow:"hidden",height:D}:d&&(r={resize:d}),{...r,...V}},[p,d,D,V]),be={id:M||ie,name:w,className:n.classNames("k-input-inner","!k-overflow-auto",{"k-resize":!p&&d!=="none","k-resize-none":p||d==="none","!k-flex-none":h==="vertical"}),ref:a,disabled:s,rows:Y,placeholder:Z,readOnly:X,required:b,tabIndex:n.getTabIndex(te,s),autoFocus:L,style:pe,"aria-labelledby":J,"aria-describedby":G,"aria-disabled":s||void 0,"aria-required":b,value:g?y:B,...Object.assign({},ne,ae),onChange:P,onFocus:de,onBlur:fe};return t.createElement("span",{className:n.classNames("k-input","k-textarea",{[`k-input-${n.kendoThemeMaps.sizeMap[i]||i}`]:i,[`k-input-${S}`]:S,[`k-rounded-${n.kendoThemeMaps.roundedMap[x]||x}`]:x,"k-invalid":!(O||I!==void 0||I===!0),"k-required":b,"k-disabled":s,"k-focus":re,"!k-flex-col":h==="vertical","!k-flex-row":h==="horizontal"},Q),style:ee,dir:ce},o.prefix&&t.createElement(oe,{...se}),t.createElement("textarea",{...be}),o.suffix&&t.createElement(le,{...ue}))});T.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(["small","medium","large"]),rounded:e.oneOf(["small","medium","large","full","none"]),fillMode:e.oneOf(["solid","flat","outline"]),resizable:e.oneOf(["none","both","horizontal","vertical"]),autoFocus:e.bool,flow:e.oneOf(["vertical","horizontal"])};const m={size:void 0,rounded:void 0,fillMode:void 0,autoFocus:!1,flow:"horizontal"};T.displayName="KendoTextArea";exports.TextArea=T;exports.TextAreaPropsContext=K;
|
package/textarea/TextArea.mjs
CHANGED
|
@@ -5,176 +5,176 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import * as
|
|
8
|
+
import * as t from "react";
|
|
9
9
|
import e from "prop-types";
|
|
10
|
-
import { usePropsContext as
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
size:
|
|
14
|
-
rounded:
|
|
15
|
-
fillMode:
|
|
10
|
+
import { usePropsContext as xe, useCustomComponent as q, useWebMcpRegister as he, useId as ye, useDir as ke, useIsomorphicLayoutEffect as Ce, dispatchEvent as z, useKendoPaste as ze, getTabIndex as we, classNames as D, kendoThemeMaps as K, createPropsContext as Pe } from "@progress/kendo-react-common";
|
|
11
|
+
const Fe = Pe(), L = t.forwardRef((j, W) => {
|
|
12
|
+
const s = xe(Fe, j), {
|
|
13
|
+
size: p = i.size,
|
|
14
|
+
rounded: b = i.rounded,
|
|
15
|
+
fillMode: w = i.fillMode,
|
|
16
16
|
autoFocus: G = i.autoFocus,
|
|
17
|
-
flow:
|
|
17
|
+
flow: v = i.flow,
|
|
18
18
|
prefix: J = null,
|
|
19
19
|
suffix: Q = null,
|
|
20
20
|
ariaDescribedBy: U,
|
|
21
|
-
ariaLabelledBy:
|
|
21
|
+
ariaLabelledBy: X,
|
|
22
22
|
autoSize: c,
|
|
23
|
-
className:
|
|
24
|
-
defaultValue:
|
|
23
|
+
className: Y,
|
|
24
|
+
defaultValue: Z,
|
|
25
25
|
disabled: o,
|
|
26
|
-
readOnly:
|
|
26
|
+
readOnly: _,
|
|
27
27
|
required: d,
|
|
28
|
-
rows:
|
|
29
|
-
id:
|
|
28
|
+
rows: ee,
|
|
29
|
+
id: P,
|
|
30
30
|
name: F,
|
|
31
|
-
placeholder:
|
|
32
|
-
style:
|
|
33
|
-
tabIndex:
|
|
34
|
-
value:
|
|
35
|
-
valid:
|
|
36
|
-
validationMessage:
|
|
37
|
-
validityStyles:
|
|
38
|
-
onChange:
|
|
31
|
+
placeholder: te,
|
|
32
|
+
style: ae,
|
|
33
|
+
tabIndex: re,
|
|
34
|
+
value: g,
|
|
35
|
+
valid: I,
|
|
36
|
+
validationMessage: M,
|
|
37
|
+
validityStyles: S,
|
|
38
|
+
onChange: x,
|
|
39
39
|
onFocus: h,
|
|
40
40
|
onBlur: y,
|
|
41
41
|
// Removed to support direct use in Form Field component
|
|
42
|
-
visited:
|
|
43
|
-
touched:
|
|
42
|
+
visited: Ie,
|
|
43
|
+
touched: Me,
|
|
44
44
|
modified: Se,
|
|
45
|
-
resizable:
|
|
46
|
-
inputAttributes:
|
|
47
|
-
textareaStyle:
|
|
48
|
-
...
|
|
49
|
-
} =
|
|
50
|
-
|
|
51
|
-
}, []),
|
|
52
|
-
|
|
53
|
-
}, []), [
|
|
54
|
-
element:
|
|
55
|
-
focus:
|
|
56
|
-
blur:
|
|
45
|
+
resizable: l,
|
|
46
|
+
inputAttributes: oe,
|
|
47
|
+
textareaStyle: T,
|
|
48
|
+
...ne
|
|
49
|
+
} = s, a = t.useRef(null), V = t.useCallback(() => {
|
|
50
|
+
a.current && a.current.focus();
|
|
51
|
+
}, []), E = t.useCallback(() => {
|
|
52
|
+
a.current && a.current.blur();
|
|
53
|
+
}, []), [O, B] = t.useState(Z), [se, A] = t.useState(!1), [le, ue] = q(J), [ie, ce] = q(Q), f = g !== void 0, m = f ? g : O, N = F || P, n = t.useCallback(() => ({
|
|
54
|
+
element: a,
|
|
55
|
+
focus: V,
|
|
56
|
+
blur: E,
|
|
57
57
|
get value() {
|
|
58
58
|
return m;
|
|
59
59
|
},
|
|
60
60
|
get name() {
|
|
61
|
-
return
|
|
61
|
+
return a.current && a.current.name;
|
|
62
62
|
}
|
|
63
|
-
}), [
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
}), [E, V, m]);
|
|
64
|
+
t.useImperativeHandle(W, n);
|
|
65
|
+
const R = t.useRef(null);
|
|
66
|
+
t.useImperativeHandle(R, n), he("textarea", R, s, s.webMcp);
|
|
67
|
+
const [H, $] = t.useState("auto"), de = ye(), fe = ke(a, s.dir), k = I !== void 0 ? I : d ? !!m : !0;
|
|
68
|
+
t.useEffect(() => {
|
|
69
|
+
a.current && a.current.setCustomValidity && a.current.setCustomValidity(k ? "" : M || "");
|
|
70
|
+
}, [k, M]), Ce(() => {
|
|
71
|
+
a.current && $(`${a.current.scrollHeight}px`);
|
|
70
72
|
}, [m]);
|
|
71
|
-
const C =
|
|
73
|
+
const C = t.useCallback(
|
|
72
74
|
(r) => {
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
75
|
+
const u = r.target.value;
|
|
76
|
+
$("auto"), !f && !o && B(u), x && !o && z(
|
|
77
|
+
x,
|
|
76
78
|
r,
|
|
77
79
|
{
|
|
78
80
|
...n(),
|
|
79
|
-
value:
|
|
81
|
+
value: u
|
|
80
82
|
},
|
|
81
|
-
{ value:
|
|
83
|
+
{ value: u }
|
|
82
84
|
);
|
|
83
85
|
},
|
|
84
|
-
[
|
|
85
|
-
),
|
|
86
|
+
[B, x, o, f]
|
|
87
|
+
), me = t.useCallback(
|
|
86
88
|
(r) => {
|
|
87
89
|
A(!0), h && !o && z(h, r, n(), void 0);
|
|
88
90
|
},
|
|
89
91
|
[h, o, n]
|
|
90
|
-
),
|
|
92
|
+
), pe = t.useCallback(
|
|
91
93
|
(r) => {
|
|
92
94
|
A(!1), y && !o && z(y, r, n(), void 0);
|
|
93
95
|
},
|
|
94
96
|
[y, o, n]
|
|
95
|
-
), be =
|
|
97
|
+
), be = t.useCallback(
|
|
96
98
|
(r) => {
|
|
97
|
-
|
|
98
|
-
const
|
|
99
|
-
target:
|
|
100
|
-
currentTarget:
|
|
99
|
+
a.current && (a.current.value = r);
|
|
100
|
+
const u = {
|
|
101
|
+
target: a.current,
|
|
102
|
+
currentTarget: a.current
|
|
101
103
|
};
|
|
102
|
-
C(
|
|
104
|
+
C(u);
|
|
103
105
|
},
|
|
104
106
|
[C]
|
|
105
107
|
);
|
|
106
|
-
|
|
108
|
+
ze(a, {
|
|
107
109
|
fieldName: N,
|
|
108
110
|
onValueChange: be,
|
|
109
111
|
enabled: !!N
|
|
110
112
|
});
|
|
111
|
-
const
|
|
113
|
+
const ve = t.useMemo(() => {
|
|
112
114
|
let r = {};
|
|
113
115
|
return c ? r = {
|
|
114
116
|
resize: "none",
|
|
115
117
|
overflow: "hidden",
|
|
116
118
|
height: H
|
|
117
|
-
} :
|
|
119
|
+
} : l && (r = { resize: l }), {
|
|
118
120
|
...r,
|
|
119
|
-
...
|
|
121
|
+
...T
|
|
120
122
|
};
|
|
121
|
-
}, [c,
|
|
122
|
-
id:
|
|
123
|
-
role: "textbox",
|
|
123
|
+
}, [c, l, H, T]), ge = {
|
|
124
|
+
id: P || de,
|
|
124
125
|
name: F,
|
|
125
|
-
className:
|
|
126
|
-
"k-resize": !c &&
|
|
127
|
-
"k-resize-none": c ||
|
|
128
|
-
"!k-flex-none":
|
|
126
|
+
className: D("k-input-inner", "!k-overflow-auto", {
|
|
127
|
+
"k-resize": !c && l !== "none",
|
|
128
|
+
"k-resize-none": c || l === "none",
|
|
129
|
+
"!k-flex-none": v === "vertical"
|
|
129
130
|
}),
|
|
130
|
-
ref:
|
|
131
|
+
ref: a,
|
|
131
132
|
disabled: o,
|
|
132
|
-
rows:
|
|
133
|
-
placeholder:
|
|
134
|
-
readOnly:
|
|
133
|
+
rows: ee,
|
|
134
|
+
placeholder: te,
|
|
135
|
+
readOnly: _,
|
|
135
136
|
required: d,
|
|
136
|
-
tabIndex:
|
|
137
|
+
tabIndex: we(re, o),
|
|
137
138
|
autoFocus: G,
|
|
138
|
-
style:
|
|
139
|
-
"aria-labelledby":
|
|
139
|
+
style: ve,
|
|
140
|
+
"aria-labelledby": X,
|
|
140
141
|
"aria-describedby": U,
|
|
141
|
-
"aria-multiline": !0,
|
|
142
142
|
"aria-disabled": o || void 0,
|
|
143
143
|
"aria-required": d,
|
|
144
|
-
value: f ?
|
|
145
|
-
...Object.assign({},
|
|
144
|
+
value: f ? g : O,
|
|
145
|
+
...Object.assign({}, ne, oe),
|
|
146
146
|
onChange: C,
|
|
147
|
-
onFocus:
|
|
148
|
-
onBlur:
|
|
147
|
+
onFocus: me,
|
|
148
|
+
onBlur: pe
|
|
149
149
|
};
|
|
150
|
-
return /* @__PURE__ */
|
|
150
|
+
return /* @__PURE__ */ t.createElement(
|
|
151
151
|
"span",
|
|
152
152
|
{
|
|
153
|
-
className:
|
|
153
|
+
className: D(
|
|
154
154
|
"k-input",
|
|
155
155
|
"k-textarea",
|
|
156
156
|
{
|
|
157
|
-
[`k-input-${
|
|
158
|
-
[`k-input-${
|
|
159
|
-
[`k-rounded-${
|
|
160
|
-
"k-invalid": !(k ||
|
|
157
|
+
[`k-input-${K.sizeMap[p] || p}`]: p,
|
|
158
|
+
[`k-input-${w}`]: w,
|
|
159
|
+
[`k-rounded-${K.roundedMap[b] || b}`]: b,
|
|
160
|
+
"k-invalid": !(k || S !== void 0 || S === !0),
|
|
161
161
|
"k-required": d,
|
|
162
162
|
"k-disabled": o,
|
|
163
|
-
"k-focus":
|
|
164
|
-
"!k-flex-col":
|
|
165
|
-
"!k-flex-row":
|
|
163
|
+
"k-focus": se,
|
|
164
|
+
"!k-flex-col": v === "vertical",
|
|
165
|
+
"!k-flex-row": v === "horizontal"
|
|
166
166
|
},
|
|
167
|
-
|
|
167
|
+
Y
|
|
168
168
|
),
|
|
169
|
-
style:
|
|
170
|
-
dir:
|
|
169
|
+
style: ae,
|
|
170
|
+
dir: fe
|
|
171
171
|
},
|
|
172
|
-
|
|
173
|
-
/* @__PURE__ */
|
|
174
|
-
|
|
172
|
+
s.prefix && /* @__PURE__ */ t.createElement(le, { ...ue }),
|
|
173
|
+
/* @__PURE__ */ t.createElement("textarea", { ...ge }),
|
|
174
|
+
s.suffix && /* @__PURE__ */ t.createElement(ie, { ...ce })
|
|
175
175
|
);
|
|
176
176
|
});
|
|
177
|
-
|
|
177
|
+
L.propTypes = {
|
|
178
178
|
ariaDescribedBy: e.string,
|
|
179
179
|
ariaLabelledBy: e.string,
|
|
180
180
|
autoSize: e.bool,
|
|
@@ -207,8 +207,8 @@ const i = {
|
|
|
207
207
|
autoFocus: !1,
|
|
208
208
|
flow: "horizontal"
|
|
209
209
|
};
|
|
210
|
-
|
|
210
|
+
L.displayName = "KendoTextArea";
|
|
211
211
|
export {
|
|
212
|
-
|
|
213
|
-
|
|
212
|
+
L as TextArea,
|
|
213
|
+
Fe as TextAreaPropsContext
|
|
214
214
|
};
|