@progress/kendo-react-inputs 14.5.0-develop.1 → 14.5.0-develop.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/rating/Rating.mjs CHANGED
@@ -7,18 +7,25 @@
7
7
  */
8
8
  import * as a from "react";
9
9
  import c from "prop-types";
10
- import { usePropsContext as te, useDir as ae, Keys as R, IconWrap as y, toIconName as B, classNames as ne, getTabIndex as le, createPropsContext as se, svgIconPropType as S } from "@progress/kendo-react-common";
11
- import { starOutlineIcon as $, starIcon as K } from "@progress/kendo-svg-icons";
10
+ import { usePropsContext as te, useDir as ae, Keys as R, IconWrap as y, toIconName as O, classNames as ne, getTabIndex as le, createPropsContext as se, svgIconPropType as P } from "@progress/kendo-react-common";
12
11
  import { RatingItem as oe } from "./RatingItem.mjs";
13
12
  import { RATING_ACTION as r, ratingReducer as ie } from "./rating-reducer.mjs";
14
- import { calcIsFirstHalf as L, toRound as D, getRemainder as re, isHalf as ce, isSelected as F, isCorrectValue as A } from "./utils/index.mjs";
15
- import { ratingAriaLabel as X, messages as ue } from "../messages/index.mjs";
13
+ import { calcIsFirstHalf as S, toRound as D, getRemainder as re, isHalf as ce, isSelected as F, isCorrectValue as $ } from "./utils/index.mjs";
14
+ import { ratingAriaLabel as K, messages as ue } from "../messages/index.mjs";
16
15
  import { useLocalization as me } from "@progress/kendo-react-intl";
17
- const q = (n, g, v) => {
18
- const [e, N] = a.useState(n);
19
- return [e, (h) => {
20
- const o = ie(g.state || e, { ...h, ...g });
21
- v && v(o, h.event), N(o);
16
+ const A = {
17
+ name: "star",
18
+ content: '<path d="m22.762 10.668-4.557 3.931 1.389 5.88a1.661 1.661 0 0 1-2.481 1.805L12 19.138l-5.116 3.146a1.661 1.661 0 0 1-2.478-1.805l1.394-5.88-4.557-3.931a1.667 1.667 0 0 1 .943-2.921l5.974-.482 2.304-5.577a1.656 1.656 0 0 1 3.065 0l2.304 5.577 5.973.482a1.667 1.667 0 0 1 .95 2.922z" />',
19
+ viewBox: "0 0 24 24"
20
+ }, X = {
21
+ name: "star-outline",
22
+ content: '<path d="M23.065 8.95a1.44 1.44 0 0 0-1.267-1l-6.101-.493-2.351-5.691a1.454 1.454 0 0 0-2.691 0L8.304 7.454l-6.101.496A1.44 1.44 0 0 0 .936 8.951a1.46 1.46 0 0 0 .433 1.562l4.657 4.011-1.417 5.998a1.46 1.46 0 0 0 .567 1.52 1.43 1.43 0 0 0 1.61.061L12 18.898l5.222 3.211a1.43 1.43 0 0 0 1.611-.061 1.46 1.46 0 0 0 .566-1.52l-1.417-5.998 4.65-4.016a1.46 1.46 0 0 0 .433-1.564m-1.229.644-4.929 4.253a.61.61 0 0 0-.195.599l1.506 6.357a.24.24 0 0 1-.096.261.23.23 0 0 1-.262.009l-5.541-3.404a.61.61 0 0 0-.636 0l-5.54 3.403a.23.23 0 0 1-.263-.01.24.24 0 0 1-.101-.26l1.506-6.358a.61.61 0 0 0-.194-.598l-4.93-4.253a.24.24 0 0 1-.074-.269.23.23 0 0 1 .21-.167l6.471-.522a.61.61 0 0 0 .513-.373l2.493-6.035a.238.238 0 0 1 .444 0l2.494 6.035a.61.61 0 0 0 .512.373l6.472.522a.23.23 0 0 1 .21.167.24.24 0 0 1-.068.269z" />',
23
+ viewBox: "0 0 24 24"
24
+ }, q = (n, g, v) => {
25
+ const [e, z] = a.useState(n);
26
+ return [e, (b) => {
27
+ const o = ie(g.state || e, { ...b, ...g });
28
+ v && v(o, b.event), z(o);
22
29
  }];
23
30
  }, de = se(), G = a.forwardRef((n, g) => {
24
31
  const v = te(de, n), e = {
@@ -33,9 +40,9 @@ const q = (n, g, v) => {
33
40
  selection: s.selection,
34
41
  precision: s.precision,
35
42
  ...v
36
- }, N = me(), m = a.useRef(null), h = a.useRef(null), o = ae(h, e.dir);
43
+ }, z = me(), m = a.useRef(null), b = a.useRef(null), o = ae(b, e.dir);
37
44
  a.useImperativeHandle(m, () => ({
38
- element: h.current,
45
+ element: b.current,
39
46
  props: e
40
47
  })), a.useImperativeHandle(g, () => m.current);
41
48
  const W = a.useCallback(
@@ -56,7 +63,7 @@ const q = (n, g, v) => {
56
63
  step: d === "half" ? i / 2 : i
57
64
  },
58
65
  W
59
- ), [T, O] = q(null, {
66
+ ), [L, B] = q(null, {
60
67
  state: e.value,
61
68
  min: I,
62
69
  max: x,
@@ -65,15 +72,15 @@ const q = (n, g, v) => {
65
72
  }), u = a.useMemo(
66
73
  () => e.value !== void 0 ? e.value : H,
67
74
  [e.value, H]
68
- ), C = a.useMemo(() => T, [T]), z = a.useMemo(
75
+ ), C = a.useMemo(() => L, [L]), N = a.useMemo(
69
76
  () => e.selection || s.selection,
70
77
  [e.selection]
71
- ), E = a.useMemo(() => i / (d === "half" ? 2 : 1), [i, d]), j = a.useCallback(
78
+ ), M = a.useMemo(() => i / (d === "half" ? 2 : 1), [i, d]), j = a.useCallback(
72
79
  (t) => {
73
80
  if (!(!t.target || !t.target.element || V || k)) {
74
81
  if (d === "half") {
75
- const l = t.target.element.getBoundingClientRect(), M = L(o || "ltr", l, t.syntheticEvent.clientX) ? D(t.target.value - i / 2, E) : t.target.value;
76
- p({ type: r.select, payload: M, event: t.syntheticEvent });
82
+ const l = t.target.element.getBoundingClientRect(), E = S(o || "ltr", l, t.syntheticEvent.clientX) ? D(t.target.value - i / 2, M) : t.target.value;
83
+ p({ type: r.select, payload: E, event: t.syntheticEvent });
77
84
  } else
78
85
  p({
79
86
  type: r.select,
@@ -160,10 +167,10 @@ const q = (n, g, v) => {
160
167
  (t) => {
161
168
  if (!(!t.target || !t.target.element))
162
169
  if (d === "half") {
163
- const l = t.target.element.getBoundingClientRect(), M = L(o || "ltr", l, t.syntheticEvent.clientX) ? t.target.value - i / 2 : t.target.value;
164
- O({ type: r.select, payload: M, event: t.syntheticEvent });
170
+ const l = t.target.element.getBoundingClientRect(), E = S(o || "ltr", l, t.syntheticEvent.clientX) ? t.target.value - i / 2 : t.target.value;
171
+ B({ type: r.select, payload: E, event: t.syntheticEvent });
165
172
  } else
166
- O({
173
+ B({
167
174
  type: r.select,
168
175
  payload: t.target.value,
169
176
  event: t.syntheticEvent
@@ -171,23 +178,23 @@ const q = (n, g, v) => {
171
178
  },
172
179
  [d, i, o]
173
180
  ), Z = a.useCallback((t) => {
174
- O({ type: r.reset, event: t.syntheticEvent });
175
- }, []), P = [], ee = re(D(x - I, E), i);
176
- for (let t = I; t <= x; t = D(t + i, E)) {
177
- const l = D(t + ee, E), f = d === "half" ? ce(l, C !== null ? C : u !== null ? u : 0, i) : !1, M = F(l, u, i, z), w = F(l, C !== null ? C : u, i, z), b = F(l, C, i, z);
178
- P.push(
181
+ B({ type: r.reset, event: t.syntheticEvent });
182
+ }, []), T = [], ee = re(D(x - I, M), i);
183
+ for (let t = I; t <= x; t = D(t + i, M)) {
184
+ const l = D(t + ee, M), f = d === "half" ? ce(l, C !== null ? C : u !== null ? u : 0, i) : !1, E = F(l, u, i, N), w = F(l, C !== null ? C : u, i, N), h = F(l, C, i, N);
185
+ T.push(
179
186
  /* @__PURE__ */ a.createElement(
180
187
  _,
181
188
  {
182
189
  key: l,
183
190
  value: l,
184
191
  dir: o,
185
- title: String(f ? D(l - i / 2, E) : l),
192
+ title: String(f ? D(l - i / 2, M) : l),
186
193
  icon: e.icon,
187
194
  svgIcon: e.svgIcon,
188
195
  half: f,
189
- selected: M || w,
190
- hovered: b,
196
+ selected: E || w,
197
+ hovered: h,
191
198
  onClick: j,
192
199
  onMouseMove: Y,
193
200
  onMouseLeave: Z
@@ -195,15 +202,15 @@ const q = (n, g, v) => {
195
202
  f && /* @__PURE__ */ a.createElement("span", { className: "k-rating-precision-complement" }, !(e.icon || e.svgIconOutline) && /* @__PURE__ */ a.createElement(
196
203
  y,
197
204
  {
198
- name: "star-outline",
199
- icon: $,
205
+ name: "star",
206
+ icon: X,
200
207
  style: { clipPath: `${o === "rtl" ? "inset(0 50% 0 0)" : "inset(0 0 0 50%)"}` },
201
208
  size: "xlarge"
202
209
  }
203
210
  ), (e.icon || e.svgIconOutline) && /* @__PURE__ */ a.createElement(
204
211
  y,
205
212
  {
206
- name: B(`${e.icon}-outline`),
213
+ name: O(`${e.icon}-outline`),
207
214
  icon: e.svgIconOutline,
208
215
  size: "xlarge"
209
216
  }
@@ -212,23 +219,23 @@ const q = (n, g, v) => {
212
219
  y,
213
220
  {
214
221
  name: "star",
215
- icon: K,
222
+ icon: A,
216
223
  style: { clipPath: `${o === "rtl" ? "inset(0 0 0 50%)" : "inset(0 50% 0 0)"}` },
217
224
  size: "xlarge"
218
225
  }
219
226
  ), (e.icon || e.svgIcon) && /* @__PURE__ */ a.createElement(
220
227
  y,
221
228
  {
222
- name: e.icon ? B(e.icon) : void 0,
229
+ name: e.icon ? O(e.icon) : void 0,
223
230
  icon: e.svgIcon,
224
231
  size: "xlarge"
225
232
  }
226
233
  )),
227
234
  f && /* @__PURE__ */ a.createElement("span", { style: { width: "24px", height: "24px", display: "block" } }),
228
- !f && !(e.icon || e.svgIcon) && (b || w && !b) && /* @__PURE__ */ a.createElement(y, { name: "star", icon: K, size: "xlarge" }) || !(e.icon || e.svgIcon) && !b && !w && /* @__PURE__ */ a.createElement(y, { name: "star-outline", icon: $, size: "xlarge" }) || (e.icon || e.svgIcon) && (b || w && !b) && /* @__PURE__ */ a.createElement(y, { name: e.icon, icon: e.svgIcon, size: "xlarge" }) || (e.icon || e.svgIcon) && !b && /* @__PURE__ */ a.createElement(
235
+ !f && !(e.icon || e.svgIcon) && (h || w && !h) && /* @__PURE__ */ a.createElement(y, { name: "star", icon: A, size: "xlarge" }) || !(e.icon || e.svgIcon) && !h && !w && /* @__PURE__ */ a.createElement(y, { name: "star", icon: X, size: "xlarge" }) || (e.icon || e.svgIcon) && (h || w && !h) && /* @__PURE__ */ a.createElement(y, { name: e.icon, icon: e.svgIcon, size: "xlarge" }) || (e.icon || e.svgIcon) && !h && /* @__PURE__ */ a.createElement(
229
236
  y,
230
237
  {
231
- name: B(`${e.icon}-outline`),
238
+ name: O(`${e.icon}-outline`),
232
239
  icon: e.svgIconOutline,
233
240
  size: "xlarge"
234
241
  }
@@ -241,7 +248,7 @@ const q = (n, g, v) => {
241
248
  {
242
249
  id: e.id,
243
250
  style: e.style,
244
- ref: h,
251
+ ref: b,
245
252
  role: "slider",
246
253
  dir: o,
247
254
  tabIndex: le(e.tabIndex, e.disabled, void 0),
@@ -261,12 +268,12 @@ const q = (n, g, v) => {
261
268
  "aria-valuemax": x,
262
269
  "aria-valuenow": u !== null ? u : void 0,
263
270
  "aria-disabled": k ? "true" : void 0,
264
- "aria-label": N.toLanguageString(X, ue[X]),
271
+ "aria-label": z.toLanguageString(K, ue[K]),
265
272
  "aria-labelledby": e.ariaLabelledBy,
266
273
  "aria-describedby": e.ariaDescribedBy
267
274
  },
268
275
  /* @__PURE__ */ a.createElement("input", { id: "rating", className: "k-hidden", readOnly: V, disabled: k }),
269
- /* @__PURE__ */ a.createElement("span", { className: "k-rating-container" }, P),
276
+ /* @__PURE__ */ a.createElement("span", { className: "k-rating-container" }, T),
270
277
  e.label && /* @__PURE__ */ a.createElement("span", { className: "k-rating-label" }, e.label)
271
278
  );
272
279
  }), pe = {
@@ -274,7 +281,7 @@ const q = (n, g, v) => {
274
281
  dir: c.oneOf(["ltr", "rtl"]),
275
282
  selection: c.oneOf(["continues", "single"]),
276
283
  precision: c.oneOf(["item", "half"]),
277
- value: (n, g, v) => n.value && n.min && n.max && n.step && !(n.precision === "half" ? A(n.min, n.max, n.step / 2, n.value) : A(n.min, n.max, n.step, n.value)) && n.precision === "half" ? new Error(
284
+ value: (n, g, v) => n.value && n.min && n.max && n.step && !(n.precision === "half" ? $(n.min, n.max, n.step / 2, n.value) : $(n.min, n.max, n.step, n.value)) && n.precision === "half" ? new Error(
278
285
  `Invalid prop + ${g} supplied to ${v}.
279
286
  The value of the { value } property is not correct, please check your values.
280
287
  `
@@ -292,8 +299,8 @@ const q = (n, g, v) => {
292
299
  readonly: c.bool,
293
300
  disabled: c.bool,
294
301
  icon: c.string,
295
- svgIcon: S,
296
- svgIconOutline: S,
302
+ svgIcon: P,
303
+ svgIconOutline: P,
297
304
  ariaDescribedBy: c.string
298
305
  }, s = {
299
306
  dir: "ltr",
package/slider/Slider.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 a=require("react"),r=require("prop-types"),c=require("@progress/kendo-react-common"),F=require("@progress/kendo-react-intl"),m=require("../messages/index.js"),ae=require("./SliderLabel.js"),j=require("@progress/kendo-react-buttons"),f=require("@progress/kendo-svg-icons");function le(e){const h=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const d in e)if(d!=="default"){const v=Object.getOwnPropertyDescriptor(e,d);Object.defineProperty(h,d,v.get?v:{enumerable:!0,get:()=>e[d]})}}return h.default=e,Object.freeze(h)}const i=le(a),k={step:1,largeStep:10,buttons:!1,vertical:!1,disabled:!1,tabIndex:0},E=i.forwardRef((e,h)=>{var K,M,O;const{step:d=k.step,largeStep:v=k.largeStep,vertical:l=k.vertical,disabled:u=k.disabled,tabIndex:P=k.tabIndex}=e,[U,H]=a.useState((K=e.defaultValue)!=null?K:e.min),[W,V]=a.useState(!1),[R,X]=a.useState(e.dir),L=a.useRef(null),y=a.useRef(null),A=a.useMemo(()=>new F.LocalizationService,[]),z=a.useRef(null),N=e.value!==void 0,I=N&&e.value!==void 0?e.value:U,s=a.useMemo(()=>{const{min:t,max:n}=e;return I<t?t:I>n?n:I},[I,e.min,e.max]),C=a.useMemo(()=>{const{min:t,max:n}=e,o=n-t;return o===0?0:(s-t)/o*100},[s,e.min,e.max]),b=(M=e.dir)!=null?M:R;a.useEffect(()=>{if(e.dir===void 0&&y.current){const n=window.getComputedStyle(y.current).direction;n!==R&&X(n)}},[e.dir,R]);const q=a.useCallback(t=>{let n=t;for(;n;){if(n.getAttribute(ae.SLIDER_LABEL_ATTRIBUTE))return!0;n=n.parentElement}return!1},[]),g=a.useCallback((t,n)=>{const o=Math.min(Math.max(n,e.min),e.max);N||H(o),c.dispatchEvent(e.onChange,t,z.current,{value:o})},[e.min,e.max,e.onChange,N]),G=a.useCallback(()=>{V(!0)},[]),Y=a.useCallback(()=>{V(!1)},[]),J=a.useCallback(t=>{if(u)return;let n;t.keyCode===c.Keys.left||t.keyCode===c.Keys.down?n=s-(d||0):t.keyCode===c.Keys.right||t.keyCode===c.Keys.up?n=s+(d||0):t.keyCode===c.Keys.pageDown?n=s-(v||0):t.keyCode===c.Keys.pageUp?n=s+(v||0):t.keyCode===c.Keys.home?n=e.min:t.keyCode===c.Keys.end&&(n=e.max),n!==void 0&&(t.preventDefault(),g(t,n))},[s,d,v,e.min,e.max,g,u]),Q=a.useCallback(t=>{t.preventDefault(),!u&&g(t,s-(d||0))},[s,d,g,u]),Z=a.useCallback(t=>{t.preventDefault(),!u&&g(t,s+(d||0))},[s,d,g,u]),w=a.useCallback(t=>{const n=t.element.getBoundingClientRect();let o;l?o=n.bottom-t.event.clientY:o=b==="rtl"?n.right-t.event.clientX:t.event.clientX-n.left;const S=l?n.height:n.width,x=o/S;g(t,e.min+x*(e.max-e.min))},[l,e.min,e.max,b,g]),$=a.useCallback(t=>{q(t.event.originalEvent.target)||(t.event.isTouch&&t.event.originalEvent.preventDefault(),w(t))},[q,w]),p=a.useCallback(t=>{t.event.originalEvent.preventDefault(),w(t)},[w]),D=a.useCallback(()=>{y.current&&y.current.focus()},[]),ee=a.useCallback(t=>{if(!t.enabled)return t.children;let n,o,S,x;return b==="rtl"?(n=l?f.caretAltUpIcon:f.caretAltLeftIcon,o=l?f.caretAltDownIcon:f.caretAltRightIcon,S=l?"caret-alt-up":"caret-alt-left",x=l?"caret-alt-down":"caret-alt-right"):(n=l?f.caretAltUpIcon:f.caretAltRightIcon,o=l?f.caretAltDownIcon:f.caretAltLeftIcon,S=l?"caret-alt-up":"caret-alt-right",x=l?"caret-alt-down":"caret-alt-left"),i.createElement(i.Fragment,null,i.createElement(j.Button,{className:"k-button-decrease",rounded:"full",icon:x,svgIcon:o,title:t.decrementTitle,onClick:t.decrement}),t.children,i.createElement(j.Button,{className:"k-button-increase",rounded:"full",icon:S,svgIcon:n,title:t.incrementTitle,onClick:t.increment}))},[b,l]);a.useImperativeHandle(h,()=>({props:e,sliderTrack:L.current,focus:D}),[e,D]),a.useEffect(()=>{z.current={props:e,sliderTrack:L.current,focus:D}},[e,D]);const te=l?{marginTop:"0.5rem",marginBottom:"0.5rem"}:{marginLeft:"0.5rem",marginRight:"0.5rem"},ne=l?{paddingTop:0,height:"100%"}:{};let T;return l?T={bottom:"calc("+C+"%)",zIndex:1}:b==="rtl"?T={right:"calc("+C+"% - 13px)",zIndex:1}:T={left:"calc("+C+"%)",zIndex:1},i.createElement("div",{ref:y,dir:b,id:e.id,style:{gap:0,...e.style},onFocus:G,onBlur:Y,onKeyDown:J,className:c.classNames("k-slider",{"k-focus":W,"k-disabled":u,"k-slider-horizontal":!l,"k-slider-vertical":l},e.className)},ee({enabled:(O=e.buttons)!=null?O:k.buttons,decrement:Q,increment:Z,incrementTitle:A.toLanguageString(m.sliderIncreaseValue,m.messages[m.sliderIncreaseValue]),decrementTitle:A.toLanguageString(m.sliderDecreaseValue,m.messages[m.sliderDecreaseValue]),children:i.createElement(c.Draggable,{onDrag:p,onPress:$,autoScroll:!1},i.createElement("div",{className:"k-slider-track-wrap",style:{flexGrow:1,position:"relative",touchAction:"none",...te}},e.children&&i.createElement("ul",{className:"k-reset k-slider-items",style:{margin:0,...ne}},i.Children.map(e.children,(t,n)=>t&&i.cloneElement(t,{position:100*(t.props.position-e.min)/(e.max-e.min),vertical:l,firstTick:n===0,lastTick:n===i.Children.count(e.children)-1},t.props.children))),i.createElement("div",{className:"k-slider-track",style:l?{bottom:0,height:"100%"}:{[b==="rtl"?"right":"left"]:0,width:"100%"},ref:L},i.createElement("div",{className:"k-slider-selection",style:l?{height:C+"%"}:{width:C+"%"}}),i.createElement("span",{role:"slider","aria-valuemin":e.min,"aria-valuemax":e.max,"aria-valuenow":s,"aria-valuetext":String(s),"aria-orientation":l?"vertical":void 0,"aria-disabled":u?"true":void 0,"aria-labelledby":e.ariaLabelledBy,"aria-describedby":e.ariaDescribedBy,"aria-label":e.ariaLabel,tabIndex:c.getTabIndex(P,u,void 0),className:"k-draghandle k-draghandle-end",title:A.toLanguageString(m.sliderDragTitle,m.messages[m.sliderDragTitle]),style:T}))))}))});E.displayName="Slider";const _=c.createPropsContext(),B=c.withPropsContext(_,E);B.displayName="KendoReactSlider";B.propTypes={value:r.number,defaultValue:r.number,min:r.number.isRequired,max:r.number.isRequired,step:r.number,largeStep:r.number,onChange:r.func,style:r.object,className:r.string,buttons:r.bool,tabIndex:r.number,disabled:r.bool,vertical:r.bool,id:r.string,ariaDescribedBy:r.string,ariaLabelledBy:r.string,ariaLabel:r.string,dir:r.oneOf(["ltr","rtl"]),children:r.node};F.registerForLocalization(E);exports.Slider=B;exports.SliderPropsContext=_;exports.SliderWithoutContext=E;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react"),r=require("prop-types"),c=require("@progress/kendo-react-common"),F=require("@progress/kendo-react-intl"),m=require("../messages/index.js"),ae=require("./SliderLabel.js"),j=require("@progress/kendo-react-buttons"),f=require("@progress/kendo-svg-icons");function le(e){const k=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const d in e)if(d!=="default"){const b=Object.getOwnPropertyDescriptor(e,d);Object.defineProperty(k,d,b.get?b:{enumerable:!0,get:()=>e[d]})}}return k.default=e,Object.freeze(k)}const i=le(a),h={step:1,largeStep:10,buttons:!1,vertical:!1,disabled:!1,tabIndex:0},E=i.forwardRef((e,k)=>{var A,M,O;const{step:d=h.step,largeStep:b=h.largeStep,vertical:l=h.vertical,disabled:u=h.disabled,tabIndex:P=h.tabIndex}=e,[U,H]=a.useState((A=e.defaultValue)!=null?A:e.min),[W,z]=a.useState(!1),[R,X]=a.useState(e.dir),L=a.useRef(null),y=a.useRef(null),N=a.useMemo(()=>new F.LocalizationService,[]),q=a.useRef(null),B=e.value!==void 0,I=B&&e.value!==void 0?e.value:U,o=a.useMemo(()=>{const{min:t,max:n}=e;return I<t?t:I>n?n:I},[I,e.min,e.max]),C=a.useMemo(()=>{const{min:t,max:n}=e,s=n-t;return s===0?0:(o-t)/s*100},[o,e.min,e.max]),v=(M=e.dir)!=null?M:R;a.useEffect(()=>{if(e.dir===void 0&&y.current){const n=window.getComputedStyle(y.current).direction;n!==R&&X(n)}},[e.dir,R]);const K=a.useCallback(t=>{let n=t;for(;n;){if(n.getAttribute(ae.SLIDER_LABEL_ATTRIBUTE))return!0;n=n.parentElement}return!1},[]),g=a.useCallback((t,n)=>{const s=Math.min(Math.max(n,e.min),e.max);B||H(s),c.dispatchEvent(e.onChange,t,q.current,{value:s})},[e.min,e.max,e.onChange,B]),G=a.useCallback(()=>{z(!0)},[]),Y=a.useCallback(()=>{z(!1)},[]),J=a.useCallback(t=>{if(u)return;let n;t.keyCode===c.Keys.left||t.keyCode===c.Keys.down?n=o-(d||0):t.keyCode===c.Keys.right||t.keyCode===c.Keys.up?n=o+(d||0):t.keyCode===c.Keys.pageDown?n=o-(b||0):t.keyCode===c.Keys.pageUp?n=o+(b||0):t.keyCode===c.Keys.home?n=e.min:t.keyCode===c.Keys.end&&(n=e.max),n!==void 0&&(t.preventDefault(),g(t,n))},[o,d,b,e.min,e.max,g,u]),Q=a.useCallback(t=>{t.preventDefault(),!u&&g(t,o-(d||0))},[o,d,g,u]),Z=a.useCallback(t=>{t.preventDefault(),!u&&g(t,o+(d||0))},[o,d,g,u]),w=a.useCallback(t=>{const n=t.element.getBoundingClientRect();let s;l?s=n.bottom-t.event.clientY:s=v==="rtl"?n.right-t.event.clientX:t.event.clientX-n.left;const S=l?n.height:n.width,x=s/S;g(t,e.min+x*(e.max-e.min))},[l,e.min,e.max,v,g]),$=a.useCallback(t=>{K(t.event.originalEvent.target)||(t.event.isTouch&&t.event.originalEvent.preventDefault(),w(t))},[K,w]),p=a.useCallback(t=>{t.event.originalEvent.preventDefault(),w(t)},[w]),D=a.useCallback(()=>{y.current&&y.current.focus()},[]),ee=a.useCallback(t=>{if(!t.enabled)return t.children;let n,s,S,x;return v==="rtl"?(n=l?f.chevronUpIcon:f.chevronLeftIcon,s=l?f.chevronDownIcon:f.chevronRightIcon,S=l?"chevron-up":"chevron-left",x=l?"chevron-down":"chevron-right"):(n=l?f.chevronUpIcon:f.chevronRightIcon,s=l?f.chevronDownIcon:f.chevronLeftIcon,S=l?"chevron-up":"chevron-right",x=l?"chevron-down":"chevron-left"),i.createElement(i.Fragment,null,i.createElement(j.Button,{className:"k-button-decrease",rounded:"full",icon:x,svgIcon:s,title:t.decrementTitle,onClick:t.decrement}),t.children,i.createElement(j.Button,{className:"k-button-increase",rounded:"full",icon:S,svgIcon:n,title:t.incrementTitle,onClick:t.increment}))},[v,l]);a.useImperativeHandle(k,()=>({props:e,sliderTrack:L.current,focus:D}),[e,D]),a.useEffect(()=>{q.current={props:e,sliderTrack:L.current,focus:D}},[e,D]);const te=l?{marginTop:"0.5rem",marginBottom:"0.5rem"}:{marginLeft:"0.5rem",marginRight:"0.5rem"},ne=l?{paddingTop:0,height:"100%"}:{};let T;return l?T={bottom:"calc("+C+"%)",zIndex:1}:v==="rtl"?T={right:"calc("+C+"% - 13px)",zIndex:1}:T={left:"calc("+C+"%)",zIndex:1},i.createElement("div",{ref:y,dir:v,id:e.id,style:{gap:0,...e.style},onFocus:G,onBlur:Y,onKeyDown:J,className:c.classNames("k-slider",{"k-focus":W,"k-disabled":u,"k-slider-horizontal":!l,"k-slider-vertical":l},e.className)},ee({enabled:(O=e.buttons)!=null?O:h.buttons,decrement:Q,increment:Z,incrementTitle:N.toLanguageString(m.sliderIncreaseValue,m.messages[m.sliderIncreaseValue]),decrementTitle:N.toLanguageString(m.sliderDecreaseValue,m.messages[m.sliderDecreaseValue]),children:i.createElement(c.Draggable,{onDrag:p,onPress:$,autoScroll:!1},i.createElement("div",{className:"k-slider-track-wrap",style:{flexGrow:1,position:"relative",touchAction:"none",...te}},e.children&&i.createElement("ul",{className:"k-reset k-slider-items",style:{margin:0,...ne}},i.Children.map(e.children,(t,n)=>t&&i.cloneElement(t,{position:100*(t.props.position-e.min)/(e.max-e.min),vertical:l,firstTick:n===0,lastTick:n===i.Children.count(e.children)-1},t.props.children))),i.createElement("div",{className:"k-slider-track",style:l?{bottom:0,height:"100%"}:{[v==="rtl"?"right":"left"]:0,width:"100%"},ref:L},i.createElement("div",{className:"k-slider-selection",style:l?{height:C+"%"}:{width:C+"%"}}),i.createElement("span",{role:"slider","aria-valuemin":e.min,"aria-valuemax":e.max,"aria-valuenow":o,"aria-valuetext":String(o),"aria-orientation":l?"vertical":void 0,"aria-disabled":u?"true":void 0,"aria-labelledby":e.ariaLabelledBy,"aria-describedby":e.ariaDescribedBy,"aria-label":e.ariaLabel,tabIndex:c.getTabIndex(P,u,void 0),className:"k-draghandle k-draghandle-end",title:N.toLanguageString(m.sliderDragTitle,m.messages[m.sliderDragTitle]),style:T}))))}))});E.displayName="Slider";const _=c.createPropsContext(),V=c.withPropsContext(_,E);V.displayName="KendoReactSlider";V.propTypes={value:r.number,defaultValue:r.number,min:r.number.isRequired,max:r.number.isRequired,step:r.number,largeStep:r.number,onChange:r.func,style:r.object,className:r.string,buttons:r.bool,tabIndex:r.number,disabled:r.bool,vertical:r.bool,id:r.string,ariaDescribedBy:r.string,ariaLabelledBy:r.string,ariaLabel:r.string,dir:r.oneOf(["ltr","rtl"]),children:r.node};F.registerForLocalization(E);exports.Slider=V;exports.SliderPropsContext=_;exports.SliderWithoutContext=E;
package/slider/Slider.mjs CHANGED
@@ -5,15 +5,15 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import * as l from "react";
8
+ import * as r from "react";
9
9
  import { useState as L, useRef as R, useMemo as N, useEffect as q, useCallback as o, useImperativeHandle as me } from "react";
10
10
  import i from "prop-types";
11
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
12
  import { LocalizationService as ye, registerForLocalization as ke } from "@progress/kendo-react-intl";
13
- import { sliderDragTitle as H, messages as A, sliderDecreaseValue as O, sliderIncreaseValue as X } from "../messages/index.mjs";
13
+ import { sliderDragTitle as H, messages as z, sliderDecreaseValue as O, sliderIncreaseValue as X } from "../messages/index.mjs";
14
14
  import { SLIDER_LABEL_ATTRIBUTE as xe } from "./SliderLabel.mjs";
15
15
  import { Button as _ } from "@progress/kendo-react-buttons";
16
- import { caretAltUpIcon as j, caretAltLeftIcon as G, caretAltDownIcon as W, caretAltRightIcon as Y } from "@progress/kendo-svg-icons";
16
+ import { chevronUpIcon as j, chevronLeftIcon as G, chevronDownIcon as W, chevronRightIcon as Y } from "@progress/kendo-svg-icons";
17
17
  const g = {
18
18
  step: 1,
19
19
  largeStep: 10,
@@ -21,7 +21,7 @@ const g = {
21
21
  vertical: !1,
22
22
  disabled: !1,
23
23
  tabIndex: 0
24
- }, z = l.forwardRef((t, P) => {
24
+ }, B = r.forwardRef((t, P) => {
25
25
  var M, K, U;
26
26
  const {
27
27
  step: u = g.step,
@@ -29,13 +29,13 @@ const g = {
29
29
  vertical: a = 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, B] = L(!1), [I, ee] = L(t.dir), E = R(null), v = R(null), T = N(() => new ye(), []), V = R(null), D = t.value !== void 0, k = D && t.value !== void 0 ? t.value : Z, r = N(() => {
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
33
  const { min: e, max: n } = t;
34
34
  return k < e ? e : k > n ? n : k;
35
35
  }, [k, t.min, t.max]), h = N(() => {
36
36
  const { min: e, max: n } = t, c = n - e;
37
- return c === 0 ? 0 : (r - e) / c * 100;
38
- }, [r, t.min, t.max]), f = (K = t.dir) != null ? K : I;
37
+ return c === 0 ? 0 : (l - e) / c * 100;
38
+ }, [l, t.min, t.max]), f = (K = t.dir) != null ? K : I;
39
39
  q(() => {
40
40
  if (t.dir === void 0 && v.current) {
41
41
  const n = window.getComputedStyle(v.current).direction;
@@ -53,31 +53,31 @@ const g = {
53
53
  }, []), s = o(
54
54
  (e, n) => {
55
55
  const c = Math.min(Math.max(n, t.min), t.max);
56
- D || $(c), fe(t.onChange, e, V.current, { value: c });
56
+ D || $(c), fe(t.onChange, e, A.current, { value: c });
57
57
  },
58
58
  [t.min, t.max, t.onChange, D]
59
59
  ), te = o(() => {
60
- B(!0);
60
+ V(!0);
61
61
  }, []), ne = o(() => {
62
- B(!1);
62
+ V(!1);
63
63
  }, []), ae = o(
64
64
  (e) => {
65
65
  if (d)
66
66
  return;
67
67
  let n;
68
- e.keyCode === m.left || e.keyCode === m.down ? n = r - (u || 0) : e.keyCode === m.right || e.keyCode === m.up ? n = r + (u || 0) : e.keyCode === m.pageDown ? n = r - (C || 0) : e.keyCode === m.pageUp ? n = r + (C || 0) : e.keyCode === m.home ? n = t.min : e.keyCode === m.end && (n = t.max), n !== void 0 && (e.preventDefault(), s(e, 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));
69
69
  },
70
- [r, u, C, t.min, t.max, s, d]
70
+ [l, u, C, t.min, t.max, s, d]
71
71
  ), ie = o(
72
72
  (e) => {
73
- e.preventDefault(), !d && s(e, r - (u || 0));
73
+ e.preventDefault(), !d && s(e, l - (u || 0));
74
74
  },
75
- [r, u, s, d]
76
- ), le = o(
75
+ [l, u, s, d]
76
+ ), re = o(
77
77
  (e) => {
78
- e.preventDefault(), !d && s(e, r + (u || 0));
78
+ e.preventDefault(), !d && s(e, l + (u || 0));
79
79
  },
80
- [r, u, s, d]
80
+ [l, u, s, d]
81
81
  ), x = o(
82
82
  (e) => {
83
83
  const n = e.element.getBoundingClientRect();
@@ -87,7 +87,7 @@ const g = {
87
87
  s(e, t.min + y * (t.max - t.min));
88
88
  },
89
89
  [a, t.min, t.max, f, s]
90
- ), re = o(
90
+ ), le = o(
91
91
  (e) => {
92
92
  F(e.event.originalEvent.target) || (e.event.isTouch && e.event.originalEvent.preventDefault(), x(e));
93
93
  },
@@ -104,7 +104,7 @@ const g = {
104
104
  if (!e.enabled)
105
105
  return e.children;
106
106
  let n, c, b, y;
107
- return f === "rtl" ? (n = a ? j : G, c = a ? W : Y, b = a ? "caret-alt-up" : "caret-alt-left", y = a ? "caret-alt-down" : "caret-alt-right") : (n = a ? j : Y, c = a ? W : G, b = a ? "caret-alt-up" : "caret-alt-right", y = a ? "caret-alt-down" : "caret-alt-left"), /* @__PURE__ */ l.createElement(l.Fragment, null, /* @__PURE__ */ l.createElement(
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(
108
108
  _,
109
109
  {
110
110
  className: "k-button-decrease",
@@ -114,7 +114,7 @@ const g = {
114
114
  title: e.decrementTitle,
115
115
  onClick: e.decrement
116
116
  }
117
- ), e.children, /* @__PURE__ */ l.createElement(
117
+ ), e.children, /* @__PURE__ */ r.createElement(
118
118
  _,
119
119
  {
120
120
  className: "k-button-increase",
@@ -137,7 +137,7 @@ const g = {
137
137
  }),
138
138
  [t, S]
139
139
  ), q(() => {
140
- V.current = {
140
+ A.current = {
141
141
  props: t,
142
142
  sliderTrack: E.current,
143
143
  focus: S
@@ -145,7 +145,7 @@ const g = {
145
145
  }, [t, S]);
146
146
  const de = a ? { marginTop: "0.5rem", marginBottom: "0.5rem" } : { marginLeft: "0.5rem", marginRight: "0.5rem" }, se = a ? { paddingTop: 0, height: "100%" } : {};
147
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__ */ l.createElement(
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(
149
149
  "div",
150
150
  {
151
151
  ref: v,
@@ -169,16 +169,16 @@ const g = {
169
169
  oe({
170
170
  enabled: (U = t.buttons) != null ? U : g.buttons,
171
171
  decrement: ie,
172
- increment: le,
172
+ increment: re,
173
173
  incrementTitle: T.toLanguageString(
174
174
  X,
175
- A[X]
175
+ z[X]
176
176
  ),
177
177
  decrementTitle: T.toLanguageString(
178
178
  O,
179
- A[O]
179
+ z[O]
180
180
  ),
181
- children: /* @__PURE__ */ l.createElement(ve, { onDrag: ce, onPress: re, autoScroll: !1 }, /* @__PURE__ */ l.createElement(
181
+ children: /* @__PURE__ */ r.createElement(ve, { onDrag: ce, onPress: le, autoScroll: !1 }, /* @__PURE__ */ r.createElement(
182
182
  "div",
183
183
  {
184
184
  className: "k-slider-track-wrap",
@@ -189,38 +189,38 @@ const g = {
189
189
  ...de
190
190
  }
191
191
  },
192
- t.children && /* @__PURE__ */ l.createElement("ul", { className: "k-reset k-slider-items", style: { margin: 0, ...se } }, l.Children.map(t.children, (e, n) => e && l.cloneElement(
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
193
  e,
194
194
  {
195
195
  position: 100 * (e.props.position - t.min) / (t.max - t.min),
196
196
  vertical: a,
197
197
  firstTick: n === 0,
198
- lastTick: n === l.Children.count(t.children) - 1
198
+ lastTick: n === r.Children.count(t.children) - 1
199
199
  },
200
200
  e.props.children
201
201
  ))),
202
- /* @__PURE__ */ l.createElement(
202
+ /* @__PURE__ */ r.createElement(
203
203
  "div",
204
204
  {
205
205
  className: "k-slider-track",
206
206
  style: a ? { bottom: 0, height: "100%" } : { [f === "rtl" ? "right" : "left"]: 0, width: "100%" },
207
207
  ref: E
208
208
  },
209
- /* @__PURE__ */ l.createElement(
209
+ /* @__PURE__ */ r.createElement(
210
210
  "div",
211
211
  {
212
212
  className: "k-slider-selection",
213
213
  style: a ? { height: h + "%" } : { width: h + "%" }
214
214
  }
215
215
  ),
216
- /* @__PURE__ */ l.createElement(
216
+ /* @__PURE__ */ r.createElement(
217
217
  "span",
218
218
  {
219
219
  role: "slider",
220
220
  "aria-valuemin": t.min,
221
221
  "aria-valuemax": t.max,
222
- "aria-valuenow": r,
223
- "aria-valuetext": String(r),
222
+ "aria-valuenow": l,
223
+ "aria-valuetext": String(l),
224
224
  "aria-orientation": a ? "vertical" : void 0,
225
225
  "aria-disabled": d ? "true" : void 0,
226
226
  "aria-labelledby": t.ariaLabelledBy,
@@ -230,7 +230,7 @@ const g = {
230
230
  className: "k-draghandle k-draghandle-end",
231
231
  title: T.toLanguageString(
232
232
  H,
233
- A[H]
233
+ z[H]
234
234
  ),
235
235
  style: w
236
236
  }
@@ -240,8 +240,8 @@ const g = {
240
240
  })
241
241
  );
242
242
  });
243
- z.displayName = "Slider";
244
- const Se = be(), J = ue(Se, z);
243
+ B.displayName = "Slider";
244
+ const Se = be(), J = ue(Se, B);
245
245
  J.displayName = "KendoReactSlider";
246
246
  J.propTypes = {
247
247
  value: i.number,
@@ -264,9 +264,9 @@ J.propTypes = {
264
264
  dir: i.oneOf(["ltr", "rtl"]),
265
265
  children: i.node
266
266
  };
267
- ke(z);
267
+ ke(B);
268
268
  export {
269
269
  J as Slider,
270
270
  Se as SliderPropsContext,
271
- z as SliderWithoutContext
271
+ B as SliderWithoutContext
272
272
  };
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"),a=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 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=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},x=d.forwardRef((e,b)=>{var F;const{disabled:s=l.disabled,defaultChecked:v=l.defaultChecked,size:C=l.size,trackRounded:S=l.trackRounded,thumbRounded:R=l.thumbRounded,offLabel:I=l.offLabel,onBlur:L=l.onBlur,onFocus:M=l.onFocus,onLabel:T=l.onLabel}=e,[q,j]=n.useState(v||!1),[V,B]=n.useState(!1),o=n.useRef(null),u=n.useRef(null),E=n.useRef(null),g=n.useRef(void 0),D=n.useRef(void 0),P=n.useRef(void 0),N=n.useMemo(()=>new X.LocalizationService,[]),c=n.useMemo(()=>g.current!==void 0?g.current:e.checked!==void 0?e.checked:q,[e.checked,q]),h=n.useMemo(()=>{var w,K;const t=e.validationMessage!==void 0,r=(w=e.valid)!=null?w:e.required?!!c:!0,y=(K=e.valid)!=null?K:r;return{customError:t,valid:y,valueMissing:c===null}},[e.valid,e.validationMessage,e.required,c]),W=(F=e.validityStyles)!=null?F:l.validityStyles;n.useEffect(()=>{var t;(t=E.current)!=null&&t.setCustomValidity&&E.current.setCustomValidity(h.valid?"":e.validationMessage||N.toLanguageString(m.switchValidation,m.messages[m.switchValidation]))},[h,e.validationMessage,N]),n.useEffect(()=>{o.current&&(P.current=e.dir||getComputedStyle(o.current).direction||void 0)},[e.dir]);const k=n.useCallback(()=>({props:e,get element(){return o.current},get actionElement(){return u.current},focus:()=>{var t;(t=u.current)==null||t.focus()},get value(){return c},get name(){return e.name},get validity(){return h}}),[e,c,h]),f=n.useCallback((t,r)=>{j(t),g.current=t,i.dispatchEvent(e.onChange,r,{...k(),value:t},{value:t}),g.current=void 0},[e.onChange,k]);n.useEffect(()=>{const t=e.name||e.id,r=i.subscribeToKendoPaste(u.current,{fieldName:t,onValueChange:y=>{if(y!==c){const w={target:u.current,currentTarget:u.current,nativeEvent:new Event("change",{bubbles:!0})};f(y,w)}}});return()=>{r==null||r.unsubscribe()}},[e.name,e.id,c,f]);const H=n.useCallback(t=>{D.current!==t.timeStamp&&(D.current=t.timeStamp,f(!c,t))},[c,f]),_=n.useCallback(t=>{if(s)return;const{keyCode:r}=t;(r===i.Keys.space||r===i.Keys.enter)&&(f(!c,t),t.preventDefault())},[s,c,f]),$=n.useCallback(t=>{s||(B(!0),M&&M(t))},[s,M]),A=n.useCallback(t=>{s||(B(!1),L&&L(t))},[s,L]);n.useImperativeHandle(b,k,[k]);const G=P.current||e.dir||o.current&&getComputedStyle(o.current).direction||void 0,J=!W||h.valid,Q=i.classNames("k-switch",{[`k-switch-${i.kendoThemeMaps.sizeMap[C]||C}`]:C,"k-switch-on":c,"k-switch-off":!c,"k-focus":V,"k-disabled":s,"k-invalid":!J},e.className),U=d.createElement("input",{type:"checkbox",checked:e.checked,ref:E,tabIndex:-1,"aria-hidden":!0,"aria-label":e.ariaLabel||N.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:u,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:Q,dir:G,onKeyDown:_,onClick:H,onBlur:A,onFocus:$,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:o},U,T?d.createElement("span",{className:"k-switch-label-on"},T):"",I?d.createElement("span",{className:"k-switch-label-off"},I):""),d.createElement("span",{className:"k-switch-thumb-wrap"},d.createElement("span",{className:i.classNames("k-switch-thumb",{[`k-rounded-${i.kendoThemeMaps.roundedMap[R]||R}`]:R})})))});x.displayName="Switch";const z=i.createPropsContext(),O=i.withIdHOC(i.withPropsContext(z,x));O.displayName="KendoReactSwitch";O.propTypes={accessKey:a.string,checked:a.bool,className:a.string,defaultChecked:a.bool,defaultValue:a.any,disabled:a.bool,dir:a.string,id:a.string,size:a.oneOf(["small","medium","large"]),trackRounded:a.oneOf(["small","medium","large","full"]),thumbRounded:a.oneOf(["small","medium","large","full"]),ariaDescribedBy:a.string,ariaLabelledBy:a.string,ariaLabel:a.string,offLabel:a.node,onBlur:a.func,onChange:a.func,onFocus:a.func,onLabel:a.node,tabIndex:a.number,value:a.any,name:a.string,required:a.bool,valid:a.bool,validationMessage:a.string,validityStyles:a.bool};exports.Switch=O;exports.SwitchPropsContext=z;exports.SwitchWithoutContext=x;
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;