@progress/kendo-react-inputs 14.0.1 → 14.0.2-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.
@@ -8,16 +8,16 @@
8
8
  import { SignaturePad as Le } from "@progress/kendo-inputs-common";
9
9
  import { Button as T } from "@progress/kendo-react-buttons";
10
10
  import { validatePackage as we, getLicenseMessage as Ie, usePropsContext as Pe, noop as f, useIsomorphicLayoutEffect as De, dispatchEvent as h, classNames as B, kendoThemeMaps as ee, getTabIndex as Te, WatermarkOverlay as Be, createPropsContext as Re } from "@progress/kendo-react-common";
11
- import { Dialog as _e } from "@progress/kendo-react-dialogs";
12
- import { useLocalization as Fe } from "@progress/kendo-react-intl";
11
+ import { Dialog as Fe } from "@progress/kendo-react-dialogs";
12
+ import { useLocalization as _e } 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
16
  import { packageMetadata as ae } from "../package-metadata.mjs";
17
17
  import { hasParent as Ne } from "./utils/index.mjs";
18
18
  import { hyperlinkOpenIcon as re, xIcon as We } from "@progress/kendo-svg-icons";
19
- const qe = 250, Ge = 84, se = 3, le = 2, Ae = "#000000", Ve = "#ffffff", ie = (d) => d !== void 0, je = Re(), _ = o.forwardRef((d, ce) => {
20
- const ue = !we(ae, { component: "Signature" }), de = Ie(ae), F = Pe(je, d), e = o.useMemo(
19
+ const qe = 250, Ge = 84, se = 3, le = 2, Ae = "#000000", Ve = "#ffffff", ie = (d) => d !== void 0, je = Re(), F = o.forwardRef((d, ce) => {
20
+ const ue = !we(ae, { component: "Signature" }), de = Ie(ae), _ = Pe(je, d), e = o.useMemo(
21
21
  () => ({
22
22
  strokeWidth: s.strokeWidth,
23
23
  smooth: s.smooth,
@@ -35,10 +35,10 @@ const qe = 250, Ge = 84, se = 3, le = 2, Ae = "#000000", Ve = "#ffffff", ie = (d
35
35
  size: s.size,
36
36
  rounded: s.rounded,
37
37
  fillMode: s.fillMode,
38
- ...F
38
+ ..._
39
39
  }),
40
- [F]
41
- ), S = Fe(), c = o.useRef(null), g = o.useRef(null), N = o.useRef(null), W = o.useRef(null), z = o.useRef(null), [r, me] = o.useState(), [b, q] = o.useState(!1), [E, G] = o.useState(!1), [k, A] = o.useState(), [pe, fe] = o.useState(), V = ie(e.value) ? e.value : k, [ge, be] = o.useState(!1), p = ie(e.open), m = p ? e.open : ge, ke = e.maximized || E || !e.maximizable || e.disabled, ve = !(e.maximized && !E), ye = !(!(e.value || k) || E || e.readOnly || e.disabled), j = S.toLanguageString(te, R[te]), U = S.toLanguageString(oe, R[oe]), H = S.toLanguageString(ne, R[ne]), O = e.popupScale || se, x = e.exportScale || le, M = (t) => {
40
+ [_]
41
+ ), S = _e(), c = o.useRef(null), g = o.useRef(null), N = o.useRef(null), W = o.useRef(null), z = o.useRef(null), [r, me] = o.useState(), [b, q] = o.useState(!1), [E, G] = o.useState(!1), [k, A] = o.useState(), [pe, fe] = o.useState(), V = ie(e.value) ? e.value : k, [ge, be] = o.useState(!1), p = ie(e.open), m = p ? e.open : ge, ke = e.maximized || E || !e.maximizable || e.disabled, ve = !(e.maximized && !E), ye = !(!(e.value || k) || E || e.readOnly || e.disabled), j = S.toLanguageString(te, R[te]), U = S.toLanguageString(oe, R[oe]), H = S.toLanguageString(ne, R[ne]), O = e.popupScale || se, x = e.exportScale || le, M = (t) => {
42
42
  A(t), e.onChange && e.onChange({ value: t });
43
43
  }, Ce = (t) => {
44
44
  r == null || r.loadImage(t.value), M(t.value);
@@ -262,8 +262,8 @@ const qe = 250, Ge = 84, se = 3, le = 2, Ae = "#000000", Ve = "#ffffff", ie = (d
262
262
  title: H
263
263
  }
264
264
  )),
265
- m && /* @__PURE__ */ o.createElement(_e, { ref: N }, /* @__PURE__ */ o.createElement(
266
- _,
265
+ m && /* @__PURE__ */ o.createElement(Fe, { ref: N }, /* @__PURE__ */ o.createElement(
266
+ F,
267
267
  {
268
268
  ...e,
269
269
  ...Z(),
@@ -278,7 +278,7 @@ const qe = 250, Ge = 84, se = 3, le = 2, Ae = "#000000", Ve = "#ffffff", ie = (d
278
278
  ue && /* @__PURE__ */ o.createElement(Be, { message: de })
279
279
  );
280
280
  });
281
- _.propTypes = {
281
+ F.propTypes = {
282
282
  value: a.string,
283
283
  width: a.number,
284
284
  height: a.number,
@@ -318,8 +318,8 @@ const s = {
318
318
  rounded: void 0,
319
319
  fillMode: void 0
320
320
  };
321
- _.displayName = "KendoSignature";
321
+ F.displayName = "KendoSignature";
322
322
  export {
323
- _ as Signature,
323
+ F as Signature,
324
324
  je as SignaturePropsContext
325
325
  };
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 n=require("react"),le=require("prop-types"),c=require("@progress/kendo-react-common"),j=require("@progress/kendo-react-intl"),u=require("../messages/index.js"),re=require("./SliderLabel.js"),_=require("@progress/kendo-react-buttons"),g=require("@progress/kendo-svg-icons");function F(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=F(n),r=F(le),v={step:1,largeStep:10,buttons:!1,vertical:!1,disabled:!1,tabIndex:0},T=i.forwardRef((e,k)=>{var K,M,O;const{step:d=v.step,largeStep:b=v.largeStep,vertical:l=v.vertical,disabled:E=v.disabled,tabIndex:U=v.tabIndex}=e,[H,W]=n.useState((K=e.defaultValue)!=null?K:e.min),[X,V]=n.useState(!1),[R,G]=n.useState(e.dir),L=n.useRef(null),h=n.useRef(null),A=n.useMemo(()=>new j.LocalizationService,[]),z=n.useRef(null),N=e.value!==void 0,x=N&&e.value!==void 0?e.value:H,s=n.useMemo(()=>{const{min:t,max:a}=e;return x<t?t:x>a?a:x},[x,e.min,e.max]),y=n.useMemo(()=>{const{min:t,max:a}=e,o=a-t;return o===0?0:(s-t)/o*100},[s,e.min,e.max]),f=(M=e.dir)!=null?M:R;n.useEffect(()=>{if(e.dir===void 0&&h.current){const a=window.getComputedStyle(h.current).direction;a!==R&&G(a)}},[e.dir,R]);const q=n.useCallback(t=>{let a=t;for(;a;){if(a.getAttribute(re.SLIDER_LABEL_ATTRIBUTE))return!0;a=a.parentElement}return!1},[]),m=n.useCallback((t,a)=>{const o=Math.min(Math.max(a,e.min),e.max);N||W(o),c.dispatchEvent(e.onChange,t,z.current,{value:o})},[e.min,e.max,e.onChange,N]),Y=n.useCallback(()=>{V(!0)},[]),J=n.useCallback(()=>{V(!1)},[]),Q=n.useCallback(t=>{let a;t.keyCode===c.Keys.left||t.keyCode===c.Keys.down?a=s-(d||0):t.keyCode===c.Keys.right||t.keyCode===c.Keys.up?a=s+(d||0):t.keyCode===c.Keys.pageDown?a=s-(b||0):t.keyCode===c.Keys.pageUp?a=s+(b||0):t.keyCode===c.Keys.home?a=e.min:t.keyCode===c.Keys.end&&(a=e.max),a!==void 0&&(t.preventDefault(),m(t,a))},[s,d,b,e.min,e.max,m]),Z=n.useCallback(t=>{t.preventDefault(),m(t,s-(d||0))},[s,d,m]),$=n.useCallback(t=>{t.preventDefault(),m(t,s+(d||0))},[s,d,m]),I=n.useCallback(t=>{const a=t.element.getBoundingClientRect();let o;l?o=a.bottom-t.event.clientY:o=f==="rtl"?a.right-t.event.clientX:t.event.clientX-a.left;const C=l?a.height:a.width,S=o/C;m(t,e.min+S*(e.max-e.min))},[l,e.min,e.max,f,m]),p=n.useCallback(t=>{q(t.event.originalEvent.target)||(t.event.isTouch&&t.event.originalEvent.preventDefault(),I(t))},[q,I]),ee=n.useCallback(t=>{t.event.originalEvent.preventDefault(),I(t)},[I]),w=n.useCallback(()=>{h.current&&h.current.focus()},[]),te=n.useCallback(t=>{if(!t.enabled)return t.children;let a,o,C,S;return f==="rtl"?(a=l?g.caretAltUpIcon:g.caretAltLeftIcon,o=l?g.caretAltDownIcon:g.caretAltRightIcon,C=l?"caret-alt-up":"caret-alt-left",S=l?"caret-alt-down":"caret-alt-right"):(a=l?g.caretAltUpIcon:g.caretAltRightIcon,o=l?g.caretAltDownIcon:g.caretAltLeftIcon,C=l?"caret-alt-up":"caret-alt-right",S=l?"caret-alt-down":"caret-alt-left"),i.createElement(i.Fragment,null,i.createElement(_.Button,{className:"k-button-decrease",rounded:"full",icon:S,svgIcon:o,title:t.decrementTitle,onClick:t.decrement}),t.children,i.createElement(_.Button,{className:"k-button-increase",rounded:"full",icon:C,svgIcon:a,title:t.incrementTitle,onClick:t.increment}))},[f,l]);n.useImperativeHandle(k,()=>({props:e,sliderTrack:L.current,focus:w}),[e,w]),n.useEffect(()=>{z.current={props:e,sliderTrack:L.current,focus:w}},[e,w]);const ae=l?{marginTop:"0.5rem",marginBottom:"0.5rem"}:{marginLeft:"0.5rem",marginRight:"0.5rem"},ne=l?{paddingTop:0,height:"100%"}:{};let D;return l?D={bottom:"calc("+y+"%)",zIndex:1}:f==="rtl"?D={right:"calc("+y+"% - 13px)",zIndex:1}:D={left:"calc("+y+"%)",zIndex:1},i.createElement("div",{ref:h,dir:f,id:e.id,style:{gap:0,...e.style},onFocus:Y,onBlur:J,onKeyDown:Q,className:c.classNames("k-slider",{"k-focus":X,"k-disabled":E,"k-slider-horizontal":!l,"k-slider-vertical":l},e.className)},te({enabled:(O=e.buttons)!=null?O:v.buttons,decrement:Z,increment:$,incrementTitle:A.toLanguageString(u.sliderIncreaseValue,u.messages[u.sliderIncreaseValue]),decrementTitle:A.toLanguageString(u.sliderDecreaseValue,u.messages[u.sliderDecreaseValue]),children:i.createElement(c.Draggable,{onDrag:ee,onPress:p,autoScroll:!1},i.createElement("div",{className:"k-slider-track-wrap",style:{flexGrow:1,position:"relative",touchAction:"none",...ae}},e.children&&i.createElement("ul",{className:"k-reset k-slider-items",style:{margin:0,...ne}},i.Children.map(e.children,(t,a)=>t&&i.cloneElement(t,{position:100*(t.props.position-e.min)/(e.max-e.min),vertical:l,firstTick:a===0,lastTick:a===i.Children.count(e.children)-1},t.props.children))),i.createElement("div",{className:"k-slider-track",style:l?{bottom:0,height:"100%"}:{[f==="rtl"?"right":"left"]:0,width:"100%"},ref:L},i.createElement("div",{className:"k-slider-selection",style:l?{height:y+"%"}:{width:y+"%"}}),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":E?"true":void 0,"aria-labelledby":e.ariaLabelledBy,"aria-describedby":e.ariaDescribedBy,"aria-label":e.ariaLabel,tabIndex:c.getTabIndex(U,E,void 0),className:"k-draghandle k-draghandle-end",title:A.toLanguageString(u.sliderDragTitle,u.messages[u.sliderDragTitle]),style:D}))))}))});T.displayName="Slider";const P=c.createPropsContext(),B=c.withPropsContext(P,T);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};j.registerForLocalization(T);exports.Slider=B;exports.SliderPropsContext=P;exports.SliderWithoutContext=T;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),i=require("prop-types"),c=require("@progress/kendo-react-common"),F=require("@progress/kendo-react-intl"),u=require("../messages/index.js"),ne=require("./SliderLabel.js"),j=require("@progress/kendo-react-buttons"),g=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 r=le(n),v={step:1,largeStep:10,buttons:!1,vertical:!1,disabled:!1,tabIndex:0},T=r.forwardRef((e,k)=>{var K,M,O;const{step:d=v.step,largeStep:b=v.largeStep,vertical:l=v.vertical,disabled:E=v.disabled,tabIndex:P=v.tabIndex}=e,[U,H]=n.useState((K=e.defaultValue)!=null?K:e.min),[W,V]=n.useState(!1),[R,X]=n.useState(e.dir),L=n.useRef(null),h=n.useRef(null),A=n.useMemo(()=>new F.LocalizationService,[]),z=n.useRef(null),N=e.value!==void 0,x=N&&e.value!==void 0?e.value:U,s=n.useMemo(()=>{const{min:t,max:a}=e;return x<t?t:x>a?a:x},[x,e.min,e.max]),y=n.useMemo(()=>{const{min:t,max:a}=e,o=a-t;return o===0?0:(s-t)/o*100},[s,e.min,e.max]),f=(M=e.dir)!=null?M:R;n.useEffect(()=>{if(e.dir===void 0&&h.current){const a=window.getComputedStyle(h.current).direction;a!==R&&X(a)}},[e.dir,R]);const q=n.useCallback(t=>{let a=t;for(;a;){if(a.getAttribute(ne.SLIDER_LABEL_ATTRIBUTE))return!0;a=a.parentElement}return!1},[]),m=n.useCallback((t,a)=>{const o=Math.min(Math.max(a,e.min),e.max);N||H(o),c.dispatchEvent(e.onChange,t,z.current,{value:o})},[e.min,e.max,e.onChange,N]),G=n.useCallback(()=>{V(!0)},[]),Y=n.useCallback(()=>{V(!1)},[]),J=n.useCallback(t=>{let a;t.keyCode===c.Keys.left||t.keyCode===c.Keys.down?a=s-(d||0):t.keyCode===c.Keys.right||t.keyCode===c.Keys.up?a=s+(d||0):t.keyCode===c.Keys.pageDown?a=s-(b||0):t.keyCode===c.Keys.pageUp?a=s+(b||0):t.keyCode===c.Keys.home?a=e.min:t.keyCode===c.Keys.end&&(a=e.max),a!==void 0&&(t.preventDefault(),m(t,a))},[s,d,b,e.min,e.max,m]),Q=n.useCallback(t=>{t.preventDefault(),m(t,s-(d||0))},[s,d,m]),Z=n.useCallback(t=>{t.preventDefault(),m(t,s+(d||0))},[s,d,m]),I=n.useCallback(t=>{const a=t.element.getBoundingClientRect();let o;l?o=a.bottom-t.event.clientY:o=f==="rtl"?a.right-t.event.clientX:t.event.clientX-a.left;const C=l?a.height:a.width,S=o/C;m(t,e.min+S*(e.max-e.min))},[l,e.min,e.max,f,m]),$=n.useCallback(t=>{q(t.event.originalEvent.target)||(t.event.isTouch&&t.event.originalEvent.preventDefault(),I(t))},[q,I]),p=n.useCallback(t=>{t.event.originalEvent.preventDefault(),I(t)},[I]),w=n.useCallback(()=>{h.current&&h.current.focus()},[]),ee=n.useCallback(t=>{if(!t.enabled)return t.children;let a,o,C,S;return f==="rtl"?(a=l?g.caretAltUpIcon:g.caretAltLeftIcon,o=l?g.caretAltDownIcon:g.caretAltRightIcon,C=l?"caret-alt-up":"caret-alt-left",S=l?"caret-alt-down":"caret-alt-right"):(a=l?g.caretAltUpIcon:g.caretAltRightIcon,o=l?g.caretAltDownIcon:g.caretAltLeftIcon,C=l?"caret-alt-up":"caret-alt-right",S=l?"caret-alt-down":"caret-alt-left"),r.createElement(r.Fragment,null,r.createElement(j.Button,{className:"k-button-decrease",rounded:"full",icon:S,svgIcon:o,title:t.decrementTitle,onClick:t.decrement}),t.children,r.createElement(j.Button,{className:"k-button-increase",rounded:"full",icon:C,svgIcon:a,title:t.incrementTitle,onClick:t.increment}))},[f,l]);n.useImperativeHandle(k,()=>({props:e,sliderTrack:L.current,focus:w}),[e,w]),n.useEffect(()=>{z.current={props:e,sliderTrack:L.current,focus:w}},[e,w]);const te=l?{marginTop:"0.5rem",marginBottom:"0.5rem"}:{marginLeft:"0.5rem",marginRight:"0.5rem"},ae=l?{paddingTop:0,height:"100%"}:{};let D;return l?D={bottom:"calc("+y+"%)",zIndex:1}:f==="rtl"?D={right:"calc("+y+"% - 13px)",zIndex:1}:D={left:"calc("+y+"%)",zIndex:1},r.createElement("div",{ref:h,dir:f,id:e.id,style:{gap:0,...e.style},onFocus:G,onBlur:Y,onKeyDown:J,className:c.classNames("k-slider",{"k-focus":W,"k-disabled":E,"k-slider-horizontal":!l,"k-slider-vertical":l},e.className)},ee({enabled:(O=e.buttons)!=null?O:v.buttons,decrement:Q,increment:Z,incrementTitle:A.toLanguageString(u.sliderIncreaseValue,u.messages[u.sliderIncreaseValue]),decrementTitle:A.toLanguageString(u.sliderDecreaseValue,u.messages[u.sliderDecreaseValue]),children:r.createElement(c.Draggable,{onDrag:p,onPress:$,autoScroll:!1},r.createElement("div",{className:"k-slider-track-wrap",style:{flexGrow:1,position:"relative",touchAction:"none",...te}},e.children&&r.createElement("ul",{className:"k-reset k-slider-items",style:{margin:0,...ae}},r.Children.map(e.children,(t,a)=>t&&r.cloneElement(t,{position:100*(t.props.position-e.min)/(e.max-e.min),vertical:l,firstTick:a===0,lastTick:a===r.Children.count(e.children)-1},t.props.children))),r.createElement("div",{className:"k-slider-track",style:l?{bottom:0,height:"100%"}:{[f==="rtl"?"right":"left"]:0,width:"100%"},ref:L},r.createElement("div",{className:"k-slider-selection",style:l?{height:y+"%"}:{width:y+"%"}}),r.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":E?"true":void 0,"aria-labelledby":e.ariaLabelledBy,"aria-describedby":e.ariaDescribedBy,"aria-label":e.ariaLabel,tabIndex:c.getTabIndex(P,E,void 0),className:"k-draghandle k-draghandle-end",title:A.toLanguageString(u.sliderDragTitle,u.messages[u.sliderDragTitle]),style:D}))))}))});T.displayName="Slider";const _=c.createPropsContext(),B=c.withPropsContext(_,T);B.displayName="KendoReactSlider";B.propTypes={value:i.number,defaultValue:i.number,min:i.number.isRequired,max:i.number.isRequired,step:i.number,largeStep:i.number,onChange:i.func,style:i.object,className:i.string,buttons:i.bool,tabIndex:i.number,disabled:i.bool,vertical:i.bool,id:i.string,ariaDescribedBy:i.string,ariaLabelledBy:i.string,ariaLabel:i.string,dir:i.oneOf(["ltr","rtl"]),children:i.node};F.registerForLocalization(T);exports.Slider=B;exports.SliderPropsContext=_;exports.SliderWithoutContext=T;
package/slider/Slider.mjs CHANGED
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import * as l 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
- import * as i from "prop-types";
10
+ import i from "prop-types";
11
11
  import { withPropsContext as ue, dispatchEvent as fe, Keys as s, 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
13
  import { sliderDragTitle as H, messages as A, sliderDecreaseValue as O, sliderIncreaseValue as X } from "../messages/index.mjs";
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"),Y=require("prop-types"),i=require("@progress/kendo-react-common"),Z=require("@progress/kendo-react-intl"),N=require("../messages/index.js");function z(e){const m=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const h=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(m,s,h.get?h:{enumerable:!0,get:()=>e[s]})}}return m.default=e,Object.freeze(m)}const d=z(n),a=z(Y),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,m)=>{var F;const{disabled:s=l.disabled,defaultChecked:h=l.defaultChecked,size:C=l.size,trackRounded:w=l.trackRounded,thumbRounded:R=l.thumbRounded,offLabel:O=l.offLabel,onBlur:S=l.onBlur,onFocus:M=l.onFocus,onLabel:T=l.onLabel}=e,[I,V]=n.useState(h||!1),[_,P]=n.useState(!1),o=n.useRef(null),u=n.useRef(null),E=n.useRef(null),v=n.useRef(void 0),q=n.useRef(void 0),B=n.useRef(void 0),D=n.useMemo(()=>new Z.LocalizationService,[]),c=n.useMemo(()=>v.current!==void 0?v.current:e.checked!==void 0?e.checked:I,[e.checked,I]),b=n.useMemo(()=>{var g,K;const t=e.validationMessage!==void 0,r=(g=e.valid)!=null?g: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(b.valid?"":e.validationMessage||D.toLanguageString(N.switchValidation,N.messages[N.switchValidation]))},[b,e.validationMessage,D]),n.useEffect(()=>{o.current&&(B.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 b}}),[e,c,b]),f=n.useCallback((t,r)=>{V(t),v.current=t,i.dispatchEvent(e.onChange,r,{...k(),value:t},{value:t}),v.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 g={target:u.current,currentTarget:u.current,nativeEvent:new Event("change",{bubbles:!0})};f(y,g)}}});return()=>{r==null||r.unsubscribe()}},[e.name,e.id,c,f]);const H=n.useCallback(t=>{q.current!==t.timeStamp&&(q.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]),A=n.useCallback(t=>{s||(P(!0),M&&M(t))},[s,M]),G=n.useCallback(t=>{s||(P(!1),S&&S(t))},[s,S]);n.useImperativeHandle(m,k,[k]);const J=B.current||e.dir||o.current&&getComputedStyle(o.current).direction||void 0,Q=!W||b.valid,U=i.classNames("k-switch",{[`k-switch-${i.kendoThemeMaps.sizeMap[C]||C}`]:C,"k-switch-on":c,"k-switch-off":!c,"k-focus":_,"k-disabled":s,"k-invalid":!Q},e.className),X=d.createElement("input",{type:"checkbox",checked:e.checked,ref:E,tabIndex:-1,"aria-hidden":!0,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:U,dir:J,onKeyDown:$,onClick:H,onBlur:G,onFocus:A,tabIndex:i.getTabIndex(e.tabIndex,s,void 0),accessKey:e.accessKey,id:e.id},d.createElement("span",{className:i.classNames("k-switch-track",{[`k-rounded-${i.kendoThemeMaps.roundedMap[w]||w}`]:w}),ref:o},X,T?d.createElement("span",{className:"k-switch-label-on"},T):"",O?d.createElement("span",{className:"k-switch-label-off"},O):""),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 j=i.createPropsContext(),L=i.withIdHOC(i.withPropsContext(j,x));L.displayName="KendoReactSwitch";L.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=L;exports.SwitchPropsContext=j;exports.SwitchWithoutContext=x;
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"),N=require("../messages/index.js");function Y(e){const m=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const h=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(m,s,h.get?h:{enumerable:!0,get:()=>e[s]})}}return m.default=e,Object.freeze(m)}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,m)=>{var F;const{disabled:s=l.disabled,defaultChecked:h=l.defaultChecked,size:C=l.size,trackRounded:w=l.trackRounded,thumbRounded:R=l.thumbRounded,offLabel:O=l.offLabel,onBlur:S=l.onBlur,onFocus:M=l.onFocus,onLabel:I=l.onLabel}=e,[T,j]=n.useState(h||!1),[V,q]=n.useState(!1),o=n.useRef(null),u=n.useRef(null),E=n.useRef(null),v=n.useRef(void 0),B=n.useRef(void 0),D=n.useRef(void 0),P=n.useMemo(()=>new X.LocalizationService,[]),c=n.useMemo(()=>v.current!==void 0?v.current:e.checked!==void 0?e.checked:T,[e.checked,T]),b=n.useMemo(()=>{var g,K;const t=e.validationMessage!==void 0,r=(g=e.valid)!=null?g: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(b.valid?"":e.validationMessage||P.toLanguageString(N.switchValidation,N.messages[N.switchValidation]))},[b,e.validationMessage,P]),n.useEffect(()=>{o.current&&(D.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 b}}),[e,c,b]),f=n.useCallback((t,r)=>{j(t),v.current=t,i.dispatchEvent(e.onChange,r,{...k(),value:t},{value:t}),v.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 g={target:u.current,currentTarget:u.current,nativeEvent:new Event("change",{bubbles:!0})};f(y,g)}}});return()=>{r==null||r.unsubscribe()}},[e.name,e.id,c,f]);const H=n.useCallback(t=>{B.current!==t.timeStamp&&(B.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||(q(!0),M&&M(t))},[s,M]),A=n.useCallback(t=>{s||(q(!1),S&&S(t))},[s,S]);n.useImperativeHandle(m,k,[k]);const G=D.current||e.dir||o.current&&getComputedStyle(o.current).direction||void 0,J=!W||b.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,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[w]||w}`]:w}),ref:o},U,I?d.createElement("span",{className:"k-switch-label-on"},I):"",O?d.createElement("span",{className:"k-switch-label-off"},O):""),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(),L=i.withIdHOC(i.withPropsContext(z,x));L.displayName="KendoReactSwitch";L.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=L;exports.SwitchPropsContext=z;exports.SwitchWithoutContext=x;
package/switch/Switch.mjs CHANGED
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import * as d from "react";
9
9
  import { useState as q, useRef as u, useMemo as E, useEffect as L, useCallback as m, useImperativeHandle as ae } from "react";
10
- import * as a from "prop-types";
10
+ import a from "prop-types";
11
11
  import { withIdHOC as ne, withPropsContext as ie, noop as M, dispatchEvent as re, subscribeToKendoPaste as ce, Keys as V, classNames as N, kendoThemeMaps as x, getTabIndex as de, createPropsContext as le } from "@progress/kendo-react-common";
12
12
  import { LocalizationService as oe } from "@progress/kendo-react-intl";
13
13
  import { switchValidation as H, messages as se } from "../messages/index.mjs";
@@ -13,19 +13,19 @@ const Pe = ze(), K = a.forwardRef((L, j) => {
13
13
  size: b = i.size,
14
14
  rounded: p = i.rounded,
15
15
  fillMode: P = i.fillMode,
16
- autoFocus: _ = i.autoFocus,
16
+ autoFocus: G = i.autoFocus,
17
17
  flow: x = i.flow,
18
- prefix: G = null,
19
- suffix: J = null,
20
- ariaDescribedBy: Q,
21
- ariaLabelledBy: U,
18
+ prefix: J = null,
19
+ suffix: Q = null,
20
+ ariaDescribedBy: U,
21
+ ariaLabelledBy: W,
22
22
  autoSize: c,
23
- className: W,
24
- defaultValue: X,
23
+ className: X,
24
+ defaultValue: Y,
25
25
  disabled: o,
26
- readOnly: Y,
26
+ readOnly: Z,
27
27
  required: d,
28
- rows: Z,
28
+ rows: _,
29
29
  id: w,
30
30
  name: F,
31
31
  placeholder: ee,
@@ -50,7 +50,7 @@ const Pe = ze(), K = a.forwardRef((L, j) => {
50
50
  t.current && t.current.focus();
51
51
  }, []), O = a.useCallback(() => {
52
52
  t.current && t.current.blur();
53
- }, []), [B, M] = a.useState(X), [ne, A] = a.useState(!1), [se, le] = $(G), [ie, ue] = $(J), f = v !== void 0, m = f ? v : B, N = F || w, n = a.useCallback(() => ({
53
+ }, []), [B, M] = a.useState(Y), [ne, A] = a.useState(!1), [se, le] = $(J), [ie, ue] = $(Q), f = v !== void 0, m = f ? v : B, N = F || w, n = a.useCallback(() => ({
54
54
  element: t,
55
55
  focus: I,
56
56
  blur: O,
@@ -129,15 +129,15 @@ const Pe = ze(), K = a.forwardRef((L, j) => {
129
129
  }),
130
130
  ref: t,
131
131
  disabled: o,
132
- rows: Z,
132
+ rows: _,
133
133
  placeholder: ee,
134
- readOnly: Y,
134
+ readOnly: Z,
135
135
  required: d,
136
136
  tabIndex: Ce(ae, o),
137
- autoFocus: _,
137
+ autoFocus: G,
138
138
  style: pe,
139
- "aria-labelledby": U,
140
- "aria-describedby": Q,
139
+ "aria-labelledby": W,
140
+ "aria-describedby": U,
141
141
  "aria-multiline": !0,
142
142
  "aria-disabled": o || void 0,
143
143
  "aria-required": d,
@@ -164,7 +164,7 @@ const Pe = ze(), K = a.forwardRef((L, j) => {
164
164
  "!k-flex-col": x === "vertical",
165
165
  "!k-flex-row": x === "horizontal"
166
166
  },
167
- W
167
+ X
168
168
  ),
169
169
  style: te,
170
170
  dir: de
@@ -8,8 +8,8 @@
8
8
  import * as t from "react";
9
9
  import o from "prop-types";
10
10
  import { useUnstyled as V, useCustomComponent as g, useKendoPaste as w, useAsyncFocusBlur as D, classNames as h, kendoThemeMaps as C, uTextBox as G } from "@progress/kendo-react-common";
11
- const _ = t.forwardRef((e, k) => {
12
- const u = t.useRef(null), i = t.useRef(null), l = t.useRef(void 0), f = V(), y = f && f.uTextBox, b = t.useCallback(() => {
11
+ const k = t.forwardRef((e, y) => {
12
+ const u = t.useRef(null), i = t.useRef(null), l = t.useRef(void 0), f = V(), b = f && f.uTextBox, B = t.useCallback(() => {
13
13
  var n;
14
14
  return l.current !== void 0 ? l.current : (n = u.current) == null ? void 0 : n.value;
15
15
  }, []);
@@ -21,15 +21,15 @@ const _ = t.forwardRef((e, k) => {
21
21
  return u.current && u.current.name;
22
22
  },
23
23
  get value() {
24
- return b();
24
+ return B();
25
25
  }
26
- })), t.useImperativeHandle(k, () => i.current);
26
+ })), t.useImperativeHandle(y, () => i.current);
27
27
  const {
28
28
  size: r = a.size,
29
29
  fillMode: c = a.fillMode,
30
30
  rounded: s = a.rounded,
31
- autoFocus: B = a.autoFocus,
32
- inputAttributes: F,
31
+ autoFocus: F = a.autoFocus,
32
+ inputAttributes: _,
33
33
  className: m,
34
34
  dir: M,
35
35
  style: E,
@@ -101,9 +101,9 @@ const _ = t.forwardRef((e, k) => {
101
101
  "input",
102
102
  {
103
103
  ref: u,
104
- className: h(G.inputInner({ c: y })),
105
- autoFocus: B,
106
- ...Object.assign({}, R, F),
104
+ className: h(G.inputInner({ c: b })),
105
+ autoFocus: F,
106
+ ...Object.assign({}, R, _),
107
107
  "aria-required": e.required,
108
108
  onChange: d
109
109
  }
@@ -116,14 +116,14 @@ const _ = t.forwardRef((e, k) => {
116
116
  fillMode: void 0,
117
117
  autoFocus: !1
118
118
  };
119
- _.propTypes = {
119
+ k.propTypes = {
120
120
  size: o.oneOf(["small", "medium", "large"]),
121
121
  rounded: o.oneOf(["small", "medium", "large", "full", "none"]),
122
122
  fillMode: o.oneOf(["solid", "flat", "outline"]),
123
123
  autoFocus: o.bool,
124
124
  inputAttributes: o.object
125
125
  };
126
- _.displayName = "KendoReactTextBoxComponent";
126
+ k.displayName = "KendoReactTextBoxComponent";
127
127
  export {
128
- _ as TextBox
128
+ k as TextBox
129
129
  };