@progress/kendo-react-inputs 15.2.0-develop.1 → 15.2.0-develop.2

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.
Files changed (42) hide show
  1. package/checkbox/Checkbox.js +1 -1
  2. package/checkbox/Checkbox.mjs +79 -77
  3. package/colors/ColorContrastLabels.js +1 -1
  4. package/colors/ColorContrastLabels.mjs +2 -2
  5. package/colors/ColorGradient.js +1 -1
  6. package/colors/ColorGradient.mjs +51 -52
  7. package/colors/ColorPalette.js +1 -1
  8. package/colors/ColorPalette.mjs +71 -72
  9. package/colors/ColorPicker.js +1 -1
  10. package/colors/ColorPicker.mjs +247 -239
  11. package/colors/FlatColorPicker.d.ts +4 -4
  12. package/colors/FlatColorPicker.js +1 -1
  13. package/colors/FlatColorPicker.mjs +104 -100
  14. package/colors/interfaces/ColorPaletteProps.d.ts +7 -0
  15. package/colors/interfaces/ColorPickerPaletteSettings.d.ts +5 -0
  16. package/dist/cdn/js/kendo-react-inputs.js +1 -1
  17. package/maskedtextbox/MaskedTextBox.d.ts +1 -0
  18. package/maskedtextbox/MaskedTextBox.js +1 -1
  19. package/maskedtextbox/MaskedTextBox.mjs +26 -23
  20. package/maskedtextbox/MaskedTextBoxProps.d.ts +7 -0
  21. package/numerictextbox/NumericTextBox.js +1 -1
  22. package/numerictextbox/NumericTextBox.mjs +2 -2
  23. package/otpinput/OTPInput.js +1 -1
  24. package/otpinput/OTPInput.mjs +141 -143
  25. package/package-metadata.js +1 -1
  26. package/package-metadata.mjs +2 -2
  27. package/package.json +10 -10
  28. package/radiobutton/RadioButton.js +1 -1
  29. package/radiobutton/RadioButton.mjs +32 -30
  30. package/range-slider/RangeSlider.js +11 -11
  31. package/range-slider/RangeSlider.mjs +54 -54
  32. package/rating/Rating.d.ts +12 -0
  33. package/rating/Rating.js +2 -2
  34. package/rating/Rating.mjs +91 -92
  35. package/slider/Slider.d.ts +12 -0
  36. package/slider/Slider.js +1 -1
  37. package/slider/Slider.mjs +61 -56
  38. package/switch/Switch.d.ts +15 -0
  39. package/switch/Switch.js +1 -1
  40. package/switch/Switch.mjs +82 -79
  41. package/textarea/TextArea.js +1 -1
  42. package/textarea/TextArea.mjs +11 -12
package/slider/Slider.mjs CHANGED
@@ -6,43 +6,45 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  import * as r from "react";
9
- import { useState as R, useRef as N, useMemo as z, useEffect as q, useCallback as c, useImperativeHandle as me } from "react";
9
+ import { useState as R, useRef as N, useMemo as z, useEffect as q, useCallback as c, useImperativeHandle as ue } from "react";
10
10
  import i from "prop-types";
11
- import { withPropsContext as ue, dispatchEvent as fe, Keys as m, useWebMcpRegister as ge, classNames as ve, Draggable as he, getTabIndex as be, createPropsContext as ye } from "@progress/kendo-react-common";
12
- import { LocalizationService as ke, registerForLocalization as xe } from "@progress/kendo-react-intl";
13
- import { sliderDragTitle as H, messages as B, sliderDecreaseValue as O, sliderIncreaseValue as W } from "../messages/index.mjs";
14
- import { SLIDER_LABEL_ATTRIBUTE as Se } from "./SliderLabel.mjs";
15
- import { Button as X } from "@progress/kendo-react-buttons";
16
- import { chevronUpIcon as _, chevronLeftIcon as j, chevronDownIcon as G, chevronRightIcon as Y } from "@progress/kendo-svg-icons";
11
+ import { withPropsContext as fe, dispatchEvent as ge, Keys as m, useWebMcpRegister as ve, classNames as he, Draggable as be, getTabIndex as ye, createPropsContext as ke } from "@progress/kendo-react-common";
12
+ import { LocalizationService as xe, registerForLocalization as Se } from "@progress/kendo-react-intl";
13
+ import { sliderDragTitle as H, messages as B, sliderDecreaseValue as W, sliderIncreaseValue as X } from "../messages/index.mjs";
14
+ import { SLIDER_LABEL_ATTRIBUTE as we } from "./SliderLabel.mjs";
15
+ import { Button as _ } from "@progress/kendo-react-buttons";
16
+ import { chevronUpIcon as j, chevronLeftIcon as G, chevronDownIcon as Y, chevronRightIcon as J } from "@progress/kendo-svg-icons";
17
17
  const g = {
18
18
  step: 1,
19
19
  largeStep: 10,
20
20
  buttons: !1,
21
21
  vertical: !1,
22
22
  disabled: !1,
23
+ readOnly: !1,
23
24
  tabIndex: 0
24
- }, V = r.forwardRef((e, P) => {
25
- var M, K, U;
25
+ }, V = r.forwardRef((e, Q) => {
26
+ var O, K, U;
26
27
  const {
27
28
  step: u = g.step,
28
29
  largeStep: C = g.largeStep,
29
30
  vertical: a = g.vertical,
30
31
  disabled: d = g.disabled,
31
- tabIndex: Q = g.tabIndex
32
- } = e, [Z, $] = R((M = e.defaultValue) != null ? M : e.min), [p, A] = R(!1), [I, ee] = R(e.dir), E = N(null), v = N(null), T = z(() => new ke(), []), D = N(null), L = e.value !== void 0, k = L && e.value !== void 0 ? e.value : Z, l = z(() => k < e.min ? e.min : k > e.max ? e.max : k, [k, e.min, e.max]), h = z(() => {
32
+ tabIndex: Z = g.tabIndex,
33
+ readOnly: A = g.readOnly
34
+ } = e, [$, p] = R((O = e.defaultValue) != null ? O : e.min), [ee, F] = R(!1), [I, te] = R(e.dir), E = N(null), v = N(null), T = z(() => new xe(), []), D = N(null), L = e.value !== void 0, k = L && e.value !== void 0 ? e.value : $, l = z(() => k < e.min ? e.min : k > e.max ? e.max : k, [k, e.min, e.max]), h = z(() => {
33
35
  const t = e.max - e.min;
34
36
  return t === 0 ? 0 : (l - e.min) / t * 100;
35
37
  }, [l, e.min, e.max]), f = (K = e.dir) != null ? K : I;
36
38
  q(() => {
37
39
  if (e.dir === void 0 && v.current) {
38
40
  const n = window.getComputedStyle(v.current).direction;
39
- n !== I && ee(n);
41
+ n !== I && te(n);
40
42
  }
41
43
  }, [e.dir, I]);
42
- const F = c((t) => {
44
+ const M = c((t) => {
43
45
  let n = t;
44
46
  for (; n; ) {
45
- if (n.getAttribute(Se))
47
+ if (n.getAttribute(we))
46
48
  return !0;
47
49
  n = n.parentElement;
48
50
  }
@@ -50,14 +52,14 @@ const g = {
50
52
  }, []), s = c(
51
53
  (t, n) => {
52
54
  const o = Math.min(Math.max(n, e.min), e.max);
53
- L || $(o), fe(e.onChange, t, D.current, { value: o });
55
+ L || p(o), ge(e.onChange, t, D.current, { value: o });
54
56
  },
55
57
  [e.min, e.max, e.onChange, L]
56
- ), te = c(() => {
57
- A(!0);
58
- }, []), ne = c(() => {
59
- A(!1);
60
- }, []), ae = c(
58
+ ), ne = c(() => {
59
+ F(!0);
60
+ }, []), ae = c(() => {
61
+ F(!1);
62
+ }, []), ie = c(
61
63
  (t) => {
62
64
  if (d)
63
65
  return;
@@ -65,12 +67,12 @@ const g = {
65
67
  t.keyCode === m.left || t.keyCode === m.down ? n = l - (u || 0) : t.keyCode === m.right || t.keyCode === m.up ? n = l + (u || 0) : t.keyCode === m.pageDown ? n = l - (C || 0) : t.keyCode === m.pageUp ? n = l + (C || 0) : t.keyCode === m.home ? n = e.min : t.keyCode === m.end && (n = e.max), n !== void 0 && (t.preventDefault(), s(t, n));
66
68
  },
67
69
  [l, u, C, e.min, e.max, s, d]
68
- ), ie = c(
70
+ ), re = c(
69
71
  (t) => {
70
72
  t.preventDefault(), !d && s(t, l - (u || 0));
71
73
  },
72
74
  [l, u, s, d]
73
- ), re = c(
75
+ ), le = c(
74
76
  (t) => {
75
77
  t.preventDefault(), !d && s(t, l + (u || 0));
76
78
  },
@@ -84,25 +86,25 @@ const g = {
84
86
  s(t, e.min + y * (e.max - e.min));
85
87
  },
86
88
  [a, e.min, e.max, f, s]
87
- ), le = c(
89
+ ), ce = c(
88
90
  (t) => {
89
- F(t.event.originalEvent.target) || (t.event.isTouch && t.event.originalEvent.preventDefault(), x(t));
91
+ M(t.event.originalEvent.target) || (t.event.isTouch && t.event.originalEvent.preventDefault(), x(t));
90
92
  },
91
- [F, x]
92
- ), ce = c(
93
+ [M, x]
94
+ ), oe = c(
93
95
  (t) => {
94
96
  t.event.originalEvent.preventDefault(), x(t);
95
97
  },
96
98
  [x]
97
99
  ), S = c(() => {
98
100
  v.current && v.current.focus();
99
- }, []), oe = c(
101
+ }, []), de = c(
100
102
  (t) => {
101
103
  if (!t.enabled)
102
104
  return t.children;
103
105
  let n, o, b, y;
104
- return f === "rtl" ? (n = a ? _ : j, o = a ? G : Y, b = a ? "chevron-up" : "chevron-left", y = a ? "chevron-down" : "chevron-right") : (n = a ? _ : Y, o = a ? G : j, b = a ? "chevron-up" : "chevron-right", y = a ? "chevron-down" : "chevron-left"), /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(
105
- X,
106
+ return f === "rtl" ? (n = a ? j : G, o = a ? Y : J, b = a ? "chevron-up" : "chevron-left", y = a ? "chevron-down" : "chevron-right") : (n = a ? j : J, o = a ? Y : G, b = a ? "chevron-up" : "chevron-right", y = a ? "chevron-down" : "chevron-left"), /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement(
107
+ _,
106
108
  {
107
109
  className: "k-button-decrease",
108
110
  rounded: "full",
@@ -112,7 +114,7 @@ const g = {
112
114
  onClick: t.decrement
113
115
  }
114
116
  ), t.children, /* @__PURE__ */ r.createElement(
115
- X,
117
+ _,
116
118
  {
117
119
  className: "k-button-increase",
118
120
  rounded: "full",
@@ -125,22 +127,22 @@ const g = {
125
127
  },
126
128
  [f, a]
127
129
  );
128
- me(
129
- P,
130
+ ue(
131
+ Q,
130
132
  () => ({
131
133
  props: e,
132
134
  sliderTrack: E.current,
133
135
  focus: S
134
136
  }),
135
137
  [e, S]
136
- ), ge("slider", D, e, e.webMcp), q(() => {
138
+ ), ve("slider", D, e, e.webMcp), q(() => {
137
139
  D.current = {
138
140
  props: e,
139
141
  sliderTrack: E.current,
140
142
  focus: S
141
143
  };
142
144
  }, [e, S]);
143
- const de = a ? { marginTop: "0.5rem", marginBottom: "0.5rem" } : { marginLeft: "0.5rem", marginRight: "0.5rem" }, se = a ? { paddingTop: 0, height: "100%" } : {};
145
+ const se = a ? { marginTop: "0.5rem", marginBottom: "0.5rem" } : { marginLeft: "0.5rem", marginRight: "0.5rem" }, me = a ? { paddingTop: 0, height: "100%" } : {};
144
146
  let w;
145
147
  return a ? w = { bottom: "calc(" + h + "%)", zIndex: 1 } : f === "rtl" ? w = { right: "calc(" + h + "%)", zIndex: 1 } : w = { left: "calc(" + h + "%)", zIndex: 1 }, /* @__PURE__ */ r.createElement(
146
148
  "div",
@@ -150,33 +152,34 @@ const g = {
150
152
  id: e.id,
151
153
  "aria-label": e.ariaLabel,
152
154
  style: { gap: 0, ...e.style },
153
- onFocus: te,
154
- onBlur: ne,
155
- onKeyDown: ae,
156
- className: ve(
155
+ onFocus: ne,
156
+ onBlur: ae,
157
+ onKeyDown: ie,
158
+ className: he(
157
159
  "k-slider",
158
160
  {
159
- "k-focus": p,
161
+ "k-focus": ee,
160
162
  "k-disabled": d,
163
+ "k-readonly": A,
161
164
  "k-slider-horizontal": !a,
162
165
  "k-slider-vertical": a
163
166
  },
164
167
  e.className
165
168
  )
166
169
  },
167
- oe({
170
+ de({
168
171
  enabled: (U = e.buttons) != null ? U : g.buttons,
169
- decrement: ie,
170
- increment: re,
172
+ decrement: re,
173
+ increment: le,
171
174
  incrementTitle: T.toLanguageString(
172
- W,
173
- B[W]
175
+ X,
176
+ B[X]
174
177
  ),
175
178
  decrementTitle: T.toLanguageString(
176
- O,
177
- B[O]
179
+ W,
180
+ B[W]
178
181
  ),
179
- children: /* @__PURE__ */ r.createElement(he, { onDrag: ce, onPress: le, autoScroll: !1 }, /* @__PURE__ */ r.createElement(
182
+ children: /* @__PURE__ */ r.createElement(be, { onDrag: oe, onPress: ce, autoScroll: !1 }, /* @__PURE__ */ r.createElement(
180
183
  "div",
181
184
  {
182
185
  className: "k-slider-track-wrap",
@@ -184,7 +187,7 @@ const g = {
184
187
  flexGrow: 1,
185
188
  position: "relative",
186
189
  touchAction: "none",
187
- ...de
190
+ ...se
188
191
  }
189
192
  },
190
193
  e.children && /* @__PURE__ */ r.createElement(
@@ -192,7 +195,7 @@ const g = {
192
195
  {
193
196
  className: "k-reset k-slider-items",
194
197
  "aria-hidden": "true",
195
- style: { margin: 0, ...se }
198
+ style: { margin: 0, ...me }
196
199
  },
197
200
  r.Children.map(e.children, (t, n) => t && r.cloneElement(
198
201
  t,
@@ -228,10 +231,11 @@ const g = {
228
231
  "aria-valuenow": l,
229
232
  "aria-orientation": a ? "vertical" : void 0,
230
233
  "aria-disabled": d ? "true" : void 0,
234
+ "aria-readonly": A ? "true" : void 0,
231
235
  "aria-labelledby": e.ariaLabelledBy,
232
236
  "aria-describedby": e.ariaDescribedBy,
233
237
  "aria-label": e.ariaLabel,
234
- tabIndex: be(Q, d, void 0),
238
+ tabIndex: ye(Z, d, void 0),
235
239
  className: "k-draghandle k-draghandle-end",
236
240
  title: T.toLanguageString(
237
241
  H,
@@ -246,9 +250,9 @@ const g = {
246
250
  );
247
251
  });
248
252
  V.displayName = "Slider";
249
- const we = ye(), J = ue(we, V);
250
- J.displayName = "KendoReactSlider";
251
- J.propTypes = {
253
+ const Ce = ke(), P = fe(Ce, V);
254
+ P.displayName = "KendoReactSlider";
255
+ P.propTypes = {
252
256
  value: i.number,
253
257
  defaultValue: i.number,
254
258
  min: i.number.isRequired,
@@ -261,6 +265,7 @@ J.propTypes = {
261
265
  buttons: i.bool,
262
266
  tabIndex: i.number,
263
267
  disabled: i.bool,
268
+ readOnly: i.bool,
264
269
  vertical: i.bool,
265
270
  id: i.string,
266
271
  ariaDescribedBy: i.string,
@@ -269,9 +274,9 @@ J.propTypes = {
269
274
  dir: i.oneOf(["ltr", "rtl"]),
270
275
  children: i.node
271
276
  };
272
- xe(V);
277
+ Se(V);
273
278
  export {
274
- J as Slider,
275
- we as SliderPropsContext,
279
+ P as Slider,
280
+ Ce as SliderPropsContext,
276
281
  V as SliderWithoutContext
277
282
  };
@@ -75,6 +75,18 @@ export interface SwitchProps extends ToggleBaseProps, FormComponentProps {
75
75
  * ```
76
76
  */
77
77
  disabled?: boolean;
78
+ /**
79
+ * Makes the Switch read-only when set to `true`. The Switch will remain focusable but its value cannot be changed by the user.
80
+ *
81
+ * @remarks
82
+ * This property is related to accessibility.
83
+ *
84
+ * @example
85
+ * ```jsx
86
+ * <Switch readOnly={true} />
87
+ * ```
88
+ */
89
+ readOnly?: boolean;
78
90
  /**
79
91
  * Specifies the `dir` property of the wrapping element of the Switch.
80
92
  *
@@ -147,6 +159,9 @@ export interface SwitchProps extends ToggleBaseProps, FormComponentProps {
147
159
  * Identifies the element(s) which will describe the component.
148
160
  * For example these elements could contain error or hint message.
149
161
  *
162
+ * @remarks
163
+ * This property is related to accessibility.
164
+ *
150
165
  * @example
151
166
  * ```jsx
152
167
  * <Switch ariaDescribedBy="description-id" />
package/switch/Switch.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 n=require("react"),t=require("prop-types"),c=require("@progress/kendo-react-common"),j=require("@progress/kendo-react-intl"),L=require("../messages/index.js");function Z(e){const b=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const v=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(b,s,v.get?v:{enumerable:!0,get:()=>e[s]})}}return b.default=e,Object.freeze(b)}const d=Z(n),r={disabled:!1,defaultChecked:!1,size:void 0,trackRounded:void 0,thumbRounded:void 0,offLabel:"OFF",onBlur:c.noop,onFocus:c.noop,onLabel:"ON",validityStyles:!0},x=d.forwardRef((e,b)=>{var F;const{disabled:s=r.disabled,defaultChecked:v=r.defaultChecked,size:C=r.size,trackRounded:R=r.trackRounded,thumbRounded:S=r.thumbRounded,offLabel:I=r.offLabel,onBlur:M=r.onBlur,onFocus:E=r.onFocus,onLabel:q=r.onLabel}=e,[B,V]=n.useState(v||!1),[W,D]=n.useState(!1),u=n.useRef(null),o=n.useRef(null),k=n.useRef(null),g=n.useRef(void 0),N=n.useRef(!1),P=n.useRef(void 0),T=n.useMemo(()=>new j.LocalizationService,[]);j.useLocalization();const i=n.useMemo(()=>g.current!==void 0?g.current:e.checked!==void 0?e.checked:B,[e.checked,B]),h=n.useMemo(()=>{var w,K;const a=e.validationMessage!==void 0,l=(w=e.valid)!=null?w:e.required?!!i:!0,y=(K=e.valid)!=null?K:l;return{customError:a,valid:y,valueMissing:i===null}},[e.valid,e.validationMessage,e.required,i]),_=(F=e.validityStyles)!=null?F:r.validityStyles;n.useEffect(()=>{var a;(a=k.current)!=null&&a.setCustomValidity&&k.current.setCustomValidity(h.valid?"":e.validationMessage||T.toLanguageString(L.switchValidation,L.messages[L.switchValidation]))},[h,e.validationMessage,T]),n.useEffect(()=>{u.current&&(P.current=e.dir||getComputedStyle(u.current).direction||void 0)},[e.dir]);const f=n.useCallback(()=>({props:e,get element(){return u.current},get actionElement(){return o.current},focus:()=>{var a;(a=o.current)==null||a.focus()},get value(){return i},get name(){return e.name},get validity(){return h}}),[e,i,h]),m=n.useCallback((a,l)=>{V(a),g.current=a,c.dispatchEvent(e.onChange,l,{...f(),value:a},{value:a}),g.current=void 0},[e.onChange,f]);n.useEffect(()=>{const a=e.name||e.id,l=c.subscribeToKendoPaste(o.current,{fieldName:a,onValueChange:y=>{if(y!==i){const w={target:o.current,currentTarget:o.current,nativeEvent:new Event("change",{bubbles:!0})};m(y,w)}}});return()=>{l==null||l.unsubscribe()}},[e.name,e.id,i,m]);const $=n.useCallback(a=>{if(a.target===k.current){if(N.current){N.current=!1;return}}else N.current=!0;m(!i,a)},[i,m]),A=n.useCallback(a=>{if(s)return;const{keyCode:l}=a;(l===c.Keys.space||l===c.Keys.enter)&&(m(!i,a),a.preventDefault())},[s,i,m]),G=n.useCallback(a=>{s||(D(!0),E&&E(a))},[s,E]),J=n.useCallback(a=>{s||(D(!1),M&&M(a))},[s,M]);n.useImperativeHandle(b,f,[f]);const z=n.useRef(null);n.useImperativeHandle(z,f,[f]),c.useWebMcpRegister("switch",z,e,e.webMcp);const Q=P.current||e.dir||u.current&&getComputedStyle(u.current).direction||void 0,U=!_||h.valid,X=c.classNames("k-switch",{[`k-switch-${c.kendoThemeMaps.sizeMap[C]||C}`]:C,"k-switch-on":i,"k-switch-off":!i,"k-focus":W,"k-disabled":s,"k-invalid":!U},e.className),Y=d.createElement("input",{type:"checkbox",checked:e.checked,ref:k,tabIndex:-1,value:i,style:{opacity:0,width:1,border:0,zIndex:-1,position:"absolute",left:"50%"},onChange:c.noop,name:e.name||void 0});return d.createElement("span",{ref:o,role:"switch","aria-checked":i,"aria-disabled":s||void 0,"aria-labelledby":e.ariaLabelledBy,"aria-describedby":e.ariaDescribedBy,"aria-label":e.ariaLabel,"aria-required":e.required,className:X,dir:Q,onKeyDown:A,onClick:$,onBlur:J,onFocus:G,tabIndex:c.getTabIndex(e.tabIndex,s,void 0),accessKey:e.accessKey,id:e.id},d.createElement("span",{className:c.classNames("k-switch-track",{[`k-rounded-${c.kendoThemeMaps.roundedMap[R]||R}`]:R}),ref:u},Y,q?d.createElement("span",{className:"k-switch-label-on"},q):"",I?d.createElement("span",{className:"k-switch-label-off"},I):""),d.createElement("span",{className:"k-switch-thumb-wrap"},d.createElement("span",{className:c.classNames("k-switch-thumb",{[`k-rounded-${c.kendoThemeMaps.roundedMap[S]||S}`]:S})})))});x.displayName="Switch";const H=c.createPropsContext(),O=c.withIdHOC(c.withPropsContext(H,x));O.displayName="KendoReactSwitch";O.propTypes={accessKey:t.string,checked:t.bool,className:t.string,defaultChecked:t.bool,defaultValue:t.any,disabled:t.bool,dir:t.string,id:t.string,size:t.oneOf(["small","medium","large"]),trackRounded:t.oneOf(["small","medium","large","full"]),thumbRounded:t.oneOf(["small","medium","large","full"]),ariaDescribedBy:t.string,ariaLabelledBy:t.string,ariaLabel:t.string,offLabel:t.node,onBlur:t.func,onChange:t.func,onFocus:t.func,onLabel:t.node,tabIndex:t.number,value:t.any,name:t.string,required:t.bool,valid:t.bool,validationMessage:t.string,validityStyles:t.bool};exports.Switch=O;exports.SwitchPropsContext=H;exports.SwitchWithoutContext=x;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),t=require("prop-types"),c=require("@progress/kendo-react-common"),Z=require("@progress/kendo-react-intl"),O=require("../messages/index.js");function p(e){const b=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const l in e)if(l!=="default"){const y=Object.getOwnPropertyDescriptor(e,l);Object.defineProperty(b,l,y.get?y:{enumerable:!0,get:()=>e[l]})}}return b.default=e,Object.freeze(b)}const d=p(n),r={disabled:!1,defaultChecked:!1,size:void 0,trackRounded:void 0,thumbRounded:void 0,offLabel:"OFF",onBlur:c.noop,onFocus:c.noop,onLabel:"ON",readOnly:!1,validityStyles:!0},x=d.forwardRef((e,b)=>{var z;const{disabled:l=r.disabled,defaultChecked:y=r.defaultChecked,size:C=r.size,trackRounded:R=r.trackRounded,thumbRounded:S=r.thumbRounded,offLabel:I=r.offLabel,onBlur:M=r.onBlur,onFocus:E=r.onFocus,onLabel:q=r.onLabel,readOnly:B=r.readOnly}=e,[D,V]=n.useState(y||!1),[W,P]=n.useState(!1),u=n.useRef(null),o=n.useRef(null),v=n.useRef(null),k=n.useRef(void 0),N=n.useRef(!1),T=n.useRef(void 0),F=n.useMemo(()=>new Z.LocalizationService,[]),i=n.useMemo(()=>k.current!==void 0?k.current:e.checked!==void 0?e.checked:D,[e.checked,D]),h=n.useMemo(()=>{var w,j;const a=e.validationMessage!==void 0,s=(w=e.valid)!=null?w:e.required?!!i:!0,g=(j=e.valid)!=null?j:s;return{customError:a,valid:g,valueMissing:i===null}},[e.valid,e.validationMessage,e.required,i]),_=(z=e.validityStyles)!=null?z:r.validityStyles;n.useEffect(()=>{var a;(a=v.current)!=null&&a.setCustomValidity&&v.current.setCustomValidity(h.valid?"":e.validationMessage||F.toLanguageString(O.switchValidation,O.messages[O.switchValidation]))},[h,e.validationMessage,F]),n.useEffect(()=>{u.current&&(T.current=e.dir||getComputedStyle(u.current).direction||void 0)},[e.dir]);const f=n.useCallback(()=>({props:e,get element(){return u.current},get actionElement(){return o.current},focus:()=>{var a;(a=o.current)==null||a.focus()},get value(){return i},get name(){return e.name},get validity(){return h}}),[e,i,h]),m=n.useCallback((a,s)=>{V(a),k.current=a,c.dispatchEvent(e.onChange,s,{...f(),value:a},{value:a}),k.current=void 0},[e.onChange,f]);n.useEffect(()=>{const a=e.name||e.id,s=c.subscribeToKendoPaste(o.current,{fieldName:a,onValueChange:g=>{if(g!==i){const w={target:o.current,currentTarget:o.current,nativeEvent:new Event("change",{bubbles:!0})};m(g,w)}}});return()=>{s==null||s.unsubscribe()}},[e.name,e.id,i,m]);const $=n.useCallback(a=>{if(a.target===v.current){if(N.current){N.current=!1;return}}else N.current=!0;m(!i,a)},[i,m]),A=n.useCallback(a=>{if(l)return;const{keyCode:s}=a;(s===c.Keys.space||s===c.Keys.enter)&&(m(!i,a),a.preventDefault())},[l,i,m]),G=n.useCallback(a=>{l||(P(!0),E&&E(a))},[l,E]),J=n.useCallback(a=>{l||(P(!1),M&&M(a))},[l,M]);n.useImperativeHandle(b,f,[f]);const K=n.useRef(null);n.useImperativeHandle(K,f,[f]),c.useWebMcpRegister("switch",K,e,e.webMcp);const Q=T.current||e.dir||u.current&&getComputedStyle(u.current).direction||void 0,U=!_||h.valid,X=c.classNames("k-switch",{[`k-switch-${c.kendoThemeMaps.sizeMap[C]||C}`]:C,"k-switch-on":i,"k-switch-off":!i,"k-focus":W,"k-disabled":l,"k-readonly":B,"k-invalid":!U},e.className),Y=d.createElement("input",{type:"checkbox",checked:e.checked,ref:v,tabIndex:-1,value:i,style:{opacity:0,width:1,border:0,zIndex:-1,position:"absolute",left:"50%"},onChange:c.noop,name:e.name||void 0});return d.createElement("span",{ref:o,role:"switch","aria-checked":i,"aria-disabled":l||void 0,"aria-readonly":B?"true":void 0,"aria-labelledby":e.ariaLabelledBy,"aria-describedby":e.ariaDescribedBy,"aria-label":e.ariaLabel,"aria-required":e.required,className:X,dir:Q,onKeyDown:A,onClick:$,onBlur:J,onFocus:G,tabIndex:c.getTabIndex(e.tabIndex,l,void 0),accessKey:e.accessKey,id:e.id},d.createElement("span",{className:c.classNames("k-switch-track",{[`k-rounded-${c.kendoThemeMaps.roundedMap[R]||R}`]:R}),ref:u},Y,q?d.createElement("span",{className:"k-switch-label-on"},q):"",I?d.createElement("span",{className:"k-switch-label-off"},I):""),d.createElement("span",{className:"k-switch-thumb-wrap"},d.createElement("span",{className:c.classNames("k-switch-thumb",{[`k-rounded-${c.kendoThemeMaps.roundedMap[S]||S}`]:S})})))});x.displayName="Switch";const H=c.createPropsContext(),L=c.withIdHOC(c.withPropsContext(H,x));L.displayName="KendoReactSwitch";L.propTypes={accessKey:t.string,checked:t.bool,className:t.string,defaultChecked:t.bool,defaultValue:t.any,disabled:t.bool,readOnly:t.bool,dir:t.string,id:t.string,size:t.oneOf(["small","medium","large"]),trackRounded:t.oneOf(["small","medium","large","full"]),thumbRounded:t.oneOf(["small","medium","large","full"]),ariaDescribedBy:t.string,ariaLabelledBy:t.string,ariaLabel:t.string,offLabel:t.node,onBlur:t.func,onChange:t.func,onFocus:t.func,onLabel:t.node,tabIndex:t.number,value:t.any,name:t.string,required:t.bool,valid:t.bool,validationMessage:t.string,validityStyles:t.bool};exports.Switch=L;exports.SwitchPropsContext=H;exports.SwitchWithoutContext=x;
package/switch/Switch.mjs CHANGED
@@ -6,52 +6,52 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  import * as d from "react";
9
- import { useState as H, useRef as l, useMemo as S, useEffect as M, useCallback as m, useImperativeHandle as V } from "react";
9
+ import { useState as V, useRef as l, useMemo as L, useEffect as M, useCallback as m, useImperativeHandle as W } from "react";
10
10
  import t from "prop-types";
11
- import { withIdHOC as ie, withPropsContext as ce, noop as B, dispatchEvent as re, subscribeToKendoPaste as de, Keys as W, useWebMcpRegister as le, classNames as N, kendoThemeMaps as x, getTabIndex as se, createPropsContext as oe } from "@progress/kendo-react-common";
12
- import { LocalizationService as ue, useLocalization as fe } from "@progress/kendo-react-intl";
13
- import { switchValidation as $, messages as me } from "../messages/index.mjs";
14
- const c = {
11
+ import { withIdHOC as re, withPropsContext as ce, noop as O, dispatchEvent as de, subscribeToKendoPaste as le, Keys as $, useWebMcpRegister as se, classNames as N, kendoThemeMaps as x, getTabIndex as oe, createPropsContext as ue } from "@progress/kendo-react-common";
12
+ import { LocalizationService as fe } from "@progress/kendo-react-intl";
13
+ import { switchValidation as j, messages as me } from "../messages/index.mjs";
14
+ const i = {
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: B,
22
- onFocus: B,
21
+ onBlur: O,
22
+ onFocus: O,
23
23
  onLabel: "ON",
24
+ readOnly: !1,
24
25
  validityStyles: !0
25
- }, j = d.forwardRef((e, G) => {
26
- var T;
26
+ }, A = d.forwardRef((e, J) => {
27
+ var q;
27
28
  const {
28
- disabled: r = c.disabled,
29
- defaultChecked: J = 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: E = c.onFocus,
36
- onLabel: F = c.onLabel
37
- } = e, [z, Q] = H(J || !1), [U, D] = H(!1), s = l(null), o = l(null), h = l(null), v = l(void 0), L = l(!1), K = l(void 0), O = S(() => new ue(), []);
38
- fe();
39
- const n = S(() => v.current !== void 0 ? v.current : e.checked !== void 0 ? e.checked : z, [e.checked, z]), b = S(() => {
40
- var y, q;
41
- const a = e.validationMessage !== void 0, i = (y = e.valid) != null ? y : e.required ? !!n : !0, g = (q = e.valid) != null ? q : i;
29
+ disabled: c = i.disabled,
30
+ defaultChecked: Q = i.defaultChecked,
31
+ size: k = i.size,
32
+ trackRounded: w = i.trackRounded,
33
+ thumbRounded: C = i.thumbRounded,
34
+ offLabel: B = i.offLabel,
35
+ onBlur: R = i.onBlur,
36
+ onFocus: E = i.onFocus,
37
+ onLabel: I = i.onLabel,
38
+ readOnly: F = i.readOnly
39
+ } = e, [D, U] = V(Q || !1), [X, K] = V(!1), s = l(null), o = l(null), h = l(null), v = l(void 0), S = l(!1), z = l(void 0), P = L(() => new fe(), []), n = L(() => v.current !== void 0 ? v.current : e.checked !== void 0 ? e.checked : D, [e.checked, D]), b = L(() => {
40
+ var g, H;
41
+ const a = e.validationMessage !== void 0, r = (g = e.valid) != null ? g : e.required ? !!n : !0, y = (H = e.valid) != null ? H : r;
42
42
  return {
43
43
  customError: a,
44
- valid: g,
44
+ valid: y,
45
45
  valueMissing: n === null
46
46
  };
47
- }, [e.valid, e.validationMessage, e.required, n]), X = (T = e.validityStyles) != null ? T : c.validityStyles;
47
+ }, [e.valid, e.validationMessage, e.required, n]), Y = (q = e.validityStyles) != null ? q : i.validityStyles;
48
48
  M(() => {
49
49
  var a;
50
50
  (a = h.current) != null && a.setCustomValidity && h.current.setCustomValidity(
51
- b.valid ? "" : e.validationMessage || O.toLanguageString($, me[$])
51
+ b.valid ? "" : e.validationMessage || P.toLanguageString(j, me[j])
52
52
  );
53
- }, [b, e.validationMessage, O]), M(() => {
54
- s.current && (K.current = e.dir || getComputedStyle(s.current).direction || void 0);
53
+ }, [b, e.validationMessage, P]), M(() => {
54
+ s.current && (z.current = e.dir || getComputedStyle(s.current).direction || void 0);
55
55
  }, [e.dir]);
56
56
  const u = m(() => ({
57
57
  props: e,
@@ -75,10 +75,10 @@ const c = {
75
75
  return b;
76
76
  }
77
77
  }), [e, n, b]), f = m(
78
- (a, i) => {
79
- Q(a), v.current = a, re(
78
+ (a, r) => {
79
+ U(a), v.current = a, de(
80
80
  e.onChange,
81
- i,
81
+ r,
82
82
  { ...u(), value: a },
83
83
  { value: a }
84
84
  ), v.current = void 0;
@@ -86,69 +86,70 @@ const c = {
86
86
  [e.onChange, u]
87
87
  );
88
88
  M(() => {
89
- const a = e.name || e.id, i = de(o.current, {
89
+ const a = e.name || e.id, r = le(o.current, {
90
90
  fieldName: a,
91
- onValueChange: (g) => {
92
- if (g !== n) {
93
- const y = {
91
+ onValueChange: (y) => {
92
+ if (y !== n) {
93
+ const g = {
94
94
  target: o.current,
95
95
  currentTarget: o.current,
96
96
  nativeEvent: new Event("change", { bubbles: !0 })
97
97
  };
98
- f(g, y);
98
+ f(y, g);
99
99
  }
100
100
  }
101
101
  });
102
102
  return () => {
103
- i == null || i.unsubscribe();
103
+ r == null || r.unsubscribe();
104
104
  };
105
105
  }, [e.name, e.id, n, f]);
106
- const Y = m(
106
+ const Z = m(
107
107
  (a) => {
108
108
  if (a.target === h.current) {
109
- if (L.current) {
110
- L.current = !1;
109
+ if (S.current) {
110
+ S.current = !1;
111
111
  return;
112
112
  }
113
113
  } else
114
- L.current = !0;
114
+ S.current = !0;
115
115
  f(!n, a);
116
116
  },
117
117
  [n, f]
118
- ), Z = m(
118
+ ), _ = m(
119
119
  (a) => {
120
- if (r)
120
+ if (c)
121
121
  return;
122
- const { keyCode: i } = a;
123
- (i === W.space || i === W.enter) && (f(!n, a), a.preventDefault());
122
+ const { keyCode: r } = a;
123
+ (r === $.space || r === $.enter) && (f(!n, a), a.preventDefault());
124
124
  },
125
- [r, n, f]
126
- ), _ = m(
125
+ [c, n, f]
126
+ ), p = m(
127
127
  (a) => {
128
- r || (D(!0), E && E(a));
128
+ c || (K(!0), E && E(a));
129
129
  },
130
- [r, E]
131
- ), p = m(
130
+ [c, E]
131
+ ), ee = m(
132
132
  (a) => {
133
- r || (D(!1), R && R(a));
133
+ c || (K(!1), R && R(a));
134
134
  },
135
- [r, R]
135
+ [c, R]
136
136
  );
137
- V(G, u, [u]);
138
- const P = l(null);
139
- V(P, u, [u]), le("switch", P, e, e.webMcp);
140
- const ee = K.current || e.dir || s.current && getComputedStyle(s.current).direction || void 0, te = !X || b.valid, ae = N(
137
+ W(J, u, [u]);
138
+ const T = l(null);
139
+ W(T, u, [u]), se("switch", T, e, e.webMcp);
140
+ const te = z.current || e.dir || s.current && getComputedStyle(s.current).direction || void 0, ae = !Y || b.valid, ne = N(
141
141
  "k-switch",
142
142
  {
143
143
  [`k-switch-${x.sizeMap[k] || k}`]: k,
144
144
  "k-switch-on": n,
145
145
  "k-switch-off": !n,
146
- "k-focus": U,
147
- "k-disabled": r,
148
- "k-invalid": !te
146
+ "k-focus": X,
147
+ "k-disabled": c,
148
+ "k-readonly": F,
149
+ "k-invalid": !ae
149
150
  },
150
151
  e.className
151
- ), ne = /* @__PURE__ */ d.createElement(
152
+ ), ie = /* @__PURE__ */ d.createElement(
152
153
  "input",
153
154
  {
154
155
  type: "checkbox",
@@ -157,7 +158,7 @@ const c = {
157
158
  tabIndex: -1,
158
159
  value: n,
159
160
  style: { opacity: 0, width: 1, border: 0, zIndex: -1, position: "absolute", left: "50%" },
160
- onChange: B,
161
+ onChange: O,
161
162
  name: e.name || void 0
162
163
  }
163
164
  );
@@ -167,18 +168,19 @@ const c = {
167
168
  ref: o,
168
169
  role: "switch",
169
170
  "aria-checked": n,
170
- "aria-disabled": r || void 0,
171
+ "aria-disabled": c || void 0,
172
+ "aria-readonly": F ? "true" : void 0,
171
173
  "aria-labelledby": e.ariaLabelledBy,
172
174
  "aria-describedby": e.ariaDescribedBy,
173
175
  "aria-label": e.ariaLabel,
174
176
  "aria-required": e.required,
175
- className: ae,
176
- dir: ee,
177
- onKeyDown: Z,
178
- onClick: Y,
179
- onBlur: p,
180
- onFocus: _,
181
- tabIndex: se(e.tabIndex, r, void 0),
177
+ className: ne,
178
+ dir: te,
179
+ onKeyDown: _,
180
+ onClick: Z,
181
+ onBlur: ee,
182
+ onFocus: p,
183
+ tabIndex: oe(e.tabIndex, c, void 0),
182
184
  accessKey: e.accessKey,
183
185
  id: e.id
184
186
  },
@@ -190,9 +192,9 @@ const c = {
190
192
  }),
191
193
  ref: s
192
194
  },
193
- ne,
194
- F ? /* @__PURE__ */ d.createElement("span", { className: "k-switch-label-on" }, F) : "",
195
- I ? /* @__PURE__ */ d.createElement("span", { className: "k-switch-label-off" }, I) : ""
195
+ ie,
196
+ I ? /* @__PURE__ */ d.createElement("span", { className: "k-switch-label-on" }, I) : "",
197
+ B ? /* @__PURE__ */ d.createElement("span", { className: "k-switch-label-off" }, B) : ""
196
198
  ),
197
199
  /* @__PURE__ */ d.createElement("span", { className: "k-switch-thumb-wrap" }, /* @__PURE__ */ d.createElement(
198
200
  "span",
@@ -204,21 +206,22 @@ const c = {
204
206
  ))
205
207
  );
206
208
  });
207
- j.displayName = "Switch";
208
- const be = oe(), A = ie(
209
+ A.displayName = "Switch";
210
+ const be = ue(), G = re(
209
211
  ce(
210
212
  be,
211
- j
213
+ A
212
214
  )
213
215
  );
214
- A.displayName = "KendoReactSwitch";
215
- A.propTypes = {
216
+ G.displayName = "KendoReactSwitch";
217
+ G.propTypes = {
216
218
  accessKey: t.string,
217
219
  checked: t.bool,
218
220
  className: t.string,
219
221
  defaultChecked: t.bool,
220
222
  defaultValue: t.any,
221
223
  disabled: t.bool,
224
+ readOnly: t.bool,
222
225
  dir: t.string,
223
226
  id: t.string,
224
227
  size: t.oneOf(["small", "medium", "large"]),
@@ -241,7 +244,7 @@ A.propTypes = {
241
244
  validityStyles: t.bool
242
245
  };
243
246
  export {
244
- A as Switch,
247
+ G as Switch,
245
248
  be as SwitchPropsContext,
246
- j as SwitchWithoutContext
249
+ A as SwitchWithoutContext
247
250
  };
@@ -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 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;
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-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;