@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.
@@ -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 le=require("react"),e=require("prop-types"),a=require("@progress/kendo-react-common");function ie(s){const u=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const o in s)if(o!=="default"){const l=Object.getOwnPropertyDescriptor(s,o);Object.defineProperty(u,o,l.get?l:{enumerable:!0,get:()=>s[o]})}}return u.default=s,Object.freeze(u)}const t=ie(le),B=a.createPropsContext(),O=t.forwardRef((s,u)=>{const o=a.usePropsContext(B,s),{size:l=p.size,rounded:b=p.rounded,fillMode:z=p.fillMode,autoFocus:F=p.autoFocus,prefix:N=null,suffix:j=null,ariaDescribedBy:w,ariaLabelledBy:q,autoSize:T,className:R,defaultValue:D,disabled:n,readOnly:H,required:c,rows:$,id:L,name:_,placeholder:K,style:G,tabIndex:J,value:g,valid:P,validationMessage:M,validityStyles:S,onChange:x,onFocus:v,onBlur:y,visited:ue,touched:ce,modified:de,resizable:h,inputAttributes:Q,...U}=o,r=t.useRef(null),E=t.useCallback(()=>{r.current&&r.current.focus()},[]),[A,I]=t.useState(D),[W,X]=a.useCustomComponent(N),[Y,Z]=a.useCustomComponent(j),d=g!==void 0,f=d?g:A,m=t.useCallback(()=>({element:r,focus:E,get value(){return f},get name(){return r.current&&r.current.name}}),[E,f]);t.useImperativeHandle(u,m);const[ee,V]=t.useState("auto"),te=a.useId(),ae=a.useDir(r,o.dir),C=P!==void 0?P:c?!!f:!0;t.useEffect(()=>{r.current&&r.current.setCustomValidity&&r.current.setCustomValidity(C?"":M||"")},[C,M]),a.useIsomorphicLayoutEffect(()=>{r.current&&V(`${r.current.scrollHeight}px`)},[f]);const re=t.useCallback(i=>{const k=i.target.value;V("auto"),!d&&!n&&I(k),x&&!n&&a.dispatchEvent(x,i,{...m(),value:k},{value:k})},[I,x,n,d]),ne=t.useCallback(i=>{v&&!n&&a.dispatchEvent(v,i,m(),void 0)},[v,n]),oe=t.useCallback(i=>{y&&!n&&a.dispatchEvent(y,i,m(),void 0)},[y,n]),se={id:L||te,role:"textbox",name:_,className:a.classNames("k-input-inner","!k-overflow-auto",{"k-resize":!T&&h!=="none"}),ref:r,disabled:n,rows:$,placeholder:K,readOnly:H,required:c,tabIndex:a.getTabIndex(J,n),autoFocus:F,style:T?{resize:"none",overflow:"hidden",height:ee}:h?{resize:h}:{},"aria-labelledby":q,"aria-describedby":w,"aria-multiline":!0,"aria-disabled":n||void 0,"aria-required":c,value:d?g:A,...Object.assign({},U,Q),onChange:re,onFocus:ne,onBlur:oe};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":!(C||S!==void 0||S===!0),"k-required":c,"k-disabled":n},R),style:G,dir:ae},o.prefix&&t.createElement(W,{...X}),t.createElement("textarea",{...se}),o.suffix&&t.createElement(Y,{...Z}))});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=B;
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;
@@ -7,136 +7,140 @@
7
7
  */
8
8
  import * as t from "react";
9
9
  import e from "prop-types";
10
- import { createPropsContext as ue, usePropsContext as de, useCustomComponent as E, useId as ce, useDir as fe, useIsomorphicLayoutEffect as me, dispatchEvent as y, classNames as F, getTabIndex as pe, kendoThemeMaps as M } from "@progress/kendo-react-common";
11
- const be = ue(), A = t.forwardRef((S, w) => {
12
- const s = de(be, S), {
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: N = d.autoFocus,
17
- prefix: H = null,
18
- suffix: R = null,
19
- ariaDescribedBy: $,
20
- ariaLabelledBy: q,
16
+ autoFocus: R = d.autoFocus,
17
+ prefix: $ = null,
18
+ suffix: q = null,
19
+ ariaDescribedBy: D,
20
+ ariaLabelledBy: L,
21
21
  autoSize: C,
22
- className: D,
23
- defaultValue: L,
22
+ className: j,
23
+ defaultValue: K,
24
24
  disabled: r,
25
- readOnly: j,
26
- required: n,
27
- rows: K,
28
- id: G,
29
- name: J,
30
- placeholder: Q,
31
- style: U,
32
- tabIndex: W,
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: I,
36
- validityStyles: O,
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: ge,
42
- touched: xe,
43
- modified: ve,
41
+ visited: he,
42
+ touched: ye,
43
+ modified: ke,
44
44
  resizable: x,
45
- inputAttributes: X,
46
- ...Y
47
- } = s, a = t.useRef(null), P = t.useCallback(() => {
45
+ inputAttributes: Z,
46
+ ..._
47
+ } = n, a = t.useRef(null), E = t.useCallback(() => {
48
48
  a.current && a.current.focus();
49
- }, []), [T, V] = t.useState(L), [Z, _] = E(H), [ee, te] = E(R), l = m !== void 0, i = l ? m : T, u = t.useCallback(() => ({
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: P,
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
- }), [P, i]);
59
- t.useImperativeHandle(w, u);
60
- const [ae, B] = t.useState("auto"), re = ce(), oe = fe(a, s.dir), v = z !== void 0 ? z : n ? !!i : !0;
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 ? "" : I || "");
63
- }, [v, I]), me(() => {
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 se = t.useCallback(
69
+ const ue = t.useCallback(
67
70
  (o) => {
68
71
  const h = o.target.value;
69
- B("auto"), !l && !r && V(h), p && !r && y(
72
+ B("auto"), !u && !r && T(h), p && !r && y(
70
73
  p,
71
74
  o,
72
75
  {
73
- ...u(),
76
+ ...s(),
74
77
  value: h
75
78
  },
76
79
  { value: h }
77
80
  );
78
81
  },
79
- [V, p, r, l]
80
- ), ne = t.useCallback(
82
+ [T, p, r, u]
83
+ ), ie = t.useCallback(
81
84
  (o) => {
82
- b && !r && y(b, o, u(), void 0);
85
+ V(!0), b && !r && y(b, o, s(), void 0);
83
86
  },
84
- [b, r]
85
- ), le = t.useCallback(
87
+ [b, r, s]
88
+ ), de = t.useCallback(
86
89
  (o) => {
87
- g && !r && y(g, o, u(), void 0);
90
+ V(!1), g && !r && y(g, o, s(), void 0);
88
91
  },
89
- [g, r]
90
- ), ie = {
91
- id: G || re,
92
+ [g, r, s]
93
+ ), ce = {
94
+ id: Q || ne,
92
95
  role: "textbox",
93
- name: J,
94
- className: F("k-input-inner", "!k-overflow-auto", { "k-resize": !C && x !== "none" }),
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: K,
98
- placeholder: Q,
99
- readOnly: j,
100
- required: n,
101
- tabIndex: pe(W, r),
102
- autoFocus: N,
103
- style: C ? { resize: "none", overflow: "hidden", height: ae } : x ? { resize: x } : {},
104
- "aria-labelledby": q,
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": n,
109
- value: l ? m : T,
110
- ...Object.assign({}, Y, X),
111
- onChange: se,
112
- onFocus: ne,
113
- onBlur: le
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: F(
121
+ className: S(
119
122
  "k-input",
120
123
  "k-textarea",
121
124
  {
122
- [`k-input-${M.sizeMap[c] || c}`]: c,
125
+ [`k-input-${A.sizeMap[c] || c}`]: c,
123
126
  [`k-input-${k}`]: k,
124
- [`k-rounded-${M.roundedMap[f] || f}`]: f,
125
- "k-invalid": !(v || O !== void 0 || O === !0),
126
- "k-required": n,
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
- D
133
+ j
130
134
  ),
131
- style: U,
132
- dir: oe
135
+ style: X,
136
+ dir: le
133
137
  },
134
- s.prefix && /* @__PURE__ */ t.createElement(Z, { ..._ }),
135
- /* @__PURE__ */ t.createElement("textarea", { ...ie }),
136
- s.suffix && /* @__PURE__ */ t.createElement(ee, { ...te })
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
- A.propTypes = {
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
- A.displayName = "KendoTextArea";
174
+ w.displayName = "KendoTextArea";
171
175
  export {
172
- A as TextArea,
173
- be as TextAreaPropsContext
176
+ w as TextArea,
177
+ ve as TextAreaPropsContext
174
178
  };