@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
@@ -7,35 +7,35 @@
7
7
  */
8
8
  import * as r from "react";
9
9
  import o from "prop-types";
10
- import { withIdHOC as F, withPropsContext as N, createPropsContext as _, validatePackage as I, getLicenseMessage as T, canUseDOM as O, Navigation as C, getActiveElement as b, disableNavigatableContainer as k, focusFirstFocusableChild as z, enableNavigatableContainer as V, keepFocusInContainer as B, TABBABLE_ELEMENTS as P, getTabIndex as S, classNames as K, kendoThemeMaps as U, Draggable as W, WatermarkOverlay as $ } from "@progress/kendo-react-common";
10
+ import { withIdHOC as G, withPropsContext as A, createPropsContext as N, validatePackage as _, getLicenseMessage as I, canUseDOM as T, Navigation as C, getActiveElement as u, disableNavigatableContainer as k, focusFirstFocusableChild as O, enableNavigatableContainer as z, keepFocusInContainer as V, TABBABLE_ELEMENTS as B, getTabIndex as S, classNames as P, kendoThemeMaps as K, Draggable as U, WatermarkOverlay as W } from "@progress/kendo-react-common";
11
11
  import { packageMetadata as R } from "../package-metadata.mjs";
12
12
  import { Slider as y } from "../slider/Slider.mjs";
13
13
  import { isPresent as E, fitIntoBounds as w } from "./utils/misc.mjs";
14
- import { getHSV as m, getRGBA as p, getColorFromHue as c, getColorFromRGBA as X, parseColor as d, getColorFromHSV as Y } from "./utils/color-parser.mjs";
15
- import { cacheHex as j, cacheRgba as q, removeCachedColor as J, cacheHsva as Q, getCachedHsva as Z, getCachedRgba as ee, getCachedHex as te } from "./utils/color-cache.mjs";
16
- import se from "./ColorInput.mjs";
17
- import { ColorContrastLabels as ae } from "./ColorContrastLabels.mjs";
18
- import { ColorContrastSvg as ie } from "./ColorContrastSvg.mjs";
19
- import { provideLocalizationService as L } from "@progress/kendo-react-intl";
20
- import { colorGradientHSVAreaAriaLabel as x, messages as g, colorGradientAriaLabel as H, colorGradientHueSliderLabel as D, colorGradientAlphaSliderLabel as G } from "../messages/index.mjs";
21
- const re = "rgba", M = "rgba(255, 255, 255, 1)", v = 2, u = 5, h = class h extends r.Component {
14
+ import { getHSV as b, getRGBA as p, getColorFromHue as c, getColorFromRGBA as $, parseColor as d, getColorFromHSV as X } from "./utils/color-parser.mjs";
15
+ import { cacheHex as Y, cacheRgba as j, removeCachedColor as q, cacheHsva as J, getCachedHsva as Q, getCachedRgba as Z, getCachedHex as ee } from "./utils/color-cache.mjs";
16
+ import te from "./ColorInput.mjs";
17
+ import { ColorContrastLabels as se } from "./ColorContrastLabels.mjs";
18
+ import { ColorContrastSvg as ae } from "./ColorContrastSvg.mjs";
19
+ import { provideLocalizationService as x } from "@progress/kendo-react-intl";
20
+ import { colorGradientHSVAreaAriaLabel as H, messages as m, colorGradientHueSliderLabel as L, colorGradientAlphaSliderLabel as D } from "../messages/index.mjs";
21
+ const ie = "rgba", M = "rgba(255, 255, 255, 1)", g = 2, v = 5, h = class h extends r.Component {
22
22
  constructor(t) {
23
23
  super(t), this.wrapperRef = r.createRef(), this.hsvGradientRef = r.createRef(), this.showLicenseWatermark = !1, this.focus = () => {
24
24
  this.wrapperRef && this.wrapperRef.current && this.wrapperRef.current.focus();
25
25
  }, this.onHexChange = (e, s, i) => {
26
26
  if (this.isUncontrolled) {
27
- const n = m(s);
27
+ const n = b(s);
28
28
  this.setState({ hsva: n, backgroundColor: c(n.h), rgba: p(s), hex: e });
29
29
  } else
30
- j(this.state.guid, s, e);
30
+ Y(this.state.guid, s, e);
31
31
  this.dispatchChangeEvent(s, i, i.nativeEvent);
32
32
  }, this.onRgbaChange = (e, s) => {
33
- const i = X(e);
33
+ const i = $(e);
34
34
  if (this.isUncontrolled) {
35
- const n = m(i), l = d(i, "hex");
35
+ const n = b(i), l = d(i, "hex");
36
36
  this.setState({ hsva: n, backgroundColor: c(n.h), rgba: e, hex: l });
37
37
  } else
38
- q(this.state.guid, i, e);
38
+ j(this.state.guid, i, e);
39
39
  this.dispatchChangeEvent(i, s.syntheticEvent, s.nativeEvent);
40
40
  }, this.onAlphaSliderChange = (e) => {
41
41
  this.handleHsvaChange(
@@ -69,8 +69,8 @@ const re = "rgba", M = "rgba(255, 255, 255, 1)", v = 2, u = 5, h = class h exten
69
69
  }, this.onKeyDown = (e) => {
70
70
  var s;
71
71
  (s = this.navigation) == null || s.triggerKeyboardEvent(e);
72
- }, this.showLicenseWatermark = !I(R, { component: "ColorGradient" }), this.licenseMessage = T(R);
73
- const a = t.value || t.defaultValue || d(M, re);
72
+ }, this.showLicenseWatermark = !_(R, { component: "ColorGradient" }), this.licenseMessage = I(R);
73
+ const a = t.value || t.defaultValue || d(M, ie);
74
74
  this.state = Object.assign({}, h.getStateFromValue(a), {
75
75
  isFirstRender: !0,
76
76
  guid: this.props.id
@@ -86,7 +86,7 @@ const re = "rgba", M = "rgba(255, 255, 255, 1)", v = 2, u = 5, h = class h exten
86
86
  * @hidden
87
87
  */
88
88
  componentDidMount() {
89
- if (this.setAlphaSliderBackground(this.state.backgroundColor), this.state.isFirstRender && this.setState({ isFirstRender: !1 }), this.gradientWrapper && (this.resizeObserver = O && window.ResizeObserver && new window.ResizeObserver(() => {
89
+ if (this.setAlphaSliderBackground(this.state.backgroundColor), this.state.isFirstRender && this.setState({ isFirstRender: !1 }), this.gradientWrapper && (this.resizeObserver = T && window.ResizeObserver && new window.ResizeObserver(() => {
90
90
  this.forceUpdate();
91
91
  }), this.resizeObserver && this.resizeObserver.observe(this.gradientWrapper)), this.wrapperRef && this.hsvGradientRef) {
92
92
  let t = 0, a = 0;
@@ -97,16 +97,16 @@ const re = "rgba", M = "rgba(255, 255, 255, 1)", v = 2, u = 5, h = class h exten
97
97
  keyboardEvents: {
98
98
  keydown: {
99
99
  ArrowDown: (e, s, i) => {
100
- a = i.shiftKey ? this.props.gradientSliderSmallStep || v : this.props.gradientSliderStep || u, this.onHsvGradientValueChange(e, 0, a);
100
+ a = i.shiftKey ? this.props.gradientSliderSmallStep || g : this.props.gradientSliderStep || v, this.onHsvGradientValueChange(e, 0, a);
101
101
  },
102
102
  ArrowUp: (e, s, i) => {
103
- a = i.shiftKey ? -(this.props.gradientSliderSmallStep || v) : -(this.props.gradientSliderStep || u), this.onHsvGradientValueChange(e, 0, a);
103
+ a = i.shiftKey ? -(this.props.gradientSliderSmallStep || g) : -(this.props.gradientSliderStep || v), this.onHsvGradientValueChange(e, 0, a);
104
104
  },
105
105
  ArrowLeft: (e, s, i) => {
106
- t = i.shiftKey ? -(this.props.gradientSliderSmallStep || v) : -(this.props.gradientSliderStep || u), this.onHsvGradientValueChange(e, t, 0);
106
+ t = i.shiftKey ? -(this.props.gradientSliderSmallStep || g) : -(this.props.gradientSliderStep || v), this.onHsvGradientValueChange(e, t, 0);
107
107
  },
108
108
  ArrowRight: (e, s, i) => {
109
- t = i.shiftKey ? this.props.gradientSliderSmallStep || v : this.props.gradientSliderStep || u, this.onHsvGradientValueChange(e, t, 0);
109
+ t = i.shiftKey ? this.props.gradientSliderSmallStep || g : this.props.gradientSliderStep || v, this.onHsvGradientValueChange(e, t, 0);
110
110
  }
111
111
  }
112
112
  }
@@ -119,13 +119,13 @@ const re = "rgba", M = "rgba(255, 255, 255, 1)", v = 2, u = 5, h = class h exten
119
119
  keyboardEvents: {
120
120
  keydown: {
121
121
  Tab: (t, a, e) => {
122
- b(document) === t ? k(t) : B(e, t, P);
122
+ u(document) === t ? k(t) : V(e, t, B);
123
123
  },
124
124
  Enter: (t, a, e) => {
125
- b(document) === t && (z(t), V(t));
125
+ u(document) === t && (O(t), z(t));
126
126
  },
127
127
  Escape: (t, a, e) => {
128
- b(document) !== t && (t.focus(), k(t));
128
+ u(document) !== t && (t.focus(), k(t));
129
129
  }
130
130
  }
131
131
  }
@@ -135,7 +135,7 @@ const re = "rgba", M = "rgba(255, 255, 255, 1)", v = 2, u = 5, h = class h exten
135
135
  * @hidden
136
136
  */
137
137
  componentWillUnmount() {
138
- J(this.state.guid), this.resizeObserver && this.resizeObserver.disconnect();
138
+ q(this.state.guid), this.resizeObserver && this.resizeObserver.disconnect();
139
139
  }
140
140
  /**
141
141
  * @hidden
@@ -147,7 +147,7 @@ const re = "rgba", M = "rgba(255, 255, 255, 1)", v = 2, u = 5, h = class h exten
147
147
  * @hidden
148
148
  */
149
149
  renderRectangleDragHandle() {
150
- const t = L(this), a = {};
150
+ const t = x(this), a = {};
151
151
  if (!this.state.isFirstRender) {
152
152
  const e = this.getGradientRectMetrics(), s = (1 - this.state.hsva.v) * e.height, i = this.state.hsva.s * e.width;
153
153
  a.top = `${s}px`, a.left = `${i}px`;
@@ -162,9 +162,8 @@ const re = "rgba", M = "rgba(255, 255, 255, 1)", v = 2, u = 5, h = class h exten
162
162
  "aria-valuenow": Math.round((1 - this.state.hsva.v) * 100),
163
163
  "aria-valuemin": 0,
164
164
  "aria-valuemax": 100,
165
- "aria-label": this.props.ariaLabelHSV || t.toLanguageString(x, g[x]),
165
+ "aria-label": this.props.ariaLabelHSV || t.toLanguageString(H, m[H]),
166
166
  "aria-orientation": "undefined",
167
- "aria-disabled": this.props.disabled ? "true" : void 0,
168
167
  className: "k-hsv-draghandle k-draghandle",
169
168
  style: a,
170
169
  onKeyDown: this.onHsvGradientKeyDown
@@ -175,18 +174,18 @@ const re = "rgba", M = "rgba(255, 255, 255, 1)", v = 2, u = 5, h = class h exten
175
174
  * @hidden
176
175
  */
177
176
  moveDragHandle(t, a) {
178
- const e = this.getGradientRectMetrics(), s = e.width, i = e.height, n = w(a, 0, i), l = w(t, 0, s), A = Object.assign({}, this.state.hsva, {
177
+ const e = this.getGradientRectMetrics(), s = e.width, i = e.height, n = w(a, 0, i), l = w(t, 0, s), F = Object.assign({}, this.state.hsva, {
179
178
  s: l / s,
180
179
  v: 1 - n / i
181
180
  });
182
- this.handleHsvaChange(A, {}, {});
181
+ this.handleHsvaChange(F, {}, {});
183
182
  }
184
183
  /**
185
184
  * @hidden
186
185
  */
187
186
  handleHsvaChange(t, a, e) {
188
- const s = Y(t), i = d(s, "hex");
189
- this.isUncontrolled || Q(this.state.guid, s, t), this.setState({ hsva: t, backgroundColor: c(t.h), rgba: p(s), hex: i }), this.dispatchChangeEvent(s, a, e);
187
+ const s = X(t), i = d(s, "hex");
188
+ this.isUncontrolled || J(this.state.guid, s, t), this.setState({ hsva: t, backgroundColor: c(t.h), rgba: p(s), hex: i }), this.dispatchChangeEvent(s, a, e);
190
189
  }
191
190
  /**
192
191
  * @hidden
@@ -204,7 +203,7 @@ const re = "rgba", M = "rgba(255, 255, 255, 1)", v = 2, u = 5, h = class h exten
204
203
  */
205
204
  static getStateFromValue(t, a) {
206
205
  E(d(t, "hex")) || (t = M);
207
- const e = Z(a, t) || m(t), s = ee(a, t) || p(t), i = te(a, t) || d(t, "hex"), n = c(e.h);
206
+ const e = Q(a, t) || b(t), s = Z(a, t) || p(t), i = ee(a, t) || d(t, "hex"), n = c(e.h);
208
207
  return { hsva: e, backgroundColor: n, rgba: s, hex: i };
209
208
  }
210
209
  /**
@@ -229,16 +228,16 @@ const re = "rgba", M = "rgba(255, 255, 255, 1)", v = 2, u = 5, h = class h exten
229
228
  * @hidden
230
229
  */
231
230
  render() {
232
- const t = L(this);
231
+ const t = x(this);
233
232
  return /* @__PURE__ */ r.createElement(
234
233
  "div",
235
234
  {
236
235
  id: this.props.id,
237
236
  role: this.props.role || "textbox",
238
- className: K(
237
+ className: P(
239
238
  "k-colorgradient",
240
239
  {
241
- [`k-colorgradient-${U.sizeMap[this.props.size] || this.props.size}`]: this.props.size,
240
+ [`k-colorgradient-${K.sizeMap[this.props.size] || this.props.size}`]: this.props.size,
242
241
  "k-disabled": this.props.disabled
243
242
  },
244
243
  this.props.className
@@ -247,14 +246,14 @@ const re = "rgba", M = "rgba(255, 255, 255, 1)", v = 2, u = 5, h = class h exten
247
246
  style: { position: "relative", ...this.props.style },
248
247
  ref: this.wrapperRef,
249
248
  tabIndex: S(this.props.tabIndex, this.props.disabled),
250
- "aria-label": this.props.role === "none" ? void 0 : this.props.ariaLabel || t.toLanguageString(H, g[H]),
249
+ "aria-label": this.props.role === "none" ? void 0 : this.props.ariaLabel,
251
250
  "aria-labelledby": this.props.ariaLabelledBy,
252
251
  "aria-describedby": this.props.ariaDescribedBy,
253
252
  onFocus: this.onFocus,
254
253
  onKeyDown: this.onKeyDown
255
254
  },
256
255
  /* @__PURE__ */ r.createElement("div", { className: `k-colorgradient-canvas ${this.props._adaptive ? "k-vstack" : "k-hstack"}` }, /* @__PURE__ */ r.createElement("div", { className: "k-hsv-rectangle", style: { background: this.state.backgroundColor } }, /* @__PURE__ */ r.createElement(
257
- W,
256
+ U,
258
257
  {
259
258
  onDrag: this.onDrag,
260
259
  onRelease: this.onRelease,
@@ -272,7 +271,7 @@ const re = "rgba", M = "rgba(255, 255, 255, 1)", v = 2, u = 5, h = class h exten
272
271
  this.renderRectangleDragHandle()
273
272
  )
274
273
  ), this.props.backgroundColor && !this.state.isFirstRender && /* @__PURE__ */ r.createElement(
275
- ie,
274
+ ae,
276
275
  {
277
276
  metrics: this.gradientWrapper ? this.getGradientRectMetrics() : void 0,
278
277
  hsva: this.state.hsva,
@@ -291,8 +290,8 @@ const re = "rgba", M = "rgba(255, 255, 255, 1)", v = 2, u = 5, h = class h exten
291
290
  className: "k-hue-slider k-colorgradient-slider",
292
291
  disabled: this.props.disabled,
293
292
  ariaLabel: t.toLanguageString(
294
- D,
295
- g[D]
293
+ L,
294
+ m[L]
296
295
  )
297
296
  }
298
297
  ), this.props.opacity && /* @__PURE__ */ r.createElement(
@@ -305,8 +304,8 @@ const re = "rgba", M = "rgba(255, 255, 255, 1)", v = 2, u = 5, h = class h exten
305
304
  max: 100,
306
305
  step: 1,
307
306
  ariaLabel: t.toLanguageString(
308
- G,
309
- g[G]
307
+ D,
308
+ m[D]
310
309
  ),
311
310
  onChange: this.onAlphaSliderChange,
312
311
  className: "k-alpha-slider k-colorgradient-slider",
@@ -317,7 +316,7 @@ const re = "rgba", M = "rgba(255, 255, 255, 1)", v = 2, u = 5, h = class h exten
317
316
  }
318
317
  ))),
319
318
  /* @__PURE__ */ r.createElement(
320
- se,
319
+ te,
321
320
  {
322
321
  rgba: this.state.rgba,
323
322
  onRgbaChange: this.onRgbaChange,
@@ -331,8 +330,8 @@ const re = "rgba", M = "rgba(255, 255, 255, 1)", v = 2, u = 5, h = class h exten
331
330
  rounded: this.props.rounded
332
331
  }
333
332
  ),
334
- this.props.backgroundColor && /* @__PURE__ */ r.createElement(ae, { bgColor: p(this.props.backgroundColor), rgba: this.state.rgba }),
335
- this.showLicenseWatermark && /* @__PURE__ */ r.createElement($, { message: this.licenseMessage })
333
+ this.props.backgroundColor && /* @__PURE__ */ r.createElement(se, { bgColor: p(this.props.backgroundColor), rgba: this.state.rgba }),
334
+ this.showLicenseWatermark && /* @__PURE__ */ r.createElement(W, { message: this.licenseMessage })
336
335
  );
337
336
  }
338
337
  };
@@ -360,15 +359,15 @@ h.displayName = "ColorGradient", h.propTypes = {
360
359
  size: void 0
361
360
  };
362
361
  let f = h;
363
- const oe = _(), ne = F(
364
- N(
365
- oe,
362
+ const re = N(), oe = G(
363
+ A(
364
+ re,
366
365
  f
367
366
  )
368
367
  );
369
- ne.displayName = "KendoReactColorGradient";
368
+ oe.displayName = "KendoReactColorGradient";
370
369
  export {
371
- ne as ColorGradient,
372
- oe as ColorGradientPropsContext,
370
+ oe as ColorGradient,
371
+ re as ColorGradientPropsContext,
373
372
  f as ColorGradientWithoutContext
374
373
  };
@@ -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 n=require("react"),s=require("prop-types"),se=require("./utils/color-palette.service.js"),w=require("@progress/kendo-react-common"),ne=require("./models/palette-presets.js"),M=require("./utils/color-parser.js"),ae=require("@progress/kendo-react-intl"),O=require("../messages/index.js");function ce(c){const p=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const P in c)if(P!=="default"){const E=Object.getOwnPropertyDescriptor(c,P);Object.defineProperty(p,P,E.get?E:{enumerable:!0,get:()=>c[P]})}}return p.default=c,Object.freeze(p)}const k=ce(n),B=24,j=10,V="office",v={palette:V,columns:j,tileSize:B},H=w.createPropsContext(),ie=c=>{if(Array.isArray(c))return c;if(typeof c=="string"){const p=ne.PALETTEPRESETS[c];if(p)return p.colors}return[]},D=k.forwardRef((c,p)=>{const P=w.usePropsContext(H,c),{palette:E=v.palette,columns:F=v.columns,tileSize:u=v.tileSize,value:x,defaultValue:K,disabled:d=!1,tabIndex:W,onChange:h,onFocus:A,className:Z,size:I,id:G,ariaLabelledBy:J,ariaDescribedBy:Q}=P,S=n.useRef(null),X=n.useRef({focus:()=>{var o;(o=S.current)==null||o.focus()},wrapperRef:S}),_=F!=null?F:v.columns,b=n.useMemo(()=>ie(E),[E]),t=n.useMemo(()=>{const o=new se.ColorPaletteService;return o.setColorMatrix(b,_),o},[b,_]),[g,N]=n.useState(()=>x!==void 0?x:K||""),[L,R]=n.useState(""),y=x!==void 0;n.useEffect(()=>{y&&N(x)},[x,y]);const Y=n.useCallback(o=>{if(d||b.length===0)return;const f=g||b[0];R(f),A&&A(o)},[d,b,g,A]),ee=n.useCallback(()=>{R("")},[]),oe=n.useCallback(o=>{if(d)return;const{key:f}=o,r=()=>L||g||b[0],m=(l,e)=>l<0?e:l>e?0:l;switch(f){case"ArrowRight":o.preventDefault();{const l=r(),e=t.getCellCoordsFor(l);if(e&&t.colorRows[e.row]){const C=t.colorRows[e.row].length-1,a=m(e.col+1,C),i=t.colorRows[e.row][a];i&&R(i)}}break;case"ArrowLeft":o.preventDefault();{const l=r(),e=t.getCellCoordsFor(l);if(e&&t.colorRows[e.row]){const C=t.colorRows[e.row].length-1,a=m(e.col-1,C),i=t.colorRows[e.row][a];i&&R(i)}}break;case"ArrowDown":o.preventDefault();{const l=r(),e=t.getCellCoordsFor(l);if(e){const C=t.colorRows.length-1,a=m(e.row+1,C),i=Math.min(e.col,t.colorRows[a].length-1),T=t.colorRows[a][i];T&&R(T)}}break;case"ArrowUp":o.preventDefault();{const l=r(),e=t.getCellCoordsFor(l);if(e){const C=t.colorRows.length-1,a=m(e.row-1,C),i=Math.min(e.col,t.colorRows[a].length-1),T=t.colorRows[a][i];T&&R(T)}}break;case"Enter":o.preventDefault();{const l=r();if(l&&(y||N(l),h)){const e=M.parseColor(l,"rgba");w.dispatchEvent(h,o,null,{value:l,rgbaValue:e||""})}}break}},[d,L,g,b,t,y,h]),U=n.useCallback((o,f)=>{if(d)return;const r=o;if(y||N(r),h){const m=M.parseColor(r,"rgba");w.dispatchEvent(h,f,null,{value:r,rgbaValue:m||""})}},[d,h,y]),q=n.useCallback((o,f)=>o.map((r,m)=>{const l=g&&r.toLowerCase()===g.toLowerCase(),e=L&&r.toLowerCase()===L.toLowerCase(),C=w.classNames("k-colorpalette-tile",{"k-selected":l,"k-focus":e}),a={backgroundColor:r};return typeof u=="number"?(a.width=`${u}px`,a.height=`${u}px`):u&&typeof u=="object"&&("width"in u&&(a.width=`${u.width}px`),"height"in u&&(a.height=`${u.height}px`)),k.createElement("td",{key:r,role:"gridcell",className:C,style:a,"aria-label":r,"aria-selected":l?"true":void 0,onClick:i=>U(r,i)})}),[g,L,u,U]),te=n.useCallback(()=>t.colorRows.map((f,r)=>k.createElement("tr",{key:f[0]||r,role:"row"},q(f,r))),[t,q]),z=n.useCallback(()=>({focus:()=>{var o;(o=S.current)==null||o.focus()},wrapperRef:S}),[]);n.useImperativeHandle(X,z),n.useImperativeHandle(p,z);const re=w.classNames("k-colorpalette",Z,{"k-disabled":d,"k-colorpalette-sm":I==="small","k-colorpalette-md":I==="medium","k-colorpalette-lg":I==="large"}),le=ae.useLocalization();return k.createElement("div",{ref:S,role:"grid",className:re,tabIndex:w.getTabIndex(W,d),id:G,"aria-label":le.toLanguageString(O.colorPaletteAriaLabel,O.messages[O.colorPaletteAriaLabel]),"aria-labelledby":J,"aria-describedby":Q,"aria-disabled":d?"true":void 0,onFocus:Y,onBlur:ee,onKeyDown:oe},k.createElement("table",{className:"k-colorpalette-table",role:"none"},k.createElement("tbody",null,te())))});D.displayName="ColorPalette";D.propTypes={palette:s.oneOfType([s.arrayOf(s.string.isRequired),s.string]),columns:s.number,tileSize:s.any,defaultValue:s.string,value:s.string,disabled:s.bool,tabIndex:s.number,onChange:s.func,onFocus:s.func,id:s.string,ariaLabelledBy:s.string,ariaDescribedBy:s.string,className:s.string,size:s.oneOf(["small","medium","large"])};const $=w.withIdHOC(D);$.displayName="KendoReactColorPalette";const ue=D;exports.ColorPalette=$;exports.ColorPalettePropsContext=H;exports.ColorPaletteWithoutContext=ue;exports.DEFAULT_COLUMNS_COUNT=j;exports.DEFAULT_PRESET=V;exports.DEFAULT_TILE_SIZE=B;exports.defaultColorPaletteProps=v;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),s=require("prop-types"),le=require("./utils/color-palette.service.js"),w=require("@progress/kendo-react-common"),se=require("./models/palette-presets.js"),q=require("./utils/color-parser.js");function ne(c){const p=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const h in c)if(h!=="default"){const E=Object.getOwnPropertyDescriptor(c,h);Object.defineProperty(p,h,E.get?E:{enumerable:!0,get:()=>c[h]})}}return p.default=c,Object.freeze(p)}const k=ne(n),z=24,B=10,j="office",L={palette:j,columns:B,tileSize:z},V=w.createPropsContext(),ae=c=>{if(Array.isArray(c))return c;if(typeof c=="string"){const p=se.PALETTEPRESETS[c];if(p)return p.colors}return[]},D=k.forwardRef((c,p)=>{const h=w.usePropsContext(V,c),{palette:E=L.palette,columns:F=L.columns,tileSize:u=L.tileSize,value:x,defaultValue:$,disabled:d=!1,tabIndex:K,onChange:P,onFocus:I,className:W,size:N,id:Z,ariaLabelledBy:G,ariaDescribedBy:J,ariaLabel:Q}=h,S=n.useRef(null),X=n.useRef({focus:()=>{var o;(o=S.current)==null||o.focus()},wrapperRef:S}),_=F!=null?F:L.columns,b=n.useMemo(()=>ae(E),[E]),t=n.useMemo(()=>{const o=new le.ColorPaletteService;return o.setColorMatrix(b,_),o},[b,_]),[g,O]=n.useState(()=>x!==void 0?x:$||""),[T,R]=n.useState(""),y=x!==void 0;n.useEffect(()=>{y&&O(x)},[x,y]);const Y=n.useCallback(o=>{if(d||b.length===0)return;const f=g||b[0];R(f),I&&I(o)},[d,b,g,I]),ee=n.useCallback(()=>{R("")},[]),oe=n.useCallback(o=>{if(d)return;const{key:f}=o,r=()=>T||g||b[0],m=(l,e)=>l<0?e:l>e?0:l;switch(f){case"ArrowRight":o.preventDefault();{const l=r(),e=t.getCellCoordsFor(l);if(e&&t.colorRows[e.row]){const C=t.colorRows[e.row].length-1,a=m(e.col+1,C),i=t.colorRows[e.row][a];i&&R(i)}}break;case"ArrowLeft":o.preventDefault();{const l=r(),e=t.getCellCoordsFor(l);if(e&&t.colorRows[e.row]){const C=t.colorRows[e.row].length-1,a=m(e.col-1,C),i=t.colorRows[e.row][a];i&&R(i)}}break;case"ArrowDown":o.preventDefault();{const l=r(),e=t.getCellCoordsFor(l);if(e){const C=t.colorRows.length-1,a=m(e.row+1,C),i=Math.min(e.col,t.colorRows[a].length-1),v=t.colorRows[a][i];v&&R(v)}}break;case"ArrowUp":o.preventDefault();{const l=r(),e=t.getCellCoordsFor(l);if(e){const C=t.colorRows.length-1,a=m(e.row-1,C),i=Math.min(e.col,t.colorRows[a].length-1),v=t.colorRows[a][i];v&&R(v)}}break;case"Enter":o.preventDefault();{const l=r();if(l&&(y||O(l),P)){const e=q.parseColor(l,"rgba");w.dispatchEvent(P,o,null,{value:l,rgbaValue:e||""})}}break}},[d,T,g,b,t,y,P]),A=n.useCallback((o,f)=>{if(d)return;const r=o;if(y||O(r),P){const m=q.parseColor(r,"rgba");w.dispatchEvent(P,f,null,{value:r,rgbaValue:m||""})}},[d,P,y]),U=n.useCallback((o,f)=>o.map((r,m)=>{const l=g&&r.toLowerCase()===g.toLowerCase(),e=T&&r.toLowerCase()===T.toLowerCase(),C=w.classNames("k-colorpalette-tile",{"k-selected":l,"k-focus":e}),a={backgroundColor:r};return typeof u=="number"?(a.width=`${u}px`,a.height=`${u}px`):u&&typeof u=="object"&&("width"in u&&(a.width=`${u.width}px`),"height"in u&&(a.height=`${u.height}px`)),k.createElement("td",{key:r,role:"gridcell",className:C,style:a,"aria-label":r,"aria-selected":l?"true":void 0,onClick:i=>A(r,i)})}),[g,T,u,A]),te=n.useCallback(()=>t.colorRows.map((f,r)=>k.createElement("tr",{key:f[0]||r,role:"row"},U(f,r))),[t,U]),M=n.useCallback(()=>({focus:()=>{var o;(o=S.current)==null||o.focus()},wrapperRef:S}),[]);n.useImperativeHandle(X,M),n.useImperativeHandle(p,M);const re=w.classNames("k-colorpalette",W,{"k-disabled":d,"k-colorpalette-sm":N==="small","k-colorpalette-md":N==="medium","k-colorpalette-lg":N==="large"});return k.createElement("div",{ref:S,role:"grid",className:re,tabIndex:w.getTabIndex(K,d),id:Z,"aria-label":Q,"aria-labelledby":G,"aria-describedby":J,"aria-disabled":d?"true":void 0,onFocus:Y,onBlur:ee,onKeyDown:oe},k.createElement("table",{className:"k-colorpalette-table",role:"none"},k.createElement("tbody",null,te())))});D.displayName="ColorPalette";D.propTypes={palette:s.oneOfType([s.arrayOf(s.string.isRequired),s.string]),columns:s.number,tileSize:s.any,defaultValue:s.string,value:s.string,disabled:s.bool,tabIndex:s.number,onChange:s.func,onFocus:s.func,id:s.string,ariaLabelledBy:s.string,ariaDescribedBy:s.string,className:s.string,size:s.oneOf(["small","medium","large"])};const H=w.withIdHOC(D);H.displayName="KendoReactColorPalette";const ce=D;exports.ColorPalette=H;exports.ColorPalettePropsContext=V;exports.ColorPaletteWithoutContext=ce;exports.DEFAULT_COLUMNS_COUNT=B;exports.DEFAULT_PRESET=j;exports.DEFAULT_TILE_SIZE=z;exports.defaultColorPaletteProps=L;
@@ -6,78 +6,77 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  import * as R from "react";
9
- import { useRef as O, useMemo as U, useState as V, useEffect as le, useCallback as p, useImperativeHandle as M } from "react";
9
+ import { useRef as O, useMemo as U, useState as V, useEffect as se, useCallback as p, useImperativeHandle as M } from "react";
10
10
  import l from "prop-types";
11
- import { ColorPaletteService as ne } from "./utils/color-palette.service.mjs";
12
- import { withIdHOC as ae, createPropsContext as ce, usePropsContext as ie, dispatchEvent as _, classNames as H, getTabIndex as ue } from "@progress/kendo-react-common";
13
- import { PALETTEPRESETS as de } from "./models/palette-presets.mjs";
11
+ import { ColorPaletteService as le } from "./utils/color-palette.service.mjs";
12
+ import { withIdHOC as ne, createPropsContext as ae, usePropsContext as ce, dispatchEvent as _, classNames as H, getTabIndex as ie } from "@progress/kendo-react-common";
13
+ import { PALETTEPRESETS as ue } from "./models/palette-presets.mjs";
14
14
  import { parseColor as $ } from "./utils/color-parser.mjs";
15
- import { useLocalization as fe } from "@progress/kendo-react-intl";
16
- import { colorPaletteAriaLabel as K, messages as me } from "../messages/index.mjs";
17
- const Ce = 24, pe = 10, we = "office", L = {
18
- palette: we,
19
- columns: pe,
20
- tileSize: Ce
21
- }, ge = ce(), be = (w) => {
22
- if (Array.isArray(w))
23
- return w;
24
- if (typeof w == "string") {
25
- const E = de[w];
26
- if (E)
27
- return E.colors;
15
+ const de = 24, fe = 10, Ce = "office", v = {
16
+ palette: Ce,
17
+ columns: fe,
18
+ tileSize: de
19
+ }, we = ae(), pe = (m) => {
20
+ if (Array.isArray(m))
21
+ return m;
22
+ if (typeof m == "string") {
23
+ const P = ue[m];
24
+ if (P)
25
+ return P.colors;
28
26
  }
29
27
  return [];
30
- }, v = R.forwardRef((w, E) => {
31
- const j = ie(ge, w), {
32
- palette: A = L.palette,
33
- columns: F = L.columns,
34
- tileSize: c = L.tileSize,
28
+ }, F = R.forwardRef((m, P) => {
29
+ const K = ce(we, m), {
30
+ palette: I = v.palette,
31
+ columns: L = v.columns,
32
+ tileSize: c = v.tileSize,
35
33
  value: y,
36
- defaultValue: q,
34
+ defaultValue: j,
37
35
  disabled: i = !1,
38
- tabIndex: W,
36
+ tabIndex: q,
39
37
  onChange: g,
40
38
  onFocus: S,
41
- className: Z,
39
+ className: W,
42
40
  size: D,
43
- id: G,
44
- ariaLabelledBy: J,
45
- ariaDescribedBy: Q
46
- } = j, k = O(null), X = O({
41
+ id: Z,
42
+ ariaLabelledBy: G,
43
+ ariaDescribedBy: J,
44
+ ariaLabel: Q
45
+ } = K, k = O(null), X = O({
47
46
  focus: () => {
48
47
  var o;
49
48
  (o = k.current) == null || o.focus();
50
49
  },
51
50
  wrapperRef: k
52
- }), I = F != null ? F : L.columns, f = U(() => be(A), [A]), t = U(() => {
53
- const o = new ne();
54
- return o.setColorMatrix(f, I), o;
55
- }, [f, I]), [m, T] = V(() => y !== void 0 ? y : q || ""), [x, b] = V(""), h = y !== void 0;
56
- le(() => {
51
+ }), A = L != null ? L : v.columns, f = U(() => pe(I), [I]), t = U(() => {
52
+ const o = new le();
53
+ return o.setColorMatrix(f, A), o;
54
+ }, [f, A]), [C, T] = V(() => y !== void 0 ? y : j || ""), [x, b] = V(""), h = y !== void 0;
55
+ se(() => {
57
56
  h && T(y);
58
57
  }, [y, h]);
59
58
  const Y = p(
60
59
  (o) => {
61
60
  if (i || f.length === 0)
62
61
  return;
63
- const u = m || f[0];
62
+ const u = C || f[0];
64
63
  b(u), S && S(o);
65
64
  },
66
- [i, f, m, S]
65
+ [i, f, C, S]
67
66
  ), ee = p(() => {
68
67
  b("");
69
68
  }, []), oe = p(
70
69
  (o) => {
71
70
  if (i)
72
71
  return;
73
- const { key: u } = o, r = () => x || m || f[0], C = (s, e) => s < 0 ? e : s > e ? 0 : s;
72
+ const { key: u } = o, r = () => x || C || f[0], w = (s, e) => s < 0 ? e : s > e ? 0 : s;
74
73
  switch (u) {
75
74
  case "ArrowRight":
76
75
  o.preventDefault();
77
76
  {
78
77
  const s = r(), e = t.getCellCoordsFor(s);
79
78
  if (e && t.colorRows[e.row]) {
80
- const d = t.colorRows[e.row].length - 1, n = C(e.col + 1, d), a = t.colorRows[e.row][n];
79
+ const d = t.colorRows[e.row].length - 1, n = w(e.col + 1, d), a = t.colorRows[e.row][n];
81
80
  a && b(a);
82
81
  }
83
82
  }
@@ -87,7 +86,7 @@ const Ce = 24, pe = 10, we = "office", L = {
87
86
  {
88
87
  const s = r(), e = t.getCellCoordsFor(s);
89
88
  if (e && t.colorRows[e.row]) {
90
- const d = t.colorRows[e.row].length - 1, n = C(e.col - 1, d), a = t.colorRows[e.row][n];
89
+ const d = t.colorRows[e.row].length - 1, n = w(e.col - 1, d), a = t.colorRows[e.row][n];
91
90
  a && b(a);
92
91
  }
93
92
  }
@@ -97,8 +96,8 @@ const Ce = 24, pe = 10, we = "office", L = {
97
96
  {
98
97
  const s = r(), e = t.getCellCoordsFor(s);
99
98
  if (e) {
100
- const d = t.colorRows.length - 1, n = C(e.row + 1, d), a = Math.min(e.col, t.colorRows[n].length - 1), P = t.colorRows[n][a];
101
- P && b(P);
99
+ const d = t.colorRows.length - 1, n = w(e.row + 1, d), a = Math.min(e.col, t.colorRows[n].length - 1), E = t.colorRows[n][a];
100
+ E && b(E);
102
101
  }
103
102
  }
104
103
  break;
@@ -107,8 +106,8 @@ const Ce = 24, pe = 10, we = "office", L = {
107
106
  {
108
107
  const s = r(), e = t.getCellCoordsFor(s);
109
108
  if (e) {
110
- const d = t.colorRows.length - 1, n = C(e.row - 1, d), a = Math.min(e.col, t.colorRows[n].length - 1), P = t.colorRows[n][a];
111
- P && b(P);
109
+ const d = t.colorRows.length - 1, n = w(e.row - 1, d), a = Math.min(e.col, t.colorRows[n].length - 1), E = t.colorRows[n][a];
110
+ E && b(E);
112
111
  }
113
112
  }
114
113
  break;
@@ -127,24 +126,24 @@ const Ce = 24, pe = 10, we = "office", L = {
127
126
  break;
128
127
  }
129
128
  },
130
- [i, x, m, f, t, h, g]
129
+ [i, x, C, f, t, h, g]
131
130
  ), N = p(
132
131
  (o, u) => {
133
132
  if (i)
134
133
  return;
135
134
  const r = o;
136
135
  if (h || T(r), g) {
137
- const C = $(r, "rgba");
136
+ const w = $(r, "rgba");
138
137
  _(g, u, null, {
139
138
  value: r,
140
- rgbaValue: C || ""
139
+ rgbaValue: w || ""
141
140
  });
142
141
  }
143
142
  },
144
143
  [i, g, h]
145
- ), z = p(
146
- (o, u) => o.map((r, C) => {
147
- const s = m && r.toLowerCase() === m.toLowerCase(), e = x && r.toLowerCase() === x.toLowerCase(), d = H("k-colorpalette-tile", {
144
+ ), B = p(
145
+ (o, u) => o.map((r, w) => {
146
+ const s = C && r.toLowerCase() === C.toLowerCase(), e = x && r.toLowerCase() === x.toLowerCase(), d = H("k-colorpalette-tile", {
148
147
  "k-selected": s,
149
148
  "k-focus": e
150
149
  }), n = {
@@ -163,8 +162,8 @@ const Ce = 24, pe = 10, we = "office", L = {
163
162
  }
164
163
  );
165
164
  }),
166
- [m, x, c, N]
167
- ), te = p(() => t.colorRows.map((u, r) => /* @__PURE__ */ R.createElement("tr", { key: u[0] || r, role: "row" }, z(u, r))), [t, z]), B = p(
165
+ [C, x, c, N]
166
+ ), te = p(() => t.colorRows.map((u, r) => /* @__PURE__ */ R.createElement("tr", { key: u[0] || r, role: "row" }, B(u, r))), [t, B]), z = p(
168
167
  () => ({
169
168
  focus: () => {
170
169
  var o;
@@ -174,24 +173,24 @@ const Ce = 24, pe = 10, we = "office", L = {
174
173
  }),
175
174
  []
176
175
  );
177
- M(X, B), M(E, B);
178
- const re = H("k-colorpalette", Z, {
176
+ M(X, z), M(P, z);
177
+ const re = H("k-colorpalette", W, {
179
178
  "k-disabled": i,
180
179
  "k-colorpalette-sm": D === "small",
181
180
  "k-colorpalette-md": D === "medium",
182
181
  "k-colorpalette-lg": D === "large"
183
- }), se = fe();
182
+ });
184
183
  return /* @__PURE__ */ R.createElement(
185
184
  "div",
186
185
  {
187
186
  ref: k,
188
187
  role: "grid",
189
188
  className: re,
190
- tabIndex: ue(W, i),
191
- id: G,
192
- "aria-label": se.toLanguageString(K, me[K]),
193
- "aria-labelledby": J,
194
- "aria-describedby": Q,
189
+ tabIndex: ie(q, i),
190
+ id: Z,
191
+ "aria-label": Q,
192
+ "aria-labelledby": G,
193
+ "aria-describedby": J,
195
194
  "aria-disabled": i ? "true" : void 0,
196
195
  onFocus: Y,
197
196
  onBlur: ee,
@@ -200,8 +199,8 @@ const Ce = 24, pe = 10, we = "office", L = {
200
199
  /* @__PURE__ */ R.createElement("table", { className: "k-colorpalette-table", role: "none" }, /* @__PURE__ */ R.createElement("tbody", null, te()))
201
200
  );
202
201
  });
203
- v.displayName = "ColorPalette";
204
- v.propTypes = {
202
+ F.displayName = "ColorPalette";
203
+ F.propTypes = {
205
204
  palette: l.oneOfType([l.arrayOf(l.string.isRequired), l.string]),
206
205
  columns: l.number,
207
206
  tileSize: l.any,
@@ -217,17 +216,17 @@ v.propTypes = {
217
216
  className: l.string,
218
217
  size: l.oneOf(["small", "medium", "large"])
219
218
  };
220
- const he = ae(
221
- v
219
+ const me = ne(
220
+ F
222
221
  );
223
- he.displayName = "KendoReactColorPalette";
224
- const Fe = v;
222
+ me.displayName = "KendoReactColorPalette";
223
+ const xe = F;
225
224
  export {
226
- he as ColorPalette,
227
- ge as ColorPalettePropsContext,
228
- Fe as ColorPaletteWithoutContext,
229
- pe as DEFAULT_COLUMNS_COUNT,
230
- we as DEFAULT_PRESET,
231
- Ce as DEFAULT_TILE_SIZE,
232
- L as defaultColorPaletteProps
225
+ me as ColorPalette,
226
+ we as ColorPalettePropsContext,
227
+ xe as ColorPaletteWithoutContext,
228
+ fe as DEFAULT_COLUMNS_COUNT,
229
+ Ce as DEFAULT_PRESET,
230
+ de as DEFAULT_TILE_SIZE,
231
+ v as defaultColorPaletteProps
233
232
  };
@@ -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 Me=require("react"),r=require("prop-types"),n=require("@progress/kendo-react-common"),be=require("../package-metadata.js"),Ve=require("./Picker.js"),He=require("./ColorGradient.js"),Y=require("./ColorPalette.js"),q=require("./FlatColorPicker.js"),We=require("@progress/kendo-react-buttons"),Ue=require("@progress/kendo-svg-icons"),d=require("../messages/index.js"),je=require("@progress/kendo-react-intl"),Ge=require("../common/AdaptiveMode.js"),Ke=require("@progress/kendo-react-layout");function $e(g){const T=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(g){for(const P in g)if(P!=="default"){const F=Object.getOwnPropertyDescriptor(g,P);Object.defineProperty(T,P,F.get?F:{enumerable:!0,get:()=>g[P]})}}return T.default=g,Object.freeze(T)}const t=$e(Me),Ze={opacity:!0},Je={palette:Y.DEFAULT_PRESET,tileSize:Y.DEFAULT_TILE_SIZE},X=g=>g!==void 0,Ee=n.createPropsContext(),ee=t.forwardRef((g,T)=>{var fe,ge;const P=!n.validatePackage(be.packageMetadata,{component:"ColorPicker"}),F=n.getLicenseMessage(be.packageMetadata),l=n.usePropsContext(Ee,g),_=je.useLocalization(),te=n.useAdaptiveModeContext(),{size:p=w.size,rounded:C=w.rounded,fillMode:M=w.fillMode,gradientSettings:y=w.gradientSettings,paletteSettings:R=w.paletteSettings,flatColorPickerSettings:A,view:v=l.views?void 0:w.view,views:u=v?void 0:w.views,activeView:ne,popupSettings:b,valid:we,disabled:V,tabIndex:Pe,icon:H,svgIcon:W,iconClassName:O,onChange:U,onFocus:j,onBlur:G,onActiveColorClick:K,className:ye,adaptive:Se,adaptiveTitle:ae=_.toLanguageString(d.colorPickerAdaptiveTitle,d.messages[d.colorPickerAdaptiveTitle]),adaptiveSubtitle:oe,showButtons:S=!0}=l,c=t.useRef(null),I=t.useRef(null),L=t.useRef(null),m=t.useRef(null),h=t.useRef(void 0),re=t.useRef(null),[he,le]=t.useState(!1),[Te,_e]=t.useState(l.defaultValue||void 0),[Re,Ae]=t.useState(!1),[D,Ie]=t.useState(),$=X(l.value),E=X(l.open),i=$?l.value:Te,f=E?l.open:Re,ie=t.useRef(i),z=t.useCallback(()=>{c.current&&c.current.focus()},[]);t.useImperativeHandle(T,()=>({element:c.current,actionElement:re.current,value:i,focus:z}),[i,z]);const ce=t.useRef(null);t.useImperativeHandle(ce,()=>({element:c.current,actionElement:re.current,value:i,focus:z}),[i,z]),n.useWebMcpRegister("colorpicker",ce,l,l.webMcp);const Z=!!(D&&te&&D<=te.medium&&Se);t.useEffect(()=>{const e=n.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(xe.bind(void 0));return document!=null&&document.body&&e&&e.observe(document.body),()=>{document!=null&&document.body&&e&&e.disconnect()}},[]);const o=t.useCallback((e,s)=>{E||(!e&&!s&&c&&c.current&&c.current.focus(),Ae(e))},[E]),se=t.useMemo(()=>new n.Navigation({root:c,selectors:[".k-colorpicker",".k-color-picker-popup"],tabIndex:0,keyboardEvents:{keydown:{Escape:(e,s,a)=>{o(!1)},Enter:(e,s,a)=>{!E&&e===c.current&&(a.preventDefault(),a.stopPropagation(),o(!0))},ArrowDown:(e,s,a)=>{a.altKey&&(a.preventDefault(),a.stopPropagation(),o(!0))},ArrowUp:(e,s,a)=>{a.altKey&&(a.preventDefault(),a.stopPropagation(),o(!1))},Tab:(e,s,a)=>{var B,ve,ke;if(n.getActiveElement(document)!==c.current){const me=(B=L.current)==null?void 0:B.wrapperRef.current,x=(ve=I.current)==null?void 0:ve.wrapperRef.current,Ce=(ke=m.current)==null?void 0:ke.element;v==="palette"&&me?n.keepFocusInContainer(a,me):v==="gradient"&&x?n.keepFocusInContainer(a,x):v==="combo"&&x?n.keepFocusInContainer(a,x.parentElement):u&&Ce&&n.keepFocusInContainer(a,Ce)}}}}}),[o,E]),Be=t.useCallback(se.triggerKeyboardEvent.bind(se),[]),Fe=t.useCallback(()=>{E||(I.current&&I.current.wrapperRef.current?n.focusFirstFocusableChild(I.current.wrapperRef.current):L.current?L.current.focus():m.current&&m.current.element&&n.focusFirstFocusableChild(m.current.element))},[E]),N=e=>ie.current=e,ue=t.useCallback(e=>{const s={value:ie.current,nativeEvent:e.nativeEvent,syntheticEvent:e};k(s),o(!f,!0)},[f]),J=t.useCallback(()=>{o(!1,!0)},[o]),Oe=t.useCallback(e=>{K&&K.call(void 0,{syntheticEvent:e,nativeEvent:e.nativeEvent,value:i,target:{element:c.current,value:i}})},[K,i]),Le=t.useCallback(e=>{h.current?(clearTimeout(h.current),h.current=void 0):(le(!0),Z&&!f&&o(!0)),j&&j.call(void 0,{nativeEvent:e.nativeEvent,syntheticEvent:e})},[Z,j,f,o]),De=t.useCallback(()=>{o(!1,!0),le(!1),h.current=void 0},[]),ze=t.useCallback(e=>{clearTimeout(h.current),h.current=window.setTimeout(De),G&&G.call(void 0,{nativeEvent:e.nativeEvent,syntheticEvent:e})},[G]),k=t.useCallback((e,s)=>{var B;const a=s?e.rgbaValue||"":(B=e.value)!=null?B:"";$||_e(a),U&&U.call(void 0,{value:a,nativeEvent:e.nativeEvent,syntheticEvent:e.syntheticEvent,target:{element:c.current,value:a}}),o(!1)},[$,U]),de=t.useCallback(e=>k(e,!0),[X,k]),Q=t.useCallback(e=>t.createElement(t.Fragment,null,(v==="combo"||v==="gradient")&&t.createElement(He.ColorGradient,{...y,_adaptive:e,ref:I,isInsidePopup:!0,role:"none",ariaLabel:void 0,size:e?"large":p,value:i,onChange:k}),(v==="combo"||v==="palette")&&t.createElement(Y.ColorPalette,{...R,ref:L,size:e?"large":p,value:i,onChange:de}),u&&u[0]==="gradient"&&u[1]==="palette"&&t.createElement(q.FlatColorPicker,{...A,_paletteSettings:R,_gradientSettings:{_adaptive:e,...y},ref:m,size:e?"large":p,rounded:C,views:["gradient","palette"],activeView:ne,setOpen:o,showButtons:e?!1:S,value:i,onChange:k,setAdaptiveModeValue:N}),u&&u[0]==="palette"&&u[1]==="gradient"&&t.createElement(q.FlatColorPicker,{...A,_paletteSettings:R,_gradientSettings:{_adaptive:e,...y},ref:m,size:e?"large":p,rounded:C,views:["palette","gradient"],setOpen:o,showButtons:e?!1:S,value:i,onChange:k,setAdaptiveModeValue:N}),u&&u.includes("gradient")&&!u.includes("palette")&&t.createElement(q.FlatColorPicker,{...A,_gradientSettings:{_adaptive:e,...y},ref:m,size:e?"large":p,rounded:C,views:["gradient"],showButtons:e?!1:S,setOpen:o,value:i,onChange:k,setAdaptiveModeValue:N}),u&&u.includes("palette")&&!u.includes("gradient")&&t.createElement(q.FlatColorPicker,{...A,_paletteSettings:R,_gradientSettings:{_adaptive:e,...y},ref:m,size:e?"large":p,rounded:C,views:["palette"],showButtons:e?!1:S,setOpen:o,value:i,onChange:k,setAdaptiveModeValue:N}),P&&t.createElement(n.WatermarkOverlay,{message:F})),[ne,M,A,y,k,de,R,o,p,i,v,u]),Ne=t.useCallback(()=>{var s;const e={animation:!!((s=b==null?void 0:b.animate)==null||s),title:ae,subTitle:oe,expand:f,onClose:J,windowWidth:D,footer:S?{cancelText:_.toLanguageString(d.flatColorPickerCancelBtn,d.messages[d.flatColorPickerCancelBtn]),onCancel:J,applyText:_.toLanguageString(d.flatColorPickerApplyBtn,d.messages[d.flatColorPickerApplyBtn]),onApply:ue}:void 0};return t.createElement(Ge.AdaptiveMode,{...e},t.createElement(Ke.ActionSheetContent,null,Q(!0)))},[b==null?void 0:b.animate,ae,oe,f,J,D,S,_,ue,Q]),xe=t.useCallback(e=>{for(const s of e)Ie(s.target.clientWidth)},[]),pe=n.useDir(c,l.dir),qe=we!==!1;return t.createElement("span",{id:l.id,role:"combobox","aria-label":l.ariaLabel,"aria-labelledby":l.ariaLabelledBy,"aria-describedby":l.ariaDescribedBy,"aria-haspopup":"dialog","aria-expanded":f,"aria-controls":f?`k-colorpicker-popup-${(fe=l.id)!=null?fe:0}`:void 0,"aria-disabled":V?"true":void 0,className:n.classNames("k-colorpicker","k-picker","k-icon-picker",{[`k-picker-${n.kendoThemeMaps.sizeMap[p]||p}`]:p,[`k-picker-${M}`]:M,[`k-rounded-${n.kendoThemeMaps.roundedMap[C]||C}`]:C,"k-invalid":!qe,"k-disabled":V,"k-focus":he,className:ye}),ref:c,tabIndex:n.getTabIndex(Pe,V),title:l.title,onKeyDown:Be,onFocus:Le,onBlur:ze,dir:pe},t.createElement(Ve.Picker,{dir:pe,open:f,onOpen:Fe,popupAnchor:c.current||void 0,popupSettings:{id:`k-colorpicker-popup-${(ge=l.id)!=null?ge:0}`,...b},input:t.createElement("span",{onClick:Oe,className:"k-input-inner"},t.createElement("span",{className:n.classNames("k-value-icon","k-color-preview",{"k-no-color":!i,"k-icon-color-preview":H||W||O})},O&&t.createElement("span",{className:n.classNames("k-color-preview-icon",O)}),!O&&(H||W)&&t.createElement(n.IconWrap,{name:H,icon:W}),t.createElement("span",{className:"k-color-preview-mask",style:{backgroundColor:i}}))),button:t.createElement(We.Button,{tabIndex:-1,type:"button",onClick:()=>o(!f),className:"k-input-button",icon:"chevron-down",svgIcon:Ue.chevronDownIcon,size:p,"aria-label":_.toLanguageString(d.colorPickerDropdownButtonAriaLabel,d.messages[d.colorPickerDropdownButtonAriaLabel])}),content:Q(!1),_mobileMode:Z,_actionSheet:Ne()}))});ee.propTypes={value:r.string,defaultValue:r.string,disabled:r.bool,view:r.oneOf(["gradient","palette","combo"]),views:r.arrayOf(r.oneOf(["gradient","palette"])),dir:r.string,id:r.string,icon:r.string,svgIcon:n.svgIconPropType,ariaLabelledBy:r.string,ariaDescribedBy:r.string,size:r.oneOf(["small","medium","large"]),rounded:r.oneOf(["small","medium","large","full","none"]),fillMode:r.oneOf(["solid","flat","outline"]),className:r.string,adaptive:r.bool,adaptiveTitle:r.string,adaptiveSubtitle:r.string};const w={size:void 0,rounded:void 0,fillMode:void 0,view:"palette",views:["gradient","palette"],gradientSettings:Ze,paletteSettings:Je};ee.displayName="KendoColorPicker";exports.ColorPicker=ee;exports.ColorPickerPropsContext=Ee;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Me=require("react"),l=require("prop-types"),a=require("@progress/kendo-react-common"),be=require("../package-metadata.js"),Ve=require("./Picker.js"),He=require("./ColorGradient.js"),Y=require("./ColorPalette.js"),M=require("./FlatColorPicker.js"),We=require("@progress/kendo-react-buttons"),Ue=require("@progress/kendo-svg-icons"),n=require("../messages/index.js"),je=require("@progress/kendo-react-intl"),Ge=require("../common/AdaptiveMode.js"),Ke=require("@progress/kendo-react-layout");function $e(g){const T=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(g){for(const y in g)if(y!=="default"){const B=Object.getOwnPropertyDescriptor(g,y);Object.defineProperty(T,y,B.get?B:{enumerable:!0,get:()=>g[y]})}}return T.default=g,Object.freeze(T)}const t=$e(Me),Ze={opacity:!0},Je={palette:Y.DEFAULT_PRESET,tileSize:Y.DEFAULT_TILE_SIZE},X=g=>g!==void 0,Ee=a.createPropsContext(),ee=t.forwardRef((g,T)=>{var fe,ge;const y=!a.validatePackage(be.packageMetadata,{component:"ColorPicker"}),B=a.getLicenseMessage(be.packageMetadata),i=a.usePropsContext(Ee,g),v=je.useLocalization(),te=a.useAdaptiveModeContext(),{size:p=w.size,rounded:b=w.rounded,fillMode:V=w.fillMode,gradientSettings:S=w.gradientSettings,paletteSettings:A=w.paletteSettings,flatColorPickerSettings:R,view:k=i.views?void 0:w.view,views:d=k?void 0:w.views,activeView:ae,popupSettings:E,valid:Pe,disabled:F,tabIndex:we,icon:H,svgIcon:W,iconClassName:O,onChange:U,onFocus:j,onBlur:G,onActiveColorClick:K,className:ye,adaptive:Se,adaptiveTitle:ne=v.toLanguageString(n.colorPickerAdaptiveTitle,n.messages[n.colorPickerAdaptiveTitle]),adaptiveSubtitle:re,showButtons:h=!0}=i,s=t.useRef(null),_=t.useRef(null),D=t.useRef(null),C=t.useRef(null),L=t.useRef(void 0),oe=t.useRef(null),[he,le]=t.useState(!1),[Le,Te]=t.useState(i.defaultValue||void 0),[Ae,Re]=t.useState(!1),[z,_e]=t.useState(),$=X(i.value),P=X(i.open),c=$?i.value:Le,f=P?i.open:Ae,ie=t.useRef(c),N=t.useCallback(()=>{s.current&&s.current.focus()},[]);t.useImperativeHandle(T,()=>({element:s.current,actionElement:oe.current,value:c,focus:N}),[c,N]);const ce=t.useRef(null);t.useImperativeHandle(ce,()=>({element:s.current,actionElement:oe.current,value:c,focus:N}),[c,N]),a.useWebMcpRegister("colorpicker",ce,i,i.webMcp);const Z=!!(z&&te&&z<=te.medium&&Se);t.useEffect(()=>{const e=a.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(xe.bind(void 0));return document!=null&&document.body&&e&&e.observe(document.body),()=>{document!=null&&document.body&&e&&e.disconnect()}},[]);const o=t.useCallback((e,u)=>{P||(!e&&!u&&s&&s.current&&s.current.focus(),Re(e))},[P]),se=t.useMemo(()=>new a.Navigation({root:s,selectors:[".k-colorpicker",".k-color-picker-popup"],tabIndex:0,keyboardEvents:{keydown:{Escape:(e,u,r)=>{o(!1)},Enter:(e,u,r)=>{!P&&e===s.current&&(r.preventDefault(),r.stopPropagation(),o(!0))},ArrowDown:(e,u,r)=>{r.altKey&&(r.preventDefault(),r.stopPropagation(),o(!0))},ArrowUp:(e,u,r)=>{r.altKey&&(r.preventDefault(),r.stopPropagation(),o(!1))},Tab:(e,u,r)=>{var I,ve,ke;if(a.getActiveElement(document)!==s.current){const me=(I=D.current)==null?void 0:I.wrapperRef.current,q=(ve=_.current)==null?void 0:ve.wrapperRef.current,Ce=(ke=C.current)==null?void 0:ke.element;k==="palette"&&me?a.keepFocusInContainer(r,me):k==="gradient"&&q?a.keepFocusInContainer(r,q):k==="combo"&&q?a.keepFocusInContainer(r,q.parentElement):d&&Ce&&a.keepFocusInContainer(r,Ce)}}}}}),[o,P]),Ie=t.useCallback(se.triggerKeyboardEvent.bind(se),[]),Be=t.useCallback(()=>{P||(_.current&&_.current.wrapperRef.current?a.focusFirstFocusableChild(_.current.wrapperRef.current):D.current?D.current.focus():C.current&&C.current.element&&a.focusFirstFocusableChild(C.current.element))},[P]),x=e=>ie.current=e,ue=t.useCallback(e=>{const u={value:ie.current,nativeEvent:e.nativeEvent,syntheticEvent:e};m(u),o(!f,!0)},[f]),J=t.useCallback(()=>{o(!1,!0)},[o]),Fe=t.useCallback(e=>{K&&K.call(void 0,{syntheticEvent:e,nativeEvent:e.nativeEvent,value:c,target:{element:s.current,value:c}})},[K,c]),Oe=t.useCallback(e=>{L.current?(clearTimeout(L.current),L.current=void 0):(le(!0),Z&&!f&&o(!0)),j&&j.call(void 0,{nativeEvent:e.nativeEvent,syntheticEvent:e})},[Z,j,f,o]),De=t.useCallback(()=>{o(!1,!0),le(!1),L.current=void 0},[]),ze=t.useCallback(e=>{clearTimeout(L.current),L.current=window.setTimeout(De),G&&G.call(void 0,{nativeEvent:e.nativeEvent,syntheticEvent:e})},[G]),m=t.useCallback((e,u)=>{var I;const r=u?e.rgbaValue||"":(I=e.value)!=null?I:"";$||Te(r),U&&U.call(void 0,{value:r,nativeEvent:e.nativeEvent,syntheticEvent:e.syntheticEvent,target:{element:s.current,value:r}}),o(!1)},[$,U]),de=t.useCallback(e=>m(e,!0),[X,m]),Q=t.useCallback(e=>t.createElement(t.Fragment,null,(k==="combo"||k==="gradient")&&t.createElement(He.ColorGradient,{...S,_adaptive:e,ref:_,isInsidePopup:!0,role:"none",ariaLabel:void 0,size:e?"large":p,value:c,onChange:m}),(k==="combo"||k==="palette")&&t.createElement(Y.ColorPalette,{...A,ref:D,size:e?"large":p,value:c,onChange:de}),d&&d[0]==="gradient"&&d[1]==="palette"&&t.createElement(M.FlatColorPicker,{ariaLabel:v.toLanguageString(n.flatColorPickerAriaLabel,n.messages[n.flatColorPickerAriaLabel]),...R,paletteSettings:A,gradientSettings:{_adaptive:e,...S},ref:C,size:e?"large":p,rounded:b,views:["gradient","palette"],activeView:ae,setOpen:o,showButtons:e?!1:h,value:c,onChange:m,setAdaptiveModeValue:x}),d&&d[0]==="palette"&&d[1]==="gradient"&&t.createElement(M.FlatColorPicker,{ariaLabel:v.toLanguageString(n.flatColorPickerAriaLabel,n.messages[n.flatColorPickerAriaLabel]),...R,paletteSettings:A,gradientSettings:{_adaptive:e,...S},ref:C,size:e?"large":p,rounded:b,views:["palette","gradient"],setOpen:o,showButtons:e?!1:h,value:c,onChange:m,setAdaptiveModeValue:x}),d&&d.includes("gradient")&&!d.includes("palette")&&t.createElement(M.FlatColorPicker,{ariaLabel:v.toLanguageString(n.flatColorPickerAriaLabel,n.messages[n.flatColorPickerAriaLabel]),...R,gradientSettings:{_adaptive:e,...S},ref:C,size:e?"large":p,rounded:b,views:["gradient"],showButtons:e?!1:h,setOpen:o,value:c,onChange:m,setAdaptiveModeValue:x}),d&&d.includes("palette")&&!d.includes("gradient")&&t.createElement(M.FlatColorPicker,{ariaLabel:v.toLanguageString(n.flatColorPickerAriaLabel,n.messages[n.flatColorPickerAriaLabel]),...R,paletteSettings:A,gradientSettings:{_adaptive:e,...S},ref:C,size:e?"large":p,rounded:b,views:["palette"],showButtons:e?!1:h,setOpen:o,value:c,onChange:m,setAdaptiveModeValue:x}),y&&t.createElement(a.WatermarkOverlay,{message:B})),[ae,V,R,S,m,de,A,o,p,c,k,d]),Ne=t.useCallback(()=>{var u;const e={animation:!!((u=E==null?void 0:E.animate)==null||u),title:ne,subTitle:re,expand:f,onClose:J,windowWidth:z,footer:h?{cancelText:v.toLanguageString(n.flatColorPickerCancelBtn,n.messages[n.flatColorPickerCancelBtn]),onCancel:J,applyText:v.toLanguageString(n.flatColorPickerApplyBtn,n.messages[n.flatColorPickerApplyBtn]),onApply:ue}:void 0};return t.createElement(Ge.AdaptiveMode,{...e},t.createElement(Ke.ActionSheetContent,null,Q(!0)))},[E==null?void 0:E.animate,ne,re,f,J,z,h,v,ue,Q]),xe=t.useCallback(e=>{for(const u of e)_e(u.target.clientWidth)},[]),pe=a.useDir(s,i.dir),qe=Pe!==!1;return t.createElement("span",{id:i.id,role:"combobox","aria-label":i.ariaLabel,"aria-labelledby":i.ariaLabelledBy,"aria-describedby":i.ariaDescribedBy,"aria-haspopup":"dialog","aria-expanded":f,"aria-controls":f?`k-colorpicker-popup-${(fe=i.id)!=null?fe:0}`:void 0,"aria-disabled":F?"true":void 0,className:a.classNames("k-colorpicker","k-picker","k-icon-picker",{[`k-picker-${a.kendoThemeMaps.sizeMap[p]||p}`]:p,[`k-picker-${V}`]:V,[`k-rounded-${a.kendoThemeMaps.roundedMap[b]||b}`]:b,"k-invalid":!qe,"k-disabled":F,"k-focus":he,className:ye}),ref:s,tabIndex:a.getTabIndex(we,F),title:i.title,onKeyDown:Ie,onFocus:Oe,onBlur:ze,dir:pe},t.createElement(Ve.Picker,{dir:pe,open:f,onOpen:Be,popupAnchor:s.current||void 0,popupSettings:{id:`k-colorpicker-popup-${(ge=i.id)!=null?ge:0}`,...E},input:t.createElement("span",{onClick:Fe,className:"k-input-inner"},t.createElement("span",{className:a.classNames("k-value-icon","k-color-preview",{"k-no-color":!c,"k-icon-color-preview":H||W||O})},O&&t.createElement("span",{className:a.classNames("k-color-preview-icon",O)}),!O&&(H||W)&&t.createElement(a.IconWrap,{name:H,icon:W}),t.createElement("span",{className:"k-color-preview-mask",style:{backgroundColor:c}}))),button:t.createElement(We.Button,{tabIndex:-1,type:"button",onClick:()=>o(!f),className:"k-input-button",disabled:F,icon:"chevron-down",svgIcon:Ue.chevronDownIcon,size:p,"aria-label":v.toLanguageString(n.colorPickerDropdownButtonAriaLabel,n.messages[n.colorPickerDropdownButtonAriaLabel])}),content:Q(!1),_mobileMode:Z,_actionSheet:Ne()}))});ee.propTypes={value:l.string,defaultValue:l.string,disabled:l.bool,view:l.oneOf(["gradient","palette","combo"]),views:l.arrayOf(l.oneOf(["gradient","palette"])),dir:l.string,id:l.string,icon:l.string,svgIcon:a.svgIconPropType,ariaLabelledBy:l.string,ariaDescribedBy:l.string,size:l.oneOf(["small","medium","large"]),rounded:l.oneOf(["small","medium","large","full","none"]),fillMode:l.oneOf(["solid","flat","outline"]),className:l.string,adaptive:l.bool,adaptiveTitle:l.string,adaptiveSubtitle:l.string};const w={size:void 0,rounded:void 0,fillMode:void 0,view:"palette",views:["gradient","palette"],gradientSettings:Ze,paletteSettings:Je};ee.displayName="KendoColorPicker";exports.ColorPicker=ee;exports.ColorPickerPropsContext=Ee;