@progress/kendo-react-inputs 8.1.0-develop.8 → 8.1.0

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.
@@ -7,173 +7,179 @@
7
7
  */
8
8
  "use client";
9
9
  import * as a from "react";
10
- import D from "prop-types";
11
- import { createPropsContext as W, validatePackage as Y, usePropsContext as _, useDir as j, Keys as v, useDraggable as F, classNames as J, getTabIndex as z } from "@progress/kendo-react-common";
12
- import { sliderDragTitle as R, messages as P } from "../messages/index.mjs";
13
- import { useLocalization as Q } from "@progress/kendo-react-intl";
14
- import { RANGE_ACTION as n, rangeReducer as U } from "./range-raducer.mjs";
15
- import { packageMetadata as Z } from "../package-metadata.mjs";
16
- const ee = (r, l, e) => {
17
- const [s, i] = a.useState(r), u = a.useCallback(
18
- (m) => {
19
- const x = U(l.state || s, { ...m, ...l });
20
- e && e(x, m.event), i(x);
10
+ import R from "prop-types";
11
+ import { createPropsContext as Y, validatePackage as _, usePropsContext as j, useDir as F, Keys as p, useDraggable as J, classNames as Q, getTabIndex as V } from "@progress/kendo-react-common";
12
+ import { sliderDragTitle as $, messages as z } from "../messages/index.mjs";
13
+ import { useLocalization as U } from "@progress/kendo-react-intl";
14
+ import { RANGE_ACTION as n, rangeReducer as Z } from "./range-raducer.mjs";
15
+ import { packageMetadata as ee } from "../package-metadata.mjs";
16
+ const te = (r, l, u) => {
17
+ const [e, s] = a.useState(r), o = a.useCallback(
18
+ (v) => {
19
+ const b = Z(l.state || e, { ...v, ...l });
20
+ u && u(b, v.event), s(b);
21
21
  },
22
- [l, e]
22
+ [l, u]
23
23
  );
24
- return [s, u];
25
- }, te = W(), T = a.forwardRef((r, l) => {
26
- Y(Z);
27
- const e = _(te, r), s = a.useRef(null), i = a.useRef(null), u = a.useRef(null), m = a.useRef(null), x = a.useRef(null), V = a.useCallback(
24
+ return [e, o];
25
+ }, ae = Y(), P = a.forwardRef((r, l) => {
26
+ _(ee);
27
+ const u = j(ae, r), e = {
28
+ step: g.step,
29
+ defaultValue: g.defaultValue,
30
+ vertical: g.vertical,
31
+ disabled: g.disabled,
32
+ ...u
33
+ }, s = a.useRef(null), o = a.useRef(null), v = a.useRef(null), b = a.useRef(null), T = a.useRef(null), K = a.useCallback(
28
34
  () => {
29
- m.current && m.current.focus();
35
+ b.current && b.current.focus();
30
36
  },
31
- [m]
37
+ [b]
32
38
  );
33
39
  a.useImperativeHandle(s, () => ({
34
- element: i.current,
35
- focus: V,
40
+ element: o.current,
41
+ focus: K,
36
42
  props: e
37
43
  })), a.useImperativeHandle(l, () => s.current);
38
- const f = a.useMemo(
44
+ const m = a.useMemo(
39
45
  () => e.min,
40
46
  [e.min]
41
47
  ), k = a.useMemo(
42
48
  () => e.max,
43
49
  [e.max]
44
- ), K = a.useMemo(
45
- () => e.step !== void 0 ? e.step : $.step,
46
- [e.step, $.step]
47
- ), p = j(i, e.dir), A = (t, o) => {
50
+ ), A = a.useMemo(
51
+ () => e.step !== void 0 ? e.step : g.step,
52
+ [e.step, g.step]
53
+ ), f = F(o, e.dir), H = (t, d) => {
48
54
  e.onChange && s.current && e.onChange.call(void 0, {
49
55
  value: t,
50
56
  target: s.current,
51
- syntheticEvent: o
57
+ syntheticEvent: d
52
58
  });
53
- }, [E, S] = a.useState(""), [g, c] = ee(
54
- e.defaultValue || $.defaultValue,
59
+ }, [E, S] = a.useState(""), [x, i] = te(
60
+ e.defaultValue || g.defaultValue,
55
61
  {
56
- min: f,
62
+ min: m,
57
63
  max: k,
58
- step: K,
64
+ step: A,
59
65
  state: e.value
60
66
  },
61
- A
62
- ), d = a.useMemo(
63
- () => e.value || g,
64
- [e.value, g]
65
- ), H = a.useRef(null), w = a.useRef(null), y = a.useMemo(
66
- () => (d.start - f) / (k - f) * 100,
67
- [d.start, f, k]
68
- ), b = a.useMemo(
69
- () => (d.end - f) / (k - f) * 100,
70
- [d.end, f, k]
71
- ), L = a.useMemo(
67
+ H
68
+ ), c = a.useMemo(
69
+ () => e.value || x,
70
+ [e.value, x]
71
+ ), L = a.useRef(null), w = a.useRef(null), y = a.useMemo(
72
+ () => (c.start - m) / (k - m) * 100,
73
+ [c.start, m, k]
74
+ ), D = a.useMemo(
75
+ () => (c.end - m) / (k - m) * 100,
76
+ [c.end, m, k]
77
+ ), N = a.useMemo(
72
78
  () => e.vertical ? { paddingTop: 0, height: "100%" } : {},
73
79
  [e.vertical]
74
- ), N = a.useMemo(
80
+ ), q = a.useMemo(
75
81
  () => e.vertical ? { marginTop: "0.5rem", marginBottom: "0.5rem" } : { marginLeft: "0.5rem", marginRight: "0.5rem" },
76
82
  [e.vertical]
77
- ), M = Q(), C = a.useCallback(
83
+ ), M = U(), C = a.useCallback(
78
84
  (t) => {
79
85
  if (!w.current)
80
86
  return;
81
- const o = w.current.getBoundingClientRect(), h = e.vertical ? o.bottom - t.clientY : p === "rtl" ? o.right - t.clientX : t.clientX - o.left, I = e.vertical ? o.height : o.width, X = h / I;
82
- return f + X * (k - f);
87
+ const d = w.current.getBoundingClientRect(), h = e.vertical ? d.bottom - t.clientY : f === "rtl" ? d.right - t.clientX : t.clientX - d.left, I = e.vertical ? d.height : d.width, W = h / I;
88
+ return m + W * (k - m);
83
89
  },
84
90
  [
85
91
  w,
86
92
  e.vertical,
87
- p,
88
93
  f,
94
+ m,
89
95
  k,
90
- g.start,
91
- g.end,
96
+ x.start,
97
+ x.end,
92
98
  e.value && e.value.start,
93
99
  e.value && e.value.end
94
100
  ]
95
- ), q = a.useCallback(
96
- (t) => t <= d.start ? "start" : t >= d.end ? "end" : 2 * t < d.end + d.start ? "start" : "end",
101
+ ), B = a.useCallback(
102
+ (t) => t <= c.start ? "start" : t >= c.end ? "end" : 2 * t < c.end + c.start ? "start" : "end",
97
103
  [
98
- g.start,
99
- g.end,
104
+ x.start,
105
+ x.end,
100
106
  e.value && e.value.start,
101
107
  e.value && e.value.end
102
108
  ]
103
- ), B = a.useCallback(
109
+ ), G = a.useCallback(
104
110
  (t) => {
105
111
  switch (t.keyCode) {
106
- case v.right:
107
- t.preventDefault(), c({ type: p === "rtl" ? n.decrease : n.increase, key: "start", event: t });
112
+ case p.right:
113
+ t.preventDefault(), i({ type: f === "rtl" ? n.decrease : n.increase, key: "start", event: t });
108
114
  break;
109
- case v.up:
110
- t.preventDefault(), c({ type: n.increase, key: "start", event: t });
115
+ case p.up:
116
+ t.preventDefault(), i({ type: n.increase, key: "start", event: t });
111
117
  break;
112
- case v.left:
113
- t.preventDefault(), c({ type: p === "rtl" ? n.increase : n.decrease, key: "start", event: t });
118
+ case p.left:
119
+ t.preventDefault(), i({ type: f === "rtl" ? n.increase : n.decrease, key: "start", event: t });
114
120
  break;
115
- case v.down:
116
- t.preventDefault(), c({ type: n.decrease, key: "start", event: t });
121
+ case p.down:
122
+ t.preventDefault(), i({ type: n.decrease, key: "start", event: t });
117
123
  break;
118
- case v.home:
119
- t.preventDefault(), c({ type: n.min, key: "start", event: t });
124
+ case p.home:
125
+ t.preventDefault(), i({ type: n.min, key: "start", event: t });
120
126
  break;
121
- case v.end:
122
- t.preventDefault(), c({ type: n.max, key: "start", event: t });
127
+ case p.end:
128
+ t.preventDefault(), i({ type: n.max, key: "start", event: t });
123
129
  break;
124
130
  }
125
131
  },
126
- [c]
127
- ), G = a.useCallback(
132
+ [i]
133
+ ), O = a.useCallback(
128
134
  (t) => {
129
135
  switch (t.keyCode) {
130
- case v.right:
131
- t.preventDefault(), c({ type: p === "rtl" ? n.decrease : n.increase, key: "end", event: t });
136
+ case p.right:
137
+ t.preventDefault(), i({ type: f === "rtl" ? n.decrease : n.increase, key: "end", event: t });
132
138
  break;
133
- case v.up:
134
- t.preventDefault(), c({ type: n.increase, key: "end", event: t });
139
+ case p.up:
140
+ t.preventDefault(), i({ type: n.increase, key: "end", event: t });
135
141
  break;
136
- case v.left:
137
- t.preventDefault(), c({ type: p === "rtl" ? n.increase : n.decrease, key: "end", event: t });
142
+ case p.left:
143
+ t.preventDefault(), i({ type: f === "rtl" ? n.increase : n.decrease, key: "end", event: t });
138
144
  break;
139
- case v.down:
140
- t.preventDefault(), c({ type: n.decrease, key: "end", event: t });
145
+ case p.down:
146
+ t.preventDefault(), i({ type: n.decrease, key: "end", event: t });
141
147
  break;
142
- case v.home:
143
- t.preventDefault(), c({ type: n.min, key: "end", event: t });
148
+ case p.home:
149
+ t.preventDefault(), i({ type: n.min, key: "end", event: t });
144
150
  break;
145
- case v.end:
146
- t.preventDefault(), c({ type: n.max, key: "end", event: t });
151
+ case p.end:
152
+ t.preventDefault(), i({ type: n.max, key: "end", event: t });
147
153
  break;
148
154
  }
149
155
  },
150
- [c, p]
151
- ), O = a.useCallback(
156
+ [i, f]
157
+ ), X = a.useCallback(
152
158
  (t) => {
153
- const o = C(t), h = q(o);
154
- S(h), h === "end" ? x.current.focus() : m.current.focus();
159
+ const d = C(t), h = B(d);
160
+ S(h), h === "end" ? T.current.focus() : b.current.focus();
155
161
  const I = h === "end" ? n.end : n.start;
156
- c({ type: I, payload: o, event: t });
162
+ i({ type: I, payload: d, event: t });
157
163
  },
158
- [e.vertical, f, k, c]
164
+ [e.vertical, m, k, i]
159
165
  );
160
- return F(w, { onPress: O, onDrag: (t) => {
161
- const o = C(t), h = E === "end" ? n.end : n.start;
162
- c({ type: h, payload: o, event: t });
166
+ return J(w, { onPress: X, onDrag: (t) => {
167
+ const d = C(t), h = E === "end" ? n.end : n.start;
168
+ i({ type: h, payload: d, event: t });
163
169
  }, onRelease: (t) => {
164
- const o = C(t), h = E === "end" ? n.end : n.start;
165
- c({ type: h, payload: o, event: t }), S("");
170
+ const d = C(t), h = E === "end" ? n.end : n.start;
171
+ i({ type: h, payload: d, event: t }), S("");
166
172
  } }), /* @__PURE__ */ a.createElement(
167
173
  "div",
168
174
  {
169
175
  id: e.id,
170
176
  style: e.style,
171
- ref: i,
172
- dir: p,
173
- className: J(
177
+ ref: o,
178
+ dir: f,
179
+ className: Q(
174
180
  "k-slider",
175
181
  {
176
- "k-rtl": p === "rtl",
182
+ "k-rtl": f === "rtl",
177
183
  "k-disabled": e.disabled,
178
184
  "k-slider-vertical": e.vertical,
179
185
  "k-slider-horizontal": !e.vertical
@@ -190,22 +196,22 @@ const ee = (r, l, e) => {
190
196
  flexGrow: 1,
191
197
  position: "relative",
192
198
  touchAction: "none",
193
- ...N
199
+ ...q
194
200
  }
195
201
  },
196
202
  e.children && /* @__PURE__ */ a.createElement(
197
203
  "ul",
198
204
  {
199
205
  className: "k-reset k-slider-items",
200
- style: { ...L }
206
+ style: { ...N }
201
207
  },
202
- a.Children.map(e.children, (t, o) => t && a.cloneElement(
208
+ a.Children.map(e.children, (t, d) => t && a.cloneElement(
203
209
  t,
204
210
  {
205
211
  position: 100 * (t.props.position - e.min) / (e.max - e.min),
206
212
  vertical: e.vertical,
207
- firstTick: o === 0,
208
- lastTick: o === a.Children.count(e.children) - 1
213
+ firstTick: d === 0,
214
+ lastTick: d === a.Children.count(e.children) - 1
209
215
  },
210
216
  t.props.children
211
217
  ))
@@ -213,115 +219,115 @@ const ee = (r, l, e) => {
213
219
  /* @__PURE__ */ a.createElement(
214
220
  "div",
215
221
  {
216
- ref: H,
222
+ ref: L,
217
223
  className: "k-slider-track",
218
- style: e.vertical ? { bottom: 0, height: "100%" } : { [p === "rtl" ? "right" : "left"]: 0, width: "100%" }
224
+ style: e.vertical ? { bottom: 0, height: "100%" } : { [f === "rtl" ? "right" : "left"]: 0, width: "100%" }
219
225
  },
220
- y !== null && b !== null && /* @__PURE__ */ a.createElement(
226
+ y !== null && D !== null && /* @__PURE__ */ a.createElement(
221
227
  "div",
222
228
  {
223
229
  "data-selection": !0,
224
- ref: u,
225
- title: `${d.start} - ${d.end}`,
230
+ ref: v,
231
+ title: `${c.start} - ${c.end}`,
226
232
  className: "k-slider-selection",
227
- style: e.vertical ? { height: b - y + "%", bottom: y + "%" } : {
228
- [p === "rtl" ? "right" : "left"]: y + "%",
229
- width: b - y + "%"
233
+ style: e.vertical ? { height: D - y + "%", bottom: y + "%" } : {
234
+ [f === "rtl" ? "right" : "left"]: y + "%",
235
+ width: D - y + "%"
230
236
  }
231
237
  }
232
238
  ),
233
239
  /* @__PURE__ */ a.createElement(
234
240
  "span",
235
241
  {
236
- ref: m,
242
+ ref: b,
237
243
  role: "slider",
238
- tabIndex: z(e.startTabIndex, e.disabled, void 0),
239
- "aria-valuemin": f,
240
- "aria-valuemax": Math.max(k, d.end),
241
- "aria-valuenow": d.start,
244
+ tabIndex: V(e.startTabIndex, e.disabled, void 0),
245
+ "aria-valuemin": m,
246
+ "aria-valuemax": Math.max(k, c.end),
247
+ "aria-valuenow": c.start,
242
248
  "aria-disabled": e.disabled ? "true" : void 0,
243
- "aria-valuetext": `${d.start} - ${d.end}`,
249
+ "aria-valuetext": `${c.start} - ${c.end}`,
244
250
  className: "k-draghandle k-draghandle-start",
245
- title: M.toLanguageString(R, P[R]),
246
- style: e.vertical ? { bottom: "calc(" + y + "%)", zIndex: 1 } : p === "rtl" ? { right: "calc(" + y + "% - 13px)", zIndex: 1 } : { left: "calc(" + y + "%)", zIndex: 1 },
247
- onKeyDown: B
251
+ title: M.toLanguageString($, z[$]),
252
+ style: e.vertical ? { bottom: "calc(" + y + "%)", zIndex: 1 } : f === "rtl" ? { right: "calc(" + y + "% - 13px)", zIndex: 1 } : { left: "calc(" + y + "%)", zIndex: 1 },
253
+ onKeyDown: G
248
254
  }
249
255
  ),
250
256
  /* @__PURE__ */ a.createElement(
251
257
  "span",
252
258
  {
253
- ref: x,
259
+ ref: T,
254
260
  role: "slider",
255
- tabIndex: z(e.endTabIndex, e.disabled, void 0),
256
- "aria-valuemin": Math.min(f, d.start),
261
+ tabIndex: V(e.endTabIndex, e.disabled, void 0),
262
+ "aria-valuemin": Math.min(m, c.start),
257
263
  "aria-valuemax": k,
258
- "aria-valuenow": d.end,
264
+ "aria-valuenow": c.end,
259
265
  "aria-disabled": e.disabled ? "true" : void 0,
260
- "aria-valuetext": `${d.start} - ${d.end}`,
266
+ "aria-valuetext": `${c.start} - ${c.end}`,
261
267
  className: "k-draghandle k-draghandle-end",
262
- title: M.toLanguageString(R, P[R]),
263
- style: e.vertical ? { bottom: "calc(" + b + "%)", zIndex: 1 } : p === "rtl" ? { right: "calc(" + b + "% - 13px)", zIndex: 1 } : { left: "calc(" + b + "%)", zIndex: 1 },
264
- onKeyDown: G
268
+ title: M.toLanguageString($, z[$]),
269
+ style: e.vertical ? { bottom: "calc(" + D + "%)", zIndex: 1 } : f === "rtl" ? { right: "calc(" + D + "% - 13px)", zIndex: 1 } : { left: "calc(" + D + "%)", zIndex: 1 },
270
+ onKeyDown: O
265
271
  }
266
272
  )
267
273
  )
268
274
  )
269
275
  );
270
- }), ae = {
271
- value: (r, l, e) => {
276
+ }), re = {
277
+ value: (r, l, u) => {
272
278
  if (r.value) {
273
- const s = r.value.start, i = r.value.end, u = r.min, m = r.max;
274
- if (s > i || s > m || s < u || i > m || i < u || i < s)
279
+ const e = r.value.start, s = r.value.end, o = r.min, v = r.max;
280
+ if (e > s || e > v || e < o || s > v || s < o || s < e)
275
281
  return new Error(
276
- `Invalid prop + ${l} supplied to ${e}.
282
+ `Invalid prop + ${l} supplied to ${u}.
277
283
  The { start, end } value must be between the min & max value and { start, end } must be start < end.
278
284
  `
279
285
  );
280
286
  }
281
287
  return null;
282
288
  },
283
- defaultValue: (r, l, e) => {
289
+ defaultValue: (r, l, u) => {
284
290
  if (r.defaultValue) {
285
- const s = r.defaultValue.start, i = r.defaultValue.end, u = r.min, m = r.max;
286
- if (s > i || s > m || s < u || i > m || i < u || i < s)
291
+ const e = r.defaultValue.start, s = r.defaultValue.end, o = r.min, v = r.max;
292
+ if (e > s || e > v || e < o || s > v || s < o || s < e)
287
293
  return new Error(
288
- `Invalid prop + ${l} supplied to ${e}.
294
+ `Invalid prop + ${l} supplied to ${u}.
289
295
  The { start, end } value must be between the min & max value and { start, end } must be start < end.
290
296
  `
291
297
  );
292
298
  }
293
299
  return null;
294
300
  },
295
- onChange: D.func,
296
- step: D.number,
297
- min: (r, l, e) => {
298
- const s = r[l], i = r.min, u = r.max;
299
- return i === void 0 ? new Error(
300
- `Invalid prop + ${l} supplied to ${e}.
301
+ onChange: R.func,
302
+ step: R.number,
303
+ min: (r, l, u) => {
304
+ const e = r[l], s = r.min, o = r.max;
305
+ return s === void 0 ? new Error(
306
+ `Invalid prop + ${l} supplied to ${u}.
301
307
  ${l} value can not be undefined.
302
308
  `
303
- ) : s && i >= u ? new Error(
304
- `Invalid prop + ${l} supplied to ${e}.
309
+ ) : e && s >= o ? new Error(
310
+ `Invalid prop + ${l} supplied to ${u}.
305
311
  ${l} value can not be equal to or bigger than the max value.
306
312
  `
307
313
  ) : null;
308
314
  },
309
- max: (r, l, e) => {
310
- const s = r[l], i = r.min, u = r.max;
311
- return u === void 0 ? new Error(
312
- `Invalid prop + ${l} supplied to ${e}.
315
+ max: (r, l, u) => {
316
+ const e = r[l], s = r.min, o = r.max;
317
+ return o === void 0 ? new Error(
318
+ `Invalid prop + ${l} supplied to ${u}.
313
319
  ${l} value can not be undefined.
314
320
  `
315
- ) : s && u <= i ? new Error(
316
- `Invalid prop + ${l} supplied to ${e}.
321
+ ) : e && o <= s ? new Error(
322
+ `Invalid prop + ${l} supplied to ${u}.
317
323
  ${l} value can not be equal to or smaller than the min value.
318
324
  `
319
325
  ) : null;
320
326
  },
321
- vertical: D.bool,
322
- disabled: D.bool,
323
- dir: D.oneOf(["ltr", "rtl"])
324
- }, $ = {
327
+ vertical: R.bool,
328
+ disabled: R.bool,
329
+ dir: R.oneOf(["ltr", "rtl"])
330
+ }, g = {
325
331
  step: 1,
326
332
  defaultValue: {
327
333
  start: 0,
@@ -330,10 +336,9 @@ const ee = (r, l, e) => {
330
336
  vertical: !1,
331
337
  disabled: !1
332
338
  };
333
- T.displayName = "KendoReactRangeSlider";
334
- T.propTypes = ae;
335
- T.defaultProps = $;
339
+ P.displayName = "KendoReactRangeSlider";
340
+ P.propTypes = re;
336
341
  export {
337
- T as RangeSlider,
338
- te as RangeSliderPropsContext
342
+ P as RangeSlider,
343
+ ae as RangeSliderPropsContext
339
344
  };
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 client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const X=require("react"),i=require("prop-types"),l=require("@progress/kendo-react-common"),D=require("@progress/kendo-svg-icons"),J=require("./RatingItem.js"),c=require("./rating-reducer.js"),u=require("./utils/index.js"),G=require("../messages/index.js"),Q=require("@progress/kendo-react-intl");function U(a){const d=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const e in a)if(e!=="default"){const f=Object.getOwnPropertyDescriptor(a,e);Object.defineProperty(d,e,f.get?f:{enumerable:!0,get:()=>a[e]})}}return d.default=a,Object.freeze(d)}const n=U(X),z=(a,d,e)=>{const[f,m]=n.useState(a);return[f,s=>{const A=c.ratingReducer(d.state||f,{...s,...d});e&&e(A,s.event),m(A)}]},F=l.createPropsContext(),E=n.forwardRef((a,d)=>{const e=l.usePropsContext(F,a),f=Q.useLocalization(),m=n.useRef(null),x=n.useRef(null),s=l.useDir(x,e.dir);n.useImperativeHandle(m,()=>({element:x.current,props:e})),n.useImperativeHandle(d,()=>m.current);const A=n.useCallback((t,o)=>{e.onChange&&m.current&&e.onChange.call(void 0,{value:t,target:m.current,syntheticEvent:o})},[e.onChange]),h=n.useMemo(()=>e.min!==void 0?e.min:p.min,[e.min]),N=n.useMemo(()=>e.max!==void 0?e.max:p.max,[e.max]),I=n.useMemo(()=>e.precision||p.precision,[e.precision]),r=n.useMemo(()=>e.step!==void 0?e.step:p.step,[e.step]),O=n.useMemo(()=>e.readonly||p.readonly,[e.readonly]),R=n.useMemo(()=>e.disabled||p.disabled,[e.disabled]),H=n.useMemo(()=>e.item||p.item,[e.item]),[P,v]=z(e.defaultValue!==void 0?e.defaultValue:p.defaultValue,{state:e.value,min:h,max:N,step:I==="half"?r/2:r},A),[V,_]=z(null,{state:e.value,min:h,max:N,step:I==="half"?r/2:r,precision:I}),g=n.useMemo(()=>e.value!==void 0?e.value:P,[e.value,P]),C=n.useMemo(()=>V,[V]),S=n.useMemo(()=>e.selection||p.selection,[e.selection]),T=n.useMemo(()=>r/(I==="half"?2:1),[r,I]),K=n.useCallback(t=>{if(!(!t.target||!t.target.element||O||R)){if(I==="half"){const o=t.target.element.getBoundingClientRect(),k=u.calcIsFirstHalf(s||"ltr",o,t.syntheticEvent.clientX)?u.toRound(t.target.value-r/2,T):t.target.value;v({type:c.RATING_ACTION.select,payload:k,event:t.syntheticEvent})}else v({type:c.RATING_ACTION.select,payload:t.target.value,event:t.syntheticEvent});if(e.onClick){const o={value:g,target:m.current,syntheticEvent:t.syntheticEvent};e.onClick.call(void 0,o)}}},[e.onClick,v,g]),q=n.useCallback(t=>{if(!(O||R)){switch(t.keyCode){case l.Keys.right:t.preventDefault(),v({type:s==="rtl"?c.RATING_ACTION.decrease:c.RATING_ACTION.increase,event:t});break;case l.Keys.left:t.preventDefault(),v({type:s==="rtl"?c.RATING_ACTION.increase:c.RATING_ACTION.decrease,event:t});break;case l.Keys.home:t.preventDefault(),v({type:s==="rtl"?c.RATING_ACTION.min:c.RATING_ACTION.max,event:t});break;case l.Keys.end:t.preventDefault(),v({type:s==="rtl"?c.RATING_ACTION.max:c.RATING_ACTION.min,event:t});break;case l.Keys.esc:t.preventDefault(),v({type:c.RATING_ACTION.deselect,event:t});break}e.onKeyDown&&e.onKeyDown.call(void 0,{value:g,target:m.current,syntheticEvent:t})}},[e.onKeyDown,v,g]),B=n.useCallback(t=>{if(e.onFocus){const o={target:m.current,syntheticEvent:t};e.onFocus.call(void 0,o)}},[e.onFocus]),$=n.useCallback(t=>{if(e.onBlur){const o={target:m.current,syntheticEvent:t};e.onBlur.call(void 0,o)}},[e.onBlur]),W=n.useCallback(t=>{if(!(!t.target||!t.target.element))if(I==="half"){const o=t.target.element.getBoundingClientRect(),k=u.calcIsFirstHalf(s||"ltr",o,t.syntheticEvent.clientX)?t.target.value-r/2:t.target.value;_({type:c.RATING_ACTION.select,payload:k,event:t.syntheticEvent})}else _({type:c.RATING_ACTION.select,payload:t.target.value,event:t.syntheticEvent})},[I,r,s]),L=n.useCallback(t=>{_({type:c.RATING_ACTION.reset,event:t.syntheticEvent})},[]),w=[],j=u.getRemainder(u.toRound(N-h,T),r);for(let t=h;t<=N;t=u.toRound(t+r,T)){const o=u.toRound(t+j,T),y=I==="half"?u.isHalf(o,C!==null?C:g!==null?g:0,r):!1,k=u.isSelected(o,g,r,S),M=u.isSelected(o,C!==null?C:g,r,S),b=u.isSelected(o,C,r,S);w.push(n.createElement(H,{key:o,value:o,dir:s,title:String(y?u.toRound(o-r/2,T):o),icon:e.icon,svgIcon:e.svgIcon,half:y,selected:k||M,hovered:b,onClick:K,onMouseMove:W,onMouseLeave:L},y&&n.createElement("span",{className:"k-rating-precision-complement"},!(e.icon||e.svgIconOutline)&&n.createElement(l.IconWrap,{name:"star-outline",icon:D.starOutlineIcon,style:{clipPath:`${s==="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:D.starIcon,style:{clipPath:`${s==="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||M&&!b)&&n.createElement(l.IconWrap,{name:"star",icon:D.starIcon,size:"xlarge"})||!(e.icon||e.svgIcon)&&!b&&!M&&n.createElement(l.IconWrap,{name:"star-outline",icon:D.starOutlineIcon,size:"xlarge"})||(e.icon||e.svgIcon)&&(b||M&&!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:x,role:"slider",dir:s,tabIndex:l.getTabIndex(e.tabIndex,e.disabled,void 0),className:l.classNames("k-rating",{"k-rtl":s==="rtl","k-readonly":O,"k-disabled":R},e.className),onKeyDown:q,onFocus:B,onBlur:$,"aria-valuemin":h,"aria-valuemax":N,"aria-valuenow":g!==null?g:void 0,"aria-disabled":R?"true":void 0,"aria-label":f.toLanguageString(G.ratingAriaLabel,G.messages[G.ratingAriaLabel]),"aria-labelledby":e.ariaLabelledBy,"aria-describedby":e.ariaDescribedBy},n.createElement("input",{id:"rating",className:"k-hidden",readOnly:O,disabled:R}),n.createElement("span",{className:"k-rating-container"},w),e.label&&n.createElement("span",{className:"k-rating-label"},e.label))}),Y={id:i.string,dir:i.oneOf(["ltr","rtl"]),selection:i.oneOf(["continues","single"]),precision:i.oneOf(["item","half"]),value:(a,d,e)=>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 + ${d} supplied to ${e}.
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const J=require("react"),u=require("prop-types"),l=require("@progress/kendo-react-common"),M=require("@progress/kendo-svg-icons"),Q=require("./RatingItem.js"),c=require("./rating-reducer.js"),d=require("./utils/index.js"),V=require("../messages/index.js"),U=require("@progress/kendo-react-intl");function Y(a){const g=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const m in a)if(m!=="default"){const e=Object.getOwnPropertyDescriptor(a,m);Object.defineProperty(g,m,e.get?e:{enumerable:!0,get:()=>a[m]})}}return g.default=a,Object.freeze(g)}const n=Y(J),z=(a,g,m)=>{const[e,D]=n.useState(a);return[e,h=>{const i=c.ratingReducer(g.state||e,{...h,...g});m&&m(i,h.event),D(i)}]},F=l.createPropsContext(),S=n.forwardRef((a,g)=>{const m=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,...m},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(g,()=>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}),p=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=d.calcIsFirstHalf(i||"ltr",o,t.syntheticEvent.clientX)?d.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:p,target:I.current,syntheticEvent:t.syntheticEvent};e.onClick.call(void 0,o)}}},[e.onClick,f,p]),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:p,target:I.current,syntheticEvent:t})}},[e.onKeyDown,f,p]),$=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=d.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=d.getRemainder(d.toRound(R-N,k),r);for(let t=N;t<=R;t=d.toRound(t+r,k)){const o=d.toRound(t+X,k),y=v==="half"?d.isHalf(o,T!==null?T:p!==null?p:0,r):!1,x=d.isSelected(o,p,r,_),O=d.isSelected(o,T!==null?T:p,r,_),b=d.isSelected(o,T,r,_);P.push(n.createElement(K,{key:o,value:o,dir:i,title:String(y?d.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-outline",icon:M.starOutlineIcon,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-outline",icon:M.starOutlineIcon,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":p!==null?p: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:u.string,dir:u.oneOf(["ltr","rtl"]),selection:u.oneOf(["continues","single"]),precision:u.oneOf(["item","half"]),value:(a,g,m)=>a.value&&a.min&&a.max&&a.step&&!(a.precision==="half"?d.isCorrectValue(a.min,a.max,a.step/2,a.value):d.isCorrectValue(a.min,a.max,a.step,a.value))&&a.precision==="half"?new Error(`Invalid prop + ${g} supplied to ${m}.
9
9
  The value of the { value } property is not correct, please check your values.
10
- `):null,defaultValue:i.number,min:i.number,max:i.number,step:(a,d,e)=>a.step!==void 0&&a.step<=0?new Error(`Invalid prop + ${d} supplied to ${e}.
10
+ `):null,defaultValue:u.number,min:u.number,max:u.number,step:(a,g,m)=>a.step!==void 0&&a.step<=0?new Error(`Invalid prop + ${g} supplied to ${m}.
11
11
  The value of the { step } property is cannot be equal or less than "0", please check your values.
12
- `):null,hovered:i.number,label:i.string,readonly:i.bool,disabled:i.bool,half:i.bool,icon:i.string,svgIcon:l.svgIconPropType,svgIconOutline:l.svgIconPropType,ariaDescribedBy:i.string},p={dir:"ltr",min:1,max:5,step:1,item:J.RatingItem,defaultValue:null,readonly:!1,disabled:!1,selection:"continues",precision:"item"};E.displayName="KendoReactRating";E.propTypes=Y;E.defaultProps=p;exports.Rating=E;exports.RatingPropsContext=F;
12
+ `):null,hovered:u.number,label:u.string,readonly:u.bool,disabled:u.bool,half:u.bool,icon:u.string,svgIcon:l.svgIconPropType,svgIconOutline:l.svgIconPropType,ariaDescribedBy:u.string},s={dir:"ltr",min:1,max:5,step:1,item:Q.RatingItem,defaultValue:null,readonly:!1,disabled:!1,selection:"continues",precision:"item"};S.displayName="KendoReactRating";S.propTypes=Z;exports.Rating=S;exports.RatingPropsContext=F;