@progress/kendo-react-inputs 9.5.0 → 10.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.
@@ -5,20 +5,19 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import { SignaturePad as Oe } from "@progress/kendo-inputs-common";
8
+ import { SignaturePad as xe } from "@progress/kendo-inputs-common";
9
9
  import { Button as T } from "@progress/kendo-react-buttons";
10
- import { createPropsContext as xe, validatePackage as Me, usePropsContext as we, useIsomorphicLayoutEffect as Le, dispatchEvent as h, classNames as B, kendoThemeMaps as ee, getTabIndex as Ie, noop as p } from "@progress/kendo-react-common";
11
- import { Dialog as Pe } from "@progress/kendo-react-dialogs";
12
- import { useLocalization as De } from "@progress/kendo-react-intl";
10
+ import { createPropsContext as Me, validatePackage as we, usePropsContext as Le, useIsomorphicLayoutEffect as Ie, dispatchEvent as h, classNames as B, kendoThemeMaps as ee, getTabIndex as Pe, WatermarkOverlay as De, noop as f } from "@progress/kendo-react-common";
11
+ import { Dialog as Te } from "@progress/kendo-react-dialogs";
12
+ import { useLocalization as Be } from "@progress/kendo-react-intl";
13
13
  import a from "prop-types";
14
14
  import * as o from "react";
15
15
  import { signatureMaximize as te, messages as R, signatureMinimize as oe, signatureClear as ne } from "../messages/index.mjs";
16
- import { packageMetadata as Te } from "../package-metadata.mjs";
17
- import { hasParent as Be } from "./utils/index.mjs";
18
- import { hyperlinkOpenIcon as ae, xIcon as Re } from "@progress/kendo-svg-icons";
19
- const Fe = 250, _e = 84, ie = 3, le = 2, Ne = "#000000", qe = "#ffffff", re = (d) => d !== void 0, Ge = xe(), F = o.forwardRef((d, se) => {
20
- Me(Te);
21
- const _ = we(Ge, d), e = o.useMemo(
16
+ import { packageMetadata as Re } from "../package-metadata.mjs";
17
+ import { hasParent as Fe } from "./utils/index.mjs";
18
+ import { hyperlinkOpenIcon as ae, xIcon as _e } from "@progress/kendo-svg-icons";
19
+ const Ne = 250, We = 84, ie = 3, le = 2, qe = "#000000", Ge = "#ffffff", re = (d) => d !== void 0, Ae = Me(), F = o.forwardRef((d, se) => {
20
+ const ce = !we(Re, { component: "Signature" }), _ = Le(Ae, d), e = o.useMemo(
22
21
  () => ({
23
22
  strokeWidth: l.strokeWidth,
24
23
  smooth: l.smooth,
@@ -39,29 +38,29 @@ const Fe = 250, _e = 84, ie = 3, le = 2, Ne = "#000000", qe = "#ffffff", re = (d
39
38
  ..._
40
39
  }),
41
40
  [_]
42
- ), z = De(), c = o.useRef(null), g = o.useRef(null), N = o.useRef(null), q = o.useRef(null), S = o.useRef(null), [r, ce] = o.useState(), [b, G] = o.useState(!1), [E, W] = o.useState(!1), [k, A] = o.useState(), [ue, de] = o.useState(), V = re(e.value) ? e.value : k, [me, fe] = o.useState(!1), f = re(e.open), m = f ? e.open : me, pe = e.maximized || E || !e.maximizable || e.disabled, ge = !(e.maximized && !E), be = !(!(e.value || k) || E || e.readOnly || e.disabled), j = z.toLanguageString(te, R[te]), U = z.toLanguageString(oe, R[oe]), H = z.toLanguageString(ne, R[ne]), O = e.popupScale || ie, x = e.exportScale || le, M = (t) => {
41
+ ), z = Be(), c = o.useRef(null), g = o.useRef(null), N = o.useRef(null), W = o.useRef(null), S = o.useRef(null), [r, ue] = o.useState(), [b, q] = o.useState(!1), [E, G] = o.useState(!1), [k, A] = o.useState(), [de, me] = o.useState(), V = re(e.value) ? e.value : k, [pe, fe] = o.useState(!1), p = re(e.open), m = p ? e.open : pe, ge = e.maximized || E || !e.maximizable || e.disabled, be = !(e.maximized && !E), ke = !(!(e.value || k) || E || e.readOnly || e.disabled), j = z.toLanguageString(te, R[te]), U = z.toLanguageString(oe, R[oe]), H = z.toLanguageString(ne, R[ne]), O = e.popupScale || ie, x = e.exportScale || le, M = (t) => {
43
42
  A(t), e.onChange && e.onChange({ value: t });
44
- }, ke = (t) => {
43
+ }, ye = (t) => {
45
44
  r == null || r.loadImage(t.value), M(t.value);
46
45
  };
47
46
  o.useEffect(() => {
48
47
  e.value !== k && (A(e.value), r == null || r.loadImage(e.value));
49
48
  }, [e.value]);
50
- const ye = () => {
49
+ const ve = () => {
51
50
  r == null || r.clear(), M();
52
51
  }, y = o.useCallback(
53
52
  (t) => {
54
- f || fe(t);
53
+ p || fe(t);
55
54
  },
56
- [f]
57
- ), ve = (t) => {
55
+ [p]
56
+ ), Ce = (t) => {
58
57
  var n, i;
59
58
  Q(t), (i = ((n = S.current) == null ? void 0 : n.element) || g.current) == null || i.focus();
60
59
  }, w = o.useCallback(() => {
61
- let t = Ne;
60
+ let t = qe;
62
61
  return !e.color && typeof document != "undefined" && c.current && (t = getComputedStyle(c.current).color), e.color || t;
63
62
  }, [e.color]), L = o.useCallback(() => {
64
- let t = qe;
63
+ let t = Ge;
65
64
  return !e.backgroundColor && typeof document != "undefined" && c.current && (t = getComputedStyle(c.current).backgroundColor), e.backgroundColor || t;
66
65
  }, [e.backgroundColor]), $ = () => ({
67
66
  scale: e.maximized ? e.popupScale : 1,
@@ -78,15 +77,15 @@ const Fe = 250, _e = 84, ie = 3, le = 2, Ne = "#000000", qe = "#ffffff", re = (d
78
77
  }));
79
78
  };
80
79
  o.useEffect(() => {
81
- const t = g.current, n = new Oe(t, $());
82
- return V && n.loadImage(V), ce(n), () => n.destroy();
80
+ const t = g.current, n = new xe(t, $());
81
+ return V && n.loadImage(V), ue(n), () => n.destroy();
83
82
  }, []), o.useEffect(() => {
84
83
  r == null || r.setOptions({
85
84
  onChange: async () => M(await K(Y())),
86
- onDraw: () => W(!0),
87
- onDrawEnd: () => W(!1)
85
+ onDraw: () => G(!0),
86
+ onDrawEnd: () => G(!1)
88
87
  });
89
- }, [r]), Le(
88
+ }, [r]), Ie(
90
89
  () => r == null ? void 0 : r.setOptions($()),
91
90
  [e.readOnly, e.color, e.backgroundColor, e.strokeWidth, e.smooth]
92
91
  ), o.useEffect(() => {
@@ -106,7 +105,7 @@ const Fe = 250, _e = 84, ie = 3, le = 2, Ne = "#000000", qe = "#ffffff", re = (d
106
105
  return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
107
106
  }, [m]), o.useEffect(() => {
108
107
  var t, n;
109
- e.maximized && ((n = (t = q.current) == null ? void 0 : t.element) == null || n.focus());
108
+ e.maximized && ((n = (t = W.current) == null ? void 0 : t.element) == null || n.focus());
110
109
  }, []);
111
110
  const I = o.useCallback(() => {
112
111
  var t;
@@ -136,31 +135,31 @@ const Fe = 250, _e = 84, ie = 3, le = 2, Ne = "#000000", qe = "#ffffff", re = (d
136
135
  L
137
136
  ]);
138
137
  o.useImperativeHandle(se, u);
139
- const Ce = o.useCallback(
138
+ const he = o.useCallback(
140
139
  (t) => {
141
- b || e.maximized || (G(!0), h(e.onFocus, t, u(), {}));
140
+ b || e.maximized || (q(!0), h(e.onFocus, t, u(), {}));
142
141
  },
143
142
  [b, e.onFocus, u]
144
- ), he = o.useCallback(
143
+ ), ze = o.useCallback(
145
144
  (t) => {
146
- Be(t.relatedTarget, c.current) || (G(!1), h(e.onBlur, t, u(), {}));
145
+ Fe(t.relatedTarget, c.current) || (q(!1), h(e.onBlur, t, u(), {}));
147
146
  },
148
147
  [b, e.onBlur, u]
149
- ), ze = o.useCallback(
148
+ ), Se = o.useCallback(
150
149
  async (t) => {
151
- de(await K(Z())), y(!0), h(e.onOpen, t, u(), {});
150
+ me(await K(Z())), y(!0), h(e.onOpen, t, u(), {});
152
151
  },
153
- [m, f, e.onOpen, e.value, k, u]
152
+ [m, p, e.onOpen, e.value, k, u]
154
153
  ), Q = o.useCallback(
155
154
  (t) => {
156
155
  y(!1), h(e.onClose, t, u(), {});
157
156
  },
158
- [m, f, e.onClose, u]
159
- ), Se = () => {
160
- ye(), I();
157
+ [m, p, e.onClose, u]
158
+ ), Ee = () => {
159
+ ve(), I();
161
160
  }, Y = () => {
162
161
  var i, s;
163
- const t = e.width || ((i = c.current) == null ? void 0 : i.offsetWidth) || Fe, n = e.height || ((s = c.current) == null ? void 0 : s.offsetHeight) || _e;
162
+ const t = e.width || ((i = c.current) == null ? void 0 : i.offsetWidth) || Ne, n = e.height || ((s = c.current) == null ? void 0 : s.offsetHeight) || We;
164
163
  return {
165
164
  width: t,
166
165
  height: n
@@ -171,7 +170,7 @@ const Fe = 250, _e = 84, ie = 3, le = 2, Ne = "#000000", qe = "#ffffff", re = (d
171
170
  width: t * O,
172
171
  height: n * O
173
172
  };
174
- }, Ee = !D() || P().valid;
173
+ }, Oe = !D() || P().valid;
175
174
  return /* @__PURE__ */ o.createElement(
176
175
  "div",
177
176
  {
@@ -187,22 +186,22 @@ const Fe = 250, _e = 84, ie = 3, le = 2, Ne = "#000000", qe = "#ffffff", re = (d
187
186
  [`k-signature-${e.fillMode}`]: e.fillMode,
188
187
  [`k-input-${e.fillMode}`]: e.fillMode,
189
188
  [`k-rounded-${ee.roundedMap[e.rounded] || e.rounded}`]: e.rounded,
190
- "k-invalid": !Ee,
189
+ "k-invalid": !Oe,
191
190
  "k-required": e.required,
192
191
  "k-disabled": e.disabled,
193
192
  "k-focus": b
194
193
  },
195
194
  e.className
196
195
  ),
197
- onFocus: Ce,
198
- onBlur: he
196
+ onFocus: he,
197
+ onBlur: ze
199
198
  },
200
199
  /* @__PURE__ */ o.createElement(
201
200
  "div",
202
201
  {
203
202
  className: "k-signature-canvas",
204
203
  ref: g,
205
- tabIndex: Ie(e.tabIndex, e.disabled),
204
+ tabIndex: Pe(e.tabIndex, e.disabled),
206
205
  role: "img",
207
206
  id: e.id,
208
207
  "aria-label": e.ariaLabel,
@@ -216,14 +215,14 @@ const Fe = 250, _e = 84, ie = 3, le = 2, Ne = "#000000", qe = "#ffffff", re = (d
216
215
  {
217
216
  type: "button",
218
217
  className: B("k-signature-action", "k-signature-maximize", {
219
- "k-hidden": e.disabled || pe
218
+ "k-hidden": e.disabled || ge
220
219
  }),
221
220
  ref: S,
222
221
  icon: "hyperlink-open",
223
222
  svgIcon: ae,
224
223
  fillMode: "flat",
225
224
  size: e.size,
226
- onClick: ze,
225
+ onClick: Se,
227
226
  "aria-label": j,
228
227
  title: j
229
228
  }
@@ -232,9 +231,9 @@ const Fe = 250, _e = 84, ie = 3, le = 2, Ne = "#000000", qe = "#ffffff", re = (d
232
231
  {
233
232
  type: "button",
234
233
  className: B("k-signature-action", "k-signature-minimize", "k-rotate-180", {
235
- "k-hidden": e.disabled || ge
234
+ "k-hidden": e.disabled || be
236
235
  }),
237
- ref: q,
236
+ ref: W,
238
237
  icon: "hyperlink-open",
239
238
  svgIcon: ae,
240
239
  fillMode: "flat",
@@ -245,33 +244,34 @@ const Fe = 250, _e = 84, ie = 3, le = 2, Ne = "#000000", qe = "#ffffff", re = (d
245
244
  }
246
245
  )),
247
246
  !e.hideLine && /* @__PURE__ */ o.createElement("div", { className: "k-signature-line", style: { zIndex: 2, pointerEvents: "none" } }),
248
- /* @__PURE__ */ o.createElement("div", { className: "k-signature-actions k-signature-actions-bottom" }, be && /* @__PURE__ */ o.createElement(
247
+ /* @__PURE__ */ o.createElement("div", { className: "k-signature-actions k-signature-actions-bottom" }, ke && /* @__PURE__ */ o.createElement(
249
248
  T,
250
249
  {
251
250
  type: "button",
252
251
  className: "k-signature-action k-signature-clear",
253
252
  icon: "x",
254
- svgIcon: Re,
253
+ svgIcon: _e,
255
254
  fillMode: "flat",
256
255
  size: e.size,
257
- onClick: Se,
256
+ onClick: Ee,
258
257
  "aria-label": H,
259
258
  title: H
260
259
  }
261
260
  )),
262
- m && /* @__PURE__ */ o.createElement(Pe, { ref: N }, /* @__PURE__ */ o.createElement(
261
+ m && /* @__PURE__ */ o.createElement(Te, { ref: N }, /* @__PURE__ */ o.createElement(
263
262
  F,
264
263
  {
265
264
  ...e,
266
265
  ...Z(),
267
- value: ue,
266
+ value: de,
268
267
  maximized: !0,
269
268
  exportScale: 1 / O * x,
270
269
  open: !1,
271
- onChange: ke,
272
- onClose: ve
270
+ onChange: ye,
271
+ onClose: Ce
273
272
  }
274
- ))
273
+ )),
274
+ ce && /* @__PURE__ */ o.createElement(De, null)
275
275
  );
276
276
  });
277
277
  F.propTypes = {
@@ -305,11 +305,11 @@ const l = {
305
305
  disabled: !1,
306
306
  required: !1,
307
307
  validityStyles: !0,
308
- onChange: (d) => p,
309
- onFocus: (d) => p,
310
- onBlur: (d) => p,
311
- onOpen: (d) => p,
312
- onClose: (d) => p,
308
+ onChange: (d) => f,
309
+ onFocus: (d) => f,
310
+ onBlur: (d) => f,
311
+ onOpen: (d) => f,
312
+ onClose: (d) => f,
313
313
  size: "medium",
314
314
  rounded: "medium",
315
315
  fillMode: "solid"
@@ -317,5 +317,5 @@ const l = {
317
317
  F.displayName = "KendoSignature";
318
318
  export {
319
319
  F as Signature,
320
- Ge as SignaturePropsContext
320
+ Ae as SignaturePropsContext
321
321
  };
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 b=require("react"),l=require("prop-types"),r=require("@progress/kendo-react-common"),g=require("@progress/kendo-react-intl"),n=require("../messages/index.js"),y=require("./SliderLabel.js"),k=require("../package-metadata.js"),m=require("@progress/kendo-react-buttons"),o=require("@progress/kendo-svg-icons");function S(d){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(d){for(const e in d)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(d,e);Object.defineProperty(s,e,t.get?t:{enumerable:!0,get:()=>d[e]})}}return s.default=d,Object.freeze(s)}const i=S(b),u=class u extends i.Component{constructor(s){super(s),this.state={value:this.props.defaultValue===void 0?this.props.min:this.props.defaultValue,focused:!1,dir:this.props.dir},this._sliderTrack=null,this._element=null,this.buttons=e=>{if(!e.enabled)return e.children;const t=this.state.dir==="rtl"?this.props.vertical?o.caretAltUpIcon:o.caretAltLeftIcon:this.props.vertical?o.caretAltUpIcon:o.caretAltRightIcon,c=this.state.dir==="rtl"?this.props.vertical?o.caretAltDownIcon:o.caretAltRightIcon:this.props.vertical?o.caretAltDownIcon:o.caretAltLeftIcon,a=this.state.dir==="rtl"?this.props.vertical?"caret-alt-up":"caret-alt-left":this.props.vertical?"caret-alt-up":"caret-alt-right",p=this.state.dir==="rtl"?this.props.vertical?"caret-alt-down":"caret-alt-right":this.props.vertical?"caret-alt-down":"caret-alt-left";return i.createElement(i.Fragment,null,i.createElement(m.Button,{className:"k-button-decrease",rounded:"full",icon:p,svgIcon:c,title:e.decrementTitle,onClick:e.decrement}),e.children,i.createElement(m.Button,{className:"k-button-increase",rounded:"full",icon:a,svgIcon:t,title:e.incrementTitle,onClick:e.increment}))},this.focus=()=>{this._element&&this._element.focus()},this.isLabel=e=>{let t=e;for(;t;){if(t.getAttribute(y.SLIDER_LABEL_ATTRIBUTE))return!0;t=t.parentElement}return!1},this.onFocus=()=>{this.setState({focused:!0})},this.onBlur=()=>{this.setState({focused:!1})},this.onKeyDown=e=>{let t;e.keyCode===r.Keys.left||e.keyCode===r.Keys.down?t=this.state.value-(this.props.step||0):e.keyCode===r.Keys.right||e.keyCode===r.Keys.up?t=this.state.value+(this.props.step||0):e.keyCode===r.Keys.pageDown?t=this.state.value-(this.props.largeStep||0):e.keyCode===r.Keys.pageUp?t=this.state.value+(this.props.largeStep||0):e.keyCode===r.Keys.home?t=this.props.min:e.keyCode===r.Keys.end&&(t=this.props.max),t!==void 0&&(e.preventDefault(),this.change(e,t))},this.decrement=e=>{e.preventDefault(),this.change(e,this.state.value-(this.props.step||0))},this.increment=e=>{e.preventDefault(),this.change(e,this.state.value+(this.props.step||0))},this.dragStart=e=>{this.isLabel(e.event.originalEvent.target)||(e.event.isTouch&&e.event.originalEvent.preventDefault(),this.drag(e))},this.dragOver=e=>{e.event.originalEvent.preventDefault(),this.drag(e)},this.drag=e=>{const t=e.element.getBoundingClientRect(),c=this.props.vertical?t.bottom-e.event.clientY:this.state.dir==="rtl"?t.right-e.event.clientX:e.event.clientX-t.left,a=this.props.vertical?t.height:t.width,p=c/a;this.change(e,this.props.min+p*(this.props.max-this.props.min))},r.validatePackage(k.packageMetadata)}static getDerivedStateFromProps(s,e){const t=s.value!==void 0?s.value:e.value,{min:c,max:a}=s;return t===void 0?null:{value:Math.min(Math.max(t,c),a)}}componentDidMount(){if(!this.state.dir&&window&&this._element){const s=window.getComputedStyle(this._element).direction;s&&this.setState({dir:s})}}render(){const s=g.provideLocalizationService(this),e=(this.state.value-this.props.min)/(this.props.max-this.props.min)*100,t=this.props.vertical?{marginTop:"0.5rem",marginBottom:"0.5rem"}:{marginLeft:"0.5rem",marginRight:"0.5rem"},c=this.props.vertical?{paddingTop:0,height:"100%"}:{};return i.createElement("div",{ref:a=>this._element=a,dir:this.state.dir,id:this.props.id,style:{gap:0,...this.props.style},onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,className:r.classNames("k-slider",{"k-focus":this.state.focused,"k-disabled":this.props.disabled,"k-slider-horizontal":!this.props.vertical,"k-slider-vertical":this.props.vertical},this.props.className)},i.createElement(this.buttons,{enabled:this.props.buttons,decrement:this.decrement,increment:this.increment,incrementTitle:s.toLanguageString(n.sliderIncreaseValue,n.messages[n.sliderIncreaseValue]),decrementTitle:s.toLanguageString(n.sliderDecreaseValue,n.messages[n.sliderDecreaseValue])},i.createElement(r.Draggable,{onDrag:this.dragOver,onPress:this.dragStart,autoScroll:!1},i.createElement("div",{className:"k-slider-track-wrap",style:{flexGrow:1,position:"relative",touchAction:"none",...t}},this.props.children&&i.createElement("ul",{className:"k-reset k-slider-items",style:{margin:0,...c}},i.Children.map(this.props.children,(a,p)=>a&&i.cloneElement(a,{position:100*(a.props.position-this.props.min)/(this.props.max-this.props.min),vertical:this.props.vertical,firstTick:p===0,lastTick:p===i.Children.count(this.props.children)-1},a.props.children))),i.createElement("div",{className:"k-slider-track",style:this.props.vertical?{bottom:0,height:"100%"}:{[this.state.dir==="rtl"?"right":"left"]:0,width:"100%"},ref:a=>this._sliderTrack=a},i.createElement("div",{className:"k-slider-selection",style:this.props.vertical?{height:e+"%"}:{width:e+"%"}}),i.createElement("span",{role:"slider","aria-valuemin":this.props.min,"aria-valuemax":this.props.max,"aria-valuenow":this.state.value,"aria-valuetext":String(this.state.value),"aria-orientation":this.props.vertical?"vertical":void 0,"aria-disabled":this.props.disabled?"true":void 0,"aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy,"aria-label":this.props.ariaLabel,tabIndex:r.getTabIndex(this.props.tabIndex,this.props.disabled,void 0),className:"k-draghandle k-draghandle-end",title:s.toLanguageString(n.sliderDragTitle,n.messages[n.sliderDragTitle]),style:this.props.vertical?{bottom:"calc("+e+"%)",zIndex:1}:this.state.dir==="rtl"?{right:"calc("+e+"% - 13px)",zIndex:1}:{left:"calc("+e+"%)",zIndex:1}}))))))}get sliderTrack(){return this._sliderTrack}change(s,e){e=Math.min(Math.max(e,this.props.min),this.props.max),this.setState({value:e}),r.dispatchEvent(this.props.onChange,s,this,{value:e})}};u.displayName="Slider",u.propTypes={min:l.number.isRequired,max:l.number.isRequired,value:l.number,vertical:l.bool,id:l.string,ariaLabelledBy:l.string,ariaDescribedBy:l.string,ariaLabel:l.string};let h=u;const v=r.createPropsContext(),f=r.withPropsContext(v,h);f.displayName="KendoReactSlider";g.registerForLocalization(h);exports.Slider=f;exports.SliderPropsContext=v;exports.SliderWithoutContext=h;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("react"),l=require("prop-types"),a=require("@progress/kendo-react-common"),g=require("@progress/kendo-react-intl"),n=require("../messages/index.js"),y=require("./SliderLabel.js"),m=require("@progress/kendo-react-buttons"),o=require("@progress/kendo-svg-icons");function k(h){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(h){for(const e in h)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(h,e);Object.defineProperty(s,e,t.get?t:{enumerable:!0,get:()=>h[e]})}}return s.default=h,Object.freeze(s)}const i=k(b),u=class u extends i.Component{constructor(s){super(s),this.state={value:this.props.defaultValue===void 0?this.props.min:this.props.defaultValue,focused:!1,dir:this.props.dir},this._sliderTrack=null,this._element=null,this.buttons=e=>{if(!e.enabled)return e.children;const t=this.state.dir==="rtl"?this.props.vertical?o.caretAltUpIcon:o.caretAltLeftIcon:this.props.vertical?o.caretAltUpIcon:o.caretAltRightIcon,c=this.state.dir==="rtl"?this.props.vertical?o.caretAltDownIcon:o.caretAltRightIcon:this.props.vertical?o.caretAltDownIcon:o.caretAltLeftIcon,r=this.state.dir==="rtl"?this.props.vertical?"caret-alt-up":"caret-alt-left":this.props.vertical?"caret-alt-up":"caret-alt-right",p=this.state.dir==="rtl"?this.props.vertical?"caret-alt-down":"caret-alt-right":this.props.vertical?"caret-alt-down":"caret-alt-left";return i.createElement(i.Fragment,null,i.createElement(m.Button,{className:"k-button-decrease",rounded:"full",icon:p,svgIcon:c,title:e.decrementTitle,onClick:e.decrement}),e.children,i.createElement(m.Button,{className:"k-button-increase",rounded:"full",icon:r,svgIcon:t,title:e.incrementTitle,onClick:e.increment}))},this.focus=()=>{this._element&&this._element.focus()},this.isLabel=e=>{let t=e;for(;t;){if(t.getAttribute(y.SLIDER_LABEL_ATTRIBUTE))return!0;t=t.parentElement}return!1},this.onFocus=()=>{this.setState({focused:!0})},this.onBlur=()=>{this.setState({focused:!1})},this.onKeyDown=e=>{let t;e.keyCode===a.Keys.left||e.keyCode===a.Keys.down?t=this.state.value-(this.props.step||0):e.keyCode===a.Keys.right||e.keyCode===a.Keys.up?t=this.state.value+(this.props.step||0):e.keyCode===a.Keys.pageDown?t=this.state.value-(this.props.largeStep||0):e.keyCode===a.Keys.pageUp?t=this.state.value+(this.props.largeStep||0):e.keyCode===a.Keys.home?t=this.props.min:e.keyCode===a.Keys.end&&(t=this.props.max),t!==void 0&&(e.preventDefault(),this.change(e,t))},this.decrement=e=>{e.preventDefault(),this.change(e,this.state.value-(this.props.step||0))},this.increment=e=>{e.preventDefault(),this.change(e,this.state.value+(this.props.step||0))},this.dragStart=e=>{this.isLabel(e.event.originalEvent.target)||(e.event.isTouch&&e.event.originalEvent.preventDefault(),this.drag(e))},this.dragOver=e=>{e.event.originalEvent.preventDefault(),this.drag(e)},this.drag=e=>{const t=e.element.getBoundingClientRect(),c=this.props.vertical?t.bottom-e.event.clientY:this.state.dir==="rtl"?t.right-e.event.clientX:e.event.clientX-t.left,r=this.props.vertical?t.height:t.width,p=c/r;this.change(e,this.props.min+p*(this.props.max-this.props.min))}}static getDerivedStateFromProps(s,e){const t=s.value!==void 0?s.value:e.value,{min:c,max:r}=s;return t===void 0?null:{value:Math.min(Math.max(t,c),r)}}componentDidMount(){if(!this.state.dir&&window&&this._element){const s=window.getComputedStyle(this._element).direction;s&&this.setState({dir:s})}}render(){const s=g.provideLocalizationService(this),e=(this.state.value-this.props.min)/(this.props.max-this.props.min)*100,t=this.props.vertical?{marginTop:"0.5rem",marginBottom:"0.5rem"}:{marginLeft:"0.5rem",marginRight:"0.5rem"},c=this.props.vertical?{paddingTop:0,height:"100%"}:{};return i.createElement("div",{ref:r=>this._element=r,dir:this.state.dir,id:this.props.id,style:{gap:0,...this.props.style},onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onKeyDown,className:a.classNames("k-slider",{"k-focus":this.state.focused,"k-disabled":this.props.disabled,"k-slider-horizontal":!this.props.vertical,"k-slider-vertical":this.props.vertical},this.props.className)},i.createElement(this.buttons,{enabled:this.props.buttons,decrement:this.decrement,increment:this.increment,incrementTitle:s.toLanguageString(n.sliderIncreaseValue,n.messages[n.sliderIncreaseValue]),decrementTitle:s.toLanguageString(n.sliderDecreaseValue,n.messages[n.sliderDecreaseValue])},i.createElement(a.Draggable,{onDrag:this.dragOver,onPress:this.dragStart,autoScroll:!1},i.createElement("div",{className:"k-slider-track-wrap",style:{flexGrow:1,position:"relative",touchAction:"none",...t}},this.props.children&&i.createElement("ul",{className:"k-reset k-slider-items",style:{margin:0,...c}},i.Children.map(this.props.children,(r,p)=>r&&i.cloneElement(r,{position:100*(r.props.position-this.props.min)/(this.props.max-this.props.min),vertical:this.props.vertical,firstTick:p===0,lastTick:p===i.Children.count(this.props.children)-1},r.props.children))),i.createElement("div",{className:"k-slider-track",style:this.props.vertical?{bottom:0,height:"100%"}:{[this.state.dir==="rtl"?"right":"left"]:0,width:"100%"},ref:r=>this._sliderTrack=r},i.createElement("div",{className:"k-slider-selection",style:this.props.vertical?{height:e+"%"}:{width:e+"%"}}),i.createElement("span",{role:"slider","aria-valuemin":this.props.min,"aria-valuemax":this.props.max,"aria-valuenow":this.state.value,"aria-valuetext":String(this.state.value),"aria-orientation":this.props.vertical?"vertical":void 0,"aria-disabled":this.props.disabled?"true":void 0,"aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy,"aria-label":this.props.ariaLabel,tabIndex:a.getTabIndex(this.props.tabIndex,this.props.disabled,void 0),className:"k-draghandle k-draghandle-end",title:s.toLanguageString(n.sliderDragTitle,n.messages[n.sliderDragTitle]),style:this.props.vertical?{bottom:"calc("+e+"%)",zIndex:1}:this.state.dir==="rtl"?{right:"calc("+e+"% - 13px)",zIndex:1}:{left:"calc("+e+"%)",zIndex:1}}))))))}get sliderTrack(){return this._sliderTrack}change(s,e){e=Math.min(Math.max(e,this.props.min),this.props.max),this.setState({value:e}),a.dispatchEvent(this.props.onChange,s,this,{value:e})}};u.displayName="Slider",u.propTypes={min:l.number.isRequired,max:l.number.isRequired,value:l.number,vertical:l.bool,id:l.string,ariaLabelledBy:l.string,ariaDescribedBy:l.string,ariaLabel:l.string};let d=u;const v=a.createPropsContext(),f=a.withPropsContext(v,d);f.displayName="KendoReactSlider";g.registerForLocalization(d);exports.Slider=f;exports.SliderPropsContext=v;exports.SliderWithoutContext=d;
package/slider/Slider.mjs CHANGED
@@ -7,11 +7,10 @@
7
7
  */
8
8
  import * as i from "react";
9
9
  import a from "prop-types";
10
- import { Keys as n, validatePackage as y, classNames as w, Draggable as S, getTabIndex as x, dispatchEvent as T, createPropsContext as E, withPropsContext as D } from "@progress/kendo-react-common";
11
- import { provideLocalizationService as C, registerForLocalization as I } from "@progress/kendo-react-intl";
10
+ import { Keys as n, classNames as y, Draggable as w, getTabIndex as S, dispatchEvent as x, createPropsContext as T, withPropsContext as E } from "@progress/kendo-react-common";
11
+ import { provideLocalizationService as D, registerForLocalization as C } from "@progress/kendo-react-intl";
12
12
  import { sliderIncreaseValue as d, messages as h, sliderDecreaseValue as m, sliderDragTitle as u } from "../messages/index.mjs";
13
- import { SLIDER_LABEL_ATTRIBUTE as L } from "./SliderLabel.mjs";
14
- import { packageMetadata as A } from "../package-metadata.mjs";
13
+ import { SLIDER_LABEL_ATTRIBUTE as I } from "./SliderLabel.mjs";
15
14
  import { Button as v } from "@progress/kendo-react-buttons";
16
15
  import { caretAltUpIcon as g, caretAltLeftIcon as f, caretAltRightIcon as b, caretAltDownIcon as k } from "@progress/kendo-svg-icons";
17
16
  const p = class p extends i.Component {
@@ -50,7 +49,7 @@ const p = class p extends i.Component {
50
49
  }, this.isLabel = (t) => {
51
50
  let e = t;
52
51
  for (; e; ) {
53
- if (e.getAttribute(L))
52
+ if (e.getAttribute(I))
54
53
  return !0;
55
54
  e = e.parentElement;
56
55
  }
@@ -73,7 +72,7 @@ const p = class p extends i.Component {
73
72
  }, this.drag = (t) => {
74
73
  const e = t.element.getBoundingClientRect(), l = this.props.vertical ? e.bottom - t.event.clientY : this.state.dir === "rtl" ? e.right - t.event.clientX : t.event.clientX - e.left, r = this.props.vertical ? e.height : e.width, o = l / r;
75
74
  this.change(t, this.props.min + o * (this.props.max - this.props.min));
76
- }, y(A);
75
+ };
77
76
  }
78
77
  /**
79
78
  * @hidden
@@ -95,7 +94,7 @@ const p = class p extends i.Component {
95
94
  * @hidden
96
95
  */
97
96
  render() {
98
- const s = C(this), t = (this.state.value - this.props.min) / (this.props.max - this.props.min) * 100, e = this.props.vertical ? { marginTop: "0.5rem", marginBottom: "0.5rem" } : { marginLeft: "0.5rem", marginRight: "0.5rem" }, l = this.props.vertical ? { paddingTop: 0, height: "100%" } : {};
97
+ const s = D(this), t = (this.state.value - this.props.min) / (this.props.max - this.props.min) * 100, e = this.props.vertical ? { marginTop: "0.5rem", marginBottom: "0.5rem" } : { marginLeft: "0.5rem", marginRight: "0.5rem" }, l = this.props.vertical ? { paddingTop: 0, height: "100%" } : {};
99
98
  return /* @__PURE__ */ i.createElement(
100
99
  "div",
101
100
  {
@@ -106,7 +105,7 @@ const p = class p extends i.Component {
106
105
  onFocus: this.onFocus,
107
106
  onBlur: this.onBlur,
108
107
  onKeyDown: this.onKeyDown,
109
- className: w(
108
+ className: y(
110
109
  "k-slider",
111
110
  {
112
111
  "k-focus": this.state.focused,
@@ -126,7 +125,7 @@ const p = class p extends i.Component {
126
125
  incrementTitle: s.toLanguageString(d, h[d]),
127
126
  decrementTitle: s.toLanguageString(m, h[m])
128
127
  },
129
- /* @__PURE__ */ i.createElement(S, { onDrag: this.dragOver, onPress: this.dragStart, autoScroll: !1 }, /* @__PURE__ */ i.createElement(
128
+ /* @__PURE__ */ i.createElement(w, { onDrag: this.dragOver, onPress: this.dragStart, autoScroll: !1 }, /* @__PURE__ */ i.createElement(
130
129
  "div",
131
130
  {
132
131
  className: "k-slider-track-wrap",
@@ -174,7 +173,7 @@ const p = class p extends i.Component {
174
173
  "aria-labelledby": this.props.ariaLabelledBy,
175
174
  "aria-describedby": this.props.ariaDescribedBy,
176
175
  "aria-label": this.props.ariaLabel,
177
- tabIndex: x(this.props.tabIndex, this.props.disabled, void 0),
176
+ tabIndex: S(this.props.tabIndex, this.props.disabled, void 0),
178
177
  className: "k-draghandle k-draghandle-end",
179
178
  title: s.toLanguageString(u, h[u]),
180
179
  style: this.props.vertical ? { bottom: "calc(" + t + "%)", zIndex: 1 } : this.state.dir === "rtl" ? { right: "calc(" + t + "% - 13px)", zIndex: 1 } : { left: "calc(" + t + "%)", zIndex: 1 }
@@ -192,7 +191,7 @@ const p = class p extends i.Component {
192
191
  return this._sliderTrack;
193
192
  }
194
193
  change(s, t) {
195
- t = Math.min(Math.max(t, this.props.min), this.props.max), this.setState({ value: t }), T(this.props.onChange, s, this, { value: t });
194
+ t = Math.min(Math.max(t, this.props.min), this.props.max), this.setState({ value: t }), x(this.props.onChange, s, this, { value: t });
196
195
  }
197
196
  };
198
197
  p.displayName = "Slider", p.propTypes = {
@@ -207,11 +206,11 @@ p.displayName = "Slider", p.propTypes = {
207
206
  // TODO: validation when buttons is set to true, but no step is provided
208
207
  };
209
208
  let c = p;
210
- const B = E(), N = D(B, c);
211
- N.displayName = "KendoReactSlider";
212
- I(c);
209
+ const L = T(), A = E(L, c);
210
+ A.displayName = "KendoReactSlider";
211
+ C(c);
213
212
  export {
214
- N as Slider,
215
- B as SliderPropsContext,
213
+ A as Slider,
214
+ L as SliderPropsContext,
216
215
  c as SliderWithoutContext
217
216
  };
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 C=require("react"),i=require("prop-types"),s=require("@progress/kendo-react-common"),S=require("@progress/kendo-react-intl"),p=require("../messages/index.js"),N=require("../package-metadata.js");function O(o){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const e in o)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(o,e);Object.defineProperty(a,e,t.get?t:{enumerable:!0,get:()=>o[e]})}}return a.default=o,Object.freeze(a)}const r=O(C),n=class n extends r.Component{constructor(a){super(a),this.setValidity=()=>{this._input&&this._input.setCustomValidity&&this._input.setCustomValidity(this.validity.valid?"":this.props.validationMessage||this.defaultValidationMessage.toLanguageString(p.switchValidation,p.messages[p.switchValidation]))},this.limit=(e,t,d)=>{const h=d.offsetWidth,l=t.offsetWidth;return e<0?0:e>h-l?h-l:e},this.toggle=(e,t)=>{this.setState({checked:e}),this.valueDuringOnChange=e,s.dispatchEvent(this.props.onChange,t,this,{value:e}),this.valueDuringOnChange=void 0},this._element=null,this._wrapper=null,this._input=null,this._id=this.props.id,this.defaultValidationMessage=S.provideLocalizationService(this),this.focus=()=>{this.actionElement&&this.actionElement.focus()},this.dummyInput=e=>r.createElement("input",{type:"checkbox",checked:this.props.checked,ref:t=>{this._input=t},tabIndex:-1,"aria-hidden":!0,value:e,style:{opacity:0,width:1,border:0,zIndex:-1,position:"absolute",left:"50%"},onChange:s.noop,name:this.name||void 0}),this.handleClick=e=>{this.eventTimeStamp!==e.timeStamp&&(this.eventTimeStamp=e.timeStamp,this.toggle(!this.value,e))},this.handleKeyDown=e=>{if(this.props.disabled)return;const{keyCode:t}=e;(t===s.Keys.space||t===s.Keys.enter)&&(this.toggle(!this.value,e),e.preventDefault())},this.handleWrapperFocus=e=>{if(this.props.disabled)return;this.setState({focused:!0});const{onFocus:t}=this.props;t&&t.call(void 0,e)},this.handleWrapperBlur=e=>{if(this.props.disabled)return;this.setState({focused:!1});const{onBlur:t}=this.props;t&&t.call(void 0,e)},s.validatePackage(N.packageMetadata),this.state={checked:a.defaultChecked||n.defaultProps.defaultChecked,focused:!1}}get value(){return this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.checked!==void 0?this.props.checked:this.state.checked}get element(){return this._element}get actionElement(){return this._wrapper}get name(){return this.props.name}get validity(){const a=this.props.validationMessage!==void 0,e=this.props.valid!==void 0?this.props.valid:this.props.required?!!this.value:!0,t=this.props.valid!==void 0?this.props.valid:e;return{customError:a,valid:t,valueMissing:this.value===null}}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:n.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:!1}componentDidMount(){this.setValidity(),this.forceUpdate()}componentDidUpdate(){this.setValidity()}render(){const{focused:a}=this.state,{dir:e,disabled:t,trackRounded:d,thumbRounded:h,size:l,offLabel:m,onLabel:f,tabIndex:v}=this.props;this.dir=e||this.element&&getComputedStyle(this.element).direction||void 0;const y=!this.validityStyles||this.validity.valid,k=s.classNames("k-switch",{[`k-switch-${s.kendoThemeMaps.sizeMap[l]||l}`]:l,"k-switch-on":this.value,"k-switch-off":!this.value,"k-focus":a,"k-disabled":t,"k-invalid":!y},this.props.className),w={"aria-checked":this.value,"aria-disabled":t||void 0,"aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy,"aria-label":this.props.ariaLabel,"aria-required":this.props.required};return r.createElement("span",{ref:u=>{this._wrapper=u},role:"switch",...w,className:k,dir:this.dir,onKeyDown:this.handleKeyDown,onClick:this.handleClick,onBlur:this.handleWrapperBlur,onFocus:this.handleWrapperFocus,tabIndex:s.getTabIndex(v,t,void 0),accessKey:this.props.accessKey,id:this.props.id||this._id},r.createElement("span",{className:s.classNames("k-switch-track",{[`k-rounded-${s.kendoThemeMaps.roundedMap[d]||d}`]:d}),ref:u=>{this._element=u}},this.dummyInput(this.value),f?r.createElement("span",{className:"k-switch-label-on"},f):"",m?r.createElement("span",{className:"k-switch-label-off"},m):""),r.createElement("span",{className:"k-switch-thumb-wrap"},r.createElement("span",{className:s.classNames("k-switch-thumb",{[`k-rounded-${h}`]:h})})))}};n.displayName="Switch",n.propTypes={accessKey:i.string,checked:i.bool,className:i.string,disabled:i.bool,defaultChecked:i.bool,size:i.oneOf([null,"small","medium","large"]),trackRounded:i.oneOf([null,"small","medium","large","full"]),thumbRounded:i.oneOf([null,"small","medium","large","full"]),dir:i.string,id:i.string,ariaLabelledBy:i.string,ariaDescribedBy:i.string,offLabel:i.string,required:i.bool,tabIndex:i.number,valid:i.bool,validate:i.bool,validationMessage:i.string,onBlur:i.any,onChange:i.any,onFocus:i.any,onLabel:i.string},n.defaultProps={disabled:!1,defaultChecked:!1,size:"medium",trackRounded:"full",thumbRounded:"full",offLabel:"OFF",onBlur:s.noop,onFocus:s.noop,onLabel:"ON",validityStyles:!0};let c=n;const g=s.createPropsContext(),b=s.withIdHOC(s.withPropsContext(g,c));b.displayName="KendoReactSwitch";exports.Switch=b;exports.SwitchPropsContext=g;exports.SwitchWithoutContext=c;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("react"),s=require("prop-types"),i=require("@progress/kendo-react-common"),S=require("@progress/kendo-react-intl"),p=require("../messages/index.js");function N(o){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const e in o)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(o,e);Object.defineProperty(a,e,t.get?t:{enumerable:!0,get:()=>o[e]})}}return a.default=o,Object.freeze(a)}const r=N(C),n=class n extends r.Component{constructor(a){super(a),this.setValidity=()=>{this._input&&this._input.setCustomValidity&&this._input.setCustomValidity(this.validity.valid?"":this.props.validationMessage||this.defaultValidationMessage.toLanguageString(p.switchValidation,p.messages[p.switchValidation]))},this.limit=(e,t,d)=>{const h=d.offsetWidth,l=t.offsetWidth;return e<0?0:e>h-l?h-l:e},this.toggle=(e,t)=>{this.setState({checked:e}),this.valueDuringOnChange=e,i.dispatchEvent(this.props.onChange,t,this,{value:e}),this.valueDuringOnChange=void 0},this._element=null,this._wrapper=null,this._input=null,this._id=this.props.id,this.defaultValidationMessage=S.provideLocalizationService(this),this.focus=()=>{this.actionElement&&this.actionElement.focus()},this.dummyInput=e=>r.createElement("input",{type:"checkbox",checked:this.props.checked,ref:t=>{this._input=t},tabIndex:-1,"aria-hidden":!0,value:e,style:{opacity:0,width:1,border:0,zIndex:-1,position:"absolute",left:"50%"},onChange:i.noop,name:this.name||void 0}),this.handleClick=e=>{this.eventTimeStamp!==e.timeStamp&&(this.eventTimeStamp=e.timeStamp,this.toggle(!this.value,e))},this.handleKeyDown=e=>{if(this.props.disabled)return;const{keyCode:t}=e;(t===i.Keys.space||t===i.Keys.enter)&&(this.toggle(!this.value,e),e.preventDefault())},this.handleWrapperFocus=e=>{if(this.props.disabled)return;this.setState({focused:!0});const{onFocus:t}=this.props;t&&t.call(void 0,e)},this.handleWrapperBlur=e=>{if(this.props.disabled)return;this.setState({focused:!1});const{onBlur:t}=this.props;t&&t.call(void 0,e)},this.state={checked:a.defaultChecked||n.defaultProps.defaultChecked,focused:!1}}get value(){return this.valueDuringOnChange!==void 0?this.valueDuringOnChange:this.props.checked!==void 0?this.props.checked:this.state.checked}get element(){return this._element}get actionElement(){return this._wrapper}get name(){return this.props.name}get validity(){const a=this.props.validationMessage!==void 0,e=this.props.valid!==void 0?this.props.valid:this.props.required?!!this.value:!0,t=this.props.valid!==void 0?this.props.valid:e;return{customError:a,valid:t,valueMissing:this.value===null}}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:n.defaultProps.validityStyles}get required(){return this.props.required!==void 0?this.props.required:!1}componentDidMount(){this.setValidity(),this.forceUpdate()}componentDidUpdate(){this.setValidity()}render(){const{focused:a}=this.state,{dir:e,disabled:t,trackRounded:d,thumbRounded:h,size:l,offLabel:m,onLabel:f,tabIndex:y}=this.props;this.dir=e||this.element&&getComputedStyle(this.element).direction||void 0;const v=!this.validityStyles||this.validity.valid,k=i.classNames("k-switch",{[`k-switch-${i.kendoThemeMaps.sizeMap[l]||l}`]:l,"k-switch-on":this.value,"k-switch-off":!this.value,"k-focus":a,"k-disabled":t,"k-invalid":!v},this.props.className),w={"aria-checked":this.value,"aria-disabled":t||void 0,"aria-labelledby":this.props.ariaLabelledBy,"aria-describedby":this.props.ariaDescribedBy,"aria-label":this.props.ariaLabel,"aria-required":this.props.required};return r.createElement("span",{ref:u=>{this._wrapper=u},role:"switch",...w,className:k,dir:this.dir,onKeyDown:this.handleKeyDown,onClick:this.handleClick,onBlur:this.handleWrapperBlur,onFocus:this.handleWrapperFocus,tabIndex:i.getTabIndex(y,t,void 0),accessKey:this.props.accessKey,id:this.props.id||this._id},r.createElement("span",{className:i.classNames("k-switch-track",{[`k-rounded-${i.kendoThemeMaps.roundedMap[d]||d}`]:d}),ref:u=>{this._element=u}},this.dummyInput(this.value),f?r.createElement("span",{className:"k-switch-label-on"},f):"",m?r.createElement("span",{className:"k-switch-label-off"},m):""),r.createElement("span",{className:"k-switch-thumb-wrap"},r.createElement("span",{className:i.classNames("k-switch-thumb",{[`k-rounded-${h}`]:h})})))}};n.displayName="Switch",n.propTypes={accessKey:s.string,checked:s.bool,className:s.string,disabled:s.bool,defaultChecked:s.bool,size:s.oneOf([null,"small","medium","large"]),trackRounded:s.oneOf([null,"small","medium","large","full"]),thumbRounded:s.oneOf([null,"small","medium","large","full"]),dir:s.string,id:s.string,ariaLabelledBy:s.string,ariaDescribedBy:s.string,offLabel:s.string,required:s.bool,tabIndex:s.number,valid:s.bool,validate:s.bool,validationMessage:s.string,onBlur:s.any,onChange:s.any,onFocus:s.any,onLabel:s.string},n.defaultProps={disabled:!1,defaultChecked:!1,size:"medium",trackRounded:"full",thumbRounded:"full",offLabel:"OFF",onBlur:i.noop,onFocus:i.noop,onLabel:"ON",validityStyles:!0};let c=n;const g=i.createPropsContext(),b=i.withIdHOC(i.withPropsContext(g,c));b.displayName="KendoReactSwitch";exports.Switch=b;exports.SwitchPropsContext=g;exports.SwitchWithoutContext=c;
package/switch/Switch.mjs CHANGED
@@ -7,10 +7,9 @@
7
7
  */
8
8
  import * as s from "react";
9
9
  import t from "prop-types";
10
- import { dispatchEvent as C, noop as h, Keys as f, validatePackage as S, classNames as p, kendoThemeMaps as g, getTabIndex as N, createPropsContext as D, withIdHOC as E, withPropsContext as L } from "@progress/kendo-react-common";
11
- import { provideLocalizationService as M } from "@progress/kendo-react-intl";
12
- import { switchValidation as v, messages as B } from "../messages/index.mjs";
13
- import { packageMetadata as O } from "../package-metadata.mjs";
10
+ import { dispatchEvent as C, noop as h, Keys as f, classNames as p, kendoThemeMaps as v, getTabIndex as S, createPropsContext as N, withIdHOC as D, withPropsContext as E } from "@progress/kendo-react-common";
11
+ import { provideLocalizationService as L } from "@progress/kendo-react-intl";
12
+ import { switchValidation as g, messages as B } from "../messages/index.mjs";
14
13
  const a = class a extends s.Component {
15
14
  /**
16
15
  * @hidden
@@ -18,14 +17,14 @@ const a = class a extends s.Component {
18
17
  constructor(r) {
19
18
  super(r), this.setValidity = () => {
20
19
  this._input && this._input.setCustomValidity && this._input.setCustomValidity(
21
- this.validity.valid ? "" : this.props.validationMessage || this.defaultValidationMessage.toLanguageString(v, B[v])
20
+ this.validity.valid ? "" : this.props.validationMessage || this.defaultValidationMessage.toLanguageString(g, B[g])
22
21
  );
23
22
  }, this.limit = (e, i, o) => {
24
23
  const n = o.offsetWidth, l = i.offsetWidth;
25
24
  return e < 0 ? 0 : e > n - l ? n - l : e;
26
25
  }, this.toggle = (e, i) => {
27
26
  this.setState({ checked: e }), this.valueDuringOnChange = e, C(this.props.onChange, i, this, { value: e }), this.valueDuringOnChange = void 0;
28
- }, this._element = null, this._wrapper = null, this._input = null, this._id = this.props.id, this.defaultValidationMessage = M(this), this.focus = () => {
27
+ }, this._element = null, this._wrapper = null, this._input = null, this._id = this.props.id, this.defaultValidationMessage = L(this), this.focus = () => {
29
28
  this.actionElement && this.actionElement.focus();
30
29
  }, this.dummyInput = (e) => /* @__PURE__ */ s.createElement(
31
30
  "input",
@@ -61,7 +60,7 @@ const a = class a extends s.Component {
61
60
  this.setState({ focused: !1 });
62
61
  const { onBlur: i } = this.props;
63
62
  i && i.call(void 0, e);
64
- }, S(O), this.state = {
63
+ }, this.state = {
65
64
  checked: r.defaultChecked || a.defaultProps.defaultChecked,
66
65
  focused: !1
67
66
  };
@@ -128,7 +127,7 @@ const a = class a extends s.Component {
128
127
  const y = !this.validityStyles || this.validity.valid, k = p(
129
128
  "k-switch",
130
129
  {
131
- [`k-switch-${g.sizeMap[l] || l}`]: l,
130
+ [`k-switch-${v.sizeMap[l] || l}`]: l,
132
131
  "k-switch-on": this.value,
133
132
  "k-switch-off": !this.value,
134
133
  "k-focus": r,
@@ -158,7 +157,7 @@ const a = class a extends s.Component {
158
157
  onClick: this.handleClick,
159
158
  onBlur: this.handleWrapperBlur,
160
159
  onFocus: this.handleWrapperFocus,
161
- tabIndex: N(b, i, void 0),
160
+ tabIndex: S(b, i, void 0),
162
161
  accessKey: this.props.accessKey,
163
162
  id: this.props.id || this._id
164
163
  },
@@ -166,7 +165,7 @@ const a = class a extends s.Component {
166
165
  "span",
167
166
  {
168
167
  className: p("k-switch-track", {
169
- [`k-rounded-${g.roundedMap[o] || o}`]: o
168
+ [`k-rounded-${v.roundedMap[o] || o}`]: o
170
169
  }),
171
170
  ref: (d) => {
172
171
  this._element = d;
@@ -216,15 +215,15 @@ a.displayName = "Switch", a.propTypes = {
216
215
  validityStyles: !0
217
216
  };
218
217
  let c = a;
219
- const V = D(), I = E(
220
- L(
221
- V,
218
+ const M = N(), O = D(
219
+ E(
220
+ M,
222
221
  c
223
222
  )
224
223
  );
225
- I.displayName = "KendoReactSwitch";
224
+ O.displayName = "KendoReactSwitch";
226
225
  export {
227
- I as Switch,
228
- V as SwitchPropsContext,
226
+ O as Switch,
227
+ M as SwitchPropsContext,
229
228
  c as SwitchWithoutContext
230
229
  };
@@ -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 w=require("react"),s=require("prop-types"),a=require("@progress/kendo-react-common"),A=require("../package-metadata.js");function D(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const l=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,l.get?l:{enumerable:!0,get:()=>e[n]})}}return r.default=e,Object.freeze(r)}const t=D(w),d=t.forwardRef((e,r)=>{a.validatePackage(A.packageMetadata);const n=t.useRef(null),l=t.useRef(null),c=t.useRef(),f=a.useUnstyled(),i=f&&f.uTextBox,y=t.useCallback(()=>{var u;return c.current!==void 0?c.current:(u=n.current)==null?void 0:u.value},[]);t.useImperativeHandle(l,()=>({get element(){return n.current},get name(){return n.current&&n.current.name},get value(){return y()}})),t.useImperativeHandle(r,()=>l.current);const{size:m=o.size,fillMode:g=o.fillMode,rounded:v=o.rounded,autoFocus:B=o.autoFocus,inputAttributes:h,className:x,dir:F,style:_,prefix:p=o.prefix,suffix:O=o.suffix,valid:I,onFocus:T,onBlur:q,modified:H,touched:G,visited:K,...M}=e,[R]=a.useCustomComponent(p),[N]=a.useCustomComponent(O),[b,C]=t.useState(!1),S=u=>{C(!0)},j=u=>{C(!1)},k=t.useCallback(u=>{c.current=u.target.value,e.onChange&&e.onChange.call(void 0,{syntheticEvent:u,nativeEvent:u.nativeEvent,value:u.target.value,target:l.current}),c.current=void 0},[e.onChange]),{onFocus:E,onBlur:P}=a.useAsyncFocusBlur({onFocus:S,onBlur:j,onSyncFocus:T,onSyncBlur:q}),z=t.useMemo(()=>a.classNames(a.uTextBox.wrapper({c:i,rounded:v,fillMode:g,size:m,focused:b,required:e.required,disabled:e.disabled,invalid:e.valid===!1}),x),[x,g,b,e.disabled,e.required,e.valid,v,m,i]);return t.createElement("span",{style:_,dir:F,className:z,onFocus:E,onBlur:P},t.createElement(R,null),t.createElement("input",{ref:n,className:a.classNames(a.uTextBox.inputInner({c:i})),autoFocus:B,...Object.assign({},M,h),"aria-required":e.required,onChange:k}),t.createElement(N,null))}),o={prefix:e=>null,suffix:e=>null,size:"medium",rounded:"medium",fillMode:"solid",autoFocus:!1};d.propTypes={size:s.oneOf([null,"small","medium","large"]),rounded:s.oneOf([null,"small","medium","large","full"]),fillMode:s.oneOf([null,"solid","flat","outline"]),autoFocus:s.bool,inputAttributes:s.object};d.displayName="KendoReactTextBoxComponent";exports.TextBox=d;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("react"),a=require("prop-types"),l=require("@progress/kendo-react-common");function A(e){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(s,n,o.get?o:{enumerable:!0,get:()=>e[n]})}}return s.default=e,Object.freeze(s)}const t=A(w),d=t.forwardRef((e,s)=>{const n=t.useRef(null),o=t.useRef(null),c=t.useRef(),f=l.useUnstyled(),i=f&&f.uTextBox,y=t.useCallback(()=>{var u;return c.current!==void 0?c.current:(u=n.current)==null?void 0:u.value},[]);t.useImperativeHandle(o,()=>({get element(){return n.current},get name(){return n.current&&n.current.name},get value(){return y()}})),t.useImperativeHandle(s,()=>o.current);const{size:m=r.size,fillMode:g=r.fillMode,rounded:v=r.rounded,autoFocus:B=r.autoFocus,inputAttributes:h,className:x,dir:F,style:_,prefix:O=r.prefix,suffix:T=r.suffix,valid:D,onFocus:p,onBlur:R,modified:I,touched:H,visited:G,...q}=e,[N]=l.useCustomComponent(O),[S]=l.useCustomComponent(T),[b,C]=t.useState(!1),j=u=>{C(!0)},E=u=>{C(!1)},M=t.useCallback(u=>{c.current=u.target.value,e.onChange&&e.onChange.call(void 0,{syntheticEvent:u,nativeEvent:u.nativeEvent,value:u.target.value,target:o.current}),c.current=void 0},[e.onChange]),{onFocus:P,onBlur:z}=l.useAsyncFocusBlur({onFocus:j,onBlur:E,onSyncFocus:p,onSyncBlur:R}),k=t.useMemo(()=>l.classNames(l.uTextBox.wrapper({c:i,rounded:v,fillMode:g,size:m,focused:b,required:e.required,disabled:e.disabled,invalid:e.valid===!1}),x),[x,g,b,e.disabled,e.required,e.valid,v,m,i]);return t.createElement("span",{style:_,dir:F,className:k,onFocus:P,onBlur:z},t.createElement(N,null),t.createElement("input",{ref:n,className:l.classNames(l.uTextBox.inputInner({c:i})),autoFocus:B,...Object.assign({},q,h),"aria-required":e.required,onChange:M}),t.createElement(S,null))}),r={prefix:e=>null,suffix:e=>null,size:"medium",rounded:"medium",fillMode:"solid",autoFocus:!1};d.propTypes={size:a.oneOf([null,"small","medium","large"]),rounded:a.oneOf([null,"small","medium","large","full"]),fillMode:a.oneOf([null,"solid","flat","outline"]),autoFocus:a.bool,inputAttributes:a.object};d.displayName="KendoReactTextBoxComponent";exports.TextBox=d;