@progress/kendo-react-inputs 13.4.0-develop.2 → 13.4.0-develop.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/checkbox/Checkbox.js +1 -1
  2. package/checkbox/Checkbox.mjs +23 -23
  3. package/checkbox/interfaces/CheckboxProps.d.ts +1 -1
  4. package/colors/ColorGradient.mjs +4 -4
  5. package/colors/ColorInput.d.ts +1 -1
  6. package/colors/ColorPicker.js +1 -1
  7. package/colors/ColorPicker.mjs +12 -12
  8. package/colors/FlatColorPicker.d.ts +1 -1
  9. package/colors/FlatColorPicker.mjs +11 -11
  10. package/colors/HexInput.d.ts +1 -1
  11. package/colors/interfaces/ColorGradientProps.d.ts +1 -1
  12. package/colors/interfaces/ColorPickerProps.d.ts +1 -1
  13. package/dist/cdn/js/kendo-react-inputs.js +1 -1
  14. package/index.d.mts +1 -1
  15. package/index.d.ts +1 -1
  16. package/input/Input.mjs +13 -13
  17. package/maskedtextbox/MaskedTextBox.d.ts +1 -1
  18. package/maskedtextbox/MaskedTextBox.js +1 -1
  19. package/maskedtextbox/MaskedTextBox.mjs +15 -15
  20. package/maskedtextbox/MaskedTextBoxProps.d.ts +1 -1
  21. package/numerictextbox/NumericTextBox.js +1 -1
  22. package/numerictextbox/NumericTextBox.mjs +40 -40
  23. package/numerictextbox/interfaces/NumericTextBoxProps.d.ts +1 -1
  24. package/package-metadata.js +1 -1
  25. package/package-metadata.mjs +1 -1
  26. package/package.json +10 -10
  27. package/radiobutton/RadioButton.mjs +18 -18
  28. package/radiobutton/RadioGroup.mjs +15 -15
  29. package/range-slider/RangeSlider.mjs +15 -15
  30. package/rating/Rating.mjs +12 -12
  31. package/rating/RatingItem.mjs +4 -4
  32. package/signature/Signature.js +1 -1
  33. package/signature/Signature.mjs +13 -13
  34. package/signature/interfaces/SignatureProps.d.ts +1 -1
  35. package/slider/Slider.d.ts +12 -78
  36. package/slider/Slider.js +1 -1
  37. package/slider/Slider.mjs +241 -191
  38. package/switch/Switch.d.ts +11 -126
  39. package/switch/Switch.js +1 -1
  40. package/switch/Switch.mjs +187 -209
  41. package/textarea/TextArea.js +1 -1
  42. package/textarea/TextArea.mjs +21 -21
  43. package/textarea/interfaces/TextAreaProps.d.ts +1 -1
  44. package/textbox/Textbox.d.ts +2 -1
  45. package/textbox/Textbox.js +1 -1
  46. package/textbox/Textbox.mjs +19 -19
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"),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;
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;
package/slider/Slider.mjs CHANGED
@@ -5,216 +5,266 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import * as i from "react";
9
- import a from "prop-types";
10
- import { withPropsContext as y, createPropsContext as w, Keys as n, classNames as S, Draggable as x, getTabIndex as T, dispatchEvent as E } from "@progress/kendo-react-common";
11
- import { provideLocalizationService as D, registerForLocalization as C } from "@progress/kendo-react-intl";
12
- import { sliderDecreaseValue as d, messages as h, sliderIncreaseValue as m, sliderDragTitle as u } from "../messages/index.mjs";
13
- import { SLIDER_LABEL_ATTRIBUTE as I } from "./SliderLabel.mjs";
14
- import { Button as v } from "@progress/kendo-react-buttons";
15
- import { caretAltUpIcon as g, caretAltLeftIcon as f, caretAltRightIcon as b, caretAltDownIcon as k } from "@progress/kendo-svg-icons";
16
- const p = class p extends i.Component {
17
- constructor(s) {
18
- super(s), this.state = {
19
- value: this.props.defaultValue === void 0 ? this.props.min : this.props.defaultValue,
20
- focused: !1,
21
- dir: this.props.dir
22
- }, this._sliderTrack = null, this._element = null, this.buttons = (t) => {
23
- if (!t.enabled)
24
- return t.children;
25
- const e = this.state.dir === "rtl" ? this.props.vertical ? g : f : this.props.vertical ? g : b, l = this.state.dir === "rtl" ? this.props.vertical ? k : b : this.props.vertical ? k : f, r = this.state.dir === "rtl" ? this.props.vertical ? "caret-alt-up" : "caret-alt-left" : this.props.vertical ? "caret-alt-up" : "caret-alt-right", o = this.state.dir === "rtl" ? this.props.vertical ? "caret-alt-down" : "caret-alt-right" : this.props.vertical ? "caret-alt-down" : "caret-alt-left";
26
- return /* @__PURE__ */ i.createElement(i.Fragment, null, /* @__PURE__ */ i.createElement(
27
- v,
8
+ import * as l from "react";
9
+ import { useState as L, useRef as R, useMemo as N, useEffect as q, useCallback as o, useImperativeHandle as me } from "react";
10
+ import * as i from "prop-types";
11
+ import { withPropsContext as ue, createPropsContext as fe, dispatchEvent as ge, Keys as s, classNames as ve, Draggable as he, getTabIndex as be } from "@progress/kendo-react-common";
12
+ import { LocalizationService as ye, registerForLocalization as ke } from "@progress/kendo-react-intl";
13
+ import { sliderDragTitle as H, messages as A, sliderDecreaseValue as O, sliderIncreaseValue as X } from "../messages/index.mjs";
14
+ import { SLIDER_LABEL_ATTRIBUTE as xe } from "./SliderLabel.mjs";
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";
17
+ const f = {
18
+ step: 1,
19
+ largeStep: 10,
20
+ buttons: !1,
21
+ vertical: !1,
22
+ disabled: !1,
23
+ tabIndex: 0
24
+ }, z = l.forwardRef((t, P) => {
25
+ var M, K, U;
26
+ const {
27
+ step: m = f.step,
28
+ largeStep: w = f.largeStep,
29
+ vertical: a = f.vertical,
30
+ disabled: C = f.disabled,
31
+ tabIndex: Q = f.tabIndex
32
+ } = t, [Z, $] = L((M = t.defaultValue) != null ? M : t.min), [p, B] = L(!1), [I, ee] = L(t.dir), E = R(null), g = R(null), T = N(() => new ye(), []), V = R(null), D = t.value !== void 0, y = D && t.value !== void 0 ? t.value : Z, r = N(() => {
33
+ const { min: e, max: n } = t;
34
+ return y < e ? e : y > n ? n : y;
35
+ }, [y, t.min, t.max]), v = N(() => {
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]), u = (K = t.dir) != null ? K : I;
39
+ q(() => {
40
+ if (t.dir === void 0 && g.current) {
41
+ const n = window.getComputedStyle(g.current).direction;
42
+ n !== I && ee(n);
43
+ }
44
+ }, [t.dir, I]);
45
+ const F = o((e) => {
46
+ let n = e;
47
+ for (; n; ) {
48
+ if (n.getAttribute(xe))
49
+ return !0;
50
+ n = n.parentElement;
51
+ }
52
+ return !1;
53
+ }, []), d = o(
54
+ (e, n) => {
55
+ const c = Math.min(Math.max(n, t.min), t.max);
56
+ D || $(c), ge(t.onChange, e, V.current, { value: c });
57
+ },
58
+ [t.min, t.max, t.onChange, D]
59
+ ), te = o(() => {
60
+ B(!0);
61
+ }, []), ne = o(() => {
62
+ B(!1);
63
+ }, []), ae = o(
64
+ (e) => {
65
+ let n;
66
+ e.keyCode === s.left || e.keyCode === s.down ? n = r - (m || 0) : e.keyCode === s.right || e.keyCode === s.up ? n = r + (m || 0) : e.keyCode === s.pageDown ? n = r - (w || 0) : e.keyCode === s.pageUp ? n = r + (w || 0) : e.keyCode === s.home ? n = t.min : e.keyCode === s.end && (n = t.max), n !== void 0 && (e.preventDefault(), d(e, n));
67
+ },
68
+ [r, m, w, t.min, t.max, d]
69
+ ), ie = o(
70
+ (e) => {
71
+ e.preventDefault(), d(e, r - (m || 0));
72
+ },
73
+ [r, m, d]
74
+ ), le = o(
75
+ (e) => {
76
+ e.preventDefault(), d(e, r + (m || 0));
77
+ },
78
+ [r, m, d]
79
+ ), k = o(
80
+ (e) => {
81
+ const n = e.element.getBoundingClientRect();
82
+ let c;
83
+ a ? c = n.bottom - e.event.clientY : c = u === "rtl" ? n.right - e.event.clientX : e.event.clientX - n.left;
84
+ const h = a ? n.height : n.width, b = c / h;
85
+ d(e, t.min + b * (t.max - t.min));
86
+ },
87
+ [a, t.min, t.max, u, d]
88
+ ), re = o(
89
+ (e) => {
90
+ F(e.event.originalEvent.target) || (e.event.isTouch && e.event.originalEvent.preventDefault(), k(e));
91
+ },
92
+ [F, k]
93
+ ), ce = o(
94
+ (e) => {
95
+ e.event.originalEvent.preventDefault(), k(e);
96
+ },
97
+ [k]
98
+ ), x = o(() => {
99
+ g.current && g.current.focus();
100
+ }, []), oe = o(
101
+ (e) => {
102
+ if (!e.enabled)
103
+ return e.children;
104
+ let n, c, h, b;
105
+ return u === "rtl" ? (n = a ? j : G, c = a ? W : Y, h = a ? "caret-alt-up" : "caret-alt-left", b = a ? "caret-alt-down" : "caret-alt-right") : (n = a ? j : Y, c = a ? W : G, h = a ? "caret-alt-up" : "caret-alt-right", b = a ? "caret-alt-down" : "caret-alt-left"), /* @__PURE__ */ l.createElement(l.Fragment, null, /* @__PURE__ */ l.createElement(
106
+ _,
28
107
  {
29
108
  className: "k-button-decrease",
30
109
  rounded: "full",
31
- icon: o,
32
- svgIcon: l,
33
- title: t.decrementTitle,
34
- onClick: t.decrement
110
+ icon: b,
111
+ svgIcon: c,
112
+ title: e.decrementTitle,
113
+ onClick: e.decrement
35
114
  }
36
- ), t.children, /* @__PURE__ */ i.createElement(
37
- v,
115
+ ), e.children, /* @__PURE__ */ l.createElement(
116
+ _,
38
117
  {
39
118
  className: "k-button-increase",
40
119
  rounded: "full",
41
- icon: r,
42
- svgIcon: e,
43
- title: t.incrementTitle,
44
- onClick: t.increment
120
+ icon: h,
121
+ svgIcon: n,
122
+ title: e.incrementTitle,
123
+ onClick: e.increment
45
124
  }
46
125
  ));
47
- }, this.focus = () => {
48
- this._element && this._element.focus();
49
- }, this.isLabel = (t) => {
50
- let e = t;
51
- for (; e; ) {
52
- if (e.getAttribute(I))
53
- return !0;
54
- e = e.parentElement;
55
- }
56
- return !1;
57
- }, this.onFocus = () => {
58
- this.setState({ focused: !0 });
59
- }, this.onBlur = () => {
60
- this.setState({ focused: !1 });
61
- }, this.onKeyDown = (t) => {
62
- let e;
63
- t.keyCode === n.left || t.keyCode === n.down ? e = this.state.value - (this.props.step || 0) : t.keyCode === n.right || t.keyCode === n.up ? e = this.state.value + (this.props.step || 0) : t.keyCode === n.pageDown ? e = this.state.value - (this.props.largeStep || 0) : t.keyCode === n.pageUp ? e = this.state.value + (this.props.largeStep || 0) : t.keyCode === n.home ? e = this.props.min : t.keyCode === n.end && (e = this.props.max), e !== void 0 && (t.preventDefault(), this.change(t, e));
64
- }, this.decrement = (t) => {
65
- t.preventDefault(), this.change(t, this.state.value - (this.props.step || 0));
66
- }, this.increment = (t) => {
67
- t.preventDefault(), this.change(t, this.state.value + (this.props.step || 0));
68
- }, this.dragStart = (t) => {
69
- this.isLabel(t.event.originalEvent.target) || (t.event.isTouch && t.event.originalEvent.preventDefault(), this.drag(t));
70
- }, this.dragOver = (t) => {
71
- t.event.originalEvent.preventDefault(), this.drag(t);
72
- }, this.drag = (t) => {
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;
74
- this.change(t, this.props.min + o * (this.props.max - this.props.min));
126
+ },
127
+ [u, a]
128
+ );
129
+ me(
130
+ P,
131
+ () => ({
132
+ props: t,
133
+ sliderTrack: E.current,
134
+ focus: x
135
+ }),
136
+ [t, x]
137
+ ), q(() => {
138
+ V.current = {
139
+ props: t,
140
+ sliderTrack: E.current,
141
+ focus: x
75
142
  };
76
- }
77
- /**
78
- * @hidden
79
- */
80
- static getDerivedStateFromProps(s, t) {
81
- const e = s.value !== void 0 ? s.value : t.value, { min: l, max: r } = s;
82
- return e === void 0 ? null : { value: Math.min(Math.max(e, l), r) };
83
- }
84
- /**
85
- * @hidden
86
- */
87
- componentDidMount() {
88
- if (!this.state.dir && window && this._element) {
89
- const s = window.getComputedStyle(this._element).direction;
90
- s && this.setState({ dir: s });
91
- }
92
- }
93
- /**
94
- * @hidden
95
- */
96
- render() {
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%" } : {};
98
- return /* @__PURE__ */ i.createElement(
99
- "div",
100
- {
101
- ref: (r) => {
102
- this._element = r;
143
+ }, [t, x]);
144
+ const de = a ? { marginTop: "0.5rem", marginBottom: "0.5rem" } : { marginLeft: "0.5rem", marginRight: "0.5rem" }, se = a ? { paddingTop: 0, height: "100%" } : {};
145
+ let S;
146
+ return a ? S = { bottom: "calc(" + v + "%)", zIndex: 1 } : u === "rtl" ? S = { right: "calc(" + v + "% - 13px)", zIndex: 1 } : S = { left: "calc(" + v + "%)", zIndex: 1 }, /* @__PURE__ */ l.createElement(
147
+ "div",
148
+ {
149
+ ref: g,
150
+ dir: u,
151
+ id: t.id,
152
+ style: { gap: 0, ...t.style },
153
+ onFocus: te,
154
+ onBlur: ne,
155
+ onKeyDown: ae,
156
+ className: ve(
157
+ "k-slider",
158
+ {
159
+ "k-focus": p,
160
+ "k-disabled": C,
161
+ "k-slider-horizontal": !a,
162
+ "k-slider-vertical": a
103
163
  },
104
- dir: this.state.dir,
105
- id: this.props.id,
106
- style: { gap: 0, ...this.props.style },
107
- onFocus: this.onFocus,
108
- onBlur: this.onBlur,
109
- onKeyDown: this.onKeyDown,
110
- className: S(
111
- "k-slider",
112
- {
113
- "k-focus": this.state.focused,
114
- "k-disabled": this.props.disabled,
115
- "k-slider-horizontal": !this.props.vertical,
116
- "k-slider-vertical": this.props.vertical
117
- },
118
- this.props.className
119
- )
120
- },
121
- /* @__PURE__ */ i.createElement(
122
- this.buttons,
164
+ t.className
165
+ )
166
+ },
167
+ oe({
168
+ enabled: (U = t.buttons) != null ? U : f.buttons,
169
+ decrement: ie,
170
+ increment: le,
171
+ incrementTitle: T.toLanguageString(
172
+ X,
173
+ A[X]
174
+ ),
175
+ decrementTitle: T.toLanguageString(
176
+ O,
177
+ A[O]
178
+ ),
179
+ children: /* @__PURE__ */ l.createElement(he, { onDrag: ce, onPress: re, autoScroll: !1 }, /* @__PURE__ */ l.createElement(
180
+ "div",
123
181
  {
124
- enabled: this.props.buttons,
125
- decrement: this.decrement,
126
- increment: this.increment,
127
- incrementTitle: s.toLanguageString(m, h[m]),
128
- decrementTitle: s.toLanguageString(d, h[d])
182
+ className: "k-slider-track-wrap",
183
+ style: {
184
+ flexGrow: 1,
185
+ position: "relative",
186
+ touchAction: "none",
187
+ ...de
188
+ }
129
189
  },
130
- /* @__PURE__ */ i.createElement(x, { onDrag: this.dragOver, onPress: this.dragStart, autoScroll: !1 }, /* @__PURE__ */ i.createElement(
190
+ 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(
191
+ e,
192
+ {
193
+ position: 100 * (e.props.position - t.min) / (t.max - t.min),
194
+ vertical: a,
195
+ firstTick: n === 0,
196
+ lastTick: n === l.Children.count(t.children) - 1
197
+ },
198
+ e.props.children
199
+ ))),
200
+ /* @__PURE__ */ l.createElement(
131
201
  "div",
132
202
  {
133
- className: "k-slider-track-wrap",
134
- style: {
135
- flexGrow: 1,
136
- position: "relative",
137
- touchAction: "none",
138
- ...e
139
- }
203
+ className: "k-slider-track",
204
+ style: a ? { bottom: 0, height: "100%" } : { [u === "rtl" ? "right" : "left"]: 0, width: "100%" },
205
+ ref: E
140
206
  },
141
- this.props.children && /* @__PURE__ */ i.createElement("ul", { className: "k-reset k-slider-items", style: { margin: 0, ...l } }, i.Children.map(this.props.children, (r, o) => r && i.cloneElement(
142
- r,
143
- {
144
- position: 100 * (r.props.position - this.props.min) / (this.props.max - this.props.min),
145
- vertical: this.props.vertical,
146
- firstTick: o === 0,
147
- lastTick: o === i.Children.count(this.props.children) - 1
148
- },
149
- r.props.children
150
- ))),
151
- /* @__PURE__ */ i.createElement(
207
+ /* @__PURE__ */ l.createElement(
152
208
  "div",
153
209
  {
154
- className: "k-slider-track",
155
- style: this.props.vertical ? { bottom: 0, height: "100%" } : { [this.state.dir === "rtl" ? "right" : "left"]: 0, width: "100%" },
156
- ref: (r) => {
157
- this._sliderTrack = r;
158
- }
159
- },
160
- /* @__PURE__ */ i.createElement(
161
- "div",
162
- {
163
- className: "k-slider-selection",
164
- style: this.props.vertical ? { height: t + "%" } : { width: t + "%" }
165
- }
166
- ),
167
- /* @__PURE__ */ i.createElement(
168
- "span",
169
- {
170
- role: "slider",
171
- "aria-valuemin": this.props.min,
172
- "aria-valuemax": this.props.max,
173
- "aria-valuenow": this.state.value,
174
- "aria-valuetext": String(this.state.value),
175
- "aria-orientation": this.props.vertical ? "vertical" : void 0,
176
- "aria-disabled": this.props.disabled ? "true" : void 0,
177
- "aria-labelledby": this.props.ariaLabelledBy,
178
- "aria-describedby": this.props.ariaDescribedBy,
179
- "aria-label": this.props.ariaLabel,
180
- tabIndex: T(this.props.tabIndex, this.props.disabled, void 0),
181
- className: "k-draghandle k-draghandle-end",
182
- title: s.toLanguageString(u, h[u]),
183
- style: this.props.vertical ? { bottom: "calc(" + t + "%)", zIndex: 1 } : this.state.dir === "rtl" ? { right: "calc(" + t + "% - 13px)", zIndex: 1 } : { left: "calc(" + t + "%)", zIndex: 1 }
184
- }
185
- )
210
+ className: "k-slider-selection",
211
+ style: a ? { height: v + "%" } : { width: v + "%" }
212
+ }
213
+ ),
214
+ /* @__PURE__ */ l.createElement(
215
+ "span",
216
+ {
217
+ role: "slider",
218
+ "aria-valuemin": t.min,
219
+ "aria-valuemax": t.max,
220
+ "aria-valuenow": r,
221
+ "aria-valuetext": String(r),
222
+ "aria-orientation": a ? "vertical" : void 0,
223
+ "aria-disabled": C ? "true" : void 0,
224
+ "aria-labelledby": t.ariaLabelledBy,
225
+ "aria-describedby": t.ariaDescribedBy,
226
+ "aria-label": t.ariaLabel,
227
+ tabIndex: be(Q, C, void 0),
228
+ className: "k-draghandle k-draghandle-end",
229
+ title: T.toLanguageString(
230
+ H,
231
+ A[H]
232
+ ),
233
+ style: S
234
+ }
186
235
  )
187
- ))
188
- )
189
- );
190
- }
191
- /**
192
- * @hidden
193
- */
194
- get sliderTrack() {
195
- return this._sliderTrack;
196
- }
197
- change(s, t) {
198
- t = Math.min(Math.max(t, this.props.min), this.props.max), this.setState({ value: t }), E(this.props.onChange, s, this, { value: t });
199
- }
200
- };
201
- p.displayName = "Slider", p.propTypes = {
202
- min: a.number.isRequired,
203
- max: a.number.isRequired,
204
- value: a.number,
205
- vertical: a.bool,
206
- id: a.string,
207
- ariaLabelledBy: a.string,
208
- ariaDescribedBy: a.string,
209
- ariaLabel: a.string
210
- // TODO: validation when buttons is set to true, but no step is provided
236
+ )
237
+ ))
238
+ })
239
+ );
240
+ });
241
+ z.displayName = "Slider";
242
+ const Se = fe(), J = ue(Se, z);
243
+ J.displayName = "KendoReactSlider";
244
+ J.propTypes = {
245
+ value: i.number,
246
+ defaultValue: i.number,
247
+ min: i.number.isRequired,
248
+ max: i.number.isRequired,
249
+ step: i.number,
250
+ largeStep: i.number,
251
+ onChange: i.func,
252
+ style: i.object,
253
+ className: i.string,
254
+ buttons: i.bool,
255
+ tabIndex: i.number,
256
+ disabled: i.bool,
257
+ vertical: i.bool,
258
+ id: i.string,
259
+ ariaDescribedBy: i.string,
260
+ ariaLabelledBy: i.string,
261
+ ariaLabel: i.string,
262
+ dir: i.oneOf(["ltr", "rtl"]),
263
+ children: i.node
211
264
  };
212
- let c = p;
213
- const L = w(), A = y(L, c);
214
- A.displayName = "KendoReactSlider";
215
- C(c);
265
+ ke(z);
216
266
  export {
217
- A as Slider,
218
- L as SliderPropsContext,
219
- c as SliderWithoutContext
267
+ J as Slider,
268
+ Se as SliderPropsContext,
269
+ z as SliderWithoutContext
220
270
  };