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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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"),u=require("../messages/index.js");function N(d){const a=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(a,e,t.get?t:{enumerable:!0,get:()=>d[e]})}}return a.default=d,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(u.switchValidation,u.messages[u.switchValidation]))},this.limit=(e,t,h)=>{const o=h.offsetWidth,l=t.offsetWidth;return e<0?0:e>o-l?o-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)},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:h,thumbRounded:o,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:p=>{this._wrapper=p},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[h]||h}`]:h}),ref:p=>{this._element=p}},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-${s.kendoThemeMaps.roundedMap[o]||o}`]:o})})))}};n.displayName="Switch",n.propTypes={accessKey:i.string,checked:i.bool,className:i.string,disabled:i.bool,defaultChecked:i.bool,size:i.oneOf(["small","medium","large"]),trackRounded:i.oneOf(["small","medium","large","full"]),thumbRounded:i.oneOf(["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:void 0,trackRounded:void 0,thumbRounded:void 0,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 n=require("react"),X=require("prop-types"),i=require("@progress/kendo-react-common"),Y=require("@progress/kendo-react-intl"),S=require("../messages/index.js");function z(e){const u=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const c in e)if(c!=="default"){const m=Object.getOwnPropertyDescriptor(e,c);Object.defineProperty(u,c,m.get?m:{enumerable:!0,get:()=>e[c]})}}return u.default=e,Object.freeze(u)}const d=z(n),t=z(X),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},M=d.forwardRef((e,u)=>{var P;const{disabled:c=l.disabled,defaultChecked:m=l.defaultChecked,size:v=l.size,trackRounded:y=l.trackRounded,thumbRounded:g=l.thumbRounded,offLabel:x=l.offLabel,onBlur:C=l.onBlur,onFocus:w=l.onFocus,onLabel:L=l.onLabel}=e,[E,j]=n.useState(m||!1),[V,O]=n.useState(!1),o=n.useRef(null),I=n.useRef(null),R=n.useRef(null),b=n.useRef(void 0),q=n.useRef(void 0),B=n.useRef(void 0),D=n.useMemo(()=>new Y.LocalizationService,[]),s=n.useMemo(()=>b.current!==void 0?b.current:e.checked!==void 0?e.checked:E,[e.checked,E]),f=n.useMemo(()=>{var T,F;const a=e.validationMessage!==void 0,r=(T=e.valid)!=null?T:e.required?!!s:!0,U=(F=e.valid)!=null?F:r;return{customError:a,valid:U,valueMissing:s===null}},[e.valid,e.validationMessage,e.required,s]),_=(P=e.validityStyles)!=null?P:l.validityStyles;n.useEffect(()=>{var a;(a=R.current)!=null&&a.setCustomValidity&&R.current.setCustomValidity(f.valid?"":e.validationMessage||D.toLanguageString(S.switchValidation,S.messages[S.switchValidation]))},[f,e.validationMessage,D]),n.useEffect(()=>{o.current&&(B.current=e.dir||getComputedStyle(o.current).direction||void 0)},[e.dir]);const h=n.useCallback(()=>({props:e,get element(){return o.current},get actionElement(){return I.current},get value(){return s},get name(){return e.name},get validity(){return f}}),[e,s,f]),k=n.useCallback((a,r)=>{j(a),b.current=a,i.dispatchEvent(e.onChange,r,{...h(),value:a},{value:a}),b.current=void 0},[e.onChange,h]),W=n.useCallback(a=>{q.current!==a.timeStamp&&(q.current=a.timeStamp,k(!s,a))},[s,k]),H=n.useCallback(a=>{if(c)return;const{keyCode:r}=a;(r===i.Keys.space||r===i.Keys.enter)&&(k(!s,a),a.preventDefault())},[c,s,k]),$=n.useCallback(a=>{c||(O(!0),w&&w(a))},[c,w]),p=n.useCallback(a=>{c||(O(!1),C&&C(a))},[c,C]);n.useImperativeHandle(u,h,[h]);const A=B.current||e.dir||o.current&&getComputedStyle(o.current).direction||void 0,G=!_||f.valid,J=i.classNames("k-switch",{[`k-switch-${i.kendoThemeMaps.sizeMap[v]||v}`]:v,"k-switch-on":s,"k-switch-off":!s,"k-focus":V,"k-disabled":c,"k-invalid":!G},e.className),Q=d.createElement("input",{type:"checkbox",checked:e.checked,ref:R,tabIndex:-1,"aria-hidden":!0,value:s,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:I,role:"switch","aria-checked":s,"aria-disabled":c||void 0,"aria-labelledby":e.ariaLabelledBy,"aria-describedby":e.ariaDescribedBy,"aria-label":e.ariaLabel,"aria-required":e.required,className:J,dir:A,onKeyDown:H,onClick:W,onBlur:p,onFocus:$,tabIndex:i.getTabIndex(e.tabIndex,c,void 0),accessKey:e.accessKey,id:e.id},d.createElement("span",{className:i.classNames("k-switch-track",{[`k-rounded-${i.kendoThemeMaps.roundedMap[y]||y}`]:y}),ref:o},Q,L?d.createElement("span",{className:"k-switch-label-on"},L):"",x?d.createElement("span",{className:"k-switch-label-off"},x):""),d.createElement("span",{className:"k-switch-thumb-wrap"},d.createElement("span",{className:i.classNames("k-switch-thumb",{[`k-rounded-${i.kendoThemeMaps.roundedMap[g]||g}`]:g})})))});M.displayName="Switch";const K=i.createPropsContext(),N=i.withIdHOC(i.withPropsContext(K,M));N.displayName="KendoReactSwitch";N.propTypes={accessKey:t.string,checked:t.bool,className:t.string,defaultChecked:t.bool,defaultValue:t.any,disabled:t.bool,dir:t.string,id:t.string,size:t.oneOf(["small","medium","large"]),trackRounded:t.oneOf(["small","medium","large","full"]),thumbRounded:t.oneOf(["small","medium","large","full"]),ariaDescribedBy:t.string,ariaLabelledBy:t.string,ariaLabel:t.string,offLabel:t.node,onBlur:t.func,onChange:t.func,onFocus:t.func,onLabel:t.node,tabIndex:t.number,value:t.any,name:t.string,required:t.bool,valid:t.bool,validationMessage:t.string,validityStyles:t.bool};exports.Switch=N;exports.SwitchPropsContext=K;exports.SwitchWithoutContext=M;
package/switch/Switch.mjs CHANGED
@@ -5,232 +5,210 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import * as s from "react";
9
- import t from "prop-types";
10
- import { withIdHOC as C, withPropsContext as S, createPropsContext as N, dispatchEvent as D, noop as h, Keys as v, classNames as p, kendoThemeMaps as c, getTabIndex as E } from "@progress/kendo-react-common";
11
- import { provideLocalizationService as L } from "@progress/kendo-react-intl";
12
- import { switchValidation as g, messages as M } from "../messages/index.mjs";
13
- const a = class a extends s.Component {
14
- /**
15
- * @hidden
16
- */
17
- constructor(r) {
18
- super(r), this.setValidity = () => {
19
- this._input && this._input.setCustomValidity && this._input.setCustomValidity(
20
- this.validity.valid ? "" : this.props.validationMessage || this.defaultValidationMessage.toLanguageString(g, M[g])
21
- );
22
- }, this.limit = (e, i, d) => {
23
- const o = d.offsetWidth, l = i.offsetWidth;
24
- return e < 0 ? 0 : e > o - l ? o - l : e;
25
- }, this.toggle = (e, i) => {
26
- this.setState({ checked: e }), this.valueDuringOnChange = e, D(this.props.onChange, i, this, { value: e }), this.valueDuringOnChange = void 0;
27
- }, this._element = null, this._wrapper = null, this._input = null, this._id = this.props.id, this.defaultValidationMessage = L(this), this.focus = () => {
28
- this.actionElement && this.actionElement.focus();
29
- }, this.dummyInput = (e) => /* @__PURE__ */ s.createElement(
30
- "input",
31
- {
32
- type: "checkbox",
33
- checked: this.props.checked,
34
- ref: (i) => {
35
- this._input = i;
36
- },
37
- tabIndex: -1,
38
- "aria-hidden": !0,
39
- value: e,
40
- style: { opacity: 0, width: 1, border: 0, zIndex: -1, position: "absolute", left: "50%" },
41
- onChange: h,
42
- name: this.name || void 0
43
- }
44
- ), this.handleClick = (e) => {
45
- this.eventTimeStamp !== e.timeStamp && (this.eventTimeStamp = e.timeStamp, this.toggle(!this.value, e));
46
- }, this.handleKeyDown = (e) => {
47
- if (this.props.disabled)
48
- return;
49
- const { keyCode: i } = e;
50
- (i === v.space || i === v.enter) && (this.toggle(!this.value, e), e.preventDefault());
51
- }, this.handleWrapperFocus = (e) => {
52
- if (this.props.disabled)
53
- return;
54
- this.setState({ focused: !0 });
55
- const { onFocus: i } = this.props;
56
- i && i.call(void 0, e);
57
- }, this.handleWrapperBlur = (e) => {
58
- if (this.props.disabled)
59
- return;
60
- this.setState({ focused: !1 });
61
- const { onBlur: i } = this.props;
62
- i && i.call(void 0, e);
63
- }, this.state = {
64
- checked: r.defaultChecked || a.defaultProps.defaultChecked,
65
- focused: !1
66
- };
67
- }
68
- /**
69
- * Gets the value of the Switch.
70
- */
71
- get value() {
72
- return this.valueDuringOnChange !== void 0 ? this.valueDuringOnChange : this.props.checked !== void 0 ? this.props.checked : this.state.checked;
73
- }
74
- get element() {
75
- return this._element;
76
- }
77
- get actionElement() {
78
- return this._wrapper;
79
- }
80
- /**
81
- * Gets the `name` property of the Switch.
82
- */
83
- get name() {
84
- return this.props.name;
85
- }
86
- /**
87
- * Represents the validity state into which the Switch is set.
88
- */
89
- get validity() {
90
- const r = this.props.validationMessage !== void 0, e = this.props.valid !== void 0 ? this.props.valid : this.props.required ? !!this.value : !0, i = this.props.valid !== void 0 ? this.props.valid : e;
8
+ import * as r from "react";
9
+ import { useState as q, useRef as o, useMemo as C, useEffect as P, useCallback as s, useImperativeHandle as ae } from "react";
10
+ import * as t from "prop-types";
11
+ import { withIdHOC as ne, withPropsContext as ie, createPropsContext as de, noop as L, dispatchEvent as re, Keys as T, classNames as R, kendoThemeMaps as S, getTabIndex as le } from "@progress/kendo-react-common";
12
+ import { LocalizationService as ce } from "@progress/kendo-react-intl";
13
+ import { switchValidation as V, messages as oe } from "../messages/index.mjs";
14
+ const i = {
15
+ disabled: !1,
16
+ defaultChecked: !1,
17
+ size: void 0,
18
+ trackRounded: void 0,
19
+ thumbRounded: void 0,
20
+ offLabel: "OFF",
21
+ onBlur: L,
22
+ onFocus: L,
23
+ onLabel: "ON",
24
+ validityStyles: !0
25
+ }, H = r.forwardRef((e, $) => {
26
+ var z;
27
+ const {
28
+ disabled: d = i.disabled,
29
+ defaultChecked: j = i.defaultChecked,
30
+ size: b = i.size,
31
+ trackRounded: v = i.trackRounded,
32
+ thumbRounded: y = i.thumbRounded,
33
+ offLabel: N = i.offLabel,
34
+ onBlur: k = i.onBlur,
35
+ onFocus: g = i.onFocus,
36
+ onLabel: x = i.onLabel
37
+ } = e, [E, A] = q(j || !1), [G, M] = q(!1), l = o(null), B = o(null), w = o(null), m = o(void 0), I = o(void 0), F = o(void 0), D = C(() => new ce(), []), n = C(() => m.current !== void 0 ? m.current : e.checked !== void 0 ? e.checked : E, [e.checked, E]), u = C(() => {
38
+ var K, O;
39
+ const a = e.validationMessage !== void 0, c = (K = e.valid) != null ? K : e.required ? !!n : !0, te = (O = e.valid) != null ? O : c;
91
40
  return {
92
- customError: r,
93
- valid: i,
94
- valueMissing: this.value === null
41
+ customError: a,
42
+ valid: te,
43
+ valueMissing: n === null
95
44
  };
96
- }
97
- /**
98
- * @hidden
99
- */
100
- get validityStyles() {
101
- return this.props.validityStyles !== void 0 ? this.props.validityStyles : a.defaultProps.validityStyles;
102
- }
103
- /**
104
- * @hidden
105
- */
106
- get required() {
107
- return this.props.required !== void 0 ? this.props.required : !1;
108
- }
109
- /**
110
- * @hidden
111
- */
112
- componentDidMount() {
113
- this.setValidity(), this.forceUpdate();
114
- }
115
- /**
116
- * @hidden
117
- */
118
- componentDidUpdate() {
119
- this.setValidity();
120
- }
121
- /**
122
- * @hidden
123
- */
124
- render() {
125
- const { focused: r } = this.state, { dir: e, disabled: i, trackRounded: d, thumbRounded: o, size: l, offLabel: m, onLabel: f, tabIndex: b } = this.props;
126
- this.dir = e || this.element && getComputedStyle(this.element).direction || void 0;
127
- const y = !this.validityStyles || this.validity.valid, k = p(
128
- "k-switch",
45
+ }, [e.valid, e.validationMessage, e.required, n]), J = (z = e.validityStyles) != null ? z : i.validityStyles;
46
+ P(() => {
47
+ var a;
48
+ (a = w.current) != null && a.setCustomValidity && w.current.setCustomValidity(
49
+ u.valid ? "" : e.validationMessage || D.toLanguageString(V, oe[V])
50
+ );
51
+ }, [u, e.validationMessage, D]), P(() => {
52
+ l.current && (F.current = e.dir || getComputedStyle(l.current).direction || void 0);
53
+ }, [e.dir]);
54
+ const f = s(() => ({
55
+ props: e,
56
+ get element() {
57
+ return l.current;
58
+ },
59
+ get actionElement() {
60
+ return B.current;
61
+ },
62
+ get value() {
63
+ return n;
64
+ },
65
+ get name() {
66
+ return e.name;
67
+ },
68
+ get validity() {
69
+ return u;
70
+ }
71
+ }), [e, n, u]), h = s(
72
+ (a, c) => {
73
+ A(a), m.current = a, re(
74
+ e.onChange,
75
+ c,
76
+ { ...f(), value: a },
77
+ { value: a }
78
+ ), m.current = void 0;
79
+ },
80
+ [e.onChange, f]
81
+ ), Q = s(
82
+ (a) => {
83
+ I.current !== a.timeStamp && (I.current = a.timeStamp, h(!n, a));
84
+ },
85
+ [n, h]
86
+ ), U = s(
87
+ (a) => {
88
+ if (d)
89
+ return;
90
+ const { keyCode: c } = a;
91
+ (c === T.space || c === T.enter) && (h(!n, a), a.preventDefault());
92
+ },
93
+ [d, n, h]
94
+ ), X = s(
95
+ (a) => {
96
+ d || (M(!0), g && g(a));
97
+ },
98
+ [d, g]
99
+ ), Y = s(
100
+ (a) => {
101
+ d || (M(!1), k && k(a));
102
+ },
103
+ [d, k]
104
+ );
105
+ ae($, f, [f]);
106
+ const Z = F.current || e.dir || l.current && getComputedStyle(l.current).direction || void 0, _ = !J || u.valid, p = R(
107
+ "k-switch",
108
+ {
109
+ [`k-switch-${S.sizeMap[b] || b}`]: b,
110
+ "k-switch-on": n,
111
+ "k-switch-off": !n,
112
+ "k-focus": G,
113
+ "k-disabled": d,
114
+ "k-invalid": !_
115
+ },
116
+ e.className
117
+ ), ee = /* @__PURE__ */ r.createElement(
118
+ "input",
119
+ {
120
+ type: "checkbox",
121
+ checked: e.checked,
122
+ ref: w,
123
+ tabIndex: -1,
124
+ "aria-hidden": !0,
125
+ value: n,
126
+ style: { opacity: 0, width: 1, border: 0, zIndex: -1, position: "absolute", left: "50%" },
127
+ onChange: L,
128
+ name: e.name || void 0
129
+ }
130
+ );
131
+ return /* @__PURE__ */ r.createElement(
132
+ "span",
133
+ {
134
+ ref: B,
135
+ role: "switch",
136
+ "aria-checked": n,
137
+ "aria-disabled": d || void 0,
138
+ "aria-labelledby": e.ariaLabelledBy,
139
+ "aria-describedby": e.ariaDescribedBy,
140
+ "aria-label": e.ariaLabel,
141
+ "aria-required": e.required,
142
+ className: p,
143
+ dir: Z,
144
+ onKeyDown: U,
145
+ onClick: Q,
146
+ onBlur: Y,
147
+ onFocus: X,
148
+ tabIndex: le(e.tabIndex, d, void 0),
149
+ accessKey: e.accessKey,
150
+ id: e.id
151
+ },
152
+ /* @__PURE__ */ r.createElement(
153
+ "span",
129
154
  {
130
- [`k-switch-${c.sizeMap[l] || l}`]: l,
131
- "k-switch-on": this.value,
132
- "k-switch-off": !this.value,
133
- "k-focus": r,
134
- "k-disabled": i,
135
- "k-invalid": !y
155
+ className: R("k-switch-track", {
156
+ [`k-rounded-${S.roundedMap[v] || v}`]: v
157
+ }),
158
+ ref: l
136
159
  },
137
- this.props.className
138
- ), w = {
139
- "aria-checked": this.value,
140
- "aria-disabled": i || void 0,
141
- "aria-labelledby": this.props.ariaLabelledBy,
142
- "aria-describedby": this.props.ariaDescribedBy,
143
- "aria-label": this.props.ariaLabel,
144
- "aria-required": this.props.required
145
- };
146
- return /* @__PURE__ */ s.createElement(
160
+ ee,
161
+ x ? /* @__PURE__ */ r.createElement("span", { className: "k-switch-label-on" }, x) : "",
162
+ N ? /* @__PURE__ */ r.createElement("span", { className: "k-switch-label-off" }, N) : ""
163
+ ),
164
+ /* @__PURE__ */ r.createElement("span", { className: "k-switch-thumb-wrap" }, /* @__PURE__ */ r.createElement(
147
165
  "span",
148
166
  {
149
- ref: (n) => {
150
- this._wrapper = n;
151
- },
152
- role: "switch",
153
- ...w,
154
- className: k,
155
- dir: this.dir,
156
- onKeyDown: this.handleKeyDown,
157
- onClick: this.handleClick,
158
- onBlur: this.handleWrapperBlur,
159
- onFocus: this.handleWrapperFocus,
160
- tabIndex: E(b, i, void 0),
161
- accessKey: this.props.accessKey,
162
- id: this.props.id || this._id
163
- },
164
- /* @__PURE__ */ s.createElement(
165
- "span",
166
- {
167
- className: p("k-switch-track", {
168
- [`k-rounded-${c.roundedMap[d] || d}`]: d
169
- }),
170
- ref: (n) => {
171
- this._element = n;
172
- }
173
- },
174
- this.dummyInput(this.value),
175
- f ? /* @__PURE__ */ s.createElement("span", { className: "k-switch-label-on" }, f) : "",
176
- m ? /* @__PURE__ */ s.createElement("span", { className: "k-switch-label-off" }, m) : ""
177
- ),
178
- /* @__PURE__ */ s.createElement("span", { className: "k-switch-thumb-wrap" }, /* @__PURE__ */ s.createElement(
179
- "span",
180
- {
181
- className: p("k-switch-thumb", {
182
- [`k-rounded-${c.roundedMap[o] || o}`]: o
183
- })
184
- }
185
- ))
186
- );
187
- }
188
- };
189
- a.displayName = "Switch", a.propTypes = {
167
+ className: R("k-switch-thumb", {
168
+ [`k-rounded-${S.roundedMap[y] || y}`]: y
169
+ })
170
+ }
171
+ ))
172
+ );
173
+ });
174
+ H.displayName = "Switch";
175
+ const se = de(), W = ne(
176
+ ie(
177
+ se,
178
+ H
179
+ )
180
+ );
181
+ W.displayName = "KendoReactSwitch";
182
+ W.propTypes = {
190
183
  accessKey: t.string,
191
184
  checked: t.bool,
192
185
  className: t.string,
193
- disabled: t.bool,
194
186
  defaultChecked: t.bool,
187
+ defaultValue: t.any,
188
+ disabled: t.bool,
189
+ dir: t.string,
190
+ id: t.string,
195
191
  size: t.oneOf(["small", "medium", "large"]),
196
192
  trackRounded: t.oneOf(["small", "medium", "large", "full"]),
197
193
  thumbRounded: t.oneOf(["small", "medium", "large", "full"]),
198
- dir: t.string,
199
- id: t.string,
200
- ariaLabelledBy: t.string,
201
194
  ariaDescribedBy: t.string,
202
- offLabel: t.string,
203
- required: t.bool,
195
+ ariaLabelledBy: t.string,
196
+ ariaLabel: t.string,
197
+ offLabel: t.node,
198
+ onBlur: t.func,
199
+ onChange: t.func,
200
+ onFocus: t.func,
201
+ onLabel: t.node,
204
202
  tabIndex: t.number,
203
+ value: t.any,
204
+ name: t.string,
205
+ required: t.bool,
205
206
  valid: t.bool,
206
- validate: t.bool,
207
207
  validationMessage: t.string,
208
- onBlur: t.any,
209
- onChange: t.any,
210
- onFocus: t.any,
211
- onLabel: t.string
212
- }, a.defaultProps = {
213
- disabled: !1,
214
- defaultChecked: !1,
215
- size: void 0,
216
- trackRounded: void 0,
217
- thumbRounded: void 0,
218
- offLabel: "OFF",
219
- onBlur: h,
220
- onFocus: h,
221
- onLabel: "ON",
222
- validityStyles: !0
208
+ validityStyles: t.bool
223
209
  };
224
- let u = a;
225
- const B = N(), O = C(
226
- S(
227
- B,
228
- u
229
- )
230
- );
231
- O.displayName = "KendoReactSwitch";
232
210
  export {
233
- O as Switch,
234
- B as SwitchPropsContext,
235
- u as SwitchWithoutContext
211
+ W as Switch,
212
+ se as SwitchPropsContext,
213
+ H as SwitchWithoutContext
236
214
  };
@@ -17,19 +17,19 @@ const ke = be(), R = t.forwardRef(($, q) => {
17
17
  flow: b = n.flow,
18
18
  prefix: L = null,
19
19
  suffix: j = null,
20
- ariaDescribedBy: K,
21
- ariaLabelledBy: G,
20
+ ariaDescribedBy: _,
21
+ ariaLabelledBy: K,
22
22
  autoSize: u,
23
- className: J,
24
- defaultValue: Q,
23
+ className: G,
24
+ defaultValue: J,
25
25
  disabled: o,
26
- readOnly: U,
26
+ readOnly: Q,
27
27
  required: d,
28
- rows: W,
29
- id: X,
30
- name: Y,
31
- placeholder: Z,
32
- style: _,
28
+ rows: U,
29
+ id: W,
30
+ name: X,
31
+ placeholder: Y,
32
+ style: Z,
33
33
  tabIndex: ee,
34
34
  value: x,
35
35
  valid: w,
@@ -50,7 +50,7 @@ const ke = be(), R = t.forwardRef(($, q) => {
50
50
  a.current && a.current.focus();
51
51
  }, []), T = t.useCallback(() => {
52
52
  a.current && a.current.blur();
53
- }, []), [E, M] = t.useState(Q), [oe, P] = t.useState(!1), [re, se] = B(L), [le, ne] = B(j), c = x !== void 0, f = c ? x : E, s = t.useCallback(() => ({
53
+ }, []), [E, M] = t.useState(J), [oe, P] = t.useState(!1), [re, se] = B(L), [le, ne] = B(j), c = x !== void 0, f = c ? x : E, s = t.useCallback(() => ({
54
54
  element: a,
55
55
  focus: O,
56
56
  blur: T,
@@ -103,9 +103,9 @@ const ke = be(), R = t.forwardRef(($, q) => {
103
103
  ...I
104
104
  };
105
105
  }, [u, l, V, I]), pe = {
106
- id: X || ie,
106
+ id: W || ie,
107
107
  role: "textbox",
108
- name: Y,
108
+ name: X,
109
109
  className: N("k-input-inner", "!k-overflow-auto", {
110
110
  "k-resize": !u && l !== "none",
111
111
  "k-resize-none": u || l === "none",
@@ -113,15 +113,15 @@ const ke = be(), R = t.forwardRef(($, q) => {
113
113
  }),
114
114
  ref: a,
115
115
  disabled: o,
116
- rows: W,
117
- placeholder: Z,
118
- readOnly: U,
116
+ rows: U,
117
+ placeholder: Y,
118
+ readOnly: Q,
119
119
  required: d,
120
120
  tabIndex: ye(ee, o),
121
121
  autoFocus: D,
122
122
  style: me,
123
- "aria-labelledby": G,
124
- "aria-describedby": K,
123
+ "aria-labelledby": K,
124
+ "aria-describedby": _,
125
125
  "aria-multiline": !0,
126
126
  "aria-disabled": o || void 0,
127
127
  "aria-required": d,
@@ -148,9 +148,9 @@ const ke = be(), R = t.forwardRef(($, q) => {
148
148
  "!k-flex-col": b === "vertical",
149
149
  "!k-flex-row": b === "horizontal"
150
150
  },
151
- J
151
+ G
152
152
  ),
153
- style: _,
153
+ style: Z,
154
154
  dir: ue
155
155
  },
156
156
  i.prefix && /* @__PURE__ */ t.createElement(re, { ...se }),
@@ -8,10 +8,10 @@
8
8
  import * as e from "react";
9
9
  import a from "prop-types";
10
10
  import { useUnstyled as j, useCustomComponent as x, useAsyncFocusBlur as H, classNames as g, kendoThemeMaps as h, uTextBox as w } from "@progress/kendo-react-common";
11
- const C = e.forwardRef((t, k) => {
12
- const o = e.useRef(null), i = e.useRef(null), s = e.useRef(void 0), c = j(), y = c && c.uTextBox, B = e.useCallback(() => {
11
+ const _ = e.forwardRef((t, C) => {
12
+ const o = e.useRef(null), i = e.useRef(null), l = e.useRef(void 0), c = j(), k = c && c.uTextBox, y = e.useCallback(() => {
13
13
  var n;
14
- return s.current !== void 0 ? s.current : (n = o.current) == null ? void 0 : n.value;
14
+ return l.current !== void 0 ? l.current : (n = o.current) == null ? void 0 : n.value;
15
15
  }, []);
16
16
  e.useImperativeHandle(i, () => ({
17
17
  get element() {
@@ -21,15 +21,15 @@ const C = e.forwardRef((t, k) => {
21
21
  return o.current && o.current.name;
22
22
  },
23
23
  get value() {
24
- return B();
24
+ return y();
25
25
  }
26
- })), e.useImperativeHandle(k, () => i.current);
26
+ })), e.useImperativeHandle(C, () => i.current);
27
27
  const {
28
- size: l = u.size,
28
+ size: s = u.size,
29
29
  fillMode: d = u.fillMode,
30
30
  rounded: r = u.rounded,
31
- autoFocus: F = u.autoFocus,
32
- inputAttributes: _,
31
+ autoFocus: B = u.autoFocus,
32
+ inputAttributes: F,
33
33
  className: f,
34
34
  dir: b,
35
35
  style: M,
@@ -52,12 +52,12 @@ const C = e.forwardRef((t, k) => {
52
52
  v(!1);
53
53
  }, A = e.useCallback(
54
54
  (n) => {
55
- s.current = n.target.value, t.onChange && t.onChange.call(void 0, {
55
+ l.current = n.target.value, t.onChange && t.onChange.call(void 0, {
56
56
  syntheticEvent: n,
57
57
  nativeEvent: n.nativeEvent,
58
58
  value: n.target.value,
59
59
  target: i.current
60
- }), s.current = void 0;
60
+ }), l.current = void 0;
61
61
  },
62
62
  [t.onChange]
63
63
  ), { onFocus: I, onBlur: P } = H({
@@ -70,7 +70,7 @@ const C = e.forwardRef((t, k) => {
70
70
  "k-input",
71
71
  "k-textbox",
72
72
  {
73
- [`k-input-${h.sizeMap[l] || l}`]: l,
73
+ [`k-input-${h.sizeMap[s] || s}`]: s,
74
74
  [`k-input-${d}`]: d,
75
75
  [`k-rounded-${h.roundedMap[r] || r}`]: r,
76
76
  "k-focus": m,
@@ -80,15 +80,15 @@ const C = e.forwardRef((t, k) => {
80
80
  },
81
81
  f
82
82
  ),
83
- [f, d, m, t.disabled, t.required, t.valid, r, l]
83
+ [f, d, m, t.disabled, t.required, t.valid, r, s]
84
84
  );
85
85
  return /* @__PURE__ */ e.createElement("span", { style: M, dir: b, className: $, onFocus: I, onBlur: P }, /* @__PURE__ */ e.createElement(T, null), /* @__PURE__ */ e.createElement(
86
86
  "input",
87
87
  {
88
88
  ref: o,
89
- className: g(w.inputInner({ c: y })),
90
- autoFocus: F,
91
- ...Object.assign({}, R, _),
89
+ className: g(w.inputInner({ c: k })),
90
+ autoFocus: B,
91
+ ...Object.assign({}, R, F),
92
92
  "aria-required": t.required,
93
93
  onChange: A
94
94
  }
@@ -101,14 +101,14 @@ const C = e.forwardRef((t, k) => {
101
101
  fillMode: void 0,
102
102
  autoFocus: !1
103
103
  };
104
- C.propTypes = {
104
+ _.propTypes = {
105
105
  size: a.oneOf(["small", "medium", "large"]),
106
106
  rounded: a.oneOf(["small", "medium", "large", "full"]),
107
107
  fillMode: a.oneOf(["solid", "flat", "outline"]),
108
108
  autoFocus: a.bool,
109
109
  inputAttributes: a.object
110
110
  };
111
- C.displayName = "KendoReactTextBoxComponent";
111
+ _.displayName = "KendoReactTextBoxComponent";
112
112
  export {
113
- C as TextBox
113
+ _ as TextBox
114
114
  };