@progress/kendo-react-inputs 8.2.0-develop.2 → 8.2.0-develop.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,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 client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ve=require("react"),t=require("prop-types"),o=require("@progress/kendo-react-common"),Ce=require("../package-metadata.js"),ye=require("@progress/kendo-react-intl"),I=require("../messages/index.js");function xe(s){const u=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const r in s)if(r!=="default"){const m=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(u,r,m.get?m:{enumerable:!0,get:()=>s[r]})}}return u.default=s,Object.freeze(u)}const e=xe(ve),W=o.createPropsContext(),O=e.forwardRef((s,u)=>{o.validatePackage(Ce.packageMetadata);const r=o.usePropsContext(W,s),{ariaDescribedBy:m,ariaLabelledBy:G,checked:B,className:J,labelClassName:Q,children:X,defaultChecked:Y,disabled:n,defaultValue:Z,id:q,size:h=A.size,rounded:g=A.rounded,label:z,labelPlacement:D,name:ee,labelOptional:te,onChange:v,onFocus:C,onBlur:y,tabIndex:ae,value:i,required:x,valid:T,validationMessage:F,validityStyles:K,visited:Pe,touched:Ee,modified:Ve,...ne}=r,l=e.useRef(null),R=e.useCallback(()=>{l.current&&l.current.focus()},[]),d=e.useCallback(()=>({element:l.current,focus:R,get name(){return l.current&&l.current.name}}),[R]);e.useImperativeHandle(u,d);const[oe,le]=e.useState(Y),[ce,se]=e.useState(Z),w=typeof i=="boolean"||i===null,P=B!==void 0,b=w,E=b?i:ce,k=P?B:b?void 0:oe,j=k===void 0&&E,V=j?E:k,p=j||b?i===null?i:void 0:i||E,L=V===null||p===null,_=o.useId(),re=ye.useLocalization(),H=a=>re.toLanguageString(a,I.messages[a]),U=H(I.checkboxValidation),ie=H(I.checkboxOptionalText),M=T!==void 0?T:x?!!k:!0;e.useEffect(()=>{l.current&&l.current.setCustomValidity&&l.current.setCustomValidity(M?"":F||U)},[M,F,U]);const f=e.useCallback((a,c)=>{!b&&!n&&(se(c),!P&&!n&&le(c)),v&&!n&&o.dispatchEvent(v,a,{...d(),value:c},{value:c})},[P,n,v,b,d]),de=e.useCallback(a=>{const c=a.target.checked;f(a,c)},[f,i]),ue=e.useCallback(a=>{if(n)return;const{keyCode:c}=a,ge=a.currentTarget.checked;c===o.Keys.space&&(a.preventDefault(),a.stopPropagation(),f(a,!ge))},[n,f]),be=e.useCallback(a=>{if(n)return;const{keyCode:c}=a;c===o.Keys.space&&a.preventDefault()},[n]),me=e.useCallback(a=>{C&&!n&&o.dispatchEvent(C,a,d(),void 0)},[C,n,d]),ke=e.useCallback(a=>{y&&!n&&o.dispatchEvent(y,a,d(),void 0)},[y,n,d]),pe=o.useDir(l,r.dir),fe=o.classNames("k-checkbox-wrap",J),$={type:"checkbox",className:o.classNames("k-checkbox",{[`k-checkbox-${o.kendoThemeMaps.sizeMap[h]||h}`]:h,[`k-rounded-${o.kendoThemeMaps.roundedMap[g]||g}`]:g,"k-indeterminate":L,"k-disabled":n,"k-invalid k-invalid":!(M||K!==void 0||K===!0)}),ref:l,name:ee,id:q||_,"aria-labelledby":G,"aria-describedby":m,checked:!!V,disabled:n,tabIndex:o.getTabIndex(ae,n),role:"checkbox",required:x!==void 0?x:!1,"aria-checked":k||V?!0:L?"mixed":!1,"aria-disabled":n||void 0,...ne,onChange:de,onKeyDown:ue,onKeyUp:be,onFocus:me,onBlur:ke},he=p===void 0?e.createElement("input",{...$}):e.createElement("input",{...$,value:w?void 0:p===null?"":p}),N=z!==void 0?e.createElement("label",{className:o.classNames("k-checkbox-label",Q),htmlFor:q||_,style:{userSelect:"none"}},e.createElement(e.Fragment,null,z),te&&e.createElement("span",{className:"k-label-optional"},ie)):null,S=e.createElement("span",{className:fe},he,X);return e.createElement(e.Fragment,null,D==="before"?e.createElement("div",{dir:"rtl"},S,N):D==="after"?e.createElement("div",{dir:"ltr"},S,N):e.createElement("div",{dir:pe},S,N))});O.propTypes={checked:t.bool,className:t.string,defaultChecked:t.bool,defaultValue:t.any,dir:t.string,disabled:t.bool,id:t.string,size:t.oneOf([null,"small","medium","large"]),rounded:t.oneOf([null,"small","medium","large"]),ariaLabelledBy:t.string,ariaDescribedBy:t.string,label:t.any,labelPlacement:t.string,labelOptional:t.bool,name:t.string,tabIndex:t.number,value:t.any,validationMessage:t.string,required:t.bool,validate:t.bool,valid:t.bool,onChange:t.func,onFocus:t.func,onBlur:t.func};const A={size:"medium",rounded:"medium"};O.displayName="KendoCheckbox";exports.Checkbox=O;exports.CheckboxPropsContext=W;
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ce=require("react"),t=require("prop-types"),o=require("@progress/kendo-react-common"),ye=require("../package-metadata.js"),xe=require("@progress/kendo-react-intl"),S=require("../messages/index.js");function Pe(s){const d=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const r in s)if(r!=="default"){const m=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(d,r,m.get?m:{enumerable:!0,get:()=>s[r]})}}return d.default=s,Object.freeze(d)}const e=Pe(Ce),A=o.createPropsContext(),I=e.forwardRef((s,d)=>{o.validatePackage(ye.packageMetadata);const r=o.usePropsContext(A,s),{ariaDescribedBy:m,ariaLabelledBy:W,checked:O,className:G,labelClassName:J,children:Q,defaultChecked:X,disabled:n,defaultValue:Y,id:B,size:f=$.size,rounded:h=$.rounded,label:F,labelPlacement:q,name:Z,labelOptional:ee,onChange:g,onFocus:v,onBlur:C,tabIndex:te,value:i,required:y,valid:z,validationMessage:D,validityStyles:T,autoFocus:ae,visited:Ee,touched:Ve,modified:Me,...ne}=r,l=e.useRef(null),K=e.useCallback(()=>{l.current&&l.current.focus()},[]),u=e.useCallback(()=>({element:l.current,focus:K,get name(){return l.current&&l.current.name}}),[K]);e.useImperativeHandle(d,u);const[oe,le]=e.useState(X),[ce,se]=e.useState(Y),R=typeof i=="boolean"||i===null,x=O!==void 0,b=R,P=b?i:ce,E=x?O:b?void 0:oe,w=E===void 0&&P,j=w?P:E,k=w||b?i===null?i:void 0:i||P,re=j===null||k===null,L=o.useId(),ie=xe.useLocalization(),_=a=>ie.toLanguageString(a,S.messages[a]),H=_(S.checkboxValidation),ue=_(S.checkboxOptionalText),V=z!==void 0?z:y?!!E:!0;e.useEffect(()=>{l.current&&l.current.setCustomValidity&&l.current.setCustomValidity(V?"":D||H)},[V,D,H]);const p=e.useCallback((a,c)=>{!b&&!n&&(se(c),!x&&!n&&le(c)),g&&!n&&o.dispatchEvent(g,a,{...u(),value:c},{value:c})},[x,n,g,b,u]),de=e.useCallback(a=>{const c=a.target.checked;p(a,c)},[p,i]),be=e.useCallback(a=>{if(n)return;const{keyCode:c}=a,ve=a.currentTarget.checked;c===o.Keys.space&&(a.preventDefault(),a.stopPropagation(),p(a,!ve))},[n,p]),me=e.useCallback(a=>{if(n)return;const{keyCode:c}=a;c===o.Keys.space&&a.preventDefault()},[n]),ke=e.useCallback(a=>{v&&!n&&o.dispatchEvent(v,a,u(),void 0)},[v,n,u]),pe=e.useCallback(a=>{C&&!n&&o.dispatchEvent(C,a,u(),void 0)},[C,n,u]),fe=o.useDir(l,r.dir),he=o.classNames("k-checkbox-wrap",G),U={type:"checkbox",className:o.classNames("k-checkbox",{[`k-checkbox-${o.kendoThemeMaps.sizeMap[f]||f}`]:f,[`k-rounded-${o.kendoThemeMaps.roundedMap[h]||h}`]:h,"k-indeterminate":re,"k-disabled":n,"k-invalid k-invalid":!(V||T!==void 0||T===!0)}),ref:l,name:Z,id:B||L,disabled:n,required:y!==void 0?y:!1,tabIndex:o.getTabIndex(te,n),role:"checkbox",checked:!!j,"aria-describedby":m,"aria-labelledby":W,"aria-disabled":n||void 0,autoFocus:ae,...ne,onChange:de,onKeyDown:be,onKeyUp:me,onFocus:ke,onBlur:pe},ge=k===void 0?e.createElement("input",{...U}):e.createElement("input",{...U,value:R?void 0:k===null?"":k}),M=F!==void 0?e.createElement("label",{className:o.classNames("k-checkbox-label",J),htmlFor:B||L,style:{userSelect:"none"}},e.createElement(e.Fragment,null,F),ee&&e.createElement("span",{className:"k-label-optional"},ue)):null,N=e.createElement("span",{className:he},ge,Q);return e.createElement(e.Fragment,null,q==="before"?e.createElement("div",{dir:"rtl"},N,M):q==="after"?e.createElement("div",{dir:"ltr"},N,M):e.createElement("div",{dir:fe},N,M))});I.propTypes={checked:t.bool,className:t.string,defaultChecked:t.bool,defaultValue:t.any,dir:t.string,disabled:t.bool,id:t.string,size:t.oneOf([null,"small","medium","large"]),rounded:t.oneOf([null,"small","medium","large"]),ariaLabelledBy:t.string,ariaDescribedBy:t.string,label:t.any,labelPlacement:t.string,labelOptional:t.bool,name:t.string,tabIndex:t.number,value:t.any,validationMessage:t.string,required:t.bool,validate:t.bool,valid:t.bool,autoFocus:t.bool,onChange:t.func,onFocus:t.func,onBlur:t.func};const $={size:"medium",rounded:"medium",autoFocus:!1};I.displayName="KendoCheckbox";exports.Checkbox=I;exports.CheckboxPropsContext=A;
@@ -8,173 +8,174 @@
8
8
  "use client";
9
9
  import * as e from "react";
10
10
  import a from "prop-types";
11
- import { createPropsContext as ge, validatePackage as ye, usePropsContext as xe, useId as Ve, dispatchEvent as E, Keys as U, useDir as Ee, classNames as P, kendoThemeMaps as $, getTabIndex as Pe } from "@progress/kendo-react-common";
12
- import { packageMetadata as Be } from "../package-metadata.mjs";
11
+ import { createPropsContext as ye, validatePackage as xe, usePropsContext as Ve, useId as Ee, dispatchEvent as V, Keys as H, useDir as Pe, classNames as E, kendoThemeMaps as U, getTabIndex as Be } from "@progress/kendo-react-common";
12
+ import { packageMetadata as Fe } from "../package-metadata.mjs";
13
13
  import { useLocalization as Ie } from "@progress/kendo-react-intl";
14
14
  import { messages as Me, checkboxValidation as Ne, checkboxOptionalText as ze } from "../messages/index.mjs";
15
- const Se = ge(), W = e.forwardRef((j, G) => {
16
- ye(Be);
17
- const B = xe(Se, j), {
18
- ariaDescribedBy: J,
19
- ariaLabelledBy: Q,
20
- checked: I,
21
- className: X,
22
- labelClassName: Y,
23
- children: Z,
24
- defaultChecked: _,
25
- disabled: l,
26
- defaultValue: ee,
27
- id: M,
28
- size: m = A.size,
29
- rounded: b = A.rounded,
30
- label: N,
31
- labelPlacement: z,
32
- name: ae,
33
- labelOptional: te,
34
- onChange: p,
35
- onFocus: k,
36
- onBlur: f,
37
- tabIndex: le,
15
+ const Se = ye(), A = e.forwardRef((W, j) => {
16
+ xe(Fe);
17
+ const P = Ve(Se, W), {
18
+ ariaDescribedBy: G,
19
+ ariaLabelledBy: J,
20
+ checked: B,
21
+ className: Q,
22
+ labelClassName: X,
23
+ children: Y,
24
+ defaultChecked: Z,
25
+ disabled: o,
26
+ defaultValue: _,
27
+ id: F,
28
+ size: u = $.size,
29
+ rounded: m = $.rounded,
30
+ label: I,
31
+ labelPlacement: M,
32
+ name: ee,
33
+ labelOptional: ae,
34
+ onChange: b,
35
+ onFocus: p,
36
+ onBlur: k,
37
+ tabIndex: te,
38
38
  value: s,
39
- required: h,
40
- valid: S,
41
- validationMessage: D,
42
- validityStyles: F,
39
+ required: f,
40
+ valid: N,
41
+ validationMessage: z,
42
+ validityStyles: S,
43
+ autoFocus: oe,
43
44
  // Removed to support direct use in Form Field component
44
45
  visited: De,
45
- touched: Fe,
46
- modified: Ke,
47
- ...ne
48
- } = B, n = e.useRef(null), K = e.useCallback(
46
+ touched: Ke,
47
+ modified: Te,
48
+ ...le
49
+ } = P, l = e.useRef(null), D = e.useCallback(
49
50
  () => {
50
- n.current && n.current.focus();
51
+ l.current && l.current.focus();
51
52
  },
52
53
  []
53
54
  ), c = e.useCallback(
54
55
  () => ({
55
- element: n.current,
56
- focus: K,
56
+ element: l.current,
57
+ focus: D,
57
58
  get name() {
58
- return n.current && n.current.name;
59
+ return l.current && l.current.name;
59
60
  }
60
61
  }),
61
- [K]
62
+ [D]
62
63
  );
63
- e.useImperativeHandle(G, c);
64
- const [oe, se] = e.useState(_), [ce, re] = e.useState(ee), T = typeof s == "boolean" || s === null, v = I !== void 0, r = T, C = r ? s : ce, i = v ? I : r ? void 0 : oe, w = i === void 0 && C, g = w ? C : i, d = w || r ? s === null ? s : void 0 : s || C, L = g === null || d === null, O = Ve(), ie = Ie(), R = (t) => ie.toLanguageString(t, Me[t]), q = R(Ne), de = R(ze), y = S !== void 0 ? S : h ? !!i : !0;
64
+ e.useImperativeHandle(j, c);
65
+ const [ne, se] = e.useState(Z), [ce, re] = e.useState(_), K = typeof s == "boolean" || s === null, h = B !== void 0, r = K, v = r ? s : ce, C = h ? B : r ? void 0 : ne, T = C === void 0 && v, w = T ? v : C, i = T || r ? s === null ? s : void 0 : s || v, ie = w === null || i === null, L = Ee(), de = Ie(), O = (t) => de.toLanguageString(t, Me[t]), R = O(Ne), ue = O(ze), g = N !== void 0 ? N : f ? !!C : !0;
65
66
  e.useEffect(
66
67
  () => {
67
- n.current && n.current.setCustomValidity && n.current.setCustomValidity(
68
- y ? "" : D || q
68
+ l.current && l.current.setCustomValidity && l.current.setCustomValidity(
69
+ g ? "" : z || R
69
70
  );
70
71
  },
71
- [y, D, q]
72
+ [g, z, R]
72
73
  );
73
- const u = e.useCallback(
74
- (t, o) => {
75
- !r && !l && (re(o), !v && !l && se(o)), p && !l && E(
76
- p,
74
+ const d = e.useCallback(
75
+ (t, n) => {
76
+ !r && !o && (re(n), !h && !o && se(n)), b && !o && V(
77
+ b,
77
78
  t,
78
79
  {
79
80
  ...c(),
80
- value: o
81
+ value: n
81
82
  },
82
- { value: o }
83
+ { value: n }
83
84
  );
84
85
  },
85
- [v, l, p, r, c]
86
- ), ue = e.useCallback(
87
- (t) => {
88
- const o = t.target.checked;
89
- u(t, o);
90
- },
91
- [u, s]
86
+ [h, o, b, r, c]
92
87
  ), me = e.useCallback(
93
88
  (t) => {
94
- if (l)
95
- return;
96
- const { keyCode: o } = t, Ce = t.currentTarget.checked;
97
- o === U.space && (t.preventDefault(), t.stopPropagation(), u(t, !Ce));
89
+ const n = t.target.checked;
90
+ d(t, n);
98
91
  },
99
- [l, u]
92
+ [d, s]
100
93
  ), be = e.useCallback(
101
94
  (t) => {
102
- if (l)
95
+ if (o)
103
96
  return;
104
- const { keyCode: o } = t;
105
- o === U.space && t.preventDefault();
97
+ const { keyCode: n } = t, ge = t.currentTarget.checked;
98
+ n === H.space && (t.preventDefault(), t.stopPropagation(), d(t, !ge));
106
99
  },
107
- [l]
100
+ [o, d]
108
101
  ), pe = e.useCallback(
109
102
  (t) => {
110
- k && !l && E(
111
- k,
103
+ if (o)
104
+ return;
105
+ const { keyCode: n } = t;
106
+ n === H.space && t.preventDefault();
107
+ },
108
+ [o]
109
+ ), ke = e.useCallback(
110
+ (t) => {
111
+ p && !o && V(
112
+ p,
112
113
  t,
113
114
  c(),
114
115
  void 0
115
116
  );
116
117
  },
117
- [k, l, c]
118
- ), ke = e.useCallback(
118
+ [p, o, c]
119
+ ), fe = e.useCallback(
119
120
  (t) => {
120
- f && !l && E(
121
- f,
121
+ k && !o && V(
122
+ k,
122
123
  t,
123
124
  c(),
124
125
  void 0
125
126
  );
126
127
  },
127
- [f, l, c]
128
- ), fe = Ee(n, B.dir), he = P(
128
+ [k, o, c]
129
+ ), he = Pe(l, P.dir), ve = E(
129
130
  "k-checkbox-wrap",
130
- X
131
- ), H = {
131
+ Q
132
+ ), q = {
132
133
  type: "checkbox",
133
- className: P(
134
+ className: E(
134
135
  "k-checkbox",
135
136
  {
136
- [`k-checkbox-${$.sizeMap[m] || m}`]: m,
137
- [`k-rounded-${$.roundedMap[b] || b}`]: b,
138
- "k-indeterminate": L,
139
- "k-disabled": l,
140
- "k-invalid k-invalid": !(y || F !== void 0 || F === !0)
137
+ [`k-checkbox-${U.sizeMap[u] || u}`]: u,
138
+ [`k-rounded-${U.roundedMap[m] || m}`]: m,
139
+ "k-indeterminate": ie,
140
+ "k-disabled": o,
141
+ "k-invalid k-invalid": !(g || S !== void 0 || S === !0)
141
142
  }
142
143
  ),
143
- ref: n,
144
- name: ae,
145
- id: M || O,
146
- "aria-labelledby": Q,
147
- "aria-describedby": J,
148
- checked: !!g,
149
- disabled: l,
150
- tabIndex: Pe(le, l),
144
+ ref: l,
145
+ name: ee,
146
+ id: F || L,
147
+ disabled: o,
148
+ required: f !== void 0 ? f : !1,
149
+ tabIndex: Be(te, o),
151
150
  role: "checkbox",
152
- required: h !== void 0 ? h : !1,
153
- "aria-checked": i || g ? !0 : L ? "mixed" : !1,
154
- "aria-disabled": l || void 0,
155
- ...ne,
156
- onChange: ue,
157
- onKeyDown: me,
158
- onKeyUp: be,
159
- onFocus: pe,
160
- onBlur: ke
161
- }, ve = (
151
+ checked: !!w,
152
+ "aria-describedby": G,
153
+ "aria-labelledby": J,
154
+ "aria-disabled": o || void 0,
155
+ autoFocus: oe,
156
+ ...le,
157
+ onChange: me,
158
+ onKeyDown: be,
159
+ onKeyUp: pe,
160
+ onFocus: ke,
161
+ onBlur: fe
162
+ }, Ce = (
162
163
  // removing value prop is required due to bug in react where
163
164
  // value set to undefined override default submit value
164
- d === void 0 ? /* @__PURE__ */ e.createElement("input", { ...H }) : /* @__PURE__ */ e.createElement("input", { ...H, value: T ? void 0 : d === null ? "" : d })
165
- ), x = N !== void 0 ? /* @__PURE__ */ e.createElement(
165
+ i === void 0 ? /* @__PURE__ */ e.createElement("input", { ...q }) : /* @__PURE__ */ e.createElement("input", { ...q, value: K ? void 0 : i === null ? "" : i })
166
+ ), y = I !== void 0 ? /* @__PURE__ */ e.createElement(
166
167
  "label",
167
168
  {
168
- className: P("k-checkbox-label", Y),
169
- htmlFor: M || O,
169
+ className: E("k-checkbox-label", X),
170
+ htmlFor: F || L,
170
171
  style: { userSelect: "none" }
171
172
  },
172
- /* @__PURE__ */ e.createElement(e.Fragment, null, N),
173
- te && /* @__PURE__ */ e.createElement("span", { className: "k-label-optional" }, de)
174
- ) : null, V = /* @__PURE__ */ e.createElement("span", { className: he }, ve, Z);
175
- return /* @__PURE__ */ e.createElement(e.Fragment, null, z === "before" ? /* @__PURE__ */ e.createElement("div", { dir: "rtl" }, V, x) : z === "after" ? /* @__PURE__ */ e.createElement("div", { dir: "ltr" }, V, x) : /* @__PURE__ */ e.createElement("div", { dir: fe }, V, x));
173
+ /* @__PURE__ */ e.createElement(e.Fragment, null, I),
174
+ ae && /* @__PURE__ */ e.createElement("span", { className: "k-label-optional" }, ue)
175
+ ) : null, x = /* @__PURE__ */ e.createElement("span", { className: ve }, Ce, Y);
176
+ return /* @__PURE__ */ e.createElement(e.Fragment, null, M === "before" ? /* @__PURE__ */ e.createElement("div", { dir: "rtl" }, x, y) : M === "after" ? /* @__PURE__ */ e.createElement("div", { dir: "ltr" }, x, y) : /* @__PURE__ */ e.createElement("div", { dir: he }, x, y));
176
177
  });
177
- W.propTypes = {
178
+ A.propTypes = {
178
179
  checked: a.bool,
179
180
  className: a.string,
180
181
  defaultChecked: a.bool,
@@ -196,16 +197,18 @@ W.propTypes = {
196
197
  required: a.bool,
197
198
  validate: a.bool,
198
199
  valid: a.bool,
200
+ autoFocus: a.bool,
199
201
  onChange: a.func,
200
202
  onFocus: a.func,
201
203
  onBlur: a.func
202
204
  };
203
- const A = {
205
+ const $ = {
204
206
  size: "medium",
205
- rounded: "medium"
207
+ rounded: "medium",
208
+ autoFocus: !1
206
209
  };
207
- W.displayName = "KendoCheckbox";
210
+ A.displayName = "KendoCheckbox";
208
211
  export {
209
- W as Checkbox,
212
+ A as Checkbox,
210
213
  Se as CheckboxPropsContext
211
214
  };