@progress/kendo-react-inputs 11.4.0-develop.5 → 11.4.0-develop.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,26 +7,26 @@
7
7
  */
8
8
  import * as t from "react";
9
9
  import r from "prop-types";
10
- import { createPropsContext as He, validatePackage as We, usePropsContext as Ue, useAdaptiveModeContext as Ke, canUseDOM as $e, Navigation as Ge, getActiveElement as Me, keepFocusInContainer as z, focusFirstFocusableChild as de, WatermarkOverlay as Ze, useDir as je, classNames as Z, kendoThemeMaps as pe, getTabIndex as qe, IconWrap as Je, svgIconPropType as Qe } from "@progress/kendo-react-common";
11
- import { packageMetadata as Xe } from "../package-metadata.mjs";
12
- import { Picker as Ye } from "./Picker.mjs";
13
- import { ColorGradient as et } from "./ColorGradient.mjs";
14
- import { ColorPalette as tt, DEFAULT_PRESET as nt, DEFAULT_TILE_SIZE as at } from "./ColorPalette.mjs";
10
+ import { createPropsContext as Ue, validatePackage as Ke, getLicenseMessage as $e, usePropsContext as Ge, useAdaptiveModeContext as Me, canUseDOM as Ze, Navigation as je, getActiveElement as qe, keepFocusInContainer as z, focusFirstFocusableChild as de, WatermarkOverlay as Je, useDir as Qe, classNames as Z, kendoThemeMaps as pe, getTabIndex as Xe, IconWrap as Ye, svgIconPropType as et } from "@progress/kendo-react-common";
11
+ import { packageMetadata as fe } from "../package-metadata.mjs";
12
+ import { Picker as tt } from "./Picker.mjs";
13
+ import { ColorGradient as nt } from "./ColorGradient.mjs";
14
+ import { ColorPalette as at, DEFAULT_PRESET as rt, DEFAULT_TILE_SIZE as ot } from "./ColorPalette.mjs";
15
15
  import { FlatColorPicker as B } from "./FlatColorPicker.mjs";
16
- import { Button as rt } from "@progress/kendo-react-buttons";
17
- import { caretAltDownIcon as ot } from "@progress/kendo-svg-icons";
18
- import { colorPickerAdaptiveTitle as fe, messages as D, flatColorPickerCancelBtn as me, flatColorPickerApplyBtn as ve, colorPickerDropdownButtonAriaLabel as ge } from "../messages/index.mjs";
19
- import { useLocalization as lt } from "@progress/kendo-react-intl";
20
- import { AdaptiveMode as it } from "../common/AdaptiveMode.mjs";
21
- import { ActionSheetContent as ct } from "@progress/kendo-react-layout";
22
- const st = {
16
+ import { Button as lt } from "@progress/kendo-react-buttons";
17
+ import { caretAltDownIcon as it } from "@progress/kendo-svg-icons";
18
+ import { colorPickerAdaptiveTitle as me, messages as L, flatColorPickerCancelBtn as ge, flatColorPickerApplyBtn as ve, colorPickerDropdownButtonAriaLabel as ke } from "../messages/index.mjs";
19
+ import { useLocalization as ct } from "@progress/kendo-react-intl";
20
+ import { AdaptiveMode as st } from "../common/AdaptiveMode.mjs";
21
+ import { ActionSheetContent as ut } from "@progress/kendo-react-layout";
22
+ const dt = {
23
23
  opacity: !0
24
- }, ut = {
25
- palette: nt,
26
- tileSize: at
27
- }, j = (L) => L !== void 0, dt = He(), ke = t.forwardRef((L, Ce) => {
24
+ }, pt = {
25
+ palette: rt,
26
+ tileSize: ot
27
+ }, j = (D) => D !== void 0, ft = Ue(), Ce = t.forwardRef((D, Ee) => {
28
28
  var oe, le;
29
- const Ee = !We(Xe, { component: "ColorPicker" }), o = Ue(dt, L), b = lt(), q = Ke(), {
29
+ const be = !Ke(fe, { component: "ColorPicker" }), we = $e(fe), o = Ge(ft, D), b = ct(), q = Me(), {
30
30
  size: u = k.size,
31
31
  rounded: x = k.rounded,
32
32
  fillMode: _ = k.fillMode,
@@ -36,10 +36,10 @@ const st = {
36
36
  view: d = o.views ? void 0 : k.view,
37
37
  views: c = d ? void 0 : k.views,
38
38
  activeView: J,
39
- popupSettings: v,
40
- valid: be,
39
+ popupSettings: g,
40
+ valid: ye,
41
41
  disabled: N,
42
- tabIndex: we,
42
+ tabIndex: Se,
43
43
  icon: O,
44
44
  svgIcon: F,
45
45
  iconClassName: P,
@@ -47,36 +47,36 @@ const st = {
47
47
  onFocus: H,
48
48
  onBlur: W,
49
49
  onActiveColorClick: U,
50
- className: ye,
51
- adaptive: Se,
52
- adaptiveTitle: Q = b.toLanguageString(fe, D[fe])
53
- } = o, s = t.useRef(null), S = t.useRef(null), T = t.useRef(null), m = t.useRef(null), E = t.useRef(void 0), he = t.useRef(null), [_e, X] = t.useState(!1), [Pe, Te] = t.useState(o.defaultValue || void 0), [Re, Ae] = t.useState(!1), [R, Ie] = t.useState(), K = j(o.value), g = j(o.open), l = K ? o.value : Pe, p = g ? o.open : Re, Y = t.useRef(l), ee = t.useCallback(() => {
50
+ className: he,
51
+ adaptive: _e,
52
+ adaptiveTitle: Q = b.toLanguageString(me, L[me])
53
+ } = o, s = t.useRef(null), S = t.useRef(null), T = t.useRef(null), m = t.useRef(null), E = t.useRef(void 0), Pe = t.useRef(null), [Te, X] = t.useState(!1), [Re, Ae] = t.useState(o.defaultValue || void 0), [Ie, ze] = t.useState(!1), [R, Be] = t.useState(), K = j(o.value), v = j(o.open), l = K ? o.value : Re, p = v ? o.open : Ie, Y = t.useRef(l), ee = t.useCallback(() => {
54
54
  s.current && s.current.focus();
55
55
  }, []);
56
56
  t.useImperativeHandle(
57
- Ce,
57
+ Ee,
58
58
  () => ({
59
59
  // we agreed that each element will have focus method exposed
60
60
  element: s.current,
61
- actionElement: he.current,
61
+ actionElement: Pe.current,
62
62
  value: l,
63
63
  focus: ee
64
64
  }),
65
65
  [l, ee]
66
66
  );
67
- const $ = !!(R && q && R <= q.medium && Se);
67
+ const $ = !!(R && q && R <= q.medium && _e);
68
68
  t.useEffect(() => {
69
- const e = $e && window.ResizeObserver && new window.ResizeObserver(Fe.bind(void 0));
69
+ const e = Ze && window.ResizeObserver && new window.ResizeObserver(He.bind(void 0));
70
70
  return document != null && document.body && e && e.observe(document.body), () => {
71
71
  document != null && document.body && e && e.disconnect();
72
72
  };
73
73
  }, []);
74
74
  const a = t.useCallback(
75
75
  (e, i) => {
76
- g || (!e && !i && s && s.current && s.current.focus(), Ae(e));
76
+ v || (!e && !i && s && s.current && s.current.focus(), ze(e));
77
77
  },
78
- [g]
79
- ), te = t.useMemo(() => new Ge({
78
+ [v]
79
+ ), te = t.useMemo(() => new je({
80
80
  root: s,
81
81
  selectors: [".k-colorpicker", ".k-color-picker-popup"],
82
82
  tabIndex: 0,
@@ -86,7 +86,7 @@ const st = {
86
86
  a(!1);
87
87
  },
88
88
  Enter: (e, i, n) => {
89
- !g && e === s.current && (n.preventDefault(), n.stopPropagation(), a(!0));
89
+ !v && e === s.current && (n.preventDefault(), n.stopPropagation(), a(!0));
90
90
  },
91
91
  ArrowDown: (e, i, n) => {
92
92
  n.altKey && (n.preventDefault(), n.stopPropagation(), a(!0));
@@ -96,16 +96,16 @@ const st = {
96
96
  },
97
97
  Tab: (e, i, n) => {
98
98
  var h, ie, ce;
99
- if (Me(document) !== s.current) {
99
+ if (qe(document) !== s.current) {
100
100
  const se = (h = T.current) == null ? void 0 : h.wrapperRef.current, I = (ie = S.current) == null ? void 0 : ie.wrapperRef.current, ue = (ce = m.current) == null ? void 0 : ce.element;
101
101
  d === "palette" && se ? z(n, se) : d === "gradient" && I ? z(n, I) : d === "combo" && I ? z(n, I.parentElement) : c && ue && z(n, ue);
102
102
  }
103
103
  }
104
104
  }
105
105
  }
106
- }), [a, g]), ze = t.useCallback(te.triggerKeyboardEvent.bind(te), []), Be = t.useCallback(() => {
107
- g || (S.current && S.current.wrapperRef.current ? de(S.current.wrapperRef.current) : T.current ? T.current.focus() : m.current && m.current.element && de(m.current.element));
108
- }, [g]), A = (e) => Y.current = e, ne = t.useCallback(
106
+ }), [a, v]), Le = t.useCallback(te.triggerKeyboardEvent.bind(te), []), De = t.useCallback(() => {
107
+ v || (S.current && S.current.wrapperRef.current ? de(S.current.wrapperRef.current) : T.current ? T.current.focus() : m.current && m.current.element && de(m.current.element));
108
+ }, [v]), A = (e) => Y.current = e, ne = t.useCallback(
109
109
  (e) => {
110
110
  const i = {
111
111
  value: Y.current,
@@ -117,7 +117,7 @@ const st = {
117
117
  [p]
118
118
  ), G = t.useCallback(() => {
119
119
  a(!1, !0);
120
- }, [a]), De = t.useCallback(
120
+ }, [a]), xe = t.useCallback(
121
121
  (e) => {
122
122
  U && U.call(void 0, {
123
123
  syntheticEvent: e,
@@ -130,7 +130,7 @@ const st = {
130
130
  });
131
131
  },
132
132
  [U, l]
133
- ), Le = t.useCallback(
133
+ ), Ne = t.useCallback(
134
134
  (e) => {
135
135
  E.current ? (clearTimeout(E.current), E.current = void 0) : (X(!0), $ && !p && a(!0)), H && H.call(void 0, {
136
136
  nativeEvent: e.nativeEvent,
@@ -138,11 +138,11 @@ const st = {
138
138
  });
139
139
  },
140
140
  [$, H, p, a]
141
- ), xe = t.useCallback(() => {
141
+ ), Oe = t.useCallback(() => {
142
142
  a(!1, !0), X(!1), E.current = void 0;
143
- }, []), Ne = t.useCallback(
143
+ }, []), Fe = t.useCallback(
144
144
  (e) => {
145
- clearTimeout(E.current), E.current = window.setTimeout(xe), W && W.call(void 0, {
145
+ clearTimeout(E.current), E.current = window.setTimeout(Oe), W && W.call(void 0, {
146
146
  nativeEvent: e.nativeEvent,
147
147
  syntheticEvent: e
148
148
  });
@@ -152,7 +152,7 @@ const st = {
152
152
  (e, i) => {
153
153
  var h;
154
154
  const n = i ? e.rgbaValue || "" : (h = e.value) != null ? h : "";
155
- K || Te(n), V && V.call(void 0, {
155
+ K || Ae(n), V && V.call(void 0, {
156
156
  value: n,
157
157
  nativeEvent: e.nativeEvent,
158
158
  syntheticEvent: e.syntheticEvent,
@@ -168,7 +168,7 @@ const st = {
168
168
  [j, f]
169
169
  ), M = t.useCallback(
170
170
  (e) => /* @__PURE__ */ t.createElement(t.Fragment, null, (d === "combo" || d === "gradient") && /* @__PURE__ */ t.createElement(
171
- et,
171
+ nt,
172
172
  {
173
173
  ...C,
174
174
  _adaptive: e,
@@ -180,7 +180,7 @@ const st = {
180
180
  onChange: f
181
181
  }
182
182
  ), (d === "combo" || d === "palette") && /* @__PURE__ */ t.createElement(
183
- tt,
183
+ at,
184
184
  {
185
185
  ...w,
186
186
  ref: T,
@@ -248,7 +248,7 @@ const st = {
248
248
  onChange: f,
249
249
  setAdaptiveModeValue: A
250
250
  }
251
- ), Ee && /* @__PURE__ */ t.createElement(Ze, null)),
251
+ ), be && /* @__PURE__ */ t.createElement(Je, { message: we })),
252
252
  [
253
253
  J,
254
254
  _,
@@ -263,24 +263,24 @@ const st = {
263
263
  d,
264
264
  c
265
265
  ]
266
- ), Oe = t.useCallback(() => {
266
+ ), Ve = t.useCallback(() => {
267
267
  var i;
268
268
  const e = {
269
- animation: !!((i = v == null ? void 0 : v.animate) == null || i),
269
+ animation: !!((i = g == null ? void 0 : g.animate) == null || i),
270
270
  title: Q,
271
271
  expand: p,
272
272
  onClose: G,
273
273
  windowWidth: R,
274
274
  footer: {
275
- cancelText: b.toLanguageString(me, D[me]),
275
+ cancelText: b.toLanguageString(ge, L[ge]),
276
276
  onCancel: G,
277
- applyText: b.toLanguageString(ve, D[ve]),
277
+ applyText: b.toLanguageString(ve, L[ve]),
278
278
  onApply: ne
279
279
  }
280
280
  };
281
- return /* @__PURE__ */ t.createElement(it, { ...e }, /* @__PURE__ */ t.createElement(ct, null, M(!0)));
281
+ return /* @__PURE__ */ t.createElement(st, { ...e }, /* @__PURE__ */ t.createElement(ut, null, M(!0)));
282
282
  }, [
283
- v == null ? void 0 : v.animate,
283
+ g == null ? void 0 : g.animate,
284
284
  Q,
285
285
  p,
286
286
  G,
@@ -288,10 +288,10 @@ const st = {
288
288
  b,
289
289
  ne,
290
290
  M
291
- ]), Fe = t.useCallback((e) => {
291
+ ]), He = t.useCallback((e) => {
292
292
  for (const i of e)
293
- Ie(i.target.clientWidth);
294
- }, []), re = je(s, o.dir), Ve = be !== !1;
293
+ Be(i.target.clientWidth);
294
+ }, []), re = Qe(s, o.dir), We = ye !== !1;
295
295
  return /* @__PURE__ */ t.createElement(
296
296
  "span",
297
297
  {
@@ -308,28 +308,28 @@ const st = {
308
308
  [`k-picker-${pe.sizeMap[u] || u}`]: u,
309
309
  [`k-picker-${_}`]: _,
310
310
  [`k-rounded-${pe.roundedMap[x] || x}`]: x,
311
- "k-invalid": !Ve,
311
+ "k-invalid": !We,
312
312
  "k-disabled": N,
313
- "k-focus": _e,
314
- className: ye
313
+ "k-focus": Te,
314
+ className: he
315
315
  }),
316
316
  ref: s,
317
- tabIndex: qe(we, N),
317
+ tabIndex: Xe(Se, N),
318
318
  title: o.title,
319
- onKeyDown: ze,
320
- onFocus: Le,
321
- onBlur: Ne,
319
+ onKeyDown: Le,
320
+ onFocus: Ne,
321
+ onBlur: Fe,
322
322
  dir: re
323
323
  },
324
324
  /* @__PURE__ */ t.createElement(
325
- Ye,
325
+ tt,
326
326
  {
327
327
  dir: re,
328
328
  open: p,
329
- onOpen: Be,
329
+ onOpen: De,
330
330
  popupAnchor: s.current || void 0,
331
- popupSettings: { id: `k-colorpicker-popup-${(le = o.id) != null ? le : 0}`, ...v },
332
- input: /* @__PURE__ */ t.createElement("span", { onClick: De, className: "k-input-inner" }, /* @__PURE__ */ t.createElement(
331
+ popupSettings: { id: `k-colorpicker-popup-${(le = o.id) != null ? le : 0}`, ...g },
332
+ input: /* @__PURE__ */ t.createElement("span", { onClick: xe, className: "k-input-inner" }, /* @__PURE__ */ t.createElement(
333
333
  "span",
334
334
  {
335
335
  className: Z("k-value-icon", "k-color-preview", {
@@ -338,11 +338,11 @@ const st = {
338
338
  })
339
339
  },
340
340
  P && /* @__PURE__ */ t.createElement("span", { className: Z("k-color-preview-icon", P) }),
341
- !P && (O || F) && /* @__PURE__ */ t.createElement(Je, { name: O, icon: F }),
341
+ !P && (O || F) && /* @__PURE__ */ t.createElement(Ye, { name: O, icon: F }),
342
342
  /* @__PURE__ */ t.createElement("span", { className: "k-color-preview-mask", style: { backgroundColor: l } })
343
343
  )),
344
344
  button: /* @__PURE__ */ t.createElement(
345
- rt,
345
+ lt,
346
346
  {
347
347
  tabIndex: -1,
348
348
  type: "button",
@@ -350,21 +350,21 @@ const st = {
350
350
  className: "k-input-button",
351
351
  rounded: null,
352
352
  icon: "caret-alt-down",
353
- svgIcon: ot,
353
+ svgIcon: it,
354
354
  "aria-label": b.toLanguageString(
355
- ge,
356
- D[ge]
355
+ ke,
356
+ L[ke]
357
357
  )
358
358
  }
359
359
  ),
360
360
  content: M(!1),
361
361
  _mobileMode: $,
362
- _actionSheet: Oe()
362
+ _actionSheet: Ve()
363
363
  }
364
364
  )
365
365
  );
366
366
  });
367
- ke.propTypes = {
367
+ Ce.propTypes = {
368
368
  value: r.string,
369
369
  defaultValue: r.string,
370
370
  disabled: r.bool,
@@ -373,7 +373,7 @@ ke.propTypes = {
373
373
  dir: r.string,
374
374
  id: r.string,
375
375
  icon: r.string,
376
- svgIcon: Qe,
376
+ svgIcon: et,
377
377
  ariaLabelledBy: r.string,
378
378
  ariaDescribedBy: r.string,
379
379
  size: r.oneOf([null, "small", "medium", "large"]),
@@ -390,11 +390,11 @@ const k = {
390
390
  fillMode: "solid",
391
391
  view: "palette",
392
392
  views: ["gradient", "palette"],
393
- gradientSettings: st,
394
- paletteSettings: ut
393
+ gradientSettings: dt,
394
+ paletteSettings: pt
395
395
  };
396
- ke.displayName = "KendoColorPicker";
396
+ Ce.displayName = "KendoColorPicker";
397
397
  export {
398
- ke as ColorPicker,
399
- dt as ColorPickerPropsContext
398
+ Ce as ColorPicker,
399
+ ft as ColorPickerPropsContext
400
400
  };
@@ -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 J=require("react"),o=require("prop-types"),n=require("@progress/kendo-react-common"),s=require("@progress/kendo-react-buttons"),f=require("@progress/kendo-svg-icons"),Q=require("./ColorPalette.js"),U=require("./ColorGradient.js"),X=require("../package-metadata.js"),Y=require("@progress/kendo-react-intl"),l=require("../messages/index.js");function Z(e){const h=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const b in e)if(b!=="default"){const v=Object.getOwnPropertyDescriptor(e,b);Object.defineProperty(h,b,v.get?v:{enumerable:!0,get:()=>e[b]})}}return h.default=e,Object.freeze(h)}const t=Z(J),M=t.forwardRef((e,h)=>{const b=!n.validatePackage(X.packageMetadata,{component:"FlatColorPicker"}),v=t.useRef(null),B=t.useRef(null),A=t.useRef(null),{defaultValue:E,showButtons:w=!0,showPreview:x=!0,showClearButton:F=!0,view:P=e.views?void 0:"ColorGradient",views:d=P?void 0:["gradient","palette"],activeView:N="gradient",size:i="medium"}=e,[C,z]=t.useState((P||"ColorGradient")==="ColorGradient"),[g,V]=t.useState((d!=null?d:[])[0]==="gradient"&&N==="gradient"),[c,y]=t.useState(e.value||E||void 0),[k,G]=t.useState(e.value||E||void 0),_=e.value!==void 0?e.value:void 0;t.useEffect(()=>{y(e.value)},[e.value]);const m=Y.useLocalization(),L=t.useCallback(()=>{v.current&&v.current.focus()},[v]);t.useImperativeHandle(v,()=>({element:B.current,focus:L,props:e,value:_}),[_,L,e]),t.useImperativeHandle(h,()=>v.current);const R=t.useCallback(a=>{(a==="ColorGradient"&&!C||a==="ColorPalette"&&C)&&z(!C)},[C]),S=t.useCallback(a=>{a==="gradient"&&!g||a==="palette"&&g||a==="palette"&&N==="gradient"?V(!g):a==="gradient"&&N==="palette"&&V(!0)},[N,g]),T=t.useCallback(a=>{var u;const r=E||void 0;if(y(r),G(r),(u=e._gradientSettings)!=null&&u._adaptive&&e.setAdaptiveModeValue&&e.setAdaptiveModeValue(r),e.onPreviewChange){const I={value:r,nativeEvent:a.nativeEvent,syntheticEvent:a};e.onPreviewChange.call(void 0,I)}},[E,e.onPreviewChange]),q=t.useCallback(a=>{var r;if(y(a.value),e.onPreviewChange){const u={value:a.value,nativeEvent:a.nativeEvent,syntheticEvent:a.syntheticEvent};e.onPreviewChange.call(void 0,u)}(r=e._gradientSettings)!=null&&r._adaptive&&e.setAdaptiveModeValue&&e.setAdaptiveModeValue(a.value)},[e.onPreviewChange]),j=t.useCallback(a=>{if(c!==void 0&&G(c),e.onChange){const r={value:c,nativeEvent:a.nativeEvent,syntheticEvent:a};e.onChange.call(void 0,r)}},[c,e.onChange]),D=t.useCallback(()=>{y(k),e.setOpen&&e.setOpen(!1)},[k]),K=t.useCallback(a=>{if(y(k),e.onPreviewChange){const r={value:k,nativeEvent:a.nativeEvent,syntheticEvent:a};e.onPreviewChange.call(void 0,r)}},[k,e.onPreviewChange]),H=t.useCallback(a=>{var u,I;if((!a.relatedTarget||!((u=B.current)!=null&&u.contains(a.relatedTarget)))&&!((I=e._gradientSettings)!=null&&I._adaptive)&&(!w&&c!==void 0&&G(c),!w&&e.onChange)){const $={value:c,nativeEvent:a.nativeEvent,syntheticEvent:a};e.onChange.call(void 0,$)}},[c,w,e.onChange]),O=t.useMemo(()=>new n.Navigation({root:B,selectors:[".k-coloreditor"],tabIndex:0,keyboardEvents:{keydown:{Tab:(a,r,u)=>{n.getActiveElement(document)===a?n.disableNavigatableContainer(a):n.keepFocusInContainer(u,a)},Enter:(a,r,u)=>{n.getActiveElement(document)===a&&(n.focusFirstFocusableChild(a),n.enableNavigatableContainer(a))},Escape:(a,r,u)=>{n.getActiveElement(document)!==a&&(a.focus(),n.disableNavigatableContainer(a))}}}}),[]),W=t.useCallback(O.triggerKeyboardEvent.bind(O),[]);return t.createElement("div",{id:e.id,role:"textbox","aria-label":e.ariaLabel,"aria-labelledby":e.ariaLabelledBy,"aria-disabled":e.disabled?"true":void 0,style:{position:"relative",...e.style},ref:B,tabIndex:n.getTabIndex(e.tabIndex,e.disabled),className:n.classNames("k-flatcolorpicker k-coloreditor",{[`k-coloreditor-${n.kendoThemeMaps.sizeMap[i]||i}`]:i,"k-disabled":e.disabled},e.className),onBlur:H,onKeyDown:W},e.header||t.createElement("div",{className:"k-coloreditor-header k-hstack"},t.createElement("div",{className:"k-coloreditor-header-actions k-hstack"},d&&d[0]==="gradient"&&d[1]==="palette"&&t.createElement(s.ButtonGroup,{className:"k-button-group-flat"},t.createElement(s.Button,{type:"button","aria-label":m.toLanguageString(l.flatColorPickerColorGradientBtn,l.messages[l.flatColorPickerColorGradientBtn]),togglable:!0,fillMode:"flat",size:i,svgIcon:f.dropletSliderIcon,selected:g,onClick:()=>S("gradient")}),t.createElement(s.Button,{type:"button","aria-label":m.toLanguageString(l.flatColorPickerColorPaletteBtn,l.messages[l.flatColorPickerColorPaletteBtn]),togglable:!0,fillMode:"flat",size:i,svgIcon:f.paletteIcon,selected:!g,onClick:()=>S("palette")})),d&&d[0]==="palette"&&d[1]==="gradient"&&t.createElement(s.ButtonGroup,{className:"k-button-group-flat"},t.createElement(s.Button,{type:"button","aria-label":m.toLanguageString(l.flatColorPickerColorPaletteBtn,l.messages[l.flatColorPickerColorPaletteBtn]),togglable:!0,fillMode:"flat",size:i,svgIcon:f.paletteIcon,selected:!g,onClick:()=>S("palette")}),t.createElement(s.Button,{type:"button","aria-label":m.toLanguageString(l.flatColorPickerColorGradientBtn,l.messages[l.flatColorPickerColorGradientBtn]),togglable:!0,fillMode:"flat",size:i,svgIcon:f.dropletSliderIcon,selected:g,onClick:()=>S("gradient")})),P&&t.createElement(s.ButtonGroup,{className:"k-button-group-flat"},t.createElement(s.Button,{type:"button","aria-label":m.toLanguageString(l.flatColorPickerColorGradientBtn,l.messages[l.flatColorPickerColorGradientBtn]),togglable:!0,fillMode:"flat",size:i,selected:C,onClick:()=>R("ColorGradient"),icon:"droplet-slider",svgIcon:f.dropletSliderIcon}),t.createElement(s.Button,{type:"button","aria-label":m.toLanguageString(l.flatColorPickerColorPaletteBtn,l.messages[l.flatColorPickerColorPaletteBtn]),togglable:!0,fillMode:"flat",size:i,selected:!C,onClick:()=>R("ColorPalette"),icon:"palette",svgIcon:f.paletteIcon}))),t.createElement("div",{className:"k-spacer"}),t.createElement("div",{className:"k-coloreditor-header-actions k-hstack"},F&&t.createElement(s.Button,{type:"button",fillMode:"flat",size:i,onClick:T,"aria-label":m.toLanguageString(l.flatColorPickerClearBtn,l.messages[l.flatColorPickerClearBtn]),icon:"droplet-slash",svgIcon:f.dropletSlashIcon}),x&&t.createElement("div",{className:"k-coloreditor-preview k-vstack"},t.createElement("span",{className:n.classNames("k-coloreditor-preview-color","k-color-preview",{"k-no-color":_===void 0})},t.createElement("span",{className:"k-color-preview-mask",style:{background:c||void 0}})),t.createElement("span",{className:n.classNames("k-coloreditor-current-color","k-color-preview",{"k-no-color":k===void 0}),onClick:K},t.createElement("span",{className:"k-color-preview-mask",style:{background:k||void 0}})))),b&&t.createElement(n.WatermarkOverlay,null)),t.createElement("div",{className:"k-coloreditor-views k-vstack"},(P&&C||d&&g)&&t.createElement(U.ColorGradient,{ref:A,role:"none",ariaLabel:void 0,value:c,onChange:q,opacity:e.opacity,format:e.format,size:i,_adaptive:e._gradientSettings?e._gradientSettings._adaptive:void 0,...e._gradientSettings}),(P&&!C||d&&!g)&&t.createElement(Q.ColorPalette,{ariaDisabled:!0,ariaLabelledBy:"required_label",value:c,onChange:q,size:i,...e._paletteSettings})),w&&t.createElement("div",{className:"k-coloreditor-footer k-actions k-actions-start k-actions-horizontal"},t.createElement(s.Button,{type:"button",themeColor:"primary",className:"k-coloreditor-apply",size:i,onClick:j},l.messages[l.flatColorPickerApplyBtn]),t.createElement(s.Button,{type:"button",className:"k-coloreditor-cancel",size:i,onClick:D},l.messages[l.flatColorPickerCancelBtn])))}),p={id:o.string,style:o.any,className:o.string,value:o.string,defaultValue:o.string,onPreviewChange:o.func,onChange:o.func,opacity:o.bool,format:o.any,tabIndex:o.number,ariaLabel:o.string,ariaLabelledBy:o.string,disabled:o.bool,view:o.any,header:o.any,showClearButton:o.bool,showPreview:o.bool,showButtons:o.bool,views:o.array,size:o.oneOf([null,"small","medium","large"])};M.displayName="KendoFlatColorPicker";M.propTypes=p;exports.FlatColorPicker=M;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const U=require("react"),o=require("prop-types"),n=require("@progress/kendo-react-common"),s=require("@progress/kendo-react-buttons"),m=require("@progress/kendo-svg-icons"),X=require("./ColorPalette.js"),Y=require("./ColorGradient.js"),x=require("../package-metadata.js"),Z=require("@progress/kendo-react-intl"),l=require("../messages/index.js");function p(e){const b=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const f in e)if(f!=="default"){const B=Object.getOwnPropertyDescriptor(e,f);Object.defineProperty(b,f,B.get?B:{enumerable:!0,get:()=>e[f]})}}return b.default=e,Object.freeze(b)}const t=p(U),L=t.forwardRef((e,b)=>{const f=!n.validatePackage(x.packageMetadata,{component:"FlatColorPicker"}),B=n.getLicenseMessage(x.packageMetadata),h=t.useRef(null),w=t.useRef(null),F=t.useRef(null),{defaultValue:E,showButtons:N=!0,showPreview:z=!0,showClearButton:T=!0,view:P=e.views?void 0:"ColorGradient",views:d=P?void 0:["gradient","palette"],activeView:S="gradient",size:i="medium"}=e,[v,j]=t.useState((P||"ColorGradient")==="ColorGradient"),[g,V]=t.useState((d!=null?d:[])[0]==="gradient"&&S==="gradient"),[c,y]=t.useState(e.value||E||void 0),[C,M]=t.useState(e.value||E||void 0),_=e.value!==void 0?e.value:void 0;t.useEffect(()=>{y(e.value)},[e.value]);const k=Z.useLocalization(),R=t.useCallback(()=>{h.current&&h.current.focus()},[h]);t.useImperativeHandle(h,()=>({element:w.current,focus:R,props:e,value:_}),[_,R,e]),t.useImperativeHandle(b,()=>h.current);const q=t.useCallback(a=>{(a==="ColorGradient"&&!v||a==="ColorPalette"&&v)&&j(!v)},[v]),I=t.useCallback(a=>{a==="gradient"&&!g||a==="palette"&&g||a==="palette"&&S==="gradient"?V(!g):a==="gradient"&&S==="palette"&&V(!0)},[S,g]),D=t.useCallback(a=>{var u;const r=E||void 0;if(y(r),M(r),(u=e._gradientSettings)!=null&&u._adaptive&&e.setAdaptiveModeValue&&e.setAdaptiveModeValue(r),e.onPreviewChange){const G={value:r,nativeEvent:a.nativeEvent,syntheticEvent:a};e.onPreviewChange.call(void 0,G)}},[E,e.onPreviewChange]),O=t.useCallback(a=>{var r;if(y(a.value),e.onPreviewChange){const u={value:a.value,nativeEvent:a.nativeEvent,syntheticEvent:a.syntheticEvent};e.onPreviewChange.call(void 0,u)}(r=e._gradientSettings)!=null&&r._adaptive&&e.setAdaptiveModeValue&&e.setAdaptiveModeValue(a.value)},[e.onPreviewChange]),K=t.useCallback(a=>{if(c!==void 0&&M(c),e.onChange){const r={value:c,nativeEvent:a.nativeEvent,syntheticEvent:a};e.onChange.call(void 0,r)}},[c,e.onChange]),H=t.useCallback(()=>{y(C),e.setOpen&&e.setOpen(!1)},[C]),W=t.useCallback(a=>{if(y(C),e.onPreviewChange){const r={value:C,nativeEvent:a.nativeEvent,syntheticEvent:a};e.onPreviewChange.call(void 0,r)}},[C,e.onPreviewChange]),$=t.useCallback(a=>{var u,G;if((!a.relatedTarget||!((u=w.current)!=null&&u.contains(a.relatedTarget)))&&!((G=e._gradientSettings)!=null&&G._adaptive)&&(!N&&c!==void 0&&M(c),!N&&e.onChange)){const Q={value:c,nativeEvent:a.nativeEvent,syntheticEvent:a};e.onChange.call(void 0,Q)}},[c,N,e.onChange]),A=t.useMemo(()=>new n.Navigation({root:w,selectors:[".k-coloreditor"],tabIndex:0,keyboardEvents:{keydown:{Tab:(a,r,u)=>{n.getActiveElement(document)===a?n.disableNavigatableContainer(a):n.keepFocusInContainer(u,a)},Enter:(a,r,u)=>{n.getActiveElement(document)===a&&(n.focusFirstFocusableChild(a),n.enableNavigatableContainer(a))},Escape:(a,r,u)=>{n.getActiveElement(document)!==a&&(a.focus(),n.disableNavigatableContainer(a))}}}}),[]),J=t.useCallback(A.triggerKeyboardEvent.bind(A),[]);return t.createElement("div",{id:e.id,role:"textbox","aria-label":e.ariaLabel,"aria-labelledby":e.ariaLabelledBy,"aria-disabled":e.disabled?"true":void 0,style:{position:"relative",...e.style},ref:w,tabIndex:n.getTabIndex(e.tabIndex,e.disabled),className:n.classNames("k-flatcolorpicker k-coloreditor",{[`k-coloreditor-${n.kendoThemeMaps.sizeMap[i]||i}`]:i,"k-disabled":e.disabled},e.className),onBlur:$,onKeyDown:J},e.header||t.createElement("div",{className:"k-coloreditor-header k-hstack"},t.createElement("div",{className:"k-coloreditor-header-actions k-hstack"},d&&d[0]==="gradient"&&d[1]==="palette"&&t.createElement(s.ButtonGroup,{className:"k-button-group-flat"},t.createElement(s.Button,{type:"button","aria-label":k.toLanguageString(l.flatColorPickerColorGradientBtn,l.messages[l.flatColorPickerColorGradientBtn]),togglable:!0,fillMode:"flat",size:i,svgIcon:m.dropletSliderIcon,selected:g,onClick:()=>I("gradient")}),t.createElement(s.Button,{type:"button","aria-label":k.toLanguageString(l.flatColorPickerColorPaletteBtn,l.messages[l.flatColorPickerColorPaletteBtn]),togglable:!0,fillMode:"flat",size:i,svgIcon:m.paletteIcon,selected:!g,onClick:()=>I("palette")})),d&&d[0]==="palette"&&d[1]==="gradient"&&t.createElement(s.ButtonGroup,{className:"k-button-group-flat"},t.createElement(s.Button,{type:"button","aria-label":k.toLanguageString(l.flatColorPickerColorPaletteBtn,l.messages[l.flatColorPickerColorPaletteBtn]),togglable:!0,fillMode:"flat",size:i,svgIcon:m.paletteIcon,selected:!g,onClick:()=>I("palette")}),t.createElement(s.Button,{type:"button","aria-label":k.toLanguageString(l.flatColorPickerColorGradientBtn,l.messages[l.flatColorPickerColorGradientBtn]),togglable:!0,fillMode:"flat",size:i,svgIcon:m.dropletSliderIcon,selected:g,onClick:()=>I("gradient")})),P&&t.createElement(s.ButtonGroup,{className:"k-button-group-flat"},t.createElement(s.Button,{type:"button","aria-label":k.toLanguageString(l.flatColorPickerColorGradientBtn,l.messages[l.flatColorPickerColorGradientBtn]),togglable:!0,fillMode:"flat",size:i,selected:v,onClick:()=>q("ColorGradient"),icon:"droplet-slider",svgIcon:m.dropletSliderIcon}),t.createElement(s.Button,{type:"button","aria-label":k.toLanguageString(l.flatColorPickerColorPaletteBtn,l.messages[l.flatColorPickerColorPaletteBtn]),togglable:!0,fillMode:"flat",size:i,selected:!v,onClick:()=>q("ColorPalette"),icon:"palette",svgIcon:m.paletteIcon}))),t.createElement("div",{className:"k-spacer"}),t.createElement("div",{className:"k-coloreditor-header-actions k-hstack"},T&&t.createElement(s.Button,{type:"button",fillMode:"flat",size:i,onClick:D,"aria-label":k.toLanguageString(l.flatColorPickerClearBtn,l.messages[l.flatColorPickerClearBtn]),icon:"droplet-slash",svgIcon:m.dropletSlashIcon}),z&&t.createElement("div",{className:"k-coloreditor-preview k-vstack"},t.createElement("span",{className:n.classNames("k-coloreditor-preview-color","k-color-preview",{"k-no-color":_===void 0})},t.createElement("span",{className:"k-color-preview-mask",style:{background:c||void 0}})),t.createElement("span",{className:n.classNames("k-coloreditor-current-color","k-color-preview",{"k-no-color":C===void 0}),onClick:W},t.createElement("span",{className:"k-color-preview-mask",style:{background:C||void 0}})))),f&&t.createElement(n.WatermarkOverlay,{message:B})),t.createElement("div",{className:"k-coloreditor-views k-vstack"},(P&&v||d&&g)&&t.createElement(Y.ColorGradient,{ref:F,role:"none",ariaLabel:void 0,value:c,onChange:O,opacity:e.opacity,format:e.format,size:i,_adaptive:e._gradientSettings?e._gradientSettings._adaptive:void 0,...e._gradientSettings}),(P&&!v||d&&!g)&&t.createElement(X.ColorPalette,{ariaDisabled:!0,ariaLabelledBy:"required_label",value:c,onChange:O,size:i,...e._paletteSettings})),N&&t.createElement("div",{className:"k-coloreditor-footer k-actions k-actions-start k-actions-horizontal"},t.createElement(s.Button,{type:"button",themeColor:"primary",className:"k-coloreditor-apply",size:i,onClick:K},l.messages[l.flatColorPickerApplyBtn]),t.createElement(s.Button,{type:"button",className:"k-coloreditor-cancel",size:i,onClick:H},l.messages[l.flatColorPickerCancelBtn])))}),ee={id:o.string,style:o.any,className:o.string,value:o.string,defaultValue:o.string,onPreviewChange:o.func,onChange:o.func,opacity:o.bool,format:o.any,tabIndex:o.number,ariaLabel:o.string,ariaLabelledBy:o.string,disabled:o.bool,view:o.any,header:o.any,showClearButton:o.bool,showPreview:o.bool,showButtons:o.bool,views:o.array,size:o.oneOf([null,"small","medium","large"])};L.displayName="KendoFlatColorPicker";L.propTypes=ee;exports.FlatColorPicker=L;