@progress/kendo-react-inputs 14.5.0-develop.13 → 14.5.0-develop.14

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