@progress/kendo-react-inputs 15.1.1-develop.2 → 15.2.0-develop.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/switch/Switch.mjs CHANGED
@@ -5,12 +5,12 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import * as l from "react";
9
- import { useState as H, useRef as d, useMemo as E, useEffect as M, useCallback as m, useImperativeHandle as V } from "react";
8
+ import * as d from "react";
9
+ import { useState as H, useRef as l, useMemo as S, useEffect as M, useCallback as m, useImperativeHandle as V } from "react";
10
10
  import t from "prop-types";
11
- import { withIdHOC as le, withPropsContext as de, noop as B, dispatchEvent as se, subscribeToKendoPaste as oe, Keys as W, useWebMcpRegister as ue, classNames as N, kendoThemeMaps as x, getTabIndex as fe, createPropsContext as me } from "@progress/kendo-react-common";
12
- import { LocalizationService as be, useLocalization as he } from "@progress/kendo-react-intl";
13
- import { switchValidation as $, messages as A, switchAriaLabel as j } from "../messages/index.mjs";
11
+ import { withIdHOC as ie, withPropsContext as ce, noop as B, dispatchEvent as re, subscribeToKendoPaste as de, Keys as W, useWebMcpRegister as le, classNames as N, kendoThemeMaps as x, getTabIndex as se, createPropsContext as oe } from "@progress/kendo-react-common";
12
+ import { LocalizationService as ue, useLocalization as fe } from "@progress/kendo-react-intl";
13
+ import { switchValidation as $, messages as me } from "../messages/index.mjs";
14
14
  const c = {
15
15
  disabled: !1,
16
16
  defaultChecked: !1,
@@ -22,19 +22,21 @@ const c = {
22
22
  onFocus: B,
23
23
  onLabel: "ON",
24
24
  validityStyles: !0
25
- }, G = l.forwardRef((e, Q) => {
25
+ }, j = d.forwardRef((e, G) => {
26
26
  var T;
27
27
  const {
28
28
  disabled: r = c.disabled,
29
- defaultChecked: U = c.defaultChecked,
29
+ defaultChecked: J = c.defaultChecked,
30
30
  size: k = c.size,
31
31
  trackRounded: w = c.trackRounded,
32
32
  thumbRounded: C = c.thumbRounded,
33
33
  offLabel: I = c.offLabel,
34
34
  onBlur: R = c.onBlur,
35
- onFocus: L = c.onFocus,
36
- onLabel: z = c.onLabel
37
- } = e, [F, X] = H(U || !1), [Y, D] = H(!1), s = d(null), o = d(null), h = d(null), v = d(void 0), S = d(!1), K = d(void 0), O = E(() => new be(), []), Z = he(), n = E(() => v.current !== void 0 ? v.current : e.checked !== void 0 ? e.checked : F, [e.checked, F]), b = E(() => {
35
+ onFocus: E = c.onFocus,
36
+ onLabel: F = c.onLabel
37
+ } = e, [z, Q] = H(J || !1), [U, D] = H(!1), s = l(null), o = l(null), h = l(null), v = l(void 0), L = l(!1), K = l(void 0), O = S(() => new ue(), []);
38
+ fe();
39
+ const n = S(() => v.current !== void 0 ? v.current : e.checked !== void 0 ? e.checked : z, [e.checked, z]), b = S(() => {
38
40
  var y, q;
39
41
  const a = e.validationMessage !== void 0, i = (y = e.valid) != null ? y : e.required ? !!n : !0, g = (q = e.valid) != null ? q : i;
40
42
  return {
@@ -42,11 +44,11 @@ const c = {
42
44
  valid: g,
43
45
  valueMissing: n === null
44
46
  };
45
- }, [e.valid, e.validationMessage, e.required, n]), _ = (T = e.validityStyles) != null ? T : c.validityStyles;
47
+ }, [e.valid, e.validationMessage, e.required, n]), X = (T = e.validityStyles) != null ? T : c.validityStyles;
46
48
  M(() => {
47
49
  var a;
48
50
  (a = h.current) != null && a.setCustomValidity && h.current.setCustomValidity(
49
- b.valid ? "" : e.validationMessage || O.toLanguageString($, A[$])
51
+ b.valid ? "" : e.validationMessage || O.toLanguageString($, me[$])
50
52
  );
51
53
  }, [b, e.validationMessage, O]), M(() => {
52
54
  s.current && (K.current = e.dir || getComputedStyle(s.current).direction || void 0);
@@ -74,7 +76,7 @@ const c = {
74
76
  }
75
77
  }), [e, n, b]), f = m(
76
78
  (a, i) => {
77
- X(a), v.current = a, se(
79
+ Q(a), v.current = a, re(
78
80
  e.onChange,
79
81
  i,
80
82
  { ...u(), value: a },
@@ -84,7 +86,7 @@ const c = {
84
86
  [e.onChange, u]
85
87
  );
86
88
  M(() => {
87
- const a = e.name || e.id, i = oe(o.current, {
89
+ const a = e.name || e.id, i = de(o.current, {
88
90
  fieldName: a,
89
91
  onValueChange: (g) => {
90
92
  if (g !== n) {
@@ -101,19 +103,19 @@ const c = {
101
103
  i == null || i.unsubscribe();
102
104
  };
103
105
  }, [e.name, e.id, n, f]);
104
- const p = m(
106
+ const Y = m(
105
107
  (a) => {
106
108
  if (a.target === h.current) {
107
- if (S.current) {
108
- S.current = !1;
109
+ if (L.current) {
110
+ L.current = !1;
109
111
  return;
110
112
  }
111
113
  } else
112
- S.current = !0;
114
+ L.current = !0;
113
115
  f(!n, a);
114
116
  },
115
117
  [n, f]
116
- ), ee = m(
118
+ ), Z = m(
117
119
  (a) => {
118
120
  if (r)
119
121
  return;
@@ -121,32 +123,32 @@ const c = {
121
123
  (i === W.space || i === W.enter) && (f(!n, a), a.preventDefault());
122
124
  },
123
125
  [r, n, f]
124
- ), te = m(
126
+ ), _ = m(
125
127
  (a) => {
126
- r || (D(!0), L && L(a));
128
+ r || (D(!0), E && E(a));
127
129
  },
128
- [r, L]
129
- ), ae = m(
130
+ [r, E]
131
+ ), p = m(
130
132
  (a) => {
131
133
  r || (D(!1), R && R(a));
132
134
  },
133
135
  [r, R]
134
136
  );
135
- V(Q, u, [u]);
136
- const P = d(null);
137
- V(P, u, [u]), ue("switch", P, e, e.webMcp);
138
- const ne = K.current || e.dir || s.current && getComputedStyle(s.current).direction || void 0, ie = !_ || b.valid, ce = N(
137
+ V(G, u, [u]);
138
+ const P = l(null);
139
+ V(P, u, [u]), le("switch", P, e, e.webMcp);
140
+ const ee = K.current || e.dir || s.current && getComputedStyle(s.current).direction || void 0, te = !X || b.valid, ae = N(
139
141
  "k-switch",
140
142
  {
141
143
  [`k-switch-${x.sizeMap[k] || k}`]: k,
142
144
  "k-switch-on": n,
143
145
  "k-switch-off": !n,
144
- "k-focus": Y,
146
+ "k-focus": U,
145
147
  "k-disabled": r,
146
- "k-invalid": !ie
148
+ "k-invalid": !te
147
149
  },
148
150
  e.className
149
- ), re = /* @__PURE__ */ l.createElement(
151
+ ), ne = /* @__PURE__ */ d.createElement(
150
152
  "input",
151
153
  {
152
154
  type: "checkbox",
@@ -159,7 +161,7 @@ const c = {
159
161
  name: e.name || void 0
160
162
  }
161
163
  );
162
- return /* @__PURE__ */ l.createElement(
164
+ return /* @__PURE__ */ d.createElement(
163
165
  "span",
164
166
  {
165
167
  ref: o,
@@ -168,19 +170,19 @@ const c = {
168
170
  "aria-disabled": r || void 0,
169
171
  "aria-labelledby": e.ariaLabelledBy,
170
172
  "aria-describedby": e.ariaDescribedBy,
171
- "aria-label": e.ariaLabel || Z.toLanguageString(j, A[j]),
173
+ "aria-label": e.ariaLabel,
172
174
  "aria-required": e.required,
173
- className: ce,
174
- dir: ne,
175
- onKeyDown: ee,
176
- onClick: p,
177
- onBlur: ae,
178
- onFocus: te,
179
- tabIndex: fe(e.tabIndex, r, void 0),
175
+ className: ae,
176
+ dir: ee,
177
+ onKeyDown: Z,
178
+ onClick: Y,
179
+ onBlur: p,
180
+ onFocus: _,
181
+ tabIndex: se(e.tabIndex, r, void 0),
180
182
  accessKey: e.accessKey,
181
183
  id: e.id
182
184
  },
183
- /* @__PURE__ */ l.createElement(
185
+ /* @__PURE__ */ d.createElement(
184
186
  "span",
185
187
  {
186
188
  className: N("k-switch-track", {
@@ -188,11 +190,11 @@ const c = {
188
190
  }),
189
191
  ref: s
190
192
  },
191
- re,
192
- z ? /* @__PURE__ */ l.createElement("span", { className: "k-switch-label-on" }, z) : "",
193
- I ? /* @__PURE__ */ l.createElement("span", { className: "k-switch-label-off" }, I) : ""
193
+ ne,
194
+ F ? /* @__PURE__ */ d.createElement("span", { className: "k-switch-label-on" }, F) : "",
195
+ I ? /* @__PURE__ */ d.createElement("span", { className: "k-switch-label-off" }, I) : ""
194
196
  ),
195
- /* @__PURE__ */ l.createElement("span", { className: "k-switch-thumb-wrap" }, /* @__PURE__ */ l.createElement(
197
+ /* @__PURE__ */ d.createElement("span", { className: "k-switch-thumb-wrap" }, /* @__PURE__ */ d.createElement(
196
198
  "span",
197
199
  {
198
200
  className: N("k-switch-thumb", {
@@ -202,15 +204,15 @@ const c = {
202
204
  ))
203
205
  );
204
206
  });
205
- G.displayName = "Switch";
206
- const ve = me(), J = le(
207
- de(
208
- ve,
209
- G
207
+ j.displayName = "Switch";
208
+ const be = oe(), A = ie(
209
+ ce(
210
+ be,
211
+ j
210
212
  )
211
213
  );
212
- J.displayName = "KendoReactSwitch";
213
- J.propTypes = {
214
+ A.displayName = "KendoReactSwitch";
215
+ A.propTypes = {
214
216
  accessKey: t.string,
215
217
  checked: t.bool,
216
218
  className: t.string,
@@ -239,7 +241,7 @@ J.propTypes = {
239
241
  validityStyles: t.bool
240
242
  };
241
243
  export {
242
- J as Switch,
243
- ve as SwitchPropsContext,
244
- G as SwitchWithoutContext
244
+ A as Switch,
245
+ be as SwitchPropsContext,
246
+ j as SwitchWithoutContext
245
247
  };