@progress/kendo-react-inputs 15.2.0-develop.1 → 15.2.0-develop.3

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.
Files changed (47) hide show
  1. package/checkbox/Checkbox.js +1 -1
  2. package/checkbox/Checkbox.mjs +79 -77
  3. package/colors/ColorContrastLabels.js +1 -1
  4. package/colors/ColorContrastLabels.mjs +2 -2
  5. package/colors/ColorGradient.js +1 -1
  6. package/colors/ColorGradient.mjs +51 -52
  7. package/colors/ColorPalette.js +1 -1
  8. package/colors/ColorPalette.mjs +71 -72
  9. package/colors/ColorPicker.js +1 -1
  10. package/colors/ColorPicker.mjs +247 -239
  11. package/colors/FlatColorPicker.d.ts +4 -4
  12. package/colors/FlatColorPicker.js +1 -1
  13. package/colors/FlatColorPicker.mjs +104 -100
  14. package/colors/interfaces/ColorPaletteProps.d.ts +7 -0
  15. package/colors/interfaces/ColorPickerPaletteSettings.d.ts +5 -0
  16. package/dist/cdn/js/kendo-react-inputs.js +1 -1
  17. package/maskedtextbox/MaskedTextBox.d.ts +1 -0
  18. package/maskedtextbox/MaskedTextBox.js +1 -1
  19. package/maskedtextbox/MaskedTextBox.mjs +26 -23
  20. package/maskedtextbox/MaskedTextBoxProps.d.ts +7 -0
  21. package/messages/index.d.ts +5 -0
  22. package/messages/index.js +1 -1
  23. package/messages/index.mjs +46 -44
  24. package/numerictextbox/NumericTextBox.js +1 -1
  25. package/numerictextbox/NumericTextBox.mjs +2 -2
  26. package/otpinput/OTPInput.js +1 -1
  27. package/otpinput/OTPInput.mjs +141 -143
  28. package/package-metadata.js +1 -1
  29. package/package-metadata.mjs +2 -2
  30. package/package.json +10 -10
  31. package/radiobutton/RadioButton.js +1 -1
  32. package/radiobutton/RadioButton.mjs +32 -30
  33. package/range-slider/RangeSlider.js +11 -11
  34. package/range-slider/RangeSlider.mjs +54 -54
  35. package/rating/Rating.d.ts +12 -0
  36. package/rating/Rating.js +2 -2
  37. package/rating/Rating.mjs +91 -92
  38. package/signature/Signature.js +1 -1
  39. package/signature/Signature.mjs +113 -110
  40. package/slider/Slider.d.ts +12 -0
  41. package/slider/Slider.js +1 -1
  42. package/slider/Slider.mjs +61 -56
  43. package/switch/Switch.d.ts +15 -0
  44. package/switch/Switch.js +1 -1
  45. package/switch/Switch.mjs +82 -79
  46. package/textarea/TextArea.js +1 -1
  47. package/textarea/TextArea.mjs +11 -12
package/rating/Rating.mjs CHANGED
@@ -7,28 +7,26 @@
7
7
  */
8
8
  import * as a from "react";
9
9
  import c from "prop-types";
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
- const A = {
10
+ import { usePropsContext as Z, useDir as ee, useWebMcpRegister as te, Keys as E, IconWrap as y, toIconName as z, classNames as ae, getTabIndex as ne, createPropsContext as le, svgIconPropType as $ } from "@progress/kendo-react-common";
11
+ import { RatingItem as se } from "./RatingItem.mjs";
12
+ import { RATING_ACTION as r, ratingReducer as oe } from "./rating-reducer.mjs";
13
+ import { calcIsFirstHalf as K, toRound as D, getRemainder as ie, isHalf as re, isSelected as F, isCorrectValue as L } from "./utils/index.mjs";
14
+ const S = {
17
15
  name: "star",
18
16
  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
17
  viewBox: "0 0 24 24"
20
- }, W = {
18
+ }, A = {
21
19
  name: "star-outline",
22
20
  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
21
  viewBox: "0 0 24 24"
24
- }, X = (n, g, v) => {
25
- const [e, z] = a.useState(n);
26
- return [e, (h) => {
27
- const o = re(g.state || e, { ...h, ...g });
28
- v && v(o, h.event), z(o);
22
+ }, W = (n, v, g) => {
23
+ const [e, u] = a.useState(n);
24
+ return [e, (o) => {
25
+ const V = oe(v.state || e, { ...o, ...v });
26
+ g && g(V, o.event), u(V);
29
27
  }];
30
- }, pe = oe(), q = a.forwardRef((n, g) => {
31
- const v = te(pe, n), e = {
28
+ }, ce = le(), X = a.forwardRef((n, v) => {
29
+ const g = Z(ce, n), e = {
32
30
  dir: s.dir,
33
31
  min: s.min,
34
32
  max: s.max,
@@ -39,13 +37,13 @@ const A = {
39
37
  disabled: s.disabled,
40
38
  selection: s.selection,
41
39
  precision: s.precision,
42
- ...v
43
- }, z = de(), u = a.useRef(null), h = a.useRef(null), o = ae(h, e.dir);
40
+ ...g
41
+ }, u = a.useRef(null), w = a.useRef(null), o = ee(w, e.dir);
44
42
  a.useImperativeHandle(u, () => ({
45
- element: h.current,
43
+ element: w.current,
46
44
  props: e
47
- })), a.useImperativeHandle(g, () => u.current), ne("rating", u, e, e.webMcp);
48
- const G = a.useCallback(
45
+ })), a.useImperativeHandle(v, () => u.current), te("rating", u, e, e.webMcp);
46
+ const V = a.useCallback(
49
47
  (t, l) => {
50
48
  e.onChange && u.current && e.onChange.call(void 0, {
51
49
  value: t,
@@ -54,32 +52,32 @@ const A = {
54
52
  });
55
53
  },
56
54
  [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]), 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(
55
+ ), h = a.useMemo(() => e.min !== void 0 ? e.min : s.min, [e.min]), I = a.useMemo(() => e.max !== void 0 ? e.max : s.max, [e.max]), m = a.useMemo(() => e.precision || s.precision, [e.precision]), i = a.useMemo(() => e.step !== void 0 ? e.step : s.step, [e.step]), x = a.useMemo(() => e.readonly || s.readonly, [e.readonly]), k = a.useMemo(() => e.disabled || s.disabled, [e.disabled]), q = a.useMemo(() => e.item || s.item, [e.item]), [H, p] = W(
58
56
  e.defaultValue !== void 0 ? e.defaultValue : s.defaultValue,
59
57
  {
60
58
  state: e.value,
61
- min: I,
62
- max: x,
63
- step: d === "half" ? i / 2 : i
59
+ min: h,
60
+ max: I,
61
+ step: m === "half" ? i / 2 : i
64
62
  },
65
- G
66
- ), [L, B] = X(null, {
63
+ V
64
+ ), [T, N] = W(null, {
67
65
  state: e.value,
68
- min: I,
69
- max: x,
70
- step: d === "half" ? i / 2 : i,
71
- precision: d
72
- }), m = a.useMemo(
66
+ min: h,
67
+ max: I,
68
+ step: m === "half" ? i / 2 : i,
69
+ precision: m
70
+ }), d = a.useMemo(
73
71
  () => e.value !== void 0 ? e.value : H,
74
72
  [e.value, H]
75
- ), C = a.useMemo(() => L, [L]), N = a.useMemo(
73
+ ), C = a.useMemo(() => T, [T]), O = a.useMemo(
76
74
  () => e.selection || s.selection,
77
75
  [e.selection]
78
- ), M = a.useMemo(() => i / (d === "half" ? 2 : 1), [i, d]), j = a.useCallback(
76
+ ), M = a.useMemo(() => i / (m === "half" ? 2 : 1), [i, m]), G = a.useCallback(
79
77
  (t) => {
80
- if (!(!t.target || !t.target.element || w || k)) {
81
- if (d === "half") {
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;
78
+ if (!(!t.target || !t.target.element || x || k)) {
79
+ if (m === "half") {
80
+ const l = t.target.element.getBoundingClientRect(), R = K(o || "ltr", l, t.syntheticEvent.clientX) ? D(t.target.value - i / 2, M) : t.target.value;
83
81
  p({ type: r.select, payload: R, event: t.syntheticEvent });
84
82
  } else
85
83
  p({
@@ -89,7 +87,7 @@ const A = {
89
87
  });
90
88
  if (e.onClick) {
91
89
  const l = {
92
- value: m,
90
+ value: d,
93
91
  target: u.current,
94
92
  syntheticEvent: t.syntheticEvent
95
93
  };
@@ -97,10 +95,10 @@ const A = {
97
95
  }
98
96
  }
99
97
  },
100
- [e.onClick, p, m]
101
- ), J = a.useCallback(
98
+ [e.onClick, p, d]
99
+ ), _ = a.useCallback(
102
100
  (t) => {
103
- if (!(w || k)) {
101
+ if (!(x || k)) {
104
102
  switch (t.keyCode) {
105
103
  case E.right:
106
104
  t.preventDefault(), p({
@@ -134,14 +132,14 @@ const A = {
134
132
  break;
135
133
  }
136
134
  e.onKeyDown && e.onKeyDown.call(void 0, {
137
- value: m,
135
+ value: d,
138
136
  target: u.current,
139
137
  syntheticEvent: t
140
138
  });
141
139
  }
142
140
  },
143
- [e.onKeyDown, p, m]
144
- ), Q = a.useCallback(
141
+ [e.onKeyDown, p, d]
142
+ ), j = a.useCallback(
145
143
  (t) => {
146
144
  if (e.onFocus) {
147
145
  const l = {
@@ -152,7 +150,7 @@ const A = {
152
150
  }
153
151
  },
154
152
  [e.onFocus]
155
- ), U = a.useCallback(
153
+ ), J = a.useCallback(
156
154
  (t) => {
157
155
  if (e.onBlur) {
158
156
  const l = {
@@ -163,28 +161,28 @@ const A = {
163
161
  }
164
162
  },
165
163
  [e.onBlur]
166
- ), Y = a.useCallback(
164
+ ), Q = a.useCallback(
167
165
  (t) => {
168
166
  if (!(!t.target || !t.target.element))
169
- if (d === "half") {
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 });
167
+ if (m === "half") {
168
+ const l = t.target.element.getBoundingClientRect(), R = K(o || "ltr", l, t.syntheticEvent.clientX) ? t.target.value - i / 2 : t.target.value;
169
+ N({ type: r.select, payload: R, event: t.syntheticEvent });
172
170
  } else
173
- B({
171
+ N({
174
172
  type: r.select,
175
173
  payload: t.target.value,
176
174
  event: t.syntheticEvent
177
175
  });
178
176
  },
179
- [d, i, o]
180
- ), Z = a.useCallback((t) => {
181
- B({ type: r.reset, event: t.syntheticEvent });
182
- }, []), T = [], ee = ce(D(x - I, M), i);
183
- for (let t = I || i; t <= x; t = D(t + i, M)) {
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
- T.push(
177
+ [m, i, o]
178
+ ), U = a.useCallback((t) => {
179
+ N({ type: r.reset, event: t.syntheticEvent });
180
+ }, []), P = [], Y = ie(D(I - h, M), i);
181
+ for (let t = h || i; t <= I; t = D(t + i, M)) {
182
+ const l = D(t + Y, M), f = m === "half" ? re(l, C !== null ? C : d !== null ? d : 0, i) : !1, R = F(l, d, i, O), B = F(l, C !== null ? C : d, i, O), b = F(l, C, i, O);
183
+ P.push(
186
184
  /* @__PURE__ */ a.createElement(
187
- _,
185
+ q,
188
186
  {
189
187
  key: l,
190
188
  value: l,
@@ -193,24 +191,24 @@ const A = {
193
191
  icon: e.icon,
194
192
  svgIcon: e.svgIcon,
195
193
  half: f,
196
- selected: R || V,
194
+ selected: R || B,
197
195
  hovered: b,
198
- onClick: j,
199
- onMouseMove: Y,
200
- onMouseLeave: Z
196
+ onClick: G,
197
+ onMouseMove: Q,
198
+ onMouseLeave: U
201
199
  },
202
200
  f && /* @__PURE__ */ a.createElement("span", { className: "k-rating-precision-complement" }, !(e.icon || e.svgIconOutline) && /* @__PURE__ */ a.createElement(
203
201
  y,
204
202
  {
205
203
  name: "star",
206
- icon: W,
204
+ icon: A,
207
205
  style: { clipPath: `${o === "rtl" ? "inset(0 50% 0 0)" : "inset(0 0 0 50%)"}` },
208
206
  size: "xlarge"
209
207
  }
210
208
  ), (e.icon || e.svgIconOutline) && /* @__PURE__ */ a.createElement(
211
209
  y,
212
210
  {
213
- name: O(`${e.icon}-outline`),
211
+ name: z(`${e.icon}-outline`),
214
212
  icon: e.svgIconOutline,
215
213
  size: "xlarge"
216
214
  }
@@ -219,23 +217,23 @@ const A = {
219
217
  y,
220
218
  {
221
219
  name: "star",
222
- icon: A,
220
+ icon: S,
223
221
  style: { clipPath: `${o === "rtl" ? "inset(0 0 0 50%)" : "inset(0 50% 0 0)"}` },
224
222
  size: "xlarge"
225
223
  }
226
224
  ), (e.icon || e.svgIcon) && /* @__PURE__ */ a.createElement(
227
225
  y,
228
226
  {
229
- name: e.icon ? O(e.icon) : void 0,
227
+ name: e.icon ? z(e.icon) : void 0,
230
228
  icon: e.svgIcon,
231
229
  size: "xlarge"
232
230
  }
233
231
  )),
234
232
  f && /* @__PURE__ */ a.createElement("span", { style: { width: "24px", height: "24px", display: "block" } }),
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(
233
+ !f && !(e.icon || e.svgIcon) && (b || B && !b) && /* @__PURE__ */ a.createElement(y, { name: "star", icon: S, size: "xlarge" }) || !(e.icon || e.svgIcon) && !b && !B && /* @__PURE__ */ a.createElement(y, { name: "star", icon: A, size: "xlarge" }) || (e.icon || e.svgIcon) && (b || B && !b) && /* @__PURE__ */ a.createElement(y, { name: e.icon, icon: e.svgIcon, size: "xlarge" }) || (e.icon || e.svgIcon) && !b && /* @__PURE__ */ a.createElement(
236
234
  y,
237
235
  {
238
- name: O(`${e.icon}-outline`),
236
+ name: z(`${e.icon}-outline`),
239
237
  icon: e.svgIconOutline,
240
238
  size: "xlarge"
241
239
  }
@@ -248,49 +246,50 @@ const A = {
248
246
  {
249
247
  id: e.id,
250
248
  style: e.style,
251
- ref: h,
249
+ ref: w,
252
250
  role: "slider",
253
251
  dir: o,
254
- tabIndex: se(e.tabIndex, e.disabled, void 0),
255
- className: le(
252
+ tabIndex: ne(e.tabIndex, e.disabled, void 0),
253
+ className: ae(
256
254
  "k-rating",
257
255
  {
258
256
  "k-rtl": o === "rtl",
259
- "k-readonly": w,
257
+ "k-readonly": x,
260
258
  "k-disabled": k
261
259
  },
262
260
  e.className
263
261
  ),
264
- onKeyDown: J,
265
- onFocus: Q,
266
- onBlur: U,
267
- "aria-valuemin": I,
268
- "aria-valuemax": x,
269
- "aria-valuenow": m !== null ? m : void 0,
262
+ onKeyDown: _,
263
+ onFocus: j,
264
+ onBlur: J,
265
+ "aria-valuemin": h,
266
+ "aria-valuemax": I,
267
+ "aria-valuenow": d !== null ? d : void 0,
270
268
  "aria-disabled": k ? "true" : void 0,
271
- "aria-label": z.toLanguageString(K, me[K]),
269
+ "aria-readonly": x ? "true" : void 0,
270
+ "aria-label": e.ariaLabel,
272
271
  "aria-labelledby": e.ariaLabelledBy,
273
272
  "aria-describedby": e.ariaDescribedBy
274
273
  },
275
- /* @__PURE__ */ a.createElement("input", { type: "hidden", id: "rating", readOnly: w, disabled: k }),
276
- /* @__PURE__ */ a.createElement("span", { className: "k-rating-container" }, T),
274
+ /* @__PURE__ */ a.createElement("input", { type: "hidden", id: "rating", readOnly: x, disabled: k }),
275
+ /* @__PURE__ */ a.createElement("span", { className: "k-rating-container" }, P),
277
276
  e.label && /* @__PURE__ */ a.createElement("span", { className: "k-rating-label" }, e.label)
278
277
  );
279
- }), ge = {
278
+ }), ue = {
280
279
  id: c.string,
281
280
  dir: c.oneOf(["ltr", "rtl"]),
282
281
  selection: c.oneOf(["continues", "single"]),
283
282
  precision: c.oneOf(["item", "half"]),
284
- value: (n, g, v) => n.value && n.min && n.max && n.step && !(n.precision === "half" ? $(n.min, n.max, n.step / 2, n.value) : $(n.min, n.max, n.step, n.value)) && n.precision === "half" ? new Error(
285
- `Invalid prop + ${g} supplied to ${v}.
283
+ value: (n, v, g) => n.value && n.min && n.max && n.step && !(n.precision === "half" ? L(n.min, n.max, n.step / 2, n.value) : L(n.min, n.max, n.step, n.value)) && n.precision === "half" ? new Error(
284
+ `Invalid prop + ${v} supplied to ${g}.
286
285
  The value of the { value } property is not correct, please check your values.
287
286
  `
288
287
  ) : null,
289
288
  defaultValue: c.number,
290
289
  min: c.number,
291
290
  max: c.number,
292
- step: (n, g, v) => n.step !== void 0 && n.step <= 0 ? new Error(
293
- `Invalid prop + ${g} supplied to ${v}.
291
+ step: (n, v, g) => n.step !== void 0 && n.step <= 0 ? new Error(
292
+ `Invalid prop + ${v} supplied to ${g}.
294
293
  The value of the { step } property is cannot be equal or less than "0", please check your values.
295
294
  `
296
295
  ) : null,
@@ -299,24 +298,24 @@ const A = {
299
298
  readonly: c.bool,
300
299
  disabled: c.bool,
301
300
  icon: c.string,
302
- svgIcon: P,
303
- svgIconOutline: P,
301
+ svgIcon: $,
302
+ svgIconOutline: $,
304
303
  ariaDescribedBy: c.string
305
304
  }, s = {
306
305
  dir: "ltr",
307
306
  min: 0,
308
307
  max: 5,
309
308
  step: 1,
310
- item: ie,
309
+ item: se,
311
310
  defaultValue: null,
312
311
  readonly: !1,
313
312
  disabled: !1,
314
313
  selection: "continues",
315
314
  precision: "item"
316
315
  };
317
- q.displayName = "KendoReactRating";
318
- q.propTypes = ge;
316
+ X.displayName = "KendoReactRating";
317
+ X.propTypes = ue;
319
318
  export {
320
- q as Rating,
321
- pe as RatingPropsContext
319
+ X as Rating,
320
+ ce as RatingPropsContext
322
321
  };
@@ -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 Se=require("@progress/kendo-inputs-common"),D=require("@progress/kendo-react-buttons"),a=require("@progress/kendo-react-common"),ze=require("@progress/kendo-react-dialogs"),Oe=require("@progress/kendo-react-intl"),s=require("prop-types"),Ee=require("react"),m=require("../messages/index.js"),Y=require("../package-metadata.js"),xe=require("./utils/index.js"),_=require("@progress/kendo-svg-icons");function Me(c){const k=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const g in c)if(g!=="default"){const v=Object.getOwnPropertyDescriptor(c,g);Object.defineProperty(k,g,v.get?v:{enumerable:!0,get:()=>c[g]})}}return k.default=c,Object.freeze(k)}const n=Me(Ee),Ie=250,Le=84,ee=3,te=2,Pe="#000000",Re="#ffffff",Z=c=>c!==void 0,ne=a.createPropsContext(),E=n.forwardRef((c,k)=>{const g=!a.validatePackage(Y.packageMetadata,{component:"Signature"}),v=a.getLicenseMessage(Y.packageMetadata),N=a.usePropsContext(ne,c),e=n.useMemo(()=>({strokeWidth:l.strokeWidth,smooth:l.smooth,popupScale:l.popupScale,exportScale:l.exportScale,maximizable:l.maximizable,disabled:l.disabled,required:l.required,validityStyles:l.validityStyles,onChange:l.onChange,onFocus:l.onFocus,onBlur:l.onBlur,onOpen:l.onOpen,onClose:l.onClose,size:l.size,rounded:l.rounded,fillMode:l.fillMode,...N}),[N]),x=Oe.useLocalization(),p=n.useRef(null),y=n.useRef(null),F=n.useRef(null),j=n.useRef(null),M=n.useRef(null),[r,oe]=n.useState(),[h,W]=n.useState(!1),[C,G]=n.useState(),[ae,se]=n.useState(),A=Z(e.value)?e.value:C,[re,ie]=n.useState(!1),b=Z(e.open),f=b?e.open:re,le=e.disabled||e.maximized||!e.maximizable,ce=e.disabled||!e.maximized,ue=!(!(e.value||C)||e.disabled||e.readOnly),de=x.toLanguageString(m.signatureMaximize,m.messages[m.signatureMaximize]),pe=x.toLanguageString(m.signatureMinimize,m.messages[m.signatureMinimize]),me=x.toLanguageString(m.signatureClear,m.messages[m.signatureClear]),I=e.popupScale||ee,L=e.exportScale||te,P=t=>{G(t),e.onChange&&e.onChange({value:t})},ge=t=>{r==null||r.loadImage(t.value),P(t.value)};n.useEffect(()=>{e.value!==C&&(G(e.value),r==null||r.loadImage(e.value))},[e.value]);const fe=()=>{r==null||r.clear(),P()},S=n.useCallback(t=>{b||ie(t)},[b]),ke=t=>{var o,i;X(t),(i=((o=M.current)==null?void 0:o.element)||y.current)==null||i.focus()},R=n.useCallback(()=>{let t=Pe;return!e.color&&typeof document!="undefined"&&p.current&&(t=getComputedStyle(p.current).color),e.color||t},[e.color]),w=n.useCallback(()=>{let t=Re;return!e.backgroundColor&&typeof document!="undefined"&&p.current&&(t=getComputedStyle(p.current).backgroundColor),e.backgroundColor||t},[e.backgroundColor]),V=()=>({scale:e.maximized?e.popupScale:1,color:R(),backgroundColor:w(),strokeWidth:e.strokeWidth,smooth:e.smooth,readonly:e.readOnly||e.disabled}),U=async t=>{const{width:o,height:i}=t;return await(r==null?void 0:r.exportImage({width:o*L,height:i*L}))};n.useEffect(()=>{const t=y.current,o=new Se.SignaturePad(t,V());return A&&o.loadImage(A),oe(o),()=>o.destroy()},[]),n.useEffect(()=>{r==null||r.setOptions({onChange:async()=>P(await U(J()))})},[r]),a.useIsomorphicLayoutEffect(()=>r==null?void 0:r.setOptions(V()),[e.readOnly,e.disabled,e.color,e.backgroundColor,e.strokeWidth,e.smooth]),n.useEffect(()=>{var i,d;const t=(d=(i=F.current)==null?void 0:i.element)==null?void 0:d.querySelector(".k-overlay");if(!t)return;const o=()=>S(!1);return t.addEventListener("click",o),()=>t.removeEventListener("click",o)},[f]),n.useEffect(()=>{if(!f||typeof document=="undefined")return;const t=o=>{var i,d;o.key==="Escape"&&(S(!1),(d=(i=M.current)==null?void 0:i.element)==null||d.focus())};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[f]),n.useEffect(()=>{var t,o;e.maximized&&((o=(t=j.current)==null?void 0:t.element)==null||o.focus())},[]);const q=n.useCallback(()=>{var t;return(t=y.current)==null?void 0:t.focus()},[]),z=n.useCallback(()=>e.value,[e.value]),H=n.useCallback(()=>e.name,[e.name]),O=n.useCallback(()=>e.required,[e.required]),T=n.useCallback(()=>{const t=e.validationMessage!==void 0,i=!z(),d=e.valid!==void 0?e.valid:!O()||!i;return{customError:t,valid:d,valueMissing:i}},[e.validationMessage,e.valid,z,O]),B=n.useCallback(()=>e.validityStyles,[e.validityStyles]),$=n.useCallback(()=>e,[e]),u=n.useCallback(()=>{const t={element:p.current,focus:q};return Object.defineProperty(t,"name",{get:H}),Object.defineProperty(t,"value",{get:z}),Object.defineProperty(t,"validity",{get:T}),Object.defineProperty(t,"validityStyles",{get:B}),Object.defineProperty(t,"required",{get:O}),Object.defineProperty(t,"props",{get:$}),Object.defineProperty(t,"color",{get:R}),Object.defineProperty(t,"backgroundColor",{get:w}),t},[H,z,T,B,O,q,$,R,w]);n.useImperativeHandle(k,u);const K=n.useRef(null);n.useImperativeHandle(K,u),a.useWebMcpRegister("signature",K,e,e.webMcp);const be=n.useCallback(t=>{h||e.maximized||(W(!0),a.dispatchEvent(e.onFocus,t,u(),{}))},[h,e.onFocus,u]),ve=n.useCallback(t=>{xe.hasParent(t.relatedTarget,p.current)||(W(!1),a.dispatchEvent(e.onBlur,t,u(),{}))},[h,e.onBlur,u]),ye=n.useCallback(async t=>{se(await U(Q())),S(!0),a.dispatchEvent(e.onOpen,t,u(),{})},[f,b,e.onOpen,e.value,C,u]),X=n.useCallback(t=>{S(!1),a.dispatchEvent(e.onClose,t,u(),{})},[f,b,e.onClose,u]),he=()=>{fe(),q()},J=()=>{var i,d;const t=e.width||((i=p.current)==null?void 0:i.offsetWidth)||Ie,o=e.height||((d=p.current)==null?void 0:d.offsetHeight)||Le;return{width:t,height:o}},Q=()=>{const{width:t,height:o}=J();return{width:t*I,height:o*I}},Ce=!B()||T().valid;return n.createElement("div",{ref:p,dir:e.dir,style:{width:e.width,height:e.height,...e.style},className:a.classNames("k-input","k-signature",{"k-signature-maximized":e.maximized,[`k-signature-${a.kendoThemeMaps.sizeMap[e.size]||e.size}`]:e.size,[`k-signature-${e.fillMode}`]:e.fillMode,[`k-input-${e.fillMode}`]:e.fillMode,[`k-rounded-${a.kendoThemeMaps.roundedMap[e.rounded]||e.rounded}`]:e.rounded,"k-invalid":!Ce,"k-required":e.required,"k-disabled":e.disabled,"k-focus":h},e.className),onFocus:be,onBlur:ve},n.createElement("div",{className:"k-signature-canvas",ref:y,role:"img",tabIndex:a.getTabIndex(e.tabIndex,e.disabled),id:e.id,"aria-label":e.ariaLabel,"aria-labelledby":e.ariaLabelledBy,"aria-describedby":e.ariaDescribedBy,style:e.inputStyle}),n.createElement("div",{className:"k-signature-actions k-signature-actions-top"},n.createElement(D.Button,{type:"button",className:a.classNames("k-signature-action","k-signature-maximize",{"k-hidden":le}),ref:M,icon:"hyperlink-open",svgIcon:_.hyperlinkOpenIcon,size:e.size,rounded:e.rounded,fillMode:"flat",onClick:ye,title:de}),n.createElement(D.Button,{type:"button",className:a.classNames("k-signature-action","k-signature-minimize k-flip-h k-flip-v",{"k-hidden":ce}),ref:j,icon:"hyperlink-open",svgIcon:_.hyperlinkOpenIcon,size:e.size,rounded:e.rounded,fillMode:"flat",onClick:X,title:pe})),!e.hideLine&&n.createElement("div",{className:"k-signature-line",style:{zIndex:2,pointerEvents:"none"}}),n.createElement("div",{className:"k-signature-actions k-signature-actions-bottom"},ue&&n.createElement(D.Button,{type:"button",className:"k-signature-action k-signature-clear",icon:"x",svgIcon:_.xIcon,size:e.size,rounded:e.rounded,fillMode:"flat",onClick:he,title:me})),f&&n.createElement(ze.Dialog,{ref:F},n.createElement(E,{...e,...Q(),value:ae,maximized:!0,exportScale:1/I*L,open:!1,onChange:ge,onClose:ke})),g&&n.createElement(a.WatermarkOverlay,{message:v}))});E.propTypes={value:s.string,width:s.number,height:s.number,tabIndex:s.number,dir:s.string,ariaDescribedBy:s.string,ariaLabelledBy:s.string,ariaLabel:s.string,readOnly:s.bool,disabled:s.bool,validationMessage:s.string,required:s.bool,onChange:s.func,onFocus:s.func,onBlur:s.func,onOpen:s.func,onClose:s.func,size:s.oneOf(["small","medium","large"]),rounded:s.oneOf(["small","medium","large","none"]),fillMode:s.oneOf(["solid","flat","outline"])};const l={strokeWidth:1,smooth:!1,popupScale:ee,exportScale:te,maximizable:!0,disabled:!1,required:!1,validityStyles:!0,onChange:c=>a.noop,onFocus:c=>a.noop,onBlur:c=>a.noop,onOpen:c=>a.noop,onClose:c=>a.noop,size:void 0,rounded:void 0,fillMode:void 0};E.displayName="KendoSignature";exports.Signature=E;exports.SignaturePropsContext=ne;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ze=require("@progress/kendo-inputs-common"),D=require("@progress/kendo-react-buttons"),a=require("@progress/kendo-react-common"),Oe=require("@progress/kendo-react-dialogs"),Ee=require("@progress/kendo-react-intl"),s=require("prop-types"),xe=require("react"),u=require("../messages/index.js"),te=require("../package-metadata.js"),Me=require("./utils/index.js"),_=require("@progress/kendo-svg-icons");function Le(c){const k=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const g in c)if(g!=="default"){const v=Object.getOwnPropertyDescriptor(c,g);Object.defineProperty(k,g,v.get?v:{enumerable:!0,get:()=>c[g]})}}return k.default=c,Object.freeze(k)}const n=Le(xe),Ie=250,Pe=84,oe=3,ae=2,Re="#000000",we="#ffffff",ne=c=>c!==void 0,se=a.createPropsContext(),x=n.forwardRef((c,k)=>{const g=!a.validatePackage(te.packageMetadata,{component:"Signature"}),v=a.getLicenseMessage(te.packageMetadata),N=a.usePropsContext(se,c),e=n.useMemo(()=>({strokeWidth:l.strokeWidth,smooth:l.smooth,popupScale:l.popupScale,exportScale:l.exportScale,maximizable:l.maximizable,disabled:l.disabled,required:l.required,validityStyles:l.validityStyles,onChange:l.onChange,onFocus:l.onFocus,onBlur:l.onBlur,onOpen:l.onOpen,onClose:l.onClose,size:l.size,rounded:l.rounded,fillMode:l.fillMode,...N}),[N]),y=Ee.useLocalization(),m=n.useRef(null),C=n.useRef(null),F=n.useRef(null),j=n.useRef(null),M=n.useRef(null),[r,re]=n.useState(),[h,W]=n.useState(!1),[S,G]=n.useState(),[ie,le]=n.useState(),A=ne(e.value)?e.value:S,[ce,ue]=n.useState(!1),b=ne(e.open),f=b?e.open:ce,de=e.disabled||e.maximized||!e.maximizable,pe=e.disabled||!e.maximized,me=!(!(e.value||S)||e.disabled||e.readOnly),V=y.toLanguageString(u.signatureMaximize,u.messages[u.signatureMaximize]),U=y.toLanguageString(u.signatureMinimize,u.messages[u.signatureMinimize]),H=y.toLanguageString(u.signatureClear,u.messages[u.signatureClear]),ge=y.toLanguageString(u.signatureCanvas,u.messages[u.signatureCanvas]),L=e.popupScale||oe,I=e.exportScale||ae,P=t=>{G(t),e.onChange&&e.onChange({value:t})},fe=t=>{r==null||r.loadImage(t.value),P(t.value)};n.useEffect(()=>{e.value!==S&&(G(e.value),r==null||r.loadImage(e.value))},[e.value]);const ke=()=>{r==null||r.clear(),P()},z=n.useCallback(t=>{b||ue(t)},[b]),be=t=>{var o,i;Y(t),(i=((o=M.current)==null?void 0:o.element)||C.current)==null||i.focus()},R=n.useCallback(()=>{let t=Re;return!e.color&&typeof document!="undefined"&&m.current&&(t=getComputedStyle(m.current).color),e.color||t},[e.color]),w=n.useCallback(()=>{let t=we;return!e.backgroundColor&&typeof document!="undefined"&&m.current&&(t=getComputedStyle(m.current).backgroundColor),e.backgroundColor||t},[e.backgroundColor]),$=()=>({scale:e.maximized?e.popupScale:1,color:R(),backgroundColor:w(),strokeWidth:e.strokeWidth,smooth:e.smooth,readonly:e.readOnly||e.disabled}),K=async t=>{const{width:o,height:i}=t;return await(r==null?void 0:r.exportImage({width:o*I,height:i*I}))};n.useEffect(()=>{const t=C.current,o=new ze.SignaturePad(t,$());return A&&o.loadImage(A),re(o),()=>o.destroy()},[]),n.useEffect(()=>{r==null||r.setOptions({onChange:async()=>P(await K(Z()))})},[r]),a.useIsomorphicLayoutEffect(()=>r==null?void 0:r.setOptions($()),[e.readOnly,e.disabled,e.color,e.backgroundColor,e.strokeWidth,e.smooth]),n.useEffect(()=>{var i,p;const t=(p=(i=F.current)==null?void 0:i.element)==null?void 0:p.querySelector(".k-overlay");if(!t)return;const o=()=>z(!1);return t.addEventListener("click",o),()=>t.removeEventListener("click",o)},[f]),n.useEffect(()=>{if(!f||typeof document=="undefined")return;const t=o=>{var i,p;o.key==="Escape"&&(z(!1),(p=(i=M.current)==null?void 0:i.element)==null||p.focus())};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[f]),n.useEffect(()=>{var t,o;e.maximized&&((o=(t=j.current)==null?void 0:t.element)==null||o.focus())},[]);const q=n.useCallback(()=>{var t;return(t=C.current)==null?void 0:t.focus()},[]),O=n.useCallback(()=>e.value,[e.value]),X=n.useCallback(()=>e.name,[e.name]),E=n.useCallback(()=>e.required,[e.required]),T=n.useCallback(()=>{const t=e.validationMessage!==void 0,i=!O(),p=e.valid!==void 0?e.valid:!E()||!i;return{customError:t,valid:p,valueMissing:i}},[e.validationMessage,e.valid,O,E]),B=n.useCallback(()=>e.validityStyles,[e.validityStyles]),J=n.useCallback(()=>e,[e]),d=n.useCallback(()=>{const t={element:m.current,focus:q};return Object.defineProperty(t,"name",{get:X}),Object.defineProperty(t,"value",{get:O}),Object.defineProperty(t,"validity",{get:T}),Object.defineProperty(t,"validityStyles",{get:B}),Object.defineProperty(t,"required",{get:E}),Object.defineProperty(t,"props",{get:J}),Object.defineProperty(t,"color",{get:R}),Object.defineProperty(t,"backgroundColor",{get:w}),t},[X,O,T,B,E,q,J,R,w]);n.useImperativeHandle(k,d);const Q=n.useRef(null);n.useImperativeHandle(Q,d),a.useWebMcpRegister("signature",Q,e,e.webMcp);const ve=n.useCallback(t=>{h||e.maximized||(W(!0),a.dispatchEvent(e.onFocus,t,d(),{}))},[h,e.onFocus,d]),ye=n.useCallback(t=>{Me.hasParent(t.relatedTarget,m.current)||(W(!1),a.dispatchEvent(e.onBlur,t,d(),{}))},[h,e.onBlur,d]),Ce=n.useCallback(async t=>{le(await K(ee())),z(!0),a.dispatchEvent(e.onOpen,t,d(),{})},[f,b,e.onOpen,e.value,S,d]),Y=n.useCallback(t=>{z(!1),a.dispatchEvent(e.onClose,t,d(),{})},[f,b,e.onClose,d]),he=()=>{ke(),q()},Z=()=>{var i,p;const t=e.width||((i=m.current)==null?void 0:i.offsetWidth)||Ie,o=e.height||((p=m.current)==null?void 0:p.offsetHeight)||Pe;return{width:t,height:o}},ee=()=>{const{width:t,height:o}=Z();return{width:t*L,height:o*L}},Se=!B()||T().valid;return n.createElement("div",{ref:m,dir:e.dir,style:{width:e.width,height:e.height,...e.style},className:a.classNames("k-input","k-signature",{"k-signature-maximized":e.maximized,[`k-signature-${a.kendoThemeMaps.sizeMap[e.size]||e.size}`]:e.size,[`k-signature-${e.fillMode}`]:e.fillMode,[`k-input-${e.fillMode}`]:e.fillMode,[`k-rounded-${a.kendoThemeMaps.roundedMap[e.rounded]||e.rounded}`]:e.rounded,"k-invalid":!Se,"k-required":e.required,"k-disabled":e.disabled,"k-focus":h},e.className),onFocus:ve,onBlur:ye},n.createElement("div",{className:"k-signature-canvas",ref:C,role:"img",tabIndex:a.getTabIndex(e.tabIndex,e.disabled),id:e.id,"aria-label":e.ariaLabel||ge,"aria-labelledby":e.ariaLabelledBy,"aria-describedby":e.ariaDescribedBy,style:e.inputStyle}),n.createElement("div",{className:"k-signature-actions k-signature-actions-top"},n.createElement(D.Button,{type:"button",className:a.classNames("k-signature-action","k-signature-maximize",{"k-hidden":de}),ref:M,icon:"hyperlink-open",svgIcon:_.hyperlinkOpenIcon,size:e.size,rounded:e.rounded,fillMode:"flat",onClick:Ce,"aria-label":V,title:V}),n.createElement(D.Button,{type:"button",className:a.classNames("k-signature-action","k-signature-minimize k-flip-h k-flip-v",{"k-hidden":pe}),ref:j,icon:"hyperlink-open",svgIcon:_.hyperlinkOpenIcon,size:e.size,rounded:e.rounded,fillMode:"flat",onClick:Y,"aria-label":U,title:U})),!e.hideLine&&n.createElement("div",{className:"k-signature-line",style:{zIndex:2,pointerEvents:"none"}}),n.createElement("div",{className:"k-signature-actions k-signature-actions-bottom"},me&&n.createElement(D.Button,{type:"button",className:"k-signature-action k-signature-clear",icon:"x",svgIcon:_.xIcon,size:e.size,rounded:e.rounded,fillMode:"flat",onClick:he,"aria-label":H,title:H})),f&&n.createElement(Oe.Dialog,{ref:F},n.createElement(x,{...e,...ee(),value:ie,maximized:!0,exportScale:1/L*I,open:!1,onChange:fe,onClose:be})),g&&n.createElement(a.WatermarkOverlay,{message:v}))});x.propTypes={value:s.string,width:s.number,height:s.number,tabIndex:s.number,dir:s.string,ariaDescribedBy:s.string,ariaLabelledBy:s.string,ariaLabel:s.string,readOnly:s.bool,disabled:s.bool,validationMessage:s.string,required:s.bool,onChange:s.func,onFocus:s.func,onBlur:s.func,onOpen:s.func,onClose:s.func,size:s.oneOf(["small","medium","large"]),rounded:s.oneOf(["small","medium","large","none"]),fillMode:s.oneOf(["solid","flat","outline"])};const l={strokeWidth:1,smooth:!1,popupScale:oe,exportScale:ae,maximizable:!0,disabled:!1,required:!1,validityStyles:!0,onChange:c=>a.noop,onFocus:c=>a.noop,onBlur:c=>a.noop,onOpen:c=>a.noop,onClose:c=>a.noop,size:void 0,rounded:void 0,fillMode:void 0};x.displayName="KendoSignature";exports.Signature=x;exports.SignaturePropsContext=se;