@progress/kendo-react-inputs 14.5.0-develop.9 → 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.
Files changed (58) hide show
  1. package/MaskedTextBoxMcpWrapper.d.ts +17 -0
  2. package/MaskedTextBoxMcpWrapper.js +8 -0
  3. package/MaskedTextBoxMcpWrapper.mjs +18 -0
  4. package/README.md +4 -4
  5. package/checkbox/Checkbox.js +1 -1
  6. package/checkbox/Checkbox.mjs +64 -64
  7. package/colors/ColorGradient.js +1 -1
  8. package/colors/ColorGradient.mjs +74 -72
  9. package/colors/ColorInput.js +1 -1
  10. package/colors/ColorInput.mjs +57 -45
  11. package/colors/ColorPalette.js +1 -1
  12. package/colors/ColorPalette.mjs +84 -81
  13. package/colors/ColorPicker.js +1 -1
  14. package/colors/ColorPicker.mjs +203 -190
  15. package/colors/FlatColorPicker.js +1 -1
  16. package/colors/FlatColorPicker.mjs +86 -94
  17. package/colors/interfaces/ColorPickerProps.d.ts +6 -1
  18. package/dist/cdn/js/kendo-react-inputs.js +1 -1
  19. package/index.d.mts +5 -1
  20. package/index.d.ts +5 -1
  21. package/index.js +1 -1
  22. package/index.mjs +92 -89
  23. package/maskedtextbox/MaskedTextBoxProps.d.ts +6 -1
  24. package/messages/index.d.ts +55 -0
  25. package/messages/index.js +1 -1
  26. package/messages/index.mjs +82 -60
  27. package/numerictextbox/NumericTextBox.js +1 -1
  28. package/numerictextbox/NumericTextBox.mjs +190 -188
  29. package/numerictextbox/interfaces/NumericTextBoxProps.d.ts +6 -1
  30. package/package-metadata.js +1 -1
  31. package/package-metadata.mjs +2 -2
  32. package/package.json +10 -10
  33. package/radiobutton/RadioButton.js +1 -1
  34. package/radiobutton/RadioButton.mjs +23 -20
  35. package/radiobutton/interfaces/RadioButtonProps.d.ts +7 -0
  36. package/range-slider/RangeSlider.d.ts +14 -1
  37. package/range-slider/RangeSlider.js +11 -11
  38. package/range-slider/RangeSlider.mjs +188 -185
  39. package/rating/Rating.d.ts +6 -1
  40. package/rating/Rating.js +3 -3
  41. package/rating/Rating.mjs +88 -81
  42. package/signature/Signature.js +1 -1
  43. package/signature/Signature.mjs +127 -129
  44. package/signature/interfaces/SignatureProps.d.ts +6 -1
  45. package/slider/Slider.d.ts +6 -1
  46. package/slider/Slider.js +1 -1
  47. package/slider/Slider.mjs +149 -144
  48. package/slider/SliderLabel.js +1 -1
  49. package/slider/SliderLabel.mjs +3 -2
  50. package/switch/Switch.d.ts +6 -1
  51. package/switch/Switch.js +1 -1
  52. package/switch/Switch.mjs +100 -100
  53. package/textarea/TextArea.js +1 -1
  54. package/textarea/TextArea.mjs +101 -101
  55. package/textarea/interfaces/TextAreaProps.d.ts +6 -1
  56. package/textbox/Textbox.d.ts +20 -1
  57. package/textbox/Textbox.js +1 -1
  58. package/textbox/Textbox.mjs +92 -81
package/slider/Slider.mjs CHANGED
@@ -6,179 +6,177 @@
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";
9
+ import { useState as z, useRef as B, useMemo as V, useEffect as H, 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, 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";
11
+ import { withPropsContext as ge, dispatchEvent as fe, 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 { sliderAriaLabel as E, messages as x, sliderDragTitle as O, sliderDecreaseValue as W, sliderIncreaseValue as X } from "../messages/index.mjs";
14
+ import { SLIDER_LABEL_ATTRIBUTE as we } 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";
17
- const g = {
16
+ import { chevronUpIcon as j, chevronLeftIcon as G, chevronDownIcon as Y, chevronRightIcon as J } from "@progress/kendo-svg-icons";
17
+ const f = {
18
18
  step: 1,
19
19
  largeStep: 10,
20
20
  buttons: !1,
21
21
  vertical: !1,
22
22
  disabled: !1,
23
23
  tabIndex: 0
24
- }, B = r.forwardRef((t, P) => {
25
- var M, K, U;
24
+ }, A = r.forwardRef((e, Q) => {
25
+ var K, U, q;
26
26
  const {
27
- step: u = g.step,
28
- largeStep: C = g.largeStep,
29
- vertical: a = g.vertical,
30
- disabled: d = g.disabled,
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) {
27
+ step: u = f.step,
28
+ largeStep: T = f.largeStep,
29
+ vertical: a = f.vertical,
30
+ disabled: d = f.disabled,
31
+ tabIndex: Z = f.tabIndex
32
+ } = e, [$, p] = z((K = e.defaultValue) != null ? K : e.min), [ee, F] = z(!1), [D, te] = z(e.dir), L = B(null), v = B(null), h = V(() => new xe(), []), R = B(null), N = e.value !== void 0, S = N && e.value !== void 0 ? e.value : $, l = V(() => S < e.min ? e.min : S > e.max ? e.max : S, [S, e.min, e.max]), b = V(() => {
33
+ const t = e.max - e.min;
34
+ return t === 0 ? 0 : (l - e.min) / t * 100;
35
+ }, [l, e.min, e.max]), g = (U = e.dir) != null ? U : D;
36
+ H(() => {
37
+ if (e.dir === void 0 && v.current) {
41
38
  const n = window.getComputedStyle(v.current).direction;
42
- n !== I && ee(n);
39
+ n !== D && te(n);
43
40
  }
44
- }, [t.dir, I]);
45
- const F = o((e) => {
46
- let n = e;
41
+ }, [e.dir, D]);
42
+ const M = c((t) => {
43
+ let n = t;
47
44
  for (; n; ) {
48
- if (n.getAttribute(xe))
45
+ if (n.getAttribute(we))
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
+ N || p(o), fe(e.onChange, t, R.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, N]
56
+ ), ne = c(() => {
57
+ F(!0);
58
+ }, []), ae = c(() => {
59
+ F(!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 - (T || 0) : t.keyCode === m.pageUp ? n = l + (T || 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, T, e.min, e.max, s, d]
68
+ ), re = 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
+ ), le = 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
+ ), w = c(
79
+ (t) => {
80
+ const n = t.element.getBoundingClientRect();
81
+ let o;
82
+ a ? o = n.bottom - t.event.clientY : o = g === "rtl" ? n.right - t.event.clientX : t.event.clientX - n.left;
83
+ const y = a ? n.height : n.width, k = o / y;
84
+ s(t, e.min + k * (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
+ [a, e.min, e.max, g, s]
87
+ ), ce = c(
88
+ (t) => {
89
+ M(t.event.originalEvent.target) || (t.event.isTouch && t.event.originalEvent.preventDefault(), w(t));
93
90
  },
94
- [F, x]
95
- ), ce = o(
96
- (e) => {
97
- e.event.originalEvent.preventDefault(), x(e);
91
+ [M, w]
92
+ ), oe = c(
93
+ (t) => {
94
+ t.event.originalEvent.preventDefault(), w(t);
98
95
  },
99
- [x]
100
- ), S = o(() => {
96
+ [w]
97
+ ), C = 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
+ }, []), de = c(
100
+ (t) => {
101
+ if (!t.enabled)
102
+ return t.children;
103
+ let n, o, y, k;
104
+ return g === "rtl" ? (n = a ? j : G, o = a ? Y : J, y = a ? "chevron-up" : "chevron-left", k = a ? "chevron-down" : "chevron-right") : (n = a ? j : J, o = a ? Y : G, y = a ? "chevron-up" : "chevron-right", k = a ? "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
- icon: y,
113
- svgIcon: c,
114
- title: e.decrementTitle,
115
- onClick: e.decrement
109
+ icon: k,
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
- icon: b,
119
+ icon: y,
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
+ [g, a]
130
127
  );
131
- me(
132
- P,
128
+ ue(
129
+ Q,
133
130
  () => ({
134
- props: t,
135
- sliderTrack: E.current,
136
- focus: S
131
+ props: e,
132
+ sliderTrack: L.current,
133
+ focus: C
137
134
  }),
138
- [t, S]
139
- ), q(() => {
140
- A.current = {
141
- props: t,
142
- sliderTrack: E.current,
143
- focus: S
135
+ [e, C]
136
+ ), ve("slider", R, e, e.webMcp), H(() => {
137
+ R.current = {
138
+ props: e,
139
+ sliderTrack: L.current,
140
+ focus: C
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%" } : {};
147
- 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(
142
+ }, [e, C]);
143
+ const se = a ? { marginTop: "0.5rem", marginBottom: "0.5rem" } : { marginLeft: "0.5rem", marginRight: "0.5rem" }, me = a ? { paddingTop: 0, height: "100%" } : {};
144
+ let I;
145
+ return a ? I = { bottom: "calc(" + b + "%)", zIndex: 1 } : g === "rtl" ? I = { right: "calc(" + b + "% - 13px)", zIndex: 1 } : I = { left: "calc(" + b + "%)", zIndex: 1 }, /* @__PURE__ */ r.createElement(
149
146
  "div",
150
147
  {
151
148
  ref: v,
152
- dir: f,
153
- id: t.id,
154
- style: { gap: 0, ...t.style },
155
- onFocus: te,
156
- onBlur: ne,
157
- onKeyDown: ae,
158
- className: ge(
149
+ dir: g,
150
+ id: e.id,
151
+ "aria-label": e.ariaLabel || h.toLanguageString(E, x[E]),
152
+ style: { gap: 0, ...e.style },
153
+ onFocus: ne,
154
+ onBlur: ae,
155
+ onKeyDown: ie,
156
+ className: he(
159
157
  "k-slider",
160
158
  {
161
- "k-focus": p,
159
+ "k-focus": ee,
162
160
  "k-disabled": d,
163
161
  "k-slider-horizontal": !a,
164
162
  "k-slider-vertical": a
165
163
  },
166
- t.className
164
+ e.className
167
165
  )
168
166
  },
169
- oe({
170
- enabled: (U = t.buttons) != null ? U : g.buttons,
171
- decrement: ie,
172
- increment: re,
173
- incrementTitle: T.toLanguageString(
167
+ de({
168
+ enabled: (q = e.buttons) != null ? q : f.buttons,
169
+ decrement: re,
170
+ increment: le,
171
+ incrementTitle: h.toLanguageString(
174
172
  X,
175
- z[X]
173
+ x[X]
176
174
  ),
177
- decrementTitle: T.toLanguageString(
178
- O,
179
- z[O]
175
+ decrementTitle: h.toLanguageString(
176
+ W,
177
+ x[W]
180
178
  ),
181
- children: /* @__PURE__ */ r.createElement(ve, { onDrag: ce, onPress: le, autoScroll: !1 }, /* @__PURE__ */ r.createElement(
179
+ children: /* @__PURE__ */ r.createElement(be, { onDrag: oe, onPress: ce, autoScroll: !1 }, /* @__PURE__ */ r.createElement(
182
180
  "div",
183
181
  {
184
182
  className: "k-slider-track-wrap",
@@ -186,53 +184,60 @@ const g = {
186
184
  flexGrow: 1,
187
185
  position: "relative",
188
186
  touchAction: "none",
189
- ...de
187
+ ...se
190
188
  }
191
189
  },
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,
190
+ e.children && /* @__PURE__ */ r.createElement(
191
+ "ul",
194
192
  {
195
- position: 100 * (e.props.position - t.min) / (t.max - t.min),
196
- vertical: a,
197
- firstTick: n === 0,
198
- lastTick: n === r.Children.count(t.children) - 1
193
+ className: "k-reset k-slider-items",
194
+ "aria-hidden": "true",
195
+ style: { margin: 0, ...me }
199
196
  },
200
- e.props.children
201
- ))),
197
+ r.Children.map(e.children, (t, n) => t && r.cloneElement(
198
+ t,
199
+ {
200
+ position: 100 * (t.props.position - e.min) / (e.max - e.min),
201
+ vertical: a,
202
+ firstTick: n === 0,
203
+ lastTick: n === r.Children.count(e.children) - 1
204
+ },
205
+ t.props.children
206
+ ))
207
+ ),
202
208
  /* @__PURE__ */ r.createElement(
203
209
  "div",
204
210
  {
205
211
  className: "k-slider-track",
206
- style: a ? { bottom: 0, height: "100%" } : { [f === "rtl" ? "right" : "left"]: 0, width: "100%" },
207
- ref: E
212
+ style: a ? { bottom: 0, height: "100%" } : { [g === "rtl" ? "right" : "left"]: 0, width: "100%" },
213
+ ref: L
208
214
  },
209
215
  /* @__PURE__ */ r.createElement(
210
216
  "div",
211
217
  {
212
218
  className: "k-slider-selection",
213
- style: a ? { height: h + "%" } : { width: h + "%" }
219
+ style: a ? { height: b + "%" } : { width: b + "%" }
214
220
  }
215
221
  ),
216
222
  /* @__PURE__ */ r.createElement(
217
223
  "span",
218
224
  {
219
225
  role: "slider",
220
- "aria-valuemin": t.min,
221
- "aria-valuemax": t.max,
226
+ "aria-valuemin": e.min,
227
+ "aria-valuemax": e.max,
222
228
  "aria-valuenow": l,
223
- "aria-valuetext": String(l),
224
229
  "aria-orientation": a ? "vertical" : void 0,
225
230
  "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),
231
+ "aria-labelledby": e.ariaLabelledBy,
232
+ "aria-describedby": e.ariaDescribedBy,
233
+ "aria-label": e.ariaLabel || h.toLanguageString(E, x[E]),
234
+ tabIndex: ye(Z, d, void 0),
230
235
  className: "k-draghandle k-draghandle-end",
231
- title: T.toLanguageString(
232
- H,
233
- z[H]
236
+ title: h.toLanguageString(
237
+ O,
238
+ x[O]
234
239
  ),
235
- style: w
240
+ style: I
236
241
  }
237
242
  )
238
243
  )
@@ -240,10 +245,10 @@ const g = {
240
245
  })
241
246
  );
242
247
  });
243
- B.displayName = "Slider";
244
- const Se = be(), J = ue(Se, B);
245
- J.displayName = "KendoReactSlider";
246
- J.propTypes = {
248
+ A.displayName = "Slider";
249
+ const Ce = ke(), P = ge(Ce, A);
250
+ P.displayName = "KendoReactSlider";
251
+ P.propTypes = {
247
252
  value: i.number,
248
253
  defaultValue: i.number,
249
254
  min: i.number.isRequired,
@@ -264,9 +269,9 @@ J.propTypes = {
264
269
  dir: i.oneOf(["ltr", "rtl"]),
265
270
  children: i.node
266
271
  };
267
- ke(B);
272
+ Se(A);
268
273
  export {
269
- J as Slider,
270
- Se as SliderPropsContext,
271
- B as SliderWithoutContext
274
+ P as Slider,
275
+ Ce as SliderPropsContext,
276
+ A as SliderWithoutContext
272
277
  };
@@ -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 i=require("react"),n=require("@progress/kendo-react-common");function s(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const l in e)if(l!=="default"){const a=Object.getOwnPropertyDescriptor(e,l);Object.defineProperty(t,l,a.get?a:{enumerable:!0,get:()=>e[l]})}}return t.default=e,Object.freeze(t)}const c=s(i),r="data-slider-label",o=e=>{const t=c.useRef(null);return n.useDir(t),c.createElement("li",{ref:t,className:n.classNames("k-tick",{"k-tick-large":e.children,"k-first":e.firstTick,"k-last":e.lastTick}),title:e.title},e.children&&c.createElement("span",{[r]:!0,className:"k-label",onClick:e.onClick},e.children))};exports.SLIDER_LABEL_ATTRIBUTE=r;exports.SliderLabel=o;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react"),a=require("@progress/kendo-react-common");function s(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const l in e)if(l!=="default"){const n=Object.getOwnPropertyDescriptor(e,l);Object.defineProperty(t,l,n.get?n:{enumerable:!0,get:()=>e[l]})}}return t.default=e,Object.freeze(t)}const c=s(i),r="data-slider-label",o=e=>{const t=c.useRef(null);return a.useDir(t),c.createElement("li",{ref:t,role:"presentation",className:a.classNames("k-tick",{"k-tick-large":e.children,"k-first":e.firstTick,"k-last":e.lastTick}),title:e.title},e.children&&c.createElement("span",{[r]:!0,className:"k-label",onClick:e.onClick},e.children))};exports.SLIDER_LABEL_ATTRIBUTE=r;exports.SliderLabel=o;
@@ -7,12 +7,13 @@
7
7
  */
8
8
  import * as l from "react";
9
9
  import { useDir as a, classNames as i } from "@progress/kendo-react-common";
10
- const c = "data-slider-label", s = (e) => {
10
+ const c = "data-slider-label", n = (e) => {
11
11
  const t = l.useRef(null);
12
12
  return a(t), /* @__PURE__ */ l.createElement(
13
13
  "li",
14
14
  {
15
15
  ref: t,
16
+ role: "presentation",
16
17
  className: i("k-tick", {
17
18
  "k-tick-large": e.children,
18
19
  "k-first": e.firstTick,
@@ -25,5 +26,5 @@ const c = "data-slider-label", s = (e) => {
25
26
  };
26
27
  export {
27
28
  c as SLIDER_LABEL_ATTRIBUTE,
28
- s as SliderLabel
29
+ n as SliderLabel
29
30
  };
@@ -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"),c=require("@progress/kendo-react-common"),j=require("@progress/kendo-react-intl"),b=require("../messages/index.js");function p(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 u=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",validityStyles:!0},x=u.forwardRef((e,h)=>{var F;const{disabled:s=r.disabled,defaultChecked:v=r.defaultChecked,size:R=r.size,trackRounded:S=r.trackRounded,thumbRounded:M=r.thumbRounded,offLabel:I=r.offLabel,onBlur:L=r.onBlur,onFocus:E=r.onFocus,onLabel:q=r.onLabel}=e,[z,V]=n.useState(v||!1),[W,B]=n.useState(!1),d=n.useRef(null),o=n.useRef(null),k=n.useRef(null),y=n.useRef(void 0),N=n.useRef(!1),D=n.useRef(void 0),P=n.useMemo(()=>new j.LocalizationService,[]),_=j.useLocalization(),i=n.useMemo(()=>y.current!==void 0?y.current:e.checked!==void 0?e.checked:z,[e.checked,z]),g=n.useMemo(()=>{var C,K;const a=e.validationMessage!==void 0,l=(C=e.valid)!=null?C:e.required?!!i:!0,w=(K=e.valid)!=null?K:l;return{customError:a,valid:w,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(g.valid?"":e.validationMessage||P.toLanguageString(b.switchValidation,b.messages[b.switchValidation]))},[g,e.validationMessage,P]),n.useEffect(()=>{d.current&&(D.current=e.dir||getComputedStyle(d.current).direction||void 0)},[e.dir]);const f=n.useCallback(()=>({props:e,get element(){return d.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 g}}),[e,i,g]),m=n.useCallback((a,l)=>{V(a),y.current=a,c.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=c.subscribeToKendoPaste(o.current,{fieldName:a,onValueChange:w=>{if(w!==i){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,i,m]);const A=n.useCallback(a=>{if(a.target===k.current){if(N.current){N.current=!1;return}}else N.current=!0;m(!i,a)},[i,m]),G=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]),J=n.useCallback(a=>{s||(B(!0),E&&E(a))},[s,E]),Q=n.useCallback(a=>{s||(B(!1),L&&L(a))},[s,L]);n.useImperativeHandle(h,f,[f]);const T=n.useRef(null);n.useImperativeHandle(T,f,[f]),c.useWebMcpRegister("switch",T,e,e.webMcp);const U=D.current||e.dir||d.current&&getComputedStyle(d.current).direction||void 0,X=!$||g.valid,Y=c.classNames("k-switch",{[`k-switch-${c.kendoThemeMaps.sizeMap[R]||R}`]:R,"k-switch-on":i,"k-switch-off":!i,"k-focus":W,"k-disabled":s,"k-invalid":!X},e.className),Z=u.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 u.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||_.toLanguageString(b.switchAriaLabel,b.messages[b.switchAriaLabel]),"aria-required":e.required,className:Y,dir:U,onKeyDown:G,onClick:A,onBlur:Q,onFocus:J,tabIndex:c.getTabIndex(e.tabIndex,s,void 0),accessKey:e.accessKey,id:e.id},u.createElement("span",{className:c.classNames("k-switch-track",{[`k-rounded-${c.kendoThemeMaps.roundedMap[S]||S}`]:S}),ref:d},Z,q?u.createElement("span",{className:"k-switch-label-on"},q):"",I?u.createElement("span",{className:"k-switch-label-off"},I):""),u.createElement("span",{className:"k-switch-thumb-wrap"},u.createElement("span",{className:c.classNames("k-switch-thumb",{[`k-rounded-${c.kendoThemeMaps.roundedMap[M]||M}`]:M})})))});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;