@progress/kendo-react-inputs 8.2.1-develop.5 → 8.3.0-develop.10

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,110 +8,115 @@
8
8
  "use client";
9
9
  import * as t from "react";
10
10
  import e from "prop-types";
11
- import { RadioButton as M } from "./RadioButton.mjs";
12
- import { createPropsContext as q, validatePackage as A, usePropsContext as J, focusFirstFocusableChild as Q, dispatchEvent as v, useId as U, classNames as g, useRtl as W } from "@progress/kendo-react-common";
13
- import { packageMetadata as X } from "../package-metadata.mjs";
14
- const Y = q(), P = t.forwardRef((r, R) => {
15
- A(X);
16
- const m = J(Y, r), {
17
- id: E,
18
- ariaLabelledBy: I,
19
- ariaDescribedBy: N,
20
- className: B,
11
+ import { RadioButton as A } from "./RadioButton.mjs";
12
+ import { createPropsContext as J, validatePackage as Q, usePropsContext as W, useUnstyled as X, focusFirstFocusableChild as Y, dispatchEvent as P, useId as Z, classNames as R, uRadioGroup as E, useRtl as _ } from "@progress/kendo-react-common";
13
+ import { packageMetadata as $ } from "../package-metadata.mjs";
14
+ const ee = J(), G = t.forwardRef((n, I) => {
15
+ Q($);
16
+ const m = W(ee, n), {
17
+ id: N,
18
+ ariaLabelledBy: B,
19
+ ariaDescribedBy: F,
20
+ className: x,
21
21
  data: b,
22
- defaultValue: F,
23
- disabled: l,
24
- name: x,
25
- labelPlacement: G,
26
- layout: n,
27
- style: V,
22
+ defaultValue: V,
23
+ disabled: s,
24
+ name: O,
25
+ labelPlacement: j,
26
+ layout: r,
27
+ style: z,
28
28
  value: p,
29
- valid: O,
30
- item: j = Z.item,
29
+ valid: D,
30
+ item: H = ae.item,
31
31
  onChange: c,
32
- onFocus: i
33
- } = m, o = t.useRef(null), f = t.useCallback(
32
+ onFocus: d
33
+ } = m, f = X(), y = f && f.uRadioGroup, o = t.useRef(null), C = t.useCallback(
34
34
  () => {
35
- o.current && Q(o.current);
35
+ o.current && Y(o.current);
36
36
  },
37
37
  []
38
- ), d = t.useCallback(
38
+ ), i = t.useCallback(
39
39
  () => ({
40
40
  element: o.current,
41
- focus: f
41
+ focus: C
42
42
  }),
43
- [f]
43
+ [C]
44
44
  );
45
- t.useImperativeHandle(R, d);
46
- const [z, y] = t.useState(F), C = p !== void 0, u = C ? p : z, D = t.useCallback(
45
+ t.useImperativeHandle(I, i);
46
+ const [L, h] = t.useState(V), v = p !== void 0, u = v ? p : L, S = t.useCallback(
47
47
  (a) => {
48
- let s = a.value;
49
- !C && !l && y(s), c && !l && v(
48
+ let l = a.value;
49
+ !v && !s && h(l), c && !s && P(
50
50
  c,
51
51
  a.syntheticEvent,
52
- d(),
53
- { value: s }
52
+ i(),
53
+ { value: l }
54
54
  );
55
55
  },
56
- [y, c, l]
57
- ), H = t.useCallback(
56
+ [h, c, s]
57
+ ), T = t.useCallback(
58
58
  (a) => {
59
- i && !l && v(
60
- i,
59
+ d && !s && P(
60
+ d,
61
61
  a.syntheticEvent,
62
- d(),
62
+ i(),
63
63
  void 0
64
64
  );
65
65
  },
66
- [i, l]
67
- ), L = U(), S = g(
68
- "k-radio-list",
69
- {
70
- "k-list-horizontal": n === "horizontal",
71
- "k-list-vertical": n === "vertical" || n === void 0
72
- },
73
- B
74
- ), T = W(o, m.dir), w = b && b.map((a, s) => {
75
- const h = u === a.value, K = u == null, k = {
66
+ [d, s]
67
+ ), w = Z(), K = R(
68
+ E.ul({
69
+ c: y,
70
+ horizontal: r === "horizontal",
71
+ vertical: r === "vertical" || r === void 0
72
+ }),
73
+ x
74
+ ), M = _(o, m.dir), U = b && b.map((a, l) => {
75
+ const g = u === a.value, q = u == null, k = {
76
76
  ...a,
77
- valid: O,
78
- checked: h,
79
- disabled: !!(a.disabled || l),
80
- labelPlacement: a.labelPlacement ? a.labelPlacement : G,
81
- tabIndex: a.tabIndex ? a.tabIndex : K && s === 0 || h ? 0 : -1,
82
- index: s,
83
- name: x || L,
84
- onChange: D,
85
- onFocus: H
77
+ valid: D,
78
+ checked: g,
79
+ disabled: !!(a.disabled || s),
80
+ labelPlacement: a.labelPlacement ? a.labelPlacement : j,
81
+ tabIndex: a.tabIndex ? a.tabIndex : q && l === 0 || g ? 0 : -1,
82
+ index: l,
83
+ name: O || w,
84
+ onChange: S,
85
+ onFocus: T
86
86
  };
87
87
  return /* @__PURE__ */ t.createElement(
88
- j,
88
+ H,
89
89
  {
90
- className: g("k-radio-list-item", { "k-disabled": k.disabled || l }),
91
- key: s,
90
+ className: R(
91
+ E.item({
92
+ c: y,
93
+ disabled: k.disabled || s
94
+ })
95
+ ),
96
+ key: l,
92
97
  role: "none"
93
98
  },
94
- /* @__PURE__ */ t.createElement(M, { ...k })
99
+ /* @__PURE__ */ t.createElement(A, { ...k })
95
100
  );
96
101
  });
97
102
  return /* @__PURE__ */ t.createElement(
98
103
  "ul",
99
104
  {
100
- id: E,
105
+ id: N,
101
106
  role: "radiogroup",
102
- className: S,
107
+ className: K,
103
108
  ref: o,
104
- dir: T,
105
- style: V,
106
- "aria-labelledby": I,
107
- "aria-describedby": N
109
+ dir: M,
110
+ style: z,
111
+ "aria-labelledby": B,
112
+ "aria-describedby": F
108
113
  },
109
- w
114
+ U
110
115
  );
111
- }), Z = {
112
- item: (r) => /* @__PURE__ */ t.createElement("li", { ...r })
116
+ }), ae = {
117
+ item: (n) => /* @__PURE__ */ t.createElement("li", { ...n })
113
118
  };
114
- P.propTypes = {
119
+ G.propTypes = {
115
120
  ariaLabelledBy: e.string,
116
121
  ariaDescribedBy: e.string,
117
122
  className: e.string,
@@ -127,8 +132,8 @@ P.propTypes = {
127
132
  onChange: e.func,
128
133
  onFocus: e.func
129
134
  };
130
- P.displayName = "KendoRadioGroup";
135
+ G.displayName = "KendoRadioGroup";
131
136
  export {
132
- P as RadioGroup,
133
- Y as RadioGroupPropsContext
137
+ G as RadioGroup,
138
+ ee as RadioGroupPropsContext
134
139
  };
@@ -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 E=require("react"),c=require("prop-types"),o=require("@progress/kendo-react-common"),P=require("../package-metadata.js");function q(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,a.get?a:{enumerable:!0,get:()=>e[n]})}}return r.default=e,Object.freeze(r)}const t=q(E),f=t.forwardRef((e,r)=>{o.validatePackage(P.packageMetadata);const n=t.useRef(null),a=t.useRef(null),s=t.useRef(),v=t.useCallback(()=>{var u;return s.current!==void 0?s.current:(u=n.current)==null?void 0:u.value},[]);t.useImperativeHandle(a,()=>({get element(){return n.current},get name(){return n.current&&n.current.name},get value(){return v()}})),t.useImperativeHandle(r,()=>a.current);const{size:i=l.size,fillMode:m=l.fillMode,rounded:d=l.rounded,autoFocus:k=l.autoFocus,className:p,dir:x,style:h,prefix:b=l.prefix,suffix:C=l.suffix,valid:z,modified:N,touched:j,visited:D,...y}=e,[M]=o.useCustomComponent(b),[F]=o.useCustomComponent(C),[_,g]=t.useState(!1),B=u=>{g(!0)},O=u=>{g(!1)},R=t.useCallback(u=>{s.current=u.target.value,e.onChange&&e.onChange.call(void 0,{syntheticEvent:u,nativeEvent:u.nativeEvent,value:u.target.value,target:a.current}),s.current=void 0},[e.onChange]),{onFocus:T,onBlur:S}=o.useAsyncFocusBlur({onFocus:B,onBlur:O,onSyncFocus:e.onFocus,onSyncBlur:e.onBlur});return t.createElement("span",{style:h,dir:x,className:o.classNames("k-textbox k-input",{[`k-input-${o.kendoThemeMaps.sizeMap[i]||i}`]:i,[`k-input-${m}`]:m,[`k-rounded-${o.kendoThemeMaps.roundedMap[d]||d}`]:d},{"k-focus":_,"k-required":e.required,"k-disabled":e.disabled,"k-invalid":e.valid===!1},p),onFocus:T,onBlur:S},t.createElement(M,null),t.createElement("input",{ref:n,className:"k-input-inner",autoFocus:k,...y,onChange:R}),t.createElement(F,null))}),l={prefix:e=>null,suffix:e=>null,size:"medium",rounded:"medium",fillMode:"solid",autoFocus:!1};f.propTypes={size:c.oneOf([null,"small","medium","large"]),rounded:c.oneOf([null,"small","medium","large","full"]),fillMode:c.oneOf([null,"solid","flat","outline"]),autoFocus:c.bool};f.displayName="KendoReactTextBoxComponent";exports.TextBox=f;
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("react"),c=require("prop-types"),l=require("@progress/kendo-react-common"),j=require("../package-metadata.js");function z(e){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(s,n,a.get?a:{enumerable:!0,get:()=>e[n]})}}return s.default=e,Object.freeze(s)}const t=z(P),d=t.forwardRef((e,s)=>{l.validatePackage(j.packageMetadata);const n=t.useRef(null),a=t.useRef(null),r=t.useRef(),f=l.useUnstyled(),i=f&&f.uTextBox,b=t.useCallback(()=>{var u;return r.current!==void 0?r.current:(u=n.current)==null?void 0:u.value},[]);t.useImperativeHandle(a,()=>({get element(){return n.current},get name(){return n.current&&n.current.name},get value(){return b()}})),t.useImperativeHandle(s,()=>a.current);const{size:m=o.size,fillMode:g=o.fillMode,rounded:v=o.rounded,autoFocus:h=o.autoFocus,className:x,dir:B,style:F,prefix:T=o.prefix,suffix:_=o.suffix,valid:w,modified:D,touched:H,visited:I,...M}=e,[O]=l.useCustomComponent(T),[R]=l.useCustomComponent(_),[C,y]=t.useState(!1),N=u=>{y(!0)},S=u=>{y(!1)},k=t.useCallback(u=>{r.current=u.target.value,e.onChange&&e.onChange.call(void 0,{syntheticEvent:u,nativeEvent:u.nativeEvent,value:u.target.value,target:a.current}),r.current=void 0},[e.onChange]),{onFocus:p,onBlur:q}=l.useAsyncFocusBlur({onFocus:N,onBlur:S,onSyncFocus:e.onFocus,onSyncBlur:e.onBlur}),E=t.useMemo(()=>l.classNames(l.uTextBox.wrapper({c:i,rounded:v,fillMode:g,size:m,focused:C,required:e.required,disabled:e.disabled,invalid:e.valid===!1}),x),[x,g,C,e.disabled,e.required,e.valid,v,m,i]);return t.createElement("span",{style:F,dir:B,className:E,onFocus:p,onBlur:q},t.createElement(O,null),t.createElement("input",{ref:n,className:l.classNames(l.uTextBox.input({c:i})),autoFocus:h,...M,onChange:k}),t.createElement(R,null))}),o={prefix:e=>null,suffix:e=>null,size:"medium",rounded:"medium",fillMode:"solid",autoFocus:!1};d.propTypes={size:c.oneOf([null,"small","medium","large"]),rounded:c.oneOf([null,"small","medium","large","full"]),fillMode:c.oneOf([null,"solid","flat","outline"]),autoFocus:c.bool};d.displayName="KendoReactTextBoxComponent";exports.TextBox=d;
@@ -6,21 +6,21 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  "use client";
9
- import * as e from "react";
10
- import a from "prop-types";
11
- import { validatePackage as P, useCustomComponent as f, useAsyncFocusBlur as S, classNames as O, kendoThemeMaps as m } from "@progress/kendo-react-common";
12
- import { packageMetadata as $ } from "../package-metadata.mjs";
13
- const v = e.forwardRef((n, g) => {
14
- P($);
15
- const l = e.useRef(null), r = e.useRef(null), o = e.useRef(), k = e.useCallback(
9
+ import * as t from "react";
10
+ import o from "prop-types";
11
+ import { validatePackage as w, useUnstyled as H, useCustomComponent as g, useAsyncFocusBlur as I, classNames as h, uTextBox as C } from "@progress/kendo-react-common";
12
+ import { packageMetadata as A } from "../package-metadata.mjs";
13
+ const B = t.forwardRef((e, F) => {
14
+ w(A);
15
+ const l = t.useRef(null), s = t.useRef(null), a = t.useRef(), c = H(), r = c && c.uTextBox, y = t.useCallback(
16
16
  () => {
17
- var t;
18
- return o.current !== void 0 ? o.current : (t = l.current) == null ? void 0 : t.value;
17
+ var n;
18
+ return a.current !== void 0 ? a.current : (n = l.current) == null ? void 0 : n.value;
19
19
  },
20
20
  []
21
21
  );
22
- e.useImperativeHandle(
23
- r,
22
+ t.useImperativeHandle(
23
+ s,
24
24
  () => ({
25
25
  get element() {
26
26
  return l.current;
@@ -29,100 +29,98 @@ const v = e.forwardRef((n, g) => {
29
29
  return l.current && l.current.name;
30
30
  },
31
31
  get value() {
32
- return k();
32
+ return y();
33
33
  }
34
34
  })
35
- ), e.useImperativeHandle(
36
- g,
37
- () => r.current
35
+ ), t.useImperativeHandle(
36
+ F,
37
+ () => s.current
38
38
  );
39
39
  const {
40
- size: s = u.size,
41
- fillMode: c = u.fillMode,
42
- rounded: i = u.rounded,
43
- autoFocus: x = u.autoFocus,
44
- className: h,
45
- dir: p,
46
- style: C,
47
- prefix: F = u.prefix,
48
- suffix: y = u.suffix,
49
- valid: q,
40
+ size: i = u.size,
41
+ fillMode: d = u.fillMode,
42
+ rounded: f = u.rounded,
43
+ autoFocus: E = u.autoFocus,
44
+ className: m,
45
+ dir: R,
46
+ style: _,
47
+ prefix: b = u.prefix,
48
+ suffix: M = u.suffix,
49
+ valid: D,
50
50
  // Destruct to avoid warning when used inside a form field
51
- modified: H,
52
- touched: I,
53
- visited: w,
54
- ...B
55
- } = n, [M] = f(F), [E] = f(y), [R, d] = e.useState(!1), _ = (t) => {
56
- d(!0);
57
- }, b = (t) => {
58
- d(!1);
59
- }, z = e.useCallback(
60
- (t) => {
61
- o.current = t.target.value, n.onChange && n.onChange.call(void 0, {
62
- syntheticEvent: t,
63
- nativeEvent: t.nativeEvent,
64
- value: t.target.value,
65
- target: r.current
66
- }), o.current = void 0;
51
+ modified: G,
52
+ touched: K,
53
+ visited: U,
54
+ ...N
55
+ } = e, [T] = g(b), [k] = g(M), [v, x] = t.useState(!1), z = (n) => {
56
+ x(!0);
57
+ }, P = (n) => {
58
+ x(!1);
59
+ }, S = t.useCallback(
60
+ (n) => {
61
+ a.current = n.target.value, e.onChange && e.onChange.call(void 0, {
62
+ syntheticEvent: n,
63
+ nativeEvent: n.nativeEvent,
64
+ value: n.target.value,
65
+ target: s.current
66
+ }), a.current = void 0;
67
67
  },
68
- [n.onChange]
69
- ), { onFocus: N, onBlur: T } = S({
70
- onFocus: _,
71
- onBlur: b,
72
- onSyncFocus: n.onFocus,
73
- onSyncBlur: n.onBlur
74
- });
75
- return /* @__PURE__ */ e.createElement(
68
+ [e.onChange]
69
+ ), { onFocus: p, onBlur: q } = I({
70
+ onFocus: z,
71
+ onBlur: P,
72
+ onSyncFocus: e.onFocus,
73
+ onSyncBlur: e.onBlur
74
+ }), O = t.useMemo(
75
+ () => h(C.wrapper({
76
+ c: r,
77
+ rounded: f,
78
+ fillMode: d,
79
+ size: i,
80
+ focused: v,
81
+ required: e.required,
82
+ disabled: e.disabled,
83
+ invalid: e.valid === !1
84
+ }), m),
85
+ [m, d, v, e.disabled, e.required, e.valid, f, i, r]
86
+ );
87
+ return /* @__PURE__ */ t.createElement(
76
88
  "span",
77
89
  {
78
- style: C,
79
- dir: p,
80
- className: O(
81
- "k-textbox k-input",
82
- {
83
- [`k-input-${m.sizeMap[s] || s}`]: s,
84
- [`k-input-${c}`]: c,
85
- [`k-rounded-${m.roundedMap[i] || i}`]: i
86
- },
87
- {
88
- "k-focus": R,
89
- "k-required": n.required,
90
- "k-disabled": n.disabled,
91
- "k-invalid": n.valid === !1
92
- },
93
- h
94
- ),
95
- onFocus: N,
96
- onBlur: T
90
+ style: _,
91
+ dir: R,
92
+ className: O,
93
+ onFocus: p,
94
+ onBlur: q
97
95
  },
98
- /* @__PURE__ */ e.createElement(M, null),
99
- /* @__PURE__ */ e.createElement(
96
+ /* @__PURE__ */ t.createElement(T, null),
97
+ /* @__PURE__ */ t.createElement(
100
98
  "input",
101
99
  {
102
100
  ref: l,
103
- className: "k-input-inner",
104
- autoFocus: x,
105
- ...B,
106
- onChange: z
101
+ className: h(C.input({ c: r })),
102
+ autoFocus: E,
103
+ ...N,
104
+ onChange: S
107
105
  }
108
106
  ),
109
- /* @__PURE__ */ e.createElement(E, null)
107
+ /* @__PURE__ */ t.createElement(k, null)
110
108
  );
111
109
  }), u = {
112
- prefix: (n) => null,
113
- suffix: (n) => null,
110
+ prefix: (e) => null,
111
+ suffix: (e) => null,
114
112
  size: "medium",
115
113
  rounded: "medium",
116
114
  fillMode: "solid",
117
115
  autoFocus: !1
118
116
  };
119
- v.propTypes = {
120
- size: a.oneOf([null, "small", "medium", "large"]),
121
- rounded: a.oneOf([null, "small", "medium", "large", "full"]),
122
- fillMode: a.oneOf([null, "solid", "flat", "outline"]),
123
- autoFocus: a.bool
117
+ B.propTypes = {
118
+ size: o.oneOf([null, "small", "medium", "large"]),
119
+ rounded: o.oneOf([null, "small", "medium", "large", "full"]),
120
+ fillMode: o.oneOf([null, "solid", "flat", "outline"]),
121
+ autoFocus: o.bool
124
122
  };
125
- v.displayName = "KendoReactTextBoxComponent";
123
+ B.displayName = "KendoReactTextBoxComponent";
126
124
  export {
127
- v as TextBox
125
+ B as TextBox
128
126
  };