@progress/kendo-react-inputs 14.5.0-develop.13 → 14.5.0-develop.14
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/MaskedTextBoxMcpWrapper.d.ts +17 -0
- package/MaskedTextBoxMcpWrapper.js +8 -0
- package/MaskedTextBoxMcpWrapper.mjs +18 -0
- package/colors/ColorPicker.js +1 -1
- package/colors/ColorPicker.mjs +194 -183
- package/colors/interfaces/ColorPickerProps.d.ts +6 -1
- package/dist/cdn/js/kendo-react-inputs.js +1 -1
- package/index.d.mts +5 -1
- package/index.d.ts +5 -1
- package/index.js +1 -1
- package/index.mjs +92 -89
- package/maskedtextbox/MaskedTextBoxProps.d.ts +6 -1
- package/numerictextbox/NumericTextBox.js +1 -1
- package/numerictextbox/NumericTextBox.mjs +170 -168
- package/numerictextbox/interfaces/NumericTextBoxProps.d.ts +6 -1
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +10 -10
- package/range-slider/RangeSlider.d.ts +6 -1
- package/range-slider/RangeSlider.js +2 -2
- package/range-slider/RangeSlider.mjs +43 -43
- package/rating/Rating.d.ts +6 -1
- package/rating/Rating.js +2 -2
- package/rating/Rating.mjs +62 -62
- package/signature/Signature.js +1 -1
- package/signature/Signature.mjs +94 -92
- package/signature/interfaces/SignatureProps.d.ts +6 -1
- package/slider/Slider.d.ts +6 -1
- package/slider/Slider.js +1 -1
- package/slider/Slider.mjs +131 -134
- package/switch/Switch.d.ts +6 -1
- package/switch/Switch.js +1 -1
- package/switch/Switch.mjs +88 -86
- package/textarea/TextArea.js +1 -1
- package/textarea/TextArea.mjs +97 -95
- package/textarea/interfaces/TextAreaProps.d.ts +6 -1
- package/textbox/Textbox.d.ts +20 -1
- package/textbox/Textbox.js +1 -1
- package/textbox/Textbox.mjs +92 -81
|
@@ -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"),I=require("prop-types"),s=require("@progress/kendo-react-common"),h=require("../messages/index.js"),Q=require("@progress/kendo-react-intl"),r=require("./range-raducer.js"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const J=require("react"),I=require("prop-types"),s=require("@progress/kendo-react-common"),h=require("../messages/index.js"),Q=require("@progress/kendo-react-intl"),r=require("./range-raducer.js"),G=require("../package-metadata.js");function Z(n){const l=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const d in n)if(d!=="default"){const i=Object.getOwnPropertyDescriptor(n,d);Object.defineProperty(l,d,i.get?i:{enumerable:!0,get:()=>n[d]})}}return l.default=n,Object.freeze(l)}const a=Z(J),ee=(n,l,d)=>{const[i,o]=a.useState(n),e=a.useCallback(g=>{const A=r.rangeReducer(l.state||i,{...g,...l});d&&d(A,g.event),o(A)},[l,d]);return[i,e]},K=s.createPropsContext(),O=a.forwardRef((n,l)=>{const d=!s.validatePackage(G.packageMetadata,{component:"RangeSlider"}),i=s.getLicenseMessage(G.packageMetadata),o=s.usePropsContext(K,n),e={step:b.step,largeStep:b.largeStep,defaultValue:b.defaultValue,vertical:b.vertical,disabled:b.disabled,...o},g=a.useRef(null),A=a.useRef(null),$=a.useRef(null),T=a.useRef(null),D=a.useRef(null),M=a.useCallback(()=>{T.current&&T.current.focus()},[T]);a.useImperativeHandle(g,()=>({element:A.current,focus:M,props:e})),a.useImperativeHandle(l,()=>g.current),s.useWebMcpRegister("rangeslider",g,e,e.webMcp);const f=a.useMemo(()=>e.min,[e.min]),y=a.useMemo(()=>e.max,[e.max]),L=a.useMemo(()=>e.step!==void 0?e.step:b.step,[e.step,b.step]),P=a.useMemo(()=>e.largeStep!==void 0?e.largeStep:b.largeStep,[e.largeStep,b.largeStep]),p=s.useDir(A,e.dir),z=(t,m)=>{e.onChange&&g.current&&e.onChange.call(void 0,{value:t,target:g.current,syntheticEvent:m})},[_,S]=a.useState(""),[N,c]=ee(e.defaultValue||b.defaultValue,{min:f,max:y,step:L,largeStep:P,state:e.value},z),u=a.useMemo(()=>e.value||N,[e.value,N]),V=a.useRef(null),C=a.useRef(null),v=a.useMemo(()=>(u.start-f)/(y-f)*100,[u.start,f,y]),R=a.useMemo(()=>(u.end-f)/(y-f)*100,[u.end,f,y]),q=a.useMemo(()=>e.vertical?{paddingTop:0,height:"100%"}:{},[e.vertical]),j=a.useMemo(()=>e.vertical?{marginTop:"0.5rem",marginBottom:"0.5rem"}:{marginLeft:"0.5rem",marginRight:"0.5rem"},[e.vertical]),w=Q.useLocalization(),E=a.useCallback(t=>{if(!C.current)return;const m=C.current.getBoundingClientRect(),k=e.vertical?m.bottom-t.clientY:p==="rtl"?m.right-t.clientX:t.clientX-m.left,x=e.vertical?m.height:m.width,Y=k/x;return f+Y*(y-f)},[C,e.vertical,p,f,y,N.start,N.end,e.value&&e.value.start,e.value&&e.value.end]),H=a.useCallback(t=>t<=u.start?"start":t>=u.end?"end":2*t<u.end+u.start?"start":"end",[N.start,N.end,e.value&&e.value.start,e.value&&e.value.end]),W=a.useCallback(t=>{if(!e.disabled)switch(t.keyCode){case s.Keys.right:t.preventDefault(),c({type:p==="rtl"?r.RANGE_ACTION.decrease:r.RANGE_ACTION.increase,key:"start",event:t});break;case s.Keys.up:t.preventDefault(),c({type:r.RANGE_ACTION.increase,key:"start",event:t});break;case s.Keys.left:t.preventDefault(),c({type:p==="rtl"?r.RANGE_ACTION.increase:r.RANGE_ACTION.decrease,key:"start",event:t});break;case s.Keys.down:t.preventDefault(),c({type:r.RANGE_ACTION.decrease,key:"start",event:t});break;case s.Keys.home:t.preventDefault(),c({type:r.RANGE_ACTION.min,key:"start",event:t});break;case s.Keys.end:t.preventDefault(),c({type:r.RANGE_ACTION.max,key:"start",event:t});break;case s.Keys.pageDown:t.preventDefault(),c({type:p==="rtl"?r.RANGE_ACTION.increaseLarge:r.RANGE_ACTION.decreaseLarge,key:"start",event:t});break;case s.Keys.pageUp:t.preventDefault(),c({type:p==="rtl"?r.RANGE_ACTION.decreaseLarge:r.RANGE_ACTION.increaseLarge,key:"start",event:t});break}},[c,e.disabled]),B=a.useCallback(t=>{if(!e.disabled)switch(t.keyCode){case s.Keys.right:t.preventDefault(),c({type:p==="rtl"?r.RANGE_ACTION.decrease:r.RANGE_ACTION.increase,key:"end",event:t});break;case s.Keys.up:t.preventDefault(),c({type:r.RANGE_ACTION.increase,key:"end",event:t});break;case s.Keys.left:t.preventDefault(),c({type:p==="rtl"?r.RANGE_ACTION.increase:r.RANGE_ACTION.decrease,key:"end",event:t});break;case s.Keys.down:t.preventDefault(),c({type:r.RANGE_ACTION.decrease,key:"end",event:t});break;case s.Keys.home:t.preventDefault(),c({type:r.RANGE_ACTION.min,key:"end",event:t});break;case s.Keys.end:t.preventDefault(),c({type:r.RANGE_ACTION.max,key:"end",event:t});break;case s.Keys.pageDown:t.preventDefault(),c({type:p==="rtl"?r.RANGE_ACTION.increaseLarge:r.RANGE_ACTION.decreaseLarge,key:"end",event:t});break;case s.Keys.pageUp:t.preventDefault(),c({type:p==="rtl"?r.RANGE_ACTION.decreaseLarge:r.RANGE_ACTION.increaseLarge,key:"end",event:t});break}},[c,p,e.disabled]),U=a.useCallback(t=>{const m=E(t),k=H(m);S(k),k==="end"?D.current.focus():T.current.focus();const x=k==="end"?r.RANGE_ACTION.end:r.RANGE_ACTION.start;c({type:x,payload:m,event:t})},[e.vertical,f,y,c]),X=t=>{const m=E(t),k=_==="end"?r.RANGE_ACTION.end:r.RANGE_ACTION.start;c({type:k,payload:m,event:t})},F=t=>{const m=E(t),k=_==="end"?r.RANGE_ACTION.end:r.RANGE_ACTION.start;c({type:k,payload:m,event:t}),S("")};return s.useDraggable(C,{onPress:U,onDrag:X,onRelease:F},{autoScroll:!1}),a.createElement(a.Fragment,null,a.createElement("div",{id:e.id,style:e.style,ref:A,dir:p,className:s.classNames("k-slider",{"k-rtl":p==="rtl","k-disabled":e.disabled,"k-slider-vertical":e.vertical,"k-slider-horizontal":!e.vertical},e.className)},a.createElement("div",{ref:C,className:"k-slider-track-wrap",style:{flexGrow:1,position:"relative",touchAction:"none",...j}},e.children&&a.createElement("ul",{className:"k-reset k-slider-items",style:{...q}},a.Children.map(e.children,(t,m)=>t&&a.cloneElement(t,{position:100*(t.props.position-e.min)/(e.max-e.min),vertical:e.vertical,firstTick:m===0,lastTick:m===a.Children.count(e.children)-1},t.props.children))),a.createElement("div",{ref:V,className:"k-slider-track",style:e.vertical?{bottom:0,height:"100%"}:{[p==="rtl"?"right":"left"]:0,width:"100%"}},v!==null&&R!==null&&a.createElement("div",{"data-selection":!0,ref:$,title:`${u.start} - ${u.end}`,className:"k-slider-selection",style:e.vertical?{height:R-v+"%",bottom:v+"%"}:{[p==="rtl"?"right":"left"]:v+"%",width:R-v+"%"}}),a.createElement("span",{ref:T,role:"slider",tabIndex:s.getTabIndex(e.startTabIndex,e.disabled,void 0),"aria-valuemin":f,"aria-valuemax":Math.max(y,u.end),"aria-valuenow":u.start,"aria-disabled":e.disabled?"true":void 0,"aria-valuetext":`${u.start} - ${u.end}`,className:"k-draghandle k-draghandle-start",title:w.toLanguageString(h.sliderDragTitle,h.messages[h.sliderDragTitle]),style:e.vertical?{bottom:"calc("+v+"%)",zIndex:1}:p==="rtl"?{right:"calc("+v+"% - 13px)",zIndex:1}:{left:"calc("+v+"%)",zIndex:1},onKeyDown:W}),a.createElement("span",{ref:D,role:"slider",tabIndex:s.getTabIndex(e.endTabIndex,e.disabled,void 0),"aria-valuemin":Math.min(f,u.start),"aria-valuemax":y,"aria-valuenow":u.end,"aria-disabled":e.disabled?"true":void 0,"aria-valuetext":`${u.start} - ${u.end}`,className:"k-draghandle k-draghandle-end",title:w.toLanguageString(h.sliderDragTitle,h.messages[h.sliderDragTitle]),style:e.vertical?{bottom:"calc("+R+"%)",zIndex:1}:p==="rtl"?{right:"calc("+R+"% - 13px)",zIndex:1}:{left:"calc("+R+"%)",zIndex:1},onKeyDown:B})))),d&&a.createElement(s.WatermarkOverlay,{message:i}))}),te={value:(n,l,d)=>{if(n.value){const i=n.value.start,o=n.value.end,e=n.min,g=n.max;if(i>o||i>g||i<e||o>g||o<e||o<i)return new Error(`Invalid prop + ${l} supplied to ${d}.
|
|
9
9
|
The { start, end } value must be between the min & max value and { start, end } must be start < end.
|
|
10
10
|
`)}return null},defaultValue:(n,l,d)=>{if(n.defaultValue){const i=n.defaultValue.start,o=n.defaultValue.end,e=n.min,g=n.max;if(i>o||i>g||i<e||o>g||o<e||o<i)return new Error(`Invalid prop + ${l} supplied to ${d}.
|
|
11
11
|
The { start, end } value must be between the min & max value and { start, end } must be start < end.
|
|
@@ -17,4 +17,4 @@
|
|
|
17
17
|
${l} value can not be undefined.
|
|
18
18
|
`):i&&e<=o?new Error(`Invalid prop + ${l} supplied to ${d}.
|
|
19
19
|
${l} value can not be equal to or smaller than the min value.
|
|
20
|
-
`):null},vertical:I.bool,disabled:I.bool,dir:I.oneOf(["ltr","rtl"])},
|
|
20
|
+
`):null},vertical:I.bool,disabled:I.bool,dir:I.oneOf(["ltr","rtl"])},b={step:1,largeStep:10,defaultValue:{start:0,end:0},vertical:!1,disabled:!1};O.displayName="KendoReactRangeSlider";O.propTypes=te;exports.RangeSlider=O;exports.RangeSliderPropsContext=K;
|
|
@@ -7,27 +7,27 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import * as a from "react";
|
|
9
9
|
import S from "prop-types";
|
|
10
|
-
import { validatePackage as j, getLicenseMessage as J, usePropsContext as Q,
|
|
10
|
+
import { validatePackage as j, getLicenseMessage as J, usePropsContext as Q, useWebMcpRegister as Z, useDir as ee, Keys as m, useDraggable as te, classNames as ae, getTabIndex as V, WatermarkOverlay as re, createPropsContext as ne } from "@progress/kendo-react-common";
|
|
11
11
|
import { sliderDragTitle as $, messages as z } from "../messages/index.mjs";
|
|
12
|
-
import { useLocalization as
|
|
13
|
-
import { RANGE_ACTION as r, rangeReducer as
|
|
12
|
+
import { useLocalization as le } from "@progress/kendo-react-intl";
|
|
13
|
+
import { RANGE_ACTION as r, rangeReducer as se } from "./range-raducer.mjs";
|
|
14
14
|
import { packageMetadata as P } from "../package-metadata.mjs";
|
|
15
|
-
const
|
|
15
|
+
const ce = (n, s, p) => {
|
|
16
16
|
const [c, i] = a.useState(n), e = a.useCallback(
|
|
17
17
|
(f) => {
|
|
18
|
-
const h =
|
|
18
|
+
const h = se(s.state || c, { ...f, ...s });
|
|
19
19
|
p && p(h, f.event), i(h);
|
|
20
20
|
},
|
|
21
21
|
[s, p]
|
|
22
22
|
);
|
|
23
23
|
return [c, e];
|
|
24
|
-
},
|
|
25
|
-
const p = !j(P, { component: "RangeSlider" }), c = J(P), i = Q(
|
|
26
|
-
step:
|
|
27
|
-
largeStep:
|
|
28
|
-
defaultValue:
|
|
29
|
-
vertical:
|
|
30
|
-
disabled:
|
|
24
|
+
}, ie = ne(), K = a.forwardRef((n, s) => {
|
|
25
|
+
const p = !j(P, { component: "RangeSlider" }), c = J(P), i = Q(ie, n), e = {
|
|
26
|
+
step: b.step,
|
|
27
|
+
largeStep: b.largeStep,
|
|
28
|
+
defaultValue: b.defaultValue,
|
|
29
|
+
vertical: b.vertical,
|
|
30
|
+
disabled: b.disabled,
|
|
31
31
|
...i
|
|
32
32
|
}, f = a.useRef(null), h = a.useRef(null), A = a.useRef(null), w = a.useRef(null), T = a.useRef(null), H = a.useCallback(() => {
|
|
33
33
|
w.current && w.current.focus();
|
|
@@ -36,40 +36,40 @@ const se = (n, s, p) => {
|
|
|
36
36
|
element: h.current,
|
|
37
37
|
focus: H,
|
|
38
38
|
props: e
|
|
39
|
-
})), a.useImperativeHandle(s, () => f.current);
|
|
40
|
-
const g = a.useMemo(() => e.min, [e.min]), k = a.useMemo(() => e.max, [e.max]),
|
|
41
|
-
() => e.step !== void 0 ? e.step :
|
|
42
|
-
[e.step,
|
|
43
|
-
),
|
|
44
|
-
() => e.largeStep !== void 0 ? e.largeStep :
|
|
45
|
-
[e.largeStep,
|
|
46
|
-
), o =
|
|
39
|
+
})), a.useImperativeHandle(s, () => f.current), Z("rangeslider", f, e, e.webMcp);
|
|
40
|
+
const g = a.useMemo(() => e.min, [e.min]), k = a.useMemo(() => e.max, [e.max]), W = a.useMemo(
|
|
41
|
+
() => e.step !== void 0 ? e.step : b.step,
|
|
42
|
+
[e.step, b.step]
|
|
43
|
+
), N = a.useMemo(
|
|
44
|
+
() => e.largeStep !== void 0 ? e.largeStep : b.largeStep,
|
|
45
|
+
[e.largeStep, b.largeStep]
|
|
46
|
+
), o = ee(h, e.dir), O = (t, u) => {
|
|
47
47
|
e.onChange && f.current && e.onChange.call(void 0, {
|
|
48
48
|
value: t,
|
|
49
49
|
target: f.current,
|
|
50
50
|
syntheticEvent: u
|
|
51
51
|
});
|
|
52
|
-
}, [E,
|
|
53
|
-
e.defaultValue ||
|
|
52
|
+
}, [E, M] = a.useState(""), [x, l] = ce(
|
|
53
|
+
e.defaultValue || b.defaultValue,
|
|
54
54
|
{
|
|
55
55
|
min: g,
|
|
56
56
|
max: k,
|
|
57
|
-
step:
|
|
58
|
-
largeStep:
|
|
57
|
+
step: W,
|
|
58
|
+
largeStep: N,
|
|
59
59
|
state: e.value
|
|
60
60
|
},
|
|
61
|
-
|
|
61
|
+
O
|
|
62
62
|
), d = a.useMemo(() => e.value || x, [e.value, x]), q = a.useRef(null), R = a.useRef(null), v = a.useMemo(() => (d.start - g) / (k - g) * 100, [d.start, g, k]), D = a.useMemo(() => (d.end - g) / (k - g) * 100, [d.end, g, k]), B = a.useMemo(
|
|
63
63
|
() => e.vertical ? { paddingTop: 0, height: "100%" } : {},
|
|
64
64
|
[e.vertical]
|
|
65
65
|
), G = a.useMemo(
|
|
66
66
|
() => e.vertical ? { marginTop: "0.5rem", marginBottom: "0.5rem" } : { marginLeft: "0.5rem", marginRight: "0.5rem" },
|
|
67
67
|
[e.vertical]
|
|
68
|
-
),
|
|
68
|
+
), L = le(), C = a.useCallback(
|
|
69
69
|
(t) => {
|
|
70
70
|
if (!R.current)
|
|
71
71
|
return;
|
|
72
|
-
const u = R.current.getBoundingClientRect(),
|
|
72
|
+
const u = R.current.getBoundingClientRect(), y = e.vertical ? u.bottom - t.clientY : o === "rtl" ? u.right - t.clientX : t.clientX - u.left, I = e.vertical ? u.height : u.width, _ = y / I;
|
|
73
73
|
return g + _ * (k - g);
|
|
74
74
|
},
|
|
75
75
|
[
|
|
@@ -182,24 +182,24 @@ const se = (n, s, p) => {
|
|
|
182
182
|
[l, o, e.disabled]
|
|
183
183
|
), Y = a.useCallback(
|
|
184
184
|
(t) => {
|
|
185
|
-
const u = C(t),
|
|
186
|
-
|
|
187
|
-
const I =
|
|
185
|
+
const u = C(t), y = U(u);
|
|
186
|
+
M(y), y === "end" ? T.current.focus() : w.current.focus();
|
|
187
|
+
const I = y === "end" ? r.end : r.start;
|
|
188
188
|
l({ type: I, payload: u, event: t });
|
|
189
189
|
},
|
|
190
190
|
[e.vertical, g, k, l]
|
|
191
191
|
);
|
|
192
|
-
return
|
|
192
|
+
return te(
|
|
193
193
|
R,
|
|
194
194
|
{
|
|
195
195
|
onPress: Y,
|
|
196
196
|
onDrag: (t) => {
|
|
197
|
-
const u = C(t),
|
|
198
|
-
l({ type:
|
|
197
|
+
const u = C(t), y = E === "end" ? r.end : r.start;
|
|
198
|
+
l({ type: y, payload: u, event: t });
|
|
199
199
|
},
|
|
200
200
|
onRelease: (t) => {
|
|
201
|
-
const u = C(t),
|
|
202
|
-
l({ type:
|
|
201
|
+
const u = C(t), y = E === "end" ? r.end : r.start;
|
|
202
|
+
l({ type: y, payload: u, event: t }), M("");
|
|
203
203
|
}
|
|
204
204
|
},
|
|
205
205
|
{ autoScroll: !1 }
|
|
@@ -210,7 +210,7 @@ const se = (n, s, p) => {
|
|
|
210
210
|
style: e.style,
|
|
211
211
|
ref: h,
|
|
212
212
|
dir: o,
|
|
213
|
-
className:
|
|
213
|
+
className: ae(
|
|
214
214
|
"k-slider",
|
|
215
215
|
{
|
|
216
216
|
"k-rtl": o === "rtl",
|
|
@@ -275,7 +275,7 @@ const se = (n, s, p) => {
|
|
|
275
275
|
"aria-disabled": e.disabled ? "true" : void 0,
|
|
276
276
|
"aria-valuetext": `${d.start} - ${d.end}`,
|
|
277
277
|
className: "k-draghandle k-draghandle-start",
|
|
278
|
-
title:
|
|
278
|
+
title: L.toLanguageString($, z[$]),
|
|
279
279
|
style: e.vertical ? { bottom: "calc(" + v + "%)", zIndex: 1 } : o === "rtl" ? { right: "calc(" + v + "% - 13px)", zIndex: 1 } : { left: "calc(" + v + "%)", zIndex: 1 },
|
|
280
280
|
onKeyDown: X
|
|
281
281
|
}
|
|
@@ -292,15 +292,15 @@ const se = (n, s, p) => {
|
|
|
292
292
|
"aria-disabled": e.disabled ? "true" : void 0,
|
|
293
293
|
"aria-valuetext": `${d.start} - ${d.end}`,
|
|
294
294
|
className: "k-draghandle k-draghandle-end",
|
|
295
|
-
title:
|
|
295
|
+
title: L.toLanguageString($, z[$]),
|
|
296
296
|
style: e.vertical ? { bottom: "calc(" + D + "%)", zIndex: 1 } : o === "rtl" ? { right: "calc(" + D + "% - 13px)", zIndex: 1 } : { left: "calc(" + D + "%)", zIndex: 1 },
|
|
297
297
|
onKeyDown: F
|
|
298
298
|
}
|
|
299
299
|
)
|
|
300
300
|
)
|
|
301
301
|
)
|
|
302
|
-
), p && /* @__PURE__ */ a.createElement(
|
|
303
|
-
}),
|
|
302
|
+
), p && /* @__PURE__ */ a.createElement(re, { message: c }));
|
|
303
|
+
}), de = {
|
|
304
304
|
value: (n, s, p) => {
|
|
305
305
|
if (n.value) {
|
|
306
306
|
const c = n.value.start, i = n.value.end, e = n.min, f = n.max;
|
|
@@ -354,7 +354,7 @@ const se = (n, s, p) => {
|
|
|
354
354
|
vertical: S.bool,
|
|
355
355
|
disabled: S.bool,
|
|
356
356
|
dir: S.oneOf(["ltr", "rtl"])
|
|
357
|
-
},
|
|
357
|
+
}, b = {
|
|
358
358
|
step: 1,
|
|
359
359
|
largeStep: 10,
|
|
360
360
|
defaultValue: {
|
|
@@ -365,8 +365,8 @@ const se = (n, s, p) => {
|
|
|
365
365
|
disabled: !1
|
|
366
366
|
};
|
|
367
367
|
K.displayName = "KendoReactRangeSlider";
|
|
368
|
-
K.propTypes =
|
|
368
|
+
K.propTypes = de;
|
|
369
369
|
export {
|
|
370
370
|
K as RangeSlider,
|
|
371
|
-
|
|
371
|
+
ie as RangeSliderPropsContext
|
|
372
372
|
};
|
package/rating/Rating.d.ts
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
|
-
import { FormComponentProps, SVGIcon } from '@progress/kendo-react-common';
|
|
8
|
+
import { FormComponentProps, SVGIcon, WebMcpProps } from '@progress/kendo-react-common';
|
|
9
9
|
import { RatingItemProps } from './RatingItem.js';
|
|
10
10
|
import { RatingKeyboardEvent, RatingItemMouseEvent, RatingItemFocusEvent } from './models/index.js';
|
|
11
11
|
import * as React from 'react';
|
|
@@ -264,6 +264,11 @@ export interface RatingProps extends FormComponentProps {
|
|
|
264
264
|
* ```
|
|
265
265
|
*/
|
|
266
266
|
ariaLabelledBy?: string;
|
|
267
|
+
/**
|
|
268
|
+
* Enables Web MCP tool registration for this component.
|
|
269
|
+
* Requires a parent `WebMcpProvider` from `@progress/kendo-react-webmcp`.
|
|
270
|
+
*/
|
|
271
|
+
webMcp?: boolean | WebMcpProps;
|
|
267
272
|
}
|
|
268
273
|
/**
|
|
269
274
|
* Represents the target(element and props) of the RatingChangeEvent.
|
package/rating/Rating.js
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
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 Q=require("react"),m=require("prop-types"),l=require("@progress/kendo-react-common"),U=require("./RatingItem.js"),c=require("./rating-reducer.js"),u=require("./utils/index.js"),_=require("../messages/index.js"),Y=require("@progress/kendo-react-intl");function Z(n){const p=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const d in n)if(d!=="default"){const e=Object.getOwnPropertyDescriptor(n,d);Object.defineProperty(p,d,e.get?e:{enumerable:!0,get:()=>n[d]})}}return p.default=n,Object.freeze(p)}const a=Z(Q),z={name:"star",content:'<path d="m22.762 10.668-4.557 3.931 1.389 5.88a1.661 1.661 0 0 1-2.481 1.805L12 19.138l-5.116 3.146a1.661 1.661 0 0 1-2.478-1.805l1.394-5.88-4.557-3.931a1.667 1.667 0 0 1 .943-2.921l5.974-.482 2.304-5.577a1.656 1.656 0 0 1 3.065 0l2.304 5.577 5.973.482a1.667 1.667 0 0 1 .95 2.922z" />',viewBox:"0 0 24 24"},P={name:"star-outline",content:'<path d="M23.065 8.95a1.44 1.44 0 0 0-1.267-1l-6.101-.493-2.351-5.691a1.454 1.454 0 0 0-2.691 0L8.304 7.454l-6.101.496A1.44 1.44 0 0 0 .936 8.951a1.46 1.46 0 0 0 .433 1.562l4.657 4.011-1.417 5.998a1.46 1.46 0 0 0 .567 1.52 1.43 1.43 0 0 0 1.61.061L12 18.898l5.222 3.211a1.43 1.43 0 0 0 1.611-.061 1.46 1.46 0 0 0 .566-1.52l-1.417-5.998 4.65-4.016a1.46 1.46 0 0 0 .433-1.564m-1.229.644-4.929 4.253a.61.61 0 0 0-.195.599l1.506 6.357a.24.24 0 0 1-.096.261.23.23 0 0 1-.262.009l-5.541-3.404a.61.61 0 0 0-.636 0l-5.54 3.403a.23.23 0 0 1-.263-.01.24.24 0 0 1-.101-.26l1.506-6.358a.61.61 0 0 0-.194-.598l-4.93-4.253a.24.24 0 0 1-.074-.269.23.23 0 0 1 .21-.167l6.471-.522a.61.61 0 0 0 .513-.373l2.493-6.035a.238.238 0 0 1 .444 0l2.494 6.035a.61.61 0 0 0 .512.373l6.472.522a.23.23 0 0 1 .21.167.24.24 0 0 1-.068.269z" />',viewBox:"0 0 24 24"},B=(n,p,d)=>{const[e,M]=a.useState(n);return[e,h=>{const i=c.ratingReducer(p.state||e,{...h,...p});d&&d(i,h.event),M(i)}]},F=l.createPropsContext(),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Q=require("react"),m=require("prop-types"),l=require("@progress/kendo-react-common"),U=require("./RatingItem.js"),c=require("./rating-reducer.js"),u=require("./utils/index.js"),_=require("../messages/index.js"),Y=require("@progress/kendo-react-intl");function Z(n){const p=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const d in n)if(d!=="default"){const e=Object.getOwnPropertyDescriptor(n,d);Object.defineProperty(p,d,e.get?e:{enumerable:!0,get:()=>n[d]})}}return p.default=n,Object.freeze(p)}const a=Z(Q),z={name:"star",content:'<path d="m22.762 10.668-4.557 3.931 1.389 5.88a1.661 1.661 0 0 1-2.481 1.805L12 19.138l-5.116 3.146a1.661 1.661 0 0 1-2.478-1.805l1.394-5.88-4.557-3.931a1.667 1.667 0 0 1 .943-2.921l5.974-.482 2.304-5.577a1.656 1.656 0 0 1 3.065 0l2.304 5.577 5.973.482a1.667 1.667 0 0 1 .95 2.922z" />',viewBox:"0 0 24 24"},P={name:"star-outline",content:'<path d="M23.065 8.95a1.44 1.44 0 0 0-1.267-1l-6.101-.493-2.351-5.691a1.454 1.454 0 0 0-2.691 0L8.304 7.454l-6.101.496A1.44 1.44 0 0 0 .936 8.951a1.46 1.46 0 0 0 .433 1.562l4.657 4.011-1.417 5.998a1.46 1.46 0 0 0 .567 1.52 1.43 1.43 0 0 0 1.61.061L12 18.898l5.222 3.211a1.43 1.43 0 0 0 1.611-.061 1.46 1.46 0 0 0 .566-1.52l-1.417-5.998 4.65-4.016a1.46 1.46 0 0 0 .433-1.564m-1.229.644-4.929 4.253a.61.61 0 0 0-.195.599l1.506 6.357a.24.24 0 0 1-.096.261.23.23 0 0 1-.262.009l-5.541-3.404a.61.61 0 0 0-.636 0l-5.54 3.403a.23.23 0 0 1-.263-.01.24.24 0 0 1-.101-.26l1.506-6.358a.61.61 0 0 0-.194-.598l-4.93-4.253a.24.24 0 0 1-.074-.269.23.23 0 0 1 .21-.167l6.471-.522a.61.61 0 0 0 .513-.373l2.493-6.035a.238.238 0 0 1 .444 0l2.494 6.035a.61.61 0 0 0 .512.373l6.472.522a.23.23 0 0 1 .21.167.24.24 0 0 1-.068.269z" />',viewBox:"0 0 24 24"},B=(n,p,d)=>{const[e,M]=a.useState(n);return[e,h=>{const i=c.ratingReducer(p.state||e,{...h,...p});d&&d(i,h.event),M(i)}]},F=l.createPropsContext(),w=a.forwardRef((n,p)=>{const d=l.usePropsContext(F,n),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},M=Y.useLocalization(),g=a.useRef(null),h=a.useRef(null),i=l.useDir(h,e.dir);a.useImperativeHandle(g,()=>({element:h.current,props:e})),a.useImperativeHandle(p,()=>g.current),l.useWebMcpRegister("rating",g,e,e.webMcp);const H=a.useCallback((t,o)=>{e.onChange&&g.current&&e.onChange.call(void 0,{value:t,target:g.current,syntheticEvent:o})},[e.onChange]),R=a.useMemo(()=>e.min!==void 0?e.min:s.min,[e.min]),N=a.useMemo(()=>e.max!==void 0?e.max:s.max,[e.max]),I=a.useMemo(()=>e.precision||s.precision,[e.precision]),r=a.useMemo(()=>e.step!==void 0?e.step:s.step,[e.step]),A=a.useMemo(()=>e.readonly||s.readonly,[e.readonly]),C=a.useMemo(()=>e.disabled||s.disabled,[e.disabled]),K=a.useMemo(()=>e.item||s.item,[e.item]),[V,f]=B(e.defaultValue!==void 0?e.defaultValue:s.defaultValue,{state:e.value,min:R,max:N,step:I==="half"?r/2:r},H),[G,D]=B(null,{state:e.value,min:R,max:N,step:I==="half"?r/2:r,precision:I}),v=a.useMemo(()=>e.value!==void 0?e.value:V,[e.value,V]),T=a.useMemo(()=>G,[G]),E=a.useMemo(()=>e.selection||s.selection,[e.selection]),x=a.useMemo(()=>r/(I==="half"?2:1),[r,I]),L=a.useCallback(t=>{if(!(!t.target||!t.target.element||A||C)){if(I==="half"){const o=t.target.element.getBoundingClientRect(),k=u.calcIsFirstHalf(i||"ltr",o,t.syntheticEvent.clientX)?u.toRound(t.target.value-r/2,x):t.target.value;f({type:c.RATING_ACTION.select,payload:k,event:t.syntheticEvent})}else f({type:c.RATING_ACTION.select,payload:t.target.value,event:t.syntheticEvent});if(e.onClick){const o={value:v,target:g.current,syntheticEvent:t.syntheticEvent};e.onClick.call(void 0,o)}}},[e.onClick,f,v]),q=a.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:v,target:g.current,syntheticEvent:t})}},[e.onKeyDown,f,v]),W=a.useCallback(t=>{if(e.onFocus){const o={target:g.current,syntheticEvent:t};e.onFocus.call(void 0,o)}},[e.onFocus]),$=a.useCallback(t=>{if(e.onBlur){const o={target:g.current,syntheticEvent:t};e.onBlur.call(void 0,o)}},[e.onBlur]),j=a.useCallback(t=>{if(!(!t.target||!t.target.element))if(I==="half"){const o=t.target.element.getBoundingClientRect(),k=u.calcIsFirstHalf(i||"ltr",o,t.syntheticEvent.clientX)?t.target.value-r/2:t.target.value;D({type:c.RATING_ACTION.select,payload:k,event:t.syntheticEvent})}else D({type:c.RATING_ACTION.select,payload:t.target.value,event:t.syntheticEvent})},[I,r,i]),X=a.useCallback(t=>{D({type:c.RATING_ACTION.reset,event:t.syntheticEvent})},[]),S=[],J=u.getRemainder(u.toRound(N-R,x),r);for(let t=R;t<=N;t=u.toRound(t+r,x)){const o=u.toRound(t+J,x),y=I==="half"?u.isHalf(o,T!==null?T:v!==null?v:0,r):!1,k=u.isSelected(o,v,r,E),O=u.isSelected(o,T!==null?T:v,r,E),b=u.isSelected(o,T,r,E);S.push(a.createElement(K,{key:o,value:o,dir:i,title:String(y?u.toRound(o-r/2,x):o),icon:e.icon,svgIcon:e.svgIcon,half:y,selected:k||O,hovered:b,onClick:L,onMouseMove:j,onMouseLeave:X},y&&a.createElement("span",{className:"k-rating-precision-complement"},!(e.icon||e.svgIconOutline)&&a.createElement(l.IconWrap,{name:"star",icon:P,style:{clipPath:`${i==="rtl"?"inset(0 50% 0 0)":"inset(0 0 0 50%)"}`},size:"xlarge"}),(e.icon||e.svgIconOutline)&&a.createElement(l.IconWrap,{name:l.toIconName(`${e.icon}-outline`),icon:e.svgIconOutline,size:"xlarge"})),y&&a.createElement("span",{className:"k-rating-precision-part"},!(e.icon||e.svgIcon)&&a.createElement(l.IconWrap,{name:"star",icon:z,style:{clipPath:`${i==="rtl"?"inset(0 0 0 50%)":"inset(0 50% 0 0)"}`},size:"xlarge"}),(e.icon||e.svgIcon)&&a.createElement(l.IconWrap,{name:e.icon?l.toIconName(e.icon):void 0,icon:e.svgIcon,size:"xlarge"})),y&&a.createElement("span",{style:{width:"24px",height:"24px",display:"block"}}),!y&&!(e.icon||e.svgIcon)&&(b||O&&!b)&&a.createElement(l.IconWrap,{name:"star",icon:z,size:"xlarge"})||!(e.icon||e.svgIcon)&&!b&&!O&&a.createElement(l.IconWrap,{name:"star",icon:P,size:"xlarge"})||(e.icon||e.svgIcon)&&(b||O&&!b)&&a.createElement(l.IconWrap,{name:e.icon,icon:e.svgIcon,size:"xlarge"})||(e.icon||e.svgIcon)&&!b&&a.createElement(l.IconWrap,{name:l.toIconName(`${e.icon}-outline`),icon:e.svgIconOutline,size:"xlarge"})))}return a.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:q,onFocus:W,onBlur:$,"aria-valuemin":R,"aria-valuemax":N,"aria-valuenow":v!==null?v:void 0,"aria-disabled":C?"true":void 0,"aria-label":M.toLanguageString(_.ratingAriaLabel,_.messages[_.ratingAriaLabel]),"aria-labelledby":e.ariaLabelledBy,"aria-describedby":e.ariaDescribedBy},a.createElement("input",{id:"rating",className:"k-hidden",readOnly:A,disabled:C}),a.createElement("span",{className:"k-rating-container"},S),e.label&&a.createElement("span",{className:"k-rating-label"},e.label))}),ee={id:m.string,dir:m.oneOf(["ltr","rtl"]),selection:m.oneOf(["continues","single"]),precision:m.oneOf(["item","half"]),value:(n,p,d)=>n.value&&n.min&&n.max&&n.step&&!(n.precision==="half"?u.isCorrectValue(n.min,n.max,n.step/2,n.value):u.isCorrectValue(n.min,n.max,n.step,n.value))&&n.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:(n,p,d)=>n.step!==void 0&&n.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.
|
|
12
|
-
`):null,hovered:m.number,label:m.node,readonly:m.bool,disabled:m.bool,icon:m.string,svgIcon:l.svgIconPropType,svgIconOutline:l.svgIconPropType,ariaDescribedBy:m.string},s={dir:"ltr",min:1,max:5,step:1,item:U.RatingItem,defaultValue:null,readonly:!1,disabled:!1,selection:"continues",precision:"item"};
|
|
12
|
+
`):null,hovered:m.number,label:m.node,readonly:m.bool,disabled:m.bool,icon:m.string,svgIcon:l.svgIconPropType,svgIconOutline:l.svgIconPropType,ariaDescribedBy:m.string},s={dir:"ltr",min:1,max:5,step:1,item:U.RatingItem,defaultValue:null,readonly:!1,disabled:!1,selection:"continues",precision:"item"};w.displayName="KendoReactRating";w.propTypes=ee;exports.Rating=w;exports.RatingPropsContext=F;
|
package/rating/Rating.mjs
CHANGED
|
@@ -7,28 +7,28 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import * as a from "react";
|
|
9
9
|
import c from "prop-types";
|
|
10
|
-
import { usePropsContext as te, useDir as ae, Keys as
|
|
11
|
-
import { RatingItem as
|
|
12
|
-
import { RATING_ACTION as r, ratingReducer as
|
|
13
|
-
import { calcIsFirstHalf as S, toRound as D, getRemainder as
|
|
14
|
-
import { ratingAriaLabel as K, messages as
|
|
15
|
-
import { useLocalization as
|
|
10
|
+
import { usePropsContext as te, useDir as ae, useWebMcpRegister as ne, Keys as E, IconWrap as y, toIconName as O, classNames as le, getTabIndex as se, createPropsContext as oe, svgIconPropType as P } from "@progress/kendo-react-common";
|
|
11
|
+
import { RatingItem as ie } from "./RatingItem.mjs";
|
|
12
|
+
import { RATING_ACTION as r, ratingReducer as re } from "./rating-reducer.mjs";
|
|
13
|
+
import { calcIsFirstHalf as S, toRound as D, getRemainder as ce, isHalf as ue, isSelected as F, isCorrectValue as $ } from "./utils/index.mjs";
|
|
14
|
+
import { ratingAriaLabel as K, messages as me } from "../messages/index.mjs";
|
|
15
|
+
import { useLocalization as de } from "@progress/kendo-react-intl";
|
|
16
16
|
const A = {
|
|
17
17
|
name: "star",
|
|
18
18
|
content: '<path d="m22.762 10.668-4.557 3.931 1.389 5.88a1.661 1.661 0 0 1-2.481 1.805L12 19.138l-5.116 3.146a1.661 1.661 0 0 1-2.478-1.805l1.394-5.88-4.557-3.931a1.667 1.667 0 0 1 .943-2.921l5.974-.482 2.304-5.577a1.656 1.656 0 0 1 3.065 0l2.304 5.577 5.973.482a1.667 1.667 0 0 1 .95 2.922z" />',
|
|
19
19
|
viewBox: "0 0 24 24"
|
|
20
|
-
},
|
|
20
|
+
}, W = {
|
|
21
21
|
name: "star-outline",
|
|
22
22
|
content: '<path d="M23.065 8.95a1.44 1.44 0 0 0-1.267-1l-6.101-.493-2.351-5.691a1.454 1.454 0 0 0-2.691 0L8.304 7.454l-6.101.496A1.44 1.44 0 0 0 .936 8.951a1.46 1.46 0 0 0 .433 1.562l4.657 4.011-1.417 5.998a1.46 1.46 0 0 0 .567 1.52 1.43 1.43 0 0 0 1.61.061L12 18.898l5.222 3.211a1.43 1.43 0 0 0 1.611-.061 1.46 1.46 0 0 0 .566-1.52l-1.417-5.998 4.65-4.016a1.46 1.46 0 0 0 .433-1.564m-1.229.644-4.929 4.253a.61.61 0 0 0-.195.599l1.506 6.357a.24.24 0 0 1-.096.261.23.23 0 0 1-.262.009l-5.541-3.404a.61.61 0 0 0-.636 0l-5.54 3.403a.23.23 0 0 1-.263-.01.24.24 0 0 1-.101-.26l1.506-6.358a.61.61 0 0 0-.194-.598l-4.93-4.253a.24.24 0 0 1-.074-.269.23.23 0 0 1 .21-.167l6.471-.522a.61.61 0 0 0 .513-.373l2.493-6.035a.238.238 0 0 1 .444 0l2.494 6.035a.61.61 0 0 0 .512.373l6.472.522a.23.23 0 0 1 .21.167.24.24 0 0 1-.068.269z" />',
|
|
23
23
|
viewBox: "0 0 24 24"
|
|
24
|
-
},
|
|
24
|
+
}, X = (n, g, v) => {
|
|
25
25
|
const [e, z] = a.useState(n);
|
|
26
|
-
return [e, (
|
|
27
|
-
const o =
|
|
28
|
-
v && v(o,
|
|
26
|
+
return [e, (h) => {
|
|
27
|
+
const o = re(g.state || e, { ...h, ...g });
|
|
28
|
+
v && v(o, h.event), z(o);
|
|
29
29
|
}];
|
|
30
|
-
},
|
|
31
|
-
const v = te(
|
|
30
|
+
}, pe = oe(), q = a.forwardRef((n, g) => {
|
|
31
|
+
const v = te(pe, n), e = {
|
|
32
32
|
dir: s.dir,
|
|
33
33
|
min: s.min,
|
|
34
34
|
max: s.max,
|
|
@@ -40,21 +40,21 @@ const A = {
|
|
|
40
40
|
selection: s.selection,
|
|
41
41
|
precision: s.precision,
|
|
42
42
|
...v
|
|
43
|
-
}, z =
|
|
44
|
-
a.useImperativeHandle(
|
|
45
|
-
element:
|
|
43
|
+
}, z = de(), u = a.useRef(null), h = a.useRef(null), o = ae(h, e.dir);
|
|
44
|
+
a.useImperativeHandle(u, () => ({
|
|
45
|
+
element: h.current,
|
|
46
46
|
props: e
|
|
47
|
-
})), a.useImperativeHandle(g, () =>
|
|
48
|
-
const
|
|
47
|
+
})), a.useImperativeHandle(g, () => u.current), ne("rating", u, e, e.webMcp);
|
|
48
|
+
const G = a.useCallback(
|
|
49
49
|
(t, l) => {
|
|
50
|
-
e.onChange &&
|
|
50
|
+
e.onChange && u.current && e.onChange.call(void 0, {
|
|
51
51
|
value: t,
|
|
52
|
-
target:
|
|
52
|
+
target: u.current,
|
|
53
53
|
syntheticEvent: l
|
|
54
54
|
});
|
|
55
55
|
},
|
|
56
56
|
[e.onChange]
|
|
57
|
-
), I = a.useMemo(() => e.min !== void 0 ? e.min : s.min, [e.min]), x = a.useMemo(() => e.max !== void 0 ? e.max : s.max, [e.max]), d = a.useMemo(() => e.precision || s.precision, [e.precision]), i = a.useMemo(() => e.step !== void 0 ? e.step : s.step, [e.step]),
|
|
57
|
+
), I = a.useMemo(() => e.min !== void 0 ? e.min : s.min, [e.min]), x = a.useMemo(() => e.max !== void 0 ? e.max : s.max, [e.max]), d = a.useMemo(() => e.precision || s.precision, [e.precision]), i = a.useMemo(() => e.step !== void 0 ? e.step : s.step, [e.step]), w = a.useMemo(() => e.readonly || s.readonly, [e.readonly]), k = a.useMemo(() => e.disabled || s.disabled, [e.disabled]), _ = a.useMemo(() => e.item || s.item, [e.item]), [H, p] = X(
|
|
58
58
|
e.defaultValue !== void 0 ? e.defaultValue : s.defaultValue,
|
|
59
59
|
{
|
|
60
60
|
state: e.value,
|
|
@@ -62,14 +62,14 @@ const A = {
|
|
|
62
62
|
max: x,
|
|
63
63
|
step: d === "half" ? i / 2 : i
|
|
64
64
|
},
|
|
65
|
-
|
|
66
|
-
), [L, B] =
|
|
65
|
+
G
|
|
66
|
+
), [L, B] = X(null, {
|
|
67
67
|
state: e.value,
|
|
68
68
|
min: I,
|
|
69
69
|
max: x,
|
|
70
70
|
step: d === "half" ? i / 2 : i,
|
|
71
71
|
precision: d
|
|
72
|
-
}),
|
|
72
|
+
}), m = a.useMemo(
|
|
73
73
|
() => e.value !== void 0 ? e.value : H,
|
|
74
74
|
[e.value, H]
|
|
75
75
|
), C = a.useMemo(() => L, [L]), N = a.useMemo(
|
|
@@ -77,10 +77,10 @@ const A = {
|
|
|
77
77
|
[e.selection]
|
|
78
78
|
), M = a.useMemo(() => i / (d === "half" ? 2 : 1), [i, d]), j = a.useCallback(
|
|
79
79
|
(t) => {
|
|
80
|
-
if (!(!t.target || !t.target.element ||
|
|
80
|
+
if (!(!t.target || !t.target.element || w || k)) {
|
|
81
81
|
if (d === "half") {
|
|
82
|
-
const l = t.target.element.getBoundingClientRect(),
|
|
83
|
-
p({ type: r.select, payload:
|
|
82
|
+
const l = t.target.element.getBoundingClientRect(), R = S(o || "ltr", l, t.syntheticEvent.clientX) ? D(t.target.value - i / 2, M) : t.target.value;
|
|
83
|
+
p({ type: r.select, payload: R, event: t.syntheticEvent });
|
|
84
84
|
} else
|
|
85
85
|
p({
|
|
86
86
|
type: r.select,
|
|
@@ -89,44 +89,44 @@ const A = {
|
|
|
89
89
|
});
|
|
90
90
|
if (e.onClick) {
|
|
91
91
|
const l = {
|
|
92
|
-
value:
|
|
93
|
-
target:
|
|
92
|
+
value: m,
|
|
93
|
+
target: u.current,
|
|
94
94
|
syntheticEvent: t.syntheticEvent
|
|
95
95
|
};
|
|
96
96
|
e.onClick.call(void 0, l);
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
},
|
|
100
|
-
[e.onClick, p,
|
|
100
|
+
[e.onClick, p, m]
|
|
101
101
|
), J = a.useCallback(
|
|
102
102
|
(t) => {
|
|
103
|
-
if (!(
|
|
103
|
+
if (!(w || k)) {
|
|
104
104
|
switch (t.keyCode) {
|
|
105
|
-
case
|
|
105
|
+
case E.right:
|
|
106
106
|
t.preventDefault(), p({
|
|
107
107
|
type: o === "rtl" ? r.decrease : r.increase,
|
|
108
108
|
event: t
|
|
109
109
|
});
|
|
110
110
|
break;
|
|
111
|
-
case
|
|
111
|
+
case E.left:
|
|
112
112
|
t.preventDefault(), p({
|
|
113
113
|
type: o === "rtl" ? r.increase : r.decrease,
|
|
114
114
|
event: t
|
|
115
115
|
});
|
|
116
116
|
break;
|
|
117
|
-
case
|
|
117
|
+
case E.home:
|
|
118
118
|
t.preventDefault(), p({
|
|
119
119
|
type: o === "rtl" ? r.min : r.max,
|
|
120
120
|
event: t
|
|
121
121
|
});
|
|
122
122
|
break;
|
|
123
|
-
case
|
|
123
|
+
case E.end:
|
|
124
124
|
t.preventDefault(), p({
|
|
125
125
|
type: o === "rtl" ? r.max : r.min,
|
|
126
126
|
event: t
|
|
127
127
|
});
|
|
128
128
|
break;
|
|
129
|
-
case
|
|
129
|
+
case E.esc:
|
|
130
130
|
t.preventDefault(), p({
|
|
131
131
|
type: r.deselect,
|
|
132
132
|
event: t
|
|
@@ -134,18 +134,18 @@ const A = {
|
|
|
134
134
|
break;
|
|
135
135
|
}
|
|
136
136
|
e.onKeyDown && e.onKeyDown.call(void 0, {
|
|
137
|
-
value:
|
|
138
|
-
target:
|
|
137
|
+
value: m,
|
|
138
|
+
target: u.current,
|
|
139
139
|
syntheticEvent: t
|
|
140
140
|
});
|
|
141
141
|
}
|
|
142
142
|
},
|
|
143
|
-
[e.onKeyDown, p,
|
|
143
|
+
[e.onKeyDown, p, m]
|
|
144
144
|
), Q = a.useCallback(
|
|
145
145
|
(t) => {
|
|
146
146
|
if (e.onFocus) {
|
|
147
147
|
const l = {
|
|
148
|
-
target:
|
|
148
|
+
target: u.current,
|
|
149
149
|
syntheticEvent: t
|
|
150
150
|
};
|
|
151
151
|
e.onFocus.call(void 0, l);
|
|
@@ -156,7 +156,7 @@ const A = {
|
|
|
156
156
|
(t) => {
|
|
157
157
|
if (e.onBlur) {
|
|
158
158
|
const l = {
|
|
159
|
-
target:
|
|
159
|
+
target: u.current,
|
|
160
160
|
syntheticEvent: t
|
|
161
161
|
};
|
|
162
162
|
e.onBlur.call(void 0, l);
|
|
@@ -167,8 +167,8 @@ const A = {
|
|
|
167
167
|
(t) => {
|
|
168
168
|
if (!(!t.target || !t.target.element))
|
|
169
169
|
if (d === "half") {
|
|
170
|
-
const l = t.target.element.getBoundingClientRect(),
|
|
171
|
-
B({ type: r.select, payload:
|
|
170
|
+
const l = t.target.element.getBoundingClientRect(), R = S(o || "ltr", l, t.syntheticEvent.clientX) ? t.target.value - i / 2 : t.target.value;
|
|
171
|
+
B({ type: r.select, payload: R, event: t.syntheticEvent });
|
|
172
172
|
} else
|
|
173
173
|
B({
|
|
174
174
|
type: r.select,
|
|
@@ -179,9 +179,9 @@ const A = {
|
|
|
179
179
|
[d, i, o]
|
|
180
180
|
), Z = a.useCallback((t) => {
|
|
181
181
|
B({ type: r.reset, event: t.syntheticEvent });
|
|
182
|
-
}, []), T = [], ee =
|
|
182
|
+
}, []), T = [], ee = ce(D(x - I, M), i);
|
|
183
183
|
for (let t = I; t <= x; t = D(t + i, M)) {
|
|
184
|
-
const l = D(t + ee, M), f = d === "half" ?
|
|
184
|
+
const l = D(t + ee, M), f = d === "half" ? ue(l, C !== null ? C : m !== null ? m : 0, i) : !1, R = F(l, m, i, N), V = F(l, C !== null ? C : m, i, N), b = F(l, C, i, N);
|
|
185
185
|
T.push(
|
|
186
186
|
/* @__PURE__ */ a.createElement(
|
|
187
187
|
_,
|
|
@@ -193,8 +193,8 @@ const A = {
|
|
|
193
193
|
icon: e.icon,
|
|
194
194
|
svgIcon: e.svgIcon,
|
|
195
195
|
half: f,
|
|
196
|
-
selected:
|
|
197
|
-
hovered:
|
|
196
|
+
selected: R || V,
|
|
197
|
+
hovered: b,
|
|
198
198
|
onClick: j,
|
|
199
199
|
onMouseMove: Y,
|
|
200
200
|
onMouseLeave: Z
|
|
@@ -203,7 +203,7 @@ const A = {
|
|
|
203
203
|
y,
|
|
204
204
|
{
|
|
205
205
|
name: "star",
|
|
206
|
-
icon:
|
|
206
|
+
icon: W,
|
|
207
207
|
style: { clipPath: `${o === "rtl" ? "inset(0 50% 0 0)" : "inset(0 0 0 50%)"}` },
|
|
208
208
|
size: "xlarge"
|
|
209
209
|
}
|
|
@@ -232,7 +232,7 @@ const A = {
|
|
|
232
232
|
}
|
|
233
233
|
)),
|
|
234
234
|
f && /* @__PURE__ */ a.createElement("span", { style: { width: "24px", height: "24px", display: "block" } }),
|
|
235
|
-
!f && !(e.icon || e.svgIcon) && (
|
|
235
|
+
!f && !(e.icon || e.svgIcon) && (b || V && !b) && /* @__PURE__ */ a.createElement(y, { name: "star", icon: A, size: "xlarge" }) || !(e.icon || e.svgIcon) && !b && !V && /* @__PURE__ */ a.createElement(y, { name: "star", icon: W, size: "xlarge" }) || (e.icon || e.svgIcon) && (b || V && !b) && /* @__PURE__ */ a.createElement(y, { name: e.icon, icon: e.svgIcon, size: "xlarge" }) || (e.icon || e.svgIcon) && !b && /* @__PURE__ */ a.createElement(
|
|
236
236
|
y,
|
|
237
237
|
{
|
|
238
238
|
name: O(`${e.icon}-outline`),
|
|
@@ -248,15 +248,15 @@ const A = {
|
|
|
248
248
|
{
|
|
249
249
|
id: e.id,
|
|
250
250
|
style: e.style,
|
|
251
|
-
ref:
|
|
251
|
+
ref: h,
|
|
252
252
|
role: "slider",
|
|
253
253
|
dir: o,
|
|
254
|
-
tabIndex:
|
|
255
|
-
className:
|
|
254
|
+
tabIndex: se(e.tabIndex, e.disabled, void 0),
|
|
255
|
+
className: le(
|
|
256
256
|
"k-rating",
|
|
257
257
|
{
|
|
258
258
|
"k-rtl": o === "rtl",
|
|
259
|
-
"k-readonly":
|
|
259
|
+
"k-readonly": w,
|
|
260
260
|
"k-disabled": k
|
|
261
261
|
},
|
|
262
262
|
e.className
|
|
@@ -266,17 +266,17 @@ const A = {
|
|
|
266
266
|
onBlur: U,
|
|
267
267
|
"aria-valuemin": I,
|
|
268
268
|
"aria-valuemax": x,
|
|
269
|
-
"aria-valuenow":
|
|
269
|
+
"aria-valuenow": m !== null ? m : void 0,
|
|
270
270
|
"aria-disabled": k ? "true" : void 0,
|
|
271
|
-
"aria-label": z.toLanguageString(K,
|
|
271
|
+
"aria-label": z.toLanguageString(K, me[K]),
|
|
272
272
|
"aria-labelledby": e.ariaLabelledBy,
|
|
273
273
|
"aria-describedby": e.ariaDescribedBy
|
|
274
274
|
},
|
|
275
|
-
/* @__PURE__ */ a.createElement("input", { id: "rating", className: "k-hidden", readOnly:
|
|
275
|
+
/* @__PURE__ */ a.createElement("input", { id: "rating", className: "k-hidden", readOnly: w, disabled: k }),
|
|
276
276
|
/* @__PURE__ */ a.createElement("span", { className: "k-rating-container" }, T),
|
|
277
277
|
e.label && /* @__PURE__ */ a.createElement("span", { className: "k-rating-label" }, e.label)
|
|
278
278
|
);
|
|
279
|
-
}),
|
|
279
|
+
}), ge = {
|
|
280
280
|
id: c.string,
|
|
281
281
|
dir: c.oneOf(["ltr", "rtl"]),
|
|
282
282
|
selection: c.oneOf(["continues", "single"]),
|
|
@@ -307,16 +307,16 @@ const A = {
|
|
|
307
307
|
min: 1,
|
|
308
308
|
max: 5,
|
|
309
309
|
step: 1,
|
|
310
|
-
item:
|
|
310
|
+
item: ie,
|
|
311
311
|
defaultValue: null,
|
|
312
312
|
readonly: !1,
|
|
313
313
|
disabled: !1,
|
|
314
314
|
selection: "continues",
|
|
315
315
|
precision: "item"
|
|
316
316
|
};
|
|
317
|
-
|
|
318
|
-
|
|
317
|
+
q.displayName = "KendoReactRating";
|
|
318
|
+
q.propTypes = ge;
|
|
319
319
|
export {
|
|
320
|
-
|
|
321
|
-
|
|
320
|
+
q as Rating,
|
|
321
|
+
pe as RatingPropsContext
|
|
322
322
|
};
|