@progress/kendo-react-inputs 14.5.0-develop.1 → 14.5.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.
- package/colors/ColorPicker.js +1 -1
- package/colors/ColorPicker.mjs +197 -192
- package/colors/FlatColorPicker.js +1 -1
- package/colors/FlatColorPicker.mjs +88 -88
- package/colors/interfaces/ColorPickerProps.d.ts +6 -0
- package/common/AdaptiveMode.d.ts +1 -1
- package/common/AdaptiveMode.js +1 -1
- package/common/AdaptiveMode.mjs +1 -1
- package/dist/cdn/js/kendo-react-inputs.js +1 -1
- package/numerictextbox/NumericTextBox.js +1 -1
- package/numerictextbox/NumericTextBox.mjs +95 -95
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +16 -11
- package/rating/Rating.js +1 -1
- package/rating/Rating.mjs +62 -62
- package/slider/Slider.js +1 -1
- package/slider/Slider.mjs +38 -38
- package/switch/Switch.js +1 -1
- package/switch/Switch.mjs +114 -107
|
@@ -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 $e=require("react"),t=require("prop-types"),ge=require("@progress/kendo-react-intl"),i=require("@progress/kendo-react-common"),pe=require("@progress/kendo-svg-icons"),Ue=require("@progress/kendo-react-labels"),p=require("../messages/index.js"),u=require("./utils/index.js"),ve=require("@progress/kendo-react-buttons");function We(g){const L=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(g){for(const k in g)if(k!=="default"){const B=Object.getOwnPropertyDescriptor(g,k);Object.defineProperty(L,k,B.get?B:{enumerable:!0,get:()=>g[k]})}}return L.default=g,Object.freeze(L)}const n=We($e),Ye="Please enter a valid value!",Ve=i.createPropsContext(),Q=n.forwardRef((g,L)=>{const k=i.usePropsContext(Ve,g),{className:B,value:
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $e=require("react"),t=require("prop-types"),ge=require("@progress/kendo-react-intl"),i=require("@progress/kendo-react-common"),pe=require("@progress/kendo-svg-icons"),Ue=require("@progress/kendo-react-labels"),p=require("../messages/index.js"),u=require("./utils/index.js"),ve=require("@progress/kendo-react-buttons");function We(g){const L=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(g){for(const k in g)if(k!=="default"){const B=Object.getOwnPropertyDescriptor(g,k);Object.defineProperty(L,k,B.get?B:{enumerable:!0,get:()=>g[k]})}}return L.default=g,Object.freeze(L)}const n=We($e),Ye="Please enter a valid value!",Ve=i.createPropsContext(),Q=n.forwardRef((g,L)=>{const k=i.usePropsContext(Ve,g),{className:B,value:h,defaultValue:ye,format:s,width:X,tabIndex:ke,accessKey:Ce,title:Se,placeholder:Z,min:f,max:b,dir:ee,name:q,label:T,id:te,ariaDescribedBy:he,ariaLabelledBy:Ee,ariaLabel:xe,inputType:Oe,readOnly:C,validationMessage:w,children:Ie,touched:Je,visited:Qe,modified:Xe,style:ne,inputStyle:Le,valid:H,step:E=m.step,spinners:Pe=m.spinners,disabled:l=m.disabled,required:F=m.required,validityStyles:re=m.validityStyles,prefix:Ne=m.prefix,suffix:De=m.suffix,onChange:O=m.onChange,onFocus:ae=m.onFocus,onBlur:se=m.onBlur,rangeOnEnter:ue=m.rangeOnEnter,size:P=m.size,rounded:$=m.rounded,fillMode:M=m.fillMode,autoFocus:Re=m.autoFocus,inputAttributes:Be,...oe}=k,qe=i.useId(),le=te||qe,o=ge.useInternationalization(),j=ge.useLocalization(),a=n.useRef(null),z=n.useRef(void 0),[Te,I]=n.useState(!1),d=n.useRef(u.getInitialState()),_=n.useRef(!1),U=n.useRef(void 0),N=n.useRef(ye),ce=q||te,D=u.formatValue(d.current.focused&&!l?d.current.currentLooseValue:u.getStateOrPropsValue(h,N.current),s,o);U.current=D;const[Fe]=i.useCustomComponent(Ne),[Me]=i.useCustomComponent(De);n.useEffect(()=>{a.current&&a.current.setCustomValidity&&a.current.setCustomValidity(K().valid?"":w||Ye)});const ie=n.useCallback(()=>{a.current&&a.current.focus()},[]),G=n.useCallback(()=>z.current!==void 0?z.current:u.getStateOrPropsValue(h,N.current),[h]),de=n.useCallback(()=>q,[q]),A=n.useCallback(()=>F,[F]),K=n.useCallback(()=>{const r=w!==void 0,e=G(),V=H!==void 0?H:!d.current.valueIsOutOfRange&&(!A()||e!=null);return{customError:r,valid:V,valueMissing:e==null}},[w,H,G,A]),W=n.useCallback(()=>re,[re]),me=n.useCallback(()=>k,[k]),x=n.useCallback(()=>{const r={element:a.current,focus:ie};return Object.defineProperty(r,"name",{get:de}),Object.defineProperty(r,"value",{get:G}),Object.defineProperty(r,"validity",{get:K}),Object.defineProperty(r,"validityStyles",{get:W}),Object.defineProperty(r,"required",{get:A}),Object.defineProperty(r,"props",{get:me}),r},[de,G,K,W,A,ie,me]);n.useImperativeHandle(L,x);const S=n.useCallback(()=>({eventValue:u.getStateOrPropsValue(h,N.current),prevLooseValue:U.current,currentLooseValue:a.current.value,selectionStart:a.current.selectionStart,selectionEnd:a.current.selectionEnd,decimalSelect:!1,valueIsCorrected:!1,valueIsOutOfRange:!1,isPaste:_.current,focused:d.current.focused}),[h]),v=n.useCallback((r,e)=>{if(l)return;z.current=e.eventValue,N.current=e.eventValue;const V=u.formatValue(u.rangeValue(e.eventValue,f,b),s,o),c=u.rangeValue(o.parseNumber(V,s),f,b);c!==e.eventValue&&(e.valueIsOutOfRange=!0,e.eventValue=c,N.current=c),h!==e.eventValue&&i.dispatchEvent(O,r,x(),{value:e.eventValue}),z.current=void 0,d.current=e,I(R=>!R)},[h,O,l,I,x]),je=n.useCallback(r=>{const e=Number(r);if(isNaN(e))return;const V=u.rangeValue(e,f,b),c=u.formatValue(V,s,o),y={...d.current,eventValue:V,currentLooseValue:c,selectionStart:c.length,selectionEnd:c.length},R={target:a.current,currentTarget:a.current};v(R,y)},[f,b,s,o,v]);i.useKendoPaste(a,{fieldName:ce,onValueChange:je,enabled:!!ce});const ze=n.useCallback(r=>{const e=S();_.current=!1,v(r,u.sanitizeNumber(e,s,o))},[s,O,o,v,S]),_e=n.useCallback(r=>{if(C||l)return;let e=S();const V=o.parseNumber(String(e.currentLooseValue),s);if(e.selectionEnd>e.selectionStart&&e.selectionEnd-e.selectionStart===String(e.currentLooseValue).length){const c=o.numberSymbols(),y=c&&r.key===c.minusSign,R=c&&r.key===c.decimal;_.current=!y&&!R;return}switch(r.keyCode){case 38:u.increaseValue(V,e,E,f,b,s,o);break;case 40:u.decreaseValue(V,e,E,f,b,s,o);break;case 13:{if(ue===!1)return;const c=u.formatValue(u.rangeValue(V,f,b),s,o),y=u.rangeValue(o.parseNumber(c,s),f,b);e.eventValue=y,e.currentLooseValue=u.formatValue(y,s,o),e.selectionStart=e.selectionEnd=e.currentLooseValue.length;break}case 110:{const c=a.current,y=o.numberSymbols();c&&(e.currentLooseValue=e.currentLooseValue.slice(0,e.selectionStart)+y.decimal+e.currentLooseValue.slice(e.selectionEnd),e.selectionStart=e.selectionEnd=e.selectionStart+1,e=u.sanitizeNumber(e,s,o));break}default:return}r.preventDefault(),v(r,e)},[s,f,b,E,O,ue,v,S]),Ge=n.useCallback(()=>{_.current=!0},[]),Y=n.useCallback(r=>{if(C||l)return;const e=S();u.increaseValue(o.parseNumber(String(e.currentLooseValue),s),e,E,f,b,s,o),v(r,e)},[s,f,b,E,O,C,l,v,S]),J=n.useCallback(r=>{if(C||l)return;const e=S();u.decreaseValue(o.parseNumber(String(e.currentLooseValue),s),e,E,f,b,s,o),v(r,e)},[s,f,b,E,O,C,l,v,S]),Ae=n.useCallback(r=>{const e=i.getActiveElement(document);!document||e!==a.current||!a.current||C||l||(r.nativeEvent.deltaY<0&&Y(r),r.nativeEvent.deltaY>0&&J(r))},[Y,J,l,C]),Ke=n.useCallback(r=>{d.current.currentLooseValue=U.current,d.current.focused=!0,i.dispatchEvent(ae,r,x(),{}),I(e=>!e)},[ae,I,x]),we=n.useCallback(r=>{d.current=u.getInitialState(),i.dispatchEvent(se,r,x(),{}),I(e=>!e)},[se,I,x]),He=n.useCallback(r=>{if(document&&a.current){const e=i.getActiveElement(document);r.preventDefault(),e!==a.current&&a.current.focus()}},[]);i.useIsomorphicLayoutEffect(()=>{a.current&&a.current.type!=="number"&&d.current.selectionStart!==void 0&&d.current.selectionEnd!==void 0&&(a.current.selectionStart=d.current.selectionStart,a.current.selectionEnd=d.current.selectionEnd,d.current.selectionStart=void 0,d.current.selectionEnd=void 0)},[Te]);const fe=!W()||K().valid,be=n.createElement("span",{dir:ee,style:T?ne:{width:X,...ne},className:i.classNames("k-input","k-numerictextbox",{[`k-input-${i.kendoThemeMaps.sizeMap[P]||P}`]:P,[`k-input-${M}`]:M,[`k-rounded-${i.kendoThemeMaps.roundedMap[$]||$}`]:$,"k-invalid":!fe,"k-required":F,"k-disabled":l},B),"aria-disabled":l?"true":void 0,...T?{}:oe},n.createElement(Fe,null),n.createElement("input",{role:"spinbutton",value:D===null?"":D,tabIndex:i.getTabIndex(ke,l),accessKey:Ce,disabled:l,title:Se,"aria-disabled":l?"true":void 0,"aria-valuemin":f,"aria-valuemax":b,"aria-label":xe,"aria-labelledby":Ee,"aria-describedby":he,"aria-required":F,placeholder:Z,spellCheck:!1,autoComplete:"off",autoCorrect:"off",autoFocus:Re,type:Oe||"tel",className:"k-input-inner",id:le,name:q,readOnly:C,style:Le,onChange:ze,onFocus:Ke,onBlur:we,onKeyDown:_e,onPaste:Ge,onWheel:Ae,ref:a,...Be}),n.createElement(Me,null),Ie,Pe&&n.createElement("span",{className:"k-input-spinner k-spin-button",onMouseDown:He},n.createElement(ve.Button,{tabIndex:-1,type:"button",icon:"chevron-up",svgIcon:pe.chevronUpIcon,fillMode:M,size:P,className:"k-spinner-increase","aria-label":j.toLanguageString(p.numericIncreaseValue,p.messages[p.numericIncreaseValue]),title:j.toLanguageString(p.numericIncreaseValue,p.messages[p.numericIncreaseValue]),onClick:Y}),n.createElement(ve.Button,{tabIndex:-1,type:"button",icon:"chevron-down",svgIcon:pe.chevronDownIcon,fillMode:M,size:P,className:"k-spinner-decrease","aria-label":j.toLanguageString(p.numericDecreaseValue,p.messages[p.numericDecreaseValue]),title:j.toLanguageString(p.numericDecreaseValue,p.messages[p.numericDecreaseValue]),onClick:J})));return T?n.createElement(Ue.FloatingLabel,{label:T,editorId:le,editorValue:D===null?"":D,editorValid:fe,editorDisabled:l,editorPlaceholder:Z,children:be,style:{width:X},dir:ee,...oe}):be});Q.propTypes={value:t.number,defaultValue:t.number,step:t.number,format:t.oneOfType([t.string,t.shape({style:t.oneOf(["decimal","currency","percent","scientific","accounting"]),currency:t.string,currencyDisplay:t.oneOf(["symbol","code","name"]),useGrouping:t.bool,minimumIntegerDigits:t.number,minimumFractionDigits:t.number,maximumFractionDigits:t.number})]),width:t.oneOfType([t.string,t.number]),tabIndex:t.number,accessKey:t.string,title:t.string,placeholder:t.string,min:t.number,max:t.number,spinners:t.bool,disabled:t.bool,readOnly:t.bool,dir:t.string,name:t.string,label:t.string,validationMessage:t.string,required:t.bool,id:t.string,rangeOnEnter:t.bool,ariaLabelledBy:t.string,ariaDescribedBy:t.string,ariaLabel:t.string,onChange:t.func,onFocus:t.func,onBlur:t.func,size:t.oneOf(["small","medium","large"]),rounded:t.oneOf(["small","medium","large","full","none"]),fillMode:t.oneOf(["solid","flat","outline"]),inputAttributes:t.object};const m={prefix:g=>null,suffix:g=>null,step:1,spinners:!0,disabled:!1,required:!1,validityStyles:!0,rangeOnEnter:!0,autoFocus:!1,onChange:g=>{},onFocus:g=>{},onBlur:g=>{},size:void 0,rounded:void 0,fillMode:void 0};Q.displayName="KendoNumericTextBox";exports.NumericTextBox=Q;exports.NumericTextBoxPropsContext=Ve;
|
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
import * as n from "react";
|
|
9
9
|
import t from "prop-types";
|
|
10
10
|
import { useInternationalization as et, useLocalization as tt } from "@progress/kendo-react-intl";
|
|
11
|
-
import { usePropsContext as nt, useId as rt, useCustomComponent as ge, dispatchEvent as Q, useKendoPaste as at, getActiveElement as ve, useIsomorphicLayoutEffect as
|
|
12
|
-
import {
|
|
11
|
+
import { usePropsContext as nt, useId as rt, useCustomComponent as ge, dispatchEvent as Q, useKendoPaste as at, getActiveElement as ve, useIsomorphicLayoutEffect as ot, classNames as st, kendoThemeMaps as ye, getTabIndex as ut, createPropsContext as lt } from "@progress/kendo-react-common";
|
|
12
|
+
import { chevronUpIcon as it, chevronDownIcon as ct } from "@progress/kendo-svg-icons";
|
|
13
13
|
import { FloatingLabel as dt } from "@progress/kendo-react-labels";
|
|
14
|
-
import { numericIncreaseValue as
|
|
15
|
-
import { getInitialState as Ve, formatValue as O, getStateOrPropsValue as X, rangeValue as N, sanitizeNumber as Ce, decreaseValue as ke, increaseValue as
|
|
16
|
-
import { Button as
|
|
17
|
-
const mt = "Please enter a valid value!", ft =
|
|
14
|
+
import { numericIncreaseValue as j, messages as A, numericDecreaseValue as K } from "../messages/index.mjs";
|
|
15
|
+
import { getInitialState as Ve, formatValue as O, getStateOrPropsValue as X, rangeValue as N, sanitizeNumber as Ce, decreaseValue as ke, increaseValue as he } from "./utils/index.mjs";
|
|
16
|
+
import { Button as Ee } from "@progress/kendo-react-buttons";
|
|
17
|
+
const mt = "Please enter a valid value!", ft = lt(), Se = n.forwardRef(
|
|
18
18
|
(k, xe) => {
|
|
19
19
|
const _ = nt(
|
|
20
20
|
ft,
|
|
@@ -23,7 +23,7 @@ const mt = "Please enter a valid value!", ft = ut(), he = n.forwardRef(
|
|
|
23
23
|
className: Ie,
|
|
24
24
|
value: y,
|
|
25
25
|
defaultValue: Le,
|
|
26
|
-
format:
|
|
26
|
+
format: o,
|
|
27
27
|
width: Z,
|
|
28
28
|
tabIndex: Oe,
|
|
29
29
|
accessKey: Ne,
|
|
@@ -51,36 +51,36 @@ const mt = "Please enter a valid value!", ft = ut(), he = n.forwardRef(
|
|
|
51
51
|
valid: w,
|
|
52
52
|
step: V = c.step,
|
|
53
53
|
spinners: ze = c.spinners,
|
|
54
|
-
disabled:
|
|
54
|
+
disabled: u = c.disabled,
|
|
55
55
|
required: R = c.required,
|
|
56
56
|
validityStyles: ae = c.validityStyles,
|
|
57
57
|
prefix: qe = c.prefix,
|
|
58
|
-
suffix:
|
|
59
|
-
onChange:
|
|
60
|
-
onFocus:
|
|
61
|
-
onBlur:
|
|
62
|
-
rangeOnEnter:
|
|
63
|
-
size:
|
|
58
|
+
suffix: Ge = c.suffix,
|
|
59
|
+
onChange: h = c.onChange,
|
|
60
|
+
onFocus: oe = c.onFocus,
|
|
61
|
+
onBlur: se = c.onBlur,
|
|
62
|
+
rangeOnEnter: ue = c.rangeOnEnter,
|
|
63
|
+
size: S = c.size,
|
|
64
64
|
rounded: U = c.rounded,
|
|
65
65
|
fillMode: F = c.fillMode,
|
|
66
|
-
autoFocus:
|
|
67
|
-
inputAttributes:
|
|
68
|
-
...
|
|
69
|
-
} = _, Ke = rt(), ie = ne || Ke,
|
|
70
|
-
i.current.focused && !
|
|
71
|
-
|
|
72
|
-
|
|
66
|
+
autoFocus: je = c.autoFocus,
|
|
67
|
+
inputAttributes: Ae,
|
|
68
|
+
...le
|
|
69
|
+
} = _, Ke = rt(), ie = ne || Ke, s = et(), B = tt(), a = n.useRef(null), M = n.useRef(void 0), [_e, E] = n.useState(!1), i = n.useRef(Ve()), T = n.useRef(!1), $ = n.useRef(void 0), x = n.useRef(Le), ce = P || ne, I = O(
|
|
70
|
+
i.current.focused && !u ? i.current.currentLooseValue : X(y, x.current),
|
|
71
|
+
o,
|
|
72
|
+
s
|
|
73
73
|
);
|
|
74
74
|
$.current = I;
|
|
75
|
-
const [He] = ge(qe), [we] = ge(
|
|
75
|
+
const [He] = ge(qe), [we] = ge(Ge);
|
|
76
76
|
n.useEffect(() => {
|
|
77
77
|
a.current && a.current.setCustomValidity && a.current.setCustomValidity(
|
|
78
|
-
|
|
78
|
+
G().valid ? "" : H || mt
|
|
79
79
|
);
|
|
80
80
|
});
|
|
81
81
|
const de = n.useCallback(() => {
|
|
82
82
|
a.current && a.current.focus();
|
|
83
|
-
}, []), z = n.useCallback(() => M.current !== void 0 ? M.current : X(y, x.current), [y]), me = n.useCallback(() => P, [P]), q = n.useCallback(() => R, [R]),
|
|
83
|
+
}, []), z = n.useCallback(() => M.current !== void 0 ? M.current : X(y, x.current), [y]), me = n.useCallback(() => P, [P]), q = n.useCallback(() => R, [R]), G = n.useCallback(() => {
|
|
84
84
|
const r = H !== void 0, e = z(), b = w !== void 0 ? w : !i.current.valueIsOutOfRange && (!q() || e != null);
|
|
85
85
|
return {
|
|
86
86
|
customError: r,
|
|
@@ -92,8 +92,8 @@ const mt = "Please enter a valid value!", ft = ut(), he = n.forwardRef(
|
|
|
92
92
|
element: a.current,
|
|
93
93
|
focus: de
|
|
94
94
|
};
|
|
95
|
-
return Object.defineProperty(r, "name", { get: me }), Object.defineProperty(r, "value", { get: z }), Object.defineProperty(r, "validity", { get:
|
|
96
|
-
}, [me, z,
|
|
95
|
+
return Object.defineProperty(r, "name", { get: me }), Object.defineProperty(r, "value", { get: z }), Object.defineProperty(r, "validity", { get: G }), Object.defineProperty(r, "validityStyles", { get: W }), Object.defineProperty(r, "required", { get: q }), Object.defineProperty(r, "props", { get: fe }), r;
|
|
96
|
+
}, [me, z, G, W, q, de, fe]);
|
|
97
97
|
n.useImperativeHandle(xe, C);
|
|
98
98
|
const v = n.useCallback(() => ({
|
|
99
99
|
eventValue: X(y, x.current),
|
|
@@ -108,33 +108,33 @@ const mt = "Please enter a valid value!", ft = ut(), he = n.forwardRef(
|
|
|
108
108
|
focused: i.current.focused
|
|
109
109
|
}), [y]), f = n.useCallback(
|
|
110
110
|
(r, e) => {
|
|
111
|
-
if (
|
|
111
|
+
if (u)
|
|
112
112
|
return;
|
|
113
113
|
M.current = e.eventValue, x.current = e.eventValue;
|
|
114
|
-
const b = O(N(e.eventValue, d, m),
|
|
115
|
-
|
|
114
|
+
const b = O(N(e.eventValue, d, m), o, s), l = N(s.parseNumber(b, o), d, m);
|
|
115
|
+
l !== e.eventValue && (e.valueIsOutOfRange = !0, e.eventValue = l, x.current = l), y !== e.eventValue && Q(h, r, C(), {
|
|
116
116
|
value: e.eventValue
|
|
117
|
-
}), M.current = void 0, i.current = e,
|
|
117
|
+
}), M.current = void 0, i.current = e, E((L) => !L);
|
|
118
118
|
},
|
|
119
|
-
[y,
|
|
119
|
+
[y, h, u, E, C]
|
|
120
120
|
), Ue = n.useCallback(
|
|
121
121
|
(r) => {
|
|
122
122
|
const e = Number(r);
|
|
123
123
|
if (isNaN(e))
|
|
124
124
|
return;
|
|
125
|
-
const b = N(e, d, m),
|
|
125
|
+
const b = N(e, d, m), l = O(b, o, s), p = {
|
|
126
126
|
...i.current,
|
|
127
127
|
eventValue: b,
|
|
128
|
-
currentLooseValue:
|
|
129
|
-
selectionStart:
|
|
130
|
-
selectionEnd:
|
|
128
|
+
currentLooseValue: l,
|
|
129
|
+
selectionStart: l.length,
|
|
130
|
+
selectionEnd: l.length
|
|
131
131
|
}, L = {
|
|
132
132
|
target: a.current,
|
|
133
133
|
currentTarget: a.current
|
|
134
134
|
};
|
|
135
135
|
f(L, p);
|
|
136
136
|
},
|
|
137
|
-
[d, m,
|
|
137
|
+
[d, m, o, s, f]
|
|
138
138
|
);
|
|
139
139
|
at(a, {
|
|
140
140
|
fieldName: ce,
|
|
@@ -144,37 +144,37 @@ const mt = "Please enter a valid value!", ft = ut(), he = n.forwardRef(
|
|
|
144
144
|
const $e = n.useCallback(
|
|
145
145
|
(r) => {
|
|
146
146
|
const e = v();
|
|
147
|
-
T.current = !1, f(r, Ce(e,
|
|
147
|
+
T.current = !1, f(r, Ce(e, o, s));
|
|
148
148
|
},
|
|
149
|
-
[
|
|
149
|
+
[o, h, s, f, v]
|
|
150
150
|
), We = n.useCallback(
|
|
151
151
|
(r) => {
|
|
152
|
-
if (g ||
|
|
152
|
+
if (g || u)
|
|
153
153
|
return;
|
|
154
154
|
let e = v();
|
|
155
|
-
const b =
|
|
155
|
+
const b = s.parseNumber(String(e.currentLooseValue), o);
|
|
156
156
|
if (e.selectionEnd > e.selectionStart && e.selectionEnd - e.selectionStart === String(e.currentLooseValue).length) {
|
|
157
|
-
const
|
|
157
|
+
const l = s.numberSymbols(), p = l && r.key === l.minusSign, L = l && r.key === l.decimal;
|
|
158
158
|
T.current = !p && !L;
|
|
159
159
|
return;
|
|
160
160
|
}
|
|
161
161
|
switch (r.keyCode) {
|
|
162
162
|
case 38:
|
|
163
|
-
|
|
163
|
+
he(b, e, V, d, m, o, s);
|
|
164
164
|
break;
|
|
165
165
|
case 40:
|
|
166
|
-
ke(b, e, V, d, m,
|
|
166
|
+
ke(b, e, V, d, m, o, s);
|
|
167
167
|
break;
|
|
168
168
|
case 13: {
|
|
169
|
-
if (
|
|
169
|
+
if (ue === !1)
|
|
170
170
|
return;
|
|
171
|
-
const
|
|
172
|
-
e.eventValue = p, e.currentLooseValue = O(p,
|
|
171
|
+
const l = O(N(b, d, m), o, s), p = N(s.parseNumber(l, o), d, m);
|
|
172
|
+
e.eventValue = p, e.currentLooseValue = O(p, o, s), e.selectionStart = e.selectionEnd = e.currentLooseValue.length;
|
|
173
173
|
break;
|
|
174
174
|
}
|
|
175
175
|
case 110: {
|
|
176
|
-
const
|
|
177
|
-
|
|
176
|
+
const l = a.current, p = s.numberSymbols();
|
|
177
|
+
l && (e.currentLooseValue = e.currentLooseValue.slice(0, e.selectionStart) + p.decimal + e.currentLooseValue.slice(e.selectionEnd), e.selectionStart = e.selectionEnd = e.selectionStart + 1, e = Ce(e, o, s));
|
|
178
178
|
break;
|
|
179
179
|
}
|
|
180
180
|
default:
|
|
@@ -182,86 +182,86 @@ const mt = "Please enter a valid value!", ft = ut(), he = n.forwardRef(
|
|
|
182
182
|
}
|
|
183
183
|
r.preventDefault(), f(r, e);
|
|
184
184
|
},
|
|
185
|
-
[
|
|
185
|
+
[o, d, m, V, h, ue, f, v]
|
|
186
186
|
), Ye = n.useCallback(() => {
|
|
187
187
|
T.current = !0;
|
|
188
188
|
}, []), Y = n.useCallback(
|
|
189
189
|
(r) => {
|
|
190
|
-
if (g ||
|
|
190
|
+
if (g || u)
|
|
191
191
|
return;
|
|
192
192
|
const e = v();
|
|
193
|
-
|
|
194
|
-
|
|
193
|
+
he(
|
|
194
|
+
s.parseNumber(String(e.currentLooseValue), o),
|
|
195
195
|
e,
|
|
196
196
|
V,
|
|
197
197
|
d,
|
|
198
198
|
m,
|
|
199
|
-
|
|
200
|
-
|
|
199
|
+
o,
|
|
200
|
+
s
|
|
201
201
|
), f(r, e);
|
|
202
202
|
},
|
|
203
|
-
[
|
|
203
|
+
[o, d, m, V, h, g, u, f, v]
|
|
204
204
|
), J = n.useCallback(
|
|
205
205
|
(r) => {
|
|
206
|
-
if (g ||
|
|
206
|
+
if (g || u)
|
|
207
207
|
return;
|
|
208
208
|
const e = v();
|
|
209
209
|
ke(
|
|
210
|
-
|
|
210
|
+
s.parseNumber(String(e.currentLooseValue), o),
|
|
211
211
|
e,
|
|
212
212
|
V,
|
|
213
213
|
d,
|
|
214
214
|
m,
|
|
215
|
-
|
|
216
|
-
|
|
215
|
+
o,
|
|
216
|
+
s
|
|
217
217
|
), f(r, e);
|
|
218
218
|
},
|
|
219
|
-
[
|
|
219
|
+
[o, d, m, V, h, g, u, f, v]
|
|
220
220
|
), Je = n.useCallback(
|
|
221
221
|
(r) => {
|
|
222
222
|
const e = ve(document);
|
|
223
|
-
!document || e !== a.current || !a.current || g ||
|
|
223
|
+
!document || e !== a.current || !a.current || g || u || (r.nativeEvent.deltaY < 0 && Y(r), r.nativeEvent.deltaY > 0 && J(r));
|
|
224
224
|
},
|
|
225
|
-
[Y, J,
|
|
225
|
+
[Y, J, u, g]
|
|
226
226
|
), Qe = n.useCallback(
|
|
227
227
|
(r) => {
|
|
228
|
-
i.current.currentLooseValue = $.current, i.current.focused = !0, Q(
|
|
228
|
+
i.current.currentLooseValue = $.current, i.current.focused = !0, Q(oe, r, C(), {}), E((e) => !e);
|
|
229
229
|
},
|
|
230
|
-
[
|
|
230
|
+
[oe, E, C]
|
|
231
231
|
), Xe = n.useCallback(
|
|
232
232
|
(r) => {
|
|
233
|
-
i.current = Ve(), Q(
|
|
233
|
+
i.current = Ve(), Q(se, r, C(), {}), E((e) => !e);
|
|
234
234
|
},
|
|
235
|
-
[
|
|
235
|
+
[se, E, C]
|
|
236
236
|
), Ze = n.useCallback((r) => {
|
|
237
237
|
if (document && a.current) {
|
|
238
238
|
const e = ve(document);
|
|
239
239
|
r.preventDefault(), e !== a.current && a.current.focus();
|
|
240
240
|
}
|
|
241
241
|
}, []);
|
|
242
|
-
|
|
242
|
+
ot(() => {
|
|
243
243
|
a.current && a.current.type !== "number" && i.current.selectionStart !== void 0 && i.current.selectionEnd !== void 0 && (a.current.selectionStart = i.current.selectionStart, a.current.selectionEnd = i.current.selectionEnd, i.current.selectionStart = void 0, i.current.selectionEnd = void 0);
|
|
244
244
|
}, [_e]);
|
|
245
|
-
const be = !W() ||
|
|
245
|
+
const be = !W() || G().valid, pe = /* @__PURE__ */ n.createElement(
|
|
246
246
|
"span",
|
|
247
247
|
{
|
|
248
248
|
dir: te,
|
|
249
249
|
style: D ? re : { width: Z, ...re },
|
|
250
|
-
className:
|
|
250
|
+
className: st(
|
|
251
251
|
"k-input",
|
|
252
252
|
"k-numerictextbox",
|
|
253
253
|
{
|
|
254
|
-
[`k-input-${ye.sizeMap[
|
|
254
|
+
[`k-input-${ye.sizeMap[S] || S}`]: S,
|
|
255
255
|
[`k-input-${F}`]: F,
|
|
256
256
|
[`k-rounded-${ye.roundedMap[U] || U}`]: U,
|
|
257
257
|
"k-invalid": !be,
|
|
258
258
|
"k-required": R,
|
|
259
|
-
"k-disabled":
|
|
259
|
+
"k-disabled": u
|
|
260
260
|
},
|
|
261
261
|
Ie
|
|
262
262
|
),
|
|
263
|
-
"aria-disabled":
|
|
264
|
-
...D ? {} :
|
|
263
|
+
"aria-disabled": u ? "true" : void 0,
|
|
264
|
+
...D ? {} : le
|
|
265
265
|
},
|
|
266
266
|
/* @__PURE__ */ n.createElement(He, null),
|
|
267
267
|
/* @__PURE__ */ n.createElement(
|
|
@@ -269,11 +269,11 @@ const mt = "Please enter a valid value!", ft = ut(), he = n.forwardRef(
|
|
|
269
269
|
{
|
|
270
270
|
role: "spinbutton",
|
|
271
271
|
value: I === null ? "" : I,
|
|
272
|
-
tabIndex:
|
|
272
|
+
tabIndex: ut(Oe, u),
|
|
273
273
|
accessKey: Ne,
|
|
274
|
-
disabled:
|
|
274
|
+
disabled: u,
|
|
275
275
|
title: Pe,
|
|
276
|
-
"aria-disabled":
|
|
276
|
+
"aria-disabled": u ? "true" : void 0,
|
|
277
277
|
"aria-valuemin": d,
|
|
278
278
|
"aria-valuemax": m,
|
|
279
279
|
"aria-label": Fe,
|
|
@@ -284,7 +284,7 @@ const mt = "Please enter a valid value!", ft = ut(), he = n.forwardRef(
|
|
|
284
284
|
spellCheck: !1,
|
|
285
285
|
autoComplete: "off",
|
|
286
286
|
autoCorrect: "off",
|
|
287
|
-
autoFocus:
|
|
287
|
+
autoFocus: je,
|
|
288
288
|
type: Be || "tel",
|
|
289
289
|
className: "k-input-inner",
|
|
290
290
|
id: ie,
|
|
@@ -298,48 +298,48 @@ const mt = "Please enter a valid value!", ft = ut(), he = n.forwardRef(
|
|
|
298
298
|
onPaste: Ye,
|
|
299
299
|
onWheel: Je,
|
|
300
300
|
ref: a,
|
|
301
|
-
...
|
|
301
|
+
...Ae
|
|
302
302
|
}
|
|
303
303
|
),
|
|
304
304
|
/* @__PURE__ */ n.createElement(we, null),
|
|
305
305
|
Me,
|
|
306
306
|
ze && /* @__PURE__ */ n.createElement("span", { className: "k-input-spinner k-spin-button", onMouseDown: Ze }, /* @__PURE__ */ n.createElement(
|
|
307
|
-
|
|
307
|
+
Ee,
|
|
308
308
|
{
|
|
309
309
|
tabIndex: -1,
|
|
310
310
|
type: "button",
|
|
311
|
-
icon: "
|
|
311
|
+
icon: "chevron-up",
|
|
312
312
|
svgIcon: it,
|
|
313
313
|
fillMode: F,
|
|
314
|
-
size:
|
|
314
|
+
size: S,
|
|
315
315
|
className: "k-spinner-increase",
|
|
316
316
|
"aria-label": B.toLanguageString(
|
|
317
|
-
|
|
318
|
-
j
|
|
317
|
+
j,
|
|
318
|
+
A[j]
|
|
319
319
|
),
|
|
320
320
|
title: B.toLanguageString(
|
|
321
|
-
|
|
322
|
-
j
|
|
321
|
+
j,
|
|
322
|
+
A[j]
|
|
323
323
|
),
|
|
324
324
|
onClick: Y
|
|
325
325
|
}
|
|
326
326
|
), /* @__PURE__ */ n.createElement(
|
|
327
|
-
|
|
327
|
+
Ee,
|
|
328
328
|
{
|
|
329
329
|
tabIndex: -1,
|
|
330
330
|
type: "button",
|
|
331
|
-
icon: "
|
|
331
|
+
icon: "chevron-down",
|
|
332
332
|
svgIcon: ct,
|
|
333
333
|
fillMode: F,
|
|
334
|
-
size:
|
|
334
|
+
size: S,
|
|
335
335
|
className: "k-spinner-decrease",
|
|
336
336
|
"aria-label": B.toLanguageString(
|
|
337
337
|
K,
|
|
338
|
-
|
|
338
|
+
A[K]
|
|
339
339
|
),
|
|
340
340
|
title: B.toLanguageString(
|
|
341
341
|
K,
|
|
342
|
-
|
|
342
|
+
A[K]
|
|
343
343
|
),
|
|
344
344
|
onClick: J
|
|
345
345
|
}
|
|
@@ -352,17 +352,17 @@ const mt = "Please enter a valid value!", ft = ut(), he = n.forwardRef(
|
|
|
352
352
|
editorId: ie,
|
|
353
353
|
editorValue: I === null ? "" : I,
|
|
354
354
|
editorValid: be,
|
|
355
|
-
editorDisabled:
|
|
355
|
+
editorDisabled: u,
|
|
356
356
|
editorPlaceholder: ee,
|
|
357
357
|
children: pe,
|
|
358
358
|
style: { width: Z },
|
|
359
359
|
dir: te,
|
|
360
|
-
...
|
|
360
|
+
...le
|
|
361
361
|
}
|
|
362
362
|
) : pe;
|
|
363
363
|
}
|
|
364
364
|
);
|
|
365
|
-
|
|
365
|
+
Se.propTypes = {
|
|
366
366
|
value: t.number,
|
|
367
367
|
defaultValue: t.number,
|
|
368
368
|
step: t.number,
|
|
@@ -426,8 +426,8 @@ const c = {
|
|
|
426
426
|
rounded: void 0,
|
|
427
427
|
fillMode: void 0
|
|
428
428
|
};
|
|
429
|
-
|
|
429
|
+
Se.displayName = "KendoNumericTextBox";
|
|
430
430
|
export {
|
|
431
|
-
|
|
431
|
+
Se as NumericTextBox,
|
|
432
432
|
ft as NumericTextBoxPropsContext
|
|
433
433
|
};
|
package/package-metadata.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 e=Object.freeze({name:"@progress/kendo-react-inputs",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate:
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=Object.freeze({name:"@progress/kendo-react-inputs",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate: 1778664032,version:"14.5.0-develop.10",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"});exports.packageMetadata=e;
|
package/package-metadata.mjs
CHANGED
|
@@ -7,7 +7,7 @@ export const packageMetadata = Object.freeze({
|
|
|
7
7
|
productName: 'KendoReact',
|
|
8
8
|
productCode: 'KENDOUIREACT',
|
|
9
9
|
productCodes: ['KENDOUIREACT'],
|
|
10
|
-
publishDate:
|
|
11
|
-
version: '14.5.0-develop.
|
|
10
|
+
publishDate: 1778664032,
|
|
11
|
+
version: '14.5.0-develop.10',
|
|
12
12
|
licensingDocsUrl: 'https://www.telerik.com/kendo-react-ui/components/my-license/'
|
|
13
13
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-react-inputs",
|
|
3
|
-
"version": "14.5.0-develop.
|
|
3
|
+
"version": "14.5.0-develop.10",
|
|
4
4
|
"description": "React Inputs offer a customizable interface for users to enter and pick different information. KendoReact Input package",
|
|
5
5
|
"author": "Progress",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -28,15 +28,15 @@
|
|
|
28
28
|
"@progress/kendo-drawing": "^1.21.2",
|
|
29
29
|
"@progress/kendo-inputs-common": "^3.1.0",
|
|
30
30
|
"@progress/kendo-licensing": "^1.7.2",
|
|
31
|
-
"@progress/kendo-react-animation": "14.5.0-develop.
|
|
32
|
-
"@progress/kendo-react-buttons": "14.5.0-develop.
|
|
33
|
-
"@progress/kendo-react-common": "14.5.0-develop.
|
|
34
|
-
"@progress/kendo-react-dialogs": "14.5.0-develop.
|
|
35
|
-
"@progress/kendo-react-layout": "14.5.0-develop.
|
|
36
|
-
"@progress/kendo-react-intl": "14.5.0-develop.
|
|
37
|
-
"@progress/kendo-react-labels": "14.5.0-develop.
|
|
38
|
-
"@progress/kendo-react-popup": "14.5.0-develop.
|
|
39
|
-
"@progress/kendo-svg-icons": "^4.0.0",
|
|
31
|
+
"@progress/kendo-react-animation": "14.5.0-develop.10",
|
|
32
|
+
"@progress/kendo-react-buttons": "14.5.0-develop.10",
|
|
33
|
+
"@progress/kendo-react-common": "14.5.0-develop.10",
|
|
34
|
+
"@progress/kendo-react-dialogs": "14.5.0-develop.10",
|
|
35
|
+
"@progress/kendo-react-layout": "14.5.0-develop.10",
|
|
36
|
+
"@progress/kendo-react-intl": "14.5.0-develop.10",
|
|
37
|
+
"@progress/kendo-react-labels": "14.5.0-develop.10",
|
|
38
|
+
"@progress/kendo-react-popup": "14.5.0-develop.10",
|
|
39
|
+
"@progress/kendo-svg-icons": "^4.9.0 || ^5.0.0",
|
|
40
40
|
"react": "^18.0.0 || ^19.0.0",
|
|
41
41
|
"react-dom": "^18.0.0 || ^19.0.0"
|
|
42
42
|
},
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"package": {
|
|
83
83
|
"productName": "KendoReact",
|
|
84
84
|
"productCode": "KENDOUIREACT",
|
|
85
|
-
"publishDate":
|
|
85
|
+
"publishDate": 1778664032,
|
|
86
86
|
"licensingDocsUrl": "https://www.telerik.com/kendo-react-ui/components/my-license/"
|
|
87
87
|
}
|
|
88
88
|
},
|
|
@@ -92,5 +92,10 @@
|
|
|
92
92
|
},
|
|
93
93
|
"publishConfig": {
|
|
94
94
|
"access": "public"
|
|
95
|
+
},
|
|
96
|
+
"peerDependenciesMeta": {
|
|
97
|
+
"@progress/kendo-svg-icons": {
|
|
98
|
+
"optional": true
|
|
99
|
+
}
|
|
95
100
|
}
|
|
96
101
|
}
|
package/rating/Rating.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
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 J=require("react"),m=require("prop-types"),l=require("@progress/kendo-react-common"),M=require("@progress/kendo-svg-icons"),Q=require("./RatingItem.js"),c=require("./rating-reducer.js"),u=require("./utils/index.js"),V=require("../messages/index.js"),U=require("@progress/kendo-react-intl");function Y(a){const p=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const d in a)if(d!=="default"){const e=Object.getOwnPropertyDescriptor(a,d);Object.defineProperty(p,d,e.get?e:{enumerable:!0,get:()=>a[d]})}}return p.default=a,Object.freeze(p)}const n=Y(J),z=(a,p,d)=>{const[e,D]=n.useState(a);return[e,h=>{const i=c.ratingReducer(p.state||e,{...h,...p});d&&d(i,h.event),D(i)}]},F=l.createPropsContext(),S=n.forwardRef((a,p)=>{const d=l.usePropsContext(F,a),e={dir:s.dir,min:s.min,max:s.max,step:s.step,item:s.item,defaultValue:s.defaultValue,readonly:s.readonly,disabled:s.disabled,selection:s.selection,precision:s.precision,...d},D=U.useLocalization(),I=n.useRef(null),h=n.useRef(null),i=l.useDir(h,e.dir);n.useImperativeHandle(I,()=>({element:h.current,props:e})),n.useImperativeHandle(p,()=>I.current);const H=n.useCallback((t,o)=>{e.onChange&&I.current&&e.onChange.call(void 0,{value:t,target:I.current,syntheticEvent:o})},[e.onChange]),N=n.useMemo(()=>e.min!==void 0?e.min:s.min,[e.min]),R=n.useMemo(()=>e.max!==void 0?e.max:s.max,[e.max]),v=n.useMemo(()=>e.precision||s.precision,[e.precision]),r=n.useMemo(()=>e.step!==void 0?e.step:s.step,[e.step]),A=n.useMemo(()=>e.readonly||s.readonly,[e.readonly]),C=n.useMemo(()=>e.disabled||s.disabled,[e.disabled]),K=n.useMemo(()=>e.item||s.item,[e.item]),[G,f]=z(e.defaultValue!==void 0?e.defaultValue:s.defaultValue,{state:e.value,min:N,max:R,step:v==="half"?r/2:r},H),[w,E]=z(null,{state:e.value,min:N,max:R,step:v==="half"?r/2:r,precision:v}),g=n.useMemo(()=>e.value!==void 0?e.value:G,[e.value,G]),T=n.useMemo(()=>w,[w]),_=n.useMemo(()=>e.selection||s.selection,[e.selection]),k=n.useMemo(()=>r/(v==="half"?2:1),[r,v]),q=n.useCallback(t=>{if(!(!t.target||!t.target.element||A||C)){if(v==="half"){const o=t.target.element.getBoundingClientRect(),x=u.calcIsFirstHalf(i||"ltr",o,t.syntheticEvent.clientX)?u.toRound(t.target.value-r/2,k):t.target.value;f({type:c.RATING_ACTION.select,payload:x,event:t.syntheticEvent})}else f({type:c.RATING_ACTION.select,payload:t.target.value,event:t.syntheticEvent});if(e.onClick){const o={value:g,target:I.current,syntheticEvent:t.syntheticEvent};e.onClick.call(void 0,o)}}},[e.onClick,f,g]),B=n.useCallback(t=>{if(!(A||C)){switch(t.keyCode){case l.Keys.right:t.preventDefault(),f({type:i==="rtl"?c.RATING_ACTION.decrease:c.RATING_ACTION.increase,event:t});break;case l.Keys.left:t.preventDefault(),f({type:i==="rtl"?c.RATING_ACTION.increase:c.RATING_ACTION.decrease,event:t});break;case l.Keys.home:t.preventDefault(),f({type:i==="rtl"?c.RATING_ACTION.min:c.RATING_ACTION.max,event:t});break;case l.Keys.end:t.preventDefault(),f({type:i==="rtl"?c.RATING_ACTION.max:c.RATING_ACTION.min,event:t});break;case l.Keys.esc:t.preventDefault(),f({type:c.RATING_ACTION.deselect,event:t});break}e.onKeyDown&&e.onKeyDown.call(void 0,{value:g,target:I.current,syntheticEvent:t})}},[e.onKeyDown,f,g]),$=n.useCallback(t=>{if(e.onFocus){const o={target:I.current,syntheticEvent:t};e.onFocus.call(void 0,o)}},[e.onFocus]),W=n.useCallback(t=>{if(e.onBlur){const o={target:I.current,syntheticEvent:t};e.onBlur.call(void 0,o)}},[e.onBlur]),L=n.useCallback(t=>{if(!(!t.target||!t.target.element))if(v==="half"){const o=t.target.element.getBoundingClientRect(),x=u.calcIsFirstHalf(i||"ltr",o,t.syntheticEvent.clientX)?t.target.value-r/2:t.target.value;E({type:c.RATING_ACTION.select,payload:x,event:t.syntheticEvent})}else E({type:c.RATING_ACTION.select,payload:t.target.value,event:t.syntheticEvent})},[v,r,i]),j=n.useCallback(t=>{E({type:c.RATING_ACTION.reset,event:t.syntheticEvent})},[]),P=[],X=u.getRemainder(u.toRound(R-N,k),r);for(let t=N;t<=R;t=u.toRound(t+r,k)){const o=u.toRound(t+X,k),y=v==="half"?u.isHalf(o,T!==null?T:g!==null?g:0,r):!1,x=u.isSelected(o,g,r,_),O=u.isSelected(o,T!==null?T:g,r,_),b=u.isSelected(o,T,r,_);P.push(n.createElement(K,{key:o,value:o,dir:i,title:String(y?u.toRound(o-r/2,k):o),icon:e.icon,svgIcon:e.svgIcon,half:y,selected:x||O,hovered:b,onClick:q,onMouseMove:L,onMouseLeave:j},y&&n.createElement("span",{className:"k-rating-precision-complement"},!(e.icon||e.svgIconOutline)&&n.createElement(l.IconWrap,{name:"star
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const J=require("react"),m=require("prop-types"),l=require("@progress/kendo-react-common"),M=require("@progress/kendo-svg-icons"),Q=require("./RatingItem.js"),c=require("./rating-reducer.js"),u=require("./utils/index.js"),V=require("../messages/index.js"),U=require("@progress/kendo-react-intl");function Y(a){const p=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const d in a)if(d!=="default"){const e=Object.getOwnPropertyDescriptor(a,d);Object.defineProperty(p,d,e.get?e:{enumerable:!0,get:()=>a[d]})}}return p.default=a,Object.freeze(p)}const n=Y(J),z=(a,p,d)=>{const[e,D]=n.useState(a);return[e,h=>{const i=c.ratingReducer(p.state||e,{...h,...p});d&&d(i,h.event),D(i)}]},F=l.createPropsContext(),S=n.forwardRef((a,p)=>{const d=l.usePropsContext(F,a),e={dir:s.dir,min:s.min,max:s.max,step:s.step,item:s.item,defaultValue:s.defaultValue,readonly:s.readonly,disabled:s.disabled,selection:s.selection,precision:s.precision,...d},D=U.useLocalization(),I=n.useRef(null),h=n.useRef(null),i=l.useDir(h,e.dir);n.useImperativeHandle(I,()=>({element:h.current,props:e})),n.useImperativeHandle(p,()=>I.current);const H=n.useCallback((t,o)=>{e.onChange&&I.current&&e.onChange.call(void 0,{value:t,target:I.current,syntheticEvent:o})},[e.onChange]),N=n.useMemo(()=>e.min!==void 0?e.min:s.min,[e.min]),R=n.useMemo(()=>e.max!==void 0?e.max:s.max,[e.max]),v=n.useMemo(()=>e.precision||s.precision,[e.precision]),r=n.useMemo(()=>e.step!==void 0?e.step:s.step,[e.step]),A=n.useMemo(()=>e.readonly||s.readonly,[e.readonly]),C=n.useMemo(()=>e.disabled||s.disabled,[e.disabled]),K=n.useMemo(()=>e.item||s.item,[e.item]),[G,f]=z(e.defaultValue!==void 0?e.defaultValue:s.defaultValue,{state:e.value,min:N,max:R,step:v==="half"?r/2:r},H),[w,E]=z(null,{state:e.value,min:N,max:R,step:v==="half"?r/2:r,precision:v}),g=n.useMemo(()=>e.value!==void 0?e.value:G,[e.value,G]),T=n.useMemo(()=>w,[w]),_=n.useMemo(()=>e.selection||s.selection,[e.selection]),k=n.useMemo(()=>r/(v==="half"?2:1),[r,v]),q=n.useCallback(t=>{if(!(!t.target||!t.target.element||A||C)){if(v==="half"){const o=t.target.element.getBoundingClientRect(),x=u.calcIsFirstHalf(i||"ltr",o,t.syntheticEvent.clientX)?u.toRound(t.target.value-r/2,k):t.target.value;f({type:c.RATING_ACTION.select,payload:x,event:t.syntheticEvent})}else f({type:c.RATING_ACTION.select,payload:t.target.value,event:t.syntheticEvent});if(e.onClick){const o={value:g,target:I.current,syntheticEvent:t.syntheticEvent};e.onClick.call(void 0,o)}}},[e.onClick,f,g]),B=n.useCallback(t=>{if(!(A||C)){switch(t.keyCode){case l.Keys.right:t.preventDefault(),f({type:i==="rtl"?c.RATING_ACTION.decrease:c.RATING_ACTION.increase,event:t});break;case l.Keys.left:t.preventDefault(),f({type:i==="rtl"?c.RATING_ACTION.increase:c.RATING_ACTION.decrease,event:t});break;case l.Keys.home:t.preventDefault(),f({type:i==="rtl"?c.RATING_ACTION.min:c.RATING_ACTION.max,event:t});break;case l.Keys.end:t.preventDefault(),f({type:i==="rtl"?c.RATING_ACTION.max:c.RATING_ACTION.min,event:t});break;case l.Keys.esc:t.preventDefault(),f({type:c.RATING_ACTION.deselect,event:t});break}e.onKeyDown&&e.onKeyDown.call(void 0,{value:g,target:I.current,syntheticEvent:t})}},[e.onKeyDown,f,g]),$=n.useCallback(t=>{if(e.onFocus){const o={target:I.current,syntheticEvent:t};e.onFocus.call(void 0,o)}},[e.onFocus]),W=n.useCallback(t=>{if(e.onBlur){const o={target:I.current,syntheticEvent:t};e.onBlur.call(void 0,o)}},[e.onBlur]),L=n.useCallback(t=>{if(!(!t.target||!t.target.element))if(v==="half"){const o=t.target.element.getBoundingClientRect(),x=u.calcIsFirstHalf(i||"ltr",o,t.syntheticEvent.clientX)?t.target.value-r/2:t.target.value;E({type:c.RATING_ACTION.select,payload:x,event:t.syntheticEvent})}else E({type:c.RATING_ACTION.select,payload:t.target.value,event:t.syntheticEvent})},[v,r,i]),j=n.useCallback(t=>{E({type:c.RATING_ACTION.reset,event:t.syntheticEvent})},[]),P=[],X=u.getRemainder(u.toRound(R-N,k),r);for(let t=N;t<=R;t=u.toRound(t+r,k)){const o=u.toRound(t+X,k),y=v==="half"?u.isHalf(o,T!==null?T:g!==null?g:0,r):!1,x=u.isSelected(o,g,r,_),O=u.isSelected(o,T!==null?T:g,r,_),b=u.isSelected(o,T,r,_);P.push(n.createElement(K,{key:o,value:o,dir:i,title:String(y?u.toRound(o-r/2,k):o),icon:e.icon,svgIcon:e.svgIcon,half:y,selected:x||O,hovered:b,onClick:q,onMouseMove:L,onMouseLeave:j},y&&n.createElement("span",{className:"k-rating-precision-complement"},!(e.icon||e.svgIconOutline)&&n.createElement(l.IconWrap,{name:"star",icon:M.starIcon,style:{clipPath:`${i==="rtl"?"inset(0 50% 0 0)":"inset(0 0 0 50%)"}`},size:"xlarge"}),(e.icon||e.svgIconOutline)&&n.createElement(l.IconWrap,{name:l.toIconName(`${e.icon}-outline`),icon:e.svgIconOutline,size:"xlarge"})),y&&n.createElement("span",{className:"k-rating-precision-part"},!(e.icon||e.svgIcon)&&n.createElement(l.IconWrap,{name:"star",icon:M.starIcon,style:{clipPath:`${i==="rtl"?"inset(0 0 0 50%)":"inset(0 50% 0 0)"}`},size:"xlarge"}),(e.icon||e.svgIcon)&&n.createElement(l.IconWrap,{name:e.icon?l.toIconName(e.icon):void 0,icon:e.svgIcon,size:"xlarge"})),y&&n.createElement("span",{style:{width:"24px",height:"24px",display:"block"}}),!y&&!(e.icon||e.svgIcon)&&(b||O&&!b)&&n.createElement(l.IconWrap,{name:"star",icon:M.starIcon,size:"xlarge"})||!(e.icon||e.svgIcon)&&!b&&!O&&n.createElement(l.IconWrap,{name:"star",icon:M.starIcon,size:"xlarge"})||(e.icon||e.svgIcon)&&(b||O&&!b)&&n.createElement(l.IconWrap,{name:e.icon,icon:e.svgIcon,size:"xlarge"})||(e.icon||e.svgIcon)&&!b&&n.createElement(l.IconWrap,{name:l.toIconName(`${e.icon}-outline`),icon:e.svgIconOutline,size:"xlarge"})))}return n.createElement("span",{id:e.id,style:e.style,ref:h,role:"slider",dir:i,tabIndex:l.getTabIndex(e.tabIndex,e.disabled,void 0),className:l.classNames("k-rating",{"k-rtl":i==="rtl","k-readonly":A,"k-disabled":C},e.className),onKeyDown:B,onFocus:$,onBlur:W,"aria-valuemin":N,"aria-valuemax":R,"aria-valuenow":g!==null?g:void 0,"aria-disabled":C?"true":void 0,"aria-label":D.toLanguageString(V.ratingAriaLabel,V.messages[V.ratingAriaLabel]),"aria-labelledby":e.ariaLabelledBy,"aria-describedby":e.ariaDescribedBy},n.createElement("input",{id:"rating",className:"k-hidden",readOnly:A,disabled:C}),n.createElement("span",{className:"k-rating-container"},P),e.label&&n.createElement("span",{className:"k-rating-label"},e.label))}),Z={id:m.string,dir:m.oneOf(["ltr","rtl"]),selection:m.oneOf(["continues","single"]),precision:m.oneOf(["item","half"]),value:(a,p,d)=>a.value&&a.min&&a.max&&a.step&&!(a.precision==="half"?u.isCorrectValue(a.min,a.max,a.step/2,a.value):u.isCorrectValue(a.min,a.max,a.step,a.value))&&a.precision==="half"?new Error(`Invalid prop + ${p} supplied to ${d}.
|
|
9
9
|
The value of the { value } property is not correct, please check your values.
|
|
10
10
|
`):null,defaultValue:m.number,min:m.number,max:m.number,step:(a,p,d)=>a.step!==void 0&&a.step<=0?new Error(`Invalid prop + ${p} supplied to ${d}.
|
|
11
11
|
The value of the { step } property is cannot be equal or less than "0", please check your values.
|