@progress/kendo-react-inputs 14.3.0-develop.11 → 14.3.0-develop.13

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/slider/Slider.mjs CHANGED
@@ -8,13 +8,13 @@
8
8
  import * as l from "react";
9
9
  import { useState as L, useRef as R, useMemo as N, useEffect as q, useCallback as o, useImperativeHandle as me } from "react";
10
10
  import i from "prop-types";
11
- import { withPropsContext as ue, dispatchEvent as fe, Keys as s, classNames as ge, Draggable as ve, getTabIndex as he, createPropsContext as be } from "@progress/kendo-react-common";
11
+ import { withPropsContext as ue, dispatchEvent as fe, Keys as m, classNames as ge, Draggable as ve, getTabIndex as he, createPropsContext as be } from "@progress/kendo-react-common";
12
12
  import { LocalizationService as ye, registerForLocalization as ke } from "@progress/kendo-react-intl";
13
13
  import { sliderDragTitle as H, messages as A, sliderDecreaseValue as O, sliderIncreaseValue as X } from "../messages/index.mjs";
14
14
  import { SLIDER_LABEL_ATTRIBUTE as xe } from "./SliderLabel.mjs";
15
15
  import { Button as _ } from "@progress/kendo-react-buttons";
16
16
  import { caretAltUpIcon as j, caretAltLeftIcon as G, caretAltDownIcon as W, caretAltRightIcon as Y } from "@progress/kendo-svg-icons";
17
- const f = {
17
+ const g = {
18
18
  step: 1,
19
19
  largeStep: 10,
20
20
  buttons: !1,
@@ -24,21 +24,21 @@ const f = {
24
24
  }, z = l.forwardRef((t, P) => {
25
25
  var M, K, U;
26
26
  const {
27
- step: m = f.step,
28
- largeStep: w = f.largeStep,
29
- vertical: a = f.vertical,
30
- disabled: C = f.disabled,
31
- tabIndex: Q = f.tabIndex
32
- } = t, [Z, $] = L((M = t.defaultValue) != null ? M : t.min), [p, B] = L(!1), [I, ee] = L(t.dir), E = R(null), g = R(null), T = N(() => new ye(), []), V = R(null), D = t.value !== void 0, y = D && t.value !== void 0 ? t.value : Z, r = N(() => {
27
+ step: u = g.step,
28
+ largeStep: C = g.largeStep,
29
+ vertical: a = g.vertical,
30
+ disabled: d = g.disabled,
31
+ tabIndex: Q = g.tabIndex
32
+ } = t, [Z, $] = L((M = t.defaultValue) != null ? M : t.min), [p, B] = L(!1), [I, ee] = L(t.dir), E = R(null), v = R(null), T = N(() => new ye(), []), V = R(null), D = t.value !== void 0, k = D && t.value !== void 0 ? t.value : Z, r = N(() => {
33
33
  const { min: e, max: n } = t;
34
- return y < e ? e : y > n ? n : y;
35
- }, [y, t.min, t.max]), v = N(() => {
34
+ return k < e ? e : k > n ? n : k;
35
+ }, [k, t.min, t.max]), h = N(() => {
36
36
  const { min: e, max: n } = t, c = n - e;
37
37
  return c === 0 ? 0 : (r - e) / c * 100;
38
- }, [r, t.min, t.max]), u = (K = t.dir) != null ? K : I;
38
+ }, [r, t.min, t.max]), f = (K = t.dir) != null ? K : I;
39
39
  q(() => {
40
- if (t.dir === void 0 && g.current) {
41
- const n = window.getComputedStyle(g.current).direction;
40
+ if (t.dir === void 0 && v.current) {
41
+ const n = window.getComputedStyle(v.current).direction;
42
42
  n !== I && ee(n);
43
43
  }
44
44
  }, [t.dir, I]);
@@ -50,7 +50,7 @@ const f = {
50
50
  n = n.parentElement;
51
51
  }
52
52
  return !1;
53
- }, []), d = o(
53
+ }, []), s = o(
54
54
  (e, n) => {
55
55
  const c = Math.min(Math.max(n, t.min), t.max);
56
56
  D || $(c), fe(t.onChange, e, V.current, { value: c });
@@ -62,52 +62,54 @@ const f = {
62
62
  B(!1);
63
63
  }, []), ae = o(
64
64
  (e) => {
65
+ if (d)
66
+ return;
65
67
  let n;
66
- e.keyCode === s.left || e.keyCode === s.down ? n = r - (m || 0) : e.keyCode === s.right || e.keyCode === s.up ? n = r + (m || 0) : e.keyCode === s.pageDown ? n = r - (w || 0) : e.keyCode === s.pageUp ? n = r + (w || 0) : e.keyCode === s.home ? n = t.min : e.keyCode === s.end && (n = t.max), n !== void 0 && (e.preventDefault(), d(e, n));
68
+ e.keyCode === m.left || e.keyCode === m.down ? n = r - (u || 0) : e.keyCode === m.right || e.keyCode === m.up ? n = r + (u || 0) : e.keyCode === m.pageDown ? n = r - (C || 0) : e.keyCode === m.pageUp ? n = r + (C || 0) : e.keyCode === m.home ? n = t.min : e.keyCode === m.end && (n = t.max), n !== void 0 && (e.preventDefault(), s(e, n));
67
69
  },
68
- [r, m, w, t.min, t.max, d]
70
+ [r, u, C, t.min, t.max, s, d]
69
71
  ), ie = o(
70
72
  (e) => {
71
- e.preventDefault(), d(e, r - (m || 0));
73
+ e.preventDefault(), !d && s(e, r - (u || 0));
72
74
  },
73
- [r, m, d]
75
+ [r, u, s, d]
74
76
  ), le = o(
75
77
  (e) => {
76
- e.preventDefault(), d(e, r + (m || 0));
78
+ e.preventDefault(), !d && s(e, r + (u || 0));
77
79
  },
78
- [r, m, d]
79
- ), k = o(
80
+ [r, u, s, d]
81
+ ), x = o(
80
82
  (e) => {
81
83
  const n = e.element.getBoundingClientRect();
82
84
  let c;
83
- a ? c = n.bottom - e.event.clientY : c = u === "rtl" ? n.right - e.event.clientX : e.event.clientX - n.left;
84
- const h = a ? n.height : n.width, b = c / h;
85
- d(e, t.min + b * (t.max - t.min));
85
+ a ? c = n.bottom - e.event.clientY : c = f === "rtl" ? n.right - e.event.clientX : e.event.clientX - n.left;
86
+ const b = a ? n.height : n.width, y = c / b;
87
+ s(e, t.min + y * (t.max - t.min));
86
88
  },
87
- [a, t.min, t.max, u, d]
89
+ [a, t.min, t.max, f, s]
88
90
  ), re = o(
89
91
  (e) => {
90
- F(e.event.originalEvent.target) || (e.event.isTouch && e.event.originalEvent.preventDefault(), k(e));
92
+ F(e.event.originalEvent.target) || (e.event.isTouch && e.event.originalEvent.preventDefault(), x(e));
91
93
  },
92
- [F, k]
94
+ [F, x]
93
95
  ), ce = o(
94
96
  (e) => {
95
- e.event.originalEvent.preventDefault(), k(e);
97
+ e.event.originalEvent.preventDefault(), x(e);
96
98
  },
97
- [k]
98
- ), x = o(() => {
99
- g.current && g.current.focus();
99
+ [x]
100
+ ), S = o(() => {
101
+ v.current && v.current.focus();
100
102
  }, []), oe = o(
101
103
  (e) => {
102
104
  if (!e.enabled)
103
105
  return e.children;
104
- let n, c, h, b;
105
- return u === "rtl" ? (n = a ? j : G, c = a ? W : Y, h = a ? "caret-alt-up" : "caret-alt-left", b = a ? "caret-alt-down" : "caret-alt-right") : (n = a ? j : Y, c = a ? W : G, h = a ? "caret-alt-up" : "caret-alt-right", b = a ? "caret-alt-down" : "caret-alt-left"), /* @__PURE__ */ l.createElement(l.Fragment, null, /* @__PURE__ */ l.createElement(
106
+ let n, c, b, y;
107
+ return f === "rtl" ? (n = a ? j : G, c = a ? W : Y, b = a ? "caret-alt-up" : "caret-alt-left", y = a ? "caret-alt-down" : "caret-alt-right") : (n = a ? j : Y, c = a ? W : G, b = a ? "caret-alt-up" : "caret-alt-right", y = a ? "caret-alt-down" : "caret-alt-left"), /* @__PURE__ */ l.createElement(l.Fragment, null, /* @__PURE__ */ l.createElement(
106
108
  _,
107
109
  {
108
110
  className: "k-button-decrease",
109
111
  rounded: "full",
110
- icon: b,
112
+ icon: y,
111
113
  svgIcon: c,
112
114
  title: e.decrementTitle,
113
115
  onClick: e.decrement
@@ -117,37 +119,37 @@ const f = {
117
119
  {
118
120
  className: "k-button-increase",
119
121
  rounded: "full",
120
- icon: h,
122
+ icon: b,
121
123
  svgIcon: n,
122
124
  title: e.incrementTitle,
123
125
  onClick: e.increment
124
126
  }
125
127
  ));
126
128
  },
127
- [u, a]
129
+ [f, a]
128
130
  );
129
131
  me(
130
132
  P,
131
133
  () => ({
132
134
  props: t,
133
135
  sliderTrack: E.current,
134
- focus: x
136
+ focus: S
135
137
  }),
136
- [t, x]
138
+ [t, S]
137
139
  ), q(() => {
138
140
  V.current = {
139
141
  props: t,
140
142
  sliderTrack: E.current,
141
- focus: x
143
+ focus: S
142
144
  };
143
- }, [t, x]);
145
+ }, [t, S]);
144
146
  const de = a ? { marginTop: "0.5rem", marginBottom: "0.5rem" } : { marginLeft: "0.5rem", marginRight: "0.5rem" }, se = a ? { paddingTop: 0, height: "100%" } : {};
145
- let S;
146
- return a ? S = { bottom: "calc(" + v + "%)", zIndex: 1 } : u === "rtl" ? S = { right: "calc(" + v + "% - 13px)", zIndex: 1 } : S = { left: "calc(" + v + "%)", zIndex: 1 }, /* @__PURE__ */ l.createElement(
147
+ let w;
148
+ return a ? w = { bottom: "calc(" + h + "%)", zIndex: 1 } : f === "rtl" ? w = { right: "calc(" + h + "% - 13px)", zIndex: 1 } : w = { left: "calc(" + h + "%)", zIndex: 1 }, /* @__PURE__ */ l.createElement(
147
149
  "div",
148
150
  {
149
- ref: g,
150
- dir: u,
151
+ ref: v,
152
+ dir: f,
151
153
  id: t.id,
152
154
  style: { gap: 0, ...t.style },
153
155
  onFocus: te,
@@ -157,7 +159,7 @@ const f = {
157
159
  "k-slider",
158
160
  {
159
161
  "k-focus": p,
160
- "k-disabled": C,
162
+ "k-disabled": d,
161
163
  "k-slider-horizontal": !a,
162
164
  "k-slider-vertical": a
163
165
  },
@@ -165,7 +167,7 @@ const f = {
165
167
  )
166
168
  },
167
169
  oe({
168
- enabled: (U = t.buttons) != null ? U : f.buttons,
170
+ enabled: (U = t.buttons) != null ? U : g.buttons,
169
171
  decrement: ie,
170
172
  increment: le,
171
173
  incrementTitle: T.toLanguageString(
@@ -201,14 +203,14 @@ const f = {
201
203
  "div",
202
204
  {
203
205
  className: "k-slider-track",
204
- style: a ? { bottom: 0, height: "100%" } : { [u === "rtl" ? "right" : "left"]: 0, width: "100%" },
206
+ style: a ? { bottom: 0, height: "100%" } : { [f === "rtl" ? "right" : "left"]: 0, width: "100%" },
205
207
  ref: E
206
208
  },
207
209
  /* @__PURE__ */ l.createElement(
208
210
  "div",
209
211
  {
210
212
  className: "k-slider-selection",
211
- style: a ? { height: v + "%" } : { width: v + "%" }
213
+ style: a ? { height: h + "%" } : { width: h + "%" }
212
214
  }
213
215
  ),
214
216
  /* @__PURE__ */ l.createElement(
@@ -220,17 +222,17 @@ const f = {
220
222
  "aria-valuenow": r,
221
223
  "aria-valuetext": String(r),
222
224
  "aria-orientation": a ? "vertical" : void 0,
223
- "aria-disabled": C ? "true" : void 0,
225
+ "aria-disabled": d ? "true" : void 0,
224
226
  "aria-labelledby": t.ariaLabelledBy,
225
227
  "aria-describedby": t.ariaDescribedBy,
226
228
  "aria-label": t.ariaLabel,
227
- tabIndex: he(Q, C, void 0),
229
+ tabIndex: he(Q, d, void 0),
228
230
  className: "k-draghandle k-draghandle-end",
229
231
  title: T.toLanguageString(
230
232
  H,
231
233
  A[H]
232
234
  ),
233
- style: S
235
+ style: w
234
236
  }
235
237
  )
236
238
  )